@xopcai/xopc 0.0.425 → 0.0.427
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/browser-ext/manifest.json +1 -1
- package/dist/extensions/telegram/src/adapters/security-adapter.js +1 -1
- package/dist/extensions/telegram/src/pairing-config-resolver.js +1 -1
- package/dist/extensions/telegram/src/plugin.js +2 -2
- package/dist/extensions/telegram/xopc.extension.json +1 -1
- package/dist/extensions/weixin/src/api/api.js +1 -1
- package/dist/extensions/weixin/src/auth/accounts.js +2 -2
- 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 +1 -1
- package/dist/extensions/weixin/src/messaging/debug-mode.js +1 -1
- package/dist/extensions/weixin/src/messaging/inbound.js +2 -2
- package/dist/extensions/weixin/src/messaging/process-message.js +3 -3
- package/dist/extensions/weixin/src/messaging/send.js +12 -3
- package/dist/extensions/weixin/src/monitor/monitor.js +1 -1
- package/dist/extensions/weixin/src/outbound-send.js +12 -3
- package/dist/extensions/weixin/src/pairing-config-resolver.js +1 -1
- package/dist/extensions/weixin/src/plugin.js +1 -1
- package/dist/gateway/static/root/assets/{activity-store-CMw8qBuC.js → activity-store-D_DXNHba.js} +1 -1
- package/dist/gateway/static/root/assets/{agent-avatar-dicebear-JI0YWOIm.js → agent-avatar-dicebear-CjaQxFQt.js} +1 -1
- package/dist/gateway/static/root/assets/{agent-avatar-display-YqmwzOSa.js → agent-avatar-display-6Z4m31Fz.js} +2 -2
- package/dist/gateway/static/root/assets/agent-defaults-settings-panel-D4ClP_DJ.js +1 -0
- package/dist/gateway/static/root/assets/agent-plugin-dialog-m1A8wF9p.js +1 -0
- package/dist/gateway/static/root/assets/agents-B9slUA_1.js +77 -0
- package/dist/gateway/static/root/assets/{agents-admin-api-DLnmdC1h.js → agents-admin-api-u5c3GREg.js} +1 -1
- package/dist/gateway/static/root/assets/{api-Boc-CVh7.js → api-C3Tp9MkF.js} +1 -1
- package/dist/gateway/static/root/assets/{api-bL7sxjAF.js → api-CRT9ZyH0.js} +1 -1
- package/dist/gateway/static/root/assets/app-link-DRy3-k7j.js +1 -0
- package/dist/gateway/static/root/assets/{app-management-settings-panel-jIG5i7KE.js → app-management-settings-panel-XqoIBF2H.js} +1 -1
- package/dist/gateway/static/root/assets/{appearance-settings-BnaQW9Xd.js → appearance-settings-9ZtqCASo.js} +1 -1
- package/dist/gateway/static/root/assets/apps-page-DUeu_7iC.js +1 -0
- package/dist/gateway/static/root/assets/{archive-plugin-DjboG3kA.js → archive-plugin-BCQnOkV8.js} +1 -1
- package/dist/gateway/static/root/assets/attachment-load-DrVGNxJm.js +1 -0
- package/dist/gateway/static/root/assets/{automation-api-CZqL9l_d.js → automation-api-hRsGx-qe.js} +1 -1
- package/dist/gateway/static/root/assets/{automation-result-state-DRd-X_Ai.js → automation-result-state-CMfVTv_i.js} +1 -1
- package/dist/gateway/static/root/assets/automation-task-card-Bur78p68.js +3 -0
- package/dist/gateway/static/root/assets/{automations-page-HyBQIfmn.js → automations-page-DMIyWsP0.js} +1 -1
- package/dist/gateway/static/root/assets/automations-workspace-DEkDjxeU.js +9 -0
- package/dist/gateway/static/root/assets/{binary-plugins-Bg8ARZUH.js → binary-plugins-CIB5cbvQ.js} +1 -1
- package/dist/gateway/static/root/assets/{block-editor-DKohqFAW.js → block-editor-CXdlNAmZ.js} +2 -2
- package/dist/gateway/static/root/assets/{browser-automation-inputs-YeibTzw4.js → browser-automation-inputs-Fxo7HbK6.js} +1 -1
- package/dist/gateway/static/root/assets/{browser-automations-page-BWNcbuz2.js → browser-automations-page-Dn3LN5wo.js} +2 -2
- package/dist/gateway/static/root/assets/{browser-control-api-CDeuxy2x.js → browser-control-api-CbbPvhHR.js} +1 -1
- package/dist/gateway/static/root/assets/browser-settings-page-Cpm9fEPV.js +3 -0
- package/dist/gateway/static/root/assets/{button-CnRSIP6m.js → button-Cc4hUNTt.js} +1 -1
- package/dist/gateway/static/root/assets/{capabilities-BcQa8c9n.js → capabilities-BEvywfF9.js} +1 -1
- package/dist/gateway/static/root/assets/capabilities-Bo2qEJhH.js +1 -0
- package/dist/gateway/static/root/assets/capabilities-page-BCzsIzvC.js +2 -0
- package/dist/gateway/static/root/assets/capabilities-settings-panel-Cr67ziwX.js +8 -0
- package/dist/gateway/static/root/assets/{capability-header-actions-CTUCuBlW.js → capability-header-actions-BxMYfQ8y.js} +1 -1
- package/dist/gateway/static/root/assets/channels-CA5z5dGY.js +1 -0
- package/dist/gateway/static/root/assets/{chat-agents-api-B8JO6Tcj.js → chat-agents-api-D8YS5amE.js} +1 -1
- package/dist/gateway/static/root/assets/{chat-chart-block-DRtuFfF1.js → chat-chart-block-B39npsXj.js} +1 -1
- package/dist/gateway/static/root/assets/chat-page-D92AWJbh.js +72 -0
- package/dist/gateway/static/root/assets/{chat-terminal-dock-Dkqq5FSL.js → chat-terminal-dock-DjFnElAM.js} +2 -2
- package/dist/gateway/static/root/assets/{command-palette-api-qujvNqkK.js → command-palette-api-Dijix7V6.js} +1 -1
- package/dist/gateway/static/root/assets/composer-payload-handoff-BQXlFKf4.js +1 -0
- package/dist/gateway/static/root/assets/{computer-settings-page-8q4hRmoo.js → computer-settings-page-MkqyKyf3.js} +1 -1
- package/dist/gateway/static/root/assets/confirm-dialog-D7dQJytv.js +1 -0
- package/dist/gateway/static/root/assets/connected-providers-grid-BSvKP2u-.js +1 -0
- package/dist/gateway/static/root/assets/{connector-service-page-DQaTI21R.js → connector-service-page-DlIl9bLx.js} +1 -1
- package/dist/gateway/static/root/assets/{connectors-api-BjypBp2g.js → connectors-api-DEJU8mgn.js} +1 -1
- package/dist/gateway/static/root/assets/connectors-page-Vx8-MY0Y.js +1 -0
- package/dist/gateway/static/root/assets/{copy-text-row-CYIv7RfP.js → copy-text-row-CpiRzq4G.js} +1 -1
- package/dist/gateway/static/root/assets/{date-picker-D_PSHGpe.js → date-picker-BIfjfOTM.js} +1 -1
- package/dist/gateway/static/root/assets/dependency-picker-XjPB8FJS.js +1 -0
- package/dist/gateway/static/root/assets/{desktop-pet-1Et9VqkM.js → desktop-pet-DFNehTtd.js} +1 -1
- package/dist/gateway/static/root/assets/{desktop-pet-narrative-rADKU0FX.js → desktop-pet-narrative-ChwjpnsG.js} +1 -1
- package/dist/gateway/static/root/assets/{desktop-pet-settings-0fCGgaG7.js → desktop-pet-settings-BDjsFown.js} +1 -1
- package/dist/gateway/static/root/assets/{dev-view-store-TTj_djD8.js → dev-view-store-CeZZLOc6.js} +1 -1
- package/dist/gateway/static/root/assets/device-pairing-wizard-DH_uJ698.js +1 -0
- package/dist/gateway/static/root/assets/{directory-picker-path-field-C07a7wYX.js → directory-picker-path-field-DiZXY7jF.js} +1 -1
- package/dist/gateway/static/root/assets/{discussion-annotation-sync-BFqKm9ky.js → discussion-annotation-sync-BXqNuZnx.js} +1 -1
- package/dist/gateway/static/root/assets/dist-BGTk37IG.js +1 -0
- package/dist/gateway/static/root/assets/dist-BuHnPloF.js +1 -0
- package/dist/gateway/static/root/assets/dist-GJ8-1PAx.js +1 -0
- package/dist/gateway/static/root/assets/dist-ZrL34Ps4.js +1 -0
- package/dist/gateway/static/root/assets/{extension-debug-page-DFaVlqas.js → extension-debug-page-myQqsol2.js} +1 -1
- package/dist/gateway/static/root/assets/{extension-iframe-host-BfzPfXBq.js → extension-iframe-host-DaL-OcTw.js} +1 -1
- package/dist/gateway/static/root/assets/{extension-marketplace-api-ow0K1Y4_.js → extension-marketplace-api-DRBszrCR.js} +1 -1
- package/dist/gateway/static/root/assets/{extension-page-CrDADV5W.js → extension-page-DvlGhZLa.js} +1 -1
- package/dist/gateway/static/root/assets/{extension-provider-mnRoa63o.js → extension-provider-fOi6V6Cr.js} +1 -1
- package/dist/gateway/static/root/assets/{extension-settings-page-BLl02GFY.js → extension-settings-page-DOGlQpkx.js} +1 -1
- package/dist/gateway/static/root/assets/{file-preview-surface-TGdKqhCf.js → file-preview-surface-DfkXvFnc.js} +1 -1
- package/dist/gateway/static/root/assets/{gateway-config-swr-DfPQIHOL.js → gateway-config-swr-BOCt_zOo.js} +1 -1
- package/dist/gateway/static/root/assets/{gateway-realtime-67vWg_M2.js → gateway-realtime-BL_Cf0OQ.js} +1 -1
- package/dist/gateway/static/root/assets/gateway-realtime-store-BHBOPF_q.js +1 -0
- package/dist/gateway/static/root/assets/{gateway-restart-CLtR2wkL.js → gateway-restart-CHf8qY7H.js} +1 -1
- package/dist/gateway/static/root/assets/{gateway-settings-COvC3r-l.js → gateway-settings-Di41peSM.js} +1 -1
- package/dist/gateway/static/root/assets/{gateway-startup-retry-9YQllbw2.js → gateway-startup-retry-CvkJYurV.js} +1 -1
- package/dist/gateway/static/root/assets/{global-defaults-api-DYMRjGvd.js → global-defaults-api-BWMbKu72.js} +1 -1
- package/dist/gateway/static/root/assets/home-page-B3sgqrl3.js +2 -0
- package/dist/gateway/static/root/assets/{image-generation-api-Dzydfvy8.js → image-generation-api-Ce-IY7Ug.js} +1 -1
- package/dist/gateway/static/root/assets/{imports-page-Csd_YZXZ.js → imports-page-W7_cDbxy.js} +1 -1
- package/dist/gateway/static/root/assets/index-D4B6O8B3.js +11 -0
- package/dist/gateway/static/root/assets/index-DGWBJDAM.css +1 -0
- package/dist/gateway/static/root/assets/install-connector-dialog-DWVl9ekV.js +1 -0
- package/dist/gateway/static/root/assets/{keyboard-shortcuts-settings-B201bMIa.js → keyboard-shortcuts-settings-Doyu0Q9e.js} +1 -1
- package/dist/gateway/static/root/assets/link-2-D_ZKYUW7.js +1 -0
- package/dist/gateway/static/root/assets/local-app-workbench-page-B3h3P6aI.js +1 -0
- package/dist/gateway/static/root/assets/{local-apps-page-BOwqNH0L.js → local-apps-page-D6D2bZGW.js} +1 -1
- package/dist/gateway/static/root/assets/{local-session-drafts-DjmK-SM9.js → local-session-drafts-BJ1B1dQ7.js} +1 -1
- package/dist/gateway/static/root/assets/{locale-store-Bg_XR36n.js → locale-store-Br7IfbXK.js} +1 -1
- package/dist/gateway/static/root/assets/{logs-page-gw3E9CMQ.js → logs-page-qiXos_12.js} +2 -2
- package/dist/gateway/static/root/assets/management-settings-C0WcSdK7.js +1 -0
- package/dist/gateway/static/root/assets/{markdown-view-BUpXJUPv.js → markdown-view-Ck5s16p9.js} +2 -2
- package/dist/gateway/static/root/assets/mcp-conversation-setup-page-CENs3hGU.js +1 -0
- package/dist/gateway/static/root/assets/{media-plugins-_shnaEMY.js → media-plugins-Ba6vUE4J.js} +1 -1
- package/dist/gateway/static/root/assets/messages-ByFlEbsu.js +3 -0
- package/dist/gateway/static/root/assets/model-selector-DCBmsHzj.js +1 -0
- package/dist/gateway/static/root/assets/{models-hub-cache-KOJC3z6Q.js → models-hub-cache-Bd-fYUrV.js} +1 -1
- package/dist/gateway/static/root/assets/note-detail-panel-CnuxqWMd.js +5 -0
- package/dist/gateway/static/root/assets/note-image-lightbox-BFKZ7qJr.js +1 -0
- package/dist/gateway/static/root/assets/{notes-api-BSmikUKI.js → notes-api-8kp0X1x6.js} +1 -1
- package/dist/gateway/static/root/assets/{notes-page-CA0NRL8O.js → notes-page-XMdy-H3H.js} +1 -1
- package/dist/gateway/static/root/assets/{oauth-api-D2t9HXoC.js → oauth-api-DMMdeaNd.js} +1 -1
- package/dist/gateway/static/root/assets/{oauth-provider-connect-DGGGGtcB.js → oauth-provider-connect-CfOK8mPM.js} +1 -1
- package/dist/gateway/static/root/assets/{page-context-capture-button-BH54VO0V.js → page-context-capture-button-CKlKWSJ7.js} +1 -1
- package/dist/gateway/static/root/assets/{page-context-draft-BS5y8Cx9.js → page-context-draft-LF33STHC.js} +1 -1
- package/dist/gateway/static/root/assets/page-header-store-Du44NIEJ.js +1 -0
- package/dist/gateway/static/root/assets/{personal-avatar-D8DtpDTa.js → personal-avatar-D6CzIIfo.js} +1 -1
- package/dist/gateway/static/root/assets/personal-page-CIMMSI25.js +1 -0
- package/dist/gateway/static/root/assets/{personal-settings-panel-9uDaNJy5.js → personal-settings-panel-wKdlrfPq.js} +1 -1
- package/dist/gateway/static/root/assets/{phone-dependencies-card-DLYrI0C4.js → phone-dependencies-card-CDhk5277.js} +1 -1
- package/dist/gateway/static/root/assets/phone-model-connection-DZ-ZunPz.js +1 -0
- package/dist/gateway/static/root/assets/{phone-model-picker-BbA2iI-3.js → phone-model-picker-DuZc5jYO.js} +1 -1
- package/dist/gateway/static/root/assets/phone-settings-page-0u0GQl_R.js +1 -0
- package/dist/gateway/static/root/assets/{phone-workspace-store-CVDk80Bf.js → phone-workspace-store-SN7hfddU.js} +1 -1
- package/dist/gateway/static/root/assets/plugin-details-dialog-Bfc-Wmrd.js +1 -0
- package/dist/gateway/static/root/assets/{popover-select-DD8fmrxH.js → popover-select-CEMWIrtY.js} +1 -1
- package/dist/gateway/static/root/assets/{preference-select-fields-BVoN-lAv.js → preference-select-fields-BKeHZLXZ.js} +1 -1
- package/dist/gateway/static/root/assets/{product-automation-feedback-DCo90zGh.js → product-automation-feedback-BPur0vyo.js} +2 -2
- package/dist/gateway/static/root/assets/{product-open-page-OWl8IAoY.js → product-open-page-Bfd7R483.js} +1 -1
- package/dist/gateway/static/root/assets/{product-preview-content-Cjas7UNe.js → product-preview-content-Bnq68oVw.js} +1 -1
- package/dist/gateway/static/root/assets/{product-preview-modal-CPWRvBI9.js → product-preview-modal-BPmTeweh.js} +2 -2
- package/dist/gateway/static/root/assets/project-detail-page-D9nnyvrI.js +7 -0
- package/dist/gateway/static/root/assets/{project-understanding-Ba02SFzB.js → project-understanding-DLvxAoTT.js} +1 -1
- package/dist/gateway/static/root/assets/projects-page-BGy1pw9a.js +1 -0
- package/dist/gateway/static/root/assets/{providers-api-rwQ4LWzr.js → providers-api-DOnNfkwQ.js} +1 -1
- package/dist/gateway/static/root/assets/{recording-upload-BSmvRrZQ.js → recording-upload-CHFJbqW1.js} +1 -1
- package/dist/gateway/static/root/assets/{refresh-button-bU_0NarN.js → refresh-button-DiWdGAaX.js} +1 -1
- package/dist/gateway/static/root/assets/{registry-api-Vy7LfH6E.js → registry-api-DFDvOTg4.js} +1 -1
- package/dist/gateway/static/root/assets/{remote-access-hub-UXrnpGev.js → remote-access-hub-BVqwnOqO.js} +1 -1
- package/dist/gateway/static/root/assets/{resource-unavailable-f9OzSi4W.js → resource-unavailable-TQcRCpAg.js} +1 -1
- package/dist/gateway/static/root/assets/route-preload-DI43HQV_.js +2 -0
- package/dist/gateway/static/root/assets/{runtime-tools-api-Bt8t37z5.js → runtime-tools-api-9o3Wfji1.js} +1 -1
- package/dist/gateway/static/root/assets/{runtime-tools-settings-panel-DU4UXnBm.js → runtime-tools-settings-panel-ccVBG-bZ.js} +1 -1
- package/dist/gateway/static/root/assets/{schema-form-BKeP5G7b.js → schema-form-C-jw6Hid.js} +1 -1
- package/dist/gateway/static/root/assets/{secret-input-BQvFXqzz.js → secret-input-Dryrns2s.js} +1 -1
- package/dist/gateway/static/root/assets/{service-recommendation-list-CuYsRcBB.js → service-recommendation-list-CNghOavt.js} +1 -1
- package/dist/gateway/static/root/assets/{session-api-DJI9eSgw.js → session-api-Bs3r_d2_.js} +1 -1
- package/dist/gateway/static/root/assets/session-manager-Bnq3qpqy.js +23 -0
- package/dist/gateway/static/root/assets/sessions-page-CyBj1Xw2.js +1 -0
- package/dist/gateway/static/root/assets/settings-advanced-gate-BI4DMz4_.js +1 -0
- package/dist/gateway/static/root/assets/{settings-advanced-section-BxUuF_yi.js → settings-advanced-section-DwpPPxT0.js} +1 -1
- package/dist/gateway/static/root/assets/{settings-mode-store-CaoRh2gt.js → settings-mode-store-CiRpsdTJ.js} +1 -1
- package/dist/gateway/static/root/assets/{settings-page-qQ8-6dJ_.js → settings-page-Cd8Ermnn.js} +1 -1
- package/dist/gateway/static/root/assets/{settings-page-header-CyUHrn7c.js → settings-page-header-BZl4AMiN.js} +1 -1
- package/dist/gateway/static/root/assets/{settings-page-layout-DGVqXrlp.js → settings-page-layout-onhEgq-K.js} +1 -1
- package/dist/gateway/static/root/assets/setup-interaction-page-Cvvj6JyV.js +1 -0
- package/dist/gateway/static/root/assets/setup-status-panel-D4qgE7QM.js +1 -0
- package/dist/gateway/static/root/assets/share-link-dialog-DA0QuFOD.js +1 -0
- package/dist/gateway/static/root/assets/{share-preview-page-Cem96FbB.js → share-preview-page-YDpIY4dC.js} +1 -1
- package/dist/gateway/static/root/assets/{shares-api-Dowes16l.js → shares-api-D8Q-m46d.js} +1 -1
- package/dist/gateway/static/root/assets/shares-settings-DUvjOMmA.js +1 -0
- package/dist/gateway/static/root/assets/{skill-api-D8ZwFEVe.js → skill-api-uKU4sRiv.js} +1 -1
- package/dist/gateway/static/root/assets/{skill-list-api-B4gp00-f.js → skill-list-api-BzKzG-xG.js} +1 -1
- package/dist/gateway/static/root/assets/{skill-reload-api-ClmaaDXo.js → skill-reload-api-DkUXekcd.js} +1 -1
- package/dist/gateway/static/root/assets/skills-page-ClyNSh-7.js +2 -0
- package/dist/gateway/static/root/assets/{system-settings-panel-D095uacX.js → system-settings-panel-BN6sUX0H.js} +1 -1
- package/dist/gateway/static/root/assets/task-detail-page-CS9m7Ipo.js +2 -0
- package/dist/gateway/static/root/assets/{task-result-evidence-LUrJlUhb.js → task-result-evidence-DKygspo2.js} +1 -1
- package/dist/gateway/static/root/assets/{terminal-panel-store-BqEDB1Vl.js → terminal-panel-store-DJVC7HqA.js} +1 -1
- package/dist/gateway/static/root/assets/{theme-store-gAcojLgP.js → theme-store-Dlnmgryi.js} +1 -1
- package/dist/gateway/static/root/assets/tool-friendly-title-DcCc6g7o.js +1 -0
- package/dist/gateway/static/root/assets/tracing-settings-page-Bs76WeoF.js +1 -0
- package/dist/gateway/static/root/assets/{tunnel-api-C9u9E3UQ.js → tunnel-api-B7nx0NQJ.js} +1 -1
- package/dist/gateway/static/root/assets/{understanding-activity-store-BTrzsR6_.js → understanding-activity-store-C4bblRnQ.js} +1 -1
- package/dist/gateway/static/root/assets/{understanding-refresh-store-5Qava3jh.js → understanding-refresh-store-BvCj9-Ue.js} +1 -1
- package/dist/gateway/static/root/assets/{usage-page-DFMLYKAc.js → usage-page-anU5gslJ.js} +1 -1
- package/dist/gateway/static/root/assets/{use-autosave-3O-X7x15.js → use-autosave-YHxQ-UZg.js} +1 -1
- package/dist/gateway/static/root/assets/use-composer-attachments-DYY3Yz4a.js +2 -0
- package/dist/gateway/static/root/assets/use-file-preview-expanded-CYgWzDnv.js +2 -0
- package/dist/gateway/static/root/assets/{use-personal-profile-MusPgljM.js → use-personal-profile-D2Un8G1L.js} +1 -1
- package/dist/gateway/static/root/assets/{use-workspace-tree-Ck_U2yTw.js → use-workspace-tree-Dkg9tUr4.js} +1 -1
- package/dist/gateway/static/root/assets/user-model-page-DIgPL3tN.js +2 -0
- package/dist/gateway/static/root/assets/{voice-api-key-field-C5zJApoa.js → voice-api-key-field-BUes-Jlp.js} +1 -1
- package/dist/gateway/static/root/assets/{voice-config-api-DC1bYDt1.js → voice-config-api-CrULrSKC.js} +1 -1
- package/dist/gateway/static/root/assets/{voice-input-shortcut-events-0SZjJdVV.js → voice-input-shortcut-events-DFMNIyy4.js} +1 -1
- package/dist/gateway/static/root/assets/voice-transcribe-api-Dy4hfftb.js +1 -0
- package/dist/gateway/static/root/assets/{work-discovery-overlay-DAQ8McVe.js → work-discovery-overlay-CFF4cRFl.js} +1 -1
- package/dist/gateway/static/root/assets/{work-discovery-page-DUQysEyb.js → work-discovery-page-BnYaVH3V.js} +1 -1
- package/dist/gateway/static/root/assets/working-directory-picker-modal-GFwVefVA.js +1 -0
- package/dist/gateway/static/root/assets/{workspace-api-ZrN6yUER.js → workspace-api-BdB4NEOh.js} +2 -2
- package/dist/gateway/static/root/assets/workspace-editor-agent-store-4cZ26iaD.js +1 -0
- package/dist/gateway/static/root/assets/{workspace-file-preview-dialog-Yj_kBWSb.js → workspace-file-preview-dialog-NRL3YRjg.js} +1 -1
- package/dist/gateway/static/root/assets/{workspace-open-location-menu-yxT7wajO.js → workspace-open-location-menu-Dcij7wvJ.js} +1 -1
- package/dist/gateway/static/root/assets/{xopc-cloud-account-card-IcH9KDzx.js → xopc-cloud-account-card-DC9aG7Pl.js} +1 -1
- package/dist/gateway/static/root/index.html +100 -98
- package/dist/package.js +1 -1
- package/dist/packages/gateway-contract/src/automations.js +7 -0
- package/dist/packages/gateway-contract/src/capabilities.js +1 -1
- package/dist/src/agent/agent-manager.d.ts +1 -0
- package/dist/src/agent/agent-manager.js +1 -0
- package/dist/src/agent/child-agent-factory.js +1 -1
- package/dist/src/agent/data-acquisition/service.js +1 -1
- package/dist/src/agent/embedded/configuration-capability-correction.d.ts +3 -0
- package/dist/src/agent/embedded/configuration-capability-correction.js +14 -0
- package/dist/src/agent/embedded/run-for-session.js +20 -5
- package/dist/src/agent/embedded/run-turn.js +13 -1
- package/dist/src/agent/embedded/session-runner.js +6 -3
- package/dist/src/agent/image/generation/openai-images-provider.js +1 -1
- package/dist/src/agent/image/load-image-media.js +1 -1
- package/dist/src/agent/inbound/inbound-loop.js +4 -1
- package/dist/src/agent/independent-execution.js +1 -1
- package/dist/src/agent/mcp/config.js +1 -1
- package/dist/src/agent/mcp/connection-drafts.d.ts +3 -1
- package/dist/src/agent/mcp/connection-drafts.js +3 -2
- package/dist/src/agent/mcp/connection-setup.js +34 -2
- package/dist/src/agent/mcp/conversation-setup.d.ts +163 -0
- package/dist/src/agent/mcp/conversation-setup.js +621 -0
- package/dist/src/agent/mcp/native-mcp.d.ts +1 -0
- package/dist/src/agent/mcp/tool-catalog.d.ts +5 -0
- package/dist/src/agent/mcp/tool-catalog.js +19 -2
- package/dist/src/agent/mcp/weixin-setup-scope.d.ts +12 -0
- package/dist/src/agent/mcp/weixin-setup-scope.js +43 -0
- package/dist/src/agent/prompt/conversational-configuration-guide.js +2 -1
- package/dist/src/agent/prompt/sections/tooling.js +3 -2
- package/dist/src/agent/prompt/service-prompt-builder.js +1 -1
- package/dist/src/agent/service/direct-turn-helpers.js +1 -1
- package/dist/src/agent/service/process-direct-streaming.js +2 -2
- package/dist/src/agent/service.d.ts +2 -0
- package/dist/src/agent/service.js +11 -1
- package/dist/src/agent/service.types.d.ts +1 -0
- package/dist/src/agent/tasks/task-judge-service.js +2 -2
- package/dist/src/agent/tool-manuals/xopc-configuration.d.ts +6 -4
- package/dist/src/agent/tool-manuals/xopc-configuration.js +92 -8
- package/dist/src/agent/tools/automation-tool.d.ts +9 -1
- package/dist/src/agent/tools/automation-tool.js +34 -5
- package/dist/src/agent/tools/create-share-tool.js +1 -1
- package/dist/src/agent/tools/factory.d.ts +3 -0
- package/dist/src/agent/tools/factory.js +34 -23
- package/dist/src/agent/tools/image-generate-tool.js +3 -3
- package/dist/src/agent/tools/index.d.ts +1 -0
- package/dist/src/agent/tools/index.js +5 -4
- package/dist/src/agent/tools/mcp-setup-tool.d.ts +9 -0
- package/dist/src/agent/tools/mcp-setup-tool.js +32 -0
- package/dist/src/agent/tools/personal-task-tool.js +2 -2
- package/dist/src/agent/tools/publish-artifacts.js +1 -1
- package/dist/src/agent/tools/read.js +1 -1
- package/dist/src/agent/tools/skill-install-tool.js +56 -1
- package/dist/src/agent/tools/skill-manage-tool.d.ts +4 -0
- package/dist/src/agent/tools/skill-manage-tool.js +74 -2
- package/dist/src/agent/tools/skills-tools.js +1 -1
- package/dist/src/agent/tools/task-collaboration-tool.js +1 -1
- package/dist/src/agent/tools/tool-manual-tool.d.ts +1 -1
- package/dist/src/agent/tools/tool-manual-tool.js +3 -1
- package/dist/src/agent/tools/toolExposure.js +2 -0
- package/dist/src/agent/tools/write.js +1 -1
- package/dist/src/agent/tools/xopc-use-tool.d.ts +4 -2
- package/dist/src/agent/tools/xopc-use-tool.js +60 -10
- package/dist/src/agent-catalog/service.d.ts +1 -1
- package/dist/src/agent-catalog/service.js +2 -1
- package/dist/src/automations/capabilities/drafts.js +5 -2
- package/dist/src/automations/capabilities/read.js +18 -7
- package/dist/src/automations/capabilities/write.d.ts +111 -52
- package/dist/src/automations/capabilities/write.js +44 -10
- package/dist/src/automations/delivery/delivery-router.d.ts +1 -0
- package/dist/src/automations/delivery/delivery-router.js +7 -1
- package/dist/src/automations/domain/types.d.ts +8 -0
- package/dist/src/automations/domain/validation.d.ts +24 -0
- package/dist/src/automations/domain/validation.js +7 -0
- package/dist/src/automations/draft/automation-draft-validator.d.ts +6 -0
- package/dist/src/automations/index.js +2 -2
- package/dist/src/automations/mcp-source.d.ts +60 -0
- package/dist/src/automations/mcp-source.js +173 -0
- package/dist/src/automations/service/action-executor.js +15 -1
- package/dist/src/automations/service/automation-service.d.ts +5 -0
- package/dist/src/automations/service/automation-service.js +52 -2
- package/dist/src/automations/service/index.js +2 -2
- package/dist/src/browser/setup/repository.d.ts +1 -0
- package/dist/src/browser/setup/repository.js +7 -1
- package/dist/src/browser/setup/service.d.ts +3 -0
- package/dist/src/browser/setup/service.js +41 -18
- package/dist/src/browser/setup/types.d.ts +1 -0
- package/dist/src/channels/attachments/voice-stt-webchat.js +1 -1
- package/dist/src/channels/index.js +1 -1
- package/dist/src/channels/manager.d.ts +1 -0
- package/dist/src/channels/outbound-sender.d.ts +1 -0
- package/dist/src/channels/outbound-sender.js +3 -0
- package/dist/src/channels/pairing/pairing-service.js +1 -1
- package/dist/src/channels/weixin/account-identity.d.ts +2 -0
- package/dist/src/channels/weixin/account-identity.js +15 -0
- package/dist/src/chat-commands/builtins/config.js +1 -1
- package/dist/src/cli/commands/backup.js +1 -1
- package/dist/src/cli/commands/channels.js +2 -2
- package/dist/src/cli/commands/doctor/checks/channel-pairing-pending.js +1 -1
- package/dist/src/cli/commands/mcp.js +1 -1
- package/dist/src/config/models-json.d.ts +12 -0
- package/dist/src/extensions/agent-plugins/credentials.js +1 -1
- package/dist/src/extensions/agent-plugins/setup.d.ts +1 -1
- package/dist/src/extensions/agent-plugins/setup.js +3 -3
- package/dist/src/extensions/api.js +1 -1
- package/dist/src/gateway/agent-builtin-tools.d.ts +1 -1
- package/dist/src/gateway/agents-admin.js +1 -1
- package/dist/src/gateway/device-routes.js +1 -1
- package/dist/src/gateway/global-defaults-admin.js +1 -1
- package/dist/src/gateway/hono/app.js +1 -1
- package/dist/src/gateway/hono/lib/config-payload.js +1 -1
- package/dist/src/gateway/hono/oauth-async.js +1 -1
- package/dist/src/gateway/hono/routes/channels.js +1 -1
- package/dist/src/gateway/hono/routes/config.js +1 -1
- package/dist/src/gateway/hono/routes/lazy-bundles.js +1 -1
- package/dist/src/gateway/hono/routes/mcp.js +39 -2
- package/dist/src/gateway/hono/routes/notes.js +2 -2
- package/dist/src/gateway/hono/routes/phone-setup.js +45 -16
- package/dist/src/gateway/hono/routes/phone.js +2 -4
- package/dist/src/gateway/hono/routes/projects.js +1 -1
- package/dist/src/gateway/hono/routes/provider-setup.js +1 -1
- package/dist/src/gateway/hono/routes/public-gateway.js +22 -0
- package/dist/src/gateway/hono/routes/session-input-handler.js +1 -1
- package/dist/src/gateway/hono/routes/shares.js +1 -1
- package/dist/src/gateway/hono/routes/site-shares.js +1 -1
- package/dist/src/gateway/hono/routes/tasks.js +1 -1
- package/dist/src/gateway/media-access.js +1 -1
- package/dist/src/gateway/service/agent-runner.d.ts +1 -0
- package/dist/src/gateway/service/agent-runner.js +3 -1
- package/dist/src/gateway/service/config-coordinator.d.ts +1 -1
- package/dist/src/gateway/service/config-coordinator.js +2 -1
- package/dist/src/gateway/service/run-gateway-agent.js +1 -1
- package/dist/src/gateway/service/sessions-api.js +2 -1
- package/dist/src/gateway/service.d.ts +5 -1
- package/dist/src/gateway/service.js +86 -12
- package/dist/src/gateway/session-context-summary.js +1 -1
- package/dist/src/gateway/session-reset-service.d.ts +1 -0
- package/dist/src/gateway/session-reset-service.js +15 -2
- package/dist/src/gateway/xopc-cloud-capability-setup.js +9 -1
- package/dist/src/notes/service.js +1 -1
- package/dist/src/personal-agent/prompts.js +1 -1
- package/dist/src/personal-agent/reply-composer.js +2 -2
- package/dist/src/personal-agent/request-service.js +3 -3
- package/dist/src/personal-agent/service.js +1 -1
- package/dist/src/personal-agent/task-cancel.js +1 -1
- package/dist/src/phone/cloud-adb-connection.js +8 -5
- package/dist/src/phone/contracts.d.ts +4 -0
- package/dist/src/phone/contracts.js +6 -1
- package/dist/src/phone/gui-protocol.d.ts +7 -0
- package/dist/src/phone/gui-protocol.js +302 -0
- package/dist/src/phone/model-adapter.d.ts +1 -1
- package/dist/src/phone/model-adapter.js +7 -4
- package/dist/src/phone/runtime.js +8 -2
- package/dist/src/phone/setup/service.d.ts +14 -4
- package/dist/src/phone/setup/service.js +106 -28
- package/dist/src/phone/ui-dump-binary.d.ts +1 -1
- package/dist/src/phone/ui-dump-binary.js +1 -1
- package/dist/src/phone/ui-session.d.ts +2 -0
- package/dist/src/phone/ui-session.js +23 -4
- package/dist/src/projects/index.js +1 -1
- package/dist/src/projects/project-service.js +1 -1
- package/dist/src/providers/env-keys.js +2 -0
- package/dist/src/providers/index.js +11 -0
- package/dist/src/providers/model-catalog-types.d.ts +1 -1
- package/dist/src/providers/model-supplements.d.ts +1 -1
- package/dist/src/providers/model-supplements.js +6 -3
- package/dist/src/providers/phone-models.d.ts +3 -0
- package/dist/src/providers/phone-models.js +33 -0
- package/dist/src/providers/presentation.js +0 -1
- package/dist/src/runtime-tools/phone-dependencies.d.ts +2 -0
- package/dist/src/runtime-tools/phone-dependencies.js +10 -0
- package/dist/src/share/note-share-service.js +1 -1
- package/dist/src/share/site-proxy.js +1 -1
- package/dist/src/tasks/capabilities/write.js +1 -1
- package/dist/src/tasks/index.js +1 -1
- package/dist/src/tasks/task-allocation-service.js +3 -3
- package/dist/src/tasks/task-application-service.js +2 -2
- package/dist/src/tasks/task-context-assembler.js +1 -1
- package/dist/src/tasks/task-contract-planner.js +1 -1
- package/dist/src/tasks/task-handoff.js +1 -1
- package/dist/src/tasks/task-research-result.js +1 -1
- package/dist/src/tasks/task-run-coordinator.js +2 -2
- package/dist/src/tui/backends/embedded-backend.js +1 -1
- package/dist/src/tui/tui.js +1 -1
- package/dist/src/voice/platform-catalog.d.ts +1 -1
- package/package.json +3 -1
- package/skills/tools/configure-xopc/SKILL.md +10 -3
- package/skills/tools/configure-xopc/references/browser/chrome-extension.md +4 -1
- package/skills/tools/configure-xopc/references/browser/overview.md +2 -2
- package/skills/tools/configure-xopc/references/phone/aliyun.md +3 -2
- package/skills/tools/configure-xopc/references/phone/overview.md +2 -2
- package/dist/gateway/static/root/assets/agent-defaults-settings-panel-DlvjxWg6.js +0 -1
- package/dist/gateway/static/root/assets/agent-plugin-dialog-OBueuQSc.js +0 -1
- package/dist/gateway/static/root/assets/agents-Cp6_5OOQ.js +0 -77
- package/dist/gateway/static/root/assets/app-link-1j40sJ-z.js +0 -1
- package/dist/gateway/static/root/assets/apps-page-C2WKUwtN.js +0 -1
- package/dist/gateway/static/root/assets/attachment-load-qjPpQzYY.js +0 -1
- package/dist/gateway/static/root/assets/automation-task-card-wbnR5i6N.js +0 -3
- package/dist/gateway/static/root/assets/automations-workspace-D6cTOKr7.js +0 -9
- package/dist/gateway/static/root/assets/browser-settings-page-L0nBjfhG.js +0 -3
- package/dist/gateway/static/root/assets/capabilities-aT-QjNTl.js +0 -1
- package/dist/gateway/static/root/assets/capabilities-page-DlpuHdHi.js +0 -2
- package/dist/gateway/static/root/assets/capabilities-settings-panel-pvqkN2-2.js +0 -8
- package/dist/gateway/static/root/assets/channels-BUPtawh6.js +0 -1
- package/dist/gateway/static/root/assets/chat-page-BP0huA-W.js +0 -72
- package/dist/gateway/static/root/assets/composer-payload-handoff-CYIhcczq.js +0 -1
- package/dist/gateway/static/root/assets/confirm-dialog-XGclfBqe.js +0 -1
- package/dist/gateway/static/root/assets/connected-providers-grid-CKZfhHSD.js +0 -1
- package/dist/gateway/static/root/assets/connectors-page-Lf1ZzaVn.js +0 -1
- package/dist/gateway/static/root/assets/dependency-picker-UqKVJ9dv.js +0 -1
- package/dist/gateway/static/root/assets/device-pairing-wizard-ByEL5lvM.js +0 -1
- package/dist/gateway/static/root/assets/dist-CaUuvp8-.js +0 -1
- package/dist/gateway/static/root/assets/dist-D3lWNSe7.js +0 -1
- package/dist/gateway/static/root/assets/dist-DfWfZ9iu.js +0 -1
- package/dist/gateway/static/root/assets/dist-DusecO_p.js +0 -1
- package/dist/gateway/static/root/assets/gateway-realtime-store-Bkt1z-xo.js +0 -1
- package/dist/gateway/static/root/assets/home-page-k9LFXcVa.js +0 -2
- package/dist/gateway/static/root/assets/index-CpwPxKQ8.css +0 -1
- package/dist/gateway/static/root/assets/index-DKW7BeT_.js +0 -11
- package/dist/gateway/static/root/assets/install-connector-dialog-CTQAKTPv.js +0 -1
- package/dist/gateway/static/root/assets/local-app-workbench-page-CD_8_gd_.js +0 -1
- package/dist/gateway/static/root/assets/management-settings-t_Z2mCyw.js +0 -1
- package/dist/gateway/static/root/assets/messages-DG4HLOER.js +0 -3
- package/dist/gateway/static/root/assets/model-selector-a7PIT1Lk.js +0 -1
- package/dist/gateway/static/root/assets/note-detail-panel-BsHYUFgk.js +0 -5
- package/dist/gateway/static/root/assets/note-image-lightbox-B-bEtjhj.js +0 -1
- package/dist/gateway/static/root/assets/page-header-store-BdZnUh-D.js +0 -1
- package/dist/gateway/static/root/assets/personal-page-KJezmTKP.js +0 -1
- package/dist/gateway/static/root/assets/phone-settings-page-Cg_BPss4.js +0 -1
- package/dist/gateway/static/root/assets/plugin-details-dialog-DgibLkc3.js +0 -1
- package/dist/gateway/static/root/assets/project-detail-page-B_HlZux_.js +0 -7
- package/dist/gateway/static/root/assets/projects-page-CdfKjp95.js +0 -1
- package/dist/gateway/static/root/assets/route-preload-BtObM-co.js +0 -2
- package/dist/gateway/static/root/assets/session-manager-CtKgACGl.js +0 -23
- package/dist/gateway/static/root/assets/sessions-page-BAsKzRHt.js +0 -1
- package/dist/gateway/static/root/assets/settings-advanced-gate-CjAFqg2U.js +0 -1
- package/dist/gateway/static/root/assets/setup-status-panel-BpaPb625.js +0 -1
- package/dist/gateway/static/root/assets/share-link-dialog-CQJ6Ykm2.js +0 -1
- package/dist/gateway/static/root/assets/shares-settings-DZEkZDR0.js +0 -1
- package/dist/gateway/static/root/assets/skills-page-CV0X9rvG.js +0 -2
- package/dist/gateway/static/root/assets/task-detail-page-CY2C4AM2.js +0 -2
- package/dist/gateway/static/root/assets/tool-friendly-title-o6sxGVUu.js +0 -1
- package/dist/gateway/static/root/assets/tracing-settings-page-B1ZRh-Is.js +0 -1
- package/dist/gateway/static/root/assets/use-composer-attachments-BLc4dBfe.js +0 -2
- package/dist/gateway/static/root/assets/use-file-preview-expanded-BaOmTXsT.js +0 -2
- package/dist/gateway/static/root/assets/user-model-page-Den5Lg-k.js +0 -2
- package/dist/gateway/static/root/assets/voice-transcribe-api-CxVeANPX.js +0 -1
- package/dist/gateway/static/root/assets/working-directory-picker-modal-BO9qdJyZ.js +0 -1
- package/dist/gateway/static/root/assets/workspace-editor-agent-store-Bo5dwoWP.js +0 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{a as t,n,t as r}from"./vendor-react-BOUWij0V.js";import{t as i}from"./chunk-KS7C4IRE-CiwuuyV8.js";import{a,i as o,n as s,o as c}from"./locale-store-Br7IfbXK.js";import{a as l,i as u,n as d,o as f,r as p,s as m,t as h}from"./dist-BGTk37IG.js";import{t as g}from"./createLucideIcon-DPHK1VkS.js";import{n as _,r as v}from"./popover-select-CEMWIrtY.js";import{t as ee}from"./circle-check-C23XjkUj.js";import{t as y}from"./external-link-DjqjBmc3.js";import{t as b}from"./secret-input-Dryrns2s.js";import{t as x}from"./loader-circle-CifKLtgG.js";import{t as S}from"./x-B_N4OPjy.js";import{t as C}from"./cn-0WouolD0.js";import{t as w}from"./skeleton-BI5TyibZ.js";import{t as T}from"./button-Cc4hUNTt.js";import{n as E}from"./interaction-BdhHBbYa.js";import{A as D,N as te,f as O,g as k,h as ne,j as A,k as j,p as M,w as N,z as P}from"./connectors-api-DEJU8mgn.js";import{s as F}from"./form-field-width-DJw_jULe.js";import{n as I}from"./electron-env-DHOGevH3.js";import{t as L}from"./oauth-provider-connect-CfOK8mPM.js";var R=g(`package-plus`,[[`path`,{d:`M12 22V12`,key:`d0xqtd`}],[`path`,{d:`M16 17h6`,key:`1ook5g`}],[`path`,{d:`M19 14v6`,key:`1ckrd5`}],[`path`,{d:`M21 10.535V8a2 2 0 0 0-1-1.73l-7-4a2 2 0 0 0-2 0l-7 4A2 2 0 0 0 3 8v8a2 2 0 0 0 1 1.729l7 4a2 2 0 0 0 2 .001l1.675-.955`,key:`28k6lz`}],[`path`,{d:`M3.29 7 12 12l8.71-5`,key:`19ckod`}],[`path`,{d:`m7.5 4.27 8.997 5.148`,key:`9yrvtv`}]]);function z(e,t){let n={};for(let t of e.setup.secrets??[])n[t.key]=``;let r={};for(let t of e.setup.config??[])r[t.key]=t.defaultValue===void 0?``:typeof t.defaultValue==`string`?t.defaultValue:JSON.stringify(t.defaultValue,null,2);return{connector:e,secrets:n,config:r,installing:!1,error:null,result:null,health:null,...t?{store:t}:{}}}var B=n(),V=e(t(),1),H=r();async function U(e,t){let n=await c(o(e),t);if(!n.ok)throw Error(n.error??`Connection request failed.`);return n.payload}function W({definition:e,instance:t,onClose:n,onChanged:r}){let i=s(e=>e.language)===`zh`,[c,d]=(0,V.useState)(t),[g,ee]=(0,V.useState)(),[y,b]=(0,V.useState)(),[C,E]=(0,V.useState)(),[D,O]=(0,V.useState)(),[k,A]=(0,V.useState)(!1),[M,P]=(0,V.useState)(),F=c?.instanceId??e.id,I=(0,V.useCallback)(async()=>{let e=await U(`/api/connectors/${encodeURIComponent(F)}/accounts`);ee(e),e.authorization&&b(e.authorization)},[F]);(0,V.useEffect)(()=>{c&&I().catch(e=>P(String(e)))},[c,I]);let L=y&&[`preparing`,`awaiting_user`,`verifying`].includes(y.status);(0,V.useEffect)(()=>{if(!L||!y)return;let e=!1,t=!1,n=async()=>{if(!t){t=!0;try{let t=await U(`/api/connectors/authorizations/${y.id}`);if(e)return;b(t.authorization),t.authorization.status===`succeeded`&&(await I(),c&&await r(c))}catch(t){e||P(String(t))}finally{t=!1}}},i=()=>{n()},a=()=>{document.visibilityState===`visible`&&i()};i();let o=setInterval(i,1500);return window.addEventListener(`focus`,i),document.addEventListener(`visibilitychange`,a),()=>{e=!0,clearInterval(o),window.removeEventListener(`focus`,i),document.removeEventListener(`visibilitychange`,a)}},[L,y?.id,c,r,I]);let R=y?.challenge?.type===`qr_code`?y.challenge.artifactId:void 0;(0,V.useEffect)(()=>{if(!R){E(void 0);return}let e=!1,t;return a(o(`/api/connectors/authorizations/${R}/artifact`)).then(async n=>{if(!n.ok)throw Error(`QR code unavailable.`);let r=await n.blob();e||(t=URL.createObjectURL(r),E(t))}).catch(t=>{e||P(String(t))}),()=>{e=!0,t&&URL.revokeObjectURL(t)}},[R]);let z=async t=>{A(!0),P(void 0);try{let n=c??await ne(e.id,{});d(n);let r=await U(`/api/connectors/${encodeURIComponent(n.instanceId)}/authorizations`,{method:`POST`,body:JSON.stringify({accountId:t})});b(r.authorization)}catch(e){P(e instanceof Error?e.message:String(e))}finally{A(!1)}},B=async e=>{A(!0),P(void 0);try{await U(`/api/connectors/${encodeURIComponent(F)}/policy`,{method:`PATCH`,body:JSON.stringify({maxScope:e})}),await I()}catch(e){P(String(e))}finally{A(!1)}},W=async e=>{A(!0),P(void 0);try{await U(`/api/connectors/accounts/${encodeURIComponent(e)}`,{method:`DELETE`}),await I()}catch(e){P(String(e))}finally{A(!1)}},G=async e=>{if(c){A(!0),P(void 0);try{if(e===`remove`)await N(F),await r(c),n();else if(e===`toggle`){let e=await j(F,!c.enabled);d(e),await r(e)}else{let e=await te(F);O(e.ok?i?`验证通过,可用操作:${e.toolCount}`:`Verified: ${e.toolCount} actions`:e.error??e.action??e.status)}}catch(e){P(String(e))}finally{A(!1)}}},K=()=>{c&&r(c),n()};return(0,H.jsx)(h,{open:!0,onOpenChange:e=>{e||K()},children:(0,H.jsxs)(f,{children:[(0,H.jsx)(l,{className:`fixed inset-0 z-50 bg-black/40`}),(0,H.jsxs)(p,{className:`fixed left-1/2 top-1/2 z-50 flex h-[min(38rem,calc(100dvh-2rem))] w-[min(36rem,calc(100vw-2rem))] -translate-x-1/2 -translate-y-1/2 flex-col overflow-hidden rounded-xl border border-edge bg-surface-overlay text-fg`,children:[(0,H.jsxs)(`div`,{className:`flex items-center justify-between border-b border-edge p-5`,children:[(0,H.jsxs)(`div`,{children:[(0,H.jsx)(m,{className:`font-semibold`,children:e.displayName}),(0,H.jsx)(u,{className:`mt-1 text-sm text-fg-muted`,children:i?`连接账号并设置允许的操作。`:`Connect an account and choose allowed actions.`})]}),(0,H.jsx)(T,{variant:`ghost`,onClick:K,"aria-label":i?`关闭`:`Close`,children:(0,H.jsx)(S,{className:`size-4`})})]}),(0,H.jsxs)(`div`,{className:`min-h-0 flex-1 space-y-5 overflow-y-auto p-5`,children:[M?(0,H.jsx)(`p`,{role:`alert`,className:`text-sm text-red-600`,children:M}):null,c&&!g?(0,H.jsx)(w,{className:`h-24 w-full`}):null,c?(0,H.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[(0,H.jsx)(T,{disabled:k||!!L,onClick:()=>void G(`toggle`),children:c.enabled?i?`停用`:`Disable`:i?`启用`:`Enable`}),(0,H.jsx)(T,{disabled:k||!!L||!c.enabled,onClick:()=>void G(`test`),children:i?`检查连接`:`Check connection`}),(0,H.jsx)(T,{variant:`ghost`,disabled:k||!!L,onClick:()=>void G(`remove`),children:i?`移除连接`:`Remove connection`})]}):null,D?(0,H.jsx)(`p`,{className:`text-sm text-fg-muted`,children:D}):null,g?.accounts.map(e=>(0,H.jsxs)(`div`,{className:`space-y-2 rounded-lg border border-edge p-3`,children:[(0,H.jsx)(`p`,{className:`text-sm font-medium`,children:e.label??e.id}),(0,H.jsx)(`p`,{className:`break-all text-xs text-fg-muted`,children:String(e.identity.openId??e.identity.botId??e.identity.userId??e.id)}),(0,H.jsx)(`p`,{className:`text-xs text-fg-muted`,children:e.enabled&&e.status===`active`?i?`已连接`:`Connected`:i?`已断开`:`Disconnected`}),(0,H.jsxs)(`div`,{className:`flex gap-2`,children:[(0,H.jsx)(T,{variant:`secondary`,disabled:k||!!L||c?.enabled===!1,onClick:()=>void z(e.id),children:i?`重新连接`:`Reconnect`}),(0,H.jsx)(T,{variant:`ghost`,disabled:k||!!L||!e.enabled,onClick:()=>void W(e.id),children:i?`断开本地连接`:`Disconnect locally`})]})]},e.id)),g?.policy?(0,H.jsxs)(`div`,{className:`space-y-2`,children:[(0,H.jsx)(`p`,{className:`text-sm`,children:i?`允许的操作`:`Allowed actions`}),(0,H.jsxs)(_,{value:g.policy.maxScope,onChange:e=>void B(e.target.value),disabled:k,children:[(0,H.jsx)(v,{value:`read`,children:i?`仅查看`:`Read only`}),(0,H.jsx)(v,{value:`write`,children:i?`查看并执行操作`:`Read and write`})]}),(0,H.jsx)(`p`,{className:`text-xs text-fg-muted`,children:i?`写入操作需要确认。断开本地连接不会撤销第三方授权。`:`Writes require confirmation. Local disconnection does not revoke provider authorization.`})]}):null,y?(0,H.jsxs)(`div`,{className:`space-y-3 rounded-lg border border-edge p-4`,"aria-live":`polite`,children:[(0,H.jsx)(`p`,{className:`text-sm`,children:y.status===`succeeded`?i?`账号验证成功`:`Account verified`:y.status===`preparing`?i?`正在准备授权…`:`Preparing authorization…`:y.status===`verifying`?i?`授权已完成,正在验证账号…`:`Authorization complete. Verifying account…`:L?i?`请完成当前步骤,返回后会自动检查结果。`:`Complete this step. We will check the result when you return.`:y.error??(i?`授权已结束,请重新连接。`:`Authorization ended. Connect again.`)}),L&&y.challenge&&y.challenge.totalSteps>1?(0,H.jsxs)(`p`,{className:`text-sm font-medium`,children:[i?`第 ${y.challenge.step} / ${y.challenge.totalSteps} 步`:`Step ${y.challenge.step} of ${y.challenge.totalSteps}`,y.challenge.step>1?i?`:上一步已完成,请打开新的授权页面继续。`:`: Previous step complete. Open the new authorization page to continue.`:i?`:完成后还需要继续授权账号。`:`: Account authorization follows this step.`]}):null,L&&y.challenge?.type===`open_url`?(0,H.jsx)(`a`,{href:y.challenge.url,target:`_blank`,rel:`noopener noreferrer`,className:`text-sm text-accent underline`,children:i?`打开授权页面`:`Open authorization page`},y.challenge.url):null,L&&R?C?(0,H.jsx)(`img`,{src:C,alt:i?`授权二维码`:`Authorization QR code`,className:`mx-auto size-56 bg-white object-contain`}):(0,H.jsx)(w,{className:`mx-auto size-56`}):null,L?(0,H.jsx)(T,{variant:`secondary`,onClick:()=>{U(`/api/connectors/authorizations/${y.id}/cancel`,{method:`POST`}).then(()=>b({...y,status:`cancelled`,challenge:void 0})).catch(e=>P(String(e)))},children:i?`取消授权`:`Cancel authorization`}):null]}):null]}),(0,H.jsxs)(`div`,{className:`flex justify-end gap-2 border-t border-edge p-4`,children:[(0,H.jsx)(T,{variant:`secondary`,onClick:K,children:i?`关闭`:`Close`}),(0,H.jsxs)(T,{disabled:k||!!L||c?.enabled===!1,onClick:()=>void z(),children:[k?(0,H.jsx)(x,{className:`mr-2 size-4 animate-spin`}):null,i?`连接账号`:`Connect account`]})]})]})]})})}function G(e,t){return Object.entries(t).reduce((e,[t,n])=>e.replaceAll(`{{${t}}}`,n),e)}function K(e,t){return e.runtime.type===`composio`?t.connectorDescriptions[e.runtime.toolkit.toLowerCase()]??e.description:e.description}function q(e){return e instanceof Error?e.message:String(e)}function re(e,t){let n=q(e);return/APIKey_InsufficientPermissions/i.test(n)||/["\\]?code["\\]?\s*:\s*812\b/i.test(n)||/session_management/i.test(n)&&/write access|write permission|at least ["\\]?write/i.test(n)?t.composioSessionWritePermissionRequired:n}var J={sm:{frame:`size-9 rounded-lg`,image:`size-7`,fallback:`size-4`},md:{frame:`size-10 rounded-xl`,image:`size-8`,fallback:`size-5`},lg:{frame:`size-12 rounded-xl`,image:`size-10`,fallback:`size-5`}};function ie(e){let t=(0,B.c)(15),{connector:n,size:r,className:i}=e,a=r===void 0?`md`:r,o=n?.branding?.logoUrl,[s,c]=(0,V.useState)(!1),l=J[a],u;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(u=()=>{c(!1)},t[0]=u):u=t[0];let d;t[1]===o?d=t[2]:(d=[o],t[1]=o,t[2]=d),(0,V.useEffect)(u,d);let f;t[3]!==i||t[4]!==l.frame?(f=C(`flex shrink-0 items-center justify-center overflow-hidden border border-edge bg-white`,l.frame,i),t[3]=i,t[4]=l.frame,t[5]=f):f=t[5];let p=n?.displayName,m;t[6]!==l.fallback||t[7]!==l.image||t[8]!==s||t[9]!==o?(m=o&&!s?(0,H.jsx)(`img`,{src:o,alt:``,loading:`lazy`,draggable:!1,className:C(`object-contain`,l.image),onError:()=>c(!0)}):(0,H.jsx)(R,{className:C(`text-fg-muted`,l.fallback),"aria-hidden":!0}),t[6]=l.fallback,t[7]=l.image,t[8]=s,t[9]=o,t[10]=m):m=t[10];let h;return t[11]!==f||t[12]!==p||t[13]!==m?(h=(0,H.jsx)(`span`,{className:f,title:p,children:m}),t[11]=f,t[12]=p,t[13]=m,t[14]=h):h=t[14],h}var Y=C(`w-full rounded-lg border border-edge bg-surface-panel px-3 py-2 text-sm text-fg`,`placeholder:text-fg-subtle`,F),ae=C(Y,`min-h-28 font-mono`);function oe(e,t){return e?t.healthStatusLabels[e]??e:t.healthStatusPending}function se(e,t){let n=t.trim();return e===`json`?n?JSON.parse(n):void 0:e===`number`?n?Number(n):void 0:e===`boolean`?n===`true`:n||void 0}function X({draft:e,onChange:t,onClose:n,onInstalled:r,t:a}){let{connector:o}=e,s=K(o,a),c=o.runtime.type===`composio`&&o.runtime.role===`toolkit`,g=o.runtime.type===`composio`&&o.runtime.role===`toolkit`?o.runtime.toolkit:null,j=o.understanding!=null,[N,F]=(0,V.useState)(!c),[z,B]=(0,V.useState)(null),[U,W]=(0,V.useState)(c),[q,J]=(0,V.useState)(null),[X,ce]=(0,V.useState)(null),[Z,le]=(0,V.useState)(!1),[Q,ue]=(0,V.useState)(!1);(0,V.useEffect)(()=>{if(!c)return;let e=!1;return O().then(t=>{e||(B(t),F(t.configured))}).catch(t=>{e||J(t instanceof Error?t.message:String(t))}).finally(()=>{e||W(!1)}),()=>{e=!0}},[o.id,c]),(0,V.useEffect)(()=>{if(!g||!N)return;let e=!1;return le(!0),M(g).then(t=>{e||ce(t)}).catch(t=>{e||J(t instanceof Error?t.message:String(t))}).finally(()=>{e||le(!1)}),()=>{e=!0}},[N,g]);let de=(0,V.useCallback)(async()=>{let n=I(),i=c&&!n?window.open(``,`_blank`):null;i&&(i.opener=null),J(null),t({...e,installing:!0,error:null,result:null,health:null});try{if(c&&!N)throw Error(a.composioSetupSignInRequired);let s=c&&g?X??await M(g):null,l=e.config.authConfigId?.trim();if(s?.requiresCustomAuthConfig&&!l)throw Error(a.composioAuthConfigRequired);if(l){let e=s?.authConfigs.find(e=>e.id===l);if(!e||e.status!==`ENABLED`||!e.isEnabledForToolRouter)throw Error(a.composioAuthConfigUnavailable)}let u={};for(let t of o.setup.config??[]){let n=se(t.type,e.config[t.key]??``);n!==void 0&&(u[t.key]=n)}l&&(u.authConfigId=l);let d=e.store?await k(e.store.packageName,{secrets:e.secrets,config:u},e.store.version,e.store.reviewHash):await ne(o.id,{secrets:e.secrets,config:u,definition:o.source===`registry`?o:void 0}),f=null;try{if(c){let e=await A(o.id);if(!e.authorizationUrl)throw Error(`The connection service did not return an authorization URL.`);if(n){let t=await window.electronAPI?.shell?.openExternalUrl(e.authorizationUrl);if(!t?.ok)throw Error(t?.error??`Could not open the system browser.`)}else i?i.location.href=e.authorizationUrl:window.open(e.authorizationUrl,`_blank`,`noopener,noreferrer`);let t=await P(g,e.connectionId,12e4,e.attemptId);if(i?.close(),j&&Q){if(!t.accountId)throw Error(`Connector account is unavailable.`);await D(t.accountId)}}}catch(n){i?.close(),t({...e,installing:!1,result:null,health:null,error:c?re(n,a):n instanceof Error?n.message:String(n)}),await r(d);return}if(d.materialized.type===`cli`||d.materialized.type===`mcp`)try{f=await te(d.instanceId)}catch{f=null}t({...e,installing:!1,result:d,health:f}),await r(d)}catch(n){i?.close(),t({...e,installing:!1,error:n instanceof Error?n.message:String(n)})}},[j,X,N,g,o,e,c,Q,t,r,a.composioAuthConfigRequired,a.composioAuthConfigUnavailable,a.composioSetupSignInRequired]),fe=X?.authConfigs.filter(e=>e.status===`ENABLED`&&e.isEnabledForToolRouter)??[],$=X?.requiresCustomAuthConfig===!0,pe=N&&$&&!e.config.authConfigId?.trim();return(0,H.jsx)(h,{open:!0,onOpenChange:e=>{e||n()},children:(0,H.jsxs)(f,{children:[(0,H.jsx)(l,{className:`xopc-dialog-overlay fixed inset-0 z-[60] bg-scrim`}),(0,H.jsxs)(p,{className:C(`xopc-dialog-content fixed left-1/2 top-1/2 z-[60] flex -translate-x-1/2 -translate-y-1/2 flex-col overflow-hidden`,c?`max-h-[calc(100dvh-2rem)] w-[min(100%-2rem,32rem)]`:`h-[min(100dvh-2rem,36rem)] w-[min(100%-2rem,42rem)]`,`rounded-2xl border border-edge bg-surface-overlay shadow-float dark:border-edge`),children:[(0,H.jsxs)(`div`,{className:`flex shrink-0 items-start justify-between gap-3 border-b border-edge-subtle px-6 py-5`,children:[(0,H.jsxs)(`div`,{className:`flex min-w-0 items-start gap-3`,children:[(0,H.jsx)(ie,{connector:o,size:`lg`}),(0,H.jsxs)(`div`,{className:`min-w-0`,children:[(0,H.jsx)(m,{className:`text-base font-semibold text-fg`,children:G(a.connectDialogTitle,{name:o.displayName})}),(0,H.jsx)(u,{className:`mt-1 line-clamp-3 text-sm text-fg-muted`,children:s})]})]}),(0,H.jsx)(d,{asChild:!0,children:(0,H.jsxs)(`button`,{type:`button`,className:C(`rounded-lg p-1.5 text-fg-muted hover:bg-surface-hover hover:text-fg`,E.focusRingPanel),"aria-label":a.modalClose,children:[(0,H.jsx)(S,{className:`size-5`,strokeWidth:1.75,"aria-hidden":!0}),(0,H.jsx)(`span`,{className:`sr-only`,children:a.modalClose})]})})]}),(0,H.jsx)(`div`,{className:C(`min-h-0 overflow-y-auto px-6 py-5`,!c&&`flex-1`),children:(0,H.jsxs)(`div`,{className:`flex flex-col gap-4`,children:[c&&U?(0,H.jsxs)(`section`,{className:`rounded-2xl border border-edge bg-surface-base p-4`,"aria-busy":`true`,"aria-label":a.composioSetupTitle,children:[(0,H.jsx)(w,{className:`h-4 w-40`}),(0,H.jsx)(w,{className:`mt-2 h-3 w-72 max-w-full`}),(0,H.jsx)(w,{className:`mt-3 h-16 w-full rounded-xl`})]}):c&&!N?(0,H.jsxs)(`section`,{className:`rounded-2xl border border-accent/25 bg-accent-soft/50 p-4`,children:[(0,H.jsx)(`h3`,{className:`text-sm font-semibold text-fg`,children:a.composioSetupTitle}),(0,H.jsx)(`p`,{className:`mt-1 text-xs leading-5 text-fg-muted`,children:a.composioSetupHint}),(0,H.jsx)(`div`,{className:`mt-3`,children:(0,H.jsx)(L,{providerId:`xopc-cloud`,displayName:`XOPC Cloud`,connected:!1,onConnected:()=>{O().then(e=>{B(e),F(e.configured)})}})}),(0,H.jsx)(i,{to:`/settings/connector-service`,onClick:n,className:`mt-3 block text-xs text-accent-fg`,children:a.composioSetupByok})]}):null,c&&j?(0,H.jsxs)(`label`,{className:`flex items-start gap-3 rounded-2xl border border-edge bg-surface-base p-4`,children:[(0,H.jsx)(`input`,{type:`checkbox`,className:`mt-0.5 size-4 accent-accent`,checked:Q,onChange:e=>ue(e.currentTarget.checked)}),(0,H.jsxs)(`span`,{children:[(0,H.jsx)(`span`,{className:`block text-sm font-medium text-fg`,children:a.learnAfterConnect}),(0,H.jsx)(`span`,{className:`mt-1 block text-xs leading-5 text-fg-muted`,children:a.learnAfterConnectHint})]})]}):null,c&&N&&z?.mode===`managed`?(0,H.jsx)(`p`,{className:`text-xs text-fg-subtle`,children:$?a.composioCloudAuthUnavailable:a.composioSetupManaged}):null,c&&N&&z?.mode===`byok`?(0,H.jsxs)(`details`,{open:$,className:`rounded-xl border border-edge bg-surface-base p-3`,children:[(0,H.jsx)(`summary`,{className:`cursor-pointer text-xs font-medium text-fg-muted`,children:a.composioAdvancedSettings}),(0,H.jsxs)(`div`,{className:`flex flex-wrap items-start justify-between gap-3`,children:[(0,H.jsxs)(`div`,{children:[(0,H.jsx)(`h3`,{className:`text-sm font-semibold text-fg`,children:a.composioAuthConfigTitle}),(0,H.jsx)(`p`,{className:`mt-1 text-xs leading-5 text-fg-muted`,children:$?a.composioAuthConfigRequiredHint:a.composioAuthConfigManaged})]}),z?.mode===`byok`?(0,H.jsxs)(`a`,{className:`inline-flex items-center gap-1 text-xs font-medium text-accent-fg hover:underline`,href:`https://app.composio.dev`,target:`_blank`,rel:`noreferrer`,children:[a.composioAuthConfigManage,(0,H.jsx)(y,{className:`size-3.5`,"aria-hidden":!0})]}):(0,H.jsx)(`span`,{className:`rounded-full bg-accent-soft px-2.5 py-1 text-xs font-medium text-accent-fg`,children:a.composioSetupManaged})]}),Z?(0,H.jsx)(w,{className:`mt-3 h-10 w-full`}):(0,H.jsxs)(_,{className:C(Y,`mt-3`),value:e.config.authConfigId??``,onChange:n=>t({...e,config:{...e.config,authConfigId:n.currentTarget.value},error:null}),children:[$?null:(0,H.jsx)(v,{value:``,children:a.composioAuthConfigManaged}),$&&!e.config.authConfigId?(0,H.jsx)(v,{value:``,disabled:!0,children:a.composioAuthConfigSelect}):null,fe.map(e=>(0,H.jsxs)(v,{value:e.id,children:[e.name,` · `,e.authScheme??`OAuth`,` · `,e.id]},e.id))]}),!Z&&$&&fe.length===0?(0,H.jsx)(`p`,{className:`mt-2 text-xs text-amber-700 dark:text-amber-300`,children:a.composioAuthConfigEmpty}):null]}):null,c&&N&&z?.mode===`byok`?(0,H.jsx)(`p`,{className:`text-xs leading-5 text-fg-subtle`,children:a.composioSessionWritePermissionHint}):null,e.store?(0,H.jsxs)(`section`,{className:`rounded-2xl border border-edge bg-surface-base p-4`,children:[(0,H.jsx)(`h3`,{className:`text-sm font-semibold text-fg`,children:a.detailPermissions}),(0,H.jsxs)(`div`,{className:`mt-3 flex flex-wrap gap-1.5`,children:[(e.store.permissions.data??[]).map(e=>(0,H.jsx)(`span`,{className:`rounded-md border border-edge bg-surface-panel px-2 py-1 text-xs text-fg-muted`,children:e},e)),(e.store.permissions.networkDomains??[]).map(e=>(0,H.jsx)(`span`,{className:`rounded-md border border-edge bg-surface-panel px-2 py-1 text-xs text-fg-muted`,children:e},e)),(0,H.jsx)(`span`,{className:`rounded-md border border-emerald-500/30 bg-emerald-500/10 px-2 py-1 text-xs text-emerald-700 dark:text-emerald-300`,children:a.storeLocalExecDenied})]})]}):null,(o.setup.links??[]).length>0?(0,H.jsx)(`div`,{className:`flex flex-wrap gap-2 rounded-xl border border-edge bg-surface-base p-3`,children:(o.setup.links??[]).map(e=>{let t=e.external!==!1&&/^https:\/\//i.test(e.href);return(0,H.jsxs)(`a`,{href:t?e.href:`#${e.href}`,target:t?`_blank`:void 0,rel:t?`noopener noreferrer`:void 0,className:`inline-flex items-center gap-1.5 text-sm font-medium text-accent-fg hover:underline`,children:[e.label,t?(0,H.jsx)(y,{className:`size-3.5`,"aria-hidden":!0}):null]},`${e.label}:${e.href}`)})}):null,(o.setup.secrets??[]).map(n=>(0,H.jsxs)(`label`,{className:`flex flex-col gap-1.5`,children:[(0,H.jsx)(`span`,{className:`text-sm font-medium text-fg`,children:n.label}),n.description?(0,H.jsx)(`span`,{className:`text-xs text-fg-subtle`,children:n.description}):null,(0,H.jsx)(b,{value:e.secrets[n.key]??``,onChange:r=>t({...e,secrets:{...e.secrets,[n.key]:r},error:null}),labels:a.secretInputLabels,placeholder:n.required?a.requiredPlaceholder:a.optionalPlaceholder})]},n.key)),(o.setup.config??[]).map(n=>(0,H.jsxs)(`label`,{className:`flex flex-col gap-1.5`,children:[(0,H.jsx)(`span`,{className:`text-sm font-medium text-fg`,children:n.label}),n.type===`json`?(0,H.jsx)(`textarea`,{className:ae,value:e.config[n.key]??``,placeholder:n.placeholder,onChange:r=>t({...e,config:{...e.config,[n.key]:r.currentTarget.value},error:null})}):(0,H.jsx)(`input`,{className:Y,value:e.config[n.key]??``,placeholder:n.placeholder,onChange:r=>t({...e,config:{...e.config,[n.key]:r.currentTarget.value},error:null})})]},n.key)),e.installing?(0,H.jsxs)(`div`,{className:`rounded-2xl border border-edge bg-surface-base p-4 text-sm text-fg-muted`,children:[(0,H.jsxs)(`div`,{className:`flex items-center gap-2 font-medium text-fg`,children:[(0,H.jsx)(x,{className:`size-4 animate-spin text-accent`,"aria-hidden":!0}),a.connectingTitle]}),(0,H.jsx)(`p`,{className:`mt-1 text-xs text-fg-subtle`,children:a.connectingHint})]}):null,e.error?(0,H.jsx)(`p`,{className:`min-w-0 max-w-full break-words rounded-xl bg-red-500/10 px-3 py-2 text-sm text-red-600 [overflow-wrap:anywhere]`,children:e.error}):null,q?(0,H.jsx)(`p`,{className:`min-w-0 max-w-full break-words rounded-xl bg-red-500/10 px-3 py-2 text-sm text-red-600 [overflow-wrap:anywhere]`,children:q}):null,e.result?(0,H.jsxs)(`div`,{className:`rounded-2xl border border-edge bg-surface-base p-4 text-sm text-fg-muted`,children:[(0,H.jsxs)(`div`,{className:`flex flex-wrap items-start justify-between gap-3`,children:[(0,H.jsx)(`div`,{children:(0,H.jsx)(`p`,{className:`font-medium text-fg`,children:a.connectedBadge})}),(0,H.jsx)(`span`,{className:C(`rounded-full px-2 py-0.5 text-xs font-medium`,e.health?.ok?`bg-emerald-500/10 text-emerald-700 dark:text-emerald-300`:e.health?`bg-amber-500/10 text-amber-700 dark:text-amber-300`:`bg-surface-hover text-fg-muted`),children:e.health?.ok?a.healthStatusHealthy:oe(e.health?.status,a)})]}),(0,H.jsx)(`p`,{className:`mt-3`,children:e.health?.ok?a.connectionReady:e.health?a.connectionNeedsSetup:a.installedWithoutHealth}),e.health?.action?(0,H.jsx)(`p`,{className:`mt-3 text-xs text-fg-subtle`,children:e.health.action}):null]}):null]})}),(0,H.jsx)(`div`,{className:`flex shrink-0 justify-end gap-2 border-t border-edge-subtle px-6 py-4`,children:(0,H.jsxs)(T,{variant:`primary`,disabled:!!e.result||e.installing||U||Z||pe||c&&!N,onClick:()=>void de(),children:[e.installing?(0,H.jsx)(x,{className:`size-4 animate-spin`}):e.result?(0,H.jsx)(ee,{className:`size-4`}):(0,H.jsx)(R,{className:`size-4`}),e.result?a.connectedBadge:a.connect]})})]})]})})}function ce(e){let t=(0,B.c)(2),n;return t[0]===e?n=t[1]:(n=e.draft.connector.runtime.type===`cli`?(0,H.jsx)(W,{definition:e.draft.connector,onClose:e.onClose,onChanged:e.onInstalled}):(0,H.jsx)(X,{...e}),t[0]=e,t[1]=n),n}export{G as a,R as c,K as i,ie as n,W as o,re as r,z as s,ce as t};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{a as t,n,t as r}from"./vendor-react-BOUWij0V.js";import{n as i}from"./locale-store-Bg_XR36n.js";import{t as a}from"./messages-DG4HLOER.js";import{t as o}from"./cn-0WouolD0.js";import{n as s}from"./electron-env-DHOGevH3.js";import{c,d as l,h as u,l as d,m as f,p,t as m,u as h}from"./voice-input-shortcut-events-0SZjJdVV.js";import{n as g}from"./side-chat-shortcut-BIw-1TTD.js";import{n as _,t as v}from"./settings-page-header-CyUHrn7c.js";import"./settings-page-layout-DGVqXrlp.js";var y=n(),b=e(t(),1),x=r(),S=l(),C=S?`⌘`:`Ctrl`;function w(e){let t=(0,y.c)(53),{title:n,description:r,shortcut:s,otherShortcut:c,defaultShortcut:l,setShortcut:u,notice:d}=e,h=i(D),g;t[0]===h?g=t[1]:(g=a(h),t[0]=h,t[1]=g);let _=g.keyboardShortcutsSettings,[v,C]=(0,b.useState)(!1),[w,O]=(0,b.useState)(null),k,A;t[2]===v?(k=t[3],A=t[4]):(k=()=>{let e={active:v};return window.dispatchEvent(new CustomEvent(m,{detail:e})),E},A=[v],t[2]=v,t[3]=k,t[4]=A),(0,b.useEffect)(k,A);let j;t[5]!==_.quickCaptureShortcutConflict||t[6]!==c||t[7]!==v||t[8]!==u?(j=e=>{if(!v)return;if(e.preventDefault(),e.stopPropagation(),e.key===`Escape`){C(!1);return}let t=f(e.nativeEvent);if(!t)return;let n=S?`meta`:`control`;if(new Set([`${n}+k`,`${n}+n`,`${n}+b`,`${n}+,`]).has(t)||t===c){O(_.quickCaptureShortcutConflict);return}u(t),O(null),C(!1)},t[5]=_.quickCaptureShortcutConflict,t[6]=c,t[7]=v,t[8]=u,t[9]=j):j=t[9];let M=j,N;t[10]===n?N=t[11]:(N=(0,x.jsx)(`h2`,{className:`text-sm font-semibold text-fg`,children:n}),t[10]=n,t[11]=N);let P;t[12]===r?P=t[13]:(P=(0,x.jsx)(`p`,{className:`mt-1 text-sm text-fg-muted`,children:r}),t[12]=r,t[13]=P);let F;t[14]!==N||t[15]!==P?(F=(0,x.jsxs)(`div`,{className:`min-w-0`,children:[N,P]}),t[14]=N,t[15]=P,t[16]=F):F=t[16];let I;t[17]===s?I=t[18]:(I=p(s).map(T),t[17]=s,t[18]=I);let L;t[19]===I?L=t[20]:(L=(0,x.jsx)(`div`,{className:`flex shrink-0 items-center gap-1`,children:I}),t[19]=I,t[20]=L);let R;t[21]!==F||t[22]!==L?(R=(0,x.jsxs)(`div`,{className:`flex flex-wrap items-start justify-between gap-3`,children:[F,L]}),t[21]=F,t[22]=L,t[23]=R):R=t[23];let z,B;t[24]===Symbol.for(`react.memo_cache_sentinel`)?(z=o(`rounded-lg bg-accent px-3 py-1.5 text-sm font-medium text-on-accent transition-colors hover:bg-accent-hover`,`focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent focus-visible:ring-offset-2 focus-visible:ring-offset-surface-base`),B=()=>{O(null),C(!0)},t[24]=z,t[25]=B):(z=t[24],B=t[25]);let V;t[26]!==_.quickCaptureShortcutChange||t[27]!==M?(V=(0,x.jsx)(`button`,{type:`button`,className:z,onClick:B,onKeyDown:M,children:_.quickCaptureShortcutChange}),t[26]=_.quickCaptureShortcutChange,t[27]=M,t[28]=V):V=t[28];let H;t[29]!==l||t[30]!==u?(H=()=>{u(l()),O(null)},t[29]=l,t[30]=u,t[31]=H):H=t[31];let U;t[32]!==_.quickCaptureShortcutReset||t[33]!==H?(U=(0,x.jsx)(`button`,{type:`button`,className:`rounded-lg px-3 py-1.5 text-sm 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`,onClick:H,children:_.quickCaptureShortcutReset}),t[32]=_.quickCaptureShortcutReset,t[33]=H,t[34]=U):U=t[34];let W;t[35]!==_.quickCaptureShortcutRecording||t[36]!==M||t[37]!==v?(W=v?(0,x.jsx)(`button`,{type:`button`,className:`rounded-lg bg-accent-soft px-3 py-1.5 text-sm font-medium text-accent-fg outline-none focus-visible:ring-2 focus-visible:ring-accent`,onKeyDown:M,onClick:()=>C(!1),children:_.quickCaptureShortcutRecording}):null,t[35]=_.quickCaptureShortcutRecording,t[36]=M,t[37]=v,t[38]=W):W=t[38];let G;t[39]!==V||t[40]!==U||t[41]!==W?(G=(0,x.jsxs)(`div`,{className:`mt-3 flex flex-wrap items-center gap-2`,children:[V,U,W]}),t[39]=V,t[40]=U,t[41]=W,t[42]=G):G=t[42];let K;t[43]===w?K=t[44]:(K=w?(0,x.jsx)(`p`,{className:`mt-2 text-sm text-danger-fg`,children:w}):null,t[43]=w,t[44]=K);let q;t[45]===d?q=t[46]:(q=d?(0,x.jsx)(`div`,{className:`mt-3 rounded-lg bg-surface-base/55 p-3`,children:d}):null,t[45]=d,t[46]=q);let J;return t[47]!==R||t[48]!==G||t[49]!==K||t[50]!==q||t[51]!==n?(J=(0,x.jsxs)(`section`,{className:`rounded-xl bg-surface-hover/20 px-4 py-3.5 sm:px-5 sm:py-4`,"aria-label":n,children:[R,G,K,q]}),t[47]=R,t[48]=G,t[49]=K,t[50]=q,t[51]=n,t[52]=J):J=t[52],J}function T(e,t){return(0,x.jsx)(z,{children:e},`${e}-${String(t)}`)}function E(){window.dispatchEvent(new CustomEvent(m,{detail:{active:!1}}))}function D(e){return e.language}function O(){let e=(0,y.c)(8),t=i(M),n;e[0]===t?n=e[1]:(n=a(t),e[0]=t,e[1]=n);let r=n.keyboardShortcutsSettings,o=u(j),s=u(A),c=d(k),l;return e[2]!==r.quickCaptureShortcutDescription||e[3]!==r.quickCaptureShortcutTitle||e[4]!==s||e[5]!==o||e[6]!==c?(l=(0,x.jsx)(w,{title:r.quickCaptureShortcutTitle,description:r.quickCaptureShortcutDescription,shortcut:o,otherShortcut:c,defaultShortcut:h,setShortcut:s}),e[2]=r.quickCaptureShortcutDescription,e[3]=r.quickCaptureShortcutTitle,e[4]=s,e[5]=o,e[6]=c,e[7]=l):l=e[7],l}function k(e){return e.shortcut}function A(e){return e.setShortcut}function j(e){return e.shortcut}function M(e){return e.language}function N(){let e=(0,y.c)(9),t=i(L),n;e[0]===t?n=e[1]:(n=a(t),e[0]=t,e[1]=n);let r=n.keyboardShortcutsSettings,o=d(I),s=d(F),l=u(P),f;e[2]===Symbol.for(`react.memo_cache_sentinel`)?(f=(0,x.jsx)(R,{}),e[2]=f):f=e[2];let p;return e[3]!==r.voiceInputShortcutDescription||e[4]!==r.voiceInputShortcutTitle||e[5]!==l||e[6]!==s||e[7]!==o?(p=(0,x.jsx)(w,{title:r.voiceInputShortcutTitle,description:r.voiceInputShortcutDescription,shortcut:o,otherShortcut:l,defaultShortcut:c,setShortcut:s,notice:f}),e[3]=r.voiceInputShortcutDescription,e[4]=r.voiceInputShortcutTitle,e[5]=l,e[6]=s,e[7]=o,e[8]=p):p=e[8],p}function P(e){return e.shortcut}function F(e){return e.setShortcut}function I(e){return e.shortcut}function L(e){return e.language}function R(){let e=a(i(e=>e.language)).keyboardShortcutsSettings,t=window.electronAPI?.system,n=s()&&window.electronAPI?.platform===`darwin`,[r,c]=(0,b.useState)(!1),[l,u]=(0,b.useState)(!1);return(0,b.useEffect)(()=>{if(!n||!t)return;let e=!0,r=()=>{t.getPermissions().then(t=>{e&&c(t.accessibility===`granted`)}).catch(()=>void 0)};return r(),window.addEventListener(`focus`,r),()=>{e=!1,window.removeEventListener(`focus`,r)}},[n,t]),!n||!t?null:(0,x.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-3`,children:[(0,x.jsx)(`p`,{className:`max-w-[65ch] text-xs text-fg-muted`,children:r?e.voiceInputAccessibilityGranted:e.voiceInputAccessibilityDescription}),r?null:(0,x.jsx)(`button`,{type:`button`,disabled:l,className:o(`rounded-lg bg-surface-base/70 px-3 py-1.5 text-xs font-medium text-fg transition-colors hover:bg-surface-hover`,`focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent disabled:cursor-not-allowed disabled:text-fg-disabled`),onClick:async()=>{u(!0);try{let e=await t.requestAccessibility();c(e.status===`granted`)}finally{u(!1)}},children:l?e.voiceInputAccessibilityRequesting:e.voiceInputAccessibilityEnable})]})}function z(e){let t=(0,y.c)(2),{children:n}=e,r;return t[0]===n?r=t[1]:(r=(0,x.jsx)(`kbd`,{className:`inline-flex min-w-[1.5rem] items-center justify-center rounded-md bg-surface-hover/70 px-1.5 py-0.5 font-mono text-xs font-medium text-fg-muted shadow-sm`,children:n}),t[0]=n,t[1]=r),r}function B(e){let t=(0,y.c)(14),{keys:n,label:r,note:i}=e,a;t[0]===r?a=t[1]:(a=(0,x.jsx)(`span`,{className:`text-sm text-fg`,children:r}),t[0]=r,t[1]=a);let o;t[2]===i?o=t[3]:(o=i&&(0,x.jsxs)(`span`,{className:`ml-1.5 text-xs text-fg-muted`,children:[`(`,i,`)`]}),t[2]=i,t[3]=o);let s;t[4]!==a||t[5]!==o?(s=(0,x.jsxs)(`div`,{className:`min-w-0`,children:[a,o]}),t[4]=a,t[5]=o,t[6]=s):s=t[6];let c;t[7]===n?c=t[8]:(c=n.map(V),t[7]=n,t[8]=c);let l;t[9]===c?l=t[10]:(l=(0,x.jsx)(`div`,{className:`flex shrink-0 items-center gap-1`,children:c}),t[9]=c,t[10]=l);let u;return t[11]!==s||t[12]!==l?(u=(0,x.jsxs)(`div`,{className:`flex items-center justify-between gap-4 py-2.5`,children:[s,l]}),t[11]=s,t[12]=l,t[13]=u):u=t[13],u}function V(e){return(0,x.jsx)(z,{children:e},e)}function H(e){let t=(0,y.c)(11),{title:n,shortcuts:r}=e,i;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(i=o(`rounded-xl bg-surface-hover/20 px-4 sm:px-5`),t[0]=i):i=t[0];let a;t[1]===n?a=t[2]:(a=(0,x.jsx)(`h2`,{className:`pb-1 pt-3.5 text-sm font-semibold text-fg sm:pt-4`,children:n}),t[1]=n,t[2]=a);let s;t[3]===r?s=t[4]:(s=r.map(U),t[3]=r,t[4]=s);let c;t[5]===s?c=t[6]:(c=(0,x.jsx)(`div`,{className:`grid gap-1 pb-3 sm:pb-4`,children:s}),t[5]=s,t[6]=c);let l;return t[7]!==a||t[8]!==c||t[9]!==n?(l=(0,x.jsxs)(`section`,{className:i,"aria-label":n,children:[a,c]}),t[7]=a,t[8]=c,t[9]=n,t[10]=l):l=t[10],l}function U(e){return(0,x.jsx)(B,{...e},e.label)}function W(){let e=(0,y.c)(139),t=i(J),n;e[0]===t?n=e[1]:(n=a(t),e[0]=t,e[1]=n);let r=n.keyboardShortcutsSettings,o=u(q),c=d(K),l;if(e[2]!==r.categoryChat||e[3]!==r.categoryEditor||e[4]!==r.categoryGlobal||e[5]!==r.categoryNavigation||e[6]!==r.chatForceSend||e[7]!==r.chatNewLine||e[8]!==r.chatSend||e[9]!==r.chatToggleSideChat||e[10]!==r.chatVoiceInput||e[11]!==r.editorBulletList||e[12]!==r.editorHeading1||e[13]!==r.editorHeading2||e[14]!==r.editorHeading3||e[15]!==r.editorOrderedList||e[16]!==r.editorTaskList||e[17]!==r.globalNewChat||e[18]!==r.globalOpenSettings||e[19]!==r.globalToggleWindow||e[20]!==r.globalVoiceInput||e[21]!==r.globalVoiceInputMacNote||e[22]!==r.globalVoiceInputWindowsNote||e[23]!==r.navCloseDialog||e[24]!==r.navCommandPalette||e[25]!==r.navQuickCapture||e[26]!==r.navToggleFullscreen||e[27]!==r.navToggleSidebar||e[28]!==o||e[29]!==c){if(l=[],s()){let t=window.electronAPI?.platform===`darwin`?`Fn`:`Alt`,n=window.electronAPI?.platform===`darwin`?r.globalVoiceInputMacNote:r.globalVoiceInputWindowsNote,i;e[31]===Symbol.for(`react.memo_cache_sentinel`)?(i=[C,`Shift`,`Space`],e[31]=i):i=e[31];let a;e[32]===r.globalToggleWindow?a=e[33]:(a={keys:i,label:r.globalToggleWindow},e[32]=r.globalToggleWindow,e[33]=a);let o;e[34]===Symbol.for(`react.memo_cache_sentinel`)?(o=[t],e[34]=o):o=e[34];let s;e[35]!==r.globalVoiceInput||e[36]!==n?(s={keys:o,label:r.globalVoiceInput,note:n},e[35]=r.globalVoiceInput,e[36]=n,e[37]=s):s=e[37];let c;e[38]!==a||e[39]!==s?(c=[a,s],e[38]=a,e[39]=s,e[40]=c):c=e[40];let u;e[41]!==r.categoryGlobal||e[42]!==c?(u={title:r.categoryGlobal,shortcuts:c},e[41]=r.categoryGlobal,e[42]=c,e[43]=u):u=e[43],l.push(u)}let t=r.categoryNavigation,n;e[44]===Symbol.for(`react.memo_cache_sentinel`)?(n=[C,`N`],e[44]=n):n=e[44];let i;e[45]===r.globalNewChat?i=e[46]:(i={keys:n,label:r.globalNewChat},e[45]=r.globalNewChat,e[46]=i);let a;e[47]===Symbol.for(`react.memo_cache_sentinel`)?(a=[C,`K`],e[47]=a):a=e[47];let u;e[48]===r.navCommandPalette?u=e[49]:(u={keys:a,label:r.navCommandPalette},e[48]=r.navCommandPalette,e[49]=u);let d;e[50]===o?d=e[51]:(d=p(o),e[50]=o,e[51]=d);let f;e[52]!==r.navQuickCapture||e[53]!==d?(f={keys:d,label:r.navQuickCapture},e[52]=r.navQuickCapture,e[53]=d,e[54]=f):f=e[54];let m;e[55]===r.navToggleSidebar?m=e[56]:(m=s()?[{keys:[C,`B`],label:r.navToggleSidebar}]:[],e[55]=r.navToggleSidebar,e[56]=m);let h;e[57]===r.navToggleFullscreen?h=e[58]:(h=s()?[{keys:[`F11`],label:r.navToggleFullscreen}]:[],e[57]=r.navToggleFullscreen,e[58]=h);let _;e[59]===r.globalOpenSettings?_=e[60]:(_=s()?[{keys:[C,`,`],label:r.globalOpenSettings}]:[],e[59]=r.globalOpenSettings,e[60]=_);let v;e[61]===Symbol.for(`react.memo_cache_sentinel`)?(v=[`Esc`],e[61]=v):v=e[61];let y;e[62]===r.navCloseDialog?y=e[63]:(y={keys:v,label:r.navCloseDialog},e[62]=r.navCloseDialog,e[63]=y);let b;e[64]!==_||e[65]!==y||e[66]!==i||e[67]!==u||e[68]!==f||e[69]!==m||e[70]!==h?(b=[i,u,f,...m,...h,..._,y],e[64]=_,e[65]=y,e[66]=i,e[67]=u,e[68]=f,e[69]=m,e[70]=h,e[71]=b):b=e[71];let x;e[72]!==r.categoryNavigation||e[73]!==b?(x={title:t,shortcuts:b},e[72]=r.categoryNavigation,e[73]=b,e[74]=x):x=e[74],l.push(x);let S=r.categoryChat,w;e[75]===Symbol.for(`react.memo_cache_sentinel`)?(w=[`Enter`],e[75]=w):w=e[75];let T;e[76]===r.chatSend?T=e[77]:(T={keys:w,label:r.chatSend},e[76]=r.chatSend,e[77]=T);let E;e[78]===Symbol.for(`react.memo_cache_sentinel`)?(E=[`Shift`,`Enter`],e[78]=E):E=e[78];let D;e[79]===r.chatNewLine?D=e[80]:(D={keys:E,label:r.chatNewLine},e[79]=r.chatNewLine,e[80]=D);let O;e[81]===Symbol.for(`react.memo_cache_sentinel`)?(O=[C,`Enter`],e[81]=O):O=e[81];let k;e[82]===r.chatForceSend?k=e[83]:(k={keys:O,label:r.chatForceSend},e[82]=r.chatForceSend,e[83]=k);let A;e[84]===c?A=e[85]:(A=p(c),e[84]=c,e[85]=A);let j;e[86]!==r.chatVoiceInput||e[87]!==A?(j={keys:A,label:r.chatVoiceInput},e[86]=r.chatVoiceInput,e[87]=A,e[88]=j):j=e[88];let M;e[89]===Symbol.for(`react.memo_cache_sentinel`)?(M=g(window.electronAPI?.platform),e[89]=M):M=e[89];let N;e[90]===r.chatToggleSideChat?N=e[91]:(N={keys:M,label:r.chatToggleSideChat},e[90]=r.chatToggleSideChat,e[91]=N);let P;e[92]!==T||e[93]!==D||e[94]!==k||e[95]!==j||e[96]!==N?(P=[T,D,k,j,N],e[92]=T,e[93]=D,e[94]=k,e[95]=j,e[96]=N,e[97]=P):P=e[97];let F;e[98]!==r.categoryChat||e[99]!==P?(F={title:S,shortcuts:P},e[98]=r.categoryChat,e[99]=P,e[100]=F):F=e[100],l.push(F);let I;e[101]===Symbol.for(`react.memo_cache_sentinel`)?(I=[C,`Shift`,`1`],e[101]=I):I=e[101];let L;e[102]===r.editorHeading1?L=e[103]:(L={keys:I,label:r.editorHeading1},e[102]=r.editorHeading1,e[103]=L);let R;e[104]===Symbol.for(`react.memo_cache_sentinel`)?(R=[C,`Shift`,`2`],e[104]=R):R=e[104];let z;e[105]===r.editorHeading2?z=e[106]:(z={keys:R,label:r.editorHeading2},e[105]=r.editorHeading2,e[106]=z);let B;e[107]===Symbol.for(`react.memo_cache_sentinel`)?(B=[C,`Shift`,`3`],e[107]=B):B=e[107];let V;e[108]===r.editorHeading3?V=e[109]:(V={keys:B,label:r.editorHeading3},e[108]=r.editorHeading3,e[109]=V);let H;e[110]===Symbol.for(`react.memo_cache_sentinel`)?(H=[C,`Shift`,`8`],e[110]=H):H=e[110];let U;e[111]===r.editorBulletList?U=e[112]:(U={keys:H,label:r.editorBulletList},e[111]=r.editorBulletList,e[112]=U);let W;e[113]===Symbol.for(`react.memo_cache_sentinel`)?(W=[C,`Shift`,`9`],e[113]=W):W=e[113];let G;e[114]===r.editorOrderedList?G=e[115]:(G={keys:W,label:r.editorOrderedList},e[114]=r.editorOrderedList,e[115]=G);let K;e[116]===Symbol.for(`react.memo_cache_sentinel`)?(K=[C,`Shift`,`0`],e[116]=K):K=e[116];let q;e[117]===r.editorTaskList?q=e[118]:(q={keys:K,label:r.editorTaskList},e[117]=r.editorTaskList,e[118]=q);let J;e[119]!==L||e[120]!==z||e[121]!==V||e[122]!==U||e[123]!==G||e[124]!==q?(J=[L,z,V,U,G,q],e[119]=L,e[120]=z,e[121]=V,e[122]=U,e[123]=G,e[124]=q,e[125]=J):J=e[125];let Y;e[126]!==r.categoryEditor||e[127]!==J?(Y={title:r.categoryEditor,shortcuts:J},e[126]=r.categoryEditor,e[127]=J,e[128]=Y):Y=e[128],l.push(Y),e[2]=r.categoryChat,e[3]=r.categoryEditor,e[4]=r.categoryGlobal,e[5]=r.categoryNavigation,e[6]=r.chatForceSend,e[7]=r.chatNewLine,e[8]=r.chatSend,e[9]=r.chatToggleSideChat,e[10]=r.chatVoiceInput,e[11]=r.editorBulletList,e[12]=r.editorHeading1,e[13]=r.editorHeading2,e[14]=r.editorHeading3,e[15]=r.editorOrderedList,e[16]=r.editorTaskList,e[17]=r.globalNewChat,e[18]=r.globalOpenSettings,e[19]=r.globalToggleWindow,e[20]=r.globalVoiceInput,e[21]=r.globalVoiceInputMacNote,e[22]=r.globalVoiceInputWindowsNote,e[23]=r.navCloseDialog,e[24]=r.navCommandPalette,e[25]=r.navQuickCapture,e[26]=r.navToggleFullscreen,e[27]=r.navToggleSidebar,e[28]=o,e[29]=c,e[30]=l}else l=e[30];let f;e[129]!==r.pageTitle||e[130]!==r.subtitle?(f=(0,x.jsx)(v,{title:r.pageTitle,subtitle:r.subtitle}),e[129]=r.pageTitle,e[130]=r.subtitle,e[131]=f):f=e[131];let m,h;e[132]===Symbol.for(`react.memo_cache_sentinel`)?(m=(0,x.jsx)(O,{}),h=(0,x.jsx)(N,{}),e[132]=m,e[133]=h):(m=e[132],h=e[133]);let b;e[134]===l?b=e[135]:(b=l.map(G),e[134]=l,e[135]=b);let S;return e[136]!==f||e[137]!==b?(S=(0,x.jsxs)(_,{gap:`gap-6`,children:[f,m,h,b]}),e[136]=f,e[137]=b,e[138]=S):S=e[138],S}function G(e){return(0,x.jsx)(H,{...e},e.title)}function K(e){return e.shortcut}function q(e){return e.shortcut}function J(e){return e.language}export{W as KeyboardShortcutsSettingsPanel};
|
|
1
|
+
import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{a as t,n,t as r}from"./vendor-react-BOUWij0V.js";import{n as i}from"./locale-store-Br7IfbXK.js";import{t as a}from"./messages-ByFlEbsu.js";import{t as o}from"./cn-0WouolD0.js";import{n as s}from"./electron-env-DHOGevH3.js";import{c,d as l,h as u,l as d,m as f,p,t as m,u as h}from"./voice-input-shortcut-events-DFMNIyy4.js";import{n as g}from"./side-chat-shortcut-BIw-1TTD.js";import{n as _,t as v}from"./settings-page-header-BZl4AMiN.js";import"./settings-page-layout-onhEgq-K.js";var y=n(),b=e(t(),1),x=r(),S=l(),C=S?`⌘`:`Ctrl`;function w(e){let t=(0,y.c)(53),{title:n,description:r,shortcut:s,otherShortcut:c,defaultShortcut:l,setShortcut:u,notice:d}=e,h=i(D),g;t[0]===h?g=t[1]:(g=a(h),t[0]=h,t[1]=g);let _=g.keyboardShortcutsSettings,[v,C]=(0,b.useState)(!1),[w,O]=(0,b.useState)(null),k,A;t[2]===v?(k=t[3],A=t[4]):(k=()=>{let e={active:v};return window.dispatchEvent(new CustomEvent(m,{detail:e})),E},A=[v],t[2]=v,t[3]=k,t[4]=A),(0,b.useEffect)(k,A);let j;t[5]!==_.quickCaptureShortcutConflict||t[6]!==c||t[7]!==v||t[8]!==u?(j=e=>{if(!v)return;if(e.preventDefault(),e.stopPropagation(),e.key===`Escape`){C(!1);return}let t=f(e.nativeEvent);if(!t)return;let n=S?`meta`:`control`;if(new Set([`${n}+k`,`${n}+n`,`${n}+b`,`${n}+,`]).has(t)||t===c){O(_.quickCaptureShortcutConflict);return}u(t),O(null),C(!1)},t[5]=_.quickCaptureShortcutConflict,t[6]=c,t[7]=v,t[8]=u,t[9]=j):j=t[9];let M=j,N;t[10]===n?N=t[11]:(N=(0,x.jsx)(`h2`,{className:`text-sm font-semibold text-fg`,children:n}),t[10]=n,t[11]=N);let P;t[12]===r?P=t[13]:(P=(0,x.jsx)(`p`,{className:`mt-1 text-sm text-fg-muted`,children:r}),t[12]=r,t[13]=P);let F;t[14]!==N||t[15]!==P?(F=(0,x.jsxs)(`div`,{className:`min-w-0`,children:[N,P]}),t[14]=N,t[15]=P,t[16]=F):F=t[16];let I;t[17]===s?I=t[18]:(I=p(s).map(T),t[17]=s,t[18]=I);let L;t[19]===I?L=t[20]:(L=(0,x.jsx)(`div`,{className:`flex shrink-0 items-center gap-1`,children:I}),t[19]=I,t[20]=L);let R;t[21]!==F||t[22]!==L?(R=(0,x.jsxs)(`div`,{className:`flex flex-wrap items-start justify-between gap-3`,children:[F,L]}),t[21]=F,t[22]=L,t[23]=R):R=t[23];let z,B;t[24]===Symbol.for(`react.memo_cache_sentinel`)?(z=o(`rounded-lg bg-accent px-3 py-1.5 text-sm font-medium text-on-accent transition-colors hover:bg-accent-hover`,`focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent focus-visible:ring-offset-2 focus-visible:ring-offset-surface-base`),B=()=>{O(null),C(!0)},t[24]=z,t[25]=B):(z=t[24],B=t[25]);let V;t[26]!==_.quickCaptureShortcutChange||t[27]!==M?(V=(0,x.jsx)(`button`,{type:`button`,className:z,onClick:B,onKeyDown:M,children:_.quickCaptureShortcutChange}),t[26]=_.quickCaptureShortcutChange,t[27]=M,t[28]=V):V=t[28];let H;t[29]!==l||t[30]!==u?(H=()=>{u(l()),O(null)},t[29]=l,t[30]=u,t[31]=H):H=t[31];let U;t[32]!==_.quickCaptureShortcutReset||t[33]!==H?(U=(0,x.jsx)(`button`,{type:`button`,className:`rounded-lg px-3 py-1.5 text-sm 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`,onClick:H,children:_.quickCaptureShortcutReset}),t[32]=_.quickCaptureShortcutReset,t[33]=H,t[34]=U):U=t[34];let W;t[35]!==_.quickCaptureShortcutRecording||t[36]!==M||t[37]!==v?(W=v?(0,x.jsx)(`button`,{type:`button`,className:`rounded-lg bg-accent-soft px-3 py-1.5 text-sm font-medium text-accent-fg outline-none focus-visible:ring-2 focus-visible:ring-accent`,onKeyDown:M,onClick:()=>C(!1),children:_.quickCaptureShortcutRecording}):null,t[35]=_.quickCaptureShortcutRecording,t[36]=M,t[37]=v,t[38]=W):W=t[38];let G;t[39]!==V||t[40]!==U||t[41]!==W?(G=(0,x.jsxs)(`div`,{className:`mt-3 flex flex-wrap items-center gap-2`,children:[V,U,W]}),t[39]=V,t[40]=U,t[41]=W,t[42]=G):G=t[42];let K;t[43]===w?K=t[44]:(K=w?(0,x.jsx)(`p`,{className:`mt-2 text-sm text-danger-fg`,children:w}):null,t[43]=w,t[44]=K);let q;t[45]===d?q=t[46]:(q=d?(0,x.jsx)(`div`,{className:`mt-3 rounded-lg bg-surface-base/55 p-3`,children:d}):null,t[45]=d,t[46]=q);let J;return t[47]!==R||t[48]!==G||t[49]!==K||t[50]!==q||t[51]!==n?(J=(0,x.jsxs)(`section`,{className:`rounded-xl bg-surface-hover/20 px-4 py-3.5 sm:px-5 sm:py-4`,"aria-label":n,children:[R,G,K,q]}),t[47]=R,t[48]=G,t[49]=K,t[50]=q,t[51]=n,t[52]=J):J=t[52],J}function T(e,t){return(0,x.jsx)(z,{children:e},`${e}-${String(t)}`)}function E(){window.dispatchEvent(new CustomEvent(m,{detail:{active:!1}}))}function D(e){return e.language}function O(){let e=(0,y.c)(8),t=i(M),n;e[0]===t?n=e[1]:(n=a(t),e[0]=t,e[1]=n);let r=n.keyboardShortcutsSettings,o=u(j),s=u(A),c=d(k),l;return e[2]!==r.quickCaptureShortcutDescription||e[3]!==r.quickCaptureShortcutTitle||e[4]!==s||e[5]!==o||e[6]!==c?(l=(0,x.jsx)(w,{title:r.quickCaptureShortcutTitle,description:r.quickCaptureShortcutDescription,shortcut:o,otherShortcut:c,defaultShortcut:h,setShortcut:s}),e[2]=r.quickCaptureShortcutDescription,e[3]=r.quickCaptureShortcutTitle,e[4]=s,e[5]=o,e[6]=c,e[7]=l):l=e[7],l}function k(e){return e.shortcut}function A(e){return e.setShortcut}function j(e){return e.shortcut}function M(e){return e.language}function N(){let e=(0,y.c)(9),t=i(L),n;e[0]===t?n=e[1]:(n=a(t),e[0]=t,e[1]=n);let r=n.keyboardShortcutsSettings,o=d(I),s=d(F),l=u(P),f;e[2]===Symbol.for(`react.memo_cache_sentinel`)?(f=(0,x.jsx)(R,{}),e[2]=f):f=e[2];let p;return e[3]!==r.voiceInputShortcutDescription||e[4]!==r.voiceInputShortcutTitle||e[5]!==l||e[6]!==s||e[7]!==o?(p=(0,x.jsx)(w,{title:r.voiceInputShortcutTitle,description:r.voiceInputShortcutDescription,shortcut:o,otherShortcut:l,defaultShortcut:c,setShortcut:s,notice:f}),e[3]=r.voiceInputShortcutDescription,e[4]=r.voiceInputShortcutTitle,e[5]=l,e[6]=s,e[7]=o,e[8]=p):p=e[8],p}function P(e){return e.shortcut}function F(e){return e.setShortcut}function I(e){return e.shortcut}function L(e){return e.language}function R(){let e=a(i(e=>e.language)).keyboardShortcutsSettings,t=window.electronAPI?.system,n=s()&&window.electronAPI?.platform===`darwin`,[r,c]=(0,b.useState)(!1),[l,u]=(0,b.useState)(!1);return(0,b.useEffect)(()=>{if(!n||!t)return;let e=!0,r=()=>{t.getPermissions().then(t=>{e&&c(t.accessibility===`granted`)}).catch(()=>void 0)};return r(),window.addEventListener(`focus`,r),()=>{e=!1,window.removeEventListener(`focus`,r)}},[n,t]),!n||!t?null:(0,x.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-3`,children:[(0,x.jsx)(`p`,{className:`max-w-[65ch] text-xs text-fg-muted`,children:r?e.voiceInputAccessibilityGranted:e.voiceInputAccessibilityDescription}),r?null:(0,x.jsx)(`button`,{type:`button`,disabled:l,className:o(`rounded-lg bg-surface-base/70 px-3 py-1.5 text-xs font-medium text-fg transition-colors hover:bg-surface-hover`,`focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent disabled:cursor-not-allowed disabled:text-fg-disabled`),onClick:async()=>{u(!0);try{let e=await t.requestAccessibility();c(e.status===`granted`)}finally{u(!1)}},children:l?e.voiceInputAccessibilityRequesting:e.voiceInputAccessibilityEnable})]})}function z(e){let t=(0,y.c)(2),{children:n}=e,r;return t[0]===n?r=t[1]:(r=(0,x.jsx)(`kbd`,{className:`inline-flex min-w-[1.5rem] items-center justify-center rounded-md bg-surface-hover/70 px-1.5 py-0.5 font-mono text-xs font-medium text-fg-muted shadow-sm`,children:n}),t[0]=n,t[1]=r),r}function B(e){let t=(0,y.c)(14),{keys:n,label:r,note:i}=e,a;t[0]===r?a=t[1]:(a=(0,x.jsx)(`span`,{className:`text-sm text-fg`,children:r}),t[0]=r,t[1]=a);let o;t[2]===i?o=t[3]:(o=i&&(0,x.jsxs)(`span`,{className:`ml-1.5 text-xs text-fg-muted`,children:[`(`,i,`)`]}),t[2]=i,t[3]=o);let s;t[4]!==a||t[5]!==o?(s=(0,x.jsxs)(`div`,{className:`min-w-0`,children:[a,o]}),t[4]=a,t[5]=o,t[6]=s):s=t[6];let c;t[7]===n?c=t[8]:(c=n.map(V),t[7]=n,t[8]=c);let l;t[9]===c?l=t[10]:(l=(0,x.jsx)(`div`,{className:`flex shrink-0 items-center gap-1`,children:c}),t[9]=c,t[10]=l);let u;return t[11]!==s||t[12]!==l?(u=(0,x.jsxs)(`div`,{className:`flex items-center justify-between gap-4 py-2.5`,children:[s,l]}),t[11]=s,t[12]=l,t[13]=u):u=t[13],u}function V(e){return(0,x.jsx)(z,{children:e},e)}function H(e){let t=(0,y.c)(11),{title:n,shortcuts:r}=e,i;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(i=o(`rounded-xl bg-surface-hover/20 px-4 sm:px-5`),t[0]=i):i=t[0];let a;t[1]===n?a=t[2]:(a=(0,x.jsx)(`h2`,{className:`pb-1 pt-3.5 text-sm font-semibold text-fg sm:pt-4`,children:n}),t[1]=n,t[2]=a);let s;t[3]===r?s=t[4]:(s=r.map(U),t[3]=r,t[4]=s);let c;t[5]===s?c=t[6]:(c=(0,x.jsx)(`div`,{className:`grid gap-1 pb-3 sm:pb-4`,children:s}),t[5]=s,t[6]=c);let l;return t[7]!==a||t[8]!==c||t[9]!==n?(l=(0,x.jsxs)(`section`,{className:i,"aria-label":n,children:[a,c]}),t[7]=a,t[8]=c,t[9]=n,t[10]=l):l=t[10],l}function U(e){return(0,x.jsx)(B,{...e},e.label)}function W(){let e=(0,y.c)(139),t=i(J),n;e[0]===t?n=e[1]:(n=a(t),e[0]=t,e[1]=n);let r=n.keyboardShortcutsSettings,o=u(q),c=d(K),l;if(e[2]!==r.categoryChat||e[3]!==r.categoryEditor||e[4]!==r.categoryGlobal||e[5]!==r.categoryNavigation||e[6]!==r.chatForceSend||e[7]!==r.chatNewLine||e[8]!==r.chatSend||e[9]!==r.chatToggleSideChat||e[10]!==r.chatVoiceInput||e[11]!==r.editorBulletList||e[12]!==r.editorHeading1||e[13]!==r.editorHeading2||e[14]!==r.editorHeading3||e[15]!==r.editorOrderedList||e[16]!==r.editorTaskList||e[17]!==r.globalNewChat||e[18]!==r.globalOpenSettings||e[19]!==r.globalToggleWindow||e[20]!==r.globalVoiceInput||e[21]!==r.globalVoiceInputMacNote||e[22]!==r.globalVoiceInputWindowsNote||e[23]!==r.navCloseDialog||e[24]!==r.navCommandPalette||e[25]!==r.navQuickCapture||e[26]!==r.navToggleFullscreen||e[27]!==r.navToggleSidebar||e[28]!==o||e[29]!==c){if(l=[],s()){let t=window.electronAPI?.platform===`darwin`?`Fn`:`Alt`,n=window.electronAPI?.platform===`darwin`?r.globalVoiceInputMacNote:r.globalVoiceInputWindowsNote,i;e[31]===Symbol.for(`react.memo_cache_sentinel`)?(i=[C,`Shift`,`Space`],e[31]=i):i=e[31];let a;e[32]===r.globalToggleWindow?a=e[33]:(a={keys:i,label:r.globalToggleWindow},e[32]=r.globalToggleWindow,e[33]=a);let o;e[34]===Symbol.for(`react.memo_cache_sentinel`)?(o=[t],e[34]=o):o=e[34];let s;e[35]!==r.globalVoiceInput||e[36]!==n?(s={keys:o,label:r.globalVoiceInput,note:n},e[35]=r.globalVoiceInput,e[36]=n,e[37]=s):s=e[37];let c;e[38]!==a||e[39]!==s?(c=[a,s],e[38]=a,e[39]=s,e[40]=c):c=e[40];let u;e[41]!==r.categoryGlobal||e[42]!==c?(u={title:r.categoryGlobal,shortcuts:c},e[41]=r.categoryGlobal,e[42]=c,e[43]=u):u=e[43],l.push(u)}let t=r.categoryNavigation,n;e[44]===Symbol.for(`react.memo_cache_sentinel`)?(n=[C,`N`],e[44]=n):n=e[44];let i;e[45]===r.globalNewChat?i=e[46]:(i={keys:n,label:r.globalNewChat},e[45]=r.globalNewChat,e[46]=i);let a;e[47]===Symbol.for(`react.memo_cache_sentinel`)?(a=[C,`K`],e[47]=a):a=e[47];let u;e[48]===r.navCommandPalette?u=e[49]:(u={keys:a,label:r.navCommandPalette},e[48]=r.navCommandPalette,e[49]=u);let d;e[50]===o?d=e[51]:(d=p(o),e[50]=o,e[51]=d);let f;e[52]!==r.navQuickCapture||e[53]!==d?(f={keys:d,label:r.navQuickCapture},e[52]=r.navQuickCapture,e[53]=d,e[54]=f):f=e[54];let m;e[55]===r.navToggleSidebar?m=e[56]:(m=s()?[{keys:[C,`B`],label:r.navToggleSidebar}]:[],e[55]=r.navToggleSidebar,e[56]=m);let h;e[57]===r.navToggleFullscreen?h=e[58]:(h=s()?[{keys:[`F11`],label:r.navToggleFullscreen}]:[],e[57]=r.navToggleFullscreen,e[58]=h);let _;e[59]===r.globalOpenSettings?_=e[60]:(_=s()?[{keys:[C,`,`],label:r.globalOpenSettings}]:[],e[59]=r.globalOpenSettings,e[60]=_);let v;e[61]===Symbol.for(`react.memo_cache_sentinel`)?(v=[`Esc`],e[61]=v):v=e[61];let y;e[62]===r.navCloseDialog?y=e[63]:(y={keys:v,label:r.navCloseDialog},e[62]=r.navCloseDialog,e[63]=y);let b;e[64]!==_||e[65]!==y||e[66]!==i||e[67]!==u||e[68]!==f||e[69]!==m||e[70]!==h?(b=[i,u,f,...m,...h,..._,y],e[64]=_,e[65]=y,e[66]=i,e[67]=u,e[68]=f,e[69]=m,e[70]=h,e[71]=b):b=e[71];let x;e[72]!==r.categoryNavigation||e[73]!==b?(x={title:t,shortcuts:b},e[72]=r.categoryNavigation,e[73]=b,e[74]=x):x=e[74],l.push(x);let S=r.categoryChat,w;e[75]===Symbol.for(`react.memo_cache_sentinel`)?(w=[`Enter`],e[75]=w):w=e[75];let T;e[76]===r.chatSend?T=e[77]:(T={keys:w,label:r.chatSend},e[76]=r.chatSend,e[77]=T);let E;e[78]===Symbol.for(`react.memo_cache_sentinel`)?(E=[`Shift`,`Enter`],e[78]=E):E=e[78];let D;e[79]===r.chatNewLine?D=e[80]:(D={keys:E,label:r.chatNewLine},e[79]=r.chatNewLine,e[80]=D);let O;e[81]===Symbol.for(`react.memo_cache_sentinel`)?(O=[C,`Enter`],e[81]=O):O=e[81];let k;e[82]===r.chatForceSend?k=e[83]:(k={keys:O,label:r.chatForceSend},e[82]=r.chatForceSend,e[83]=k);let A;e[84]===c?A=e[85]:(A=p(c),e[84]=c,e[85]=A);let j;e[86]!==r.chatVoiceInput||e[87]!==A?(j={keys:A,label:r.chatVoiceInput},e[86]=r.chatVoiceInput,e[87]=A,e[88]=j):j=e[88];let M;e[89]===Symbol.for(`react.memo_cache_sentinel`)?(M=g(window.electronAPI?.platform),e[89]=M):M=e[89];let N;e[90]===r.chatToggleSideChat?N=e[91]:(N={keys:M,label:r.chatToggleSideChat},e[90]=r.chatToggleSideChat,e[91]=N);let P;e[92]!==T||e[93]!==D||e[94]!==k||e[95]!==j||e[96]!==N?(P=[T,D,k,j,N],e[92]=T,e[93]=D,e[94]=k,e[95]=j,e[96]=N,e[97]=P):P=e[97];let F;e[98]!==r.categoryChat||e[99]!==P?(F={title:S,shortcuts:P},e[98]=r.categoryChat,e[99]=P,e[100]=F):F=e[100],l.push(F);let I;e[101]===Symbol.for(`react.memo_cache_sentinel`)?(I=[C,`Shift`,`1`],e[101]=I):I=e[101];let L;e[102]===r.editorHeading1?L=e[103]:(L={keys:I,label:r.editorHeading1},e[102]=r.editorHeading1,e[103]=L);let R;e[104]===Symbol.for(`react.memo_cache_sentinel`)?(R=[C,`Shift`,`2`],e[104]=R):R=e[104];let z;e[105]===r.editorHeading2?z=e[106]:(z={keys:R,label:r.editorHeading2},e[105]=r.editorHeading2,e[106]=z);let B;e[107]===Symbol.for(`react.memo_cache_sentinel`)?(B=[C,`Shift`,`3`],e[107]=B):B=e[107];let V;e[108]===r.editorHeading3?V=e[109]:(V={keys:B,label:r.editorHeading3},e[108]=r.editorHeading3,e[109]=V);let H;e[110]===Symbol.for(`react.memo_cache_sentinel`)?(H=[C,`Shift`,`8`],e[110]=H):H=e[110];let U;e[111]===r.editorBulletList?U=e[112]:(U={keys:H,label:r.editorBulletList},e[111]=r.editorBulletList,e[112]=U);let W;e[113]===Symbol.for(`react.memo_cache_sentinel`)?(W=[C,`Shift`,`9`],e[113]=W):W=e[113];let G;e[114]===r.editorOrderedList?G=e[115]:(G={keys:W,label:r.editorOrderedList},e[114]=r.editorOrderedList,e[115]=G);let K;e[116]===Symbol.for(`react.memo_cache_sentinel`)?(K=[C,`Shift`,`0`],e[116]=K):K=e[116];let q;e[117]===r.editorTaskList?q=e[118]:(q={keys:K,label:r.editorTaskList},e[117]=r.editorTaskList,e[118]=q);let J;e[119]!==L||e[120]!==z||e[121]!==V||e[122]!==U||e[123]!==G||e[124]!==q?(J=[L,z,V,U,G,q],e[119]=L,e[120]=z,e[121]=V,e[122]=U,e[123]=G,e[124]=q,e[125]=J):J=e[125];let Y;e[126]!==r.categoryEditor||e[127]!==J?(Y={title:r.categoryEditor,shortcuts:J},e[126]=r.categoryEditor,e[127]=J,e[128]=Y):Y=e[128],l.push(Y),e[2]=r.categoryChat,e[3]=r.categoryEditor,e[4]=r.categoryGlobal,e[5]=r.categoryNavigation,e[6]=r.chatForceSend,e[7]=r.chatNewLine,e[8]=r.chatSend,e[9]=r.chatToggleSideChat,e[10]=r.chatVoiceInput,e[11]=r.editorBulletList,e[12]=r.editorHeading1,e[13]=r.editorHeading2,e[14]=r.editorHeading3,e[15]=r.editorOrderedList,e[16]=r.editorTaskList,e[17]=r.globalNewChat,e[18]=r.globalOpenSettings,e[19]=r.globalToggleWindow,e[20]=r.globalVoiceInput,e[21]=r.globalVoiceInputMacNote,e[22]=r.globalVoiceInputWindowsNote,e[23]=r.navCloseDialog,e[24]=r.navCommandPalette,e[25]=r.navQuickCapture,e[26]=r.navToggleFullscreen,e[27]=r.navToggleSidebar,e[28]=o,e[29]=c,e[30]=l}else l=e[30];let f;e[129]!==r.pageTitle||e[130]!==r.subtitle?(f=(0,x.jsx)(v,{title:r.pageTitle,subtitle:r.subtitle}),e[129]=r.pageTitle,e[130]=r.subtitle,e[131]=f):f=e[131];let m,h;e[132]===Symbol.for(`react.memo_cache_sentinel`)?(m=(0,x.jsx)(O,{}),h=(0,x.jsx)(N,{}),e[132]=m,e[133]=h):(m=e[132],h=e[133]);let b;e[134]===l?b=e[135]:(b=l.map(G),e[134]=l,e[135]=b);let S;return e[136]!==f||e[137]!==b?(S=(0,x.jsxs)(_,{gap:`gap-6`,children:[f,m,h,b]}),e[136]=f,e[137]=b,e[138]=S):S=e[138],S}function G(e){return(0,x.jsx)(H,{...e},e.title)}function K(e){return e.shortcut}function q(e){return e.shortcut}function J(e){return e.language}export{W as KeyboardShortcutsSettingsPanel};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{t as e}from"./createLucideIcon-DPHK1VkS.js";var t=e(`link-2`,[[`path`,{d:`M9 17H7A5 5 0 0 1 7 7h2`,key:`8i5ue5`}],[`path`,{d:`M15 7h2a5 5 0 1 1 0 10h-2`,key:`1b9ql8`}],[`line`,{x1:`8`,x2:`16`,y1:`12`,y2:`12`,key:`1jonct`}]]);export{t};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{a as t,n,t as r}from"./vendor-react-BOUWij0V.js";import{f as i,t as a,u as o}from"./chunk-KS7C4IRE-CiwuuyV8.js";import{i as s,n as c}from"./locale-store-Br7IfbXK.js";import{t as ee}from"./resource-unavailable-TQcRCpAg.js";import{a as l,i as u,n as d,o as f,r as p,s as m,t as h}from"./dist-BGTk37IG.js";import{t as g}from"./arrow-left-D880xG-P.js";import{t as _}from"./check-DUBLcKHA.js";import{t as v}from"./circle-check-C23XjkUj.js";import{t as y}from"./circle-x-DFsCKeya.js";import{t as b}from"./clock-3-DnrAnuyZ.js";import{t as te}from"./external-link-DjqjBmc3.js";import{n as x,r as S,t as C}from"./power-off-CwwQ7Gp7.js";import{t as w}from"./folder-kanban-CpLlFI1o.js";import{t as ne}from"./history-DXH_9jsE.js";import{t as T}from"./loader-circle-CifKLtgG.js";import{t as re}from"./panel-left-C8MqSXRZ.js";import{t as ie}from"./power-ZI-pBczI.js";import{t as ae}from"./refresh-cw-BRlGaq2w.js";import{t as oe}from"./rotate-ccw-JM1TBLpp.js";import{t as se}from"./shield-check-BU58siTV.js";import{t as ce}from"./sparkles-DHlfQFAF.js";import{t as le}from"./trash-2-DusmjVPV.js";import{t as ue}from"./triangle-alert-2JXFNNKU.js";import{t as de}from"./x-B_N4OPjy.js";import{t as E}from"./skeleton-BI5TyibZ.js";import{a as fe}from"./local-apps-Ck6kACsY.js";import{u as pe}from"./api-C3Tp9MkF.js";import{a as me,i as he}from"./vendor-swr-CdRzEUwF.js";import{t as D}from"./button-Cc4hUNTt.js";import{t as ge}from"./page-header-store-Du44NIEJ.js";import{a as _e,c as ve,d as ye,l as be,n as xe,r as Se,s as Ce,t as we,u as Te}from"./api-CRT9ZyH0.js";import{n as Ee,r as De,t as Oe}from"./runtime-health-D2TDFLLq.js";import{r as ke}from"./date-formatters-DukWSVwc.js";import{n as Ae,t as je}from"./tab-completion-input-CxtEp0aP.js";import{t as Me}from"./page-context-capture-button-CKlKWSJ7.js";var O=e(t(),1);function Ne(e){return e.replace(/^(?:例如\s*[::]?|for example\s*[::]?|e\.g\.\s*)/i,``).replace(/…$/,``).trim()}var Pe=`build-xopc-local-app`;function k(e){return(e.routing?.agentId??e.agentId??``).trim().toLowerCase()}function Fe(e){return e.find(e=>k(e)===`coder`)??null}function Ie(e,t){let n=new URLSearchParams({skill:Pe}),r=t?.trim();return r&&n.set(`draft`,r),`/chat/${encodeURIComponent(e)}?${n.toString()}`}var Le=n(),A=r();function Re(e){let t=(0,Le.c)(36),{scenarios:n,results:r,runningTarget:i,zh:a,onRunAll:o,onRunScenario:s,onAskCoder:c}=e;if(!n.length)return null;let ee=a?`产品场景`:`Product scenarios`,l;t[0]===ee?l=t[1]:(l=(0,A.jsx)(`p`,{className:`text-xs font-medium text-fg`,children:ee}),t[0]=ee,t[1]=l);let u=a?`${n.length} 个关键用户路径`:`${n.length} critical user journey${n.length===1?``:`s`}`,d;t[2]===u?d=t[3]:(d=(0,A.jsx)(`p`,{className:`mt-0.5 text-[11px] text-fg-subtle`,children:u}),t[2]=u,t[3]=d);let f;t[4]!==l||t[5]!==d?(f=(0,A.jsxs)(`div`,{children:[l,d]}),t[4]=l,t[5]=d,t[6]=f):f=t[6];let p=i!==null,m;t[7]===i?m=t[8]:(m=i===`all`?(0,A.jsx)(T,{className:`size-3 animate-spin`}):(0,A.jsx)(ae,{className:`size-3`}),t[7]=i,t[8]=m);let h=a?`全部重跑`:`Run all`,g;t[9]!==o||t[10]!==p||t[11]!==m||t[12]!==h?(g=(0,A.jsxs)(D,{variant:`ghost`,className:`h-7 rounded-lg px-2 text-[11px]`,onClick:o,disabled:p,children:[m,h]}),t[9]=o,t[10]=p,t[11]=m,t[12]=h,t[13]=g):g=t[13];let _;t[14]!==f||t[15]!==g?(_=(0,A.jsxs)(`div`,{className:`flex items-center justify-between gap-2`,children:[f,g]}),t[14]=f,t[15]=g,t[16]=_):_=t[16];let te=a?`产品场景验收结果`:`Product scenario acceptance results`,S;if(t[17]!==c||t[18]!==s||t[19]!==r||t[20]!==i||t[21]!==n||t[22]!==a){let e;t[24]!==c||t[25]!==s||t[26]!==r||t[27]!==i||t[28]!==a?(e=e=>{let t=r[e.id],n=i===`all`||i===e.id?`running`:t?.status??`pending`;return(0,A.jsx)(`li`,{className:`py-2.5 first:pt-1`,children:(0,A.jsxs)(`div`,{className:`flex items-start gap-2`,children:[(0,A.jsx)(`span`,{className:`mt-0.5 shrink-0`,"aria-hidden":!0,children:n===`running`?(0,A.jsx)(T,{className:`size-3.5 animate-spin text-accent`}):n===`passed`?(0,A.jsx)(v,{className:`size-3.5 text-success`}):n===`failed`?(0,A.jsx)(y,{className:`size-3.5 text-danger`}):(0,A.jsx)(b,{className:`size-3.5 text-fg-subtle`})}),(0,A.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,A.jsxs)(`div`,{className:`flex items-start justify-between gap-2`,children:[(0,A.jsxs)(`div`,{className:`min-w-0`,children:[(0,A.jsx)(`p`,{className:`truncate text-[11px] font-medium text-fg`,children:e.name}),(0,A.jsx)(`p`,{className:`mt-0.5 text-[10px] text-fg-subtle`,children:a?`${e.stepCount} 个步骤`:`${e.stepCount} step${e.stepCount===1?``:`s`}`})]}),(0,A.jsx)(D,{variant:`ghost`,className:`size-7 shrink-0 rounded-lg p-0`,onClick:()=>s(e.id),disabled:i!==null,"aria-label":a?`重跑${e.name}`:`Rerun ${e.name}`,title:a?`单独重跑`:`Rerun scenario`,children:(0,A.jsx)(ae,{className:`size-3`})})]}),n===`running`?(0,A.jsx)(`p`,{className:`mt-1 text-[11px] leading-4 text-fg-muted`,children:a?`正在隔离预览中执行…`:`Running in an isolated preview…`}):t?.status===`failed`?(0,A.jsxs)(`div`,{className:`mt-1.5`,children:[(0,A.jsx)(`p`,{className:`text-[11px] leading-4 text-danger`,children:t.message}),(0,A.jsxs)(D,{variant:`ghost`,className:`mt-1 h-7 rounded-lg px-2 text-[11px] text-danger hover:text-danger`,onClick:()=>c(e,t),children:[(0,A.jsx)(x,{className:`size-3`}),a?`让 Coder 修复`:`Ask Coder to fix`]})]}):t?.status===`passed`?(0,A.jsx)(`p`,{className:`mt-1 text-[11px] leading-4 text-fg-muted`,children:a?`场景已通过`:`Scenario passed`}):(0,A.jsx)(`p`,{className:`mt-1 text-[11px] leading-4 text-fg-muted`,children:a?`等待运行`:`Waiting to run`})]})]})},e.id)},t[24]=c,t[25]=s,t[26]=r,t[27]=i,t[28]=a,t[29]=e):e=t[29],S=n.map(e),t[17]=c,t[18]=s,t[19]=r,t[20]=i,t[21]=n,t[22]=a,t[23]=S}else S=t[23];let C;t[30]!==te||t[31]!==S?(C=(0,A.jsx)(`ul`,{className:`mt-2 divide-y divide-edge-subtle`,"aria-label":te,children:S}),t[30]=te,t[31]=S,t[32]=C):C=t[32];let w;return t[33]!==_||t[34]!==C?(w=(0,A.jsxs)(`div`,{className:`mt-3 border-t border-edge-subtle pt-3`,children:[_,C]}),t[33]=_,t[34]=C,t[35]=w):w=t[35],w}var ze=`allow-scripts allow-forms`;function Be(e,t){return ke(e,t)}function Ve(e,t,n){return!!(t&&n&&e.sourceHash===t&&e.status===n.status&&e.interactiveCount===n.interactiveCount&&JSON.stringify(e.checks)===JSON.stringify(n.checks))}function He(){let{appId:e}=i(),t=e===`new`,n=c(e=>e.language)===`zh`,r=c(e=>e.language),y=o(),{mutate:b}=me(),ke=ge(e=>e.setPageHeader),Pe=ge(e=>e.clearPageHeader),{data:k,isLoading:Le,error:He,mutate:Ue}=he(!t&&e?[`local-app`,e]:null,()=>xe(e)),{data:j,isLoading:We,mutate:Ge}=he(!t&&e?[`local-app-validation`,e]:null,()=>ye(e)),[Ke,qe]=(0,O.useState)(``),[Je,Ye]=(0,O.useState)(``),[M,N]=(0,O.useState)(!1),[Xe,P]=(0,O.useState)(null),[Ze,Qe]=(0,O.useState)(!1),[$e,et]=(0,O.useState)(!1),[tt,nt]=(0,O.useState)(0),[rt,it]=(0,O.useState)(``),[F,at]=(0,O.useState)(!1),[I,ot]=(0,O.useState)(!1),[L,R]=(0,O.useState)(`booting`),[z,st]=(0,O.useState)(null),[B,ct]=(0,O.useState)(null),[V,lt]=(0,O.useState)({}),[H,ut]=(0,O.useState)(`all`),[U,W]=(0,O.useState)(0),[dt,ft]=(0,O.useState)(0),[pt,mt]=(0,O.useState)(null),[G,ht]=(0,O.useState)(null),[gt,_t]=(0,O.useState)([]),[vt,yt]=(0,O.useState)(!1),bt=(0,O.useRef)(new Set),K=(0,O.useRef)(null),xt=(0,O.useRef)(null),St=(0,O.useRef)(null),q=(0,O.useRef)(null),J=(0,O.useRef)(``),Y=j?.acceptanceScenarios??[],X=(0,O.useMemo)(()=>{if(!Y.length)return null;let e=Y.map(e=>V[e.id]).filter(e=>!!e);return e.length===Y.length?{status:e.some(e=>e.status===`failed`)?`failed`:`passed`,scenarioCount:Y.length,scenarios:e}:null},[Y,V]),Z=(0,O.useMemo)(()=>{if(!B)return null;if(!j?.acceptanceScenarioCount)return B;if(!X)return null;let e=X.scenarios.find(e=>e.status===`failed`),t={id:`criteria`,status:X.status,message:e?`${e.name}: ${e.message}`:`${X.scenarioCount} product scenario(s) passed`},n=[...B.checks,t];return{status:n.some(e=>e.status===`failed`)?`failed`:`passed`,checks:n,interactiveCount:B.interactiveCount}},[B,X,j?.acceptanceScenarioCount]),Ct=(0,O.useCallback)(async(e,t)=>{let n=Fe(await pe(e.projectId));if(!n){let n=new URLSearchParams({projectId:e.projectId,...t?{draft:t}:{}});y(`/chat/new?${n}`,{state:{agentId:`coder`,forceNewChat:!0}});return}bt.current.add(n.key),y(Ie(n.key,t))},[y]),wt=(0,O.useCallback)(async(e=!0)=>{if(!k)return null;ot(!0);try{let t=await ye(k.id);return await Ge(t,{revalidate:!1}),e&&(q.current=t.sourceHash??null,ut(`all`),W(0),nt(e=>e+1)),t}catch(e){return P(e instanceof Error?e.message:String(e)),null}finally{ot(!1)}},[k,Ge]);(0,O.useEffect)(()=>{if(!k)return;let e=!1;pe(k.projectId).then(t=>{e||(bt.current=new Set(t.filter(e=>(e.routing?.agentId??e.agentId)?.toLowerCase()===`coder`).map(e=>e.key)))}).catch(()=>{});let t=e=>{let t=e.detail?.key;!t||!bt.current.has(t)||(K.current!==null&&window.clearTimeout(K.current),K.current=window.setTimeout(()=>{K.current=null,wt(!0)},750))};return window.addEventListener(`session-transcript-updated`,t),()=>{e=!0,window.removeEventListener(`session-transcript-updated`,t),K.current!==null&&window.clearTimeout(K.current)}},[k,wt]),(0,O.useEffect)(()=>{_t(k?.acceptanceRuns??[])},[k?.acceptanceRuns]),(0,O.useEffect)(()=>{q.current=null},[k?.id]),(0,O.useEffect)(()=>{!j?.sourceHash||q.current===j.sourceHash||(q.current=j.sourceHash,ut(`all`),W(0),nt(e=>e+1))},[k?.id,j?.sourceHash]),(0,O.useLayoutEffect)(()=>{if(!k)return;R(`booting`),st(null),ct(null),ht(null),yt(!1),J.current=``;let e=window.setTimeout(()=>R(e=>e===`failed`?e:`timeout`),7e3),t=xt.current?De(xt.current,t=>{let n=fe(t);if(n){if(n.type===`ready`){R(e=>e===`failed`?e:`healthy`);return}if(n.type===`acceptance`){window.clearTimeout(e),ct(n.detail),ht(q.current);return}n.type!==`criteria`&&(window.clearTimeout(e),st(n.detail),R(`failed`))}}):()=>{};return()=>{window.clearTimeout(e),t()}},[k,tt]),(0,O.useLayoutEffect)(()=>{if(!k||j?.status!==`healthy`||!Y.length){mt(null);return}let e=H===`all`?Y[U]:Y.find(e=>e.id===H),t=e?[e]:[];if(!t.length)return;mt(H),lt(e=>{if(H===`all`&&U===0)return{};let t={...e};return delete t[H],t});let r=!1,i=e=>{lt(n=>{let r={...n};for(let n of t)r[n.id]={id:n.id,name:n.name,status:`failed`,message:e,failureKind:`runner`};return r}),mt(null)},a=window.setTimeout(()=>i(r?n?`场景在 10 秒内未完成。`:`Scenario did not finish within 10 seconds.`:n?`验收执行器未能连接,请重新验收。`:`The acceptance runner did not connect. Run acceptance again.`),1e4),o=St.current?De(St.current,e=>{let t=fe(e);t&&(t.type===`ready`?r=!0:t.type===`criteria`?(window.clearTimeout(a),lt(e=>{let n={...e};for(let e of t.detail.scenarios)(n[e.id]?.status!==`failed`||e.status===`failed`)&&(n[e.id]=e);return n}),H===`all`&&U+1<Y.length?(W(e=>e+1),ft(e=>e+1)):mt(null)):t.type===`error`&&(window.clearTimeout(a),i(Oe(t.detail))))}):()=>{};return()=>{window.clearTimeout(a),o()}},[Y,k,dt,H,U,tt,j?.status,n]),(0,O.useEffect)(()=>{if(!k||!Z||!G||G!==j?.sourceHash)return;let e=`${k.id}:${G}:${JSON.stringify(Z)}`;J.current!==e&&(J.current=e,yt(!0),Ce(k.id,G,Z).then(t=>{J.current===e&&_t(e=>[t,...e.filter(e=>e.id!==t.id)].toSorted((e,t)=>t.createdAt-e.createdAt).slice(0,20))}).catch(t=>{J.current===e&&(J.current=``,yt(!1),P(t instanceof Error?t.message:String(t)))}).finally(()=>{J.current===e&&yt(!1)}))},[Z,G,k,j?.sourceHash]);let Q=(0,O.useCallback)(async e=>{if(k){at(!0),P(null);try{await Ct(k,e)}catch(e){P(e instanceof Error?e.message:String(e)),at(!1)}}},[k,Ct]);(0,O.useLayoutEffect)(()=>(ke({startExtra:(0,A.jsx)(a,{to:`/local-apps`,className:`rounded-lg p-1.5 text-fg-muted hover:bg-surface-hover hover:text-fg`,"aria-label":n?`返回应用工坊`:`Back to App Studio`,children:(0,A.jsx)(g,{className:`size-4`})}),main:(0,A.jsx)(`h1`,{className:`truncate text-base font-semibold tracking-tight text-fg`,children:k?.name||(t?n?`创建应用`:`Create app`:n?`应用详情`:`App details`)}),end:k?(0,A.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,A.jsx)(Me,{resource:{kind:`local_app`,id:k.id,revision:j?.sourceHash??``},disabled:M||F||I||!j?.sourceHash}),(0,A.jsx)(D,{asChild:!0,variant:`ghost`,className:`h-9`,children:(0,A.jsxs)(a,{to:`/projects/${encodeURIComponent(k.projectId)}`,children:[(0,A.jsx)(w,{className:`size-4`}),n?`项目`:`Project`]})}),(0,A.jsxs)(D,{className:`h-9`,onClick:()=>void Q(),disabled:F,children:[F?(0,A.jsx)(T,{className:`size-4 animate-spin`}):(0,A.jsx)(x,{className:`size-4`}),n?`继续开发`:`Continue building`]})]}):null}),()=>Pe()),[k,t,M,F,I,j?.sourceHash,Pe,Q,ke,n]);async function Tt(e){e.preventDefault(),N(!0),P(null);try{let e=await we({name:Ke,idea:Je});await b(`local-apps-list`);let t=n?`请基于 APP_BRIEF.md 完成这个本地应用的首版。先检查现有草稿,再实现最小可用版本并运行校验;完成后告诉我可以如何预览。`:`Build the first usable version of this local app from APP_BRIEF.md. Inspect the existing draft, implement the smallest useful version, run validation, and tell me how to preview it.`;try{await Ct(e,t)}catch{y(`/local-apps/${encodeURIComponent(e.id)}`,{replace:!0})}}catch(e){P(e instanceof Error?e.message:String(e))}finally{N(!1)}}async function Et(){if(k){N(!0),P(null);try{let e=await _e(k.id);await Ue(e,{revalidate:!1}),await Ge(),await Promise.all([b(`local-apps-list`),b(`gateway-extensions-list`)]),Qe(!1)}catch(e){P(e instanceof Error?e.message:String(e))}finally{N(!1)}}}async function Dt(e){N(!0),P(null);try{let t=await e();return await Ue(t,{revalidate:!1}),await Ge(),await Promise.all([b(`local-apps-list`),b(`gateway-extensions-list`)]),!0}catch(e){return P(e instanceof Error?e.message:String(e)),!1}finally{N(!1)}}async function Ot(e){k&&await Dt(()=>be(k.id,e))}async function kt(e){k&&await Dt(()=>ve(k.id,e))}async function At(){k&&await Dt(()=>Te(k.id))&&et(!1)}async function jt(e){if(!(!k||!e.length)){P(null);try{let t=await Se(k.id,{sourceHash:j?.sourceHash,locale:n?`zh`:`en`,diagnostics:e});await Q(t.prompt)}catch(e){P(e instanceof Error?e.message:String(e))}}}function Mt(){jt([...j?.issues.map(e=>({phase:`build`,code:e.code,message:e.message}))??[],...z?[{phase:`runtime`,code:z.kind,message:Oe(z)}]:[],...Z?.checks.filter(e=>e.status===`failed`&&e.id!==`criteria`).map(e=>({phase:`acceptance`,code:e.id,message:e.message}))??[],...Object.values(V).filter(e=>e.status===`failed`).map(e=>({phase:e.failureKind===`runner`?`runner`:`acceptance`,code:e.id,message:`${e.name}: ${e.message}`})),...L===`timeout`?[{phase:`boot`,code:`boot_timeout`,message:`Preview did not report ready within 7 seconds.`}]:[]])}function Nt(){ut(`all`),W(0),ft(e=>e+1)}function Pt(e){ut(e),W(0),ft(e=>e+1)}function Ft(e,t){jt([{phase:t.failureKind===`runner`?`runner`:`acceptance`,code:e.id,message:`${e.name}: ${t.message}`}])}let It=gt.findIndex(e=>Ve(e,G,Z)),$=It>=0?gt[It]:null,Lt=It>=0?gt[It+1]??null:gt[0]??null,Rt=Ee(Z),zt=Lt?Lt.checks.filter(e=>e.status===`failed`).map(e=>e.message):[],Bt=j?.status===`failed`||L===`failed`||L===`timeout`||Z?.status===`failed`||Object.values(V).some(e=>e.status===`failed`),Vt=zt.filter(e=>!Rt.includes(e)).length;async function Ht(){let e=await wt(!1);if(e?.status===`healthy`&&e.sourceHash!==G){q.current=e.sourceHash??null,W(0),nt(e=>e+1);return}e?.status===`healthy`&&L===`healthy`&&Z?.status===`passed`&&$&&$.sourceHash===e.sourceHash&&Qe(!0)}return t?(0,A.jsx)(`div`,{className:`flex min-h-0 flex-1 bg-surface-panel p-3 sm:p-5 xl:p-6`,children:(0,A.jsxs)(`div`,{className:`grid w-full min-w-0 overflow-hidden rounded-2xl border border-edge-subtle bg-surface-base shadow-surface lg:grid-cols-[minmax(280px,0.8fr)_minmax(0,1.5fr)]`,children:[(0,A.jsxs)(`form`,{onSubmit:Tt,className:`flex flex-col border-b border-edge-subtle p-5 lg:border-b-0 lg:border-r`,children:[(0,A.jsxs)(`div`,{className:`flex items-center gap-2 text-xs font-semibold uppercase tracking-[0.14em] text-accent`,children:[(0,A.jsx)(ce,{className:`size-4`}),n?`告诉编程智能体你的想法`:`Tell Coder your idea`]}),(0,A.jsx)(`h2`,{className:`mt-4 text-xl font-semibold tracking-tight text-fg`,children:n?`你想创建什么?`:`What do you want to create?`}),(0,A.jsx)(`p`,{className:`mt-2 text-sm leading-6 text-fg-muted`,children:n?`我们会创建项目,并在对话中由编程智能体根据你的想法开发应用。`:`We will create a Coder Project and carry the app context and development skill into chat.`}),(0,A.jsxs)(`label`,{className:`mt-6 text-xs font-medium text-fg-muted`,children:[n?`应用名称`:`App name`,(0,A.jsx)(je,{value:Ke,onChange:e=>qe(e.target.value),suggestion:Ne(n?`例如:阅读清单`:`e.g. Reading list`),onAcceptSuggestion:qe,required:!0,className:`mt-2 w-full rounded-xl border border-edge bg-surface-panel px-3 py-2.5 text-sm text-fg focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,placeholder:n?`例如:阅读清单`:`e.g. Reading list`})]}),(0,A.jsxs)(`label`,{className:`mt-4 text-xs font-medium text-fg-muted`,children:[n?`描述你的想法`:`Describe your idea`,(0,A.jsx)(Ae,{value:Je,onChange:e=>Ye(e.target.value),suggestion:Ne(n?`我想要一个可以记录待读文章、标记进度并按主题筛选的小工具…`:`I want a small tool that tracks articles, reading progress, and topics…`),onAcceptSuggestion:Ye,required:!0,rows:7,className:`mt-2 w-full resize-none rounded-xl border border-edge bg-surface-panel px-3 py-2.5 text-sm leading-6 text-fg focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,placeholder:n?`我想要一个可以记录待读文章、标记进度并按主题筛选的小工具…`:`I want a small tool that tracks articles, reading progress, and topics…`})]}),Xe?(0,A.jsx)(`p`,{className:`mt-3 text-sm text-danger`,role:`alert`,children:Xe}):null,(0,A.jsxs)(D,{type:`submit`,variant:`primary`,className:`mt-5 h-10`,disabled:M||!Ke.trim()||!Je.trim(),children:[M?(0,A.jsx)(T,{className:`size-4 animate-spin`}):(0,A.jsx)(x,{className:`size-4`}),n?`开始开发对话`:`Continue with Coder`]})]}),(0,A.jsx)(`div`,{className:`hidden min-h-[620px] place-items-center bg-surface-panel p-8 lg:grid`,children:(0,A.jsxs)(`div`,{className:`max-w-md text-center`,children:[(0,A.jsx)(`div`,{className:`mx-auto flex size-16 items-center justify-center rounded-2xl border border-edge bg-surface-base text-accent shadow-surface`,children:(0,A.jsx)(re,{className:`size-7`})}),(0,A.jsx)(`h3`,{className:`mt-5 text-base font-semibold text-fg`,children:n?`创建后,这里就是实时预览`:`Your live preview appears here`}),(0,A.jsx)(`p`,{className:`mt-2 text-sm leading-6 text-fg-muted`,children:n?`你可以先体验草稿,再决定是否把它添加到左侧导航。`:`Try the draft first, then decide whether to add it to the sidebar.`})]})})]})}):Le?(0,A.jsxs)(`div`,{className:`grid min-h-0 flex-1 gap-3 bg-surface-panel p-3 lg:grid-cols-[280px_minmax(0,1fr)_260px]`,children:[(0,A.jsx)(E,{className:`rounded-xl`}),(0,A.jsx)(E,{className:`rounded-xl`}),(0,A.jsx)(E,{className:`rounded-xl`})]}):He||!k?(0,A.jsx)(ee,{kind:`app`,missing:!He||/not found|404/i.test(String(He)),backTo:`/local-apps`,retry:()=>void Ue()}):(0,A.jsxs)(`div`,{className:`grid min-h-0 flex-1 gap-3 overflow-hidden bg-surface-panel p-3 lg:grid-cols-[280px_minmax(0,1fr)_300px]`,children:[(0,A.jsxs)(`aside`,{className:`min-h-0 min-w-0 overflow-y-auto rounded-xl border border-edge-subtle bg-surface-base p-4 shadow-surface`,children:[(0,A.jsxs)(`div`,{className:`flex items-center gap-2 text-xs font-semibold uppercase tracking-[0.12em] text-accent`,children:[(0,A.jsx)(ce,{className:`size-4`}),n?`创作对话`:`Build conversation`]}),(0,A.jsx)(`div`,{className:`mt-4 min-w-0 rounded-xl bg-surface-panel p-3 text-sm leading-6 text-fg [overflow-wrap:anywhere]`,children:k.idea}),(0,A.jsxs)(`div`,{className:`mt-4 rounded-xl bg-accent-soft p-3`,children:[(0,A.jsxs)(`p`,{className:`flex items-center gap-2 text-sm font-medium text-accent-fg`,children:[(0,A.jsx)(v,{className:`size-4`}),n?`草稿已准备好`:`Draft is ready`]}),(0,A.jsx)(`p`,{className:`mt-1 text-xs leading-5 text-fg-muted`,children:n?`继续开发会打开对应项目的对话,编程智能体可以参考当前应用继续修改。`:`Continue in the Project where Coder has the app context and dedicated skill.`})]}),(0,A.jsxs)(`form`,{className:`mt-5`,onSubmit:e=>{e.preventDefault(),Q(rt)},children:[(0,A.jsx)(`label`,{className:`text-xs font-medium text-fg-muted`,htmlFor:`local-app-change-request`,children:n?`下一步想改什么?`:`What should change next?`}),(0,A.jsx)(Ae,{id:`local-app-change-request`,value:rt,onChange:e=>it(e.target.value),suggestion:Ne(n?`例如:增加月视图,并支持按标签筛选`:`e.g. Add a monthly view and tag filters`),onAcceptSuggestion:it,rows:4,className:`mt-2 w-full resize-none rounded-xl border border-edge bg-surface-panel px-3 py-2.5 text-sm leading-6 text-fg outline-none focus-visible:ring-2 focus-visible:ring-accent`,placeholder:n?`例如:增加月视图,并支持按标签筛选`:`e.g. Add a monthly view and tag filters`}),(0,A.jsxs)(D,{type:`submit`,className:`mt-2 w-full`,disabled:F||!rt.trim(),children:[F?(0,A.jsx)(T,{className:`size-4 animate-spin`}):(0,A.jsx)(x,{className:`size-4`}),n?`让 Coder 修改`:`Ask Coder to update`]})]}),(0,A.jsxs)(D,{variant:`ghost`,className:`mt-2 w-full`,onClick:()=>void Q(),disabled:F,children:[(0,A.jsx)(w,{className:`size-4`}),n?`打开已有开发对话`:`Open development chat`]})]}),(0,A.jsxs)(`section`,{className:`flex min-h-0 flex-col overflow-hidden rounded-xl border border-edge-subtle bg-surface-base shadow-surface`,children:[(0,A.jsxs)(`div`,{className:`flex h-11 shrink-0 items-center justify-between border-b border-edge-subtle px-3`,children:[(0,A.jsxs)(`div`,{className:`flex items-center gap-2 text-xs font-medium text-fg-muted`,children:[(0,A.jsx)(`span`,{className:`size-2 rounded-full ${j?.status===`failed`||L===`failed`||L===`timeout`||Z?.status===`failed`?`bg-danger`:j?.status===`healthy`&&L===`healthy`&&Z?.status===`passed`&&$?.sourceHash===j.sourceHash&&!vt?`bg-success`:`bg-fg-subtle`}`}),L===`failed`||L===`timeout`?n?`预览运行异常`:`Preview runtime issue`:j?.status===`failed`||Z?.status===`failed`?n?`自动验收未通过`:`Acceptance needs attention`:L===`booting`||!Z?n?`自动验收中`:`Running acceptance`:vt||$?.sourceHash!==j?.sourceHash?n?`正在保存验收快照`:`Saving acceptance snapshot`:n?`草稿已通过验收`:`Draft accepted`]}),(0,A.jsxs)(D,{variant:`ghost`,className:`h-8 px-2`,onClick:()=>void wt(!0),disabled:I,children:[I?(0,A.jsx)(T,{className:`size-3.5 animate-spin`}):(0,A.jsx)(ae,{className:`size-3.5`}),n?`重新验收`:`Run again`]})]}),(0,A.jsx)(`iframe`,{ref:xt,title:`${k.name} preview`,src:s(k.draftPreviewUrl),sandbox:ze,className:`min-h-0 w-full flex-1 bg-white`,onError:()=>{st({kind:`script_error`,message:`Preview document failed to load`}),R(`failed`)}},tt),j?.status===`healthy`&&j.acceptanceScenarioCount>0?(0,A.jsx)(`iframe`,{ref:St,title:`${k.name} acceptance runner`,src:`${s(k.draftPreviewUrl)}?xopcAcceptance=1&xopcScenario=${encodeURIComponent(H===`all`?Y[U]?.id??``:H)}`,sandbox:ze,"aria-hidden":`true`,tabIndex:-1,className:`pointer-events-none fixed left-[-200vw] top-0 h-[720px] w-[1024px] opacity-0`},`criteria-${tt}-${dt}-${U}`):null]}),(0,A.jsxs)(`aside`,{className:`min-h-0 overflow-y-auto rounded-xl border border-edge-subtle bg-surface-base p-4 shadow-surface`,children:[(0,A.jsxs)(`div`,{className:`flex items-start justify-between gap-3`,children:[(0,A.jsxs)(`div`,{children:[(0,A.jsx)(`h2`,{className:`text-sm font-semibold text-fg`,children:n?`发布状态`:`Release status`}),(0,A.jsx)(`p`,{className:`mt-1 text-xs text-fg-muted`,children:k.installationState===`not_installed`?n?`尚未安装`:`Not installed`:k.enabled?n?`版本 ${k.activeVersion} 正在使用`:`Version ${k.activeVersion} is active`:n?`已禁用,版本仍保留`:`Disabled, release retained`})]}),(0,A.jsx)(`span`,{className:`mt-1 size-2.5 rounded-full ${k.enabled?`bg-success`:`bg-fg-subtle`}`,"aria-hidden":!0})]}),(0,A.jsxs)(`dl`,{className:`mt-4 grid grid-cols-2 gap-3 text-xs`,children:[(0,A.jsxs)(`div`,{children:[(0,A.jsx)(`dt`,{className:`text-fg-subtle`,children:n?`当前草稿`:`Draft`}),(0,A.jsxs)(`dd`,{className:`mt-1 font-medium text-fg`,children:[`v`,k.draftVersion]})]}),(0,A.jsxs)(`div`,{children:[(0,A.jsx)(`dt`,{className:`text-fg-subtle`,children:n?`已安装`:`Installed`}),(0,A.jsx)(`dd`,{className:`mt-1 font-medium text-fg`,children:k.activeVersion?`v${k.activeVersion}`:`—`})]})]}),(0,A.jsxs)(`div`,{className:`mt-5 border-t border-edge-subtle pt-4`,children:[(0,A.jsxs)(`div`,{className:`flex items-center justify-between gap-2`,children:[(0,A.jsxs)(`h3`,{className:`flex items-center gap-2 text-xs font-semibold text-fg`,children:[(0,A.jsx)(S,{className:`size-4 text-accent`}),n?`草稿检查`:`Draft checks`]}),We||I?(0,A.jsx)(T,{className:`size-3.5 animate-spin text-fg-muted`}):j?.status===`healthy`?(0,A.jsx)(v,{className:`size-4 text-success`}):(0,A.jsx)(ue,{className:`size-4 text-danger`})]}),j?(0,A.jsxs)(`div`,{className:`mt-2`,children:[(0,A.jsx)(`p`,{className:`text-xs leading-5 ${j.status===`healthy`?`text-fg-muted`:`text-danger`}`,children:j.status===`healthy`?j.hasDraftChanges?n?`${j.changedFileCount} 个文件有改动,可以安装新版本。`:`${j.changedFileCount} changed files are ready for a new release.`:n?`草稿与当前安装版本一致。`:`Draft matches the installed release.`:j.issues[0]?.message}),j.changedFiles.length?(0,A.jsx)(`ul`,{className:`mt-2 space-y-1`,children:j.changedFiles.slice(0,4).map(e=>(0,A.jsxs)(`li`,{className:`flex min-w-0 items-center gap-2 text-[11px] text-fg-muted`,children:[(0,A.jsx)(`span`,{className:`w-4 shrink-0 font-medium text-fg-subtle`,children:e.status===`added`?`+`:e.status===`deleted`?`−`:`•`}),(0,A.jsx)(`span`,{className:`truncate font-mono`,children:e.path})]},e.path))}):null,j.changedFileCount>4?(0,A.jsx)(`p`,{className:`mt-1 text-[10px] text-fg-subtle`,children:n?`还有 ${j.changedFileCount-4} 个文件`:`${j.changedFileCount-4} more files`}):null,(0,A.jsxs)(`div`,{className:`mt-3 border-t border-edge-subtle pt-3`,children:[(0,A.jsxs)(`p`,{className:`flex items-center gap-2 text-xs font-medium text-fg`,children:[(0,A.jsx)(`span`,{className:`size-2 rounded-full ${L===`healthy`?`bg-success`:L===`booting`?`bg-fg-subtle`:`bg-danger`}`}),n?`预览运行`:`Preview runtime`]}),(0,A.jsx)(`p`,{className:`mt-1 text-xs leading-5 ${L===`failed`||L===`timeout`?`text-danger`:`text-fg-muted`}`,children:z?Oe(z):L===`healthy`?n?`已成功启动,未发现未捕获异常。`:`Started successfully with no uncaught errors.`:L===`timeout`?n?`7 秒内未完成启动,可能出现白屏或阻塞。`:`Did not finish booting within 7 seconds.`:n?`正在等待应用启动。`:`Waiting for the app to start.`})]}),(0,A.jsxs)(`div`,{className:`mt-3 border-t border-edge-subtle pt-3`,children:[(0,A.jsxs)(`p`,{className:`flex items-center gap-2 text-xs font-medium text-fg`,children:[(0,A.jsx)(`span`,{className:`size-2 rounded-full ${Z?.status===`passed`?`bg-success`:Z?.status===`failed`?`bg-danger`:`bg-fg-subtle`}`}),n?`自动验收`:`Automatic acceptance`]}),Z?(0,A.jsx)(`ul`,{className:`mt-2 space-y-1.5`,children:Z.checks.map(e=>(0,A.jsxs)(`li`,{className:`flex items-start gap-2 text-[11px] leading-4 ${e.status===`failed`?`text-danger`:`text-fg-muted`}`,children:[(0,A.jsx)(`span`,{className:`mt-1 size-1.5 shrink-0 rounded-full ${e.status===`failed`?`bg-danger`:e.status===`passed`?`bg-success`:`bg-fg-subtle`}`}),(0,A.jsx)(`span`,{children:e.message})]},e.id))}):(0,A.jsx)(`p`,{className:`mt-1 text-xs leading-5 text-fg-muted`,children:j?.acceptanceScenarioCount?n?`正在检查页面基础质量和 ${j.acceptanceScenarioCount} 个产品场景。`:`Checking page quality and ${j.acceptanceScenarioCount} product scenario(s).`:n?`正在检查页面内容和基础交互。`:`Checking rendered content and basic interaction.`}),vt?(0,A.jsxs)(`p`,{className:`mt-2 flex items-center gap-2 text-[11px] text-fg-muted`,children:[(0,A.jsx)(T,{className:`size-3 animate-spin`}),n?`正在保存当前源码对应的验收快照…`:`Saving the acceptance snapshot for this source…`]}):$?(0,A.jsx)(`p`,{className:`mt-2 text-[11px] leading-4 text-fg-muted`,children:Lt?n?`相比上次:已修复 ${Vt} 项,仍有 ${Rt.length} 项。`:`Since the previous run: ${Vt} fixed, ${Rt.length} remaining.`:n?`首个验收快照已保存。`:`First acceptance snapshot saved.`}):null,(0,A.jsx)(Re,{scenarios:Y,results:V,runningTarget:pt,zh:n,onRunAll:Nt,onRunScenario:Pt,onAskCoder:Ft})]}),Bt?(0,A.jsxs)(D,{className:`mt-3 w-full`,onClick:Mt,disabled:F,children:[(0,A.jsx)(x,{className:`size-4`}),n?`让 Coder 修复`:`Ask Coder to fix`]}):null]}):(0,A.jsx)(E,{className:`mt-2 h-12 rounded-lg`})]}),(0,A.jsxs)(`div`,{className:`mt-5 border-t border-edge-subtle pt-4`,children:[(0,A.jsxs)(`div`,{className:`flex items-center gap-2 text-xs font-semibold text-fg`,children:[(0,A.jsx)(se,{className:`size-4 text-accent`}),n?`权限`:`Permissions`]}),(0,A.jsx)(`div`,{className:`mt-2 flex flex-wrap gap-1.5`,children:(j?.permissions??k.permissions).map(e=>(0,A.jsx)(`span`,{className:`rounded-md bg-surface-hover px-2 py-1 text-[11px] text-fg-muted`,children:e},e))})]}),(0,A.jsx)(D,{variant:`primary`,className:`mt-5 w-full`,onClick:()=>void Ht(),disabled:M||We||I||vt||j?.status===`failed`||L!==`healthy`||Z?.status!==`passed`||!$||$.sourceHash!==j?.sourceHash||k.installationState===`installed`&&j?.hasDraftChanges===!1,children:k.installationState===`installed`?n?`安装当前更新`:`Install current update`:n?`添加到左侧导航`:`Add to sidebar`}),k.installationState===`installed`?(0,A.jsxs)(`div`,{className:`mt-2 flex gap-2`,children:[(0,A.jsxs)(D,{className:`min-w-0 flex-1`,onClick:()=>void Ot(!k.enabled),disabled:M,children:[k.enabled?(0,A.jsx)(C,{className:`size-4`}):(0,A.jsx)(ie,{className:`size-4`}),k.enabled?n?`禁用`:`Disable`:n?`启用`:`Enable`]}),(0,A.jsx)(D,{variant:`ghost`,className:`text-danger hover:text-danger`,onClick:()=>et(!0),disabled:M,"aria-label":n?`卸载应用`:`Uninstall app`,children:(0,A.jsx)(le,{className:`size-4`})})]}):null,(0,A.jsxs)(`div`,{className:`mt-6 border-t border-edge-subtle pt-4`,children:[(0,A.jsxs)(`h3`,{className:`flex items-center gap-2 text-xs font-semibold text-fg`,children:[(0,A.jsx)(ne,{className:`size-4`}),n?`版本历史`:`Release history`]}),k.releases.length?(0,A.jsx)(`ul`,{className:`mt-2 divide-y divide-edge-subtle`,children:k.releases.map(e=>(0,A.jsxs)(`li`,{className:`flex items-center justify-between gap-3 py-2.5`,children:[(0,A.jsxs)(`div`,{className:`min-w-0`,children:[(0,A.jsxs)(`div`,{className:`flex items-center gap-1.5 text-xs font-medium text-fg`,children:[`v`,e.version,e.isActive?(0,A.jsx)(`span`,{className:`rounded-full bg-success-soft px-1.5 py-0.5 text-[10px] text-success`,children:n?`当前`:`Active`}):null]}),(0,A.jsx)(`p`,{className:`mt-0.5 truncate text-[10px] text-fg-subtle`,children:Be(e.createdAt,r)})]}),e.isActive?null:(0,A.jsxs)(D,{variant:`ghost`,className:`h-7 px-2 text-xs`,onClick:()=>void kt(e.id),disabled:M,children:[(0,A.jsx)(oe,{className:`size-3.5`}),n?`恢复`:`Restore`]})]},e.id))}):(0,A.jsx)(`p`,{className:`mt-2 text-xs leading-5 text-fg-muted`,children:n?`安装首个版本后,可以从这里恢复。`:`Install the first version to enable recovery.`})]}),Xe?(0,A.jsx)(`p`,{className:`mt-3 text-xs leading-5 text-danger`,role:`alert`,children:Xe}):null]}),(0,A.jsx)(h,{open:Ze,onOpenChange:Qe,children:(0,A.jsxs)(f,{children:[(0,A.jsx)(l,{className:`xopc-dialog-overlay fixed inset-0 z-50 bg-scrim backdrop-blur-[2px]`}),(0,A.jsxs)(p,{className:`xopc-dialog-content fixed left-1/2 top-1/2 z-50 flex h-[min(560px,calc(100vh-32px))] w-[min(520px,calc(100vw-32px))] -translate-x-1/2 -translate-y-1/2 flex-col overflow-hidden rounded-2xl border border-edge bg-surface-overlay shadow-2xl focus:outline-none`,children:[(0,A.jsxs)(`div`,{className:`flex items-start justify-between border-b border-edge-subtle p-5`,children:[(0,A.jsxs)(`div`,{children:[(0,A.jsx)(m,{className:`text-base font-semibold text-fg`,children:n?`确认安装到 XOPC`:`Confirm installation`}),(0,A.jsx)(u,{className:`mt-1 text-sm text-fg-muted`,children:n?`当前草稿会成为左侧导航中的可用版本。`:`The current draft will become the version available in the sidebar.`})]}),(0,A.jsx)(d,{className:`rounded-lg p-1.5 text-fg-muted hover:bg-surface-hover`,children:(0,A.jsx)(de,{className:`size-4`})})]}),(0,A.jsxs)(`div`,{className:`min-h-0 flex-1 overflow-y-auto p-5`,children:[(0,A.jsxs)(`div`,{className:`rounded-xl border border-edge-subtle bg-surface-panel p-4`,children:[(0,A.jsx)(`h3`,{className:`text-sm font-semibold text-fg`,children:k.name}),(0,A.jsx)(`p`,{className:`mt-1 text-xs text-fg-muted`,children:k.extensionId})]}),(0,A.jsx)(`h4`,{className:`mt-5 text-xs font-semibold text-fg`,children:n?`本次迭代`:`This iteration`}),(0,A.jsxs)(`dl`,{className:`mt-2 grid grid-cols-2 gap-3 text-xs`,children:[(0,A.jsxs)(`div`,{children:[(0,A.jsx)(`dt`,{className:`text-fg-subtle`,children:n?`文件变化`:`Changed files`}),(0,A.jsx)(`dd`,{className:`mt-1 font-medium text-fg`,children:j?.changedFileCount??0})]}),(0,A.jsxs)(`div`,{children:[(0,A.jsx)(`dt`,{className:`text-fg-subtle`,children:n?`自动验收`:`Acceptance`}),(0,A.jsxs)(`dd`,{className:`mt-1 flex items-center gap-1.5 font-medium text-success`,children:[(0,A.jsx)(v,{className:`size-3.5`}),n?`已通过并保存`:`Passed and saved`]})]})]}),j?.changedFiles.length?(0,A.jsx)(`ul`,{className:`mt-3 space-y-1`,children:j.changedFiles.slice(0,5).map(e=>(0,A.jsxs)(`li`,{className:`flex min-w-0 items-center gap-2 text-[11px] text-fg-muted`,children:[(0,A.jsx)(`span`,{className:`w-4 shrink-0 font-medium text-fg-subtle`,children:e.status===`added`?`+`:e.status===`deleted`?`−`:`•`}),(0,A.jsx)(`span`,{className:`truncate font-mono`,children:e.path})]},e.path))}):null,(0,A.jsx)(`h4`,{className:`mt-5 text-xs font-semibold text-fg`,children:n?`请求权限`:`Requested permissions`}),(0,A.jsx)(`ul`,{className:`mt-2 space-y-2`,children:(j?.permissions??k.permissions).map(e=>(0,A.jsxs)(`li`,{className:`flex items-center gap-2 text-sm text-fg`,children:[(0,A.jsx)(_,{className:`size-4 text-success`}),e,k.installationState===`installed`&&j?.permissionDelta.added.includes(e)?(0,A.jsx)(`span`,{className:`rounded-full bg-warning-soft px-2 py-0.5 text-[10px] text-warning`,children:n?`新增`:`New`}):null]},e))}),k.installationState===`installed`&&j?.permissionDelta.added.length?(0,A.jsx)(`p`,{className:`mt-4 rounded-xl bg-warning-soft p-3 text-xs leading-5 text-warning`,children:n?`此更新增加了权限,请确认这些能力符合你的修改意图。`:`This update adds permissions. Confirm they match the change you requested.`}):null,(0,A.jsx)(`p`,{className:`mt-5 rounded-xl bg-accent-soft p-3 text-xs leading-5 text-accent-fg`,children:n?`Phase 1 应用只能使用界面主题和本地存储,不能访问网络或运行系统命令。`:`Phase 1 apps can use theme and local storage only. They cannot access the network or run system commands.`})]}),(0,A.jsxs)(`div`,{className:`flex justify-end gap-2 border-t border-edge-subtle p-4`,children:[(0,A.jsx)(d,{asChild:!0,children:(0,A.jsx)(D,{children:n?`取消`:`Cancel`})}),(0,A.jsxs)(D,{variant:`primary`,onClick:()=>void Et(),disabled:M,children:[M?(0,A.jsx)(T,{className:`size-4 animate-spin`}):(0,A.jsx)(te,{className:`size-4`}),n?`确认安装`:`Install`]})]})]})]})}),(0,A.jsx)(h,{open:$e,onOpenChange:et,children:(0,A.jsxs)(f,{children:[(0,A.jsx)(l,{className:`xopc-dialog-overlay fixed inset-0 z-50 bg-scrim backdrop-blur-[2px]`}),(0,A.jsxs)(p,{className:`xopc-dialog-content fixed left-1/2 top-1/2 z-50 flex h-[min(420px,calc(100vh-32px))] w-[min(500px,calc(100vw-32px))] -translate-x-1/2 -translate-y-1/2 flex-col overflow-hidden rounded-2xl border border-edge bg-surface-overlay shadow-2xl focus:outline-none`,children:[(0,A.jsxs)(`div`,{className:`flex items-start justify-between border-b border-edge-subtle p-5`,children:[(0,A.jsxs)(`div`,{children:[(0,A.jsx)(m,{className:`text-base font-semibold text-fg`,children:n?`卸载当前应用?`:`Uninstall this app?`}),(0,A.jsx)(u,{className:`mt-1 text-sm leading-6 text-fg-muted`,children:n?`应用会从侧栏移除,但项目、源码、版本历史和本地数据都会保留。`:`The app leaves the sidebar, while its Project, source, release history, and local data remain.`})]}),(0,A.jsx)(d,{className:`rounded-lg p-1.5 text-fg-muted hover:bg-surface-hover`,children:(0,A.jsx)(de,{className:`size-4`})})]}),(0,A.jsx)(`div`,{className:`min-h-0 flex-1 overflow-y-auto p-5`,children:(0,A.jsxs)(`div`,{className:`rounded-xl bg-surface-panel p-4`,children:[(0,A.jsx)(`p`,{className:`text-sm font-medium text-fg`,children:k.name}),(0,A.jsx)(`p`,{className:`mt-1 text-xs text-fg-muted`,children:n?`之后可从任意保留版本重新安装。`:`You can reinstall any retained release later.`})]})}),(0,A.jsxs)(`div`,{className:`flex justify-end gap-2 border-t border-edge-subtle p-4`,children:[(0,A.jsx)(d,{asChild:!0,children:(0,A.jsx)(D,{children:n?`取消`:`Cancel`})}),(0,A.jsxs)(D,{variant:`ghost`,className:`text-danger hover:bg-danger-soft hover:text-danger`,onClick:()=>void At(),disabled:M,children:[M?(0,A.jsx)(T,{className:`size-4 animate-spin`}):(0,A.jsx)(le,{className:`size-4`}),n?`卸载但保留项目`:`Uninstall and keep Project`]})]})]})]})})]})}export{He as LocalAppWorkbenchPage};
|
package/dist/gateway/static/root/assets/{local-apps-page-BOwqNH0L.js → local-apps-page-D6D2bZGW.js}
RENAMED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{a as t,n,t as r}from"./vendor-react-BOUWij0V.js";import{t as i}from"./chunk-KS7C4IRE-CiwuuyV8.js";import{n as a}from"./locale-store-
|
|
1
|
+
import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{a as t,n,t as r}from"./vendor-react-BOUWij0V.js";import{t as i}from"./chunk-KS7C4IRE-CiwuuyV8.js";import{n as a}from"./locale-store-Br7IfbXK.js";import{t as o}from"./arrow-right-DSSvoX71.js";import{t as s}from"./box-DvYoGszj.js";import{t as c}from"./plus-Q2yW6OE7.js";import{t as l}from"./skeleton-BI5TyibZ.js";import{i as u}from"./vendor-swr-CdRzEUwF.js";import{t as d}from"./button-Cc4hUNTt.js";import{t as f}from"./page-header-store-Du44NIEJ.js";import{o as p}from"./api-CRT9ZyH0.js";var m=n(),h=e(t(),1),g=r();function _(){let e=(0,m.c)(20),t=a(x)===`zh`,n=f(b),r=f(y),{data:l,isLoading:_,error:S}=u(`local-apps-list`,p),C,w;e[0]!==r||e[1]!==n||e[2]!==t?(C=()=>(n({startExtra:null,main:(0,g.jsx)(`h1`,{className:`truncate text-base font-semibold tracking-tight text-fg`,children:t?`应用工坊`:`App Studio`}),end:(0,g.jsx)(d,{asChild:!0,variant:`primary`,className:`h-9`,children:(0,g.jsxs)(i,{to:`/local-apps/new`,children:[(0,g.jsx)(c,{className:`size-4`}),t?`创建应用`:`Create app`]})})}),()=>r()),w=[r,n,t],e[0]=r,e[1]=n,e[2]=t,e[3]=C,e[4]=w):(C=e[3],w=e[4]),(0,h.useLayoutEffect)(C,w);let T=t?`创建属于你的 XOPC 应用`:`Build your own apps for XOPC`,E;e[5]===T?E=e[6]:(E=(0,g.jsx)(`h2`,{className:`text-2xl font-semibold tracking-tight text-fg`,children:T}),e[5]=T,e[6]=E);let D=t?`创建、预览并持续改进自己的工具,需要时可以添加到侧栏。`:`Create, preview, and improve your own tools, then add them to the sidebar when they are ready.`,O;e[7]===D?O=e[8]:(O=(0,g.jsx)(`p`,{className:`mt-2 text-sm leading-6 text-fg-muted`,children:D}),e[7]=D,e[8]=O);let k;e[9]!==E||e[10]!==O?(k=(0,g.jsxs)(`div`,{className:`mb-7 max-w-2xl`,children:[E,O]}),e[9]=E,e[10]=O,e[11]=k):k=e[11];let A;e[12]!==l||e[13]!==S||e[14]!==_||e[15]!==t?(A=_?(0,g.jsx)(`div`,{className:`grid gap-4 sm:grid-cols-2 lg:grid-cols-3`,children:Array.from({length:3}).map(v)}):S?(0,g.jsx)(`p`,{className:`rounded-xl border border-danger/30 bg-danger-soft p-4 text-sm text-danger`,children:S instanceof Error?S.message:String(S)}):l?.length?(0,g.jsx)(`div`,{className:`grid gap-4 sm:grid-cols-2 lg:grid-cols-3`,children:l.map(e=>(0,g.jsxs)(i,{to:`/local-apps/${encodeURIComponent(e.id)}`,className:`group flex min-h-44 flex-col rounded-xl border border-edge-subtle bg-surface-base p-4 shadow-surface transition-colors hover:bg-surface-hover/45 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,children:[(0,g.jsxs)(`div`,{className:`flex items-start justify-between gap-3`,children:[(0,g.jsx)(`div`,{className:`flex size-10 items-center justify-center rounded-xl bg-accent-soft text-accent-fg`,children:(0,g.jsx)(s,{className:`size-5`})}),(0,g.jsx)(`span`,{className:`rounded-full bg-surface-hover px-2 py-1 text-[11px] font-medium text-fg-muted`,children:e.installationState===`not_installed`?t?`草稿`:`Draft`:e.enabled?t?`已在侧栏`:`In sidebar`:t?`已禁用`:`Disabled`})]}),(0,g.jsx)(`h3`,{className:`mt-4 truncate text-sm font-semibold text-fg`,children:e.name}),(0,g.jsx)(`p`,{className:`mt-1 line-clamp-2 text-xs leading-5 text-fg-muted`,children:e.description||e.idea}),(0,g.jsxs)(`div`,{className:`mt-auto flex items-center justify-end pt-3 text-xs font-medium text-accent`,children:[t?`编辑应用`:`Edit app`,(0,g.jsx)(o,{className:`ml-1 size-3.5 transition-transform group-hover:translate-x-0.5`})]})]},e.id))}):(0,g.jsxs)(`div`,{className:`px-6 py-16 text-center`,children:[(0,g.jsx)(s,{className:`mx-auto size-8 text-fg-subtle`}),(0,g.jsx)(`h3`,{className:`mt-4 text-sm font-semibold text-fg`,children:t?`还没有应用`:`No apps yet`}),(0,g.jsx)(`p`,{className:`mx-auto mt-2 max-w-md text-sm text-fg-muted`,children:t?`描述你想解决的问题,XOPC 会创建应用草稿,并用项目保存后续开发记录。`:`Describe the problem and XOPC will create an app scaffold and an ongoing Project.`}),(0,g.jsx)(d,{asChild:!0,variant:`primary`,className:`mt-5`,children:(0,g.jsxs)(i,{to:`/local-apps/new`,children:[(0,g.jsx)(c,{className:`size-4`}),t?`创建第一个应用`:`Create your first app`]})})]}),e[12]=l,e[13]=S,e[14]=_,e[15]=t,e[16]=A):A=e[16];let j;return e[17]!==k||e[18]!==A?(j=(0,g.jsx)(`div`,{className:`min-h-0 flex-1 overflow-y-auto bg-surface-panel px-3 pb-8 pt-3 sm:px-5 lg:pt-4 xl:px-6`,children:(0,g.jsxs)(`div`,{className:`mx-auto max-w-6xl`,children:[k,A]})}),e[17]=k,e[18]=A,e[19]=j):j=e[19],j}function v(e,t){return(0,g.jsx)(l,{className:`h-44 rounded-xl`},t)}function y(e){return e.clearPageHeader}function b(e){return e.setPageHeader}function x(e){return e.language}export{_ as LocalAppsPage};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{l as e}from"./locale-store-
|
|
1
|
+
import{l as e}from"./locale-store-Br7IfbXK.js";import{a as t,c as n,d as r,g as i,i as a,m as o,n as s,o as c,p as l,u,v as d,y as f}from"./schemas-CCWMleym.js";var p=o().regex(/^[A-Za-z0-9_-]{1,64}$/),m=l({id:p,label:o().trim().min(1).max(120),description:o().max(500).optional()}),h={id:p,header:o().trim().min(1).max(24),question:o().trim().min(1).max(1e3)},g=a(c(`type`,[l({...h,type:n(`text`)}),l({...h,type:n(`single_choice`),choices:a(m).min(2).max(10),recommendedChoiceId:p.optional()})])).min(1).max(3).superRefine((e,t)=>{new Set(e.map(e=>e.id)).size!==e.length&&t.addIssue({code:`custom`,message:`Duplicate question IDs`}),e.forEach((e,n)=>{e.type===`single_choice`&&(new Set(e.choices.map(e=>e.id)).size!==e.choices.length&&t.addIssue({code:`custom`,path:[n,`choices`],message:`Duplicate choice IDs`}),e.recommendedChoiceId&&!e.choices.some(t=>t.id===e.recommendedChoiceId)&&t.addIssue({code:`custom`,path:[n,`recommendedChoiceId`],message:`Unknown recommended choice`}))})}),_=a(l({questionId:p,choiceId:p.optional(),text:o().trim().max(2e3).optional()})).min(1).max(3);l({schemaVersion:n(2),questions:g});var v=l({clarificationVersions:a(i([n(1),n(2)])).min(1).max(2)});function y(e){if(new TextEncoder().encode(JSON.stringify(e)).byteLength>32*1024)throw Error(`Clarification exceeds 32 KiB`)}function b(e,t){let n=_.parse(t);if(y(n),n.length!==e.length||new Set(n.map(e=>e.questionId)).size!==n.length||n.some(t=>!e.some(e=>e.id===t.questionId)))throw Error(`Answer every question exactly once`);let r=e.map(e=>{let t=n.find(t=>t.questionId===e.id),r=t.text?.trim()||void 0;if(e.type===`text`&&t.choiceId)throw Error(`Unexpected choice: ${e.id}`);if(t.choiceId&&(e.type!==`single_choice`||!e.choices.some(e=>e.id===t.choiceId)))throw Error(`Unknown choice: ${e.id}`);if(!t.choiceId&&!r)throw Error(`Answer required: ${e.id}`);return{questionId:e.id,...t.choiceId?{choiceId:t.choiceId}:{},...r?{text:r}:{}}});return{answers:r,answer:e.map((e,t)=>{let n=r[t],i=e.type===`single_choice`?e.choices.find(e=>e.id===n.choiceId)?.label:void 0;return`${e.header}: ${e.question}\n${[i,n.text].filter(Boolean).join(`
|
|
2
2
|
`)}`}).join(`
|
|
3
3
|
|
|
4
4
|
`)}}var x=l({kind:s([`note`,`task`,`project`,`local_app`]),id:o().min(1).max(512),revision:o().min(1).max(128)}),S=l({version:n(1),clientInstanceId:o().uuid(),tabId:o().uuid(),sequence:u().int().nonnegative().max(2**53-1),surface:s([`web`,`electron`,`mobile`]),resourceRefs:a(x).max(20),selection:l({text:o().max(16e3),draft:t().default(!1)}).optional(),capturedAt:u().int().nonnegative().max(2**53-1)}),C=r({snapshot:S,resources:a(r({reference:x,title:o(),text:o().max(16e3),truncated:t()})).max(20),selectionTrust:n(`user-supplied`)});function w(e){let t=S.parse(e);if(new TextEncoder().encode(JSON.stringify(t)).byteLength>65536)throw Error(`App context exceeds 64 KiB`);let n=t.resourceRefs.map(e=>`${e.kind}:${e.id}`);if(new Set(n).size!==n.length)throw Error(`App context contains duplicate resources`);return t}var T=e=>new TextEncoder().encode(e).byteLength,E=a(l({kind:n(`browser_page`),sourceId:f(),version:o().regex(/^[a-f0-9]{64}$/),title:o().trim().min(1).max(512),url:d(),capturedAt:u().int().nonnegative(),documentId:o().trim().min(1).max(256),selection:o().optional(),text:o().optional(),truncated:t()}).superRefine((e,t)=>{let n=new URL(e.url);(![`http:`,`https:`].includes(n.protocol)||n.username||n.password||n.hash)&&t.addIssue({code:`custom`,path:[`url`],message:`URL must be a sanitized HTTP(S) URL`}),!e.selection?.trim()&&!e.text?.trim()&&t.addIssue({code:`custom`,message:`A browser context must include selection or page text`}),e.selection&&T(e.selection)>32768&&t.addIssue({code:`custom`,path:[`selection`],message:`Selection is too large`}),e.text&&T(e.text)>131072&&t.addIssue({code:`custom`,path:[`text`],message:`Page text is too large`})})).max(2).superRefine((e,t)=>{T(JSON.stringify(e))>262144&&t.addIssue({code:`custom`,message:`Browser contexts are too large`})}),D=l({agentId:o().trim().min(1),projectId:o().trim().min(1).nullable(),execution:l({mode:s([`local_checkout`,`managed_worktree`]),baseRef:o().trim().min(1).optional()}).nullable(),temporary:t(),model:o().trim().min(1),thinkingLevel:o().min(1)}).refine(e=>e.projectId!==null||e.execution===null,{message:`An execution environment requires a project`,path:[`execution`]}),O=l({id:o().optional(),type:o().min(1),mimeType:o().optional(),data:o().optional(),uri:o().optional(),name:o().optional(),size:u().nonnegative().optional(),workspaceRelativePath:o().optional(),durationSeconds:u().nonnegative().optional()}),k=l({version:n(1),capturedAt:u().int().nonnegative().max(2**53-1),timezone:o().min(1).max(80).refine(e=>{try{return new Intl.DateTimeFormat(`en`,{timeZone:e}),!0}catch{return!1}},`Invalid timezone`),locale:o().min(1).max(80).refine(e=>{try{return Intl.getCanonicalLocales(e).length===1}catch{return!1}},`Invalid locale`)}),A=l({content:o(),endpointContext:k.optional(),interactionCapabilities:v.optional(),attachments:a(O).optional(),contextRefs:a(l({kind:s([`note`,`task`,`file`,`session`,`browser_tab`,`user_assertion`,`result`]),sourceId:o().trim().min(1),refId:o().regex(/^[A-Za-z0-9_-]{1,64}$/).optional(),expectedVersion:o().optional()})).max(5).optional(),browserContexts:E.optional(),appContext:S.optional()}),j=c(`type`,[l({type:n(`endpoint`),endpointId:o().min(1),token:o().min(1)}),l({type:n(`system`),source:n(`cli`)})]),M=c(`kind`,[l({kind:n(`start`),clientMessageId:o().min(1).max(128),creation:D,input:A,origin:j}),l({kind:n(`append`),clientMessageId:o().min(1).max(128),expectedTranscriptId:o().min(1).max(128),configVersion:u().int().nonnegative(),delivery:s([`next`,`steer`]),interrupt:t().optional(),input:A,origin:j})]);l({commandId:o().min(1).max(128),creation:D,purpose:s([`voice`,`session_resources`])});var N=r({operationId:o(),revision:u().int(),state:s([`preparing`,`ready`,`preparation_failed`]),lastError:o().nullable()});function P(e){if(typeof e!=`object`||!e)return JSON.stringify(e)??`null`;if(Array.isArray(e))return`[${e.map(P).join(`,`)}]`;let t=e;return`{${Object.keys(t).filter(e=>t[e]!==void 0).sort().map(e=>`${JSON.stringify(e)}:${P(t[e])}`).join(`,`)}}`}var F,I=new Set,L=new Map,R=new Map,z=new Map,B=new Map;function V(){return F??=new Promise((e,t)=>{let n=indexedDB.open(`xopc-session-drafts`,2);n.onupgradeneeded=()=>{for(let e of[`drafts`,`identities`,`commands`,`composers`])n.result.objectStoreNames.contains(e)||n.result.createObjectStore(e)},n.onsuccess=()=>e(n.result),n.onerror=()=>{F=void 0,t(n.error)}})}function H(){let t=e.getState();if(!t.conversationId)throw Error(`Sign in before opening a conversation`);return t.conversationId}function U(e){return`${H()}:${e}`}function W(e,t=e){let n=U(e),r=U(t);return{async read(){return I.has(r)?structuredClone(B.get(n)):G(`readonly`,e=>e.get(n),`composers`)},async write(e){if(I.has(r)){e===void 0?B.delete(n):B.set(n,structuredClone(e));return}e===void 0?await G(`readwrite`,e=>e.delete(n),`composers`):await G(`readwrite`,t=>t.put(e,n),`composers`)}}}async function G(e,t,n=`drafts`){let r=await V();return new Promise((i,a)=>{let o=r.transaction(n,e),s=t(o.objectStore(n));o.oncomplete=()=>i(s.result),o.onabort=()=>a(o.error??s.error??Error(`Draft persistence failed`)),o.onerror=()=>a(o.error??s.error)})}async function K(e){let t=U(e);return I.has(t)?structuredClone(L.get(t)):G(`readonly`,e=>e.get(t))}async function q(e){let t=U(e.conversationId);if(e.creation.temporary){I.add(t),L.set(t,structuredClone(e));return}I.delete(t),L.delete(t),await G(`readwrite`,n=>n.put(e,t))}async function J(e,t){let n=U(e);if(I.has(n)){z.set(n,t);return}await G(`readwrite`,e=>e.put(t,n),`identities`)}async function Y(e){let t=U(e);return I.has(t)?z.get(t):G(`readonly`,e=>e.get(t),`identities`)}async function X(e){let t=U(e);return I.has(t)?structuredClone(R.get(t)):G(`readonly`,e=>e.get(t),`commands`)}async function Z(e,t){let n=U(e);if(I.has(n)){let e=R.get(n);if(e&&P(e)!==P(t))throw Error(`Another input is awaiting confirmation`);R.set(n,structuredClone(t));return}let r=await V();await new Promise((e,i)=>{let a=r.transaction(`commands`,`readwrite`),o=a.objectStore(`commands`),s=o.get(n);s.onsuccess=()=>{let e=s.result;if(e&&P(e)!==P(t)){a.abort();return}o.put(t,n)},a.oncomplete=()=>e(),a.onabort=()=>i(Error(`Another input is awaiting confirmation`)),a.onerror=()=>i(a.error)})}async function Q(e){let t=U(e);if(I.has(t)){R.delete(t);return}await G(`readwrite`,e=>e.delete(t),`commands`)}async function $(e,t){let n=U(e);if(I.has(n)){z.set(n,t),L.delete(n),R.delete(n);return}let r=await V();await new Promise((e,i)=>{let a=r.transaction([`drafts`,`identities`,`commands`],`readwrite`);a.objectStore(`identities`).put(t,n),a.objectStore(`drafts`).delete(n),a.objectStore(`commands`).delete(n),a.oncomplete=()=>e(),a.onabort=()=>i(a.error??Error(`Receipt persistence failed`)),a.onerror=()=>i(a.error)})}function ee(e){return{localDraft:!0,model:e.creation.model,thinkingLevel:e.creation.thinkingLevel,fixedModel:!1,activityDetail:{default:`on`,override:null,effective:`on`,source:`default`},effectiveWorkspacePath:``,workingDirectoryLocked:!!e.creation.projectId,workspaceSource:e.creation.projectId?`project`:`agent_default_root`,userContextMode:e.creation.temporary?`temporary`:`enabled`}}export{w as _,K as a,b,J as c,P as d,k as f,C as g,S as h,ee as i,q as l,N as m,W as n,X as o,M as p,$ as r,Y as s,Q as t,Z as u,_ as v,g as y};
|
package/dist/gateway/static/root/assets/{locale-store-Bg_XR36n.js → locale-store-Br7IfbXK.js}
RENAMED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{a as t}from"./vendor-react-BOUWij0V.js";import{t as n}from"./messages-
|
|
1
|
+
import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{a as t}from"./vendor-react-BOUWij0V.js";import{t as n}from"./messages-ByFlEbsu.js";var r=e(t(),1),i=e=>{let t,n=new Set,r=(e,r)=>{let i=typeof e==`function`?e(t):e;if(!Object.is(i,t)){let e=t;t=r??(typeof i!=`object`||!i)?i:Object.assign({},t,i),n.forEach(n=>n(t,e))}},i=()=>t,a={setState:r,getState:i,getInitialState:()=>o,subscribe:e=>(n.add(e),()=>n.delete(e))},o=t=e(r,i,a);return a},a=(e=>e?i(e):i),o=e=>e;function s(e,t=o){let n=r.useSyncExternalStore(e.subscribe,r.useCallback(()=>t(e.getState()),[e,t]),r.useCallback(()=>t(e.getInitialState()),[e,t]));return r.useDebugValue(n),n}var c=e=>{let t=a(e),n=e=>s(t,e);return Object.assign(n,t),n},l=(e=>e?c(e):c);function u(e){let t=(e??``).trim().toLowerCase().replace(/_/g,`-`);return t&&(t===`zh`||t.startsWith(`zh-`))?`zh`:`en`}function d(){if(typeof navigator>`u`)return`en`;let e=(navigator.language||navigator.languages?.[0]||``).trim();return e?u(e):`en`}function f(e){return e===`zh`?`zh-CN`:`en`}function p(e){document.documentElement.setAttribute(`lang`,f(e)),document.title=n(e).appTitle}function m(){return U.getState().language}function h(e,t,n){let r=e.trim().toLowerCase();return!!(!r||r===`http ${t}`||n&&r===n.trim().toLowerCase()||t===429&&(r===`rate_limited`||r===`too many requests`||r===`too many authentication attempts`)||t===500&&r===`internal server error`||t>=500&&(r===`provider request failed`||r===`provider_error`))}function g(e,t,r){let i=r?.trim()??``;if(i&&!h(i,e,t))return i;let a=n(m()).api;return e>=500?e===502?a.errorBadGateway:e===503?a.errorServiceUnavailable:e===504?a.errorGatewayTimeout:e===500?a.errorInternal:a.errorServer.replace(`{{status}}`,String(e)):e===404?a.errorNotFound:e===403?a.errorForbidden:e===429?a.errorRateLimited:a.errorRequest.replace(`{{status}}`,String(e))}var _=l(e=>({baseUrl:typeof window<`u`?window.location.origin:``,conversationId:void 0,tokenDialogOpen:!1,tokenExpired:!1,setBrowserSession:t=>{e({conversationId:t,tokenDialogOpen:!1,tokenExpired:!1}),window.dispatchEvent(new CustomEvent(`gateway-authenticated`))},clearBrowserSession:()=>{fetch(`/api/browser-session`,{method:`DELETE`,credentials:`same-origin`,redirect:`error`,signal:AbortSignal.timeout(8e3)}).catch(()=>{}),e({conversationId:void 0})},openTokenDialog:()=>e({tokenDialogOpen:!0}),closeTokenDialog:()=>e({tokenDialogOpen:!1}),onUnauthorized:()=>{e({conversationId:void 0,tokenDialogOpen:!1,tokenExpired:!0}),window.dispatchEvent(new CustomEvent(`gateway-auth-expired`))}}));async function v(e){return fetch(`/api/browser-session`,{method:`POST`,credentials:`same-origin`,redirect:`error`,signal:AbortSignal.timeout(8e3),headers:{Authorization:`Bearer ${e}`}})}async function y(){try{let e=await fetch(`/api/browser-session`,{credentials:`same-origin`,redirect:`error`,signal:AbortSignal.timeout(8e3)});if(e.ok){let t=await e.json();if(t.conversationId){_.getState().setBrowserSession(t.conversationId);return}}if(e.status!==401)return;let t=window.electronAPI?.gateway?.getCredential,n=typeof t==`function`?await t():void 0;if(!n)return;let r=await v(n);if(!r.ok)return;let i=await r.json();i.conversationId&&_.getState().setBrowserSession(i.conversationId)}catch{}}var b=null,x=null;function S(){b||=new Promise(e=>{x=e})}function C(){b&&(x?.(),b=null,x=null)}typeof window<`u`&&window.addEventListener(`gateway-authenticated`,C);async function w(e,t){b&&await b;let n=new Headers(t?.headers),r=t?.body,i=typeof FormData<`u`&&r instanceof FormData;!n.has(`Content-Type`)&&!i&&n.set(`Content-Type`,`application/json`);let a=await fetch(e,{...t,credentials:`same-origin`,redirect:`error`,headers:n});return a.status===401&&(S(),_.getState().onUnauthorized()),a}async function T(e,t){let n=await w(e,t);if(!n.ok){let e=await n.json().catch(()=>({})),t=typeof e.error==`string`?e.error:e.error?.message,r=g(n.status,n.statusText,t),i=n.headers.get(`Retry-After`),a=i==null?NaN:Number(i);throw Object.assign(Error(r),{status:n.status,body:e,...Number.isFinite(a)&&a>=0?{retryAfterMs:a*1e3}:{}})}return n.json()}function E(){return window.location.origin}function D(e){let t=e.startsWith(`/`)?e:`/${e}`;return`${E()}${t}`}var O=`xopc.language`;function k(){return A()||d()}function A(){try{let e=localStorage.getItem(O);return e===`en`||e===`zh`?e:null}catch{return null}}function j(e){try{localStorage.setItem(O,e)}catch(e){console.error(`Failed to save language:`,e)}}var M,N,P,F;function I(e){return e===`en`||e===`zh`}function L(e){j(e),p(e)}function R(e){window.electronAPI?.locale?.setLanguage(e).catch(()=>{})}function z(e,t){return e?.token===t.token&&e.language===t.language}async function B(){for(;N;){let e=N;N=void 0,M=e,(await Promise.allSettled([T(D(`/api/voice/language`),{method:`POST`,body:JSON.stringify({language:e.language})}),T(D(`/api/user-model/assertions`),{method:`POST`,body:JSON.stringify({scope:{type:`global`},subject:{type:`user`,id:`self`},predicate:`preference.locale`,cardinality:`single`,kind:`preference`,value:e.language===`zh`?`zh-CN`:`en`,statement:e.language===`zh`?`The user prefers Chinese.`:`The user prefers English.`,volatility:`slow`,declaredImportance:.8})})])).every(e=>e.status===`fulfilled`)&&(P=e),M=void 0}}function V(){F||=B().finally(()=>{F=void 0,N&&V()})}function H(e){let t=_.getState().conversationId;if(!t)return;let n={token:t,language:e};if(z(M,n)){N=void 0;return}z(N,n)||!M&&z(P,n)||(N=n,V())}var U=l(e=>({language:k(),setLanguage:t=>{L(t),e({language:t}),R(t),H(t)}}));function W(){H(U.getState().language);let e=_.subscribe((e,t)=>{e.conversationId&&e.conversationId!==t.conversationId&&H(U.getState().language)}),t=window.electronAPI?.locale;if(!t)return e;let n=!1,r=A();r?R(r):t.getLanguage().then(e=>{n||!I(e)||(L(e),U.setState({language:e}),H(e))});let i=t.onChanged(e=>{n||!I(e)||(L(e),U.setState({language:e}),H(e))});return()=>{n=!0,i(),e()}}export{w as a,y as c,p as d,f,D as i,_ as l,U as n,T as o,l as p,k as r,v as s,W as t,g as u};
|