@xopcai/xopc 0.0.353 → 0.0.355
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-YogQEteU.js +1 -0
- package/dist/gateway/static/root/assets/activity-store-X7CG9pzB.js +1 -0
- package/dist/gateway/static/root/assets/{agent-avatar-dicebear-BVIuZcCP.js → agent-avatar-dicebear-DiEBNuSv.js} +1 -1
- package/dist/gateway/static/root/assets/agent-defaults-settings-panel-DpBmB3QX.js +1 -0
- package/dist/gateway/static/root/assets/agent-plugin-dialog-DlojWUY_.js +1 -0
- package/dist/gateway/static/root/assets/agents-CeSCdUHP.js +66 -0
- package/dist/gateway/static/root/assets/app-chrome-BeB4KgOf.js +1 -0
- package/dist/gateway/static/root/assets/app-management-settings-panel-MkSa6isi.js +1 -0
- package/dist/gateway/static/root/assets/appearance-settings-B7hCkaT_.js +1 -0
- package/dist/gateway/static/root/assets/apps-page-D_CduJuC.js +1 -0
- package/dist/gateway/static/root/assets/{archive-plugin-BZXXJvpX.js → archive-plugin-QfOaQPL_.js} +1 -1
- package/dist/gateway/static/root/assets/{automations-page-C7VKkDb5.js → automations-page-uEnQawd7.js} +1 -1
- package/dist/gateway/static/root/assets/automations-workspace-pdiSK3Qk.js +7 -0
- package/dist/gateway/static/root/assets/{binary-plugins-DoT3g5SP.js → binary-plugins-BF2lVwR9.js} +1 -1
- package/dist/gateway/static/root/assets/{block-editor-sqqrCafh.js → block-editor-r4mKGacz.js} +39 -39
- package/dist/gateway/static/root/assets/bot-DjLkhyZL.js +1 -0
- package/dist/gateway/static/root/assets/{browser-automation-inputs-CZOKsAaa.js → browser-automation-inputs-FW3bYZ-z.js} +1 -1
- package/dist/gateway/static/root/assets/{browser-automations-page-TEeTmkGP.js → browser-automations-page-Blrxyy_h.js} +2 -2
- package/dist/gateway/static/root/assets/browser-settings-page-DGuwrO7j.js +3 -0
- package/dist/gateway/static/root/assets/{capabilities-BOrLei_L.js → capabilities-BCF_160Z.js} +1 -1
- package/dist/gateway/static/root/assets/capabilities-CF4-mrIa.js +1 -0
- package/dist/gateway/static/root/assets/capabilities-page-DUIA2K--.js +2 -0
- package/dist/gateway/static/root/assets/capabilities-settings-panel-CwPNQsJS.js +8 -0
- package/dist/gateway/static/root/assets/capability-header-actions-CyvI2F5x.js +1 -0
- package/dist/gateway/static/root/assets/channels-DBxDJV8I.js +1 -0
- package/dist/gateway/static/root/assets/{chat-terminal-dock-Q99iKyiO.js → chat-terminal-dock-YdxhecE7.js} +2 -2
- package/dist/gateway/static/root/assets/chevron-right-BweFrslA.js +1 -0
- package/dist/gateway/static/root/assets/circle-alert-BEjgurr2.js +1 -0
- package/dist/gateway/static/root/assets/circle-dashed-8qMD7gHf.js +1 -0
- package/dist/gateway/static/root/assets/circle-dot-BAseJTrF.js +1 -0
- package/dist/gateway/static/root/assets/circle-pause-CN9jYH2s.js +1 -0
- package/dist/gateway/static/root/assets/clock-3-DnrAnuyZ.js +1 -0
- package/dist/gateway/static/root/assets/cloud-C4-yfnnk.js +1 -0
- package/dist/gateway/static/root/assets/computer-settings-page-BuCrA8yD.js +1 -0
- package/dist/gateway/static/root/assets/connector-service-page-BiB2GYkp.js +1 -0
- package/dist/gateway/static/root/assets/connectors-page-nQAgZk-5.js +2 -0
- package/dist/gateway/static/root/assets/copy-text-row-BHDs3cBa.js +1 -0
- package/dist/gateway/static/root/assets/date-picker-BJtADyRQ.js +1 -0
- package/dist/gateway/static/root/assets/{dependency-picker-BjH8XrKb.js → dependency-picker-D-Ko0G40.js} +1 -1
- package/dist/gateway/static/root/assets/{desktop-pet-DyGxNAVW.js → desktop-pet-CVPWcWwC.js} +1 -1
- package/dist/gateway/static/root/assets/desktop-pet-settings-BcN_I-7y.js +1 -0
- package/dist/gateway/static/root/assets/device-pairing-wizard-CoKKoUlt.js +1 -0
- package/dist/gateway/static/root/assets/directory-picker-path-field-m0CubGEP.js +1 -0
- package/dist/gateway/static/root/assets/dist-3h6cXXhT.js +1 -0
- package/dist/gateway/static/root/assets/dist-Che_jiQF.js +1 -0
- package/dist/gateway/static/root/assets/extension-debug-page-BrGWLJg9.js +1 -0
- package/dist/gateway/static/root/assets/extension-page-Dd88ynHj.js +1 -0
- package/dist/gateway/static/root/assets/extension-provider-CUpbXB2k.js +1 -0
- package/dist/gateway/static/root/assets/extension-settings-page-Dq1MXh6D.js +1 -0
- package/dist/gateway/static/root/assets/form-field-width-DJw_jULe.js +1 -0
- package/dist/gateway/static/root/assets/gateway-settings-C_bTRQeE.js +1 -0
- package/dist/gateway/static/root/assets/git-branch-Dh9uxTot.js +1 -0
- package/dist/gateway/static/root/assets/home-page-xbqSikkK.js +1 -0
- package/dist/gateway/static/root/assets/imports-page-Cd4tcbLU.js +1 -0
- package/dist/gateway/static/root/assets/index-BuzC93X-.css +1 -0
- package/dist/gateway/static/root/assets/index-CYeGnj-L.js +106 -0
- package/dist/gateway/static/root/assets/index.module-Cd9ENXfk.js +1 -0
- package/dist/gateway/static/root/assets/interaction-BdhHBbYa.js +1 -0
- package/dist/gateway/static/root/assets/is-masked-secret-DOkL5b_X.js +1 -0
- package/dist/gateway/static/root/assets/{keyboard-shortcuts-settings-CoYdyBRh.js → keyboard-shortcuts-settings-CmalfzgQ.js} +1 -1
- package/dist/gateway/static/root/assets/local-app-workbench-page-BquHHLj6.js +1 -0
- package/dist/gateway/static/root/assets/{local-apps-page-CeBhXeoX.js → local-apps-page-RPLHMvYs.js} +1 -1
- package/dist/gateway/static/root/assets/logs-page-7NMGltSw.js +2 -0
- package/dist/gateway/static/root/assets/management-settings-zwFewbhp.js +1 -0
- package/dist/gateway/static/root/assets/markdown-view-7tzqIp_G.js +201 -0
- package/dist/gateway/static/root/assets/{media-plugins-C9ya5rUH.js → media-plugins-cjgrKnne.js} +1 -1
- package/dist/gateway/static/root/assets/message-square-fVE7Ghj1.js +1 -0
- package/dist/gateway/static/root/assets/mic-CuUb7zc-.js +1 -0
- package/dist/gateway/static/root/assets/model-display-name-DXhO9rcM.js +1 -0
- package/dist/gateway/static/root/assets/models-hub-cache-HGrORbzR.js +1 -0
- package/dist/gateway/static/root/assets/note-detail-panel-CwMg9cvF.js +5 -0
- package/dist/gateway/static/root/assets/notes-api-J0yhflxC.js +1 -0
- package/dist/gateway/static/root/assets/notes-page-CWJwrvo7.js +8 -0
- package/dist/gateway/static/root/assets/oauth-api-CYe61zfD.js +1 -0
- package/dist/gateway/static/root/assets/page-context-capture-button-DqmAq4Ov.js +1 -0
- package/dist/gateway/static/root/assets/page-tabs-D2xpUV26.js +1 -0
- package/dist/gateway/static/root/assets/pause-DuPxgSxk.js +1 -0
- package/dist/gateway/static/root/assets/personal-page-Bbgx_dgV.js +1 -0
- package/dist/gateway/static/root/assets/play-kxZvpBg8.js +1 -0
- package/dist/gateway/static/root/assets/popover-select-DcsFzD_i.js +1 -0
- package/dist/gateway/static/root/assets/preview-open-alternatives-Dvey7GwU.js +1 -0
- package/dist/gateway/static/root/assets/{product-open-page-DUPsiVP9.js → product-open-page-SsG2sljT.js} +1 -1
- package/dist/gateway/static/root/assets/project-detail-page-wp5cFhM7.js +1 -0
- package/dist/gateway/static/root/assets/projects-page-Brfi519S.js +1 -0
- package/dist/gateway/static/root/assets/remote-access-hub-BdtF8Cvk.js +1 -0
- package/dist/gateway/static/root/assets/rotate-ccw-JM1TBLpp.js +1 -0
- package/dist/gateway/static/root/assets/{runtime-tools-settings-panel-C25xEYTK.js → runtime-tools-settings-panel-CT6HKczq.js} +2 -2
- package/dist/gateway/static/root/assets/scenes-page-BmlI42OR.js +2 -0
- package/dist/gateway/static/root/assets/schema-form-DEcsbgne.js +1 -0
- package/dist/gateway/static/root/assets/secret-input-DPl3VYM8.js +1 -0
- package/dist/gateway/static/root/assets/send-session-input-C7Nqy0sK.js +1 -0
- package/dist/gateway/static/root/assets/sessions-page-C_G8fZwV.js +1 -0
- package/dist/gateway/static/root/assets/settings-2-D-csvaET.js +1 -0
- package/dist/gateway/static/root/assets/settings-advanced-gate-CDxdzwDs.js +1 -0
- package/dist/gateway/static/root/assets/settings-form-draft-Dy10ldo8.js +1 -0
- package/dist/gateway/static/root/assets/settings-form-section-exRhP9xn.js +1 -0
- package/dist/gateway/static/root/assets/{settings-page-DqCJHcdG.js → settings-page-P50kLPUz.js} +1 -1
- package/dist/gateway/static/root/assets/setup-status-panel-DtnwH0wN.js +1 -0
- package/dist/gateway/static/root/assets/share-link-dialog-COlX10Dc.js +1 -0
- package/dist/gateway/static/root/assets/share-preview-page-NtRLUieq.js +2 -0
- package/dist/gateway/static/root/assets/shares-api-DICV5EKH.js +1 -0
- package/dist/gateway/static/root/assets/shares-settings-7Ak_MsJg.js +1 -0
- package/dist/gateway/static/root/assets/skill-api-CcdHQhxd.js +1 -0
- package/dist/gateway/static/root/assets/skill-api-utils-C7V4JVXM.js +1 -0
- package/dist/gateway/static/root/assets/skill-reload-api-CWH3Fmx4.js +1 -0
- package/dist/gateway/static/root/assets/skill-wire-pattern-BPpeIcCi.js +1 -0
- package/dist/gateway/static/root/assets/skills-page-ChjXDxdX.js +2 -0
- package/dist/gateway/static/root/assets/sparkles-DHlfQFAF.js +1 -0
- package/dist/gateway/static/root/assets/system-settings-panel-DAR0w3Xi.js +1 -0
- package/dist/gateway/static/root/assets/task-detail-page-DEx0kXDV.js +1 -0
- package/dist/gateway/static/root/assets/tasks-Buv1mgPF.js +1 -0
- package/dist/gateway/static/root/assets/theme-store-BKgBPLH4.js +1 -0
- package/dist/gateway/static/root/assets/tunnel-api-CBy97LfF.js +1 -0
- package/dist/gateway/static/root/assets/usage-page-BdX6VPQC.js +1 -0
- package/dist/gateway/static/root/assets/use-async-resource-GrnWNwMZ.js +1 -0
- package/dist/gateway/static/root/assets/use-autosave-Cn6hqqyM.js +1 -0
- package/dist/gateway/static/root/assets/use-composer-attachments-DL61XeSu.js +2 -0
- package/dist/gateway/static/root/assets/use-file-preview-expanded-Cl9mU32w.js +2 -0
- package/dist/gateway/static/root/assets/user-model-page-CRxiQnWG.js +2 -0
- package/dist/gateway/static/root/assets/voice-api-key-field-Bw05QB_V.js +1 -0
- package/dist/gateway/static/root/assets/{work-discovery-overlay-BnfD6w0k.js → work-discovery-overlay-DvwmD9Ma.js} +1 -1
- package/dist/gateway/static/root/assets/{workflow-run-setup-panel-DSy57rBr.js → workflow-run-setup-panel-BQ3fmhM-.js} +2 -2
- package/dist/gateway/static/root/assets/workflows-page-Bl8rd4fM.js +6 -0
- package/dist/gateway/static/root/assets/workspace-api-BbBT75Kg.js +2 -0
- package/dist/gateway/static/root/index.html +61 -19
- package/dist/package.js +1 -1
- package/dist/packages/gateway-contract/src/tasks.js +19 -2
- package/dist/src/agent/agent-manager.js +4 -4
- package/dist/src/agent/embedded/run-for-session.d.ts +1 -0
- package/dist/src/agent/embedded/run-for-session.js +2 -1
- package/dist/src/agent/embedded/run-turn.js +30 -2
- package/dist/src/agent/embedded/types.d.ts +1 -0
- package/dist/src/agent/prompt/sections/messaging-runtime.js +2 -1
- package/dist/src/agent/service/direct-turn-helpers.d.ts +1 -0
- package/dist/src/agent/service/direct-turn-helpers.js +1 -0
- package/dist/src/agent/service/process-direct-streaming.js +1 -0
- package/dist/src/agent/service.js +4 -1
- package/dist/src/agent/session/session-config-service.js +27 -1
- package/dist/src/agent/session/session-hydrator.js +1 -1
- package/dist/src/agent/tools/factory.js +21 -14
- package/dist/src/agent/tools/personal-preference-tool.d.ts +10 -0
- package/dist/src/agent/tools/personal-preference-tool.js +44 -0
- package/dist/src/agent/tools/personal-task-tool.d.ts +29 -0
- package/dist/src/agent/tools/personal-task-tool.js +184 -0
- package/dist/src/agent/tools/xopc-use-tool.js +3 -2
- package/dist/src/agent-catalog/service.d.ts +1 -1
- package/dist/src/agent-catalog/service.js +2 -1
- package/dist/src/agent-config/index.js +2 -2
- package/dist/src/agent-config/schema.d.ts +153 -1
- package/dist/src/agent-config/schema.js +42 -3
- package/dist/src/chat-commands/builtins/thinking.js +12 -2
- package/dist/src/chat-commands/context.js +7 -1
- package/dist/src/cli/commands/auth.js +1 -1
- package/dist/src/cli/commands/doctor/checks/database-schema.js +1 -1
- package/dist/src/cli/commands/models.js +2 -2
- package/dist/src/cli/commands/onboard/model.js +1 -1
- package/dist/src/cli/commands/providers.js +1 -1
- package/dist/src/gateway/hono/lib/config-payload.d.ts +1 -0
- package/dist/src/gateway/hono/routes/lazy-bundles.js +8 -0
- package/dist/src/gateway/hono/routes/models.js +1 -1
- package/dist/src/gateway/hono/routes/personal-agent.d.ts +3 -0
- package/dist/src/gateway/hono/routes/personal-agent.js +122 -0
- package/dist/src/gateway/hono/routes/session-input-handler.js +1 -1
- package/dist/src/gateway/hono/routes/sessions.js +5 -0
- package/dist/src/gateway/hono/routes/side-chats.js +1 -1
- package/dist/src/gateway/hono/routes/tasks.js +64 -1
- package/dist/src/gateway/hono/routes/voice.js +8 -0
- package/dist/src/gateway/service/agent-runner.js +41 -0
- package/dist/src/gateway/service/run-gateway-agent.js +2 -1
- package/dist/src/gateway/service/session-command-service.js +7 -1
- package/dist/src/gateway/service/sessions-api.js +11 -1
- package/dist/src/gateway/service.js +10 -10
- package/dist/src/gateway/session-reset-service.js +5 -0
- package/dist/src/gateway/xopc-cloud-capability-setup.d.ts +9 -0
- package/dist/src/gateway/xopc-cloud-capability-setup.js +42 -2
- package/dist/src/home-intelligence/host.js +2 -2
- package/dist/src/personal-agent/policy.d.ts +1 -0
- package/dist/src/personal-agent/policy.js +13 -0
- package/dist/src/personal-agent/repository.d.ts +25 -0
- package/dist/src/personal-agent/repository.js +68 -0
- package/dist/src/personal-agent/service.d.ts +49 -0
- package/dist/src/personal-agent/service.js +234 -0
- package/dist/src/session/resolve-session.js +4 -2
- package/dist/src/storage/sqlite/migrations/229_task_criterion_reviews.sql +12 -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/schema.js +1 -1
- package/dist/src/storage/sqlite/schema.sql +13 -0
- package/dist/src/storage/sqlite/session-repository.js +6 -2
- package/dist/src/storage/sqlite/transcript-repository.js +2 -1
- package/dist/src/tasks/capabilities/read.js +3 -0
- package/dist/src/tasks/task-application-service.js +6 -1
- package/dist/src/tasks/task-criterion-review-repository.d.ts +22 -0
- package/dist/src/tasks/task-criterion-review-repository.js +74 -0
- package/dist/src/tasks/task-main-update-decision-service.js +6 -0
- package/dist/src/tasks/task-main-update-delivery.js +5 -2
- package/dist/src/tasks/task-origin-repository.d.ts +4 -1
- package/dist/src/tasks/task-origin-repository.js +3 -3
- package/dist/src/tasks/task-run-coordinator.d.ts +1 -0
- package/dist/src/tasks/task-run-coordinator.js +13 -7
- package/dist/src/tasks/task-run-dispatcher.d.ts +1 -1
- package/dist/src/tasks/task-run-dispatcher.js +6 -4
- package/package.json +4 -4
- package/dist/gateway/static/root/assets/agent-defaults-settings-panel-CcTnphqy.js +0 -1
- package/dist/gateway/static/root/assets/agent-plugin-dialog-CdCzMPhC.js +0 -1
- package/dist/gateway/static/root/assets/agents-BiNKpndr.js +0 -66
- package/dist/gateway/static/root/assets/app-management-settings-panel-BvGDN5J6.js +0 -1
- package/dist/gateway/static/root/assets/appearance-settings-BhQYkuQj.js +0 -1
- package/dist/gateway/static/root/assets/apps-page-BQZJuM-C.js +0 -1
- package/dist/gateway/static/root/assets/automations-workspace-y4qcvlg8.js +0 -7
- package/dist/gateway/static/root/assets/browser-settings-page--N4P7V0l.js +0 -3
- package/dist/gateway/static/root/assets/capabilities-page-F7OAv-iz.js +0 -2
- package/dist/gateway/static/root/assets/capabilities-settings-panel-CaiIo1S1.js +0 -8
- package/dist/gateway/static/root/assets/capability-header-actions-CR_O9_Vr.js +0 -1
- package/dist/gateway/static/root/assets/channels-Bb-8c4wl.js +0 -1
- package/dist/gateway/static/root/assets/computer-settings-page-QuXZBfky.js +0 -1
- package/dist/gateway/static/root/assets/connector-service-page-BIqzVqCO.js +0 -1
- package/dist/gateway/static/root/assets/connectors-page-CZ24DSBJ.js +0 -2
- package/dist/gateway/static/root/assets/date-picker-Ck-FmYEL.js +0 -1
- package/dist/gateway/static/root/assets/desktop-pet-settings-C1rKgB-S.js +0 -1
- package/dist/gateway/static/root/assets/device-pairing-wizard-UrPcOU6Q.js +0 -1
- package/dist/gateway/static/root/assets/directory-picker-path-field-BYxUgMZb.js +0 -1
- package/dist/gateway/static/root/assets/dist-CKkafhaS.js +0 -1
- package/dist/gateway/static/root/assets/dist-io9jFpN72.js +0 -1
- package/dist/gateway/static/root/assets/extension-debug-page-CGL0jpQA.js +0 -1
- package/dist/gateway/static/root/assets/extension-page-DPWf-tYg.js +0 -1
- package/dist/gateway/static/root/assets/extension-settings-page-DZWBY39d.js +0 -1
- package/dist/gateway/static/root/assets/gateway-settings-D5w5aYXK.js +0 -1
- package/dist/gateway/static/root/assets/home-page-DPQwxBGy.js +0 -1
- package/dist/gateway/static/root/assets/imports-page-CnRWDtGz.js +0 -1
- package/dist/gateway/static/root/assets/index-B-w6Rk9Z.css +0 -1
- package/dist/gateway/static/root/assets/index-DU5Eb1V8.js +0 -106
- package/dist/gateway/static/root/assets/local-app-workbench-page-hjFeYlIq.js +0 -1
- package/dist/gateway/static/root/assets/logs-page-CzpZDjkA.js +0 -2
- package/dist/gateway/static/root/assets/management-settings-Beu_R_Rc.js +0 -1
- package/dist/gateway/static/root/assets/markdown-view-BlzX7Ze5.js +0 -201
- package/dist/gateway/static/root/assets/note-detail-panel-D8bpTGwP.js +0 -5
- package/dist/gateway/static/root/assets/notes-page-OmgXowUG.js +0 -8
- package/dist/gateway/static/root/assets/page-context-capture-button-BjjjuLkz.js +0 -1
- package/dist/gateway/static/root/assets/page-tabs-_DiuzxyD.js +0 -1
- package/dist/gateway/static/root/assets/popover-select-0p9PIHRy.js +0 -1
- package/dist/gateway/static/root/assets/preview-open-alternatives-BKvUadws.js +0 -1
- package/dist/gateway/static/root/assets/project-detail-page-CWlCg2x5.js +0 -1
- package/dist/gateway/static/root/assets/projects-page-NbVNo0tP.js +0 -1
- package/dist/gateway/static/root/assets/remote-access-hub-CD8HrqGC.js +0 -1
- package/dist/gateway/static/root/assets/scenes-page-DbWaemwR.js +0 -2
- package/dist/gateway/static/root/assets/schema-form-_3LQ4hyB.js +0 -1
- package/dist/gateway/static/root/assets/sessions-page-B7ZUdXlb.js +0 -1
- package/dist/gateway/static/root/assets/settings-advanced-gate-CpKzZMft.js +0 -1
- package/dist/gateway/static/root/assets/settings-form-section-DS80hVSY.js +0 -1
- package/dist/gateway/static/root/assets/setup-status-panel-De-kC3yJ.js +0 -1
- package/dist/gateway/static/root/assets/share-preview-page-T-0g_rwr.js +0 -2
- package/dist/gateway/static/root/assets/shares-settings-Dz33T3du.js +0 -1
- package/dist/gateway/static/root/assets/skill-api-Cx6GGpSY.js +0 -1
- package/dist/gateway/static/root/assets/skill-reload-api-DyJ-Duem.js +0 -1
- package/dist/gateway/static/root/assets/skills-page-B2iyN-kP.js +0 -2
- package/dist/gateway/static/root/assets/system-settings-panel-By3SZQR_.js +0 -1
- package/dist/gateway/static/root/assets/task-detail-page-4yHUTs4_.js +0 -1
- package/dist/gateway/static/root/assets/tasks-BH8_WMUF.js +0 -1
- package/dist/gateway/static/root/assets/tunnel-api-BoH0LBkw.js +0 -1
- package/dist/gateway/static/root/assets/usage-page-dKU5X9zT.js +0 -1
- package/dist/gateway/static/root/assets/use-autosave-YKCwQvqT.js +0 -1
- package/dist/gateway/static/root/assets/user-model-page-Uht32LPP.js +0 -2
- package/dist/gateway/static/root/assets/voice-api-key-field-DiqHIA8l.js +0 -1
- package/dist/gateway/static/root/assets/workflows-page-Cq3vRUbc.js +0 -6
- /package/dist/gateway/static/root/assets/{dist-CI_fqRk-2.js → dist-CI_fqRk-.js} +0 -0
package/dist/gateway/static/root/assets/{media-plugins-C9ya5rUH.js → media-plugins-cjgrKnne.js}
RENAMED
|
@@ -1 +1 @@
|
|
|
1
|
-
import"./rolldown-runtime-aKtaBQYM.js";import{a as e,n as t,t as n}from"./vendor-react-BOUWij0V.js";import{t as r}from"./messages-DPw2X06D.js";import{a as i}from"./attachment-utils-core-BIOUBrpT.js";import{t as a}from"./preview-open-alternatives-
|
|
1
|
+
import"./rolldown-runtime-aKtaBQYM.js";import{a as e,n as t,t as n}from"./vendor-react-BOUWij0V.js";import{t as r}from"./messages-DPw2X06D.js";import{a as i}from"./attachment-utils-core-BIOUBrpT.js";import{t as a}from"./preview-open-alternatives-Dvey7GwU.js";import{t as o}from"./use-blob-object-url-D4BFuzZB.js";var s=t();e();var c=n();function l(e){let t=(0,s.c)(2),n;return t[0]===e?n=t[1]:(n=(0,c.jsx)(d,{props:e,kind:`audio`}),t[0]=e,t[1]=n),n}function u(e){let t=(0,s.c)(2),n;return t[0]===e?n=t[1]:(n=(0,c.jsx)(d,{props:e,kind:`video`}),t[0]=e,t[1]=n),n}function d(e){let t=(0,s.c)(8),{props:n,kind:r}=e,a;bb0:{if(!n.binaryBuffer){a=null;break bb0}let e;if(t[0]!==r||t[1]!==n.binaryBuffer||t[2]!==n.descriptor.fileName||t[3]!==n.descriptor.mimeType){let a=i(n.descriptor.fileName)??n.descriptor.mimeType;e=new Blob([n.binaryBuffer],{type:a||`${r}/*`}),t[0]=r,t[1]=n.binaryBuffer,t[2]=n.descriptor.fileName,t[3]=n.descriptor.mimeType,t[4]=e}else e=t[4];a=e}let l=o(a);if(!l)return null;let u;return t[5]!==r||t[6]!==l?(u=(0,c.jsx)(`div`,{className:`flex min-h-0 flex-1 items-center justify-center overflow-auto bg-surface-base p-4 dark:bg-surface-hover/20`,children:r===`audio`?(0,c.jsx)(`audio`,{src:l,controls:!0,className:`w-full max-w-2xl`}):(0,c.jsx)(`video`,{src:l,controls:!0,playsInline:!0,className:`max-h-full max-w-full rounded-md bg-black`})}),t[5]=r,t[6]=l,t[7]=u):u=t[7],u}function f(e){let t=(0,s.c)(12),n;t[0]===e.language?n=t[1]:(n=r(e.language),t[0]=e.language,t[1]=n);let i=n,o=e.descriptor.context===`workspace`,l=o?`${i.workspace.cannotPreviewType} ${i.workspace.openElsewhereHint}`:i.chat.attachmentPreviewOpenElsewhereHint,u=o?i.workspace.openSystemApp:void 0,d=o?i.workspace.chooseApp:void 0,f;return t[2]!==i.chat.attachmentPreviewDownloadFull||t[3]!==e.actions.canChooseOpenWithApp||t[4]!==e.actions.canOpenWithSystemApp||t[5]!==e.actions.onChooseOpenWithApp||t[6]!==e.actions.onDownload||t[7]!==e.actions.onOpenWithSystemApp||t[8]!==l||t[9]!==u||t[10]!==d?(f=(0,c.jsx)(`div`,{className:`flex min-h-0 flex-1 flex-col gap-3 overflow-auto p-4`,children:(0,c.jsx)(a,{message:l,downloadLabel:i.chat.attachmentPreviewDownloadFull,onDownload:e.actions.onDownload,openSystemLabel:u,onOpenWithSystemApp:e.actions.onOpenWithSystemApp,canOpenWithSystemApp:e.actions.canOpenWithSystemApp,chooseAppLabel:d,onChooseOpenWithApp:e.actions.onChooseOpenWithApp,canChooseOpenWithApp:e.actions.canChooseOpenWithApp})}),t[2]=i.chat.attachmentPreviewDownloadFull,t[3]=e.actions.canChooseOpenWithApp,t[4]=e.actions.canOpenWithSystemApp,t[5]=e.actions.onChooseOpenWithApp,t[6]=e.actions.onDownload,t[7]=e.actions.onOpenWithSystemApp,t[8]=l,t[9]=u,t[10]=d,t[11]=f):f=t[11],f}export{l as AudioPreviewPluginView,f as UnsupportedPreviewPluginView,u as VideoPreviewPluginView};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{t as e}from"./createLucideIcon-DPHK1VkS.js";var t=e(`message-square`,[[`path`,{d:`M22 17a2 2 0 0 1-2 2H6.828a2 2 0 0 0-1.414.586l-2.202 2.202A.71.71 0 0 1 2 21.286V5a2 2 0 0 1 2-2h16a2 2 0 0 1 2 2z`,key:`18887p`}]]);export{t};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{t as e}from"./createLucideIcon-DPHK1VkS.js";var t=e(`mic`,[[`path`,{d:`M12 19v3`,key:`npa21l`}],[`path`,{d:`M19 10v2a7 7 0 0 1-14 0v-2`,key:`1vc78b`}],[`rect`,{x:`9`,y:`2`,width:`6`,height:`13`,rx:`3`,key:`s6n7sd`}]]);export{t};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
function e(e,t){return e.displayNames?.[t.toLowerCase().startsWith(`zh`)?`zh-CN`:`en`]||e.name}export{e as t};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{r as e}from"./locale-store-Y1aBayM_.js";import{o as t}from"./vendor-swr-BIWyz7Rc.js";import{n}from"./gateway-config-swr-B31I6Gbq.js";import{r}from"./registry-api-DqDOrPQ0.js";var i=`models-json-config`,a=`model-catalog`,o=`capability-readiness`;async function s(){await Promise.all([n(),t(e(`/api/providers/meta`)),t(i),t(a),t(o),r()])}export{s as i,i as n,a as r,o as t};
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/block-editor-r4mKGacz.js","assets/rolldown-runtime-aKtaBQYM.js","assets/index-CYeGnj-L.js","assets/preload-helper-zJ_50EbN.js","assets/es2015-DBLcMg5B.js","assets/vendor-react-BOUWij0V.js","assets/dist-CxGUk8J-.js","assets/dist-CI_fqRk-.js","assets/floating-ui.dom-B7uQOZZW.js","assets/markdown-view-7tzqIp_G.js","assets/dist-BGTk37IG.js","assets/chunk-KS7C4IRE-BMYIfy9x.js","assets/createLucideIcon-DPHK1VkS.js","assets/download-Dk-ZjtO6.js","assets/plus-Q2yW6OE7.js","assets/x-B_N4OPjy.js","assets/locale-store-Y1aBayM_.js","assets/messages-DPw2X06D.js","assets/cn-JdwAhgNB.js","assets/app-link-DRL0YnPs.js","assets/product-delivery-BAks11S4.js","assets/schemas-CObaziC7.js","assets/local-apps-yys1VChX.js","assets/copy-to-clipboard-HOJ79TWv.js","assets/markdown-view-DSjfHfaW.css","assets/dist-Che_jiQF.js","assets/vendor-swr-BIWyz7Rc.js","assets/activity-YogQEteU.js","assets/bot-DjLkhyZL.js","assets/check-DUBLcKHA.js","assets/chevron-right-BweFrslA.js","assets/popover-select-DcsFzD_i.js","assets/dist-3h6cXXhT.js","assets/skeleton-BwbyijEw.js","assets/settings-shell-dialog-layer-BU3UuiJr.js","assets/settings-shell-layer-context-BTQUDoJ2.js","assets/circle-alert-BEjgurr2.js","assets/circle-check-C23XjkUj.js","assets/circle-dashed-8qMD7gHf.js","assets/circle-dot-BAseJTrF.js","assets/circle-pause-CN9jYH2s.js","assets/clock-3-DnrAnuyZ.js","assets/cloud-C4-yfnnk.js","assets/copy-Dv6d4Dvw.js","assets/ellipsis-0k4rZLoy.js","assets/external-link-DjqjBmc3.js","assets/secret-input-DPl3VYM8.js","assets/eye-CABVeTq0.js","assets/loader-circle-CifKLtgG.js","assets/form-field-width-DJw_jULe.js","assets/interaction-BdhHBbYa.js","assets/is-masked-secret-DOkL5b_X.js","assets/use-composer-attachments-DL61XeSu.js","assets/mic-CuUb7zc-.js","assets/use-file-preview-expanded-Cl9mU32w.js","assets/folder-open-CyzJ19I9.js","assets/link-2-D_ZKYUW7.js","assets/message-square-plus-XP0tGdlV.js","assets/minimize-2-DtOGrlpo.js","assets/pencil-DmIY3Oa-.js","assets/rotate-cw-LIg3Am9S.js","assets/search-DA7gz22f.js","assets/index.module-Cd9ENXfk.js","assets/session-api-CTN4qwiN.js","assets/gateway-startup-retry-DVol958v.js","assets/constants-Co2_smKQ.js","assets/app-chrome-BeB4KgOf.js","assets/attachment-utils-core-BIOUBrpT.js","assets/workspace-api-BbBT75Kg.js","assets/files-Bw4SBGdM.js","assets/electron-env-Dit0bHgy.js","assets/use-async-resource-GrnWNwMZ.js","assets/activity-store-X7CG9pzB.js","assets/share-link-dialog-COlX10Dc.js","assets/globe-DSSGFWFn.js","assets/button-CS04eWY9.js","assets/copy-text-row-BHDs3cBa.js","assets/capabilities-BCF_160Z.js","assets/local-session-drafts-wiq_12oN.js","assets/tasks-Buv1mgPF.js","assets/skill-wire-pattern-BPpeIcCi.js","assets/shares-api-DICV5EKH.js","assets/capabilities-CF4-mrIa.js","assets/git-branch-Dh9uxTot.js","assets/notes-api-J0yhflxC.js","assets/message-square-fVE7Ghj1.js","assets/pause-DuPxgSxk.js","assets/play-kxZvpBg8.js","assets/rotate-ccw-JM1TBLpp.js","assets/settings-2-D-csvaET.js","assets/sparkles-DHlfQFAF.js","assets/middleware-Pd0e8Igk.js","assets/gateway-realtime-D6ffOiPe.js","assets/gateway-realtime-store-DQuFWNjA.js","assets/extension-provider-CUpbXB2k.js","assets/session-manager-DsH1DZI_.js","assets/tool-activity-BtJkgjFf.js","assets/registry-api-DqDOrPQ0.js","assets/agents-admin-api-Ck2x78jq.js","assets/gateway-config-swr-B31I6Gbq.js","assets/send-session-input-C7Nqy0sK.js","assets/theme-store-BKgBPLH4.js","assets/models-hub-cache-HGrORbzR.js","assets/oauth-api-CYe61zfD.js","assets/skill-api-utils-C7V4JVXM.js","assets/model-display-name-DXhO9rcM.js","assets/settings-form-draft-Dy10ldo8.js","assets/index-BuzC93X-.css","assets/vendor-codemirror-DFxP3B9T.js","assets/with-selector-aYPsXwdl.js","assets/note-image-lightbox-1qg2v-9j.js","assets/block-editor-BdOTO0Yo.css","assets/markdown-editor-BhBJANcx.js","assets/code-editor-CXIH8jQw.js","assets/languages-BFe8nIOO.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{f as a,t as o,u as s}from"./chunk-KS7C4IRE-BMYIfy9x.js";import{t as c}from"./check-DUBLcKHA.js";import{n as l,r as u}from"./popover-select-DcsFzD_i.js";import{t as d}from"./circle-check-C23XjkUj.js";import{t as f}from"./copy-Dv6d4Dvw.js";import{t as p}from"./download-Dk-ZjtO6.js";import{t as m}from"./ellipsis-0k4rZLoy.js";import{t as h}from"./external-link-DjqjBmc3.js";import{t as g}from"./eye-CABVeTq0.js";import{y as _}from"./markdown-view-7tzqIp_G.js";import{C as v,E as y,O as b,S as x,T as S,_ as C,a as w,c as T,d as E,f as D,h as O,l as k,m as A,n as j,r as M,s as N,u as P,w as F,x as I}from"./notes-api-J0yhflxC.js";import{t as L}from"./loader-circle-CifKLtgG.js";import{t as R}from"./pencil-DmIY3Oa-.js";import{t as z}from"./play-kxZvpBg8.js";import{t as ee}from"./search-DA7gz22f.js";import{t as B}from"./sparkles-DHlfQFAF.js";import{t as te}from"./x-B_N4OPjy.js";import{t as V}from"./messages-DPw2X06D.js";import{t as H}from"./cn-JdwAhgNB.js";import{a as U,c as ne,f as re,n as ie,r as W}from"./locale-store-Y1aBayM_.js";import{a as ae,i as oe,n as se,o as ce,r as le,s as ue,t as de}from"./dist-BGTk37IG.js";import{t as fe}from"./session-manager-DsH1DZI_.js";import{t as G}from"./copy-to-clipboard-HOJ79TWv.js";import{i as pe}from"./vendor-swr-BIWyz7Rc.js";import{t as K}from"./button-CS04eWY9.js";import{r as me}from"./app-chrome-BeB4KgOf.js";import{i as he}from"./theme-store-BKgBPLH4.js";import{t as ge}from"./skeleton-BwbyijEw.js";import{b as q,d as _e,o as ve,s as ye,v as be}from"./shares-api-DICV5EKH.js";import{$n as xe,An as Se,F as Ce,Fn as we,Fo as Te,Ft as Ee,Gs as De,I as Oe,Ki as ke,Mn as Ae,Nc as je,Nn as Me,Ns as Ne,Oo as Pe,Pc as Fe,Pn as Ie,Qn as Le,Xn as Re,Zn as ze,_c as J,a as Be,ai as Ve,an as He,c as Ue,co as We,do as Ge,jn as Ke,l as qe,o as Je,oc as Ye,on as Xe,os as Ze,s as Qe,uo as $e,vs as Y,yo as X}from"./index-CYeGnj-L.js";import{n as et,t as tt}from"./note-image-lightbox-1qg2v-9j.js";import{t as nt}from"./page-context-capture-button-DqmAq4Ov.js";var Z=e(t(),1),rt=n(),Q=r(),it=6e4,at=36e5,ot=864e5;function st(e){let t=new Date(e);return t.setHours(0,0,0,0),t.getTime()}function $(e,t,n){let r=t-e;if(r<it)return n.justNow;if(r<at){let e=Math.floor(r/it);return n.minutesAgo.replace(`{{n}}`,String(e))}let i=st(t);if(e>=i)return n.today+` `+new Date(e).toLocaleTimeString(n.locale,{hour:`2-digit`,minute:`2-digit`});if(e>=i-ot)return n.yesterday+` `+new Date(e).toLocaleTimeString(n.locale,{hour:`2-digit`,minute:`2-digit`});if(r<7*ot){let e=Math.floor(r/ot);return n.daysAgo.replace(`{{n}}`,String(e))}return new Date(e).toLocaleDateString(n.locale,{month:`short`,day:`numeric`})}function ct(e,t,n){let r=st(t);if(e>=r)return n.today;if(e>=r-ot)return n.yesterday;let i=new Date(e),a=new Date(t);return i.getFullYear()===a.getFullYear()?i.toLocaleDateString(n.locale,{month:`long`,day:`numeric`}):i.toLocaleDateString(n.locale,{year:`numeric`,month:`long`,day:`numeric`})}function lt(e){let t=new Date(e);return`${t.getFullYear()}-${String(t.getMonth()+1).padStart(2,`0`)}-${String(t.getDate()).padStart(2,`0`)}`}function ut(e){let t=(0,rt.c)(45),{title:n,description:r,prompt:i,coverage:o,className:s,variant:c}=e,l=c===void 0?`card`:c,u=ie(pt),f=V(u).automations.suggestions,p=V(u).automations,m=a(),h;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(h={revalidateOnFocus:!1,refreshInterval:15e3},t[0]=h):h=t[0];let{data:g}=pe(o?`automation-suggestion-coverage`:null,ft,h),_=o?g?.automations.find(e=>Ue(e,o)):void 0,v=_?Je(_,p):[];if(l===`titleAction`){if(_){let e;t[1]===s?e=t[2]:(e=H(`flex min-w-0 items-center gap-2 rounded-lg border border-emerald-500/25 bg-emerald-500/10 px-2.5 py-1.5`,s),t[1]=s,t[2]=e);let n;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(n=(0,Q.jsx)(d,{className:`size-3.5 shrink-0 text-emerald-700 dark:text-emerald-300`,"aria-hidden":!0}),t[3]=n):n=t[3];let r;return t[4]===m?r=t[5]:(r=()=>m(`/automations`),t[4]=m,t[5]=r),(0,Q.jsxs)(`section`,{className:e,children:[n,(0,Q.jsx)(`span`,{className:`min-w-0 truncate text-xs font-medium text-fg`,children:f.coveredTitle}),(0,Q.jsx)(K,{variant:`ghost`,className:`h-7 shrink-0 rounded-md px-2 text-xs`,onClick:r,children:f.manage})]})}let e;t[6]===s?e=t[7]:(e=H(`flex min-w-0 items-center gap-2 rounded-lg bg-surface-panel px-2.5 py-1.5 shadow-surface`,s),t[6]=s,t[7]=e);let a;t[8]===Symbol.for(`react.memo_cache_sentinel`)?(a=(0,Q.jsx)(Y,{className:`size-3.5 shrink-0 text-accent`,"aria-hidden":!0}),t[8]=a):a=t[8];let o;t[9]!==r||t[10]!==n?(o=(0,Q.jsx)(`span`,{className:`min-w-0 truncate text-xs font-medium text-fg`,title:r,children:n}),t[9]=r,t[10]=n,t[11]=o):o=t[11];let c;t[12]!==m||t[13]!==i?(c=()=>{m(`/automations?${new URLSearchParams({draft:i,autogenerate:`1`}).toString()}`)},t[12]=m,t[13]=i,t[14]=c):c=t[14];let l;return t[15]===Symbol.for(`react.memo_cache_sentinel`)?(l=(0,Q.jsx)(B,{className:`size-3.5`,"aria-hidden":!0}),t[15]=l):l=t[15],(0,Q.jsxs)(`section`,{className:e,children:[a,o,(0,Q.jsxs)(K,{variant:`secondary`,className:`h-7 shrink-0 rounded-md px-2 text-xs`,onClick:c,children:[l,f.setup]})]})}if(_){let e;t[16]===s?e=t[17]:(e=H(`rounded-lg border border-emerald-500/25 bg-emerald-500/10 p-3`,s),t[16]=s,t[17]=e);let n;t[18]===Symbol.for(`react.memo_cache_sentinel`)?(n=(0,Q.jsx)(d,{className:`mt-0.5 size-4 shrink-0 text-emerald-700 dark:text-emerald-300`,"aria-hidden":!0}),t[18]=n):n=t[18];let r;t[19]===m?r=t[20]:(r=()=>m(`/automations`),t[19]=m,t[20]=r);let i;return t[21]!==f||t[22]!==r?(i=(0,Q.jsx)(`div`,{className:`mt-3 flex justify-end`,children:(0,Q.jsx)(K,{variant:`ghost`,className:`h-8 rounded-md px-2.5 text-xs`,onClick:r,children:f.manage})}),t[21]=f,t[22]=r,t[23]=i):i=t[23],(0,Q.jsxs)(`section`,{className:e,children:[(0,Q.jsxs)(`div`,{className:`flex items-start gap-2`,children:[n,(0,Q.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,Q.jsx)(`div`,{className:`text-sm font-semibold text-fg`,children:f.coveredTitle}),(0,Q.jsx)(`p`,{className:`mt-1 break-words text-xs leading-5 text-fg-muted`,children:Qe(f.coveredDescription,{name:_.name})})]})]}),(0,Q.jsxs)(`div`,{className:`mt-2 rounded-md bg-surface-base/55 px-2.5 py-2`,children:[(0,Q.jsx)(`div`,{className:`text-xs font-medium text-fg`,children:p.explain.whyCovered}),(0,Q.jsx)(`div`,{className:`mt-1 flex flex-wrap gap-1.5`,children:v.map(dt)})]}),i]})}let y;t[24]===s?y=t[25]:(y=H(`rounded-lg bg-surface-panel p-3 shadow-surface`,s),t[24]=s,t[25]=y);let b;t[26]===Symbol.for(`react.memo_cache_sentinel`)?(b=(0,Q.jsx)(Y,{className:`mt-0.5 size-4 shrink-0 text-accent`,"aria-hidden":!0}),t[26]=b):b=t[26];let x;t[27]===n?x=t[28]:(x=(0,Q.jsx)(`div`,{className:`text-sm font-semibold text-fg`,children:n}),t[27]=n,t[28]=x);let S;t[29]===r?S=t[30]:(S=(0,Q.jsx)(`p`,{className:`mt-1 break-words text-xs leading-5 text-fg-muted`,children:r}),t[29]=r,t[30]=S);let C;t[31]!==x||t[32]!==S?(C=(0,Q.jsxs)(`div`,{className:`flex items-start gap-2`,children:[b,(0,Q.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[x,S]})]}),t[31]=x,t[32]=S,t[33]=C):C=t[33];let w;t[34]!==m||t[35]!==i?(w=()=>{m(`/automations?${new URLSearchParams({draft:i,autogenerate:`1`}).toString()}`)},t[34]=m,t[35]=i,t[36]=w):w=t[36];let T;t[37]===Symbol.for(`react.memo_cache_sentinel`)?(T=(0,Q.jsx)(B,{className:`size-3.5`,"aria-hidden":!0}),t[37]=T):T=t[37];let E;t[38]!==f.create||t[39]!==w?(E=(0,Q.jsx)(`div`,{className:`mt-3 flex justify-end`,children:(0,Q.jsxs)(K,{variant:`secondary`,className:`h-8 rounded-md px-2.5 text-xs`,onClick:w,children:[T,f.create]})}),t[38]=f.create,t[39]=w,t[40]=E):E=t[40];let D;return t[41]!==E||t[42]!==y||t[43]!==C?(D=(0,Q.jsxs)(`section`,{className:y,children:[C,E]}),t[41]=E,t[42]=y,t[43]=C,t[44]=D):D=t[44],D}function dt(e){return(0,Q.jsx)(`span`,{className:`rounded-full bg-surface-panel px-2 py-0.5 text-xs text-fg-muted`,children:e},e)}function ft(){return qe.list()}function pt(e){return e.language}function mt(e){let t=(0,rt.c)(51),{initial:n,zh:r,busy:i,onClose:a,onSave:o}=e,[s,c]=(0,Z.useState)(n),l;t[0]!==i||t[1]!==a?(l=e=>{!e&&!i&&a()},t[0]=i,t[1]=a,t[2]=l):l=t[2];let u;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(u=(0,Q.jsx)(ae,{className:`xopc-dialog-overlay fixed inset-0 z-[70] bg-scrim backdrop-blur-[2px]`}),t[3]=u):u=t[3];let d=r?`编辑纪要内容`:`Edit meeting content`,f;t[4]===d?f=t[5]:(f=(0,Q.jsx)(`header`,{className:`border-b border-edge p-4`,children:(0,Q.jsx)(ue,{children:d})}),t[4]=d,t[5]=f);let p=r?`人工修改会保留,重新整理不会覆盖。已创建任务保持不变。`:`Your changes survive regeneration. Existing tasks remain unchanged.`,m;t[6]===p?m=t[7]:(m=(0,Q.jsx)(`p`,{className:`text-xs text-fg-muted`,children:p}),t[6]=p,t[7]=m);let h=r?`内容`:`Content`,g;t[8]===s?g=t[9]:(g=e=>c({...s,text:e.target.value}),t[8]=s,t[9]=g);let _;t[10]!==s.text||t[11]!==g?(_=(0,Q.jsx)(`textarea`,{className:`mt-1 min-h-32 w-full rounded border border-edge bg-transparent p-2`,value:s.text,onChange:g}),t[10]=s.text,t[11]=g,t[12]=_):_=t[12];let v;t[13]!==h||t[14]!==_?(v=(0,Q.jsxs)(`label`,{className:`block text-sm`,children:[h,_]}),t[13]=h,t[14]=_,t[15]=v):v=t[15];let y;t[16]!==s||t[17]!==r?(y=s.kind===`actionItems`?(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsxs)(`label`,{className:`block text-sm`,children:[r?`负责人原话`:`Owner as stated`,(0,Q.jsx)(`input`,{className:`mt-1 w-full rounded border border-edge bg-transparent p-2`,value:s.owner??``,onChange:e=>c({...s,owner:e.target.value})})]}),(0,Q.jsxs)(`label`,{className:`block text-sm`,children:[r?`期限原话`:`Date as stated`,(0,Q.jsx)(`input`,{className:`mt-1 w-full rounded border border-edge bg-transparent p-2`,value:s.dueDate??``,onChange:e=>c({...s,dueDate:e.target.value})})]})]}):null,t[16]=s,t[17]=r,t[18]=y):y=t[18];let b;t[19]!==s||t[20]!==r?(b=s.kind===`summary`?null:(0,Q.jsxs)(`label`,{className:`flex items-center gap-2 text-sm`,children:[(0,Q.jsx)(`input`,{type:`checkbox`,className:`ui-checkbox`,checked:!!s.ignored,onChange:e=>c({...s,ignored:e.target.checked})}),r?`忽略此项`:`Ignore this item`]}),t[19]=s,t[20]=r,t[21]=b):b=t[21];let x;t[22]!==v||t[23]!==y||t[24]!==b||t[25]!==m?(x=(0,Q.jsxs)(`div`,{className:`min-h-0 flex-1 space-y-4 overflow-y-auto p-4`,children:[m,v,y,b]}),t[22]=v,t[23]=y,t[24]=b,t[25]=m,t[26]=x):x=t[26];let S=r?`取消`:`Cancel`,C;t[27]!==i||t[28]!==a||t[29]!==S?(C=(0,Q.jsx)(K,{disabled:i,onClick:a,children:S}),t[27]=i,t[28]=a,t[29]=S,t[30]=C):C=t[30];let w;t[31]!==i||t[32]!==s.text?(w=i||!s.text.trim(),t[31]=i,t[32]=s.text,t[33]=w):w=t[33];let T;t[34]!==s||t[35]!==o?(T=()=>void o(s),t[34]=s,t[35]=o,t[36]=T):T=t[36];let E=r?`保存修改`:`Save changes`,D;t[37]!==w||t[38]!==T||t[39]!==E?(D=(0,Q.jsx)(K,{variant:`primary`,disabled:w,onClick:T,children:E}),t[37]=w,t[38]=T,t[39]=E,t[40]=D):D=t[40];let O;t[41]!==C||t[42]!==D?(O=(0,Q.jsxs)(`footer`,{className:`flex justify-end gap-2 border-t border-edge p-3`,children:[C,D]}),t[41]=C,t[42]=D,t[43]=O):O=t[43];let k;t[44]!==x||t[45]!==O||t[46]!==f?(k=(0,Q.jsxs)(ce,{children:[u,(0,Q.jsxs)(le,{"aria-describedby":void 0,className:`xopc-dialog-content fixed left-1/2 top-1/2 z-[71] flex h-[min(32rem,90dvh)] 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-overlay`,children:[f,x,O]})]}),t[44]=x,t[45]=O,t[46]=f,t[47]=k):k=t[47];let A;return t[48]!==l||t[49]!==k?(A=(0,Q.jsx)(de,{open:!0,onOpenChange:l,children:k}),t[48]=l,t[49]=k,t[50]=A):A=t[50],A}function ht(e,t,n){if(t===`summary`){let r=e.organization;if(!r)return``;let i=r.organization;if(!i)return``;let a=e=>e.filter(e=>n.showIgnored||!e.ignored);return JSON.stringify({discussionId:e.discussion.id,view:t,revision:r.revision,transcriptRevision:r.transcriptRevision,summary:i.summary,decisions:a(i.decisions),actionItems:a(i.actionItems),risks:a(i.risks),openQuestions:a(i.openQuestions),chapters:i.chapters},null,2)}let r=n.query.toLocaleLowerCase(),i=e.transcript.segments.filter(e=>(e.displayText??e.rawText??``).toLocaleLowerCase().includes(r)||e.speakerLabel?.toLocaleLowerCase().includes(r)).slice(0,n.page*50);return i.length?JSON.stringify({discussionId:e.discussion.id,view:t,revision:e.transcript.revision,scope:`loaded filtered segments only`,segments:i.map(e=>({sequence:e.sequence,startedAtMs:e.startedAtMs,speaker:e.speakerLabel,text:e.displayText??e.rawText??``}))},null,2):``}var gt=e=>`${String(Math.floor(e/6e4)).padStart(2,`0`)}:${String(Math.floor(e/1e3)%60).padStart(2,`0`)}`;function _t({noteId:e}){let t=s(),n=ie(e=>e.language)===`zh`,{data:r,mutate:i,isLoading:a}=pe([`note-discussion-document`,e],()=>He(e),{refreshInterval:e=>e&&([`recording`,`stopping`,`sealing`,`organizing`].includes(e.discussion.status)||e.recordingJob?.state===`queued`||e.recordingJob?.state===`running`)?3e3:0}),d=r?.discussion.id,f=`/api/discussions/${encodeURIComponent(d??``)}`,{data:m=[],mutate:h}=pe(d?`${f}/actions`:null,e=>U(W(e)),{refreshInterval:1e4}),[g,v]=(0,Z.useState)(`summary`),[y,b]=(0,Z.useState)(``),[x,S]=(0,Z.useState)(`general`),[C,w]=(0,Z.useState)(null),[T,E]=(0,Z.useState)(null),[D,O]=(0,Z.useState)(null),[k,A]=(0,Z.useState)(!1),[j,M]=(0,Z.useState)([]),[N,P]=(0,Z.useState)(null),[F,I]=(0,Z.useState)(!1),[L,R]=(0,Z.useState)(1),B=(0,Z.useRef)(null),V=(0,Z.useRef)(null),[H,ne]=(0,Z.useState)(0);(0,Z.useEffect)(()=>{let e=()=>{i(),h()};return window.addEventListener(`discussion-updated`,e),window.addEventListener(`discussion-segment-updated`,e),()=>{window.removeEventListener(`discussion-updated`,e),window.removeEventListener(`discussion-segment-updated`,e)}},[i,h]),(0,Z.useEffect)(()=>{r?.discussion.template&&S(r.discussion.template)},[r?.discussion.template]);async function re(e){if(!F){I(!0),P(null);try{await e(),await i(),await h()}catch(e){P(e instanceof Error?e.message:String(e))}finally{I(!1)}}}function oe(e){B.current&&(B.current.readyState===0?(V.current=e/1e3,B.current.load()):B.current.currentTime=e/1e3,B.current.play().catch(()=>void 0))}async function se(e,t){r?.organization&&await re(async()=>{w((await U(W(`${f}/transcript?revision=${t??r.organization.transcriptRevision}`))).segments.filter(t=>e.includes(t.sequence)))})}let fe=(e,t,r)=>t.some(e=>k||!e.ignored)?(0,Q.jsxs)(`section`,{className:`space-y-2`,children:[(0,Q.jsx)(`h3`,{className:`font-semibold text-fg`,children:e}),t.filter(e=>k||!e.ignored).map(e=>(0,Q.jsxs)(`div`,{className:`flex items-start gap-3 text-sm`,children:[(0,Q.jsxs)(`p`,{className:`flex-1 whitespace-pre-wrap`,children:[e.text,e.supersededBy||e.disputedBy?(0,Q.jsx)(`span`,{className:`ml-2 text-xs text-fg-muted`,children:n?`有后续变更`:`Later changes`}):null,e.editedByUser?(0,Q.jsx)(`span`,{className:`ml-2 text-xs text-fg-muted`,children:n?e.ignored?`已忽略`:`人工编辑`:e.ignored?`Ignored`:`Edited`}):null]}),(0,Q.jsx)(`button`,{className:`text-xs text-fg-muted`,disabled:F,onClick:()=>O({kind:r,itemId:e.id,text:e.text,ignored:e.ignored}),children:n?`编辑`:`Edit`}),e.evidenceSegmentIds.length?(0,Q.jsx)(`button`,{disabled:F,className:`shrink-0 text-accent-fg`,onClick:()=>void se(e.evidenceSegmentIds,e.evidenceRevision),children:n?`原话`:`Source`}):(0,Q.jsx)(`span`,{className:`text-xs text-fg-muted`,children:n?`暂无定位`:`No source timing`})]},e.id))]}):null;if(a)return(0,Q.jsx)(ge,{className:`h-48 w-full`});if(!r)return null;let{discussion:G,transcript:me,organization:he}=r,q=he?.organization,_e=[`stopping`,`sealing`,`organizing`].includes(G.status),ve=[`recording`,`completed`,`needs_attention`].includes(G.status),ye=me.segments.filter(e=>(e.displayText??e.rawText??``).toLocaleLowerCase().includes(y.toLocaleLowerCase())||e.speakerLabel?.toLocaleLowerCase().includes(y.toLocaleLowerCase())),be=ht(r,g,{query:y,page:L,showIgnored:k});return(0,Q.jsxs)(`section`,{className:`relative flex h-full min-h-0 w-full flex-col text-fg`,children:[(0,Q.jsxs)(`header`,{className:`flex shrink-0 flex-wrap items-center gap-3 border-b border-edge-subtle p-4`,children:[(0,Q.jsx)(De,{className:`size-4 text-accent`}),(0,Q.jsxs)(`span`,{className:`text-sm font-medium`,children:[gt(G.durationMs??0),` · `,_e?n?`正在整理`:`Processing`:G.status===`completed`?n?`整理完成`:`Ready`:G.status]}),(0,Q.jsxs)(`div`,{className:`ml-auto flex items-center gap-2`,children:[(0,Q.jsxs)(l,{value:x,"aria-label":n?`纪要模板`:`Summary template`,onChange:e=>S(e.target.value),children:[(0,Q.jsx)(u,{value:`general`,children:n?`通用会议`:`General`}),(0,Q.jsx)(u,{value:`project`,children:n?`项目例会`:`Project`}),(0,Q.jsx)(u,{value:`review`,children:n?`需求评审`:`Review`}),(0,Q.jsx)(u,{value:`interview`,children:n?`客户访谈`:`Interview`})]}),(0,Q.jsxs)(K,{disabled:F||_e||!G.canonicalTranscript,onClick:()=>void re(()=>U(W(`${f}/organize`),{method:`POST`,body:JSON.stringify({template:x})})),children:[(0,Q.jsx)(Te,{className:`size-3.5`}),n?`重新整理`:`Regenerate`]})]})]}),(0,Q.jsxs)(`nav`,{"aria-label":n?`会议内容`:`Meeting content`,className:`flex shrink-0 items-center gap-4 border-b border-edge-subtle px-4 py-2 text-sm`,children:[[`summary`,`transcript`].map(e=>(0,Q.jsx)(`button`,{className:g===e?`font-medium text-accent-fg`:`text-fg-muted`,onClick:()=>v(e),children:e===`summary`?n?`纪要与行动`:`Summary & actions`:n?`逐字稿`:`Transcript`},e)),(0,Q.jsxs)(`div`,{className:`ml-auto flex items-center gap-2 text-xs`,children:[(0,Q.jsx)(p,{className:`size-3`}),[`md`,`txt`,`srt`].map(e=>(0,Q.jsx)(`a`,{className:`text-accent-fg`,href:W(`${f}/export?format=${e}`),download:!0,children:e.toUpperCase()},e))]})]}),(0,Q.jsxs)(`div`,{className:`flex shrink-0 flex-wrap items-center gap-2 border-b border-edge-subtle px-4 py-2`,children:[(0,Q.jsx)(nt,{resource:{kind:`note`,id:e,revision:String(r.note.remoteVersion??1)},selection:{text:be,draft:!1},label:n?`引用当前会议内容到新对话`:`Reference displayed meeting content`,disabled:F||_e||!!(D||T)||!be||be.length>16e3}),(0,Q.jsx)(`p`,{className:`text-xs text-fg-muted`,children:be.length>16e3?n?`内容超过 16,000 字符,请筛选更少的逐字稿内容后重试。`:`Over 16,000 characters. Filter fewer transcript segments and try again.`:n?`仅附带当前纪要或已加载的筛选逐字稿,不含录音;作为用户提供的文本。`:`Includes this summary or loaded filtered transcript only, not audio; treated as user-provided text.`})]}),N?(0,Q.jsx)(`p`,{role:`alert`,className:`px-4 py-2 text-sm text-danger`,children:N}):null,r.recordingJob?.state===`queued`||r.recordingJob?.state===`running`?(0,Q.jsx)(`p`,{role:`status`,className:`px-4 py-2 text-sm text-fg-muted`,children:n?`录音已上传,正在后台校验与保存。关闭此页面不会中断处理。`:`Recording uploaded. Verification and saving continue in the background, even if you close this page.`}):null,G.status===`needs_attention`?(0,Q.jsxs)(`div`,{className:`flex gap-2 p-4 text-sm text-danger`,children:[(0,Q.jsx)(`span`,{children:G.failureMessage}),(0,Q.jsx)(`button`,{disabled:F,onClick:()=>void re(()=>Xe(G.id)),children:n?`重试`:`Retry`})]}):null,he&&he.transcriptRevision!==me.revision?(0,Q.jsx)(`p`,{className:`px-4 py-2 text-xs text-fg-muted`,children:n?`转写已修改,当前纪要引用的是修改前版本。重新整理可生成新版纪要。`:`Transcript changed. This summary cites the previous revision; regenerate to update.`}):null,(0,Q.jsx)(`main`,{className:`min-h-0 flex-1 overflow-y-auto p-4 sm:p-6`,children:g===`summary`?q?(0,Q.jsxs)(`div`,{className:`mx-auto max-w-3xl space-y-6`,children:[(0,Q.jsxs)(`div`,{className:`flex items-center justify-between text-xs text-fg-muted`,children:[(0,Q.jsx)(`span`,{children:q.summaryEditedByUser?n?`概要已人工编辑`:`Overview edited`:``}),(0,Q.jsx)(`button`,{disabled:F||_e,onClick:()=>O({kind:`summary`,itemId:`summary`,text:q.summary}),children:n?`编辑概要`:`Edit overview`})]}),(0,Q.jsx)(`p`,{className:`whitespace-pre-wrap text-sm leading-7`,children:q.summary}),(0,Q.jsxs)(`label`,{className:`flex items-center gap-2 text-xs text-fg-muted`,children:[(0,Q.jsx)(`input`,{type:`checkbox`,className:`ui-checkbox`,checked:k,onChange:e=>A(e.target.checked)}),n?`显示已忽略项`:`Show ignored items`]}),j.length?(0,Q.jsx)(K,{disabled:F,onClick:()=>void re(async()=>{for(let e of j)await U(W(`${f}/actions/${encodeURIComponent(e)}/convert`),{method:`POST`,body:JSON.stringify({organizationRevision:he.revision})});M([])}),children:n?`加入所选 ${j.length} 项任务`:`Add ${j.length} selected tasks`}):null,fe(n?`已决定事项`:`Decisions`,q.decisions,`decisions`),q.actionItems.length?(0,Q.jsxs)(`section`,{className:`space-y-3`,children:[(0,Q.jsx)(`h3`,{className:`font-semibold`,children:n?`下一步行动`:`Next actions`}),q.actionItems.filter(e=>k||!e.ignored).map(e=>{let r=m.find(t=>t.actionId===e.id);return(0,Q.jsxs)(`article`,{className:`rounded-lg border border-edge-subtle p-3`,children:[(0,Q.jsxs)(`div`,{className:`flex items-start gap-2`,children:[!r&&!e.ignored&&(!(e.supersededBy||e.disputedBy)||e.reviewedChangeId===(e.supersededBy??e.disputedBy))?(0,Q.jsx)(`input`,{type:`checkbox`,"aria-label":`${n?`选择行动`:`Select action`}: ${e.title}`,className:`ui-checkbox`,checked:j.includes(e.id),onChange:t=>M(t.target.checked?[...j,e.id]:j.filter(t=>t!==e.id))}):null,(0,Q.jsxs)(`p`,{className:`flex-1 text-sm font-medium`,children:[e.title,e.supersededBy||e.disputedBy?(0,Q.jsx)(`span`,{className:`ml-2 text-xs text-fg-muted`,children:n?`有后续变更,请复核`:`Review later changes`}):null,e.editedByUser?(0,Q.jsx)(`span`,{className:`ml-2 text-xs text-fg-muted`,children:n?e.ignored?`已忽略`:`人工编辑`:e.ignored?`Ignored`:`Edited`}):null]}),(0,Q.jsx)(`button`,{className:`text-xs text-fg-muted`,disabled:F||_e,onClick:()=>O({kind:`actionItems`,itemId:e.id,text:e.title,owner:e.owner,dueDate:e.dueDate,ignored:e.ignored}),children:n?`编辑`:`Edit`})]}),(0,Q.jsxs)(`p`,{className:`mt-1 text-xs text-fg-muted`,children:[e.owner??(n?`负责人未明确`:`Owner unspecified`),` · `,e.dueDate??(n?`期限未明确`:`Date unspecified`)]}),(0,Q.jsxs)(`div`,{className:`mt-3 flex flex-wrap items-center gap-3 text-xs`,children:[e.evidenceSegmentIds.length?(0,Q.jsx)(`button`,{disabled:F,className:`text-accent-fg`,onClick:()=>void se(e.evidenceSegmentIds,e.evidenceRevision),children:n?`查看原话`:`Source`}):null,r?r.deleted?(0,Q.jsx)(`span`,{children:n?`关联任务已删除`:`Linked task deleted`}):(0,Q.jsx)(o,{className:`text-accent-fg`,to:_(`${t.pathname}${t.search}`,r.taskId),children:r.resolution===`done`?n?`已完成 · 查看任务`:`Done · View task`:n?`查看任务 / 交给助手`:`View task / Delegate`}):e.ignored?null:(0,Q.jsx)(K,{disabled:F||!!(e.supersededBy||e.disputedBy)&&e.reviewedChangeId!==(e.supersededBy??e.disputedBy),onClick:()=>void re(()=>U(W(`${f}/actions/${encodeURIComponent(e.id)}/convert`),{method:`POST`,body:JSON.stringify({organizationRevision:he.revision})})),children:n?`加入我的任务`:`Add to my tasks`})]})]},e.id)})]}):null,fe(n?`风险`:`Risks`,q.risks,`risks`),fe(n?`尚未确定`:`Open questions`,q.openQuestions,`openQuestions`),q.changes?.length?(0,Q.jsxs)(`section`,{className:`space-y-3`,children:[(0,Q.jsx)(`h3`,{className:`font-semibold`,children:n?`前后变更`:`Changes during the meeting`}),q.changes.map(e=>{let t=[...q.decisions,...q.actionItems,...q.risks,...q.openQuestions],r=t.find(t=>t.id===e.fromId),i=t.find(t=>t.id===e.toId);return!r||!i?null:(0,Q.jsxs)(`article`,{className:`space-y-2 rounded border border-edge p-3 text-sm`,children:[(0,Q.jsx)(`p`,{className:`text-xs text-fg-muted`,children:e.relation===`supersedes`?n?`后续撤销或替代`:`Later superseded`:n?`存在冲突,尚未明确解决`:`Unresolved conflict`}),(0,Q.jsx)(`button`,{className:`block text-left text-accent-fg`,onClick:()=>void se(r.evidenceSegmentIds,r.evidenceRevision),children:`title`in r?r.title:r.text}),(0,Q.jsx)(`span`,{children:`↓`}),(0,Q.jsx)(`button`,{className:`block text-left text-accent-fg`,onClick:()=>void se(i.evidenceSegmentIds,i.evidenceRevision),children:`title`in i?i.title:i.text})]},`${e.fromId}:${e.toId}`)})]}):null,q.chapters.length?(0,Q.jsxs)(`section`,{className:`space-y-3`,children:[(0,Q.jsx)(`h3`,{className:`font-semibold`,children:n?`章节回顾`:`Chapters`}),q.chapters.map((e,t)=>(0,Q.jsxs)(`div`,{children:[(0,Q.jsxs)(`button`,{className:`text-sm text-accent-fg`,onClick:()=>oe(e.startedAtMs),children:[gt(e.startedAtMs),` · `,e.title]}),(0,Q.jsx)(`p`,{className:`mt-1 whitespace-pre-wrap text-sm text-fg-muted`,children:e.summary})]},t))]}):null]}):(0,Q.jsxs)(`div`,{className:`space-y-3`,children:[(0,Q.jsx)(`p`,{className:`text-sm text-fg-muted`,children:_e?n?`录音已保存,纪要正在生成。可以先查看逐字稿。`:`Recording saved. Summary is processing; you can read the transcript.`:n?`录音结束后自动生成纪要。`:`Summary appears after recording ends.`}),_e?(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(ge,{className:`h-6 w-3/4`}),(0,Q.jsx)(ge,{className:`h-24 w-full`})]}):null]}):(0,Q.jsxs)(`div`,{className:`space-y-4`,children:[(0,Q.jsxs)(`label`,{className:`flex items-center gap-2 rounded-md border border-edge px-3`,children:[(0,Q.jsx)(ee,{className:`size-4 text-fg-muted`}),(0,Q.jsx)(`input`,{className:`w-full bg-transparent py-2 text-sm outline-none`,placeholder:n?`查找原话或说话人`:`Search words or speaker`,value:y,onChange:e=>{b(e.target.value),R(1)}})]}),ye.slice(0,L*50).map(e=>(0,Q.jsxs)(`article`,{className:`rounded-md border p-3 ${H>=e.startedAtMs&&H<e.endedAtMs?`border-accent`:`border-edge-subtle`}`,children:[(0,Q.jsxs)(`div`,{className:`mb-2 flex items-center gap-3 text-xs text-fg-muted`,children:[(0,Q.jsxs)(`button`,{className:`inline-flex items-center gap-1 text-accent-fg`,onClick:()=>oe(e.startedAtMs),children:[(0,Q.jsx)(z,{className:`size-3`}),gt(e.startedAtMs)]}),(0,Q.jsx)(`span`,{children:e.speakerLabel??(n?`未区分说话人`:`Speaker unknown`)}),ve&&e.status===`confirmed`?(0,Q.jsx)(`button`,{className:`ml-auto`,onClick:()=>E({segment:e,text:e.displayText??e.rawText??``,speaker:e.speakerLabel??``}),children:n?`校对`:`Edit`}):null]}),(0,Q.jsx)(`p`,{className:`whitespace-pre-wrap text-sm leading-6`,children:e.displayText??e.rawText??(n?`等待转写`:`Awaiting transcription`)})]},e.sequence)),ye.length>L*50?(0,Q.jsx)(K,{onClick:()=>R(L+1),children:n?`加载更多`:`More`}):null]})}),G.audioAttachmentId&&!G.audioDeletedAt?(0,Q.jsxs)(`footer`,{className:`shrink-0 border-t border-edge-subtle p-3`,children:[(0,Q.jsx)(`audio`,{ref:B,controls:!0,preload:`metadata`,className:`h-10 w-full`,src:W(`${f}/audio`),onTimeUpdate:()=>ne((B.current?.currentTime??0)*1e3),onLoadedMetadata:()=>{V.current!==null&&B.current&&(B.current.currentTime=V.current,V.current=null)},onError:()=>P(n?`录音暂不可播放`:`Recording unavailable`)}),(0,Q.jsx)(`a`,{className:`mt-1 block text-right text-xs text-accent-fg`,href:W(`${f}/audio`),download:!0,children:n?`下载录音`:`Download recording`})]}):null,C?(0,Q.jsxs)(`aside`,{"aria-label":n?`原话证据`:`Source evidence`,className:`absolute inset-y-0 right-0 z-10 flex w-[min(26rem,100%)] flex-col border-l border-edge bg-surface-panel`,children:[(0,Q.jsxs)(`header`,{className:`flex shrink-0 items-center justify-between border-b border-edge p-4`,children:[(0,Q.jsx)(`h3`,{children:n?`原话证据`:`Source evidence`}),(0,Q.jsx)(`button`,{"aria-label":n?`关闭`:`Close`,onClick:()=>w(null),children:(0,Q.jsx)(te,{className:`size-4`})})]}),(0,Q.jsx)(`div`,{className:`min-h-0 flex-1 space-y-4 overflow-y-auto p-4`,children:C.length?C.map(e=>(0,Q.jsxs)(`article`,{children:[(0,Q.jsxs)(`button`,{className:`mb-2 text-xs text-accent-fg`,onClick:()=>oe(e.startedAtMs),children:[gt(e.startedAtMs),` · `,e.speakerLabel??(n?`说话人未明确`:`Unknown speaker`)]}),(0,Q.jsx)(`p`,{className:`whitespace-pre-wrap text-sm leading-7`,children:e.displayText??e.rawText})]},e.sequence)):(0,Q.jsx)(`p`,{children:n?`此版本暂无可定位原话。`:`No timed source available for this revision.`})})]}):null,D&&he?(0,Q.jsx)(mt,{initial:D,zh:n,busy:F,onClose:()=>O(null),onSave:e=>re(async()=>{await U(W(`${f}/summary`),{method:`PATCH`,body:JSON.stringify({...e,expectedRevision:he.revision})}),O(null)})},`${D.kind}:${D.itemId}:${he.revision}`):null,T?(0,Q.jsx)(de,{open:!0,onOpenChange:e=>{e||E(null)},children:(0,Q.jsxs)(ce,{children:[(0,Q.jsx)(ae,{className:`xopc-dialog-overlay fixed inset-0 z-[70] bg-scrim backdrop-blur-[2px]`}),(0,Q.jsxs)(le,{"aria-describedby":void 0,className:`xopc-dialog-content fixed left-1/2 top-1/2 z-[71] flex h-[min(28rem,90dvh)] 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-overlay`,children:[(0,Q.jsxs)(`header`,{className:`flex items-center justify-between border-b border-edge p-4`,children:[(0,Q.jsx)(ue,{children:n?`校对逐字稿`:`Edit transcript`}),(0,Q.jsx)(`button`,{"aria-label":n?`关闭校对`:`Close editor`,onClick:()=>E(null),children:(0,Q.jsx)(te,{className:`size-4`})})]}),(0,Q.jsxs)(`div`,{className:`min-h-0 flex-1 space-y-3 overflow-y-auto p-4`,children:[(0,Q.jsxs)(`label`,{className:`block text-xs`,children:[n?`本段说话人`:`Speaker for this segment`,(0,Q.jsx)(`input`,{className:`mt-1 w-full rounded border border-edge bg-surface-inset p-2 text-sm`,value:T.speaker,onChange:e=>E({...T,speaker:e.target.value})})]}),T.segment.speakerLabel?(0,Q.jsxs)(`label`,{className:`flex items-center gap-2 text-xs`,children:[(0,Q.jsx)(`input`,{type:`checkbox`,className:`ui-checkbox`,checked:!!T.applyToSpeakerGroup,onChange:e=>E({...T,applyToSpeakerGroup:e.target.checked})}),n?`同时更名所有同标签片段;输入已有标签可合并说话人`:`Rename all segments with this label; use an existing label to merge speakers`]}):null,(0,Q.jsx)(`textarea`,{className:`min-h-32 w-full rounded border border-edge bg-surface-inset p-2 text-sm`,value:T.text,onChange:e=>E({...T,text:e.target.value})})]}),(0,Q.jsx)(`footer`,{className:`border-t border-edge p-3`,children:(0,Q.jsxs)(K,{variant:`primary`,disabled:F||!T.text.trim(),onClick:()=>void re(async()=>{await U(W(`${f}/segments/${T.segment.sequence}`),{method:`PATCH`,body:JSON.stringify({displayText:T.text,speakerLabel:T.speaker,expectedRevision:T.segment.revision,applyToSpeakerGroup:T.applyToSpeakerGroup,expectedTranscriptRevision:me.revision})}),E(null)}),children:[(0,Q.jsx)(c,{className:`size-4`}),n?`保存修订`:`Save revision`]})})]})]})}):null]})}var vt={edit:R,ai_edit:B,sync:Te,restore:Fe};function yt(e,t){return{edit:t.triggerEdit,ai_edit:t.triggerAiEdit,sync:t.triggerSync,restore:t.triggerRestore}[e]??e}function bt({noteId:e,activeTimestamp:t,onSelect:n,onClose:r,onRestored:i}){let a=ie(e=>e.language),o=V(a).notes,s={justNow:o.justNow,minutesAgo:o.minutesAgo,today:o.today,yesterday:o.yesterday,daysAgo:o.daysAgo,locale:re(a)},{data:c}=pe(e?[`note-history`,e]:null,()=>D(e)),[l,u]=(0,Z.useState)(!1),[d,f]=(0,Z.useState)(null),[p,m]=(0,Z.useState)(null),h=(0,Z.useCallback)(async t=>{u(!0),m(null);try{await S(e,t),f(null),i()}catch{m(o.restoreFailed)}finally{u(!1)}},[e,o.restoreSuccess,o.restoreFailed,i]),g=Date.now();return(0,Q.jsxs)(`div`,{className:`flex h-full min-h-0 flex-col`,children:[(0,Q.jsxs)(`div`,{className:`flex shrink-0 items-center justify-between border-b border-edge px-4 py-3`,children:[(0,Q.jsxs)(`div`,{className:`flex items-center gap-2 text-sm font-medium text-fg`,children:[(0,Q.jsx)(Ne,{className:`size-4`,"aria-hidden":!0}),o.history]}),(0,Q.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,Q.jsx)(te,{className:`size-4`,"aria-hidden":!0})})]}),(0,Q.jsxs)(`div`,{className:`min-h-0 flex-1 overflow-y-auto`,children:[p?(0,Q.jsx)(`p`,{className:`border-b border-danger/20 bg-danger-soft px-4 py-2 text-xs text-danger`,role:`alert`,children:p}):null,c?.length?(0,Q.jsx)(`ul`,{className:`divide-y divide-edge`,children:c.map(e=>{let r=vt[e.trigger]??R,i=t===e.timestamp,a=d===e.timestamp;return(0,Q.jsxs)(`li`,{children:[(0,Q.jsxs)(`button`,{type:`button`,onClick:()=>n(e),className:H(`w-full px-4 py-3 text-left transition-colors`,i?`bg-accent/10`:`hover:bg-surface-hover`),children:[(0,Q.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,Q.jsx)(r,{className:`size-3.5 shrink-0 text-fg-muted`,"aria-hidden":!0}),(0,Q.jsx)(`span`,{className:`text-xs font-medium text-fg`,children:yt(e.trigger,o)}),(0,Q.jsx)(`span`,{className:`ml-auto text-xs text-fg-muted`,children:$(e.timestamp,g,s)})]}),e.snippet&&(0,Q.jsx)(`p`,{className:`mt-1 truncate text-xs text-fg-muted/60`,children:e.snippet})]}),i&&(0,Q.jsx)(`div`,{className:`border-t border-edge/50 px-4 py-2`,children:a?(0,Q.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,Q.jsx)(`span`,{className:`min-w-0 truncate text-xs text-fg-muted`,children:o.restoreConfirm}),(0,Q.jsx)(`button`,{type:`button`,onClick:t=>{t.stopPropagation(),h(e.timestamp)},disabled:l,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:l?`...`:o.restore}),(0,Q.jsx)(`button`,{type:`button`,onClick:e=>{e.stopPropagation(),f(null)},className:`shrink-0 rounded-lg px-2 py-1 text-xs text-fg-muted hover:bg-surface-hover`,children:`Cancel`})]}):(0,Q.jsx)(`button`,{type:`button`,onClick:t=>{t.stopPropagation(),f(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:o.restore})})]},e.timestamp)})}):(0,Q.jsxs)(`div`,{className:`px-4 py-8 text-center`,children:[(0,Q.jsx)(`p`,{className:`text-sm font-medium text-fg-muted`,children:o.historyEmpty}),(0,Q.jsx)(`p`,{className:`mt-1 text-xs text-fg-muted/60`,children:o.historyEmptyDescription})]})]})]})}function xt({noteId:e,note:t,catalyzing:n,onCatalyze:r,onClose:i,noteThreads:o,openingChat:s,onOpenChat:c,onOpenNewChat:l}){let u=V(ie(e=>e.language)).notes,d=a(),f=t?.aiDeep?.catalysis,p=f?.report??null,[m,h]=(0,Z.useState)(null),[g,_]=(0,Z.useState)(!1),{data:v,mutate:y,isLoading:b}=pe(e?[`note-agent-context-status`,e]:null,()=>k(e),{revalidateOnFocus:!1}),S=(0,Z.useCallback)(async()=>{if(!g){_(!0),h(null);try{await y(()=>I(e),{revalidate:!1})}catch(e){h(`${u.contextRebuildFailed}: ${e instanceof Error?e.message:u.quickCaptureFailedHint}`)}finally{_(!1)}}},[g,y,u.contextRebuildFailed,u.quickCaptureFailedHint,e]),C=(0,Z.useCallback)(async t=>{try{await x(e,t)}catch{}},[e]);return(0,Q.jsxs)(`div`,{className:`flex h-full flex-col`,children:[(0,Q.jsxs)(`div`,{className:`flex items-center justify-between border-b border-edge-subtle px-4 py-3`,children:[(0,Q.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,Q.jsx)(B,{className:`size-4 text-accent`,"aria-hidden":!0}),(0,Q.jsx)(`span`,{className:`text-sm font-semibold text-fg`,children:u.catalysisSectionTitle})]}),(0,Q.jsx)(`button`,{type:`button`,onClick:i,"aria-label":u.lightboxClose,className:`rounded-lg p-1.5 text-fg-muted transition-colors hover:bg-surface-hover hover:text-fg`,children:(0,Q.jsx)(je,{className:`size-4 rotate-180`,"aria-hidden":!0})})]}),(0,Q.jsxs)(`div`,{className:`flex-1 overflow-y-auto p-4`,children:[(0,Q.jsx)(`p`,{className:`mb-4 text-xs leading-relaxed text-fg-muted`,children:u.catalysisSectionDescription}),v?(0,Q.jsxs)(`section`,{className:`mb-4 rounded-xl bg-surface-base p-3`,children:[(0,Q.jsxs)(`div`,{className:`flex items-center justify-between gap-2`,children:[(0,Q.jsx)(`div`,{className:`text-xs font-medium text-fg-muted`,children:u.contextStatusTitle}),(0,Q.jsx)(`button`,{type:`button`,onClick:()=>void S(),disabled:b||g,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?u.processing:u.contextRebuild}),(0,Q.jsx)(`span`,{className:H(`rounded-full px-2 py-0.5 text-[11px] font-medium`,v.status===`ready`?`bg-emerald-500/10 text-emerald-600 dark:text-emerald-300`:v.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:v.status})]}),(0,Q.jsx)(`div`,{className:`mt-2 text-xs leading-relaxed text-fg-muted`,children:u.contextStatusDetail.replace(`{{attachments}}`,String(v.attachments.length)).replace(`{{tokens}}`,String(v.tokenEstimate??0))}),m?(0,Q.jsx)(`p`,{className:`mt-3 rounded-lg border border-danger/25 bg-danger-soft px-3 py-2 text-xs text-danger`,role:`alert`,children:m}):null,v.attachments.length>0?(0,Q.jsx)(`div`,{className:`mt-3 space-y-1.5`,children:v.attachments.slice(0,5).map(e=>(0,Q.jsxs)(`div`,{className:`flex items-center justify-between gap-2 rounded-lg bg-surface-hover px-2 py-1.5 text-xs`,children:[(0,Q.jsx)(`span`,{className:`min-w-0 truncate text-fg`,children:e.fileName}),(0,Q.jsx)(`span`,{className:`shrink-0 text-fg-muted`,children:e.status})]},e.attachmentId))}):null]}):null,(0,Q.jsx)(`button`,{type:`button`,onClick:r,disabled:n,className:`w-full rounded-lg bg-accent px-2.5 py-1.5 text-xs font-medium text-on-accent transition-colors hover:bg-accent/90 disabled:cursor-not-allowed disabled:opacity-50`,children:n?u.processing:p?u.recatalyze:u.catalyzeAction}),p?(0,Q.jsxs)(`div`,{className:`mt-4 space-y-4`,children:[(0,Q.jsxs)(`div`,{children:[(0,Q.jsx)(`div`,{className:`text-xs font-medium text-fg-muted`,children:u.valueHypothesis}),(0,Q.jsx)(`p`,{className:`mt-1 text-sm leading-relaxed text-fg`,children:p.valueHypothesis})]}),(0,Q.jsxs)(`div`,{children:[(0,Q.jsx)(`div`,{className:`text-xs font-medium text-fg-muted`,children:u.targetUsers}),(0,Q.jsx)(`div`,{className:`mt-1 flex flex-wrap gap-1.5`,children:p.targetUsers.slice(0,5).map(e=>(0,Q.jsx)(`span`,{className:`rounded-full bg-surface-hover px-2 py-0.5 text-xs text-fg`,children:e},e))})]}),(0,Q.jsxs)(`div`,{children:[(0,Q.jsx)(`div`,{className:`text-xs font-medium text-fg-muted`,children:u.keyQuestions}),(0,Q.jsx)(`ul`,{className:`mt-1 space-y-1 text-sm leading-relaxed text-fg`,children:p.keyQuestions.slice(0,3).map(e=>(0,Q.jsxs)(`li`,{className:`flex gap-2`,children:[(0,Q.jsx)(`span`,{className:`mt-2 size-1 shrink-0 rounded-full bg-accent`}),(0,Q.jsx)(`span`,{children:e})]},e))})]}),(0,Q.jsxs)(`div`,{children:[(0,Q.jsx)(`div`,{className:`text-xs font-medium text-fg-muted`,children:u.mvpPathLabel}),(0,Q.jsx)(`ol`,{className:`mt-1 space-y-1 text-sm leading-relaxed text-fg`,children:p.mvpPath.slice(0,3).map((e,t)=>(0,Q.jsxs)(`li`,{className:`flex gap-2`,children:[(0,Q.jsxs)(`span`,{className:`text-fg-muted`,children:[t+1,`.`]}),(0,Q.jsx)(`span`,{children:e})]},e))})]}),(0,Q.jsxs)(`div`,{children:[(0,Q.jsx)(`div`,{className:`text-xs font-medium text-fg-muted`,children:u.risks}),(0,Q.jsx)(`ul`,{className:`mt-1 space-y-1 text-sm leading-relaxed text-fg`,children:p.risks.slice(0,3).map(e=>(0,Q.jsxs)(`li`,{className:`flex gap-2`,children:[(0,Q.jsx)(`span`,{className:`mt-2 size-1 shrink-0 rounded-full bg-fg-muted`}),(0,Q.jsx)(`span`,{children:e})]},e))})]}),(0,Q.jsxs)(`div`,{children:[(0,Q.jsx)(`div`,{className:`text-xs font-medium text-fg-muted`,children:u.nextActions}),(0,Q.jsx)(`ul`,{className:`mt-1 space-y-1 text-sm leading-relaxed text-fg`,children:p.nextActions.slice(0,4).map(e=>(0,Q.jsxs)(`li`,{className:`flex gap-2`,children:[(0,Q.jsx)(`span`,{className:`rounded bg-accent/10 px-1.5 py-0.5 text-[10px] uppercase tracking-wide text-accent`,children:e.kind}),(0,Q.jsx)(`span`,{children:e.text})]},`${e.kind}:${e.text}`))})]}),(0,Q.jsxs)(`div`,{className:`flex items-center justify-between border-t border-edge-subtle pt-3`,children:[(0,Q.jsx)(`span`,{className:`text-xs text-fg-muted`,children:u.confidenceLabel.replace(`{{percent}}`,String(Math.round(p.confidence*100)))}),(0,Q.jsxs)(`div`,{className:`flex items-center gap-1`,children:[(0,Q.jsx)(`button`,{type:`button`,onClick:()=>void C(`helpful`),className:H(`rounded-lg p-1.5 text-fg-muted transition-colors hover:bg-surface-hover hover:text-fg`,f?.feedback===`helpful`&&`bg-accent/10 text-accent`),"aria-label":u.feedbackHelpfulAria,children:(0,Q.jsx)($e,{className:`size-3.5`,"aria-hidden":!0})}),(0,Q.jsx)(`button`,{type:`button`,onClick:()=>void C(`not_helpful`),className:H(`rounded-lg p-1.5 text-fg-muted transition-colors hover:bg-surface-hover hover:text-fg`,f?.feedback===`not_helpful`&&`bg-accent/10 text-accent`),"aria-label":u.feedbackNotHelpfulAria,children:(0,Q.jsx)(Ge,{className:`size-3.5`,"aria-hidden":!0})})]})]})]}):(0,Q.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:u.noCatalysisReportHint}),(0,Q.jsxs)(`section`,{className:`mt-6 rounded-xl bg-surface-base p-4`,children:[(0,Q.jsxs)(`div`,{className:`mb-3 flex items-center justify-between gap-3`,children:[(0,Q.jsxs)(`div`,{children:[(0,Q.jsxs)(`div`,{className:`flex items-center gap-2 text-sm font-semibold text-fg`,children:[(0,Q.jsx)(Ze,{className:`size-4 text-accent`,"aria-hidden":!0}),u.relatedThreadsTitle]}),(0,Q.jsx)(`p`,{className:`mt-1 text-xs text-fg-muted`,children:u.relatedThreadsDescription})]}),(0,Q.jsxs)(`div`,{className:`flex shrink-0 items-center gap-1.5`,children:[(0,Q.jsx)(`button`,{type:`button`,onClick:c,disabled:s,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:s?u.openingChat:u.openThread}),(0,Q.jsx)(`button`,{type:`button`,onClick:l,disabled:s,className:`rounded-lg bg-accent px-2.5 py-1.5 text-xs font-medium text-on-accent transition-colors hover:bg-accent/90 disabled:cursor-not-allowed disabled:opacity-50`,children:u.newThread})]})]}),o.length>0?(0,Q.jsx)(`div`,{className:`space-y-2`,children:o.slice(0,5).map(e=>(0,Q.jsxs)(`button`,{type:`button`,onClick:()=>d(`/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,Q.jsx)(`div`,{className:`truncate text-sm font-medium text-fg`,children:e.name||u.noteDiscussionFallback}),(0,Q.jsx)(`div`,{className:`mt-0.5 text-xs text-fg-muted`,children:u.messageCount.replace(`{{count}}`,String(e.messageCount??0))})]},e.key))}):(0,Q.jsx)(`div`,{className:`rounded-lg border border-dashed border-edge-subtle px-3 py-5 text-center text-sm text-fg-muted`,children:u.noThreads})]})]})]})}var St=[{value:`86400000`,zh:`24 小时`,en:`24 hours`},{value:`604800000`,zh:`7 天`,en:`7 days`},{value:`2592000000`,zh:`30 天`,en:`30 days`}];function Ct({open:e,onOpenChange:t,note:n}){let r=ie(e=>e.language)===`zh`,i=r?Dt:Ot,{data:a,mutate:o}=pe(e?[`note-shares`,n.id]:null,()=>A(n.id)),s=pe(e?`hosted-share-auth-status`:null,_e),d=s.data===!0,p=pe(e&&d?`hosted-publication-capabilities`:null,ye),m=p.data?.publishing.allowed===!0,g=pe(e&&d?[`hosted-note-publications`,n.id]:null,()=>E(n.id)),[_,y]=(0,Z.useState)(new Set),[b,x]=(0,Z.useState)(`86400000`),[S,C]=(0,Z.useState)(``),[T,D]=(0,Z.useState)(``),[O,k]=(0,Z.useState)(`hosted`),[j,N]=(0,Z.useState)(!1),[P,I]=(0,Z.useState)(null),[R,z]=(0,Z.useState)(null),[ee,B]=(0,Z.useState)(!1),[V,H]=(0,Z.useState)(null),U=(0,Z.useMemo)(()=>{let e=new Set;return n.markdown.replace(/xopc-attachment:\/\/notes\/([^/]+)\/([^\s)]+)/gi,(t,r,i)=>{try{decodeURIComponent(r)===n.id&&e.add(decodeURIComponent(i))}catch{}return t}),(n.attachments??[]).filter(t=>e.has(t.id))},[n.attachments,n.id,n.markdown]);(0,Z.useEffect)(()=>{e&&(y(new Set(U.map(e=>e.id))),z(null),B(!1),H(null))},[e,U]);let ne=async()=>{N(!0),H(null);try{let e={expectedNoteVersion:n.updatedAt,attachmentIds:[..._],ttlMs:Number(b),maxViews:S.trim()?Number(S):null,description:T.trim()||void 0};O===`hosted`?(z((await M(n.id,e)).shareUrl),await g.mutate()):(z((await w(n.id,e)).payload.shareUrl),await o())}catch(e){H(e instanceof Error?e.message:String(e))}finally{N(!1)}},re=async(e,t)=>{I(e.id),H(null);try{t===`refresh`?await v(n.id,e.id,{expectedNoteVersion:n.updatedAt,attachmentIds:[..._]}):await be(e.id),await g.mutate()}catch(e){H(e instanceof Error?e.message:String(e))}finally{I(null)}},W=async(e,t)=>{I(e.id),H(null);try{t===`refresh`?await F(n.id,e.id,{expectedNoteVersion:n.updatedAt,attachmentIds:[..._]}):t===`extend`?await ve(e.id,864e5):await q(e.id),await o()}catch(e){H(e instanceof Error?e.message:String(e))}finally{I(null)}},fe=async e=>{H(null);try{if(!await G(e)){B(!1),H(i.copyFailed);return}B(!0),window.setTimeout(()=>B(!1),1500)}catch{B(!1),H(i.copyFailed)}};return(0,Q.jsx)(de,{open:e,onOpenChange:t,children:(0,Q.jsxs)(ce,{children:[(0,Q.jsx)(ae,{className:`xopc-dialog-overlay fixed inset-0 z-[70] bg-scrim backdrop-blur-[2px]`}),(0,Q.jsxs)(le,{className:`xopc-dialog-content fixed left-1/2 top-1/2 z-[71] flex h-[min(42rem,calc(100dvh-2rem))] w-[min(40rem,calc(100vw-2rem))] -translate-x-1/2 -translate-y-1/2 flex-col overflow-hidden rounded-xl border border-edge bg-surface-overlay shadow-popover outline-none`,children:[(0,Q.jsxs)(`div`,{className:`flex shrink-0 items-start justify-between border-b border-edge px-5 py-4`,children:[(0,Q.jsxs)(`div`,{children:[(0,Q.jsxs)(ue,{className:`flex items-center gap-2 text-base font-semibold text-fg`,children:[(0,Q.jsx)(Pe,{className:`size-4`}),i.title]}),(0,Q.jsx)(oe,{className:`mt-1 text-xs text-fg-muted`,children:i.description})]}),(0,Q.jsx)(se,{asChild:!0,children:(0,Q.jsx)(`button`,{type:`button`,className:`rounded-md p-1.5 text-fg-muted hover:bg-surface-hover`,"aria-label":i.close,children:(0,Q.jsx)(te,{className:`size-4`})})})]}),(0,Q.jsxs)(`div`,{className:`min-h-0 flex-1 overflow-y-auto p-5`,children:[(0,Q.jsxs)(`section`,{className:`rounded-lg border border-edge bg-surface-inset p-4`,children:[(0,Q.jsx)(`div`,{className:`text-sm font-semibold text-fg`,children:n.title||i.untitled}),(0,Q.jsx)(`p`,{className:`mt-2 line-clamp-4 whitespace-pre-wrap text-xs leading-5 text-fg-muted`,children:n.markdown||i.empty}),(0,Q.jsx)(`p`,{className:`mt-3 text-xs text-fg-subtle`,children:i.privateExcluded})]}),U.length>0?(0,Q.jsxs)(`section`,{className:`mt-5`,children:[(0,Q.jsx)(`h3`,{className:`text-sm font-medium text-fg`,children:i.attachments}),(0,Q.jsx)(`div`,{className:`mt-2 grid gap-2`,children:U.map(e=>(0,Q.jsxs)(`label`,{className:`flex items-center gap-3 rounded-lg border border-edge-subtle px-3 py-2 text-sm text-fg-muted`,children:[(0,Q.jsx)(`input`,{type:`checkbox`,checked:_.has(e.id),onChange:()=>y(t=>{let n=new Set(t);return n.has(e.id)?n.delete(e.id):n.add(e.id),n}),className:`accent-accent`}),(0,Q.jsx)(`span`,{className:`min-w-0 flex-1 truncate`,children:e.fileName}),(0,Q.jsx)(`span`,{className:`text-xs text-fg-subtle`,children:Et(e.size)})]},e.id))})]}):null,(0,Q.jsxs)(`section`,{className:`mt-5 grid gap-4 sm:grid-cols-2`,children:[(0,Q.jsxs)(`label`,{className:`grid gap-1.5 text-xs text-fg-muted sm:col-span-2`,children:[i.delivery,(0,Q.jsxs)(l,{value:O,onChange:e=>k(e.target.value),children:[(0,Q.jsx)(u,{value:`hosted`,children:i.deliveryHosted}),(0,Q.jsx)(u,{value:`local`,children:i.deliveryLocal})]})]}),O===`hosted`&&s.data===!1?(0,Q.jsx)(`div`,{className:`sm:col-span-2`,children:(0,Q.jsx)(Ee,{providerId:`xopc-share`,displayName:`XOPC Hosted Share`,connected:!1,onConnected:()=>void s.mutate(!0,{revalidate:!1})})}):null,O===`hosted`&&d&&p.data&&!m?(0,Q.jsx)(`p`,{className:`rounded-lg border border-warning/30 bg-warning-soft px-3 py-2 text-xs text-warning sm:col-span-2`,children:i.hostedDisabled}):null,(0,Q.jsxs)(`label`,{className:`grid gap-1.5 text-xs text-fg-muted`,children:[i.expires,(0,Q.jsx)(l,{value:b,onChange:e=>x(e.target.value),children:St.map(e=>(0,Q.jsx)(u,{value:e.value,children:r?e.zh:e.en},e.value))})]}),(0,Q.jsxs)(`label`,{className:`grid gap-1.5 text-xs text-fg-muted`,children:[i.maxViews,(0,Q.jsx)(`input`,{type:`number`,min:1,max:1e3,value:S,onChange:e=>C(e.target.value),placeholder:i.unlimited,className:`h-9 rounded-md border border-edge bg-surface-panel px-3 text-sm text-fg outline-none focus:border-accent`})]}),(0,Q.jsxs)(`label`,{className:`grid gap-1.5 text-xs text-fg-muted sm:col-span-2`,children:[i.publicDescription,(0,Q.jsx)(`input`,{value:T,onChange:e=>D(e.target.value),className:`h-9 rounded-md border border-edge bg-surface-panel px-3 text-sm text-fg outline-none focus:border-accent`})]})]}),R?(0,Q.jsx)(`div`,{className:`mt-5 rounded-lg border border-success/25 bg-success-soft p-3`,children:(0,Q.jsxs)(`div`,{className:`flex gap-2`,children:[(0,Q.jsx)(`input`,{readOnly:!0,value:R,className:`min-w-0 flex-1 bg-transparent text-xs text-fg outline-none`}),(0,Q.jsxs)(K,{type:`button`,className:`px-2 py-1 text-xs`,variant:`ghost`,onClick:()=>void fe(R),children:[ee?(0,Q.jsx)(c,{className:`size-4`}):(0,Q.jsx)(f,{className:`size-4`}),ee?i.copied:i.copy]}),(0,Q.jsxs)(K,{type:`button`,className:`px-2 py-1 text-xs`,variant:`ghost`,onClick:()=>window.open(R,`_blank`,`noopener,noreferrer`),children:[(0,Q.jsx)(h,{className:`size-4`}),i.open]})]})}):null,V?(0,Q.jsx)(`p`,{className:`mt-4 rounded-lg border border-danger/25 bg-danger-soft px-3 py-2 text-sm text-danger`,children:V}):null,(a?.items.length??0)>0?(0,Q.jsxs)(`section`,{className:`mt-6 border-t border-edge pt-5`,children:[(0,Q.jsx)(`h3`,{className:`text-sm font-medium text-fg`,children:i.activeLinks}),(0,Q.jsx)(`div`,{className:`mt-2 grid gap-2`,children:a.items.map(e=>(0,Q.jsx)(Tt,{share:e,busy:P===e.id,t:i,onCopy:fe,onAction:W},e.id))})]}):null,(g.data?.length??0)>0?(0,Q.jsxs)(`section`,{className:`mt-6 border-t border-edge pt-5`,children:[(0,Q.jsx)(`h3`,{className:`text-sm font-medium text-fg`,children:i.hostedLinks}),(0,Q.jsx)(`div`,{className:`mt-2 grid gap-2`,children:g.data.map(e=>(0,Q.jsx)(wt,{publication:e,stale:e.source?.version!==String(n.updatedAt),busy:P===e.id,publishingAllowed:m,t:i,onCopy:fe,onAction:re},e.id))})]}):null]}),(0,Q.jsxs)(`div`,{className:`flex shrink-0 items-center justify-end gap-2 border-t border-edge px-5 py-3`,children:[(0,Q.jsx)(se,{asChild:!0,children:(0,Q.jsx)(K,{type:`button`,variant:`ghost`,children:i.close})}),(0,Q.jsxs)(K,{type:`button`,onClick:()=>void ne(),disabled:j||O===`hosted`&&(!d||!m),children:[j?(0,Q.jsx)(L,{className:`size-4 animate-spin`}):(0,Q.jsx)(Pe,{className:`size-4`}),j?i.creating:i.create]})]})]})]})})}function wt(e){let t=(0,rt.c)(64),{publication:n,stale:r,busy:i,publishingAllowed:a,t:o,onCopy:s,onAction:c}=e,l=n.revoked||n.expired,u=l&&`opacity-60`,d;t[0]===u?d=t[1]:(d=H(`rounded-lg border border-edge-subtle p-3`,u),t[0]=u,t[1]=d);let p=r&&!l?o.stale:l?o.inactive:o.active,m;t[2]===p?m=t[3]:(m=(0,Q.jsx)(`span`,{children:p}),t[2]=p,t[3]=m);let g;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(g=(0,Q.jsx)(`span`,{children:`·`}),t[4]=g):g=t[4];let _=n.maxViews===null?``:` / ${n.maxViews}`,v;t[5]!==n.viewCount||t[6]!==o.views||t[7]!==_?(v=(0,Q.jsxs)(`span`,{children:[o.views,` `,n.viewCount,_]}),t[5]=n.viewCount,t[6]=o.views,t[7]=_,t[8]=v):v=t[8];let y;t[9]===Symbol.for(`react.memo_cache_sentinel`)?(y=(0,Q.jsx)(`span`,{children:`·`}),t[9]=y):y=t[9];let b;t[10]!==n.revision||t[11]!==o.revision?(b=(0,Q.jsxs)(`span`,{children:[o.revision,` `,n.revision]}),t[10]=n.revision,t[11]=o.revision,t[12]=b):b=t[12];let x;t[13]!==m||t[14]!==v||t[15]!==b?(x=(0,Q.jsxs)(`div`,{className:`flex items-center gap-2 text-xs text-fg-muted`,children:[m,g,v,y,b]}),t[13]=m,t[14]=v,t[15]=b,t[16]=x):x=t[16];let S;t[17]===n.shareUrl?S=t[18]:(S=(0,Q.jsx)(`div`,{className:`mt-1 truncate text-xs text-fg-subtle`,children:n.shareUrl}),t[17]=n.shareUrl,t[18]=S);let C;t[19]!==x||t[20]!==S?(C=(0,Q.jsxs)(`div`,{className:`min-w-0`,children:[x,S]}),t[19]=x,t[20]=S,t[21]=C):C=t[21];let w;t[22]===i?w=t[23]:(w=i?(0,Q.jsx)(L,{className:`size-4 animate-spin text-fg-muted`}):null,t[22]=i,t[23]=w);let T;t[24]!==C||t[25]!==w?(T=(0,Q.jsxs)(`div`,{className:`flex items-start justify-between gap-3`,children:[C,w]}),t[24]=C,t[25]=w,t[26]=T):T=t[26];let E=!a,D;t[27]!==s||t[28]!==n.shareUrl?(D=()=>void s(n.shareUrl),t[27]=s,t[28]=n.shareUrl,t[29]=D):D=t[29];let O;t[30]===Symbol.for(`react.memo_cache_sentinel`)?(O=(0,Q.jsx)(f,{className:`size-3.5`}),t[30]=O):O=t[30];let k;t[31]!==o.copy||t[32]!==E||t[33]!==D?(k=(0,Q.jsxs)(K,{className:`px-2 py-1 text-xs`,variant:`ghost`,disabled:E,onClick:D,children:[O,o.copy]}),t[31]=o.copy,t[32]=E,t[33]=D,t[34]=k):k=t[34];let A=!a,j;t[35]===n.shareUrl?j=t[36]:(j=()=>window.open(n.shareUrl,`_blank`,`noopener,noreferrer`),t[35]=n.shareUrl,t[36]=j);let M;t[37]===Symbol.for(`react.memo_cache_sentinel`)?(M=(0,Q.jsx)(h,{className:`size-3.5`}),t[37]=M):M=t[37];let N;t[38]!==o.open||t[39]!==A||t[40]!==j?(N=(0,Q.jsxs)(K,{className:`px-2 py-1 text-xs`,variant:`ghost`,disabled:A,onClick:j,children:[M,o.open]}),t[38]=o.open,t[39]=A,t[40]=j,t[41]=N):N=t[41];let P;t[42]!==i||t[43]!==l||t[44]!==c||t[45]!==n||t[46]!==a||t[47]!==r||t[48]!==o.refresh?(P=r&&!l?(0,Q.jsxs)(K,{className:`px-2 py-1 text-xs`,variant:`ghost`,disabled:i||!a,onClick:()=>void c(n,`refresh`),children:[(0,Q.jsx)(Te,{className:`size-3.5`}),o.refresh]}):null,t[42]=i,t[43]=l,t[44]=c,t[45]=n,t[46]=a,t[47]=r,t[48]=o.refresh,t[49]=P):P=t[49];let F;t[50]!==i||t[51]!==c||t[52]!==n||t[53]!==o.revoke?(F=n.revoked?null:(0,Q.jsxs)(K,{className:`px-2 py-1 text-xs`,variant:`ghost`,disabled:i,onClick:()=>void c(n,`revoke`),children:[(0,Q.jsx)(We,{className:`size-3.5`}),o.revoke]}),t[50]=i,t[51]=c,t[52]=n,t[53]=o.revoke,t[54]=F):F=t[54];let I;t[55]!==k||t[56]!==N||t[57]!==P||t[58]!==F?(I=(0,Q.jsxs)(`div`,{className:`mt-2 flex flex-wrap gap-1`,children:[k,N,P,F]}),t[55]=k,t[56]=N,t[57]=P,t[58]=F,t[59]=I):I=t[59];let R;return t[60]!==T||t[61]!==d||t[62]!==I?(R=(0,Q.jsxs)(`div`,{className:d,children:[T,I]}),t[60]=T,t[61]=d,t[62]=I,t[63]=R):R=t[63],R}function Tt(e){let t=(0,rt.c)(68),{share:n,busy:r,t:i,onCopy:a,onAction:o}=e,s=n.revoked||n.expired,c=s&&`opacity-60`,l;t[0]===c?l=t[1]:(l=H(`rounded-lg border border-edge-subtle p-3`,c),t[0]=c,t[1]=l);let u=n.stale&&!s?i.stale:s?i.inactive:i.active,d;t[2]===u?d=t[3]:(d=(0,Q.jsx)(`span`,{children:u}),t[2]=u,t[3]=d);let p;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(p=(0,Q.jsx)(`span`,{children:`·`}),t[4]=p):p=t[4];let m=n.maxViews===null?``:` / ${n.maxViews}`,g;t[5]!==n.viewCount||t[6]!==i.views||t[7]!==m?(g=(0,Q.jsxs)(`span`,{children:[i.views,` `,n.viewCount,m]}),t[5]=n.viewCount,t[6]=i.views,t[7]=m,t[8]=g):g=t[8];let _;t[9]===Symbol.for(`react.memo_cache_sentinel`)?(_=(0,Q.jsx)(`span`,{children:`·`}),t[9]=_):_=t[9];let v;t[10]===n.expiresAt?v=t[11]:(v=new Date(n.expiresAt).toLocaleDateString(),t[10]=n.expiresAt,t[11]=v);let y;t[12]===v?y=t[13]:(y=(0,Q.jsx)(`span`,{children:v}),t[12]=v,t[13]=y);let b;t[14]!==y||t[15]!==d||t[16]!==g?(b=(0,Q.jsxs)(`div`,{className:`flex items-center gap-2 text-xs text-fg-muted`,children:[d,p,g,_,y]}),t[14]=y,t[15]=d,t[16]=g,t[17]=b):b=t[17];let x;t[18]===n.shareUrl?x=t[19]:(x=(0,Q.jsx)(`div`,{className:`mt-1 truncate text-xs text-fg-subtle`,children:n.shareUrl}),t[18]=n.shareUrl,t[19]=x);let S;t[20]!==b||t[21]!==x?(S=(0,Q.jsxs)(`div`,{className:`min-w-0`,children:[b,x]}),t[20]=b,t[21]=x,t[22]=S):S=t[22];let C;t[23]===r?C=t[24]:(C=r?(0,Q.jsx)(L,{className:`size-4 animate-spin text-fg-muted`}):null,t[23]=r,t[24]=C);let w;t[25]!==S||t[26]!==C?(w=(0,Q.jsxs)(`div`,{className:`flex items-start justify-between gap-3`,children:[S,C]}),t[25]=S,t[26]=C,t[27]=w):w=t[27];let T;t[28]!==a||t[29]!==n.shareUrl?(T=()=>void a(n.shareUrl),t[28]=a,t[29]=n.shareUrl,t[30]=T):T=t[30];let E;t[31]===Symbol.for(`react.memo_cache_sentinel`)?(E=(0,Q.jsx)(f,{className:`size-3.5`}),t[31]=E):E=t[31];let D;t[32]!==i.copy||t[33]!==T?(D=(0,Q.jsxs)(K,{className:`px-2 py-1 text-xs`,variant:`ghost`,onClick:T,children:[E,i.copy]}),t[32]=i.copy,t[33]=T,t[34]=D):D=t[34];let O;t[35]===n.shareUrl?O=t[36]:(O=()=>window.open(n.shareUrl,`_blank`,`noopener,noreferrer`),t[35]=n.shareUrl,t[36]=O);let k;t[37]===Symbol.for(`react.memo_cache_sentinel`)?(k=(0,Q.jsx)(h,{className:`size-3.5`}),t[37]=k):k=t[37];let A;t[38]!==i.open||t[39]!==O?(A=(0,Q.jsxs)(K,{className:`px-2 py-1 text-xs`,variant:`ghost`,onClick:O,children:[k,i.open]}),t[38]=i.open,t[39]=O,t[40]=A):A=t[40];let j;t[41]!==r||t[42]!==s||t[43]!==o||t[44]!==n||t[45]!==i.refresh?(j=n.stale&&!s?(0,Q.jsxs)(K,{className:`px-2 py-1 text-xs`,variant:`ghost`,disabled:r,onClick:()=>void o(n,`refresh`),children:[(0,Q.jsx)(Te,{className:`size-3.5`}),i.refresh]}):null,t[41]=r,t[42]=s,t[43]=o,t[44]=n,t[45]=i.refresh,t[46]=j):j=t[46];let M;t[47]!==r||t[48]!==s||t[49]!==o||t[50]!==n||t[51]!==i.extend?(M=s?null:(0,Q.jsx)(K,{className:`px-2 py-1 text-xs`,variant:`ghost`,disabled:r,onClick:()=>void o(n,`extend`),children:i.extend}),t[47]=r,t[48]=s,t[49]=o,t[50]=n,t[51]=i.extend,t[52]=M):M=t[52];let N;t[53]!==r||t[54]!==o||t[55]!==n||t[56]!==i.revoke?(N=n.revoked?null:(0,Q.jsxs)(K,{className:`px-2 py-1 text-xs`,variant:`ghost`,disabled:r,onClick:()=>void o(n,`revoke`),children:[(0,Q.jsx)(We,{className:`size-3.5`}),i.revoke]}),t[53]=r,t[54]=o,t[55]=n,t[56]=i.revoke,t[57]=N):N=t[57];let P;t[58]!==D||t[59]!==A||t[60]!==j||t[61]!==M||t[62]!==N?(P=(0,Q.jsxs)(`div`,{className:`mt-2 flex flex-wrap gap-1`,children:[D,A,j,M,N]}),t[58]=D,t[59]=A,t[60]=j,t[61]=M,t[62]=N,t[63]=P):P=t[63];let F;return t[64]!==w||t[65]!==l||t[66]!==P?(F=(0,Q.jsxs)(`div`,{className:l,children:[w,P]}),t[64]=w,t[65]=l,t[66]=P,t[67]=F):F=t[67],F}function Et(e){return e<1024?`${e} B`:e<1048576?`${(e/1024).toFixed(1)} KB`:`${(e/1048576).toFixed(1)} MB`}var Dt={title:`分享笔记`,description:`创建一个无需登录即可查看的只读快照。`,close:`关闭`,untitled:`无标题笔记`,empty:`空笔记`,privateExcluded:`不会分享标签、AI 元数据、项目、讨论、历史版本或未引用附件。`,attachments:`包含的附件`,expires:`有效期`,maxViews:`最多查看次数`,unlimited:`不限`,publicDescription:`公开说明(可选)`,create:`创建分享链接`,creating:`创建中…`,copy:`复制`,copied:`已复制`,open:`打开`,activeLinks:`这条笔记的分享`,copyFailed:`无法复制到剪贴板,请手动选择链接并复制。`,delivery:`发布方式`,deliveryHosted:`平台托管(外网稳定访问)`,deliveryLocal:`本机直连(需要隧道或公网部署)`,hostedLinks:`平台托管发布`,revision:`版本`,hostedDisabled:`管理员已暂停你的公网分享能力。已有托管链接当前不可访问,但仍可撤销。`,stale:`旧版本`,inactive:`已失效`,active:`有效`,views:`查看`,refresh:`更新快照`,extend:`延长 24 小时`,revoke:`撤销`},Ot={title:`Share Note`,description:`Create a read-only snapshot that opens without sign-in.`,close:`Close`,untitled:`Untitled Note`,empty:`Empty Note`,privateExcluded:`Tags, AI metadata, projects, discussions, history, and unreferenced attachments are excluded.`,attachments:`Included attachments`,expires:`Expires`,maxViews:`Maximum views`,unlimited:`Unlimited`,publicDescription:`Public description (optional)`,create:`Create share link`,creating:`Creating…`,copy:`Copy`,copied:`Copied`,open:`Open`,activeLinks:`Shares for this Note`,copyFailed:`Could not copy to the clipboard. Select the link and copy it manually.`,delivery:`Publishing method`,deliveryHosted:`Hosted platform (stable public access)`,deliveryLocal:`Direct from this device (requires public access)`,hostedLinks:`Hosted publications`,revision:`Revision`,hostedDisabled:`An administrator has paused public sharing for your account. Existing hosted links are unavailable, but can still be revoked.`,stale:`Older version`,inactive:`Inactive`,active:`Active`,views:`Views`,refresh:`Update snapshot`,extend:`Extend 24 hours`,revoke:`Revoke`};function kt(e){let t=(0,rt.c)(18),{input:n,labels:r,showLabel:i}=e,a=i===void 0?!0:i,o;t[0]===n?o=t[1]:(o=n(),t[0]=n,t[1]=o);let s=o.source.id,c;t[2]===s?c=t[3]:(c=e=>e.source?.type===`note`&&e.source.id===s&&e.status!==`idle`,t[2]=s,t[3]=c);let l=ze(c),u;t[4]===s?u=t[5]:(u=e=>e.source?.type===`note`&&e.source.id===s&&e.status===`preparing`,t[4]=s,t[5]=u);let d=ze(u),f=ze(At),p;t[6]!==n||t[7]!==r||t[8]!==d||t[9]!==a?(p=(0,Q.jsx)(Re,{input:n,labels:r,disabled:d,showLabel:a}),t[6]=n,t[7]=r,t[8]=d,t[9]=a,t[10]=p):p=t[10];let m;t[11]!==l||t[12]!==r||t[13]!==f?(m=l?(0,Q.jsx)(`button`,{type:`button`,onClick:f,title:r.stop,"aria-label":r.stop,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`,children:(0,Q.jsx)(X,{className:`size-3.5`,"aria-hidden":!0})}):null,t[11]=l,t[12]=r,t[13]=f,t[14]=m):m=t[14];let h;return t[15]!==p||t[16]!==m?(h=(0,Q.jsxs)(`div`,{className:`flex items-center gap-1`,children:[p,m]}),t[15]=p,t[16]=m,t[17]=h):h=t[17],h}function At(e){return e.stop}function jt(e,t){let n=Le(t.replace(/^\s*(`{3,}|~{3,})[^\n]*$/gm,``).replace(/xopc-attachment:\/\/[^\s)]+/g,``).replace(/^(\s*[-*+]\s+)\[[ xX]\]\s*/gm,`$1`)),r=Le(e);return!r||n.split(`
|
|
3
|
+
`)[0]===r?n:[r,n].filter(Boolean).join(`
|
|
4
|
+
|
|
5
|
+
`)}var Mt=()=>i(()=>import(`./block-editor-r4mKGacz.js`),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,82,83,84,85,86,87,88,89,90,91,92,93,94,95,96,97,98,99,100,101,102,103,104,105,106,107,108,109,110,111])),Nt=()=>i(()=>import(`./markdown-editor-BhBJANcx.js`),__vite__mapDeps([112,1,108,5,113,114,3])),Pt=(0,Z.lazy)(()=>Mt().then(e=>({default:e.BlockEditor}))),Ft=(0,Z.lazy)(()=>Nt().then(e=>({default:e.MarkdownEditor})));function It(){let e=(0,rt.c)(1),t;return e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,Q.jsxs)(`div`,{className:`flex h-full min-h-0 flex-col px-6 py-4`,"aria-busy":!0,children:[(0,Q.jsx)(`div`,{className:`h-8 w-56 max-w-full animate-pulse rounded-md bg-surface-hover`}),(0,Q.jsx)(`div`,{className:`mt-6 h-4 w-11/12 animate-pulse rounded bg-surface-hover`}),(0,Q.jsx)(`div`,{className:`mt-3 h-4 w-9/12 animate-pulse rounded bg-surface-hover`}),(0,Q.jsx)(`div`,{className:`mt-3 h-4 w-10/12 animate-pulse rounded bg-surface-hover`})]}),e[0]=t):t=e[0],t}function Lt(e){let t=(0,rt.c)(29),{mode:n,onModeChange:r,labels:i}=e,a;t[0]===i.edit?a=t[1]:(a={id:`wysiwyg`,label:i.edit,Icon:De},t[0]=i.edit,t[1]=a);let o;t[2]===i.source?o=t[3]:(o={id:`source`,label:i.source,Icon:Ye},t[2]=i.source,t[3]=o);let s;t[4]===i.preview?s=t[5]:(s={id:`preview`,label:i.preview,Icon:g},t[4]=i.preview,t[5]=s);let l;t[6]!==a||t[7]!==o||t[8]!==s?(l=[a,o,s],t[6]=a,t[7]=o,t[8]=s,t[9]=l):l=t[9];let u=l,d;t[10]!==n||t[11]!==u?(d=u.find(e=>e.id===n)??u[0],t[10]=n,t[11]=u,t[12]=d):d=t[12];let f=d,p=f.Icon,m=Rt,h;t[13]===p?h=t[14]:(h=(0,Q.jsx)(p,{className:`size-3.5`,"aria-hidden":!0}),t[13]=p,t[14]=h);let _;t[15]===f.label?_=t[16]:(_=(0,Q.jsx)(`span`,{children:f.label}),t[15]=f.label,t[16]=_);let v;t[17]===Symbol.for(`react.memo_cache_sentinel`)?(v=(0,Q.jsx)(J,{className:`size-3 text-fg-subtle`,"aria-hidden":!0}),t[17]=v):v=t[17];let y;t[18]!==f.label||t[19]!==h||t[20]!==_?(y=(0,Q.jsx)(we,{asChild:!0,children:(0,Q.jsxs)(`button`,{type:`button`,"aria-label":f.label,className:`inline-flex h-8 items-center gap-1.5 rounded-lg border border-edge px-2.5 text-xs font-medium 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:[h,_,v]})}),t[18]=f.label,t[19]=h,t[20]=_,t[21]=y):y=t[21];let b;t[22]!==n||t[23]!==u||t[24]!==r?(b=(0,Q.jsx)(Ae,{children:(0,Q.jsx)(Se,{align:`end`,sideOffset:6,className:`z-50 min-w-36 rounded-xl border border-edge bg-surface-panel p-1 shadow-popover`,children:u.map(e=>{let{id:t,label:i,Icon:a}=e;return(0,Q.jsxs)(Ke,{onSelect:()=>r(t),onPointerMove:()=>m(t),onFocus:()=>m(t),className:`flex cursor-pointer items-center gap-2 rounded-lg px-3 py-2 text-sm text-fg outline-none hover:bg-surface-hover focus:bg-surface-hover`,children:[(0,Q.jsx)(a,{className:`size-4 text-fg-muted`,"aria-hidden":!0}),(0,Q.jsx)(`span`,{className:`flex-1`,children:i}),n===t?(0,Q.jsx)(c,{className:`size-4 text-accent`,"aria-hidden":!0}):null]},t)})})}),t[22]=n,t[23]=u,t[24]=r,t[25]=b):b=t[25];let x;return t[26]!==b||t[27]!==y?(x=(0,Q.jsxs)(Me,{modal:!1,children:[y,b]}),t[26]=b,t[27]=y,t[28]=x):x=t[28],x}function Rt(e){e===`wysiwyg`&&Mt(),e===`source`&&Nt()}function zt(e){let t=(0,rt.c)(16),{noteId:n,onBack:r,onSaved:i,showBackButton:a,backButtonClassName:o,clearHeaderOnCleanup:s,onOpenSearch:c,autoFocus:l,initialMode:u,onAutoFocusConsumed:d}=e,f=a===void 0?!0:a,p=s===void 0?!0:s,m=l===void 0?!1:l,h=ie(Bt),g;t[0]===h?g=t[1]:(g=V(h),t[0]=h,t[1]=g);let _=g.notes.lightboxClose,v;t[2]!==m||t[3]!==o||t[4]!==p||t[5]!==u||t[6]!==n||t[7]!==d||t[8]!==r||t[9]!==c||t[10]!==i||t[11]!==f?(v=(0,Q.jsx)(Vt,{noteId:n,onBack:r,onSaved:i,showBackButton:f,backButtonClassName:o,clearHeaderOnCleanup:p,onOpenSearch:c,autoFocus:m,initialMode:u,onAutoFocusConsumed:d}),t[2]=m,t[3]=o,t[4]=p,t[5]=u,t[6]=n,t[7]=d,t[8]=r,t[9]=c,t[10]=i,t[11]=f,t[12]=v):v=t[12];let y;return t[13]!==_||t[14]!==v?(y=(0,Q.jsx)(tt,{closeLabel:_,children:v}),t[13]=_,t[14]=v,t[15]=y):y=t[15],y}function Bt(e){return e.language}function Vt({noteId:e,onBack:t,onSaved:n,showBackButton:r=!0,backButtonClassName:i,clearHeaderOnCleanup:o=!0,onOpenSearch:s,autoFocus:l=!1,initialMode:u=`wysiwyg`,onAutoFocusConsumed:d}){let f=ie(e=>e.language),p=V(f).notes,h=V(f).chat.pageContext,g=V(f).automations.suggestions,{data:_}=pe([`note-discussion-document`,e],()=>He(e)),[v,x]=(0,Z.useState)(!0),S=a(),w=he(e=>e.resolved)===`dark`,{openImage:E}=et(),[D,k]=(0,Z.useState)(u),[A,M]=(0,Z.useState)(null),[F,I]=(0,Z.useState)(null),[L,R]=(0,Z.useState)(!1),[z,te]=(0,Z.useState)(``),[U,re]=(0,Z.useState)(360),[W,ae]=(0,Z.useState)(!1),[oe,se]=(0,Z.useState)(!1),[ce,le]=(0,Z.useState)(!1),ue=(0,Z.useRef)(0);(0,Z.useEffect)(()=>()=>{ue.current+=1},[e]);let[de,G]=(0,Z.useState)(null),[K,ge]=(0,Z.useState)(!1),[q,_e]=(0,Z.useState)(null),[ve,ye]=(0,Z.useState)(!1),[be,Te]=(0,Z.useState)(!1),Ee=(0,Z.useRef)(!1),Fe=(0,Z.useRef)(!1),Le=(0,Z.useRef)(null),Re=(0,Z.useRef)(null),J=(0,Z.useRef)(null),Ue=(0,Z.useRef)(null),Ge=(0,Z.useRef)(null),qe=(0,Z.useRef)(null),Je=(0,Z.useRef)(null),Ye=(0,Z.useRef)(null),Xe=(0,Z.useRef)(null),Qe=ke(e=>e.setPageHeader),$e=ke(e=>e.clearPageHeader),{data:Y,mutate:X,error:tt}=pe(e?[`note-detail`,e]:null,()=>T(e)),{data:nt=[],mutate:rt}=pe(e?[`note-threads`,e]:null,()=>O(e),{revalidateOnFocus:!1}),it=F!==null,at=(0,Z.useCallback)(e=>{G(`${p.refreshFailed}: ${e instanceof Error?e.message:p.quickCaptureFailedHint}`)},[p.quickCaptureFailedHint,p.refreshFailed]);(0,Z.useEffect)(()=>{if(!e)return;let t=t=>{t.detail?.noteId===e&&X().catch(at)};return window.addEventListener(`note-updated`,t),()=>window.removeEventListener(`note-updated`,t)},[X,e,at]),(0,Z.useEffect)(()=>{Ee.current=!1,te(``),I(null),M(null),Fe.current=!1,Xe.current=null},[e]),(0,Z.useEffect)(()=>{!Y||Ee.current||(te(Y.title??``),Ee.current=!0)},[Y]),(0,Z.useEffect)(()=>{if(!l||!Y||it||Xe.current===e)return;let t=window.requestAnimationFrame(()=>{Ye.current?.focus(),d?.()});return Xe.current=e,()=>window.cancelAnimationFrame(t)},[l,it,Y,e,d]);let ot=Y?new Date(Y.createdAt).toLocaleString(void 0,{year:`numeric`,month:`short`,day:`numeric`,hour:`2-digit`,minute:`2-digit`}):``,st=(0,Z.useMemo)(()=>r?(0,Q.jsx)(`button`,{type:`button`,onClick:t,"aria-label":p.back,className:H(`rounded-lg p-1.5 text-fg-muted transition-colors hover:bg-surface-hover hover:text-fg`,me,i),children:(0,Q.jsx)(je,{className:`size-4`,"aria-hidden":!0})}):null,[i,p.back,t,r]),$=(0,Z.useCallback)(()=>{let t=ze.getState();t.source?.type===`note`&&t.source.id===e&&t.stop()},[e]),ct=(0,Z.useCallback)(e=>{e!==`preview`&&$(),k(e)},[$]),lt=(0,Z.useCallback)(t=>{$(),te(t),e&&(Ue.current=t,Re.current&&clearTimeout(Re.current),Re.current=setTimeout(async()=>{let t=Ue.current;if(Ue.current=null,t!==null){R(!0);try{await y(e,{title:t}),await X(),n?.()}catch{}finally{R(!1)}}},600))},[$,e,X,n]),dt=(0,Z.useMemo)(()=>(0,Q.jsxs)(`div`,{className:H(`flex min-w-0 items-center gap-2`,me),children:[(0,Q.jsx)(`span`,{className:`min-w-0 truncate text-sm font-medium text-fg`,title:z||ot||void 0,children:z||ot}),L?(0,Q.jsx)(`span`,{className:`shrink-0 text-xs text-fg-muted opacity-60`,children:p.saving}):null]}),[p.saving,L,ot,z]),ft=(0,Z.useCallback)(async(t=!1)=>{le(!0),G(null);try{let n=await C(e,{forceNew:t});await X(),await rt(),S(`/chat/${encodeURIComponent(n.conversationId)}`)}catch(e){G(`${p.chatOpenFailedTitle}: ${e instanceof Error?e.message:p.chatOpenFailedMessage}`)}finally{le(!1)}},[X,rt,S,e,p.chatOpenFailedMessage,p.chatOpenFailedTitle]),pt=(0,Z.useCallback)(async()=>{se(!0),G(null);try{await j(e),await X()}catch(e){G(`${p.catalysisFailed}: ${e instanceof Error?e.message:p.chatOpenFailedMessage}`)}finally{se(!1)}},[X,e]),mt=(0,Z.useCallback)(()=>{M(A===`breakdown`?null:`breakdown`),!Y?.aiDeep?.catalysis?.report&&!oe&&pt()},[A,oe,pt,Y?.aiDeep?.catalysis?.report]),ht=(0,Z.useCallback)(()=>{let t=F?F.markdown??``:J.current??Y?.markdown??``,n=F?F.title??``:z,r=jt(n,t);return{source:{type:`note`,id:e,title:n||p.titlePlaceholder},text:r,language:xe(r,f)}},[f,p.titlePlaceholder,Y?.markdown,e,F,z]),gt=(0,Z.useCallback)(async()=>{Le.current&&clearTimeout(Le.current),Re.current&&clearTimeout(Re.current),Le.current=null,Re.current=null;let t=J.current,r=Ue.current;J.current=null,Ue.current=null;let i={};if(t!==null&&(i.markdown=t),r!==null&&(i.title=r),Object.keys(i).length===0)return Y??null;R(!0);try{let t=await y(e,i);return await X(t,{revalidate:!1}),n?.(),t}catch(e){return J.current===null&&(J.current=t),Ue.current===null&&(Ue.current=r),G(`${p.saveFailed}: ${e instanceof Error?e.message:p.saveFailedHint}`),null}finally{R(!1)}},[X,p.saveFailed,p.saveFailedHint,Y,e,n]),vt=(0,Z.useCallback)(async()=>{if(!Y||ce||L)return;le(!0),G(null);let e=ne.getState(),t=++ue.current,n=()=>ue.current===t&&ne.getState().baseUrl===e.baseUrl&&ne.getState().conversationId===e.conversationId;try{let t=window.getSelection(),r=t?.anchorNode&&t.focusNode&&Ge.current?.contains(t.anchorNode)&&Ge.current.contains(t.focusNode)?t.toString():``,i=await gt();if(!i||!n())return;if(J.current!==null||Ue.current!==null)throw Error(h.unavailable);let a=Oe.capture({title:i.title||i.id,text:i.markdown,resourceRefs:[{kind:`note`,id:i.id,revision:String(i.remoteVersion??1)}],selection:r?{text:r,draft:!1}:void 0}),o=await new fe().createSession();if(!n())return;if(J.current!==null||Ue.current!==null)throw Error(h.unavailable);let s=Ce(e.baseUrl,e.conversationId,o.key);if(!Oe.put(s,a))throw Error(h.unavailable);S(`/chat/${encodeURIComponent(o.key)}`)}catch{n()&&G(h.unavailable)}finally{ue.current===t&&le(!1)}},[Y,ce,L,gt,S,h.unavailable]),yt=(0,Z.useCallback)(async()=>{G(null);let e=await gt();e&&(_e(e),ge(!0))},[gt]),St=(0,Z.useCallback)(async()=>{if(!(be||L)){ye(!1),Te(!0),G(null),$(),Le.current&&clearTimeout(Le.current),Re.current&&clearTimeout(Re.current),Le.current=null,Re.current=null,J.current=null,Ue.current=null;try{await N(e),window.dispatchEvent(new CustomEvent(`note-deleted`,{detail:{noteId:e}})),n?.(),t()}catch(e){G(`${p.deleteFailed}: ${e instanceof Error?e.message:p.quickCaptureFailedHint}`)}finally{Te(!1)}}},[be,p.deleteFailed,p.quickCaptureFailedHint,e,t,n,L,$]),wt=(0,Z.useMemo)(()=>(0,Q.jsxs)(`div`,{className:H(`flex min-w-0 items-center gap-1 sm:gap-2`,me),children:[s?(0,Q.jsx)(`button`,{type:`button`,onClick:s,"aria-label":p.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,Q.jsx)(ee,{className:`size-4`,"aria-hidden":!0})}):null,(0,Q.jsx)(kt,{input:ht,showLabel:!1,labels:{read:p.readAloud,preparing:p.readAloudPreparing,pause:p.readAloudPause,resume:p.readAloudResume,retry:p.readAloudRetry,stop:p.readAloudStop}}),(0,Q.jsxs)(`button`,{type:`button`,onClick:mt,disabled:oe,"aria-label":p.catalysisSectionTitle,className:H(`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`,A===`breakdown`?`bg-accent/10 text-accent`:`bg-accent/10 text-fg hover:bg-accent/15`),children:[(0,Q.jsx)(B,{className:`size-3.5`,"aria-hidden":!0}),(0,Q.jsx)(`span`,{className:`hidden sm:inline`,children:oe?p.catalyzing:p.catalyzeButton})]}),(0,Q.jsxs)(`button`,{type:`button`,onClick:()=>ft(!1),"aria-label":p.openChatButton,disabled:ce,className:H(`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,Q.jsx)(Ze,{className:`size-3.5`,"aria-hidden":!0}),(0,Q.jsx)(`span`,{className:`hidden sm:inline`,children:ce?p.openingChat:p.openChatButton})]}),(0,Q.jsx)(Lt,{mode:D,onModeChange:ct,labels:{edit:p.modeEdit,source:p.modeSource,preview:p.modePreview}}),(0,Q.jsxs)(`button`,{type:`button`,onClick:()=>void vt(),disabled:ce||L||!Y||!!F,className:`inline-flex items-center gap-1.5 rounded-lg border border-edge px-2.5 py-1.5 text-xs text-fg-muted hover:bg-surface-hover hover:text-fg focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent disabled:opacity-50`,children:[(0,Q.jsx)(De,{className:`size-3.5`,"aria-hidden":!0}),h.capture]}),(0,Q.jsxs)(Me,{modal:!1,children:[(0,Q.jsx)(we,{asChild:!0,children:(0,Q.jsx)(`button`,{type:`button`,"aria-label":p.noteActions,title:p.noteActions,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`,children:(0,Q.jsx)(m,{className:`size-4`,"aria-hidden":!0})})}),(0,Q.jsx)(Ae,{children:(0,Q.jsxs)(Se,{align:`end`,sideOffset:6,className:`z-50 min-w-40 rounded-xl border border-edge bg-surface-panel p-1 shadow-popover`,children:[(0,Q.jsxs)(Ke,{onSelect:()=>void yt(),className:`flex cursor-pointer items-center gap-2 rounded-lg px-3 py-2 text-sm text-fg outline-none hover:bg-surface-hover focus:bg-surface-hover`,children:[(0,Q.jsx)(Pe,{className:`size-4 text-fg-muted`,"aria-hidden":!0}),f===`zh`?`分享`:`Share`]}),(0,Q.jsxs)(Ke,{onSelect:()=>M(A===`history`?null:`history`),className:`flex cursor-pointer items-center gap-2 rounded-lg px-3 py-2 text-sm text-fg outline-none hover:bg-surface-hover focus:bg-surface-hover`,children:[(0,Q.jsx)(Ne,{className:`size-4 text-fg-muted`,"aria-hidden":!0}),(0,Q.jsx)(`span`,{className:`flex-1`,children:p.history}),A===`history`?(0,Q.jsx)(c,{className:`size-4 text-accent`,"aria-hidden":!0}):null]}),(0,Q.jsx)(Ie,{className:`my-1 h-px bg-edge-subtle`}),(0,Q.jsxs)(Ke,{disabled:be||L,onSelect:()=>ye(!0),className:`flex cursor-pointer items-center gap-2 rounded-lg px-3 py-2 text-sm text-danger outline-none hover:bg-danger-soft focus:bg-danger-soft data-[disabled]:cursor-not-allowed data-[disabled]:opacity-50`,children:[(0,Q.jsx)(We,{className:`size-4`,"aria-hidden":!0}),p.delete]})]})})]})]}),[oe,mt,ft,vt,h.capture,Y,F,D,p.history,p.modeEdit,p.modePreview,p.modeSource,ce,A,s,p.searchDialogTitle,p.readAloud,p.readAloudPause,p.readAloudPreparing,p.readAloudResume,p.readAloudRetry,p.readAloudStop,ct,ht,yt,be,L,f,p.delete,ye]);(0,Z.useLayoutEffect)(()=>(Qe({startExtra:st,main:Y?dt:null,end:Y?wt:null}),()=>{o&&$e()}),[o,$e,wt,dt,st,Y,Qe]);let Tt=(0,Z.useCallback)(t=>{e&&($(),J.current=t,Le.current&&clearTimeout(Le.current),Le.current=setTimeout(async()=>{let t=J.current;if(J.current=null,t!==null){R(!0),G(null);try{await y(e,{markdown:t}),await X(),n?.()}catch(e){G(`${p.saveFailed}: ${e instanceof Error?e.message:p.saveFailedHint}`)}finally{R(!1)}}},600))},[$,e,X,p.saveFailed,p.saveFailedHint,n]),Et=(0,Z.useCallback)(t=>{P(e,t.timestamp).then(e=>{e&&($(),I(e))})},[e,$]),Dt=(0,Z.useCallback)(()=>{$(),M(null),I(null)},[$]),Ot=(0,Z.useCallback)(()=>{$(),M(null),I(null),X().catch(at),n?.()},[X,n,at,$]);if((0,Z.useEffect)(()=>()=>{Le.current&&clearTimeout(Le.current),Re.current&&clearTimeout(Re.current);let t=J.current,n=Ue.current;J.current=null,Ue.current=null;let r={};t!==null&&(r.markdown=t),n!==null&&(r.title=n),Object.keys(r).length>0&&y(e,r).catch(()=>void 0)},[e]),Y===void 0)return tt?(0,Q.jsxs)(`div`,{className:`flex flex-1 flex-col items-center justify-center gap-3 p-6 text-center`,role:`alert`,children:[(0,Q.jsx)(`p`,{className:`text-sm text-danger`,children:p.home.loadFailed}),(0,Q.jsx)(`button`,{type:`button`,onClick:()=>void X().catch(at),className:`rounded-lg border border-edge px-3 py-2 text-sm text-fg hover:bg-surface-hover`,children:p.home.retry}),(0,Q.jsx)(`button`,{type:`button`,onClick:t,className:`text-sm text-fg-muted hover:text-fg`,children:p.back})]}):(0,Q.jsx)(It,{});if(Y===null)return(0,Q.jsxs)(`div`,{className:`flex flex-1 flex-col items-center justify-center gap-3 text-center`,children:[(0,Q.jsx)(`div`,{className:`text-sm font-medium text-fg`,children:p.notFoundTitle}),(0,Q.jsx)(`p`,{className:`text-sm text-fg-muted`,children:p.notFoundDescription}),(0,Q.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:p.back})]});let At=it?F.title??``:z,Mt=it?F.markdown??``:J.current??Y.markdown??``,Nt=new Date(Y.createdAt).getTime(),Rt=Number.isFinite(Nt)&&Date.now()-Nt<3600*1e3?(0,Q.jsx)(ut,{title:g.noteCreatedTitle,description:g.noteCreatedDescription,prompt:g.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,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsxs)(`div`,{className:`flex h-full min-h-0 gap-3 p-4 sm:px-5`,children:[(0,Q.jsxs)(`div`,{className:`mx-auto flex min-h-0 min-w-0 w-full max-w-[60rem] flex-1 flex-col`,children:[de?(0,Q.jsx)(`p`,{className:`mb-3 shrink-0 rounded-lg border border-danger/25 bg-danger-soft px-3 py-2 text-sm text-danger`,role:`alert`,children:de}):null,(0,Q.jsx)(Be,{eventType:`note.created`,source:`notes`,payloadKey:`noteId`,payloadValue:e,className:`mb-3 shrink-0`}),(0,Q.jsx)(Be,{eventType:`note.updated`,source:`notes`,payloadKey:`noteId`,payloadValue:e,className:`mb-3 shrink-0`}),_?(0,Q.jsxs)(`div`,{className:`mb-2 flex shrink-0 gap-4 text-sm`,children:[(0,Q.jsx)(`button`,{className:v?`text-accent-fg`:`text-fg-muted`,onClick:()=>x(!0),children:f===`zh`?`会议`:`Meeting`}),(0,Q.jsx)(`button`,{className:v?`text-fg-muted`:`text-accent-fg`,onClick:()=>x(!1),children:f===`zh`?`我的笔记`:`My notes`})]}):null,(0,Q.jsxs)(`div`,{ref:Ge,className:`flex min-h-0 flex-1 flex-col overflow-hidden rounded-xl border border-edge-subtle bg-surface-panel xl:flex-row`,children:[_&&v?(0,Q.jsx)(_t,{noteId:e}):null,(0,Q.jsx)(`div`,{className:_&&v?`hidden`:`min-h-0 min-w-0 flex-1`,children:it?(0,Q.jsxs)(`div`,{className:`h-full overflow-y-auto px-4 py-4 sm:px-6`,children:[At&&(0,Q.jsx)(`h1`,{className:`mb-4 text-2xl font-bold text-fg/70`,children:At}),Mt?(0,Q.jsx)(b,{noteId:e,content:Mt,className:`opacity-80`}):(0,Q.jsx)(`p`,{className:`italic text-fg-muted`,children:p.emptyPreview})]}):(0,Q.jsxs)(Q.Fragment,{children:[D===`wysiwyg`&&(0,Q.jsxs)(`div`,{className:`flex h-full flex-col`,children:[(0,Q.jsxs)(`div`,{className:`flex shrink-0 items-start px-6 pt-4`,children:[(0,Q.jsx)(`input`,{ref:Ye,type:`text`,value:z,onChange:e=>lt(e.target.value),onCompositionStart:()=>{Fe.current=!0},onCompositionEnd:()=>{Fe.current=!1},onKeyDown:e=>{let t=e.nativeEvent;e.key===`Enter`&&!Fe.current&&!t.isComposing&&(e.preventDefault(),(Ge.current?.querySelector(`.ProseMirror`))?.focus())},placeholder:p.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`}),Rt]}),(0,Q.jsx)(`div`,{className:`min-h-0 flex-1`,children:(0,Q.jsx)(Z.Suspense,{fallback:(0,Q.jsx)(It,{}),children:(0,Q.jsx)(Pt,{initialContent:Y.markdown??``,onChange:Tt,noteId:e},`wysiwyg-${e}`)})})]}),D===`source`&&(0,Q.jsxs)(`div`,{className:`flex h-full flex-col`,children:[(0,Q.jsxs)(`div`,{className:`flex shrink-0 items-start px-6 pt-4`,children:[(0,Q.jsx)(`input`,{ref:Ye,type:`text`,value:z,onChange:e=>lt(e.target.value),placeholder:p.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`}),Rt]}),(0,Q.jsx)(`div`,{className:`min-h-0 flex-1`,children:(0,Q.jsx)(Z.Suspense,{fallback:(0,Q.jsx)(It,{}),children:(0,Q.jsx)(Ft,{initialContent:Y.markdown??``,onChange:Tt,isDark:w},`source-${e}`)})})]}),D===`preview`&&(0,Q.jsxs)(`div`,{className:`h-full overflow-y-auto px-4 py-4 sm:px-6`,onClick:e=>{let t=e.target;t instanceof HTMLImageElement&&E(t.currentSrc||t.src,t.alt)},children:[z&&!Y.markdown.trimStart().startsWith(`# ${z.trim()}\n`)&&Y.markdown.trim()!==`# ${z.trim()}`&&(0,Q.jsx)(`h1`,{className:`mb-4 text-2xl font-bold text-fg`,children:z}),Y.markdown?(0,Q.jsx)(b,{noteId:e,content:Y.markdown,className:`[&_img]:cursor-zoom-in`}):(0,Q.jsx)(`p`,{className:`italic text-fg-muted`,children:p.emptyPreview})]})]})})]})]}),(0,Q.jsx)(`div`,{ref:qe,className:H(`relative flex min-h-0 shrink-0 flex-col overflow-hidden`,!W&&`transition-[width] duration-300 ease-in-out`),style:{width:A?U:0},children:(0,Q.jsxs)(`div`,{ref:Je,className:`flex min-h-0 flex-1 flex-col`,style:{width:U},children:[(0,Q.jsx)(`div`,{role:`separator`,"aria-orientation":`vertical`,onPointerDown:e=>{e.preventDefault();let t=e.currentTarget;t.setPointerCapture(e.pointerId),ae(!0);let n=e.clientX,r=U,i=e.pointerId,a=0,o=U,s=U,c=()=>{a=0,s=o,A&&qe.current?.style.setProperty(`width`,`${s}px`),Je.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{}ae(!1),re(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:H(`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`,W&&`before:!bg-edge/80 dark:before:!bg-edge/85`,`touch-none select-none`)}),(0,Q.jsx)(`div`,{className:`flex min-h-0 flex-1 flex-col overflow-hidden rounded-xl border border-edge-subtle bg-surface-panel`,children:A===`history`?(0,Q.jsx)(bt,{noteId:e,activeTimestamp:F?.timestamp??null,onSelect:Et,onClose:Dt,onRestored:Ot}):A===`breakdown`?(0,Q.jsx)(xt,{noteId:e,note:Y??null,catalyzing:oe,onCatalyze:pt,onClose:()=>M(null),noteThreads:nt,openingChat:ce,onOpenChat:()=>ft(!1),onOpenNewChat:()=>ft(!0)}):null})]})})]}),q?(0,Q.jsx)(Ct,{open:K,onOpenChange:ge,note:q}):null,(0,Q.jsx)(Ve,{open:ve,title:p.deleteConfirmTitle,description:p.deleteConfirmDescription.replace(`{{title}}`,Y.title||p.titlePlaceholder),confirmLabel:p.deleteConfirmLabel,cancelLabel:p.deleteCancelLabel,destructive:!0,onConfirm:()=>void St(),onCancel:()=>ye(!1)})]})}export{$ as i,lt as n,ct as r,zt as t};
|
|
@@ -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"./createLucideIcon-DPHK1VkS.js";import{t as a}from"./markdown-view-7tzqIp_G.js";import{t as o}from"./cn-JdwAhgNB.js";import{a as s,c,i as l,r as u}from"./locale-store-Y1aBayM_.js";var d=i(`image-off`,[[`line`,{x1:`2`,x2:`22`,y1:`2`,y2:`22`,key:`a6p6uj`}],[`path`,{d:`M10.41 10.41a2 2 0 1 1-2.83-2.83`,key:`1bzlo9`}],[`line`,{x1:`13.5`,x2:`6`,y1:`13.5`,y2:`21`,key:`1q0aeu`}],[`line`,{x1:`18`,x2:`21`,y1:`12`,y2:`15`,key:`5mozeu`}],[`path`,{d:`M3.59 3.59A1.99 1.99 0 0 0 3 5v14a2 2 0 0 0 2 2h14c.55 0 1.052-.22 1.41-.59`,key:`mmje98`}],[`path`,{d:`M21 15V5a2 2 0 0 0-2-2H9`,key:`43el77`}]]),f=`xopc-attachment`,p=/^xopc-attachment:\/\/notes\/([^/]+)\/([^/?#]+)$/i,m=/^\/api\/notes\/([^/]+)\/media\/([^/?#]+)$/i;function h(e,t){return`${f}://notes/${encodeURIComponent(e)}/${encodeURIComponent(t)}`}function g(e,t){let n=e.trim();if(!n)return null;let r=n.split(`?`)[0],i=r.match(p),a=r.match(m),o=i??a;if(!o)return null;let s=decodeURIComponent(o[1]),c=decodeURIComponent(o[2]);return t&&s!==t?null:{noteId:s,attachmentId:c}}function _(e,t){return`/api/notes/${encodeURIComponent(e)}/media/${encodeURIComponent(t)}`}var v=e(t(),1),y=n(),b=new Map,x=``;function S(e,t,n){return`${n}:${e}:${t}`}function C(){let e=c.getState().conversationId??``;if(e!==x){for(let e of b.values())e.objectUrl&&URL.revokeObjectURL(e.objectUrl);b.clear(),x=e}}async function w(e,t){C();let n=S(e,t,c.getState().conversationId??``),r=b.get(n);return r||(r={blob:(async()=>{let n=await l(u(_(e,t)));if(n.status===401&&c.getState().onUnauthorized(),!n.ok)throw Error(`HTTP ${n.status}`);return n.blob()})(),objectUrl:null,refCount:0},b.set(n,r)),r.blob}async function T(e,t){C();let n=S(e,t,c.getState().conversationId??``),r=b.get(n);if(r||(r={blob:w(e,t),objectUrl:null,refCount:0},b.set(n,r)),!r.objectUrl){let e=await r.blob;r.objectUrl=URL.createObjectURL(e)}return r.refCount+=1,r.objectUrl}function E(e,t){C();let n=S(e,t,c.getState().conversationId??``),r=b.get(n);r&&(r.refCount=Math.max(0,r.refCount-1),r.refCount===0&&r.objectUrl&&(URL.revokeObjectURL(r.objectUrl),r.objectUrl=null,b.delete(n)))}function D(e,t){return h(e,t)}function O(e){if(e<60)return`Voice · ${e}s`;let t=Math.floor(e/60),n=e%60;return`Voice · ${t}:${String(n).padStart(2,`0`)}`}async function ee(e){let t=await e.json().catch(()=>({}));return typeof t.error==`string`?t.error:`HTTP ${e.status}`}async function k(e,t,n){let r=new Headers;n&&r.set(`Idempotency-Key`,n);let i=await fetch(e,{method:`POST`,headers:r,body:t});if(i.status===401&&c.getState().onUnauthorized(),!i.ok)throw Error(await ee(i));return i.json()}var A=r();function te(e){let t=(0,y.c)(39),n,r,i,a,s,c,l;t[0]===e?(n=t[1],r=t[2],i=t[3],a=t[4],s=t[5],c=t[6],l=t[7]):({src:c,expectedNoteId:r,alt:l,className:n,onClick:i,onLoadFailed:a,...s}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i,t[4]=a,t[5]=s,t[6]=c,t[7]=l);let u=l===void 0?``:l,f;t[8]!==r||t[9]!==c?(f=g(c,r),t[8]=r,t[9]=c,t[10]=f):f=t[10];let p=f,[m,h]=(0,v.useState)(p?null:c),[_,b]=(0,v.useState)(!1),x,S;if(t[11]!==a||t[12]!==p||t[13]!==c?(x=()=>{if(b(!1),!p){h(c);return}let e=!1;return h(null),T(p.noteId,p.attachmentId).then(t=>{e||h(t)}).catch(()=>{e||(b(!0),a?.())}),()=>{e=!0,E(p.noteId,p.attachmentId)}},S=[c,p,a],t[11]=a,t[12]=p,t[13]=c,t[14]=x,t[15]=S):(x=t[14],S=t[15]),(0,v.useEffect)(x,S),_){let e;t[16]===n?e=t[17]:(e=o(`flex items-center justify-center bg-surface-hover text-fg-muted`,n),t[16]=n,t[17]=e);let r=!u,i;t[18]===Symbol.for(`react.memo_cache_sentinel`)?(i=(0,A.jsx)(d,{className:`size-5`}),t[18]=i):i=t[18];let a;return t[19]!==e||t[20]!==r?(a=(0,A.jsx)(`div`,{className:e,"aria-hidden":r,children:i}),t[19]=e,t[20]=r,t[21]=a):a=t[21],a}if(!m){let e;t[22]===n?e=t[23]:(e=o(`animate-pulse bg-surface-hover`,n),t[22]=n,t[23]=e);let r=!u,i;return t[24]!==e||t[25]!==r?(i=(0,A.jsx)(`div`,{className:e,"aria-hidden":r}),t[24]=e,t[25]=r,t[26]=i):i=t[26],i}let C;t[27]!==m||t[28]!==i?(C=i?()=>i(m):void 0,t[27]=m,t[28]=i,t[29]=C):C=t[29];let w;t[30]===a?w=t[31]:(w=()=>{b(!0),a?.()},t[30]=a,t[31]=w);let D;return t[32]!==u||t[33]!==n||t[34]!==m||t[35]!==s||t[36]!==C||t[37]!==w?(D=(0,A.jsx)(`img`,{...s,src:m,alt:u,className:n,onClick:C,onError:w}),t[32]=u,t[33]=n,t[34]=m,t[35]=s,t[36]=C,t[37]=w,t[38]=D):D=t[38],D}function j(e){return e.replace(/xopc-attachment:\/\/notes\/([^/]+)\/([^)\s]+)/gi,`/api/notes/$1/media/$2`)}function M(e,t){let n=[];return e.querySelectorAll(`.markdown-body img`).forEach(e=>{let r=g(e.getAttribute(`src`)??``,t);if(!r)return;let i=!1;T(r.noteId,r.attachmentId).then(t=>{i||(e.src=t)}).catch(()=>{e.classList.add(`note-media-load-failed`)}),n.push(()=>{i=!0,E(r.noteId,r.attachmentId)})}),e.querySelectorAll(`.markdown-body a`).forEach(e=>{let r=g(e.getAttribute(`href`)??``,t);if(!r)return;let i=document.createElement(`audio`);i.controls=!0,i.className=`note-media-audio mt-2 w-full max-w-md`,e.replaceWith(i);let a=!1;T(r.noteId,r.attachmentId).then(e=>{a||(i.src=e)}).catch(()=>{i.remove()}),n.push(()=>{a=!0,E(r.noteId,r.attachmentId)})}),()=>{for(let e of n)e()}}function N(e){let t=(0,y.c)(17),n,r,i;t[0]===e?(n=t[1],r=t[2],i=t[3]):({content:n,noteId:r,...i}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i);let o=(0,v.useRef)(null),s;t[4]===r?s=t[5]:(s=()=>{let e=o.current;if(e)return M(e,r)},t[4]=r,t[5]=s);let c;t[6]!==n||t[7]!==r?(c=[n,r],t[6]=n,t[7]=r,t[8]=c):c=t[8],(0,v.useLayoutEffect)(s,c);let l;t[9]===n?l=t[10]:(l=j(n),t[9]=n,t[10]=l);let u;t[11]===i.className?u=t[12]:(u=[`markdown-note`,i.className].filter(Boolean),t[11]=i.className,t[12]=u);let d=u.join(` `),f;return t[13]!==i||t[14]!==l||t[15]!==d?(f=(0,A.jsx)(`div`,{ref:o,children:(0,A.jsx)(a,{content:l,mermaidActions:!0,...i,className:d})}),t[13]=i,t[14]=l,t[15]=d,t[16]=f):f=t[16],f}async function P(){return s(u(`/api/notes/project-summaries`))}async function F(e={}){let t=new URLSearchParams;e.status&&t.set(`status`,e.status),e.kind&&t.set(`kind`,e.kind),e.tag&&t.set(`tag`,e.tag),e.projectId&&t.set(`projectId`,e.projectId),e.unassigned&&t.set(`unassigned`,`true`),e.agentEdited&&t.set(`agentEdited`,`true`),e.pinned!==void 0&&t.set(`pinned`,String(e.pinned)),e.search&&t.set(`search`,e.search),e.limit&&t.set(`limit`,String(e.limit)),e.offset&&t.set(`offset`,String(e.offset)),e.sortBy&&t.set(`sortBy`,e.sortBy),e.sortOrder&&t.set(`sortOrder`,e.sortOrder);let n=t.toString();return s(u(`/api/notes${n?`?${n}`:``}`))}async function I(e,t=`web`){return(await s(u(`/api/notes/quick-capture`),{method:`POST`,body:JSON.stringify({text:e,channel:t})})).note}async function L(e,t){return(await s(u(`/api/notes`),{method:`POST`,...t?{headers:{"Idempotency-Key":t}}:{},body:JSON.stringify({markdown:e.markdown,title:e.title,kind:e.kind,tags:e.tags,projectId:e.projectId,pinned:e.pinned,channel:e.channel??`web`})})).note}async function R(e){let t=await l(u(`/api/notes/${encodeURIComponent(e)}`));if(t.status===404)return null;let n=await t.json();if(!t.ok)throw Error(n.error||`HTTP ${t.status}`);return n.note??null}async function z(e,t){return(await s(u(`/api/notes/${encodeURIComponent(e)}`),{method:`PATCH`,body:JSON.stringify(t)})).note}async function B(e){await s(u(`/api/notes/${encodeURIComponent(e)}`),{method:`DELETE`})}async function V(e){return s(u(`/api/notes/${encodeURIComponent(e)}/shares`))}async function H(e,t){return s(u(`/api/notes/${encodeURIComponent(e)}/shares`),{method:`POST`,body:JSON.stringify(t)})}async function U(e,t,n){await s(u(`/api/notes/${encodeURIComponent(e)}/shares/${encodeURIComponent(t)}/refresh`),{method:`POST`,body:JSON.stringify(n)})}async function W(e){return(await s(u(`/api/notes/${encodeURIComponent(e)}/hosted-publications`))).payload.publications}async function G(e,t){return(await s(u(`/api/notes/${encodeURIComponent(e)}/hosted-publications`),{method:`POST`,body:JSON.stringify(t)})).payload}async function K(e,t,n){return(await s(u(`/api/notes/${encodeURIComponent(e)}/hosted-publications/${encodeURIComponent(t)}/refresh`),{method:`POST`,body:JSON.stringify(n)})).payload}async function q(e){return s(u(`/api/notes/${encodeURIComponent(e)}/catalyze`),{method:`POST`})}async function J(e,t){return(await s(u(`/api/notes/${encodeURIComponent(e)}/catalysis-feedback`),{method:`POST`,body:JSON.stringify({feedback:t})})).note}async function Y(e,t={}){return s(u(`/api/notes/${encodeURIComponent(e)}/chat`),{method:`POST`,body:JSON.stringify(t)})}async function X(e){return(await s(u(`/api/notes/${encodeURIComponent(e)}/threads`))).items}async function Z(e){return s(u(`/api/notes/${encodeURIComponent(e)}/context-status`))}async function ne(e){return s(u(`/api/notes/${encodeURIComponent(e)}/context-rebuild`),{method:`POST`})}async function re(e,t,n){return(await s(u(`/api/notes/${encodeURIComponent(e)}/append`),{method:`POST`,body:JSON.stringify({content:t,heading:n})})).note}async function ie(e,t={}){return(await s(u(`/api/notes/task`),{method:`POST`,body:JSON.stringify({title:e,channel:`web`,priority:t.priority,sourceConversationId:t.sourceConversationId||void 0,sourceNoteId:t.sourceNoteId||void 0})})).note}async function ae(e,t,n){let r=new FormData;return r.append(`file`,t),(await k(u(`/api/notes/${encodeURIComponent(e)}/media`),r,n)).attachment}async function Q(e,t){let n=new FormData;return n.append(`file`,e),t?.markdown&&n.append(`markdown`,t.markdown),n.append(`channel`,t?.channel??`web`),t?.kind&&n.append(`kind`,t.kind),t?.duration!==void 0&&n.append(`duration`,String(t.duration)),(await k(u(`/api/notes`),n)).note}async function oe(e,t=`web`){let n=await Q(e,{channel:t}),r=n.attachments?.find(e=>e.type===`image`)??n.attachments?.[0];if(!r)return n;let i=`})`;return n.markdown!==i&&(n=await z(n.id,{markdown:i})),n}async function $(e,t,n=`web`){let r=await Q(e,{channel:n,kind:`voice`,duration:t}),i=r.attachments?.find(e=>e.type===`audio`)??r.attachments?.[0];if(!i)return r;let a=`[${O(t)}](${D(r.id,i.id)})`;return r.markdown!==a&&(r=await z(r.id,{markdown:a,kind:`voice`})),r}async function se(e){return(await s(u(`/api/notes/${encodeURIComponent(e)}/history`))).entries}async function ce(e,t){return(await s(u(`/api/notes/${encodeURIComponent(e)}/history/${t}`))).snapshot}async function le(e,t){return(await s(u(`/api/notes/${encodeURIComponent(e)}/history/restore`),{method:`POST`,body:JSON.stringify({timestamp:t})})).note}export{D as A,K as C,ae as D,z as E,d as F,E as M,h as N,N as O,g as P,J as S,le as T,Y as _,H as a,$ as b,R as c,W as d,se as f,F as g,X as h,L as i,T as j,te as k,Z as l,V as m,q as n,ie as o,P as p,G as r,B as s,re as t,ce as u,I as v,U as w,ne as x,oe as y};
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{a as t,n,t as r}from"./vendor-react-BOUWij0V.js";import{f as i,g as a,m as o,u as s}from"./chunk-KS7C4IRE-BMYIfy9x.js";import{t as c}from"./popover-select-DcsFzD_i.js";import{t as l}from"./ellipsis-0k4rZLoy.js";import{f as u}from"./markdown-view-7tzqIp_G.js";import{A as d,D as f,E as p,_ as m,g as h,i as g,p as _,s as v}from"./notes-api-J0yhflxC.js";import{t as ee}from"./loader-circle-CifKLtgG.js";import{t as y}from"./mic-CuUb7zc-.js";import{t as b}from"./plus-Q2yW6OE7.js";import{t as te}from"./search-DA7gz22f.js";import{t as ne}from"./sparkles-DHlfQFAF.js";import{t as x}from"./x-B_N4OPjy.js";import{t as S}from"./messages-DPw2X06D.js";import{t as C}from"./cn-JdwAhgNB.js";import{c as w,f as re,n as ie}from"./locale-store-Y1aBayM_.js";import{i as T}from"./vendor-swr-BIWyz7Rc.js";import{r as E}from"./app-chrome-BeB4KgOf.js";import{t as D}from"./skeleton-BwbyijEw.js";import{n as O}from"./index.module-Cd9ENXfk.js";import{$o as k,$t as A,Ac as j,An as ae,Bs as oe,Fc as se,Fn as ce,Gs as le,Jo as M,Ki as ue,Mc as de,Mn as fe,Mo as N,Nc as pe,Nn as me,Qt as he,_c as ge,ai as _e,co as ve,en as ye,in as P,io as be,jn as xe,kc as Se,kn as Ce,ks as we,nn as Te,rn as F,tn as I,vc as Ee,vo as De,wc as Oe}from"./index-CYeGnj-L.js";import{i as ke,t as L}from"./note-detail-panel-CwMg9cvF.js";var Ae=n(),R=e(t(),1),z=r();function je({projectId:e}){let t=ie(e=>e.language)===`zh`,n=i(),r=(0,R.useRef)(null),a=(0,R.useRef)(null),[o,s]=(0,R.useState)(null),[c,l]=(0,R.useState)(null),[u,d]=(0,R.useState)(null);async function f(){let t=a.current;if(!(!t||o!==null)){s(0),l(null);try{let r=await P();if(r.consentAcknowledgedAt==null){d(r.consentPolicyVersion);return}let i=await he(t.file,t.requestId),o=await F({clientRequestId:t.requestId,contextProjectId:e,source:`web`,consentPolicyVersion:r.consentPolicyVersion});t.discussionId=o.discussion.id,await I({...i,serverDiscussionId:o.discussion.id,projectId:e}),o.discussion.audioAttachmentId||await A(i,o.discussion.id,s),await ye(t.requestId),a.current=null,n(`/notes/${encodeURIComponent(o.note.id)}`)}catch(e){l(e instanceof Error?e.message:String(e))}finally{s(null)}}}return(0,z.jsxs)(`div`,{className:`inline-flex flex-wrap items-center gap-2 text-xs`,children:[(0,z.jsx)(`input`,{ref:r,hidden:!0,type:`file`,accept:`audio/*,.m4a,.wav,.mp3,.webm,.ogg`,onChange:e=>{let n=e.target.files?.[0];if(e.target.value=``,n){if(!n.size||n.size>1073741824){l(t?`音频须为 1 字节至 1 GiB`:`Audio must be between 1 byte and 1 GiB`);return}a.current={file:n,requestId:crypto.randomUUID()},f()}}}),(0,z.jsxs)(`button`,{type:`button`,className:`inline-flex items-center gap-1 rounded-md p-2 hover:bg-surface-hover`,disabled:o!==null,onClick:()=>c&&a.current?void f():r.current?.click(),children:[(0,z.jsx)(be,{className:`size-3.5`}),o===null?c&&a.current?t?`重试导入`:`Retry import`:t?`导入录音`:`Import recording`:`${o}%`]}),u===null?null:(0,z.jsxs)(`span`,{children:[t?`请确认你有权上传此录音,并允许配置的语音服务处理。`:`Confirm permission to upload this recording and process it with your configured speech service.`,(0,z.jsx)(`button`,{type:`button`,className:`p-2 text-accent`,onClick:()=>void Te(u).then(()=>(d(null),f())).catch(e=>l(String(e))),children:t?`确认导入`:`Confirm import`})]}),c?(0,z.jsx)(`span`,{role:`alert`,className:`text-danger`,children:c}):null]})}async function Me(e){e.note??=await g({title:e.title,markdown:e.markdown,projectId:e.projectId,channel:`web`},e.requestId);let t=e.note.id;for(let n=e.attachments.length;n<e.files.length;n++)e.attachments.push(await f(t,e.files[n],`${e.requestId}:file:${n}`));if(e.attachments.length){let n=e.attachments.map(e=>`[${e.fileName.replace(/[\\[\]]/g,`\\$&`).replace(/[\r\n]/g,` `)}](${d(t,e.id)})`);e.note=await p(t,{markdown:`${e.markdown}\n\n## ${e.materialHeading}\n\n${n.join(`
|
|
2
|
+
|
|
3
|
+
`)}`})}return{noteId:t,conversationId:(await m(t,{projectId:e.projectId})).conversationId}}function B(e,t,n){let r=new URLSearchParams({draft:n.replace(`{{id}}`,t),autoSend:`1`});return`/chat/${encodeURIComponent(e)}?${r}`}var V={meeting:Se,requirements:le,research:N,weekly:Ee};function Ne({projects:e,projectId:t,onProjectChange:n,onCreated:r,labels:a,projectsLoading:o,projectsError:s}){let l=a.home,u=i(),[d,f]=(0,R.useState)(``),[p,m]=(0,R.useState)(null),[h,g]=(0,R.useState)(!1),[_,v]=(0,R.useState)([]),[b,te]=(0,R.useState)(!1),[S,w]=(0,R.useState)(null),[re,ie]=(0,R.useState)(``),T=(0,R.useRef)(null),E=(0,R.useRef)(!1),D=(0,R.useRef)(null),O=(0,R.useRef)(null),k=b||!!T.current,A=p?l.templateOptions[p]:null,ae=!!(d.trim()||_.length);async function se(){if(!(E.current||!ae&&!T.current)){E.current=!0,te(!0),w(null),T.current??={requestId:crypto.randomUUID(),title:d.trim().split(`
|
|
4
|
+
`)[0]?.slice(0,80)||A?.label||a.titlePlaceholder,markdown:`## ${l.requestHeading}\n\n${A?`${A.prompt}\n`:``}${d.trim()}`,projectId:t||void 0,files:[..._],attachments:[],materialHeading:l.materialsHeading};try{let e=await Me(T.current);r(),u(B(e.conversationId,e.noteId,l.agentPrompt))}catch(e){T.current.note&&r(),w(e instanceof Error?e.message:a.quickCaptureFailedHint)}finally{E.current=!1,te(!1)}}}function ce(){T.current=null,w(null),f(``),v([]),m(null),g(!1),O.current?.focus()}return(0,z.jsxs)(`section`,{"aria-label":l.askLabel,children:[(0,z.jsxs)(`form`,{onSubmit:e=>{e.preventDefault(),se()},className:`relative rounded-xl border border-edge bg-surface-panel p-4 focus-within:border-accent/60 sm:p-5`,children:[(0,z.jsxs)(`fieldset`,{disabled:k,className:`min-w-0`,children:[(0,z.jsxs)(`label`,{htmlFor:`notes-home-prompt`,className:`flex items-center gap-2 text-xs font-medium text-accent-fg`,children:[(0,z.jsx)(ne,{className:`size-4`,"aria-hidden":!0}),l.askLabel]}),(0,z.jsx)(`p`,{className:`mt-1 text-xs leading-5 text-fg-muted`,children:l.agentResultHint}),A?(0,z.jsxs)(`div`,{className:`mt-3 flex items-start gap-2 rounded-lg bg-accent-soft px-3 py-2 text-xs leading-5 text-accent-fg`,children:[(0,z.jsxs)(`p`,{className:`min-w-0 flex-1`,children:[(0,z.jsxs)(`span`,{className:`font-medium`,children:[A.label,` · `]}),A.prompt.split(`
|
|
5
|
+
|
|
6
|
+
`)[0]]}),(0,z.jsx)(`button`,{type:`button`,onClick:()=>m(null),"aria-label":a.searchClear,className:`shrink-0 rounded p-1 hover:bg-surface-hover`,children:(0,z.jsx)(x,{className:`size-3.5`})})]}):null,(0,z.jsx)(`textarea`,{ref:O,id:`notes-home-prompt`,value:d,onChange:e=>f(e.target.value),placeholder:A?A.prompt.split(`
|
|
7
|
+
|
|
8
|
+
`).at(-1):l.askPlaceholder,rows:2,onKeyDown:e=>{(e.metaKey||e.ctrlKey)&&e.key===`Enter`&&!e.nativeEvent.isComposing&&(e.preventDefault(),se())},className:`mt-2 min-h-16 w-full resize-y bg-transparent py-2 text-base leading-6 text-fg outline-none placeholder:text-fg-muted sm:text-sm`}),_.length?(0,z.jsx)(`ul`,{className:`mb-3 flex flex-wrap gap-2`,children:_.map((e,t)=>(0,z.jsxs)(`li`,{className:`flex max-w-full items-center gap-2 rounded-md border border-edge px-2 py-1 text-xs text-fg-muted`,children:[(0,z.jsx)(M,{className:`size-3 shrink-0`,"aria-hidden":!0}),(0,z.jsx)(`span`,{className:`truncate`,children:e.name}),(0,z.jsx)(`button`,{type:`button`,"aria-label":`${l.removeMaterial}: ${e.name}`,onClick:()=>v(e=>e.filter((e,n)=>n!==t)),className:`rounded p-1 hover:bg-surface-hover`,children:(0,z.jsx)(x,{className:`size-3`})})]},`${e.name}-${t}`))}):null,(0,z.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2 sm:pr-40`,children:[(0,z.jsx)(`div`,{className:`w-44 max-w-full`,children:(0,z.jsx)(c,{value:t,options:e.filter(e=>e.name.toLowerCase().includes(re.toLowerCase())).map(e=>({value:e.id,label:e.name})),selectedLabel:t?e.find(e=>e.id===t)?.name:l.unassigned,placeholder:l.unassigned,emptyLabel:l.unassigned,ariaLabel:l.assignProject,triggerIcon:(0,z.jsx)(oe,{className:`size-4 shrink-0`,"aria-hidden":!0}),triggerClassName:`h-8 border-transparent bg-transparent px-2 text-xs text-fg-muted hover:bg-surface-hover`,onChange:n,disabled:k,loading:o,statusMessage:s?l.projectsLoadFailed:void 0,searchPlaceholder:l.projectSearch,searchValue:re,onSearchChange:ie})}),(0,z.jsxs)(`button`,{type:`button`,onClick:()=>D.current?.click(),className:`inline-flex h-8 items-center gap-1.5 rounded-md px-2 text-xs text-fg-muted hover:bg-surface-hover`,children:[(0,z.jsx)(M,{className:`size-4`,"aria-hidden":!0}),l.addMaterials]}),(0,z.jsx)(`input`,{ref:D,type:`file`,multiple:!0,className:`hidden`,"aria-label":l.addMaterials,onChange:e=>{let t=Array.from(e.target.files??[]);v(e=>[...e,...t]),e.target.value=``}})]})]}),(0,z.jsx)(`div`,{className:`mt-2 flex justify-end sm:absolute sm:bottom-5 sm:right-5 sm:mt-0`,children:(0,z.jsxs)(`button`,{type:`submit`,disabled:b||!T.current&&!ae,className:`inline-flex h-9 items-center gap-2 rounded-lg bg-accent px-4 text-sm font-medium text-on-accent hover:bg-accent-hover focus-visible:ring-2 focus-visible:ring-accent focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50`,children:[b?(0,z.jsx)(ee,{className:`size-4 animate-spin`,"aria-hidden":!0}):(0,z.jsx)(j,{className:`size-4`,"aria-hidden":!0}),b?l.creating:S?l.retry:l.agentCreate]})})]}),S?(0,z.jsxs)(`div`,{className:`mt-3 rounded-lg border border-danger/25 bg-danger-soft px-3 py-3 text-xs text-danger`,role:`alert`,children:[(0,z.jsx)(`p`,{children:S}),T.current?.note?(0,z.jsx)(`p`,{className:`mt-1`,children:l.partialFailure}):null,(0,z.jsxs)(`div`,{className:`mt-2 flex flex-wrap gap-3`,children:[T.current?.note?(0,z.jsx)(`button`,{type:`button`,onClick:()=>u(`/notes/${encodeURIComponent(T.current.note.id)}?edit=1`),className:`underline`,children:l.openSavedDraft}):null,(0,z.jsx)(`button`,{type:`button`,onClick:ce,className:`underline`,children:l.newRequest})]})]}):null,(0,z.jsxs)(`div`,{className:`mt-2 flex flex-wrap items-center gap-2 text-xs text-fg-muted`,children:[(0,z.jsxs)(`button`,{type:`button`,disabled:k,"aria-expanded":h,"aria-controls":`notes-home-templates`,onClick:()=>g(e=>!e),className:`touch-target inline-flex items-center gap-1.5 rounded-md px-2 py-2 hover:bg-surface-hover focus-visible:ring-2 focus-visible:ring-accent disabled:opacity-50`,children:[l.templates,(0,z.jsx)(ge,{className:C(`size-3.5 transition-transform`,h&&`rotate-180`),"aria-hidden":!0})]}),(0,z.jsxs)(`button`,{type:`button`,disabled:b,onClick:()=>Ce(),className:`touch-target ml-auto inline-flex items-center gap-1.5 rounded-md px-2 py-2 hover:bg-surface-hover focus-visible:ring-2 focus-visible:ring-accent`,children:[(0,z.jsx)(y,{className:`size-3.5`,"aria-hidden":!0}),l.recordDiscussion]})]}),(0,z.jsxs)(`div`,{id:`notes-home-templates`,hidden:!h,className:C(`mt-1 flex-wrap items-center gap-1 text-xs text-fg-muted`,h?`flex`:`hidden`),children:[Object.keys(V).map(e=>{let t=V[e];return(0,z.jsxs)(`button`,{type:`button`,disabled:k,"aria-pressed":p===e,onClick:()=>{m(p===e?null:e),O.current?.focus()},className:C(`inline-flex items-center gap-1.5 rounded-md px-2 py-2 hover:bg-surface-hover disabled:opacity-50`,p===e&&`bg-accent-soft text-accent-fg`),children:[(0,z.jsx)(t,{className:`size-3.5`,"aria-hidden":!0}),l.templateOptions[e].label]},e)}),(0,z.jsx)(je,{})]})]})}function Pe(e,t){let n=Number(e.get(`page`)??0),r=Number.isSafeInteger(n)&&n>=0?n:0,i=e.get(`view`);return{projectId:e.get(`projectId`)||void 0,unassigned:e.get(`unassigned`)===`true`||i===`unassigned`||void 0,pinned:i===`favorites`?!0:void 0,agentEdited:i===`agent`||void 0,status:i===`archived`?`archived`:void 0,search:t.trim()||void 0,sortBy:`updatedAt`,sortOrder:`desc`,limit:12,offset:r*12}}function Fe(e){let t=e.snippet?.trim()??``,n=e.title?.trim();return n&&t.startsWith(n)?t.slice(n.length).replace(/^[\s::·—-]+/,``):t}var H=`touch-target inline-flex min-h-9 items-center justify-center gap-2 rounded-lg px-3 text-sm text-fg-muted 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`;function U(){let e=ie(e=>e.language),t=S(e).notes,n=t.home,r=w(e=>e.conversationId),o=ue(e=>e.setPageHeader),u=ue(e=>e.clearPageHeader),d=i(),{pathname:f,search:m}=s(),[y,x]=a(),A=y.get(`projectId`)||``,j=y.get(`view`)||`all`,M=y.get(`unassigned`)===`true`||j===`unassigned`,N=y.get(`search`)||``,[he]=O(N,250),[ye,P]=(0,R.useState)(A),[be,Ce]=(0,R.useState)(``),[Te,F]=(0,R.useState)(null),[I,Ee]=(0,R.useState)(!1),[L,Ae]=(0,R.useState)(!1),[je,Me]=(0,R.useState)(new Set),[B,V]=(0,R.useState)(null),[U,Ie]=(0,R.useState)(null),W=(0,R.useRef)(new Set),G=(0,R.useRef)(null),Le=(0,R.useRef)(!1),Re=(0,R.useRef)(null),ze=Pe(y,he),K=(ze.offset??0)/12,{data:Be,error:Ve,isLoading:He,mutate:Ue}=T(r?[`notes-home`,r,ze]:null,()=>h(ze)),{data:We,error:Ge,isLoading:q,mutate:Ke}=T(r?[`notes-home-projects`,r]:null,_),J=We?.items??[],qe=J.filter(e=>e.noteCount>0).slice(0,2),Je=J.find(e=>e.id===A)?.name??n.projectNotes,Ye=Be?.items??[],Y=Be?.total??0,Xe=He||N!==he,Ze=(0,R.useMemo)(()=>({justNow:t.justNow,minutesAgo:t.minutesAgo,today:t.today,yesterday:t.yesterday,daysAgo:t.daysAgo,locale:re(e)}),[e,t.justNow,t.minutesAgo,t.today,t.yesterday,t.daysAgo]),[X,Qe]=(0,R.useState)(()=>Date.now());(0,R.useEffect)(()=>{P(A)},[A]),(0,R.useEffect)(()=>{let e=window.setInterval(()=>Qe(Date.now()),6e4);return()=>window.clearInterval(e)},[]);let Z=(0,R.useCallback)(()=>{Ue().catch(()=>void 0),Ke().catch(()=>void 0)},[Ue,Ke]);(0,R.useEffect)(()=>{let e=[`note-updated`,`note-created`,`note-deleted`,`project-updated`,`project-created`,`project-deleted`];return e.forEach(e=>window.addEventListener(e,Z)),()=>e.forEach(e=>window.removeEventListener(e,Z))},[Z]);let $e=(0,R.useCallback)((e,t=!1)=>{let n=`${f}${m}`,r=new URLSearchParams({returnTo:n});t&&r.set(`edit`,`1`),d(`/notes/${encodeURIComponent(e)}?${r}`)},[f,m,d]),Q=(0,R.useCallback)(async()=>{if(!(Le.current||!r)){Le.current=!0,Ee(!0),F(null),G.current??={key:crypto.randomUUID(),projectId:A||void 0};try{let e=await g({markdown:``,kind:`thought`,projectId:G.current.projectId},G.current.key);G.current=null,Z(),$e(e.id,!0)}catch(e){F(`${t.createBlankFailed}: ${e instanceof Error?e.message:t.createBlankFailedHint}`)}finally{Le.current=!1,Ee(!1)}}},[A,t.createBlankFailed,t.createBlankFailedHint,$e,Z,r]),et=(0,R.useCallback)(e=>{x(t=>{let n=new URLSearchParams(t);return e?n.set(`search`,e):n.delete(`search`),n.delete(`page`),n},{replace:!0})},[x]);function $(e,t=`all`){let n=new URLSearchParams;e&&n.set(`projectId`,e),t===`unassigned`?n.set(`unassigned`,`true`):t!==`all`&&n.set(`view`,t),P(e),x(n)}function tt(e){x(t=>{let n=new URLSearchParams(t);return M&&n.set(`unassigned`,`true`),e===`all`?n.delete(`view`):n.set(`view`,e),n.delete(`page`),n})}async function nt(e,n){if(!W.current.has(e)){W.current.add(e),Me(new Set(W.current)),F(null);try{await p(e,{pinned:n}),Z()}catch(e){F(`${t.actionFailed}: ${e instanceof Error?e.message:t.quickCaptureFailedHint}`)}finally{W.current.delete(e),Me(new Set(W.current))}}}async function rt(){let e=B;if(!(!e||U)){V(null),Ie(e.id),F(null);try{await v(e.id),window.dispatchEvent(new CustomEvent(`note-deleted`,{detail:{noteId:e.id}})),Z()}catch(e){F(`${t.deleteFailed}: ${e instanceof Error?e.message:t.quickCaptureFailedHint}`)}finally{Ie(null)}}}if((0,R.useLayoutEffect)(()=>{if(!r){u();return}return o({startExtra:null,main:(0,z.jsx)(`h1`,{className:`truncate text-base font-semibold text-fg`,children:t.title}),end:(0,z.jsx)(`div`,{className:C(`flex min-w-0 items-center gap-2`,E),children:(0,z.jsxs)(`label`,{className:`flex h-9 w-32 min-w-0 items-center gap-2 rounded-lg border border-edge bg-surface-panel px-2 sm:w-48`,children:[(0,z.jsx)(te,{className:`size-4 shrink-0 text-fg-muted`,"aria-hidden":!0}),(0,z.jsx)(`input`,{ref:Re,type:`search`,value:N,onChange:e=>et(e.target.value),"aria-label":t.searchDialogTitle,placeholder:t.searchPlaceholder,className:`min-w-0 flex-1 bg-transparent text-sm text-fg outline-none placeholder:text-fg-muted`})]})})}),()=>u()},[u,Q,I,n.blankNote,t.searchDialogTitle,t.searchPlaceholder,t.title,N,o,et,r]),(0,R.useEffect)(()=>{let e=e=>{!(e.metaKey||e.ctrlKey)||e.altKey||e.isComposing||e.target?.closest(`input, textarea, [contenteditable="true"], [role="dialog"]`)||(e.key.toLowerCase()===`n`&&(e.preventDefault(),Q()),e.key.toLowerCase()===`f`&&(e.preventDefault(),Re.current?.focus()))};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},[Q]),!r)return(0,z.jsx)(`div`,{className:`flex flex-1 items-center justify-center p-8 text-sm text-fg-muted`,children:t.needToken});let it=[{id:`all`,label:n.homeNav,Icon:k},{id:`favorites`,label:n.favorites,Icon:De},{id:`unassigned`,label:n.unassigned,Icon:we},{id:`archived`,label:t.filterArchived,Icon:se}],at=A?`project:${A}`:M?`unassigned`:`all`,ot=!Xe&&!Ve&&Y===0&&!A&&!M&&!N&&j===`all`;return(0,z.jsxs)(`div`,{className:`flex h-full min-h-0 w-full flex-1 overflow-hidden bg-surface-panel`,children:[(0,z.jsxs)(`aside`,{className:`hidden w-44 shrink-0 flex-col gap-1 overflow-y-auto px-3 py-6 xl:flex`,"aria-label":n.homeNav,children:[it.map(({id:e,label:t,Icon:n})=>(0,z.jsxs)(`button`,{type:`button`,onClick:()=>$(``,e),"aria-current":!A&&(e===`unassigned`?M:!M&&j===e)?`page`:void 0,className:C(H,`justify-start px-2 text-left text-xs`,!A&&(e===`unassigned`?M:!M&&j===e)&&`bg-surface-hover font-medium text-fg`),children:[(0,z.jsx)(n,{className:`size-4 shrink-0`,"aria-hidden":!0}),t]},e)),(0,z.jsx)(`span`,{className:`mb-1 mt-7 px-2 text-xs text-fg-muted`,children:n.projects}),q?[0,1,2].map(e=>(0,z.jsx)(D,{className:`mb-2 h-8 w-full`},e)):J.slice(0,8).map(e=>(0,z.jsxs)(`button`,{type:`button`,onClick:()=>$(e.id),"aria-current":A===e.id?`page`:void 0,className:C(H,`justify-start px-2 text-left text-xs`,A===e.id&&`bg-surface-hover font-medium text-fg`),children:[(0,z.jsx)(oe,{className:`size-4 shrink-0`,"aria-hidden":!0}),(0,z.jsx)(`span`,{className:`truncate`,children:e.name})]},e.id)),(0,z.jsxs)(`button`,{type:`button`,onClick:()=>d(`/projects`),className:C(H,`mt-2 justify-start px-2 text-xs`),children:[n.allProjects,(0,z.jsx)(de,{className:`ml-auto size-3`,"aria-hidden":!0})]})]}),(0,z.jsx)(`div`,{className:`min-h-0 min-w-0 flex-1 overflow-y-auto overscroll-contain`,children:(0,z.jsxs)(`div`,{className:`mx-auto flex w-full max-w-7xl flex-col px-4 pb-4 pt-3 sm:px-6 sm:pb-7 lg:px-8 lg:pb-9 lg:pt-4`,children:[(0,z.jsxs)(`div`,{className:`mb-5 flex flex-wrap items-start justify-between gap-4`,children:[(0,z.jsxs)(`div`,{children:[(0,z.jsx)(`h2`,{className:`min-w-0 break-words text-2xl font-semibold tracking-tight text-fg`,children:A?Je:M?n.unassigned:ot?n.firstNoteTitle:n.continueTitle}),(0,z.jsx)(`p`,{className:`mt-1 text-sm text-fg-muted`,children:A?n.projectDescription:ot?n.firstNoteDescription:n.continueDescription})]}),A?(0,z.jsxs)(`button`,{type:`button`,onClick:()=>d(`/projects/${encodeURIComponent(A)}`),className:C(H,`text-xs`),children:[n.openProject,(0,z.jsx)(de,{className:`size-3.5`,"aria-hidden":!0})]}):null]}),Te?(0,z.jsx)(`p`,{className:`mb-4 rounded-lg border border-danger/25 bg-danger-soft px-3 py-2 text-sm text-danger`,role:`alert`,children:Te}):null,(0,z.jsxs)(`section`,{"aria-label":n.startAction,children:[(0,z.jsxs)(`div`,{className:`grid gap-3 sm:grid-cols-2`,children:[(0,z.jsxs)(`button`,{type:`button`,onClick:()=>{Ae(e=>!e),L||window.requestAnimationFrame(()=>document.getElementById(`notes-home-prompt`)?.focus())},"aria-expanded":L,"aria-controls":`notes-home-agent-composer`,className:C(`touch-target flex min-h-20 items-center gap-3 rounded-xl border p-4 text-left transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,L?`border-accent/60 bg-accent-soft`:`border-edge bg-surface-panel hover:bg-surface-hover`),children:[(0,z.jsx)(ne,{className:`size-5 shrink-0 text-accent-fg`,"aria-hidden":!0}),(0,z.jsxs)(`span`,{className:`min-w-0 flex-1`,children:[(0,z.jsx)(`span`,{className:`block text-sm font-semibold text-fg`,children:n.agentAction}),(0,z.jsx)(`span`,{className:`mt-1 block text-xs leading-5 text-fg-muted`,children:n.agentActionHint})]}),(0,z.jsx)(ge,{className:C(`size-4 shrink-0 text-fg-muted transition-transform`,L&&`rotate-180`),"aria-hidden":!0})]}),(0,z.jsxs)(`button`,{type:`button`,onClick:()=>void Q(),disabled:I,className:`touch-target flex min-h-20 items-center gap-3 rounded-xl border border-edge bg-surface-panel p-4 text-left transition-colors hover:bg-surface-hover focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent disabled:opacity-50`,children:[I?(0,z.jsx)(ee,{className:`size-5 shrink-0 animate-spin text-fg-muted`,"aria-hidden":!0}):(0,z.jsx)(b,{className:`size-5 shrink-0 text-fg-muted`,"aria-hidden":!0}),(0,z.jsxs)(`span`,{children:[(0,z.jsx)(`span`,{className:`block text-sm font-semibold text-fg`,children:n.blankNote}),(0,z.jsx)(`span`,{className:`mt-1 block text-xs leading-5 text-fg-muted`,children:n.blankActionHint})]})]})]}),(0,z.jsx)(`div`,{id:`notes-home-agent-composer`,hidden:!L,className:C(`mt-3`,!L&&`hidden`),children:(0,z.jsx)(Ne,{projects:J,projectId:ye,onProjectChange:P,onCreated:Z,labels:t,projectsLoading:q,projectsError:!!Ge})})]}),Ge?(0,z.jsxs)(`div`,{role:`alert`,className:`mt-4 flex items-center gap-3 text-xs text-danger`,children:[(0,z.jsx)(`span`,{children:n.projectsLoadFailed}),(0,z.jsx)(`button`,{type:`button`,onClick:()=>void Ke().catch(()=>void 0),className:`underline`,children:n.retry})]}):null,ot?null:(0,z.jsxs)(`section`,{className:`mt-8 pb-6`,"aria-label":n.recentNotes,children:[(0,z.jsxs)(`div`,{className:`mb-3 flex flex-wrap items-center justify-between gap-3`,children:[(0,z.jsx)(`h3`,{className:`text-sm font-semibold text-fg`,children:j===`favorites`?n.favorites:j===`archived`?t.filterArchived:A?n.projectNotes:n.recentNotes}),(0,z.jsxs)(`div`,{className:`flex flex-wrap items-center gap-3`,children:[(0,z.jsx)(`button`,{type:`button`,"aria-pressed":j===`agent`,onClick:()=>tt(j===`agent`?`all`:`agent`),className:C(`touch-target rounded-md px-2 text-xs text-fg-muted hover:bg-surface-hover hover:text-fg focus-visible:ring-2 focus-visible:ring-accent`,j===`agent`&&`bg-accent-soft text-accent-fg`),children:n.agentEdited}),(0,z.jsx)(`span`,{className:`hidden text-xs text-fg-muted xl:inline`,children:n.sortUpdated}),(0,z.jsx)(`div`,{className:`w-48 max-w-full xl:hidden`,children:(0,z.jsx)(c,{value:at,allowEmpty:!1,ariaLabel:n.projects,placeholder:n.allNotes,options:[{value:`all`,label:n.allNotes},{value:`unassigned`,label:n.unassigned},...J.filter(e=>e.name.toLowerCase().includes(be.toLowerCase())).map(e=>({value:`project:${e.id}`,label:e.name}))],selectedLabel:A?Je:M?n.unassigned:n.allNotes,triggerClassName:`h-8 bg-surface-panel text-xs`,loading:q,searchPlaceholder:n.projectSearch,searchValue:be,onSearchChange:Ce,onChange:e=>$(e.startsWith(`project:`)?e.slice(8):``,e===`unassigned`?e:`all`)})})]})]}),(0,z.jsxs)(`div`,{className:`flex flex-wrap items-center gap-x-5 border-b border-edge xl:hidden`,"aria-label":t.libraryTitle,children:[[{id:`all`,label:t.filterAll},{id:`favorites`,label:n.favorites},{id:`archived`,label:t.filterArchived}].map(({id:e,label:t})=>(0,z.jsx)(`button`,{type:`button`,"aria-pressed":j===e||e===`all`&&j===`unassigned`,onClick:()=>tt(e),className:C(`touch-target border-b-2 border-transparent py-3 text-xs text-fg-muted hover:text-fg`,(j===e||e===`all`&&j===`unassigned`)&&`border-fg font-medium text-fg`),children:t},e)),(0,z.jsx)(`span`,{className:`ml-auto py-3 text-xs text-fg-muted`,children:n.sortUpdated})]}),Ve?(0,z.jsxs)(`div`,{className:`py-10 text-center`,role:`alert`,children:[(0,z.jsx)(`p`,{className:`text-sm text-danger`,children:n.loadFailed}),(0,z.jsx)(`button`,{type:`button`,onClick:()=>void Ue().catch(()=>void 0),className:C(H,`mt-2`),children:n.retry})]}):Xe?(0,z.jsx)(`div`,{"aria-busy":`true`,className:`divide-y divide-edge`,children:[0,1,2,3].map(e=>(0,z.jsxs)(`div`,{className:`flex items-center gap-3 py-4`,children:[(0,z.jsx)(D,{className:`h-10 w-8 shrink-0`}),(0,z.jsxs)(`div`,{className:`flex-1 space-y-2`,children:[(0,z.jsx)(D,{className:`h-4 w-2/3`}),(0,z.jsx)(D,{className:`h-3 w-1/2`})]})]},e))}):Ye.length===0?(0,z.jsxs)(`div`,{className:`flex flex-col items-center px-4 py-12 text-center`,children:[(0,z.jsx)(k,{className:`mb-4 size-8 text-fg-muted`,strokeWidth:1.3,"aria-hidden":!0}),(0,z.jsx)(`h4`,{className:`text-sm font-medium text-fg`,children:N||j!==`all`&&j!==`unassigned`?n.noMatches:A?n.projectEmpty:n.emptyTitle}),(0,z.jsx)(`p`,{className:`mt-2 max-w-md text-sm leading-6 text-fg-muted`,children:N||j!==`all`&&j!==`unassigned`?n.noMatchesHint:A?n.projectEmptyHint:n.emptyDescription})]}):(0,z.jsx)(`ul`,{className:`divide-y divide-edge`,children:Ye.map(e=>{let r=e.voiceAttachmentId||e.kind===`voice`?Se:e.kind===`bookmark`?Oe:le,i=Fe(e)||(e.coverAttachmentId?t.imageNote:t.noText);return(0,z.jsxs)(`li`,{className:`group flex min-w-0 items-center gap-3 py-4`,children:[(0,z.jsxs)(`button`,{type:`button`,onClick:()=>$e(e.id),className:`touch-target flex min-w-0 flex-1 items-center gap-3 rounded-md text-left focus-visible:ring-2 focus-visible:ring-accent`,children:[(0,z.jsx)(`span`,{className:`flex h-10 w-8 shrink-0 items-center justify-center rounded-md border border-edge text-fg-muted`,children:(0,z.jsx)(r,{className:`size-4`,"aria-hidden":!0})}),(0,z.jsxs)(`span`,{className:`min-w-0 flex-1`,children:[(0,z.jsx)(`span`,{className:`block truncate text-base font-medium text-fg sm:text-sm group-hover:text-accent-fg`,children:e.title||i.slice(0,48)||t.titlePlaceholder}),(0,z.jsxs)(`span`,{className:`mt-1 flex min-w-0 items-center gap-1.5 text-xs text-fg-muted`,children:[e.lastEditTrigger===`ai_edit`?(0,z.jsxs)(`span`,{className:`inline-flex shrink-0 items-center gap-1 text-accent-fg`,children:[(0,z.jsx)(ne,{className:`size-3`,"aria-hidden":!0}),n.agentEditLabel,(0,z.jsx)(`span`,{"aria-hidden":!0,children:`·`})]}):null,(0,z.jsx)(`span`,{className:`truncate`,children:i})]}),(0,z.jsx)(`time`,{dateTime:new Date(e.updatedAt).toISOString(),className:`mt-1.5 block text-xs text-fg-muted sm:hidden`,children:ke(e.updatedAt,X,Ze)})]})]}),(0,z.jsx)(`span`,{className:`hidden max-w-32 truncate text-xs text-fg-muted md:block`,title:e.projects?.map(e=>e.name).join(` · `),children:e.projects?.map(e=>e.name).join(` · `)||n.unassigned}),(0,z.jsx)(`time`,{dateTime:new Date(e.updatedAt).toISOString(),className:`hidden w-24 shrink-0 text-right text-xs text-fg-muted sm:block`,children:ke(e.updatedAt,X,Ze)}),(0,z.jsx)(`button`,{type:`button`,onClick:()=>void nt(e.id,!e.pinned),disabled:je.has(e.id),"aria-label":`${e.pinned?n.unfavorite:n.favorite}: ${e.title||t.titlePlaceholder}`,"aria-pressed":!!e.pinned,className:`touch-target inline-flex size-9 shrink-0 items-center justify-center rounded-md text-fg-muted hover:bg-surface-hover hover:text-fg disabled:opacity-50 focus-visible:ring-2 focus-visible:ring-accent`,children:(0,z.jsx)(De,{className:C(`size-4`,e.pinned&&`fill-current text-fg`),"aria-hidden":!0})}),(0,z.jsxs)(me,{children:[(0,z.jsx)(ce,{asChild:!0,children:(0,z.jsx)(`button`,{type:`button`,disabled:U===e.id,"aria-label":`${t.noteActions}: ${e.title||t.titlePlaceholder}`,className:`touch-target inline-flex size-9 shrink-0 items-center justify-center rounded-md text-fg-muted hover:bg-surface-hover hover:text-fg disabled:opacity-50 focus-visible:ring-2 focus-visible:ring-accent`,children:U===e.id?(0,z.jsx)(ee,{className:`size-4 animate-spin`,"aria-hidden":!0}):(0,z.jsx)(l,{className:`size-4`,"aria-hidden":!0})})}),(0,z.jsx)(fe,{children:(0,z.jsx)(ae,{align:`end`,sideOffset:4,className:`z-50 min-w-36 rounded-lg border border-edge bg-surface-panel p-1 shadow-popover`,children:(0,z.jsxs)(xe,{className:`touch-target flex cursor-pointer items-center gap-2 rounded-md px-3 py-2 text-sm text-danger outline-none hover:bg-danger-soft focus:bg-danger-soft`,onSelect:()=>V(e),children:[(0,z.jsx)(ve,{className:`size-4`,"aria-hidden":!0}),t.delete]})})})]})]},e.id)})}),!Xe&&!Ve&&Y>0?(0,z.jsxs)(`div`,{className:`mt-4 flex flex-wrap items-center justify-between gap-3 text-xs text-fg-muted`,"aria-live":`polite`,children:[(0,z.jsx)(`span`,{children:t.noteCount.replace(`{{count}}`,String(Y))}),Y>12||K>0?(0,z.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,z.jsx)(`button`,{type:`button`,"aria-label":n.previousPage,disabled:K===0,className:H,onClick:()=>x(e=>{let t=new URLSearchParams(e);return t.set(`page`,String(K-1)),t}),children:(0,z.jsx)(pe,{className:`size-4`,"aria-hidden":!0})}),(0,z.jsxs)(`span`,{children:[K+1,` / `,Math.max(1,Math.ceil(Y/12))]}),(0,z.jsx)(`button`,{type:`button`,"aria-label":n.nextPage,disabled:(K+1)*12>=Y,className:H,onClick:()=>x(e=>{let t=new URLSearchParams(e);return t.set(`page`,String(K+1)),t}),children:(0,z.jsx)(de,{className:`size-4`,"aria-hidden":!0})})]}):null]}):null]}),!A&&!M&&(q||qe.length>0)?(0,z.jsxs)(`section`,{className:`mt-8`,"aria-label":n.continueProjects,children:[(0,z.jsxs)(`div`,{className:`mb-3 flex items-center justify-between`,children:[(0,z.jsx)(`h3`,{className:`text-sm font-semibold text-fg`,children:n.continueProjects}),(0,z.jsx)(`button`,{type:`button`,onClick:()=>d(`/projects`),className:`text-xs text-fg-muted hover:text-fg`,children:n.allProjects})]}),(0,z.jsx)(`div`,{className:`grid gap-3 sm:grid-cols-2`,children:q?[0,1].map(e=>(0,z.jsx)(D,{className:`h-28 w-full`},e)):qe.map(e=>(0,z.jsxs)(`button`,{type:`button`,onClick:()=>$(e.id),className:`min-w-0 rounded-lg border border-edge bg-surface-panel p-3 text-left transition-colors sm:p-4 hover:bg-surface-base focus-visible:ring-2 focus-visible:ring-accent`,children:[(0,z.jsxs)(`span`,{className:`flex items-center gap-2 text-sm font-medium text-fg`,children:[(0,z.jsx)(oe,{className:`size-4 shrink-0`,"aria-hidden":!0}),(0,z.jsx)(`span`,{className:`truncate`,children:e.name})]}),e.description?(0,z.jsx)(`p`,{className:`mt-2 hidden line-clamp-1 text-xs text-fg-muted sm:block`,children:e.description}):null,(0,z.jsxs)(`span`,{className:`mt-2 flex flex-wrap items-center justify-between gap-1 text-xs text-fg-muted sm:mt-3`,children:[(0,z.jsx)(`span`,{children:t.noteCount.replace(`{{count}}`,String(e.noteCount))}),(0,z.jsx)(`span`,{children:e.updatedAt?ke(e.updatedAt,X,Ze):n.emptyProject})]})]},e.id))})]}):null]})}),(0,z.jsx)(_e,{open:B!==null,title:t.deleteConfirmTitle,description:t.deleteConfirmDescription.replace(`{{title}}`,B?.title||t.titlePlaceholder),confirmLabel:t.deleteConfirmLabel,cancelLabel:t.deleteCancelLabel,destructive:!0,onConfirm:()=>void rt(),onCancel:()=>V(null)})]})}function Ie(){let e=(0,Ae.c)(12),{noteId:t}=o(),n=i(),[r]=a(),s;e[0]===r?s=e[1]:(s=u(r.get(`returnTo`),`/notes`,[`/chat`,`/projects`,`/notes`,`/tasks`]),e[0]=r,e[1]=s);let c=s,l;e[2]!==n||e[3]!==c?(l=()=>{n(c)},e[2]=n,e[3]=c,e[4]=l):l=e[4];let d=l;if(!t)return null;let f=r.get(`edit`)===`1`?`wysiwyg`:`preview`,p;e[5]===r?p=e[6]:(p=r.get(`edit`),e[5]=r,e[6]=p);let m=p===`1`,h;return e[7]!==d||e[8]!==t||e[9]!==f||e[10]!==m?(h=(0,z.jsx)(`div`,{className:`mx-auto flex h-full min-h-0 w-full max-w-6xl flex-1 flex-col`,children:(0,z.jsx)(L,{noteId:t,onBack:d,initialMode:f,autoFocus:m},t)}),e[7]=d,e[8]=t,e[9]=f,e[10]=m,e[11]=h):h=e[11],h}function W(){let e=(0,Ae.c)(2),{noteId:t}=o(),n;return e[0]===t?n=e[1]:(n=t?(0,z.jsx)(Ie,{}):(0,z.jsx)(U,{}),e[0]=t,e[1]=n),n}export{W as NotesPage};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{i as e,r as t}from"./locale-store-Y1aBayM_.js";import{n}from"./electron-env-Dit0bHgy.js";function r(){if(!n())return;let e=window.location.hash.startsWith(`#/`)?window.location.hash.slice(1):`/`;return e.length<=2048?e:`/`}async function i(i){let a=await e(t(`/api/auth/oauth-async/start`),{method:`POST`,body:JSON.stringify({provider:i,client:n()?`desktop`:`web`,returnPath:r()})});if(!a.ok){let e=await a.json().catch(()=>({}));throw Error(e.error||`OAuth start failed: ${a.status}`)}return(await a.json()).payload}async function a(n){let r=await e(t(`/api/auth/oauth-async/${encodeURIComponent(n)}/status`));if(!r.ok)throw Error(`OAuth status: ${r.status}`);return(await r.json()).payload}async function o(n,r){let i=await e(t(`/api/auth/oauth-async/${encodeURIComponent(n)}/code`),{method:`POST`,body:JSON.stringify({code:r})});if(!i.ok){let e=await i.json().catch(()=>({}));throw Error(e.error||`Submit code failed: ${i.status}`)}}async function s(n){let r=await e(t(`/api/auth/oauth-async/${encodeURIComponent(n)}/cancel`),{method:`POST`});if(!r.ok)throw Error(`Cancel OAuth failed: ${r.status}`)}async function c(n){let r=await e(t(`/api/auth/oauth-async/${encodeURIComponent(n)}`),{method:`DELETE`});if(!r.ok)throw Error(`Cleanup session failed: ${r.status}`)}async function l(n){let r=await e(t(`/api/auth/oauth/${encodeURIComponent(n)}`),{method:`DELETE`});if(!r.ok)throw Error(`Revoke OAuth failed: ${r.status}`)}export{i as a,l as i,c as n,o,a as r,s as t};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{a as t,t as n}from"./vendor-react-BOUWij0V.js";import{f as r,u as i}from"./chunk-KS7C4IRE-BMYIfy9x.js";import{t as a}from"./loader-circle-CifKLtgG.js";import{t as o}from"./messages-DPw2X06D.js";import{c as s,n as c}from"./locale-store-Y1aBayM_.js";import{t as l}from"./session-manager-DsH1DZI_.js";import{t as u}from"./capabilities-CF4-mrIa.js";import{F as d,Gs as f,I as p}from"./index-CYeGnj-L.js";var m=e(t(),1),h=n();function g({resource:e,selection:t,label:n,disabled:g=!1}){let _=o(c(e=>e.language)).chat.pageContext,v=r(),y=i().key,[b,x]=(0,m.useState)(!1),[S,C]=(0,m.useState)(!1),w=(0,m.useRef)(!1),T=(0,m.useRef)(0),E=s(e=>e.baseUrl),D=s(e=>e.conversationId);(0,m.useEffect)(()=>(w.current=!1,x(!1),C(!1),()=>{T.current+=1}),[y,e.kind,e.id,e.revision,t?.text,t?.draft,g,E,D]);async function O(){if(g||w.current)return;w.current=!0,x(!0),C(!1);let n=T.current,r=()=>T.current===n&&s.getState().baseUrl===E&&s.getState().conversationId===D;try{let n=p.capture({title:``,text:``,resourceRefs:[e],selection:t}),i=await u(`xopc.context.resolve`,n.envelope);if(!r())return;let a=i.resources[0];if(i.resources.length!==1||JSON.stringify(i.snapshot)!==JSON.stringify(n.envelope)||a.reference.kind!==e.kind||a.reference.id!==e.id||a.reference.revision!==e.revision)throw Error(`Context mismatch`);n.title=a.title,n.preview=a.text,n.truncated=a.truncated;let o=await new l().createSession();if(!r())return;if(!p.put(d(E,D,o.key),n))throw Error(`Context draft limit reached`);v(`/chat/${encodeURIComponent(o.key)}`)}catch{r()&&C(!0)}finally{T.current===n&&(w.current=!1,x(!1))}}return(0,h.jsxs)(`div`,{className:`flex min-w-0 flex-col items-start gap-1`,children:[(0,h.jsxs)(`button`,{type:`button`,disabled:g||b,onClick:()=>void O(),"aria-busy":b,title:g?_.unavailable:n??_.capture,className:`inline-flex min-h-9 items-center gap-1.5 rounded-lg border border-edge px-2.5 py-1.5 text-xs text-fg-muted hover:bg-surface-hover hover:text-fg focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent disabled:opacity-50`,children:[b?(0,h.jsx)(a,{className:`size-3.5 animate-spin`,"aria-hidden":!0}):(0,h.jsx)(f,{className:`size-3.5`,"aria-hidden":!0}),n??_.capture]}),S?(0,h.jsx)(`p`,{role:`alert`,className:`max-w-72 text-xs text-danger`,children:_.unavailable}):null]})}export{g as t};
|
|
@@ -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"./cn-JdwAhgNB.js";import{n as a}from"./interaction-BdhHBbYa.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-surface-active text-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 overscroll-x-contain 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(![`ArrowLeft`,`ArrowRight`,`Home`,`End`].includes(e.key)||!n.length)return;e.preventDefault();let t=n.findIndex(e=>e.id===r),i=e.key===`Home`?0:e.key===`End`?n.length-1:(Math.max(0,t)+(e.key===`ArrowRight`?1:-1)+n.length)%n.length;l(n[i].id);let a=e.currentTarget.querySelectorAll(`[role="tab"]`)[i];a?.focus(),a?.scrollIntoView({block:`nearest`,inline:`nearest`})},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,tabIndex:h?0:-1,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(`touch-target 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-inset 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-xs tabular-nums text-fg-muted`,_),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};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{t as e}from"./createLucideIcon-DPHK1VkS.js";var t=e(`pause`,[[`rect`,{x:`14`,y:`3`,width:`5`,height:`18`,rx:`1`,key:`kaeet6`}],[`rect`,{x:`5`,y:`3`,width:`5`,height:`18`,rx:`1`,key:`1wsw3u`}]]);export{t};
|
|
@@ -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-BMYIfy9x.js";import{t as a}from"./popover-select-DcsFzD_i.js";import{b as o}from"./markdown-view-7tzqIp_G.js";import{t as s}from"./settings-2-D-csvaET.js";import{t as c}from"./x-B_N4OPjy.js";import{a as l,n as u,r as d}from"./locale-store-Y1aBayM_.js";import{t as f}from"./skeleton-BwbyijEw.js";import{Dr as p,Ki as m,Ko as h,Mc as g,Wi as _,jc as v,n as y,os as b,ps as x,ra as S}from"./index-CYeGnj-L.js";var C=n(),w=e(t(),1),T=r(),E=5;function ee(e){let t=e.replace(/\s+/g,` `).trim();if(t.length<=58)return t;let n=t.replace(/([^)]{1,80})|\([^)]{1,80}\)/g,``).replace(/([A-Za-z0-9])(?=[\u4e00-\u9fff])/g,`$1 `).replace(/\s+/g,` `).trim(),r=n.split(/[。!?;;,]/,1)[0]?.trim()||n;return r.length>58?`${r.slice(0,57).trimEnd()}…`:r}function te(e,t){return e.phase===`closed`?{label:t?`已结束`:`Finished`,tone:`bg-fg-subtle`}:e.runStatus===`running`?{label:t?`正在执行`:`Working`,tone:`bg-accent`}:e.runStatus===`queued`?{label:t?`等待开始`:`Queued`,tone:`bg-fg-subtle`}:e.runStatus===`failed`?{label:t?`需要关注`:`Needs attention`,tone:`bg-danger`}:e.runStatus===`waiting`?{label:t?`等待继续`:`Waiting`,tone:`bg-warning`}:e.runStatus===`verifying`||e.runStatus===`succeeded`||e.phase===`review`?{label:t?`等待验收`:`In review`,tone:`bg-warning`}:e.runStatus===`cancelled`?{label:t?`已暂停`:`Stopped`,tone:`bg-fg-subtle`}:e.phase===`active`?{label:t?`正在推进`:`In progress`,tone:`bg-accent`}:e.phase===`ready`?{label:t?`准备开始`:`Ready`,tone:`bg-fg-subtle`}:{label:t?`待处理`:`Planned`,tone:`bg-fg-subtle`}}function ne(e){let t=(0,C.c)(30),{item:n,zh:r}=e,a;t[0]!==n||t[1]!==r?(a=te(n,r),t[0]=n,t[1]=r,t[2]=a):a=t[2];let s=a,c;t[3]===n.id?c=t[4]:(c=o(`/personal`,n.id),t[3]=n.id,t[4]=c);let l=`mt-2 size-1.5 shrink-0 rounded-full ${s.tone}`,u;t[5]===l?u=t[6]:(u=(0,T.jsx)(`span`,{className:l,"aria-hidden":!0}),t[5]=l,t[6]=u);let d;t[7]===n.title?d=t[8]:(d=ee(n.title),t[7]=n.title,t[8]=d);let f;t[9]===d?f=t[10]:(f=(0,T.jsx)(`span`,{className:`line-clamp-2 break-words text-sm font-medium leading-5 text-fg`,children:d}),t[9]=d,t[10]=f);let m;t[11]===s.label?m=t[12]:(m=(0,T.jsx)(`span`,{children:s.label}),t[11]=s.label,t[12]=m);let h;t[13]===Symbol.for(`react.memo_cache_sentinel`)?(h=(0,T.jsx)(`span`,{className:`text-fg-subtle`,"aria-hidden":!0,children:`·`}),t[13]=h):h=t[13];let g=r?`zh`:`en`,_;t[14]!==n.updatedAt||t[15]!==g?(_=p(n.updatedAt,g),t[14]=n.updatedAt,t[15]=g,t[16]=_):_=t[16];let y;t[17]===_?y=t[18]:(y=(0,T.jsx)(`span`,{children:_}),t[17]=_,t[18]=y);let b;t[19]!==y||t[20]!==m?(b=(0,T.jsxs)(`span`,{className:`mt-1.5 flex items-center gap-2 text-xs text-fg-muted`,children:[m,h,y]}),t[19]=y,t[20]=m,t[21]=b):b=t[21];let x;t[22]!==b||t[23]!==f?(x=(0,T.jsxs)(`span`,{className:`min-w-0 flex-1`,children:[f,b]}),t[22]=b,t[23]=f,t[24]=x):x=t[24];let S;t[25]===Symbol.for(`react.memo_cache_sentinel`)?(S=(0,T.jsx)(v,{className:`mt-0.5 size-4 shrink-0 text-fg-subtle opacity-0 transition-opacity duration-150 group-hover:opacity-100 group-focus-visible:opacity-100`,"aria-hidden":!0}),t[25]=S):S=t[25];let w;return t[26]!==x||t[27]!==c||t[28]!==u?(w=(0,T.jsxs)(i,{to:c,className:`group flex min-w-0 items-start gap-3 rounded-2xl bg-surface-panel px-4 py-4 transition-colors duration-150 hover:bg-surface-hover focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,children:[u,x,S]}),t[26]=x,t[27]=c,t[28]=u,t[29]=w):w=t[29],w}var D=[{id:`direct`,warmth:`reserved`,zh:`直接清楚`,en:`Clear and direct`,zhExample:`先说结论,再说明下一步。`,enExample:`Lead with the answer, then the next step.`},{id:`natural`,warmth:`balanced`,zh:`自然有分寸`,en:`Natural and measured`,zhExample:`说清重点,也留出必要的解释。`,enExample:`Cover the point, with enough context to act.`},{id:`gentle`,warmth:`gentle`,zh:`温和耐心`,en:`Warm and patient`,zhExample:`语气柔和一些,仍然把事情说清楚。`,enExample:`Be gentle while keeping the answer clear.`}],O=[{id:`spark`,zh:`星形`,en:`Star`,color:`bg-amber-100/40 dark:bg-amber-400/10`},{id:`cloud`,zh:`云形`,en:`Cloud`,color:`bg-sky-100/40 dark:bg-sky-400/10`},{id:`bean`,zh:`圆形`,en:`Round`,color:`bg-lime-100/40 dark:bg-lime-400/10`}];function k(e){return O.find(t=>t.id===e)??O[0]}function re(e,t){return e.warmth===`reserved`?t?`你可以直接说目标或问题。我会先给结论,需要时再展开。`:`Tell me the goal or question. I’ll lead with the answer and expand when useful.`:e.warmth===`gentle`?t?`想聊一件事,或让我帮你推进工作,都可以从这里开始。我会认真听,也会把下一步说清楚。`:`You can talk something through or ask me to move work forward. I’ll listen carefully and make the next step clear.`:t?`有什么想讨论或推进的事?直接告诉我就好。`:`What would you like to discuss or move forward? Just tell me what is on your mind.`}function ie(e,t,n){return t===`listen`?e===`reserved`?n?`先说说这三件事。我听完再帮你排顺序。`:`Tell me about the three tasks first. I’ll listen, then help order them.`:e===`gentle`?n?`可以,慢慢说说每件事现在到哪一步。等你说完,我们再一起排顺序。`:`Take your time telling me where each task stands. Once you’re done, we can sort the order together.`:n?`你先说说三件事各自到哪一步。我听完再和你一起排顺序。`:`Tell me where each task stands. I’ll listen first, then help you order them.`:t===`solutions`?e===`reserved`?n?`列出三件事和截止时间。我直接给你建议顺序与依据。`:`List the three tasks and deadlines. I’ll give you a suggested order and why.`:e===`gentle`?n?`把三件事和截止时间告诉我。我先帮你排出一个可行顺序,再解释为什么。`:`Tell me the three tasks and deadlines. I’ll suggest a workable order and explain why.`:n?`把三件事和截止时间发我,我会给出建议顺序和理由。`:`Send me the three tasks and deadlines. I’ll suggest an order and explain why.`:e===`reserved`?n?`列出三件事、截止时间和影响范围。我帮你排优先级。`:`List the three tasks, deadlines, and impact. I’ll rank them.`:e===`gentle`?n?`我们先把三件事放到一起看。告诉我各自的截止时间,我帮你理清先后。`:`Let’s look at the three together. Tell me their deadlines, and I’ll help sort the order.`:n?`可以。把三件事和截止时间发我,我们先找出最该做的一件。`:`Sure. Send me the three tasks and deadlines, and we’ll identify the one to start with.`}function ae(e){return D.find(t=>t.warmth===e.warmth)?.id??`natural`}function oe(){let e=S(),t=(0,w.useRef)(e);t.current=e;let n=u(e=>e.language)===`zh`,r=m(e=>e.setPageHeader),o=m(e=>e.clearPageHeader),[p,v]=(0,w.useState)(null),[C,ee]=(0,w.useState)([]),[te,oe]=(0,w.useState)(!0),[A,j]=(0,w.useState)(!1),[M,N]=(0,w.useState)(null),[P,se]=(0,w.useState)(`natural`),[F,ce]=(0,w.useState)(`spark`),[le,ue]=(0,w.useState)(``),[de,fe]=(0,w.useState)(``),[I,L]=(0,w.useState)(`untangle`),[R,z]=(0,w.useState)(`none`),[B,pe]=(0,w.useState)(`balanced`),[me,he]=(0,w.useState)(`decisions`),[V,H]=(0,w.useState)(!1),[U,ge]=(0,w.useState)(!1),[W,G]=(0,w.useState)(null),[_e,ve]=(0,w.useState)(!1),[K,q]=(0,w.useState)(!1),[ye,J]=(0,w.useState)(!1),[Y,X]=(0,w.useState)(0),Z=(0,w.useRef)(0),Q=(0,w.useCallback)(async()=>{try{let[e,t]=await Promise.all([l(d(`/api/personal-agent`)),l(d(`/api/personal-agent/models`))]);v(e.payload),window.dispatchEvent(new CustomEvent(`personal-agent-updated`,{detail:e.payload})),e.payload&&window.dispatchEvent(new Event(`session-updated`)),ee(t.payload),e.payload&&(ue(e.payload.displayName),ce(e.payload.appearance),se(ae(e.payload.preferences)),fe(e.payload.preferences.addressAs??``),L(e.payload.preferences.supportMode??`untangle`),z(e.payload.preferences.humor??`none`),pe(e.payload.preferences.detailLevel??`balanced`),he(e.payload.preferences.proactivity??`decisions`))}catch(e){N(e instanceof Error?e.message:String(e))}finally{oe(!1)}},[]);(0,w.useEffect)(()=>{Q()},[Q]);let be=async(e,t,n)=>{let r=D.find(e=>e.id===n)??D[1],i=await l(d(`/api/personal-agent/profile`),{method:`PATCH`,body:JSON.stringify({revision:e.revision,displayName:t.trim()||e.displayName,appearance:F,preferences:{...e.preferences,addressAs:de.trim()||void 0,supportMode:I,detailLevel:B,proactivity:me,warmth:r.warmth,humor:R}})});v(i.payload),window.dispatchEvent(new CustomEvent(`personal-agent-updated`,{detail:i.payload}))},xe=async()=>{if(C.length!==0){j(!0),N(null);try{let e=await l(d(`/api/personal-agent`),{method:`POST`,body:JSON.stringify({})});v(e.payload),window.dispatchEvent(new CustomEvent(`personal-agent-updated`,{detail:e.payload})),window.dispatchEvent(new Event(`session-updated`))}catch(e){N(e instanceof Error?e.message:String(e)),await Q()}finally{j(!1)}}},$=(0,w.useCallback)(async()=>{let e=++Z.current;ge(!0),G(null),ve(!1),q(!1),J(!1),X(0);try{let t=await l(d(`/api/personal-agent/activity?limit=${E}&offset=0`));if(e!==Z.current)return;G(t.payload),X(t.payload.items.length)}catch{e===Z.current&&ve(!0)}},[]),Se=(0,w.useCallback)(async()=>{if(!W||K||Y>=W.total)return;let e=Z.current;q(!0),J(!1);try{let t=await l(d(`/api/personal-agent/activity?limit=${E}&offset=${Y}`));if(e!==Z.current)return;G(e=>e?{total:t.payload.total,items:[...e.items,...t.payload.items.filter(t=>!e.items.some(e=>e.id===t.id))]}:t.payload),X(e=>e+t.payload.items.length)}catch{e===Z.current&&J(!0)}finally{e===Z.current&&q(!1)}},[W,Y,K]),Ce=async()=>{if(p){j(!0),N(null);try{await be(p,le,P),H(!1)}catch(e){N(e instanceof Error?e.message:String(e)),await Q()}finally{j(!1)}}};return(0,w.useLayoutEffect)(()=>{let i=p?.state===`ready`,a=i?p.appearance:F,l=i?p.displayName:`Personal AI`;return r({startExtra:null,main:(0,T.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2.5`,children:[(0,T.jsx)(`span`,{className:`flex size-8 shrink-0 items-center justify-center rounded-full ${k(a).color}`,children:(0,T.jsx)(_,{appearance:a,className:`size-8`})}),(0,T.jsx)(`h1`,{className:`min-w-0 truncate text-sm font-semibold text-fg sm:text-base`,children:l}),V&&(0,T.jsxs)(`span`,{className:`truncate text-sm text-fg-muted`,children:[`· `,n?`回应偏好`:`Response preferences`]})]}),end:i?V?(0,T.jsx)(`button`,{type:`button`,onClick:()=>H(!1),className:`touch-target rounded-lg p-2 text-fg-muted hover:bg-surface-hover hover:text-fg`,"aria-label":n?`关闭偏好设置`:`Close response preferences`,children:(0,T.jsx)(c,{className:`size-5`})}):(0,T.jsxs)(`div`,{className:`flex items-center gap-1`,children:[(0,T.jsx)(`button`,{type:`button`,disabled:e.active,onClick:()=>{p?.state===`ready`&&t.current.open({conversationId:p.conversationId,name:p.displayName,mode:`assistant`})},className:`touch-target rounded-lg p-2 text-fg-muted hover:bg-surface-hover hover:text-fg disabled:opacity-50`,"aria-label":n?`语音通话`:`Voice call`,title:n?`语音通话`:`Voice call`,children:(0,T.jsx)(h,{className:`size-5`})}),(0,T.jsx)(`button`,{type:`button`,onClick:()=>void $(),"aria-pressed":U,className:`touch-target rounded-lg p-2 text-fg-muted hover:bg-surface-hover hover:text-fg`,"aria-label":n?`正在做的事`:`Activity`,children:(0,T.jsx)(x,{className:`size-5`})}),(0,T.jsx)(`button`,{type:`button`,onClick:()=>H(!0),className:`touch-target rounded-lg p-2 text-fg-muted hover:bg-surface-hover hover:text-fg`,"aria-label":n?`回应偏好`:`Response preferences`,children:(0,T.jsx)(s,{className:`size-5`})})]}):null}),()=>o()},[F,o,$,p,r,U,V,e.active,n]),te?(0,T.jsxs)(`div`,{className:`mx-auto w-full max-w-2xl space-y-5 px-6 py-12`,children:[(0,T.jsx)(f,{className:`h-20 w-20 rounded-full`}),(0,T.jsx)(f,{className:`h-9 w-72`}),(0,T.jsx)(f,{className:`h-44 w-full rounded-2xl`})]}):p?.state===`ready`&&!V?(0,T.jsx)(`div`,{className:`flex h-full min-h-0 flex-1 flex-col bg-surface-panel`,children:(0,T.jsxs)(`div`,{className:`flex min-h-0 flex-1`,children:[(0,T.jsx)(`div`,{className:`min-w-0 flex-1`,children:(0,T.jsx)(y,{embedded:!0,personal:!0,personalWelcome:{name:p.displayName,addressAs:p.preferences.addressAs,avatar:(0,T.jsx)(_,{appearance:p.appearance,className:`size-14`}),opening:re(p.preferences,n)},conversationId:p.conversationId})}),U&&(0,T.jsxs)(`aside`,{className:`fixed inset-0 z-30 flex min-w-0 flex-col bg-surface-inset shadow-lg sm:static sm:w-[min(25rem,42vw)] sm:shadow-none`,"aria-label":n?`派发的任务`:`Delegated tasks`,children:[(0,T.jsxs)(`div`,{className:`flex shrink-0 items-start justify-between gap-3 px-6 pb-3 pt-6`,children:[(0,T.jsxs)(`div`,{className:`min-w-0`,children:[(0,T.jsx)(`h2`,{className:`text-base font-semibold tracking-tight text-fg`,children:n?`交给我推进的事`:`Delegated work`}),(0,T.jsx)(`p`,{className:`mt-1 text-xs text-fg-muted`,children:W?n?`最近更新 · 共 ${W.total} 项`:`Recently updated · ${W.total} total`:n?`查看任务进展与结果`:`Follow progress and results`})]}),(0,T.jsx)(`button`,{type:`button`,onClick:()=>ge(!1),className:`touch-target -mr-2 -mt-1 rounded-lg p-2 text-fg-muted transition-colors hover:bg-surface-hover hover:text-fg focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,"aria-label":n?`关闭活动`:`Close activity`,children:(0,T.jsx)(c,{className:`size-4`})})]}),(0,T.jsxs)(`div`,{className:`min-h-0 flex-1 overflow-y-auto px-3 pb-5 pt-3`,children:[!W&&!_e&&(0,T.jsxs)(`div`,{className:`space-y-2`,children:[(0,T.jsx)(f,{className:`h-18 rounded-2xl`}),(0,T.jsx)(f,{className:`h-18 rounded-2xl`}),(0,T.jsx)(f,{className:`h-18 rounded-2xl`})]}),_e&&(0,T.jsxs)(`div`,{className:`px-5 py-12 text-center`,children:[(0,T.jsx)(`p`,{className:`text-sm text-fg-muted`,children:n?`暂时无法读取任务`:`Could not load tasks`}),(0,T.jsx)(`button`,{type:`button`,onClick:()=>void $(),className:`mt-3 rounded-lg px-3 py-2 text-sm text-accent hover:bg-surface-hover`,children:n?`重试`:`Try again`})]}),W?.items.length===0&&(0,T.jsxs)(`div`,{className:`px-5 py-16 text-center`,children:[(0,T.jsx)(x,{className:`mx-auto size-7 text-fg-subtle`,"aria-hidden":!0}),(0,T.jsx)(`p`,{className:`mt-4 text-sm font-medium text-fg`,children:n?`还没有派发的任务`:`No delegated work yet`}),(0,T.jsx)(`p`,{className:`mt-1 text-xs leading-5 text-fg-muted`,children:n?`你可以在对话里直接告诉我想推进的事。`:`Tell me what you would like to move forward in chat.`})]}),W&&W.items.length>0&&(0,T.jsx)(`div`,{className:`space-y-2`,children:W.items.map(e=>(0,T.jsx)(ne,{item:e,zh:n},e.id))}),W&&Y<W.total&&(0,T.jsxs)(`div`,{className:`pt-4 text-center`,children:[(0,T.jsx)(`button`,{type:`button`,onClick:()=>void Se(),disabled:K,className:`min-h-10 rounded-xl bg-surface-panel px-5 text-sm font-medium text-fg-muted transition-colors hover:bg-surface-hover hover:text-fg disabled:opacity-50`,children:K?n?`正在加载…`:`Loading…`:n?`加载更多`:`Load more`}),ye&&(0,T.jsx)(`p`,{role:`alert`,className:`mt-2 text-xs text-danger`,children:n?`加载失败,请重试`:`Could not load more. Try again.`})]})]})]})]})}):V?(0,T.jsx)(`div`,{className:`h-full min-h-0 overflow-y-auto bg-surface-base px-4 py-8 sm:px-6`,children:(0,T.jsxs)(`div`,{className:`mx-auto max-w-2xl`,children:[(0,T.jsxs)(`div`,{className:`mb-7`,children:[(0,T.jsx)(`h2`,{className:`text-2xl font-semibold tracking-tight text-fg`,children:V?n?`调整回应方式`:`Adjust how it responds`:n?`让回应更适合你`:`Make responses feel right for you`}),(0,T.jsx)(`p`,{className:`mt-2 text-sm leading-relaxed text-fg-muted`,children:n?`先选你喜欢的表达方式。名字和形象可以稍后再决定,所有设置都能随时调整。`:`Start with the way you like to be answered. Name and appearance can wait, and every choice can change later.`})]}),(0,T.jsxs)(`div`,{className:`rounded-2xl border border-edge bg-surface-panel p-5 sm:p-6`,children:[(0,T.jsx)(`div`,{className:`text-sm font-medium text-fg`,children:n?`回答的语气`:`Response tone`}),(0,T.jsx)(`p`,{className:`mt-1 text-xs text-fg-muted`,children:n?`选一个起点;每次对话仍会按具体情况调整。`:`Choose a starting point. Each reply still adapts to the situation.`}),(0,T.jsx)(`div`,{className:`mt-3 grid gap-3 sm:grid-cols-3`,children:D.map(e=>(0,T.jsxs)(`button`,{type:`button`,onClick:()=>se(e.id),"aria-pressed":P===e.id,className:`min-h-28 rounded-xl border p-4 text-left transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent ${P===e.id?`border-accent bg-accent/5`:`border-edge hover:bg-surface-hover`}`,children:[(0,T.jsxs)(`span`,{className:`flex items-center gap-2 font-medium text-fg`,children:[(0,T.jsx)(b,{className:`size-4 text-accent`,"aria-hidden":!0}),n?e.zh:e.en]}),(0,T.jsx)(`span`,{className:`mt-2 block text-xs leading-relaxed text-fg-muted`,children:n?e.zhExample:e.enExample})]},e.id))}),(0,T.jsx)(`div`,{className:`mt-6 text-sm font-medium text-fg`,children:n?`遇到棘手的问题时,希望先得到什么?`:`When a problem is tricky, what helps first?`}),(0,T.jsx)(`div`,{className:`mt-3 flex flex-wrap gap-2`,children:[[`listen`,n?`先听我说`:`Listen first`],[`untangle`,n?`帮我理清`:`Help me untangle it`],[`solutions`,n?`直接给办法`:`Give me solutions`]].map(([e,t])=>(0,T.jsx)(`button`,{type:`button`,"aria-pressed":I===e,onClick:()=>L(e),className:`min-h-11 rounded-full border px-4 text-sm ${I===e?`border-accent bg-accent/5 text-fg`:`border-edge text-fg-muted hover:bg-surface-hover`}`,children:t},e))}),(0,T.jsxs)(`div`,{className:`mt-6 grid gap-5 sm:grid-cols-2`,children:[(0,T.jsxs)(`div`,{children:[(0,T.jsx)(`p`,{className:`mb-2 text-sm font-medium text-fg`,children:n?`回答多详细`:`Answer length`}),(0,T.jsx)(a,{value:B??`balanced`,options:[{value:`brief`,label:n?`简短,先说结论`:`Brief, answer first`},{value:`balanced`,label:n?`适中`:`Balanced`},{value:`detailed`,label:n?`多解释一点`:`More detail`}],placeholder:n?`选择回答长度`:`Choose answer length`,allowEmpty:!1,onChange:e=>pe(e)})]}),(0,T.jsxs)(`div`,{children:[(0,T.jsx)(`p`,{className:`mb-2 text-sm font-medium text-fg`,children:n?`主动更新的频率`:`Proactive updates`}),(0,T.jsx)(a,{value:me??`decisions`,options:[{value:`decisions`,label:n?`只说结果和决定`:`Results and decisions only`},{value:`important`,label:n?`重要进展也告诉我`:`Important milestones too`},{value:`open`,label:n?`可以多提建议`:`More suggestions`}],placeholder:n?`选择主动程度`:`Choose check-in style`,allowEmpty:!1,onChange:e=>he(e)})]})]}),(0,T.jsxs)(`details`,{className:`mt-5 text-sm text-fg-muted`,children:[(0,T.jsx)(`summary`,{className:`cursor-pointer select-none`,children:n?`更多表达偏好`:`More expression preferences`}),(0,T.jsxs)(`div`,{className:`mt-3 max-w-xs`,children:[(0,T.jsx)(`p`,{className:`mb-2 font-medium text-fg`,children:n?`轻松程度`:`Lightness`}),(0,T.jsx)(a,{value:R??`none`,options:[{value:`none`,label:n?`不加玩笑`:`No jokes`},{value:`occasional`,label:n?`合适时轻松一点`:`A light touch when it fits`},{value:`playful`,label:n?`可以更活泼`:`More playful`}],placeholder:n?`选择轻松程度`:`Choose lightness`,allowEmpty:!1,onChange:e=>z(e)})]})]}),(0,T.jsxs)(`div`,{className:`mt-6 rounded-2xl border border-edge bg-surface-base p-4`,"aria-live":`polite`,children:[(0,T.jsx)(`p`,{className:`text-xs font-medium text-fg-muted`,children:n?`语气与支持方式预览`:`Tone and support preview`}),(0,T.jsx)(`p`,{className:`mt-3 text-sm text-fg-muted`,children:n?`你:我手上有三件事,不知道先做哪件。`:`You: I have three things to do and don’t know where to start.`}),(0,T.jsxs)(`div`,{className:`mt-2 flex items-start gap-3`,children:[(0,T.jsx)(`span`,{className:`flex size-8 shrink-0 items-center justify-center rounded-full ${k(F).color}`,children:(0,T.jsx)(_,{appearance:F,className:`size-8`})}),(0,T.jsx)(`p`,{className:`rounded-2xl rounded-tl-sm bg-surface-hover px-4 py-3 text-sm leading-relaxed text-fg`,children:ie(D.find(e=>e.id===P)?.warmth,I,n)})]})]}),(0,T.jsxs)(`div`,{className:`mt-7 border-t border-edge pt-6`,children:[(0,T.jsx)(`h3`,{className:`text-sm font-medium text-fg`,children:n?`称呼与形象(可选)`:`Name and appearance (optional)`}),(0,T.jsx)(`p`,{className:`mt-1 text-xs text-fg-muted`,children:n?`名称与称呼可随时修改;界面形象不决定回答语气。`:`Names can change anytime; appearance does not determine response tone.`})]}),(0,T.jsxs)(`div`,{className:`mt-5 grid gap-4 sm:grid-cols-2`,children:[(0,T.jsxs)(`div`,{children:[(0,T.jsx)(`label`,{htmlFor:`personal-name`,className:`block text-sm font-medium text-fg`,children:n?`助手名称`:`Assistant name`}),(0,T.jsx)(`input`,{id:`personal-name`,value:le,onChange:e=>ue(e.target.value),maxLength:60,placeholder:`Personal AI`,className:`mt-2 w-full rounded-xl border border-edge bg-surface-base px-3 py-2.5 text-fg outline-none focus-visible:ring-2 focus-visible:ring-accent`})]}),(0,T.jsxs)(`div`,{children:[(0,T.jsx)(`label`,{htmlFor:`personal-address`,className:`block text-sm font-medium text-fg`,children:n?`怎么称呼你`:`What should it call you?`}),(0,T.jsx)(`input`,{id:`personal-address`,value:de,onChange:e=>fe(e.target.value),maxLength:60,placeholder:n?`可留空`:`Optional`,className:`mt-2 w-full rounded-xl border border-edge bg-surface-base px-3 py-2.5 text-fg outline-none focus-visible:ring-2 focus-visible:ring-accent`})]})]}),(0,T.jsx)(`div`,{className:`mt-5 text-sm font-medium text-fg`,children:n?`界面形象`:`On-screen appearance`}),(0,T.jsx)(`div`,{className:`mt-3 flex flex-wrap gap-3`,children:O.map(e=>(0,T.jsxs)(`button`,{type:`button`,onClick:()=>ce(e.id),"aria-pressed":F===e.id,className:`flex min-h-16 min-w-20 items-center gap-2 rounded-xl border px-3 transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent ${F===e.id?`border-accent bg-accent/5`:`border-edge hover:bg-surface-hover`}`,children:[(0,T.jsx)(`span`,{className:`flex size-8 items-center justify-center rounded-full ${e.color}`,children:(0,T.jsx)(_,{appearance:e.id,className:`size-8`})}),(0,T.jsx)(`span`,{className:`text-xs text-fg-muted`,children:n?e.zh:e.en})]},e.id))}),M&&(0,T.jsx)(`p`,{role:`alert`,className:`mt-4 text-sm text-red-600`,children:M}),(0,T.jsx)(`button`,{type:`button`,disabled:A,onClick:()=>void Ce(),className:`mt-6 min-h-11 w-full rounded-xl bg-accent px-4 py-2.5 font-medium text-white disabled:opacity-50`,children:A?n?`正在保存…`:`Saving…`:n?`保存回应偏好`:`Save response preferences`})]}),(0,T.jsx)(`p`,{className:`mt-5 text-center text-sm text-fg-muted`,children:n?`之后可以直接说“回答短一点”或“先听我说”,回应方式会继续调整。`:`You can later say “keep it shorter” or “listen first” to adjust how it responds.`})]})}):(0,T.jsx)(`div`,{className:`flex h-full min-h-0 flex-1 items-center justify-center overflow-y-auto bg-surface-base px-5 py-10 sm:px-8`,children:(0,T.jsxs)(`div`,{className:`w-full max-w-lg text-center`,children:[(0,T.jsx)(`div`,{className:`mx-auto flex size-20 items-center justify-center rounded-[1.75rem] bg-amber-100/40 dark:bg-amber-400/10`,children:(0,T.jsx)(_,{appearance:`spark`,className:`size-16`})}),(0,T.jsx)(`h2`,{className:`mt-7 text-3xl font-semibold tracking-tight text-fg`,children:n?`有事,直接和我说`:`Start with a conversation`}),(0,T.jsx)(`p`,{className:`mx-auto mt-3 max-w-md text-sm leading-7 text-fg-muted`,children:n?`聊想法、问问题,或交给我一件要推进的事。我们先从对话开始,回应方式可以边聊边调整。`:`Bring a question, an idea, or something to move forward. We can shape how I respond as we talk.`}),(0,T.jsxs)(`button`,{type:`button`,disabled:A||C.length===0,onClick:()=>void xe(),className:`mx-auto mt-8 flex min-h-12 w-full max-w-xs items-center justify-center gap-2 rounded-xl bg-accent px-5 text-sm font-medium text-white transition-colors hover:opacity-90 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent focus-visible:ring-offset-2 disabled:opacity-50`,children:[A?n?`正在准备对话…`:`Getting ready…`:n?`开始对话`:`Start chatting`,!A&&(0,T.jsx)(g,{className:`size-4`,"aria-hidden":!0})]}),C.length===0&&(0,T.jsxs)(`p`,{className:`mt-5 text-sm text-fg-muted`,children:[n?`开始前需要配置一个可用模型。`:`Set up a compatible model to get started.`,` `,(0,T.jsx)(i,{to:`/settings/capabilities/models`,className:`text-accent underline underline-offset-2`,children:n?`前往模型设置`:`Model settings`})]}),M&&(0,T.jsx)(`p`,{role:`alert`,className:`mt-5 text-sm text-danger`,children:M}),C.length>0&&(0,T.jsx)(`p`,{className:`mt-5 text-xs text-fg-subtle`,children:n?`名字、形象和其他偏好,以后都能随时调整。`:`You can change the name, appearance, and preferences later.`})]})})}export{oe as PersonalPage};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{t as e}from"./createLucideIcon-DPHK1VkS.js";var t=e(`play`,[[`path`,{d:`M5 5a2 2 0 0 1 3.008-1.728l11.997 6.998a2 2 0 0 1 .003 3.458l-12 7A2 2 0 0 1 5 19z`,key:`10ikf1`}]]);export{t};
|
|
@@ -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"./createLucideIcon-DPHK1VkS.js";import{t as a}from"./check-DUBLcKHA.js";import{t as o}from"./cn-JdwAhgNB.js";import{a as s,i as c,o as l,r as u}from"./dist-3h6cXXhT.js";import{t as d}from"./skeleton-BwbyijEw.js";import{a as f,s as p,t as m}from"./settings-shell-dialog-layer-BU3UuiJr.js";import{n as h,r as g}from"./settings-shell-layer-context-BTQUDoJ2.js";var _=i(`chevrons-up-down`,[[`path`,{d:`m7 15 5 5 5-5`,key:`1hf1tw`}],[`path`,{d:`m7 9 5-5 5 5`,key:`sgt6xg`}]]),v=e(t(),1),y=n();function b(e,t=!1){if(!t)return m;switch(e){case`modal`:return f;case`page`:return p;default:return`z-50`}}var x=r();function S(e){let t=(0,y.c)(14),{options:n,values:r,multiple:i,onChange:a,ariaLabel:s}=e,c=i===void 0?!1:i,l=(0,v.useId)(),u;if(t[0]!==c||t[1]!==l||t[2]!==a||t[3]!==n||t[4]!==r){let e;t[6]!==c||t[7]!==l||t[8]!==a||t[9]!==r?(e=e=>(0,x.jsxs)(`label`,{className:o(`touch-target flex min-h-10 min-w-0 items-center gap-3 rounded-md px-2 py-2 text-sm text-fg has-focus-visible:ring-2 has-focus-visible:ring-accent`,e.disabled?`cursor-not-allowed opacity-50`:`cursor-pointer hover:bg-surface-hover`),children:[(0,x.jsx)(`input`,{type:c?`checkbox`:`radio`,name:l,value:e.value,checked:r.includes(e.value),disabled:e.disabled,className:`shrink-0 accent-accent`,onChange:t=>a(c?t.target.checked?[...r,e.value]:r.filter(t=>t!==e.value):[e.value])}),e.icon,(0,x.jsx)(`span`,{className:`min-w-0 flex-1 break-words`,children:e.label})]},e.value),t[6]=c,t[7]=l,t[8]=a,t[9]=r,t[10]=e):e=t[10],u=n.map(e),t[0]=c,t[1]=l,t[2]=a,t[3]=n,t[4]=r,t[5]=u}else u=t[5];let d;return t[11]!==s||t[12]!==u?(d=(0,x.jsx)(`fieldset`,{"aria-label":s,className:`min-w-0 space-y-0.5`,children:u}),t[11]=s,t[12]=u,t[13]=d):d=t[13],d}var C=`flex max-h-[min(20rem,var(--radix-popover-content-available-height))] flex-col overflow-hidden`,w=`min-h-0 flex-1 overflow-y-auto overscroll-y-contain touch-pan-y [scrollbar-gutter:stable]`;function T({value:e,options:t,placeholder:n,allowEmpty:r=!0,emptyLabel:i=n,emptyDisabled:f=!1,disabledValues:p,disabled:m,id:y,ariaLabel:S,ariaLabelledBy:T,title:E,triggerClassName:D,triggerIcon:O,contentClassName:k,side:A=`bottom`,align:j=`start`,onChange:M,searchPlaceholder:N,searchValue:P,onSearchChange:F,loading:I=!1,statusMessage:L,selectedLabel:R}){let[z,B]=(0,v.useState)(!1),[V,H]=(0,v.useState)(null),U=g(),W=h(V),G=b(U,W!==null),K=t.find(t=>t.value===e),q=R??K?.label??(e?`${e} · unavailable`:n),J;return(0,x.jsxs)(s,{open:z,onOpenChange:B,children:[(0,x.jsx)(l,{asChild:!0,children:(0,x.jsxs)(`button`,{ref:H,id:y,type:`button`,"aria-label":S,"aria-labelledby":T,title:E,disabled:m,className:o(`touch-target box-border flex h-10 w-full min-w-0 items-center justify-between gap-2 rounded-lg border border-edge bg-surface-inset px-3 text-left text-sm font-normal text-fg`,`hover:border-edge-strong focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,m&&`cursor-not-allowed opacity-50 hover:border-edge`,D),children:[O,(0,x.jsx)(`span`,{className:o(`min-w-0 truncate`,!e&&`text-fg-subtle`),children:q}),(0,x.jsx)(_,{className:`size-4 shrink-0 text-fg-subtle`,"aria-hidden":`true`})]})}),(0,x.jsx)(c,{container:W??void 0,children:(0,x.jsxs)(u,{side:A,align:j,sideOffset:4,collisionPadding:8,className:o(G,C,`w-[var(--radix-popover-trigger-width)] min-w-[16rem] rounded-lg border border-edge bg-surface-overlay p-1 shadow-popover outline-none`,k),children:[N?(0,x.jsx)(`input`,{type:`search`,"aria-label":N,placeholder:N,value:P,onChange:e=>F?.(e.target.value),className:`mb-1 w-full shrink-0 rounded-md bg-surface-base px-3 py-2 text-base text-fg placeholder:text-fg-subtle sm:text-sm focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`}):null,(0,x.jsxs)(`div`,{"data-select-scroll-region":!0,className:o(w,`max-h-64`),children:[r?(0,x.jsxs)(`button`,{type:`button`,disabled:f,className:o(`touch-target flex h-9 w-full items-center gap-2 rounded-md px-2 text-left text-sm text-fg hover:bg-surface-hover`,e===``&&`bg-surface-active font-medium`,f&&`cursor-not-allowed opacity-45 hover:bg-transparent`),onClick:()=>{f||(M(``),B(!1))},children:[(0,x.jsx)(a,{className:o(`size-4 shrink-0`,e!==``&&`invisible`),"aria-hidden":`true`}),(0,x.jsx)(`span`,{className:`min-w-0 truncate text-fg-subtle`,children:i})]}):null,I?(0,x.jsx)(`div`,{className:`space-y-2 p-2`,"aria-busy":`true`,children:[0,1,2].map(e=>(0,x.jsx)(d,{className:`h-8 w-full`},e))}):null,L&&!I?(0,x.jsx)(`p`,{role:`status`,className:`px-3 py-2 text-xs text-fg-muted`,children:L}):null,(I?[]:t).map(t=>{let n=t.disabled===!0||p?.has(t.value)===!0&&t.value!==e,r=t.group&&t.group!==J;return J=t.group,(0,x.jsxs)(v.Fragment,{children:[r?(0,x.jsx)(`div`,{className:`px-2 pb-1 pt-2 text-[11px] font-semibold uppercase tracking-wide text-fg-subtle`,children:t.group}):null,(0,x.jsxs)(`button`,{type:`button`,disabled:n,className:o(`touch-target flex h-9 w-full items-center gap-2 rounded-md px-2 text-left text-sm text-fg hover:bg-surface-hover`,t.value===e&&`bg-surface-active font-medium`,n&&`cursor-not-allowed opacity-45 hover:bg-transparent`),onClick:()=>{n||(M(t.value),B(!1))},children:[t.icon??(0,x.jsx)(a,{className:o(`size-4 shrink-0`,t.value!==e&&`invisible`),"aria-hidden":`true`}),(0,x.jsx)(`span`,{className:`min-w-0 truncate`,children:t.label}),t.icon?(0,x.jsx)(a,{className:o(`ml-auto size-4 shrink-0`,t.value!==e&&`invisible`),"aria-hidden":!0}):null]})]},`${t.group??``}:${t.value}`)})]})]})})]})}function E(e){return typeof e==`string`||typeof e==`number`?String(e):Array.isArray(e)?e.map(E).join(``):(0,v.isValidElement)(e)?E(e.props.children):``}function D(e,t){let n=[];return v.Children.forEach(e,e=>{if(!(0,v.isValidElement)(e))return;if(e.type===v.Fragment){n.push(...D(e.props.children,t));return}if(e.type===k){let t=e.props;n.push(...D(t.children,E(t.label)));return}if(e.type!==O)return;let r=e.props,i=E(r.children).trim(),a=r.value==null?i:String(r.value);n.push({value:a,label:i,disabled:r.disabled,group:t})}),n}function O(e){return null}function k(e){return null}function A(e){if(!e)return;let t=e.split(/\s+/).filter(Boolean).filter(e=>{let t=e.includes(`:`)?e.slice(e.lastIndexOf(`:`)+1):e;return t===`block`||t===`inline-block`||t===`inline-flex`||t===`flex`||t===`flex-1`||t===`flex-auto`||t===`flex-initial`||t===`flex-none`||t===`grow`||t===`shrink`||t===`min-w-0`||t===`min-h-0`||t.startsWith(`w-`)||t.startsWith(`min-w-`)||t.startsWith(`max-w-`)||t.startsWith(`basis-`)||t.startsWith(`grow-`)||t.startsWith(`shrink-`)||t.startsWith(`self-`)||t.startsWith(`order-`)||t.startsWith(`col-`)||t.startsWith(`row-`)});return t.length===0?void 0:t.join(` `)}function j(e){let t=(0,y.c)(66),n,r,i,a,s,c,l,u,d,f,p,m;t[0]===e?(n=t[1],r=t[2],i=t[3],a=t[4],s=t[5],c=t[6],l=t[7],u=t[8],d=t[9],f=t[10],p=t[11],m=t[12]):({align:n,children:r,className:i,contentClassName:a,disabled:s,id:c,onChange:l,placeholder:u,side:f,triggerClassName:p,value:m,...d}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i,t[4]=a,t[5]=s,t[6]=c,t[7]=l,t[8]=u,t[9]=d,t[10]=f,t[11]=p,t[12]=m);let h=(0,v.useId)(),g=m==null?``:String(m),_,b,S,C,w,E,O,k,j,P;if(t[13]!==r||t[14]!==i||t[15]!==s||t[16]!==h||t[17]!==c||t[18]!==u||t[19]!==d.name||t[20]!==g){let e=D(r);C=e.find(N),b=C!==void 0,S=C?.label||u||``,k=s||void 0,t[31]===i?j=t[32]:(j=A(i),t[31]=i,t[32]=j),P=d.name,_=T,w=c??h,E=g,O=e.filter(M),t[13]=r,t[14]=i,t[15]=s,t[16]=h,t[17]=c,t[18]=u,t[19]=d.name,t[20]=g,t[21]=_,t[22]=b,t[23]=S,t[24]=C,t[25]=w,t[26]=E,t[27]=O,t[28]=k,t[29]=j,t[30]=P}else _=t[21],b=t[22],S=t[23],C=t[24],w=t[25],E=t[26],O=t[27],k=t[28],j=t[29],P=t[30];let F=u??S,I=C?.disabled===!0,L=d[`aria-label`],R=d[`aria-labelledby`],z=d.title,B;t[33]!==i||t[34]!==p?(B=o(i,p),t[33]=i,t[34]=p,t[35]=B):B=t[35];let V;t[36]===l?V=t[37]:(V=e=>l?.({target:{value:e},currentTarget:{value:e}}),t[36]=l,t[37]=V);let H;t[38]!==_||t[39]!==n||t[40]!==b||t[41]!==a||t[42]!==s||t[43]!==S||t[44]!==d.title||t[45]!==f||t[46]!==w||t[47]!==R||t[48]!==B||t[49]!==V||t[50]!==E||t[51]!==O||t[52]!==F||t[53]!==I||t[54]!==L?(H=(0,x.jsx)(_,{id:w,value:E,options:O,placeholder:F,allowEmpty:b,emptyLabel:S,emptyDisabled:I,disabled:s,ariaLabel:L,ariaLabelledBy:R,title:z,side:f,align:n,triggerClassName:B,contentClassName:a,onChange:V}),t[38]=_,t[39]=n,t[40]=b,t[41]=a,t[42]=s,t[43]=S,t[44]=d.title,t[45]=f,t[46]=w,t[47]=R,t[48]=B,t[49]=V,t[50]=E,t[51]=O,t[52]=F,t[53]=I,t[54]=L,t[55]=H):H=t[55];let U;t[56]!==s||t[57]!==d.name||t[58]!==g?(U=(0,x.jsx)(`input`,{name:d.name,value:g,readOnly:!0,hidden:!0,disabled:s}),t[56]=s,t[57]=d.name,t[58]=g,t[59]=U):U=t[59];let W;return t[60]!==H||t[61]!==U||t[62]!==k||t[63]!==j||t[64]!==P?(W=(0,x.jsxs)(`div`,{"aria-disabled":k,className:j,"data-select-name":P,children:[H,U]}),t[60]=H,t[61]=U,t[62]=k,t[63]=j,t[64]=P,t[65]=W):W=t[65],W}function M(e){return e.value!==``}function N(e){return e.value===``}export{C as a,_ as c,S as i,j as n,w as o,O as r,b as s,T as t};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{n as e,t}from"./vendor-react-BOUWij0V.js";import{t as n}from"./download-Dk-ZjtO6.js";import{t as r}from"./external-link-DjqjBmc3.js";import{t as i}from"./cn-JdwAhgNB.js";import{n as a}from"./interaction-BdhHBbYa.js";import{n as o}from"./electron-env-Dit0bHgy.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=o()&&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=o()&&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=i(`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:i(`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`,a.transition,a.press,a.focusRingPanel),onClick:()=>void p?.(),children:[(0,c.jsx)(r,{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:i(`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`,a.transition,a.press,a.focusRingPanel),onClick:()=>void h?.(),children:[(0,c.jsx)(r,{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=i(`inline-flex items-center gap-1.5 rounded-md border border-accent bg-accent px-3 py-1.5 text-xs font-medium text-on-accent shadow-sm`,a.transition,a.press,a.focusRingPanel),t[19]=O):O=t[19];let k;t[20]===Symbol.for(`react.memo_cache_sentinel`)?(k=(0,c.jsx)(n,{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{r as n,t as r,u as i}from"./chunk-KS7C4IRE-BMYIfy9x.js";import{n as a}from"./locale-store-Y1aBayM_.js";import{a as o,r as s}from"./product-delivery-BAks11S4.js";import{i as c}from"./vendor-swr-BIWyz7Rc.js";import{t as l}from"./skeleton-BwbyijEw.js";import{
|
|
1
|
+
import{n as e,t}from"./vendor-react-BOUWij0V.js";import{r as n,t as r,u as i}from"./chunk-KS7C4IRE-BMYIfy9x.js";import{n as a}from"./locale-store-Y1aBayM_.js";import{a as o,r as s}from"./product-delivery-BAks11S4.js";import{i as c}from"./vendor-swr-BIWyz7Rc.js";import{t as l}from"./skeleton-BwbyijEw.js";import{Vn as u}from"./index-CYeGnj-L.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=i(),r=a(h)===`zh`,m=s(`xopc://open${t.search}`),_=m?.kind===`local_app`?m.id:null,{data:v,error:y}=c(_?[`local-app-open`,_]:null,()=>u(_));if(!m){let t=r?`这个打开链接无效。`:`This open link is invalid.`,n;return e[0]!==t||e[1]!==r?(n=(0,p.jsx)(g,{message:t,zh:r}),e[0]=t,e[1]=r,e[2]=n):n=e[2],n}if(m.kind!==`local_app`){let t=o({...m,title:m.id,capabilities:[`open`]}),i;return e[3]!==t||e[4]!==r?(i=t?(0,p.jsx)(n,{to:t,replace:!0}):(0,p.jsx)(g,{message:r?`这个内容无法在应用中打开。`:`This content cannot be opened in the app.`,zh:r}),e[3]=t,e[4]=r,e[5]=i):i=e[5],i}if(y){let t=typeof y==`object`&&y&&`status`in y&&y.status===404?r?`找不到这个应用,它可能已被删除。`:`This app was not found and may have been deleted.`:y instanceof Error?y.message:r?`无法打开这个应用。`:`Unable to open this app.`,n;return e[6]!==t||e[7]!==r?(n=(0,p.jsx)(g,{message:t,zh:r}),e[6]=t,e[7]=r,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 r;return e[11]===t?r=e[12]:(r=(0,p.jsx)(n,{to:t,replace:!0}),e[11]=t,e[12]=r),r}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:i}=e,a;t[0]===n?a=t[1]:(a=(0,p.jsx)(`p`,{children:n}),t[0]=n,t[1]=a);let o=i?`查看应用`:`View apps`,s;t[2]===o?s=t[3]:(s=(0,p.jsx)(r,{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};
|