@xopcai/xopc 0.0.487 → 0.0.489
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/README.md +9 -3
- package/README.zh-CN.md +9 -3
- package/dist/browser-ext/_locales/en/messages.json +1 -1
- package/dist/browser-ext/_locales/zh_CN/messages.json +1 -1
- package/dist/browser-ext/dist/assets/{auth-8EjgHa-n.js → page-context-DCkQH5LX.js} +237 -172
- package/dist/browser-ext/dist/background.js +650 -108
- package/dist/browser-ext/dist/sidepanel.html +1 -1
- package/dist/browser-ext/dist/sidepanel.js +22 -4
- package/dist/browser-ext/manifest.json +2 -1
- package/dist/extensions/dingtalk/src/index.js +54 -10
- package/dist/extensions/discord/src/index.js +39 -6
- package/dist/extensions/feishu/src/adapters/cli-login.js +1 -1
- package/dist/extensions/feishu/src/adapters/gateway-setup.js +1 -1
- package/dist/extensions/feishu/src/outbound/media-load.d.ts +1 -0
- package/dist/extensions/feishu/src/outbound/media-load.js +2 -2
- package/dist/extensions/feishu/src/outbound/outbound-adapter.js +2 -1
- package/dist/extensions/feishu/src/pairing/feishu-pairing-prompt.js +1 -1
- package/dist/extensions/feishu/src/plugin.js +1 -1
- package/dist/extensions/feishu/src/streaming/streaming-adapter.js +1 -1
- package/dist/extensions/feishu/src/transport/client/install-sdk.js +2 -2
- package/dist/extensions/feishu/src/transport/reliability/message-ingress.js +3 -3
- package/dist/extensions/feishu/src/transport/socket-mode/monitor.js +1 -1
- package/dist/extensions/slack/src/index.js +51 -1
- package/dist/extensions/slack/src/manifest.js +1 -0
- package/dist/extensions/telegram/src/adapters/outbound-adapter.js +6 -1
- package/dist/extensions/telegram/src/adapters/streaming-adapter.js +3 -3
- package/dist/extensions/telegram/src/doctor.js +2 -2
- package/dist/extensions/telegram/src/draft-stream.js +1 -1
- package/dist/extensions/telegram/src/exec-approval-handler.js +1 -1
- package/dist/extensions/telegram/src/focus-handler.js +1 -1
- package/dist/extensions/telegram/src/inbound-processor.js +6 -6
- package/dist/extensions/telegram/src/outbound-sender.js +7 -6
- package/dist/extensions/telegram/src/plugin.js +22 -22
- package/dist/extensions/telegram/src/polling-session.js +1 -1
- package/dist/extensions/telegram/xopc.extension.json +1 -1
- package/dist/extensions/wecom/src/index.js +82 -6
- package/dist/extensions/weixin/src/api/api.js +3 -3
- package/dist/extensions/weixin/src/auth/accounts.js +14 -14
- package/dist/extensions/weixin/src/auth/pairing.js +1 -1
- package/dist/extensions/weixin/src/cdn/upload.js +1 -1
- package/dist/extensions/weixin/src/cli/gateway-qr-login.js +1 -1
- package/dist/extensions/weixin/src/cli/qr-login.js +2 -2
- package/dist/extensions/weixin/src/media/data-url.d.ts +1 -0
- package/dist/extensions/weixin/src/media/data-url.js +5 -2
- package/dist/extensions/weixin/src/messaging/debug-mode.js +6 -6
- package/dist/extensions/weixin/src/messaging/inbound.js +13 -13
- package/dist/extensions/weixin/src/messaging/process-message.js +4 -4
- package/dist/extensions/weixin/src/messaging/quote-cache.js +1 -1
- package/dist/extensions/weixin/src/messaging/send.js +1 -1
- package/dist/extensions/weixin/src/monitor/monitor.js +2 -2
- package/dist/extensions/weixin/src/outbound-send.js +18 -6
- package/dist/extensions/weixin/src/plugin.js +3 -3
- package/dist/gateway/server/chunks.bin +1767 -1712
- package/dist/gateway/server/chunks.json +1 -1
- package/dist/gateway/static/root/assets/{activity-store-CWGtissf.js → activity-store-DyHjQrpP.js} +1 -1
- package/dist/gateway/static/root/assets/{agent-avatar-dicebear-D4YSq8A9.js → agent-avatar-dicebear-gADhOk89.js} +1 -1
- package/dist/gateway/static/root/assets/{agent-avatar-display-DWv7biOS.js → agent-avatar-display-Dyyk4GdM.js} +2 -2
- package/dist/gateway/static/root/assets/{agent-defaults-settings-panel-3xdD9dR1.js → agent-defaults-settings-panel-DD5mU7h6.js} +1 -1
- package/dist/gateway/static/root/assets/{agent-plugin-dialog-BNvw2z1Y.js → agent-plugin-dialog-RZpnW9HG.js} +1 -1
- package/dist/gateway/static/root/assets/{agents-DcENLHHW.js → agents-Ckt9wMj7.js} +3 -3
- package/dist/gateway/static/root/assets/{agents-admin-api-BzpxMKwk.js → agents-admin-api-BW3Mzst8.js} +1 -1
- package/dist/gateway/static/root/assets/{api-D70-LnNE.js → api-Cd5TqEwc.js} +1 -1
- package/dist/gateway/static/root/assets/{api-SIYalfjE.js → api-DVQaJzrB.js} +1 -1
- package/dist/gateway/static/root/assets/{app-management-settings-panel-CEveRIMe.js → app-management-settings-panel-Cim6ZmGT.js} +1 -1
- package/dist/gateway/static/root/assets/{appearance-settings-CT2NLLuY.js → appearance-settings-BVMDvmUO.js} +1 -1
- package/dist/gateway/static/root/assets/{apps-page-pEqr4fAK.js → apps-page-B7T55D7Y.js} +1 -1
- package/dist/gateway/static/root/assets/{archive-plugin-xnggGfUN.js → archive-plugin-DVoAuR_a.js} +1 -1
- package/dist/gateway/static/root/assets/{automation-api-CaBLskwk.js → automation-api-B6YcuEsE.js} +1 -1
- package/dist/gateway/static/root/assets/{automation-result-state-CeGtOXK0.js → automation-result-state-BycWqFXM.js} +1 -1
- package/dist/gateway/static/root/assets/{automation-run-list-DUpezxj4.js → automation-run-list-DDDHtKq0.js} +1 -1
- package/dist/gateway/static/root/assets/{automation-task-card-CLayJo0S.js → automation-task-card-BBEA23Zb.js} +1 -1
- package/dist/gateway/static/root/assets/{automations-page-BKfvaA41.js → automations-page-B3i5x1Lc.js} +1 -1
- package/dist/gateway/static/root/assets/{automations-workspace-BRcJzgLA.js → automations-workspace-D6-Kk33X.js} +2 -2
- package/dist/gateway/static/root/assets/{binary-plugins-DtD3acS4.js → binary-plugins-o-jwYyMd.js} +1 -1
- package/dist/gateway/static/root/assets/{block-editor-DXjBAN8L.js → block-editor-Bp6TLleA.js} +1 -1
- package/dist/gateway/static/root/assets/{browser-settings-page-Cgxtr2eR.js → browser-settings-page-CtPARtRA.js} +1 -1
- package/dist/gateway/static/root/assets/{capabilities-CpwoMqtm.js → capabilities-B5gHYD8r.js} +1 -1
- package/dist/gateway/static/root/assets/{capabilities-DcD15BrU.js → capabilities-G2ZaAAs2.js} +1 -1
- package/dist/gateway/static/root/assets/{capabilities-page-x_AS_XJ0.js → capabilities-page-C6KCaaHR.js} +2 -2
- package/dist/gateway/static/root/assets/{capabilities-settings-panel-DMgEXxkC.js → capabilities-settings-panel-CVwdxuL4.js} +1 -1
- package/dist/gateway/static/root/assets/{channels-565FQAGr.js → channels-Bh2bHLni.js} +1 -1
- package/dist/gateway/static/root/assets/{chat-agents-api-BfsNH-ht.js → chat-agents-api-DRKlkcuv.js} +1 -1
- package/dist/gateway/static/root/assets/{chat-chart-block-Dpolmx0-.js → chat-chart-block-DxTCx__V.js} +1 -1
- package/dist/gateway/static/root/assets/{chat-page-Bn44NcvF.js → chat-page-oy4EGdO1.js} +31 -31
- package/dist/gateway/static/root/assets/{chat-terminal-dock-D6fuI2tI.js → chat-terminal-dock-Ch74AWYF.js} +1 -1
- package/dist/gateway/static/root/assets/{command-palette-api-H3lCPfK8.js → command-palette-api-CAKoTF_-.js} +1 -1
- package/dist/gateway/static/root/assets/{composer-model-config-control-BcWrGT5D.js → composer-model-config-control-Bas1wFVW.js} +1 -1
- package/dist/gateway/static/root/assets/{composer-notifications-0fMBrXZD.js → composer-notifications-CpBgWAE4.js} +1 -1
- package/dist/gateway/static/root/assets/{composer-payload-handoff-DCGudJjU.js → composer-payload-handoff-uT_hvvap.js} +1 -1
- package/dist/gateway/static/root/assets/{computer-settings-page-kvYzJ_j2.js → computer-settings-page-x8YUBBuX.js} +1 -1
- package/dist/gateway/static/root/assets/{connected-providers-grid-CApjiM_x.js → connected-providers-grid-DS21-u3Q.js} +1 -1
- package/dist/gateway/static/root/assets/{connection-usage-guide-C2qOP6Nx.js → connection-usage-guide-DNNFESD9.js} +1 -1
- package/dist/gateway/static/root/assets/{connector-service-page-DKihi3WL.js → connector-service-page-BS7IJ6oc.js} +1 -1
- package/dist/gateway/static/root/assets/{connectors-api-Dj9RbG9p.js → connectors-api-B27sJ651.js} +1 -1
- package/dist/gateway/static/root/assets/{connectors-page-CR6a3Mne.js → connectors-page-DM6TppXV.js} +1 -1
- package/dist/gateway/static/root/assets/{date-picker-BX5tr0IG.js → date-picker-D3N2BGVY.js} +1 -1
- package/dist/gateway/static/root/assets/{date-time-picker-CdPsuK2A.js → date-time-picker-BNw099Is.js} +1 -1
- package/dist/gateway/static/root/assets/{desktop-pet-DRfOb9ZT.js → desktop-pet-BtY6aGrh.js} +1 -1
- package/dist/gateway/static/root/assets/{desktop-pet-settings-D6qCAFLe.js → desktop-pet-settings-DVXfAMaU.js} +1 -1
- package/dist/gateway/static/root/assets/{dev-view-store-DrRxtile.js → dev-view-store-D4EyUkRI.js} +1 -1
- package/dist/gateway/static/root/assets/{device-connections-panel-Drbw9eRH.js → device-connections-panel-DYK_DQzO.js} +1 -1
- package/dist/gateway/static/root/assets/{device-pairing-action-Dd2YtIhH.js → device-pairing-action-DXo8MWy2.js} +1 -1
- package/dist/gateway/static/root/assets/{device-pairing-wizard-wtsyHEO3.js → device-pairing-wizard-NddAztJ2.js} +1 -1
- package/dist/gateway/static/root/assets/{directory-picker-path-field-B3YBba3x.js → directory-picker-path-field-Bbq7ZyGn.js} +1 -1
- package/dist/gateway/static/root/assets/{extension-authoritative-grants-WXYRv5nA.js → extension-authoritative-grants-qpYvHriJ.js} +1 -1
- package/dist/gateway/static/root/assets/{extension-debug-page-CKeIq8S2.js → extension-debug-page-BOb-6rpq.js} +1 -1
- package/dist/gateway/static/root/assets/{extension-iframe-host-Cv4PCSVv.js → extension-iframe-host-DpgIPfJe.js} +1 -1
- package/dist/gateway/static/root/assets/{extension-marketplace-api-e0e9OxOT.js → extension-marketplace-api-BhGNQYHl.js} +1 -1
- package/dist/gateway/static/root/assets/{extension-message-router-GPlMiYyF.js → extension-message-router-QjbtEYyu.js} +1 -1
- package/dist/gateway/static/root/assets/{extension-page-DcP7IEMp.js → extension-page-BOp7wU9Y.js} +1 -1
- package/dist/gateway/static/root/assets/{extension-provider-DZ97b5uA.js → extension-provider-CFPicsnW.js} +1 -1
- package/dist/gateway/static/root/assets/{extension-settings-page-DIYoawnA.js → extension-settings-page-cXjBvPwg.js} +1 -1
- package/dist/gateway/static/root/assets/{gateway-config-swr-aAsaoOK1.js → gateway-config-swr-DxelrRtx.js} +1 -1
- package/dist/gateway/static/root/assets/gateway-realtime-D2B_nv2b.js +1 -0
- package/dist/gateway/static/root/assets/gateway-realtime-store-DrVbjYfI.js +1 -0
- package/dist/gateway/static/root/assets/{gateway-restart-BY6zJgTe.js → gateway-restart-Ce6rCCAr.js} +1 -1
- package/dist/gateway/static/root/assets/{gateway-settings-4TvJ0_i0.js → gateway-settings-BTr0Gwdo.js} +1 -1
- package/dist/gateway/static/root/assets/{gateway-startup-retry-D0dDJJQ4.js → gateway-startup-retry-Dm0dK8BT.js} +1 -1
- package/dist/gateway/static/root/assets/{global-defaults-api-9iooq81U.js → global-defaults-api-BZnu44eA.js} +1 -1
- package/dist/gateway/static/root/assets/{home-page-VMzHth7Q.js → home-page-BmoT_EN4.js} +3 -3
- package/dist/gateway/static/root/assets/{home-task-actions-iUYzLb18.js → home-task-actions-Ck0AhcYe.js} +1 -1
- package/dist/gateway/static/root/assets/{image-generation-api-Dv4fjHaE.js → image-generation-api-DrZPmWFt.js} +1 -1
- package/dist/gateway/static/root/assets/{imports-page-WENCxW7P.js → imports-page-D-x5kijk.js} +1 -1
- package/dist/gateway/static/root/assets/index-BiQP7-5r.js +11 -0
- package/dist/gateway/static/root/assets/index-CREeN6C_.css +1 -0
- package/dist/gateway/static/root/assets/{install-connector-dialog-DNY-rpBC.js → install-connector-dialog-st2O1bez.js} +1 -1
- package/dist/gateway/static/root/assets/{keyboard-shortcuts-settings-DHWEGna7.js → keyboard-shortcuts-settings-DnKkQoqR.js} +1 -1
- package/dist/gateway/static/root/assets/{local-app-workbench-page-Dnug0YtC.js → local-app-workbench-page-CKHJa4K8.js} +1 -1
- package/dist/gateway/static/root/assets/{local-apps-page-Bjr4rrgT.js → local-apps-page-D28d-sO0.js} +1 -1
- package/dist/gateway/static/root/assets/{local-session-drafts-Z3PoR-8i.js → local-session-drafts-KkAOxXk5.js} +2 -2
- package/dist/gateway/static/root/assets/{locale-store-DgbX5Azb.js → locale-store-Dy0B0XDJ.js} +1 -1
- package/dist/gateway/static/root/assets/{logs-page-BIZvtqSJ.js → logs-page-BPuHO-iA.js} +1 -1
- package/dist/gateway/static/root/assets/{management-api-CJb5Vclf.js → management-api-BtTRehT0.js} +1 -1
- package/dist/gateway/static/root/assets/{management-settings-BjtIRkgJ.js → management-settings-B2R43Itv.js} +1 -1
- package/dist/gateway/static/root/assets/{markdown-view-lnMk_L03.js → markdown-view-ByuzuGRb.js} +1 -1
- package/dist/gateway/static/root/assets/{mcp-conversation-setup-page-kq0dZ2Nc.js → mcp-conversation-setup-page-D_6XeyXG.js} +1 -1
- package/dist/gateway/static/root/assets/{media-plugins-RU49QGcW.js → media-plugins-B9Q7WvNF.js} +1 -1
- package/dist/gateway/static/root/assets/messages-Bj6DCoic.js +3 -0
- package/dist/gateway/static/root/assets/{model-selector-BolKz5sx.js → model-selector-8FTrQQ2N.js} +1 -1
- package/dist/gateway/static/root/assets/{models-hub-cache-CjdnTF5z.js → models-hub-cache-DMBOw544.js} +1 -1
- package/dist/gateway/static/root/assets/{new-session-preferences-gb411vZP.js → new-session-preferences-CxCn2Jxk.js} +1 -1
- package/dist/gateway/static/root/assets/{note-detail-panel-Qm1Et_f8.js → note-detail-panel-CYNPJVVE.js} +3 -3
- package/dist/gateway/static/root/assets/note-image-lightbox-D20oZuOM.js +1 -0
- package/dist/gateway/static/root/assets/{notes-api-FjHO1h6b.js → notes-api-M1FuRZbW.js} +1 -1
- package/dist/gateway/static/root/assets/{notes-page-B_atfwwi.js → notes-page-Dpd98vQp.js} +1 -1
- package/dist/gateway/static/root/assets/{oauth-api-B1lbdI3v.js → oauth-api-Dza1tHcr.js} +1 -1
- package/dist/gateway/static/root/assets/{oauth-provider-connect-Cy1Yy8aX.js → oauth-provider-connect-BPNIEiMv.js} +1 -1
- package/dist/gateway/static/root/assets/{page-context-capture-button-Phh-SyES.js → page-context-capture-button-DpGnxSrD.js} +1 -1
- package/dist/gateway/static/root/assets/{page-context-draft-M04A73Ul.js → page-context-draft-CHAS3BY3.js} +1 -1
- package/dist/gateway/static/root/assets/{page-header-store-CYA4Isnf.js → page-header-store-BXED3zhV.js} +1 -1
- package/dist/gateway/static/root/assets/{personal-avatar-DF3Frmnt.js → personal-avatar-BCk4KoeZ.js} +1 -1
- package/dist/gateway/static/root/assets/{personal-page-DkDROUWV.js → personal-page-BfljqOp5.js} +1 -1
- package/dist/gateway/static/root/assets/{personal-profile-settings-LAAXGLKs.js → personal-profile-settings-C86FBPOH.js} +1 -1
- package/dist/gateway/static/root/assets/{personal-settings-panel-B6G-4av9.js → personal-settings-panel-BlPLE0Ip.js} +1 -1
- package/dist/gateway/static/root/assets/{phone-dependencies-card-DeBlKu7M.js → phone-dependencies-card-BCob98OY.js} +1 -1
- package/dist/gateway/static/root/assets/{phone-model-connection-TStZicIQ.js → phone-model-connection-D-CcYcch.js} +1 -1
- package/dist/gateway/static/root/assets/{phone-model-picker-C3xcbacO.js → phone-model-picker-eMe7fmZu.js} +1 -1
- package/dist/gateway/static/root/assets/{phone-settings-page-CllfdPFi.js → phone-settings-page-D7yXeGmR.js} +1 -1
- package/dist/gateway/static/root/assets/{phone-workspace-store-CeP3GXUk.js → phone-workspace-store-CcA_vo-t.js} +1 -1
- package/dist/gateway/static/root/assets/{plugin-details-dialog-Ck1dirgu.js → plugin-details-dialog-BAmodjSZ.js} +1 -1
- package/dist/gateway/static/root/assets/{preference-select-fields-DMClbggY.js → preference-select-fields-BBd5CWkM.js} +1 -1
- package/dist/gateway/static/root/assets/{preview-runtime-Cl-SoLXg.js → preview-runtime-DUJ7XhMP.js} +3 -3
- package/dist/gateway/static/root/assets/{product-automation-feedback-Bb_lbw1l.js → product-automation-feedback-BDFpFrSs.js} +1 -1
- package/dist/gateway/static/root/assets/{product-open-page-BWH54iuf.js → product-open-page-t3hsoYql.js} +1 -1
- package/dist/gateway/static/root/assets/{product-preview-content-NOZu0WO2.js → product-preview-content-BM0pjf0F.js} +1 -1
- package/dist/gateway/static/root/assets/{product-preview-modal-ZKiIeKof.js → product-preview-modal-CLQcCVjI.js} +2 -2
- package/dist/gateway/static/root/assets/project-detail-page-CcnOT_aq.js +7 -0
- package/dist/gateway/static/root/assets/{project-understanding-BWpcOkWw.js → project-understanding-CwtdVbMP.js} +1 -1
- package/dist/gateway/static/root/assets/{projects-page-Dnx2AcQX.js → projects-page-ESAmJ4I_.js} +1 -1
- package/dist/gateway/static/root/assets/{providers-api-BRAMBKCK.js → providers-api-CR7FJzt-.js} +1 -1
- package/dist/gateway/static/root/assets/{recording-upload-C0d2YjJV.js → recording-upload-DrgujKBt.js} +1 -1
- package/dist/gateway/static/root/assets/{registry-api-Dz4umdY3.js → registry-api-CaBz9f4g.js} +1 -1
- package/dist/gateway/static/root/assets/{remote-access-hub-BEIzBYdj.js → remote-access-hub-CB-Js5gd.js} +1 -1
- package/dist/gateway/static/root/assets/{resource-unavailable-82byHwG_.js → resource-unavailable-DiPPmZsR.js} +1 -1
- package/dist/gateway/static/root/assets/right-workspace-store-DsVm6C0V.js +1 -0
- package/dist/gateway/static/root/assets/{route-preload-DkUojqyb.js → route-preload-CsBdFJHO.js} +2 -2
- package/dist/gateway/static/root/assets/{routine-panel-wJxaH-1V.js → routine-panel-pVuJtctD.js} +2 -2
- package/dist/gateway/static/root/assets/{runtime-tools-api-CQ7fTX-H.js → runtime-tools-api-utBemmh4.js} +1 -1
- package/dist/gateway/static/root/assets/{runtime-tools-settings-panel-DZD-cEXM.js → runtime-tools-settings-panel-ChXrIluB.js} +1 -1
- package/dist/gateway/static/root/assets/{service-recommendation-list-CFJ8WBzq.js → service-recommendation-list-Dm5GcMRy.js} +1 -1
- package/dist/gateway/static/root/assets/{session-api-Dxhtjzoa.js → session-api-vEn4BzjV.js} +1 -1
- package/dist/gateway/static/root/assets/{session-manager-DvIGR4Sw.js → session-manager-7nbjJYyy.js} +2 -2
- package/dist/gateway/static/root/assets/{sessions-page-BDPieIpD.js → sessions-page-B__ftjgG.js} +1 -1
- package/dist/gateway/static/root/assets/settings-advanced-gate-DV-_ZdXD.js +1 -0
- package/dist/gateway/static/root/assets/{settings-advanced-section-1R7xRVEG.js → settings-advanced-section-DhKzGl03.js} +1 -1
- package/dist/gateway/static/root/assets/{settings-mode-store-D4-i8uQI.js → settings-mode-store-CQofc337.js} +1 -1
- package/dist/gateway/static/root/assets/{settings-page-DXo8rZFt.js → settings-page-BRAijVXZ.js} +1 -1
- package/dist/gateway/static/root/assets/{settings-page-header-BooYRGUH.js → settings-page-header-CiS6x6sn.js} +1 -1
- package/dist/gateway/static/root/assets/{settings-page-layout-BeHnqGAN.js → settings-page-layout-B-rj_rso.js} +1 -1
- package/dist/gateway/static/root/assets/{setup-interaction-page-DqmPSRNo.js → setup-interaction-page-DTgwtj55.js} +1 -1
- package/dist/gateway/static/root/assets/{setup-status-panel-c4yDTYiK.js → setup-status-panel-BhKPMIds.js} +1 -1
- package/dist/gateway/static/root/assets/{share-link-dialog-Cvma1jxB.js → share-link-dialog-WR7Op1vL.js} +1 -1
- package/dist/gateway/static/root/assets/{share-preview-page-BL6FwL4u.js → share-preview-page-DonmTI11.js} +1 -1
- package/dist/gateway/static/root/assets/{shares-api-BqIBNEtd.js → shares-api-CoRLwDnw.js} +1 -1
- package/dist/gateway/static/root/assets/{shares-settings-BoBOd-eB.js → shares-settings-UA91fiMV.js} +1 -1
- package/dist/gateway/static/root/assets/{skill-api-oDg0Zlyb.js → skill-api-BE-iPtTQ.js} +1 -1
- package/dist/gateway/static/root/assets/{skill-list-api-BvfKctht.js → skill-list-api-Dsfjdtuu.js} +1 -1
- package/dist/gateway/static/root/assets/{skill-reload-api-CnchMEV8.js → skill-reload-api-BIZJWow-.js} +1 -1
- package/dist/gateway/static/root/assets/{skills-page-CFZk_0nE.js → skills-page-1wvItQag.js} +1 -1
- package/dist/gateway/static/root/assets/{space-api-C_GoZOc_.js → space-api-E8VbAaEl.js} +1 -1
- package/dist/gateway/static/root/assets/space-page-CUwakPrj.js +2 -0
- package/dist/gateway/static/root/assets/{space-workbook-B8JGuyIf.js → space-workbook-CwltZeHG.js} +1 -1
- package/dist/gateway/static/root/assets/{system-settings-panel-DzNDyMOH.js → system-settings-panel-03a25GEc.js} +1 -1
- package/dist/gateway/static/root/assets/{task-detail-page-BmWkL-KH.js → task-detail-page-Cvx-XtFO.js} +1 -1
- package/dist/gateway/static/root/assets/{task-header-title-CCaEJNV4.js → task-header-title-DHb7z-hq.js} +1 -1
- package/dist/gateway/static/root/assets/{task-result-presentation-DwEf7Xf7.js → task-result-presentation-_VWkiekf.js} +1 -1
- package/dist/gateway/static/root/assets/{task-run-issue-notice-COE7ppvl.js → task-run-issue-notice-CqjS8_gi.js} +1 -1
- package/dist/gateway/static/root/assets/{tasks-CvOAtEHv.js → tasks-D8bnpu0N.js} +1 -1
- package/dist/gateway/static/root/assets/{terminal-panel-store-CHQ2xJtk.js → terminal-panel-store-BOHv5O2x.js} +1 -1
- package/dist/gateway/static/root/assets/{theme-store-Bij94a-6.js → theme-store-XNsFzxSj.js} +1 -1
- package/dist/gateway/static/root/assets/{tracing-settings-page-CKH4dKSl.js → tracing-settings-page-Y9z2HoGj.js} +1 -1
- package/dist/gateway/static/root/assets/{tunnel-api-ChjCCCGL.js → tunnel-api-XHGjcUi9.js} +1 -1
- package/dist/gateway/static/root/assets/turn-outcome-Bf3N3Bmj.js +1 -0
- package/dist/gateway/static/root/assets/{understanding-activity-store-BD1OXjlI.js → understanding-activity-store-BDBAkksk.js} +1 -1
- package/dist/gateway/static/root/assets/{understanding-refresh-store-BSVLFuVh.js → understanding-refresh-store-D7gBfD26.js} +1 -1
- package/dist/gateway/static/root/assets/{usage-page-v5c3aC-p.js → usage-page-DxESTMwa.js} +1 -1
- package/dist/gateway/static/root/assets/{use-autosave-teDzNJW4.js → use-autosave-D7zZrcsj.js} +1 -1
- package/dist/gateway/static/root/assets/{use-composer-attachments-rUl5n4_a.js → use-composer-attachments-CQwCTKAp.js} +1 -1
- package/dist/gateway/static/root/assets/{use-file-preview-expanded-BRjXpRde.js → use-file-preview-expanded-CA9vFUTT.js} +1 -1
- package/dist/gateway/static/root/assets/{use-generated-media-Bx6BscUT.js → use-generated-media-DX4_ne7C.js} +1 -1
- package/dist/gateway/static/root/assets/{use-personal-profile-Dz3wWaGt.js → use-personal-profile-CaCORKeL.js} +1 -1
- package/dist/gateway/static/root/assets/{use-personal-work-D-Tgi4DZ.js → use-personal-work-fvvZDK_7.js} +1 -1
- package/dist/gateway/static/root/assets/{use-realtime-voice-Bp81D6PV.js → use-realtime-voice-D9k997EW.js} +1 -1
- package/dist/gateway/static/root/assets/{use-share-link-D5HNXEIt.js → use-share-link-CqV3o-VZ.js} +1 -1
- package/dist/gateway/static/root/assets/{use-workspace-tree-DXKhfc1T.js → use-workspace-tree-nnrez9-d.js} +1 -1
- package/dist/gateway/static/root/assets/{user-model-page-B0tEc4rh.js → user-model-page-CpVdbSxS.js} +1 -1
- package/dist/gateway/static/root/assets/{voice-api-key-field-odum3GZx.js → voice-api-key-field-CVi3dBKx.js} +1 -1
- package/dist/gateway/static/root/assets/{voice-config-api-CiA2cr3s.js → voice-config-api-DZbcg7qD.js} +1 -1
- package/dist/gateway/static/root/assets/{voice-input-shortcut-events-JsEfJGJz.js → voice-input-shortcut-events-CwKpIInD.js} +1 -1
- package/dist/gateway/static/root/assets/{voice-player-store-CUV5cpmX.js → voice-player-store-DT0f9GPa.js} +1 -1
- package/dist/gateway/static/root/assets/{voice-settings-FOeRWVH4.js → voice-settings-CJdWnHas.js} +1 -1
- package/dist/gateway/static/root/assets/{work-discovery-overlay-CJxXUdeq.js → work-discovery-overlay-qEN1Ikir.js} +1 -1
- package/dist/gateway/static/root/assets/{work-discovery-page-Dm0XTxsk.js → work-discovery-page-JjCyt1Kw.js} +1 -1
- package/dist/gateway/static/root/assets/{working-directory-picker-modal-DfyyBJpb.js → working-directory-picker-modal-DX6bRmkQ.js} +1 -1
- package/dist/gateway/static/root/assets/{workspace-api-B1JW3oZZ.js → workspace-api-CD_6YyPI.js} +2 -2
- package/dist/gateway/static/root/assets/workspace-editor-agent-store-BuYdf4CO.js +1 -0
- package/dist/gateway/static/root/assets/{workspace-file-preview-dialog-kGa6o4bV.js → workspace-file-preview-dialog-DdVyIRKm.js} +1 -1
- package/dist/gateway/static/root/assets/{workspace-open-location-menu-Dl4QsZL3.js → workspace-open-location-menu-BdXn5F2i.js} +1 -1
- package/dist/gateway/static/root/assets/{xopc-cloud-account-card-fiyk59YU.js → xopc-cloud-account-card-CLM7hfkN.js} +1 -1
- package/dist/gateway/static/root/index.html +96 -96
- package/dist/package.js +1 -1
- package/dist/packages/gateway-contract/src/session-input-command.js +2 -1
- package/dist/packages/gateway-contract/src/task-display.js +1 -1
- package/dist/packages/gateway-contract/src/task-research-result.js +5 -0
- package/dist/packages/realtime-client/src/index.js +6 -1
- package/dist/packages/realtime-protocol/src/browser-preview.js +111 -0
- package/dist/packages/realtime-protocol/src/index.js +5 -1
- package/dist/src/activity/emitter.js +1 -1
- package/dist/src/agent/agent-manager.d.ts +2 -2
- package/dist/src/agent/agent-manager.js +26 -23
- package/dist/src/agent/agent-scope.js +2 -2
- package/dist/src/agent/background-review/prompts.js +1 -1
- package/dist/src/agent/background-review/run-background-review.js +12 -12
- package/dist/src/agent/child-agent-factory.js +4 -4
- package/dist/src/agent/coding/repository-instructions.js +1 -1
- package/dist/src/agent/coding/workspace-revision.js +1 -1
- package/dist/src/agent/commands/command-isolation.js +1 -1
- package/dist/src/agent/commands/command-registry.js +1 -1
- package/dist/src/agent/context/coordinator.js +3 -3
- package/dist/src/agent/context/deep-recall.js +5 -5
- package/dist/src/agent/context/execution-context.js +1 -1
- package/dist/src/agent/context/project-context.js +4 -4
- package/dist/src/agent/context/workspace-seed.js +1 -1
- package/dist/src/agent/data-acquisition/git.js +1 -1
- package/dist/src/agent/data-acquisition/service.js +2 -2
- package/dist/src/agent/embedded/codemode-extension.js +1 -1
- package/dist/src/agent/embedded/codemode-output.js +2 -2
- package/dist/src/agent/embedded/execution-tool-policy.js +1 -1
- package/dist/src/agent/embedded/external-tool-discovery.js +1 -1
- package/dist/src/agent/embedded/index.js +1 -1
- package/dist/src/agent/embedded/model-runtime.js +1 -1
- package/dist/src/agent/embedded/run-for-session.js +14 -14
- package/dist/src/agent/embedded/run-turn.js +100 -35
- package/dist/src/agent/embedded/session-runner.js +7 -6
- package/dist/src/agent/embedded/types.d.ts +1 -1
- package/dist/src/agent/embedded/xopc-stream-bridge.js +3 -3
- package/dist/src/agent/embedded/xopc-tools-bridge.js +1 -1
- package/dist/src/agent/external-tools/cliProvider.js +5 -5
- package/dist/src/agent/external-tools/composio-provider.js +3 -3
- package/dist/src/agent/external-tools/endpoint-provider.js +9 -9
- package/dist/src/agent/external-tools/extension-provider.js +1 -1
- package/dist/src/agent/external-tools/gateway-tools.js +3 -3
- package/dist/src/agent/external-tools/index.js +1 -1
- package/dist/src/agent/external-tools/memory-provider.js +1 -1
- package/dist/src/agent/image/generation/openai-images-provider.js +1 -1
- package/dist/src/agent/image/generation/providers/xopc-cloud.js +2 -2
- package/dist/src/agent/image/generation/runtime.js +1 -1
- package/dist/src/agent/image/index.js +1 -1
- package/dist/src/agent/image/load-image-media.js +2 -2
- package/dist/src/agent/image/tool-model-config.js +1 -1
- package/dist/src/agent/inbound/attachment-pipeline.js +1 -1
- package/dist/src/agent/inbound/inbound-loop.js +9 -4
- package/dist/src/agent/independent-execution.js +3 -3
- package/dist/src/agent/index.js +1 -1
- package/dist/src/agent/mcp/connection-drafts.js +2 -2
- package/dist/src/agent/mcp/connection-setup.js +1 -1
- package/dist/src/agent/mcp/conversation-setup.js +1 -1
- package/dist/src/agent/mcp/discovery.js +2 -2
- package/dist/src/agent/mcp/managed-discovery.js +1 -1
- package/dist/src/agent/mcp/tool-catalog.js +1 -1
- package/dist/src/agent/mcp/weixin-setup-scope.js +2 -2
- package/dist/src/agent/memory/index.js +1 -1
- package/dist/src/agent/messaging/command-handler.js +1 -1
- package/dist/src/agent/messaging/outbound-coordinator.js +1 -1
- package/dist/src/agent/orchestration/agent-orchestrator.js +1 -1
- package/dist/src/agent/orchestration/child-run-resume.js +3 -3
- package/dist/src/agent/orchestration/llm-turn-retry.js +1 -1
- package/dist/src/agent/prompt/response-language.js +1 -1
- package/dist/src/agent/prompt/sections/tooling.d.ts +1 -0
- package/dist/src/agent/prompt/sections/tooling.js +7 -2
- package/dist/src/agent/prompt/service-prompt-builder.js +3 -3
- package/dist/src/agent/prompt/system-prompt.js +1 -0
- package/dist/src/agent/sandbox/exec-policy.js +2 -2
- package/dist/src/agent/sandbox/native-command.js +1 -1
- package/dist/src/agent/sandbox/path-policy.js +1 -1
- package/dist/src/agent/service/direct-turn-helpers.js +3 -3
- package/dist/src/agent/service/process-direct-streaming.js +7 -7
- package/dist/src/agent/service/webchat-tts.js +3 -3
- package/dist/src/agent/service.js +23 -21
- package/dist/src/agent/session/session-config-service.js +2 -2
- package/dist/src/agent/session/session-hydrator.js +1 -1
- package/dist/src/agent/session/session-inspector.js +1 -1
- package/dist/src/agent/skills/hub-hash.js +1 -1
- package/dist/src/agent/skills/hub-lock.js +1 -1
- package/dist/src/agent/skills/hub-pull.js +3 -3
- package/dist/src/agent/skills/index.js +1 -1
- package/dist/src/agent/skills/managed-store.js +1 -1
- package/dist/src/agent/skills/skill-manage-ops.js +1 -1
- package/dist/src/agent/skills/skill-manager.js +1 -1
- package/dist/src/agent/skills/skill-sources.js +2 -2
- package/dist/src/agent/tasks/task-judge-service.js +7 -7
- package/dist/src/agent/tools/browser/tool/browser-use-tool.js +71 -17
- package/dist/src/agent/tools/browser/tool/schemas.d.ts +3 -1
- package/dist/src/agent/tools/browser/tool/schemas.js +12 -1
- package/dist/src/agent/tools/communication.d.ts +1 -0
- package/dist/src/agent/tools/communication.js +10 -3
- package/dist/src/agent/tools/create-share-tool.js +1 -1
- package/dist/src/agent/tools/delegate-tool.js +4 -4
- package/dist/src/agent/tools/exec-command.js +1 -1
- package/dist/src/agent/tools/factory.js +38 -21
- package/dist/src/agent/tools/image-generate-tool.d.ts +7 -0
- package/dist/src/agent/tools/image-generate-tool.js +23 -3
- package/dist/src/agent/tools/index.js +4 -4
- package/dist/src/agent/tools/knowledge-memory-tool.js +1 -1
- package/dist/src/agent/tools/managed-job-tool.js +1 -1
- package/dist/src/agent/tools/personal-attention-tool.js +1 -1
- package/dist/src/agent/tools/personal-memory-tool.js +4 -4
- package/dist/src/agent/tools/personal-read-tool.js +1 -1
- package/dist/src/agent/tools/personal-request-result-tool.js +2 -2
- package/dist/src/agent/tools/personal-request-tool.js +2 -2
- package/dist/src/agent/tools/personal-result-tool.js +1 -1
- package/dist/src/agent/tools/personal-task-tool.js +84 -21
- package/dist/src/agent/tools/publish-artifacts.js +1 -1
- package/dist/src/agent/tools/read.js +1 -1
- package/dist/src/agent/tools/review-workspace.js +2 -2
- package/dist/src/agent/tools/scoped-workspace-tools.js +1 -1
- package/dist/src/agent/tools/send-media.d.ts +1 -0
- package/dist/src/agent/tools/send-media.js +7 -4
- package/dist/src/agent/tools/session-recall-tool.js +10 -2
- package/dist/src/agent/tools/session-search-tool.js +2 -2
- package/dist/src/agent/tools/task-collaboration-tool.js +2 -2
- package/dist/src/agent/tools/task-result-tool.js +10 -9
- package/dist/src/agent/tools/tool-media.d.ts +1 -0
- package/dist/src/agent/tools/tool-media.js +14 -1
- package/dist/src/agent/tools/tts-tool.js +1 -1
- package/dist/src/agent/tools/user-context-tool.js +1 -1
- package/dist/src/agent/tools/web-extract.js +1 -1
- package/dist/src/agent/tools/web.js +6 -4
- package/dist/src/agent/tools/workbook-tools.js +1 -1
- package/dist/src/agent/tools/write.js +1 -1
- package/dist/src/agent/tools/xopc-use-tool.js +11 -11
- package/dist/src/agent-catalog/capabilities.js +1 -1
- package/dist/src/agent-catalog/repository.js +1 -1
- package/dist/src/ai-assist/text-assist.js +1 -1
- package/dist/src/auth/credentials.js +1 -1
- package/dist/src/auth/oauth/openai.js +1 -1
- package/dist/src/auth/oauth/xopc-cloud.js +1 -1
- package/dist/src/auth/oauth-provider-lock.js +1 -1
- package/dist/src/auth/profiles/store.js +1 -1
- package/dist/src/auth/sync-provider-auth.js +1 -1
- package/dist/src/automations/capabilities/write.js +1 -1
- package/dist/src/automations/delivery/delivery-router.js +1 -1
- package/dist/src/automations/domain/index.js +1 -1
- package/dist/src/automations/draft/automation-draft-service.js +1 -1
- package/dist/src/automations/index.js +2 -2
- package/dist/src/automations/service/action-executor.js +1 -1
- package/dist/src/automations/service/automation-service.js +3 -3
- package/dist/src/backup/archive.js +4 -4
- package/dist/src/bootstrap/application-state.js +1 -1
- package/dist/src/browser/assistance.d.ts +34 -0
- package/dist/src/browser/assistance.js +243 -0
- package/dist/src/browser/cache-dir-policy.js +1 -1
- package/dist/src/browser/drivers/browser-driver.d.ts +45 -0
- package/dist/src/browser/drivers/extension-driver.d.ts +2 -0
- package/dist/src/browser/drivers/extension-driver.js +11 -1
- package/dist/src/browser/drivers/playwright-driver.d.ts +2 -1
- package/dist/src/browser/drivers/playwright-driver.js +161 -0
- package/dist/src/browser/managed-live-runtime.d.ts +79 -0
- package/dist/src/browser/managed-live-runtime.js +313 -0
- package/dist/src/browser/native-messaging-host.js +2 -2
- package/dist/src/browser/providers/browser-ext-install.js +4 -4
- package/dist/src/browser/runtime/browser-runtime.d.ts +24 -1
- package/dist/src/browser/runtime/browser-runtime.js +68 -5
- package/dist/src/capabilities/capability-catalog.js +3 -3
- package/dist/src/capabilities/readiness/from-config.js +2 -2
- package/dist/src/capabilities/runtime/dispatcher.js +1 -1
- package/dist/src/channels/channel-domain.d.ts +1 -0
- package/dist/src/channels/enterprise/media.d.ts +14 -0
- package/dist/src/channels/enterprise/media.js +208 -0
- package/dist/src/channels/enterprise/plugin.d.ts +4 -0
- package/dist/src/channels/enterprise/plugin.js +40 -12
- package/dist/src/channels/format.js +1 -1
- package/dist/src/channels/index.js +2 -2
- package/dist/src/channels/internal-outbound.d.ts +2 -0
- package/dist/src/channels/internal-outbound.js +17 -1
- package/dist/src/channels/lifecycle-supervisor.js +1 -1
- package/dist/src/channels/outbound-sender.js +1 -1
- package/dist/src/channels/pairing/allow-from-file.js +9 -9
- package/dist/src/channels/pairing/pairing-service.js +1 -1
- package/dist/src/channels/pairing/pairing-store.js +6 -6
- package/dist/src/chat-commands/agent-edit.js +1 -1
- package/dist/src/chat-commands/builtins/config.js +4 -4
- package/dist/src/chat-commands/builtins/review.js +1 -1
- package/dist/src/chat-commands/builtins/tts.js +1 -1
- package/dist/src/chat-commands/builtins/understanding.js +1 -1
- package/dist/src/chat-commands/context.js +2 -2
- package/dist/src/chat-commands/index.js +2 -2
- package/dist/src/cli/commands/agent.js +7 -7
- package/dist/src/cli/commands/browser-cli-helpers.js +1 -1
- package/dist/src/cli/commands/config.js +1 -1
- package/dist/src/cli/commands/doctor/checks/database-schema.js +1 -1
- package/dist/src/cli/commands/doctor/checks/image-providers.js +1 -1
- package/dist/src/cli/commands/doctor/checks/provider-auth.js +2 -2
- package/dist/src/cli/commands/doctor/checks/tool-runtimes.js +1 -1
- package/dist/src/cli/commands/extension-agent-plugin.js +3 -3
- package/dist/src/cli/commands/extension-dev.js +1 -1
- package/dist/src/cli/commands/extension-marketplace.js +3 -3
- package/dist/src/cli/commands/extension-pack.js +1 -1
- package/dist/src/cli/commands/extension.js +2 -2
- package/dist/src/cli/commands/image.js +1 -1
- package/dist/src/cli/commands/init.js +1 -1
- package/dist/src/cli/commands/mcp.js +2 -2
- package/dist/src/cli/commands/models.js +5 -5
- package/dist/src/cli/commands/onboard/model.js +2 -2
- package/dist/src/cli/commands/onboard.js +1 -1
- package/dist/src/cli/commands/project.js +2 -2
- package/dist/src/cli/commands/runtime.js +1 -1
- package/dist/src/cli/commands/skills.js +2 -2
- package/dist/src/cli/commands/tunnel.js +3 -3
- package/dist/src/cli/extension-cli-register.js +5 -5
- package/dist/src/cli/utils/gateway-client.js +1 -1
- package/dist/src/cli/utils/init-workspace-core.js +3 -3
- package/dist/src/computer/broker.js +1 -1
- package/dist/src/computer/model-adapter.js +1 -1
- package/dist/src/computer/runtime.js +12 -12
- package/dist/src/config/config-file.js +1 -1
- package/dist/src/config/index.js +6 -6
- package/dist/src/config/loader.js +2 -2
- package/dist/src/config/models-json.js +1 -1
- package/dist/src/config/paths-state.js +1 -1
- package/dist/src/config/schema.js +2 -2
- package/dist/src/config/workspace-path.js +1 -1
- package/dist/src/connectors/cli/authorization.js +1 -1
- package/dist/src/connectors/cli/installer.js +1 -1
- package/dist/src/connectors/connected-source-ingestion.js +2 -2
- package/dist/src/connectors/connected-source-understanding.js +4 -4
- package/dist/src/connectors/connection-recovery-service.js +4 -4
- package/dist/src/connectors/content-enrichment.js +2 -2
- package/dist/src/connectors/health.js +1 -1
- package/dist/src/daemon/constants.js +1 -1
- package/dist/src/daemon/install-plan.js +1 -1
- package/dist/src/daemon/launchd.js +1 -1
- package/dist/src/daemon/schtasks.js +1 -1
- package/dist/src/daemon/systemd.js +1 -1
- package/dist/src/discussions/action-tasks.js +1 -1
- package/dist/src/discussions/live-worker.js +1 -1
- package/dist/src/discussions/recording.js +2 -2
- package/dist/src/discussions/repository.js +1 -1
- package/dist/src/discussions/sealer.js +2 -2
- package/dist/src/discussions/service.js +1 -1
- package/dist/src/endpoint-tools/delegation.js +1 -1
- package/dist/src/endpoint-tools/invocation-service.js +2 -2
- package/dist/src/endpoint-tools/target-resolver.js +1 -1
- package/dist/src/endpoint-tools/upload-service.js +1 -1
- package/dist/src/execution-environments/local-worktree-manager.js +1 -1
- package/dist/src/execution-environments/session-environment-service.js +1 -1
- package/dist/src/execution-environments/worktree-safety.js +1 -1
- package/dist/src/extensions/activation-context.js +4 -4
- package/dist/src/extensions/agent-plugins/auth.js +2 -2
- package/dist/src/extensions/agent-plugins/branding.js +1 -1
- package/dist/src/extensions/agent-plugins/cli-authorization.js +2 -2
- package/dist/src/extensions/agent-plugins/mcp-adapter.js +2 -2
- package/dist/src/extensions/agent-plugins/resources.js +1 -1
- package/dist/src/extensions/agent-plugins/setup.js +2 -2
- package/dist/src/extensions/agent-plugins/skill-catalog.js +2 -2
- package/dist/src/extensions/agent-plugins/source-catalog.js +2 -2
- package/dist/src/extensions/agent-plugins/sources.js +1 -1
- package/dist/src/extensions/agent-plugins/store.js +2 -2
- package/dist/src/extensions/agent-plugins/user-config.js +1 -1
- package/dist/src/extensions/agent-plugins/validation.js +2 -2
- package/dist/src/extensions/api.js +2 -2
- package/dist/src/extensions/bundled-extension-activation.js +1 -1
- package/dist/src/extensions/index.js +1 -1
- package/dist/src/extensions/loader.js +3 -3
- package/dist/src/extensions/lockfile.js +1 -1
- package/dist/src/extensions/sdk/index.js +1 -1
- package/dist/src/extensions/sdk/media.js +1 -1
- package/dist/src/extensions/update.js +2 -2
- package/dist/src/files/file-service.js +1 -1
- package/dist/src/files/workspace-file-spaces.js +1 -1
- package/dist/src/gateway/agent-reactions/reaction.js +2 -2
- package/dist/src/gateway/agents-admin.js +1 -1
- package/dist/src/gateway/device-routes.js +1 -1
- package/dist/src/gateway/file-path-classifier.js +2 -2
- package/dist/src/gateway/global-defaults-admin.js +1 -1
- package/dist/src/gateway/hono/app.js +2 -2
- package/dist/src/gateway/hono/lib/config-payload.js +5 -5
- package/dist/src/gateway/hono/lib/static-ui.js +1 -1
- package/dist/src/gateway/hono/oauth-async.js +1 -1
- package/dist/src/gateway/hono/routes/agent-plugins.js +2 -2
- package/dist/src/gateway/hono/routes/auth-registry-extensions.js +7 -7
- package/dist/src/gateway/hono/routes/browser.js +297 -1
- package/dist/src/gateway/hono/routes/channels.js +1 -1
- package/dist/src/gateway/hono/routes/commands-skills.js +5 -5
- package/dist/src/gateway/hono/routes/config-patch/gateway.js +1 -1
- package/dist/src/gateway/hono/routes/config-patch/misc.js +1 -1
- package/dist/src/gateway/hono/routes/connectors.js +1 -1
- package/dist/src/gateway/hono/routes/device-connections.js +3 -3
- package/dist/src/gateway/hono/routes/device-push.js +7 -2
- package/dist/src/gateway/hono/routes/device-targets.js +1 -1
- package/dist/src/gateway/hono/routes/endpoint-tools.js +1 -1
- package/dist/src/gateway/hono/routes/execution-environments.js +4 -0
- package/dist/src/gateway/hono/routes/files.js +1 -1
- package/dist/src/gateway/hono/routes/home.js +1 -1
- package/dist/src/gateway/hono/routes/host-fs.js +1 -1
- package/dist/src/gateway/hono/routes/local-app-capabilities.js +1 -1
- package/dist/src/gateway/hono/routes/local-apps.js +1 -1
- package/dist/src/gateway/hono/routes/location-sharing.js +1 -1
- package/dist/src/gateway/hono/routes/mcp.js +1 -1
- package/dist/src/gateway/hono/routes/memory-learning.js +2 -2
- package/dist/src/gateway/hono/routes/mobile-capability-actions.js +5 -5
- package/dist/src/gateway/hono/routes/mobile-capability-panels.js +13 -13
- package/dist/src/gateway/hono/routes/mobile-model-settings.js +16 -8
- package/dist/src/gateway/hono/routes/models.js +10 -10
- package/dist/src/gateway/hono/routes/music-generation.js +1 -1
- package/dist/src/gateway/hono/routes/notes.js +3 -3
- package/dist/src/gateway/hono/routes/notifications.js +11 -7
- package/dist/src/gateway/hono/routes/observability.js +1 -1
- package/dist/src/gateway/hono/routes/personal-agent.js +2 -2
- package/dist/src/gateway/hono/routes/phone-setup.js +4 -4
- package/dist/src/gateway/hono/routes/phone.js +2 -2
- package/dist/src/gateway/hono/routes/projects.js +7 -8
- package/dist/src/gateway/hono/routes/session-command-handler.js +3 -2
- package/dist/src/gateway/hono/routes/session-input-handler.d.ts +2 -0
- package/dist/src/gateway/hono/routes/session-input-handler.js +3 -3
- package/dist/src/gateway/hono/routes/sessions.js +3 -3
- package/dist/src/gateway/hono/routes/shares.js +3 -3
- package/dist/src/gateway/hono/routes/side-chats.js +1 -1
- package/dist/src/gateway/hono/routes/status.js +1 -1
- package/dist/src/gateway/hono/routes/tasks.js +1 -1
- package/dist/src/gateway/hono/routes/tui.js +1 -1
- package/dist/src/gateway/hono/routes/user-model.js +6 -6
- package/dist/src/gateway/hono/routes/video-generation.js +2 -2
- package/dist/src/gateway/hono/routes/voice.js +8 -8
- package/dist/src/gateway/image-generation-setup.js +2 -2
- package/dist/src/gateway/lock.js +11 -11
- package/dist/src/gateway/media-access.js +2 -2
- package/dist/src/gateway/mobile-privacy.js +2 -2
- package/dist/src/gateway/next-turn-suggestions/snapshot.js +1 -1
- package/dist/src/gateway/ports.js +7 -7
- package/dist/src/gateway/provider-model-setup.js +2 -2
- package/dist/src/gateway/security/device-request-proof.js +1 -1
- package/dist/src/gateway/security/gateway-scopes.js +4 -0
- package/dist/src/gateway/server.js +1 -1
- package/dist/src/gateway/service/agent-runner.js +3 -3
- package/dist/src/gateway/service/config-coordinator.js +4 -4
- package/dist/src/gateway/service/marketplace-service.js +2 -2
- package/dist/src/gateway/service/run-gateway-agent.js +9 -7
- package/dist/src/gateway/service/session-command-service.js +6 -4
- package/dist/src/gateway/service/session-input-coordinator.d.ts +1 -0
- package/dist/src/gateway/service/session-input-coordinator.js +14 -4
- package/dist/src/gateway/service/session-preparation-worker.js +6 -2
- package/dist/src/gateway/service/sessions-api.js +1 -1
- package/dist/src/gateway/service.d.ts +6 -0
- package/dist/src/gateway/service.js +86 -47
- package/dist/src/gateway/session-context-summary.js +1 -1
- package/dist/src/gateway/workspace-editor-path.js +2 -2
- package/dist/src/gateway/xopc-cloud-capability-setup.js +4 -4
- package/dist/src/home-intelligence/follow-ups.js +2 -2
- package/dist/src/home-intelligence/generator.js +2 -2
- package/dist/src/home-intelligence/host.js +1 -1
- package/dist/src/home-intelligence/observation.js +1 -1
- package/dist/src/home-intelligence/repository.js +1 -1
- package/dist/src/home-intelligence/routines.js +3 -3
- package/dist/src/imports/files.js +1 -1
- package/dist/src/imports/importService.js +1 -1
- package/dist/src/imports/inventory.js +3 -3
- package/dist/src/imports/planner.js +1 -1
- package/dist/src/imports/scanner.js +1 -1
- package/dist/src/imports/sources.js +1 -1
- package/dist/src/infra/brew.js +1 -1
- package/dist/src/infra/gateway-processes.js +2 -2
- package/dist/src/infra/package-runtime-check.js +1 -1
- package/dist/src/infra/path-env.js +4 -4
- package/dist/src/infra/ports.js +1 -1
- package/dist/src/infra/process-diagnostics.js +1 -1
- package/dist/src/infra/ssh-tunnel.js +1 -1
- package/dist/src/infra/update-global.js +9 -9
- package/dist/src/infra/update-startup.js +1 -1
- package/dist/src/infra/write-file-atomic.js +1 -1
- package/dist/src/knowledge/connected-knowledge-pipeline.js +1 -1
- package/dist/src/knowledge/index.js +1 -1
- package/dist/src/local-apps/artifact-files.js +1 -1
- package/dist/src/local-apps/capabilities/delegate.js +1 -1
- package/dist/src/local-apps/execution-authority.js +2 -2
- package/dist/src/local-apps/p1-services.js +3 -3
- package/dist/src/local-apps/preview-sessions.js +1 -1
- package/dist/src/local-apps/preview-worker.js +1 -1
- package/dist/src/local-apps/public-assets.js +1 -1
- package/dist/src/local-apps/service.js +4 -4
- package/dist/src/local-apps/store.js +1 -1
- package/dist/src/markdown/index.js +1 -1
- package/dist/src/mcp/connection-grants.js +1 -1
- package/dist/src/mcp/delegation.js +5 -5
- package/dist/src/mcp/run-callback-subscriptions.d.ts +13 -0
- package/dist/src/mcp/run-callback-subscriptions.js +17 -0
- package/dist/src/mcp/run-callbacks.d.ts +1 -4
- package/dist/src/mcp/run-callbacks.js +9 -22
- package/dist/src/media/session-references.js +1 -1
- package/dist/src/media-shared/http/provider-http.js +1 -1
- package/dist/src/media-understanding/openai-compatible-audio.js +1 -1
- package/dist/src/media-understanding/runner.js +1 -1
- package/dist/src/memory-learning/choice-observations.js +6 -6
- package/dist/src/memory-learning/source-learning.js +4 -4
- package/dist/src/memory-learning/task-receipts.js +1 -1
- package/dist/src/memory-learning/work-capture.js +1 -1
- package/dist/src/memory-learning/work-review.js +3 -3
- package/dist/src/music-generation/artifact.js +3 -3
- package/dist/src/music-generation/worker.js +1 -1
- package/dist/src/notes/agent-context.js +3 -3
- package/dist/src/notes/service.js +2 -2
- package/dist/src/notes/store.js +1 -1
- package/dist/src/notifications/device-store.js +1 -1
- package/dist/src/notifications/platform-push.d.ts +2 -1
- package/dist/src/notifications/platform-push.js +4 -3
- package/dist/src/notifications/service.js +4 -4
- package/dist/src/notifications/store.js +1 -1
- package/dist/src/observability/runtime.js +1 -1
- package/dist/src/personal-agent/capability-service.js +1 -1
- package/dist/src/personal-agent/proactivity/repository.js +1 -1
- package/dist/src/personal-agent/proactivity/service.js +6 -6
- package/dist/src/personal-agent/prompt-context.js +4 -4
- package/dist/src/personal-agent/prompts.js +1 -1
- package/dist/src/personal-agent/reply-composer.js +12 -12
- package/dist/src/personal-agent/reply-style.d.ts +2 -2
- package/dist/src/personal-agent/reply-style.js +8 -7
- package/dist/src/personal-agent/request-delivery.js +2 -2
- package/dist/src/personal-agent/request-service.js +5 -5
- package/dist/src/personal-agent/result-reader.d.ts +2 -0
- package/dist/src/personal-agent/result-reader.js +16 -5
- package/dist/src/personal-agent/service.js +3 -3
- package/dist/src/personal-agent/specialist-capabilities.js +3 -2
- package/dist/src/personal-agent/task-cancel.js +1 -1
- package/dist/src/personal-agent/unread.js +1 -1
- package/dist/src/phone/adb-driver.js +3 -3
- package/dist/src/phone/cloud-adb-connection.js +2 -2
- package/dist/src/phone/execution-trace.js +1 -1
- package/dist/src/phone/hdc-driver.js +2 -2
- package/dist/src/phone/hdc-video-tools.js +1 -1
- package/dist/src/phone/model-adapter.js +2 -2
- package/dist/src/phone/runtime.js +4 -4
- package/dist/src/phone/ui-session.js +1 -1
- package/dist/src/platform/index.js +1 -1
- package/dist/src/project-trust/trust-store.js +1 -1
- package/dist/src/projects/index.js +4 -4
- package/dist/src/projects/project-kind.d.ts +0 -7
- package/dist/src/projects/project-kind.js +1 -6
- package/dist/src/projects/project-service.js +3 -11
- package/dist/src/projects/workspace-project.js +1 -1
- package/dist/src/projects/workspace.js +1 -1
- package/dist/src/providers/extension-stream-bridge.js +2 -2
- package/dist/src/providers/index.js +4 -4
- package/dist/src/providers/model-call.js +3 -3
- package/dist/src/providers/model-catalog-persistence.js +1 -1
- package/dist/src/providers/model-reference-auditor.js +1 -1
- package/dist/src/providers/model-registry.js +3 -3
- package/dist/src/providers/provider-disconnect-core.js +1 -1
- package/dist/src/providers/register-runtime-providers.js +1 -1
- package/dist/src/providers/setup/voice.js +1 -1
- package/dist/src/providers/xopc-cloud-catalog-coordinator.js +1 -1
- package/dist/src/providers/xopc-cloud-credit-budget.js +1 -1
- package/dist/src/providers/xopc-cloud-model-source.js +1 -1
- package/dist/src/realtime/browser-preview-ice.d.ts +2 -0
- package/dist/src/realtime/browser-preview-ice.js +42 -0
- package/dist/src/realtime/browser-preview.d.ts +45 -0
- package/dist/src/realtime/browser-preview.js +191 -0
- package/dist/src/realtime/runtime.d.ts +4 -1
- package/dist/src/realtime/runtime.js +53 -2
- package/dist/src/remote-access/exposure-manager.js +1 -1
- package/dist/src/review/review-git.js +1 -1
- package/dist/src/runtime-tools/downloader.js +1 -1
- package/dist/src/runtime-tools/harmony-dependencies.js +1 -1
- package/dist/src/runtime-tools/manager.js +2 -2
- package/dist/src/runtime-tools/phone-dependencies.js +1 -1
- package/dist/src/session/history-recall-policy.js +1 -1
- package/dist/src/session/index.js +2 -2
- package/dist/src/session/init-session-turn.js +1 -1
- package/dist/src/session/resolve-session.js +1 -1
- package/dist/src/session/session-title.js +1 -1
- package/dist/src/session/store.js +8 -8
- package/dist/src/session/thinking-resolve.js +1 -1
- package/dist/src/share/hosted-note-publication.js +1 -1
- package/dist/src/share/hosted-session-share.js +1 -1
- package/dist/src/share/hosted-static-site-publication.js +1 -1
- package/dist/src/share/session-share-service.js +1 -1
- package/dist/src/share/share-auto.js +1 -1
- package/dist/src/share/share-thumbnail.js +1 -1
- package/dist/src/share/share-zip.js +1 -1
- package/dist/src/share/site-proxy.js +2 -2
- package/dist/src/space/budget-workbook.js +1 -1
- package/dist/src/space/ingest.js +1 -1
- package/dist/src/space/repository.js +3 -3
- package/dist/src/space/workbook-turn.js +1 -1
- package/dist/src/space/worker.js +1 -1
- package/dist/src/storage/sqlite/ai-usage-repository.js +1 -1
- package/dist/src/storage/sqlite/clarification-wait-repository.js +2 -2
- package/dist/src/storage/sqlite/connection.js +11 -11
- package/dist/src/storage/sqlite/conversation-repository.js +2 -2
- package/dist/src/storage/sqlite/desktop-execution-repository.js +1 -1
- package/dist/src/storage/sqlite/desktop-execution-stop-repository.js +1 -1
- package/dist/src/storage/sqlite/device-access-repository.js +1 -1
- package/dist/src/storage/sqlite/device-pairing-approval.js +1 -1
- package/dist/src/storage/sqlite/index.js +1 -1
- package/dist/src/storage/sqlite/schema-upgrade.js +3 -3
- package/dist/src/storage/sqlite/session-creation-repository.d.ts +2 -0
- package/dist/src/storage/sqlite/session-creation-repository.js +25 -6
- package/dist/src/storage/sqlite/session-input-control-repository.js +1 -1
- package/dist/src/storage/sqlite/session-input-repository.js +2 -1
- package/dist/src/storage/sqlite/session-repository.js +1 -1
- package/dist/src/support/collect-support-report.js +1 -1
- package/dist/src/tasks/capabilities/management.js +1 -1
- package/dist/src/tasks/capabilities/read.js +2 -2
- package/dist/src/tasks/capabilities/relations.js +2 -2
- package/dist/src/tasks/capabilities/runs.js +1 -1
- package/dist/src/tasks/capabilities/write.js +3 -3
- package/dist/src/tasks/delegated-run-result.js +1 -1
- package/dist/src/tasks/home-query-service.js +1 -1
- package/dist/src/tasks/index.js +4 -4
- package/dist/src/tasks/task-allocation-service.js +8 -8
- package/dist/src/tasks/task-application-service.d.ts +1 -0
- package/dist/src/tasks/task-application-service.js +18 -7
- package/dist/src/tasks/task-context-assembler.js +4 -3
- package/dist/src/tasks/task-contract-planner.js +3 -2
- package/dist/src/tasks/task-criterion-review-repository.js +1 -1
- package/dist/src/tasks/task-deliverables.js +1 -1
- package/dist/src/tasks/task-execution-capabilities.js +1 -1
- package/dist/src/tasks/task-handoff-service.js +2 -2
- package/dist/src/tasks/task-handoff.d.ts +4 -0
- package/dist/src/tasks/task-handoff.js +58 -17
- package/dist/src/tasks/task-json-acceptance.js +2 -2
- package/dist/src/tasks/task-main-update-decision-service.js +4 -3
- package/dist/src/tasks/task-main-update-delivery.js +5 -3
- package/dist/src/tasks/task-model-call.js +1 -1
- package/dist/src/tasks/task-origin-repository.d.ts +2 -0
- package/dist/src/tasks/task-origin-repository.js +17 -0
- package/dist/src/tasks/task-read-model-projector.js +1 -1
- package/dist/src/tasks/task-research-repair.js +4 -2
- package/dist/src/tasks/task-research-result.d.ts +7 -0
- package/dist/src/tasks/task-research-result.js +137 -35
- package/dist/src/tasks/task-result-delivery-repository.js +1 -1
- package/dist/src/tasks/task-result-delivery-service.js +4 -4
- package/dist/src/tasks/task-retry-service.js +1 -1
- package/dist/src/tasks/task-run-coordinator.js +7 -7
- package/dist/src/tasks/task-run-dispatcher.js +2 -2
- package/dist/src/tasks/task-run-repository.js +1 -1
- package/dist/src/tasks/task-signal-service.js +1 -1
- package/dist/src/tasks/task-workspace-verification.js +2 -2
- package/dist/src/tui/backend-services.js +1 -1
- package/dist/src/tui/backends/embedded-backend.js +16 -16
- package/dist/src/tui/backends/embedded-drafts.js +1 -1
- package/dist/src/tui/backends/gateway-realtime-backend.js +1 -1
- package/dist/src/tui/clipboard-image.js +2 -2
- package/dist/src/tui/extension-host/load-extensions.js +2 -2
- package/dist/src/tui/tui-capabilities.js +2 -2
- package/dist/src/tui/tui-commands.js +4 -4
- package/dist/src/tui/tui-management.js +8 -8
- package/dist/src/tui/tui-picker-overlay.js +1 -1
- package/dist/src/tui/tui-skills-autocomplete.js +2 -2
- package/dist/src/tui/tui-startup-resources.js +3 -3
- package/dist/src/tui/tui.js +9 -9
- package/dist/src/tunnel/frpc-binary.js +2 -2
- package/dist/src/tunnel/gateway-lifecycle.js +1 -1
- package/dist/src/usage/cloud-capability.js +1 -1
- package/dist/src/usage/recorder.js +2 -2
- package/dist/src/user-model/capture/executor.js +1 -1
- package/dist/src/user-model/index.js +2 -2
- package/dist/src/utils/index.js +1 -1
- package/dist/src/utils/logger/index.js +2 -2
- package/dist/src/utils/logger.js +1 -1
- package/dist/src/video-generation/artifact.js +3 -3
- package/dist/src/video-generation/repository.js +1 -1
- package/dist/src/video-generation/worker.js +1 -1
- package/dist/src/voice/audio/normalize.js +1 -1
- package/dist/src/voice/platform-settings.js +1 -1
- package/dist/src/voice/realtime/conversation-context.js +1 -1
- package/dist/src/voice/realtime/memory-context.js +3 -3
- package/dist/src/voice/realtime/omniRoute.js +1 -1
- package/dist/src/voice/realtime/runtime.js +5 -5
- package/dist/src/voice/stt/factory.js +1 -1
- package/dist/src/voice/stt/index.js +1 -1
- package/dist/src/voice/stt/preflight.js +1 -1
- package/dist/src/voice/stt/providers/alibaba-transcription.js +1 -1
- package/dist/src/voice/stt/providers/bailian-plan-transcription.js +3 -3
- package/dist/src/voice/stt/providers/xopc-cloud-transcription.js +3 -3
- package/dist/src/voice/tts/factory.js +1 -1
- package/dist/src/voice/tts/index.js +3 -3
- package/dist/src/voice/tts/merge-config.js +1 -1
- package/dist/src/voice/tts/payload.js +1 -1
- package/dist/src/voice/tts/providers/bailian-plan-speech.js +3 -3
- package/dist/src/voice/tts/providers/edge-speech.js +1 -1
- package/dist/src/voice/tts/providers/xopc-cloud-speech.js +3 -3
- package/dist/src/voice/tts/speak-core.js +2 -2
- package/dist/src/work-discovery/candidate-discovery.js +2 -2
- package/dist/src/work-discovery/probe.js +2 -2
- package/dist/src/work-discovery/service.js +7 -7
- package/package.json +1 -1
- package/dist/gateway/static/root/assets/gateway-realtime-egUNyhxi.js +0 -1
- package/dist/gateway/static/root/assets/gateway-realtime-store-5YcWzAfG.js +0 -1
- package/dist/gateway/static/root/assets/index-CaUUC83j.css +0 -1
- package/dist/gateway/static/root/assets/index-DwdoCbAF.js +0 -11
- package/dist/gateway/static/root/assets/messages-Clfka2Sx.js +0 -3
- package/dist/gateway/static/root/assets/note-image-lightbox-BVcE6TAF.js +0 -1
- package/dist/gateway/static/root/assets/project-detail-page-BTgDajpj.js +0 -7
- package/dist/gateway/static/root/assets/right-workspace-store-B8ooYVOe.js +0 -1
- package/dist/gateway/static/root/assets/settings-advanced-gate-CaALReQD.js +0 -1
- package/dist/gateway/static/root/assets/space-page-CBSaZbyH.js +0 -2
- package/dist/gateway/static/root/assets/turn-outcome-Dtw6OgwL.js +0 -1
- package/dist/gateway/static/root/assets/workspace-editor-agent-store-BbfHBVhA.js +0 -1
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/block-editor-
|
|
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{d as o,f as s,t as c}from"./chunk-KS7C4IRE-DIIvxCDx.js";import{f as l,i as u,l as d,n as f,o as p,p as m}from"./locale-store-DgbX5Azb.js";import{t as h}from"./messages-Clfka2Sx.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-DlirbHVs.js";import{t as w}from"./arrow-down-to-line-C5D8Vt-L.js";import{t as T}from"./arrow-left-D880xG-P.js";import{i as E,n as D,r as O,t as k}from"./product-automation-feedback-Bb_lbw1l.js";import{A,D as j,L as M,R as N,S as P,T as F,a as I,c as L,h as R,i as z,j as ee,l as te,n as B,o as ne,r as V,t as re,w as H,x as ie}from"./recording-upload-C0d2YjJV.js";import{t as ae}from"./check-DUBLcKHA.js";import{t as oe}from"./chevron-down-ccbiQQz_.js";import{n as se,r as U}from"./popover-select-hRG1EzAY.js";import{t as ce}from"./code-xml-DJtYhZUF.js";import{t as le}from"./copy-Dv6d4Dvw.js";import{t as ue}from"./download-Dk-ZjtO6.js";import{t as de}from"./ellipsis-0k4rZLoy.js";import{t as fe}from"./external-link-DjqjBmc3.js";import{t as W}from"./eye-CABVeTq0.js";import{t as pe}from"./file-text-D12HbeVy.js";import{t as me}from"./history-DXH_9jsE.js";import{C as he,E as ge,F as _e,I as ve,O as ye,S as G,T as be,_ as xe,a as Se,c as Ce,d as we,f as Te,h as Ee,l as K,m as De,n as Oe,r as ke,s as Ae,u as je,w as q,x as Me}from"./notes-api-FjHO1h6b.js";import{t as Ne}from"./loader-circle-CifKLtgG.js";import{P as Pe}from"./markdown-view-lnMk_L03.js";import{t as Fe}from"./message-circle-Badhj-4D.js";import{t as Ie}from"./pencil-DmIY3Oa-.js";import{t as Le}from"./play-kxZvpBg8.js";import{t as Re}from"./refresh-cw-BRlGaq2w.js";import{t as ze}from"./search-DA7gz22f.js";import{t as Be}from"./share-2-CnIB9PsV.js";import{t as Ve}from"./sliders-horizontal-DqsYor6I.js";import{t as He}from"./sparkles-DHlfQFAF.js";import{t as Ue}from"./square-pen-B8FsvqNu.js";import{t as We}from"./square-DMK_fB-3.js";import{t as Ge}from"./trash-2-DusmjVPV.js";import{t as Ke}from"./upload-rrb46c3c.js";import{t as qe}from"./x-B_N4OPjy.js";import{t as Je}from"./cn-0WouolD0.js";import{t as Ye}from"./skeleton-DzdOeGYz.js";import{a as Xe,o as Ze,s as Qe,t as $e}from"./session-manager-DvIGR4Sw.js";import{i as et}from"./vendor-swr-CdRzEUwF.js";import{o as tt,s as nt,t as rt}from"./playback-coordinator-CWHIf0wr.js";import{t as J}from"./button-C5tRaJxt.js";import{a as it,i as at,o as ot,s as st}from"./dist-BSVQC3i_.js";import{t as Y}from"./copy-to-clipboard-HOJ79TWv.js";import{r as ct}from"./app-chrome-BeB4KgOf.js";import{i as lt}from"./theme-store-Bij94a-6.js";import{t as X}from"./page-header-store-CYA4Isnf.js";import{t as ut}from"./confirm-dialog-yhRKgG72.js";import{b as dt,d as ft,o as pt,s as mt,v as ht}from"./shares-api-BqIBNEtd.js";import{l as gt,m as _t,o as vt,r as yt,t as bt,u as xt}from"./dist-DaFr5KMw.js";import{t as St}from"./oauth-provider-connect-Cy1Yy8aX.js";import{n as Ct,t as wt}from"./page-context-draft-M04A73Ul.js";import"./note-image-lightbox-BVcE6TAF.js";import{t as Tt}from"./page-context-capture-button-Phh-SyES.js";var Z=e(t(),1),Q=i();function Et({projectId:e,compact:t=!1}){let n=f(e=>e.language)===`zh`,r=s(),i=(0,Z.useRef)(null),a=(0,Z.useRef)(null),o=(0,Z.useRef)(null),c=(0,Z.useRef)(!1),[l,u]=(0,Z.useState)(null),[d,p]=(0,Z.useState)(!1),[m,h]=(0,Z.useState)(null),[_,w]=(0,Z.useState)(null);async function T(e){let t=o.current;if(!(!t||c.current)){c.current=!0,u(0),p(!1),h(null);try{e!==void 0&&await ie(e);let n=await H();if(n.consentAcknowledgedAt==null){w(n.consentPolicyVersion);return}w(null),t.draft??=await re(t.file,t.requestId);let i=await P({clientRequestId:t.requestId,contextProjectId:t.projectId,source:`web`,consentPolicyVersion:n.consentPolicyVersion,recordedAt:t.draft.startedAt}),a={...t.draft,serverDiscussionId:i.discussion.id,projectId:t.projectId};await R(a),await B(a,i.discussion.id,u,!0,e=>p(e===`verifying`)),await te(t.requestId),o.current=null,r(`/notes/${encodeURIComponent(i.note.id)}`)}catch(e){h(e instanceof Error&&e.message===`Unsupported audio format`?n?`请选择 MP3、M4A、WAV、OGG 或 WebM 音频。`:`Choose an MP3, M4A, WAV, OGG, or WebM file.`:n?`上传未完成,请重试。`:`Upload incomplete. Try again.`)}finally{c.current=!1,u(null),p(!1)}}}let E=n?`上传音频`:`Upload audio`,D=d?n?`正在确认音频`:`Verifying audio`:l===null?E:n?`上传中 ${l}%`:`Uploading ${l}%`;return(0,Q.jsxs)(`div`,{className:t?`relative inline-flex`:`flex min-w-0 flex-col`,children:[(0,Q.jsx)(`input`,{ref:i,hidden:!0,type:`file`,accept:`audio/mpeg,audio/mp4,audio/wav,audio/x-wav,audio/ogg,audio/webm,.mp3,.m4a,.wav,.ogg,.webm`,onChange:t=>{let r=t.target.files?.[0];if(t.target.value=``,r){if(!r.size||r.size>1073741824){o.current=null,h(n?`请选择小于或等于 1 GiB 的非空音频。`:`Choose a non-empty audio file up to 1 GiB.`);return}o.current={file:r,requestId:crypto.randomUUID(),projectId:e},T()}}}),(0,Q.jsxs)(`button`,{ref:a,type:`button`,"aria-label":D,title:E,disabled:l!==null,className:`inline-flex items-center gap-3 text-left hover:bg-surface-hover focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent disabled:opacity-60 ${t?`size-11 shrink-0 justify-center rounded-lg text-fg-muted`:`min-h-20 flex-1 rounded-xl border border-edge bg-surface-panel p-4 text-sm font-semibold text-fg`}`,onClick:()=>i.current?.click(),children:[l===null?(0,Q.jsx)(Ke,{className:t?`size-4`:`size-5 shrink-0 text-fg-muted`,"aria-hidden":!0}):(0,Q.jsx)(Ne,{className:`size-4 shrink-0 animate-spin`,"aria-hidden":!0}),t?(0,Q.jsx)(`span`,{className:`sr-only`,role:`status`,children:D}):(0,Q.jsx)(`span`,{role:`status`,children:D})]}),m?(0,Q.jsxs)(`div`,{className:`rounded-lg border border-edge bg-surface-panel p-2 text-xs text-danger ${t?`absolute right-0 top-full z-20 w-56 shadow-popover`:`mt-2`}`,children:[(0,Q.jsx)(`span`,{role:`alert`,children:m}),o.current?(0,Q.jsx)(J,{variant:`ghost`,onClick:()=>void T(),children:n?`重试`:`Retry`}):null]}):null,(0,Q.jsx)(C,{open:_!==null,onOpenChange:e=>{!e&&!c.current&&w(null)},children:(0,Q.jsxs)(b,{children:[(0,Q.jsx)(g,{className:`xopc-dialog-overlay fixed inset-0 z-[90] bg-scrim`}),(0,Q.jsxs)(x,{onCloseAutoFocus:e=>{e.preventDefault(),a.current?.focus()},className:`xopc-dialog-content fixed left-1/2 top-1/2 z-[91] w-[min(24rem,calc(100vw-2rem))] -translate-x-1/2 -translate-y-1/2 rounded-xl border border-edge bg-surface-overlay p-5 text-fg shadow-popover`,children:[(0,Q.jsx)(S,{className:`font-semibold`,children:E}),(0,Q.jsx)(v,{className:`mt-2 text-sm text-fg-muted`,children:n?`请确认你有权上传此录音,并允许语音服务转写。`:`Confirm you have permission to upload and transcribe this recording.`}),m?(0,Q.jsx)(`p`,{role:`alert`,className:`mt-2 text-xs text-danger`,children:m}):null,(0,Q.jsxs)(`div`,{className:`mt-4 flex justify-end gap-2`,children:[(0,Q.jsx)(y,{asChild:!0,children:(0,Q.jsx)(J,{disabled:l!==null,children:n?`取消`:`Cancel`})}),(0,Q.jsx)(J,{variant:`primary`,disabled:l!==null,onClick:()=>{_!==null&&T(_)},children:n?`确认上传`:`Confirm upload`})]})]})]})})]})}var Dt=r(),Ot=6e4,kt=36e5,$=864e5;function At(e){let t=new Date(e);return t.setHours(0,0,0,0),t.getTime()}function jt(e,t,n){let r=t-e;if(r<Ot)return n.justNow;if(r<kt){let e=Math.floor(r/Ot);return n.minutesAgo.replace(`{{n}}`,String(e))}let i=At(t);if(e>=i)return n.today+` `+new Date(e).toLocaleTimeString(n.locale,{hour:`2-digit`,minute:`2-digit`});if(e>=i-$)return n.yesterday+` `+new Date(e).toLocaleTimeString(n.locale,{hour:`2-digit`,minute:`2-digit`});if(r<7*$){let e=Math.floor(r/$);return n.daysAgo.replace(`{{n}}`,String(e))}return new Date(e).toLocaleDateString(n.locale,{month:`short`,day:`numeric`})}function Mt(e,t,n){let r=At(t);if(e>=r)return n.today;if(e>=r-$)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 Nt(e){let t=new Date(e);return`${t.getFullYear()}-${String(t.getMonth()+1).padStart(2,`0`)}-${String(t.getDate()).padStart(2,`0`)}`}var Pt=`z-[140] min-w-44 rounded-lg border border-edge bg-surface-overlay p-1 text-sm text-fg shadow-popover`,Ft=`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 It(e){let t=(0,Dt.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,Q.jsxs)(Q.Fragment,{children:[(0,Q.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,Q.jsx)(Fe,{className:`size-4`,"aria-hidden":!0}),r?`问这段录音`:`Ask recording`]}),(0,Q.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,Q.jsx)(Be,{className:`size-4`,"aria-hidden":!0}),(0,Q.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,Q.jsx)(ue,{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,Q.jsx)(`span`,{className:`hidden sm:inline`,children:h}),t[5]=h,t[6]=g);let _;t[7]!==p||t[8]!==g?(_=(0,Q.jsx)(_t,{asChild:!0,children:(0,Q.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,Q.jsx)(yt,{asChild:!0,children:(0,Q.jsx)(`a`,{className:Ft,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,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(xt,{className:`my-1 h-px bg-edge-subtle`}),(0,Q.jsx)(yt,{asChild:!0,children:(0,Q.jsxs)(`a`,{className:Ft,href:u(`${l}/audio`),download:!0,children:[(0,Q.jsx)(ue,{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,Q.jsx)(vt,{children:(0,Q.jsxs)(bt,{align:`end`,sideOffset:6,collisionPadding:12,className:Pt,children:[y,b]})}),t[18]=y,t[19]=b,t[20]=x):x=t[20];let S;t[21]!==x||t[22]!==_?(S=(0,Q.jsxs)(gt,{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,Q.jsx)(de,{className:`size-5`,"aria-hidden":!0}),t[24]=w):w=t[24];let T;t[25]===C?T=t[26]:(T=(0,Q.jsx)(_t,{asChild:!0,children:(0,Q.jsx)(`button`,{type:`button`,"data-note-actions-trigger":!0,"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,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsxs)(yt,{className:Ft,disabled:c.busy,onSelect:c.onAnalyze,children:[(0,Q.jsx)(He,{className:`size-4`,"aria-hidden":!0}),r?`进一步分析`:`Analyze this note`]}),c.onOutline?(0,Q.jsxs)(yt,{className:Ft,onSelect:c.onOutline,children:[(0,Q.jsx)(M,{className:`size-4`,"aria-hidden":!0}),r?`文档大纲`:`Document outline`]}):null,(0,Q.jsxs)(yt,{className:Ft,onSelect:c.onHistory,children:[(0,Q.jsx)(me,{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`,N=i||a||s||!o||o.length>16e3,P;t[35]!==k||t[36]!==A||t[37]!==j||t[38]!==N?(P=(0,Q.jsx)(`div`,{children:(0,Q.jsx)(Tt,{presentation:`menu`,resource:k,selection:A,label:j,disabled:N})}),t[35]=k,t[36]=A,t[37]=j,t[38]=N,t[39]=P):P=t[39];let F;t[40]!==c||t[41]!==r?(F=c?(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(xt,{className:`my-1 h-px bg-edge-subtle`}),(0,Q.jsxs)(yt,{className:`${Ft} text-danger`,disabled:c.busy,onSelect:c.onDelete,children:[(0,Q.jsx)(Ge,{className:`size-4`,"aria-hidden":!0}),r?`删除笔记`:`Delete note`]})]}):null,t[40]=c,t[41]=r,t[42]=F):F=t[42];let I;t[43]!==E||t[44]!==P||t[45]!==F?(I=(0,Q.jsx)(vt,{children:(0,Q.jsxs)(bt,{align:`end`,sideOffset:6,collisionPadding:12,className:Pt,children:[E,P,F]})}),t[43]=E,t[44]=P,t[45]=F,t[46]=I):I=t[46];let L;t[47]!==T||t[48]!==I?(L=(0,Q.jsxs)(gt,{children:[T,I]}),t[47]=T,t[48]=I,t[49]=L):L=t[49];let R;return t[50]!==f||t[51]!==S||t[52]!==L?(R=(0,Q.jsxs)(`div`,{className:`flex flex-wrap items-center gap-1`,children:[f,S,L]}),t[50]=f,t[51]=S,t[52]=L,t[53]=R):R=t[53],R}function Lt(e){let t=(0,Dt.c)(68),{detail:n,template:r,onTemplate:i,zh:a,busy:o,processing:s,onOrganize:c,onRegenerate:l}=e,[u,d]=(0,Z.useState)(!1),f=!!n.discussion.audioAttachmentId&&!n.discussion.audioDeletedAt,p;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(p=(0,Q.jsx)(Ve,{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,Q.jsx)(_,{asChild:!0,children:(0,Q.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,Q.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,Q.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,Q.jsx)(qe,{className:`size-4`}),t[6]=O):O=t[6];let k;t[7]===D?k=t[8]:(k=(0,Q.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,Q.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,Q.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,Q.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,Q.jsx)(U,{value:`general`,children:L}),t[18]=L,t[19]=R);let z=a?`项目例会`:`Project`,ee;t[20]===z?ee=t[21]:(ee=(0,Q.jsx)(U,{value:`project`,children:z}),t[20]=z,t[21]=ee);let te=a?`需求评审`:`Review`,B;t[22]===te?B=t[23]:(B=(0,Q.jsx)(U,{value:`review`,children:te}),t[22]=te,t[23]=B);let ne=a?`客户访谈`:`Interview`,V;t[24]===ne?V=t[25]:(V=(0,Q.jsx)(U,{value:`interview`,children:ne}),t[24]=ne,t[25]=V);let re;t[26]!==F||t[27]!==I||t[28]!==R||t[29]!==ee||t[30]!==B||t[31]!==V||t[32]!==r?(re=(0,Q.jsxs)(se,{value:r,"aria-label":F,onChange:I,children:[R,ee,B,V]}),t[26]=F,t[27]=I,t[28]=R,t[29]=ee,t[30]=B,t[31]=V,t[32]=r,t[33]=re):re=t[33];let H;t[34]!==P||t[35]!==re?(H=(0,Q.jsxs)(`label`,{className:`block space-y-2 text-sm`,children:[P,re]}),t[34]=P,t[35]=re,t[36]=H):H=t[36];let ie;t[37]!==f||t[38]!==o||t[39]!==n.discussion.status||t[40]!==l||t[41]!==s||t[42]!==a?(ie=f&&[`completed`,`needs_attention`].includes(n.discussion.status)?(0,Q.jsxs)(`details`,{className:`border-t border-edge-subtle pt-3`,children:[(0,Q.jsx)(`summary`,{className:`min-h-11 cursor-pointer text-sm text-fg-muted`,children:a?`高级选项:重新识别录音`:`Advanced: transcribe again`}),(0,Q.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,Q.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]=ie):ie=t[43];let ae;t[44]!==M||t[45]!==H||t[46]!==ie?(ae=(0,Q.jsxs)(`div`,{className:`min-h-0 flex-1 space-y-5 overflow-y-auto p-5`,children:[M,H,ie]}),t[44]=M,t[45]=H,t[46]=ie,t[47]=ae):ae=t[47];let oe=a?`取消`:`Cancel`,ce;t[48]===oe?ce=t[49]:(ce=(0,Q.jsx)(y,{asChild:!0,children:(0,Q.jsx)(J,{children:oe})}),t[48]=oe,t[49]=ce);let le=o||s||!n.discussion.canonicalTranscript,ue;t[50]===c?ue=t[51]:(ue=()=>{d(!1),c()},t[50]=c,t[51]=ue);let de;t[52]===Symbol.for(`react.memo_cache_sentinel`)?(de=(0,Q.jsx)(Re,{className:`size-4`,"aria-hidden":!0}),t[52]=de):de=t[52];let fe=a?`重新整理纪要`:`Regenerate summary`,W;t[53]!==le||t[54]!==ue||t[55]!==fe?(W=(0,Q.jsxs)(J,{variant:`primary`,disabled:le,onClick:ue,children:[de,fe]}),t[53]=le,t[54]=ue,t[55]=fe,t[56]=W):W=t[56];let pe;t[57]!==ce||t[58]!==W?(pe=(0,Q.jsxs)(`footer`,{className:`flex shrink-0 justify-end gap-2 border-t border-edge-subtle p-4`,children:[ce,W]}),t[57]=ce,t[58]=W,t[59]=pe):pe=t[59];let me;t[60]!==A||t[61]!==ae||t[62]!==pe?(me=(0,Q.jsxs)(b,{children:[w,(0,Q.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,ae,pe]})]}),t[60]=A,t[61]=ae,t[62]=pe,t[63]=me):me=t[63];let he;return t[64]!==u||t[65]!==h||t[66]!==me?(he=(0,Q.jsxs)(C,{open:u,onOpenChange:d,children:[h,me]}),t[64]=u,t[65]=h,t[66]=me,t[67]=he):he=t[67],he}function Rt(e){return JSON.stringify([e.transcript.revision,e.transcript.segments.map(e=>[e.sequence,e.revision,e.status]),e.organization?.revision])}function zt(e,t,n,r){let i=(0,Dt.c)(27),a=r!==void 0&&r,[o,s]=(0,Z.useState)(),c;i[0]!==n||i[1]!==a||i[2]!==t||i[3]!==e||i[4]!==o?(c=()=>{!a&&t&&(o?.noteId!==e||o.version!==Rt(t))&&(o?.noteId===e&&n(),s({noteId:e,version:Rt(t),value:t}))},i[0]=n,i[1]=a,i[2]=t,i[3]=e,i[4]=o,i[5]=c):c=i[5];let l=o?.noteId,u=o?.version,d;i[6]!==n||i[7]!==a||i[8]!==t||i[9]!==e||i[10]!==l||i[11]!==u?(d=[e,t,l,u,n,a],i[6]=n,i[7]=a,i[8]=t,i[9]=e,i[10]=l,i[11]=u,i[12]=d):d=i[12],(0,Z.useLayoutEffect)(c,d);let f;i[13]!==n||i[14]!==t||i[15]!==e?(f=r=>{let i=r===void 0?t:r;i&&(n(),s({noteId:e,version:Rt(i),value:i}))},i[13]=n,i[14]=t,i[15]=e,i[16]=f):f=i[16];let p=f,m=o?.noteId===e?o:void 0,h;i[17]!==m||i[18]!==t?(h=!!t&&!!m&&m.version!==Rt(t),i[17]=m,i[18]=t,i[19]=h):h=i[19];let g=h,_;i[20]!==m||i[21]!==t?(_=t&&m?{...t,transcript:m.value.transcript,organization:m.value.organization}:t,i[20]=m,i[21]=t,i[22]=_):_=i[22];let v=_,y;return i[23]!==v||i[24]!==g||i[25]!==p?(y={detail:v,hasUpdates:g,publish:p},i[23]=v,i[24]=g,i[25]=p,i[26]=y):y=i[26],y}function Bt(e){let t=(0,Z.useRef)(null),n=(0,Z.useCallback)(()=>{let n=e.current;if(!n||t.current)return;let r=n.getBoundingClientRect().top;t.current={scrollTop:n.scrollTop,anchors:n.scrollTop<=0?[]:Array.from(n.querySelectorAll(`[data-reading-anchor]`)).filter(e=>e.getBoundingClientRect().bottom>r).map(e=>({key:e.dataset.readingAnchor,top:e.getBoundingClientRect().top-r}))}},[e]);return(0,Z.useLayoutEffect)(()=>{let n=t.current,r=e.current;if(t.current=null,!n||!r)return;let i=new Map(Array.from(r.querySelectorAll(`[data-reading-anchor]`)).map(e=>[e.dataset.readingAnchor,e])),a=n.anchors.find(e=>i.has(e.key));r.scrollTop=a?r.scrollTop+i.get(a.key).getBoundingClientRect().top-r.getBoundingClientRect().top-a.top:n.scrollTop}),n}var Vt=e=>`${Math.floor(e/6e4)}:${String(Math.floor(e/1e3)%60).padStart(2,`0`)}`;function Ht({id:e,query:t,zh:n,refreshKey:r,sourceKey:i,active:a,tab:o,onEvidence:s,onPlay:c}){let[l,d]=(0,Z.useState)(),f=(0,Z.useRef)(null),m=Bt(f),h=(0,Z.useRef)(null),g=(0,Z.useRef)(!1),[_,v]=(0,Z.useState)(!0),[y,b]=(0,Z.useState)(``),[x,S]=(0,Z.useState)(!1),C=(0,Z.useRef)(0),[w,T]=(0,Z.useState)(),[E,D]=(0,Z.useState)(),[O,k]=(0,Z.useState)(``),[A,j]=(0,Z.useState)(0),M=JSON.stringify([e,i,t]),N=t?``:r;(0,Z.useEffect)(()=>{if(!a||t)return;let e=window.setInterval(()=>j(e=>e+1),3e3);return()=>window.clearInterval(e)},[a,t]),(0,Z.useEffect)(()=>{D(void 0)},[e,t]),(0,Z.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(async a=>{if(C.current!==n)return;let o=h.current;if(!i&&o?.key===M){if(o.value.version===a.version)return;let i=o.value.hits.length;for(;a.hasMore&&a.hits.length<i;){let i=await p(u(`/api/discussions/${encodeURIComponent(e)}/review?q=${encodeURIComponent(t)}&offset=${a.hits.length}&version=${encodeURIComponent(a.version)}`),{signal:r.signal});if(C.current!==n)return;if(i.version!==a.version||!i.hits.length)throw Error(`Review changed during refresh`);a={...i,offset:0,hits:[...a.hits,...i.hits]}}m()}h.current={key:M,value:a},d(a),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,m]);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,Q.jsxs)(`article`,{"data-reading-anchor":`review:${e.id}`,className:`space-y-2 rounded-xl bg-surface-inset p-4`,children:[(0,Q.jsxs)(`button`,{className:`text-left text-sm text-accent-fg`,onClick:()=>I(e),children:[e.startedAtMs===void 0?``:`${Vt(e.startedAtMs)}${e.endedAtMs===void 0?``:`–${Vt(e.endedAtMs)}`} · `,e.title||L(e)]}),(0,Q.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,Q.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,Q.jsxs)(`p`,{className:`text-xs text-fg-muted`,children:[Vt(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,Q.jsxs)(J,{onClick:()=>c(e.startedAtMs,e.endedAtMs),children:[n?`回听上下文`:`Play context`,` `,Vt(e.startedAtMs),`–`,Vt(e.endedAtMs)]},t)),e.segments.length?(0,Q.jsx)(J,{onClick:()=>I(e),children:n?`查看对应原文`:`View transcript`}):(0,Q.jsx)(`p`,{className:`text-xs text-fg-muted`,children:n?`暂无可核实的原文定位`:`No verified transcript reference`})]},e.id);return(0,Q.jsxs)(`section`,{ref:e=>{f.current=e?.closest(`main`)??e},"aria-label":n?`长录音回顾`:`Recording review`,className:`flex flex-col gap-3`,children:[y?(0,Q.jsxs)(`div`,{children:[(0,Q.jsx)(`p`,{role:`alert`,className:`text-sm text-danger`,children:y}),(0,Q.jsx)(J,{onClick:P,children:n?`刷新结果`:`Refresh results`})]}):null,_&&(!l||w!==M||O!==t)?(0,Q.jsx)(Ye,{className:`h-20 w-full`}):null,l&&w===M&&(!t||O===t)?(0,Q.jsxs)(Q.Fragment,{children:[t?(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(`h3`,{className:`text-sm font-medium`,children:n?`搜索结果 · ${l.total}`:`Search results · ${l.total}`}),(0,Q.jsx)(J,{onClick:P,children:n?`刷新结果`:`Refresh results`}),(0,Q.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,Q.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":`${Vt(e.startedAtMs)} ${e.title||L(e)}`,onClick:()=>I(e)},e.id))}),l.total?null:(0,Q.jsx)(`p`,{className:`text-sm text-fg-muted`,children:n?`未找到关键词;尚未转写的内容无法搜索。`:`No matches. Untranscribed audio is not searchable yet.`}),l.hits.map(R)]}):(0,Q.jsxs)(Q.Fragment,{children:[o===`summary`&&l.chapters.length?(0,Q.jsxs)(`details`,{className:`rounded-xl bg-surface-inset px-4`,children:[(0,Q.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,Q.jsx)(`div`,{className:`space-y-3 pb-4`,children:l.chapters.map(R)})]}):null,l.hits.length?(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(`h3`,{className:`text-sm font-medium`,children:n?`本轮已完成转写(阶段性)`:`Available transcription from this run`}),l.hits.map(R)]}):null]}),l.hasMore?(0,Q.jsx)(J,{disabled:x,onClick:()=>void F(),children:n?`加载更多结果`:`More results`}):null,(0,Q.jsxs)(`details`,{className:`rounded-lg text-xs text-fg-muted`,children:[(0,Q.jsx)(`summary`,{className:`min-h-11 cursor-pointer py-3 focus-visible:ring-2 focus-visible:ring-accent`,children:n?`处理范围`:`Processing coverage`}),(0,Q.jsxs)(`div`,{role:`status`,className:`space-y-2 pb-3 leading-5`,children:[(0,Q.jsxs)(`p`,{children:[n?`原音`:`Audio`,` · `,l.coverage.audioAvailable?n?`已保存,可回听`:`Saved, ready to play`:n?`尚不可用`:`Unavailable`]}),(0,Q.jsxs)(`p`,{children:[n?`本轮转写已处理`:`Processed this run`,` `,Vt(l.coverage.processedMs),` / `,Vt(l.coverage.durationMs),` · `,n?`连续处理至`:`Continuous through`,` `,Vt(l.coverage.continuousThroughMs)]}),(0,Q.jsxs)(`p`,{children:[n?`分析覆盖`:`Analysis coverage`,` · `,l.coverage.analysisRanges.length?l.coverage.analysisRanges.map(e=>`${Vt(e.startedAtMs)}–${Vt(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,Q.jsx)(`p`,{className:`text-xs text-fg-muted`,children:n?`以上是本轮已保存的阶段性原文;正式发布后才能校对和标记具体段落。`:`Saved partial text; segment editing and highlighting become available after publication.`}):null]}):null]})}function Ut({recordingId:e,discussionId:t,zh:n,onEvidence:r,onPlay:i}){let{data:a=[],mutate:o}=et(`/api/discussions/${t}/annotations`,e=>p(u(e))),[s,c]=(0,Z.useState)([]),[l,d]=(0,Z.useState)(null),[f,m]=(0,Z.useState)(null),[h,g]=(0,Z.useState)(``),_=(0,Z.useCallback)(async()=>{c(await I(e))},[e]),v=(0,Z.useCallback)(async()=>{try{await V(e,t),await _(),await o()}catch(e){await o(),g(e instanceof Error?e.message:String(e))}},[e,t,_,o]);(0,Z.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 L(e,{...t,updatedAt:Date.now()},n),m(null),g(``),await _(),v()}catch(e){g(e instanceof Error?e.message:String(e))}};return(0,Q.jsxs)(`section`,{className:`space-y-4`,"aria-label":n?`我的标记`:`My highlights`,children:[h?(0,Q.jsxs)(`p`,{role:`alert`,className:`text-sm text-danger`,children:[h,(0,Q.jsx)(J,{onClick:()=>void v(),children:n?`重试同步`:`Retry sync`})]}):null,y.size?null:(0,Q.jsx)(`p`,{className:`text-sm text-fg-muted`,children:n?`暂无标记`:`No highlights yet`}),[...y.values()].sort((e,t)=>e.annotation.anchor.capturedAt-t.annotation.anchor.capturedAt).filter(e=>!e.annotation.deleted||e.localState===`conflict`).map(e=>(0,Q.jsxs)(`article`,{className:`space-y-2 rounded-lg border border-edge p-3`,children:[(0,Q.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,Q.jsx)(`blockquote`,{className:`text-sm`,children:e.text},e.sequence)),e.positionMs===void 0?null:(0,Q.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,Q.jsxs)(`p`,{className:`whitespace-pre-wrap text-sm`,children:[n?`我的说明:`:`My context: `,e.annotation.text]}):null,(0,Q.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[(0,Q.jsx)(J,{disabled:!e.evidence,onClick:()=>e.evidence&&r(e.evidence),children:n?`查看原文`:`View transcript`}),e.playback.map((e,t)=>(0,Q.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,Q.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,Q.jsx)(J,{onClick:()=>void b({...e.annotation,deleted:!0}),children:n?`移除标记`:`Remove`})]}),e.state===`located`&&!e.evidence?(0,Q.jsx)(`p`,{className:`text-xs text-fg-muted`,children:n?`该位置原文尚未生成,可先回听原音。`:`Transcript for this position is pending; audio is usable.`}):null,e.state===`unavailable`?(0,Q.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,Q.jsx)(`p`,{className:`text-xs text-fg-muted`,children:n?`等待原音/原文完成定位`:`Awaiting audio/transcript positioning`}):null,e.localState===`conflict`?(0,Q.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&&z(t,n.annotation).then(_)},children:n?`使用服务端版本`:`Use server version`}):null]},e.annotation.id)),f?(0,Q.jsxs)(`div`,{role:`dialog`,"aria-label":n?`编辑标记`:`Edit highlight`,className:`rounded-lg border border-edge p-3`,children:[(0,Q.jsxs)(se,{value:f.kind,"aria-label":n?`标记类型`:`Highlight type`,onChange:e=>m({...f,kind:e.target.value}),children:[(0,Q.jsx)(U,{value:`highlight`,children:n?`重点`:`Highlight`}),(0,Q.jsx)(U,{value:`question`,children:n?`问题`:`Question`}),(0,Q.jsx)(U,{value:`note`,children:n?`补充`:`Context`})]}),(0,Q.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,Q.jsx)(J,{onClick:()=>void b(f,l),children:n?`保存到本机并同步`:`Save locally and sync`}),(0,Q.jsx)(J,{onClick:()=>m(null),children:n?`取消`:`Cancel`})]}):null]})}var Wt={tab:`summary`,query:``,page:1,positionMs:0},Gt=m((e,t)=>({notes:{},update:(n,r)=>{let i={...qt(n,t().notes[n]),...r};e(e=>({notes:{...e.notes,[n]:i}}));try{localStorage.setItem(`discussion-review:${n}`,JSON.stringify(i))}catch{}}})),Kt=new Map;function qt(e,t){if(t)return t;if(Kt.has(e))return Kt.get(e);let n=Wt;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={...Wt,...t})}catch{}return Kt.set(e,n),n}function Jt(e){let t=(0,Dt.c)(51),{initial:n,zh:r,busy:i,onClose:a,onSave:o}=e,[s,c]=(0,Z.useState)(n),l;t[0]!==i||t[1]!==a?(l=e=>{!e&&!i&&a()},t[0]=i,t[1]=a,t[2]=l):l=t[2];let u;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(u=(0,Q.jsx)(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,Q.jsx)(`header`,{className:`border-b border-edge p-4`,children:(0,Q.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,Q.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,Q.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,Q.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,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsxs)(`label`,{className:`block text-sm`,children:[r?`负责人原话`:`Owner as stated`,(0,Q.jsx)(`input`,{className:`mt-1 w-full rounded border border-edge bg-transparent p-2`,value:s.owner??``,onChange:e=>c({...s,owner:e.target.value})})]}),(0,Q.jsxs)(`label`,{className:`block text-sm`,children:[r?`期限原话`:`Date as stated`,(0,Q.jsx)(`input`,{className:`mt-1 w-full rounded border border-edge bg-transparent p-2`,value:s.dueDate??``,onChange:e=>c({...s,dueDate:e.target.value})})]})]}):null,t[16]=s,t[17]=r,t[18]=w):w=t[18];let T;t[19]!==s||t[20]!==r?(T=s.kind===`summary`?null:(0,Q.jsxs)(`label`,{className:`flex items-center gap-2 text-sm`,children:[(0,Q.jsx)(`input`,{type:`checkbox`,className:`ui-checkbox`,checked:!!s.ignored,onChange:e=>c({...s,ignored:e.target.checked})}),r?`忽略此项`:`Ignore this item`]}),t[19]=s,t[20]=r,t[21]=T):T=t[21];let E;t[22]!==y||t[23]!==w||t[24]!==T||t[25]!==m?(E=(0,Q.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,Q.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,Q.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,Q.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,Q.jsxs)(b,{children:[u,(0,Q.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,Q.jsx)(C,{open:!0,onOpenChange:l,children:P}),t[48]=l,t[49]=P,t[50]=F):F=t[50],F}function Yt(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 Xt=e=>`${String(Math.floor(e/6e4)).padStart(2,`0`)}:${String(Math.floor(e/1e3)%60).padStart(2,`0`)}`;function Zt(e,t){e.currentTime=Number.isFinite(e.duration)?Math.min(t,e.duration):t}function Qt({noteId:e,onPersonalNotes:t,onMeetingContent:n,personalNotes:r,personalNotesActive:i=!1,noteTitle:a,noteActions:s}){let l=o(),d=(0,Z.useId)(),m=(0,Z.useRef)(null),h=f(e=>e.language)===`zh`,{data:_,mutate:v,isLoading:y}=et([`note-discussion-document`,e],()=>F(e),{refreshInterval:e=>e&&([`recording`,`stopping`,`sealing`,`organizing`].includes(e.discussion.status)||e.recordingJob?.state===`queued`||e.recordingJob?.state===`running`)?3e3:0}),[w,T]=(0,Z.useState)(null),[E,D]=(0,Z.useState)(null),O=(0,Z.useRef)(null),{detail:k,hasUpdates:M,publish:P}=zt(e,_,Bt(O),!!w||!!E),I=k?.discussion.id,R=`/api/discussions/${encodeURIComponent(I??``)}`,{data:z=[],mutate:te}=et(I?`${R}/actions`:null,e=>p(u(e)),{refreshInterval:1e4}),B=Gt(t=>qt(e,t.notes[e])),re=Gt(e=>e.update),H=B.tab,ie=t=>re(e,{tab:t}),oe=B.query,se=t=>re(e,{query:t}),[U,ce]=(0,Z.useState)(!1),le=(0,Z.useRef)(null);(0,Z.useEffect)(()=>{U&&le.current?.focus()},[U]);let[ue,de]=(0,Z.useState)(`general`),fe=(0,Z.useRef)(null),W=(0,Z.useRef)(null),[pe,me]=(0,Z.useState)(!1),[he,ge]=(0,Z.useState)(!1),_e=(0,Z.useRef)(!1),ve=(0,Z.useRef)(null),ye=(0,Z.useRef)(null),[G,be]=(0,Z.useState)(null),[xe,Se]=(0,Z.useState)(!1),[Ce,we]=(0,Z.useState)([]),[Te,Ee]=(0,Z.useState)(null),[K,De]=(0,Z.useState)(!1),Oe=B.page,ke=t=>re(e,{page:t}),Ae=(0,Z.useRef)(null),[je,q]=(0,Z.useState)([]),Me=(0,Z.useRef)(0),Ne=(0,Z.useRef)(0),Fe=(0,Z.useRef)(_?.transcript.revision);Fe.current=_?.transcript.revision;let Ie=(0,Z.useRef)(null),Re=(0,Z.useRef)(_?.discussion.audioDeletedAt);Re.current=_?.discussion.audioDeletedAt;let Be=(0,Z.useRef)(null),[Ve,He]=(0,Z.useState)();(0,Z.useEffect)(()=>{let t=()=>{v(),te()},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)}},[v,te,e]),(0,Z.useEffect)(()=>{k?.discussion.template&&de(k.discussion.template)},[k?.discussion.template]);async function We(e){if(!K){De(!0),Ee(null);try{await e();let t=await v();P(t),await te()}catch(e){Ee(e instanceof Error?e.message:String(e))}finally{De(!1)}}}function Ge(e,t){if(!Ie.current)return;let n=Ie.current,r=e/1e3;Ae.current=t??null,Be.current=n.readyState===0?r:null,Zt(n,r),rt(n),n.play().catch(()=>{n.paused&&nt(n)})}function Ke(){if(W.current)return;let e=ye.current??(document.activeElement instanceof HTMLElement?document.activeElement:null);W.current={element:e,triggerIndex:Array.from(O.current?.querySelectorAll(`button`)??[]).findIndex(t=>t===e),scrollTop:O.current?.scrollTop??0,review:B}}function Je(){Ne.current++,me(!1),be(null),ge(!1),q([]),W.current=null,ve.current=null}function Xe(){Ne.current++,me(!1),be(null),ve.current=W.current?.element??null,he||(W.current=null)}function Ze(){let t=W.current;if(!t)return;let{tab:n,query:r,page:i,anchor:a,anchorRevision:o}=t.review;re(e,{tab:n,query:r,page:i,anchor:a,anchorRevision:o}),q([]),be(null),ge(!1),_e.current=!0}(0,Z.useLayoutEffect)(()=>{if(!G&&!pe&&ve.current&&(ve.current.focus({preventScroll:!0}),ve.current=null),!_e.current)return;_e.current=!1;let e=W.current;e&&O.current&&(O.current.scrollTop=e.scrollTop),(e?.element?.isConnected?e.element:e&&e.triggerIndex>=0?O.current?.querySelectorAll(`button`)[e.triggerIndex]:null)?.focus({preventScroll:!0}),W.current=null}),(0,Z.useEffect)(()=>{(G||pe)&&fe.current?.focus({preventScroll:!0})},[G,pe]);function Qe(e){i&&n?.(),Ke();let t=e.stale||e.transcriptRevision!==Fe.current,r=Re.current?{...e,audioAvailable:!1,timingVerified:!1,segments:e.segments.map(e=>({...e,playback:[]}))}:e;be({...r,stale:t}),t||q(e.segments.map(e=>e.sequence))}async function $e(e,t){if(!k)return;let r=Me.current,a=++Ne.current;i&&n?.(),Ke(),me(!0),be(null),Ee(null);try{let n=await p(u(`${R}/evidence?revision=${t??k.organization?.transcriptRevision??k.transcript.revision}&segments=${e.join(`,`)}`));if(r!==Me.current||a!==Ne.current)return;Qe(n)}catch(e){r===Me.current&&a===Ne.current&&(Ee(e instanceof Error?e.message:String(e)),Xe())}finally{a===Ne.current&&me(!1)}}async function it(e){if(!k||Re.current||!Ie.current)return;(G||pe||he)&&Je();let t=Me.current,n=++Ne.current;if(Ee(null),k.discussion.mimeType?.split(`;`)[0]===`audio/wav`&&e.endedAtMs>e.startedAtMs){Ge(e.startedAtMs,e.endedAtMs);return}try{let r=await p(u(`${R}/evidence?revision=${k.transcript.revision}&segments=${e.sequence}`));if(t!==Me.current||n!==Ne.current||Re.current)return;let i=r.segments.find(t=>t.sequence===e.sequence)?.playback[0];if(!i){Ee(h?`这段录音暂无法定位`:`This segment cannot be located yet`);return}q([]),Ge(i.startedAtMs,i.endedAtMs)}catch(e){t===Me.current&&n===Ne.current&&Ee(e instanceof Error?e.message:String(e))}}async function at(e){k&&await We(async()=>{await L(k.discussion.clientRequestId,ne({type:`transcript`,capturedAt:Date.now(),transcriptRevision:k.transcript.revision,segmentIds:[e.sequence]})),ie(`marks`),V(k.discussion.clientRequestId,k.discussion.id).catch(e=>Ee(String(e)))})}(0,Z.useEffect)(()=>(Me.current++,Ne.current++,W.current=null,ge(!1),me(!1),be(null),q([]),T(null),D(null),we([]),Ee(null),Ae.current=null,()=>{Me.current++}),[e]),(0,Z.useEffect)(()=>{let t=k?.discussion.audioSha256??k?.discussion.audioAttachmentId;if(!t)return;let n=qt(e,Gt.getState().notes[e]);n.source&&n.source!==t?(Me.current++,Ne.current++,me(!1),be(null),q([]),Ie.current?.pause(),re(e,{positionMs:0,source:t}),Be.current=0,Ae.current=null):re(e,{source:t})},[e,k?.discussion.audioSha256,k?.discussion.audioAttachmentId,re]),(0,Z.useEffect)(()=>{k?.discussion.audioDeletedAt&&(Ie.current?.pause(),Be.current=null,Ae.current=null,be(e=>e?{...e,audioAvailable:!1,timingVerified:!1,segments:e.segments.map(e=>({...e,playback:[]}))}:null))},[k?.discussion.audioDeletedAt]),(0,Z.useEffect)(()=>{B.tab===`transcript`&&B.anchor!==void 0&&B.anchorRevision===k?.transcript.revision&&window.setTimeout(()=>document.getElementById(`discussion-segment-${B.anchor}`)?.scrollIntoView?.({block:`center`}),0)},[B.tab,B.anchor,B.anchorRevision,k?.transcript.revision]),(0,Z.useEffect)(()=>{q([]),be(e=>e&&e.transcriptRevision!==_?.transcript.revision?{...e,stale:!0}:e)},[_?.transcript.revision]);function ot(e,t,n=h?`原话`:`Source`){let r=k&&(t??k.organization?.transcriptRevision??k.transcript.revision)===k.transcript.revision?k.transcript.segments.find(t=>t.sequence===e[0]):void 0;return(0,Q.jsx)(`button`,{type:`button`,className:`inline-flex min-h-11 shrink-0 items-center gap-1.5 rounded-lg px-2 text-xs text-accent-fg hover:bg-surface-hover focus-visible:ring-2 focus-visible:ring-accent`,"aria-label":r?`${n} · ${Xt(r.startedAtMs)}`:void 0,onClick:()=>void $e(e,t),children:r?(0,Q.jsx)(`span`,{className:`tabular-nums`,children:Xt(r.startedAtMs)}):n})}let st=(e,t,n)=>t.some(e=>xe||!e.ignored)?(0,Q.jsxs)(`section`,{className:`space-y-2`,children:[(0,Q.jsx)(`h3`,{className:`font-semibold text-fg`,children:e}),t.filter(e=>xe||!e.ignored).map(e=>(0,Q.jsxs)(`div`,{"data-reading-anchor":`fact:${e.id}`,className:`flex items-start gap-3 text-sm`,children:[(0,Q.jsxs)(`p`,{className:`flex-1 whitespace-pre-wrap`,children:[e.text,e.supersededBy||e.disputedBy?(0,Q.jsx)(`span`,{className:`ml-2 text-xs text-fg-muted`,children:h?`有后续变更`:`Later changes`}):null,e.editedByUser?(0,Q.jsx)(`span`,{className:`ml-2 text-xs text-fg-muted`,children:h?e.ignored?`已忽略`:`人工编辑`:e.ignored?`Ignored`:`Edited`}):null]}),(0,Q.jsx)(`button`,{className:`text-xs text-fg-muted`,disabled:K||M,onClick:()=>D({kind:n,itemId:e.id,text:e.text,ignored:e.ignored}),children:h?`编辑`:`Edit`}),e.evidenceSegmentIds.length?ot(e.evidenceSegmentIds,e.evidenceRevision):(0,Q.jsx)(`span`,{className:`text-xs text-fg-muted`,children:h?`暂无定位`:`No source timing`})]},e.id))]}):null;if(y)return(0,Q.jsx)(Ye,{className:`h-48 w-full`});if(!k)return null;let{discussion:Y,transcript:ct,organization:lt}=k,X=lt?.organization,ut=!k.note.title||/^Discussion · \d{4}-\d{2}-\d{2} \d{2}:\d{2}$/.test(k.note.title)?h?`语音笔记`:`Voice note`:k.note.title,dt=Y.recordingStartedAt??k.note.createdAt,ft=dt?new Date(dt).toLocaleDateString(h?`zh-CN`:`en`,{month:`short`,day:`numeric`}):null,pt=Y.audioSha256??Y.audioAttachmentId??``,mt=Ve?.source===pt?Ve.ms:Y.durationMs??0,ht=!!Y.audioAttachmentId&&!Y.audioDeletedAt,gt=[`stopping`,`sealing`,`organizing`].includes(Y.status),_t=!M&&[`recording`,`completed`,`needs_attention`].includes(Y.status),vt=i||!!G||pe,yt=ct.segments.filter(e=>(e.displayText??e.rawText??``).toLocaleLowerCase().includes(oe.toLocaleLowerCase())||e.speakerLabel?.toLocaleLowerCase().includes(oe.toLocaleLowerCase())),bt=i?k.note.markdown:H===`marks`||oe.trim()?``:Yt(k,H,{query:oe,page:Oe,showIgnored:xe});return(0,Q.jsxs)(`section`,{className:`@container/discussion relative flex h-full min-h-0 min-w-0 w-full flex-col text-fg`,onClickCapture:e=>{ye.current=e.target instanceof Element?e.target.closest(`button`):null},onKeyDown:e=>{!e.defaultPrevented&&(e.metaKey||e.ctrlKey)&&e.key===`f`&&(e.preventDefault(),i&&O.current&&getComputedStyle(O.current).visibility===`hidden`&&n?.(),U?window.requestAnimationFrame(()=>le.current?.focus()):ce(!0))},children:[(0,Q.jsxs)(`header`,{className:`flex shrink-0 flex-wrap items-start gap-x-4 gap-y-1 px-5 pb-3 pt-5 sm:px-7`,children:[(0,Q.jsxs)(`div`,{className:`min-w-40 flex-1`,children:[a??(0,Q.jsx)(`h2`,{className:`break-words text-2xl font-semibold leading-snug tracking-tight`,children:ut}),(0,Q.jsx)(`p`,{className:`mt-1 text-xs tabular-nums text-fg-muted`,children:[ft,Xt(mt)].filter(Boolean).join(` · `)})]}),(0,Q.jsx)(It,{noteActions:s,detail:k,zh:h,busy:K,processing:gt,pageText:bt,editing:!!E||!!w})]}),(0,Q.jsxs)(`div`,{className:`mx-5 mb-2 flex shrink-0 flex-wrap items-center justify-between gap-x-2 border-b border-edge-subtle pb-2 sm:mx-7`,children:[(0,Q.jsx)(`nav`,{"aria-label":h?`录音内容`:`Recording content`,className:`inline-flex items-center rounded-xl bg-surface-inset px-1`,children:[`summary`,`transcript`].map(e=>(0,Q.jsxs)(`button`,{type:`button`,"aria-pressed":H===e||e===`transcript`&&H===`marks`,className:`group relative isolate min-h-11 rounded-lg px-3.5 text-sm text-fg-muted aria-pressed:font-medium aria-pressed:text-fg focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,onClick:()=>{i&&O.current&&getComputedStyle(O.current).visibility===`hidden`&&n?.(),Je(),ie(e)},children:[(0,Q.jsx)(`span`,{"aria-hidden":!0,className:`absolute inset-x-0 inset-y-1.5 -z-10 rounded-lg group-aria-pressed:bg-surface-panel group-aria-pressed:shadow-sm`}),e===`summary`?h?`纪要`:`Summary`:h?`转写`:`Transcript`]},e))}),(0,Q.jsxs)(`div`,{className:`ml-auto flex items-center gap-1`,children:[(0,Q.jsx)(`button`,{type:`button`,"aria-label":h?`搜索`:`Search`,"aria-expanded":U||!!oe,onClick:()=>{i&&n?.(),ce(e=>!e),U&&se(``)},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`,children:(0,Q.jsx)(ze,{className:`size-4`,"aria-hidden":!0})}),r?(0,Q.jsxs)(`button`,{ref:m,type:`button`,"aria-expanded":i,"aria-controls":d,className:`inline-flex min-h-11 items-center gap-1.5 rounded-lg px-2 text-sm font-medium text-accent-fg hover:bg-surface-hover focus-visible:ring-2 focus-visible:ring-accent`,onClick:()=>{i?n?.():(Je(),t?.())},children:[i?(0,Q.jsx)(ae,{className:`size-4`,"aria-hidden":!0}):(0,Q.jsx)(Ue,{className:`size-4`,"aria-hidden":!0}),i?h?`完成`:`Done`:h?`写笔记`:`Write notes`]}):null]})]}),Te?(0,Q.jsxs)(`details`,{role:`alert`,className:`px-4 py-2 text-sm text-danger`,children:[(0,Q.jsx)(`summary`,{children:h?`操作未完成,可以稍后重试`:`Action incomplete. Try again later`}),(0,Q.jsx)(`p`,{className:`mt-2 break-words text-xs text-fg-muted`,children:Te})]}):null,U||oe?(0,Q.jsxs)(`label`,{className:`mx-5 mb-2 shrink-0 items-center gap-2 rounded-xl bg-surface-inset px-3 sm:mx-7 ${i?`hidden @min-[58rem]/discussion:flex`:`flex`}`,children:[(0,Q.jsx)(ze,{className:`size-4 text-fg-muted`}),(0,Q.jsx)(`input`,{ref:le,"aria-label":h?`搜索录音内容`:`Search recording`,className:`min-h-11 min-w-0 w-full bg-transparent text-sm outline-none`,maxLength:200,placeholder:h?`搜索录音内容`:`Search recording`,value:oe,onChange:e=>{se(e.target.value),ke(1)}}),(0,Q.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":h?`关闭搜索`:`Close search`,onClick:()=>{se(``),ce(!1)},children:(0,Q.jsx)(qe,{className:`size-4`})})]}):null,he?(0,Q.jsx)(`div`,{className:`flex shrink-0 items-center px-5 pb-2 text-xs text-fg-muted sm:px-7`,children:(0,Q.jsx)(J,{variant:`ghost`,onClick:Ze,children:W.current?.review.tab===`summary`?h?`返回结论`:`Back to conclusion`:h?`返回阅读位置`:`Back to reading`})}):null,(0,Q.jsxs)(`div`,{className:`relative flex min-h-0 min-w-0 flex-1 overflow-hidden`,children:[(0,Q.jsxs)(`main`,{ref:O,className:`min-h-0 min-w-0 flex-1 flex-col gap-5 overflow-y-auto px-5 pb-6 pt-3 sm:px-7 ${vt?`invisible @min-[58rem]/discussion:visible`:``} flex`,children:[H!==`summary`&&!oe.trim()?(0,Q.jsx)(`div`,{className:`mx-auto flex w-full max-w-[46rem] justify-end`,children:(0,Q.jsxs)(J,{variant:`ghost`,"aria-pressed":H===`marks`,onClick:()=>ie(H===`marks`?`transcript`:`marks`),className:`min-h-11 gap-1.5 aria-pressed:bg-surface-inset`,children:[(0,Q.jsx)(N,{className:`size-4`,"aria-hidden":!0}),h?`我的标记`:`My highlights`]})}):null,(Y.status!==`completed`||!X||lt?.transcriptRevision!==ct.revision)&&(Y.status!==`recording`||k.recordingJob)?(0,Q.jsx)(A,{context:`note`,nextAttemptAt:k.processing?.nextAttemptAt,input:ee(k),zh:h,busy:K,onRetry:e=>void We(()=>e===`analyze`?p(u(`${R}/organize`),{method:`POST`,body:JSON.stringify({template:ue})}):j(Y.id,e===`regenerate`?`from_audio`:`resume`))}):null,(0,Q.jsx)(`div`,{className:`mx-auto w-full max-w-[46rem]`,hidden:!!oe.trim(),children:H===`marks`?(0,Q.jsx)(Ut,{recordingId:Y.clientRequestId,discussionId:Y.id,zh:h,onEvidence:Qe,onPlay:e=>Ge(e.startedAtMs,e.endedAtMs)},Y.id):H===`summary`?X?(0,Q.jsxs)(`div`,{className:`mx-auto w-full max-w-[46rem] space-y-6`,children:[(0,Q.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[(0,Q.jsx)(`h3`,{className:`text-base font-medium`,children:h?`摘要`:`Summary`}),(0,Q.jsxs)(`div`,{className:`flex items-center gap-1`,children:[(0,Q.jsx)(Lt,{detail:k,template:ue,onTemplate:de,zh:h,busy:K,processing:gt,onOrganize:()=>void We(()=>p(u(`${R}/organize`),{method:`POST`,body:JSON.stringify({template:ue})})),onRegenerate:()=>void We(()=>j(Y.id,`from_audio`))}),(0,Q.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":h?`编辑概要`:`Edit overview`,title:h?`编辑概要`:`Edit overview`,disabled:K||gt||M,onClick:()=>D({kind:`summary`,itemId:`summary`,text:X.summary}),children:(0,Q.jsx)(Ue,{className:`size-4`,"aria-hidden":!0})})]})]}),(0,Q.jsx)(`p`,{"data-reading-anchor":`summary`,className:`whitespace-pre-wrap text-[15px] leading-7`,children:X.summary}),X.summaryEditedByUser?(0,Q.jsx)(`p`,{className:`text-xs text-fg-muted`,children:h?`已由你编辑`:`Edited by you`}):null,X.summaryEvidenceSegmentIds?.length?Array.from({length:Math.ceil(X.summaryEvidenceSegmentIds.length/100)},(e,t)=>(0,Q.jsxs)(J,{onClick:()=>void $e(X.summaryEvidenceSegmentIds.slice(t*100,(t+1)*100)),children:[h?`查看原话`:`View source`,X.summaryEvidenceSegmentIds.length>100?` · ${t+1}`:``]},t)):null,X.keyPointEvidence?.length?(0,Q.jsxs)(`section`,{className:`space-y-2`,children:[(0,Q.jsx)(`h3`,{children:h?`重点结论`:`Key points`}),X.keyPointEvidence.map(e=>(0,Q.jsxs)(`div`,{className:`flex gap-2 text-sm`,children:[(0,Q.jsx)(`p`,{className:`flex-1`,children:e.text}),ot(e.evidenceSegmentIds,e.evidenceRevision)]},e.id))]}):X.keyPoints.length?(0,Q.jsxs)(`section`,{className:`space-y-3`,children:[(0,Q.jsx)(`h3`,{className:`text-base font-medium`,children:h?`重点结论`:`Key points`}),(0,Q.jsx)(`ul`,{className:`list-disc space-y-2 pl-5 text-[15px] leading-7`,children:X.keyPoints.map((e,t)=>(0,Q.jsx)(`li`,{children:e},`${t}:${e}`))})]}):null,[...X.decisions,...X.actionItems,...X.risks,...X.openQuestions].some(e=>e.ignored)?(0,Q.jsxs)(`label`,{className:`flex items-center gap-2 text-xs text-fg-muted`,children:[(0,Q.jsx)(`input`,{type:`checkbox`,className:`ui-checkbox`,checked:xe,onChange:e=>Se(e.target.checked)}),h?`显示已忽略项`:`Show ignored items`]}):null,Ce.length?(0,Q.jsx)(J,{disabled:K||M,onClick:()=>void We(async()=>{for(let e of Ce)await p(u(`${R}/actions/${encodeURIComponent(e)}/convert`),{method:`POST`,body:JSON.stringify({organizationRevision:lt.revision})});we([])}),children:h?`加入所选 ${Ce.length} 项任务`:`Add ${Ce.length} selected tasks`}):null,st(h?`已决定事项`:`Decisions`,X.decisions,`decisions`),X.actionItems.length?(0,Q.jsxs)(`section`,{className:`space-y-3`,children:[(0,Q.jsx)(`h3`,{className:`font-semibold`,children:h?`下一步行动`:`Next actions`}),X.actionItems.filter(e=>xe||!e.ignored).map(e=>{let t=z.find(t=>t.actionId===e.id);return(0,Q.jsxs)(`article`,{"data-reading-anchor":`action:${e.id}`,className:`rounded-lg border border-edge-subtle p-3`,children:[(0,Q.jsxs)(`div`,{className:`flex items-start gap-2`,children:[!t&&!e.ignored&&(!(e.supersededBy||e.disputedBy)||e.reviewedChangeId===(e.supersededBy??e.disputedBy))?(0,Q.jsx)(`input`,{type:`checkbox`,"aria-label":`${h?`选择行动`:`Select action`}: ${e.title}`,className:`ui-checkbox`,checked:Ce.includes(e.id),onChange:t=>we(t.target.checked?[...Ce,e.id]:Ce.filter(t=>t!==e.id))}):null,(0,Q.jsxs)(`p`,{className:`flex-1 text-sm font-medium`,children:[e.title,e.supersededBy||e.disputedBy?(0,Q.jsx)(`span`,{className:`ml-2 text-xs text-fg-muted`,children:h?`有后续变更,请复核`:`Review later changes`}):null,e.editedByUser?(0,Q.jsx)(`span`,{className:`ml-2 text-xs text-fg-muted`,children:h?e.ignored?`已忽略`:`人工编辑`:e.ignored?`Ignored`:`Edited`}):null]}),(0,Q.jsx)(`button`,{className:`text-xs text-fg-muted`,disabled:K||gt||M,onClick:()=>D({kind:`actionItems`,itemId:e.id,text:e.title,owner:e.owner,dueDate:e.dueDate,ignored:e.ignored}),children:h?`编辑`:`Edit`})]}),(0,Q.jsxs)(`p`,{className:`mt-1 text-xs text-fg-muted`,children:[e.owner??(h?`负责人未明确`:`Owner unspecified`),` · `,e.dueDate??(h?`期限未明确`:`Date unspecified`)]}),(0,Q.jsxs)(`div`,{className:`mt-3 flex flex-wrap items-center gap-3 text-xs`,children:[e.evidenceSegmentIds.length?ot(e.evidenceSegmentIds,e.evidenceRevision,h?`查看原话`:`Source`):null,t?t.deleted?(0,Q.jsx)(`span`,{children:h?`关联任务已删除`:`Linked task deleted`}):(0,Q.jsx)(c,{className:`text-accent-fg`,to:Pe(`${l.pathname}${l.search}`,t.taskId),children:t.resolution===`done`?h?`已完成 · 查看任务`:`Done · View task`:h?`查看任务 / 交给助手`:`View task / Delegate`}):e.ignored?null:(0,Q.jsx)(J,{disabled:K||M||!!(e.supersededBy||e.disputedBy)&&e.reviewedChangeId!==(e.supersededBy??e.disputedBy),onClick:()=>void We(()=>p(u(`${R}/actions/${encodeURIComponent(e.id)}/convert`),{method:`POST`,body:JSON.stringify({organizationRevision:lt.revision})})),children:h?`加入我的任务`:`Add to my tasks`})]})]},e.id)})]}):null,st(h?`风险`:`Risks`,X.risks,`risks`),st(h?`尚未确定`:`Open questions`,X.openQuestions,`openQuestions`),X.changes?.length?(0,Q.jsxs)(`section`,{className:`space-y-3`,children:[(0,Q.jsx)(`h3`,{className:`font-semibold`,children:h?`前后变更`:`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,Q.jsxs)(`article`,{className:`space-y-2 rounded border border-edge p-3 text-sm`,children:[(0,Q.jsx)(`p`,{className:`text-xs text-fg-muted`,children:e.relation===`supersedes`?h?`后续撤销或替代`:`Later superseded`:h?`存在冲突,尚未明确解决`:`Unresolved conflict`}),(0,Q.jsx)(`button`,{className:`block text-left text-accent-fg`,onClick:()=>void $e(n.evidenceSegmentIds,n.evidenceRevision),children:`title`in n?n.title:n.text}),(0,Q.jsx)(`span`,{children:`↓`}),(0,Q.jsx)(`button`,{className:`block text-left text-accent-fg`,onClick:()=>void $e(r.evidenceSegmentIds,r.evidenceRevision),children:`title`in r?r.title:r.text})]},`${e.fromId}:${e.toId}`)})]}):null]}):(0,Q.jsxs)(`div`,{className:`mx-auto w-full max-w-[46rem] space-y-4 py-3`,children:[(0,Q.jsx)(`p`,{className:`whitespace-pre-wrap text-[15px] leading-7 text-fg-muted`,children:ct.text?ct.text.slice(0,400)+(ct.text.length>400?`…`:``):null}),ct.text?(0,Q.jsx)(J,{className:`min-h-11`,onClick:()=>ie(`transcript`),children:h?`查看转写`:`View transcript`}):null]}):(0,Q.jsxs)(`div`,{className:`divide-y divide-edge-subtle`,children:[yt.slice(0,Oe*50).map(e=>(0,Q.jsxs)(`article`,{"data-reading-anchor":`segment:${e.sequence}`,id:`discussion-segment-${e.sequence}`,className:`px-3 py-2 ${je.includes(e.sequence)||B.anchor===e.sequence&&B.anchorRevision===ct.revision?`rounded-lg bg-accent-soft`:B.positionMs>0&&B.positionMs>=e.startedAtMs&&B.positionMs<e.endedAtMs?`rounded-lg bg-surface-inset`:``}`,children:[(0,Q.jsxs)(`div`,{className:`flex flex-wrap items-center gap-x-2 text-xs text-fg-muted`,children:[(0,Q.jsx)(`span`,{children:e.speakerLabel??(h?`未区分说话人`:`Speaker unknown`)}),e.status===`confirmed`&&!M?(0,Q.jsxs)(`button`,{type:`button`,className:`ml-auto inline-flex min-h-11 items-center gap-1.5 rounded-lg px-2 hover:bg-surface-hover focus-visible:ring-2 focus-visible:ring-accent`,onClick:()=>void at(e),children:[(0,Q.jsx)(N,{className:`size-3.5`,"aria-hidden":!0}),h?`标记此段`:`Highlight segment`]}):null,_t&&e.status===`confirmed`?(0,Q.jsx)(`button`,{type:`button`,className:`min-h-11 rounded-lg px-2 hover:bg-surface-hover focus-visible:ring-2 focus-visible:ring-accent`,onClick:()=>T({segment:e,text:e.displayText??e.rawText??``,speaker:e.speakerLabel??``}),children:h?`校对`:`Edit`}):null]}),ht&&e.status===`confirmed`?(0,Q.jsxs)(`button`,{type:`button`,className:`flex min-h-11 w-full items-start gap-3 rounded-lg px-2 py-2 text-left hover:bg-surface-hover focus-visible:ring-2 focus-visible:ring-accent`,onClick:()=>void it(e),children:[(0,Q.jsxs)(`span`,{className:`inline-flex shrink-0 items-center gap-1 pt-1 text-xs tabular-nums text-accent-fg`,children:[(0,Q.jsx)(Le,{className:`size-3`,"aria-hidden":!0}),(0,Q.jsxs)(`span`,{className:`sr-only`,children:[h?`回听`:`Play`,` `]}),Xt(e.startedAtMs)]}),(0,Q.jsx)(`span`,{className:`whitespace-pre-wrap break-words text-sm leading-6`,children:e.displayText??e.rawText})]}):(0,Q.jsxs)(`p`,{className:`flex gap-3 px-2 py-2 text-sm leading-6`,children:[(0,Q.jsx)(`span`,{className:`shrink-0 text-xs tabular-nums text-fg-muted`,children:Xt(e.startedAtMs)}),(0,Q.jsx)(`span`,{className:`whitespace-pre-wrap break-words`,children:e.displayText??e.rawText??(h?`等待转写`:`Awaiting transcription`)})]})]},e.sequence)),yt.length>Oe*50?(0,Q.jsx)(J,{onClick:()=>ke(Oe+1),children:h?`加载更多`:`More`}):null]})}),(0,Q.jsx)(`div`,{className:`mx-auto w-full max-w-[46rem]`,children:(0,Q.jsx)(Ht,{id:Y.id,query:oe.trim(),zh:h,sourceKey:`${Y.audioSha256}:${Y.audioDeletedAt}`,active:gt||Y.status===`recording`,tab:H,refreshKey:`${Y.updatedAt}:${ct.revision}:${lt?.revision}`,onEvidence:Qe,onPlay:Ge},Y.id)})]}),r?(0,Q.jsx)(`aside`,{id:d,"aria-label":h?`我的笔记`:`My notes`,hidden:!i,className:`absolute inset-0 z-10 min-h-0 min-w-0 overflow-hidden bg-surface-panel @min-[58rem]/discussion:static @min-[58rem]/discussion:w-[24rem] @min-[58rem]/discussion:shrink-0 @min-[58rem]/discussion:border-l @min-[58rem]/discussion:border-edge-subtle`,onKeyDown:e=>{e.key!==`Escape`||e.defaultPrevented||(n?.(),m.current?.focus())},children:r}):null,G||pe?(0,Q.jsxs)(`aside`,{ref:fe,tabIndex:-1,onKeyDown:e=>{e.key===`Escape`&&(e.stopPropagation(),Xe())},"aria-label":h?`原话证据`:`Source evidence`,className:`absolute inset-0 z-20 flex min-h-0 w-full min-w-0 flex-col border-edge bg-surface-panel outline-none @min-[58rem]/discussion:static @min-[58rem]/discussion:w-[22rem] @min-[58rem]/discussion:shrink-0 @min-[58rem]/discussion:border-l`,children:[(0,Q.jsxs)(`header`,{className:`flex shrink-0 items-center justify-between border-b border-edge p-4`,children:[(0,Q.jsxs)(`h3`,{children:[h?`原话证据`:`Source evidence`,` `,G?`· v${G.transcriptRevision}`:``]}),(0,Q.jsx)(`button`,{"aria-label":h?`关闭`:`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:Xe,children:(0,Q.jsx)(qe,{className:`size-4`})})]}),(0,Q.jsxs)(`div`,{className:`min-h-0 flex-1 space-y-4 overflow-y-auto p-4`,children:[pe?(0,Q.jsxs)(`div`,{"aria-busy":`true`,className:`space-y-3`,children:[(0,Q.jsx)(Ye,{className:`h-4 w-1/3`}),(0,Q.jsx)(Ye,{className:`h-24 w-full`})]}):null,G?(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(`p`,{className:`text-xs text-fg-muted`,children:h?`按整段定位,不代表词句级时间。`:`Segment timing; not word-level alignment.`}),G.stale?(0,Q.jsx)(`p`,{className:`text-xs text-fg-muted`,children:h?`原文已更新,以下保留当时版本的依据。`:`Transcript updated; showing the original evidence revision.`}):null,!G.audioAvailable||!G.timingVerified?(0,Q.jsx)(`p`,{className:`text-xs text-fg-muted`,children:h?`原文仍可查看;原音不可用或时间定位待核实。`:`Text remains available; audio is missing or timing is unverified.`}):null,G.segments.map(t=>(0,Q.jsxs)(`article`,{className:`space-y-2 rounded border border-edge p-3`,children:[(0,Q.jsxs)(`p`,{className:`text-xs text-fg-muted`,children:[Xt(t.startedAtMs),`–`,Xt(t.endedAtMs),` · `,t.speakerLabel??(h?`说话人未明确`:`Unknown speaker`)]}),(0,Q.jsx)(`p`,{className:`whitespace-pre-wrap text-sm leading-7`,children:t.text}),t.playback.map((e,t)=>(0,Q.jsxs)(J,{onClick:()=>Ge(e.startedAtMs,e.endedAtMs),children:[h?`播放原话`:`Play source`,` `,Xt(e.startedAtMs),`–`,Xt(e.endedAtMs)]},t)),!G.stale&&G.transcriptRevision===_?.transcript.revision&&G.transcriptRevision!==ct.revision?(0,Q.jsx)(J,{onClick:()=>P(),children:h?`查看最新原文`:`View latest transcript`}):null,!G.stale&&G.transcriptRevision===_?.transcript.revision&&G.transcriptRevision===ct.revision?(0,Q.jsx)(J,{onClick:()=>{se(``),ke(Math.max(Oe,Math.ceil((ct.segments.findIndex(e=>e.sequence===t.sequence)+1)/50))),ie(`transcript`),q([t.sequence]),be(null),ge(!0),re(e,{anchor:t.sequence,anchorRevision:ct.revision}),window.setTimeout(()=>document.getElementById(`discussion-segment-${t.sequence}`)?.scrollIntoView?.({block:`center`}),0)},children:h?`定位原文`:`Locate transcript`}):null]},t.sequence))]}):null]})]}):null]}),ht?(0,Q.jsx)(`footer`,{className:`shrink-0 border-t border-edge-subtle px-4 py-2`,children:(0,Q.jsx)(`audio`,{ref:Ie,controls:!0,preload:`metadata`,className:`h-10 w-full`,src:u(`${R}/audio`),"aria-label":h?`录音播放器`:`Recording player`,onDurationChange:e=>{let t=e.currentTarget.duration;He(Number.isFinite(t)&&t>0?{source:pt,ms:Math.floor(t*1e3)}:void 0)},onTimeUpdate:t=>{let n=t.currentTarget.currentTime*1e3;re(e,{positionMs:n}),Ae.current!==null&&n>=Ae.current&&(t.currentTarget.pause(),Ae.current=null)},onLoadedMetadata:e=>{let t=e.currentTarget;Be.current===null?Zt(t,B.source===pt?B.positionMs/1e3:0):(Zt(t,Be.current),Be.current=null,tt(t)&&t.play().catch(()=>{t.paused&&nt(t)}))},onError:()=>Ee(h?`录音暂不可播放`:`Recording unavailable`)},pt)}):null,E&<?(0,Q.jsx)(Jt,{initial:E,zh:h,busy:K,onClose:()=>D(null),onSave:e=>We(async()=>{await p(u(`${R}/summary`),{method:`PATCH`,body:JSON.stringify({...e,expectedRevision:lt.revision})}),D(null)})},`${E.kind}:${E.itemId}:${lt.revision}`):null,w?(0,Q.jsx)(C,{open:!0,onOpenChange:e=>{e||T(null)},children:(0,Q.jsxs)(b,{children:[(0,Q.jsx)(g,{className:`xopc-dialog-overlay fixed inset-0 z-[70] bg-scrim backdrop-blur-[2px]`}),(0,Q.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,Q.jsxs)(`header`,{className:`flex items-center justify-between border-b border-edge p-4`,children:[(0,Q.jsx)(S,{children:h?`校对逐字稿`:`Edit transcript`}),(0,Q.jsx)(`button`,{"aria-label":h?`关闭校对`:`Close editor`,onClick:()=>T(null),children:(0,Q.jsx)(qe,{className:`size-4`})})]}),(0,Q.jsxs)(`div`,{className:`min-h-0 flex-1 space-y-3 overflow-y-auto p-4`,children:[(0,Q.jsxs)(`label`,{className:`block text-xs`,children:[h?`本段说话人`:`Speaker for this segment`,(0,Q.jsx)(`input`,{className:`mt-1 w-full rounded border border-edge bg-surface-inset p-2 text-sm`,value:w.speaker,onChange:e=>T({...w,speaker:e.target.value})})]}),w.segment.speakerLabel?(0,Q.jsxs)(`label`,{className:`flex items-center gap-2 text-xs`,children:[(0,Q.jsx)(`input`,{type:`checkbox`,className:`ui-checkbox`,checked:!!w.applyToSpeakerGroup,onChange:e=>T({...w,applyToSpeakerGroup:e.target.checked})}),h?`同时更名所有同标签片段;输入已有标签可合并说话人`:`Rename all segments with this label; use an existing label to merge speakers`]}):null,(0,Q.jsx)(`textarea`,{className:`min-h-32 w-full rounded border border-edge bg-surface-inset p-2 text-sm`,value:w.text,onChange:e=>T({...w,text:e.target.value})})]}),(0,Q.jsx)(`footer`,{className:`border-t border-edge p-3`,children:(0,Q.jsxs)(J,{variant:`primary`,disabled:K||!w.text.trim(),onClick:()=>void We(async()=>{await p(u(`${R}/segments/${w.segment.sequence}`),{method:`PATCH`,body:JSON.stringify({displayText:w.text,speakerLabel:w.speaker,expectedRevision:w.segment.revision,applyToSpeakerGroup:w.applyToSpeakerGroup,expectedTranscriptRevision:ct.revision})}),T(null)}),children:[(0,Q.jsx)(ae,{className:`size-4`}),h?`保存修订`:`Save revision`]})})]})]})}):null]})}var $t={edit:Ie,ai_edit:He,sync:Re,restore:w};function en(e,t){return{edit:t.triggerEdit,ai_edit:t.triggerAiEdit,sync:t.triggerSync,restore:t.triggerRestore}[e]??e}function tn({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}=et(e?[`note-history`,e]:null,()=>Te(e)),[u,d]=(0,Z.useState)(!1),[p,m]=(0,Z.useState)(null),[g,_]=(0,Z.useState)(null),v=(0,Z.useCallback)(async t=>{d(!0),_(null);try{await be(e,t),m(null),i()}catch{_(o.restoreFailed)}finally{d(!1)}},[e,o.restoreSuccess,o.restoreFailed,i]),y=Date.now();return(0,Q.jsxs)(`div`,{className:`flex h-full min-h-0 flex-col`,children:[(0,Q.jsxs)(`div`,{className:`flex shrink-0 items-center justify-between border-b border-edge px-4 py-3`,children:[(0,Q.jsxs)(`div`,{className:`flex items-center gap-2 text-sm font-medium text-fg`,children:[(0,Q.jsx)(me,{className:`size-4`,"aria-hidden":!0}),o.history]}),(0,Q.jsx)(`button`,{type:`button`,onClick:r,className:`rounded-lg p-1 text-fg-muted transition-colors hover:bg-surface-hover hover:text-fg`,children:(0,Q.jsx)(qe,{className:`size-4`,"aria-hidden":!0})})]}),(0,Q.jsxs)(`div`,{className:`min-h-0 flex-1 overflow-y-auto`,children:[g?(0,Q.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,Q.jsx)(`ul`,{className:`divide-y divide-edge`,children:c.map(e=>{let r=$t[e.trigger]??Ie,i=t===e.timestamp,a=p===e.timestamp;return(0,Q.jsxs)(`li`,{children:[(0,Q.jsxs)(`button`,{type:`button`,onClick:()=>n(e),className:Je(`w-full px-4 py-3 text-left transition-colors`,i?`bg-accent/10`:`hover:bg-surface-hover`),children:[(0,Q.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,Q.jsx)(r,{className:`size-3.5 shrink-0 text-fg-muted`,"aria-hidden":!0}),(0,Q.jsx)(`span`,{className:`text-xs font-medium text-fg`,children:en(e.trigger,o)}),(0,Q.jsx)(`span`,{className:`ml-auto text-xs text-fg-muted`,children:jt(e.timestamp,y,s)})]}),e.snippet&&(0,Q.jsx)(`p`,{className:`mt-1 truncate text-xs text-fg-muted/60`,children:e.snippet})]}),i&&(0,Q.jsx)(`div`,{className:`border-t border-edge/50 px-4 py-2`,children:a?(0,Q.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,Q.jsx)(`span`,{className:`min-w-0 truncate text-xs text-fg-muted`,children:o.restoreConfirm}),(0,Q.jsx)(`button`,{type:`button`,onClick:t=>{t.stopPropagation(),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,Q.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,Q.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,Q.jsxs)(`div`,{className:`px-4 py-8 text-center`,children:[(0,Q.jsx)(`p`,{className:`text-sm font-medium text-fg-muted`,children:o.historyEmpty}),(0,Q.jsx)(`p`,{className:`mt-1 text-xs text-fg-muted/60`,children:o.historyEmptyDescription})]})]})]})}var nn=24,rn=864;function an(e){let t=(0,Dt.c)(11),n;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(n=[],t[0]=n):n=t[0];let[r,i]=(0,Z.useState)(n),[a,o]=(0,Z.useState)(null),[s,c]=(0,Z.useState)(!1),l=(0,Z.useRef)(null),u,d;t[1]===e?(u=t[2],d=t[3]):(u=()=>{if(!e){i([]),o(null),c(!1);return}let t=0,n=!0,r=[],a=!0,s=null,u=null,d=()=>{if(t=0,n){n=!1,s=e.querySelector(`[data-note-outline-scroll]`);let t=s?.querySelector(`[data-note-outline-content], .ProseMirror`)??null;t!==u&&(u&&p?.unobserve(u),t&&p?.observe(t),u=t);let o=Array.from(u?.querySelectorAll(`h1, h2, h3`)??[],sn).filter(on);(a||o.length!==r.length||o.some((e,t)=>{let{element:n,label:i}=e;return n!==r[t]?.element||i!==r[t]?.label}))&&(r=o,i(o),a=!1)}if(c(e.clientWidth>=rn),!s?.clientHeight||r.length<2)return;let d=l.current;if(d&&Math.abs(d.scrollTop-s.scrollTop)<1&&r.some(e=>{let{element:t}=e;return t===d.element})){o(d.element);return}l.current=null;let f=s.getBoundingClientRect().top+nn+1,m=r[0].element;for(let{element:e}of r){if(e.getBoundingClientRect().top>f)break;m=e}let h=s.scrollTop>0&&s.scrollHeight-s.clientHeight-s.scrollTop<=1;o(h?r[r.length-1].element:m)},f=()=>{t||=window.requestAnimationFrame(d)},p=typeof ResizeObserver>`u`?null:new ResizeObserver(f),m=new MutationObserver(()=>{n=!0,f()});return p?.observe(e),m.observe(e,{childList:!0,characterData:!0,subtree:!0}),e.addEventListener(`scroll`,f,{capture:!0,passive:!0}),d(),()=>{m.disconnect(),p?.disconnect(),e.removeEventListener(`scroll`,f,!0),window.cancelAnimationFrame(t),l.current=null}},d=[e],t[1]=e,t[2]=u,t[3]=d),(0,Z.useLayoutEffect)(u,d);let f;t[4]===e?f=t[5]:(f=t=>{let n=t.closest(`[data-note-outline-scroll]`);if(!n||!e?.contains(n))return;let r=t.getBoundingClientRect().top-n.getBoundingClientRect().top;n.scrollTop+=r-nn,l.current={element:t,scrollTop:n.scrollTop},o(t)},t[4]=e,t[5]=f);let p=f,m;return t[6]!==a||t[7]!==p||t[8]!==r||t[9]!==s?(m={headings:r,current:a,wide:s,goTo:p},t[6]=a,t[7]=p,t[8]=r,t[9]=s,t[10]=m):m=t[10],m}function on(e){return e.label}function sn(e){return{element:e,label:e.textContent?.trim()??``,level:Number(e.tagName.slice(1))}}function cn(e){let t=(0,Dt.c)(16),{label:n,headings:r,current:i,onSelect:a}=e,o;t[0]===r?o=t[1]:(o=Math.min(...r.map(ln)),t[0]=r,t[1]=o);let s=o,c;if(t[2]!==s||t[3]!==i||t[4]!==r||t[5]!==a){let e;t[7]!==s||t[8]!==i||t[9]!==a?(e=(e,t)=>{let{element:n,label:r,level:o}=e;return(0,Q.jsx)(`li`,{children:(0,Q.jsx)(`button`,{type:`button`,"aria-current":n===i?`location`:void 0,onClick:()=>a(n),style:{paddingInlineStart:`${.625+(o-s)*.75}rem`},className:Je(`min-h-9 w-full rounded-md py-1.5 pr-2 text-start text-sm break-words focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-accent`,n===i?`bg-accent-soft font-medium text-accent-fg`:`text-fg-muted hover:bg-surface-hover hover:text-fg`),children:r})},t)},t[7]=s,t[8]=i,t[9]=a,t[10]=e):e=t[10],c=r.map(e),t[2]=s,t[3]=i,t[4]=r,t[5]=a,t[6]=c}else c=t[6];let l;t[11]===c?l=t[12]:(l=(0,Q.jsx)(`ul`,{children:c}),t[11]=c,t[12]=l);let u;return t[13]!==n||t[14]!==l?(u=(0,Q.jsx)(`nav`,{"aria-label":n,className:`min-h-0 overflow-y-auto overscroll-contain p-1.5`,children:l}),t[13]=n,t[14]=l,t[15]=u):u=t[15],u}function ln(e){let{level:t}=e;return t}function un(e){let t=(0,Dt.c)(18),[n,r]=(0,Z.useState)(!1),i;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(i=(0,Q.jsx)(M,{className:`size-4`,"aria-hidden":!0}),t[0]=i):i=t[0];let a;t[1]===e.label?a=t[2]:(a=(0,Q.jsx)(st,{asChild:!0,children:(0,Q.jsx)(`button`,{type:`button`,className:`absolute top-5 right-4 z-10 inline-flex size-9 items-center justify-center rounded-lg text-fg-muted hover:bg-surface-hover hover:text-fg focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,"aria-label":e.label,title:e.label,children:i})}),t[1]=e.label,t[2]=a);let o;t[3]===e.label?o=t[4]:(o=(0,Q.jsx)(`div`,{className:`shrink-0 px-4 pt-3 pb-1 text-xs font-medium text-fg-muted`,children:e.label}),t[3]=e.label,t[4]=o);let s;t[5]===e?s=t[6]:(s=t=>{e.onSelect(t),r(!1)},t[5]=e,t[6]=s);let c;t[7]!==e||t[8]!==s?(c=(0,Q.jsx)(cn,{...e,onSelect:s}),t[7]=e,t[8]=s,t[9]=c):c=t[9];let l;t[10]!==e.label||t[11]!==o||t[12]!==c?(l=(0,Q.jsx)(it,{children:(0,Q.jsxs)(at,{"aria-label":e.label,align:`end`,sideOffset:6,collisionPadding:12,className:`z-[70] flex max-h-[min(25rem,var(--radix-popover-content-available-height))] w-64 flex-col overflow-hidden rounded-xl border border-edge bg-surface-overlay text-fg shadow-popover`,children:[o,c]})}),t[10]=e.label,t[11]=o,t[12]=c,t[13]=l):l=t[13];let u;return t[14]!==n||t[15]!==a||t[16]!==l?(u=(0,Q.jsxs)(ot,{open:n,onOpenChange:r,children:[a,l]}),t[14]=n,t[15]=a,t[16]=l,t[17]=u):u=t[17],u}function dn(e){let t=(0,Dt.c)(31),n,r,i,a,o;t[0]===e?(n=t[1],r=t[2],i=t[3],a=t[4],o=t[5]):({closeLabel:n,open:i,onOpenChange:r,returnFocus:o,...a}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i,t[4]=a,t[5]=o);let s;t[6]===Symbol.for(`react.memo_cache_sentinel`)?(s=(0,Q.jsx)(g,{className:`fixed inset-0 z-[150] bg-scrim`}),t[6]=s):s=t[6];let c;t[7]===o?c=t[8]:(c=e=>{e.preventDefault(),o()},t[7]=o,t[8]=c);let l;t[9]===a.label?l=t[10]:(l=(0,Q.jsx)(S,{className:`text-sm font-semibold`,children:a.label}),t[9]=a.label,t[10]=l);let u;t[11]===Symbol.for(`react.memo_cache_sentinel`)?(u=(0,Q.jsx)(qe,{className:`size-4`,"aria-hidden":!0}),t[11]=u):u=t[11];let d;t[12]===n?d=t[13]:(d=(0,Q.jsx)(y,{className:`inline-flex size-9 items-center justify-center rounded-lg text-fg-muted hover:bg-surface-hover focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,"aria-label":n,children:u}),t[12]=n,t[13]=d);let f;t[14]!==l||t[15]!==d?(f=(0,Q.jsxs)(`header`,{className:`flex shrink-0 items-center justify-between border-b border-edge-subtle px-4 py-2`,children:[l,d]}),t[14]=l,t[15]=d,t[16]=f):f=t[16];let p;t[17]!==r||t[18]!==a?(p=e=>{r(!1),a.onSelect(e)},t[17]=r,t[18]=a,t[19]=p):p=t[19];let m;t[20]!==a||t[21]!==p?(m=(0,Q.jsx)(cn,{...a,onSelect:p}),t[20]=a,t[21]=p,t[22]=m):m=t[22];let h;t[23]!==c||t[24]!==f||t[25]!==m?(h=(0,Q.jsxs)(b,{children:[s,(0,Q.jsxs)(x,{"aria-describedby":void 0,onCloseAutoFocus:c,className:`fixed top-1/2 left-1/2 z-[151] flex h-[min(24rem,calc(100dvh-2rem))] w-[min(26rem,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 shadow-popover`,children:[f,m]})]}),t[23]=c,t[24]=f,t[25]=m,t[26]=h):h=t[26];let _;return t[27]!==r||t[28]!==i||t[29]!==h?(_=(0,Q.jsx)(C,{open:i,onOpenChange:r,children:h}),t[27]=r,t[28]=i,t[29]=h,t[30]=_):_=t[30],_}function fn({noteId:e,note:t,catalyzing:n,onCatalyze:r,onClose:i,noteThreads:a,openingChat:o,onOpenChat:c,onOpenNewChat:l}){let u=h(f(e=>e.language)).notes,d=s(),p=t?.aiDeep?.catalysis,m=p?.report??null,[g,_]=(0,Z.useState)(null),[v,y]=(0,Z.useState)(!1),{data:b,mutate:x,isLoading:S}=et(e?[`note-agent-context-status`,e]:null,()=>K(e),{revalidateOnFocus:!1}),C=(0,Z.useCallback)(async()=>{if(!v){y(!0),_(null);try{await x(()=>Me(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,Z.useCallback)(async t=>{try{await G(e,t)}catch{}},[e]);return(0,Q.jsxs)(`div`,{className:`flex h-full flex-col`,children:[(0,Q.jsxs)(`div`,{className:`flex items-center justify-between border-b border-edge-subtle px-4 py-3`,children:[(0,Q.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,Q.jsx)(He,{className:`size-4 text-accent`,"aria-hidden":!0}),(0,Q.jsx)(`span`,{className:`text-sm font-semibold text-fg`,children:u.catalysisSectionTitle})]}),(0,Q.jsx)(`button`,{type:`button`,onClick:i,"aria-label":u.lightboxClose,className:`rounded-lg p-1.5 text-fg-muted transition-colors hover:bg-surface-hover hover:text-fg`,children:(0,Q.jsx)(T,{className:`size-4 rotate-180`,"aria-hidden":!0})})]}),(0,Q.jsxs)(`div`,{className:`flex-1 overflow-y-auto p-4`,children:[(0,Q.jsx)(`p`,{className:`mb-4 text-xs leading-relaxed text-fg-muted`,children:u.catalysisSectionDescription}),b?(0,Q.jsxs)(`section`,{className:`mb-4 rounded-xl bg-surface-base p-3`,children:[(0,Q.jsxs)(`div`,{className:`flex items-center justify-between gap-2`,children:[(0,Q.jsx)(`div`,{className:`text-xs font-medium text-fg-muted`,children:u.contextStatusTitle}),(0,Q.jsx)(`button`,{type:`button`,onClick:()=>void 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,Q.jsx)(`span`,{className:Je(`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,Q.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,Q.jsx)(`p`,{className:`mt-3 rounded-lg border border-danger/25 bg-danger-soft px-3 py-2 text-xs text-danger`,role:`alert`,children:g}):null,b.attachments.length>0?(0,Q.jsx)(`div`,{className:`mt-3 space-y-1.5`,children:b.attachments.slice(0,5).map(e=>(0,Q.jsxs)(`div`,{className:`flex items-center justify-between gap-2 rounded-lg bg-surface-hover px-2 py-1.5 text-xs`,children:[(0,Q.jsx)(`span`,{className:`min-w-0 truncate text-fg`,children:e.fileName}),(0,Q.jsx)(`span`,{className:`shrink-0 text-fg-muted`,children:e.status})]},e.attachmentId))}):null]}):null,(0,Q.jsx)(`button`,{type:`button`,onClick:r,disabled:n,className:`w-full rounded-lg bg-accent px-2.5 py-1.5 text-xs font-medium text-on-accent transition-colors hover:bg-accent/90 disabled:cursor-not-allowed disabled:opacity-50`,children:n?u.processing:m?u.recatalyze:u.catalyzeAction}),m?(0,Q.jsxs)(`div`,{className:`mt-4 space-y-4`,children:[(0,Q.jsxs)(`div`,{children:[(0,Q.jsx)(`div`,{className:`text-xs font-medium text-fg-muted`,children:u.valueHypothesis}),(0,Q.jsx)(`p`,{className:`mt-1 text-sm leading-relaxed text-fg`,children:m.valueHypothesis})]}),(0,Q.jsxs)(`div`,{children:[(0,Q.jsx)(`div`,{className:`text-xs font-medium text-fg-muted`,children:u.targetUsers}),(0,Q.jsx)(`div`,{className:`mt-1 flex flex-wrap gap-1.5`,children:m.targetUsers.slice(0,5).map(e=>(0,Q.jsx)(`span`,{className:`rounded-full bg-surface-hover px-2 py-0.5 text-xs text-fg`,children:e},e))})]}),(0,Q.jsxs)(`div`,{children:[(0,Q.jsx)(`div`,{className:`text-xs font-medium text-fg-muted`,children:u.keyQuestions}),(0,Q.jsx)(`ul`,{className:`mt-1 space-y-1 text-sm leading-relaxed text-fg`,children:m.keyQuestions.slice(0,3).map(e=>(0,Q.jsxs)(`li`,{className:`flex gap-2`,children:[(0,Q.jsx)(`span`,{className:`mt-2 size-1 shrink-0 rounded-full bg-accent`}),(0,Q.jsx)(`span`,{children:e})]},e))})]}),(0,Q.jsxs)(`div`,{children:[(0,Q.jsx)(`div`,{className:`text-xs font-medium text-fg-muted`,children:u.mvpPathLabel}),(0,Q.jsx)(`ol`,{className:`mt-1 space-y-1 text-sm leading-relaxed text-fg`,children:m.mvpPath.slice(0,3).map((e,t)=>(0,Q.jsxs)(`li`,{className:`flex gap-2`,children:[(0,Q.jsxs)(`span`,{className:`text-fg-muted`,children:[t+1,`.`]}),(0,Q.jsx)(`span`,{children:e})]},e))})]}),(0,Q.jsxs)(`div`,{children:[(0,Q.jsx)(`div`,{className:`text-xs font-medium text-fg-muted`,children:u.risks}),(0,Q.jsx)(`ul`,{className:`mt-1 space-y-1 text-sm leading-relaxed text-fg`,children:m.risks.slice(0,3).map(e=>(0,Q.jsxs)(`li`,{className:`flex gap-2`,children:[(0,Q.jsx)(`span`,{className:`mt-2 size-1 shrink-0 rounded-full bg-fg-muted`}),(0,Q.jsx)(`span`,{children:e})]},e))})]}),(0,Q.jsxs)(`div`,{children:[(0,Q.jsx)(`div`,{className:`text-xs font-medium text-fg-muted`,children:u.nextActions}),(0,Q.jsx)(`ul`,{className:`mt-1 space-y-1 text-sm leading-relaxed text-fg`,children:m.nextActions.slice(0,4).map(e=>(0,Q.jsxs)(`li`,{className:`flex gap-2`,children:[(0,Q.jsx)(`span`,{className:`rounded bg-accent/10 px-1.5 py-0.5 text-[10px] uppercase tracking-wide text-accent`,children:e.kind}),(0,Q.jsx)(`span`,{children:e.text})]},`${e.kind}:${e.text}`))})]}),(0,Q.jsxs)(`div`,{className:`flex items-center justify-between border-t border-edge-subtle pt-3`,children:[(0,Q.jsx)(`span`,{className:`text-xs text-fg-muted`,children:u.confidenceLabel.replace(`{{percent}}`,String(Math.round(m.confidence*100)))}),(0,Q.jsxs)(`div`,{className:`flex items-center gap-1`,children:[(0,Q.jsx)(`button`,{type:`button`,onClick:()=>void w(`helpful`),className:Je(`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,Q.jsx)(O,{className:`size-3.5`,"aria-hidden":!0})}),(0,Q.jsx)(`button`,{type:`button`,onClick:()=>void w(`not_helpful`),className:Je(`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,Q.jsx)(E,{className:`size-3.5`,"aria-hidden":!0})})]})]})]}):(0,Q.jsx)(`div`,{className:`mt-4 rounded-lg border border-dashed border-edge-subtle px-3 py-6 text-center text-sm text-fg-muted`,children:u.noCatalysisReportHint}),(0,Q.jsxs)(`section`,{className:`mt-6 rounded-xl bg-surface-base p-4`,children:[(0,Q.jsxs)(`div`,{className:`mb-3 flex items-center justify-between gap-3`,children:[(0,Q.jsxs)(`div`,{children:[(0,Q.jsxs)(`div`,{className:`flex items-center gap-2 text-sm font-semibold text-fg`,children:[(0,Q.jsx)(Fe,{className:`size-4 text-accent`,"aria-hidden":!0}),u.relatedThreadsTitle]}),(0,Q.jsx)(`p`,{className:`mt-1 text-xs text-fg-muted`,children:u.relatedThreadsDescription})]}),(0,Q.jsxs)(`div`,{className:`flex shrink-0 items-center gap-1.5`,children:[(0,Q.jsx)(`button`,{type:`button`,onClick:c,disabled: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,Q.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,Q.jsx)(`div`,{className:`space-y-2`,children:a.slice(0,5).map(e=>(0,Q.jsxs)(`button`,{type:`button`,onClick:()=>d(`/chat/${encodeURIComponent(e.key)}`),className:`w-full rounded-lg border border-edge-subtle px-3 py-2 text-left transition-colors hover:bg-surface-hover`,children:[(0,Q.jsx)(`div`,{className:`truncate text-sm font-medium text-fg`,children:e.name||u.noteDiscussionFallback}),(0,Q.jsx)(`div`,{className:`mt-0.5 text-xs text-fg-muted`,children:u.messageCount.replace(`{{count}}`,String(e.messageCount??0))})]},e.key))}):(0,Q.jsx)(`div`,{className:`rounded-lg border border-dashed border-edge-subtle px-3 py-5 text-center text-sm text-fg-muted`,children:u.noThreads})]})]})]})}var pn=[{value:`86400000`,zh:`24 小时`,en:`24 hours`},{value:`604800000`,zh:`7 天`,en:`7 days`},{value:`2592000000`,zh:`30 天`,en:`30 days`}];function mn({open:e,onOpenChange:t,note:n}){let r=f(e=>e.language)===`zh`,i=r?vn:yn,{data:a,mutate:o}=et(e?[`note-shares`,n.id]:null,()=>De(n.id)),s=et(e?`hosted-share-auth-status`:null,ft),c=s.data===!0,l=et(e&&c?`hosted-publication-capabilities`:null,mt),u=l.data?.publishing.allowed===!0,d=et(e&&c?[`hosted-note-publications`,n.id]:null,()=>we(n.id)),[p,m]=(0,Z.useState)(new Set),[h,_]=(0,Z.useState)(`86400000`),[w,T]=(0,Z.useState)(``),[E,D]=(0,Z.useState)(``),[O,k]=(0,Z.useState)(`hosted`),[A,j]=(0,Z.useState)(!1),[M,N]=(0,Z.useState)(null),[P,F]=(0,Z.useState)(null),[I,L]=(0,Z.useState)(!1),[R,z]=(0,Z.useState)(null),ee=(0,Z.useMemo)(()=>{let e=new Set;return n.markdown.replace(/xopc-attachment:\/\/notes\/([^/]+)\/([^\s)]+)/gi,(t,r,i)=>{try{decodeURIComponent(r)===n.id&&e.add(decodeURIComponent(i))}catch{}return t}),(n.attachments??[]).filter(t=>e.has(t.id))},[n.attachments,n.id,n.markdown]);(0,Z.useEffect)(()=>{e&&(m(new Set(ee.map(e=>e.id))),F(null),L(!1),z(null))},[e,ee]);let te=async()=>{j(!0),z(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 ke(n.id,e);F(t.shareUrl),await d.mutate()}else{let t=await Se(n.id,e);F(t.payload.shareUrl),await o()}}catch(e){z(e instanceof Error?e.message:String(e))}finally{j(!1)}},B=async(e,t)=>{N(e.id),z(null);try{t===`refresh`?await he(n.id,e.id,{expectedNoteVersion:n.updatedAt,attachmentIds:[...p]}):await ht(e.id),await d.mutate()}catch(e){z(e instanceof Error?e.message:String(e))}finally{N(null)}},ne=async(e,t)=>{N(e.id),z(null);try{t===`refresh`?await q(n.id,e.id,{expectedNoteVersion:n.updatedAt,attachmentIds:[...p]}):t===`extend`?await pt(e.id,864e5):await dt(e.id),await o()}catch(e){z(e instanceof Error?e.message:String(e))}finally{N(null)}},V=async e=>{z(null);try{if(!await Y(e)){L(!1),z(i.copyFailed);return}L(!0),window.setTimeout(()=>L(!1),1500)}catch{L(!1),z(i.copyFailed)}};return(0,Q.jsx)(C,{open:e,onOpenChange:t,children:(0,Q.jsxs)(b,{children:[(0,Q.jsx)(g,{className:`xopc-dialog-overlay fixed inset-0 z-[70] bg-scrim backdrop-blur-[2px]`}),(0,Q.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,Q.jsxs)(`div`,{className:`flex shrink-0 items-start justify-between border-b border-edge px-5 py-4`,children:[(0,Q.jsxs)(`div`,{children:[(0,Q.jsxs)(S,{className:`flex items-center gap-2 text-base font-semibold text-fg`,children:[(0,Q.jsx)(Be,{className:`size-4`}),i.title]}),(0,Q.jsx)(v,{className:`mt-1 text-xs text-fg-muted`,children:i.description})]}),(0,Q.jsx)(y,{asChild:!0,children:(0,Q.jsx)(`button`,{type:`button`,className:`rounded-md p-1.5 text-fg-muted hover:bg-surface-hover`,"aria-label":i.close,children:(0,Q.jsx)(qe,{className:`size-4`})})})]}),(0,Q.jsxs)(`div`,{className:`min-h-0 flex-1 overflow-y-auto p-5`,children:[(0,Q.jsxs)(`section`,{className:`rounded-lg border border-edge bg-surface-inset p-4`,children:[(0,Q.jsx)(`div`,{className:`text-sm font-semibold text-fg`,children:n.title||i.untitled}),(0,Q.jsx)(`p`,{className:`mt-2 line-clamp-4 whitespace-pre-wrap text-xs leading-5 text-fg-muted`,children:n.markdown||i.empty}),(0,Q.jsx)(`p`,{className:`mt-3 text-xs text-fg-subtle`,children:i.privateExcluded})]}),ee.length>0?(0,Q.jsxs)(`section`,{className:`mt-5`,children:[(0,Q.jsx)(`h3`,{className:`text-sm font-medium text-fg`,children:i.attachments}),(0,Q.jsx)(`div`,{className:`mt-2 grid gap-2`,children:ee.map(e=>(0,Q.jsxs)(`label`,{className:`flex items-center gap-3 rounded-lg border border-edge-subtle px-3 py-2 text-sm text-fg-muted`,children:[(0,Q.jsx)(`input`,{type:`checkbox`,checked: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,Q.jsx)(`span`,{className:`min-w-0 flex-1 truncate`,children:e.fileName}),(0,Q.jsx)(`span`,{className:`text-xs text-fg-subtle`,children:_n(e.size)})]},e.id))})]}):null,(0,Q.jsxs)(`section`,{className:`mt-5 grid gap-4 sm:grid-cols-2`,children:[(0,Q.jsxs)(`label`,{className:`grid gap-1.5 text-xs text-fg-muted sm:col-span-2`,children:[i.delivery,(0,Q.jsxs)(se,{value:O,onChange:e=>k(e.target.value),children:[(0,Q.jsx)(U,{value:`hosted`,children:i.deliveryHosted}),(0,Q.jsx)(U,{value:`local`,children:i.deliveryLocal})]})]}),O===`hosted`&&s.data===!1?(0,Q.jsx)(`div`,{className:`sm:col-span-2`,children:(0,Q.jsx)(St,{providerId:`xopc-share`,displayName:`XOPC Hosted Share`,connected:!1,onConnected:()=>void s.mutate(!0,{revalidate:!1})})}):null,O===`hosted`&&c&&l.data&&!u?(0,Q.jsx)(`p`,{className:`rounded-lg border border-warning/30 bg-warning-soft px-3 py-2 text-xs text-warning sm:col-span-2`,children:i.hostedDisabled}):null,(0,Q.jsxs)(`label`,{className:`grid gap-1.5 text-xs text-fg-muted`,children:[i.expires,(0,Q.jsx)(se,{value:h,onChange:e=>_(e.target.value),children:pn.map(e=>(0,Q.jsx)(U,{value:e.value,children:r?e.zh:e.en},e.value))})]}),(0,Q.jsxs)(`label`,{className:`grid gap-1.5 text-xs text-fg-muted`,children:[i.maxViews,(0,Q.jsx)(`input`,{type:`number`,min:1,max:1e3,value: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,Q.jsxs)(`label`,{className:`grid gap-1.5 text-xs text-fg-muted sm:col-span-2`,children:[i.publicDescription,(0,Q.jsx)(`input`,{value: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,Q.jsx)(`div`,{className:`mt-5 rounded-lg border border-success/25 bg-success-soft p-3`,children:(0,Q.jsxs)(`div`,{className:`flex gap-2`,children:[(0,Q.jsx)(`input`,{readOnly:!0,value:P,className:`min-w-0 flex-1 bg-transparent text-xs text-fg outline-none`}),(0,Q.jsxs)(J,{type:`button`,className:`px-2 py-1 text-xs`,variant:`ghost`,onClick:()=>void V(P),children:[I?(0,Q.jsx)(ae,{className:`size-4`}):(0,Q.jsx)(le,{className:`size-4`}),I?i.copied:i.copy]}),(0,Q.jsxs)(J,{type:`button`,className:`px-2 py-1 text-xs`,variant:`ghost`,onClick:()=>window.open(P,`_blank`,`noopener,noreferrer`),children:[(0,Q.jsx)(fe,{className:`size-4`}),i.open]})]})}):null,R?(0,Q.jsx)(`p`,{className:`mt-4 rounded-lg border border-danger/25 bg-danger-soft px-3 py-2 text-sm text-danger`,children:R}):null,(a?.items.length??0)>0?(0,Q.jsxs)(`section`,{className:`mt-6 border-t border-edge pt-5`,children:[(0,Q.jsx)(`h3`,{className:`text-sm font-medium text-fg`,children:i.activeLinks}),(0,Q.jsx)(`div`,{className:`mt-2 grid gap-2`,children:a.items.map(e=>(0,Q.jsx)(gn,{share:e,busy:M===e.id,t:i,onCopy:V,onAction:ne},e.id))})]}):null,(d.data?.length??0)>0?(0,Q.jsxs)(`section`,{className:`mt-6 border-t border-edge pt-5`,children:[(0,Q.jsx)(`h3`,{className:`text-sm font-medium text-fg`,children:i.hostedLinks}),(0,Q.jsx)(`div`,{className:`mt-2 grid gap-2`,children:d.data.map(e=>(0,Q.jsx)(hn,{publication:e,stale:e.source?.version!==String(n.updatedAt),busy:M===e.id,publishingAllowed:u,t:i,onCopy:V,onAction:B},e.id))})]}):null]}),(0,Q.jsxs)(`div`,{className:`flex shrink-0 items-center justify-end gap-2 border-t border-edge px-5 py-3`,children:[(0,Q.jsx)(y,{asChild:!0,children:(0,Q.jsx)(J,{type:`button`,variant:`ghost`,children:i.close})}),(0,Q.jsxs)(J,{type:`button`,onClick:()=>void te(),disabled:A||O===`hosted`&&(!c||!u),children:[A?(0,Q.jsx)(Ne,{className:`size-4 animate-spin`}):(0,Q.jsx)(Be,{className:`size-4`}),A?i.creating:i.create]})]})]})]})})}function hn(e){let t=(0,Dt.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=Je(`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,Q.jsx)(`span`,{children:f}),t[2]=f,t[3]=p);let m;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(m=(0,Q.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,Q.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,Q.jsx)(`span`,{children:`·`}),t[9]=_):_=t[9];let v;t[10]!==n.revision||t[11]!==o.revision?(v=(0,Q.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,Q.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,Q.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,Q.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,Q.jsx)(Ne,{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,Q.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,Q.jsx)(le,{className:`size-3.5`}),t[30]=E):E=t[30];let D;t[31]!==o.copy||t[32]!==w||t[33]!==T?(D=(0,Q.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,Q.jsx)(fe,{className:`size-3.5`}),t[37]=A):A=t[37];let j;t[38]!==o.open||t[39]!==O||t[40]!==k?(j=(0,Q.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,Q.jsxs)(J,{className:`px-2 py-1 text-xs`,variant:`ghost`,disabled:i||!a,onClick:()=>void c(n,`refresh`),children:[(0,Q.jsx)(Re,{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,Q.jsxs)(J,{className:`px-2 py-1 text-xs`,variant:`ghost`,disabled:i,onClick:()=>void c(n,`revoke`),children:[(0,Q.jsx)(Ge,{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,Q.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,Q.jsxs)(`div`,{className:d,children:[C,P]}),t[60]=C,t[61]=d,t[62]=P,t[63]=F):F=t[63],F}function gn(e){let t=(0,Dt.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=Je(`rounded-lg border border-edge-subtle p-3`,c),t[0]=c,t[1]=l);let u=n.stale&&!s?i.stale:s?i.inactive:i.active,d;t[2]===u?d=t[3]:(d=(0,Q.jsx)(`span`,{children:u}),t[2]=u,t[3]=d);let f;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(f=(0,Q.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,Q.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,Q.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,Q.jsx)(`span`,{children:g}),t[12]=g,t[13]=_);let v;t[14]!==_||t[15]!==d||t[16]!==m?(v=(0,Q.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,Q.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,Q.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,Q.jsx)(Ne,{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,Q.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,Q.jsx)(le,{className:`size-3.5`}),t[31]=w):w=t[31];let T;t[32]!==i.copy||t[33]!==C?(T=(0,Q.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,Q.jsx)(fe,{className:`size-3.5`}),t[37]=D):D=t[37];let O;t[38]!==i.open||t[39]!==E?(O=(0,Q.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,Q.jsxs)(J,{className:`px-2 py-1 text-xs`,variant:`ghost`,disabled:r,onClick:()=>void o(n,`refresh`),children:[(0,Q.jsx)(Re,{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,Q.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,Q.jsxs)(J,{className:`px-2 py-1 text-xs`,variant:`ghost`,disabled:r,onClick:()=>void o(n,`revoke`),children:[(0,Q.jsx)(Ge,{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,Q.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,Q.jsxs)(`div`,{className:l,children:[S,M]}),t[64]=S,t[65]=l,t[66]=M,t[67]=N):N=t[67],N}function _n(e){return e<1024?`${e} B`:e<1048576?`${(e/1024).toFixed(1)} KB`:`${(e/1048576).toFixed(1)} MB`}var vn={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:`撤销`},yn={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`},bn=e(n(),1);function xn({noteId:e,selection:t,zh:n,onDismiss:r,onAsk:i}){let[a,o]=(0,Z.useState)(null),[s,c]=(0,Z.useState)(!1),[l,d]=(0,Z.useState)(``),[f,m]=(0,Z.useState)(!1),h=(0,Z.useRef)(null),g=(0,Z.useRef)(null),[_,v]=(0,Z.useState)({left:8,top:8}),y=s||a!==null||!!l,b=t.text.length>16e3;function x(){h.current?.abort(),r(),t.restore()}(0,Z.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,Z.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(`
|
|
1
|
+
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/block-editor-Bp6TLleA.js","assets/rolldown-runtime-aKtaBQYM.js","assets/vendor-react-BOUWij0V.js","assets/locale-store-Dy0B0XDJ.js","assets/messages-Bj6DCoic.js","assets/unlink-NsCMuCT1.js","assets/createLucideIcon-DPHK1VkS.js","assets/check-DUBLcKHA.js","assets/copy-Dv6d4Dvw.js","assets/external-link-DjqjBmc3.js","assets/notes-api-M1FuRZbW.js","assets/dist-DlirbHVs.js","assets/es2015-CFqg57eW.js","assets/dist-CDSvxjOh.js","assets/download-Dk-ZjtO6.js","assets/markdown-view-ByuzuGRb.js","assets/marked.esm-8VXEA2AD.js","assets/chunk-KS7C4IRE-DIIvxCDx.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-Ji4uewEG.js","assets/product-delivery-4gEqUIsK.js","assets/schemas-CCWMleym.js","assets/copy-to-clipboard-HOJ79TWv.js","assets/xml-_d7dTN2Q.js","assets/mermaid-render-oOellPHt.js","assets/markdown-view-Czi3_WHu.css","assets/chat-chart-block-DxTCx__V.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/undo-2-6IMTwK4M.js","assets/vendor-swr-CdRzEUwF.js","assets/floating-ui.dom-CiMnRY5O.js","assets/linkify-it-BkqEorO0.js","assets/vendor-codemirror-aCQ0FcJT.js","assets/voice-player-store-DT0f9GPa.js","assets/playback-coordinator-CWHIf0wr.js","assets/note-image-lightbox-D20oZuOM.js","assets/block-editor-BFDeQtYs.css","assets/markdown-editor-CjQJ-Nho.js","assets/languages-kF11aUYU.js","assets/chat-page-oy4EGdO1.js","assets/app-window-DXFNqt_0.js","assets/archive-Dz0hferG.js","assets/arrow-left-D880xG-P.js","assets/video-generation-Cec49Jwg.js","assets/arrow-up-D5ZtR1QT.js","assets/product-automation-feedback-BDFpFrSs.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/session-manager-7nbjJYyy.js","assets/turn-outcome-Bf3N3Bmj.js","assets/session-api-vEn4BzjV.js","assets/gateway-startup-retry-Dm0dK8BT.js","assets/local-session-drafts-KkAOxXk5.js","assets/tool-activity-BtJkgjFf.js","assets/attachment-utils-core-BPYdUI6y.js","assets/agent-run-error-parser-DsXmcKt-.js","assets/gateway-realtime-D2B_nv2b.js","assets/gateway-realtime-store-DrVbjYfI.js","assets/registry-api-CaBz9f4g.js","assets/agents-admin-api-BW3Mzst8.js","assets/gateway-config-swr-DxelrRtx.js","assets/button-C5tRaJxt.js","assets/automation-api-B6YcuEsE.js","assets/earth-C9Z4bTTG.js","assets/chevron-down-ccbiQQz_.js","assets/chevron-right-BweFrslA.js","assets/working-directory-picker-modal-DX6bRmkQ.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-hRG1EzAY.js","assets/dist-BSVQC3i_.js","assets/dist-DSRLZhL9.js","assets/floating-ui.react-dom-Gx6CM22l.js","assets/settings-shell-dialog-layer-BU3UuiJr.js","assets/circle-alert-BEjgurr2.js","assets/send-1f1Ntw6E.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-code-corner-byQA1VfD.js","assets/file-text-D12HbeVy.js","assets/file-CStvVK2S.js","assets/folder-kanban-CpLlFI1o.js","assets/folder-open-CyzJ19I9.js","assets/folder-CN-pC3XL.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/link-2-D_ZKYUW7.js","assets/list-checks-BbsExAoq.js","assets/messages-square-BckAJrEW.js","assets/monitor-Af5eAvF7.js","assets/use-generated-media-DX4_ne7C.js","assets/install-connector-dialog-st2O1bez.js","assets/secret-input-DsjfQmDn.js","assets/eye-CABVeTq0.js","assets/is-masked-secret-DOkL5b_X.js","assets/connectors-api-B27sJ651.js","assets/electron-env-DHOGevH3.js","assets/oauth-provider-connect-BPNIEiMv.js","assets/cloud-C4-yfnnk.js","assets/models-hub-cache-DMBOw544.js","assets/oauth-api-Dza1tHcr.js","assets/connection-usage-guide-DNNFESD9.js","assets/connection-usage-BhdQRWgQ.js","assets/paperclip-f1HujQY1.js","assets/pin-off-BMRv-Kxr.js","assets/refresh-cw-BRlGaq2w.js","assets/save-DRDABU--.js","assets/search-DA7gz22f.js","assets/settings-2-D-csvaET.js","assets/settings-uiTATseT.js","assets/share-2-CnIB9PsV.js","assets/shield-check-BU58siTV.js","assets/smartphone-DSSsQFqA.js","assets/square-DMK_fB-3.js","assets/preview-runtime-DUJ7XhMP.js","assets/use-async-resource-BHFGZCY2.js","assets/workspace-api-CD_6YyPI.js","assets/files-GdwDamkp.js","assets/index.module-Cd9ENXfk.js","assets/trash-2-DusmjVPV.js","assets/user-round-C9jxPhMR.js","assets/wifi-off-C35sMFUl.js","assets/share-link-dialog-WR7Op1vL.js","assets/copy-text-row-gqdh0Bg1.js","assets/wrench-DFb4r8bH.js","assets/tasks-D8bnpu0N.js","assets/specialists-xbB3xL9e.js","assets/api-Cd5TqEwc.js","assets/session-identity-DRFdxntH.js","assets/new-session-preferences-CxCn2Jxk.js","assets/composer-model-config-control-Bas1wFVW.js","assets/model-selector-8FTrQQ2N.js","assets/open-capability-settings-DQsmJxI7.js","assets/model-sort-_Tz8s_4N.js","assets/cloud-credits-B-nbtkqv.js","assets/space-api-E8VbAaEl.js","assets/home-task-actions-Ck0AhcYe.js","assets/capabilities-G2ZaAAs2.js","assets/capabilities-B5gHYD8r.js","assets/right-workspace-store-DsVm6C0V.js","assets/phone-workspace-store-CcA_vo-t.js","assets/workspace-editor-agent-store-BuYdf4CO.js","assets/chat-agents-api-DRKlkcuv.js","assets/middleware-Pd0e8Igk.js","assets/task-copy-CtcqCQ78.js","assets/chunk-D32TOXHM-DQIy-Baq.js","assets/tool-friendly-title-CJVFJ2Ud.js","assets/use-realtime-voice-D9k997EW.js","assets/voice-CUfqdnlR.js","assets/composer-notifications-CpBgWAE4.js","assets/activity-store-DyHjQrpP.js","assets/voice-call-context-BM2A4bLz.js","assets/app-chrome-BeB4KgOf.js","assets/page-header-store-BXED3zhV.js","assets/new-chat-navigation-spnin196.js","assets/loopi-CNtmi9FU.js","assets/loopi-C09I2mNj.css","assets/extension-provider-CFPicsnW.js","assets/theme-store-XNsFzxSj.js","assets/extension-message-router-QjbtEYyu.js","assets/agent-avatar-display-Dyyk4GdM.js","assets/skill-wire-pattern-BPpeIcCi.js","assets/composer-handoff-params-DBpzHuNo.js","assets/agent-display-names-Bje7vfSn.js","assets/use-directory-picker-C4p7AgWY.js","assets/confirm-dialog-yhRKgG72.js","assets/shares-api-CoRLwDnw.js","assets/dist-DaFr5KMw.js","assets/use-composer-attachments-CQwCTKAp.js","assets/chevron-left-DqFhpbvK.js","assets/use-file-preview-expanded-CA9vFUTT.js","assets/message-square-plus-XP0tGdlV.js","assets/minimize-2-DtOGrlpo.js","assets/constants-D5Z-mUto.js","assets/sliding-tab-list-CmcrqRzN.js","assets/sliding-indicator-hwz0sx3h.js","assets/use-share-link-CqV3o-VZ.js","assets/file-preview-surface-Da1xZiG6.js","assets/command-palette-api-CAKoTF_-.js","assets/skill-list-api-Dsfjdtuu.js","assets/skill-api-utils-C7V4JVXM.js","assets/composer-payload-handoff-uT_hvvap.js","assets/voice-input-shortcut-events-CwKpIInD.js","assets/automation-task-card-BBEA23Zb.js","assets/automation-display-DaVDNZz8.js","assets/message-circle-Badhj-4D.js","assets/date-picker-D3N2BGVY.js","assets/calendar-days-hw_Y-g-s.js","assets/time-picker-otHjbob1.js","assets/dev-view-store-D4EyUkRI.js","assets/extension-iframe-host-DpgIPfJe.js","assets/extension-authoritative-grants-qpYvHriJ.js","assets/runtime-health-zDkHcOZO.js","assets/api-DVQaJzrB.js","assets/terminal-panel-store-BOHv5O2x.js","assets/agents-app-path-ciChvpCS.js","assets/use-media-query-ady-FgjK.js","assets/oauth-authorization-window-o6URRos4.js","assets/page-context-draft-CHAS3BY3.js","assets/management-api-BtTRehT0.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{d as o,f as s,t as c}from"./chunk-KS7C4IRE-DIIvxCDx.js";import{f as l,i as u,l as d,n as f,o as p,p as m}from"./locale-store-Dy0B0XDJ.js";import{t as h}from"./messages-Bj6DCoic.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-DlirbHVs.js";import{t as w}from"./arrow-down-to-line-C5D8Vt-L.js";import{t as T}from"./arrow-left-D880xG-P.js";import{i as E,n as D,r as O,t as k}from"./product-automation-feedback-BDFpFrSs.js";import{A,D as j,L as M,R as N,S as P,T as F,a as I,c as L,h as R,i as z,j as ee,l as te,n as B,o as ne,r as V,t as re,w as H,x as ie}from"./recording-upload-DrgujKBt.js";import{t as ae}from"./check-DUBLcKHA.js";import{t as oe}from"./chevron-down-ccbiQQz_.js";import{n as se,r as U}from"./popover-select-hRG1EzAY.js";import{t as ce}from"./code-xml-DJtYhZUF.js";import{t as le}from"./copy-Dv6d4Dvw.js";import{t as ue}from"./download-Dk-ZjtO6.js";import{t as de}from"./ellipsis-0k4rZLoy.js";import{t as fe}from"./external-link-DjqjBmc3.js";import{t as W}from"./eye-CABVeTq0.js";import{t as pe}from"./file-text-D12HbeVy.js";import{t as me}from"./history-DXH_9jsE.js";import{C as he,E as ge,F as _e,I as ve,O as ye,S as G,T as be,_ as xe,a as Se,c as Ce,d as we,f as Te,h as Ee,l as K,m as De,n as Oe,r as ke,s as Ae,u as je,w as q,x as Me}from"./notes-api-M1FuRZbW.js";import{t as Ne}from"./loader-circle-CifKLtgG.js";import{P as Pe}from"./markdown-view-ByuzuGRb.js";import{t as Fe}from"./message-circle-Badhj-4D.js";import{t as Ie}from"./pencil-DmIY3Oa-.js";import{t as Le}from"./play-kxZvpBg8.js";import{t as Re}from"./refresh-cw-BRlGaq2w.js";import{t as ze}from"./search-DA7gz22f.js";import{t as Be}from"./share-2-CnIB9PsV.js";import{t as Ve}from"./sliders-horizontal-DqsYor6I.js";import{t as He}from"./sparkles-DHlfQFAF.js";import{t as Ue}from"./square-pen-B8FsvqNu.js";import{t as We}from"./square-DMK_fB-3.js";import{t as Ge}from"./trash-2-DusmjVPV.js";import{t as Ke}from"./upload-rrb46c3c.js";import{t as qe}from"./x-B_N4OPjy.js";import{t as Je}from"./cn-0WouolD0.js";import{t as Ye}from"./skeleton-DzdOeGYz.js";import{a as Xe,o as Ze,s as Qe,t as $e}from"./session-manager-7nbjJYyy.js";import{i as et}from"./vendor-swr-CdRzEUwF.js";import{o as tt,s as nt,t as rt}from"./playback-coordinator-CWHIf0wr.js";import{t as J}from"./button-C5tRaJxt.js";import{a as it,i as at,o as ot,s as st}from"./dist-BSVQC3i_.js";import{t as Y}from"./copy-to-clipboard-HOJ79TWv.js";import{r as ct}from"./app-chrome-BeB4KgOf.js";import{i as lt}from"./theme-store-XNsFzxSj.js";import{t as X}from"./page-header-store-BXED3zhV.js";import{t as ut}from"./confirm-dialog-yhRKgG72.js";import{b as dt,d as ft,o as pt,s as mt,v as ht}from"./shares-api-CoRLwDnw.js";import{l as gt,m as _t,o as vt,r as yt,t as bt,u as xt}from"./dist-DaFr5KMw.js";import{t as St}from"./oauth-provider-connect-BPNIEiMv.js";import{n as Ct,t as wt}from"./page-context-draft-CHAS3BY3.js";import"./note-image-lightbox-D20oZuOM.js";import{t as Tt}from"./page-context-capture-button-DpGnxSrD.js";var Z=e(t(),1),Q=i();function Et({projectId:e,compact:t=!1}){let n=f(e=>e.language)===`zh`,r=s(),i=(0,Z.useRef)(null),a=(0,Z.useRef)(null),o=(0,Z.useRef)(null),c=(0,Z.useRef)(!1),[l,u]=(0,Z.useState)(null),[d,p]=(0,Z.useState)(!1),[m,h]=(0,Z.useState)(null),[_,w]=(0,Z.useState)(null);async function T(e){let t=o.current;if(!(!t||c.current)){c.current=!0,u(0),p(!1),h(null);try{e!==void 0&&await ie(e);let n=await H();if(n.consentAcknowledgedAt==null){w(n.consentPolicyVersion);return}w(null),t.draft??=await re(t.file,t.requestId);let i=await P({clientRequestId:t.requestId,contextProjectId:t.projectId,source:`web`,consentPolicyVersion:n.consentPolicyVersion,recordedAt:t.draft.startedAt}),a={...t.draft,serverDiscussionId:i.discussion.id,projectId:t.projectId};await R(a),await B(a,i.discussion.id,u,!0,e=>p(e===`verifying`)),await te(t.requestId),o.current=null,r(`/notes/${encodeURIComponent(i.note.id)}`)}catch(e){h(e instanceof Error&&e.message===`Unsupported audio format`?n?`请选择 MP3、M4A、WAV、OGG 或 WebM 音频。`:`Choose an MP3, M4A, WAV, OGG, or WebM file.`:n?`上传未完成,请重试。`:`Upload incomplete. Try again.`)}finally{c.current=!1,u(null),p(!1)}}}let E=n?`上传音频`:`Upload audio`,D=d?n?`正在确认音频`:`Verifying audio`:l===null?E:n?`上传中 ${l}%`:`Uploading ${l}%`;return(0,Q.jsxs)(`div`,{className:t?`relative inline-flex`:`flex min-w-0 flex-col`,children:[(0,Q.jsx)(`input`,{ref:i,hidden:!0,type:`file`,accept:`audio/mpeg,audio/mp4,audio/wav,audio/x-wav,audio/ogg,audio/webm,.mp3,.m4a,.wav,.ogg,.webm`,onChange:t=>{let r=t.target.files?.[0];if(t.target.value=``,r){if(!r.size||r.size>1073741824){o.current=null,h(n?`请选择小于或等于 1 GiB 的非空音频。`:`Choose a non-empty audio file up to 1 GiB.`);return}o.current={file:r,requestId:crypto.randomUUID(),projectId:e},T()}}}),(0,Q.jsxs)(`button`,{ref:a,type:`button`,"aria-label":D,title:E,disabled:l!==null,className:`inline-flex items-center gap-3 text-left hover:bg-surface-hover focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent disabled:opacity-60 ${t?`size-11 shrink-0 justify-center rounded-lg text-fg-muted`:`min-h-20 flex-1 rounded-xl border border-edge bg-surface-panel p-4 text-sm font-semibold text-fg`}`,onClick:()=>i.current?.click(),children:[l===null?(0,Q.jsx)(Ke,{className:t?`size-4`:`size-5 shrink-0 text-fg-muted`,"aria-hidden":!0}):(0,Q.jsx)(Ne,{className:`size-4 shrink-0 animate-spin`,"aria-hidden":!0}),t?(0,Q.jsx)(`span`,{className:`sr-only`,role:`status`,children:D}):(0,Q.jsx)(`span`,{role:`status`,children:D})]}),m?(0,Q.jsxs)(`div`,{className:`rounded-lg border border-edge bg-surface-panel p-2 text-xs text-danger ${t?`absolute right-0 top-full z-20 w-56 shadow-popover`:`mt-2`}`,children:[(0,Q.jsx)(`span`,{role:`alert`,children:m}),o.current?(0,Q.jsx)(J,{variant:`ghost`,onClick:()=>void T(),children:n?`重试`:`Retry`}):null]}):null,(0,Q.jsx)(C,{open:_!==null,onOpenChange:e=>{!e&&!c.current&&w(null)},children:(0,Q.jsxs)(b,{children:[(0,Q.jsx)(g,{className:`xopc-dialog-overlay fixed inset-0 z-[90] bg-scrim`}),(0,Q.jsxs)(x,{onCloseAutoFocus:e=>{e.preventDefault(),a.current?.focus()},className:`xopc-dialog-content fixed left-1/2 top-1/2 z-[91] w-[min(24rem,calc(100vw-2rem))] -translate-x-1/2 -translate-y-1/2 rounded-xl border border-edge bg-surface-overlay p-5 text-fg shadow-popover`,children:[(0,Q.jsx)(S,{className:`font-semibold`,children:E}),(0,Q.jsx)(v,{className:`mt-2 text-sm text-fg-muted`,children:n?`请确认你有权上传此录音,并允许语音服务转写。`:`Confirm you have permission to upload and transcribe this recording.`}),m?(0,Q.jsx)(`p`,{role:`alert`,className:`mt-2 text-xs text-danger`,children:m}):null,(0,Q.jsxs)(`div`,{className:`mt-4 flex justify-end gap-2`,children:[(0,Q.jsx)(y,{asChild:!0,children:(0,Q.jsx)(J,{disabled:l!==null,children:n?`取消`:`Cancel`})}),(0,Q.jsx)(J,{variant:`primary`,disabled:l!==null,onClick:()=>{_!==null&&T(_)},children:n?`确认上传`:`Confirm upload`})]})]})]})})]})}var Dt=r(),Ot=6e4,kt=36e5,$=864e5;function At(e){let t=new Date(e);return t.setHours(0,0,0,0),t.getTime()}function jt(e,t,n){let r=t-e;if(r<Ot)return n.justNow;if(r<kt){let e=Math.floor(r/Ot);return n.minutesAgo.replace(`{{n}}`,String(e))}let i=At(t);if(e>=i)return n.today+` `+new Date(e).toLocaleTimeString(n.locale,{hour:`2-digit`,minute:`2-digit`});if(e>=i-$)return n.yesterday+` `+new Date(e).toLocaleTimeString(n.locale,{hour:`2-digit`,minute:`2-digit`});if(r<7*$){let e=Math.floor(r/$);return n.daysAgo.replace(`{{n}}`,String(e))}return new Date(e).toLocaleDateString(n.locale,{month:`short`,day:`numeric`})}function Mt(e,t,n){let r=At(t);if(e>=r)return n.today;if(e>=r-$)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 Nt(e){let t=new Date(e);return`${t.getFullYear()}-${String(t.getMonth()+1).padStart(2,`0`)}-${String(t.getDate()).padStart(2,`0`)}`}var Pt=`z-[140] min-w-44 rounded-lg border border-edge bg-surface-overlay p-1 text-sm text-fg shadow-popover`,Ft=`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 It(e){let t=(0,Dt.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,Q.jsxs)(Q.Fragment,{children:[(0,Q.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,Q.jsx)(Fe,{className:`size-4`,"aria-hidden":!0}),r?`问这段录音`:`Ask recording`]}),(0,Q.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,Q.jsx)(Be,{className:`size-4`,"aria-hidden":!0}),(0,Q.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,Q.jsx)(ue,{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,Q.jsx)(`span`,{className:`hidden sm:inline`,children:h}),t[5]=h,t[6]=g);let _;t[7]!==p||t[8]!==g?(_=(0,Q.jsx)(_t,{asChild:!0,children:(0,Q.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,Q.jsx)(yt,{asChild:!0,children:(0,Q.jsx)(`a`,{className:Ft,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,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(xt,{className:`my-1 h-px bg-edge-subtle`}),(0,Q.jsx)(yt,{asChild:!0,children:(0,Q.jsxs)(`a`,{className:Ft,href:u(`${l}/audio`),download:!0,children:[(0,Q.jsx)(ue,{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,Q.jsx)(vt,{children:(0,Q.jsxs)(bt,{align:`end`,sideOffset:6,collisionPadding:12,className:Pt,children:[y,b]})}),t[18]=y,t[19]=b,t[20]=x):x=t[20];let S;t[21]!==x||t[22]!==_?(S=(0,Q.jsxs)(gt,{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,Q.jsx)(de,{className:`size-5`,"aria-hidden":!0}),t[24]=w):w=t[24];let T;t[25]===C?T=t[26]:(T=(0,Q.jsx)(_t,{asChild:!0,children:(0,Q.jsx)(`button`,{type:`button`,"data-note-actions-trigger":!0,"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,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsxs)(yt,{className:Ft,disabled:c.busy,onSelect:c.onAnalyze,children:[(0,Q.jsx)(He,{className:`size-4`,"aria-hidden":!0}),r?`进一步分析`:`Analyze this note`]}),c.onOutline?(0,Q.jsxs)(yt,{className:Ft,onSelect:c.onOutline,children:[(0,Q.jsx)(M,{className:`size-4`,"aria-hidden":!0}),r?`文档大纲`:`Document outline`]}):null,(0,Q.jsxs)(yt,{className:Ft,onSelect:c.onHistory,children:[(0,Q.jsx)(me,{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`,N=i||a||s||!o||o.length>16e3,P;t[35]!==k||t[36]!==A||t[37]!==j||t[38]!==N?(P=(0,Q.jsx)(`div`,{children:(0,Q.jsx)(Tt,{presentation:`menu`,resource:k,selection:A,label:j,disabled:N})}),t[35]=k,t[36]=A,t[37]=j,t[38]=N,t[39]=P):P=t[39];let F;t[40]!==c||t[41]!==r?(F=c?(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(xt,{className:`my-1 h-px bg-edge-subtle`}),(0,Q.jsxs)(yt,{className:`${Ft} text-danger`,disabled:c.busy,onSelect:c.onDelete,children:[(0,Q.jsx)(Ge,{className:`size-4`,"aria-hidden":!0}),r?`删除笔记`:`Delete note`]})]}):null,t[40]=c,t[41]=r,t[42]=F):F=t[42];let I;t[43]!==E||t[44]!==P||t[45]!==F?(I=(0,Q.jsx)(vt,{children:(0,Q.jsxs)(bt,{align:`end`,sideOffset:6,collisionPadding:12,className:Pt,children:[E,P,F]})}),t[43]=E,t[44]=P,t[45]=F,t[46]=I):I=t[46];let L;t[47]!==T||t[48]!==I?(L=(0,Q.jsxs)(gt,{children:[T,I]}),t[47]=T,t[48]=I,t[49]=L):L=t[49];let R;return t[50]!==f||t[51]!==S||t[52]!==L?(R=(0,Q.jsxs)(`div`,{className:`flex flex-wrap items-center gap-1`,children:[f,S,L]}),t[50]=f,t[51]=S,t[52]=L,t[53]=R):R=t[53],R}function Lt(e){let t=(0,Dt.c)(68),{detail:n,template:r,onTemplate:i,zh:a,busy:o,processing:s,onOrganize:c,onRegenerate:l}=e,[u,d]=(0,Z.useState)(!1),f=!!n.discussion.audioAttachmentId&&!n.discussion.audioDeletedAt,p;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(p=(0,Q.jsx)(Ve,{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,Q.jsx)(_,{asChild:!0,children:(0,Q.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,Q.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,Q.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,Q.jsx)(qe,{className:`size-4`}),t[6]=O):O=t[6];let k;t[7]===D?k=t[8]:(k=(0,Q.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,Q.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,Q.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,Q.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,Q.jsx)(U,{value:`general`,children:L}),t[18]=L,t[19]=R);let z=a?`项目例会`:`Project`,ee;t[20]===z?ee=t[21]:(ee=(0,Q.jsx)(U,{value:`project`,children:z}),t[20]=z,t[21]=ee);let te=a?`需求评审`:`Review`,B;t[22]===te?B=t[23]:(B=(0,Q.jsx)(U,{value:`review`,children:te}),t[22]=te,t[23]=B);let ne=a?`客户访谈`:`Interview`,V;t[24]===ne?V=t[25]:(V=(0,Q.jsx)(U,{value:`interview`,children:ne}),t[24]=ne,t[25]=V);let re;t[26]!==F||t[27]!==I||t[28]!==R||t[29]!==ee||t[30]!==B||t[31]!==V||t[32]!==r?(re=(0,Q.jsxs)(se,{value:r,"aria-label":F,onChange:I,children:[R,ee,B,V]}),t[26]=F,t[27]=I,t[28]=R,t[29]=ee,t[30]=B,t[31]=V,t[32]=r,t[33]=re):re=t[33];let H;t[34]!==P||t[35]!==re?(H=(0,Q.jsxs)(`label`,{className:`block space-y-2 text-sm`,children:[P,re]}),t[34]=P,t[35]=re,t[36]=H):H=t[36];let ie;t[37]!==f||t[38]!==o||t[39]!==n.discussion.status||t[40]!==l||t[41]!==s||t[42]!==a?(ie=f&&[`completed`,`needs_attention`].includes(n.discussion.status)?(0,Q.jsxs)(`details`,{className:`border-t border-edge-subtle pt-3`,children:[(0,Q.jsx)(`summary`,{className:`min-h-11 cursor-pointer text-sm text-fg-muted`,children:a?`高级选项:重新识别录音`:`Advanced: transcribe again`}),(0,Q.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,Q.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]=ie):ie=t[43];let ae;t[44]!==M||t[45]!==H||t[46]!==ie?(ae=(0,Q.jsxs)(`div`,{className:`min-h-0 flex-1 space-y-5 overflow-y-auto p-5`,children:[M,H,ie]}),t[44]=M,t[45]=H,t[46]=ie,t[47]=ae):ae=t[47];let oe=a?`取消`:`Cancel`,ce;t[48]===oe?ce=t[49]:(ce=(0,Q.jsx)(y,{asChild:!0,children:(0,Q.jsx)(J,{children:oe})}),t[48]=oe,t[49]=ce);let le=o||s||!n.discussion.canonicalTranscript,ue;t[50]===c?ue=t[51]:(ue=()=>{d(!1),c()},t[50]=c,t[51]=ue);let de;t[52]===Symbol.for(`react.memo_cache_sentinel`)?(de=(0,Q.jsx)(Re,{className:`size-4`,"aria-hidden":!0}),t[52]=de):de=t[52];let fe=a?`重新整理纪要`:`Regenerate summary`,W;t[53]!==le||t[54]!==ue||t[55]!==fe?(W=(0,Q.jsxs)(J,{variant:`primary`,disabled:le,onClick:ue,children:[de,fe]}),t[53]=le,t[54]=ue,t[55]=fe,t[56]=W):W=t[56];let pe;t[57]!==ce||t[58]!==W?(pe=(0,Q.jsxs)(`footer`,{className:`flex shrink-0 justify-end gap-2 border-t border-edge-subtle p-4`,children:[ce,W]}),t[57]=ce,t[58]=W,t[59]=pe):pe=t[59];let me;t[60]!==A||t[61]!==ae||t[62]!==pe?(me=(0,Q.jsxs)(b,{children:[w,(0,Q.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,ae,pe]})]}),t[60]=A,t[61]=ae,t[62]=pe,t[63]=me):me=t[63];let he;return t[64]!==u||t[65]!==h||t[66]!==me?(he=(0,Q.jsxs)(C,{open:u,onOpenChange:d,children:[h,me]}),t[64]=u,t[65]=h,t[66]=me,t[67]=he):he=t[67],he}function Rt(e){return JSON.stringify([e.transcript.revision,e.transcript.segments.map(e=>[e.sequence,e.revision,e.status]),e.organization?.revision])}function zt(e,t,n,r){let i=(0,Dt.c)(27),a=r!==void 0&&r,[o,s]=(0,Z.useState)(),c;i[0]!==n||i[1]!==a||i[2]!==t||i[3]!==e||i[4]!==o?(c=()=>{!a&&t&&(o?.noteId!==e||o.version!==Rt(t))&&(o?.noteId===e&&n(),s({noteId:e,version:Rt(t),value:t}))},i[0]=n,i[1]=a,i[2]=t,i[3]=e,i[4]=o,i[5]=c):c=i[5];let l=o?.noteId,u=o?.version,d;i[6]!==n||i[7]!==a||i[8]!==t||i[9]!==e||i[10]!==l||i[11]!==u?(d=[e,t,l,u,n,a],i[6]=n,i[7]=a,i[8]=t,i[9]=e,i[10]=l,i[11]=u,i[12]=d):d=i[12],(0,Z.useLayoutEffect)(c,d);let f;i[13]!==n||i[14]!==t||i[15]!==e?(f=r=>{let i=r===void 0?t:r;i&&(n(),s({noteId:e,version:Rt(i),value:i}))},i[13]=n,i[14]=t,i[15]=e,i[16]=f):f=i[16];let p=f,m=o?.noteId===e?o:void 0,h;i[17]!==m||i[18]!==t?(h=!!t&&!!m&&m.version!==Rt(t),i[17]=m,i[18]=t,i[19]=h):h=i[19];let g=h,_;i[20]!==m||i[21]!==t?(_=t&&m?{...t,transcript:m.value.transcript,organization:m.value.organization}:t,i[20]=m,i[21]=t,i[22]=_):_=i[22];let v=_,y;return i[23]!==v||i[24]!==g||i[25]!==p?(y={detail:v,hasUpdates:g,publish:p},i[23]=v,i[24]=g,i[25]=p,i[26]=y):y=i[26],y}function Bt(e){let t=(0,Z.useRef)(null),n=(0,Z.useCallback)(()=>{let n=e.current;if(!n||t.current)return;let r=n.getBoundingClientRect().top;t.current={scrollTop:n.scrollTop,anchors:n.scrollTop<=0?[]:Array.from(n.querySelectorAll(`[data-reading-anchor]`)).filter(e=>e.getBoundingClientRect().bottom>r).map(e=>({key:e.dataset.readingAnchor,top:e.getBoundingClientRect().top-r}))}},[e]);return(0,Z.useLayoutEffect)(()=>{let n=t.current,r=e.current;if(t.current=null,!n||!r)return;let i=new Map(Array.from(r.querySelectorAll(`[data-reading-anchor]`)).map(e=>[e.dataset.readingAnchor,e])),a=n.anchors.find(e=>i.has(e.key));r.scrollTop=a?r.scrollTop+i.get(a.key).getBoundingClientRect().top-r.getBoundingClientRect().top-a.top:n.scrollTop}),n}var Vt=e=>`${Math.floor(e/6e4)}:${String(Math.floor(e/1e3)%60).padStart(2,`0`)}`;function Ht({id:e,query:t,zh:n,refreshKey:r,sourceKey:i,active:a,tab:o,onEvidence:s,onPlay:c}){let[l,d]=(0,Z.useState)(),f=(0,Z.useRef)(null),m=Bt(f),h=(0,Z.useRef)(null),g=(0,Z.useRef)(!1),[_,v]=(0,Z.useState)(!0),[y,b]=(0,Z.useState)(``),[x,S]=(0,Z.useState)(!1),C=(0,Z.useRef)(0),[w,T]=(0,Z.useState)(),[E,D]=(0,Z.useState)(),[O,k]=(0,Z.useState)(``),[A,j]=(0,Z.useState)(0),M=JSON.stringify([e,i,t]),N=t?``:r;(0,Z.useEffect)(()=>{if(!a||t)return;let e=window.setInterval(()=>j(e=>e+1),3e3);return()=>window.clearInterval(e)},[a,t]),(0,Z.useEffect)(()=>{D(void 0)},[e,t]),(0,Z.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(async a=>{if(C.current!==n)return;let o=h.current;if(!i&&o?.key===M){if(o.value.version===a.version)return;let i=o.value.hits.length;for(;a.hasMore&&a.hits.length<i;){let i=await p(u(`/api/discussions/${encodeURIComponent(e)}/review?q=${encodeURIComponent(t)}&offset=${a.hits.length}&version=${encodeURIComponent(a.version)}`),{signal:r.signal});if(C.current!==n)return;if(i.version!==a.version||!i.hits.length)throw Error(`Review changed during refresh`);a={...i,offset:0,hits:[...a.hits,...i.hits]}}m()}h.current={key:M,value:a},d(a),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,m]);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,Q.jsxs)(`article`,{"data-reading-anchor":`review:${e.id}`,className:`space-y-2 rounded-xl bg-surface-inset p-4`,children:[(0,Q.jsxs)(`button`,{className:`text-left text-sm text-accent-fg`,onClick:()=>I(e),children:[e.startedAtMs===void 0?``:`${Vt(e.startedAtMs)}${e.endedAtMs===void 0?``:`–${Vt(e.endedAtMs)}`} · `,e.title||L(e)]}),(0,Q.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,Q.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,Q.jsxs)(`p`,{className:`text-xs text-fg-muted`,children:[Vt(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,Q.jsxs)(J,{onClick:()=>c(e.startedAtMs,e.endedAtMs),children:[n?`回听上下文`:`Play context`,` `,Vt(e.startedAtMs),`–`,Vt(e.endedAtMs)]},t)),e.segments.length?(0,Q.jsx)(J,{onClick:()=>I(e),children:n?`查看对应原文`:`View transcript`}):(0,Q.jsx)(`p`,{className:`text-xs text-fg-muted`,children:n?`暂无可核实的原文定位`:`No verified transcript reference`})]},e.id);return(0,Q.jsxs)(`section`,{ref:e=>{f.current=e?.closest(`main`)??e},"aria-label":n?`长录音回顾`:`Recording review`,className:`flex flex-col gap-3`,children:[y?(0,Q.jsxs)(`div`,{children:[(0,Q.jsx)(`p`,{role:`alert`,className:`text-sm text-danger`,children:y}),(0,Q.jsx)(J,{onClick:P,children:n?`刷新结果`:`Refresh results`})]}):null,_&&(!l||w!==M||O!==t)?(0,Q.jsx)(Ye,{className:`h-20 w-full`}):null,l&&w===M&&(!t||O===t)?(0,Q.jsxs)(Q.Fragment,{children:[t?(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(`h3`,{className:`text-sm font-medium`,children:n?`搜索结果 · ${l.total}`:`Search results · ${l.total}`}),(0,Q.jsx)(J,{onClick:P,children:n?`刷新结果`:`Refresh results`}),(0,Q.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,Q.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":`${Vt(e.startedAtMs)} ${e.title||L(e)}`,onClick:()=>I(e)},e.id))}),l.total?null:(0,Q.jsx)(`p`,{className:`text-sm text-fg-muted`,children:n?`未找到关键词;尚未转写的内容无法搜索。`:`No matches. Untranscribed audio is not searchable yet.`}),l.hits.map(R)]}):(0,Q.jsxs)(Q.Fragment,{children:[o===`summary`&&l.chapters.length?(0,Q.jsxs)(`details`,{className:`rounded-xl bg-surface-inset px-4`,children:[(0,Q.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,Q.jsx)(`div`,{className:`space-y-3 pb-4`,children:l.chapters.map(R)})]}):null,l.hits.length?(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(`h3`,{className:`text-sm font-medium`,children:n?`本轮已完成转写(阶段性)`:`Available transcription from this run`}),l.hits.map(R)]}):null]}),l.hasMore?(0,Q.jsx)(J,{disabled:x,onClick:()=>void F(),children:n?`加载更多结果`:`More results`}):null,(0,Q.jsxs)(`details`,{className:`rounded-lg text-xs text-fg-muted`,children:[(0,Q.jsx)(`summary`,{className:`min-h-11 cursor-pointer py-3 focus-visible:ring-2 focus-visible:ring-accent`,children:n?`处理范围`:`Processing coverage`}),(0,Q.jsxs)(`div`,{role:`status`,className:`space-y-2 pb-3 leading-5`,children:[(0,Q.jsxs)(`p`,{children:[n?`原音`:`Audio`,` · `,l.coverage.audioAvailable?n?`已保存,可回听`:`Saved, ready to play`:n?`尚不可用`:`Unavailable`]}),(0,Q.jsxs)(`p`,{children:[n?`本轮转写已处理`:`Processed this run`,` `,Vt(l.coverage.processedMs),` / `,Vt(l.coverage.durationMs),` · `,n?`连续处理至`:`Continuous through`,` `,Vt(l.coverage.continuousThroughMs)]}),(0,Q.jsxs)(`p`,{children:[n?`分析覆盖`:`Analysis coverage`,` · `,l.coverage.analysisRanges.length?l.coverage.analysisRanges.map(e=>`${Vt(e.startedAtMs)}–${Vt(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,Q.jsx)(`p`,{className:`text-xs text-fg-muted`,children:n?`以上是本轮已保存的阶段性原文;正式发布后才能校对和标记具体段落。`:`Saved partial text; segment editing and highlighting become available after publication.`}):null]}):null]})}function Ut({recordingId:e,discussionId:t,zh:n,onEvidence:r,onPlay:i}){let{data:a=[],mutate:o}=et(`/api/discussions/${t}/annotations`,e=>p(u(e))),[s,c]=(0,Z.useState)([]),[l,d]=(0,Z.useState)(null),[f,m]=(0,Z.useState)(null),[h,g]=(0,Z.useState)(``),_=(0,Z.useCallback)(async()=>{c(await I(e))},[e]),v=(0,Z.useCallback)(async()=>{try{await V(e,t),await _(),await o()}catch(e){await o(),g(e instanceof Error?e.message:String(e))}},[e,t,_,o]);(0,Z.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 L(e,{...t,updatedAt:Date.now()},n),m(null),g(``),await _(),v()}catch(e){g(e instanceof Error?e.message:String(e))}};return(0,Q.jsxs)(`section`,{className:`space-y-4`,"aria-label":n?`我的标记`:`My highlights`,children:[h?(0,Q.jsxs)(`p`,{role:`alert`,className:`text-sm text-danger`,children:[h,(0,Q.jsx)(J,{onClick:()=>void v(),children:n?`重试同步`:`Retry sync`})]}):null,y.size?null:(0,Q.jsx)(`p`,{className:`text-sm text-fg-muted`,children:n?`暂无标记`:`No highlights yet`}),[...y.values()].sort((e,t)=>e.annotation.anchor.capturedAt-t.annotation.anchor.capturedAt).filter(e=>!e.annotation.deleted||e.localState===`conflict`).map(e=>(0,Q.jsxs)(`article`,{className:`space-y-2 rounded-lg border border-edge p-3`,children:[(0,Q.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,Q.jsx)(`blockquote`,{className:`text-sm`,children:e.text},e.sequence)),e.positionMs===void 0?null:(0,Q.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,Q.jsxs)(`p`,{className:`whitespace-pre-wrap text-sm`,children:[n?`我的说明:`:`My context: `,e.annotation.text]}):null,(0,Q.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[(0,Q.jsx)(J,{disabled:!e.evidence,onClick:()=>e.evidence&&r(e.evidence),children:n?`查看原文`:`View transcript`}),e.playback.map((e,t)=>(0,Q.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,Q.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,Q.jsx)(J,{onClick:()=>void b({...e.annotation,deleted:!0}),children:n?`移除标记`:`Remove`})]}),e.state===`located`&&!e.evidence?(0,Q.jsx)(`p`,{className:`text-xs text-fg-muted`,children:n?`该位置原文尚未生成,可先回听原音。`:`Transcript for this position is pending; audio is usable.`}):null,e.state===`unavailable`?(0,Q.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,Q.jsx)(`p`,{className:`text-xs text-fg-muted`,children:n?`等待原音/原文完成定位`:`Awaiting audio/transcript positioning`}):null,e.localState===`conflict`?(0,Q.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&&z(t,n.annotation).then(_)},children:n?`使用服务端版本`:`Use server version`}):null]},e.annotation.id)),f?(0,Q.jsxs)(`div`,{role:`dialog`,"aria-label":n?`编辑标记`:`Edit highlight`,className:`rounded-lg border border-edge p-3`,children:[(0,Q.jsxs)(se,{value:f.kind,"aria-label":n?`标记类型`:`Highlight type`,onChange:e=>m({...f,kind:e.target.value}),children:[(0,Q.jsx)(U,{value:`highlight`,children:n?`重点`:`Highlight`}),(0,Q.jsx)(U,{value:`question`,children:n?`问题`:`Question`}),(0,Q.jsx)(U,{value:`note`,children:n?`补充`:`Context`})]}),(0,Q.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,Q.jsx)(J,{onClick:()=>void b(f,l),children:n?`保存到本机并同步`:`Save locally and sync`}),(0,Q.jsx)(J,{onClick:()=>m(null),children:n?`取消`:`Cancel`})]}):null]})}var Wt={tab:`summary`,query:``,page:1,positionMs:0},Gt=m((e,t)=>({notes:{},update:(n,r)=>{let i={...qt(n,t().notes[n]),...r};e(e=>({notes:{...e.notes,[n]:i}}));try{localStorage.setItem(`discussion-review:${n}`,JSON.stringify(i))}catch{}}})),Kt=new Map;function qt(e,t){if(t)return t;if(Kt.has(e))return Kt.get(e);let n=Wt;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={...Wt,...t})}catch{}return Kt.set(e,n),n}function Jt(e){let t=(0,Dt.c)(51),{initial:n,zh:r,busy:i,onClose:a,onSave:o}=e,[s,c]=(0,Z.useState)(n),l;t[0]!==i||t[1]!==a?(l=e=>{!e&&!i&&a()},t[0]=i,t[1]=a,t[2]=l):l=t[2];let u;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(u=(0,Q.jsx)(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,Q.jsx)(`header`,{className:`border-b border-edge p-4`,children:(0,Q.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,Q.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,Q.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,Q.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,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsxs)(`label`,{className:`block text-sm`,children:[r?`负责人原话`:`Owner as stated`,(0,Q.jsx)(`input`,{className:`mt-1 w-full rounded border border-edge bg-transparent p-2`,value:s.owner??``,onChange:e=>c({...s,owner:e.target.value})})]}),(0,Q.jsxs)(`label`,{className:`block text-sm`,children:[r?`期限原话`:`Date as stated`,(0,Q.jsx)(`input`,{className:`mt-1 w-full rounded border border-edge bg-transparent p-2`,value:s.dueDate??``,onChange:e=>c({...s,dueDate:e.target.value})})]})]}):null,t[16]=s,t[17]=r,t[18]=w):w=t[18];let T;t[19]!==s||t[20]!==r?(T=s.kind===`summary`?null:(0,Q.jsxs)(`label`,{className:`flex items-center gap-2 text-sm`,children:[(0,Q.jsx)(`input`,{type:`checkbox`,className:`ui-checkbox`,checked:!!s.ignored,onChange:e=>c({...s,ignored:e.target.checked})}),r?`忽略此项`:`Ignore this item`]}),t[19]=s,t[20]=r,t[21]=T):T=t[21];let E;t[22]!==y||t[23]!==w||t[24]!==T||t[25]!==m?(E=(0,Q.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,Q.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,Q.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,Q.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,Q.jsxs)(b,{children:[u,(0,Q.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,Q.jsx)(C,{open:!0,onOpenChange:l,children:P}),t[48]=l,t[49]=P,t[50]=F):F=t[50],F}function Yt(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 Xt=e=>`${String(Math.floor(e/6e4)).padStart(2,`0`)}:${String(Math.floor(e/1e3)%60).padStart(2,`0`)}`;function Zt(e,t){e.currentTime=Number.isFinite(e.duration)?Math.min(t,e.duration):t}function Qt({noteId:e,onPersonalNotes:t,onMeetingContent:n,personalNotes:r,personalNotesActive:i=!1,noteTitle:a,noteActions:s}){let l=o(),d=(0,Z.useId)(),m=(0,Z.useRef)(null),h=f(e=>e.language)===`zh`,{data:_,mutate:v,isLoading:y}=et([`note-discussion-document`,e],()=>F(e),{refreshInterval:e=>e&&([`recording`,`stopping`,`sealing`,`organizing`].includes(e.discussion.status)||e.recordingJob?.state===`queued`||e.recordingJob?.state===`running`)?3e3:0}),[w,T]=(0,Z.useState)(null),[E,D]=(0,Z.useState)(null),O=(0,Z.useRef)(null),{detail:k,hasUpdates:M,publish:P}=zt(e,_,Bt(O),!!w||!!E),I=k?.discussion.id,R=`/api/discussions/${encodeURIComponent(I??``)}`,{data:z=[],mutate:te}=et(I?`${R}/actions`:null,e=>p(u(e)),{refreshInterval:1e4}),B=Gt(t=>qt(e,t.notes[e])),re=Gt(e=>e.update),H=B.tab,ie=t=>re(e,{tab:t}),oe=B.query,se=t=>re(e,{query:t}),[U,ce]=(0,Z.useState)(!1),le=(0,Z.useRef)(null);(0,Z.useEffect)(()=>{U&&le.current?.focus()},[U]);let[ue,de]=(0,Z.useState)(`general`),fe=(0,Z.useRef)(null),W=(0,Z.useRef)(null),[pe,me]=(0,Z.useState)(!1),[he,ge]=(0,Z.useState)(!1),_e=(0,Z.useRef)(!1),ve=(0,Z.useRef)(null),ye=(0,Z.useRef)(null),[G,be]=(0,Z.useState)(null),[xe,Se]=(0,Z.useState)(!1),[Ce,we]=(0,Z.useState)([]),[Te,Ee]=(0,Z.useState)(null),[K,De]=(0,Z.useState)(!1),Oe=B.page,ke=t=>re(e,{page:t}),Ae=(0,Z.useRef)(null),[je,q]=(0,Z.useState)([]),Me=(0,Z.useRef)(0),Ne=(0,Z.useRef)(0),Fe=(0,Z.useRef)(_?.transcript.revision);Fe.current=_?.transcript.revision;let Ie=(0,Z.useRef)(null),Re=(0,Z.useRef)(_?.discussion.audioDeletedAt);Re.current=_?.discussion.audioDeletedAt;let Be=(0,Z.useRef)(null),[Ve,He]=(0,Z.useState)();(0,Z.useEffect)(()=>{let t=()=>{v(),te()},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)}},[v,te,e]),(0,Z.useEffect)(()=>{k?.discussion.template&&de(k.discussion.template)},[k?.discussion.template]);async function We(e){if(!K){De(!0),Ee(null);try{await e();let t=await v();P(t),await te()}catch(e){Ee(e instanceof Error?e.message:String(e))}finally{De(!1)}}}function Ge(e,t){if(!Ie.current)return;let n=Ie.current,r=e/1e3;Ae.current=t??null,Be.current=n.readyState===0?r:null,Zt(n,r),rt(n),n.play().catch(()=>{n.paused&&nt(n)})}function Ke(){if(W.current)return;let e=ye.current??(document.activeElement instanceof HTMLElement?document.activeElement:null);W.current={element:e,triggerIndex:Array.from(O.current?.querySelectorAll(`button`)??[]).findIndex(t=>t===e),scrollTop:O.current?.scrollTop??0,review:B}}function Je(){Ne.current++,me(!1),be(null),ge(!1),q([]),W.current=null,ve.current=null}function Xe(){Ne.current++,me(!1),be(null),ve.current=W.current?.element??null,he||(W.current=null)}function Ze(){let t=W.current;if(!t)return;let{tab:n,query:r,page:i,anchor:a,anchorRevision:o}=t.review;re(e,{tab:n,query:r,page:i,anchor:a,anchorRevision:o}),q([]),be(null),ge(!1),_e.current=!0}(0,Z.useLayoutEffect)(()=>{if(!G&&!pe&&ve.current&&(ve.current.focus({preventScroll:!0}),ve.current=null),!_e.current)return;_e.current=!1;let e=W.current;e&&O.current&&(O.current.scrollTop=e.scrollTop),(e?.element?.isConnected?e.element:e&&e.triggerIndex>=0?O.current?.querySelectorAll(`button`)[e.triggerIndex]:null)?.focus({preventScroll:!0}),W.current=null}),(0,Z.useEffect)(()=>{(G||pe)&&fe.current?.focus({preventScroll:!0})},[G,pe]);function Qe(e){i&&n?.(),Ke();let t=e.stale||e.transcriptRevision!==Fe.current,r=Re.current?{...e,audioAvailable:!1,timingVerified:!1,segments:e.segments.map(e=>({...e,playback:[]}))}:e;be({...r,stale:t}),t||q(e.segments.map(e=>e.sequence))}async function $e(e,t){if(!k)return;let r=Me.current,a=++Ne.current;i&&n?.(),Ke(),me(!0),be(null),Ee(null);try{let n=await p(u(`${R}/evidence?revision=${t??k.organization?.transcriptRevision??k.transcript.revision}&segments=${e.join(`,`)}`));if(r!==Me.current||a!==Ne.current)return;Qe(n)}catch(e){r===Me.current&&a===Ne.current&&(Ee(e instanceof Error?e.message:String(e)),Xe())}finally{a===Ne.current&&me(!1)}}async function it(e){if(!k||Re.current||!Ie.current)return;(G||pe||he)&&Je();let t=Me.current,n=++Ne.current;if(Ee(null),k.discussion.mimeType?.split(`;`)[0]===`audio/wav`&&e.endedAtMs>e.startedAtMs){Ge(e.startedAtMs,e.endedAtMs);return}try{let r=await p(u(`${R}/evidence?revision=${k.transcript.revision}&segments=${e.sequence}`));if(t!==Me.current||n!==Ne.current||Re.current)return;let i=r.segments.find(t=>t.sequence===e.sequence)?.playback[0];if(!i){Ee(h?`这段录音暂无法定位`:`This segment cannot be located yet`);return}q([]),Ge(i.startedAtMs,i.endedAtMs)}catch(e){t===Me.current&&n===Ne.current&&Ee(e instanceof Error?e.message:String(e))}}async function at(e){k&&await We(async()=>{await L(k.discussion.clientRequestId,ne({type:`transcript`,capturedAt:Date.now(),transcriptRevision:k.transcript.revision,segmentIds:[e.sequence]})),ie(`marks`),V(k.discussion.clientRequestId,k.discussion.id).catch(e=>Ee(String(e)))})}(0,Z.useEffect)(()=>(Me.current++,Ne.current++,W.current=null,ge(!1),me(!1),be(null),q([]),T(null),D(null),we([]),Ee(null),Ae.current=null,()=>{Me.current++}),[e]),(0,Z.useEffect)(()=>{let t=k?.discussion.audioSha256??k?.discussion.audioAttachmentId;if(!t)return;let n=qt(e,Gt.getState().notes[e]);n.source&&n.source!==t?(Me.current++,Ne.current++,me(!1),be(null),q([]),Ie.current?.pause(),re(e,{positionMs:0,source:t}),Be.current=0,Ae.current=null):re(e,{source:t})},[e,k?.discussion.audioSha256,k?.discussion.audioAttachmentId,re]),(0,Z.useEffect)(()=>{k?.discussion.audioDeletedAt&&(Ie.current?.pause(),Be.current=null,Ae.current=null,be(e=>e?{...e,audioAvailable:!1,timingVerified:!1,segments:e.segments.map(e=>({...e,playback:[]}))}:null))},[k?.discussion.audioDeletedAt]),(0,Z.useEffect)(()=>{B.tab===`transcript`&&B.anchor!==void 0&&B.anchorRevision===k?.transcript.revision&&window.setTimeout(()=>document.getElementById(`discussion-segment-${B.anchor}`)?.scrollIntoView?.({block:`center`}),0)},[B.tab,B.anchor,B.anchorRevision,k?.transcript.revision]),(0,Z.useEffect)(()=>{q([]),be(e=>e&&e.transcriptRevision!==_?.transcript.revision?{...e,stale:!0}:e)},[_?.transcript.revision]);function ot(e,t,n=h?`原话`:`Source`){let r=k&&(t??k.organization?.transcriptRevision??k.transcript.revision)===k.transcript.revision?k.transcript.segments.find(t=>t.sequence===e[0]):void 0;return(0,Q.jsx)(`button`,{type:`button`,className:`inline-flex min-h-11 shrink-0 items-center gap-1.5 rounded-lg px-2 text-xs text-accent-fg hover:bg-surface-hover focus-visible:ring-2 focus-visible:ring-accent`,"aria-label":r?`${n} · ${Xt(r.startedAtMs)}`:void 0,onClick:()=>void $e(e,t),children:r?(0,Q.jsx)(`span`,{className:`tabular-nums`,children:Xt(r.startedAtMs)}):n})}let st=(e,t,n)=>t.some(e=>xe||!e.ignored)?(0,Q.jsxs)(`section`,{className:`space-y-2`,children:[(0,Q.jsx)(`h3`,{className:`font-semibold text-fg`,children:e}),t.filter(e=>xe||!e.ignored).map(e=>(0,Q.jsxs)(`div`,{"data-reading-anchor":`fact:${e.id}`,className:`flex items-start gap-3 text-sm`,children:[(0,Q.jsxs)(`p`,{className:`flex-1 whitespace-pre-wrap`,children:[e.text,e.supersededBy||e.disputedBy?(0,Q.jsx)(`span`,{className:`ml-2 text-xs text-fg-muted`,children:h?`有后续变更`:`Later changes`}):null,e.editedByUser?(0,Q.jsx)(`span`,{className:`ml-2 text-xs text-fg-muted`,children:h?e.ignored?`已忽略`:`人工编辑`:e.ignored?`Ignored`:`Edited`}):null]}),(0,Q.jsx)(`button`,{className:`text-xs text-fg-muted`,disabled:K||M,onClick:()=>D({kind:n,itemId:e.id,text:e.text,ignored:e.ignored}),children:h?`编辑`:`Edit`}),e.evidenceSegmentIds.length?ot(e.evidenceSegmentIds,e.evidenceRevision):(0,Q.jsx)(`span`,{className:`text-xs text-fg-muted`,children:h?`暂无定位`:`No source timing`})]},e.id))]}):null;if(y)return(0,Q.jsx)(Ye,{className:`h-48 w-full`});if(!k)return null;let{discussion:Y,transcript:ct,organization:lt}=k,X=lt?.organization,ut=!k.note.title||/^Discussion · \d{4}-\d{2}-\d{2} \d{2}:\d{2}$/.test(k.note.title)?h?`语音笔记`:`Voice note`:k.note.title,dt=Y.recordingStartedAt??k.note.createdAt,ft=dt?new Date(dt).toLocaleDateString(h?`zh-CN`:`en`,{month:`short`,day:`numeric`}):null,pt=Y.audioSha256??Y.audioAttachmentId??``,mt=Ve?.source===pt?Ve.ms:Y.durationMs??0,ht=!!Y.audioAttachmentId&&!Y.audioDeletedAt,gt=[`stopping`,`sealing`,`organizing`].includes(Y.status),_t=!M&&[`recording`,`completed`,`needs_attention`].includes(Y.status),vt=i||!!G||pe,yt=ct.segments.filter(e=>(e.displayText??e.rawText??``).toLocaleLowerCase().includes(oe.toLocaleLowerCase())||e.speakerLabel?.toLocaleLowerCase().includes(oe.toLocaleLowerCase())),bt=i?k.note.markdown:H===`marks`||oe.trim()?``:Yt(k,H,{query:oe,page:Oe,showIgnored:xe});return(0,Q.jsxs)(`section`,{className:`@container/discussion relative flex h-full min-h-0 min-w-0 w-full flex-col text-fg`,onClickCapture:e=>{ye.current=e.target instanceof Element?e.target.closest(`button`):null},onKeyDown:e=>{!e.defaultPrevented&&(e.metaKey||e.ctrlKey)&&e.key===`f`&&(e.preventDefault(),i&&O.current&&getComputedStyle(O.current).visibility===`hidden`&&n?.(),U?window.requestAnimationFrame(()=>le.current?.focus()):ce(!0))},children:[(0,Q.jsxs)(`header`,{className:`flex shrink-0 flex-wrap items-start gap-x-4 gap-y-1 px-5 pb-3 pt-5 sm:px-7`,children:[(0,Q.jsxs)(`div`,{className:`min-w-40 flex-1`,children:[a??(0,Q.jsx)(`h2`,{className:`break-words text-2xl font-semibold leading-snug tracking-tight`,children:ut}),(0,Q.jsx)(`p`,{className:`mt-1 text-xs tabular-nums text-fg-muted`,children:[ft,Xt(mt)].filter(Boolean).join(` · `)})]}),(0,Q.jsx)(It,{noteActions:s,detail:k,zh:h,busy:K,processing:gt,pageText:bt,editing:!!E||!!w})]}),(0,Q.jsxs)(`div`,{className:`mx-5 mb-2 flex shrink-0 flex-wrap items-center justify-between gap-x-2 border-b border-edge-subtle pb-2 sm:mx-7`,children:[(0,Q.jsx)(`nav`,{"aria-label":h?`录音内容`:`Recording content`,className:`inline-flex items-center rounded-xl bg-surface-inset px-1`,children:[`summary`,`transcript`].map(e=>(0,Q.jsxs)(`button`,{type:`button`,"aria-pressed":H===e||e===`transcript`&&H===`marks`,className:`group relative isolate min-h-11 rounded-lg px-3.5 text-sm text-fg-muted aria-pressed:font-medium aria-pressed:text-fg focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,onClick:()=>{i&&O.current&&getComputedStyle(O.current).visibility===`hidden`&&n?.(),Je(),ie(e)},children:[(0,Q.jsx)(`span`,{"aria-hidden":!0,className:`absolute inset-x-0 inset-y-1.5 -z-10 rounded-lg group-aria-pressed:bg-surface-panel group-aria-pressed:shadow-sm`}),e===`summary`?h?`纪要`:`Summary`:h?`转写`:`Transcript`]},e))}),(0,Q.jsxs)(`div`,{className:`ml-auto flex items-center gap-1`,children:[(0,Q.jsx)(`button`,{type:`button`,"aria-label":h?`搜索`:`Search`,"aria-expanded":U||!!oe,onClick:()=>{i&&n?.(),ce(e=>!e),U&&se(``)},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`,children:(0,Q.jsx)(ze,{className:`size-4`,"aria-hidden":!0})}),r?(0,Q.jsxs)(`button`,{ref:m,type:`button`,"aria-expanded":i,"aria-controls":d,className:`inline-flex min-h-11 items-center gap-1.5 rounded-lg px-2 text-sm font-medium text-accent-fg hover:bg-surface-hover focus-visible:ring-2 focus-visible:ring-accent`,onClick:()=>{i?n?.():(Je(),t?.())},children:[i?(0,Q.jsx)(ae,{className:`size-4`,"aria-hidden":!0}):(0,Q.jsx)(Ue,{className:`size-4`,"aria-hidden":!0}),i?h?`完成`:`Done`:h?`写笔记`:`Write notes`]}):null]})]}),Te?(0,Q.jsxs)(`details`,{role:`alert`,className:`px-4 py-2 text-sm text-danger`,children:[(0,Q.jsx)(`summary`,{children:h?`操作未完成,可以稍后重试`:`Action incomplete. Try again later`}),(0,Q.jsx)(`p`,{className:`mt-2 break-words text-xs text-fg-muted`,children:Te})]}):null,U||oe?(0,Q.jsxs)(`label`,{className:`mx-5 mb-2 shrink-0 items-center gap-2 rounded-xl bg-surface-inset px-3 sm:mx-7 ${i?`hidden @min-[58rem]/discussion:flex`:`flex`}`,children:[(0,Q.jsx)(ze,{className:`size-4 text-fg-muted`}),(0,Q.jsx)(`input`,{ref:le,"aria-label":h?`搜索录音内容`:`Search recording`,className:`min-h-11 min-w-0 w-full bg-transparent text-sm outline-none`,maxLength:200,placeholder:h?`搜索录音内容`:`Search recording`,value:oe,onChange:e=>{se(e.target.value),ke(1)}}),(0,Q.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":h?`关闭搜索`:`Close search`,onClick:()=>{se(``),ce(!1)},children:(0,Q.jsx)(qe,{className:`size-4`})})]}):null,he?(0,Q.jsx)(`div`,{className:`flex shrink-0 items-center px-5 pb-2 text-xs text-fg-muted sm:px-7`,children:(0,Q.jsx)(J,{variant:`ghost`,onClick:Ze,children:W.current?.review.tab===`summary`?h?`返回结论`:`Back to conclusion`:h?`返回阅读位置`:`Back to reading`})}):null,(0,Q.jsxs)(`div`,{className:`relative flex min-h-0 min-w-0 flex-1 overflow-hidden`,children:[(0,Q.jsxs)(`main`,{ref:O,className:`min-h-0 min-w-0 flex-1 flex-col gap-5 overflow-y-auto px-5 pb-6 pt-3 sm:px-7 ${vt?`invisible @min-[58rem]/discussion:visible`:``} flex`,children:[H!==`summary`&&!oe.trim()?(0,Q.jsx)(`div`,{className:`mx-auto flex w-full max-w-[46rem] justify-end`,children:(0,Q.jsxs)(J,{variant:`ghost`,"aria-pressed":H===`marks`,onClick:()=>ie(H===`marks`?`transcript`:`marks`),className:`min-h-11 gap-1.5 aria-pressed:bg-surface-inset`,children:[(0,Q.jsx)(N,{className:`size-4`,"aria-hidden":!0}),h?`我的标记`:`My highlights`]})}):null,(Y.status!==`completed`||!X||lt?.transcriptRevision!==ct.revision)&&(Y.status!==`recording`||k.recordingJob)?(0,Q.jsx)(A,{context:`note`,nextAttemptAt:k.processing?.nextAttemptAt,input:ee(k),zh:h,busy:K,onRetry:e=>void We(()=>e===`analyze`?p(u(`${R}/organize`),{method:`POST`,body:JSON.stringify({template:ue})}):j(Y.id,e===`regenerate`?`from_audio`:`resume`))}):null,(0,Q.jsx)(`div`,{className:`mx-auto w-full max-w-[46rem]`,hidden:!!oe.trim(),children:H===`marks`?(0,Q.jsx)(Ut,{recordingId:Y.clientRequestId,discussionId:Y.id,zh:h,onEvidence:Qe,onPlay:e=>Ge(e.startedAtMs,e.endedAtMs)},Y.id):H===`summary`?X?(0,Q.jsxs)(`div`,{className:`mx-auto w-full max-w-[46rem] space-y-6`,children:[(0,Q.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[(0,Q.jsx)(`h3`,{className:`text-base font-medium`,children:h?`摘要`:`Summary`}),(0,Q.jsxs)(`div`,{className:`flex items-center gap-1`,children:[(0,Q.jsx)(Lt,{detail:k,template:ue,onTemplate:de,zh:h,busy:K,processing:gt,onOrganize:()=>void We(()=>p(u(`${R}/organize`),{method:`POST`,body:JSON.stringify({template:ue})})),onRegenerate:()=>void We(()=>j(Y.id,`from_audio`))}),(0,Q.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":h?`编辑概要`:`Edit overview`,title:h?`编辑概要`:`Edit overview`,disabled:K||gt||M,onClick:()=>D({kind:`summary`,itemId:`summary`,text:X.summary}),children:(0,Q.jsx)(Ue,{className:`size-4`,"aria-hidden":!0})})]})]}),(0,Q.jsx)(`p`,{"data-reading-anchor":`summary`,className:`whitespace-pre-wrap text-[15px] leading-7`,children:X.summary}),X.summaryEditedByUser?(0,Q.jsx)(`p`,{className:`text-xs text-fg-muted`,children:h?`已由你编辑`:`Edited by you`}):null,X.summaryEvidenceSegmentIds?.length?Array.from({length:Math.ceil(X.summaryEvidenceSegmentIds.length/100)},(e,t)=>(0,Q.jsxs)(J,{onClick:()=>void $e(X.summaryEvidenceSegmentIds.slice(t*100,(t+1)*100)),children:[h?`查看原话`:`View source`,X.summaryEvidenceSegmentIds.length>100?` · ${t+1}`:``]},t)):null,X.keyPointEvidence?.length?(0,Q.jsxs)(`section`,{className:`space-y-2`,children:[(0,Q.jsx)(`h3`,{children:h?`重点结论`:`Key points`}),X.keyPointEvidence.map(e=>(0,Q.jsxs)(`div`,{className:`flex gap-2 text-sm`,children:[(0,Q.jsx)(`p`,{className:`flex-1`,children:e.text}),ot(e.evidenceSegmentIds,e.evidenceRevision)]},e.id))]}):X.keyPoints.length?(0,Q.jsxs)(`section`,{className:`space-y-3`,children:[(0,Q.jsx)(`h3`,{className:`text-base font-medium`,children:h?`重点结论`:`Key points`}),(0,Q.jsx)(`ul`,{className:`list-disc space-y-2 pl-5 text-[15px] leading-7`,children:X.keyPoints.map((e,t)=>(0,Q.jsx)(`li`,{children:e},`${t}:${e}`))})]}):null,[...X.decisions,...X.actionItems,...X.risks,...X.openQuestions].some(e=>e.ignored)?(0,Q.jsxs)(`label`,{className:`flex items-center gap-2 text-xs text-fg-muted`,children:[(0,Q.jsx)(`input`,{type:`checkbox`,className:`ui-checkbox`,checked:xe,onChange:e=>Se(e.target.checked)}),h?`显示已忽略项`:`Show ignored items`]}):null,Ce.length?(0,Q.jsx)(J,{disabled:K||M,onClick:()=>void We(async()=>{for(let e of Ce)await p(u(`${R}/actions/${encodeURIComponent(e)}/convert`),{method:`POST`,body:JSON.stringify({organizationRevision:lt.revision})});we([])}),children:h?`加入所选 ${Ce.length} 项任务`:`Add ${Ce.length} selected tasks`}):null,st(h?`已决定事项`:`Decisions`,X.decisions,`decisions`),X.actionItems.length?(0,Q.jsxs)(`section`,{className:`space-y-3`,children:[(0,Q.jsx)(`h3`,{className:`font-semibold`,children:h?`下一步行动`:`Next actions`}),X.actionItems.filter(e=>xe||!e.ignored).map(e=>{let t=z.find(t=>t.actionId===e.id);return(0,Q.jsxs)(`article`,{"data-reading-anchor":`action:${e.id}`,className:`rounded-lg border border-edge-subtle p-3`,children:[(0,Q.jsxs)(`div`,{className:`flex items-start gap-2`,children:[!t&&!e.ignored&&(!(e.supersededBy||e.disputedBy)||e.reviewedChangeId===(e.supersededBy??e.disputedBy))?(0,Q.jsx)(`input`,{type:`checkbox`,"aria-label":`${h?`选择行动`:`Select action`}: ${e.title}`,className:`ui-checkbox`,checked:Ce.includes(e.id),onChange:t=>we(t.target.checked?[...Ce,e.id]:Ce.filter(t=>t!==e.id))}):null,(0,Q.jsxs)(`p`,{className:`flex-1 text-sm font-medium`,children:[e.title,e.supersededBy||e.disputedBy?(0,Q.jsx)(`span`,{className:`ml-2 text-xs text-fg-muted`,children:h?`有后续变更,请复核`:`Review later changes`}):null,e.editedByUser?(0,Q.jsx)(`span`,{className:`ml-2 text-xs text-fg-muted`,children:h?e.ignored?`已忽略`:`人工编辑`:e.ignored?`Ignored`:`Edited`}):null]}),(0,Q.jsx)(`button`,{className:`text-xs text-fg-muted`,disabled:K||gt||M,onClick:()=>D({kind:`actionItems`,itemId:e.id,text:e.title,owner:e.owner,dueDate:e.dueDate,ignored:e.ignored}),children:h?`编辑`:`Edit`})]}),(0,Q.jsxs)(`p`,{className:`mt-1 text-xs text-fg-muted`,children:[e.owner??(h?`负责人未明确`:`Owner unspecified`),` · `,e.dueDate??(h?`期限未明确`:`Date unspecified`)]}),(0,Q.jsxs)(`div`,{className:`mt-3 flex flex-wrap items-center gap-3 text-xs`,children:[e.evidenceSegmentIds.length?ot(e.evidenceSegmentIds,e.evidenceRevision,h?`查看原话`:`Source`):null,t?t.deleted?(0,Q.jsx)(`span`,{children:h?`关联任务已删除`:`Linked task deleted`}):(0,Q.jsx)(c,{className:`text-accent-fg`,to:Pe(`${l.pathname}${l.search}`,t.taskId),children:t.resolution===`done`?h?`已完成 · 查看任务`:`Done · View task`:h?`查看任务 / 交给助手`:`View task / Delegate`}):e.ignored?null:(0,Q.jsx)(J,{disabled:K||M||!!(e.supersededBy||e.disputedBy)&&e.reviewedChangeId!==(e.supersededBy??e.disputedBy),onClick:()=>void We(()=>p(u(`${R}/actions/${encodeURIComponent(e.id)}/convert`),{method:`POST`,body:JSON.stringify({organizationRevision:lt.revision})})),children:h?`加入我的任务`:`Add to my tasks`})]})]},e.id)})]}):null,st(h?`风险`:`Risks`,X.risks,`risks`),st(h?`尚未确定`:`Open questions`,X.openQuestions,`openQuestions`),X.changes?.length?(0,Q.jsxs)(`section`,{className:`space-y-3`,children:[(0,Q.jsx)(`h3`,{className:`font-semibold`,children:h?`前后变更`:`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,Q.jsxs)(`article`,{className:`space-y-2 rounded border border-edge p-3 text-sm`,children:[(0,Q.jsx)(`p`,{className:`text-xs text-fg-muted`,children:e.relation===`supersedes`?h?`后续撤销或替代`:`Later superseded`:h?`存在冲突,尚未明确解决`:`Unresolved conflict`}),(0,Q.jsx)(`button`,{className:`block text-left text-accent-fg`,onClick:()=>void $e(n.evidenceSegmentIds,n.evidenceRevision),children:`title`in n?n.title:n.text}),(0,Q.jsx)(`span`,{children:`↓`}),(0,Q.jsx)(`button`,{className:`block text-left text-accent-fg`,onClick:()=>void $e(r.evidenceSegmentIds,r.evidenceRevision),children:`title`in r?r.title:r.text})]},`${e.fromId}:${e.toId}`)})]}):null]}):(0,Q.jsxs)(`div`,{className:`mx-auto w-full max-w-[46rem] space-y-4 py-3`,children:[(0,Q.jsx)(`p`,{className:`whitespace-pre-wrap text-[15px] leading-7 text-fg-muted`,children:ct.text?ct.text.slice(0,400)+(ct.text.length>400?`…`:``):null}),ct.text?(0,Q.jsx)(J,{className:`min-h-11`,onClick:()=>ie(`transcript`),children:h?`查看转写`:`View transcript`}):null]}):(0,Q.jsxs)(`div`,{className:`divide-y divide-edge-subtle`,children:[yt.slice(0,Oe*50).map(e=>(0,Q.jsxs)(`article`,{"data-reading-anchor":`segment:${e.sequence}`,id:`discussion-segment-${e.sequence}`,className:`px-3 py-2 ${je.includes(e.sequence)||B.anchor===e.sequence&&B.anchorRevision===ct.revision?`rounded-lg bg-accent-soft`:B.positionMs>0&&B.positionMs>=e.startedAtMs&&B.positionMs<e.endedAtMs?`rounded-lg bg-surface-inset`:``}`,children:[(0,Q.jsxs)(`div`,{className:`flex flex-wrap items-center gap-x-2 text-xs text-fg-muted`,children:[(0,Q.jsx)(`span`,{children:e.speakerLabel??(h?`未区分说话人`:`Speaker unknown`)}),e.status===`confirmed`&&!M?(0,Q.jsxs)(`button`,{type:`button`,className:`ml-auto inline-flex min-h-11 items-center gap-1.5 rounded-lg px-2 hover:bg-surface-hover focus-visible:ring-2 focus-visible:ring-accent`,onClick:()=>void at(e),children:[(0,Q.jsx)(N,{className:`size-3.5`,"aria-hidden":!0}),h?`标记此段`:`Highlight segment`]}):null,_t&&e.status===`confirmed`?(0,Q.jsx)(`button`,{type:`button`,className:`min-h-11 rounded-lg px-2 hover:bg-surface-hover focus-visible:ring-2 focus-visible:ring-accent`,onClick:()=>T({segment:e,text:e.displayText??e.rawText??``,speaker:e.speakerLabel??``}),children:h?`校对`:`Edit`}):null]}),ht&&e.status===`confirmed`?(0,Q.jsxs)(`button`,{type:`button`,className:`flex min-h-11 w-full items-start gap-3 rounded-lg px-2 py-2 text-left hover:bg-surface-hover focus-visible:ring-2 focus-visible:ring-accent`,onClick:()=>void it(e),children:[(0,Q.jsxs)(`span`,{className:`inline-flex shrink-0 items-center gap-1 pt-1 text-xs tabular-nums text-accent-fg`,children:[(0,Q.jsx)(Le,{className:`size-3`,"aria-hidden":!0}),(0,Q.jsxs)(`span`,{className:`sr-only`,children:[h?`回听`:`Play`,` `]}),Xt(e.startedAtMs)]}),(0,Q.jsx)(`span`,{className:`whitespace-pre-wrap break-words text-sm leading-6`,children:e.displayText??e.rawText})]}):(0,Q.jsxs)(`p`,{className:`flex gap-3 px-2 py-2 text-sm leading-6`,children:[(0,Q.jsx)(`span`,{className:`shrink-0 text-xs tabular-nums text-fg-muted`,children:Xt(e.startedAtMs)}),(0,Q.jsx)(`span`,{className:`whitespace-pre-wrap break-words`,children:e.displayText??e.rawText??(h?`等待转写`:`Awaiting transcription`)})]})]},e.sequence)),yt.length>Oe*50?(0,Q.jsx)(J,{onClick:()=>ke(Oe+1),children:h?`加载更多`:`More`}):null]})}),(0,Q.jsx)(`div`,{className:`mx-auto w-full max-w-[46rem]`,children:(0,Q.jsx)(Ht,{id:Y.id,query:oe.trim(),zh:h,sourceKey:`${Y.audioSha256}:${Y.audioDeletedAt}`,active:gt||Y.status===`recording`,tab:H,refreshKey:`${Y.updatedAt}:${ct.revision}:${lt?.revision}`,onEvidence:Qe,onPlay:Ge},Y.id)})]}),r?(0,Q.jsx)(`aside`,{id:d,"aria-label":h?`我的笔记`:`My notes`,hidden:!i,className:`absolute inset-0 z-10 min-h-0 min-w-0 overflow-hidden bg-surface-panel @min-[58rem]/discussion:static @min-[58rem]/discussion:w-[24rem] @min-[58rem]/discussion:shrink-0 @min-[58rem]/discussion:border-l @min-[58rem]/discussion:border-edge-subtle`,onKeyDown:e=>{e.key!==`Escape`||e.defaultPrevented||(n?.(),m.current?.focus())},children:r}):null,G||pe?(0,Q.jsxs)(`aside`,{ref:fe,tabIndex:-1,onKeyDown:e=>{e.key===`Escape`&&(e.stopPropagation(),Xe())},"aria-label":h?`原话证据`:`Source evidence`,className:`absolute inset-0 z-20 flex min-h-0 w-full min-w-0 flex-col border-edge bg-surface-panel outline-none @min-[58rem]/discussion:static @min-[58rem]/discussion:w-[22rem] @min-[58rem]/discussion:shrink-0 @min-[58rem]/discussion:border-l`,children:[(0,Q.jsxs)(`header`,{className:`flex shrink-0 items-center justify-between border-b border-edge p-4`,children:[(0,Q.jsxs)(`h3`,{children:[h?`原话证据`:`Source evidence`,` `,G?`· v${G.transcriptRevision}`:``]}),(0,Q.jsx)(`button`,{"aria-label":h?`关闭`:`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:Xe,children:(0,Q.jsx)(qe,{className:`size-4`})})]}),(0,Q.jsxs)(`div`,{className:`min-h-0 flex-1 space-y-4 overflow-y-auto p-4`,children:[pe?(0,Q.jsxs)(`div`,{"aria-busy":`true`,className:`space-y-3`,children:[(0,Q.jsx)(Ye,{className:`h-4 w-1/3`}),(0,Q.jsx)(Ye,{className:`h-24 w-full`})]}):null,G?(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(`p`,{className:`text-xs text-fg-muted`,children:h?`按整段定位,不代表词句级时间。`:`Segment timing; not word-level alignment.`}),G.stale?(0,Q.jsx)(`p`,{className:`text-xs text-fg-muted`,children:h?`原文已更新,以下保留当时版本的依据。`:`Transcript updated; showing the original evidence revision.`}):null,!G.audioAvailable||!G.timingVerified?(0,Q.jsx)(`p`,{className:`text-xs text-fg-muted`,children:h?`原文仍可查看;原音不可用或时间定位待核实。`:`Text remains available; audio is missing or timing is unverified.`}):null,G.segments.map(t=>(0,Q.jsxs)(`article`,{className:`space-y-2 rounded border border-edge p-3`,children:[(0,Q.jsxs)(`p`,{className:`text-xs text-fg-muted`,children:[Xt(t.startedAtMs),`–`,Xt(t.endedAtMs),` · `,t.speakerLabel??(h?`说话人未明确`:`Unknown speaker`)]}),(0,Q.jsx)(`p`,{className:`whitespace-pre-wrap text-sm leading-7`,children:t.text}),t.playback.map((e,t)=>(0,Q.jsxs)(J,{onClick:()=>Ge(e.startedAtMs,e.endedAtMs),children:[h?`播放原话`:`Play source`,` `,Xt(e.startedAtMs),`–`,Xt(e.endedAtMs)]},t)),!G.stale&&G.transcriptRevision===_?.transcript.revision&&G.transcriptRevision!==ct.revision?(0,Q.jsx)(J,{onClick:()=>P(),children:h?`查看最新原文`:`View latest transcript`}):null,!G.stale&&G.transcriptRevision===_?.transcript.revision&&G.transcriptRevision===ct.revision?(0,Q.jsx)(J,{onClick:()=>{se(``),ke(Math.max(Oe,Math.ceil((ct.segments.findIndex(e=>e.sequence===t.sequence)+1)/50))),ie(`transcript`),q([t.sequence]),be(null),ge(!0),re(e,{anchor:t.sequence,anchorRevision:ct.revision}),window.setTimeout(()=>document.getElementById(`discussion-segment-${t.sequence}`)?.scrollIntoView?.({block:`center`}),0)},children:h?`定位原文`:`Locate transcript`}):null]},t.sequence))]}):null]})]}):null]}),ht?(0,Q.jsx)(`footer`,{className:`shrink-0 border-t border-edge-subtle px-4 py-2`,children:(0,Q.jsx)(`audio`,{ref:Ie,controls:!0,preload:`metadata`,className:`h-10 w-full`,src:u(`${R}/audio`),"aria-label":h?`录音播放器`:`Recording player`,onDurationChange:e=>{let t=e.currentTarget.duration;He(Number.isFinite(t)&&t>0?{source:pt,ms:Math.floor(t*1e3)}:void 0)},onTimeUpdate:t=>{let n=t.currentTarget.currentTime*1e3;re(e,{positionMs:n}),Ae.current!==null&&n>=Ae.current&&(t.currentTarget.pause(),Ae.current=null)},onLoadedMetadata:e=>{let t=e.currentTarget;Be.current===null?Zt(t,B.source===pt?B.positionMs/1e3:0):(Zt(t,Be.current),Be.current=null,tt(t)&&t.play().catch(()=>{t.paused&&nt(t)}))},onError:()=>Ee(h?`录音暂不可播放`:`Recording unavailable`)},pt)}):null,E&<?(0,Q.jsx)(Jt,{initial:E,zh:h,busy:K,onClose:()=>D(null),onSave:e=>We(async()=>{await p(u(`${R}/summary`),{method:`PATCH`,body:JSON.stringify({...e,expectedRevision:lt.revision})}),D(null)})},`${E.kind}:${E.itemId}:${lt.revision}`):null,w?(0,Q.jsx)(C,{open:!0,onOpenChange:e=>{e||T(null)},children:(0,Q.jsxs)(b,{children:[(0,Q.jsx)(g,{className:`xopc-dialog-overlay fixed inset-0 z-[70] bg-scrim backdrop-blur-[2px]`}),(0,Q.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,Q.jsxs)(`header`,{className:`flex items-center justify-between border-b border-edge p-4`,children:[(0,Q.jsx)(S,{children:h?`校对逐字稿`:`Edit transcript`}),(0,Q.jsx)(`button`,{"aria-label":h?`关闭校对`:`Close editor`,onClick:()=>T(null),children:(0,Q.jsx)(qe,{className:`size-4`})})]}),(0,Q.jsxs)(`div`,{className:`min-h-0 flex-1 space-y-3 overflow-y-auto p-4`,children:[(0,Q.jsxs)(`label`,{className:`block text-xs`,children:[h?`本段说话人`:`Speaker for this segment`,(0,Q.jsx)(`input`,{className:`mt-1 w-full rounded border border-edge bg-surface-inset p-2 text-sm`,value:w.speaker,onChange:e=>T({...w,speaker:e.target.value})})]}),w.segment.speakerLabel?(0,Q.jsxs)(`label`,{className:`flex items-center gap-2 text-xs`,children:[(0,Q.jsx)(`input`,{type:`checkbox`,className:`ui-checkbox`,checked:!!w.applyToSpeakerGroup,onChange:e=>T({...w,applyToSpeakerGroup:e.target.checked})}),h?`同时更名所有同标签片段;输入已有标签可合并说话人`:`Rename all segments with this label; use an existing label to merge speakers`]}):null,(0,Q.jsx)(`textarea`,{className:`min-h-32 w-full rounded border border-edge bg-surface-inset p-2 text-sm`,value:w.text,onChange:e=>T({...w,text:e.target.value})})]}),(0,Q.jsx)(`footer`,{className:`border-t border-edge p-3`,children:(0,Q.jsxs)(J,{variant:`primary`,disabled:K||!w.text.trim(),onClick:()=>void We(async()=>{await p(u(`${R}/segments/${w.segment.sequence}`),{method:`PATCH`,body:JSON.stringify({displayText:w.text,speakerLabel:w.speaker,expectedRevision:w.segment.revision,applyToSpeakerGroup:w.applyToSpeakerGroup,expectedTranscriptRevision:ct.revision})}),T(null)}),children:[(0,Q.jsx)(ae,{className:`size-4`}),h?`保存修订`:`Save revision`]})})]})]})}):null]})}var $t={edit:Ie,ai_edit:He,sync:Re,restore:w};function en(e,t){return{edit:t.triggerEdit,ai_edit:t.triggerAiEdit,sync:t.triggerSync,restore:t.triggerRestore}[e]??e}function tn({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}=et(e?[`note-history`,e]:null,()=>Te(e)),[u,d]=(0,Z.useState)(!1),[p,m]=(0,Z.useState)(null),[g,_]=(0,Z.useState)(null),v=(0,Z.useCallback)(async t=>{d(!0),_(null);try{await be(e,t),m(null),i()}catch{_(o.restoreFailed)}finally{d(!1)}},[e,o.restoreSuccess,o.restoreFailed,i]),y=Date.now();return(0,Q.jsxs)(`div`,{className:`flex h-full min-h-0 flex-col`,children:[(0,Q.jsxs)(`div`,{className:`flex shrink-0 items-center justify-between border-b border-edge px-4 py-3`,children:[(0,Q.jsxs)(`div`,{className:`flex items-center gap-2 text-sm font-medium text-fg`,children:[(0,Q.jsx)(me,{className:`size-4`,"aria-hidden":!0}),o.history]}),(0,Q.jsx)(`button`,{type:`button`,onClick:r,className:`rounded-lg p-1 text-fg-muted transition-colors hover:bg-surface-hover hover:text-fg`,children:(0,Q.jsx)(qe,{className:`size-4`,"aria-hidden":!0})})]}),(0,Q.jsxs)(`div`,{className:`min-h-0 flex-1 overflow-y-auto`,children:[g?(0,Q.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,Q.jsx)(`ul`,{className:`divide-y divide-edge`,children:c.map(e=>{let r=$t[e.trigger]??Ie,i=t===e.timestamp,a=p===e.timestamp;return(0,Q.jsxs)(`li`,{children:[(0,Q.jsxs)(`button`,{type:`button`,onClick:()=>n(e),className:Je(`w-full px-4 py-3 text-left transition-colors`,i?`bg-accent/10`:`hover:bg-surface-hover`),children:[(0,Q.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,Q.jsx)(r,{className:`size-3.5 shrink-0 text-fg-muted`,"aria-hidden":!0}),(0,Q.jsx)(`span`,{className:`text-xs font-medium text-fg`,children:en(e.trigger,o)}),(0,Q.jsx)(`span`,{className:`ml-auto text-xs text-fg-muted`,children:jt(e.timestamp,y,s)})]}),e.snippet&&(0,Q.jsx)(`p`,{className:`mt-1 truncate text-xs text-fg-muted/60`,children:e.snippet})]}),i&&(0,Q.jsx)(`div`,{className:`border-t border-edge/50 px-4 py-2`,children:a?(0,Q.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,Q.jsx)(`span`,{className:`min-w-0 truncate text-xs text-fg-muted`,children:o.restoreConfirm}),(0,Q.jsx)(`button`,{type:`button`,onClick:t=>{t.stopPropagation(),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,Q.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,Q.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,Q.jsxs)(`div`,{className:`px-4 py-8 text-center`,children:[(0,Q.jsx)(`p`,{className:`text-sm font-medium text-fg-muted`,children:o.historyEmpty}),(0,Q.jsx)(`p`,{className:`mt-1 text-xs text-fg-muted/60`,children:o.historyEmptyDescription})]})]})]})}var nn=24,rn=864;function an(e){let t=(0,Dt.c)(11),n;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(n=[],t[0]=n):n=t[0];let[r,i]=(0,Z.useState)(n),[a,o]=(0,Z.useState)(null),[s,c]=(0,Z.useState)(!1),l=(0,Z.useRef)(null),u,d;t[1]===e?(u=t[2],d=t[3]):(u=()=>{if(!e){i([]),o(null),c(!1);return}let t=0,n=!0,r=[],a=!0,s=null,u=null,d=()=>{if(t=0,n){n=!1,s=e.querySelector(`[data-note-outline-scroll]`);let t=s?.querySelector(`[data-note-outline-content], .ProseMirror`)??null;t!==u&&(u&&p?.unobserve(u),t&&p?.observe(t),u=t);let o=Array.from(u?.querySelectorAll(`h1, h2, h3`)??[],sn).filter(on);(a||o.length!==r.length||o.some((e,t)=>{let{element:n,label:i}=e;return n!==r[t]?.element||i!==r[t]?.label}))&&(r=o,i(o),a=!1)}if(c(e.clientWidth>=rn),!s?.clientHeight||r.length<2)return;let d=l.current;if(d&&Math.abs(d.scrollTop-s.scrollTop)<1&&r.some(e=>{let{element:t}=e;return t===d.element})){o(d.element);return}l.current=null;let f=s.getBoundingClientRect().top+nn+1,m=r[0].element;for(let{element:e}of r){if(e.getBoundingClientRect().top>f)break;m=e}let h=s.scrollTop>0&&s.scrollHeight-s.clientHeight-s.scrollTop<=1;o(h?r[r.length-1].element:m)},f=()=>{t||=window.requestAnimationFrame(d)},p=typeof ResizeObserver>`u`?null:new ResizeObserver(f),m=new MutationObserver(()=>{n=!0,f()});return p?.observe(e),m.observe(e,{childList:!0,characterData:!0,subtree:!0}),e.addEventListener(`scroll`,f,{capture:!0,passive:!0}),d(),()=>{m.disconnect(),p?.disconnect(),e.removeEventListener(`scroll`,f,!0),window.cancelAnimationFrame(t),l.current=null}},d=[e],t[1]=e,t[2]=u,t[3]=d),(0,Z.useLayoutEffect)(u,d);let f;t[4]===e?f=t[5]:(f=t=>{let n=t.closest(`[data-note-outline-scroll]`);if(!n||!e?.contains(n))return;let r=t.getBoundingClientRect().top-n.getBoundingClientRect().top;n.scrollTop+=r-nn,l.current={element:t,scrollTop:n.scrollTop},o(t)},t[4]=e,t[5]=f);let p=f,m;return t[6]!==a||t[7]!==p||t[8]!==r||t[9]!==s?(m={headings:r,current:a,wide:s,goTo:p},t[6]=a,t[7]=p,t[8]=r,t[9]=s,t[10]=m):m=t[10],m}function on(e){return e.label}function sn(e){return{element:e,label:e.textContent?.trim()??``,level:Number(e.tagName.slice(1))}}function cn(e){let t=(0,Dt.c)(16),{label:n,headings:r,current:i,onSelect:a}=e,o;t[0]===r?o=t[1]:(o=Math.min(...r.map(ln)),t[0]=r,t[1]=o);let s=o,c;if(t[2]!==s||t[3]!==i||t[4]!==r||t[5]!==a){let e;t[7]!==s||t[8]!==i||t[9]!==a?(e=(e,t)=>{let{element:n,label:r,level:o}=e;return(0,Q.jsx)(`li`,{children:(0,Q.jsx)(`button`,{type:`button`,"aria-current":n===i?`location`:void 0,onClick:()=>a(n),style:{paddingInlineStart:`${.625+(o-s)*.75}rem`},className:Je(`min-h-9 w-full rounded-md py-1.5 pr-2 text-start text-sm break-words focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-accent`,n===i?`bg-accent-soft font-medium text-accent-fg`:`text-fg-muted hover:bg-surface-hover hover:text-fg`),children:r})},t)},t[7]=s,t[8]=i,t[9]=a,t[10]=e):e=t[10],c=r.map(e),t[2]=s,t[3]=i,t[4]=r,t[5]=a,t[6]=c}else c=t[6];let l;t[11]===c?l=t[12]:(l=(0,Q.jsx)(`ul`,{children:c}),t[11]=c,t[12]=l);let u;return t[13]!==n||t[14]!==l?(u=(0,Q.jsx)(`nav`,{"aria-label":n,className:`min-h-0 overflow-y-auto overscroll-contain p-1.5`,children:l}),t[13]=n,t[14]=l,t[15]=u):u=t[15],u}function ln(e){let{level:t}=e;return t}function un(e){let t=(0,Dt.c)(18),[n,r]=(0,Z.useState)(!1),i;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(i=(0,Q.jsx)(M,{className:`size-4`,"aria-hidden":!0}),t[0]=i):i=t[0];let a;t[1]===e.label?a=t[2]:(a=(0,Q.jsx)(st,{asChild:!0,children:(0,Q.jsx)(`button`,{type:`button`,className:`absolute top-5 right-4 z-10 inline-flex size-9 items-center justify-center rounded-lg text-fg-muted hover:bg-surface-hover hover:text-fg focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,"aria-label":e.label,title:e.label,children:i})}),t[1]=e.label,t[2]=a);let o;t[3]===e.label?o=t[4]:(o=(0,Q.jsx)(`div`,{className:`shrink-0 px-4 pt-3 pb-1 text-xs font-medium text-fg-muted`,children:e.label}),t[3]=e.label,t[4]=o);let s;t[5]===e?s=t[6]:(s=t=>{e.onSelect(t),r(!1)},t[5]=e,t[6]=s);let c;t[7]!==e||t[8]!==s?(c=(0,Q.jsx)(cn,{...e,onSelect:s}),t[7]=e,t[8]=s,t[9]=c):c=t[9];let l;t[10]!==e.label||t[11]!==o||t[12]!==c?(l=(0,Q.jsx)(it,{children:(0,Q.jsxs)(at,{"aria-label":e.label,align:`end`,sideOffset:6,collisionPadding:12,className:`z-[70] flex max-h-[min(25rem,var(--radix-popover-content-available-height))] w-64 flex-col overflow-hidden rounded-xl border border-edge bg-surface-overlay text-fg shadow-popover`,children:[o,c]})}),t[10]=e.label,t[11]=o,t[12]=c,t[13]=l):l=t[13];let u;return t[14]!==n||t[15]!==a||t[16]!==l?(u=(0,Q.jsxs)(ot,{open:n,onOpenChange:r,children:[a,l]}),t[14]=n,t[15]=a,t[16]=l,t[17]=u):u=t[17],u}function dn(e){let t=(0,Dt.c)(31),n,r,i,a,o;t[0]===e?(n=t[1],r=t[2],i=t[3],a=t[4],o=t[5]):({closeLabel:n,open:i,onOpenChange:r,returnFocus:o,...a}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i,t[4]=a,t[5]=o);let s;t[6]===Symbol.for(`react.memo_cache_sentinel`)?(s=(0,Q.jsx)(g,{className:`fixed inset-0 z-[150] bg-scrim`}),t[6]=s):s=t[6];let c;t[7]===o?c=t[8]:(c=e=>{e.preventDefault(),o()},t[7]=o,t[8]=c);let l;t[9]===a.label?l=t[10]:(l=(0,Q.jsx)(S,{className:`text-sm font-semibold`,children:a.label}),t[9]=a.label,t[10]=l);let u;t[11]===Symbol.for(`react.memo_cache_sentinel`)?(u=(0,Q.jsx)(qe,{className:`size-4`,"aria-hidden":!0}),t[11]=u):u=t[11];let d;t[12]===n?d=t[13]:(d=(0,Q.jsx)(y,{className:`inline-flex size-9 items-center justify-center rounded-lg text-fg-muted hover:bg-surface-hover focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,"aria-label":n,children:u}),t[12]=n,t[13]=d);let f;t[14]!==l||t[15]!==d?(f=(0,Q.jsxs)(`header`,{className:`flex shrink-0 items-center justify-between border-b border-edge-subtle px-4 py-2`,children:[l,d]}),t[14]=l,t[15]=d,t[16]=f):f=t[16];let p;t[17]!==r||t[18]!==a?(p=e=>{r(!1),a.onSelect(e)},t[17]=r,t[18]=a,t[19]=p):p=t[19];let m;t[20]!==a||t[21]!==p?(m=(0,Q.jsx)(cn,{...a,onSelect:p}),t[20]=a,t[21]=p,t[22]=m):m=t[22];let h;t[23]!==c||t[24]!==f||t[25]!==m?(h=(0,Q.jsxs)(b,{children:[s,(0,Q.jsxs)(x,{"aria-describedby":void 0,onCloseAutoFocus:c,className:`fixed top-1/2 left-1/2 z-[151] flex h-[min(24rem,calc(100dvh-2rem))] w-[min(26rem,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 shadow-popover`,children:[f,m]})]}),t[23]=c,t[24]=f,t[25]=m,t[26]=h):h=t[26];let _;return t[27]!==r||t[28]!==i||t[29]!==h?(_=(0,Q.jsx)(C,{open:i,onOpenChange:r,children:h}),t[27]=r,t[28]=i,t[29]=h,t[30]=_):_=t[30],_}function fn({noteId:e,note:t,catalyzing:n,onCatalyze:r,onClose:i,noteThreads:a,openingChat:o,onOpenChat:c,onOpenNewChat:l}){let u=h(f(e=>e.language)).notes,d=s(),p=t?.aiDeep?.catalysis,m=p?.report??null,[g,_]=(0,Z.useState)(null),[v,y]=(0,Z.useState)(!1),{data:b,mutate:x,isLoading:S}=et(e?[`note-agent-context-status`,e]:null,()=>K(e),{revalidateOnFocus:!1}),C=(0,Z.useCallback)(async()=>{if(!v){y(!0),_(null);try{await x(()=>Me(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,Z.useCallback)(async t=>{try{await G(e,t)}catch{}},[e]);return(0,Q.jsxs)(`div`,{className:`flex h-full flex-col`,children:[(0,Q.jsxs)(`div`,{className:`flex items-center justify-between border-b border-edge-subtle px-4 py-3`,children:[(0,Q.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,Q.jsx)(He,{className:`size-4 text-accent`,"aria-hidden":!0}),(0,Q.jsx)(`span`,{className:`text-sm font-semibold text-fg`,children:u.catalysisSectionTitle})]}),(0,Q.jsx)(`button`,{type:`button`,onClick:i,"aria-label":u.lightboxClose,className:`rounded-lg p-1.5 text-fg-muted transition-colors hover:bg-surface-hover hover:text-fg`,children:(0,Q.jsx)(T,{className:`size-4 rotate-180`,"aria-hidden":!0})})]}),(0,Q.jsxs)(`div`,{className:`flex-1 overflow-y-auto p-4`,children:[(0,Q.jsx)(`p`,{className:`mb-4 text-xs leading-relaxed text-fg-muted`,children:u.catalysisSectionDescription}),b?(0,Q.jsxs)(`section`,{className:`mb-4 rounded-xl bg-surface-base p-3`,children:[(0,Q.jsxs)(`div`,{className:`flex items-center justify-between gap-2`,children:[(0,Q.jsx)(`div`,{className:`text-xs font-medium text-fg-muted`,children:u.contextStatusTitle}),(0,Q.jsx)(`button`,{type:`button`,onClick:()=>void 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,Q.jsx)(`span`,{className:Je(`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,Q.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,Q.jsx)(`p`,{className:`mt-3 rounded-lg border border-danger/25 bg-danger-soft px-3 py-2 text-xs text-danger`,role:`alert`,children:g}):null,b.attachments.length>0?(0,Q.jsx)(`div`,{className:`mt-3 space-y-1.5`,children:b.attachments.slice(0,5).map(e=>(0,Q.jsxs)(`div`,{className:`flex items-center justify-between gap-2 rounded-lg bg-surface-hover px-2 py-1.5 text-xs`,children:[(0,Q.jsx)(`span`,{className:`min-w-0 truncate text-fg`,children:e.fileName}),(0,Q.jsx)(`span`,{className:`shrink-0 text-fg-muted`,children:e.status})]},e.attachmentId))}):null]}):null,(0,Q.jsx)(`button`,{type:`button`,onClick:r,disabled:n,className:`w-full rounded-lg bg-accent px-2.5 py-1.5 text-xs font-medium text-on-accent transition-colors hover:bg-accent/90 disabled:cursor-not-allowed disabled:opacity-50`,children:n?u.processing:m?u.recatalyze:u.catalyzeAction}),m?(0,Q.jsxs)(`div`,{className:`mt-4 space-y-4`,children:[(0,Q.jsxs)(`div`,{children:[(0,Q.jsx)(`div`,{className:`text-xs font-medium text-fg-muted`,children:u.valueHypothesis}),(0,Q.jsx)(`p`,{className:`mt-1 text-sm leading-relaxed text-fg`,children:m.valueHypothesis})]}),(0,Q.jsxs)(`div`,{children:[(0,Q.jsx)(`div`,{className:`text-xs font-medium text-fg-muted`,children:u.targetUsers}),(0,Q.jsx)(`div`,{className:`mt-1 flex flex-wrap gap-1.5`,children:m.targetUsers.slice(0,5).map(e=>(0,Q.jsx)(`span`,{className:`rounded-full bg-surface-hover px-2 py-0.5 text-xs text-fg`,children:e},e))})]}),(0,Q.jsxs)(`div`,{children:[(0,Q.jsx)(`div`,{className:`text-xs font-medium text-fg-muted`,children:u.keyQuestions}),(0,Q.jsx)(`ul`,{className:`mt-1 space-y-1 text-sm leading-relaxed text-fg`,children:m.keyQuestions.slice(0,3).map(e=>(0,Q.jsxs)(`li`,{className:`flex gap-2`,children:[(0,Q.jsx)(`span`,{className:`mt-2 size-1 shrink-0 rounded-full bg-accent`}),(0,Q.jsx)(`span`,{children:e})]},e))})]}),(0,Q.jsxs)(`div`,{children:[(0,Q.jsx)(`div`,{className:`text-xs font-medium text-fg-muted`,children:u.mvpPathLabel}),(0,Q.jsx)(`ol`,{className:`mt-1 space-y-1 text-sm leading-relaxed text-fg`,children:m.mvpPath.slice(0,3).map((e,t)=>(0,Q.jsxs)(`li`,{className:`flex gap-2`,children:[(0,Q.jsxs)(`span`,{className:`text-fg-muted`,children:[t+1,`.`]}),(0,Q.jsx)(`span`,{children:e})]},e))})]}),(0,Q.jsxs)(`div`,{children:[(0,Q.jsx)(`div`,{className:`text-xs font-medium text-fg-muted`,children:u.risks}),(0,Q.jsx)(`ul`,{className:`mt-1 space-y-1 text-sm leading-relaxed text-fg`,children:m.risks.slice(0,3).map(e=>(0,Q.jsxs)(`li`,{className:`flex gap-2`,children:[(0,Q.jsx)(`span`,{className:`mt-2 size-1 shrink-0 rounded-full bg-fg-muted`}),(0,Q.jsx)(`span`,{children:e})]},e))})]}),(0,Q.jsxs)(`div`,{children:[(0,Q.jsx)(`div`,{className:`text-xs font-medium text-fg-muted`,children:u.nextActions}),(0,Q.jsx)(`ul`,{className:`mt-1 space-y-1 text-sm leading-relaxed text-fg`,children:m.nextActions.slice(0,4).map(e=>(0,Q.jsxs)(`li`,{className:`flex gap-2`,children:[(0,Q.jsx)(`span`,{className:`rounded bg-accent/10 px-1.5 py-0.5 text-[10px] uppercase tracking-wide text-accent`,children:e.kind}),(0,Q.jsx)(`span`,{children:e.text})]},`${e.kind}:${e.text}`))})]}),(0,Q.jsxs)(`div`,{className:`flex items-center justify-between border-t border-edge-subtle pt-3`,children:[(0,Q.jsx)(`span`,{className:`text-xs text-fg-muted`,children:u.confidenceLabel.replace(`{{percent}}`,String(Math.round(m.confidence*100)))}),(0,Q.jsxs)(`div`,{className:`flex items-center gap-1`,children:[(0,Q.jsx)(`button`,{type:`button`,onClick:()=>void w(`helpful`),className:Je(`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,Q.jsx)(O,{className:`size-3.5`,"aria-hidden":!0})}),(0,Q.jsx)(`button`,{type:`button`,onClick:()=>void w(`not_helpful`),className:Je(`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,Q.jsx)(E,{className:`size-3.5`,"aria-hidden":!0})})]})]})]}):(0,Q.jsx)(`div`,{className:`mt-4 rounded-lg border border-dashed border-edge-subtle px-3 py-6 text-center text-sm text-fg-muted`,children:u.noCatalysisReportHint}),(0,Q.jsxs)(`section`,{className:`mt-6 rounded-xl bg-surface-base p-4`,children:[(0,Q.jsxs)(`div`,{className:`mb-3 flex items-center justify-between gap-3`,children:[(0,Q.jsxs)(`div`,{children:[(0,Q.jsxs)(`div`,{className:`flex items-center gap-2 text-sm font-semibold text-fg`,children:[(0,Q.jsx)(Fe,{className:`size-4 text-accent`,"aria-hidden":!0}),u.relatedThreadsTitle]}),(0,Q.jsx)(`p`,{className:`mt-1 text-xs text-fg-muted`,children:u.relatedThreadsDescription})]}),(0,Q.jsxs)(`div`,{className:`flex shrink-0 items-center gap-1.5`,children:[(0,Q.jsx)(`button`,{type:`button`,onClick:c,disabled: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,Q.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,Q.jsx)(`div`,{className:`space-y-2`,children:a.slice(0,5).map(e=>(0,Q.jsxs)(`button`,{type:`button`,onClick:()=>d(`/chat/${encodeURIComponent(e.key)}`),className:`w-full rounded-lg border border-edge-subtle px-3 py-2 text-left transition-colors hover:bg-surface-hover`,children:[(0,Q.jsx)(`div`,{className:`truncate text-sm font-medium text-fg`,children:e.name||u.noteDiscussionFallback}),(0,Q.jsx)(`div`,{className:`mt-0.5 text-xs text-fg-muted`,children:u.messageCount.replace(`{{count}}`,String(e.messageCount??0))})]},e.key))}):(0,Q.jsx)(`div`,{className:`rounded-lg border border-dashed border-edge-subtle px-3 py-5 text-center text-sm text-fg-muted`,children:u.noThreads})]})]})]})}var pn=[{value:`86400000`,zh:`24 小时`,en:`24 hours`},{value:`604800000`,zh:`7 天`,en:`7 days`},{value:`2592000000`,zh:`30 天`,en:`30 days`}];function mn({open:e,onOpenChange:t,note:n}){let r=f(e=>e.language)===`zh`,i=r?vn:yn,{data:a,mutate:o}=et(e?[`note-shares`,n.id]:null,()=>De(n.id)),s=et(e?`hosted-share-auth-status`:null,ft),c=s.data===!0,l=et(e&&c?`hosted-publication-capabilities`:null,mt),u=l.data?.publishing.allowed===!0,d=et(e&&c?[`hosted-note-publications`,n.id]:null,()=>we(n.id)),[p,m]=(0,Z.useState)(new Set),[h,_]=(0,Z.useState)(`86400000`),[w,T]=(0,Z.useState)(``),[E,D]=(0,Z.useState)(``),[O,k]=(0,Z.useState)(`hosted`),[A,j]=(0,Z.useState)(!1),[M,N]=(0,Z.useState)(null),[P,F]=(0,Z.useState)(null),[I,L]=(0,Z.useState)(!1),[R,z]=(0,Z.useState)(null),ee=(0,Z.useMemo)(()=>{let e=new Set;return n.markdown.replace(/xopc-attachment:\/\/notes\/([^/]+)\/([^\s)]+)/gi,(t,r,i)=>{try{decodeURIComponent(r)===n.id&&e.add(decodeURIComponent(i))}catch{}return t}),(n.attachments??[]).filter(t=>e.has(t.id))},[n.attachments,n.id,n.markdown]);(0,Z.useEffect)(()=>{e&&(m(new Set(ee.map(e=>e.id))),F(null),L(!1),z(null))},[e,ee]);let te=async()=>{j(!0),z(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 ke(n.id,e);F(t.shareUrl),await d.mutate()}else{let t=await Se(n.id,e);F(t.payload.shareUrl),await o()}}catch(e){z(e instanceof Error?e.message:String(e))}finally{j(!1)}},B=async(e,t)=>{N(e.id),z(null);try{t===`refresh`?await he(n.id,e.id,{expectedNoteVersion:n.updatedAt,attachmentIds:[...p]}):await ht(e.id),await d.mutate()}catch(e){z(e instanceof Error?e.message:String(e))}finally{N(null)}},ne=async(e,t)=>{N(e.id),z(null);try{t===`refresh`?await q(n.id,e.id,{expectedNoteVersion:n.updatedAt,attachmentIds:[...p]}):t===`extend`?await pt(e.id,864e5):await dt(e.id),await o()}catch(e){z(e instanceof Error?e.message:String(e))}finally{N(null)}},V=async e=>{z(null);try{if(!await Y(e)){L(!1),z(i.copyFailed);return}L(!0),window.setTimeout(()=>L(!1),1500)}catch{L(!1),z(i.copyFailed)}};return(0,Q.jsx)(C,{open:e,onOpenChange:t,children:(0,Q.jsxs)(b,{children:[(0,Q.jsx)(g,{className:`xopc-dialog-overlay fixed inset-0 z-[70] bg-scrim backdrop-blur-[2px]`}),(0,Q.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,Q.jsxs)(`div`,{className:`flex shrink-0 items-start justify-between border-b border-edge px-5 py-4`,children:[(0,Q.jsxs)(`div`,{children:[(0,Q.jsxs)(S,{className:`flex items-center gap-2 text-base font-semibold text-fg`,children:[(0,Q.jsx)(Be,{className:`size-4`}),i.title]}),(0,Q.jsx)(v,{className:`mt-1 text-xs text-fg-muted`,children:i.description})]}),(0,Q.jsx)(y,{asChild:!0,children:(0,Q.jsx)(`button`,{type:`button`,className:`rounded-md p-1.5 text-fg-muted hover:bg-surface-hover`,"aria-label":i.close,children:(0,Q.jsx)(qe,{className:`size-4`})})})]}),(0,Q.jsxs)(`div`,{className:`min-h-0 flex-1 overflow-y-auto p-5`,children:[(0,Q.jsxs)(`section`,{className:`rounded-lg border border-edge bg-surface-inset p-4`,children:[(0,Q.jsx)(`div`,{className:`text-sm font-semibold text-fg`,children:n.title||i.untitled}),(0,Q.jsx)(`p`,{className:`mt-2 line-clamp-4 whitespace-pre-wrap text-xs leading-5 text-fg-muted`,children:n.markdown||i.empty}),(0,Q.jsx)(`p`,{className:`mt-3 text-xs text-fg-subtle`,children:i.privateExcluded})]}),ee.length>0?(0,Q.jsxs)(`section`,{className:`mt-5`,children:[(0,Q.jsx)(`h3`,{className:`text-sm font-medium text-fg`,children:i.attachments}),(0,Q.jsx)(`div`,{className:`mt-2 grid gap-2`,children:ee.map(e=>(0,Q.jsxs)(`label`,{className:`flex items-center gap-3 rounded-lg border border-edge-subtle px-3 py-2 text-sm text-fg-muted`,children:[(0,Q.jsx)(`input`,{type:`checkbox`,checked: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,Q.jsx)(`span`,{className:`min-w-0 flex-1 truncate`,children:e.fileName}),(0,Q.jsx)(`span`,{className:`text-xs text-fg-subtle`,children:_n(e.size)})]},e.id))})]}):null,(0,Q.jsxs)(`section`,{className:`mt-5 grid gap-4 sm:grid-cols-2`,children:[(0,Q.jsxs)(`label`,{className:`grid gap-1.5 text-xs text-fg-muted sm:col-span-2`,children:[i.delivery,(0,Q.jsxs)(se,{value:O,onChange:e=>k(e.target.value),children:[(0,Q.jsx)(U,{value:`hosted`,children:i.deliveryHosted}),(0,Q.jsx)(U,{value:`local`,children:i.deliveryLocal})]})]}),O===`hosted`&&s.data===!1?(0,Q.jsx)(`div`,{className:`sm:col-span-2`,children:(0,Q.jsx)(St,{providerId:`xopc-share`,displayName:`XOPC Hosted Share`,connected:!1,onConnected:()=>void s.mutate(!0,{revalidate:!1})})}):null,O===`hosted`&&c&&l.data&&!u?(0,Q.jsx)(`p`,{className:`rounded-lg border border-warning/30 bg-warning-soft px-3 py-2 text-xs text-warning sm:col-span-2`,children:i.hostedDisabled}):null,(0,Q.jsxs)(`label`,{className:`grid gap-1.5 text-xs text-fg-muted`,children:[i.expires,(0,Q.jsx)(se,{value:h,onChange:e=>_(e.target.value),children:pn.map(e=>(0,Q.jsx)(U,{value:e.value,children:r?e.zh:e.en},e.value))})]}),(0,Q.jsxs)(`label`,{className:`grid gap-1.5 text-xs text-fg-muted`,children:[i.maxViews,(0,Q.jsx)(`input`,{type:`number`,min:1,max:1e3,value: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,Q.jsxs)(`label`,{className:`grid gap-1.5 text-xs text-fg-muted sm:col-span-2`,children:[i.publicDescription,(0,Q.jsx)(`input`,{value: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,Q.jsx)(`div`,{className:`mt-5 rounded-lg border border-success/25 bg-success-soft p-3`,children:(0,Q.jsxs)(`div`,{className:`flex gap-2`,children:[(0,Q.jsx)(`input`,{readOnly:!0,value:P,className:`min-w-0 flex-1 bg-transparent text-xs text-fg outline-none`}),(0,Q.jsxs)(J,{type:`button`,className:`px-2 py-1 text-xs`,variant:`ghost`,onClick:()=>void V(P),children:[I?(0,Q.jsx)(ae,{className:`size-4`}):(0,Q.jsx)(le,{className:`size-4`}),I?i.copied:i.copy]}),(0,Q.jsxs)(J,{type:`button`,className:`px-2 py-1 text-xs`,variant:`ghost`,onClick:()=>window.open(P,`_blank`,`noopener,noreferrer`),children:[(0,Q.jsx)(fe,{className:`size-4`}),i.open]})]})}):null,R?(0,Q.jsx)(`p`,{className:`mt-4 rounded-lg border border-danger/25 bg-danger-soft px-3 py-2 text-sm text-danger`,children:R}):null,(a?.items.length??0)>0?(0,Q.jsxs)(`section`,{className:`mt-6 border-t border-edge pt-5`,children:[(0,Q.jsx)(`h3`,{className:`text-sm font-medium text-fg`,children:i.activeLinks}),(0,Q.jsx)(`div`,{className:`mt-2 grid gap-2`,children:a.items.map(e=>(0,Q.jsx)(gn,{share:e,busy:M===e.id,t:i,onCopy:V,onAction:ne},e.id))})]}):null,(d.data?.length??0)>0?(0,Q.jsxs)(`section`,{className:`mt-6 border-t border-edge pt-5`,children:[(0,Q.jsx)(`h3`,{className:`text-sm font-medium text-fg`,children:i.hostedLinks}),(0,Q.jsx)(`div`,{className:`mt-2 grid gap-2`,children:d.data.map(e=>(0,Q.jsx)(hn,{publication:e,stale:e.source?.version!==String(n.updatedAt),busy:M===e.id,publishingAllowed:u,t:i,onCopy:V,onAction:B},e.id))})]}):null]}),(0,Q.jsxs)(`div`,{className:`flex shrink-0 items-center justify-end gap-2 border-t border-edge px-5 py-3`,children:[(0,Q.jsx)(y,{asChild:!0,children:(0,Q.jsx)(J,{type:`button`,variant:`ghost`,children:i.close})}),(0,Q.jsxs)(J,{type:`button`,onClick:()=>void te(),disabled:A||O===`hosted`&&(!c||!u),children:[A?(0,Q.jsx)(Ne,{className:`size-4 animate-spin`}):(0,Q.jsx)(Be,{className:`size-4`}),A?i.creating:i.create]})]})]})]})})}function hn(e){let t=(0,Dt.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=Je(`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,Q.jsx)(`span`,{children:f}),t[2]=f,t[3]=p);let m;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(m=(0,Q.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,Q.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,Q.jsx)(`span`,{children:`·`}),t[9]=_):_=t[9];let v;t[10]!==n.revision||t[11]!==o.revision?(v=(0,Q.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,Q.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,Q.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,Q.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,Q.jsx)(Ne,{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,Q.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,Q.jsx)(le,{className:`size-3.5`}),t[30]=E):E=t[30];let D;t[31]!==o.copy||t[32]!==w||t[33]!==T?(D=(0,Q.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,Q.jsx)(fe,{className:`size-3.5`}),t[37]=A):A=t[37];let j;t[38]!==o.open||t[39]!==O||t[40]!==k?(j=(0,Q.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,Q.jsxs)(J,{className:`px-2 py-1 text-xs`,variant:`ghost`,disabled:i||!a,onClick:()=>void c(n,`refresh`),children:[(0,Q.jsx)(Re,{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,Q.jsxs)(J,{className:`px-2 py-1 text-xs`,variant:`ghost`,disabled:i,onClick:()=>void c(n,`revoke`),children:[(0,Q.jsx)(Ge,{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,Q.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,Q.jsxs)(`div`,{className:d,children:[C,P]}),t[60]=C,t[61]=d,t[62]=P,t[63]=F):F=t[63],F}function gn(e){let t=(0,Dt.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=Je(`rounded-lg border border-edge-subtle p-3`,c),t[0]=c,t[1]=l);let u=n.stale&&!s?i.stale:s?i.inactive:i.active,d;t[2]===u?d=t[3]:(d=(0,Q.jsx)(`span`,{children:u}),t[2]=u,t[3]=d);let f;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(f=(0,Q.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,Q.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,Q.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,Q.jsx)(`span`,{children:g}),t[12]=g,t[13]=_);let v;t[14]!==_||t[15]!==d||t[16]!==m?(v=(0,Q.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,Q.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,Q.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,Q.jsx)(Ne,{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,Q.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,Q.jsx)(le,{className:`size-3.5`}),t[31]=w):w=t[31];let T;t[32]!==i.copy||t[33]!==C?(T=(0,Q.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,Q.jsx)(fe,{className:`size-3.5`}),t[37]=D):D=t[37];let O;t[38]!==i.open||t[39]!==E?(O=(0,Q.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,Q.jsxs)(J,{className:`px-2 py-1 text-xs`,variant:`ghost`,disabled:r,onClick:()=>void o(n,`refresh`),children:[(0,Q.jsx)(Re,{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,Q.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,Q.jsxs)(J,{className:`px-2 py-1 text-xs`,variant:`ghost`,disabled:r,onClick:()=>void o(n,`revoke`),children:[(0,Q.jsx)(Ge,{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,Q.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,Q.jsxs)(`div`,{className:l,children:[S,M]}),t[64]=S,t[65]=l,t[66]=M,t[67]=N):N=t[67],N}function _n(e){return e<1024?`${e} B`:e<1048576?`${(e/1024).toFixed(1)} KB`:`${(e/1048576).toFixed(1)} MB`}var vn={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:`撤销`},yn={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`},bn=e(n(),1);function xn({noteId:e,selection:t,zh:n,onDismiss:r,onAsk:i}){let[a,o]=(0,Z.useState)(null),[s,c]=(0,Z.useState)(!1),[l,d]=(0,Z.useState)(``),[f,m]=(0,Z.useState)(!1),h=(0,Z.useRef)(null),g=(0,Z.useRef)(null),[_,v]=(0,Z.useState)({left:8,top:8}),y=s||a!==null||!!l,b=t.text.length>16e3;function x(){h.current?.abort(),r(),t.restore()}(0,Z.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,Z.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
3
|
|
|
4
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,bn.createPortal)((0,Q.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,Q.jsxs)(`div`,{role:`group`,"aria-label":n?`选段操作`:`Selection actions`,className:`flex shrink-0 flex-wrap items-center gap-1 p-1`,children:[(0,Q.jsx)(J,{variant:`ghost`,className:`text-xs`,disabled:s||b,onClick:()=>void S(`summary`),children:n?`摘要预览`:`Summary`}),(0,Q.jsx)(J,{variant:`ghost`,className:`text-xs`,disabled:s||b,onClick:()=>void S(`todo`),children:n?`提取待办`:`Extract to-dos`}),(0,Q.jsx)(J,{variant:`ghost`,className:`text-xs`,disabled:s||b,onClick:()=>i(t.text),children:n?`引用提问`:`Ask about selection`}),(0,Q.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,Q.jsx)(qe,{className:`size-4`})})]}),b?(0,Q.jsx)(`p`,{className:`px-3 pb-3 text-xs text-fg-muted`,children:n?`请选择不超过 16000 字的片段。`:`Select up to 16,000 characters.`}):null,y?(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsxs)(`div`,{className:`min-h-0 flex-1 overflow-y-auto border-t border-edge-subtle p-3`,children:[(0,Q.jsx)(`p`,{className:`mb-3 text-xs text-fg-muted`,children:n?`按选段生成的本地整理预览,尚未写入笔记。`:`Local preview of the selection. Your note is unchanged.`}),s?(0,Q.jsxs)(`div`,{"aria-busy":`true`,className:`space-y-2`,children:[(0,Q.jsx)(Ye,{className:`h-4 w-full`}),(0,Q.jsx)(Ye,{className:`h-4 w-2/3`})]}):null,a===null?null:(0,Q.jsx)(`pre`,{className:`whitespace-pre-wrap break-words font-sans text-sm leading-6`,children:a}),l?(0,Q.jsx)(`p`,{role:`alert`,className:`text-xs text-danger`,children:l}):null]}),a===null?null:(0,Q.jsxs)(`div`,{className:`flex shrink-0 justify-end gap-2 border-t border-edge-subtle p-2`,children:[(0,Q.jsx)(J,{variant:`ghost`,onClick:()=>void Y(a).then(e=>{m(e),e||d(n?`复制失败,请重试。`:`Copy failed. Try again.`)}),children:f?n?`已复制`:`Copied`:n?`复制结果`:`Copy`}),(0,Q.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 Sn(e){let t=(0,Dt.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=Xe(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=Xe(u),f=Xe(Cn),p;t[6]!==n||t[7]!==r||t[8]!==d||t[9]!==a?(p=(0,Q.jsx)(D,{input:n,labels:r,disabled:d,showLabel:a}),t[6]=n,t[7]=r,t[8]=d,t[9]=a,t[10]=p):p=t[10];let m;t[11]!==l||t[12]!==r||t[13]!==f?(m=l?(0,Q.jsx)(`button`,{type:`button`,onClick:f,title:r.stop,"aria-label":r.stop,className:`inline-flex size-8 items-center justify-center rounded-lg text-fg-muted hover:bg-surface-hover hover:text-fg focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,children:(0,Q.jsx)(We,{className:`size-3.5`,"aria-hidden":!0})}):null,t[11]=l,t[12]=r,t[13]=f,t[14]=m):m=t[14];let h;return t[15]!==p||t[16]!==m?(h=(0,Q.jsxs)(`div`,{className:`flex items-center gap-1`,children:[p,m]}),t[15]=p,t[16]=m,t[17]=h):h=t[17],h}function Cn(e){return e.stop}function wn(e,t){let n=Ze(t.replace(/^\s*(`{3,}|~{3,})[^\n]*$/gm,``).replace(/xopc-attachment:\/\/[^\s)]+/g,``).replace(/^(\s*[-*+]\s+)\[[ xX]\]\s*/gm,`$1`)),r=Ze(e);return!r||n.split(`
|
|
5
5
|
`)[0]===r?n:[r,n].filter(Boolean).join(`
|
|
6
6
|
|
|
7
|
-
`)}var Tn=()=>a(()=>import(`./block-editor-DXjBAN8L.js`),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47])),En=()=>a(()=>import(`./markdown-editor-CjQJ-Nho.js`),__vite__mapDeps([48,1,2,43,49,18])),Dn=(0,Z.lazy)(()=>a(()=>import(`./chat-page-Bn44NcvF.js`).then(e=>e.n).then(e=>({default:e.ChatPage})),__vite__mapDeps([50,1,16,2,18,17,3,4,11,12,13,6,51,52,53,54,55,56,57,58,59,60,61,9,34,62,36,38,63,64,65,66,67,68,22,23,69,26,70,25,71,72,73,74,75,76,77,78,45,79,80,81,40,82,83,84,7,85,86,87,88,89,90,91,92,32,93,94,41,95,96,97,98,99,100,101,8,102,14,103,104,19,105,106,107,108,109,110,111,112,10,15,20,21,24,27,28,29,30,31,113,114,115,116,33,117,35,118,119,120,121,122,123,124,125,126,127,128,129,130,131,132,37,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,42,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,203,204,205,206,207,208,209,210,211,212,213,214,215,216,217,218,219,220,221,222,223,224,225,226,227,228,229,230]))),On=(0,Z.lazy)(()=>Tn().then(e=>({default:e.BlockEditor}))),kn=(0,Z.lazy)(()=>En().then(e=>({default:e.MarkdownEditor})));function An(){let e=(0,Dt.c)(1),t;return e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,Q.jsxs)(`div`,{className:`flex h-full min-h-0 flex-col px-6 py-4`,"aria-busy":!0,children:[(0,Q.jsx)(`div`,{className:`h-8 w-56 max-w-full animate-pulse rounded-md bg-surface-hover`}),(0,Q.jsx)(`div`,{className:`mt-6 h-4 w-11/12 animate-pulse rounded bg-surface-hover`}),(0,Q.jsx)(`div`,{className:`mt-3 h-4 w-9/12 animate-pulse rounded bg-surface-hover`}),(0,Q.jsx)(`div`,{className:`mt-3 h-4 w-10/12 animate-pulse rounded bg-surface-hover`})]}),e[0]=t):t=e[0],t}function jn(e){let t=(0,Dt.c)(29),{mode:n,onModeChange:r,labels:i}=e,a;t[0]===i.edit?a=t[1]:(a={id:`wysiwyg`,label:i.edit,Icon:pe},t[0]=i.edit,t[1]=a);let o;t[2]===i.source?o=t[3]:(o={id:`source`,label:i.source,Icon:ce},t[2]=i.source,t[3]=o);let s;t[4]===i.preview?s=t[5]:(s={id:`preview`,label:i.preview,Icon:W},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=Mn,m;t[13]===f?m=t[14]:(m=(0,Q.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,Q.jsx)(`span`,{children:d.label}),t[15]=d.label,t[16]=h);let g;t[17]===Symbol.for(`react.memo_cache_sentinel`)?(g=(0,Q.jsx)(oe,{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,Q.jsx)(_t,{asChild:!0,children:(0,Q.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,Q.jsx)(vt,{children:(0,Q.jsx)(bt,{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,Q.jsxs)(yt,{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,Q.jsx)(a,{className:`size-4 text-fg-muted`,"aria-hidden":!0}),(0,Q.jsx)(`span`,{className:`flex-1`,children:i}),n===t?(0,Q.jsx)(ae,{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,Q.jsxs)(gt,{modal:!1,children:[_,v]}),t[26]=v,t[27]=_,t[28]=y):y=t[28],y}function Mn(e){e===`wysiwyg`&&Tn(),e===`source`&&En()}function Nn(e){let t=(0,Dt.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(Pn),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,Q.jsx)(Fn,{noteId:n,onBack:r,onSaved:i,showBackButton:p,backButtonClassName:o,clearHeaderOnCleanup:m,onOpenSearch:c,autoFocus:g,initialMode:u,onAutoFocusConsumed:d},n),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,Q.jsx)(_e,{closeLabel:y,children:b}),t[13]=y,t[14]=b,t[15]=x):x=t[15],x}function Pn(e){return e.language}function Fn({noteId:e,onBack:t,onSaved:n,showBackButton:r=!0,backButtonClassName:i,clearHeaderOnCleanup:a=!0,onOpenSearch:o,autoFocus:c=!1,initialMode:l=`wysiwyg`,onAutoFocusConsumed:u}){let p=f(e=>e.language),m=h(p).notes,g=h(p).chat.pageContext,{data:_}=et([`note-discussion-document`,e],()=>F(e)),[v,y]=(0,Z.useState)(!0),[b,x]=(0,Z.useState)(null),S=(0,Z.useCallback)(()=>x(null),[]);(0,Z.useEffect)(()=>{x(null)},[e]);let C=s(),w=lt(e=>e.resolved)===`dark`,{openImage:E}=ve(),[D,O]=(0,Z.useState)(l);(0,Z.useEffect)(()=>{x(null)},[D,v]);let[A,j]=(0,Z.useState)(null),[N,P]=(0,Z.useState)(null),[I,L]=(0,Z.useState)(!1),[R,z]=(0,Z.useState)(null),[ee,te]=(0,Z.useState)(!1),[B,ne]=(0,Z.useState)(null),[V,re]=(0,Z.useState)(``),[H,ie]=(0,Z.useState)(360),[oe,se]=(0,Z.useState)(!1),[U,ce]=(0,Z.useState)(!1),[le,ue]=(0,Z.useState)(!1),[fe,W]=(0,Z.useState)(!1),[he,_e]=(0,Z.useState)(null),G=(0,Z.useRef)(0),[be,Se]=(0,Z.useState)(null),we=d(e=>e.baseUrl),Te=d(e=>e.conversationId),K=he?.noteId===e&&he.gatewayUrl===we&&he.gatewayToken===Te?he.conversationId:null;(0,Z.useEffect)(()=>(G.current++,W(!1),_e(null),ue(!1),Se(null),y(!0),()=>{G.current++}),[e,we,Te]);let De=(0,Z.useRef)(0);(0,Z.useEffect)(()=>()=>{De.current+=1},[e]);let[ke,q]=(0,Z.useState)(null),[Me,Ne]=(0,Z.useState)(!1),[Pe,Ie]=(0,Z.useState)(null),[Le,Re]=(0,Z.useState)(!1),[Ve,Ue]=(0,Z.useState)(!1),We=(0,Z.useRef)(!1),Ke=(0,Z.useRef)(null),Ye=(0,Z.useRef)(null),Ze=(0,Z.useRef)(null),tt=(0,Z.useRef)(null),nt=(0,Z.useRef)(void 0),rt=(0,Z.useRef)(!1),J=(0,Z.useRef)(null),[it,at]=(0,Z.useState)(null),[ot,st]=(0,Z.useState)(!1),{headings:Y,current:dt,wide:ft,goTo:pt}=an(it),mt=Y.length>=2&&N===null&&D!==`source`&&(!_||!v),ht=mt&&ft&&!fe&&!A&&!_;(0,Z.useEffect)(()=>{(!mt||ht)&&st(!1)},[ht,mt]);let St=(0,Z.useRef)(null),Tt=(0,Z.useRef)(null),Et=(0,Z.useRef)(null),Dt=(0,Z.useRef)(null),Ot=X(e=>e.setPageHeader),kt=X(e=>e.clearPageHeader),{data:$,mutate:At,error:jt}=et(e?[`note-detail`,e]:null,()=>Ce(e)),{data:Mt=[],mutate:Nt}=et(e?[`note-threads`,e]:null,()=>Ee(e),{revalidateOnFocus:!1}),Pt=N!==null,Ft=(0,Z.useCallback)(e=>{q(`${m.refreshFailed}: ${e instanceof Error?e.message:m.quickCaptureFailedHint}`)},[m.quickCaptureFailedHint,m.refreshFailed]);(0,Z.useEffect)(()=>{if(!e)return;let t=t=>{t.detail?.noteId===e&&At().catch(Ft)};return window.addEventListener(`note-updated`,t),()=>window.removeEventListener(`note-updated`,t)},[At,e,Ft]),(0,Z.useEffect)(()=>{re(``),P(null),j(null),We.current=!1,Dt.current=null},[e]),(0,Z.useEffect)(()=>{!$||I||tt.current!==null||We.current||re($.title??``)},[$,I]);let It=(0,Z.useCallback)(t=>{Et.current=t,!(!t||!c||Dt.current===e)&&window.requestAnimationFrame(()=>{Et.current!==t||Dt.current===e||(Dt.current=e,t.focus({preventScroll:!0}),u?.())})},[c,e,u]),Lt=$?new Date($.createdAt).toLocaleString(void 0,{year:`numeric`,month:`short`,day:`numeric`,hour:`2-digit`,minute:`2-digit`}):``,Rt=(0,Z.useMemo)(()=>r?(0,Q.jsx)(`button`,{type:`button`,onClick:t,"aria-label":m.back,className:Je(`rounded-lg p-1.5 text-fg-muted transition-colors hover:bg-surface-hover hover:text-fg`,ct,i),children:(0,Q.jsx)(T,{className:`size-4`,"aria-hidden":!0})}):null,[i,m.back,t,r]),zt=(0,Z.useCallback)(()=>{let t=Xe.getState();t.source?.type===`note`&&t.source.id===e&&t.stop()},[e]),Bt=(0,Z.useCallback)(e=>{e!==D&&(e!==`preview`&&zt(),O(e))},[D,zt]);(0,Z.useEffect)(()=>{!I&&Ze.current===null&&tt.current===null&&(nt.current=$?.remoteVersion??1)},[e,$?.remoteVersion,I]);let Vt=(0,Z.useCallback)(async(t,n)=>{let r=n??nt.current??$?.remoteVersion??1,i=await ge(e,t,r);return nt.current=i.remoteVersion??r+1,i},[e,$?.remoteVersion]),Ht=(0,Z.useMemo)(()=>(0,Q.jsxs)(`div`,{className:Je(`flex min-w-0 items-center gap-2`,ct),children:[(0,Q.jsx)(`span`,{className:`min-w-0 truncate text-sm font-medium text-fg`,title:V||Lt||void 0,children:V||Lt}),(0,Q.jsx)(`span`,{role:`status`,className:`shrink-0 text-xs text-fg-muted`,children:I?m.saving:null})]}),[m.saving,I,Lt,V]),Ut=(0,Z.useCallback)(async()=>{ce(!0),q(null);try{await Oe(e),await At()}catch(e){q(`${m.catalysisFailed}: ${e instanceof Error?e.message:m.chatOpenFailedMessage}`)}finally{ce(!1)}},[At,e]),Wt=(0,Z.useCallback)(()=>{W(!1),j(A===`breakdown`?null:`breakdown`),!$?.aiDeep?.catalysis?.report&&!U&&Ut()},[A,U,Ut,$?.aiDeep?.catalysis?.report]),Gt=(0,Z.useCallback)(()=>{let t=N?N.markdown??``:Ze.current??$?.markdown??``,n=N?N.title??``:V,r=wn(n,t);return{source:{type:`note`,id:e,title:n||m.titlePlaceholder},text:r,language:Qe(r,p)}},[p,m.titlePlaceholder,$?.markdown,e,N,V]),Kt=(0,Z.useCallback)(async e=>{for(Ke.current&&clearTimeout(Ke.current),Ke.current=null;Ye.current;){let e=await Ye.current;if(!e||Ze.current===null&&tt.current===null)return e}if(rt.current&&e===void 0)return null;let t=Ze.current,r=We.current?null:tt.current,i={};if(t!==null&&(i.markdown=t),r!==null&&(i.title=r),t===null&&r===null)return $??null;L(!0),z(null);let a=Vt(i,e).then(async e=>(await At(e,{revalidate:!1}),rt.current=!1,Ze.current===t&&(Ze.current=null),tt.current===r&&(tt.current=null),n?.(),e)).catch(e=>(e instanceof Error&&`status`in e&&e.status===409?(rt.current=!0,z(m.saveConflict)):z(`${m.saveFailed}: ${e instanceof Error?e.message:m.saveFailedHint}`),null)).finally(()=>{Ye.current=null,L(!1)});return Ye.current=a,a},[At,m.saveConflict,m.saveFailed,m.saveFailedHint,$,n,Vt]),qt=async()=>{te(!0);try{let t=await Ce(e);if(!t)throw Error(m.saveConflictMissing);ne(t),z(m.saveConflict)}catch(e){z(`${m.saveFailed}: ${e instanceof Error?e.message:m.saveFailedHint}`)}finally{te(!1)}},Jt=(0,Z.useRef)(Kt);Jt.current=Kt;let Yt=(0,Z.useCallback)(()=>{Ke.current&&clearTimeout(Ke.current),Ke.current=setTimeout(()=>void Jt.current(),600)},[]),Xt=(0,Z.useCallback)(e=>{zt(),re(e),tt.current=e,We.current||Yt()},[Yt,zt]),Zt=()=>{We.current=!1,tt.current!==null&&Yt()},$t=(0,Z.useCallback)(e=>{zt(),Ze.current=e,Yt()},[Yt,zt]),en=(0,Z.useCallback)(async()=>I?(q(p===`zh`?`笔记正在保存,请稍后发送。`:`The note is saving. Please send again shortly.`),!1):!!await Kt()&&Ze.current===null&&tt.current===null,[I,p,Kt]),nn=(0,Z.useCallback)(async(t=!1)=>{if(j(null),W(!0),le||!t&&K)return;let n=++G.current;ue(!0),q(null);try{if(!await en())return;let r=await xe(e,{forceNew:t});if(n!==G.current)return;_e({noteId:e,gatewayUrl:we,gatewayToken:Te,conversationId:r.conversationId}),await At(),await Nt()}catch(e){n===G.current&&q(`${m.chatOpenFailedTitle}: ${e instanceof Error?e.message:m.chatOpenFailedMessage}`)}finally{n===G.current&&ue(!1)}},[le,K,en,At,Nt,e,we,Te,m.chatOpenFailedMessage,m.chatOpenFailedTitle]),rn=(0,Z.useCallback)(async e=>{if(!$||le||I)return;ue(!0),q(null);let t=d.getState(),n=++De.current,r=()=>De.current===n&&d.getState().baseUrl===t.baseUrl&&d.getState().conversationId===t.conversationId;try{let n=window.getSelection(),i=e??(n?.anchorNode&&n.focusNode&&J.current?.contains(n.anchorNode)&&J.current.contains(n.focusNode)?n.toString():``),a=await Kt();if(!a||!r())return;if(Ze.current!==null||tt.current!==null)throw Error(g.unavailable);let o=Ct.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 $e().createSession();if(!r())return;if(Ze.current!==null||tt.current!==null)throw Error(g.unavailable);let c=wt(t.baseUrl,t.conversationId,s.key);if(!Ct.put(c,o))throw Error(g.unavailable);C(`/chat/${encodeURIComponent(s.key)}`)}catch{r()&&q(g.unavailable)}finally{De.current===n&&ue(!1)}},[$,le,I,Kt,C,g.unavailable]),on=(0,Z.useCallback)(async()=>{q(null);let e=await Kt();e&&(Ie(e),Ne(!0))},[Kt]),sn=(0,Z.useCallback)(async()=>{if(!(Ve||I)){Re(!1),Ue(!0),q(null),zt(),Ke.current&&clearTimeout(Ke.current),Ke.current=null,Ze.current=null,tt.current=null;try{await Ae(e),window.dispatchEvent(new CustomEvent(`note-deleted`,{detail:{noteId:e}})),n?.(),t()}catch(e){q(`${m.deleteFailed}: ${e instanceof Error?e.message:m.quickCaptureFailedHint}`)}finally{Ue(!1)}}},[Ve,m.deleteFailed,m.quickCaptureFailedHint,e,t,n,I,zt]),cn=e=>{if(it?.clientWidth===0){W(!1),j(null),window.requestAnimationFrame(()=>pt(e));return}pt(e)},ln=(0,Z.useMemo)(()=>(0,Q.jsxs)(`div`,{className:Je(`flex min-w-0 items-center gap-1 sm:gap-2`,ct),children:[o?(0,Q.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,Q.jsx)(ze,{className:`size-4`,"aria-hidden":!0})}):null,(0,Q.jsx)(Sn,{input:Gt,showLabel:!1,labels:{read:m.readAloud,preparing:m.readAloudPreparing,pause:m.readAloudPause,resume:m.readAloudResume,retry:m.readAloudRetry,stop:m.readAloudStop}}),(0,Q.jsx)(`button`,{type:`button`,onClick:()=>{fe?W(!1):nn()},"aria-label":le?m.openingChat:m.openChatButton,title:m.openChatButton,"aria-controls":fe?`note-assistant-${e}`:void 0,"aria-expanded":fe,"data-note-assistant-trigger":!0,disabled:le,className:Je(`inline-flex size-8 shrink-0 items-center justify-center rounded-lg text-fg-muted transition-colors hover:bg-surface-hover hover:text-fg focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent disabled:opacity-50`,fe&&`bg-surface-active text-fg`),children:(0,Q.jsx)(Fe,{className:`size-3.5`,"aria-hidden":!0})}),(0,Q.jsx)(jn,{mode:D,onModeChange:Bt,labels:{edit:m.modeEdit,source:m.modeSource,preview:m.modePreview}}),(0,Q.jsxs)(gt,{modal:!1,children:[(0,Q.jsx)(_t,{asChild:!0,children:(0,Q.jsx)(`button`,{type:`button`,"data-note-actions-trigger":!0,"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,Q.jsx)(de,{className:`size-4`,"aria-hidden":!0})})}),(0,Q.jsx)(vt,{children:(0,Q.jsxs)(bt,{align:`end`,sideOffset:6,className:`z-50 min-w-40 rounded-xl border border-edge bg-surface-overlay p-1 shadow-popover`,children:[mt&&!ht?(0,Q.jsxs)(yt,{onSelect:()=>st(!0),className:`flex cursor-pointer items-center gap-2 rounded-lg px-3 py-2 text-sm text-fg outline-none hover:bg-surface-hover focus:bg-surface-hover`,children:[(0,Q.jsx)(M,{className:`size-4 text-fg-muted`,"aria-hidden":!0}),m.outline]}):null,(0,Q.jsxs)(yt,{onSelect:Wt,disabled:U,className:`flex cursor-pointer items-center gap-2 rounded-lg px-3 py-2 text-sm text-fg outline-none hover:bg-surface-hover focus:bg-surface-hover data-[disabled]:opacity-50`,children:[(0,Q.jsx)(He,{className:`size-4 text-fg-muted`,"aria-hidden":!0}),U?m.catalyzing:m.catalyzeButton]}),(0,Q.jsxs)(yt,{onSelect:()=>void rn(),disabled:le||I||!$||!!N,className:`flex cursor-pointer items-center gap-2 rounded-lg px-3 py-2 text-sm text-fg outline-none hover:bg-surface-hover focus:bg-surface-hover data-[disabled]:opacity-50`,children:[(0,Q.jsx)(pe,{className:`size-4 text-fg-muted`,"aria-hidden":!0}),g.capture]}),(0,Q.jsx)(xt,{className:`my-1 h-px bg-edge-subtle`}),(0,Q.jsxs)(yt,{onSelect:()=>void on(),className:`flex cursor-pointer items-center gap-2 rounded-lg px-3 py-2 text-sm text-fg outline-none hover:bg-surface-hover focus:bg-surface-hover`,children:[(0,Q.jsx)(Be,{className:`size-4 text-fg-muted`,"aria-hidden":!0}),p===`zh`?`分享`:`Share`]}),(0,Q.jsxs)(yt,{onSelect:()=>{W(!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,Q.jsx)(me,{className:`size-4 text-fg-muted`,"aria-hidden":!0}),(0,Q.jsx)(`span`,{className:`flex-1`,children:m.history}),A===`history`?(0,Q.jsx)(ae,{className:`size-4 text-accent`,"aria-hidden":!0}):null]}),(0,Q.jsx)(xt,{className:`my-1 h-px bg-edge-subtle`}),(0,Q.jsxs)(yt,{disabled:Ve||I,onSelect:()=>Re(!0),className:`flex cursor-pointer items-center gap-2 rounded-lg px-3 py-2 text-sm text-danger outline-none hover:bg-danger-soft focus:bg-danger-soft data-[disabled]:cursor-not-allowed data-[disabled]:opacity-50`,children:[(0,Q.jsx)(Ge,{className:`size-4`,"aria-hidden":!0}),m.delete]})]})})]})]}),[U,mt,ht,m.outline,fe,e,Wt,nn,rn,g.capture,$,N,D,m.history,m.catalyzeButton,m.catalyzing,m.noteActions,m.openChatButton,m.openingChat,m.modeEdit,m.modePreview,m.modeSource,le,A,o,m.searchDialogTitle,m.readAloud,m.readAloudPause,m.readAloudPreparing,m.readAloudResume,m.readAloudRetry,m.readAloudStop,Bt,Gt,on,Ve,I,p,m.delete,Re]);(0,Z.useLayoutEffect)(()=>(Ot({startExtra:Rt,main:$&&!_?Ht:null,end:$&&!_?ln:null}),()=>{a&&kt()}),[a,kt,ln,Ht,Rt,_,v,$,Ot]);let pn=(0,Z.useCallback)(t=>{je(e,t.timestamp).then(e=>{e&&(zt(),P(e),_&&y(!1))})},[_,e,zt]),hn=(0,Z.useCallback)(()=>{zt(),j(null),P(null)},[zt]),gn=(0,Z.useCallback)(()=>{zt(),j(null),P(null),At().catch(Ft),n?.()},[At,n,Ft,zt]);if((0,Z.useEffect)(()=>()=>{Jt.current()},[]),$===void 0)return jt?(0,Q.jsxs)(`div`,{className:`flex flex-1 flex-col items-center justify-center gap-3 p-6 text-center`,role:`alert`,children:[(0,Q.jsx)(`p`,{className:`text-sm text-danger`,children:m.home.loadFailed}),(0,Q.jsx)(`button`,{type:`button`,onClick:()=>void At().catch(Ft),className:`rounded-lg border border-edge px-3 py-2 text-sm text-fg hover:bg-surface-hover`,children:m.home.retry}),(0,Q.jsx)(`button`,{type:`button`,onClick:t,className:`text-sm text-fg-muted hover:text-fg`,children:m.back})]}):(0,Q.jsx)(An,{});if($===null)return(0,Q.jsxs)(`div`,{className:`flex flex-1 flex-col items-center justify-center gap-3 text-center`,children:[(0,Q.jsx)(`div`,{className:`text-sm font-medium text-fg`,children:m.notFoundTitle}),(0,Q.jsx)(`p`,{className:`text-sm text-fg-muted`,children:m.notFoundDescription}),(0,Q.jsx)(`button`,{type:`button`,onClick:t,className:`rounded-lg border border-edge px-3 py-1.5 text-sm font-medium text-fg-muted transition-colors hover:bg-surface-hover hover:text-fg`,children:m.back})]});let _n=Pt?N.title??``:V,vn=Pt?N.markdown??``:Ze.current??$.markdown??``,yn=/^Discussion · \d{4}-\d{2}-\d{2} \d{2}:\d{2}$/.test(V)?``:V,bn=p===`zh`?`语音笔记`:`Voice note`,Cn=!v&&!Pt?(0,Q.jsx)(`input`,{ref:It,"aria-label":m.titlePlaceholder,value:yn,placeholder:bn,onChange:e=>Xt(e.target.value),onCompositionStart:()=>{We.current=!0},onCompositionEnd:Zt,className:`w-full rounded-md bg-transparent text-2xl font-semibold leading-snug tracking-tight placeholder:text-fg focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`}):null,Tn=(0,Q.jsx)(`input`,{ref:It,type:`text`,"aria-label":m.titlePlaceholder,value:V,onChange:e=>Xt(e.target.value),onCompositionStart:()=>{We.current=!0},onCompositionEnd:Zt,onKeyDown:e=>{if(e.key!==`Enter`||We.current||e.nativeEvent.isComposing)return;let t=J.current?.querySelector(`.ProseMirror, .cm-content`);t&&(e.preventDefault(),t.focus())},placeholder:m.titlePlaceholder,className:`block w-full min-w-0 rounded-md bg-transparent text-[clamp(1.75rem,4vw,2.5rem)] font-bold leading-tight tracking-tight text-fg placeholder:text-fg-muted/60 focus:outline-none`}),En=(0,Q.jsxs)(`div`,{ref:at,className:`relative flex h-full min-h-0 flex-col`,children:[ht?(0,Q.jsx)(un,{label:m.outline,headings:Y,current:dt,onSelect:cn}):null,_?(0,Q.jsxs)(`div`,{className:`flex shrink-0 flex-wrap items-center justify-between gap-x-2 border-b border-edge-subtle px-4 py-1`,children:[(0,Q.jsx)(`h3`,{className:`text-sm font-medium`,children:p===`zh`?`我的笔记`:`My notes`}),(0,Q.jsx)(jn,{mode:D,onModeChange:Bt,labels:{edit:m.modeEdit,source:m.modeSource,preview:m.modePreview}})]}):null,(0,Q.jsx)(`div`,{className:`h-full min-h-0 min-w-0 flex-1`,children:Pt?(0,Q.jsxs)(`div`,{className:`h-full overflow-y-auto px-4 py-4 sm:px-6`,children:[_n&&(0,Q.jsx)(`h1`,{className:`mb-4 text-2xl font-bold text-fg/70`,children:_n}),vn?(0,Q.jsx)(ye,{noteId:e,content:vn,className:`opacity-80`}):(0,Q.jsx)(`p`,{className:`italic text-fg-muted`,children:m.emptyPreview})]}):(0,Q.jsxs)(Q.Fragment,{children:[D===`wysiwyg`&&(0,Q.jsx)(`div`,{className:`flex h-full flex-col`,children:(0,Q.jsx)(`div`,{className:`min-h-0 flex-1`,children:(0,Q.jsx)(Z.Suspense,{fallback:(0,Q.jsx)(An,{}),children:(0,Q.jsx)(On,{autoFocus:!!_&&!v,placeholder:m.editorPlaceholder,documentHeader:_?void 0:Tn,initialContent:vn,onChange:$t,noteId:e,onTextSelection:x},`wysiwyg-${e}`)})})}),D===`source`&&(0,Q.jsxs)(`div`,{className:`flex h-full flex-col`,children:[_?null:(0,Q.jsx)(`div`,{className:`mx-auto mb-3 w-full max-w-3xl px-5 pt-6 sm:px-10 sm:pt-9`,children:Tn}),(0,Q.jsx)(`div`,{className:Je(`min-h-0 min-w-0 flex-1`,!_&&`mx-auto w-full max-w-3xl px-3 sm:px-8`),children:(0,Q.jsx)(Z.Suspense,{fallback:(0,Q.jsx)(An,{}),children:(0,Q.jsx)(kn,{initialContent:vn,onChange:$t,isDark:w,onTextSelection:x},`source-${e}`)})})]}),D===`preview`&&(0,Q.jsxs)(`div`,{"data-note-outline-scroll":!0,className:Je(`h-full overflow-y-auto px-5 py-6 sm:px-10 sm:pt-9`,!_&&`mx-auto w-full max-w-3xl`),onClick:e=>{let t=e.target;t instanceof HTMLImageElement&&E(t.currentSrc||t.src,t.alt)},children:[!_&&V&&!vn.trimStart().startsWith(`# ${V.trim()}\n`)&&vn.trim()!==`# ${V.trim()}`&&(0,Q.jsx)(`h1`,{className:`mb-5 break-words text-[clamp(1.75rem,4vw,2.5rem)] font-bold leading-tight tracking-tight text-fg`,children:V}),vn?(0,Q.jsx)(`div`,{"data-note-outline-content":!0,children:(0,Q.jsx)(ye,{noteId:e,content:vn,className:`[&_img]:cursor-zoom-in`})}):_?(0,Q.jsx)(`button`,{type:`button`,className:`min-h-11 rounded-lg px-2 text-sm text-accent-fg hover:bg-surface-hover focus-visible:ring-2 focus-visible:ring-accent`,onClick:()=>Bt(`wysiwyg`),children:p===`zh`?`写笔记`:`Write notes`}):(0,Q.jsx)(`p`,{className:`italic text-fg-muted`,children:m.emptyPreview})]})]})})]});return(0,Q.jsxs)(Q.Fragment,{children:[mt&&!ht?(0,Q.jsx)(dn,{label:m.outline,closeLabel:m.outlineClose,headings:Y,current:dt,onSelect:cn,open:ot,onOpenChange:st,returnFocus:()=>document.querySelector(`[data-note-actions-trigger]`)?.focus({preventScroll:!0})}):null,b&&!Pt&&!(_&&v)&&D!==`preview`?(0,Q.jsx)(xn,{noteId:e,selection:b,zh:p===`zh`,onDismiss:S,onAsk:e=>{Se({id:Date.now(),text:p===`zh`?`请帮我分析或改写下面这段笔记:\n\n${e}`:`Help me analyze or rewrite this note selection:\n\n${e}`}),S(),nn()}},`${e}:${D}`):null,(0,Q.jsxs)(`div`,{className:`@container/note flex h-full min-h-0 min-w-0 gap-3 p-3 sm:p-4`,children:[(0,Q.jsxs)(`div`,{className:Je(`mx-auto min-h-0 min-w-0 w-full flex-1 flex-col`,fe||A?`hidden @min-[56rem]/note:flex`:`flex`,!_&&`max-w-[60rem]`),children:[R?(0,Q.jsxs)(`div`,{className:`mb-3 flex shrink-0 items-center gap-2 rounded-lg border border-danger/25 bg-danger-soft px-3 py-2 text-sm text-danger`,children:[(0,Q.jsx)(`p`,{role:`alert`,className:`min-w-0 flex-1 break-words`,children:R}),(0,Q.jsx)(`button`,{type:`button`,className:`shrink-0 rounded-md px-2 py-1 font-medium hover:bg-surface-hover focus-visible:ring-2 focus-visible:ring-accent`,disabled:ee,onClick:()=>void(rt.current?qt():Kt()),children:rt.current?m.saveConflictReview:m.home.retry})]}):null,ke?(0,Q.jsx)(`p`,{className:`mb-3 shrink-0 rounded-lg border border-danger/25 bg-danger-soft px-3 py-2 text-sm text-danger`,role:`alert`,children:ke}):null,(0,Q.jsx)(k,{eventType:`note.created`,source:`notes`,payloadKey:`noteId`,payloadValue:e,className:`mb-3 shrink-0`}),(0,Q.jsx)(k,{eventType:`note.updated`,source:`notes`,payloadKey:`noteId`,payloadValue:e,className:`mb-3 shrink-0`}),(0,Q.jsxs)(`div`,{ref:J,onKeyDown:e=>{(e.metaKey||e.ctrlKey)&&e.key.toLowerCase()===`s`&&(e.preventDefault(),!We.current&&!e.nativeEvent.isComposing&&Kt()),b&&e.altKey&&e.key===`Enter`&&(e.preventDefault(),document.querySelector(`[data-note-selection-actions] button:not(:disabled)`)?.focus())},className:`flex min-h-0 min-w-0 flex-1 flex-col overflow-hidden rounded-xl border border-edge-subtle bg-surface-panel`,children:[_?(0,Q.jsx)(Qt,{noteId:e,noteTitle:Cn,personalNotes:En,personalNotesActive:!v,onMeetingContent:()=>{Pt&&hn(),y(!0)},onPersonalNotes:()=>{hn(),Bt(`wysiwyg`),y(!1)},noteActions:{onAnalyze:Wt,chatOpen:fe,onChat:()=>{fe?W(!1):nn(!1)},onShare:()=>{on()},onHistory:()=>{W(!1),A===`history`?hn():j(`history`)},onDelete:()=>Re(!0),onOutline:mt?()=>st(!0):void 0,busy:Ve||I||U||le}}):null,_?null:En]})]}),fe||K?(0,Q.jsxs)(`aside`,{id:`note-assistant-${e}`,"aria-label":p===`zh`?`笔记 AI 对话`:`Note AI chat`,className:Je(`min-h-0 min-w-0 shrink-0 flex-col overflow-hidden rounded-xl border border-edge-subtle bg-surface-panel`,fe?`flex w-full @min-[56rem]/note:w-[22rem] @min-[76rem]/note:w-[24rem]`:`hidden`),children:[(0,Q.jsxs)(`header`,{className:`flex shrink-0 items-center gap-2 border-b border-edge-subtle px-4 py-2`,children:[(0,Q.jsx)(Fe,{className:`size-4 text-accent-fg`,"aria-hidden":!0}),(0,Q.jsx)(`h2`,{className:`flex-1 text-sm font-medium`,children:_?p===`zh`?`问这段录音`:`Ask about this recording`:p===`zh`?`AI 对话`:`AI chat`}),(0,Q.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:()=>{W(!1),window.requestAnimationFrame(()=>document.querySelector(`[data-note-assistant-trigger], [aria-controls="note-assistant-${e}"]`)?.focus({preventScroll:!0}))},children:(0,Q.jsx)(qe,{className:`size-4`})})]}),_&&fe&&K&&_.transcript?.text?.trim()?(0,Q.jsx)(`div`,{className:`flex shrink-0 flex-wrap gap-1 border-b border-edge-subtle px-4 py-1`,children:(p===`zh`?[`最后决定了什么?`,`有哪些待跟进事项?`]:[`What was decided?`,`What needs follow-up?`]).map(e=>(0,Q.jsx)(`button`,{type:`button`,className:`min-h-11 rounded-lg px-2 text-xs text-fg-muted hover:bg-surface-hover focus-visible:ring-2 focus-visible:ring-accent`,onClick:()=>Se({id:Date.now(),text:e}),children:e},e))}):null,ke&&K?(0,Q.jsx)(`p`,{role:`alert`,className:`shrink-0 px-4 py-2 text-xs text-danger`,children:ke}):null,(0,Q.jsx)(`div`,{className:`flex min-h-0 min-w-0 flex-1 flex-col`,children:K?(0,Q.jsx)(Z.Suspense,{fallback:(0,Q.jsx)(An,{}),children:(0,Q.jsx)(Dn,{embedded:!0,sourceNoteInView:!0,conversationId:K,draftSeed:be,beforeSend:en},`${e}:${K}`)}):le?(0,Q.jsx)(An,{}):(0,Q.jsxs)(`div`,{className:`space-y-3 p-4 text-sm`,children:[(0,Q.jsx)(`p`,{className:`text-fg-muted`,children:ke||(p===`zh`?`对话尚未打开,请重试。`:`Chat could not be opened. Try again.`)}),(0,Q.jsx)(`button`,{type:`button`,className:`min-h-11 rounded-lg px-3 text-accent-fg hover:bg-surface-hover`,onClick:()=>void nn(),children:p===`zh`?`重新打开`:`Try again`})]})})]}):null,(0,Q.jsx)(`div`,{ref:St,className:Je(`relative min-h-0 max-w-full shrink-0 flex-col overflow-hidden`,A?`flex`:`hidden`,!oe&&`transition-[width] duration-300 ease-in-out`),style:{width:A?H:0},children:(0,Q.jsxs)(`div`,{ref:Tt,className:`flex min-h-0 flex-1 flex-col`,style:{width:H},children:[(0,Q.jsx)(`div`,{role:`separator`,"aria-orientation":`vertical`,onPointerDown:e=>{e.preventDefault();let t=e.currentTarget;t.setPointerCapture(e.pointerId),se(!0);let n=e.clientX,r=H,i=e.pointerId,a=0,o=H,s=H,c=()=>{a=0,s=o,A&&St.current?.style.setProperty(`width`,`${s}px`),Tt.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{}se(!1),ie(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:Je(`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`,oe&&`before:!bg-edge/80 dark:before:!bg-edge/85`,`touch-none select-none`)}),(0,Q.jsx)(`div`,{className:`flex min-h-0 flex-1 flex-col overflow-hidden rounded-xl border border-edge-subtle bg-surface-panel`,children:A===`history`?(0,Q.jsx)(tn,{noteId:e,activeTimestamp:N?.timestamp??null,onSelect:pn,onClose:hn,onRestored:gn}):A===`breakdown`?(0,Q.jsx)(fn,{noteId:e,note:$??null,catalyzing:U,onCatalyze:Ut,onClose:()=>j(null),noteThreads:Mt,openingChat:le,onOpenChat:()=>nn(!1),onOpenNewChat:()=>nn(!0)}):null})]})})]}),Pe?(0,Q.jsx)(mn,{open:Me,onOpenChange:Ne,note:Pe}):null,B?(0,Q.jsx)(ut,{open:!0,title:m.saveConflictReview,contentClassName:`flex h-[min(calc(100dvh-2rem),32rem)] flex-col overflow-hidden`,descriptionClassName:`min-h-0 max-h-none flex-1`,description:`${m.saveConflictReviewHint}\n\n${B.title??``}\n\n${B.markdown??``}`,confirmLabel:m.saveConflictOverwrite,cancelLabel:m.deleteCancelLabel,onConfirm:()=>{ne(null),Kt(B.remoteVersion??1)},onCancel:()=>ne(null)}):null,(0,Q.jsx)(ut,{open:Le,title:m.deleteConfirmTitle,description:m.deleteConfirmDescription.replace(`{{title}}`,$.title||m.titlePlaceholder),confirmLabel:m.deleteConfirmLabel,cancelLabel:m.deleteCancelLabel,destructive:!0,onConfirm:()=>void sn(),onCancel:()=>Re(!1)})]})}export{Et as a,jt as i,Nt as n,Mt as r,Nn as t};
|
|
7
|
+
`)}var Tn=()=>a(()=>import(`./block-editor-Bp6TLleA.js`),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47])),En=()=>a(()=>import(`./markdown-editor-CjQJ-Nho.js`),__vite__mapDeps([48,1,2,43,49,18])),Dn=(0,Z.lazy)(()=>a(()=>import(`./chat-page-oy4EGdO1.js`).then(e=>e.n).then(e=>({default:e.ChatPage})),__vite__mapDeps([50,1,16,2,18,17,3,4,11,12,13,6,51,52,53,54,55,56,57,58,59,60,61,9,34,62,36,38,63,64,65,66,67,68,22,23,69,26,70,25,71,72,73,74,75,76,77,78,45,79,80,81,40,82,83,84,7,85,86,87,88,89,90,91,92,32,93,94,41,95,96,97,98,99,100,101,8,102,14,103,104,19,105,106,107,108,109,110,111,112,10,15,20,21,24,27,28,29,30,31,113,114,115,116,33,117,35,118,119,120,121,122,123,124,125,126,127,128,129,130,131,132,37,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,42,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,203,204,205,206,207,208,209,210,211,212,213,214,215,216,217,218,219,220,221,222,223,224,225,226,227,228,229,230]))),On=(0,Z.lazy)(()=>Tn().then(e=>({default:e.BlockEditor}))),kn=(0,Z.lazy)(()=>En().then(e=>({default:e.MarkdownEditor})));function An(){let e=(0,Dt.c)(1),t;return e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,Q.jsxs)(`div`,{className:`flex h-full min-h-0 flex-col px-6 py-4`,"aria-busy":!0,children:[(0,Q.jsx)(`div`,{className:`h-8 w-56 max-w-full animate-pulse rounded-md bg-surface-hover`}),(0,Q.jsx)(`div`,{className:`mt-6 h-4 w-11/12 animate-pulse rounded bg-surface-hover`}),(0,Q.jsx)(`div`,{className:`mt-3 h-4 w-9/12 animate-pulse rounded bg-surface-hover`}),(0,Q.jsx)(`div`,{className:`mt-3 h-4 w-10/12 animate-pulse rounded bg-surface-hover`})]}),e[0]=t):t=e[0],t}function jn(e){let t=(0,Dt.c)(29),{mode:n,onModeChange:r,labels:i}=e,a;t[0]===i.edit?a=t[1]:(a={id:`wysiwyg`,label:i.edit,Icon:pe},t[0]=i.edit,t[1]=a);let o;t[2]===i.source?o=t[3]:(o={id:`source`,label:i.source,Icon:ce},t[2]=i.source,t[3]=o);let s;t[4]===i.preview?s=t[5]:(s={id:`preview`,label:i.preview,Icon:W},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=Mn,m;t[13]===f?m=t[14]:(m=(0,Q.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,Q.jsx)(`span`,{children:d.label}),t[15]=d.label,t[16]=h);let g;t[17]===Symbol.for(`react.memo_cache_sentinel`)?(g=(0,Q.jsx)(oe,{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,Q.jsx)(_t,{asChild:!0,children:(0,Q.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,Q.jsx)(vt,{children:(0,Q.jsx)(bt,{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,Q.jsxs)(yt,{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,Q.jsx)(a,{className:`size-4 text-fg-muted`,"aria-hidden":!0}),(0,Q.jsx)(`span`,{className:`flex-1`,children:i}),n===t?(0,Q.jsx)(ae,{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,Q.jsxs)(gt,{modal:!1,children:[_,v]}),t[26]=v,t[27]=_,t[28]=y):y=t[28],y}function Mn(e){e===`wysiwyg`&&Tn(),e===`source`&&En()}function Nn(e){let t=(0,Dt.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(Pn),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,Q.jsx)(Fn,{noteId:n,onBack:r,onSaved:i,showBackButton:p,backButtonClassName:o,clearHeaderOnCleanup:m,onOpenSearch:c,autoFocus:g,initialMode:u,onAutoFocusConsumed:d},n),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,Q.jsx)(_e,{closeLabel:y,children:b}),t[13]=y,t[14]=b,t[15]=x):x=t[15],x}function Pn(e){return e.language}function Fn({noteId:e,onBack:t,onSaved:n,showBackButton:r=!0,backButtonClassName:i,clearHeaderOnCleanup:a=!0,onOpenSearch:o,autoFocus:c=!1,initialMode:l=`wysiwyg`,onAutoFocusConsumed:u}){let p=f(e=>e.language),m=h(p).notes,g=h(p).chat.pageContext,{data:_}=et([`note-discussion-document`,e],()=>F(e)),[v,y]=(0,Z.useState)(!0),[b,x]=(0,Z.useState)(null),S=(0,Z.useCallback)(()=>x(null),[]);(0,Z.useEffect)(()=>{x(null)},[e]);let C=s(),w=lt(e=>e.resolved)===`dark`,{openImage:E}=ve(),[D,O]=(0,Z.useState)(l);(0,Z.useEffect)(()=>{x(null)},[D,v]);let[A,j]=(0,Z.useState)(null),[N,P]=(0,Z.useState)(null),[I,L]=(0,Z.useState)(!1),[R,z]=(0,Z.useState)(null),[ee,te]=(0,Z.useState)(!1),[B,ne]=(0,Z.useState)(null),[V,re]=(0,Z.useState)(``),[H,ie]=(0,Z.useState)(360),[oe,se]=(0,Z.useState)(!1),[U,ce]=(0,Z.useState)(!1),[le,ue]=(0,Z.useState)(!1),[fe,W]=(0,Z.useState)(!1),[he,_e]=(0,Z.useState)(null),G=(0,Z.useRef)(0),[be,Se]=(0,Z.useState)(null),we=d(e=>e.baseUrl),Te=d(e=>e.conversationId),K=he?.noteId===e&&he.gatewayUrl===we&&he.gatewayToken===Te?he.conversationId:null;(0,Z.useEffect)(()=>(G.current++,W(!1),_e(null),ue(!1),Se(null),y(!0),()=>{G.current++}),[e,we,Te]);let De=(0,Z.useRef)(0);(0,Z.useEffect)(()=>()=>{De.current+=1},[e]);let[ke,q]=(0,Z.useState)(null),[Me,Ne]=(0,Z.useState)(!1),[Pe,Ie]=(0,Z.useState)(null),[Le,Re]=(0,Z.useState)(!1),[Ve,Ue]=(0,Z.useState)(!1),We=(0,Z.useRef)(!1),Ke=(0,Z.useRef)(null),Ye=(0,Z.useRef)(null),Ze=(0,Z.useRef)(null),tt=(0,Z.useRef)(null),nt=(0,Z.useRef)(void 0),rt=(0,Z.useRef)(!1),J=(0,Z.useRef)(null),[it,at]=(0,Z.useState)(null),[ot,st]=(0,Z.useState)(!1),{headings:Y,current:dt,wide:ft,goTo:pt}=an(it),mt=Y.length>=2&&N===null&&D!==`source`&&(!_||!v),ht=mt&&ft&&!fe&&!A&&!_;(0,Z.useEffect)(()=>{(!mt||ht)&&st(!1)},[ht,mt]);let St=(0,Z.useRef)(null),Tt=(0,Z.useRef)(null),Et=(0,Z.useRef)(null),Dt=(0,Z.useRef)(null),Ot=X(e=>e.setPageHeader),kt=X(e=>e.clearPageHeader),{data:$,mutate:At,error:jt}=et(e?[`note-detail`,e]:null,()=>Ce(e)),{data:Mt=[],mutate:Nt}=et(e?[`note-threads`,e]:null,()=>Ee(e),{revalidateOnFocus:!1}),Pt=N!==null,Ft=(0,Z.useCallback)(e=>{q(`${m.refreshFailed}: ${e instanceof Error?e.message:m.quickCaptureFailedHint}`)},[m.quickCaptureFailedHint,m.refreshFailed]);(0,Z.useEffect)(()=>{if(!e)return;let t=t=>{t.detail?.noteId===e&&At().catch(Ft)};return window.addEventListener(`note-updated`,t),()=>window.removeEventListener(`note-updated`,t)},[At,e,Ft]),(0,Z.useEffect)(()=>{re(``),P(null),j(null),We.current=!1,Dt.current=null},[e]),(0,Z.useEffect)(()=>{!$||I||tt.current!==null||We.current||re($.title??``)},[$,I]);let It=(0,Z.useCallback)(t=>{Et.current=t,!(!t||!c||Dt.current===e)&&window.requestAnimationFrame(()=>{Et.current!==t||Dt.current===e||(Dt.current=e,t.focus({preventScroll:!0}),u?.())})},[c,e,u]),Lt=$?new Date($.createdAt).toLocaleString(void 0,{year:`numeric`,month:`short`,day:`numeric`,hour:`2-digit`,minute:`2-digit`}):``,Rt=(0,Z.useMemo)(()=>r?(0,Q.jsx)(`button`,{type:`button`,onClick:t,"aria-label":m.back,className:Je(`rounded-lg p-1.5 text-fg-muted transition-colors hover:bg-surface-hover hover:text-fg`,ct,i),children:(0,Q.jsx)(T,{className:`size-4`,"aria-hidden":!0})}):null,[i,m.back,t,r]),zt=(0,Z.useCallback)(()=>{let t=Xe.getState();t.source?.type===`note`&&t.source.id===e&&t.stop()},[e]),Bt=(0,Z.useCallback)(e=>{e!==D&&(e!==`preview`&&zt(),O(e))},[D,zt]);(0,Z.useEffect)(()=>{!I&&Ze.current===null&&tt.current===null&&(nt.current=$?.remoteVersion??1)},[e,$?.remoteVersion,I]);let Vt=(0,Z.useCallback)(async(t,n)=>{let r=n??nt.current??$?.remoteVersion??1,i=await ge(e,t,r);return nt.current=i.remoteVersion??r+1,i},[e,$?.remoteVersion]),Ht=(0,Z.useMemo)(()=>(0,Q.jsxs)(`div`,{className:Je(`flex min-w-0 items-center gap-2`,ct),children:[(0,Q.jsx)(`span`,{className:`min-w-0 truncate text-sm font-medium text-fg`,title:V||Lt||void 0,children:V||Lt}),(0,Q.jsx)(`span`,{role:`status`,className:`shrink-0 text-xs text-fg-muted`,children:I?m.saving:null})]}),[m.saving,I,Lt,V]),Ut=(0,Z.useCallback)(async()=>{ce(!0),q(null);try{await Oe(e),await At()}catch(e){q(`${m.catalysisFailed}: ${e instanceof Error?e.message:m.chatOpenFailedMessage}`)}finally{ce(!1)}},[At,e]),Wt=(0,Z.useCallback)(()=>{W(!1),j(A===`breakdown`?null:`breakdown`),!$?.aiDeep?.catalysis?.report&&!U&&Ut()},[A,U,Ut,$?.aiDeep?.catalysis?.report]),Gt=(0,Z.useCallback)(()=>{let t=N?N.markdown??``:Ze.current??$?.markdown??``,n=N?N.title??``:V,r=wn(n,t);return{source:{type:`note`,id:e,title:n||m.titlePlaceholder},text:r,language:Qe(r,p)}},[p,m.titlePlaceholder,$?.markdown,e,N,V]),Kt=(0,Z.useCallback)(async e=>{for(Ke.current&&clearTimeout(Ke.current),Ke.current=null;Ye.current;){let e=await Ye.current;if(!e||Ze.current===null&&tt.current===null)return e}if(rt.current&&e===void 0)return null;let t=Ze.current,r=We.current?null:tt.current,i={};if(t!==null&&(i.markdown=t),r!==null&&(i.title=r),t===null&&r===null)return $??null;L(!0),z(null);let a=Vt(i,e).then(async e=>(await At(e,{revalidate:!1}),rt.current=!1,Ze.current===t&&(Ze.current=null),tt.current===r&&(tt.current=null),n?.(),e)).catch(e=>(e instanceof Error&&`status`in e&&e.status===409?(rt.current=!0,z(m.saveConflict)):z(`${m.saveFailed}: ${e instanceof Error?e.message:m.saveFailedHint}`),null)).finally(()=>{Ye.current=null,L(!1)});return Ye.current=a,a},[At,m.saveConflict,m.saveFailed,m.saveFailedHint,$,n,Vt]),qt=async()=>{te(!0);try{let t=await Ce(e);if(!t)throw Error(m.saveConflictMissing);ne(t),z(m.saveConflict)}catch(e){z(`${m.saveFailed}: ${e instanceof Error?e.message:m.saveFailedHint}`)}finally{te(!1)}},Jt=(0,Z.useRef)(Kt);Jt.current=Kt;let Yt=(0,Z.useCallback)(()=>{Ke.current&&clearTimeout(Ke.current),Ke.current=setTimeout(()=>void Jt.current(),600)},[]),Xt=(0,Z.useCallback)(e=>{zt(),re(e),tt.current=e,We.current||Yt()},[Yt,zt]),Zt=()=>{We.current=!1,tt.current!==null&&Yt()},$t=(0,Z.useCallback)(e=>{zt(),Ze.current=e,Yt()},[Yt,zt]),en=(0,Z.useCallback)(async()=>I?(q(p===`zh`?`笔记正在保存,请稍后发送。`:`The note is saving. Please send again shortly.`),!1):!!await Kt()&&Ze.current===null&&tt.current===null,[I,p,Kt]),nn=(0,Z.useCallback)(async(t=!1)=>{if(j(null),W(!0),le||!t&&K)return;let n=++G.current;ue(!0),q(null);try{if(!await en())return;let r=await xe(e,{forceNew:t});if(n!==G.current)return;_e({noteId:e,gatewayUrl:we,gatewayToken:Te,conversationId:r.conversationId}),await At(),await Nt()}catch(e){n===G.current&&q(`${m.chatOpenFailedTitle}: ${e instanceof Error?e.message:m.chatOpenFailedMessage}`)}finally{n===G.current&&ue(!1)}},[le,K,en,At,Nt,e,we,Te,m.chatOpenFailedMessage,m.chatOpenFailedTitle]),rn=(0,Z.useCallback)(async e=>{if(!$||le||I)return;ue(!0),q(null);let t=d.getState(),n=++De.current,r=()=>De.current===n&&d.getState().baseUrl===t.baseUrl&&d.getState().conversationId===t.conversationId;try{let n=window.getSelection(),i=e??(n?.anchorNode&&n.focusNode&&J.current?.contains(n.anchorNode)&&J.current.contains(n.focusNode)?n.toString():``),a=await Kt();if(!a||!r())return;if(Ze.current!==null||tt.current!==null)throw Error(g.unavailable);let o=Ct.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 $e().createSession();if(!r())return;if(Ze.current!==null||tt.current!==null)throw Error(g.unavailable);let c=wt(t.baseUrl,t.conversationId,s.key);if(!Ct.put(c,o))throw Error(g.unavailable);C(`/chat/${encodeURIComponent(s.key)}`)}catch{r()&&q(g.unavailable)}finally{De.current===n&&ue(!1)}},[$,le,I,Kt,C,g.unavailable]),on=(0,Z.useCallback)(async()=>{q(null);let e=await Kt();e&&(Ie(e),Ne(!0))},[Kt]),sn=(0,Z.useCallback)(async()=>{if(!(Ve||I)){Re(!1),Ue(!0),q(null),zt(),Ke.current&&clearTimeout(Ke.current),Ke.current=null,Ze.current=null,tt.current=null;try{await Ae(e),window.dispatchEvent(new CustomEvent(`note-deleted`,{detail:{noteId:e}})),n?.(),t()}catch(e){q(`${m.deleteFailed}: ${e instanceof Error?e.message:m.quickCaptureFailedHint}`)}finally{Ue(!1)}}},[Ve,m.deleteFailed,m.quickCaptureFailedHint,e,t,n,I,zt]),cn=e=>{if(it?.clientWidth===0){W(!1),j(null),window.requestAnimationFrame(()=>pt(e));return}pt(e)},ln=(0,Z.useMemo)(()=>(0,Q.jsxs)(`div`,{className:Je(`flex min-w-0 items-center gap-1 sm:gap-2`,ct),children:[o?(0,Q.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,Q.jsx)(ze,{className:`size-4`,"aria-hidden":!0})}):null,(0,Q.jsx)(Sn,{input:Gt,showLabel:!1,labels:{read:m.readAloud,preparing:m.readAloudPreparing,pause:m.readAloudPause,resume:m.readAloudResume,retry:m.readAloudRetry,stop:m.readAloudStop}}),(0,Q.jsx)(`button`,{type:`button`,onClick:()=>{fe?W(!1):nn()},"aria-label":le?m.openingChat:m.openChatButton,title:m.openChatButton,"aria-controls":fe?`note-assistant-${e}`:void 0,"aria-expanded":fe,"data-note-assistant-trigger":!0,disabled:le,className:Je(`inline-flex size-8 shrink-0 items-center justify-center rounded-lg text-fg-muted transition-colors hover:bg-surface-hover hover:text-fg focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent disabled:opacity-50`,fe&&`bg-surface-active text-fg`),children:(0,Q.jsx)(Fe,{className:`size-3.5`,"aria-hidden":!0})}),(0,Q.jsx)(jn,{mode:D,onModeChange:Bt,labels:{edit:m.modeEdit,source:m.modeSource,preview:m.modePreview}}),(0,Q.jsxs)(gt,{modal:!1,children:[(0,Q.jsx)(_t,{asChild:!0,children:(0,Q.jsx)(`button`,{type:`button`,"data-note-actions-trigger":!0,"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,Q.jsx)(de,{className:`size-4`,"aria-hidden":!0})})}),(0,Q.jsx)(vt,{children:(0,Q.jsxs)(bt,{align:`end`,sideOffset:6,className:`z-50 min-w-40 rounded-xl border border-edge bg-surface-overlay p-1 shadow-popover`,children:[mt&&!ht?(0,Q.jsxs)(yt,{onSelect:()=>st(!0),className:`flex cursor-pointer items-center gap-2 rounded-lg px-3 py-2 text-sm text-fg outline-none hover:bg-surface-hover focus:bg-surface-hover`,children:[(0,Q.jsx)(M,{className:`size-4 text-fg-muted`,"aria-hidden":!0}),m.outline]}):null,(0,Q.jsxs)(yt,{onSelect:Wt,disabled:U,className:`flex cursor-pointer items-center gap-2 rounded-lg px-3 py-2 text-sm text-fg outline-none hover:bg-surface-hover focus:bg-surface-hover data-[disabled]:opacity-50`,children:[(0,Q.jsx)(He,{className:`size-4 text-fg-muted`,"aria-hidden":!0}),U?m.catalyzing:m.catalyzeButton]}),(0,Q.jsxs)(yt,{onSelect:()=>void rn(),disabled:le||I||!$||!!N,className:`flex cursor-pointer items-center gap-2 rounded-lg px-3 py-2 text-sm text-fg outline-none hover:bg-surface-hover focus:bg-surface-hover data-[disabled]:opacity-50`,children:[(0,Q.jsx)(pe,{className:`size-4 text-fg-muted`,"aria-hidden":!0}),g.capture]}),(0,Q.jsx)(xt,{className:`my-1 h-px bg-edge-subtle`}),(0,Q.jsxs)(yt,{onSelect:()=>void on(),className:`flex cursor-pointer items-center gap-2 rounded-lg px-3 py-2 text-sm text-fg outline-none hover:bg-surface-hover focus:bg-surface-hover`,children:[(0,Q.jsx)(Be,{className:`size-4 text-fg-muted`,"aria-hidden":!0}),p===`zh`?`分享`:`Share`]}),(0,Q.jsxs)(yt,{onSelect:()=>{W(!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,Q.jsx)(me,{className:`size-4 text-fg-muted`,"aria-hidden":!0}),(0,Q.jsx)(`span`,{className:`flex-1`,children:m.history}),A===`history`?(0,Q.jsx)(ae,{className:`size-4 text-accent`,"aria-hidden":!0}):null]}),(0,Q.jsx)(xt,{className:`my-1 h-px bg-edge-subtle`}),(0,Q.jsxs)(yt,{disabled:Ve||I,onSelect:()=>Re(!0),className:`flex cursor-pointer items-center gap-2 rounded-lg px-3 py-2 text-sm text-danger outline-none hover:bg-danger-soft focus:bg-danger-soft data-[disabled]:cursor-not-allowed data-[disabled]:opacity-50`,children:[(0,Q.jsx)(Ge,{className:`size-4`,"aria-hidden":!0}),m.delete]})]})})]})]}),[U,mt,ht,m.outline,fe,e,Wt,nn,rn,g.capture,$,N,D,m.history,m.catalyzeButton,m.catalyzing,m.noteActions,m.openChatButton,m.openingChat,m.modeEdit,m.modePreview,m.modeSource,le,A,o,m.searchDialogTitle,m.readAloud,m.readAloudPause,m.readAloudPreparing,m.readAloudResume,m.readAloudRetry,m.readAloudStop,Bt,Gt,on,Ve,I,p,m.delete,Re]);(0,Z.useLayoutEffect)(()=>(Ot({startExtra:Rt,main:$&&!_?Ht:null,end:$&&!_?ln:null}),()=>{a&&kt()}),[a,kt,ln,Ht,Rt,_,v,$,Ot]);let pn=(0,Z.useCallback)(t=>{je(e,t.timestamp).then(e=>{e&&(zt(),P(e),_&&y(!1))})},[_,e,zt]),hn=(0,Z.useCallback)(()=>{zt(),j(null),P(null)},[zt]),gn=(0,Z.useCallback)(()=>{zt(),j(null),P(null),At().catch(Ft),n?.()},[At,n,Ft,zt]);if((0,Z.useEffect)(()=>()=>{Jt.current()},[]),$===void 0)return jt?(0,Q.jsxs)(`div`,{className:`flex flex-1 flex-col items-center justify-center gap-3 p-6 text-center`,role:`alert`,children:[(0,Q.jsx)(`p`,{className:`text-sm text-danger`,children:m.home.loadFailed}),(0,Q.jsx)(`button`,{type:`button`,onClick:()=>void At().catch(Ft),className:`rounded-lg border border-edge px-3 py-2 text-sm text-fg hover:bg-surface-hover`,children:m.home.retry}),(0,Q.jsx)(`button`,{type:`button`,onClick:t,className:`text-sm text-fg-muted hover:text-fg`,children:m.back})]}):(0,Q.jsx)(An,{});if($===null)return(0,Q.jsxs)(`div`,{className:`flex flex-1 flex-col items-center justify-center gap-3 text-center`,children:[(0,Q.jsx)(`div`,{className:`text-sm font-medium text-fg`,children:m.notFoundTitle}),(0,Q.jsx)(`p`,{className:`text-sm text-fg-muted`,children:m.notFoundDescription}),(0,Q.jsx)(`button`,{type:`button`,onClick:t,className:`rounded-lg border border-edge px-3 py-1.5 text-sm font-medium text-fg-muted transition-colors hover:bg-surface-hover hover:text-fg`,children:m.back})]});let _n=Pt?N.title??``:V,vn=Pt?N.markdown??``:Ze.current??$.markdown??``,yn=/^Discussion · \d{4}-\d{2}-\d{2} \d{2}:\d{2}$/.test(V)?``:V,bn=p===`zh`?`语音笔记`:`Voice note`,Cn=!v&&!Pt?(0,Q.jsx)(`input`,{ref:It,"aria-label":m.titlePlaceholder,value:yn,placeholder:bn,onChange:e=>Xt(e.target.value),onCompositionStart:()=>{We.current=!0},onCompositionEnd:Zt,className:`w-full rounded-md bg-transparent text-2xl font-semibold leading-snug tracking-tight placeholder:text-fg focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`}):null,Tn=(0,Q.jsx)(`input`,{ref:It,type:`text`,"aria-label":m.titlePlaceholder,value:V,onChange:e=>Xt(e.target.value),onCompositionStart:()=>{We.current=!0},onCompositionEnd:Zt,onKeyDown:e=>{if(e.key!==`Enter`||We.current||e.nativeEvent.isComposing)return;let t=J.current?.querySelector(`.ProseMirror, .cm-content`);t&&(e.preventDefault(),t.focus())},placeholder:m.titlePlaceholder,className:`block w-full min-w-0 rounded-md bg-transparent text-[clamp(1.75rem,4vw,2.5rem)] font-bold leading-tight tracking-tight text-fg placeholder:text-fg-muted/60 focus:outline-none`}),En=(0,Q.jsxs)(`div`,{ref:at,className:`relative flex h-full min-h-0 flex-col`,children:[ht?(0,Q.jsx)(un,{label:m.outline,headings:Y,current:dt,onSelect:cn}):null,_?(0,Q.jsxs)(`div`,{className:`flex shrink-0 flex-wrap items-center justify-between gap-x-2 border-b border-edge-subtle px-4 py-1`,children:[(0,Q.jsx)(`h3`,{className:`text-sm font-medium`,children:p===`zh`?`我的笔记`:`My notes`}),(0,Q.jsx)(jn,{mode:D,onModeChange:Bt,labels:{edit:m.modeEdit,source:m.modeSource,preview:m.modePreview}})]}):null,(0,Q.jsx)(`div`,{className:`h-full min-h-0 min-w-0 flex-1`,children:Pt?(0,Q.jsxs)(`div`,{className:`h-full overflow-y-auto px-4 py-4 sm:px-6`,children:[_n&&(0,Q.jsx)(`h1`,{className:`mb-4 text-2xl font-bold text-fg/70`,children:_n}),vn?(0,Q.jsx)(ye,{noteId:e,content:vn,className:`opacity-80`}):(0,Q.jsx)(`p`,{className:`italic text-fg-muted`,children:m.emptyPreview})]}):(0,Q.jsxs)(Q.Fragment,{children:[D===`wysiwyg`&&(0,Q.jsx)(`div`,{className:`flex h-full flex-col`,children:(0,Q.jsx)(`div`,{className:`min-h-0 flex-1`,children:(0,Q.jsx)(Z.Suspense,{fallback:(0,Q.jsx)(An,{}),children:(0,Q.jsx)(On,{autoFocus:!!_&&!v,placeholder:m.editorPlaceholder,documentHeader:_?void 0:Tn,initialContent:vn,onChange:$t,noteId:e,onTextSelection:x},`wysiwyg-${e}`)})})}),D===`source`&&(0,Q.jsxs)(`div`,{className:`flex h-full flex-col`,children:[_?null:(0,Q.jsx)(`div`,{className:`mx-auto mb-3 w-full max-w-3xl px-5 pt-6 sm:px-10 sm:pt-9`,children:Tn}),(0,Q.jsx)(`div`,{className:Je(`min-h-0 min-w-0 flex-1`,!_&&`mx-auto w-full max-w-3xl px-3 sm:px-8`),children:(0,Q.jsx)(Z.Suspense,{fallback:(0,Q.jsx)(An,{}),children:(0,Q.jsx)(kn,{initialContent:vn,onChange:$t,isDark:w,onTextSelection:x},`source-${e}`)})})]}),D===`preview`&&(0,Q.jsxs)(`div`,{"data-note-outline-scroll":!0,className:Je(`h-full overflow-y-auto px-5 py-6 sm:px-10 sm:pt-9`,!_&&`mx-auto w-full max-w-3xl`),onClick:e=>{let t=e.target;t instanceof HTMLImageElement&&E(t.currentSrc||t.src,t.alt)},children:[!_&&V&&!vn.trimStart().startsWith(`# ${V.trim()}\n`)&&vn.trim()!==`# ${V.trim()}`&&(0,Q.jsx)(`h1`,{className:`mb-5 break-words text-[clamp(1.75rem,4vw,2.5rem)] font-bold leading-tight tracking-tight text-fg`,children:V}),vn?(0,Q.jsx)(`div`,{"data-note-outline-content":!0,children:(0,Q.jsx)(ye,{noteId:e,content:vn,className:`[&_img]:cursor-zoom-in`})}):_?(0,Q.jsx)(`button`,{type:`button`,className:`min-h-11 rounded-lg px-2 text-sm text-accent-fg hover:bg-surface-hover focus-visible:ring-2 focus-visible:ring-accent`,onClick:()=>Bt(`wysiwyg`),children:p===`zh`?`写笔记`:`Write notes`}):(0,Q.jsx)(`p`,{className:`italic text-fg-muted`,children:m.emptyPreview})]})]})})]});return(0,Q.jsxs)(Q.Fragment,{children:[mt&&!ht?(0,Q.jsx)(dn,{label:m.outline,closeLabel:m.outlineClose,headings:Y,current:dt,onSelect:cn,open:ot,onOpenChange:st,returnFocus:()=>document.querySelector(`[data-note-actions-trigger]`)?.focus({preventScroll:!0})}):null,b&&!Pt&&!(_&&v)&&D!==`preview`?(0,Q.jsx)(xn,{noteId:e,selection:b,zh:p===`zh`,onDismiss:S,onAsk:e=>{Se({id:Date.now(),text:p===`zh`?`请帮我分析或改写下面这段笔记:\n\n${e}`:`Help me analyze or rewrite this note selection:\n\n${e}`}),S(),nn()}},`${e}:${D}`):null,(0,Q.jsxs)(`div`,{className:`@container/note flex h-full min-h-0 min-w-0 gap-3 p-3 sm:p-4`,children:[(0,Q.jsxs)(`div`,{className:Je(`mx-auto min-h-0 min-w-0 w-full flex-1 flex-col`,fe||A?`hidden @min-[56rem]/note:flex`:`flex`,!_&&`max-w-[60rem]`),children:[R?(0,Q.jsxs)(`div`,{className:`mb-3 flex shrink-0 items-center gap-2 rounded-lg border border-danger/25 bg-danger-soft px-3 py-2 text-sm text-danger`,children:[(0,Q.jsx)(`p`,{role:`alert`,className:`min-w-0 flex-1 break-words`,children:R}),(0,Q.jsx)(`button`,{type:`button`,className:`shrink-0 rounded-md px-2 py-1 font-medium hover:bg-surface-hover focus-visible:ring-2 focus-visible:ring-accent`,disabled:ee,onClick:()=>void(rt.current?qt():Kt()),children:rt.current?m.saveConflictReview:m.home.retry})]}):null,ke?(0,Q.jsx)(`p`,{className:`mb-3 shrink-0 rounded-lg border border-danger/25 bg-danger-soft px-3 py-2 text-sm text-danger`,role:`alert`,children:ke}):null,(0,Q.jsx)(k,{eventType:`note.created`,source:`notes`,payloadKey:`noteId`,payloadValue:e,className:`mb-3 shrink-0`}),(0,Q.jsx)(k,{eventType:`note.updated`,source:`notes`,payloadKey:`noteId`,payloadValue:e,className:`mb-3 shrink-0`}),(0,Q.jsxs)(`div`,{ref:J,onKeyDown:e=>{(e.metaKey||e.ctrlKey)&&e.key.toLowerCase()===`s`&&(e.preventDefault(),!We.current&&!e.nativeEvent.isComposing&&Kt()),b&&e.altKey&&e.key===`Enter`&&(e.preventDefault(),document.querySelector(`[data-note-selection-actions] button:not(:disabled)`)?.focus())},className:`flex min-h-0 min-w-0 flex-1 flex-col overflow-hidden rounded-xl border border-edge-subtle bg-surface-panel`,children:[_?(0,Q.jsx)(Qt,{noteId:e,noteTitle:Cn,personalNotes:En,personalNotesActive:!v,onMeetingContent:()=>{Pt&&hn(),y(!0)},onPersonalNotes:()=>{hn(),Bt(`wysiwyg`),y(!1)},noteActions:{onAnalyze:Wt,chatOpen:fe,onChat:()=>{fe?W(!1):nn(!1)},onShare:()=>{on()},onHistory:()=>{W(!1),A===`history`?hn():j(`history`)},onDelete:()=>Re(!0),onOutline:mt?()=>st(!0):void 0,busy:Ve||I||U||le}}):null,_?null:En]})]}),fe||K?(0,Q.jsxs)(`aside`,{id:`note-assistant-${e}`,"aria-label":p===`zh`?`笔记 AI 对话`:`Note AI chat`,className:Je(`min-h-0 min-w-0 shrink-0 flex-col overflow-hidden rounded-xl border border-edge-subtle bg-surface-panel`,fe?`flex w-full @min-[56rem]/note:w-[22rem] @min-[76rem]/note:w-[24rem]`:`hidden`),children:[(0,Q.jsxs)(`header`,{className:`flex shrink-0 items-center gap-2 border-b border-edge-subtle px-4 py-2`,children:[(0,Q.jsx)(Fe,{className:`size-4 text-accent-fg`,"aria-hidden":!0}),(0,Q.jsx)(`h2`,{className:`flex-1 text-sm font-medium`,children:_?p===`zh`?`问这段录音`:`Ask about this recording`:p===`zh`?`AI 对话`:`AI chat`}),(0,Q.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:()=>{W(!1),window.requestAnimationFrame(()=>document.querySelector(`[data-note-assistant-trigger], [aria-controls="note-assistant-${e}"]`)?.focus({preventScroll:!0}))},children:(0,Q.jsx)(qe,{className:`size-4`})})]}),_&&fe&&K&&_.transcript?.text?.trim()?(0,Q.jsx)(`div`,{className:`flex shrink-0 flex-wrap gap-1 border-b border-edge-subtle px-4 py-1`,children:(p===`zh`?[`最后决定了什么?`,`有哪些待跟进事项?`]:[`What was decided?`,`What needs follow-up?`]).map(e=>(0,Q.jsx)(`button`,{type:`button`,className:`min-h-11 rounded-lg px-2 text-xs text-fg-muted hover:bg-surface-hover focus-visible:ring-2 focus-visible:ring-accent`,onClick:()=>Se({id:Date.now(),text:e}),children:e},e))}):null,ke&&K?(0,Q.jsx)(`p`,{role:`alert`,className:`shrink-0 px-4 py-2 text-xs text-danger`,children:ke}):null,(0,Q.jsx)(`div`,{className:`flex min-h-0 min-w-0 flex-1 flex-col`,children:K?(0,Q.jsx)(Z.Suspense,{fallback:(0,Q.jsx)(An,{}),children:(0,Q.jsx)(Dn,{embedded:!0,sourceNoteInView:!0,conversationId:K,draftSeed:be,beforeSend:en},`${e}:${K}`)}):le?(0,Q.jsx)(An,{}):(0,Q.jsxs)(`div`,{className:`space-y-3 p-4 text-sm`,children:[(0,Q.jsx)(`p`,{className:`text-fg-muted`,children:ke||(p===`zh`?`对话尚未打开,请重试。`:`Chat could not be opened. Try again.`)}),(0,Q.jsx)(`button`,{type:`button`,className:`min-h-11 rounded-lg px-3 text-accent-fg hover:bg-surface-hover`,onClick:()=>void nn(),children:p===`zh`?`重新打开`:`Try again`})]})})]}):null,(0,Q.jsx)(`div`,{ref:St,className:Je(`relative min-h-0 max-w-full shrink-0 flex-col overflow-hidden`,A?`flex`:`hidden`,!oe&&`transition-[width] duration-300 ease-in-out`),style:{width:A?H:0},children:(0,Q.jsxs)(`div`,{ref:Tt,className:`flex min-h-0 flex-1 flex-col`,style:{width:H},children:[(0,Q.jsx)(`div`,{role:`separator`,"aria-orientation":`vertical`,onPointerDown:e=>{e.preventDefault();let t=e.currentTarget;t.setPointerCapture(e.pointerId),se(!0);let n=e.clientX,r=H,i=e.pointerId,a=0,o=H,s=H,c=()=>{a=0,s=o,A&&St.current?.style.setProperty(`width`,`${s}px`),Tt.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{}se(!1),ie(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:Je(`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`,oe&&`before:!bg-edge/80 dark:before:!bg-edge/85`,`touch-none select-none`)}),(0,Q.jsx)(`div`,{className:`flex min-h-0 flex-1 flex-col overflow-hidden rounded-xl border border-edge-subtle bg-surface-panel`,children:A===`history`?(0,Q.jsx)(tn,{noteId:e,activeTimestamp:N?.timestamp??null,onSelect:pn,onClose:hn,onRestored:gn}):A===`breakdown`?(0,Q.jsx)(fn,{noteId:e,note:$??null,catalyzing:U,onCatalyze:Ut,onClose:()=>j(null),noteThreads:Mt,openingChat:le,onOpenChat:()=>nn(!1),onOpenNewChat:()=>nn(!0)}):null})]})})]}),Pe?(0,Q.jsx)(mn,{open:Me,onOpenChange:Ne,note:Pe}):null,B?(0,Q.jsx)(ut,{open:!0,title:m.saveConflictReview,contentClassName:`flex h-[min(calc(100dvh-2rem),32rem)] flex-col overflow-hidden`,descriptionClassName:`min-h-0 max-h-none flex-1`,description:`${m.saveConflictReviewHint}\n\n${B.title??``}\n\n${B.markdown??``}`,confirmLabel:m.saveConflictOverwrite,cancelLabel:m.deleteCancelLabel,onConfirm:()=>{ne(null),Kt(B.remoteVersion??1)},onCancel:()=>ne(null)}):null,(0,Q.jsx)(ut,{open:Le,title:m.deleteConfirmTitle,description:m.deleteConfirmDescription.replace(`{{title}}`,$.title||m.titlePlaceholder),confirmLabel:m.deleteConfirmLabel,cancelLabel:m.deleteCancelLabel,destructive:!0,onConfirm:()=>void sn(),onCancel:()=>Re(!1)})]})}export{Et as a,jt as i,Nt as n,Mt as r,Nn as t};
|