@xopcai/xopc 0.0.445 → 0.0.447
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/dist/assets/{auth-DAIwDtVp.js → auth-CQmxIyWw.js} +225 -8
- package/dist/browser-ext/dist/background.js +254 -16
- package/dist/browser-ext/dist/sidepanel.html +1 -1
- package/dist/browser-ext/dist/sidepanel.js +3 -49
- package/dist/browser-ext/manifest.json +1 -1
- package/dist/extensions/telegram/src/draft-stream-lifecycle.d.ts +2 -3
- package/dist/extensions/telegram/src/plugin.d.ts +0 -1
- package/dist/extensions/telegram/src/plugin.js +0 -1
- package/dist/extensions/telegram/xopc.extension.json +1 -1
- package/dist/gateway/static/root/assets/{activity-store-CuPXAoLe.js → activity-store-D_KDDoA1.js} +1 -1
- package/dist/gateway/static/root/assets/{agent-avatar-dicebear-D92uHOFV.js → agent-avatar-dicebear-CGHzO0HR.js} +1 -1
- package/dist/gateway/static/root/assets/{agent-avatar-display-DINzeGs0.js → agent-avatar-display-Dm1YHaAt.js} +2 -2
- package/dist/gateway/static/root/assets/{agent-defaults-settings-panel-rH1QpgiR.js → agent-defaults-settings-panel-BGTfRvG5.js} +1 -1
- package/dist/gateway/static/root/assets/{agent-plugin-dialog-B2vXlrDW.js → agent-plugin-dialog-D0AQB-2O.js} +1 -1
- package/dist/gateway/static/root/assets/{agents-lvQfOQPN.js → agents-Ckr-T2KU.js} +3 -3
- package/dist/gateway/static/root/assets/{agents-admin-api-DPLtjJtX.js → agents-admin-api-D0qHxAok.js} +1 -1
- package/dist/gateway/static/root/assets/{api-snfMD8_Y.js → api-pQXrYBTk.js} +1 -1
- package/dist/gateway/static/root/assets/{api-CEzBruRJ.js → api-uriioEZx.js} +1 -1
- package/dist/gateway/static/root/assets/{app-management-settings-panel-CONwDpqL.js → app-management-settings-panel-CQbKhrjd.js} +1 -1
- package/dist/gateway/static/root/assets/{appearance-settings-Bu7K-_ri.js → appearance-settings-Dm0GM368.js} +1 -1
- package/dist/gateway/static/root/assets/{apps-page-C3iDd3ZQ.js → apps-page-DCeINCy-.js} +1 -1
- package/dist/gateway/static/root/assets/{archive-plugin-CfLz9o-2.js → archive-plugin-Cd4FOTEH.js} +1 -1
- package/dist/gateway/static/root/assets/{automation-api-Dl9fi8t0.js → automation-api-B3df53ms.js} +1 -1
- package/dist/gateway/static/root/assets/{automation-result-state-BjjZCxee.js → automation-result-state-CpgaWu2r.js} +1 -1
- package/dist/gateway/static/root/assets/{automation-run-list-9IPHu_UC.js → automation-run-list-DrJfwJN_.js} +1 -1
- package/dist/gateway/static/root/assets/{automation-task-card-CKbHMLSy.js → automation-task-card-C2mxNw5Q.js} +1 -1
- package/dist/gateway/static/root/assets/{automations-page-K3trjTZl.js → automations-page-B5bnb-N8.js} +1 -1
- package/dist/gateway/static/root/assets/{automations-workspace-D7m3w_9B.js → automations-workspace-7R4mL3M-.js} +2 -2
- package/dist/gateway/static/root/assets/{binary-plugins-Bv4ixxo4.js → binary-plugins-C0QOjfJV.js} +1 -1
- package/dist/gateway/static/root/assets/{block-editor-CtaJSB9U.js → block-editor-BY1Mb-WW.js} +3 -2
- package/dist/gateway/static/root/assets/{browser-settings-page-CmBsnx24.js → browser-settings-page-DUsk02LK.js} +1 -1
- package/dist/gateway/static/root/assets/{capabilities-DJYgOjeq.js → capabilities-Bt1fAcDI.js} +1 -1
- package/dist/gateway/static/root/assets/{capabilities-DDJJhQ40.js → capabilities-Bu7efUpH.js} +1 -1
- package/dist/gateway/static/root/assets/{capabilities-page-CBqvHAyp.js → capabilities-page-DFv5-mPY.js} +2 -2
- package/dist/gateway/static/root/assets/{capabilities-settings-panel-wjezs0OE.js → capabilities-settings-panel-BtRMZjAx.js} +1 -1
- package/dist/gateway/static/root/assets/{channels-D4q8hiD0.js → channels-CByFQQ_H.js} +1 -1
- package/dist/gateway/static/root/assets/{chat-agents-api-BOB3dILf.js → chat-agents-api-SruH_oEQ.js} +1 -1
- package/dist/gateway/static/root/assets/{chat-chart-block-DsaCatBN.js → chat-chart-block-BBchFbUa.js} +1 -1
- package/dist/gateway/static/root/assets/chat-page-C3ttsYGZ.js +71 -0
- package/dist/gateway/static/root/assets/{chat-terminal-dock-D9o0nUEV.js → chat-terminal-dock-DCNAz0CB.js} +1 -1
- package/dist/gateway/static/root/assets/{command-palette-api-Cj0_7g9o.js → command-palette-api-r8U5soT7.js} +1 -1
- package/dist/gateway/static/root/assets/{composer-payload-handoff-CoDWKzBm.js → composer-payload-handoff-RaEQXTjj.js} +1 -1
- package/dist/gateway/static/root/assets/{computer-settings-page-DJ9BIOHC.js → computer-settings-page-C7cj9Zyx.js} +1 -1
- package/dist/gateway/static/root/assets/{connected-providers-grid-C5-3MDIj.js → connected-providers-grid-DgJ7I1do.js} +1 -1
- package/dist/gateway/static/root/assets/{connection-usage-guide-bD1sKiAp.js → connection-usage-guide-De6QJt8B.js} +1 -1
- package/dist/gateway/static/root/assets/{connector-service-page-BEq3i3Vi.js → connector-service-page-qSYlFATU.js} +1 -1
- package/dist/gateway/static/root/assets/{connectors-api-DEExP6a7.js → connectors-api-CqyteNnT.js} +1 -1
- package/dist/gateway/static/root/assets/{connectors-page-QVWuoxuK.js → connectors-page-BB3V-zJS.js} +1 -1
- package/dist/gateway/static/root/assets/{date-picker-D2whl8Ci.js → date-picker-CB6IVCiq.js} +1 -1
- package/dist/gateway/static/root/assets/{desktop-pet-narrative-C8zQtMcw.js → desktop-pet-narrative-B7I1II0Z.js} +1 -1
- package/dist/gateway/static/root/assets/{desktop-pet-settings-C54b1FY4.js → desktop-pet-settings-Cm1O5CEG.js} +1 -1
- package/dist/gateway/static/root/assets/{desktop-pet-qnIdmNnH.js → desktop-pet-wqyOn6xs.js} +1 -1
- package/dist/gateway/static/root/assets/{dev-view-store-bryv5YRw.js → dev-view-store-BxPWx1Gi.js} +1 -1
- package/dist/gateway/static/root/assets/{device-pairing-wizard-Du-yOxZv.js → device-pairing-wizard-CqgjknYy.js} +1 -1
- package/dist/gateway/static/root/assets/{directory-picker-path-field-GsMkjw59.js → directory-picker-path-field-BCOUShCs.js} +1 -1
- package/dist/gateway/static/root/assets/{discussion-annotation-sync-CrpDiC7J.js → discussion-annotation-sync-uvwyXFX3.js} +1 -1
- package/dist/gateway/static/root/assets/{extension-debug-page-CDZfdMAR.js → extension-debug-page-C7ZJumIY.js} +1 -1
- package/dist/gateway/static/root/assets/{extension-iframe-host-CG70QWPS.js → extension-iframe-host-B0rM3Ohp.js} +1 -1
- package/dist/gateway/static/root/assets/{extension-marketplace-api-D7Av-sOf.js → extension-marketplace-api-DIGw487r.js} +1 -1
- package/dist/gateway/static/root/assets/{extension-page-DpJTL6-v.js → extension-page-C5LnL_Dy.js} +1 -1
- package/dist/gateway/static/root/assets/{extension-provider-BZTbdvCF.js → extension-provider-D5L3t0e3.js} +1 -1
- package/dist/gateway/static/root/assets/{extension-settings-page-CC4rmiFC.js → extension-settings-page-DnXoNNDa.js} +1 -1
- package/dist/gateway/static/root/assets/{file-preview-surface-Dtla5oAW.js → file-preview-surface-Bfqc0ZKv.js} +1 -1
- package/dist/gateway/static/root/assets/{gateway-config-swr-B5THNdYK.js → gateway-config-swr-Db2fE-gT.js} +1 -1
- package/dist/gateway/static/root/assets/gateway-realtime-nI6k8qP8.js +1 -0
- package/dist/gateway/static/root/assets/gateway-realtime-store-CjYSSi_l.js +1 -0
- package/dist/gateway/static/root/assets/gateway-restart-CyhN9Fk3.js +1 -0
- package/dist/gateway/static/root/assets/gateway-settings-Nr0Bzbsy.js +1 -0
- package/dist/gateway/static/root/assets/{gateway-startup-retry-CqtCJzWJ.js → gateway-startup-retry-Du7l0oxt.js} +1 -1
- package/dist/gateway/static/root/assets/{global-defaults-api-BQMdHLlp.js → global-defaults-api-qGBKLt28.js} +1 -1
- package/dist/gateway/static/root/assets/{home-page-Df3X6-Ko.js → home-page-h6D4Pqqc.js} +2 -2
- package/dist/gateway/static/root/assets/{image-generation-api-G3tQFhif.js → image-generation-api-DeolJQxY.js} +1 -1
- package/dist/gateway/static/root/assets/{imports-page-BmEqiunH.js → imports-page-B3kUV_dq.js} +1 -1
- package/dist/gateway/static/root/assets/index-Bj6IrJGJ.js +11 -0
- package/dist/gateway/static/root/assets/index-D3YWUSNe.css +1 -0
- package/dist/gateway/static/root/assets/install-connector-dialog-Brl22l1N.js +1 -0
- package/dist/gateway/static/root/assets/{keyboard-shortcuts-settings-CtNI6i7K.js → keyboard-shortcuts-settings-CFrEEDZu.js} +1 -1
- package/dist/gateway/static/root/assets/languages-kF11aUYU.js +2 -0
- package/dist/gateway/static/root/assets/{local-app-workbench-page-CE46mHc0.js → local-app-workbench-page-CbHgQzs4.js} +1 -1
- package/dist/gateway/static/root/assets/{local-apps-page-DqZT5hLH.js → local-apps-page-Cdeawk2X.js} +1 -1
- package/dist/gateway/static/root/assets/{local-session-drafts-Bt_e3A8f.js → local-session-drafts-oWhYPECv.js} +1 -1
- package/dist/gateway/static/root/assets/{locale-store-Bld7_m-Q.js → locale-store-BY-fRY-q.js} +1 -1
- package/dist/gateway/static/root/assets/{logs-page-CzajqK40.js → logs-page-3dWLrUy0.js} +1 -1
- package/dist/gateway/static/root/assets/management-api-BzdYxqsC.js +1 -0
- package/dist/gateway/static/root/assets/management-settings-yWWgFlzF.js +1 -0
- package/dist/gateway/static/root/assets/{markdown-editor-BuuGlcfG.js → markdown-editor-CjQJ-Nho.js} +1 -1
- package/dist/gateway/static/root/assets/{markdown-view-B3cFKCfO.js → markdown-view-ClNfoiYC.js} +1 -1
- package/dist/gateway/static/root/assets/{mcp-conversation-setup-page-ZcY1nqMO.js → mcp-conversation-setup-page-C0M7yW4O.js} +1 -1
- package/dist/gateway/static/root/assets/{media-plugins-DSOplRhW.js → media-plugins-DmVG3TQ5.js} +1 -1
- package/dist/gateway/static/root/assets/messages-DFCLetQl.js +3 -0
- package/dist/gateway/static/root/assets/{model-selector-yAKlOR3O.js → model-selector-DkytsBae.js} +1 -1
- package/dist/gateway/static/root/assets/{models-hub-cache-8V-ZpAIa.js → models-hub-cache-CESzQ_tk.js} +1 -1
- package/dist/gateway/static/root/assets/navigation-ByOzYT0t.js +1 -0
- package/dist/gateway/static/root/assets/note-detail-panel-CQIrUO6h.js +7 -0
- package/dist/gateway/static/root/assets/note-image-lightbox-Cw-TaViX.js +1 -0
- package/dist/gateway/static/root/assets/{notes-api-CVQqqmGI.js → notes-api-32qiHxz2.js} +1 -1
- package/dist/gateway/static/root/assets/{notes-page-DIugUbkV.js → notes-page-gl59x-7l.js} +2 -2
- package/dist/gateway/static/root/assets/{oauth-api-DGa6PTuq.js → oauth-api-CMpfoRed.js} +1 -1
- package/dist/gateway/static/root/assets/{oauth-provider-connect-Bc-KLH1e.js → oauth-provider-connect-XzlLkqnK.js} +1 -1
- package/dist/gateway/static/root/assets/page-context-capture-button-CdMxGZaM.js +1 -0
- package/dist/gateway/static/root/assets/{page-context-draft-GveHK8e2.js → page-context-draft-CrgFs0h3.js} +1 -1
- package/dist/gateway/static/root/assets/page-header-store-BNjlQHqU.js +1 -0
- package/dist/gateway/static/root/assets/{personal-avatar-Cu8lGBXZ.js → personal-avatar-BHMRbUIc.js} +1 -1
- package/dist/gateway/static/root/assets/{personal-page-BZWJKyZ8.js → personal-page-DUuJe2P9.js} +1 -1
- package/dist/gateway/static/root/assets/{personal-settings-panel-awr10jTV.js → personal-settings-panel-CZjvI9rl.js} +1 -1
- package/dist/gateway/static/root/assets/{phone-dependencies-card-CAxn3usD.js → phone-dependencies-card-BCEI4PGp.js} +1 -1
- package/dist/gateway/static/root/assets/{phone-model-connection-BBG3LxRP.js → phone-model-connection-BqOzyoRr.js} +1 -1
- package/dist/gateway/static/root/assets/{phone-model-picker-CfPjKpnd.js → phone-model-picker-BGAAMeo6.js} +1 -1
- package/dist/gateway/static/root/assets/{phone-settings-page-C4dJdwRW.js → phone-settings-page-BdoFCa2J.js} +1 -1
- package/dist/gateway/static/root/assets/{phone-workspace-store-BKltFHtG.js → phone-workspace-store-D1BS7otl.js} +1 -1
- package/dist/gateway/static/root/assets/{plugin-details-dialog-BqcFfZFH.js → plugin-details-dialog-BP-ZS2g2.js} +1 -1
- package/dist/gateway/static/root/assets/{preference-select-fields-QlyIA8ve.js → preference-select-fields-RITbo_ES.js} +1 -1
- package/dist/gateway/static/root/assets/{product-automation-feedback-CRsfuAXl.js → product-automation-feedback-CQvcSORB.js} +1 -1
- package/dist/gateway/static/root/assets/{product-open-page-CQ4dk-_l.js → product-open-page-CJfYOVkw.js} +1 -1
- package/dist/gateway/static/root/assets/product-preview-content-B0-rh4uS.js +1 -0
- package/dist/gateway/static/root/assets/product-preview-modal-CSFxc7oy.js +2 -0
- package/dist/gateway/static/root/assets/project-detail-page-CgU7vGyT.js +7 -0
- package/dist/gateway/static/root/assets/project-overview-model-DrLXaO-t.js +1 -0
- package/dist/gateway/static/root/assets/{project-understanding-CU2af95r.js → project-understanding-szQw-qin.js} +1 -1
- package/dist/gateway/static/root/assets/{projects-page-BsgZb6n9.js → projects-page-BFZsIyzp.js} +1 -1
- package/dist/gateway/static/root/assets/{providers-api-CspehmSU.js → providers-api-j511FMYv.js} +1 -1
- package/dist/gateway/static/root/assets/{recording-upload-BOZAOdCI.js → recording-upload-jq70ER5Y.js} +1 -1
- package/dist/gateway/static/root/assets/{registry-api-Bdp3UUyz.js → registry-api-BnEoY6_B.js} +1 -1
- package/dist/gateway/static/root/assets/{remote-access-hub-Bos3uwAT.js → remote-access-hub-B8AHjzC5.js} +1 -1
- package/dist/gateway/static/root/assets/{resource-unavailable-DJR3SCy6.js → resource-unavailable-AT-LkLIB.js} +1 -1
- package/dist/gateway/static/root/assets/route-preload-ByDpGuZp.js +2 -0
- package/dist/gateway/static/root/assets/{runtime-tools-api-DsbahxzE.js → runtime-tools-api-BDjAwlQF.js} +1 -1
- package/dist/gateway/static/root/assets/{runtime-tools-settings-panel-DW9_OFi2.js → runtime-tools-settings-panel-kvbXN_HV.js} +1 -1
- package/dist/gateway/static/root/assets/{service-recommendation-list-Bd1JDO5T.js → service-recommendation-list-DquxQCKH.js} +1 -1
- package/dist/gateway/static/root/assets/{session-api-DjnHJ-0n.js → session-api-CgTDekPG.js} +1 -1
- package/dist/gateway/static/root/assets/{session-manager-ChHnJOWW.js → session-manager-V8cj3NVD.js} +2 -2
- package/dist/gateway/static/root/assets/{sessions-page-BM-oqd22.js → sessions-page-KFescmNm.js} +1 -1
- package/dist/gateway/static/root/assets/settings-advanced-gate-JCPJyeK-.js +1 -0
- package/dist/gateway/static/root/assets/{settings-advanced-section-CM44UlF8.js → settings-advanced-section-Daxv3VGf.js} +1 -1
- package/dist/gateway/static/root/assets/{settings-mode-store-Blc4C8aw.js → settings-mode-store-LUeLxacj.js} +1 -1
- package/dist/gateway/static/root/assets/{settings-page-irv-JoTz.js → settings-page-Bi6rvZGw.js} +1 -1
- package/dist/gateway/static/root/assets/{settings-page-header-BYFaTD8a.js → settings-page-header-Dmw3nYJ1.js} +1 -1
- package/dist/gateway/static/root/assets/{settings-page-layout-CnUQSxT3.js → settings-page-layout-YJXlkr_Z.js} +1 -1
- package/dist/gateway/static/root/assets/{setup-interaction-page-DqaiLQ0I.js → setup-interaction-page-Dd3Ovfgm.js} +1 -1
- package/dist/gateway/static/root/assets/{setup-status-panel-iOYgfkoK.js → setup-status-panel-BZZXpXiB.js} +1 -1
- package/dist/gateway/static/root/assets/{share-link-dialog-C_uYNUlp.js → share-link-dialog-B1g7Xero.js} +1 -1
- package/dist/gateway/static/root/assets/{share-preview-page-CFebGqyB.js → share-preview-page-1GlB7603.js} +1 -1
- package/dist/gateway/static/root/assets/{shares-api-C2GDyqxP.js → shares-api-DXOD--vt.js} +1 -1
- package/dist/gateway/static/root/assets/{shares-settings-B-7la3QN.js → shares-settings-Bj-HKS3s.js} +1 -1
- package/dist/gateway/static/root/assets/skill-api-HQEXke4-.js +1 -0
- package/dist/gateway/static/root/assets/{skill-list-api-7MY9ewiu.js → skill-list-api-CJBrtxil.js} +1 -1
- package/dist/gateway/static/root/assets/{skill-reload-api-DkDpu3Wd.js → skill-reload-api-CO6jhwui.js} +1 -1
- package/dist/gateway/static/root/assets/skills-page-DAxov1a8.js +2 -0
- package/dist/gateway/static/root/assets/{source-workspace-editor-kxosllTu.js → source-workspace-editor-BwYU5OEh.js} +1 -1
- package/dist/gateway/static/root/assets/{system-settings-panel-BltKPJdb.js → system-settings-panel-By3gokfs.js} +1 -1
- package/dist/gateway/static/root/assets/{task-detail-page-6awKGnOr.js → task-detail-page-Cf58C6gC.js} +1 -1
- package/dist/gateway/static/root/assets/{task-result-evidence-Cy9txdqV.js → task-result-evidence-DWfp9UIc.js} +1 -1
- package/dist/gateway/static/root/assets/{terminal-panel-store-DUEJoa1M.js → terminal-panel-store-DBC-pqGy.js} +1 -1
- package/dist/gateway/static/root/assets/{theme-store-DsvYj7Vy.js → theme-store-C57ZxHqm.js} +1 -1
- package/dist/gateway/static/root/assets/tool-friendly-title-YQmN1S2k.js +2 -0
- package/dist/gateway/static/root/assets/{tracing-settings-page-B_Xdc2VF.js → tracing-settings-page-BQ7regHS.js} +1 -1
- package/dist/gateway/static/root/assets/{tunnel-api-B6BhWTh3.js → tunnel-api-BOJVQPqI.js} +1 -1
- package/dist/gateway/static/root/assets/{understanding-activity-store-B7rFXhDk.js → understanding-activity-store-YrDh1XvR.js} +1 -1
- package/dist/gateway/static/root/assets/{understanding-refresh-store-DCFASve5.js → understanding-refresh-store-D6gM1s8M.js} +1 -1
- package/dist/gateway/static/root/assets/{usage-page-DqzosTxy.js → usage-page-DpC6gP1I.js} +1 -1
- package/dist/gateway/static/root/assets/{use-autosave-DsqcLHV9.js → use-autosave-NOpNkLFw.js} +1 -1
- package/dist/gateway/static/root/assets/{use-composer-attachments-ClakaDU1.js → use-composer-attachments-R6kKpDgc.js} +1 -1
- package/dist/gateway/static/root/assets/use-file-preview-expanded-M7LSoDLc.js +15 -0
- package/dist/gateway/static/root/assets/{use-personal-profile-T2e6P5Ed.js → use-personal-profile-JPLBYzew.js} +1 -1
- package/dist/gateway/static/root/assets/{use-workspace-tree-Dq0qgK3N.js → use-workspace-tree-jzKVAl3N.js} +1 -1
- package/dist/gateway/static/root/assets/{user-model-page-Ziz55hVM.js → user-model-page-CPZgl93P.js} +1 -1
- package/dist/gateway/static/root/assets/{voice-api-key-field-D7NPAc1E.js → voice-api-key-field-R_KAYzHp.js} +1 -1
- package/dist/gateway/static/root/assets/{voice-config-api-UQDTh6hh.js → voice-config-api-D6ueBjfw.js} +1 -1
- package/dist/gateway/static/root/assets/{voice-input-shortcut-events-SD2gZVg8.js → voice-input-shortcut-events-04u9YoRg.js} +1 -1
- package/dist/gateway/static/root/assets/{voice-transcribe-api-Bf9FaI-p.js → voice-transcribe-api-B2NVJYnu.js} +1 -1
- package/dist/gateway/static/root/assets/{work-discovery-overlay-B41GOFXh.js → work-discovery-overlay-BHaemIrQ.js} +1 -1
- package/dist/gateway/static/root/assets/{work-discovery-page-NNhExALx.js → work-discovery-page-Bt_j5iQ5.js} +1 -1
- package/dist/gateway/static/root/assets/{working-directory-picker-modal-DeNWVFFK.js → working-directory-picker-modal-5EsBeKBO.js} +1 -1
- package/dist/gateway/static/root/assets/{workspace-api-DrVss2Fd.js → workspace-api-BmUCKePi.js} +2 -2
- package/dist/gateway/static/root/assets/workspace-editor-agent-store-Sy1CLe2K.js +1 -0
- package/dist/gateway/static/root/assets/{workspace-file-preview-dialog-C2egBzza.js → workspace-file-preview-dialog-hYGX2hWZ.js} +1 -1
- package/dist/gateway/static/root/assets/{workspace-open-location-menu-XFUtwfLY.js → workspace-open-location-menu-DqLui4B1.js} +1 -1
- package/dist/gateway/static/root/assets/{xopc-cloud-account-card-BlhFT1q9.js → xopc-cloud-account-card-CVq7U7Ft.js} +1 -1
- package/dist/gateway/static/root/index.html +85 -84
- package/dist/package.js +1 -1
- package/dist/packages/endpoint-tools-client/src/index.js +309 -17
- package/dist/packages/endpoint-tools-protocol/src/index.js +62 -10
- package/dist/packages/endpoint-tools-protocol/src/provider-execution.js +32 -0
- package/dist/packages/endpoint-tools-protocol/src/providers.js +233 -0
- package/dist/packages/gateway-contract/src/clarifications.js +1 -1
- package/dist/packages/gateway-contract/src/device-pairing.js +2 -1
- package/dist/packages/gateway-contract/src/device-request-proof.js +32 -0
- package/dist/packages/gateway-contract/src/index.js +2 -2
- package/dist/packages/realtime-client/src/index.js +1 -0
- package/dist/packages/realtime-protocol/src/index.js +4 -1
- package/dist/src/agent/agent-manager.d.ts +0 -1
- package/dist/src/agent/agent-manager.js +1 -4
- package/dist/src/agent/background-review/run-background-review.js +1 -1
- package/dist/src/agent/commands/command-registry.js +1 -1
- package/dist/src/agent/embedded/run-for-session.js +4 -7
- package/dist/src/agent/embedded/session-runner.js +8 -3
- package/dist/src/agent/embedded/tool-metadata.d.ts +1 -1
- package/dist/src/agent/embedded/tool-search-extension.d.ts +1 -0
- package/dist/src/agent/embedded/tool-search-extension.js +35 -2
- package/dist/src/agent/external-tools/cliProvider.js +2 -2
- package/dist/src/agent/external-tools/composio-provider.js +2 -2
- package/dist/src/agent/external-tools/endpoint-provider.d.ts +3 -0
- package/dist/src/agent/external-tools/endpoint-provider.js +96 -18
- package/dist/src/agent/external-tools/index.js +2 -2
- package/dist/src/agent/external-tools/personal-request-scope.js +6 -0
- package/dist/src/agent/external-tools/read-policy.js +15 -8
- package/dist/src/agent/external-tools/service.js +8 -0
- package/dist/src/agent/external-tools/types.d.ts +1 -0
- package/dist/src/agent/inbound/inbound-loop.js +2 -1
- package/dist/src/agent/mcp/continuation-guard.js +1 -1
- package/dist/src/agent/mcp/conversation-setup.js +1 -1
- package/dist/src/agent/mcp/discovery.js +1 -1
- package/dist/src/agent/mcp/native-mcp.d.ts +2 -0
- package/dist/src/agent/mcp/native-mcp.js +5 -0
- package/dist/src/agent/mcp/transport.d.ts +2 -1
- package/dist/src/agent/mcp/transport.js +21 -6
- package/dist/src/agent/orchestration/agent-orchestrator.d.ts +2 -1
- package/dist/src/agent/orchestration/agent-orchestrator.js +6 -5
- package/dist/src/agent/service.js +1 -1
- package/dist/src/agent/skills/index.js +1 -1
- package/dist/src/agent/skills/managed-store.js +1 -1
- package/dist/src/agent/skills/marketplace/adapters/clawhub/adapter.d.ts +1 -0
- package/dist/src/agent/skills/marketplace/adapters/clawhub/adapter.js +56 -30
- package/dist/src/agent/skills/marketplace/search.js +2 -2
- package/dist/src/agent/skills/skill-manage-ops.js +1 -1
- package/dist/src/agent/tool-manuals/computer.d.ts +1 -1
- package/dist/src/agent/tool-manuals/computer.js +2 -0
- package/dist/src/agent/tools/clarify-tool.d.ts +1 -0
- package/dist/src/agent/tools/device-use-tool.d.ts +9 -0
- package/dist/src/agent/tools/device-use-tool.js +158 -0
- package/dist/src/agent/tools/factory.js +24 -3
- package/dist/src/agent/tools/personal-read-tool.js +1 -1
- package/dist/src/agent/tools/xopc-use-tool.js +2 -2
- package/dist/src/agent-catalog/capabilities.js +2 -2
- package/dist/src/agent-catalog/repository.js +1 -1
- package/dist/src/automations/api/routes.js +2 -2
- package/dist/src/automations/capabilities/drafts.js +1 -1
- package/dist/src/automations/capabilities/write.js +1 -1
- package/dist/src/automations/configuration-conversation.js +1 -1
- package/dist/src/automations/mcp-source.js +1 -1
- package/dist/src/automations/service/action-executor.js +10 -2
- package/dist/src/browser/providers/browser-ext-install.js +1 -1
- package/dist/src/browser/remote/device-driver.js +7 -3
- package/dist/src/browser/remote/device-target.d.ts +1 -1
- package/dist/src/browser/remote/device-target.js +8 -6
- package/dist/src/capabilities/runtime/dispatcher.js +1 -1
- package/dist/src/capabilities/runtime/product.js +1 -1
- package/dist/src/channels/lifecycle-supervisor.js +2 -1
- package/dist/src/channels/pairing/paths.d.ts +1 -1
- package/dist/src/channels/pairing/paths.js +1 -1
- package/dist/src/channels/verified-inbound.d.ts +13 -0
- package/dist/src/channels/verified-inbound.js +29 -0
- package/dist/src/cli/command-loaders.js +1 -0
- package/dist/src/cli/command-manifest.js +4 -0
- package/dist/src/cli/commands/agents.js +1 -1
- package/dist/src/cli/commands/device-host.js +52 -0
- package/dist/src/cli/commands/doctor/checks/database-schema.js +1 -1
- package/dist/src/cli/commands/models.js +1 -1
- package/dist/src/cli/commands/onboard/model.js +1 -1
- package/dist/src/cli/index.js +1 -1
- package/dist/src/cli/utils/init-workspace-core.js +1 -1
- package/dist/src/computer/diagnostics.d.ts +3 -3
- package/dist/src/computer/endpoint-transport.js +1 -1
- package/dist/src/computer/errors.js +4 -0
- package/dist/src/computer/evaluation.d.ts +2 -2
- package/dist/src/computer/flows.js +1 -1
- package/dist/src/computer/runtime.d.ts +1 -0
- package/dist/src/computer/runtime.js +25 -3
- package/dist/src/config/agent-profile.js +1 -1
- package/dist/src/config/paths.d.ts +1 -1
- package/dist/src/config/paths.js +1 -1
- package/dist/src/config/schema.d.ts +2 -0
- package/dist/src/config/schema.js +1 -0
- package/dist/src/connectors/composio-triggers.js +1 -1
- package/dist/src/endpoint-tools/bridge-host.d.ts +5 -4
- package/dist/src/endpoint-tools/bridge-host.js +165 -30
- package/dist/src/endpoint-tools/bridge.d.ts +1 -1
- package/dist/src/endpoint-tools/bridge.js +39 -7
- package/dist/src/endpoint-tools/capability-catalog.d.ts +1 -1
- package/dist/src/endpoint-tools/capability-catalog.js +1 -1
- package/dist/src/endpoint-tools/delegation.d.ts +60 -0
- package/dist/src/endpoint-tools/delegation.js +130 -0
- package/dist/src/endpoint-tools/desktop-execution.js +1 -1
- package/dist/src/endpoint-tools/device-host.d.ts +98 -0
- package/dist/src/endpoint-tools/device-host.js +89 -0
- package/dist/src/endpoint-tools/execution-actor.d.ts +6 -0
- package/dist/src/endpoint-tools/execution-actor.js +53 -0
- package/dist/src/endpoint-tools/grant-service.d.ts +7 -4
- package/dist/src/endpoint-tools/grant-service.js +12 -4
- package/dist/src/endpoint-tools/host-credentials.d.ts +42 -0
- package/dist/src/endpoint-tools/host-credentials.js +144 -0
- package/dist/src/endpoint-tools/index.d.ts +1 -1
- package/dist/src/endpoint-tools/index.js +3 -3
- package/dist/src/endpoint-tools/invocation-service.d.ts +47 -4
- package/dist/src/endpoint-tools/invocation-service.js +328 -36
- package/dist/src/endpoint-tools/mcp-provider.d.ts +32 -0
- package/dist/src/endpoint-tools/mcp-provider.js +258 -0
- package/dist/src/endpoint-tools/policy.js +0 -3
- package/dist/src/endpoint-tools/provider-catalog.d.ts +45 -0
- package/dist/src/endpoint-tools/provider-catalog.js +202 -0
- package/dist/src/endpoint-tools/provider-operation-journal.d.ts +18 -0
- package/dist/src/endpoint-tools/provider-operation-journal.js +111 -0
- package/dist/src/endpoint-tools/provider-operation-status.d.ts +33 -0
- package/dist/src/endpoint-tools/provider-operation-status.js +80 -0
- package/dist/src/endpoint-tools/registry.d.ts +14 -1
- package/dist/src/endpoint-tools/registry.js +15 -1
- package/dist/src/endpoint-tools/result-projector.d.ts +1 -2
- package/dist/src/endpoint-tools/result-projector.js +3 -11
- package/dist/src/endpoint-tools/runtime.d.ts +10 -2
- package/dist/src/endpoint-tools/runtime.js +102 -11
- package/dist/src/endpoint-tools/target-resolver.d.ts +8 -3
- package/dist/src/endpoint-tools/target-resolver.js +24 -5
- package/dist/src/endpoint-tools/task-targets.d.ts +38 -0
- package/dist/src/endpoint-tools/task-targets.js +95 -0
- package/dist/src/endpoint-tools/upload-service.d.ts +34 -1
- package/dist/src/endpoint-tools/upload-service.js +88 -2
- package/dist/src/execution-environments/local-worktree-manager.js +1 -1
- package/dist/src/extensions/agent-plugins/refresh-runtime-access.d.ts +7 -2
- package/dist/src/extensions/agent-plugins/refresh-runtime-access.js +36 -25
- package/dist/src/extensions/agent-plugins/setup.d.ts +1 -1
- package/dist/src/extensions/agent-plugins/setup.js +2 -2
- package/dist/src/extensions/agent-plugins/skill-catalog.js +1 -1
- package/dist/src/extensions/agent-plugins/validation.js +1 -1
- package/dist/src/extensions/loader.d.ts +0 -1
- package/dist/src/extensions/loader.js +3 -38
- package/dist/src/extensions/typed-event-bus.d.ts +0 -1
- package/dist/src/extensions/typed-event-bus.js +0 -1
- package/dist/src/gateway/agents-admin.js +1 -1
- package/dist/src/gateway/global-defaults-admin.js +1 -1
- package/dist/src/gateway/hono/routes/agent-stream.js +12 -1
- package/dist/src/gateway/hono/routes/agents.js +1 -1
- package/dist/src/gateway/hono/routes/config-patch/misc.js +1 -1
- package/dist/src/gateway/hono/routes/device-authorizations.js +4 -10
- package/dist/src/gateway/hono/routes/device-hosts.d.ts +3 -0
- package/dist/src/gateway/hono/routes/device-hosts.js +82 -0
- package/dist/src/gateway/hono/routes/device-providers.d.ts +3 -0
- package/dist/src/gateway/hono/routes/device-providers.js +297 -0
- package/dist/src/gateway/hono/routes/device-targets.d.ts +3 -0
- package/dist/src/gateway/hono/routes/device-targets.js +117 -0
- package/dist/src/gateway/hono/routes/endpoint-compatibility.js +2 -1
- package/dist/src/gateway/hono/routes/endpoint-tools.js +2 -78
- package/dist/src/gateway/hono/routes/lazy-bundles.js +24 -8
- package/dist/src/gateway/hono/routes/notes.js +2 -2
- package/dist/src/gateway/hono/routes/phone-setup.js +1 -1
- package/dist/src/gateway/hono/routes/projects.js +2 -2
- package/dist/src/gateway/hono/routes/session-command-handler.js +2 -0
- package/dist/src/gateway/hono/routes/session-input-handler.js +3 -1
- package/dist/src/gateway/hono/routes/tasks.js +1 -1
- package/dist/src/gateway/image-generation-setup.js +1 -1
- package/dist/src/gateway/security/device-request-proof.js +8 -18
- package/dist/src/gateway/security/gateway-scopes.js +1 -0
- package/dist/src/gateway/service/agent-runner.d.ts +3 -0
- package/dist/src/gateway/service/agent-runner.js +21 -5
- package/dist/src/gateway/service/config-coordinator.d.ts +1 -0
- package/dist/src/gateway/service.js +9 -4
- package/dist/src/gateway/xopc-cloud-capability-setup.js +1 -1
- package/dist/src/home-intelligence/host.js +2 -2
- package/dist/src/imports/importService.js +1 -1
- package/dist/src/local-apps/service.js +1 -1
- package/dist/src/mcp/capability-server.js +1 -1
- package/dist/src/notes/agent-context.d.ts +3 -0
- package/dist/src/notes/agent-context.js +32 -4
- package/dist/src/personal-agent/proactivity/repository.js +1 -1
- package/dist/src/personal-agent/proactivity/service.js +1 -1
- package/dist/src/personal-agent/service.js +1 -1
- package/dist/src/phone/assistance.js +1 -1
- package/dist/src/phone/location-environment.js +1 -1
- package/dist/src/phone/repository.js +1 -1
- package/dist/src/phone/setup/service.js +1 -1
- package/dist/src/realtime/runtime.js +5 -0
- package/dist/src/runtime-tools/archive.js +1 -1
- package/dist/src/session/session-context-for-llm.js +9 -1
- package/dist/src/session/store.js +1 -1
- package/dist/src/share/hosted-session-share.js +1 -1
- package/dist/src/share/share-store.js +1 -1
- package/dist/src/storage/sqlite/clarification-wait-repository.d.ts +7 -1
- package/dist/src/storage/sqlite/clarification-wait-repository.js +40 -2
- package/dist/src/storage/sqlite/device-access-repository.d.ts +2 -8
- package/dist/src/storage/sqlite/device-access-repository.js +1 -3
- package/dist/src/storage/sqlite/endpoint-tool-invocation-repository.d.ts +1 -0
- package/dist/src/storage/sqlite/endpoint-tool-invocation-repository.js +2 -2
- package/dist/src/storage/sqlite/index.d.ts +0 -1
- package/dist/src/storage/sqlite/index.js +3 -3
- package/dist/src/storage/sqlite/schema.d.ts +2 -2
- package/dist/src/storage/sqlite/schema.js +7 -7
- package/dist/src/storage/sqlite/schema.sql +2 -10
- package/dist/src/storage/sqlite/session-input-repository.js +8 -0
- package/dist/src/storage/sqlite/upgrades/270_device_bridge_kind.sql +30 -0
- package/dist/src/tasks/capabilities/read.js +2 -2
- package/dist/src/tasks/capabilities/write.js +1 -1
- package/dist/src/tui/backends/embedded-backend.js +1 -1
- package/dist/src/voice/realtime/persona-context.js +1 -1
- package/package.json +4 -5
- package/dist/extensions/feishu/src/auth/paths.d.ts +0 -2
- package/dist/extensions/feishu/src/auth/paths.js +0 -16
- package/dist/extensions/feishu/src/state/thread-bindings.d.ts +0 -19
- package/dist/extensions/feishu/src/state/thread-bindings.js +0 -44
- package/dist/extensions/feishu/src/subagent-hooks.d.ts +0 -12
- package/dist/extensions/feishu/src/subagent-hooks.js +0 -50
- package/dist/extensions/feishu/src/tools/docx/docx-batch-insert.d.ts +0 -11
- package/dist/extensions/feishu/src/tools/docx/docx-batch-insert.js +0 -93
- package/dist/extensions/feishu/src/tools/docx/docx-color-text.d.ts +0 -15
- package/dist/extensions/feishu/src/tools/docx/docx-color-text.js +0 -73
- package/dist/extensions/feishu/src/tools/docx/docx-table-ops.d.ts +0 -20
- package/dist/extensions/feishu/src/tools/docx/docx-table-ops.js +0 -171
- package/dist/extensions/feishu/src/tools/docx/docx-types.d.ts +0 -34
- package/dist/gateway/static/root/assets/chat-page-CeHOmJqM.js +0 -72
- package/dist/gateway/static/root/assets/gateway-realtime-hnEaDFaA.js +0 -1
- package/dist/gateway/static/root/assets/gateway-realtime-store-ugwtyD4q.js +0 -1
- package/dist/gateway/static/root/assets/gateway-restart-kwv0njYq.js +0 -1
- package/dist/gateway/static/root/assets/gateway-settings-CxYPJTy8.js +0 -1
- package/dist/gateway/static/root/assets/index-DE2bG5EI.css +0 -1
- package/dist/gateway/static/root/assets/index-PewrhviZ.js +0 -11
- package/dist/gateway/static/root/assets/install-connector-dialog-BU4l6KJv.js +0 -1
- package/dist/gateway/static/root/assets/languages-zXtNocoy.js +0 -2
- package/dist/gateway/static/root/assets/management-settings-BgdAP0kf.js +0 -1
- package/dist/gateway/static/root/assets/messages-CGO1P4mz.js +0 -3
- package/dist/gateway/static/root/assets/navigation-D62kPsA9.js +0 -1
- package/dist/gateway/static/root/assets/note-detail-panel-DWIWloib.js +0 -5
- package/dist/gateway/static/root/assets/note-image-lightbox-BbNYW2Rw.js +0 -1
- package/dist/gateway/static/root/assets/page-context-capture-button-B9L7V_n2.js +0 -1
- package/dist/gateway/static/root/assets/page-header-store-YZfSLNTg.js +0 -1
- package/dist/gateway/static/root/assets/product-preview-content-CGbqoID0.js +0 -1
- package/dist/gateway/static/root/assets/product-preview-modal-0wvIDcVr.js +0 -2
- package/dist/gateway/static/root/assets/project-detail-page-Bkxs8knZ.js +0 -7
- package/dist/gateway/static/root/assets/route-preload-BVo8JPwW.js +0 -2
- package/dist/gateway/static/root/assets/settings-advanced-gate-DyGT3o1e.js +0 -1
- package/dist/gateway/static/root/assets/skill-api-BnpTSZGc.js +0 -1
- package/dist/gateway/static/root/assets/skills-page-sL2kGqHZ.js +0 -2
- package/dist/gateway/static/root/assets/tool-friendly-title-DEGpbye4.js +0 -1
- package/dist/gateway/static/root/assets/use-file-preview-expanded-9DED7ohY.js +0 -2
- package/dist/gateway/static/root/assets/workspace-editor-agent-store-CmSYxTmk.js +0 -1
- package/dist/packages/endpoint-tools-protocol/src/bridge.js +0 -105
- package/dist/packages/gateway-contract/src/desktop-chat.js +0 -29
- package/dist/src/endpoint-tools/binding-service.d.ts +0 -24
- package/dist/src/endpoint-tools/binding-service.js +0 -57
- package/dist/src/gateway/hono/routes/desktop-chat.d.ts +0 -3
- package/dist/src/gateway/hono/routes/desktop-chat.js +0 -30
- package/dist/src/storage/sqlite/endpoint-session-binding-repository.d.ts +0 -9
- package/dist/src/storage/sqlite/endpoint-session-binding-repository.js +0 -41
- /package/dist/{extensions/feishu/src/tools/docx/docx-types.js → src/cli/commands/device-host.d.ts} +0 -0
package/dist/gateway/static/root/assets/{model-selector-yAKlOR3O.js → model-selector-DkytsBae.js}
RENAMED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{a as t,n,t as r}from"./vendor-react-BOUWij0V.js";import{l as i,u as a}from"./chunk-KS7C4IRE-CiwuuyV8.js";import{n as ee}from"./locale-store-Bld7_m-Q.js";import{t as o}from"./messages-CGO1P4mz.js";import{t as te}from"./check-DUBLcKHA.js";import{a as ne,c as s,d as c,l,o as u,u as re}from"./popover-select-CLsphyzA.js";import{t as ie}from"./settings-2-D-csvaET.js";import{t as d}from"./cn-0WouolD0.js";import{i as ae}from"./vendor-swr-CdRzEUwF.js";import{n as f,t as oe}from"./registry-api-Bdp3UUyz.js";import{c as se,s as ce}from"./dist-GJ8-1PAx.js";import{t as le}from"./open-capability-settings-Cvb65hQB.js";import{n as ue}from"./interaction-BdhHBbYa.js";import{i as de,n as fe,r as pe}from"./form-field-width-DJw_jULe.js";import{n as p}from"./model-sort-_Tz8s_4N.js";var me=n();function m(e,t){return e.displayNames?.[t.toLowerCase().startsWith(`zh`)?`zh-CN`:`en`]||(t.toLowerCase().startsWith(`zh`)&&e.id===`xopc-cloud/auto`&&e.name===`Standard`?`标准`:t.toLowerCase().startsWith(`zh`)&&e.id===`xopc-cloud/advanced`&&e.name===`Advanced`?`高级`:e.name)}var h=e(t(),1);function he(e,t,n){if(t===`computer-use`)return e.filter(e=>!!e.computerUse);let r=e=>e.computerUse?.profile!==void 0&&e.computerUse.dedicated!==!1&&e.computerUse.profile!==`openai-responses-computer-v1`,i=e=>!!(e.phoneUse&&e.phoneUse.dedicated!==!1);if(t!==`vision`)return e.filter(e=>!r(e)&&!i(e)||e.id===n);let a=e.filter(e=>e.vision===!0&&!r(e)&&!i(e));if(!n||a.some(e=>e.id===n))return a;let ee=e.find(e=>e.id===n);if(ee)return[ee,...a];let o=n.indexOf(`/`),te=o>=0?n.slice(0,o):``;return[{id:n,name:(o>=0?n.slice(o+1):n)||n,provider:te||`—`,vision:!1},...a]}var g=r();function _(e){return`${e.id} ${e.name} ${Object.values(e.displayNames??{}).join(` `)} ${e.provider}`.toLowerCase()}var ge=[];function _e(e,t){let n=t.trim().toLowerCase();if(!n)return e;let r=n.split(/\s+/).filter(Boolean);return e.filter(e=>{let t=_(e);return r.every(e=>t.includes(e))})}function v(e){let t=(0,me.c)(100),{value:n,disabled:r,placeholder:u,searchPlaceholder:p,noMatches:_,models:v,modelsLoading:xe,modelsError:Se,capabilitiesFilter:y,outOfFilterNote:Ce,registryEmptyHint:we,allowEmpty:Te,emptyLabel:Ee,compact:De,showProviderInTrigger:Oe,contentSide:ke,contentAlign:Ae,className:je,popoverContentClassName:Me,showProviderSettingsFooter:Ne,settingsFooterLink:Pe,ariaLabel:Fe,onChange:b}=e,Ie=Te!==void 0&&Te,Le=Oe===void 0||Oe,Re=ke===void 0?`bottom`:ke,ze=Ae===void 0?`end`:Ae,Be=a(),x=i(),S=ee(ye),C;t[0]===S?C=t[1]:(C=o(S),t[0]=S,t[1]=C);let Ve=C.chat,[He,w]=(0,h.useState)(!1),[T,E]=(0,h.useState)(``),[Ue,We]=(0,h.useState)(null),Ge=l(),Ke=s(Ue),qe=re(Ge,Ke!==null),D;t[2]!==Ve||t[3]!==Pe||t[4]!==Ne?(D=Pe??(Ne?{label:Ve.modelProviderSettingsLink,path:`/settings/capabilities/models`}:void 0),t[2]=Ve,t[3]=Pe,t[4]=Ne,t[5]=D):D=t[5];let O=D,k;t[6]===Symbol.for(`react.memo_cache_sentinel`)?(k={revalidateOnFocus:!1},t[6]=k):k=t[6];let Je=ae(v?null:oe,f,k),A=v??Je.data??ge,Ye=v?!!xe:Je.isLoading,j=v?Se:Je.error,M;t[7]===n?M=t[8]:(M=n.trim(),t[7]=n,t[8]=M);let N=M,Xe;t[9]!==y||t[10]!==A||t[11]!==N?(Xe=he(A,y,N),t[9]=y,t[10]=A,t[11]=N,t[12]=Xe):Xe=t[12];let P=Xe,Ze=y===`computer-use`||P.length>10,Qe=Ze?T:``,$e;t[13]!==P||t[14]!==Qe?($e=_e(P,Qe),t[13]=P,t[14]=Qe,t[15]=$e):$e=t[15];let F=$e,et;t[16]!==A||t[17]!==P||t[18]!==n?(et=A.find(e=>e.id===n)??P.find(e=>e.id===n),t[16]=A,t[17]=P,t[18]=n,t[19]=et):et=t[19];let I=et,tt;t[20]!==S||t[21]!==u||t[22]!==I||t[23]!==Le||t[24]!==n?(tt=I?Le?`${m(I,S)} (${I.provider})`:m(I,S):n||u,t[20]=S,t[21]=u,t[22]=I,t[23]=Le,t[24]=n,t[25]=tt):tt=t[25];let nt=tt,L=!j&&!!y&&P.length===0,rt=se,it=r||Ye,R;t[26]!==S||t[27]!==u||t[28]!==I?(R=I?`${m(I,S)} (${I.provider})`:u,t[26]=S,t[27]=u,t[28]=I,t[29]=R):R=t[29];let at=De&&`py-1.5 text-[13px]`,z;t[30]!==je||t[31]!==at?(z=d(fe,`items-center gap-2 rounded-lg border border-edge-subtle bg-surface-panel px-3 py-2 text-left text-sm font-normal text-fg`,ue.transition,`hover:border-edge hover:bg-surface-hover/45`,de,`disabled:cursor-not-allowed disabled:opacity-50`,`dark:border-edge-subtle dark:hover:bg-surface-hover/55`,at,je),t[30]=je,t[31]=at,t[32]=z):z=t[32];let ot=Ye?`…`:nt,B;t[33]===ot?B=t[34]:(B=(0,g.jsx)(`span`,{className:`min-w-0 truncate`,children:ot}),t[33]=ot,t[34]=B);let st;t[35]===Symbol.for(`react.memo_cache_sentinel`)?(st=(0,g.jsx)(c,{className:`size-4 shrink-0 text-fg-subtle opacity-70`,"aria-hidden":!0}),t[35]=st):st=t[35];let V;t[36]!==Fe||t[37]!==it||t[38]!==R||t[39]!==z||t[40]!==B?(V=(0,g.jsx)(ce,{asChild:!0,children:(0,g.jsxs)(`button`,{ref:We,type:`button`,"aria-label":Fe,disabled:it,title:R,className:z,children:[B,st]})}),t[36]=Fe,t[37]=it,t[38]=R,t[39]=z,t[40]=B,t[41]=V):V=t[41];let ct=se,lt=Ke??void 0,ut=se,dt=d(qe,ne,`w-[min(22rem,calc(100vw-2rem))] rounded-xl border border-edge-subtle bg-surface-overlay p-1 shadow-elevated dark:border-edge-subtle`,Me),H;t[42]!==T||t[43]!==p||t[44]!==Ze?(H=Ze?(0,g.jsx)(`input`,{type:`search`,"aria-label":p,className:d(`mb-1 w-full shrink-0 rounded-lg border border-edge-subtle bg-surface-base px-2.5 py-1.5 text-sm text-fg placeholder:text-fg-disabled dark:bg-surface-hover/40`,pe),placeholder:p,value:T,onChange:e=>E(e.target.value)}):null,t[42]=T,t[43]=p,t[44]=Ze,t[45]=H):H=t[45];let U;t[46]!==Ie||t[47]!==Ee||t[48]!==b||t[49]!==u||t[50]!==N?(U=Ie?(0,g.jsxs)(`button`,{type:`button`,className:d(`flex w-full items-center gap-2 rounded-md px-2 py-1.5 text-left text-sm text-fg hover:bg-surface-hover`,N===``&&`bg-surface-hover/90 font-medium dark:bg-surface-hover/70`),onClick:()=>{b(``),w(!1),E(``)},children:[(0,g.jsx)(te,{className:d(`size-4 shrink-0`,N!==``&&`invisible`),"aria-hidden":!0}),(0,g.jsx)(`span`,{className:`min-w-0 truncate text-fg-muted`,children:Ee??u})]}):null,t[46]=Ie,t[47]=Ee,t[48]=b,t[49]=u,t[50]=N,t[51]=U):U=t[51];let W;t[52]===j?W=t[53]:(W=j?(0,g.jsx)(`div`,{className:`p-2 text-xs text-red-600 dark:text-red-400`,children:j instanceof Error?j.message:`Failed to load models`}):null,t[52]=j,t[53]=W);let G;t[54]!==j||t[55]!==_||t[56]!==we||t[57]!==L?(G=!j&&L?(0,g.jsx)(`div`,{className:`px-2 py-3 text-center text-xs text-fg-muted`,children:we??_}):null,t[54]=j,t[55]=_,t[56]=we,t[57]=L,t[58]=G):G=t[58];let K;t[59]!==j||t[60]!==F||t[61]!==_||t[62]!==L?(K=!j&&!L&&F.length===0?(0,g.jsx)(`div`,{className:`px-2 py-3 text-center text-xs text-fg-muted`,children:_}):null,t[59]=j,t[60]=F,t[61]=_,t[62]=L,t[63]=K):K=t[63];let ft=y===`vision`?Ce:void 0,q;t[64]===b?q=t[65]:(q=e=>{b(e),w(!1),E(``)},t[64]=b,t[65]=q);let J;t[66]!==F||t[67]!==_||t[68]!==p||t[69]!==ft||t[70]!==q||t[71]!==n?(J=(0,g.jsx)(be,{models:F,value:n,searchPlaceholder:p,noMatches:_,showSearch:!1,outOfFilterNote:ft,onChange:q}),t[66]=F,t[67]=_,t[68]=p,t[69]=ft,t[70]=q,t[71]=n,t[72]=J):J=t[72];let Y;t[73]!==U||t[74]!==W||t[75]!==G||t[76]!==K||t[77]!==J?(Y=(0,g.jsxs)(`div`,{className:`flex min-h-0 max-h-60 flex-1 flex-col overflow-hidden`,children:[U,W,G,K,J]}),t[73]=U,t[74]=W,t[75]=G,t[76]=K,t[77]=J,t[78]=Y):Y=t[78];let X;t[79]!==O||t[80]!==x||t[81]!==Be?(X=O?(0,g.jsx)(`div`,{className:`mt-1 shrink-0 border-t border-edge-subtle pt-1`,children:(0,g.jsxs)(`button`,{type:`button`,className:d(`flex w-full items-center gap-2 rounded-md p-2 text-left text-sm font-medium text-accent`,ue.transition,`hover:bg-surface-hover focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40`),onClick:()=>{O.path===`/settings/capabilities/models`?le(x.pathname.startsWith(`/automations`)?`background`:`chat`,`services`,x.pathname.startsWith(`/automations`)?`automation`:void 0):Be(O.path,{state:{settingsBackPath:`${x.pathname}${x.search}`}}),w(!1),E(``)},children:[(0,g.jsx)(ie,{className:`size-4 shrink-0 opacity-90`,"aria-hidden":!0}),(0,g.jsx)(`span`,{className:`min-w-0`,children:O.label})]})}):null,t[79]=O,t[80]=x,t[81]=Be,t[82]=X):X=t[82];let Z;t[83]!==ze||t[84]!==Re||t[85]!==ut.Content||t[86]!==dt||t[87]!==H||t[88]!==Y||t[89]!==X?(Z=(0,g.jsxs)(ut.Content,{className:dt,side:Re,sideOffset:4,align:ze,collisionPadding:8,onOpenAutoFocus:ve,children:[H,Y,X]}),t[83]=ze,t[84]=Re,t[85]=ut.Content,t[86]=dt,t[87]=H,t[88]=Y,t[89]=X,t[90]=Z):Z=t[90];let Q;t[91]!==ct.Portal||t[92]!==lt||t[93]!==Z?(Q=(0,g.jsx)(ct.Portal,{container:lt,children:Z}),t[91]=ct.Portal,t[92]=lt,t[93]=Z,t[94]=Q):Q=t[94];let $;return t[95]!==He||t[96]!==rt.Root||t[97]!==V||t[98]!==Q?($=(0,g.jsxs)(rt.Root,{open:He,onOpenChange:w,children:[V,Q]}),t[95]=He,t[96]=rt.Root,t[97]=V,t[98]=Q,t[99]=$):$=t[99],$}function ve(e){return e.preventDefault()}function ye(e){return e.language}function be({models:e,value:t,onChange:n,searchPlaceholder:r,noMatches:i,disabled:a,showSearch:o=e.length>10,outOfFilterNote:ne,groupByProvider:s=!1}){let c=ee(e=>e.language),[l,re]=(0,h.useState)(``),ie=_e(e,o?l:``),ae=(0,h.useRef)(null);(0,h.useLayoutEffect)(()=>{l||ae.current?.scrollIntoView?.({block:`nearest`})},[t,l,ie.some(e=>e.id===t)]);let f=new Map;for(let t of e){let e=s?t.provider:``;f.has(e)||f.set(e,[])}for(let e of ie)f.get(s?e.provider:``).push(e);return(0,g.jsxs)(`div`,{className:`flex min-h-0 flex-1 flex-col`,children:[o&&(0,g.jsx)(`input`,{type:`search`,"aria-label":r,placeholder:r,value:l,onChange:e=>re(e.target.value),className:d(`mx-1 mb-2 rounded-lg border border-edge bg-surface-base px-3 py-2 text-sm text-fg`,`focus:outline-none focus-visible:outline-none focus-visible:ring-0 focus-visible:ring-offset-0 focus-visible:shadow-none focus-visible:border-edge`)}),(0,g.jsxs)(`div`,{"data-select-scroll-region":!0,className:d(u,s&&`scroll-pt-8`),children:[ie.length===0&&(0,g.jsx)(`p`,{className:`px-3 py-4 text-sm text-fg-muted`,children:i}),[...f].filter(([,e])=>e.length>0).map(([r,i])=>(0,g.jsxs)(`div`,{role:s?`group`:void 0,"aria-label":s?r:void 0,className:s?`border-t border-edge-subtle pb-1 first:border-t-0`:void 0,children:[s&&(0,g.jsx)(`p`,{className:`sticky top-0 z-10 bg-surface-overlay px-3 pb-1 pt-3 text-xs font-medium text-fg-muted`,children:r}),i.sort(p).map(r=>(0,g.jsxs)(`button`,{type:`button`,disabled:a,title:r.id,ref:r.id===t?ae:void 0,"aria-pressed":r.id===t,style:e.length>50?{contentVisibility:`auto`,containIntrinsicSize:`auto 60px`}:void 0,className:d(`flex min-h-11 w-full items-center gap-3 rounded-lg px-3 py-2 text-left text-sm text-fg hover:bg-surface-hover disabled:opacity-50`,ue.focusRingPanel,r.id===t&&`bg-surface-hover`),onClick:()=>n(r.id),children:[(0,g.jsxs)(`span`,{className:`min-w-0 flex-1`,children:[(0,g.jsxs)(`span`,{className:`flex items-center gap-2`,children:[(0,g.jsx)(`span`,{className:`truncate font-medium`,children:m(r,c)}),(r.phoneUse&&r.phoneUse.dedicated!==!1||r.computerUse?.dedicated||r.reasoning)&&(0,g.jsx)(`span`,{className:`shrink-0 text-xs text-fg-muted`,children:r.phoneUse&&r.phoneUse.dedicated!==!1?c===`zh`?`手机控制`:`Phone control`:r.computerUse?.dedicated?c===`zh`?`电脑控制`:`Computer control`:c===`zh`?`推理`:`Reasoning`})]}),!s&&(0,g.jsx)(`span`,{className:`block truncate text-xs text-fg-muted`,children:r.provider}),ne&&!r.vision&&r.id===t&&(0,g.jsx)(`span`,{className:`block text-xs text-fg-muted`,children:ne})]}),(0,g.jsx)(te,{className:d(`size-4 shrink-0 text-accent-fg`,r.id!==t&&`invisible`),"aria-hidden":!0})]},r.id))]},r))]})]})}export{v as n,m as r,be as t};
|
|
1
|
+
import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{a as t,n,t as r}from"./vendor-react-BOUWij0V.js";import{l as i,u as a}from"./chunk-KS7C4IRE-CiwuuyV8.js";import{n as ee}from"./locale-store-BY-fRY-q.js";import{t as o}from"./messages-DFCLetQl.js";import{t as te}from"./check-DUBLcKHA.js";import{a as ne,c as s,d as c,l,o as u,u as re}from"./popover-select-CLsphyzA.js";import{t as ie}from"./settings-2-D-csvaET.js";import{t as d}from"./cn-0WouolD0.js";import{i as ae}from"./vendor-swr-CdRzEUwF.js";import{n as f,t as oe}from"./registry-api-BnEoY6_B.js";import{c as se,s as ce}from"./dist-GJ8-1PAx.js";import{t as le}from"./open-capability-settings-Cvb65hQB.js";import{n as ue}from"./interaction-BdhHBbYa.js";import{i as de,n as fe,r as pe}from"./form-field-width-DJw_jULe.js";import{n as p}from"./model-sort-_Tz8s_4N.js";var me=n();function m(e,t){return e.displayNames?.[t.toLowerCase().startsWith(`zh`)?`zh-CN`:`en`]||(t.toLowerCase().startsWith(`zh`)&&e.id===`xopc-cloud/auto`&&e.name===`Standard`?`标准`:t.toLowerCase().startsWith(`zh`)&&e.id===`xopc-cloud/advanced`&&e.name===`Advanced`?`高级`:e.name)}var h=e(t(),1);function he(e,t,n){if(t===`computer-use`)return e.filter(e=>!!e.computerUse);let r=e=>e.computerUse?.profile!==void 0&&e.computerUse.dedicated!==!1&&e.computerUse.profile!==`openai-responses-computer-v1`,i=e=>!!(e.phoneUse&&e.phoneUse.dedicated!==!1);if(t!==`vision`)return e.filter(e=>!r(e)&&!i(e)||e.id===n);let a=e.filter(e=>e.vision===!0&&!r(e)&&!i(e));if(!n||a.some(e=>e.id===n))return a;let ee=e.find(e=>e.id===n);if(ee)return[ee,...a];let o=n.indexOf(`/`),te=o>=0?n.slice(0,o):``;return[{id:n,name:(o>=0?n.slice(o+1):n)||n,provider:te||`—`,vision:!1},...a]}var g=r();function _(e){return`${e.id} ${e.name} ${Object.values(e.displayNames??{}).join(` `)} ${e.provider}`.toLowerCase()}var ge=[];function _e(e,t){let n=t.trim().toLowerCase();if(!n)return e;let r=n.split(/\s+/).filter(Boolean);return e.filter(e=>{let t=_(e);return r.every(e=>t.includes(e))})}function v(e){let t=(0,me.c)(100),{value:n,disabled:r,placeholder:u,searchPlaceholder:p,noMatches:_,models:v,modelsLoading:xe,modelsError:Se,capabilitiesFilter:y,outOfFilterNote:Ce,registryEmptyHint:we,allowEmpty:Te,emptyLabel:Ee,compact:De,showProviderInTrigger:Oe,contentSide:ke,contentAlign:Ae,className:je,popoverContentClassName:Me,showProviderSettingsFooter:Ne,settingsFooterLink:Pe,ariaLabel:Fe,onChange:b}=e,Ie=Te!==void 0&&Te,Le=Oe===void 0||Oe,Re=ke===void 0?`bottom`:ke,ze=Ae===void 0?`end`:Ae,Be=a(),x=i(),S=ee(ye),C;t[0]===S?C=t[1]:(C=o(S),t[0]=S,t[1]=C);let Ve=C.chat,[He,w]=(0,h.useState)(!1),[T,E]=(0,h.useState)(``),[Ue,We]=(0,h.useState)(null),Ge=l(),Ke=s(Ue),qe=re(Ge,Ke!==null),D;t[2]!==Ve||t[3]!==Pe||t[4]!==Ne?(D=Pe??(Ne?{label:Ve.modelProviderSettingsLink,path:`/settings/capabilities/models`}:void 0),t[2]=Ve,t[3]=Pe,t[4]=Ne,t[5]=D):D=t[5];let O=D,k;t[6]===Symbol.for(`react.memo_cache_sentinel`)?(k={revalidateOnFocus:!1},t[6]=k):k=t[6];let Je=ae(v?null:oe,f,k),A=v??Je.data??ge,Ye=v?!!xe:Je.isLoading,j=v?Se:Je.error,M;t[7]===n?M=t[8]:(M=n.trim(),t[7]=n,t[8]=M);let N=M,Xe;t[9]!==y||t[10]!==A||t[11]!==N?(Xe=he(A,y,N),t[9]=y,t[10]=A,t[11]=N,t[12]=Xe):Xe=t[12];let P=Xe,Ze=y===`computer-use`||P.length>10,Qe=Ze?T:``,$e;t[13]!==P||t[14]!==Qe?($e=_e(P,Qe),t[13]=P,t[14]=Qe,t[15]=$e):$e=t[15];let F=$e,et;t[16]!==A||t[17]!==P||t[18]!==n?(et=A.find(e=>e.id===n)??P.find(e=>e.id===n),t[16]=A,t[17]=P,t[18]=n,t[19]=et):et=t[19];let I=et,tt;t[20]!==S||t[21]!==u||t[22]!==I||t[23]!==Le||t[24]!==n?(tt=I?Le?`${m(I,S)} (${I.provider})`:m(I,S):n||u,t[20]=S,t[21]=u,t[22]=I,t[23]=Le,t[24]=n,t[25]=tt):tt=t[25];let nt=tt,L=!j&&!!y&&P.length===0,rt=se,it=r||Ye,R;t[26]!==S||t[27]!==u||t[28]!==I?(R=I?`${m(I,S)} (${I.provider})`:u,t[26]=S,t[27]=u,t[28]=I,t[29]=R):R=t[29];let at=De&&`py-1.5 text-[13px]`,z;t[30]!==je||t[31]!==at?(z=d(fe,`items-center gap-2 rounded-lg border border-edge-subtle bg-surface-panel px-3 py-2 text-left text-sm font-normal text-fg`,ue.transition,`hover:border-edge hover:bg-surface-hover/45`,de,`disabled:cursor-not-allowed disabled:opacity-50`,`dark:border-edge-subtle dark:hover:bg-surface-hover/55`,at,je),t[30]=je,t[31]=at,t[32]=z):z=t[32];let ot=Ye?`…`:nt,B;t[33]===ot?B=t[34]:(B=(0,g.jsx)(`span`,{className:`min-w-0 truncate`,children:ot}),t[33]=ot,t[34]=B);let st;t[35]===Symbol.for(`react.memo_cache_sentinel`)?(st=(0,g.jsx)(c,{className:`size-4 shrink-0 text-fg-subtle opacity-70`,"aria-hidden":!0}),t[35]=st):st=t[35];let V;t[36]!==Fe||t[37]!==it||t[38]!==R||t[39]!==z||t[40]!==B?(V=(0,g.jsx)(ce,{asChild:!0,children:(0,g.jsxs)(`button`,{ref:We,type:`button`,"aria-label":Fe,disabled:it,title:R,className:z,children:[B,st]})}),t[36]=Fe,t[37]=it,t[38]=R,t[39]=z,t[40]=B,t[41]=V):V=t[41];let ct=se,lt=Ke??void 0,ut=se,dt=d(qe,ne,`w-[min(22rem,calc(100vw-2rem))] rounded-xl border border-edge-subtle bg-surface-overlay p-1 shadow-elevated dark:border-edge-subtle`,Me),H;t[42]!==T||t[43]!==p||t[44]!==Ze?(H=Ze?(0,g.jsx)(`input`,{type:`search`,"aria-label":p,className:d(`mb-1 w-full shrink-0 rounded-lg border border-edge-subtle bg-surface-base px-2.5 py-1.5 text-sm text-fg placeholder:text-fg-disabled dark:bg-surface-hover/40`,pe),placeholder:p,value:T,onChange:e=>E(e.target.value)}):null,t[42]=T,t[43]=p,t[44]=Ze,t[45]=H):H=t[45];let U;t[46]!==Ie||t[47]!==Ee||t[48]!==b||t[49]!==u||t[50]!==N?(U=Ie?(0,g.jsxs)(`button`,{type:`button`,className:d(`flex w-full items-center gap-2 rounded-md px-2 py-1.5 text-left text-sm text-fg hover:bg-surface-hover`,N===``&&`bg-surface-hover/90 font-medium dark:bg-surface-hover/70`),onClick:()=>{b(``),w(!1),E(``)},children:[(0,g.jsx)(te,{className:d(`size-4 shrink-0`,N!==``&&`invisible`),"aria-hidden":!0}),(0,g.jsx)(`span`,{className:`min-w-0 truncate text-fg-muted`,children:Ee??u})]}):null,t[46]=Ie,t[47]=Ee,t[48]=b,t[49]=u,t[50]=N,t[51]=U):U=t[51];let W;t[52]===j?W=t[53]:(W=j?(0,g.jsx)(`div`,{className:`p-2 text-xs text-red-600 dark:text-red-400`,children:j instanceof Error?j.message:`Failed to load models`}):null,t[52]=j,t[53]=W);let G;t[54]!==j||t[55]!==_||t[56]!==we||t[57]!==L?(G=!j&&L?(0,g.jsx)(`div`,{className:`px-2 py-3 text-center text-xs text-fg-muted`,children:we??_}):null,t[54]=j,t[55]=_,t[56]=we,t[57]=L,t[58]=G):G=t[58];let K;t[59]!==j||t[60]!==F||t[61]!==_||t[62]!==L?(K=!j&&!L&&F.length===0?(0,g.jsx)(`div`,{className:`px-2 py-3 text-center text-xs text-fg-muted`,children:_}):null,t[59]=j,t[60]=F,t[61]=_,t[62]=L,t[63]=K):K=t[63];let ft=y===`vision`?Ce:void 0,q;t[64]===b?q=t[65]:(q=e=>{b(e),w(!1),E(``)},t[64]=b,t[65]=q);let J;t[66]!==F||t[67]!==_||t[68]!==p||t[69]!==ft||t[70]!==q||t[71]!==n?(J=(0,g.jsx)(be,{models:F,value:n,searchPlaceholder:p,noMatches:_,showSearch:!1,outOfFilterNote:ft,onChange:q}),t[66]=F,t[67]=_,t[68]=p,t[69]=ft,t[70]=q,t[71]=n,t[72]=J):J=t[72];let Y;t[73]!==U||t[74]!==W||t[75]!==G||t[76]!==K||t[77]!==J?(Y=(0,g.jsxs)(`div`,{className:`flex min-h-0 max-h-60 flex-1 flex-col overflow-hidden`,children:[U,W,G,K,J]}),t[73]=U,t[74]=W,t[75]=G,t[76]=K,t[77]=J,t[78]=Y):Y=t[78];let X;t[79]!==O||t[80]!==x||t[81]!==Be?(X=O?(0,g.jsx)(`div`,{className:`mt-1 shrink-0 border-t border-edge-subtle pt-1`,children:(0,g.jsxs)(`button`,{type:`button`,className:d(`flex w-full items-center gap-2 rounded-md p-2 text-left text-sm font-medium text-accent`,ue.transition,`hover:bg-surface-hover focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40`),onClick:()=>{O.path===`/settings/capabilities/models`?le(x.pathname.startsWith(`/automations`)?`background`:`chat`,`services`,x.pathname.startsWith(`/automations`)?`automation`:void 0):Be(O.path,{state:{settingsBackPath:`${x.pathname}${x.search}`}}),w(!1),E(``)},children:[(0,g.jsx)(ie,{className:`size-4 shrink-0 opacity-90`,"aria-hidden":!0}),(0,g.jsx)(`span`,{className:`min-w-0`,children:O.label})]})}):null,t[79]=O,t[80]=x,t[81]=Be,t[82]=X):X=t[82];let Z;t[83]!==ze||t[84]!==Re||t[85]!==ut.Content||t[86]!==dt||t[87]!==H||t[88]!==Y||t[89]!==X?(Z=(0,g.jsxs)(ut.Content,{className:dt,side:Re,sideOffset:4,align:ze,collisionPadding:8,onOpenAutoFocus:ve,children:[H,Y,X]}),t[83]=ze,t[84]=Re,t[85]=ut.Content,t[86]=dt,t[87]=H,t[88]=Y,t[89]=X,t[90]=Z):Z=t[90];let Q;t[91]!==ct.Portal||t[92]!==lt||t[93]!==Z?(Q=(0,g.jsx)(ct.Portal,{container:lt,children:Z}),t[91]=ct.Portal,t[92]=lt,t[93]=Z,t[94]=Q):Q=t[94];let $;return t[95]!==He||t[96]!==rt.Root||t[97]!==V||t[98]!==Q?($=(0,g.jsxs)(rt.Root,{open:He,onOpenChange:w,children:[V,Q]}),t[95]=He,t[96]=rt.Root,t[97]=V,t[98]=Q,t[99]=$):$=t[99],$}function ve(e){return e.preventDefault()}function ye(e){return e.language}function be({models:e,value:t,onChange:n,searchPlaceholder:r,noMatches:i,disabled:a,showSearch:o=e.length>10,outOfFilterNote:ne,groupByProvider:s=!1}){let c=ee(e=>e.language),[l,re]=(0,h.useState)(``),ie=_e(e,o?l:``),ae=(0,h.useRef)(null);(0,h.useLayoutEffect)(()=>{l||ae.current?.scrollIntoView?.({block:`nearest`})},[t,l,ie.some(e=>e.id===t)]);let f=new Map;for(let t of e){let e=s?t.provider:``;f.has(e)||f.set(e,[])}for(let e of ie)f.get(s?e.provider:``).push(e);return(0,g.jsxs)(`div`,{className:`flex min-h-0 flex-1 flex-col`,children:[o&&(0,g.jsx)(`input`,{type:`search`,"aria-label":r,placeholder:r,value:l,onChange:e=>re(e.target.value),className:d(`mx-1 mb-2 rounded-lg border border-edge bg-surface-base px-3 py-2 text-sm text-fg`,`focus:outline-none focus-visible:outline-none focus-visible:ring-0 focus-visible:ring-offset-0 focus-visible:shadow-none focus-visible:border-edge`)}),(0,g.jsxs)(`div`,{"data-select-scroll-region":!0,className:d(u,s&&`scroll-pt-8`),children:[ie.length===0&&(0,g.jsx)(`p`,{className:`px-3 py-4 text-sm text-fg-muted`,children:i}),[...f].filter(([,e])=>e.length>0).map(([r,i])=>(0,g.jsxs)(`div`,{role:s?`group`:void 0,"aria-label":s?r:void 0,className:s?`border-t border-edge-subtle pb-1 first:border-t-0`:void 0,children:[s&&(0,g.jsx)(`p`,{className:`sticky top-0 z-10 bg-surface-overlay px-3 pb-1 pt-3 text-xs font-medium text-fg-muted`,children:r}),i.sort(p).map(r=>(0,g.jsxs)(`button`,{type:`button`,disabled:a,title:r.id,ref:r.id===t?ae:void 0,"aria-pressed":r.id===t,style:e.length>50?{contentVisibility:`auto`,containIntrinsicSize:`auto 60px`}:void 0,className:d(`flex min-h-11 w-full items-center gap-3 rounded-lg px-3 py-2 text-left text-sm text-fg hover:bg-surface-hover disabled:opacity-50`,ue.focusRingPanel,r.id===t&&`bg-surface-hover`),onClick:()=>n(r.id),children:[(0,g.jsxs)(`span`,{className:`min-w-0 flex-1`,children:[(0,g.jsxs)(`span`,{className:`flex items-center gap-2`,children:[(0,g.jsx)(`span`,{className:`truncate font-medium`,children:m(r,c)}),(r.phoneUse&&r.phoneUse.dedicated!==!1||r.computerUse?.dedicated||r.reasoning)&&(0,g.jsx)(`span`,{className:`shrink-0 text-xs text-fg-muted`,children:r.phoneUse&&r.phoneUse.dedicated!==!1?c===`zh`?`手机控制`:`Phone control`:r.computerUse?.dedicated?c===`zh`?`电脑控制`:`Computer control`:c===`zh`?`推理`:`Reasoning`})]}),!s&&(0,g.jsx)(`span`,{className:`block truncate text-xs text-fg-muted`,children:r.provider}),ne&&!r.vision&&r.id===t&&(0,g.jsx)(`span`,{className:`block text-xs text-fg-muted`,children:ne})]}),(0,g.jsx)(te,{className:d(`size-4 shrink-0 text-accent-fg`,r.id!==t&&`invisible`),"aria-hidden":!0})]},r.id))]},r))]})]})}export{v as n,m as r,be as t};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{i as e}from"./locale-store-
|
|
1
|
+
import{i as e}from"./locale-store-BY-fRY-q.js";import{o as t}from"./vendor-swr-CdRzEUwF.js";import{n}from"./gateway-config-swr-Db2fE-gT.js";import{r}from"./registry-api-BnEoY6_B.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),t(`settings-agent-defaults`),t(`model-capability-media-sources`),t(`native-voice-connections`),t(`voice-dictation-route`),t(e=>Array.isArray(e)&&[`model-use-choices`,`native-voice-connections`,`capability-service-connections`].includes(e[0])),r()])}export{s as i,i as n,a as r,o as t};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
var e={settingsImports:`imports`,settingsOverview:`overview`,settingsAppearance:`appearance`,settingsKeyboardShortcuts:`keyboard-shortcuts`,settingsPersonal:`personal`,settingsSystem:`system`,settingsDesktopPet:`desktop-pet`,settingsDesktopApp:`desktop-app`,settingsAgentDefaults:`agent-defaults`,settingsGateway:`gateway`,settingsRuntimes:`runtimes`,settingsDevices:`devices`,settingsTunnel:`remote-access`,settingsShares:`shares`};function t(t){return e[t]??null}var n=new Set([`settingsDesktopPet`,`settingsDesktopApp`]),r=[{id:`general`,tabs:[`settingsOverview`,`settingsAppearance`,`settingsKeyboardShortcuts`,`settingsSystem`,`settingsDesktopPet`]},{id:`capabilities`,tabs:[`settingsPersonal`,`settingsModels`,`settingsSearch`,`settingsAgentDefaults`]},{id:`connection`,tabs:[`settingsGateway`,`settingsDevices`,`settingsAgentBrowser`,`settingsComputerUse`,`settingsPhoneUse`,`settingsTunnel`]},{id:`data`,tabs:[`settingsImports`,`sessions`,`usage`,`settingsShares`,`settingsDesktopApp`]},{id:`diagnostics`,tabs:[`settingsRuntimes`,`tracing`,`logs`]}],i=`https://xopcai.github.io/xopc`;function a(e){return e===`zh`?`${i}/zh/`:`${i}/`}function o(e,t){let n=t.replace(/^\/+/,``).replace(/\.md$/,``);return e===`zh`?`${i}/zh/${n}`:`${i}/${n}`}function s(e,t){let n=o(e,`remote-access`);return t?`${n}#${t}`:n}function c(e){if(e===`settingsKeyboardShortcuts`)return`/settings/keyboard-shortcuts`;if(e===`settingsAgentBrowser`)return`/settings/agent-browser`;if(e===`settingsPhoneUse`)return`/settings/phone-use`;if(e===`settingsComputerUse`)return`/settings/computer-use`;if(e===`settingsModels`)return l(`models`);if(e===`settingsSearch`)return l(`search`);let n=t(e);return n?`/settings/${n}`:e===`sessions`||e===`usage`||e===`tracing`||e===`logs`?`/settings/${e}`:`/${e}`}function l(e){return`/settings/capabilities/${e}`}function u(e,t){return e===`settingsModels`?t===l(`models`):t===c(e)}function d(e,t){return/^https:\/\//i.test(t)?t:/^[a-z][a-z0-9+.-]*:|^\/\//i.test(t)?a(e):o(e,t.replace(/^\/?zh\//,``))}export{o as a,c,d as i,s as l,r as n,a as o,l as r,u as s,n as t};
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/block-editor-BY1Mb-WW.js","assets/rolldown-runtime-aKtaBQYM.js","assets/vendor-react-BOUWij0V.js","assets/locale-store-BY-fRY-q.js","assets/messages-DFCLetQl.js","assets/unlink-BEuthaaq.js","assets/createLucideIcon-DPHK1VkS.js","assets/check-DUBLcKHA.js","assets/copy-Dv6d4Dvw.js","assets/external-link-DjqjBmc3.js","assets/notes-api-32qiHxz2.js","assets/dist-BGTk37IG.js","assets/es2015-DBLcMg5B.js","assets/dist-CxGUk8J-.js","assets/download-Dk-ZjtO6.js","assets/markdown-view-ClNfoiYC.js","assets/chunk-KS7C4IRE-CiwuuyV8.js","assets/preload-helper-Czpn1I53.js","assets/file-image-CDUPkZvG.js","assets/plus-Q2yW6OE7.js","assets/x-B_N4OPjy.js","assets/cn-0WouolD0.js","assets/bundle-mjs-rHxsej31.js","assets/app-link-CdD448kS.js","assets/product-delivery-DRyD9_Xq.js","assets/schemas-CCWMleym.js","assets/local-apps-Ck6kACsY.js","assets/copy-to-clipboard-HOJ79TWv.js","assets/xml-_d7dTN2Q.js","assets/mermaid-render-oOellPHt.js","assets/markdown-view-DG8DDkEA.css","assets/chat-chart-block-BBchFbUa.js","assets/skeleton-DzdOeGYz.js","assets/list-todo-CTVRto8O.js","assets/loader-circle-CifKLtgG.js","assets/mic-CuUb7zc-.js","assets/pause-DuPxgSxk.js","assets/pencil-DmIY3Oa-.js","assets/play-kxZvpBg8.js","assets/vendor-swr-CdRzEUwF.js","assets/floating-ui.dom-seOukHzT.js","assets/vendor-codemirror-aCQ0FcJT.js","assets/with-selector-xonYxPoM.js","assets/note-image-lightbox-Cw-TaViX.js","assets/block-editor-Cvy3D_4T.css","assets/markdown-editor-CjQJ-Nho.js","assets/languages-kF11aUYU.js","assets/chat-page-C3ttsYGZ.js","assets/app-window-DXFNqt_0.js","assets/archive-Dz0hferG.js","assets/arrow-left-D880xG-P.js","assets/voice-call-context-CJ1ZiJWR.js","assets/arrow-up-D5ZtR1QT.js","assets/product-automation-feedback-CQvcSORB.js","assets/activity-YogQEteU.js","assets/bot-DjLkhyZL.js","assets/circle-check-C23XjkUj.js","assets/circle-pause-CN9jYH2s.js","assets/clock-3-DnrAnuyZ.js","assets/message-square-fVE7Ghj1.js","assets/rotate-ccw-JM1TBLpp.js","assets/rotate-cw-LIg3Am9S.js","assets/sparkles-DHlfQFAF.js","assets/triangle-alert-2JXFNNKU.js","assets/volume-2-BSJhAY97.js","assets/zap-dximCGjy.js","assets/button-Cc4hUNTt.js","assets/automation-api-B3df53ms.js","assets/earth-C9Z4bTTG.js","assets/chevron-down-ccbiQQz_.js","assets/chevron-right-BweFrslA.js","assets/working-directory-picker-modal-5EsBeKBO.js","assets/file-archive-DanfQJNe.js","assets/interaction-BdhHBbYa.js","assets/form-field-width-DJw_jULe.js","assets/settings-form-draft-Dy10ldo8.js","assets/popover-select-CLsphyzA.js","assets/dist-GJ8-1PAx.js","assets/dist-BuHnPloF.js","assets/settings-shell-dialog-layer-BU3UuiJr.js","assets/circle-alert-BEjgurr2.js","assets/new-chat-navigation-B6NPQ4h4.js","assets/circle-x-DFsCKeya.js","assets/circle-BoO4YvTx.js","assets/file-tree-utils-DJs1faGv.js","assets/database-CjjeZfRG.js","assets/ellipsis-0k4rZLoy.js","assets/file-BqMS_3DT.js","assets/file-text-D12HbeVy.js","assets/folder-kanban-CpLlFI1o.js","assets/folder-open-CyzJ19I9.js","assets/folder-CN-pC3XL.js","assets/use-file-preview-expanded-M7LSoDLc.js","assets/eye-CABVeTq0.js","assets/link-2-D_ZKYUW7.js","assets/message-square-plus-XP0tGdlV.js","assets/minimize-2-DtOGrlpo.js","assets/paperclip-f1HujQY1.js","assets/refresh-cw-BRlGaq2w.js","assets/save-DRDABU--.js","assets/search-DA7gz22f.js","assets/constants-CsVXarqA.js","assets/session-api-CgTDekPG.js","assets/gateway-startup-retry-Du7l0oxt.js","assets/attachment-utils-core-BIOUBrpT.js","assets/activity-store-D_KDDoA1.js","assets/app-chrome-BeB4KgOf.js","assets/electron-env-DHOGevH3.js","assets/use-async-resource-BHFGZCY2.js","assets/sliding-tab-list-CmcrqRzN.js","assets/sliding-indicator-hwz0sx3h.js","assets/index.module-Cd9ENXfk.js","assets/workspace-api-BmUCKePi.js","assets/files-BNL4kkSB.js","assets/dist-ZrL34Ps4.js","assets/git-branch-Dh9uxTot.js","assets/globe-DSSGFWFn.js","assets/history-DXH_9jsE.js","assets/key-round-DWbpyU2U.js","assets/laptop-CI3hBVrl.js","assets/list-checks-BbsExAoq.js","assets/messages-square-BckAJrEW.js","assets/monitor-Af5eAvF7.js","assets/install-connector-dialog-Brl22l1N.js","assets/secret-input-Dryrns2s.js","assets/is-masked-secret-DOkL5b_X.js","assets/connectors-api-CqyteNnT.js","assets/gateway-config-swr-Db2fE-gT.js","assets/oauth-provider-connect-XzlLkqnK.js","assets/cloud-C4-yfnnk.js","assets/models-hub-cache-CESzQ_tk.js","assets/registry-api-BnEoY6_B.js","assets/oauth-api-CMpfoRed.js","assets/connection-usage-guide-De6QJt8B.js","assets/connection-usage-BhdQRWgQ.js","assets/settings-2-D-csvaET.js","assets/settings-uiTATseT.js","assets/shield-check-BU58siTV.js","assets/smartphone-DSSsQFqA.js","assets/square-DMK_fB-3.js","assets/trash-2-DusmjVPV.js","assets/share-link-dialog-B1g7Xero.js","assets/copy-text-row-CpiRzq4G.js","assets/wrench-DFb4r8bH.js","assets/tasks-D_xuHn6V.js","assets/specialists-xbB3xL9e.js","assets/api-pQXrYBTk.js","assets/session-manager-V8cj3NVD.js","assets/local-session-drafts-oWhYPECv.js","assets/tool-activity-BtJkgjFf.js","assets/personal-proactivity-DaRnbB1f.js","assets/gateway-realtime-nI6k8qP8.js","assets/gateway-realtime-store-CjYSSi_l.js","assets/agents-admin-api-D0qHxAok.js","assets/new-session-preferences-gb411vZP.js","assets/extension-provider-D5L3t0e3.js","assets/capabilities-Bt1fAcDI.js","assets/theme-store-C57ZxHqm.js","assets/middleware-Pd0e8Igk.js","assets/use-composer-attachments-R6kKpDgc.js","assets/chevron-left-DqFhpbvK.js","assets/capabilities-Bu7efUpH.js","assets/file-preview-surface-Bfqc0ZKv.js","assets/phone-workspace-store-D1BS7otl.js","assets/shares-api-DXOD--vt.js","assets/skill-wire-pattern-BPpeIcCi.js","assets/chat-agents-api-SruH_oEQ.js","assets/composer-payload-handoff-RaEQXTjj.js","assets/voice-transcribe-api-B2NVJYnu.js","assets/open-capability-settings-Cvb65hQB.js","assets/workspace-editor-agent-store-Sy1CLe2K.js","assets/voice-input-shortcut-events-04u9YoRg.js","assets/chunk-D32TOXHM-DQIy-Baq.js","assets/tool-friendly-title-YQmN1S2k.js","assets/page-header-store-BNjlQHqU.js","assets/loopi-CNtmi9FU.js","assets/loopi-C09I2mNj.css","assets/agent-avatar-display-Dm1YHaAt.js","assets/use-directory-picker-C4p7AgWY.js","assets/confirm-dialog-D7dQJytv.js","assets/command-palette-api-r8U5soT7.js","assets/skill-list-api-CJBrtxil.js","assets/skill-api-utils-C7V4JVXM.js","assets/model-selector-DkytsBae.js","assets/model-sort-_Tz8s_4N.js","assets/automation-task-card-C2mxNw5Q.js","assets/calendar-clock-D-quYVPe.js","assets/message-circle-Badhj-4D.js","assets/date-picker-CB6IVCiq.js","assets/calendar-days-hw_Y-g-s.js","assets/dev-view-store-BxPWx1Gi.js","assets/extension-iframe-host-B0rM3Ohp.js","assets/api-uriioEZx.js","assets/runtime-health-D2TDFLLq.js","assets/terminal-panel-store-DBC-pqGy.js","assets/agents-app-path-ciChvpCS.js","assets/agent-display-names-Bje7vfSn.js","assets/use-media-query-ady-FgjK.js","assets/oauth-authorization-window-o6URRos4.js","assets/page-context-draft-CrgFs0h3.js","assets/management-api-BzdYxqsC.js","assets/side-chat-shortcut-BIw-1TTD.js","assets/chat-page-zQeUaawJ.css"])))=>i.map(i=>d[i]);
|
|
2
|
+
import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{a as t,i as n,n as r,t as i}from"./vendor-react-BOUWij0V.js";import{t as a}from"./preload-helper-Czpn1I53.js";import{l as o,t as s,u as c}from"./chunk-KS7C4IRE-CiwuuyV8.js";import{f as l,i as u,l as d,n as f,o as p,p as m}from"./locale-store-BY-fRY-q.js";import{t as h}from"./messages-DFCLetQl.js";import{a as g,c as _,i as v,n as y,o as b,r as x,s as S,t as C}from"./dist-BGTk37IG.js";import{E as w,b as T,d as E,h as D,i as O,n as k,o as A,r as j,t as M,w as N,x as P}from"./discussion-annotation-sync-uvwyXFX3.js";import{t as F}from"./arrow-left-D880xG-P.js";import{a as I,c as L,d as R,i as z,l as B,n as ee,o as te,r as ne,s as re,t as ie,u as ae}from"./product-automation-feedback-CQvcSORB.js";import{t as oe}from"./check-DUBLcKHA.js";import{t as se}from"./chevron-down-ccbiQQz_.js";import{n as ce,r as V}from"./popover-select-CLsphyzA.js";import{t as le}from"./circle-check-C23XjkUj.js";import{t as ue}from"./code-xml-DJtYhZUF.js";import{t as de}from"./copy-Dv6d4Dvw.js";import{t as fe}from"./download-Dk-ZjtO6.js";import{t as pe}from"./ellipsis-0k4rZLoy.js";import{t as me}from"./external-link-DjqjBmc3.js";import{t as H}from"./eye-CABVeTq0.js";import{t as he}from"./file-text-D12HbeVy.js";import{t as U}from"./history-DXH_9jsE.js";import{C as ge,E as _e,F as ve,O as ye,P as be,S as xe,T as Se,_ as Ce,a as we,c as Te,d as Ee,f as De,h as Oe,l as W,m as ke,n as Ae,r as je,s as Me,u as Ne,w as Pe,x as Fe}from"./notes-api-32qiHxz2.js";import{t as Ie}from"./loader-circle-CifKLtgG.js";import{P as Le}from"./markdown-view-ClNfoiYC.js";import{t as Re}from"./message-circle-Badhj-4D.js";import{t as ze}from"./pencil-DmIY3Oa-.js";import{t as Be}from"./play-kxZvpBg8.js";import{t as Ve}from"./refresh-cw-BRlGaq2w.js";import{t as He}from"./search-DA7gz22f.js";import{t as Ue}from"./sliders-horizontal-DqsYor6I.js";import{t as We}from"./sparkles-DHlfQFAF.js";import{t as Ge}from"./square-pen-B8FsvqNu.js";import{t as G}from"./square-DMK_fB-3.js";import{t as Ke}from"./trash-2-DusmjVPV.js";import{t as qe}from"./x-B_N4OPjy.js";import{t as K}from"./cn-0WouolD0.js";import{t as q}from"./skeleton-DzdOeGYz.js";import{t as Je}from"./session-manager-V8cj3NVD.js";import{i as Ye}from"./vendor-swr-CdRzEUwF.js";import{t as J}from"./button-Cc4hUNTt.js";import{t as Xe}from"./copy-to-clipboard-HOJ79TWv.js";import{r as Y}from"./app-chrome-BeB4KgOf.js";import{i as Ze}from"./theme-store-C57ZxHqm.js";import{t as Qe}from"./page-header-store-BNjlQHqU.js";import{t as X}from"./automation-api-B3df53ms.js";import{t as $e}from"./confirm-dialog-D7dQJytv.js";import{b as et,d as tt,o as nt,s as rt,v as it}from"./shares-api-DXOD--vt.js";import{l as at,m as ot,o as st,r as ct,t as lt,u as ut}from"./dist-ZrL34Ps4.js";import{t as Z}from"./oauth-provider-connect-XzlLkqnK.js";import{n as dt,t as ft}from"./page-context-draft-CrgFs0h3.js";import"./note-image-lightbox-Cw-TaViX.js";import{t as pt}from"./page-context-capture-button-CdMxGZaM.js";var Q=e(t(),1),mt=r(),$=i(),ht=6e4,gt=36e5,_t=864e5;function vt(e){let t=new Date(e);return t.setHours(0,0,0,0),t.getTime()}function yt(e,t,n){let r=t-e;if(r<ht)return n.justNow;if(r<gt){let e=Math.floor(r/ht);return n.minutesAgo.replace(`{{n}}`,String(e))}let i=vt(t);if(e>=i)return n.today+` `+new Date(e).toLocaleTimeString(n.locale,{hour:`2-digit`,minute:`2-digit`});if(e>=i-_t)return n.yesterday+` `+new Date(e).toLocaleTimeString(n.locale,{hour:`2-digit`,minute:`2-digit`});if(r<7*_t){let e=Math.floor(r/_t);return n.daysAgo.replace(`{{n}}`,String(e))}return new Date(e).toLocaleDateString(n.locale,{month:`short`,day:`numeric`})}function bt(e,t,n){let r=vt(t);if(e>=r)return n.today;if(e>=r-_t)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 xt(e){let t=new Date(e);return`${t.getFullYear()}-${String(t.getMonth()+1).padStart(2,`0`)}-${String(t.getDate()).padStart(2,`0`)}`}function St(e){let t=(0,mt.c)(45),{title:n,description:r,prompt:i,coverage:a,className:o,variant:s}=e,l=s===void 0?`card`:s,u=f(Tt),d=h(u).automations.suggestions,p=h(u).automations,m=c(),g;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(g={revalidateOnFocus:!1,refreshInterval:15e3},t[0]=g):g=t[0];let{data:_}=Ye(a?`automation-suggestion-coverage`:null,wt,g),v=a?_?.automations.find(e=>z(e,a)):void 0,y=v?ee(v,p):[];if(l===`titleAction`){if(v){let e;t[1]===o?e=t[2]:(e=K(`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`,o),t[1]=o,t[2]=e);let n;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(n=(0,$.jsx)(le,{className:`size-3.5 shrink-0 text-emerald-700 dark:text-emerald-300`,"aria-hidden":!0}),t[3]=n):n=t[3];let r;return t[4]===m?r=t[5]:(r=()=>m(`/automations`),t[4]=m,t[5]=r),(0,$.jsxs)(`section`,{className:e,children:[n,(0,$.jsx)(`span`,{className:`min-w-0 truncate text-xs font-medium text-fg`,children:d.coveredTitle}),(0,$.jsx)(J,{variant:`ghost`,className:`h-7 shrink-0 rounded-md px-2 text-xs`,onClick:r,children:d.manage})]})}let e;t[6]===o?e=t[7]:(e=K(`flex min-w-0 items-center gap-2 rounded-lg bg-surface-panel px-2.5 py-1.5 shadow-surface`,o),t[6]=o,t[7]=e);let a;t[8]===Symbol.for(`react.memo_cache_sentinel`)?(a=(0,$.jsx)(N,{className:`size-3.5 shrink-0 text-accent`,"aria-hidden":!0}),t[8]=a):a=t[8];let s;t[9]!==r||t[10]!==n?(s=(0,$.jsx)(`span`,{className:`min-w-0 truncate text-xs font-medium text-fg`,title:r,children:n}),t[9]=r,t[10]=n,t[11]=s):s=t[11];let c;t[12]!==m||t[13]!==i?(c=()=>{let e=new URLSearchParams({draft:i,autogenerate:`1`});m(`/automations?${e.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,$.jsx)(We,{className:`size-3.5`,"aria-hidden":!0}),t[15]=l):l=t[15],(0,$.jsxs)(`section`,{className:e,children:[a,s,(0,$.jsxs)(J,{variant:`secondary`,className:`h-7 shrink-0 rounded-md px-2 text-xs`,onClick:c,children:[l,d.setup]})]})}if(v){let e;t[16]===o?e=t[17]:(e=K(`rounded-lg border border-emerald-500/25 bg-emerald-500/10 p-3`,o),t[16]=o,t[17]=e);let n;t[18]===Symbol.for(`react.memo_cache_sentinel`)?(n=(0,$.jsx)(le,{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]!==d||t[22]!==r?(i=(0,$.jsx)(`div`,{className:`mt-3 flex justify-end`,children:(0,$.jsx)(J,{variant:`ghost`,className:`h-8 rounded-md px-2.5 text-xs`,onClick:r,children:d.manage})}),t[21]=d,t[22]=r,t[23]=i):i=t[23],(0,$.jsxs)(`section`,{className:e,children:[(0,$.jsxs)(`div`,{className:`flex items-start gap-2`,children:[n,(0,$.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,$.jsx)(`div`,{className:`text-sm font-semibold text-fg`,children:d.coveredTitle}),(0,$.jsx)(`p`,{className:`mt-1 break-words text-xs leading-5 text-fg-muted`,children:ne(d.coveredDescription,{name:v.name})})]})]}),(0,$.jsxs)(`div`,{className:`mt-2 rounded-md bg-surface-base/55 px-2.5 py-2`,children:[(0,$.jsx)(`div`,{className:`text-xs font-medium text-fg`,children:p.explain.whyCovered}),(0,$.jsx)(`div`,{className:`mt-1 flex flex-wrap gap-1.5`,children:y.map(Ct)})]}),i]})}let b;t[24]===o?b=t[25]:(b=K(`rounded-lg bg-surface-panel p-3 shadow-surface`,o),t[24]=o,t[25]=b);let x;t[26]===Symbol.for(`react.memo_cache_sentinel`)?(x=(0,$.jsx)(N,{className:`mt-0.5 size-4 shrink-0 text-accent`,"aria-hidden":!0}),t[26]=x):x=t[26];let S;t[27]===n?S=t[28]:(S=(0,$.jsx)(`div`,{className:`text-sm font-semibold text-fg`,children:n}),t[27]=n,t[28]=S);let C;t[29]===r?C=t[30]:(C=(0,$.jsx)(`p`,{className:`mt-1 break-words text-xs leading-5 text-fg-muted`,children:r}),t[29]=r,t[30]=C);let w;t[31]!==S||t[32]!==C?(w=(0,$.jsxs)(`div`,{className:`flex items-start gap-2`,children:[x,(0,$.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[S,C]})]}),t[31]=S,t[32]=C,t[33]=w):w=t[33];let T;t[34]!==m||t[35]!==i?(T=()=>{let e=new URLSearchParams({draft:i,autogenerate:`1`});m(`/automations?${e.toString()}`)},t[34]=m,t[35]=i,t[36]=T):T=t[36];let E;t[37]===Symbol.for(`react.memo_cache_sentinel`)?(E=(0,$.jsx)(We,{className:`size-3.5`,"aria-hidden":!0}),t[37]=E):E=t[37];let D;t[38]!==d.create||t[39]!==T?(D=(0,$.jsx)(`div`,{className:`mt-3 flex justify-end`,children:(0,$.jsxs)(J,{variant:`secondary`,className:`h-8 rounded-md px-2.5 text-xs`,onClick:T,children:[E,d.create]})}),t[38]=d.create,t[39]=T,t[40]=D):D=t[40];let O;return t[41]!==D||t[42]!==b||t[43]!==w?(O=(0,$.jsxs)(`section`,{className:b,children:[w,D]}),t[41]=D,t[42]=b,t[43]=w,t[44]=O):O=t[44],O}function Ct(e){return(0,$.jsx)(`span`,{className:`rounded-full bg-surface-panel px-2 py-0.5 text-xs text-fg-muted`,children:e},e)}function wt(){return X.list()}function Tt(e){return e.language}var Et=`z-[140] min-w-44 rounded-lg border border-edge bg-surface-overlay p-1 text-sm text-fg shadow-popover`,Dt=`flex min-h-11 cursor-pointer items-center gap-2 rounded-md px-3 outline-none focus:bg-surface-hover data-[disabled]:pointer-events-none data-[disabled]:opacity-40`;function Ot(e){let t=(0,mt.c)(54),{detail:n,zh:r,busy:i,processing:a,pageText:o,editing:s,noteActions:c}=e,l=`/api/discussions/${encodeURIComponent(n.discussion.id)}`,d=!!n.discussion.audioAttachmentId&&!n.discussion.audioDeletedAt,f;t[0]!==n.note.id||t[1]!==c||t[2]!==r?(f=c?(0,$.jsxs)($.Fragment,{children:[(0,$.jsxs)(`button`,{type:`button`,className:`inline-flex min-h-11 items-center justify-center gap-2 rounded-lg px-3 text-sm text-fg-muted hover:bg-surface-hover focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent aria-expanded:bg-accent-soft aria-expanded:text-accent-fg aria-expanded:hover:bg-accent-soft`,"aria-expanded":c.chatOpen??!1,"aria-controls":`note-assistant-${n.note.id}`,disabled:c.busy,onClick:c.onChat,children:[(0,$.jsx)(Re,{className:`size-4`,"aria-hidden":!0}),r?`AI 对话`:`AI chat`]}),(0,$.jsxs)(`button`,{type:`button`,className:`inline-flex min-h-11 items-center justify-center gap-2 rounded-lg px-3 text-sm text-fg-muted hover:bg-surface-hover focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,"aria-label":r?`分享笔记`:`Share note`,disabled:c.busy,onClick:c.onShare,children:[(0,$.jsx)(R,{className:`size-4`,"aria-hidden":!0}),(0,$.jsx)(`span`,{className:`hidden sm:inline`,children:r?`分享`:`Share`})]})]}):null,t[0]=n.note.id,t[1]=c,t[2]=r,t[3]=f):f=t[3];let p=r?`导出笔记`:`Export note`,m;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(m=(0,$.jsx)(fe,{className:`size-4`,"aria-hidden":!0}),t[4]=m):m=t[4];let h=r?`导出`:`Export`,g;t[5]===h?g=t[6]:(g=(0,$.jsx)(`span`,{className:`hidden sm:inline`,children:h}),t[5]=h,t[6]=g);let _;t[7]!==p||t[8]!==g?(_=(0,$.jsx)(ot,{asChild:!0,children:(0,$.jsxs)(`button`,{type:`button`,className:`inline-flex min-h-11 items-center justify-center gap-2 rounded-lg px-3 text-sm text-fg-muted hover:bg-surface-hover focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,"aria-label":p,children:[m,g]})}),t[7]=p,t[8]=g,t[9]=_):_=t[9];let v;t[10]===Symbol.for(`react.memo_cache_sentinel`)?(v=[`md`,`txt`,`srt`],t[10]=v):v=t[10];let y;t[11]!==l||t[12]!==r?(y=v.map(e=>(0,$.jsx)(ct,{asChild:!0,children:(0,$.jsx)(`a`,{className:Dt,href:u(`${l}/export?format=${e}`),download:!0,children:e===`srt`?r?`字幕 · SRT`:`Subtitles · SRT`:e===`md`?`Markdown · MD`:r?`纯文本 · TXT`:`Plain text · TXT`})},e)),t[11]=l,t[12]=r,t[13]=y):y=t[13];let b;t[14]!==d||t[15]!==l||t[16]!==r?(b=d?(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(ut,{className:`my-1 h-px bg-edge-subtle`}),(0,$.jsx)(ct,{asChild:!0,children:(0,$.jsxs)(`a`,{className:Dt,href:u(`${l}/audio`),download:!0,children:[(0,$.jsx)(fe,{className:`size-4`,"aria-hidden":!0}),r?`下载录音`:`Download recording`]})})]}):null,t[14]=d,t[15]=l,t[16]=r,t[17]=b):b=t[17];let x;t[18]!==y||t[19]!==b?(x=(0,$.jsx)(st,{children:(0,$.jsxs)(lt,{align:`end`,sideOffset:6,collisionPadding:12,className:Et,children:[y,b]})}),t[18]=y,t[19]=b,t[20]=x):x=t[20];let S;t[21]!==x||t[22]!==_?(S=(0,$.jsxs)(at,{children:[_,x]}),t[21]=x,t[22]=_,t[23]=S):S=t[23];let C=r?`更多笔记操作`:`More note actions`,w;t[24]===Symbol.for(`react.memo_cache_sentinel`)?(w=(0,$.jsx)(pe,{className:`size-5`,"aria-hidden":!0}),t[24]=w):w=t[24];let T;t[25]===C?T=t[26]:(T=(0,$.jsx)(ot,{asChild:!0,children:(0,$.jsx)(`button`,{type:`button`,"aria-label":C,className:`inline-flex min-h-11 items-center justify-center gap-2 rounded-lg px-3 text-sm text-fg-muted hover:bg-surface-hover focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,children:w})}),t[25]=C,t[26]=T);let E;t[27]!==c||t[28]!==r?(E=c?(0,$.jsxs)($.Fragment,{children:[(0,$.jsxs)(ct,{className:Dt,disabled:c.busy,onSelect:c.onAnalyze,children:[(0,$.jsx)(We,{className:`size-4`,"aria-hidden":!0}),r?`进一步分析`:`Analyze this note`]}),(0,$.jsxs)(ct,{className:Dt,onSelect:c.onHistory,children:[(0,$.jsx)(U,{className:`size-4`,"aria-hidden":!0}),r?`版本历史`:`Version history`]})]}):null,t[27]=c,t[28]=r,t[29]=E):E=t[29];let D=n.note.id,O=String(n.note.remoteVersion??1),k;t[30]!==n.note.id||t[31]!==O?(k={kind:`note`,id:D,revision:O},t[30]=n.note.id,t[31]=O,t[32]=k):k=t[32];let A;t[33]===o?A=t[34]:(A={text:o,draft:!1},t[33]=o,t[34]=A);let j=r?`带到新对话`:`Use in a new chat`,M=i||a||s||!o||o.length>16e3,N;t[35]!==k||t[36]!==A||t[37]!==j||t[38]!==M?(N=(0,$.jsx)(`div`,{children:(0,$.jsx)(pt,{presentation:`menu`,resource:k,selection:A,label:j,disabled:M})}),t[35]=k,t[36]=A,t[37]=j,t[38]=M,t[39]=N):N=t[39];let P;t[40]!==c||t[41]!==r?(P=c?(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(ut,{className:`my-1 h-px bg-edge-subtle`}),(0,$.jsxs)(ct,{className:`${Dt} text-danger`,disabled:c.busy,onSelect:c.onDelete,children:[(0,$.jsx)(Ke,{className:`size-4`,"aria-hidden":!0}),r?`删除笔记`:`Delete note`]})]}):null,t[40]=c,t[41]=r,t[42]=P):P=t[42];let F;t[43]!==E||t[44]!==N||t[45]!==P?(F=(0,$.jsx)(st,{children:(0,$.jsxs)(lt,{align:`end`,sideOffset:6,collisionPadding:12,className:Et,children:[E,N,P]})}),t[43]=E,t[44]=N,t[45]=P,t[46]=F):F=t[46];let I;t[47]!==T||t[48]!==F?(I=(0,$.jsxs)(at,{children:[T,F]}),t[47]=T,t[48]=F,t[49]=I):I=t[49];let L;return t[50]!==f||t[51]!==S||t[52]!==I?(L=(0,$.jsxs)(`div`,{className:`flex flex-wrap items-center gap-1`,children:[f,S,I]}),t[50]=f,t[51]=S,t[52]=I,t[53]=L):L=t[53],L}function kt(e){let t=(0,mt.c)(68),{detail:n,template:r,onTemplate:i,zh:a,busy:o,processing:s,onOrganize:c,onRegenerate:l}=e,[u,d]=(0,Q.useState)(!1),f=!!n.discussion.audioAttachmentId&&!n.discussion.audioDeletedAt,p;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(p=(0,$.jsx)(Ue,{className:`size-3.5`,"aria-hidden":!0}),t[0]=p):p=t[0];let m=a?`整理方式`:`Summary settings`,h;t[1]===m?h=t[2]:(h=(0,$.jsx)(_,{asChild:!0,children:(0,$.jsxs)(`button`,{type:`button`,className:`inline-flex min-h-11 items-center gap-2 rounded-lg px-2 text-xs text-fg-muted hover:bg-surface-hover focus-visible:ring-2 focus-visible:ring-accent`,children:[p,m]})}),t[1]=m,t[2]=h);let w;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(w=(0,$.jsx)(g,{className:`fixed inset-0 z-[150] bg-scrim`}),t[3]=w):w=t[3];let T=a?`整理方式`:`Summary settings`,E;t[4]===T?E=t[5]:(E=(0,$.jsx)(S,{className:`font-medium`,children:T}),t[4]=T,t[5]=E);let D=a?`关闭整理设置`:`Close summary settings`,O;t[6]===Symbol.for(`react.memo_cache_sentinel`)?(O=(0,$.jsx)(qe,{className:`size-4`}),t[6]=O):O=t[6];let k;t[7]===D?k=t[8]:(k=(0,$.jsx)(y,{className:`inline-flex size-11 items-center justify-center rounded-lg hover:bg-surface-hover`,"aria-label":D,children:O}),t[7]=D,t[8]=k);let A;t[9]!==E||t[10]!==k?(A=(0,$.jsxs)(`header`,{className:`flex shrink-0 items-center justify-between border-b border-edge-subtle px-5 py-3`,children:[E,k]}),t[9]=E,t[10]=k,t[11]=A):A=t[11];let j=a?`根据已有原文重新整理纪要。你已手动编辑的内容会保留。`:`Reorganize the existing transcript. Your manual edits are preserved.`,M;t[12]===j?M=t[13]:(M=(0,$.jsx)(v,{className:`text-sm leading-6 text-fg-muted`,children:j}),t[12]=j,t[13]=M);let N=a?`纪要模板`:`Summary template`,P;t[14]===N?P=t[15]:(P=(0,$.jsx)(`span`,{children:N}),t[14]=N,t[15]=P);let F=a?`纪要模板`:`Summary template`,I;t[16]===i?I=t[17]:(I=e=>i(e.target.value),t[16]=i,t[17]=I);let L=a?`通用会议`:`General`,R;t[18]===L?R=t[19]:(R=(0,$.jsx)(V,{value:`general`,children:L}),t[18]=L,t[19]=R);let z=a?`项目例会`:`Project`,B;t[20]===z?B=t[21]:(B=(0,$.jsx)(V,{value:`project`,children:z}),t[20]=z,t[21]=B);let ee=a?`需求评审`:`Review`,te;t[22]===ee?te=t[23]:(te=(0,$.jsx)(V,{value:`review`,children:ee}),t[22]=ee,t[23]=te);let ne=a?`客户访谈`:`Interview`,re;t[24]===ne?re=t[25]:(re=(0,$.jsx)(V,{value:`interview`,children:ne}),t[24]=ne,t[25]=re);let ie;t[26]!==F||t[27]!==I||t[28]!==R||t[29]!==B||t[30]!==te||t[31]!==re||t[32]!==r?(ie=(0,$.jsxs)(ce,{value:r,"aria-label":F,onChange:I,children:[R,B,te,re]}),t[26]=F,t[27]=I,t[28]=R,t[29]=B,t[30]=te,t[31]=re,t[32]=r,t[33]=ie):ie=t[33];let ae;t[34]!==P||t[35]!==ie?(ae=(0,$.jsxs)(`label`,{className:`block space-y-2 text-sm`,children:[P,ie]}),t[34]=P,t[35]=ie,t[36]=ae):ae=t[36];let oe;t[37]!==f||t[38]!==o||t[39]!==n.discussion.status||t[40]!==l||t[41]!==s||t[42]!==a?(oe=f&&[`completed`,`needs_attention`].includes(n.discussion.status)?(0,$.jsxs)(`details`,{className:`border-t border-edge-subtle pt-3`,children:[(0,$.jsx)(`summary`,{className:`min-h-11 cursor-pointer text-sm text-fg-muted`,children:a?`高级选项:重新识别录音`:`Advanced: transcribe again`}),(0,$.jsx)(`p`,{className:`mb-3 text-xs leading-5 text-fg-muted`,children:a?`重新处理原音,可能耗时较长。适用于原文缺失或识别不完整。`:`Process the original recording again when text is missing or incomplete. This may take longer.`}),(0,$.jsx)(J,{disabled:o||s,onClick:()=>{d(!1),l()},children:a?`从原音重新生成`:`Regenerate from audio`})]}):null,t[37]=f,t[38]=o,t[39]=n.discussion.status,t[40]=l,t[41]=s,t[42]=a,t[43]=oe):oe=t[43];let se;t[44]!==M||t[45]!==ae||t[46]!==oe?(se=(0,$.jsxs)(`div`,{className:`min-h-0 flex-1 space-y-5 overflow-y-auto p-5`,children:[M,ae,oe]}),t[44]=M,t[45]=ae,t[46]=oe,t[47]=se):se=t[47];let le=a?`取消`:`Cancel`,ue;t[48]===le?ue=t[49]:(ue=(0,$.jsx)(y,{asChild:!0,children:(0,$.jsx)(J,{children:le})}),t[48]=le,t[49]=ue);let de=o||s||!n.discussion.canonicalTranscript,fe;t[50]===c?fe=t[51]:(fe=()=>{d(!1),c()},t[50]=c,t[51]=fe);let pe;t[52]===Symbol.for(`react.memo_cache_sentinel`)?(pe=(0,$.jsx)(Ve,{className:`size-4`,"aria-hidden":!0}),t[52]=pe):pe=t[52];let me=a?`重新整理纪要`:`Regenerate summary`,H;t[53]!==de||t[54]!==fe||t[55]!==me?(H=(0,$.jsxs)(J,{variant:`primary`,disabled:de,onClick:fe,children:[pe,me]}),t[53]=de,t[54]=fe,t[55]=me,t[56]=H):H=t[56];let he;t[57]!==ue||t[58]!==H?(he=(0,$.jsxs)(`footer`,{className:`flex shrink-0 justify-end gap-2 border-t border-edge-subtle p-4`,children:[ue,H]}),t[57]=ue,t[58]=H,t[59]=he):he=t[59];let U;t[60]!==A||t[61]!==se||t[62]!==he?(U=(0,$.jsxs)(b,{children:[w,(0,$.jsxs)(x,{className:`fixed left-1/2 top-1/2 z-[151] flex h-[min(28rem,90dvh)] w-[min(30rem,calc(100vw-2rem))] -translate-x-1/2 -translate-y-1/2 flex-col overflow-hidden rounded-xl border border-edge bg-surface-overlay text-fg`,children:[A,se,he]})]}),t[60]=A,t[61]=se,t[62]=he,t[63]=U):U=t[63];let ge;return t[64]!==u||t[65]!==h||t[66]!==U?(ge=(0,$.jsxs)(C,{open:u,onOpenChange:d,children:[h,U]}),t[64]=u,t[65]=h,t[66]=U,t[67]=ge):ge=t[67],ge}function At(e){return JSON.stringify([e.transcript.revision,e.transcript.segments.map(e=>[e.sequence,e.revision,e.status]),e.organization?.revision])}function jt(e,t){let n=(0,mt.c)(21),[r,i]=(0,Q.useState)(),a;n[0]!==t||n[1]!==e||n[2]!==r?.noteId?(a=()=>{t&&r?.noteId!==e&&i({noteId:e,version:At(t),value:t})},n[0]=t,n[1]=e,n[2]=r?.noteId,n[3]=a):a=n[3];let o=r?.noteId,s;n[4]!==t||n[5]!==e||n[6]!==o?(s=[e,t,o],n[4]=t,n[5]=e,n[6]=o,n[7]=s):s=n[7],(0,Q.useEffect)(a,s);let c;n[8]!==t||n[9]!==e?(c=n=>{let r=n===void 0?t:n;r&&i({noteId:e,version:At(r),value:r})},n[8]=t,n[9]=e,n[10]=c):c=n[10];let l=c,u=r?.noteId===e?r:void 0,d;n[11]!==u||n[12]!==t?(d=!!t&&!!u&&u.version!==At(t),n[11]=u,n[12]=t,n[13]=d):d=n[13];let f=d,p;n[14]!==u||n[15]!==t?(p=t&&u?{...t,transcript:u.value.transcript,organization:u.value.organization}:t,n[14]=u,n[15]=t,n[16]=p):p=n[16];let m=p,h;return n[17]!==m||n[18]!==f||n[19]!==l?(h={detail:m,hasUpdates:f,publish:l},n[17]=m,n[18]=f,n[19]=l,n[20]=h):h=n[20],h}var Mt=e=>`${Math.floor(e/6e4)}:${String(Math.floor(e/1e3)%60).padStart(2,`0`)}`;function Nt({id:e,query:t,zh:n,refreshKey:r,sourceKey:i,active:a,tab:o,onEvidence:s,onPlay:c}){let[l,d]=(0,Q.useState)(),[f,m]=(0,Q.useState)(),h=(0,Q.useRef)(null),g=(0,Q.useRef)(!1),[_,v]=(0,Q.useState)(!0),[y,b]=(0,Q.useState)(``),[x,S]=(0,Q.useState)(!1),C=(0,Q.useRef)(0),[w,T]=(0,Q.useState)(),[E,D]=(0,Q.useState)(),[O,k]=(0,Q.useState)(``),[A,j]=(0,Q.useState)(0),M=JSON.stringify([e,i,t]),N=t?``:r;(0,Q.useEffect)(()=>{if(!a||t)return;let e=window.setInterval(()=>j(e=>e+1),3e3);return()=>window.clearInterval(e)},[a,t]),(0,Q.useEffect)(()=>{D(void 0)},[e,t]),(0,Q.useEffect)(()=>{let n=++C.current,r=new AbortController;v(!0),S(!1),b(``);let i=g.current;g.current=!1;let a=window.setTimeout(()=>{p(u(`/api/discussions/${encodeURIComponent(e)}/review?q=${encodeURIComponent(t)}`),{signal:r.signal}).then(e=>{if(C.current!==n)return;let r=h.current;if(!i&&r?.key===M){r.value.version!==e.version&&m(e);return}h.current={key:M,value:e},d(e),m(void 0),T(M),k(t)}).catch(e=>{C.current===n&&!r.signal.aborted&&b(String(e))}).finally(()=>{C.current===n&&v(!1)})},t?200:0);return()=>{C.current++,r.abort(),window.clearTimeout(a)}},[e,t,N,i,M,A]);function P(){g.current=!0,j(e=>e+1)}async function F(){if(!l||x)return;let r=C.current;S(!0);try{let n=await p(u(`/api/discussions/${encodeURIComponent(e)}/review?q=${encodeURIComponent(t)}&offset=${l.hits.length}&version=${l.version}`));if(r===C.current){let e={...n,hits:[...l.hits,...n.hits]};h.current={key:M,value:e},d(e)}}catch(e){r===C.current&&b(n?`内容已变化,请重新搜索。${String(e)}`:`Content changed; search again. ${String(e)}`)}finally{r===C.current&&S(!1)}}function I(e){D(e),(!e.provisional||e.kind===`chapter`)&&e.transcriptRevision!==void 0&&e.segments.length&&s({transcriptRevision:e.transcriptRevision,stale:e.stale,audioAvailable:l?.coverage.audioAvailable??!1,timingVerified:e.segments.some(e=>e.playback.length>0),segments:e.segments})}let L=e=>e.kind===`chapter`?n?`章节`:`Chapter`:e.kind===`annotation`?n?`我的标记`:`My mark`:e.kind===`analysis`?n?`分析`:`Analysis`:n?`原文`:`Transcript`,R=e=>(0,$.jsxs)(`article`,{className:`space-y-2 rounded-xl bg-surface-inset p-4`,children:[(0,$.jsxs)(`button`,{className:`text-left text-sm text-accent-fg`,onClick:()=>I(e),children:[e.startedAtMs===void 0?``:`${Mt(e.startedAtMs)}${e.endedAtMs===void 0?``:`–${Mt(e.endedAtMs)}`} · `,e.title||L(e)]}),(0,$.jsx)(`p`,{className:`whitespace-pre-wrap text-sm`,children:e.kind===`chapter`&&!t&&e.text.length>300?`${e.text.slice(0,300)}…`:e.text}),(0,$.jsxs)(`p`,{className:`text-xs text-fg-muted`,children:[L(e),e.provisional?n?` · 阶段性结果`:` · Partial result`:``,e.stale?n?` · 原文已更新,保留旧版依据`:` · Earlier transcript revision`:``,e.kind===`chapter`?` · ${e.highlightCount??0} ${n?`个重点`:`marks`} · ${e.actionCount??0} ${n?`个候选行动`:`candidate actions`}`:``]}),e.kind!==`chapter`||t||E?.id===e.id?e.segments.map(e=>(0,$.jsxs)(`p`,{className:`text-xs text-fg-muted`,children:[Mt(e.startedAtMs),` · `,e.text.length>500?`${e.text.slice(0,500)}…`:e.text]},`${e.sequence}:${e.startedAtMs}`)):null,e.playback.slice(0,3).map((e,t)=>(0,$.jsxs)(J,{onClick:()=>c(e.startedAtMs,e.endedAtMs),children:[n?`回听上下文`:`Play context`,` `,Mt(e.startedAtMs),`–`,Mt(e.endedAtMs)]},t)),e.segments.length?(0,$.jsx)(J,{onClick:()=>I(e),children:n?`查看对应原文`:`View transcript`}):(0,$.jsx)(`p`,{className:`text-xs text-fg-muted`,children:n?`暂无可核实的原文定位`:`No verified transcript reference`})]},e.id);return(0,$.jsxs)(`section`,{"aria-label":n?`长录音回顾`:`Recording review`,className:`flex flex-col gap-3`,children:[y?(0,$.jsxs)(`div`,{children:[(0,$.jsx)(`p`,{role:`alert`,className:`text-sm text-danger`,children:y}),(0,$.jsx)(J,{onClick:P,children:n?`刷新结果`:`Refresh results`})]}):null,_&&(!l||w!==M||O!==t)?(0,$.jsx)(q,{className:`h-20 w-full`}):null,l&&w===M&&(!t||O===t)?(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(`div`,{className:`sticky top-0 z-10 h-0`,children:f?(0,$.jsxs)(`div`,{className:`flex items-center justify-between gap-3 rounded-lg border border-edge-subtle bg-surface-overlay px-3 py-2 text-xs text-fg-muted shadow-popover`,children:[(0,$.jsx)(`span`,{role:`status`,children:n?`内容已更新,当前阅读位置已保留`:`Updates available. Your reading position is preserved.`}),(0,$.jsx)(J,{variant:`ghost`,onClick:()=>{h.current={key:M,value:f},d(f),m(void 0)},children:n?`查看最新`:`View latest`})]}):null}),t?(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(`h3`,{className:`text-sm font-medium`,children:n?`搜索结果 · ${l.total}`:`Search results · ${l.total}`}),(0,$.jsx)(J,{onClick:P,children:n?`刷新结果`:`Refresh results`}),(0,$.jsx)(`div`,{"aria-label":n?`命中位置`:`Match positions`,className:`relative my-3 h-5 rounded bg-surface-inset`,children:l.hits.filter(e=>e.startedAtMs!==void 0).map(e=>(0,$.jsx)(`button`,{className:`absolute top-0 h-5 w-1.5 rounded bg-accent`,style:{left:`${Math.min(99,100*e.startedAtMs/Math.max(1,l.coverage.durationMs))}%`},"aria-label":`${Mt(e.startedAtMs)} ${e.title||L(e)}`,onClick:()=>I(e)},e.id))}),l.total?null:(0,$.jsx)(`p`,{className:`text-sm text-fg-muted`,children:n?`未找到关键词;尚未转写的内容无法搜索。`:`No matches. Untranscribed audio is not searchable yet.`}),l.hits.map(R)]}):(0,$.jsxs)($.Fragment,{children:[o===`summary`&&l.chapters.length?(0,$.jsxs)(`details`,{className:`rounded-xl bg-surface-inset px-4`,children:[(0,$.jsxs)(`summary`,{className:`min-h-11 cursor-pointer py-3 text-sm font-medium focus-visible:ring-2 focus-visible:ring-accent`,children:[n?`章节目录`:`Chapters`,` · `,l.chapters.length]}),(0,$.jsx)(`div`,{className:`space-y-3 pb-4`,children:l.chapters.map(R)})]}):null,l.hits.length?(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(`h3`,{className:`text-sm font-medium`,children:n?`本轮已完成转写(阶段性)`:`Available transcription from this run`}),l.hits.map(R)]}):null]}),l.hasMore?(0,$.jsx)(J,{disabled:x,onClick:()=>void F(),children:n?`加载更多结果`:`More results`}):null,(0,$.jsxs)(`details`,{className:`rounded-lg text-xs text-fg-muted`,children:[(0,$.jsx)(`summary`,{className:`min-h-11 cursor-pointer py-3 focus-visible:ring-2 focus-visible:ring-accent`,children:n?`处理范围`:`Processing coverage`}),(0,$.jsxs)(`div`,{role:`status`,className:`space-y-2 pb-3 leading-5`,children:[(0,$.jsxs)(`p`,{children:[n?`原音`:`Audio`,` · `,l.coverage.audioAvailable?n?`已保存,可回听`:`Saved, ready to play`:n?`尚不可用`:`Unavailable`]}),(0,$.jsxs)(`p`,{children:[n?`本轮转写已处理`:`Processed this run`,` `,Mt(l.coverage.processedMs),` / `,Mt(l.coverage.durationMs),` · `,n?`连续处理至`:`Continuous through`,` `,Mt(l.coverage.continuousThroughMs)]}),(0,$.jsxs)(`p`,{children:[n?`分析覆盖`:`Analysis coverage`,` · `,l.coverage.analysisRanges.length?l.coverage.analysisRanges.map(e=>`${Mt(e.startedAtMs)}–${Mt(e.endedAtMs)}`).join(`、`):n?`暂无本版已完成章节`:`No completed chapters for this revision`,l.coverage.analysisStale?n?`;已发布分析基于旧版原文`:`; published analysis uses an earlier transcript`:``,` · `,l.coverage.complete?n?`本轮处理完成`:`Run complete`:n?`阶段性内容,其余仍待处理`:`Partial content; remaining work pending`]})]})]}),E?.provisional?(0,$.jsx)(`p`,{className:`text-xs text-fg-muted`,children:n?`以上是本轮已保存的阶段性原文;正式发布后才能校对和标记具体段落。`:`Saved partial text; segment editing and highlighting become available after publication.`}):null]}):null]})}function Pt({recordingId:e,discussionId:t,zh:n,onEvidence:r,onPlay:i}){let{data:a=[],mutate:o}=Ye(`/api/discussions/${t}/annotations`,e=>p(u(e))),[s,c]=(0,Q.useState)([]),[l,d]=(0,Q.useState)(null),[f,m]=(0,Q.useState)(null),[h,g]=(0,Q.useState)(``),_=(0,Q.useCallback)(async()=>{c(await j(e))},[e]),v=(0,Q.useCallback)(async()=>{try{await M(e,t),await _(),await o()}catch(e){await o(),g(e instanceof Error?e.message:String(e))}},[e,t,_,o]);(0,Q.useEffect)(()=>{_().catch(e=>g(String(e))),v();let e=()=>{_().catch(e=>g(String(e)))};window.addEventListener(`discussion-annotations-changed`,e),window.addEventListener(`online`,v);let t=window.setInterval(()=>{navigator.onLine&&v()},15e3);return()=>{window.removeEventListener(`discussion-annotations-changed`,e),window.removeEventListener(`online`,v),window.clearInterval(t)}},[_,v]);let y=new Map(a.map(e=>[e.annotation.id,{...e,localState:`synced`}]));for(let e of s)if(e.state!==`synced`||!y.has(e.annotation.id)){let t=y.get(e.annotation.id);y.set(e.annotation.id,{annotation:e.annotation,state:t?.state??`pending`,playback:t?.playback??[],evidence:t?.evidence,localState:e.state})}let b=async(t,n=s.find(e=>e.annotation.id===t.id)?.nonce??null)=>{try{await A(e,{...t,updatedAt:Date.now()},n),m(null),g(``),await _(),v()}catch(e){g(e instanceof Error?e.message:String(e))}};return(0,$.jsxs)(`section`,{className:`space-y-4`,"aria-label":n?`我的标记`:`My highlights`,children:[h?(0,$.jsxs)(`p`,{role:`alert`,className:`text-sm text-danger`,children:[h,(0,$.jsx)(J,{onClick:()=>void v(),children:n?`重试同步`:`Retry sync`})]}):null,y.size?null:(0,$.jsx)(`p`,{className:`text-sm text-fg-muted`,children:n?`录音时标重点,或在原文中标记整段。标记先保存在本机。`:`Highlight while recording or mark a transcript segment. Highlights save locally first.`}),[...y.values()].sort((e,t)=>e.annotation.anchor.capturedAt-t.annotation.anchor.capturedAt).filter(e=>!e.annotation.deleted||e.localState===`conflict`).map(e=>(0,$.jsxs)(`article`,{className:`space-y-2 rounded-lg border border-edge p-3`,children:[(0,$.jsxs)(`p`,{className:`text-xs text-fg-muted`,children:[e.annotation.kind===`highlight`?n?`重点`:`Highlight`:e.annotation.kind===`question`?n?`问题`:`Question`:n?`我的补充`:`My note`,` · `,new Date(e.annotation.anchor.capturedAt).toLocaleString(),` · `,e.localState===`synced`?n?`已同步`:`Synced`:e.localState===`conflict`?n?`同步冲突,保留了本机修改`:`Conflict; local edits retained`:n?`本机已保存,待同步`:`Saved locally; sync pending`]}),e.evidence?.segments.map(e=>(0,$.jsx)(`blockquote`,{className:`text-sm`,children:e.text},e.sequence)),e.positionMs===void 0?null:(0,$.jsxs)(`p`,{className:`text-xs text-fg-muted`,children:[n?`标记位置`:`Marked position`,` · `,Math.floor(e.positionMs/6e4),`:`,String(Math.floor(e.positionMs/1e3)%60).padStart(2,`0`)]}),e.annotation.text?(0,$.jsxs)(`p`,{className:`whitespace-pre-wrap text-sm`,children:[n?`我的说明:`:`My context: `,e.annotation.text]}):null,(0,$.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[(0,$.jsx)(J,{disabled:!e.evidence,onClick:()=>e.evidence&&r(e.evidence),children:n?`查看原文`:`View transcript`}),e.playback.map((e,t)=>(0,$.jsxs)(J,{onClick:()=>i(e),children:[n?`回听`:`Play`,` `,Math.floor(e.startedAtMs/6e4),`:`,String(Math.floor(e.startedAtMs/1e3)%60).padStart(2,`0`)]},t)),(0,$.jsx)(J,{onClick:()=>{d(s.find(t=>t.annotation.id===e.annotation.id)?.nonce??null),m({...e.annotation,revision:a.find(t=>t.annotation.id===e.annotation.id)?.annotation.revision??e.annotation.revision})},children:e.localState===`conflict`?n?`合并修改`:`Merge changes`:n?`添加说明/类型`:`Edit context/type`}),(0,$.jsx)(J,{onClick:()=>void b({...e.annotation,deleted:!0}),children:n?`移除标记`:`Remove`})]}),e.state===`located`&&!e.evidence?(0,$.jsx)(`p`,{className:`text-xs text-fg-muted`,children:n?`该位置原文尚未生成,可先回听原音。`:`Transcript for this position is pending; audio is usable.`}):null,e.state===`unavailable`?(0,$.jsx)(`p`,{className:`text-xs text-fg-muted`,children:n?`该位置原音未保存、已删除或时间尚无法核实;保留原始标记,不自动移动。`:`Audio at this position is missing, deleted or unverified. The original anchor has been retained.`}):e.state===`pending`?(0,$.jsx)(`p`,{className:`text-xs text-fg-muted`,children:n?`等待原音/原文完成定位`:`Awaiting audio/transcript positioning`}):null,e.localState===`conflict`?(0,$.jsx)(J,{onClick:()=>{let t=s.find(t=>t.annotation.id===e.annotation.id),n=a.find(t=>t.annotation.id===e.annotation.id);t&&n&&k(t,n.annotation).then(_)},children:n?`使用服务端版本`:`Use server version`}):null]},e.annotation.id)),f?(0,$.jsxs)(`div`,{role:`dialog`,"aria-label":n?`编辑标记`:`Edit highlight`,className:`rounded-lg border border-edge p-3`,children:[(0,$.jsxs)(ce,{value:f.kind,"aria-label":n?`标记类型`:`Highlight type`,onChange:e=>m({...f,kind:e.target.value}),children:[(0,$.jsx)(V,{value:`highlight`,children:n?`重点`:`Highlight`}),(0,$.jsx)(V,{value:`question`,children:n?`问题`:`Question`}),(0,$.jsx)(V,{value:`note`,children:n?`补充`:`Context`})]}),(0,$.jsx)(`textarea`,{"aria-label":n?`我的说明`:`My context`,maxLength:4e3,value:f.text,onChange:e=>m({...f,text:e.target.value}),className:`my-2 min-h-24 w-full rounded border border-edge bg-surface-inset p-2`}),(0,$.jsx)(J,{onClick:()=>void b(f,l),children:n?`保存到本机并同步`:`Save locally and sync`}),(0,$.jsx)(J,{onClick:()=>m(null),children:n?`取消`:`Cancel`})]}):null]})}var Ft={tab:`summary`,query:``,page:1,positionMs:0},It=m((e,t)=>({notes:{},update:(n,r)=>{let i={...Rt(n,t().notes[n]),...r};e(e=>({notes:{...e.notes,[n]:i}}));try{localStorage.setItem(`discussion-review:${n}`,JSON.stringify(i))}catch{}}})),Lt=new Map;function Rt(e,t){if(t)return t;if(Lt.has(e))return Lt.get(e);let n=Ft;try{let t=JSON.parse(localStorage.getItem(`discussion-review:${e}`)??`null`);t&&[`summary`,`transcript`,`marks`].includes(t.tab)&&typeof t.query==`string`&&Number.isSafeInteger(t.page)&&t.page>0&&t.page<=1e4&&Number.isFinite(t.positionMs)&&t.positionMs>=0&&(n={...Ft,...t})}catch{}return Lt.set(e,n),n}function zt(e){let t=(0,mt.c)(51),{initial:n,zh:r,busy:i,onClose:a,onSave:o}=e,[s,c]=(0,Q.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,$.jsx)(g,{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,$.jsx)(`header`,{className:`border-b border-edge p-4`,children:(0,$.jsx)(S,{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,$.jsx)(`p`,{className:`text-xs text-fg-muted`,children:p}),t[6]=p,t[7]=m);let h=r?`内容`:`Content`,_;t[8]===s?_=t[9]:(_=e=>c({...s,text:e.target.value}),t[8]=s,t[9]=_);let v;t[10]!==s.text||t[11]!==_?(v=(0,$.jsx)(`textarea`,{className:`mt-1 min-h-32 w-full rounded border border-edge bg-transparent p-2`,value:s.text,onChange:_}),t[10]=s.text,t[11]=_,t[12]=v):v=t[12];let y;t[13]!==h||t[14]!==v?(y=(0,$.jsxs)(`label`,{className:`block text-sm`,children:[h,v]}),t[13]=h,t[14]=v,t[15]=y):y=t[15];let w;t[16]!==s||t[17]!==r?(w=s.kind===`actionItems`?(0,$.jsxs)($.Fragment,{children:[(0,$.jsxs)(`label`,{className:`block text-sm`,children:[r?`负责人原话`:`Owner as stated`,(0,$.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,$.jsxs)(`label`,{className:`block text-sm`,children:[r?`期限原话`:`Date as stated`,(0,$.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]=w):w=t[18];let T;t[19]!==s||t[20]!==r?(T=s.kind===`summary`?null:(0,$.jsxs)(`label`,{className:`flex items-center gap-2 text-sm`,children:[(0,$.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]=T):T=t[21];let E;t[22]!==y||t[23]!==w||t[24]!==T||t[25]!==m?(E=(0,$.jsxs)(`div`,{className:`min-h-0 flex-1 space-y-4 overflow-y-auto p-4`,children:[m,y,w,T]}),t[22]=y,t[23]=w,t[24]=T,t[25]=m,t[26]=E):E=t[26];let D=r?`取消`:`Cancel`,O;t[27]!==i||t[28]!==a||t[29]!==D?(O=(0,$.jsx)(J,{disabled:i,onClick:a,children:D}),t[27]=i,t[28]=a,t[29]=D,t[30]=O):O=t[30];let k;t[31]!==i||t[32]!==s.text?(k=i||!s.text.trim(),t[31]=i,t[32]=s.text,t[33]=k):k=t[33];let A;t[34]!==s||t[35]!==o?(A=()=>void o(s),t[34]=s,t[35]=o,t[36]=A):A=t[36];let j=r?`保存修改`:`Save changes`,M;t[37]!==k||t[38]!==A||t[39]!==j?(M=(0,$.jsx)(J,{variant:`primary`,disabled:k,onClick:A,children:j}),t[37]=k,t[38]=A,t[39]=j,t[40]=M):M=t[40];let N;t[41]!==O||t[42]!==M?(N=(0,$.jsxs)(`footer`,{className:`flex justify-end gap-2 border-t border-edge p-3`,children:[O,M]}),t[41]=O,t[42]=M,t[43]=N):N=t[43];let P;t[44]!==E||t[45]!==N||t[46]!==f?(P=(0,$.jsxs)(b,{children:[u,(0,$.jsxs)(x,{"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,E,N]})]}),t[44]=E,t[45]=N,t[46]=f,t[47]=P):P=t[47];let F;return t[48]!==l||t[49]!==P?(F=(0,$.jsx)(C,{open:!0,onOpenChange:l,children:P}),t[48]=l,t[49]=P,t[50]=F):F=t[50],F}function Bt(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 Vt=e=>`${String(Math.floor(e/6e4)).padStart(2,`0`)}:${String(Math.floor(e/1e3)%60).padStart(2,`0`)}`;function Ht({noteId:e,onPersonalNotes:t,onMeetingContent:n,personalNotes:r,personalNotesActive:i=!1,noteActions:a}){let c=o(),l=f(e=>e.language)===`zh`,{data:d,mutate:m,isLoading:h}=Ye([`note-discussion-document`,e],()=>E(e),{refreshInterval:e=>e&&([`recording`,`stopping`,`sealing`,`organizing`].includes(e.discussion.status)||e.recordingJob?.state===`queued`||e.recordingJob?.state===`running`)?3e3:0}),{detail:_,hasUpdates:v,publish:y}=jt(e,d),w=_?.discussion.id,k=`/api/discussions/${encodeURIComponent(w??``)}`,{data:j=[],mutate:N}=Ye(w?`${k}/actions`:null,e=>p(u(e)),{refreshInterval:1e4}),F=It(t=>Rt(e,t.notes[e])),I=It(e=>e.update),L=F.tab,R=t=>I(e,{tab:t}),z=F.query,B=t=>I(e,{query:t}),[ee,te]=(0,Q.useState)(!1),ne=(0,Q.useRef)(null);(0,Q.useEffect)(()=>{ee&&ne.current?.focus()},[ee]);let[re,ie]=(0,Q.useState)(`general`),ae=(0,Q.useRef)(null),se=(0,Q.useRef)(null),ce=(0,Q.useRef)(null),[V,le]=(0,Q.useState)(!1),[ue,de]=(0,Q.useState)(!1),fe=(0,Q.useRef)(!1),pe=(0,Q.useRef)(null),me=(0,Q.useRef)(null),[H,he]=(0,Q.useState)(null),[U,ge]=(0,Q.useState)(null),[_e,ve]=(0,Q.useState)(null),[ye,be]=(0,Q.useState)(!1),[xe,Se]=(0,Q.useState)([]),[Ce,we]=(0,Q.useState)(null),[Te,Ee]=(0,Q.useState)(!1),De=F.page,Oe=t=>I(e,{page:t}),W=(0,Q.useRef)(null),[ke,Ae]=(0,Q.useState)([]),je=(0,Q.useRef)(0),Me=(0,Q.useRef)(0),Ne=(0,Q.useRef)(d?.transcript.revision);Ne.current=d?.transcript.revision;let Pe=(0,Q.useRef)(null),Fe=(0,Q.useRef)(d?.discussion.audioDeletedAt);Fe.current=d?.discussion.audioDeletedAt;let Ie=(0,Q.useRef)(null),[,Re]=(0,Q.useState)(0);(0,Q.useEffect)(()=>{let t=()=>{m(),N()},n=n=>{n.detail?.noteId===e&&t()};return window.addEventListener(`note-updated`,n),window.addEventListener(`discussion-updated`,t),window.addEventListener(`discussion-segment-updated`,t),()=>{window.removeEventListener(`note-updated`,n),window.removeEventListener(`discussion-updated`,t),window.removeEventListener(`discussion-segment-updated`,t)}},[m,N,e]),(0,Q.useEffect)(()=>{_?.discussion.template&&ie(_.discussion.template)},[_?.discussion.template]);async function ze(e){if(!Te){Ee(!0),we(null);try{await e();let t=await m();y(t),await N()}catch(e){we(e instanceof Error?e.message:String(e))}finally{Ee(!1)}}}function Ve(e,t){Pe.current&&(W.current=t??null,Pe.current.readyState===0?(Ie.current=e/1e3,Pe.current.load()):(Pe.current.currentTime=e/1e3,Pe.current.play().catch(()=>void 0)))}function Ue(){if(ce.current)return;let e=me.current??(document.activeElement instanceof HTMLElement?document.activeElement:null);ce.current={element:e,triggerIndex:Array.from(ae.current?.querySelectorAll(`button`)??[]).findIndex(t=>t===e),scrollTop:ae.current?.scrollTop??0,review:F}}function We(){Me.current++,le(!1),he(null),pe.current=ce.current?.element??null,ue||(ce.current=null)}function G(){let t=ce.current;if(!t)return;let{tab:n,query:r,page:i,anchor:a,anchorRevision:o}=t.review;I(e,{tab:n,query:r,page:i,anchor:a,anchorRevision:o}),Ae([]),he(null),de(!1),fe.current=!0}(0,Q.useLayoutEffect)(()=>{if(!H&&!V&&pe.current&&(pe.current.focus({preventScroll:!0}),pe.current=null),!fe.current)return;fe.current=!1;let e=ce.current;e&&ae.current&&(ae.current.scrollTop=e.scrollTop),(e?.element?.isConnected?e.element:e&&e.triggerIndex>=0?ae.current?.querySelectorAll(`button`)[e.triggerIndex]:null)?.focus({preventScroll:!0}),ce.current=null}),(0,Q.useEffect)(()=>{(H||V)&&se.current?.focus({preventScroll:!0})},[H,V]);function Ke(e){Ue();let t=e.stale||e.transcriptRevision!==Ne.current,n=Fe.current?{...e,audioAvailable:!1,timingVerified:!1,segments:e.segments.map(e=>({...e,playback:[]}))}:e;he({...n,stale:t}),t||Ae(e.segments.map(e=>e.sequence))}async function K(e,t,n=!1){if(!_)return;let r=je.current,i=++Me.current;Ue(),le(!0),he(null),we(null);try{let a=await p(u(`${k}/evidence?revision=${t??_.organization?.transcriptRevision??_.transcript.revision}&segments=${e.join(`,`)}`));if(r!==je.current||i!==Me.current)return;if(Ke(a),n&&!Fe.current&&a.segments[0]?.playback[0]){let e=a.segments[0].playback[0];Ve(e.startedAtMs,e.endedAtMs)}}catch(e){r===je.current&&i===Me.current&&(we(e instanceof Error?e.message:String(e)),We())}finally{i===Me.current&&le(!1)}}async function Je(e){_&&await ze(async()=>{await A(_.discussion.clientRequestId,O({type:`transcript`,capturedAt:Date.now(),transcriptRevision:_.transcript.revision,segmentIds:[e.sequence]})),R(`marks`),M(_.discussion.clientRequestId,_.discussion.id).catch(e=>we(String(e)))})}(0,Q.useEffect)(()=>(je.current++,Me.current++,ce.current=null,de(!1),le(!1),he(null),Ae([]),ge(null),ve(null),Se([]),we(null),W.current=null,()=>{je.current++}),[e]),(0,Q.useEffect)(()=>{let t=_?.discussion.audioSha256??_?.discussion.audioAttachmentId;if(!t)return;let n=Rt(e,It.getState().notes[e]);n.source&&n.source!==t?(je.current++,Me.current++,le(!1),he(null),Ae([]),Pe.current?.pause(),I(e,{positionMs:0,source:t}),Ie.current=0,W.current=null):I(e,{source:t})},[e,_?.discussion.audioSha256,_?.discussion.audioAttachmentId,I]),(0,Q.useEffect)(()=>{_?.discussion.audioDeletedAt&&(Pe.current?.pause(),Ie.current=null,W.current=null,he(e=>e?{...e,audioAvailable:!1,timingVerified:!1,segments:e.segments.map(e=>({...e,playback:[]}))}:null))},[_?.discussion.audioDeletedAt]),(0,Q.useEffect)(()=>{F.tab===`transcript`&&F.anchor!==void 0&&F.anchorRevision===_?.transcript.revision&&window.setTimeout(()=>document.getElementById(`discussion-segment-${F.anchor}`)?.scrollIntoView?.({block:`center`}),0)},[F.tab,F.anchor,F.anchorRevision,_?.transcript.revision]),(0,Q.useEffect)(()=>{Ae([]),he(e=>e&&e.transcriptRevision!==d?.transcript.revision?{...e,stale:!0}:e)},[d?.transcript.revision]);let Xe=(e,t,n)=>t.some(e=>ye||!e.ignored)?(0,$.jsxs)(`section`,{className:`space-y-2`,children:[(0,$.jsx)(`h3`,{className:`font-semibold text-fg`,children:e}),t.filter(e=>ye||!e.ignored).map(e=>(0,$.jsxs)(`div`,{className:`flex items-start gap-3 text-sm`,children:[(0,$.jsxs)(`p`,{className:`flex-1 whitespace-pre-wrap`,children:[e.text,e.supersededBy||e.disputedBy?(0,$.jsx)(`span`,{className:`ml-2 text-xs text-fg-muted`,children:l?`有后续变更`:`Later changes`}):null,e.editedByUser?(0,$.jsx)(`span`,{className:`ml-2 text-xs text-fg-muted`,children:l?e.ignored?`已忽略`:`人工编辑`:e.ignored?`Ignored`:`Edited`}):null]}),(0,$.jsx)(`button`,{className:`text-xs text-fg-muted`,disabled:Te||v,onClick:()=>ve({kind:n,itemId:e.id,text:e.text,ignored:e.ignored}),children:l?`编辑`:`Edit`}),e.evidenceSegmentIds.length?(0,$.jsx)(`button`,{disabled:Te,className:`shrink-0 text-accent-fg`,onClick:()=>void K(e.evidenceSegmentIds,e.evidenceRevision),children:l?`原话`:`Source`}):(0,$.jsx)(`span`,{className:`text-xs text-fg-muted`,children:l?`暂无定位`:`No source timing`})]},e.id))]}):null;if(h)return(0,$.jsx)(q,{className:`h-48 w-full`});if(!_)return null;let{discussion:Y,transcript:Ze,organization:Qe}=_,X=Qe?.organization,$e=[`stopping`,`sealing`,`organizing`].includes(Y.status),et=!v&&[`recording`,`completed`,`needs_attention`].includes(Y.status),tt=Ze.segments.filter(e=>(e.displayText??e.rawText??``).toLocaleLowerCase().includes(z.toLocaleLowerCase())||e.speakerLabel?.toLocaleLowerCase().includes(z.toLocaleLowerCase())),nt=i?_.note.markdown:L===`marks`||z.trim()?``:Bt(_,L,{query:z,page:De,showIgnored:ye});return(0,$.jsxs)(`section`,{className:`@container/discussion relative flex h-full min-h-0 min-w-0 w-full flex-col text-fg`,onClickCapture:e=>{me.current=e.target instanceof Element?e.target.closest(`button`):null},onKeyDown:e=>{(e.metaKey||e.ctrlKey)&&e.key===`f`&&(e.preventDefault(),te(!0))},children:[(0,$.jsxs)(`header`,{className:`flex shrink-0 flex-wrap items-start gap-x-3 gap-y-1 px-5 pb-2 pt-5 sm:px-7`,children:[(0,$.jsxs)(`div`,{className:`min-w-40 flex-1`,children:[(0,$.jsx)(`h2`,{className:`text-2xl font-semibold leading-snug tracking-tight`,children:!_.note.title||/^Discussion · \d{4}-\d{2}-\d{2} \d{2}:\d{2}$/.test(_.note.title)?l?`语音笔记`:`Voice note`:_.note.title}),(0,$.jsxs)(`p`,{className:`mt-1 text-xs text-fg-muted`,children:[l?`录音`:`Recording`,` · `,Vt(Y.durationMs??0)]})]}),(0,$.jsx)(`button`,{type:`button`,"aria-label":l?`搜索此 Note`:`Search this Note`,"aria-expanded":ee||!!z,onClick:()=>{te(e=>!e),ee&&B(``)},className:`inline-flex size-11 shrink-0 items-center justify-center rounded-full text-fg-muted hover:bg-surface-hover focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,children:(0,$.jsx)(He,{className:`size-5`,"aria-hidden":!0})}),(0,$.jsx)(Ot,{noteActions:a,detail:_,zh:l,busy:Te,processing:$e,pageText:nt,editing:!!_e||!!U})]}),(0,$.jsx)(`nav`,{"aria-label":l?`笔记内容`:`Note content`,className:`mx-5 mb-2 flex shrink-0 gap-6 border-b border-edge-subtle sm:mx-7`,children:[`summary`,`transcript`,`personal`].map(e=>{let r=e===`personal`?i:!i&&(e===`transcript`?L===`transcript`||L===`marks`:L===e);return(0,$.jsx)(`button`,{type:`button`,"aria-pressed":r,className:`min-h-11 border-b-2 px-1 text-sm focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent ${r?`border-accent font-medium text-fg`:`border-transparent text-fg-muted hover:text-fg`}`,onClick:()=>{e===`personal`?(We(),t?.()):(n?.(),R(e))},children:e===`summary`?l?`纪要`:`Summary`:e===`personal`?l?`我的笔记`:`My notes`:l?`原文`:`Transcript`},e)})}),Ce?(0,$.jsxs)(`details`,{role:`alert`,className:`px-4 py-2 text-sm text-danger`,children:[(0,$.jsx)(`summary`,{children:l?`操作未完成,可以稍后重试`:`Action incomplete. Try again later`}),(0,$.jsx)(`p`,{className:`mt-2 break-words text-xs text-fg-muted`,children:Ce})]}):null,!i&&(ee||z)?(0,$.jsxs)(`label`,{className:`mx-5 mb-2 flex shrink-0 items-center gap-2 rounded-xl bg-surface-inset px-3 sm:mx-7`,children:[(0,$.jsx)(He,{className:`size-4 text-fg-muted`}),(0,$.jsx)(`input`,{ref:ne,"aria-label":l?`搜索此 Note`:`Search this Note`,className:`min-h-11 min-w-0 w-full bg-transparent text-sm outline-none`,maxLength:200,placeholder:l?`搜索这篇笔记`:`Search this note`,value:z,onChange:e=>{B(e.target.value),Oe(1)}}),(0,$.jsx)(`button`,{className:`inline-flex size-11 shrink-0 items-center justify-center rounded-lg focus-visible:ring-2 focus-visible:ring-accent`,"aria-label":l?`关闭搜索`:`Close search`,onClick:()=>{B(``),te(!1)},children:(0,$.jsx)(qe,{className:`size-4`})})]}):null,ue?(0,$.jsxs)(`div`,{className:`flex shrink-0 items-center justify-between gap-3 px-5 pb-2 text-xs text-fg-muted sm:px-7`,children:[(0,$.jsx)(`span`,{children:ce.current?.review.tab===`summary`?l?`正在查看结论依据`:`Viewing supporting transcript`:l?`正在查看原文依据`:`Viewing source transcript`}),(0,$.jsx)(J,{variant:`ghost`,onClick:G,children:ce.current?.review.tab===`summary`?l?`返回结论`:`Back to conclusion`:l?`返回阅读位置`:`Back to reading`})]}):null,(0,$.jsx)(`div`,{className:`relative z-10 h-0 shrink-0`,children:v?(0,$.jsx)(J,{className:`absolute right-5 top-2 border-edge bg-surface-overlay text-xs shadow-popover`,onClick:()=>y(),children:l?`内容已更新 · 查看最新`:`Updates available · View latest`}):null}),(0,$.jsxs)(`div`,{className:`flex min-h-0 min-w-0 flex-1 overflow-hidden`,children:[(0,$.jsxs)(`main`,{ref:ae,className:`min-h-0 min-w-0 flex-1 flex-col gap-5 overflow-y-auto px-5 pb-6 pt-1 sm:px-7 ${i||H||V?`hidden`:`flex`} ${!i&&(H||V)?`@min-[58rem]/discussion:flex`:``}`,children:[L===`summary`?(0,$.jsxs)(`div`,{className:`mx-auto flex w-full max-w-[46rem] items-center justify-between gap-3`,children:[(0,$.jsx)(`span`,{className:`text-xs text-fg-muted`,children:l?`会议纪要`:`Meeting summary`}),(0,$.jsx)(kt,{detail:_,template:re,onTemplate:ie,zh:l,busy:Te,processing:$e,onOrganize:()=>void ze(()=>p(u(`${k}/organize`),{method:`POST`,body:JSON.stringify({template:re})})),onRegenerate:()=>void ze(()=>D(Y.id,`from_audio`))})]}):(0,$.jsxs)(`div`,{className:`mx-auto flex w-full max-w-[46rem] gap-2`,children:[(0,$.jsx)(J,{variant:`ghost`,"aria-pressed":L===`transcript`,onClick:()=>R(`transcript`),children:l?`全部原文`:`All transcript`}),(0,$.jsx)(J,{variant:`ghost`,"aria-pressed":L===`marks`,onClick:()=>R(`marks`),children:l?`我的标记`:`My highlights`})]}),(Y.status!==`completed`||!X||Qe?.transcriptRevision!==Ze.revision)&&(Y.status!==`recording`||_.recordingJob)?(0,$.jsx)(T,{context:`note`,nextAttemptAt:_.processing?.nextAttemptAt,input:P(_),zh:l,busy:Te,onRetry:e=>void ze(()=>e===`analyze`?p(u(`${k}/organize`),{method:`POST`,body:JSON.stringify({template:re})}):D(Y.id,e===`regenerate`?`from_audio`:`resume`))}):null,(0,$.jsx)(`div`,{className:`mx-auto w-full max-w-[46rem]`,hidden:!!z.trim(),children:L===`marks`?(0,$.jsx)(Pt,{recordingId:Y.clientRequestId,discussionId:Y.id,zh:l,onEvidence:Ke,onPlay:e=>Ve(e.startedAtMs,e.endedAtMs)},Y.id):L===`summary`?X?(0,$.jsxs)(`div`,{className:`mx-auto w-full max-w-[46rem] space-y-6`,children:[(0,$.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[(0,$.jsx)(`h3`,{className:`text-base font-medium`,children:l?`摘要`:`Summary`}),(0,$.jsx)(`button`,{className:`inline-flex size-11 shrink-0 items-center justify-center rounded-full text-fg-muted hover:bg-surface-hover focus-visible:ring-2 focus-visible:ring-accent`,"aria-label":l?`编辑概要`:`Edit overview`,title:l?`编辑概要`:`Edit overview`,disabled:Te||$e||v,onClick:()=>ve({kind:`summary`,itemId:`summary`,text:X.summary}),children:(0,$.jsx)(Ge,{className:`size-4`,"aria-hidden":!0})})]}),(0,$.jsx)(`p`,{className:`whitespace-pre-wrap text-[15px] leading-7`,children:X.summary}),X.summaryEditedByUser?(0,$.jsx)(`p`,{className:`text-xs text-fg-muted`,children:l?`已由你编辑`:`Edited by you`}):null,X.summaryEvidenceSegmentIds?.length?Array.from({length:Math.ceil(X.summaryEvidenceSegmentIds.length/100)},(e,t)=>(0,$.jsxs)(J,{onClick:()=>void K(X.summaryEvidenceSegmentIds.slice(t*100,(t+1)*100)),children:[l?`查看原话`:`View source`,X.summaryEvidenceSegmentIds.length>100?` · ${t+1}`:``]},t)):null,X.keyPointEvidence?.length?(0,$.jsxs)(`section`,{className:`space-y-2`,children:[(0,$.jsx)(`h3`,{children:l?`重点结论`:`Key points`}),X.keyPointEvidence.map(e=>(0,$.jsxs)(`div`,{className:`flex gap-2 text-sm`,children:[(0,$.jsx)(`p`,{className:`flex-1`,children:e.text}),(0,$.jsx)(J,{onClick:()=>void K(e.evidenceSegmentIds,e.evidenceRevision),children:l?`原话`:`Source`})]},e.id))]}):X.keyPoints.length?(0,$.jsxs)(`section`,{className:`space-y-3`,children:[(0,$.jsx)(`h3`,{className:`text-base font-medium`,children:l?`重点结论`:`Key points`}),(0,$.jsx)(`ul`,{className:`list-disc space-y-2 pl-5 text-[15px] leading-7`,children:X.keyPoints.map((e,t)=>(0,$.jsx)(`li`,{children:e},`${t}:${e}`))})]}):null,[...X.decisions,...X.actionItems,...X.risks,...X.openQuestions].some(e=>e.ignored)?(0,$.jsxs)(`label`,{className:`flex items-center gap-2 text-xs text-fg-muted`,children:[(0,$.jsx)(`input`,{type:`checkbox`,className:`ui-checkbox`,checked:ye,onChange:e=>be(e.target.checked)}),l?`显示已忽略项`:`Show ignored items`]}):null,xe.length?(0,$.jsx)(J,{disabled:Te||v,onClick:()=>void ze(async()=>{for(let e of xe)await p(u(`${k}/actions/${encodeURIComponent(e)}/convert`),{method:`POST`,body:JSON.stringify({organizationRevision:Qe.revision})});Se([])}),children:l?`加入所选 ${xe.length} 项任务`:`Add ${xe.length} selected tasks`}):null,Xe(l?`已决定事项`:`Decisions`,X.decisions,`decisions`),X.actionItems.length?(0,$.jsxs)(`section`,{className:`space-y-3`,children:[(0,$.jsx)(`h3`,{className:`font-semibold`,children:l?`下一步行动`:`Next actions`}),X.actionItems.filter(e=>ye||!e.ignored).map(e=>{let t=j.find(t=>t.actionId===e.id);return(0,$.jsxs)(`article`,{className:`rounded-lg border border-edge-subtle p-3`,children:[(0,$.jsxs)(`div`,{className:`flex items-start gap-2`,children:[!t&&!e.ignored&&(!(e.supersededBy||e.disputedBy)||e.reviewedChangeId===(e.supersededBy??e.disputedBy))?(0,$.jsx)(`input`,{type:`checkbox`,"aria-label":`${l?`选择行动`:`Select action`}: ${e.title}`,className:`ui-checkbox`,checked:xe.includes(e.id),onChange:t=>Se(t.target.checked?[...xe,e.id]:xe.filter(t=>t!==e.id))}):null,(0,$.jsxs)(`p`,{className:`flex-1 text-sm font-medium`,children:[e.title,e.supersededBy||e.disputedBy?(0,$.jsx)(`span`,{className:`ml-2 text-xs text-fg-muted`,children:l?`有后续变更,请复核`:`Review later changes`}):null,e.editedByUser?(0,$.jsx)(`span`,{className:`ml-2 text-xs text-fg-muted`,children:l?e.ignored?`已忽略`:`人工编辑`:e.ignored?`Ignored`:`Edited`}):null]}),(0,$.jsx)(`button`,{className:`text-xs text-fg-muted`,disabled:Te||$e||v,onClick:()=>ve({kind:`actionItems`,itemId:e.id,text:e.title,owner:e.owner,dueDate:e.dueDate,ignored:e.ignored}),children:l?`编辑`:`Edit`})]}),(0,$.jsxs)(`p`,{className:`mt-1 text-xs text-fg-muted`,children:[e.owner??(l?`负责人未明确`:`Owner unspecified`),` · `,e.dueDate??(l?`期限未明确`:`Date unspecified`)]}),(0,$.jsxs)(`div`,{className:`mt-3 flex flex-wrap items-center gap-3 text-xs`,children:[e.evidenceSegmentIds.length?(0,$.jsx)(`button`,{disabled:Te,className:`text-accent-fg`,onClick:()=>void K(e.evidenceSegmentIds,e.evidenceRevision),children:l?`查看原话`:`Source`}):null,t?t.deleted?(0,$.jsx)(`span`,{children:l?`关联任务已删除`:`Linked task deleted`}):(0,$.jsx)(s,{className:`text-accent-fg`,to:Le(`${c.pathname}${c.search}`,t.taskId),children:t.resolution===`done`?l?`已完成 · 查看任务`:`Done · View task`:l?`查看任务 / 交给助手`:`View task / Delegate`}):e.ignored?null:(0,$.jsx)(J,{disabled:Te||v||!!(e.supersededBy||e.disputedBy)&&e.reviewedChangeId!==(e.supersededBy??e.disputedBy),onClick:()=>void ze(()=>p(u(`${k}/actions/${encodeURIComponent(e.id)}/convert`),{method:`POST`,body:JSON.stringify({organizationRevision:Qe.revision})})),children:l?`加入我的任务`:`Add to my tasks`})]})]},e.id)})]}):null,Xe(l?`风险`:`Risks`,X.risks,`risks`),Xe(l?`尚未确定`:`Open questions`,X.openQuestions,`openQuestions`),X.changes?.length?(0,$.jsxs)(`section`,{className:`space-y-3`,children:[(0,$.jsx)(`h3`,{className:`font-semibold`,children:l?`前后变更`:`Changes during the meeting`}),X.changes.map(e=>{let t=[...X.decisions,...X.actionItems,...X.risks,...X.openQuestions],n=t.find(t=>t.id===e.fromId),r=t.find(t=>t.id===e.toId);return!n||!r?null:(0,$.jsxs)(`article`,{className:`space-y-2 rounded border border-edge p-3 text-sm`,children:[(0,$.jsx)(`p`,{className:`text-xs text-fg-muted`,children:e.relation===`supersedes`?l?`后续撤销或替代`:`Later superseded`:l?`存在冲突,尚未明确解决`:`Unresolved conflict`}),(0,$.jsx)(`button`,{className:`block text-left text-accent-fg`,onClick:()=>void K(n.evidenceSegmentIds,n.evidenceRevision),children:`title`in n?n.title:n.text}),(0,$.jsx)(`span`,{children:`↓`}),(0,$.jsx)(`button`,{className:`block text-left text-accent-fg`,onClick:()=>void K(r.evidenceSegmentIds,r.evidenceRevision),children:`title`in r?r.title:r.text})]},`${e.fromId}:${e.toId}`)})]}):null]}):(0,$.jsxs)(`div`,{className:`mx-auto w-full max-w-[46rem] space-y-4 py-3`,children:[(0,$.jsx)(`h3`,{className:`text-base font-medium`,children:Ze.text?l?`录音摘录`:`From your recording`:Y.status===`needs_attention`?l?`纪要暂未生成`:`Summary unavailable`:l?`笔记正在整理`:`Preparing your note`}),(0,$.jsx)(`p`,{className:`whitespace-pre-wrap text-[15px] leading-7 ${Ze.text?`text-fg`:`text-fg-muted`}`,children:Ze.text?Ze.text.slice(0,400)+(Ze.text.length>400?`…`:``):l?`文字整理完成后,重点和行动会出现在这里。`:`Highlights and actions will appear as processing completes.`}),Ze.text?(0,$.jsx)(J,{className:`min-h-11`,onClick:()=>R(`transcript`),children:l?`查看原文`:`Read transcript`}):null]}):(0,$.jsxs)(`div`,{className:`space-y-4`,children:[tt.slice(0,De*50).map(e=>(0,$.jsxs)(`article`,{id:`discussion-segment-${e.sequence}`,className:`rounded-md border p-3 ${ke.includes(e.sequence)||F.anchor===e.sequence&&F.anchorRevision===Ze.revision?`border-accent`:`border-edge-subtle`}`,children:[(0,$.jsxs)(`div`,{className:`mb-2 flex items-center gap-3 text-xs text-fg-muted`,children:[(0,$.jsxs)(`button`,{className:`inline-flex items-center gap-1 text-accent-fg`,disabled:!Y.audioAttachmentId||!!Y.audioDeletedAt,onClick:()=>void K([e.sequence],Ze.revision,!0),children:[(0,$.jsx)(Be,{className:`size-3`}),Vt(e.startedAtMs)]}),e.status===`confirmed`&&!v?(0,$.jsx)(`button`,{onClick:()=>void Je(e),children:l?`标记此段`:`Highlight segment`}):null,(0,$.jsx)(`span`,{children:e.speakerLabel??(l?`未区分说话人`:`Speaker unknown`)}),et&&e.status===`confirmed`?(0,$.jsx)(`button`,{className:`ml-auto`,onClick:()=>ge({segment:e,text:e.displayText??e.rawText??``,speaker:e.speakerLabel??``}),children:l?`校对`:`Edit`}):null]}),(0,$.jsx)(`p`,{className:`whitespace-pre-wrap text-sm leading-6`,children:e.displayText??e.rawText??(l?`等待转写`:`Awaiting transcription`)})]},e.sequence)),tt.length>De*50?(0,$.jsx)(J,{onClick:()=>Oe(De+1),children:l?`加载更多`:`More`}):null]})}),(0,$.jsx)(`div`,{className:`mx-auto w-full max-w-[46rem]`,children:(0,$.jsx)(Nt,{id:Y.id,query:z.trim(),zh:l,sourceKey:`${Y.audioSha256}:${Y.audioDeletedAt}`,active:$e||Y.status===`recording`,tab:L,refreshKey:`${Y.updatedAt}:${Ze.revision}:${Qe?.revision}`,onEvidence:Ke,onPlay:Ve},Y.id)})]}),(0,$.jsx)(`div`,{className:i?`min-h-0 min-w-0 flex-1 overflow-hidden`:`hidden`,children:r}),H||V?(0,$.jsxs)(`aside`,{ref:se,tabIndex:-1,onKeyDown:e=>{e.key===`Escape`&&(e.stopPropagation(),We())},"aria-label":l?`原话证据`:`Source evidence`,className:`flex min-h-0 w-full min-w-0 flex-col border-edge bg-surface-panel outline-none @min-[58rem]/discussion:w-[22rem] @min-[58rem]/discussion:shrink-0 @min-[58rem]/discussion:border-l`,children:[(0,$.jsxs)(`header`,{className:`flex shrink-0 items-center justify-between border-b border-edge p-4`,children:[(0,$.jsxs)(`h3`,{children:[l?`原话证据`:`Source evidence`,` `,H?`· v${H.transcriptRevision}`:``]}),(0,$.jsx)(`button`,{"aria-label":l?`关闭`:`Close`,className:`inline-flex size-11 items-center justify-center rounded-lg hover:bg-surface-hover focus-visible:ring-2 focus-visible:ring-accent`,onClick:We,children:(0,$.jsx)(qe,{className:`size-4`})})]}),(0,$.jsxs)(`div`,{className:`min-h-0 flex-1 space-y-4 overflow-y-auto p-4`,children:[V?(0,$.jsxs)(`div`,{"aria-busy":`true`,className:`space-y-3`,children:[(0,$.jsx)(q,{className:`h-4 w-1/3`}),(0,$.jsx)(q,{className:`h-24 w-full`})]}):null,H?(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(`p`,{className:`text-xs text-fg-muted`,children:l?`按整段定位,不代表词句级时间。`:`Segment timing; not word-level alignment.`}),H.stale?(0,$.jsx)(`p`,{className:`text-xs text-fg-muted`,children:l?`原文已更新,以下保留当时版本的依据。`:`Transcript updated; showing the original evidence revision.`}):null,!H.audioAvailable||!H.timingVerified?(0,$.jsx)(`p`,{className:`text-xs text-fg-muted`,children:l?`原文仍可查看;原音不可用或时间定位待核实。`:`Text remains available; audio is missing or timing is unverified.`}):null,H.segments.map(t=>(0,$.jsxs)(`article`,{className:`space-y-2 rounded border border-edge p-3`,children:[(0,$.jsxs)(`p`,{className:`text-xs text-fg-muted`,children:[Vt(t.startedAtMs),`–`,Vt(t.endedAtMs),` · `,t.speakerLabel??(l?`说话人未明确`:`Unknown speaker`)]}),(0,$.jsx)(`p`,{className:`whitespace-pre-wrap text-sm leading-7`,children:t.text}),t.playback.map((e,t)=>(0,$.jsxs)(J,{onClick:()=>Ve(e.startedAtMs,e.endedAtMs),children:[l?`播放原话`:`Play source`,` `,Vt(e.startedAtMs),`–`,Vt(e.endedAtMs)]},t)),!H.stale&&H.transcriptRevision===d?.transcript.revision&&H.transcriptRevision!==Ze.revision?(0,$.jsx)(J,{onClick:()=>y(),children:l?`查看最新原文`:`View latest transcript`}):null,!H.stale&&H.transcriptRevision===d?.transcript.revision&&H.transcriptRevision===Ze.revision?(0,$.jsx)(J,{onClick:()=>{B(``),Oe(Math.max(De,Math.ceil((Ze.segments.findIndex(e=>e.sequence===t.sequence)+1)/50))),R(`transcript`),Ae([t.sequence]),he(null),de(!0),I(e,{anchor:t.sequence,anchorRevision:Ze.revision}),window.setTimeout(()=>document.getElementById(`discussion-segment-${t.sequence}`)?.scrollIntoView?.({block:`center`}),0)},children:l?`定位原文`:`Locate transcript`}):null]},t.sequence))]}):null]})]}):null]}),Y.audioAttachmentId&&!Y.audioDeletedAt?(0,$.jsx)(`footer`,{className:`shrink-0 border-t border-edge-subtle p-3`,children:(0,$.jsx)(`audio`,{ref:Pe,controls:!0,preload:`metadata`,className:`h-10 w-full`,src:u(`${k}/audio`),onTimeUpdate:()=>{let t=(Pe.current?.currentTime??0)*1e3;Re(t),I(e,{positionMs:t}),W.current!==null&&t>=W.current&&(Pe.current?.pause(),W.current=null)},onLoadedMetadata:()=>{Ie.current!==null&&Pe.current?(Pe.current.currentTime=Ie.current,Ie.current=null,Pe.current.play().catch(()=>void 0)):Pe.current&&(Pe.current.currentTime=F.positionMs/1e3)},onError:()=>we(l?`录音暂不可播放`:`Recording unavailable`)})}):null,_e&&Qe?(0,$.jsx)(zt,{initial:_e,zh:l,busy:Te,onClose:()=>ve(null),onSave:e=>ze(async()=>{await p(u(`${k}/summary`),{method:`PATCH`,body:JSON.stringify({...e,expectedRevision:Qe.revision})}),ve(null)})},`${_e.kind}:${_e.itemId}:${Qe.revision}`):null,U?(0,$.jsx)(C,{open:!0,onOpenChange:e=>{e||ge(null)},children:(0,$.jsxs)(b,{children:[(0,$.jsx)(g,{className:`xopc-dialog-overlay fixed inset-0 z-[70] bg-scrim backdrop-blur-[2px]`}),(0,$.jsxs)(x,{"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,$.jsxs)(`header`,{className:`flex items-center justify-between border-b border-edge p-4`,children:[(0,$.jsx)(S,{children:l?`校对逐字稿`:`Edit transcript`}),(0,$.jsx)(`button`,{"aria-label":l?`关闭校对`:`Close editor`,onClick:()=>ge(null),children:(0,$.jsx)(qe,{className:`size-4`})})]}),(0,$.jsxs)(`div`,{className:`min-h-0 flex-1 space-y-3 overflow-y-auto p-4`,children:[(0,$.jsxs)(`label`,{className:`block text-xs`,children:[l?`本段说话人`:`Speaker for this segment`,(0,$.jsx)(`input`,{className:`mt-1 w-full rounded border border-edge bg-surface-inset p-2 text-sm`,value:U.speaker,onChange:e=>ge({...U,speaker:e.target.value})})]}),U.segment.speakerLabel?(0,$.jsxs)(`label`,{className:`flex items-center gap-2 text-xs`,children:[(0,$.jsx)(`input`,{type:`checkbox`,className:`ui-checkbox`,checked:!!U.applyToSpeakerGroup,onChange:e=>ge({...U,applyToSpeakerGroup:e.target.checked})}),l?`同时更名所有同标签片段;输入已有标签可合并说话人`:`Rename all segments with this label; use an existing label to merge speakers`]}):null,(0,$.jsx)(`textarea`,{className:`min-h-32 w-full rounded border border-edge bg-surface-inset p-2 text-sm`,value:U.text,onChange:e=>ge({...U,text:e.target.value})})]}),(0,$.jsx)(`footer`,{className:`border-t border-edge p-3`,children:(0,$.jsxs)(J,{variant:`primary`,disabled:Te||!U.text.trim(),onClick:()=>void ze(async()=>{await p(u(`${k}/segments/${U.segment.sequence}`),{method:`PATCH`,body:JSON.stringify({displayText:U.text,speakerLabel:U.speaker,expectedRevision:U.segment.revision,applyToSpeakerGroup:U.applyToSpeakerGroup,expectedTranscriptRevision:Ze.revision})}),ge(null)}),children:[(0,$.jsx)(oe,{className:`size-4`}),l?`保存修订`:`Save revision`]})})]})]})}):null]})}var Ut={edit:ze,ai_edit:We,sync:Ve,restore:w};function Wt(e,t){return{edit:t.triggerEdit,ai_edit:t.triggerAiEdit,sync:t.triggerSync,restore:t.triggerRestore}[e]??e}function Gt({noteId:e,activeTimestamp:t,onSelect:n,onClose:r,onRestored:i}){let a=f(e=>e.language),o=h(a).notes,s={justNow:o.justNow,minutesAgo:o.minutesAgo,today:o.today,yesterday:o.yesterday,daysAgo:o.daysAgo,locale:l(a)},{data:c}=Ye(e?[`note-history`,e]:null,()=>De(e)),[u,d]=(0,Q.useState)(!1),[p,m]=(0,Q.useState)(null),[g,_]=(0,Q.useState)(null),v=(0,Q.useCallback)(async t=>{d(!0),_(null);try{await Se(e,t),m(null),i()}catch{_(o.restoreFailed)}finally{d(!1)}},[e,o.restoreSuccess,o.restoreFailed,i]),y=Date.now();return(0,$.jsxs)(`div`,{className:`flex h-full min-h-0 flex-col`,children:[(0,$.jsxs)(`div`,{className:`flex shrink-0 items-center justify-between border-b border-edge px-4 py-3`,children:[(0,$.jsxs)(`div`,{className:`flex items-center gap-2 text-sm font-medium text-fg`,children:[(0,$.jsx)(U,{className:`size-4`,"aria-hidden":!0}),o.history]}),(0,$.jsx)(`button`,{type:`button`,onClick:r,className:`rounded-lg p-1 text-fg-muted transition-colors hover:bg-surface-hover hover:text-fg`,children:(0,$.jsx)(qe,{className:`size-4`,"aria-hidden":!0})})]}),(0,$.jsxs)(`div`,{className:`min-h-0 flex-1 overflow-y-auto`,children:[g?(0,$.jsx)(`p`,{className:`border-b border-danger/20 bg-danger-soft px-4 py-2 text-xs text-danger`,role:`alert`,children:g}):null,c?.length?(0,$.jsx)(`ul`,{className:`divide-y divide-edge`,children:c.map(e=>{let r=Ut[e.trigger]??ze,i=t===e.timestamp,a=p===e.timestamp;return(0,$.jsxs)(`li`,{children:[(0,$.jsxs)(`button`,{type:`button`,onClick:()=>n(e),className:K(`w-full px-4 py-3 text-left transition-colors`,i?`bg-accent/10`:`hover:bg-surface-hover`),children:[(0,$.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,$.jsx)(r,{className:`size-3.5 shrink-0 text-fg-muted`,"aria-hidden":!0}),(0,$.jsx)(`span`,{className:`text-xs font-medium text-fg`,children:Wt(e.trigger,o)}),(0,$.jsx)(`span`,{className:`ml-auto text-xs text-fg-muted`,children:yt(e.timestamp,y,s)})]}),e.snippet&&(0,$.jsx)(`p`,{className:`mt-1 truncate text-xs text-fg-muted/60`,children:e.snippet})]}),i&&(0,$.jsx)(`div`,{className:`border-t border-edge/50 px-4 py-2`,children:a?(0,$.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,$.jsx)(`span`,{className:`min-w-0 truncate text-xs text-fg-muted`,children:o.restoreConfirm}),(0,$.jsx)(`button`,{type:`button`,onClick:t=>{t.stopPropagation(),v(e.timestamp)},disabled:u,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:u?`...`:o.restore}),(0,$.jsx)(`button`,{type:`button`,onClick:e=>{e.stopPropagation(),m(null)},className:`shrink-0 rounded-lg px-2 py-1 text-xs text-fg-muted hover:bg-surface-hover`,children:`Cancel`})]}):(0,$.jsx)(`button`,{type:`button`,onClick:t=>{t.stopPropagation(),m(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,$.jsxs)(`div`,{className:`px-4 py-8 text-center`,children:[(0,$.jsx)(`p`,{className:`text-sm font-medium text-fg-muted`,children:o.historyEmpty}),(0,$.jsx)(`p`,{className:`mt-1 text-xs text-fg-muted/60`,children:o.historyEmptyDescription})]})]})]})}function Kt({noteId:e,note:t,catalyzing:n,onCatalyze:r,onClose:i,noteThreads:a,openingChat:o,onOpenChat:s,onOpenNewChat:l}){let u=h(f(e=>e.language)).notes,d=c(),p=t?.aiDeep?.catalysis,m=p?.report??null,[g,_]=(0,Q.useState)(null),[v,y]=(0,Q.useState)(!1),{data:b,mutate:x,isLoading:S}=Ye(e?[`note-agent-context-status`,e]:null,()=>W(e),{revalidateOnFocus:!1}),C=(0,Q.useCallback)(async()=>{if(!v){y(!0),_(null);try{await x(()=>Fe(e),{revalidate:!1})}catch(e){_(`${u.contextRebuildFailed}: ${e instanceof Error?e.message:u.quickCaptureFailedHint}`)}finally{y(!1)}}},[v,x,u.contextRebuildFailed,u.quickCaptureFailedHint,e]),w=(0,Q.useCallback)(async t=>{try{await xe(e,t)}catch{}},[e]);return(0,$.jsxs)(`div`,{className:`flex h-full flex-col`,children:[(0,$.jsxs)(`div`,{className:`flex items-center justify-between border-b border-edge-subtle px-4 py-3`,children:[(0,$.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,$.jsx)(We,{className:`size-4 text-accent`,"aria-hidden":!0}),(0,$.jsx)(`span`,{className:`text-sm font-semibold text-fg`,children:u.catalysisSectionTitle})]}),(0,$.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,$.jsx)(F,{className:`size-4 rotate-180`,"aria-hidden":!0})})]}),(0,$.jsxs)(`div`,{className:`flex-1 overflow-y-auto p-4`,children:[(0,$.jsx)(`p`,{className:`mb-4 text-xs leading-relaxed text-fg-muted`,children:u.catalysisSectionDescription}),b?(0,$.jsxs)(`section`,{className:`mb-4 rounded-xl bg-surface-base p-3`,children:[(0,$.jsxs)(`div`,{className:`flex items-center justify-between gap-2`,children:[(0,$.jsx)(`div`,{className:`text-xs font-medium text-fg-muted`,children:u.contextStatusTitle}),(0,$.jsx)(`button`,{type:`button`,onClick:()=>void C(),disabled:S||v,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:v?u.processing:u.contextRebuild}),(0,$.jsx)(`span`,{className:K(`rounded-full px-2 py-0.5 text-[11px] font-medium`,b.status===`ready`?`bg-emerald-500/10 text-emerald-600 dark:text-emerald-300`:b.status===`partial`?`bg-amber-500/10 text-amber-600 dark:text-amber-300`:`bg-red-500/10 text-red-600 dark:text-red-300`),children:b.status})]}),(0,$.jsx)(`div`,{className:`mt-2 text-xs leading-relaxed text-fg-muted`,children:u.contextStatusDetail.replace(`{{attachments}}`,String(b.attachments.length)).replace(`{{tokens}}`,String(b.tokenEstimate??0))}),g?(0,$.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:g}):null,b.attachments.length>0?(0,$.jsx)(`div`,{className:`mt-3 space-y-1.5`,children:b.attachments.slice(0,5).map(e=>(0,$.jsxs)(`div`,{className:`flex items-center justify-between gap-2 rounded-lg bg-surface-hover px-2 py-1.5 text-xs`,children:[(0,$.jsx)(`span`,{className:`min-w-0 truncate text-fg`,children:e.fileName}),(0,$.jsx)(`span`,{className:`shrink-0 text-fg-muted`,children:e.status})]},e.attachmentId))}):null]}):null,(0,$.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:m?u.recatalyze:u.catalyzeAction}),m?(0,$.jsxs)(`div`,{className:`mt-4 space-y-4`,children:[(0,$.jsxs)(`div`,{children:[(0,$.jsx)(`div`,{className:`text-xs font-medium text-fg-muted`,children:u.valueHypothesis}),(0,$.jsx)(`p`,{className:`mt-1 text-sm leading-relaxed text-fg`,children:m.valueHypothesis})]}),(0,$.jsxs)(`div`,{children:[(0,$.jsx)(`div`,{className:`text-xs font-medium text-fg-muted`,children:u.targetUsers}),(0,$.jsx)(`div`,{className:`mt-1 flex flex-wrap gap-1.5`,children:m.targetUsers.slice(0,5).map(e=>(0,$.jsx)(`span`,{className:`rounded-full bg-surface-hover px-2 py-0.5 text-xs text-fg`,children:e},e))})]}),(0,$.jsxs)(`div`,{children:[(0,$.jsx)(`div`,{className:`text-xs font-medium text-fg-muted`,children:u.keyQuestions}),(0,$.jsx)(`ul`,{className:`mt-1 space-y-1 text-sm leading-relaxed text-fg`,children:m.keyQuestions.slice(0,3).map(e=>(0,$.jsxs)(`li`,{className:`flex gap-2`,children:[(0,$.jsx)(`span`,{className:`mt-2 size-1 shrink-0 rounded-full bg-accent`}),(0,$.jsx)(`span`,{children:e})]},e))})]}),(0,$.jsxs)(`div`,{children:[(0,$.jsx)(`div`,{className:`text-xs font-medium text-fg-muted`,children:u.mvpPathLabel}),(0,$.jsx)(`ol`,{className:`mt-1 space-y-1 text-sm leading-relaxed text-fg`,children:m.mvpPath.slice(0,3).map((e,t)=>(0,$.jsxs)(`li`,{className:`flex gap-2`,children:[(0,$.jsxs)(`span`,{className:`text-fg-muted`,children:[t+1,`.`]}),(0,$.jsx)(`span`,{children:e})]},e))})]}),(0,$.jsxs)(`div`,{children:[(0,$.jsx)(`div`,{className:`text-xs font-medium text-fg-muted`,children:u.risks}),(0,$.jsx)(`ul`,{className:`mt-1 space-y-1 text-sm leading-relaxed text-fg`,children:m.risks.slice(0,3).map(e=>(0,$.jsxs)(`li`,{className:`flex gap-2`,children:[(0,$.jsx)(`span`,{className:`mt-2 size-1 shrink-0 rounded-full bg-fg-muted`}),(0,$.jsx)(`span`,{children:e})]},e))})]}),(0,$.jsxs)(`div`,{children:[(0,$.jsx)(`div`,{className:`text-xs font-medium text-fg-muted`,children:u.nextActions}),(0,$.jsx)(`ul`,{className:`mt-1 space-y-1 text-sm leading-relaxed text-fg`,children:m.nextActions.slice(0,4).map(e=>(0,$.jsxs)(`li`,{className:`flex gap-2`,children:[(0,$.jsx)(`span`,{className:`rounded bg-accent/10 px-1.5 py-0.5 text-[10px] uppercase tracking-wide text-accent`,children:e.kind}),(0,$.jsx)(`span`,{children:e.text})]},`${e.kind}:${e.text}`))})]}),(0,$.jsxs)(`div`,{className:`flex items-center justify-between border-t border-edge-subtle pt-3`,children:[(0,$.jsx)(`span`,{className:`text-xs text-fg-muted`,children:u.confidenceLabel.replace(`{{percent}}`,String(Math.round(m.confidence*100)))}),(0,$.jsxs)(`div`,{className:`flex items-center gap-1`,children:[(0,$.jsx)(`button`,{type:`button`,onClick:()=>void w(`helpful`),className:K(`rounded-lg p-1.5 text-fg-muted transition-colors hover:bg-surface-hover hover:text-fg`,p?.feedback===`helpful`&&`bg-accent/10 text-accent`),"aria-label":u.feedbackHelpfulAria,children:(0,$.jsx)(B,{className:`size-3.5`,"aria-hidden":!0})}),(0,$.jsx)(`button`,{type:`button`,onClick:()=>void w(`not_helpful`),className:K(`rounded-lg p-1.5 text-fg-muted transition-colors hover:bg-surface-hover hover:text-fg`,p?.feedback===`not_helpful`&&`bg-accent/10 text-accent`),"aria-label":u.feedbackNotHelpfulAria,children:(0,$.jsx)(ae,{className:`size-3.5`,"aria-hidden":!0})})]})]})]}):(0,$.jsx)(`div`,{className:`mt-4 rounded-lg border border-dashed border-edge-subtle px-3 py-6 text-center text-sm text-fg-muted`,children:u.noCatalysisReportHint}),(0,$.jsxs)(`section`,{className:`mt-6 rounded-xl bg-surface-base p-4`,children:[(0,$.jsxs)(`div`,{className:`mb-3 flex items-center justify-between gap-3`,children:[(0,$.jsxs)(`div`,{children:[(0,$.jsxs)(`div`,{className:`flex items-center gap-2 text-sm font-semibold text-fg`,children:[(0,$.jsx)(Re,{className:`size-4 text-accent`,"aria-hidden":!0}),u.relatedThreadsTitle]}),(0,$.jsx)(`p`,{className:`mt-1 text-xs text-fg-muted`,children:u.relatedThreadsDescription})]}),(0,$.jsxs)(`div`,{className:`flex shrink-0 items-center gap-1.5`,children:[(0,$.jsx)(`button`,{type:`button`,onClick:s,disabled:o,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:o?u.openingChat:u.openThread}),(0,$.jsx)(`button`,{type:`button`,onClick:l,disabled:o,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})]})]}),a.length>0?(0,$.jsx)(`div`,{className:`space-y-2`,children:a.slice(0,5).map(e=>(0,$.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,$.jsx)(`div`,{className:`truncate text-sm font-medium text-fg`,children:e.name||u.noteDiscussionFallback}),(0,$.jsx)(`div`,{className:`mt-0.5 text-xs text-fg-muted`,children:u.messageCount.replace(`{{count}}`,String(e.messageCount??0))})]},e.key))}):(0,$.jsx)(`div`,{className:`rounded-lg border border-dashed border-edge-subtle px-3 py-5 text-center text-sm text-fg-muted`,children:u.noThreads})]})]})]})}var qt=[{value:`86400000`,zh:`24 小时`,en:`24 hours`},{value:`604800000`,zh:`7 天`,en:`7 days`},{value:`2592000000`,zh:`30 天`,en:`30 days`}];function Jt({open:e,onOpenChange:t,note:n}){let r=f(e=>e.language)===`zh`,i=r?Qt:$t,{data:a,mutate:o}=Ye(e?[`note-shares`,n.id]:null,()=>ke(n.id)),s=Ye(e?`hosted-share-auth-status`:null,tt),c=s.data===!0,l=Ye(e&&c?`hosted-publication-capabilities`:null,rt),u=l.data?.publishing.allowed===!0,d=Ye(e&&c?[`hosted-note-publications`,n.id]:null,()=>Ee(n.id)),[p,m]=(0,Q.useState)(new Set),[h,_]=(0,Q.useState)(`86400000`),[w,T]=(0,Q.useState)(``),[E,D]=(0,Q.useState)(``),[O,k]=(0,Q.useState)(`hosted`),[A,j]=(0,Q.useState)(!1),[M,N]=(0,Q.useState)(null),[P,F]=(0,Q.useState)(null),[I,L]=(0,Q.useState)(!1),[z,B]=(0,Q.useState)(null),ee=(0,Q.useMemo)(()=>{let e=new Set;return n.markdown.replace(/xopc-attachment:\/\/notes\/([^/]+)\/([^\s)]+)/gi,(t,r,i)=>{try{decodeURIComponent(r)===n.id&&e.add(decodeURIComponent(i))}catch{}return t}),(n.attachments??[]).filter(t=>e.has(t.id))},[n.attachments,n.id,n.markdown]);(0,Q.useEffect)(()=>{e&&(m(new Set(ee.map(e=>e.id))),F(null),L(!1),B(null))},[e,ee]);let te=async()=>{j(!0),B(null);try{let e={expectedNoteVersion:n.updatedAt,attachmentIds:[...p],ttlMs:Number(h),maxViews:w.trim()?Number(w):null,description:E.trim()||void 0};if(O===`hosted`){let t=await je(n.id,e);F(t.shareUrl),await d.mutate()}else{let t=await we(n.id,e);F(t.payload.shareUrl),await o()}}catch(e){B(e instanceof Error?e.message:String(e))}finally{j(!1)}},ne=async(e,t)=>{N(e.id),B(null);try{t===`refresh`?await ge(n.id,e.id,{expectedNoteVersion:n.updatedAt,attachmentIds:[...p]}):await it(e.id),await d.mutate()}catch(e){B(e instanceof Error?e.message:String(e))}finally{N(null)}},re=async(e,t)=>{N(e.id),B(null);try{t===`refresh`?await Pe(n.id,e.id,{expectedNoteVersion:n.updatedAt,attachmentIds:[...p]}):t===`extend`?await nt(e.id,864e5):await et(e.id),await o()}catch(e){B(e instanceof Error?e.message:String(e))}finally{N(null)}},ie=async e=>{B(null);try{if(!await Xe(e)){L(!1),B(i.copyFailed);return}L(!0),window.setTimeout(()=>L(!1),1500)}catch{L(!1),B(i.copyFailed)}};return(0,$.jsx)(C,{open:e,onOpenChange:t,children:(0,$.jsxs)(b,{children:[(0,$.jsx)(g,{className:`xopc-dialog-overlay fixed inset-0 z-[70] bg-scrim backdrop-blur-[2px]`}),(0,$.jsxs)(x,{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,$.jsxs)(`div`,{className:`flex shrink-0 items-start justify-between border-b border-edge px-5 py-4`,children:[(0,$.jsxs)(`div`,{children:[(0,$.jsxs)(S,{className:`flex items-center gap-2 text-base font-semibold text-fg`,children:[(0,$.jsx)(R,{className:`size-4`}),i.title]}),(0,$.jsx)(v,{className:`mt-1 text-xs text-fg-muted`,children:i.description})]}),(0,$.jsx)(y,{asChild:!0,children:(0,$.jsx)(`button`,{type:`button`,className:`rounded-md p-1.5 text-fg-muted hover:bg-surface-hover`,"aria-label":i.close,children:(0,$.jsx)(qe,{className:`size-4`})})})]}),(0,$.jsxs)(`div`,{className:`min-h-0 flex-1 overflow-y-auto p-5`,children:[(0,$.jsxs)(`section`,{className:`rounded-lg border border-edge bg-surface-inset p-4`,children:[(0,$.jsx)(`div`,{className:`text-sm font-semibold text-fg`,children:n.title||i.untitled}),(0,$.jsx)(`p`,{className:`mt-2 line-clamp-4 whitespace-pre-wrap text-xs leading-5 text-fg-muted`,children:n.markdown||i.empty}),(0,$.jsx)(`p`,{className:`mt-3 text-xs text-fg-subtle`,children:i.privateExcluded})]}),ee.length>0?(0,$.jsxs)(`section`,{className:`mt-5`,children:[(0,$.jsx)(`h3`,{className:`text-sm font-medium text-fg`,children:i.attachments}),(0,$.jsx)(`div`,{className:`mt-2 grid gap-2`,children:ee.map(e=>(0,$.jsxs)(`label`,{className:`flex items-center gap-3 rounded-lg border border-edge-subtle px-3 py-2 text-sm text-fg-muted`,children:[(0,$.jsx)(`input`,{type:`checkbox`,checked:p.has(e.id),onChange:()=>m(t=>{let n=new Set(t);return n.has(e.id)?n.delete(e.id):n.add(e.id),n}),className:`accent-accent`}),(0,$.jsx)(`span`,{className:`min-w-0 flex-1 truncate`,children:e.fileName}),(0,$.jsx)(`span`,{className:`text-xs text-fg-subtle`,children:Zt(e.size)})]},e.id))})]}):null,(0,$.jsxs)(`section`,{className:`mt-5 grid gap-4 sm:grid-cols-2`,children:[(0,$.jsxs)(`label`,{className:`grid gap-1.5 text-xs text-fg-muted sm:col-span-2`,children:[i.delivery,(0,$.jsxs)(ce,{value:O,onChange:e=>k(e.target.value),children:[(0,$.jsx)(V,{value:`hosted`,children:i.deliveryHosted}),(0,$.jsx)(V,{value:`local`,children:i.deliveryLocal})]})]}),O===`hosted`&&s.data===!1?(0,$.jsx)(`div`,{className:`sm:col-span-2`,children:(0,$.jsx)(Z,{providerId:`xopc-share`,displayName:`XOPC Hosted Share`,connected:!1,onConnected:()=>void s.mutate(!0,{revalidate:!1})})}):null,O===`hosted`&&c&&l.data&&!u?(0,$.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,$.jsxs)(`label`,{className:`grid gap-1.5 text-xs text-fg-muted`,children:[i.expires,(0,$.jsx)(ce,{value:h,onChange:e=>_(e.target.value),children:qt.map(e=>(0,$.jsx)(V,{value:e.value,children:r?e.zh:e.en},e.value))})]}),(0,$.jsxs)(`label`,{className:`grid gap-1.5 text-xs text-fg-muted`,children:[i.maxViews,(0,$.jsx)(`input`,{type:`number`,min:1,max:1e3,value:w,onChange:e=>T(e.target.value),placeholder:i.unlimited,className:`h-9 rounded-md border border-edge bg-surface-panel px-3 text-sm text-fg outline-none focus:border-accent`})]}),(0,$.jsxs)(`label`,{className:`grid gap-1.5 text-xs text-fg-muted sm:col-span-2`,children:[i.publicDescription,(0,$.jsx)(`input`,{value:E,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`})]})]}),P?(0,$.jsx)(`div`,{className:`mt-5 rounded-lg border border-success/25 bg-success-soft p-3`,children:(0,$.jsxs)(`div`,{className:`flex gap-2`,children:[(0,$.jsx)(`input`,{readOnly:!0,value:P,className:`min-w-0 flex-1 bg-transparent text-xs text-fg outline-none`}),(0,$.jsxs)(J,{type:`button`,className:`px-2 py-1 text-xs`,variant:`ghost`,onClick:()=>void ie(P),children:[I?(0,$.jsx)(oe,{className:`size-4`}):(0,$.jsx)(de,{className:`size-4`}),I?i.copied:i.copy]}),(0,$.jsxs)(J,{type:`button`,className:`px-2 py-1 text-xs`,variant:`ghost`,onClick:()=>window.open(P,`_blank`,`noopener,noreferrer`),children:[(0,$.jsx)(me,{className:`size-4`}),i.open]})]})}):null,z?(0,$.jsx)(`p`,{className:`mt-4 rounded-lg border border-danger/25 bg-danger-soft px-3 py-2 text-sm text-danger`,children:z}):null,(a?.items.length??0)>0?(0,$.jsxs)(`section`,{className:`mt-6 border-t border-edge pt-5`,children:[(0,$.jsx)(`h3`,{className:`text-sm font-medium text-fg`,children:i.activeLinks}),(0,$.jsx)(`div`,{className:`mt-2 grid gap-2`,children:a.items.map(e=>(0,$.jsx)(Xt,{share:e,busy:M===e.id,t:i,onCopy:ie,onAction:re},e.id))})]}):null,(d.data?.length??0)>0?(0,$.jsxs)(`section`,{className:`mt-6 border-t border-edge pt-5`,children:[(0,$.jsx)(`h3`,{className:`text-sm font-medium text-fg`,children:i.hostedLinks}),(0,$.jsx)(`div`,{className:`mt-2 grid gap-2`,children:d.data.map(e=>(0,$.jsx)(Yt,{publication:e,stale:e.source?.version!==String(n.updatedAt),busy:M===e.id,publishingAllowed:u,t:i,onCopy:ie,onAction:ne},e.id))})]}):null]}),(0,$.jsxs)(`div`,{className:`flex shrink-0 items-center justify-end gap-2 border-t border-edge px-5 py-3`,children:[(0,$.jsx)(y,{asChild:!0,children:(0,$.jsx)(J,{type:`button`,variant:`ghost`,children:i.close})}),(0,$.jsxs)(J,{type:`button`,onClick:()=>void te(),disabled:A||O===`hosted`&&(!c||!u),children:[A?(0,$.jsx)(Ie,{className:`size-4 animate-spin`}):(0,$.jsx)(R,{className:`size-4`}),A?i.creating:i.create]})]})]})]})})}function Yt(e){let t=(0,mt.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=K(`rounded-lg border border-edge-subtle p-3`,u),t[0]=u,t[1]=d);let f=r&&!l?o.stale:l?o.inactive:o.active,p;t[2]===f?p=t[3]:(p=(0,$.jsx)(`span`,{children:f}),t[2]=f,t[3]=p);let m;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(m=(0,$.jsx)(`span`,{children:`·`}),t[4]=m):m=t[4];let h=n.maxViews===null?``:` / ${n.maxViews}`,g;t[5]!==n.viewCount||t[6]!==o.views||t[7]!==h?(g=(0,$.jsxs)(`span`,{children:[o.views,` `,n.viewCount,h]}),t[5]=n.viewCount,t[6]=o.views,t[7]=h,t[8]=g):g=t[8];let _;t[9]===Symbol.for(`react.memo_cache_sentinel`)?(_=(0,$.jsx)(`span`,{children:`·`}),t[9]=_):_=t[9];let v;t[10]!==n.revision||t[11]!==o.revision?(v=(0,$.jsxs)(`span`,{children:[o.revision,` `,n.revision]}),t[10]=n.revision,t[11]=o.revision,t[12]=v):v=t[12];let y;t[13]!==p||t[14]!==g||t[15]!==v?(y=(0,$.jsxs)(`div`,{className:`flex items-center gap-2 text-xs text-fg-muted`,children:[p,m,g,_,v]}),t[13]=p,t[14]=g,t[15]=v,t[16]=y):y=t[16];let b;t[17]===n.shareUrl?b=t[18]:(b=(0,$.jsx)(`div`,{className:`mt-1 truncate text-xs text-fg-subtle`,children:n.shareUrl}),t[17]=n.shareUrl,t[18]=b);let x;t[19]!==y||t[20]!==b?(x=(0,$.jsxs)(`div`,{className:`min-w-0`,children:[y,b]}),t[19]=y,t[20]=b,t[21]=x):x=t[21];let S;t[22]===i?S=t[23]:(S=i?(0,$.jsx)(Ie,{className:`size-4 animate-spin text-fg-muted`}):null,t[22]=i,t[23]=S);let C;t[24]!==x||t[25]!==S?(C=(0,$.jsxs)(`div`,{className:`flex items-start justify-between gap-3`,children:[x,S]}),t[24]=x,t[25]=S,t[26]=C):C=t[26];let w=!a,T;t[27]!==s||t[28]!==n.shareUrl?(T=()=>void s(n.shareUrl),t[27]=s,t[28]=n.shareUrl,t[29]=T):T=t[29];let E;t[30]===Symbol.for(`react.memo_cache_sentinel`)?(E=(0,$.jsx)(de,{className:`size-3.5`}),t[30]=E):E=t[30];let D;t[31]!==o.copy||t[32]!==w||t[33]!==T?(D=(0,$.jsxs)(J,{className:`px-2 py-1 text-xs`,variant:`ghost`,disabled:w,onClick:T,children:[E,o.copy]}),t[31]=o.copy,t[32]=w,t[33]=T,t[34]=D):D=t[34];let O=!a,k;t[35]===n.shareUrl?k=t[36]:(k=()=>window.open(n.shareUrl,`_blank`,`noopener,noreferrer`),t[35]=n.shareUrl,t[36]=k);let A;t[37]===Symbol.for(`react.memo_cache_sentinel`)?(A=(0,$.jsx)(me,{className:`size-3.5`}),t[37]=A):A=t[37];let j;t[38]!==o.open||t[39]!==O||t[40]!==k?(j=(0,$.jsxs)(J,{className:`px-2 py-1 text-xs`,variant:`ghost`,disabled:O,onClick:k,children:[A,o.open]}),t[38]=o.open,t[39]=O,t[40]=k,t[41]=j):j=t[41];let M;t[42]!==i||t[43]!==l||t[44]!==c||t[45]!==n||t[46]!==a||t[47]!==r||t[48]!==o.refresh?(M=r&&!l?(0,$.jsxs)(J,{className:`px-2 py-1 text-xs`,variant:`ghost`,disabled:i||!a,onClick:()=>void c(n,`refresh`),children:[(0,$.jsx)(Ve,{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]=M):M=t[49];let N;t[50]!==i||t[51]!==c||t[52]!==n||t[53]!==o.revoke?(N=n.revoked?null:(0,$.jsxs)(J,{className:`px-2 py-1 text-xs`,variant:`ghost`,disabled:i,onClick:()=>void c(n,`revoke`),children:[(0,$.jsx)(Ke,{className:`size-3.5`}),o.revoke]}),t[50]=i,t[51]=c,t[52]=n,t[53]=o.revoke,t[54]=N):N=t[54];let P;t[55]!==D||t[56]!==j||t[57]!==M||t[58]!==N?(P=(0,$.jsxs)(`div`,{className:`mt-2 flex flex-wrap gap-1`,children:[D,j,M,N]}),t[55]=D,t[56]=j,t[57]=M,t[58]=N,t[59]=P):P=t[59];let F;return t[60]!==C||t[61]!==d||t[62]!==P?(F=(0,$.jsxs)(`div`,{className:d,children:[C,P]}),t[60]=C,t[61]=d,t[62]=P,t[63]=F):F=t[63],F}function Xt(e){let t=(0,mt.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=K(`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,$.jsx)(`span`,{children:u}),t[2]=u,t[3]=d);let f;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(f=(0,$.jsx)(`span`,{children:`·`}),t[4]=f):f=t[4];let p=n.maxViews===null?``:` / ${n.maxViews}`,m;t[5]!==n.viewCount||t[6]!==i.views||t[7]!==p?(m=(0,$.jsxs)(`span`,{children:[i.views,` `,n.viewCount,p]}),t[5]=n.viewCount,t[6]=i.views,t[7]=p,t[8]=m):m=t[8];let h;t[9]===Symbol.for(`react.memo_cache_sentinel`)?(h=(0,$.jsx)(`span`,{children:`·`}),t[9]=h):h=t[9];let g;t[10]===n.expiresAt?g=t[11]:(g=new Date(n.expiresAt).toLocaleDateString(),t[10]=n.expiresAt,t[11]=g);let _;t[12]===g?_=t[13]:(_=(0,$.jsx)(`span`,{children:g}),t[12]=g,t[13]=_);let v;t[14]!==_||t[15]!==d||t[16]!==m?(v=(0,$.jsxs)(`div`,{className:`flex items-center gap-2 text-xs text-fg-muted`,children:[d,f,m,h,_]}),t[14]=_,t[15]=d,t[16]=m,t[17]=v):v=t[17];let y;t[18]===n.shareUrl?y=t[19]:(y=(0,$.jsx)(`div`,{className:`mt-1 truncate text-xs text-fg-subtle`,children:n.shareUrl}),t[18]=n.shareUrl,t[19]=y);let b;t[20]!==v||t[21]!==y?(b=(0,$.jsxs)(`div`,{className:`min-w-0`,children:[v,y]}),t[20]=v,t[21]=y,t[22]=b):b=t[22];let x;t[23]===r?x=t[24]:(x=r?(0,$.jsx)(Ie,{className:`size-4 animate-spin text-fg-muted`}):null,t[23]=r,t[24]=x);let S;t[25]!==b||t[26]!==x?(S=(0,$.jsxs)(`div`,{className:`flex items-start justify-between gap-3`,children:[b,x]}),t[25]=b,t[26]=x,t[27]=S):S=t[27];let C;t[28]!==a||t[29]!==n.shareUrl?(C=()=>void a(n.shareUrl),t[28]=a,t[29]=n.shareUrl,t[30]=C):C=t[30];let w;t[31]===Symbol.for(`react.memo_cache_sentinel`)?(w=(0,$.jsx)(de,{className:`size-3.5`}),t[31]=w):w=t[31];let T;t[32]!==i.copy||t[33]!==C?(T=(0,$.jsxs)(J,{className:`px-2 py-1 text-xs`,variant:`ghost`,onClick:C,children:[w,i.copy]}),t[32]=i.copy,t[33]=C,t[34]=T):T=t[34];let E;t[35]===n.shareUrl?E=t[36]:(E=()=>window.open(n.shareUrl,`_blank`,`noopener,noreferrer`),t[35]=n.shareUrl,t[36]=E);let D;t[37]===Symbol.for(`react.memo_cache_sentinel`)?(D=(0,$.jsx)(me,{className:`size-3.5`}),t[37]=D):D=t[37];let O;t[38]!==i.open||t[39]!==E?(O=(0,$.jsxs)(J,{className:`px-2 py-1 text-xs`,variant:`ghost`,onClick:E,children:[D,i.open]}),t[38]=i.open,t[39]=E,t[40]=O):O=t[40];let k;t[41]!==r||t[42]!==s||t[43]!==o||t[44]!==n||t[45]!==i.refresh?(k=n.stale&&!s?(0,$.jsxs)(J,{className:`px-2 py-1 text-xs`,variant:`ghost`,disabled:r,onClick:()=>void o(n,`refresh`),children:[(0,$.jsx)(Ve,{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]=k):k=t[46];let A;t[47]!==r||t[48]!==s||t[49]!==o||t[50]!==n||t[51]!==i.extend?(A=s?null:(0,$.jsx)(J,{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]=A):A=t[52];let j;t[53]!==r||t[54]!==o||t[55]!==n||t[56]!==i.revoke?(j=n.revoked?null:(0,$.jsxs)(J,{className:`px-2 py-1 text-xs`,variant:`ghost`,disabled:r,onClick:()=>void o(n,`revoke`),children:[(0,$.jsx)(Ke,{className:`size-3.5`}),i.revoke]}),t[53]=r,t[54]=o,t[55]=n,t[56]=i.revoke,t[57]=j):j=t[57];let M;t[58]!==T||t[59]!==O||t[60]!==k||t[61]!==A||t[62]!==j?(M=(0,$.jsxs)(`div`,{className:`mt-2 flex flex-wrap gap-1`,children:[T,O,k,A,j]}),t[58]=T,t[59]=O,t[60]=k,t[61]=A,t[62]=j,t[63]=M):M=t[63];let N;return t[64]!==S||t[65]!==l||t[66]!==M?(N=(0,$.jsxs)(`div`,{className:l,children:[S,M]}),t[64]=S,t[65]=l,t[66]=M,t[67]=N):N=t[67],N}function Zt(e){return e<1024?`${e} B`:e<1048576?`${(e/1024).toFixed(1)} KB`:`${(e/1048576).toFixed(1)} MB`}var Qt={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:`撤销`},$t={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`},en=e(n(),1);function tn({noteId:e,selection:t,zh:n,onDismiss:r,onAsk:i}){let[a,o]=(0,Q.useState)(null),[s,c]=(0,Q.useState)(!1),[l,d]=(0,Q.useState)(``),[f,m]=(0,Q.useState)(!1),h=(0,Q.useRef)(null),g=(0,Q.useRef)(null),[_,v]=(0,Q.useState)({left:8,top:8}),y=s||a!==null||!!l,b=t.text.length>16e3;function x(){h.current?.abort(),r(),t.restore()}(0,Q.useEffect)(()=>{o(null),c(!1),d(``),m(!1);let e=e=>{g.current?.contains(e.target)||r()},n=e=>{e.key===`Escape`&&(e.preventDefault(),r(),t.restore())},i=e=>{!g.current?.contains(e.target)&&!h.current&&!g.current?.contains(document.activeElement)&&r()};return document.addEventListener(`pointerdown`,e),document.addEventListener(`keydown`,n),window.addEventListener(`resize`,r),window.addEventListener(`scroll`,i,!0),()=>{h.current?.abort(),h.current=null,document.removeEventListener(`pointerdown`,e),document.removeEventListener(`keydown`,n),window.removeEventListener(`resize`,r),window.removeEventListener(`scroll`,i,!0)}},[t,r]),(0,Q.useLayoutEffect)(()=>{let e=g.current?.getBoundingClientRect();if(!e)return;let n=Math.max(8,Math.min(t.rect.left,window.innerWidth-e.width-8)),r=t.rect.bottom+8,i=r+e.height<=window.innerHeight-8?r:Math.max(8,t.rect.top-e.height-8);v({left:n,top:i})},[t,y,a,l]);async function S(r){h.current?.abort();let i=new AbortController;h.current=i,c(!0),d(``),o(null),m(!1);try{let a=await p(u(`/api/notes/${encodeURIComponent(e)}/ai/edit`),{method:`POST`,signal:i.signal,body:JSON.stringify({instruction:r,markdown:t.text})});if(i.signal.aborted)return;let s=a.patch.operations.filter(e=>e.type===`replaceRange`).map(e=>e.markdown??``).join(`
|
|
3
|
+
|
|
4
|
+
`);if(!s.trim())throw Error(n?`没有可用结果,请重试。`:`No result available. Try again.`);o(s)}catch(e){i.signal.aborted||d(e instanceof Error?e.message:String(e))}finally{i.signal.aborted||(c(!1),h.current=null)}}return(0,en.createPortal)((0,$.jsxs)(`div`,{ref:g,role:`region`,"data-note-selection-actions":!0,"aria-keyshortcuts":`Alt+Enter`,"aria-label":n?`笔记选段操作`:`Note selection actions`,className:`fixed z-[80] flex max-h-[calc(100dvh-1rem)] max-w-[calc(100vw-1rem)] flex-col overflow-hidden rounded-xl border border-edge bg-surface-overlay text-fg shadow-popover ${y?`w-96`:``}`,style:_,onPointerDown:e=>{e.target.closest(`button`)&&e.preventDefault()},children:[(0,$.jsxs)(`div`,{role:`group`,"aria-label":n?`选段操作`:`Selection actions`,className:`flex shrink-0 flex-wrap items-center gap-1 p-1`,children:[(0,$.jsx)(J,{variant:`ghost`,className:`text-xs`,disabled:s||b,onClick:()=>void S(`summary`),children:n?`摘要预览`:`Summary`}),(0,$.jsx)(J,{variant:`ghost`,className:`text-xs`,disabled:s||b,onClick:()=>void S(`todo`),children:n?`提取待办`:`Extract to-dos`}),(0,$.jsx)(J,{variant:`ghost`,className:`text-xs`,disabled:s||b,onClick:()=>i(t.text),children:n?`引用提问`:`Ask about selection`}),(0,$.jsx)(`button`,{type:`button`,className:`inline-flex size-9 items-center justify-center rounded-lg hover:bg-surface-hover focus-visible:ring-2 focus-visible:ring-accent`,"aria-label":n?`关闭选段操作`:`Close selection actions`,onClick:x,children:(0,$.jsx)(qe,{className:`size-4`})})]}),b?(0,$.jsx)(`p`,{className:`px-3 pb-3 text-xs text-fg-muted`,children:n?`请选择不超过 16000 字的片段。`:`Select up to 16,000 characters.`}):null,y?(0,$.jsxs)($.Fragment,{children:[(0,$.jsxs)(`div`,{className:`min-h-0 flex-1 overflow-y-auto border-t border-edge-subtle p-3`,children:[(0,$.jsx)(`p`,{className:`mb-3 text-xs text-fg-muted`,children:n?`按选段生成的本地整理预览,尚未写入笔记。`:`Local preview of the selection. Your note is unchanged.`}),s?(0,$.jsxs)(`div`,{"aria-busy":`true`,className:`space-y-2`,children:[(0,$.jsx)(q,{className:`h-4 w-full`}),(0,$.jsx)(q,{className:`h-4 w-2/3`})]}):null,a===null?null:(0,$.jsx)(`pre`,{className:`whitespace-pre-wrap break-words font-sans text-sm leading-6`,children:a}),l?(0,$.jsx)(`p`,{role:`alert`,className:`text-xs text-danger`,children:l}):null]}),a===null?null:(0,$.jsxs)(`div`,{className:`flex shrink-0 justify-end gap-2 border-t border-edge-subtle p-2`,children:[(0,$.jsx)(J,{variant:`ghost`,onClick:()=>void Xe(a).then(e=>{m(e),e||d(n?`复制失败,请重试。`:`Copy failed. Try again.`)}),children:f?n?`已复制`:`Copied`:n?`复制结果`:`Copy`}),(0,$.jsx)(J,{variant:`primary`,onClick:()=>{t.insertAfter(a)?r():d(n?`正文已变化,请重新选择片段后再整理。`:`The note changed. Select the passage again.`)},children:n?`插入选段后`:`Insert after selection`})]})]}):null]}),document.body)}function nn(e){let t=(0,mt.c)(18),{input:n,labels:r,showLabel:i}=e,a=i===void 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=te(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=te(u),f=te(rn),p;t[6]!==n||t[7]!==r||t[8]!==d||t[9]!==a?(p=(0,$.jsx)(I,{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,$.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,$.jsx)(G,{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,$.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 rn(e){return e.stop}function an(e,t){let n=re(t.replace(/^\s*(`{3,}|~{3,})[^\n]*$/gm,``).replace(/xopc-attachment:\/\/[^\s)]+/g,``).replace(/^(\s*[-*+]\s+)\[[ xX]\]\s*/gm,`$1`)),r=re(e);return!r||n.split(`
|
|
5
|
+
`)[0]===r?n:[r,n].filter(Boolean).join(`
|
|
6
|
+
|
|
7
|
+
`)}var on=()=>a(()=>import(`./block-editor-BY1Mb-WW.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])),sn=()=>a(()=>import(`./markdown-editor-CjQJ-Nho.js`),__vite__mapDeps([45,1,2,41,46,17])),cn=(0,Q.lazy)(()=>a(()=>import(`./chat-page-C3ttsYGZ.js`).then(e=>e.n).then(e=>({default:e.ChatPage})),__vite__mapDeps([47,1,2,17,16,3,4,11,12,13,6,48,49,50,51,52,53,54,55,56,57,58,9,10,14,15,18,19,20,21,22,23,24,25,26,27,28,29,30,31,7,8,32,34,59,36,38,60,61,62,63,64,65,39,66,67,68,69,70,71,72,73,74,75,76,77,78,40,79,80,81,82,83,84,85,86,87,88,89,90,91,92,93,94,95,96,97,37,98,99,100,101,102,103,104,105,106,107,108,109,110,111,112,113,114,115,116,117,118,119,120,33,121,35,122,123,124,125,126,127,128,129,130,131,132,133,134,135,136,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,160,161,162,163,164,165,166,167,168,169,170,171,172,173,174,175,176,177,178,179,180,181,182,183,184,185,186,187,188,189,190,191,192,193,194,195,196,197,198,199,200,201,202]))),ln=(0,Q.lazy)(()=>on().then(e=>({default:e.BlockEditor}))),un=(0,Q.lazy)(()=>sn().then(e=>({default:e.MarkdownEditor})));function dn(){let e=(0,mt.c)(1),t;return e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,$.jsxs)(`div`,{className:`flex h-full min-h-0 flex-col px-6 py-4`,"aria-busy":!0,children:[(0,$.jsx)(`div`,{className:`h-8 w-56 max-w-full animate-pulse rounded-md bg-surface-hover`}),(0,$.jsx)(`div`,{className:`mt-6 h-4 w-11/12 animate-pulse rounded bg-surface-hover`}),(0,$.jsx)(`div`,{className:`mt-3 h-4 w-9/12 animate-pulse rounded bg-surface-hover`}),(0,$.jsx)(`div`,{className:`mt-3 h-4 w-10/12 animate-pulse rounded bg-surface-hover`})]}),e[0]=t):t=e[0],t}function fn(e){let t=(0,mt.c)(29),{mode:n,onModeChange:r,labels:i}=e,a;t[0]===i.edit?a=t[1]:(a={id:`wysiwyg`,label:i.edit,Icon:he},t[0]=i.edit,t[1]=a);let o;t[2]===i.source?o=t[3]:(o={id:`source`,label:i.source,Icon:ue},t[2]=i.source,t[3]=o);let s;t[4]===i.preview?s=t[5]:(s={id:`preview`,label:i.preview,Icon:H},t[4]=i.preview,t[5]=s);let c;t[6]!==a||t[7]!==o||t[8]!==s?(c=[a,o,s],t[6]=a,t[7]=o,t[8]=s,t[9]=c):c=t[9];let l=c,u;t[10]!==n||t[11]!==l?(u=l.find(e=>e.id===n)??l[0],t[10]=n,t[11]=l,t[12]=u):u=t[12];let d=u,f=d.Icon,p=pn,m;t[13]===f?m=t[14]:(m=(0,$.jsx)(f,{className:`size-3.5`,"aria-hidden":!0}),t[13]=f,t[14]=m);let h;t[15]===d.label?h=t[16]:(h=(0,$.jsx)(`span`,{children:d.label}),t[15]=d.label,t[16]=h);let g;t[17]===Symbol.for(`react.memo_cache_sentinel`)?(g=(0,$.jsx)(se,{className:`size-3 text-fg-subtle`,"aria-hidden":!0}),t[17]=g):g=t[17];let _;t[18]!==d.label||t[19]!==m||t[20]!==h?(_=(0,$.jsx)(ot,{asChild:!0,children:(0,$.jsxs)(`button`,{type:`button`,"aria-label":d.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:[m,h,g]})}),t[18]=d.label,t[19]=m,t[20]=h,t[21]=_):_=t[21];let v;t[22]!==n||t[23]!==l||t[24]!==r?(v=(0,$.jsx)(st,{children:(0,$.jsx)(lt,{align:`end`,sideOffset:6,className:`z-50 min-w-36 rounded-xl border border-edge bg-surface-overlay p-1 shadow-popover`,children:l.map(e=>{let{id:t,label:i,Icon:a}=e;return(0,$.jsxs)(ct,{onSelect:()=>r(t),onPointerMove:()=>p(t),onFocus:()=>p(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,$.jsx)(a,{className:`size-4 text-fg-muted`,"aria-hidden":!0}),(0,$.jsx)(`span`,{className:`flex-1`,children:i}),n===t?(0,$.jsx)(oe,{className:`size-4 text-accent`,"aria-hidden":!0}):null]},t)})})}),t[22]=n,t[23]=l,t[24]=r,t[25]=v):v=t[25];let y;return t[26]!==v||t[27]!==_?(y=(0,$.jsxs)(at,{modal:!1,children:[_,v]}),t[26]=v,t[27]=_,t[28]=y):y=t[28],y}function pn(e){e===`wysiwyg`&&on(),e===`source`&&sn()}function mn(e){let t=(0,mt.c)(16),{noteId:n,onBack:r,onSaved:i,showBackButton:a,backButtonClassName:o,clearHeaderOnCleanup:s,onOpenSearch:c,autoFocus:l,initialMode:u,onAutoFocusConsumed:d}=e,p=a===void 0||a,m=s===void 0||s,g=l!==void 0&&l,_=f(hn),v;t[0]===_?v=t[1]:(v=h(_),t[0]=_,t[1]=v);let y=v.notes.lightboxClose,b;t[2]!==g||t[3]!==o||t[4]!==m||t[5]!==u||t[6]!==n||t[7]!==d||t[8]!==r||t[9]!==c||t[10]!==i||t[11]!==p?(b=(0,$.jsx)(gn,{noteId:n,onBack:r,onSaved:i,showBackButton:p,backButtonClassName:o,clearHeaderOnCleanup:m,onOpenSearch:c,autoFocus:g,initialMode:u,onAutoFocusConsumed:d}),t[2]=g,t[3]=o,t[4]=m,t[5]=u,t[6]=n,t[7]=d,t[8]=r,t[9]=c,t[10]=i,t[11]=p,t[12]=b):b=t[12];let x;return t[13]!==y||t[14]!==b?(x=(0,$.jsx)(be,{closeLabel:y,children:b}),t[13]=y,t[14]=b,t[15]=x):x=t[15],x}function hn(e){return e.language}function gn({noteId:e,onBack:t,onSaved:n,showBackButton:r=!0,backButtonClassName:i,clearHeaderOnCleanup:a=!0,onOpenSearch:o,autoFocus:s=!1,initialMode:l=`wysiwyg`,onAutoFocusConsumed:u}){let p=f(e=>e.language),m=h(p).notes,g=h(p).chat.pageContext,_=h(p).automations.suggestions,{data:v}=Ye([`note-discussion-document`,e],()=>E(e)),[y,b]=(0,Q.useState)(!0),[x,S]=(0,Q.useState)(null),C=(0,Q.useCallback)(()=>S(null),[]);(0,Q.useEffect)(()=>{S(null)},[e]);let w=c(),T=Ze(e=>e.resolved)===`dark`,{openImage:D}=ve(),[O,k]=(0,Q.useState)(l);(0,Q.useEffect)(()=>{S(null)},[O,y]);let[A,j]=(0,Q.useState)(null),[M,N]=(0,Q.useState)(null),[P,I]=(0,Q.useState)(!1),[z,B]=(0,Q.useState)(``),[ee,ne]=(0,Q.useState)(360),[re,ae]=(0,Q.useState)(!1),[se,ce]=(0,Q.useState)(!1),[V,le]=(0,Q.useState)(!1),[ue,de]=(0,Q.useState)(!1),[fe,me]=(0,Q.useState)(null),H=(0,Q.useRef)(0),[ge,be]=(0,Q.useState)(null),xe=d(e=>e.baseUrl),Se=d(e=>e.conversationId),we=fe?.noteId===e&&fe.gatewayUrl===xe&&fe.gatewayToken===Se?fe.conversationId:null;(0,Q.useEffect)(()=>(H.current++,de(!1),me(null),le(!1),be(null),b(!0),()=>{H.current++}),[e,xe,Se]);let Ee=(0,Q.useRef)(0);(0,Q.useEffect)(()=>()=>{Ee.current+=1},[e]);let[De,W]=(0,Q.useState)(null),[ke,je]=(0,Q.useState)(!1),[Pe,Fe]=(0,Q.useState)(null),[Ie,Le]=(0,Q.useState)(!1),[ze,Be]=(0,Q.useState)(!1),Ve=(0,Q.useRef)(!1),Ue=(0,Q.useRef)(null),Ge=(0,Q.useRef)(null),G=(0,Q.useRef)(null),q=(0,Q.useRef)(null),J=(0,Q.useRef)(void 0),Xe=(0,Q.useRef)(null),X=(0,Q.useRef)(null),et=(0,Q.useRef)(null),tt=(0,Q.useRef)(null),nt=(0,Q.useRef)(null),rt=Qe(e=>e.setPageHeader),it=Qe(e=>e.clearPageHeader),{data:Z,mutate:pt,error:mt}=Ye(e?[`note-detail`,e]:null,()=>Te(e)),{data:ht=[],mutate:gt}=Ye(e?[`note-threads`,e]:null,()=>Oe(e),{revalidateOnFocus:!1}),_t=M!==null,vt=(0,Q.useCallback)(e=>{W(`${m.refreshFailed}: ${e instanceof Error?e.message:m.quickCaptureFailedHint}`)},[m.quickCaptureFailedHint,m.refreshFailed]);(0,Q.useEffect)(()=>{if(!e)return;let t=t=>{t.detail?.noteId===e&&pt().catch(vt)};return window.addEventListener(`note-updated`,t),()=>window.removeEventListener(`note-updated`,t)},[pt,e,vt]),(0,Q.useEffect)(()=>{B(``),N(null),j(null),Ve.current=!1,nt.current=null},[e]),(0,Q.useEffect)(()=>{!Z||P||q.current!==null||Ve.current||B(Z.title??``)},[Z,P]),(0,Q.useEffect)(()=>{if(!s||!Z||_t||nt.current===e)return;let t=window.requestAnimationFrame(()=>{tt.current?.focus(),u?.()});return nt.current=e,()=>window.cancelAnimationFrame(t)},[s,_t,Z,e,u]);let yt=Z?new Date(Z.createdAt).toLocaleString(void 0,{year:`numeric`,month:`short`,day:`numeric`,hour:`2-digit`,minute:`2-digit`}):``,bt=(0,Q.useMemo)(()=>r?(0,$.jsx)(`button`,{type:`button`,onClick:t,"aria-label":m.back,className:K(`rounded-lg p-1.5 text-fg-muted transition-colors hover:bg-surface-hover hover:text-fg`,Y,i),children:(0,$.jsx)(F,{className:`size-4`,"aria-hidden":!0})}):null,[i,m.back,t,r]),xt=(0,Q.useCallback)(()=>{let t=te.getState();t.source?.type===`note`&&t.source.id===e&&t.stop()},[e]),Ct=(0,Q.useCallback)(e=>{e!==`preview`&&xt(),k(e)},[xt]);(0,Q.useEffect)(()=>{!P&&G.current===null&&q.current===null&&(J.current=Z?.remoteVersion??1)},[e,Z?.remoteVersion,P]);let wt=(0,Q.useCallback)(async t=>{let n=J.current??Z?.remoteVersion??1,r=await _e(e,t,n);return J.current===n&&(J.current=r.remoteVersion??n+1),r},[e,Z?.remoteVersion]),Tt=(0,Q.useCallback)(t=>{xt(),B(t),e&&(q.current=t,Ge.current&&clearTimeout(Ge.current),Ge.current=setTimeout(async()=>{let e=q.current;if(q.current=null,e!==null){I(!0);try{await wt({title:e}),await pt(),n?.()}catch(t){q.current===null&&(q.current=e),W(`${m.saveFailed}: ${t instanceof Error?t.message:m.saveFailedHint}`)}finally{I(!1)}}},600))},[xt,e,pt,n,wt,m.saveFailed,m.saveFailedHint]),Et=(0,Q.useMemo)(()=>(0,$.jsxs)(`div`,{className:K(`flex min-w-0 items-center gap-2`,Y),children:[(0,$.jsx)(`span`,{className:`min-w-0 truncate text-sm font-medium text-fg`,title:z||yt||void 0,children:z||yt}),P?(0,$.jsx)(`span`,{className:`shrink-0 text-xs text-fg-muted opacity-60`,children:m.saving}):null]}),[m.saving,P,yt,z]),Dt=(0,Q.useCallback)(async()=>{ce(!0),W(null);try{await Ae(e),await pt()}catch(e){W(`${m.catalysisFailed}: ${e instanceof Error?e.message:m.chatOpenFailedMessage}`)}finally{ce(!1)}},[pt,e]),Ot=(0,Q.useCallback)(()=>{de(!1),j(A===`breakdown`?null:`breakdown`),!Z?.aiDeep?.catalysis?.report&&!se&&Dt()},[A,se,Dt,Z?.aiDeep?.catalysis?.report]),kt=(0,Q.useCallback)(()=>{let t=M?M.markdown??``:G.current??Z?.markdown??``,n=M?M.title??``:z,r=an(n,t);return{source:{type:`note`,id:e,title:n||m.titlePlaceholder},text:r,language:L(r,p)}},[p,m.titlePlaceholder,Z?.markdown,e,M,z]),At=(0,Q.useCallback)(async()=>{Ue.current&&clearTimeout(Ue.current),Ge.current&&clearTimeout(Ge.current),Ue.current=null,Ge.current=null;let e=G.current,t=q.current;G.current=null,q.current=null;let r={};if(e!==null&&(r.markdown=e),t!==null&&(r.title=t),Object.keys(r).length===0)return Z??null;I(!0);try{let e=await wt(r);return await pt(e,{revalidate:!1}),n?.(),e}catch(n){return G.current===null&&(G.current=e),q.current===null&&(q.current=t),W(`${m.saveFailed}: ${n instanceof Error?n.message:m.saveFailedHint}`),null}finally{I(!1)}},[pt,m.saveFailed,m.saveFailedHint,Z,n,wt]),jt=(0,Q.useCallback)(async()=>P?(W(p===`zh`?`笔记正在保存,请稍后发送。`:`The note is saving. Please send again shortly.`),!1):!!await At()&&G.current===null&&q.current===null,[P,p,At]),Mt=(0,Q.useCallback)(async(t=!1)=>{if(j(null),de(!0),V||!t&&we)return;let n=++H.current;le(!0),W(null);try{if(!await jt())return;let r=await Ce(e,{forceNew:t});if(n!==H.current)return;me({noteId:e,gatewayUrl:xe,gatewayToken:Se,conversationId:r.conversationId}),await pt(),await gt()}catch(e){n===H.current&&W(`${m.chatOpenFailedTitle}: ${e instanceof Error?e.message:m.chatOpenFailedMessage}`)}finally{n===H.current&&le(!1)}},[V,we,jt,pt,gt,e,xe,Se,m.chatOpenFailedMessage,m.chatOpenFailedTitle]),Nt=(0,Q.useCallback)(async e=>{if(!Z||V||P)return;le(!0),W(null);let t=d.getState(),n=++Ee.current,r=()=>Ee.current===n&&d.getState().baseUrl===t.baseUrl&&d.getState().conversationId===t.conversationId;try{let n=window.getSelection(),i=e??(n?.anchorNode&&n.focusNode&&Xe.current?.contains(n.anchorNode)&&Xe.current.contains(n.focusNode)?n.toString():``),a=await At();if(!a||!r())return;if(G.current!==null||q.current!==null)throw Error(g.unavailable);let o=dt.capture({title:a.title||a.id,text:a.markdown,resourceRefs:[{kind:`note`,id:a.id,revision:String(a.remoteVersion??1)}],selection:i?{text:i,draft:!1}:void 0}),s=await new Je().createSession();if(!r())return;if(G.current!==null||q.current!==null)throw Error(g.unavailable);let c=ft(t.baseUrl,t.conversationId,s.key);if(!dt.put(c,o))throw Error(g.unavailable);w(`/chat/${encodeURIComponent(s.key)}`)}catch{r()&&W(g.unavailable)}finally{Ee.current===n&&le(!1)}},[Z,V,P,At,w,g.unavailable]),Pt=(0,Q.useCallback)(async()=>{W(null);let e=await At();e&&(Fe(e),je(!0))},[At]),Ft=(0,Q.useCallback)(async()=>{if(!(ze||P)){Le(!1),Be(!0),W(null),xt(),Ue.current&&clearTimeout(Ue.current),Ge.current&&clearTimeout(Ge.current),Ue.current=null,Ge.current=null,G.current=null,q.current=null;try{await Me(e),window.dispatchEvent(new CustomEvent(`note-deleted`,{detail:{noteId:e}})),n?.(),t()}catch(e){W(`${m.deleteFailed}: ${e instanceof Error?e.message:m.quickCaptureFailedHint}`)}finally{Be(!1)}}},[ze,m.deleteFailed,m.quickCaptureFailedHint,e,t,n,P,xt]),It=(0,Q.useMemo)(()=>(0,$.jsxs)(`div`,{className:K(`flex min-w-0 items-center gap-1 sm:gap-2`,Y),children:[o?(0,$.jsx)(`button`,{type:`button`,onClick:o,"aria-label":m.searchDialogTitle,className:`rounded-lg p-1.5 text-fg-muted transition-colors hover:bg-surface-hover hover:text-fg focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,children:(0,$.jsx)(He,{className:`size-4`,"aria-hidden":!0})}):null,(0,$.jsx)(nn,{input:kt,showLabel:!1,labels:{read:m.readAloud,preparing:m.readAloudPreparing,pause:m.readAloudPause,resume:m.readAloudResume,retry:m.readAloudRetry,stop:m.readAloudStop}}),(0,$.jsxs)(`button`,{type:`button`,onClick:Ot,disabled:se,"aria-label":m.catalysisSectionTitle,className:K(`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,$.jsx)(We,{className:`size-3.5`,"aria-hidden":!0}),(0,$.jsx)(`span`,{className:`hidden sm:inline`,children:se?m.catalyzing:m.catalyzeButton})]}),(0,$.jsxs)(`button`,{type:`button`,onClick:()=>Mt(!1),"aria-label":m.openChatButton,disabled:V,className:K(`inline-flex items-center gap-1.5 rounded-lg px-2.5 py-1.5 text-xs font-medium transition-colors`,`border border-edge text-fg-muted hover:bg-surface-hover hover:text-fg disabled:cursor-not-allowed disabled:opacity-50`),children:[(0,$.jsx)(Re,{className:`size-3.5`,"aria-hidden":!0}),(0,$.jsx)(`span`,{className:`hidden sm:inline`,children:V?m.openingChat:m.openChatButton})]}),(0,$.jsx)(fn,{mode:O,onModeChange:Ct,labels:{edit:m.modeEdit,source:m.modeSource,preview:m.modePreview}}),(0,$.jsxs)(`button`,{type:`button`,onClick:()=>void Nt(),disabled:V||P||!Z||!!M,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,$.jsx)(he,{className:`size-3.5`,"aria-hidden":!0}),g.capture]}),(0,$.jsxs)(at,{modal:!1,children:[(0,$.jsx)(ot,{asChild:!0,children:(0,$.jsx)(`button`,{type:`button`,"aria-label":m.noteActions,title:m.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,$.jsx)(pe,{className:`size-4`,"aria-hidden":!0})})}),(0,$.jsx)(st,{children:(0,$.jsxs)(lt,{align:`end`,sideOffset:6,className:`z-50 min-w-40 rounded-xl border border-edge bg-surface-overlay p-1 shadow-popover`,children:[(0,$.jsxs)(ct,{onSelect:()=>void Pt(),className:`flex cursor-pointer items-center gap-2 rounded-lg px-3 py-2 text-sm text-fg outline-none hover:bg-surface-hover focus:bg-surface-hover`,children:[(0,$.jsx)(R,{className:`size-4 text-fg-muted`,"aria-hidden":!0}),p===`zh`?`分享`:`Share`]}),(0,$.jsxs)(ct,{onSelect:()=>{de(!1),j(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,$.jsx)(U,{className:`size-4 text-fg-muted`,"aria-hidden":!0}),(0,$.jsx)(`span`,{className:`flex-1`,children:m.history}),A===`history`?(0,$.jsx)(oe,{className:`size-4 text-accent`,"aria-hidden":!0}):null]}),(0,$.jsx)(ut,{className:`my-1 h-px bg-edge-subtle`}),(0,$.jsxs)(ct,{disabled:ze||P,onSelect:()=>Le(!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,$.jsx)(Ke,{className:`size-4`,"aria-hidden":!0}),m.delete]})]})})]})]}),[se,Ot,Mt,Nt,g.capture,Z,M,O,m.history,m.modeEdit,m.modePreview,m.modeSource,V,A,o,m.searchDialogTitle,m.readAloud,m.readAloudPause,m.readAloudPreparing,m.readAloudResume,m.readAloudRetry,m.readAloudStop,Ct,kt,Pt,ze,P,p,m.delete,Le]);(0,Q.useLayoutEffect)(()=>(rt({startExtra:bt,main:Z&&!v?Et:null,end:Z&&!v?It:null}),()=>{a&&it()}),[a,it,It,Et,bt,v,y,Z,rt]);let Lt=(0,Q.useCallback)(t=>{e&&(xt(),G.current=t,Ue.current&&clearTimeout(Ue.current),Ue.current=setTimeout(async()=>{let e=G.current;if(G.current=null,e!==null){I(!0),W(null);try{await wt({markdown:e}),await pt(),n?.()}catch(t){G.current===null&&(G.current=e),W(`${m.saveFailed}: ${t instanceof Error?t.message:m.saveFailedHint}`)}finally{I(!1)}}},600))},[xt,e,pt,m.saveFailed,m.saveFailedHint,n,wt]),Rt=(0,Q.useCallback)(t=>{Ne(e,t.timestamp).then(e=>{e&&(xt(),N(e))})},[e,xt]),zt=(0,Q.useCallback)(()=>{xt(),j(null),N(null)},[xt]),Bt=(0,Q.useCallback)(()=>{xt(),j(null),N(null),pt().catch(vt),n?.()},[pt,n,vt,xt]);if((0,Q.useEffect)(()=>()=>{Ue.current&&clearTimeout(Ue.current),Ge.current&&clearTimeout(Ge.current);let t=G.current,n=q.current;G.current=null,q.current=null;let r={};t!==null&&(r.markdown=t),n!==null&&(r.title=n),Object.keys(r).length>0&&_e(e,r,J.current).catch(()=>void 0)},[e]),Z===void 0)return mt?(0,$.jsxs)(`div`,{className:`flex flex-1 flex-col items-center justify-center gap-3 p-6 text-center`,role:`alert`,children:[(0,$.jsx)(`p`,{className:`text-sm text-danger`,children:m.home.loadFailed}),(0,$.jsx)(`button`,{type:`button`,onClick:()=>void pt().catch(vt),className:`rounded-lg border border-edge px-3 py-2 text-sm text-fg hover:bg-surface-hover`,children:m.home.retry}),(0,$.jsx)(`button`,{type:`button`,onClick:t,className:`text-sm text-fg-muted hover:text-fg`,children:m.back})]}):(0,$.jsx)(dn,{});if(Z===null)return(0,$.jsxs)(`div`,{className:`flex flex-1 flex-col items-center justify-center gap-3 text-center`,children:[(0,$.jsx)(`div`,{className:`text-sm font-medium text-fg`,children:m.notFoundTitle}),(0,$.jsx)(`p`,{className:`text-sm text-fg-muted`,children:m.notFoundDescription}),(0,$.jsx)(`button`,{type:`button`,onClick:t,className:`rounded-lg border border-edge px-3 py-1.5 text-sm font-medium text-fg-muted transition-colors hover:bg-surface-hover hover:text-fg`,children:m.back})]});let Vt=_t?M.title??``:z,Ut=_t?M.markdown??``:G.current??Z.markdown??``,Wt=new Date(Z.createdAt).getTime(),qt=Number.isFinite(Wt)&&Date.now()-Wt<3600*1e3?(0,$.jsx)(St,{title:_.noteCreatedTitle,description:_.noteCreatedDescription,prompt:_.noteCreatedPrompt,coverage:{eventType:`note.created`,source:`notes`,eventPayload:{noteId:e}},variant:`titleAction`,className:`ml-3 hidden max-w-[18rem] shrink-0 md:flex`}):null,Yt=(0,$.jsxs)(`div`,{className:`flex h-full min-h-0 flex-col`,children:[v?(0,$.jsx)(`div`,{className:`flex shrink-0 items-center justify-end px-4 py-1`,children:(0,$.jsx)(fn,{mode:O,onModeChange:Ct,labels:{edit:m.modeEdit,source:m.modeSource,preview:m.modePreview}})}):null,(0,$.jsx)(`div`,{className:`h-full min-h-0 min-w-0 flex-1`,children:_t?(0,$.jsxs)(`div`,{className:`h-full overflow-y-auto px-4 py-4 sm:px-6`,children:[Vt&&(0,$.jsx)(`h1`,{className:`mb-4 text-2xl font-bold text-fg/70`,children:Vt}),Ut?(0,$.jsx)(ye,{noteId:e,content:Ut,className:`opacity-80`}):(0,$.jsx)(`p`,{className:`italic text-fg-muted`,children:m.emptyPreview})]}):(0,$.jsxs)($.Fragment,{children:[O===`wysiwyg`&&(0,$.jsxs)(`div`,{className:`flex h-full flex-col`,children:[(0,$.jsxs)(`div`,{className:`flex shrink-0 items-start px-6 pt-4`,children:[(0,$.jsx)(`input`,{ref:tt,type:`text`,value:z,onChange:e=>Tt(e.target.value),onCompositionStart:()=>{Ve.current=!0},onCompositionEnd:()=>{Ve.current=!1},onKeyDown:e=>{let t=e.nativeEvent;e.key===`Enter`&&!Ve.current&&!t.isComposing&&(e.preventDefault(),(Xe.current?.querySelector(`.ProseMirror`))?.focus())},placeholder:m.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`}),qt]}),(0,$.jsx)(`div`,{className:`min-h-0 flex-1`,children:(0,$.jsx)(Q.Suspense,{fallback:(0,$.jsx)(dn,{}),children:(0,$.jsx)(ln,{initialContent:Z.markdown??``,onChange:Lt,noteId:e,onTextSelection:S},`wysiwyg-${e}`)})})]}),O===`source`&&(0,$.jsxs)(`div`,{className:`flex h-full flex-col`,children:[(0,$.jsxs)(`div`,{className:`flex shrink-0 items-start px-6 pt-4`,children:[(0,$.jsx)(`input`,{ref:tt,type:`text`,value:z,onChange:e=>Tt(e.target.value),placeholder:m.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`}),qt]}),(0,$.jsx)(`div`,{className:`min-h-0 flex-1`,children:(0,$.jsx)(Q.Suspense,{fallback:(0,$.jsx)(dn,{}),children:(0,$.jsx)(un,{initialContent:Z.markdown??``,onChange:Lt,isDark:T,onTextSelection:S},`source-${e}`)})})]}),O===`preview`&&(0,$.jsxs)(`div`,{className:`h-full overflow-y-auto px-4 py-4 sm:px-6`,onClick:e=>{let t=e.target;t instanceof HTMLImageElement&&D(t.currentSrc||t.src,t.alt)},children:[z&&!Z.markdown.trimStart().startsWith(`# ${z.trim()}\n`)&&Z.markdown.trim()!==`# ${z.trim()}`&&(0,$.jsx)(`h1`,{className:`mb-4 text-2xl font-bold text-fg`,children:z}),Z.markdown?(0,$.jsx)(ye,{noteId:e,content:Z.markdown,className:`[&_img]:cursor-zoom-in`}):(0,$.jsx)(`p`,{className:`italic text-fg-muted`,children:m.emptyPreview})]})]})})]});return(0,$.jsxs)($.Fragment,{children:[x&&!_t&&!(v&&y)&&O!==`preview`?(0,$.jsx)(tn,{noteId:e,selection:x,zh:p===`zh`,onDismiss:C,onAsk:e=>{be({id:Date.now(),text:p===`zh`?`请帮我分析或改写下面这段笔记:\n\n${e}`:`Help me analyze or rewrite this note selection:\n\n${e}`}),C(),Mt()}},`${e}:${O}`):null,(0,$.jsxs)(`div`,{className:`@container/note flex h-full min-h-0 min-w-0 gap-3 p-3 sm:p-4`,children:[(0,$.jsxs)(`div`,{className:K(`mx-auto min-h-0 min-w-0 w-full flex-1 flex-col`,ue||A?`hidden @min-[56rem]/note:flex`:`flex`,!v&&`max-w-[60rem]`),children:[De?(0,$.jsx)(`p`,{className:`mb-3 shrink-0 rounded-lg border border-danger/25 bg-danger-soft px-3 py-2 text-sm text-danger`,role:`alert`,children:De}):null,(0,$.jsx)(ie,{eventType:`note.created`,source:`notes`,payloadKey:`noteId`,payloadValue:e,className:`mb-3 shrink-0`}),(0,$.jsx)(ie,{eventType:`note.updated`,source:`notes`,payloadKey:`noteId`,payloadValue:e,className:`mb-3 shrink-0`}),(0,$.jsxs)(`div`,{ref:Xe,onKeyDown:e=>{x&&e.altKey&&e.key===`Enter`&&(e.preventDefault(),document.querySelector(`[data-note-selection-actions] button:not(:disabled)`)?.focus())},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,$.jsx)(Ht,{personalNotes:Yt,personalNotesActive:!y,onMeetingContent:()=>b(!0),noteId:e,noteActions:{onAnalyze:Ot,chatOpen:ue,onChat:()=>{ue?de(!1):Mt(!1)},onShare:()=>{Pt()},onHistory:()=>{de(!1),j(A===`history`?null:`history`)},onDelete:()=>Le(!0),busy:ze||P||se||V},onPersonalNotes:()=>{b(!1),window.setTimeout(()=>tt.current?.focus(),0)}}):null,v?null:Yt]})]}),ue||we?(0,$.jsxs)(`aside`,{id:`note-assistant-${e}`,"aria-label":p===`zh`?`笔记 AI 对话`:`Note AI chat`,className:K(`min-h-0 min-w-0 shrink-0 flex-col overflow-hidden rounded-xl border border-edge-subtle bg-surface-panel`,ue?`flex w-full @min-[56rem]/note:w-[22rem] @min-[76rem]/note:w-[24rem]`:`hidden`),children:[(0,$.jsxs)(`header`,{className:`flex shrink-0 items-center gap-2 border-b border-edge-subtle px-4 py-2`,children:[(0,$.jsx)(Re,{className:`size-4 text-accent-fg`,"aria-hidden":!0}),(0,$.jsx)(`h2`,{className:`flex-1 text-sm font-medium`,children:p===`zh`?`AI 对话`:`AI chat`}),(0,$.jsx)(`button`,{type:`button`,className:`inline-flex size-11 items-center justify-center rounded-lg text-fg-muted hover:bg-surface-hover focus-visible:ring-2 focus-visible:ring-accent`,"aria-label":p===`zh`?`收起 AI 对话`:`Close AI chat`,onClick:()=>{de(!1),window.requestAnimationFrame(()=>document.querySelector(`[aria-controls="note-assistant-${e}"]`)?.focus({preventScroll:!0}))},children:(0,$.jsx)(qe,{className:`size-4`})})]}),(0,$.jsx)(`p`,{className:`shrink-0 border-b border-edge-subtle px-4 py-3 text-xs leading-5 text-fg-muted`,children:p===`zh`?`已关联当前笔记。可提问、改写我的笔记,也可将回答保存回笔记。`:`Linked to this note. Ask questions, edit My notes, or save an answer to the note.`}),De&&we?(0,$.jsx)(`p`,{role:`alert`,className:`shrink-0 px-4 py-2 text-xs text-danger`,children:De}):null,(0,$.jsx)(`div`,{className:`flex min-h-0 min-w-0 flex-1 flex-col`,children:we?(0,$.jsx)(Q.Suspense,{fallback:(0,$.jsx)(dn,{}),children:(0,$.jsx)(cn,{embedded:!0,sourceNoteInView:!0,conversationId:we,draftSeed:ge,beforeSend:jt},`${e}:${we}`)}):V?(0,$.jsx)(dn,{}):(0,$.jsxs)(`div`,{className:`space-y-3 p-4 text-sm`,children:[(0,$.jsx)(`p`,{className:`text-fg-muted`,children:De||(p===`zh`?`对话尚未打开,请重试。`:`Chat could not be opened. Try again.`)}),(0,$.jsx)(`button`,{type:`button`,className:`min-h-11 rounded-lg px-3 text-accent-fg hover:bg-surface-hover`,onClick:()=>void Mt(),children:p===`zh`?`重新打开`:`Try again`})]})})]}):null,(0,$.jsx)(`div`,{ref:X,className:K(`relative min-h-0 max-w-full shrink-0 flex-col overflow-hidden`,A?`flex`:`hidden`,!re&&`transition-[width] duration-300 ease-in-out`),style:{width:A?ee:0},children:(0,$.jsxs)(`div`,{ref:et,className:`flex min-h-0 flex-1 flex-col`,style:{width:ee},children:[(0,$.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=ee,i=e.pointerId,a=0,o=ee,s=ee,c=()=>{a=0,s=o,A&&X.current?.style.setProperty(`width`,`${s}px`),et.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),ne(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:K(`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`,re&&`before:!bg-edge/80 dark:before:!bg-edge/85`,`touch-none select-none`)}),(0,$.jsx)(`div`,{className:`flex min-h-0 flex-1 flex-col overflow-hidden rounded-xl border border-edge-subtle bg-surface-panel`,children:A===`history`?(0,$.jsx)(Gt,{noteId:e,activeTimestamp:M?.timestamp??null,onSelect:Rt,onClose:zt,onRestored:Bt}):A===`breakdown`?(0,$.jsx)(Kt,{noteId:e,note:Z??null,catalyzing:se,onCatalyze:Dt,onClose:()=>j(null),noteThreads:ht,openingChat:V,onOpenChat:()=>Mt(!1),onOpenNewChat:()=>Mt(!0)}):null})]})})]}),Pe?(0,$.jsx)(Jt,{open:ke,onOpenChange:je,note:Pe}):null,(0,$.jsx)($e,{open:Ie,title:m.deleteConfirmTitle,description:m.deleteConfirmDescription.replace(`{{title}}`,Z.title||m.titlePlaceholder),confirmLabel:m.deleteConfirmLabel,cancelLabel:m.deleteCancelLabel,destructive:!0,onConfirm:()=>void Ft(),onCancel:()=>Le(!1)})]})}export{yt as i,xt as n,bt as r,mn as t};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import"./notes-api-32qiHxz2.js";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{a as t,n,t as r}from"./vendor-react-BOUWij0V.js";import{a as i,i as a,l as o,n as s,o as c,p as l}from"./locale-store-Bld7_m-Q.js";import{t as u}from"./messages-CGO1P4mz.js";import{a as d,n as f,o as p,r as m,s as h,t as g}from"./dist-BGTk37IG.js";import{t as _}from"./createLucideIcon-DPHK1VkS.js";import{t as v}from"./download-Dk-ZjtO6.js";import{G as y,t as b}from"./markdown-view-B3cFKCfO.js";import{t as ee}from"./plus-Q2yW6OE7.js";import{t as te}from"./x-B_N4OPjy.js";import{t as x}from"./cn-0WouolD0.js";import{r as S,t as C}from"./chat-chart-block-DsaCatBN.js";var w=_(`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`}]]),T=_(`maximize`,[[`path`,{d:`M8 3H5a2 2 0 0 0-2 2v3`,key:`1dcmit`}],[`path`,{d:`M21 8V5a2 2 0 0 0-2-2h-3`,key:`1e4gt3`}],[`path`,{d:`M3 16v3a2 2 0 0 0 2 2h3`,key:`wsl5sc`}],[`path`,{d:`M16 21h3a2 2 0 0 0 2-2v-3`,key:`18trek`}]]),E=n(),D=e(t(),1),O=r(),k=(0,D.createContext)(null);function A(){let e=(0,E.c)(1),t=(0,D.useContext)(k);if(!t){let t;return e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t={openImage:j},e[0]=t):t=e[0],t}return t}function j(){}function M({children:e,closeLabel:t=`Close`,interactive:n=!1}){let r=u(s(e=>e.language)).chat,[i,a]=(0,D.useState)(1),[o,c]=(0,D.useState)({x:0,y:0}),[l,_]=(0,D.useState)(!1),[b,S]=(0,D.useState)(!1),C=(0,D.useRef)(null),w=(0,D.useRef)(0),E=(0,D.useRef)(null),[A,j]=(0,D.useState)(null),M=(0,D.useCallback)((e,t)=>{E.current=document.activeElement instanceof HTMLElement?document.activeElement:null,w.current++,C.current=null,a(1),c({x:0,y:0}),_(!1),S(!1),j({src:e,alt:t})},[]),N=(0,D.useMemo)(()=>({openImage:M}),[M]);return(0,O.jsxs)(k.Provider,{value:N,children:[e,(0,O.jsx)(g,{open:A!==null,onOpenChange:e=>{e||(w.current++,j(null))},children:(0,O.jsxs)(p,{children:[(0,O.jsx)(d,{className:`fixed inset-0 z-[70] bg-scrim/90 backdrop-blur-sm`}),(0,O.jsxs)(m,{className:x(`fixed inset-0 z-[71] flex items-center justify-center p-4 outline-none`,`data-[state=open]:animate-in data-[state=closed]:animate-out`),"aria-describedby":void 0,onCloseAutoFocus:e=>{n&&(e.preventDefault(),E.current?.isConnected&&E.current.focus({preventScroll:!0}))},children:[(0,O.jsx)(h,{className:`sr-only`,children:A?.alt||r.attachmentPreviewImage}),(0,O.jsx)(f,{asChild:!0,children:(0,O.jsx)(`button`,{type:`button`,"aria-label":t,className:`absolute right-4 top-4 z-10 rounded-lg bg-surface-panel/80 p-2 text-fg-muted backdrop-blur transition-colors hover:bg-surface-hover hover:text-fg`,children:(0,O.jsx)(te,{className:`size-5`,"aria-hidden":!0})})}),A&&n?(0,O.jsxs)(O.Fragment,{children:[(0,O.jsxs)(`div`,{className:`absolute bottom-4 left-1/2 z-10 flex -translate-x-1/2 items-center rounded-lg border border-edge bg-surface-panel p-1 text-fg shadow-surface`,children:[(0,O.jsx)(`button`,{type:`button`,"aria-label":r.mermaidZoomOut,disabled:i<=1,className:`size-11 rounded-md p-3 hover:bg-surface-hover disabled:opacity-40`,onClick:()=>{a(e=>Math.max(1,e-.5)),c({x:0,y:0})},children:(0,O.jsx)(y,{className:`size-5`})}),(0,O.jsxs)(`span`,{className:`min-w-12 text-center text-xs tabular-nums`,"aria-live":`polite`,children:[Math.round(i*100),`%`]}),(0,O.jsx)(`button`,{type:`button`,"aria-label":r.mermaidZoomIn,disabled:i>=4,className:`size-11 rounded-md p-3 hover:bg-surface-hover disabled:opacity-40`,onClick:()=>a(e=>Math.min(4,e+.5)),children:(0,O.jsx)(ee,{className:`size-5`})}),(0,O.jsx)(`button`,{type:`button`,"aria-label":r.mermaidFit,className:`size-11 rounded-md p-3 hover:bg-surface-hover`,onClick:()=>{a(1),c({x:0,y:0})},children:(0,O.jsx)(T,{className:`size-5`})}),(0,O.jsx)(`button`,{type:`button`,"aria-label":r.attachmentPreviewDownload,disabled:b,className:`size-11 rounded-md p-3 hover:bg-surface-hover disabled:opacity-40`,onClick:async()=>{let e=w.current;S(!0),_(!1);try{let t=await fetch(A.src);if(!t.ok)throw Error(`Download failed`);let n=await t.blob();if(e!==w.current)return;let r=URL.createObjectURL(n),i=document.createElement(`a`);i.href=r;let a=n.type.split(`/`)[1]?.replace(`jpeg`,`jpg`).replace(`svg+xml`,`svg`);i.download=`image.${/^[a-z0-9]+$/i.test(a??``)?a:`png`}`,document.body.append(i),i.click(),i.remove(),window.setTimeout(()=>URL.revokeObjectURL(r),1e3)}catch{e===w.current&&_(!0)}finally{e===w.current&&S(!1)}},children:(0,O.jsx)(v,{className:`size-5`})})]}),l&&(0,O.jsx)(`p`,{role:`alert`,className:`absolute bottom-20 rounded-md bg-surface-panel px-3 py-2 text-sm text-danger`,children:r.imageDownloadFailed})]}):null,A?(0,O.jsx)(`div`,{className:n?`flex h-full w-full touch-none items-center justify-center overflow-hidden pb-16`:`contents`,onPointerDown:e=>{!n||i<=1||e.button!==0||!e.isPrimary||(C.current={id:e.pointerId,x:e.clientX,y:e.clientY,ox:o.x,oy:o.y},e.currentTarget.setPointerCapture(e.pointerId))},onPointerMove:e=>{let t=C.current;t?.id===e.pointerId&&c({x:t.ox+e.clientX-t.x,y:t.oy+e.clientY-t.y})},onPointerUp:()=>{C.current=null},onPointerCancel:()=>{C.current=null},children:(0,O.jsx)(`img`,{src:A.src,alt:A.alt??``,draggable:!1,className:n?`max-h-[min(80vh,900px)] max-w-[min(95vw,1200px)] select-none rounded-lg object-contain`:`max-h-[min(90vh,900px)] max-w-[min(95vw,1200px)] rounded-lg object-contain shadow-lg`,style:n?{transform:`translate(${o.x}px, ${o.y}px) scale(${i})`,cursor:i>1?`grab`:void 0}:void 0})}):null]})]})})]})}var N=`xopc-attachment`,ne=/^xopc-attachment:\/\/notes\/([^/]+)\/([^/?#]+)$/i,re=/^\/api\/notes\/([^/]+)\/media\/([^/?#]+)$/i;function P(e,t){return`${N}://notes/${encodeURIComponent(e)}/${encodeURIComponent(t)}`}function F(e,t){let n=e.trim();if(!n)return null;let r=n.split(`?`)[0],i=r.match(ne),a=r.match(re),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 ie(e,t){return`/api/notes/${encodeURIComponent(e)}/media/${encodeURIComponent(t)}`}var I=new Map,L=``;function R(e,t,n){return`${n}:${e}:${t}`}function z(){let e=o.getState().conversationId??``;if(e!==L){for(let e of I.values())e.objectUrl&&URL.revokeObjectURL(e.objectUrl);I.clear(),L=e}}async function ae(e,t){z();let n=R(e,t,o.getState().conversationId??``),r=I.get(n);return r||(r={blob:(async()=>{let n=await i(a(ie(e,t)));if(n.status===401&&o.getState().onUnauthorized(),!n.ok)throw Error(`HTTP ${n.status}`);return n.blob()})(),objectUrl:null,refCount:0},I.set(n,r)),r.blob}async function B(e,t){z();let n=R(e,t,o.getState().conversationId??``),r=I.get(n);if(r||(r={blob:ae(e,t),objectUrl:null,refCount:0},I.set(n,r)),!r.objectUrl){let e=await r.blob;r.objectUrl=URL.createObjectURL(e)}return r.refCount+=1,r.objectUrl}function V(e,t){z();let n=R(e,t,o.getState().conversationId??``),r=I.get(n);r&&(r.refCount=Math.max(0,r.refCount-1),r.refCount===0&&r.objectUrl&&(URL.revokeObjectURL(r.objectUrl),r.objectUrl=null,I.delete(n)))}var H={noteId:null,attachmentId:null,playing:!1,currentTime:0,duration:0,loading:!1},U=null,W=null,G=null,K=null;function q(){return U||(U=new Audio,U.addEventListener(`timeupdate`,()=>{Y.setState({currentTime:U.currentTime})}),U.addEventListener(`loadedmetadata`,()=>{let e=U.duration;Number.isFinite(e)&&Y.setState({duration:e})}),U.addEventListener(`ended`,()=>{Y.setState({playing:!1,currentTime:0}),U.currentTime=0}),U.addEventListener(`pause`,()=>{Y.setState({playing:!1})}),U.addEventListener(`play`,()=>{Y.setState({playing:!0})})),U}function J(){G&&K&&V(G,K),W=null,G=null,K=null}var Y=l()((e,t)=>({...H,play:async(n,r,i)=>{let a=q(),o=t();if(o.noteId===n&&o.attachmentId===r&&W){a.play();return}a.pause(),J(),e({noteId:n,attachmentId:r,playing:!1,currentTime:0,duration:i??0,loading:!0});try{let t=await B(n,r);W=t,G=n,K=r,a.src=t,await a.play(),window.dispatchEvent(new CustomEvent(`xopc-voice-playback-start`,{detail:{id:`note:${n}:${r}`}})),e({loading:!1})}catch{e({loading:!1,playing:!1}),J()}},pause:()=>{q().pause()},toggle:(e,n,r)=>{let i=t();i.noteId===e&&i.attachmentId===n&&i.playing?t().pause():t().play(e,n,r)},seek:t=>{let n=q();n.currentTime=t,e({currentTime:t})},reset:()=>{q().pause(),q().src=``,J(),e(H)}}));function X(e,t){return P(e,t)}function oe(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 se(e){let t=await e.json().catch(()=>({}));return typeof t.error==`string`?t.error:`HTTP ${e.status}`}async function Z(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&&o.getState().onUnauthorized(),!i.ok)throw Error(await se(i));return i.json()}function ce(e){let t=(0,E.c)(39),n,r,i,a,o,s,c;t[0]===e?(n=t[1],r=t[2],i=t[3],a=t[4],o=t[5],s=t[6],c=t[7]):({src:s,expectedNoteId:r,alt:c,className:n,onClick:i,onLoadFailed:a,...o}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i,t[4]=a,t[5]=o,t[6]=s,t[7]=c);let l=c===void 0?``:c,u;t[8]!==r||t[9]!==s?(u=F(s,r),t[8]=r,t[9]=s,t[10]=u):u=t[10];let d=u,[f,p]=(0,D.useState)(d?null:s),[m,h]=(0,D.useState)(!1),g,_;if(t[11]!==a||t[12]!==d||t[13]!==s?(g=()=>{if(h(!1),!d){p(s);return}let e=!1;return p(null),B(d.noteId,d.attachmentId).then(t=>{e||p(t)}).catch(()=>{e||(h(!0),a?.())}),()=>{e=!0,V(d.noteId,d.attachmentId)}},_=[s,d,a],t[11]=a,t[12]=d,t[13]=s,t[14]=g,t[15]=_):(g=t[14],_=t[15]),(0,D.useEffect)(g,_),m){let e;t[16]===n?e=t[17]:(e=x(`flex items-center justify-center bg-surface-hover text-fg-muted`,n),t[16]=n,t[17]=e);let r=!l,i;t[18]===Symbol.for(`react.memo_cache_sentinel`)?(i=(0,O.jsx)(w,{className:`size-5`}),t[18]=i):i=t[18];let a;return t[19]!==e||t[20]!==r?(a=(0,O.jsx)(`div`,{className:e,"aria-hidden":r,children:i}),t[19]=e,t[20]=r,t[21]=a):a=t[21],a}if(!f){let e;t[22]===n?e=t[23]:(e=x(`animate-pulse bg-surface-hover`,n),t[22]=n,t[23]=e);let r=!l,i;return t[24]!==e||t[25]!==r?(i=(0,O.jsx)(`div`,{className:e,"aria-hidden":r}),t[24]=e,t[25]=r,t[26]=i):i=t[26],i}let v;t[27]!==f||t[28]!==i?(v=i?()=>i(f):void 0,t[27]=f,t[28]=i,t[29]=v):v=t[29];let y;t[30]===a?y=t[31]:(y=()=>{h(!0),a?.()},t[30]=a,t[31]=y);let b;return t[32]!==l||t[33]!==n||t[34]!==f||t[35]!==o||t[36]!==v||t[37]!==y?(b=(0,O.jsx)(`img`,{...o,src:f,alt:l,className:n,onClick:v,onError:y}),t[32]=l,t[33]=n,t[34]=f,t[35]=o,t[36]=v,t[37]=y,t[38]=b):b=t[38],b}function le(e){return e.replace(/xopc-attachment:\/\/notes\/([^/]+)\/([^)\s]+)/gi,`/api/notes/$1/media/$2`)}function ue(e,t){let n=[];return e.querySelectorAll(`.markdown-body img`).forEach(e=>{let r=F(e.getAttribute(`src`)??``,t);if(!r)return;let i=!1;B(r.noteId,r.attachmentId).then(t=>{i||(e.src=t)}).catch(()=>{e.classList.add(`note-media-load-failed`)}),n.push(()=>{i=!0,V(r.noteId,r.attachmentId)})}),e.querySelectorAll(`.markdown-body a`).forEach(e=>{let r=F(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;B(r.noteId,r.attachmentId).then(e=>{a||(i.src=e)}).catch(()=>{i.remove()}),n.push(()=>{a=!0,V(r.noteId,r.attachmentId)})}),()=>{for(let e of n)e()}}function de(e){let t=(0,E.c)(21),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 a=(0,D.useRef)(null),o;t[4]!==i.codeCopy||t[5]!==i.streaming?(o=e=>(0,O.jsx)(C,{source:e.source,incomplete:!e.closed,streaming:i.streaming??!1,copy:i.codeCopy??!0}),t[4]=i.codeCopy,t[5]=i.streaming,t[6]=o):o=t[6];let s=o,c;t[7]===r?c=t[8]:(c=()=>{let e=a.current;if(e)return ue(e,r)},t[7]=r,t[8]=c);let l;t[9]!==n||t[10]!==r?(l=[n,r],t[9]=n,t[10]=r,t[11]=l):l=t[11],(0,D.useLayoutEffect)(c,l);let u;t[12]===n?u=t[13]:(u=le(n),t[12]=n,t[13]=u);let d;t[14]===i.className?d=t[15]:(d=[`markdown-note`,i.className].filter(Boolean),t[14]=i.className,t[15]=d);let f=d.join(` `),p;return t[16]!==s||t[17]!==i||t[18]!==u||t[19]!==f?(p=(0,O.jsx)(`div`,{ref:a,children:(0,O.jsx)(S,{children:(0,O.jsx)(b,{content:u,mermaidActions:!0,...i,renderChart:s,className:f})})}),t[16]=s,t[17]=i,t[18]=u,t[19]=f,t[20]=p):p=t[20],p}async function fe(){return c(a(`/api/notes/project-summaries`))}async function pe(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 c(a(`/api/notes${n?`?${n}`:``}`))}async function me(e,t=`web`){return(await c(a(`/api/notes/quick-capture`),{method:`POST`,body:JSON.stringify({text:e,channel:t})})).note}async function he(e,t){return(await c(a(`/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 ge(e){let t=await i(a(`/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 Q(e,t){return(await c(a(`/api/notes/${encodeURIComponent(e)}`),{method:`PATCH`,body:JSON.stringify(t)})).note}async function _e(e){await c(a(`/api/notes/${encodeURIComponent(e)}`),{method:`DELETE`})}async function ve(e){return c(a(`/api/notes/${encodeURIComponent(e)}/shares`))}async function ye(e,t){return c(a(`/api/notes/${encodeURIComponent(e)}/shares`),{method:`POST`,body:JSON.stringify(t)})}async function be(e,t,n){await c(a(`/api/notes/${encodeURIComponent(e)}/shares/${encodeURIComponent(t)}/refresh`),{method:`POST`,body:JSON.stringify(n)})}async function xe(e){return(await c(a(`/api/notes/${encodeURIComponent(e)}/hosted-publications`))).payload.publications}async function Se(e,t){return(await c(a(`/api/notes/${encodeURIComponent(e)}/hosted-publications`),{method:`POST`,body:JSON.stringify(t)})).payload}async function Ce(e,t,n){return(await c(a(`/api/notes/${encodeURIComponent(e)}/hosted-publications/${encodeURIComponent(t)}/refresh`),{method:`POST`,body:JSON.stringify(n)})).payload}async function we(e){return c(a(`/api/notes/${encodeURIComponent(e)}/catalyze`),{method:`POST`})}async function Te(e,t){return(await c(a(`/api/notes/${encodeURIComponent(e)}/catalysis-feedback`),{method:`POST`,body:JSON.stringify({feedback:t})})).note}async function Ee(e,t={}){return c(a(`/api/notes/${encodeURIComponent(e)}/chat`),{method:`POST`,body:JSON.stringify(t)})}async function De(e){return(await c(a(`/api/notes/${encodeURIComponent(e)}/threads`))).items}async function Oe(e){return c(a(`/api/notes/${encodeURIComponent(e)}/context-status`))}async function ke(e){return c(a(`/api/notes/${encodeURIComponent(e)}/context-rebuild`),{method:`POST`})}async function Ae(e,t,n){return(await c(a(`/api/notes/${encodeURIComponent(e)}/append`),{method:`POST`,body:JSON.stringify({content:t,heading:n})})).note}async function je(e,t={}){return(await c(a(`/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 Me(e,t,n){let r=new FormData;return r.append(`file`,t),(await Z(a(`/api/notes/${encodeURIComponent(e)}/media`),r,n)).attachment}async function $(e,t){let n=new FormData;return n.append(`file`,e),t?.markdown&&n.append(`markdown`,t.markdown),n.append(`channel`,t?.channel??`web`),t?.kind&&n.append(`kind`,t.kind),t?.duration!==void 0&&n.append(`duration`,String(t.duration)),(await Z(a(`/api/notes`),n)).note}async function Ne(e,t=`web`){let n=await $(e,{channel:t}),r=n.attachments?.find(e=>e.type===`image`)??n.attachments?.[0];if(!r)return n;let i=`})`;return n.markdown!==i&&(n=await Q(n.id,{markdown:i})),n}async function Pe(e,t,n=`web`){let r=await $(e,{channel:n,kind:`voice`,duration:t}),i=r.attachments?.find(e=>e.type===`audio`)??r.attachments?.[0];if(!i)return r;let a=`[${oe(t)}](${X(r.id,i.id)})`;return r.markdown!==a&&(r=await Q(r.id,{markdown:a,kind:`voice`})),r}async function Fe(e){return(await c(a(`/api/notes/${encodeURIComponent(e)}/history`))).entries}async function Ie(e,t){return(await c(a(`/api/notes/${encodeURIComponent(e)}/history/${t}`))).snapshot}async function Le(e,t){return(await c(a(`/api/notes/${encodeURIComponent(e)}/history/restore`),{method:`POST`,body:JSON.stringify({timestamp:t})})).note}export{X as A,Ce as C,Me as D,Q as E,A as F,T as I,w as L,P as M,F as N,de as O,M as P,Te as S,Le as T,Ee as _,ye as a,Pe as b,ge as c,xe as d,Fe as f,pe as g,De as h,he as i,Y as j,ce as k,Oe as l,ve as m,we as n,je as o,fe as p,Se as r,_e as s,Ae as t,Ie as u,me as v,be as w,ke as x,Ne as y};
|
|
1
|
+
import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{a as t,n,t as r}from"./vendor-react-BOUWij0V.js";import{a as i,i as a,l as o,n as s,o as c,p as l}from"./locale-store-BY-fRY-q.js";import{t as u}from"./messages-DFCLetQl.js";import{a as d,n as f,o as p,r as m,s as h,t as g}from"./dist-BGTk37IG.js";import{t as _}from"./createLucideIcon-DPHK1VkS.js";import{t as v}from"./download-Dk-ZjtO6.js";import{G as y,t as b}from"./markdown-view-ClNfoiYC.js";import{t as ee}from"./plus-Q2yW6OE7.js";import{t as te}from"./x-B_N4OPjy.js";import{t as x}from"./cn-0WouolD0.js";import{r as S,t as C}from"./chat-chart-block-BBchFbUa.js";var w=_(`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`}]]),T=_(`maximize`,[[`path`,{d:`M8 3H5a2 2 0 0 0-2 2v3`,key:`1dcmit`}],[`path`,{d:`M21 8V5a2 2 0 0 0-2-2h-3`,key:`1e4gt3`}],[`path`,{d:`M3 16v3a2 2 0 0 0 2 2h3`,key:`wsl5sc`}],[`path`,{d:`M16 21h3a2 2 0 0 0 2-2v-3`,key:`18trek`}]]),E=n(),D=e(t(),1),O=r(),k=(0,D.createContext)(null);function A(){let e=(0,E.c)(1),t=(0,D.useContext)(k);if(!t){let t;return e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t={openImage:j},e[0]=t):t=e[0],t}return t}function j(){}function M({children:e,closeLabel:t=`Close`,interactive:n=!1}){let r=u(s(e=>e.language)).chat,[i,a]=(0,D.useState)(1),[o,c]=(0,D.useState)({x:0,y:0}),[l,_]=(0,D.useState)(!1),[b,S]=(0,D.useState)(!1),C=(0,D.useRef)(null),w=(0,D.useRef)(0),E=(0,D.useRef)(null),[A,j]=(0,D.useState)(null),M=(0,D.useCallback)((e,t)=>{E.current=document.activeElement instanceof HTMLElement?document.activeElement:null,w.current++,C.current=null,a(1),c({x:0,y:0}),_(!1),S(!1),j({src:e,alt:t})},[]),N=(0,D.useMemo)(()=>({openImage:M}),[M]);return(0,O.jsxs)(k.Provider,{value:N,children:[e,(0,O.jsx)(g,{open:A!==null,onOpenChange:e=>{e||(w.current++,j(null))},children:(0,O.jsxs)(p,{children:[(0,O.jsx)(d,{className:`fixed inset-0 z-[70] bg-scrim/90 backdrop-blur-sm`}),(0,O.jsxs)(m,{className:x(`fixed inset-0 z-[71] flex items-center justify-center p-4 outline-none`,`data-[state=open]:animate-in data-[state=closed]:animate-out`),"aria-describedby":void 0,onCloseAutoFocus:e=>{n&&(e.preventDefault(),E.current?.isConnected&&E.current.focus({preventScroll:!0}))},children:[(0,O.jsx)(h,{className:`sr-only`,children:A?.alt||r.attachmentPreviewImage}),(0,O.jsx)(f,{asChild:!0,children:(0,O.jsx)(`button`,{type:`button`,"aria-label":t,className:`absolute right-4 top-4 z-10 rounded-lg bg-surface-panel/80 p-2 text-fg-muted backdrop-blur transition-colors hover:bg-surface-hover hover:text-fg`,children:(0,O.jsx)(te,{className:`size-5`,"aria-hidden":!0})})}),A&&n?(0,O.jsxs)(O.Fragment,{children:[(0,O.jsxs)(`div`,{className:`absolute bottom-4 left-1/2 z-10 flex -translate-x-1/2 items-center rounded-lg border border-edge bg-surface-panel p-1 text-fg shadow-surface`,children:[(0,O.jsx)(`button`,{type:`button`,"aria-label":r.mermaidZoomOut,disabled:i<=1,className:`size-11 rounded-md p-3 hover:bg-surface-hover disabled:opacity-40`,onClick:()=>{a(e=>Math.max(1,e-.5)),c({x:0,y:0})},children:(0,O.jsx)(y,{className:`size-5`})}),(0,O.jsxs)(`span`,{className:`min-w-12 text-center text-xs tabular-nums`,"aria-live":`polite`,children:[Math.round(i*100),`%`]}),(0,O.jsx)(`button`,{type:`button`,"aria-label":r.mermaidZoomIn,disabled:i>=4,className:`size-11 rounded-md p-3 hover:bg-surface-hover disabled:opacity-40`,onClick:()=>a(e=>Math.min(4,e+.5)),children:(0,O.jsx)(ee,{className:`size-5`})}),(0,O.jsx)(`button`,{type:`button`,"aria-label":r.mermaidFit,className:`size-11 rounded-md p-3 hover:bg-surface-hover`,onClick:()=>{a(1),c({x:0,y:0})},children:(0,O.jsx)(T,{className:`size-5`})}),(0,O.jsx)(`button`,{type:`button`,"aria-label":r.attachmentPreviewDownload,disabled:b,className:`size-11 rounded-md p-3 hover:bg-surface-hover disabled:opacity-40`,onClick:async()=>{let e=w.current;S(!0),_(!1);try{let t=await fetch(A.src);if(!t.ok)throw Error(`Download failed`);let n=await t.blob();if(e!==w.current)return;let r=URL.createObjectURL(n),i=document.createElement(`a`);i.href=r;let a=n.type.split(`/`)[1]?.replace(`jpeg`,`jpg`).replace(`svg+xml`,`svg`);i.download=`image.${/^[a-z0-9]+$/i.test(a??``)?a:`png`}`,document.body.append(i),i.click(),i.remove(),window.setTimeout(()=>URL.revokeObjectURL(r),1e3)}catch{e===w.current&&_(!0)}finally{e===w.current&&S(!1)}},children:(0,O.jsx)(v,{className:`size-5`})})]}),l&&(0,O.jsx)(`p`,{role:`alert`,className:`absolute bottom-20 rounded-md bg-surface-panel px-3 py-2 text-sm text-danger`,children:r.imageDownloadFailed})]}):null,A?(0,O.jsx)(`div`,{className:n?`flex h-full w-full touch-none items-center justify-center overflow-hidden pb-16`:`contents`,onPointerDown:e=>{!n||i<=1||e.button!==0||!e.isPrimary||(C.current={id:e.pointerId,x:e.clientX,y:e.clientY,ox:o.x,oy:o.y},e.currentTarget.setPointerCapture(e.pointerId))},onPointerMove:e=>{let t=C.current;t?.id===e.pointerId&&c({x:t.ox+e.clientX-t.x,y:t.oy+e.clientY-t.y})},onPointerUp:()=>{C.current=null},onPointerCancel:()=>{C.current=null},children:(0,O.jsx)(`img`,{src:A.src,alt:A.alt??``,draggable:!1,className:n?`max-h-[min(80vh,900px)] max-w-[min(95vw,1200px)] select-none rounded-lg object-contain`:`max-h-[min(90vh,900px)] max-w-[min(95vw,1200px)] rounded-lg object-contain shadow-lg`,style:n?{transform:`translate(${o.x}px, ${o.y}px) scale(${i})`,cursor:i>1?`grab`:void 0}:void 0})}):null]})]})})]})}var N=`xopc-attachment`,ne=/^xopc-attachment:\/\/notes\/([^/]+)\/([^/?#]+)$/i,re=/^\/api\/notes\/([^/]+)\/media\/([^/?#]+)$/i;function P(e,t){return`${N}://notes/${encodeURIComponent(e)}/${encodeURIComponent(t)}`}function F(e,t){let n=e.trim();if(!n)return null;let r=n.split(`?`)[0],i=r.match(ne),a=r.match(re),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 ie(e,t){return`/api/notes/${encodeURIComponent(e)}/media/${encodeURIComponent(t)}`}var I=new Map,L=``;function R(e,t,n){return`${n}:${e}:${t}`}function z(){let e=o.getState().conversationId??``;if(e!==L){for(let e of I.values())e.objectUrl&&URL.revokeObjectURL(e.objectUrl);I.clear(),L=e}}async function ae(e,t){z();let n=R(e,t,o.getState().conversationId??``),r=I.get(n);return r||(r={blob:(async()=>{let n=await i(a(ie(e,t)));if(n.status===401&&o.getState().onUnauthorized(),!n.ok)throw Error(`HTTP ${n.status}`);return n.blob()})(),objectUrl:null,refCount:0},I.set(n,r)),r.blob}async function B(e,t){z();let n=R(e,t,o.getState().conversationId??``),r=I.get(n);if(r||(r={blob:ae(e,t),objectUrl:null,refCount:0},I.set(n,r)),!r.objectUrl){let e=await r.blob;r.objectUrl=URL.createObjectURL(e)}return r.refCount+=1,r.objectUrl}function V(e,t){z();let n=R(e,t,o.getState().conversationId??``),r=I.get(n);r&&(r.refCount=Math.max(0,r.refCount-1),r.refCount===0&&r.objectUrl&&(URL.revokeObjectURL(r.objectUrl),r.objectUrl=null,I.delete(n)))}var H={noteId:null,attachmentId:null,playing:!1,currentTime:0,duration:0,loading:!1},U=null,W=null,G=null,K=null;function q(){return U||(U=new Audio,U.addEventListener(`timeupdate`,()=>{Y.setState({currentTime:U.currentTime})}),U.addEventListener(`loadedmetadata`,()=>{let e=U.duration;Number.isFinite(e)&&Y.setState({duration:e})}),U.addEventListener(`ended`,()=>{Y.setState({playing:!1,currentTime:0}),U.currentTime=0}),U.addEventListener(`pause`,()=>{Y.setState({playing:!1})}),U.addEventListener(`play`,()=>{Y.setState({playing:!0})})),U}function J(){G&&K&&V(G,K),W=null,G=null,K=null}var Y=l()((e,t)=>({...H,play:async(n,r,i)=>{let a=q(),o=t();if(o.noteId===n&&o.attachmentId===r&&W){a.play();return}a.pause(),J(),e({noteId:n,attachmentId:r,playing:!1,currentTime:0,duration:i??0,loading:!0});try{let t=await B(n,r);W=t,G=n,K=r,a.src=t,await a.play(),window.dispatchEvent(new CustomEvent(`xopc-voice-playback-start`,{detail:{id:`note:${n}:${r}`}})),e({loading:!1})}catch{e({loading:!1,playing:!1}),J()}},pause:()=>{q().pause()},toggle:(e,n,r)=>{let i=t();i.noteId===e&&i.attachmentId===n&&i.playing?t().pause():t().play(e,n,r)},seek:t=>{let n=q();n.currentTime=t,e({currentTime:t})},reset:()=>{q().pause(),q().src=``,J(),e(H)}}));function X(e,t){return P(e,t)}function oe(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 se(e){let t=await e.json().catch(()=>({}));return typeof t.error==`string`?t.error:`HTTP ${e.status}`}async function Z(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&&o.getState().onUnauthorized(),!i.ok)throw Error(await se(i));return i.json()}function ce(e){let t=(0,E.c)(39),n,r,i,a,o,s,c;t[0]===e?(n=t[1],r=t[2],i=t[3],a=t[4],o=t[5],s=t[6],c=t[7]):({src:s,expectedNoteId:r,alt:c,className:n,onClick:i,onLoadFailed:a,...o}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i,t[4]=a,t[5]=o,t[6]=s,t[7]=c);let l=c===void 0?``:c,u;t[8]!==r||t[9]!==s?(u=F(s,r),t[8]=r,t[9]=s,t[10]=u):u=t[10];let d=u,[f,p]=(0,D.useState)(d?null:s),[m,h]=(0,D.useState)(!1),g,_;if(t[11]!==a||t[12]!==d||t[13]!==s?(g=()=>{if(h(!1),!d){p(s);return}let e=!1;return p(null),B(d.noteId,d.attachmentId).then(t=>{e||p(t)}).catch(()=>{e||(h(!0),a?.())}),()=>{e=!0,V(d.noteId,d.attachmentId)}},_=[s,d,a],t[11]=a,t[12]=d,t[13]=s,t[14]=g,t[15]=_):(g=t[14],_=t[15]),(0,D.useEffect)(g,_),m){let e;t[16]===n?e=t[17]:(e=x(`flex items-center justify-center bg-surface-hover text-fg-muted`,n),t[16]=n,t[17]=e);let r=!l,i;t[18]===Symbol.for(`react.memo_cache_sentinel`)?(i=(0,O.jsx)(w,{className:`size-5`}),t[18]=i):i=t[18];let a;return t[19]!==e||t[20]!==r?(a=(0,O.jsx)(`div`,{className:e,"aria-hidden":r,children:i}),t[19]=e,t[20]=r,t[21]=a):a=t[21],a}if(!f){let e;t[22]===n?e=t[23]:(e=x(`animate-pulse bg-surface-hover`,n),t[22]=n,t[23]=e);let r=!l,i;return t[24]!==e||t[25]!==r?(i=(0,O.jsx)(`div`,{className:e,"aria-hidden":r}),t[24]=e,t[25]=r,t[26]=i):i=t[26],i}let v;t[27]!==f||t[28]!==i?(v=i?()=>i(f):void 0,t[27]=f,t[28]=i,t[29]=v):v=t[29];let y;t[30]===a?y=t[31]:(y=()=>{h(!0),a?.()},t[30]=a,t[31]=y);let b;return t[32]!==l||t[33]!==n||t[34]!==f||t[35]!==o||t[36]!==v||t[37]!==y?(b=(0,O.jsx)(`img`,{...o,src:f,alt:l,className:n,onClick:v,onError:y}),t[32]=l,t[33]=n,t[34]=f,t[35]=o,t[36]=v,t[37]=y,t[38]=b):b=t[38],b}function le(e){return e.replace(/xopc-attachment:\/\/notes\/([^/]+)\/([^)\s]+)/gi,`/api/notes/$1/media/$2`)}function ue(e,t){let n=[];return e.querySelectorAll(`.markdown-body img`).forEach(e=>{let r=F(e.getAttribute(`src`)??``,t);if(!r)return;let i=!1;B(r.noteId,r.attachmentId).then(t=>{i||(e.src=t)}).catch(()=>{e.classList.add(`note-media-load-failed`)}),n.push(()=>{i=!0,V(r.noteId,r.attachmentId)})}),e.querySelectorAll(`.markdown-body a`).forEach(e=>{let r=F(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;B(r.noteId,r.attachmentId).then(e=>{a||(i.src=e)}).catch(()=>{i.remove()}),n.push(()=>{a=!0,V(r.noteId,r.attachmentId)})}),()=>{for(let e of n)e()}}function de(e){let t=(0,E.c)(21),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 a=(0,D.useRef)(null),o;t[4]!==i.codeCopy||t[5]!==i.streaming?(o=e=>(0,O.jsx)(C,{source:e.source,incomplete:!e.closed,streaming:i.streaming??!1,copy:i.codeCopy??!0}),t[4]=i.codeCopy,t[5]=i.streaming,t[6]=o):o=t[6];let s=o,c;t[7]===r?c=t[8]:(c=()=>{let e=a.current;if(e)return ue(e,r)},t[7]=r,t[8]=c);let l;t[9]!==n||t[10]!==r?(l=[n,r],t[9]=n,t[10]=r,t[11]=l):l=t[11],(0,D.useLayoutEffect)(c,l);let u;t[12]===n?u=t[13]:(u=le(n),t[12]=n,t[13]=u);let d;t[14]===i.className?d=t[15]:(d=[`markdown-note`,i.className].filter(Boolean),t[14]=i.className,t[15]=d);let f=d.join(` `),p;return t[16]!==s||t[17]!==i||t[18]!==u||t[19]!==f?(p=(0,O.jsx)(`div`,{ref:a,children:(0,O.jsx)(S,{children:(0,O.jsx)(b,{content:u,mermaidActions:!0,...i,renderChart:s,className:f})})}),t[16]=s,t[17]=i,t[18]=u,t[19]=f,t[20]=p):p=t[20],p}async function fe(){return c(a(`/api/notes/project-summaries`))}async function pe(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 c(a(`/api/notes${n?`?${n}`:``}`))}async function me(e,t=`web`){return(await c(a(`/api/notes/quick-capture`),{method:`POST`,body:JSON.stringify({text:e,channel:t})})).note}async function he(e,t){return(await c(a(`/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 ge(e){let t=await i(a(`/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 Q(e,t,n){return(await c(a(`/api/notes/${encodeURIComponent(e)}`),{method:`PATCH`,body:JSON.stringify({...t,...n===void 0?{}:{expectedRevision:n}})})).note}async function _e(e){await c(a(`/api/notes/${encodeURIComponent(e)}`),{method:`DELETE`})}async function ve(e){return c(a(`/api/notes/${encodeURIComponent(e)}/shares`))}async function ye(e,t){return c(a(`/api/notes/${encodeURIComponent(e)}/shares`),{method:`POST`,body:JSON.stringify(t)})}async function be(e,t,n){await c(a(`/api/notes/${encodeURIComponent(e)}/shares/${encodeURIComponent(t)}/refresh`),{method:`POST`,body:JSON.stringify(n)})}async function xe(e){return(await c(a(`/api/notes/${encodeURIComponent(e)}/hosted-publications`))).payload.publications}async function Se(e,t){return(await c(a(`/api/notes/${encodeURIComponent(e)}/hosted-publications`),{method:`POST`,body:JSON.stringify(t)})).payload}async function Ce(e,t,n){return(await c(a(`/api/notes/${encodeURIComponent(e)}/hosted-publications/${encodeURIComponent(t)}/refresh`),{method:`POST`,body:JSON.stringify(n)})).payload}async function we(e){return c(a(`/api/notes/${encodeURIComponent(e)}/catalyze`),{method:`POST`})}async function Te(e,t){return(await c(a(`/api/notes/${encodeURIComponent(e)}/catalysis-feedback`),{method:`POST`,body:JSON.stringify({feedback:t})})).note}async function Ee(e,t={}){return c(a(`/api/notes/${encodeURIComponent(e)}/chat`),{method:`POST`,body:JSON.stringify(t)})}async function De(e){return(await c(a(`/api/notes/${encodeURIComponent(e)}/threads`))).items}async function Oe(e){return c(a(`/api/notes/${encodeURIComponent(e)}/context-status`))}async function ke(e){return c(a(`/api/notes/${encodeURIComponent(e)}/context-rebuild`),{method:`POST`})}async function Ae(e,t,n){return(await c(a(`/api/notes/${encodeURIComponent(e)}/append`),{method:`POST`,body:JSON.stringify({content:t,heading:n})})).note}async function je(e,t={}){return(await c(a(`/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 Me(e,t,n){let r=new FormData;return r.append(`file`,t),(await Z(a(`/api/notes/${encodeURIComponent(e)}/media`),r,n)).attachment}async function $(e,t){let n=new FormData;return n.append(`file`,e),t?.markdown&&n.append(`markdown`,t.markdown),n.append(`channel`,t?.channel??`web`),t?.kind&&n.append(`kind`,t.kind),t?.duration!==void 0&&n.append(`duration`,String(t.duration)),(await Z(a(`/api/notes`),n)).note}async function Ne(e,t=`web`){let n=await $(e,{channel:t}),r=n.attachments?.find(e=>e.type===`image`)??n.attachments?.[0];if(!r)return n;let i=`})`;return n.markdown!==i&&(n=await Q(n.id,{markdown:i})),n}async function Pe(e,t,n=`web`){let r=await $(e,{channel:n,kind:`voice`,duration:t}),i=r.attachments?.find(e=>e.type===`audio`)??r.attachments?.[0];if(!i)return r;let a=`[${oe(t)}](${X(r.id,i.id)})`;return r.markdown!==a&&(r=await Q(r.id,{markdown:a,kind:`voice`})),r}async function Fe(e){return(await c(a(`/api/notes/${encodeURIComponent(e)}/history`))).entries}async function Ie(e,t){return(await c(a(`/api/notes/${encodeURIComponent(e)}/history/${t}`))).snapshot}async function Le(e,t){return(await c(a(`/api/notes/${encodeURIComponent(e)}/history/restore`),{method:`POST`,body:JSON.stringify({timestamp:t})})).note}export{X as A,Ce as C,Me as D,Q as E,A as F,T as I,w as L,P as M,F as N,de as O,M as P,Te as S,Le as T,Ee as _,ye as a,Pe as b,ge as c,xe as d,Fe as f,pe as g,De as h,he as i,Y as j,ce as k,Oe as l,ve as m,we as n,je as o,fe as p,Se as r,_e as s,Ae as t,Ie as u,me as v,be as w,ke as x,Ne as y};
|