@xopcai/xopc 0.0.474 → 0.0.476
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/browser-ext/manifest.json +1 -1
- package/dist/extensions/telegram/xopc.extension.json +1 -1
- package/dist/gateway/server/chunks.bin +1103 -1067
- package/dist/gateway/server/chunks.json +1 -1
- package/dist/gateway/server/schema.sql +13 -0
- package/dist/gateway/server/upgrades/281_session_agent_reactions.sql +13 -0
- package/dist/gateway/static/root/assets/{activity-store-nD2NH0C7.js → activity-store-BK11iD5x.js} +1 -1
- package/dist/gateway/static/root/assets/{agent-avatar-dicebear-D0JEEj2L.js → agent-avatar-dicebear-DZlgZHm9.js} +1 -1
- package/dist/gateway/static/root/assets/{agent-avatar-display-BxHA8hEW.js → agent-avatar-display-BDHjRaTK.js} +2 -2
- package/dist/gateway/static/root/assets/{agent-defaults-settings-panel-C7O0Aaq3.js → agent-defaults-settings-panel-Bicuh10_.js} +1 -1
- package/dist/gateway/static/root/assets/{agent-plugin-dialog--H7-gWL7.js → agent-plugin-dialog-hRZYhcLp.js} +1 -1
- package/dist/gateway/static/root/assets/{agents-CIcUUuaE.js → agents-C2DH8M4z.js} +3 -3
- package/dist/gateway/static/root/assets/{agents-admin-api-DyeFg0yq.js → agents-admin-api-_mp_Ew1u.js} +1 -1
- package/dist/gateway/static/root/assets/{api-DAWXH9Wf.js → api-D0r-2gWQ.js} +1 -1
- package/dist/gateway/static/root/assets/{api-LSz0L9gc.js → api-oA0NOKLI.js} +1 -1
- package/dist/gateway/static/root/assets/{app-management-settings-panel-CjXfqaEA.js → app-management-settings-panel-BrO0gY6b.js} +1 -1
- package/dist/gateway/static/root/assets/{appearance-settings-0Zl5M7iV.js → appearance-settings-h82Or0g-.js} +1 -1
- package/dist/gateway/static/root/assets/{apps-page-DDVJnHlm.js → apps-page-B9Ho8S53.js} +1 -1
- package/dist/gateway/static/root/assets/{archive-plugin-CMqJbzQ-.js → archive-plugin-Co_oRPj1.js} +1 -1
- package/dist/gateway/static/root/assets/{automation-api-DHGtNfOT.js → automation-api-CxLFngqe.js} +1 -1
- package/dist/gateway/static/root/assets/{automation-result-state-DUBlVnPg.js → automation-result-state-CjiuyW-C.js} +1 -1
- package/dist/gateway/static/root/assets/{automation-run-list-CuWKRWy0.js → automation-run-list-CLjSIujK.js} +1 -1
- package/dist/gateway/static/root/assets/{automation-task-card-Y4vC_7qq.js → automation-task-card-BS-RT312.js} +1 -1
- package/dist/gateway/static/root/assets/{automations-page-DBQyHgFW.js → automations-page-BL6ASYrU.js} +1 -1
- package/dist/gateway/static/root/assets/{automations-workspace-DRCt4lq0.js → automations-workspace-BFk-AF43.js} +2 -2
- package/dist/gateway/static/root/assets/{binary-plugins-CMKEp-IB.js → binary-plugins-5GVlyrXg.js} +1 -1
- package/dist/gateway/static/root/assets/{block-editor-CQwjLxA9.js → block-editor-Dtz8JtrO.js} +1 -1
- package/dist/gateway/static/root/assets/{browser-settings-page-BA0i0h3v.js → browser-settings-page-CDUHHu0n.js} +1 -1
- package/dist/gateway/static/root/assets/capabilities-Clwtvm7F.js +1 -0
- package/dist/gateway/static/root/assets/{capabilities--EoyYsa8.js → capabilities-DFRrPT_I.js} +1 -1
- package/dist/gateway/static/root/assets/{capabilities-page-B5Ja0Knr.js → capabilities-page-D9EpUcuB.js} +2 -2
- package/dist/gateway/static/root/assets/{capabilities-settings-panel-C5WmcgqD.js → capabilities-settings-panel-ComYXaP1.js} +2 -2
- package/dist/gateway/static/root/assets/{channels-BQPomrMC.js → channels-Aa2Iun4r.js} +1 -1
- package/dist/gateway/static/root/assets/{chat-agents-api-DI0TksSO.js → chat-agents-api-B-47bqbd.js} +1 -1
- package/dist/gateway/static/root/assets/{chat-chart-block-CNm3uFNf.js → chat-chart-block-DA2S21y2.js} +1 -1
- package/dist/gateway/static/root/assets/chat-page-BbahuZ59.js +72 -0
- package/dist/gateway/static/root/assets/{chat-terminal-dock-D1DkoN9Y.js → chat-terminal-dock-BALrP7_l.js} +1 -1
- package/dist/gateway/static/root/assets/{chunk-KS7C4IRE-CiwuuyV8.js → chunk-KS7C4IRE-BPb7KheU.js} +2 -2
- package/dist/gateway/static/root/assets/{command-palette-api-DZt3IZKz.js → command-palette-api-BbSsGD48.js} +1 -1
- package/dist/gateway/static/root/assets/{composer-model-config-control-_doimXGR.js → composer-model-config-control-BFC8jNyK.js} +1 -1
- package/dist/gateway/static/root/assets/{composer-notifications-BE40dFxM.js → composer-notifications-Drbl5lKS.js} +1 -1
- package/dist/gateway/static/root/assets/{composer-payload-handoff-DMWTIrnl.js → composer-payload-handoff-DKLokix8.js} +1 -1
- package/dist/gateway/static/root/assets/{computer-settings-page-DJiToD0s.js → computer-settings-page-CVWaJ3L8.js} +1 -1
- package/dist/gateway/static/root/assets/{connected-providers-grid-CYWTW8cv.js → connected-providers-grid-NZP4qb6S.js} +1 -1
- package/dist/gateway/static/root/assets/{connection-usage-guide-QgwPzjZb.js → connection-usage-guide-BNoFtMol.js} +1 -1
- package/dist/gateway/static/root/assets/{connector-service-page-DkQsU_yu.js → connector-service-page-CzrdJ4JY.js} +1 -1
- package/dist/gateway/static/root/assets/{connectors-api-Bqac6cVg.js → connectors-api-KA6rkOJX.js} +1 -1
- package/dist/gateway/static/root/assets/{connectors-page-DSCQw53B.js → connectors-page-BUqNvStL.js} +1 -1
- package/dist/gateway/static/root/assets/{date-picker-B0J_jDfr.js → date-picker-DgTDENzF.js} +1 -1
- package/dist/gateway/static/root/assets/{date-time-picker-Zr3u7nL1.js → date-time-picker-Gw4oSOk9.js} +1 -1
- package/dist/gateway/static/root/assets/{dependency-picker-CLD0xbpi.js → dependency-picker-BJDpQtKY.js} +1 -1
- package/dist/gateway/static/root/assets/{desktop-pet-CfQHdCjf.js → desktop-pet-BbIPYbvc.js} +1 -1
- package/dist/gateway/static/root/assets/{desktop-pet-settings-wlYidCpI.js → desktop-pet-settings-Cqzplufb.js} +1 -1
- package/dist/gateway/static/root/assets/{dev-view-store-DM2X7oYZ.js → dev-view-store-CXE5-Egp.js} +1 -1
- package/dist/gateway/static/root/assets/{device-pairing-wizard-DIjBN08k.js → device-pairing-wizard-DXFZiWMi.js} +1 -1
- package/dist/gateway/static/root/assets/{directory-picker-path-field-BJj6gT1z.js → directory-picker-path-field-DVFEzTAJ.js} +1 -1
- package/dist/gateway/static/root/assets/{extension-authoritative-grants-DC9q_s91.js → extension-authoritative-grants-DAfeCx4B.js} +1 -1
- package/dist/gateway/static/root/assets/{extension-debug-page-DBLJqOJ2.js → extension-debug-page-gW4GEEcj.js} +1 -1
- package/dist/gateway/static/root/assets/{extension-iframe-host-DCdjl257.js → extension-iframe-host-DOPywUKI.js} +1 -1
- package/dist/gateway/static/root/assets/{extension-marketplace-api-BEulqVpr.js → extension-marketplace-api-Bo_chffY.js} +1 -1
- package/dist/gateway/static/root/assets/{extension-message-router-DhEyQZWI.js → extension-message-router-TTAx3dPv.js} +1 -1
- package/dist/gateway/static/root/assets/{extension-page-BpY2ZrxI.js → extension-page-Iq7vFC-g.js} +1 -1
- package/dist/gateway/static/root/assets/{extension-provider-YdavG8wv.js → extension-provider-BNnLkq95.js} +1 -1
- package/dist/gateway/static/root/assets/{extension-settings-page-BKvG-hJa.js → extension-settings-page-C0oLjaz6.js} +1 -1
- package/dist/gateway/static/root/assets/{file-preview-surface-D71-xhLL.js → file-preview-surface-BSrIpn5C.js} +1 -1
- package/dist/gateway/static/root/assets/files-GdwDamkp.js +1 -0
- package/dist/gateway/static/root/assets/{gateway-config-swr-C-cx4ObA.js → gateway-config-swr-2VOPSLSq.js} +1 -1
- package/dist/gateway/static/root/assets/{gateway-realtime-Dh23j5Jx.js → gateway-realtime-CfceJ5WX.js} +1 -1
- package/dist/gateway/static/root/assets/gateway-realtime-store-Ca42Wsk6.js +1 -0
- package/dist/gateway/static/root/assets/{gateway-restart-F1q8XY7Y.js → gateway-restart-Dsg95Dwt.js} +1 -1
- package/dist/gateway/static/root/assets/{gateway-settings-WQ42gfHY.js → gateway-settings-CMgry8RK.js} +1 -1
- package/dist/gateway/static/root/assets/{gateway-startup-retry-Dx1dmgnX.js → gateway-startup-retry-D0i7dt51.js} +1 -1
- package/dist/gateway/static/root/assets/{global-defaults-api-C_Sn41rn.js → global-defaults-api-u-ado9kz.js} +1 -1
- package/dist/gateway/static/root/assets/{home-page-A3VCyEO8.js → home-page-pT-lEQsu.js} +4 -4
- package/dist/gateway/static/root/assets/{image-generation-api-CvRiMNIJ.js → image-generation-api-DDHOD0Nx.js} +1 -1
- package/dist/gateway/static/root/assets/{imports-page-DJ2wJ2QG.js → imports-page-BxRXNvQx.js} +1 -1
- package/dist/gateway/static/root/assets/index-BtHMU5k4.css +1 -0
- package/dist/gateway/static/root/assets/index-DdEh8KeB.js +11 -0
- package/dist/gateway/static/root/assets/{install-connector-dialog-CyHz1Nys.js → install-connector-dialog-Rox2_5eU.js} +1 -1
- package/dist/gateway/static/root/assets/{keyboard-shortcuts-settings-Byb_rqj4.js → keyboard-shortcuts-settings-D7xlV7xT.js} +1 -1
- package/dist/gateway/static/root/assets/{local-app-workbench-page-D58zzTUZ.js → local-app-workbench-page-ReBczGac.js} +1 -1
- package/dist/gateway/static/root/assets/{local-apps-page-L6ODN66C.js → local-apps-page-Ct07GT0V.js} +1 -1
- package/dist/gateway/static/root/assets/{local-session-drafts-UN3vioSr.js → local-session-drafts-8PozABVy.js} +1 -1
- package/dist/gateway/static/root/assets/{locale-store-CnHhWsDP.js → locale-store-B4o4aDCg.js} +1 -1
- package/dist/gateway/static/root/assets/{logs-page-2rOEUxHs.js → logs-page-CtEv5J4C.js} +1 -1
- package/dist/gateway/static/root/assets/{management-api-CSkXaCjk.js → management-api-BBLUlEXt.js} +1 -1
- package/dist/gateway/static/root/assets/{management-settings-B1Enr-fL.js → management-settings-BjvQ4WiZ.js} +1 -1
- package/dist/gateway/static/root/assets/{markdown-view-CWhAtI1O.js → markdown-view-C7kqotD-.js} +1 -1
- package/dist/gateway/static/root/assets/mcp-conversation-setup-page-DfbMmlmC.js +1 -0
- package/dist/gateway/static/root/assets/{media-plugins-DVrn3x6D.js → media-plugins-B5XMcW5S.js} +1 -1
- package/dist/gateway/static/root/assets/{messages-CZCXd6Pj.js → messages-hlOsXkQ7.js} +2 -2
- package/dist/gateway/static/root/assets/{model-selector-D-9SUwg2.js → model-selector-BP-t33vd.js} +1 -1
- package/dist/gateway/static/root/assets/{models-hub-cache-qgre89p2.js → models-hub-cache-B0z5Ptmt.js} +1 -1
- package/dist/gateway/static/root/assets/{new-chat-navigation-DXYDldT_.js → new-chat-navigation-BA1IB3hy.js} +1 -1
- package/dist/gateway/static/root/assets/{note-detail-panel-4Pd0mAhL.js → note-detail-panel-DAhIT6xP.js} +3 -3
- package/dist/gateway/static/root/assets/note-image-lightbox-DrVGs1eQ.js +1 -0
- package/dist/gateway/static/root/assets/{notes-api-_jYkMe8e.js → notes-api-B3Kc4909.js} +1 -1
- package/dist/gateway/static/root/assets/notes-page-zAJJ2OiQ.js +8 -0
- package/dist/gateway/static/root/assets/{oauth-api-CaWkle-J.js → oauth-api-CW1XhW42.js} +1 -1
- package/dist/gateway/static/root/assets/{oauth-provider-connect-DTsztbWi.js → oauth-provider-connect-3QGibJMl.js} +1 -1
- package/dist/gateway/static/root/assets/{page-context-capture-button-CYMb3IZu.js → page-context-capture-button-Bd__UBi9.js} +1 -1
- package/dist/gateway/static/root/assets/{page-context-draft-D441lgCD.js → page-context-draft-DpDsGHtl.js} +1 -1
- package/dist/gateway/static/root/assets/{page-header-store-7jhoVGK_.js → page-header-store-D_2QZ6Ps.js} +1 -1
- package/dist/gateway/static/root/assets/page-tabs-DoYMKhVO.js +1 -0
- package/dist/gateway/static/root/assets/{personal-avatar-CAATciod.js → personal-avatar-D5VUVQGE.js} +1 -1
- package/dist/gateway/static/root/assets/{personal-page-DCcipmsB.js → personal-page-DHik8uj6.js} +1 -1
- package/dist/gateway/static/root/assets/{personal-profile-settings-CZhQ4fwt.js → personal-profile-settings-Cd2xUVbw.js} +1 -1
- package/dist/gateway/static/root/assets/{personal-settings-panel-CMaFnp1G.js → personal-settings-panel-CHRra9hc.js} +1 -1
- package/dist/gateway/static/root/assets/{phone-dependencies-card-BlFgKeRz.js → phone-dependencies-card-CREmmRxI.js} +1 -1
- package/dist/gateway/static/root/assets/{phone-model-connection-DF_E69Sv.js → phone-model-connection-BDzr9jXL.js} +1 -1
- package/dist/gateway/static/root/assets/{phone-model-picker-D3O3vql4.js → phone-model-picker-DSQF-RxW.js} +1 -1
- package/dist/gateway/static/root/assets/{phone-settings-page-d2OEqR-2.js → phone-settings-page-gP5kr3VO.js} +1 -1
- package/dist/gateway/static/root/assets/{phone-workspace-store-BrXIdz55.js → phone-workspace-store-B0mF8oMk.js} +1 -1
- package/dist/gateway/static/root/assets/{plugin-details-dialog-tpugwKl1.js → plugin-details-dialog-43jCnG5n.js} +1 -1
- package/dist/gateway/static/root/assets/{preference-select-fields-DXMfKUtD.js → preference-select-fields-VqtR_pOy.js} +1 -1
- package/dist/gateway/static/root/assets/{preview-runtime-Bd9e2ent.js → preview-runtime-MJUo7XlD.js} +3 -3
- package/dist/gateway/static/root/assets/{product-automation-feedback-DmdIebRg.js → product-automation-feedback-D43XiQq6.js} +1 -1
- package/dist/gateway/static/root/assets/{product-open-page-DnPJLzt7.js → product-open-page-CQMoDCO1.js} +1 -1
- package/dist/gateway/static/root/assets/{product-preview-content-hChoKYQM.js → product-preview-content-CkQebfi-.js} +1 -1
- package/dist/gateway/static/root/assets/{product-preview-modal-CwAjfaEd.js → product-preview-modal-DToUA1EF.js} +2 -2
- package/dist/gateway/static/root/assets/{project-detail-page-BYZdStns.js → project-detail-page-BBF8eVJa.js} +2 -2
- package/dist/gateway/static/root/assets/{project-understanding-CeZ3CW6E.js → project-understanding-BScfv1pD.js} +1 -1
- package/dist/gateway/static/root/assets/{projects-page-BpARg2mt.js → projects-page-BCMWrLGf.js} +1 -1
- package/dist/gateway/static/root/assets/{providers-api-DjHMmSNk.js → providers-api-BIA2IARN.js} +1 -1
- package/dist/gateway/static/root/assets/{recording-upload-CxcMaBPr.js → recording-upload-Yy9r6kHe.js} +1 -1
- package/dist/gateway/static/root/assets/{registry-api-x3kjVVzC.js → registry-api-CmLu4MA9.js} +1 -1
- package/dist/gateway/static/root/assets/{remote-access-hub-Cuyfg5gz.js → remote-access-hub-BeG8Bgy0.js} +1 -1
- package/dist/gateway/static/root/assets/{resource-unavailable-ClTyW1KO.js → resource-unavailable-Dccp_uis.js} +1 -1
- package/dist/gateway/static/root/assets/{right-workspace-store-BgVMF75g.js → right-workspace-store-CFf15f36.js} +1 -1
- package/dist/gateway/static/root/assets/{route-preload-BPMOD0qt.js → route-preload-Bl10PwKS.js} +2 -2
- package/dist/gateway/static/root/assets/{routine-panel-DqCzH4o9.js → routine-panel-BjqenuXU.js} +2 -2
- package/dist/gateway/static/root/assets/{runtime-tools-api-ZKJq8Y1c.js → runtime-tools-api-CFvov9Uy.js} +1 -1
- package/dist/gateway/static/root/assets/{runtime-tools-settings-panel-CSVS-0w1.js → runtime-tools-settings-panel-C7sHr-Lm.js} +1 -1
- package/dist/gateway/static/root/assets/{service-recommendation-list-Jbg55MsH.js → service-recommendation-list-Bz9QWUZc.js} +1 -1
- package/dist/gateway/static/root/assets/{session-api-JAcSuzXh.js → session-api-7-TPnKv0.js} +1 -1
- package/dist/gateway/static/root/assets/{session-manager-CvC5uo-A.js → session-manager-fvJusKsK.js} +2 -2
- package/dist/gateway/static/root/assets/{sessions-page-itpuSflW.js → sessions-page-DS-OExY1.js} +1 -1
- package/dist/gateway/static/root/assets/settings-advanced-gate-DHfrm0Zj.js +1 -0
- package/dist/gateway/static/root/assets/{settings-advanced-section-C-Rq-g2w.js → settings-advanced-section-BsqgVQL3.js} +1 -1
- package/dist/gateway/static/root/assets/{settings-mode-store-DWWvnHvd.js → settings-mode-store-BtwrUOdQ.js} +1 -1
- package/dist/gateway/static/root/assets/{settings-page-DppkfISC.js → settings-page-B_8kxJQW.js} +1 -1
- package/dist/gateway/static/root/assets/{settings-page-header-BnBbewrE.js → settings-page-header-DKgbD0Bc.js} +1 -1
- package/dist/gateway/static/root/assets/{settings-page-layout-DgRq0a-W.js → settings-page-layout-BE3vLWp_.js} +1 -1
- package/dist/gateway/static/root/assets/{setup-interaction-page-_UOcgWMs.js → setup-interaction-page-DLpGv0yp.js} +1 -1
- package/dist/gateway/static/root/assets/{setup-status-panel-fXdj1EOR.js → setup-status-panel-BMaFUPnt.js} +1 -1
- package/dist/gateway/static/root/assets/{share-link-dialog-BUzVn5kX.js → share-link-dialog-3RNzFIH3.js} +1 -1
- package/dist/gateway/static/root/assets/{share-preview-page-CIdxsC9i.js → share-preview-page-C49EIXte.js} +1 -1
- package/dist/gateway/static/root/assets/{shares-api-DNlL_AwP.js → shares-api-B532SLIU.js} +1 -1
- package/dist/gateway/static/root/assets/{shares-settings-R2H0pdNK.js → shares-settings-C_ITdQqP.js} +1 -1
- package/dist/gateway/static/root/assets/{skill-api-D3iuvyp7.js → skill-api-x-ENFv-9.js} +1 -1
- package/dist/gateway/static/root/assets/{skill-list-api-K8n_AYMV.js → skill-list-api-CqmglPCz.js} +1 -1
- package/dist/gateway/static/root/assets/{skill-reload-api-BqxHK3K0.js → skill-reload-api-YeoxO91w.js} +1 -1
- package/dist/gateway/static/root/assets/{skills-page-BHciTWaw.js → skills-page-B30SsJL6.js} +1 -1
- package/dist/gateway/static/root/assets/space-page-DmvjU1jc.js +2 -0
- package/dist/gateway/static/root/assets/{system-settings-panel-BPyQzKf8.js → system-settings-panel-KXLPpyOW.js} +1 -1
- package/dist/gateway/static/root/assets/{task-detail-page-By5vozgo.js → task-detail-page-DHYm_bsg.js} +3 -3
- package/dist/gateway/static/root/assets/{task-header-title-lUJ0ls3u.js → task-header-title-Buwr7WTV.js} +1 -1
- package/dist/gateway/static/root/assets/{task-result-evidence-CWpAUoNq.js → task-result-evidence-DpV1mZJA.js} +1 -1
- package/dist/gateway/static/root/assets/{terminal-panel-store-D24y7GIK.js → terminal-panel-store-Ch8lOYIq.js} +1 -1
- package/dist/gateway/static/root/assets/{theme-store-VVHRSdNZ.js → theme-store-C7t81hG7.js} +1 -1
- package/dist/gateway/static/root/assets/{tracing-settings-page-D3tu_G8X.js → tracing-settings-page-CcyPoojp.js} +1 -1
- package/dist/gateway/static/root/assets/{tunnel-api-DwTTVUxp.js → tunnel-api-D713CJ9R.js} +1 -1
- package/dist/gateway/static/root/assets/{understanding-activity-store-BOIGCSnz.js → understanding-activity-store-mSawFpIz.js} +1 -1
- package/dist/gateway/static/root/assets/{understanding-refresh-store-mKqdZVjW.js → understanding-refresh-store-4M0xrc88.js} +1 -1
- package/dist/gateway/static/root/assets/{usage-page-B4MqbLKR.js → usage-page-DN1TcxWS.js} +1 -1
- package/dist/gateway/static/root/assets/{use-autosave-BcgfZd3f.js → use-autosave-BkVX6SyB.js} +1 -1
- package/dist/gateway/static/root/assets/{use-composer-attachments-Ca1eE6iV.js → use-composer-attachments-4FKbf6PB.js} +1 -1
- package/dist/gateway/static/root/assets/{use-file-preview-expanded-BwB7VH_A.js → use-file-preview-expanded-CRBn6UTd.js} +1 -1
- package/dist/gateway/static/root/assets/use-generated-media-CEJ5BBxX.js +1 -0
- package/dist/gateway/static/root/assets/{use-personal-profile-BDLuMaWC.js → use-personal-profile-DdjQjf9I.js} +1 -1
- package/dist/gateway/static/root/assets/{use-personal-work-Dfbs6S75.js → use-personal-work-srLCZOam.js} +1 -1
- package/dist/gateway/static/root/assets/{use-realtime-voice-BrM12ktL.js → use-realtime-voice-tyo85cre.js} +1 -1
- package/dist/gateway/static/root/assets/{use-workspace-tree-AL4BVZhS.js → use-workspace-tree-VwHdfiR8.js} +1 -1
- package/dist/gateway/static/root/assets/{user-model-page-CqTB0BIf.js → user-model-page-D-F5GO3T.js} +2 -2
- package/dist/gateway/static/root/assets/{voice-api-key-field-BbVCvQrE.js → voice-api-key-field-gWJ6bx-H.js} +1 -1
- package/dist/gateway/static/root/assets/{voice-config-api-vtmTs-mq.js → voice-config-api-B1RtxiRq.js} +1 -1
- package/dist/gateway/static/root/assets/{voice-input-shortcut-events-BhmaEWvI.js → voice-input-shortcut-events-C-8Ts1gq.js} +1 -1
- package/dist/gateway/static/root/assets/{voice-player-store-IVeW1g9y.js → voice-player-store-DyuAAbk0.js} +1 -1
- package/dist/gateway/static/root/assets/{voice-settings-JJfxv-lj.js → voice-settings-DOajN2ay.js} +1 -1
- package/dist/gateway/static/root/assets/{work-discovery-overlay-Bl2qHC88.js → work-discovery-overlay-CTLp1-tu.js} +1 -1
- package/dist/gateway/static/root/assets/{work-discovery-page-ChvUHm0f.js → work-discovery-page-B-UzFKIr.js} +1 -1
- package/dist/gateway/static/root/assets/{working-directory-picker-modal-BxeoaS6d.js → working-directory-picker-modal-DvVtUxHW.js} +1 -1
- package/dist/gateway/static/root/assets/{workspace-api-D_dxOn8W.js → workspace-api-CIfedJeG.js} +2 -2
- package/dist/gateway/static/root/assets/workspace-editor-agent-store-Bh4FYwVq.js +1 -0
- package/dist/gateway/static/root/assets/{workspace-file-preview-dialog-D0GxWvAv.js → workspace-file-preview-dialog-Xi5feqPq.js} +1 -1
- package/dist/gateway/static/root/assets/{workspace-open-location-menu-CCJISdeq.js → workspace-open-location-menu-sbOva_RI.js} +1 -1
- package/dist/gateway/static/root/assets/{workspace-preview-store-DKZ6gVL4.js → workspace-preview-store-DYd8E5bV.js} +1 -1
- package/dist/gateway/static/root/assets/{xopc-cloud-account-card-Cxt6wEom.js → xopc-cloud-account-card-BYuMOGaK.js} +1 -1
- package/dist/gateway/static/root/index.html +96 -96
- package/dist/package.js +1 -1
- package/dist/packages/gateway-contract/src/files.js +17 -3
- package/dist/packages/gateway-contract/src/home.js +1 -0
- package/dist/src/agent/agent-manager.d.ts +1 -0
- package/dist/src/agent/agent-manager.js +2 -1
- package/dist/src/agent/commands/command-registry.d.ts +1 -1
- package/dist/src/agent/commands/command-registry.js +10 -1
- package/dist/src/agent/embedded/index.js +1 -1
- package/dist/src/agent/embedded/run-for-session.js +1 -1
- package/dist/src/agent/embedded/run-turn.js +3 -2
- package/dist/src/agent/embedded/runs.d.ts +3 -0
- package/dist/src/agent/embedded/runs.js +20 -2
- package/dist/src/agent/embedded/tool-search-extension.js +2 -0
- package/dist/src/agent/embedded/xopc-tools-bridge.js +1 -1
- package/dist/src/agent/external-tools/discovery.js +1 -1
- package/dist/src/agent/external-tools/endpoint-provider.js +1 -1
- package/dist/src/agent/mcp/continuation-guard.js +1 -1
- package/dist/src/agent/mcp/conversation-setup.d.ts +221 -4
- package/dist/src/agent/mcp/conversation-setup.js +66 -27
- package/dist/src/agent/mcp/discovery.d.ts +5 -0
- package/dist/src/agent/mcp/discovery.js +47 -6
- package/dist/src/agent/prompt/conversational-configuration-guide.js +3 -2
- package/dist/src/agent/prompt/sections/tooling.js +1 -1
- package/dist/src/agent/service.js +1 -0
- package/dist/src/agent/service.types.d.ts +1 -0
- package/dist/src/agent/tool-manuals/browser.d.ts +1 -1
- package/dist/src/agent/tool-manuals/browser.js +3 -1
- package/dist/src/agent/tool-manuals/xopc-configuration.d.ts +2 -2
- package/dist/src/agent/tool-manuals/xopc-configuration.js +10 -9
- package/dist/src/agent/tools/browser/tool/browser-use-tool.js +1 -1
- package/dist/src/agent/tools/capability-catalog-tool.d.ts +10 -0
- package/dist/src/agent/tools/capability-catalog-tool.js +63 -0
- package/dist/src/agent/tools/exec-command.d.ts +1 -0
- package/dist/src/agent/tools/exec-command.js +11 -5
- package/dist/src/agent/tools/factory.d.ts +1 -0
- package/dist/src/agent/tools/factory.js +32 -1
- package/dist/src/agent/tools/language-diagnostics.js +4 -1
- package/dist/src/agent/tools/managed-job-tool.js +3 -2
- package/dist/src/agent/tools/mcp-setup-tool.js +2 -2
- package/dist/src/agent/tools/phone-use-tool.js +1 -1
- package/dist/src/agent/tools/xopc-use-tool.d.ts +2 -0
- package/dist/src/agent/tools/xopc-use-tool.js +5 -3
- package/dist/src/agent-config/schema.d.ts +3 -0
- package/dist/src/agent-config/schema.js +1 -0
- package/dist/src/automations/api/routes.js +17 -5
- package/dist/src/automations/capabilities/write.js +32 -4
- package/dist/src/automations/configuration-conversation.d.ts +7 -0
- package/dist/src/automations/configuration-conversation.js +13 -5
- package/dist/src/capabilities/capability-catalog.d.ts +47 -0
- package/dist/src/capabilities/capability-catalog.js +162 -0
- package/dist/src/capabilities/runtime/product.js +1 -1
- package/dist/src/capabilities/store-connector.d.ts +1 -0
- package/dist/src/capabilities/store-connector.js +6 -3
- package/dist/src/chat-commands/builtins/config.js +1 -1
- package/dist/src/chat-commands/context.js +1 -1
- package/dist/src/cli/commands/agent.js +1 -1
- package/dist/src/cli/commands/doctor/checks/channel-plugins.js +1 -1
- package/dist/src/cli/commands/doctor/checks/database-schema.js +5 -5
- package/dist/src/cli/commands/extension-dev.js +1 -1
- package/dist/src/cli/commands/extension-marketplace.js +1 -1
- package/dist/src/cli/commands/extension.js +1 -1
- package/dist/src/cli/commands/onboard/channels/registry.js +1 -1
- package/dist/src/cli/commands/platform.js +2 -2
- package/dist/src/cli/commands/skills.js +1 -1
- package/dist/src/cli/extension-cli-register.js +1 -1
- package/dist/src/cli/utils/session.js +1 -1
- package/dist/src/config/index.js +1 -1
- package/dist/src/config/schema.d.ts +2 -0
- package/dist/src/config/schema.js +6 -3
- package/dist/src/extensions/index.js +2 -2
- package/dist/src/extensions/loader.js +1 -1
- package/dist/src/extensions/update.js +1 -1
- package/dist/src/files/file-service.js +1 -0
- package/dist/src/files/file-versions.d.ts +15 -0
- package/dist/src/files/file-versions.js +87 -0
- package/dist/src/gateway/agent-reactions/reaction.d.ts +27 -0
- package/dist/src/gateway/agent-reactions/reaction.js +186 -0
- package/dist/src/gateway/hono/routes/auth-registry-extensions.js +1 -1
- package/dist/src/gateway/hono/routes/capabilities.js +27 -0
- package/dist/src/gateway/hono/routes/connectors.js +1 -1
- package/dist/src/gateway/hono/routes/files.js +39 -0
- package/dist/src/gateway/hono/routes/home.js +1 -1
- package/dist/src/gateway/hono/routes/mobile-capability-actions.d.ts +4 -0
- package/dist/src/gateway/hono/routes/mobile-capability-actions.js +290 -0
- package/dist/src/gateway/hono/routes/music-generation.js +1 -0
- package/dist/src/gateway/hono/routes/personal-agent.js +23 -43
- package/dist/src/gateway/hono/routes/sessions.js +41 -2
- package/dist/src/gateway/security/gateway-principal.d.ts +1 -0
- package/dist/src/gateway/security/gateway-principal.js +9 -1
- package/dist/src/gateway/security/gateway-scopes.js +3 -0
- package/dist/src/gateway/service/agent-runner.d.ts +2 -0
- package/dist/src/gateway/service/agent-runner.js +5 -1
- package/dist/src/gateway/service/config-coordinator.d.ts +1 -0
- package/dist/src/gateway/service/config-coordinator.js +1 -1
- package/dist/src/gateway/service/run-gateway-agent.d.ts +3 -0
- package/dist/src/gateway/service/run-gateway-agent.js +43 -1
- package/dist/src/gateway/service/task-conversation-query-service.d.ts +4 -0
- package/dist/src/gateway/service.js +20 -11
- package/dist/src/home-intelligence/host.js +5 -5
- package/dist/src/personal-agent/repository.d.ts +1 -0
- package/dist/src/personal-agent/repository.js +1 -0
- package/dist/src/personal-agent/schedules.d.ts +9 -1
- package/dist/src/personal-agent/schedules.js +32 -1
- package/dist/src/personal-agent/service.d.ts +2 -2
- package/dist/src/personal-agent/service.js +6 -3
- package/dist/src/projects/index.js +1 -1
- package/dist/src/providers/model-call.js +1 -0
- package/dist/src/realtime/runtime.js +1 -0
- package/dist/src/session/client-history.d.ts +1 -0
- package/dist/src/session/client-history.js +2 -0
- package/dist/src/session/types.d.ts +4 -0
- package/dist/src/storage/sqlite/agent-reaction-repository.d.ts +15 -0
- package/dist/src/storage/sqlite/agent-reaction-repository.js +73 -0
- package/dist/src/storage/sqlite/row-mappers.js +1 -1
- package/dist/src/storage/sqlite/schema.d.ts +2 -2
- package/dist/src/storage/sqlite/schema.js +7 -7
- package/dist/src/storage/sqlite/schema.sql +13 -0
- package/dist/src/storage/sqlite/upgrades/281_session_agent_reactions.sql +13 -0
- package/dist/src/tasks/home-query-service.js +1 -0
- package/dist/src/tui/backends/embedded-backend.js +5 -4
- package/dist/src/tui/extension-host/load-extensions.js +1 -1
- package/dist/src/tui/tui-commands.js +1 -1
- package/dist/src/tui/tui-management.js +1 -1
- package/dist/src/tui/tui.js +1 -1
- package/dist/src/usage/recorder.js +6 -2
- package/dist/src/usage/types.d.ts +1 -0
- package/package.json +1 -1
- package/dist/gateway/static/root/assets/capabilities-DG-WesBp.js +0 -1
- package/dist/gateway/static/root/assets/chat-page-DO060oe9.js +0 -72
- package/dist/gateway/static/root/assets/files-BNL4kkSB.js +0 -1
- package/dist/gateway/static/root/assets/gateway-realtime-store-D_ZITqDi.js +0 -1
- package/dist/gateway/static/root/assets/index-Ca939klV.js +0 -11
- package/dist/gateway/static/root/assets/index-DrWdNdP4.css +0 -1
- package/dist/gateway/static/root/assets/mcp-conversation-setup-page-lOOFtIXe.js +0 -1
- package/dist/gateway/static/root/assets/note-image-lightbox-C1w4X0T6.js +0 -1
- package/dist/gateway/static/root/assets/notes-page-strWZLkP.js +0 -8
- package/dist/gateway/static/root/assets/page-tabs-oeTY7z3_.js +0 -1
- package/dist/gateway/static/root/assets/settings-advanced-gate-BEDT8_0u.js +0 -1
- package/dist/gateway/static/root/assets/space-api-C302hvkG.js +0 -1
- package/dist/gateway/static/root/assets/space-page-sfc82o9O.js +0 -2
- package/dist/gateway/static/root/assets/workspace-editor-agent-store-D5wq8Kme.js +0 -1
|
@@ -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-
|
|
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-B4o4aDCg.js";import{t as a}from"./calendar-days-hw_Y-g-s.js";import{t as ee}from"./chevron-left-DqFhpbvK.js";import{t as te}from"./chevron-right-BweFrslA.js";import{c as ne,l as re,u as ie}from"./popover-select-CLsphyzA.js";import{t as ae}from"./cn-0WouolD0.js";import{c as oe,n as se,s as ce}from"./dist-GJ8-1PAx.js";var o=e(t(),1),le=n();function s(e){return String(e).padStart(2,`0`)}function ue(e){return`${e.getFullYear()}-${s(e.getMonth()+1)}-${s(e.getDate())}`}function de(e){let t=/^(\d{4})-(\d{2})-(\d{2})$/.exec(e);if(!t)return null;let n=Number(t[1]),r=Number(t[2])-1,i=Number(t[3]),a=new Date(n,r,i,12);return a.getFullYear()===n&&a.getMonth()===r&&a.getDate()===i?a:null}function fe(e,t){let n=de(e);return n?t===`zh`?`${n.getFullYear()}/${s(n.getMonth()+1)}/${s(n.getDate())}`:new Intl.DateTimeFormat(`en`,{year:`numeric`,month:`short`,day:`numeric`}).format(n):``}var c=r();function pe(e,t){let n=new Date(e.getFullYear(),e.getMonth(),1,12),r=(n.getDay()-t+7)%7;return Array.from({length:42},(e,t)=>new Date(n.getFullYear(),n.getMonth(),1-r+t,12))}function l(e){let t=(0,le.c)(106),{value:n,onChange:r,disabled:s,className:l,ariaLabel:ve,placeholder:ye,min:u,max:d}=e,f=i(_e),p=f===`zh`?`zh-CN`:`en`,be;t[0]===n?be=t[1]:(be=de(n),t[0]=n,t[1]=be);let m=be,[h,xe]=(0,o.useState)(!1),[Se,Ce]=(0,o.useState)(null),g;t[2]===m?g=t[3]:(g=()=>m??new Date,t[2]=m,t[3]=g);let[_,we]=(0,o.useState)(g),Te=ne(Se),Ee=ie(re(),Te!==null),v=+(f===`zh`),y,b;t[4]!==h||t[5]!==n?(y=()=>{if(!h)return;let e=de(n);e&&we(e)},b=[h,n],t[4]=h,t[5]=n,t[6]=y,t[7]=b):(y=t[6],b=t[7]),(0,o.useEffect)(y,b);let x;t[8]!==_||t[9]!==v?(x=pe(_,v),t[8]=_,t[9]=v,t[10]=x):x=t[10];let De=x,S;if(t[11]!==p||t[12]!==v){let e=new Date(2026,7,23,12);S=Array.from({length:7},(t,n)=>{let r=new Date(e);return r.setDate(e.getDate()+v+n),new Intl.DateTimeFormat(p,{weekday:`narrow`}).format(r)}),t[11]=p,t[12]=v,t[13]=S}else S=t[13];let Oe=S,C;t[14]===Symbol.for(`react.memo_cache_sentinel`)?(C=ue(new Date),t[14]=C):C=t[14];let w=C,T;t[15]===m?T=t[16]:(T=m?ue(m):``,t[15]=m,t[16]=T);let E=T,D;t[17]!==p||t[18]!==_?(D=new Intl.DateTimeFormat(p,{year:`numeric`,month:`long`}).format(_),t[17]=p,t[18]=_,t[19]=D):D=t[19];let ke=D,O;t[20]===r?O=t[21]:(O=e=>{r(e),xe(!1)},t[20]=r,t[21]=O);let k=O,Ae=oe,je=s&&`cursor-not-allowed opacity-50`,A;t[22]!==l||t[23]!==je?(A=ae(`flex h-10 w-full min-w-0 items-center justify-between gap-3 rounded-lg bg-surface-hover px-3 text-left text-sm text-fg outline-none transition-colors`,`hover:bg-surface-active focus-visible:ring-2 focus-visible:ring-accent/40`,je,l),t[22]=l,t[23]=je,t[24]=A):A=t[24];let Me=!n&&`text-fg-subtle`,j;t[25]===Me?j=t[26]:(j=ae(`min-w-0 truncate tabular-nums`,Me),t[25]=Me,t[26]=j);let M;t[27]!==f||t[28]!==ye||t[29]!==n?(M=fe(n,f)||ye||(f===`zh`?`选择日期`:`Select date`),t[27]=f,t[28]=ye,t[29]=n,t[30]=M):M=t[30];let N;t[31]!==j||t[32]!==M?(N=(0,c.jsx)(`span`,{className:j,children:M}),t[31]=j,t[32]=M,t[33]=N):N=t[33];let P;t[34]===Symbol.for(`react.memo_cache_sentinel`)?(P=(0,c.jsx)(a,{className:`size-4 shrink-0 text-fg-muted`,"aria-hidden":!0}),t[34]=P):P=t[34];let F;t[35]!==ve||t[36]!==s||t[37]!==A||t[38]!==N?(F=(0,c.jsx)(ce,{asChild:!0,children:(0,c.jsxs)(`button`,{ref:Ce,type:`button`,disabled:s,"aria-label":ve,className:A,children:[N,P]})}),t[35]=ve,t[36]=s,t[37]=A,t[38]=N,t[39]=F):F=t[39];let Ne=oe,Pe=Te??void 0,Fe=oe,Ie=Te??void 0,Le=ae(Ee,`max-h-[var(--radix-popover-content-available-height)] w-[19rem] max-w-[var(--radix-popover-content-available-width)] overflow-y-auto rounded-2xl border border-edge bg-surface-overlay p-3 shadow-float outline-none`),Re=f===`zh`?`上个月`:`Previous month`,I,L;t[40]===Symbol.for(`react.memo_cache_sentinel`)?(I=()=>we(ge),L=(0,c.jsx)(ee,{className:`size-4`,"aria-hidden":!0}),t[40]=I,t[41]=L):(I=t[40],L=t[41]);let R;t[42]===Re?R=t[43]:(R=(0,c.jsx)(`button`,{type:`button`,className:`flex size-8 items-center justify-center rounded-lg text-fg-muted hover:bg-surface-hover hover:text-fg focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40`,"aria-label":Re,onClick:I,children:L}),t[42]=Re,t[43]=R);let z;t[44]===ke?z=t[45]:(z=(0,c.jsx)(`div`,{className:`text-sm font-semibold text-fg`,children:ke}),t[44]=ke,t[45]=z);let ze=f===`zh`?`下个月`:`Next month`,B,V;t[46]===Symbol.for(`react.memo_cache_sentinel`)?(B=()=>we(he),V=(0,c.jsx)(te,{className:`size-4`,"aria-hidden":!0}),t[46]=B,t[47]=V):(B=t[46],V=t[47]);let H;t[48]===ze?H=t[49]:(H=(0,c.jsx)(`button`,{type:`button`,className:`flex size-8 items-center justify-center rounded-lg text-fg-muted hover:bg-surface-hover hover:text-fg focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40`,"aria-label":ze,onClick:B,children:V}),t[48]=ze,t[49]=H);let U;t[50]!==R||t[51]!==z||t[52]!==H?(U=(0,c.jsxs)(`div`,{className:`flex h-10 items-center justify-between gap-2 px-1`,children:[R,z,H]}),t[50]=R,t[51]=z,t[52]=H,t[53]=U):U=t[53];let W;t[54]===Oe?W=t[55]:(W=(0,c.jsx)(`div`,{className:`mt-2 grid grid-cols-7`,"aria-hidden":!0,children:Oe.map(me)}),t[54]=Oe,t[55]=W);let G;if(t[56]!==De||t[57]!==p||t[58]!==d||t[59]!==u||t[60]!==k||t[61]!==E||t[62]!==_){let e;t[64]!==p||t[65]!==d||t[66]!==u||t[67]!==k||t[68]!==E||t[69]!==_?(e=e=>{let t=ue(e),n=t===E,r=t===w,i=e.getMonth()!==_.getMonth(),a=!!(u&&t<u||d&&t>d);return(0,c.jsx)(`button`,{type:`button`,role:`gridcell`,"aria-selected":n,"aria-disabled":a,disabled:a,"aria-label":new Intl.DateTimeFormat(p,{dateStyle:`full`}).format(e),className:ae(`mx-auto flex h-9 w-full max-w-9 items-center justify-center rounded-xl text-sm tabular-nums text-fg transition-colors`,`hover:bg-surface-hover focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40`,i&&`text-fg-disabled`,a&&`cursor-not-allowed opacity-35 hover:bg-transparent`,r&&!n&&`bg-accent-soft font-semibold text-accent-fg`,n&&`bg-accent font-semibold text-on-accent hover:bg-accent-hover`),onClick:()=>k(t),children:e.getDate()},t)},t[64]=p,t[65]=d,t[66]=u,t[67]=k,t[68]=E,t[69]=_,t[70]=e):e=t[70],G=De.map(e),t[56]=De,t[57]=p,t[58]=d,t[59]=u,t[60]=k,t[61]=E,t[62]=_,t[63]=G}else G=t[63];let K;t[71]===G?K=t[72]:(K=(0,c.jsx)(`div`,{className:`grid grid-cols-7 gap-y-1`,role:`grid`,children:G}),t[71]=G,t[72]=K);let Be=!n,q;t[73]===k?q=t[74]:(q=()=>k(``),t[73]=k,t[74]=q);let Ve=f===`zh`?`清除`:`Clear`,J;t[75]!==Be||t[76]!==q||t[77]!==Ve?(J=(0,c.jsx)(`button`,{type:`button`,disabled:Be,className:`rounded-lg px-2.5 py-1.5 text-xs font-medium text-fg-muted hover:bg-surface-hover hover:text-fg disabled:pointer-events-none disabled:opacity-35`,onClick:q,children:Ve}),t[75]=Be,t[76]=q,t[77]=Ve,t[78]=J):J=t[78];let He=!!(u&&w<u||d&&w>d),Y;t[79]===k?Y=t[80]:(Y=()=>k(w),t[79]=k,t[80]=Y);let Ue=f===`zh`?`今天`:`Today`,X;t[81]!==He||t[82]!==Y||t[83]!==Ue?(X=(0,c.jsx)(`button`,{type:`button`,disabled:He,className:`rounded-lg bg-accent-soft px-2.5 py-1.5 text-xs font-medium text-accent-fg hover:bg-accent-soft/80 disabled:pointer-events-none disabled:opacity-35`,onClick:Y,children:Ue}),t[81]=He,t[82]=Y,t[83]=Ue,t[84]=X):X=t[84];let Z;t[85]!==J||t[86]!==X?(Z=(0,c.jsxs)(`div`,{className:`mt-2 flex items-center justify-between px-1 pt-1`,children:[J,X]}),t[85]=J,t[86]=X,t[87]=Z):Z=t[87];let We;t[88]===Symbol.for(`react.memo_cache_sentinel`)?(We=(0,c.jsx)(se,{className:`fill-surface-overlay`}),t[88]=We):We=t[88];let Q;t[89]!==Fe.Content||t[90]!==Ie||t[91]!==Le||t[92]!==U||t[93]!==W||t[94]!==K||t[95]!==Z?(Q=(0,c.jsxs)(Fe.Content,{align:`start`,sideOffset:6,collisionPadding:12,collisionBoundary:Ie,className:Le,children:[U,W,K,Z,We]}),t[89]=Fe.Content,t[90]=Ie,t[91]=Le,t[92]=U,t[93]=W,t[94]=K,t[95]=Z,t[96]=Q):Q=t[96];let $;t[97]!==Ne.Portal||t[98]!==Pe||t[99]!==Q?($=(0,c.jsx)(Ne.Portal,{container:Pe,children:Q}),t[97]=Ne.Portal,t[98]=Pe,t[99]=Q,t[100]=$):$=t[100];let Ge;return t[101]!==h||t[102]!==Ae.Root||t[103]!==F||t[104]!==$?(Ge=(0,c.jsxs)(Ae.Root,{open:h,onOpenChange:xe,children:[F,$]}),t[101]=h,t[102]=Ae.Root,t[103]=F,t[104]=$,t[105]=Ge):Ge=t[105],Ge}function me(e,t){return(0,c.jsx)(`div`,{className:`flex h-8 items-center justify-center text-[11px] font-medium text-fg-subtle`,children:e},`${e}-${t}`)}function he(e){return new Date(e.getFullYear(),e.getMonth()+1,1,12)}function ge(e){return new Date(e.getFullYear(),e.getMonth()-1,1,12)}function _e(e){return e.language}export{l 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-
|
|
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-B4o4aDCg.js";import{t as a}from"./cn-0WouolD0.js";import{t as o}from"./date-picker-DgTDENzF.js";import{t as s}from"./time-picker-C1PXAXZF.js";var c=n(),l=e(t(),1),u=r();function d(e){let t=(0,c.c)(33),{label:n,value:r,onChange:d,defaultTime:p,disabled:m,className:h}=e,g=(0,l.useId)(),_=i(f)===`zh`,v,y;if(t[0]!==r){let[e,n]=r.split(`T`);v=e,y=n?.slice(0,5),t[0]=r,t[1]=v,t[2]=y}else v=t[1],y=t[2];let b=y,x;t[3]===h?x=t[4]:(x=a(`grid min-w-0 gap-2 text-sm text-fg`,h),t[3]=h,t[4]=x);let S;t[5]!==n||t[6]!==g?(S=(0,u.jsx)(`span`,{id:g,children:n}),t[5]=n,t[6]=g,t[7]=S):S=t[7];let C=`${n} · ${_?`日期`:`Date`}`,w;t[8]!==p||t[9]!==d||t[10]!==b?(w=e=>d(e?`${e}T${b||p}`:``),t[8]=p,t[9]=d,t[10]=b,t[11]=w):w=t[11];let T;t[12]!==v||t[13]!==m||t[14]!==C||t[15]!==w?(T=(0,u.jsx)(o,{ariaLabel:C,disabled:m,value:v,className:`border border-edge bg-surface-panel hover:bg-surface-hover`,onChange:w}),t[12]=v,t[13]=m,t[14]=C,t[15]=w,t[16]=T):T=t[16];let E=`${n} · ${_?`时间`:`Time`}`,D=m||!v,O=b??``,k;t[17]!==v||t[18]!==d?(k=e=>d(`${v}T${e}`),t[17]=v,t[18]=d,t[19]=k):k=t[19];let A;t[20]!==k||t[21]!==E||t[22]!==D||t[23]!==O?(A=(0,u.jsx)(s,{ariaLabel:E,disabled:D,value:O,onChange:k}),t[20]=k,t[21]=E,t[22]=D,t[23]=O,t[24]=A):A=t[24];let j;t[25]!==A||t[26]!==T?(j=(0,u.jsxs)(`div`,{className:`grid min-w-0 grid-cols-[minmax(0,1fr)_minmax(5.5rem,0.6fr)] gap-2`,children:[T,A]}),t[25]=A,t[26]=T,t[27]=j):j=t[27];let M;return t[28]!==g||t[29]!==j||t[30]!==x||t[31]!==S?(M=(0,u.jsxs)(`div`,{role:`group`,"aria-labelledby":g,className:x,children:[S,j]}),t[28]=g,t[29]=j,t[30]=x,t[31]=S,t[32]=M):M=t[32],M}function f(e){return e.language}export{d as t};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{a as t,n,t as r}from"./vendor-react-BOUWij0V.js";import{t as i}from"./chunk-KS7C4IRE-
|
|
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-BPb7KheU.js";import{t as a}from"./check-DUBLcKHA.js";import{t as o}from"./chevron-down-ccbiQQz_.js";import{t as s}from"./link-2-D_ZKYUW7.js";import{t as c}from"./search-DA7gz22f.js";import{t as l}from"./x-B_N4OPjy.js";import{t as u}from"./cn-0WouolD0.js";import{t as d}from"./button-ChmVQg9O.js";import{a as f,i as p,o as m,r as h,s as g}from"./copy-text-row-BnSoJ0FX.js";var _=n(),v=e(t(),1),y=r(),b=`!z-[10000] max-w-[min(28rem,90vw)] rounded-md border border-edge bg-surface-overlay px-2.5 py-2 text-left text-xs leading-relaxed text-fg shadow-lg`;function x(e){let t=(0,_.c)(31),{candidates:n,selectedIds:r,labels:x,disabled:C,borderless:w,getTaskHref:T,onChange:E}=e,D=w!==void 0&&w,[O,k]=(0,v.useState)(!1),[A,j]=(0,v.useState)(``),M;t[0]===A?M=t[1]:(M=A.trim().toLocaleLowerCase(),t[0]=A,t[1]=M);let N=M,P;if(t[2]!==n||t[3]!==N){let e;t[5]===N?e=t[6]:(e=e=>!N||e.title.toLocaleLowerCase().includes(N),t[5]=N,t[6]=e),P=n.filter(e).slice(0,20),t[2]=n,t[3]=N,t[4]=P}else P=t[4];let F=P,I;t[7]!==n||t[8]!==C||t[9]!==T||t[10]!==x.remove||t[11]!==E||t[12]!==r?(I=r.length>0?(0,y.jsx)(`div`,{className:`flex min-w-0 flex-wrap gap-2`,children:r.map(e=>{let t=n.find(t=>t.id===e);return t?(0,y.jsxs)(`span`,{className:`inline-flex min-w-0 max-w-full items-center gap-1.5 rounded-lg bg-surface-hover px-2.5 py-1.5 text-xs text-fg-muted`,children:[(0,y.jsxs)(m,{children:[(0,y.jsx)(g,{asChild:!0,children:T?(0,y.jsx)(i,{to:T(t.id),className:`min-w-0 whitespace-normal break-words [overflow-wrap:anywhere] rounded-sm outline-none transition-colors hover:text-fg hover:underline focus-visible:ring-2 focus-visible:ring-accent/50`,children:t.title}):(0,y.jsx)(`span`,{className:`min-w-0 whitespace-normal break-words [overflow-wrap:anywhere]`,children:t.title})}),(0,y.jsx)(p,{children:(0,y.jsx)(h,{side:`top`,sideOffset:6,collisionPadding:12,className:b,children:(0,y.jsx)(`span`,{className:`break-words`,children:t.title})})})]}),(0,y.jsx)(`button`,{type:`button`,className:`shrink-0 rounded text-fg-subtle transition-colors hover:text-fg`,"aria-label":x.remove.replace(`{{task}}`,t.title),disabled:C,onClick:()=>E(r.filter(e=>e!==t.id)),children:(0,y.jsx)(l,{className:`size-3.5`,"aria-hidden":!0})})]},t.id):null})}):null,t[7]=n,t[8]=C,t[9]=T,t[10]=x.remove,t[11]=E,t[12]=r,t[13]=I):I=t[13];let L;t[14]!==D||t[15]!==n.length||t[16]!==C||t[17]!==x.link||t[18]!==x.linked||t[19]!==x.noCandidates||t[20]!==x.noMatches||t[21]!==x.searchPlaceholder||t[22]!==F||t[23]!==E||t[24]!==O||t[25]!==A||t[26]!==r?(L=n.length>0?(0,y.jsxs)(y.Fragment,{children:[(0,y.jsxs)(d,{type:`button`,variant:`secondary`,className:u(`w-fit rounded-lg`,D&&`border-0 bg-surface-hover shadow-none`),disabled:C,"aria-expanded":O,onClick:()=>k(S),children:[(0,y.jsx)(s,{className:`size-4`,"aria-hidden":!0}),r.length>0?x.linked.replace(`{{count}}`,String(r.length)):x.link,(0,y.jsx)(o,{className:u(`size-3.5 transition-transform`,O&&`rotate-180`),"aria-hidden":!0})]}),O?(0,y.jsxs)(`div`,{className:u(`grid gap-2 rounded-lg p-2`,D?`bg-surface-hover`:`border border-edge bg-surface-base`),children:[(0,y.jsxs)(`label`,{className:`relative block`,children:[(0,y.jsx)(c,{className:`pointer-events-none absolute left-2.5 top-1/2 size-4 -translate-y-1/2 text-fg-subtle`,"aria-hidden":!0}),(0,y.jsx)(`input`,{value:A,onChange:e=>j(e.target.value),placeholder:x.searchPlaceholder,className:u(`h-9 w-full rounded-md bg-surface-panel pl-8 pr-3 text-sm text-fg outline-none placeholder:text-fg-subtle`,D?`focus:ring-2 focus:ring-accent/30`:`border border-edge focus:border-accent`),autoFocus:!0})]}),F.length>0?(0,y.jsx)(`div`,{className:`grid max-h-52 gap-1 overflow-y-auto`,children:F.map(e=>{let t=r.includes(e.id);return(0,y.jsxs)(`button`,{type:`button`,"aria-pressed":t,disabled:C,onClick:()=>E(t?r.filter(t=>t!==e.id):[...r,e.id]),className:u(`flex items-center gap-2 rounded-md px-2.5 py-2 text-left text-sm transition-colors`,t?`bg-accent-soft text-accent-fg`:`text-fg hover:bg-surface-hover`),children:[(0,y.jsx)(`span`,{className:u(`flex size-4 shrink-0 items-center justify-center rounded`,D?t?`bg-accent text-on-accent`:`bg-surface-active`:t?`border border-accent bg-accent text-on-accent`:`border border-edge`),children:t?(0,y.jsx)(a,{className:`size-3`,"aria-hidden":!0}):null}),(0,y.jsx)(`span`,{className:`min-w-0 flex-1 whitespace-normal break-words [overflow-wrap:anywhere]`,children:e.title})]},e.id)})}):(0,y.jsx)(`p`,{className:`px-2 py-3 text-center text-sm text-fg-subtle`,children:x.noMatches})]}):null]}):(0,y.jsx)(`p`,{className:`text-sm text-fg-subtle`,children:x.noCandidates}),t[14]=D,t[15]=n.length,t[16]=C,t[17]=x.link,t[18]=x.linked,t[19]=x.noCandidates,t[20]=x.noMatches,t[21]=x.searchPlaceholder,t[22]=F,t[23]=E,t[24]=O,t[25]=A,t[26]=r,t[27]=L):L=t[27];let R;return t[28]!==I||t[29]!==L?(R=(0,y.jsx)(f,{delayDuration:300,children:(0,y.jsxs)(`div`,{className:`min-w-0 grid gap-2`,children:[I,L]})}),t[28]=I,t[29]=L,t[30]=R):R=t[30],R}function S(e){return!e}export{x 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-CnHhWsDP.js";import{t as a}from"./messages-CZCXd6Pj.js";import{t as o}from"./resource-unavailable-ClTyW1KO.js";import{t as s}from"./chevron-down-ccbiQQz_.js";import{t as c}from"./x-B_N4OPjy.js";import{t as l}from"./desktop-pet-narrative-Tlfyn0jb.js";import{t as u}from"./desktop-pet-sprite-D5YYq2zC.js";var d=e(t(),1),f=n(),p=9e4,m=3e4,h=20*6e4,g=45e3,_=45*6e4,v=58;function y(e,t){return e.state===`running`&&t-(e.startedAt??e.timestamp)>=p}function b(e,t){return e.state===`running`&&t-e.timestamp>=m}function x(e,t,n){if(e.progress){let t=`${e.progress.completed}/${e.progress.total}`;return e.action.includes(t)?``:` · ${t}`}return e.detail&&!e.action.includes(e.detail)?n.replace(/\{\{detail\}\}/g,e.detail):e.state===`running`?` · ${Math.max(1,Math.floor((t-e.timestamp)/1e3))}s`:``}function S(e,t){if(e.state!==`success`||!e.publicSummary)return;let n=e.publicSummary.replace(/\s+/g,` `).trim(),r=n.length>v?`${n.slice(0,v-1)}…`:n;return t.replace(/\{\{summary\}\}/g,r)}function C(e,t,n){if(b(e,t))return n.stale;if(y(e,t))return n.longRunning}function w(e,t){let n=e.feedback?.reassurance;return n?t[n]:void 0}function ee(e){let t=e.now-e.lastActivityAt,n=t>=h?(t-h)%_:1/0;return e.bubbleEnabled&&e.behaviorMode!==`focus`&&e.proactiveTipsEnabled&&(!e.remindersPausedUntil||e.now>=e.remindersPausedUntil)&&!e.collapsed&&e.queuedCount===0&&e.activeCount===0&&n<=g&&e.now>=e.dismissedUntil}function T(e,t,n){return e.state===`waiting`||e.state===`error`?`action_required`:e.state===`success`?t===`focus`?`ambient`:`notice`:b(e,n)||t===`playful`||t===`companion`&&y(e,n)?`notice`:`ambient`}function E(e,t,n,r){let i=T(e,t,n);return i===`action_required`?!0:r&&n<r?!1:i===`notice`}var D=8e3;function O(e,t){let n=e?.runId===t.runId,r=t.feedback?.sensitivity===`private`;return{...n?e:void 0,...t,startedAt:n?e.startedAt??e.timestamp:t.timestamp,publicSummary:r?void 0:t.publicSummary??(n?e.publicSummary:void 0),feedback:t.feedback??(n?e.feedback:void 0),expiresAt:t.state===`success`?t.timestamp+D:void 0}}function k(e,t){let n={...e};for(let e of t){let t=n[e.conversationId];t?.runId===e.runId&&e.sequence<=t.sequence||(n[e.conversationId]=O(t,e))}return n}function A(e,t){return t?.runId===e.runId&&t.state===e.state}function j(e,t){let n={error:0,waiting:1,running:2,success:3};return e.filter(e=>!e.expiresAt||e.expiresAt>t).sort((e,t)=>n[e.state]-n[t.state]||t.timestamp-e.timestamp).slice(0,3)}function M(e){return e?`/chat/${e.conversationId}`:void 0}var N=r();function P(e){return e?e.state===`error`?`concern`:e.state===`success`?`success`:e.animation??l(e.phase):`idle`}function F(e,t){if(!e?.length)return;let n=t.sequence;for(let e of`${t.conversationId}:${t.runId}`)n=n*31+e.charCodeAt(0)>>>0;return e[n%e.length]}function I(e,t,n){let r=e.persona?.phrases??n;if(t.state===`success`)return F(r?.success,t);if(t.state===`waiting`)return F(r?.waiting,t);if(t.state===`error`)return F(r?.error,t)}function L(e,t,n){return e?n?`${e} · ${t}`:e:t}function R(e,t){let n=e.feedback?.nextAction?.type;if(n===`confirm`)return t.needsInput;if(n===`review_error`)return t.reviewIssue;if(n===`open_session`)return t.open;if(e.state===`waiting`)return t.needsInput;if(e.state===`error`)return t.reviewIssue;if(e.state===`success`)return t.open}function z(){let e=Date.now();return{prefs:{enabled:!0,showOnStartup:!1,selectedPetId:`loopi`,alwaysOnTop:!0,bubbleEnabled:!0,clickThroughWhenIdle:!1,muted:!1,behaviorMode:`companion`,proactiveTipsEnabled:!0,interactionEnabled:!0,reducedMotion:!1,sizePercent:100,collapsed:!1},relationship:{firstMetAt:e,lastSeenAt:e,completedTaskCount:0,unlockedReactions:[],recentCompletedRunIds:[]},pets:[],visible:!0,customPetsDir:``,petIssues:[],activities:[]}}function B(){let e=a(i(e=>e.language)).desktopPet,[t,n]=(0,d.useState)(z),[r,o]=(0,d.useState)({}),[l,f]=(0,d.useState)({}),[p,m]=(0,d.useState)(Date.now()),[h,g]=(0,d.useState)(()=>Date.now()),[v,y]=(0,d.useState)(0),[b,T]=(0,d.useState)(null),D=(0,d.useRef)(null),O=(0,d.useRef)(!1),B=(0,d.useRef)(null),V=(0,d.useRef)(null),H=(0,d.useRef)(null),U=(0,d.useMemo)(()=>t.pets.find(e=>e.id===t.prefs.selectedPetId)??t.pets[0],[t]),W=Math.min(1.4,Math.max(.7,t.prefs.sizePercent/100)),G=(0,d.useMemo)(()=>j(Object.values(r),p),[r,p]),K=(0,d.useMemo)(()=>t.prefs.bubbleEnabled?G.filter(e=>!A(e,l[e.conversationId])&&E(e,t.prefs.behaviorMode,p,t.prefs.remindersPausedUntil)):[],[G,l,p,t.prefs.behaviorMode,t.prefs.bubbleEnabled,t.prefs.remindersPausedUntil]),q=(0,d.useMemo)(()=>t.prefs.bubbleEnabled?G.filter(e=>A(e,l[e.conversationId])&&E(e,t.prefs.behaviorMode,p,t.prefs.remindersPausedUntil)).length:0,[G,l,p,t.prefs.behaviorMode,t.prefs.bubbleEnabled,t.prefs.remindersPausedUntil]),J=K[0]??G[0],te=p-h>20*6e4&&(new Date(p).getHours()>=23||new Date(p).getHours()<7)?`sleep`:`idle`,ne=b??(J?P(J):te),Y=e.personaPhrases[U?.persona?.tone??`calm`],X=ee({bubbleEnabled:t.prefs.bubbleEnabled,behaviorMode:t.prefs.behaviorMode,proactiveTipsEnabled:t.prefs.proactiveTipsEnabled,remindersPausedUntil:t.prefs.remindersPausedUntil,collapsed:t.prefs.collapsed,queuedCount:K.length,activeCount:G.length,now:p,lastActivityAt:h,dismissedUntil:v});(0,d.useEffect)(()=>{document.documentElement.dataset.desktopPet=`true`;let e=window.electronAPI?.pet;if(!e)return;let t=e=>{n(e),o(t=>k(t,e.activities))};e.getState().then(t).catch(()=>{});let r=e.onStateChanged(t),i=e.onEvent(e=>o(t=>(g(Date.now()),k(t,[e])))),a=window.setInterval(()=>m(Date.now()),1e3);return()=>{delete document.documentElement.dataset.desktopPet,r(),i(),window.clearInterval(a)}},[]),(0,d.useEffect)(()=>{if(!t.relationshipMoment)return;T(t.relationshipMoment===`first_meeting`?`wake`:`greet`);let e=window.setTimeout(()=>T(null),1400);return()=>window.clearTimeout(e)},[t.relationshipMoment]),(0,d.useLayoutEffect)(()=>{let e=B.current,t=window.electronAPI?.pet;if(!e||!t)return;let n=()=>{let e=[V.current,H.current].filter(e=>e!==null).map(e=>({left:e.offsetLeft,top:e.offsetTop,right:e.offsetLeft+e.offsetWidth,bottom:e.offsetTop+e.offsetHeight}));if(!e.length)return;let n=Math.min(...e.map(e=>e.left)),r=Math.min(...e.map(e=>e.top)),i=Math.max(...e.map(e=>e.right)),a=Math.max(...e.map(e=>e.bottom)),o=Math.round(132*W),s=o+(V.current?8+V.current.offsetHeight:0);t.setContentSize({width:Math.ceil(Math.max(i-n,o)),height:Math.ceil(Math.max(a-r,s))})},r=new ResizeObserver(n);return r.observe(e),V.current&&r.observe(V.current),H.current&&r.observe(H.current),n(),()=>r.disconnect()},[X,K.length,t.prefs.collapsed,W]);let Z=(e=J)=>{e&&e.state!==`running`&&(window.electronAPI?.pet?.acknowledgeEvent(e.conversationId,e.runId),o(t=>{let{[e.conversationId]:n,...r}=t;return r})),window.electronAPI?.pet?.openMainWindow(M(e))},re=async()=>{if(Object.keys(l).length>0&&(f({}),!t.prefs.collapsed))return;let e=await window.electronAPI?.pet?.setPrefs({collapsed:!t.prefs.collapsed});e&&n(e)},ie=(0,d.useCallback)(e=>{e.button===0&&(D.current={pointerId:e.pointerId,x:e.screenX,y:e.screenY,moved:!1},e.currentTarget.setPointerCapture(e.pointerId),window.electronAPI?.pet?.startDrag({screenX:e.screenX,screenY:e.screenY}))},[]),ae=(0,d.useCallback)(e=>{let t=D.current;!t||t.pointerId!==e.pointerId||(t.moved||Math.abs(e.screenX-t.x)+Math.abs(e.screenY-t.y)>4)&&(t.moved=!0,T(`pickedUp`),window.electronAPI?.pet?.drag({screenX:e.screenX,screenY:e.screenY}))},[]),Q=(0,d.useCallback)(e=>{let t=D.current;if(!t||e&&t.pointerId!==e.pointerId)return;D.current=null;let n=e?.type===`pointerup`&&Number.isFinite(e.screenX)&&Number.isFinite(e.screenY),r=t.moved||n&&Math.abs(e.screenX-t.x)+Math.abs(e.screenY-t.y)>4;r&&n&&window.electronAPI?.pet?.drag({screenX:e.screenX,screenY:e.screenY}),window.electronAPI?.pet?.endDrag(),r&&(T(`released`),window.setTimeout(()=>T(null),700),O.current=!0,window.setTimeout(()=>{O.current=!1},0))},[]);(0,d.useEffect)(()=>{let e=e=>Q(e),t=()=>Q();return window.addEventListener(`pointerup`,e),window.addEventListener(`pointercancel`,e),window.addEventListener(`blur`,t),()=>{window.removeEventListener(`pointerup`,e),window.removeEventListener(`pointercancel`,e),window.removeEventListener(`blur`,t)}},[Q]);let oe=()=>{O.current||Z()};if(!U)return null;let se={"--desktop-pet-stage-size":`${Math.round(132*W)}px`,"--desktop-pet-menu-size":`${Math.round(28*W)}px`,"--desktop-pet-menu-left":`0px`,"--desktop-pet-menu-bottom":`${Math.round(12*W)}px`},$=t.prefs.collapsed?K.length:q;return(0,N.jsxs)(`div`,{ref:B,className:`desktop-pet-window`,"data-reduced-motion":t.prefs.reducedMotion,style:se,children:[!t.prefs.collapsed&&K.length>0?(0,N.jsx)(`div`,{ref:V,className:`desktop-pet-bubble desktop-pet-queue`,children:K.map(t=>{let n=C(t,p,{longRunning:e.tipLongRunning,stale:e.tipStaleSignal}),r=S(t,e.tipCompleteSummary),i=w(t,{making_progress:e.petReassuranceMakingProgress,waiting_safely:e.petReassuranceWaitingSafely,completed:e.petReassuranceCompleted,work_preserved:e.petReassuranceWorkPreserved,details_available:e.petReassuranceDetailsAvailable}),a=r??n??i??t.action,o=L(I(U,t,Y),a,!!(r||n||i)),s=R(t,{open:e.viewSession,needsInput:e.petCtaNeedsInput,reviewIssue:e.petCtaReviewIssue});return(0,N.jsxs)(`div`,{className:`desktop-pet-session desktop-pet-session--${t.state}${n?` desktop-pet-session--health`:``}`,children:[(0,N.jsxs)(`button`,{type:`button`,className:`desktop-pet-session-open`,onClick:()=>Z(t),children:[(0,N.jsx)(`span`,{className:`desktop-pet-session-dot`}),(0,N.jsxs)(`span`,{className:`desktop-pet-session-main`,children:[(0,N.jsx)(`strong`,{children:t.sessionLabel}),(0,N.jsxs)(`span`,{children:[o,r||n?``:x(t,p,e.tipTargetSuffix)]})]}),s?(0,N.jsx)(`span`,{className:`desktop-pet-session-cta`,children:s}):null]}),(0,N.jsx)(`button`,{type:`button`,className:`desktop-pet-session-close`,"aria-label":e.dismissSession,onClick:()=>{window.electronAPI?.pet?.acknowledgeEvent(t.conversationId,t.runId),f(e=>({...e,[t.conversationId]:{runId:t.runId,state:t.state}}))},children:(0,N.jsx)(c,{size:12})})]},t.conversationId)})}):null,X?(0,N.jsx)(`div`,{ref:V,className:`desktop-pet-bubble desktop-pet-queue desktop-pet-idle-tip`,children:(0,N.jsxs)(`div`,{className:`desktop-pet-session desktop-pet-session--idle`,children:[(0,N.jsxs)(`button`,{type:`button`,className:`desktop-pet-session-open`,onClick:()=>Z(),children:[(0,N.jsx)(`span`,{className:`desktop-pet-session-dot`}),(0,N.jsxs)(`span`,{className:`desktop-pet-session-main`,children:[(0,N.jsx)(`strong`,{children:e.idleTipTitle}),(0,N.jsx)(`span`,{children:F(U.persona?.phrases?.greeting??Y.greeting,{conversationId:`idle`,runId:`idle`,sessionLabel:``,sequence:0,timestamp:h,state:`running`,phase:`waiting`,action:e.idleTipBody})??e.idleTipBody})]})]}),(0,N.jsx)(`button`,{type:`button`,className:`desktop-pet-session-close`,"aria-label":e.dismissSession,onClick:()=>y(p+_),children:(0,N.jsx)(c,{size:12})})]})}):null,(0,N.jsxs)(`div`,{ref:H,className:`desktop-pet-stage`,children:[(0,N.jsx)(`button`,{type:`button`,className:`desktop-pet-menu-button`,onClick:()=>void re(),"aria-label":e.menu,children:$>0?(0,N.jsx)(`span`,{className:`desktop-pet-tip-count`,children:Math.min(99,$)}):(0,N.jsx)(s,{className:`desktop-pet-menu-chevron size-4`})}),(0,N.jsx)(`button`,{type:`button`,className:`desktop-pet-hit-area`,onClick:oe,onPointerEnter:()=>{!J&&t.prefs.interactionEnabled&&t.prefs.behaviorMode===`playful`&&T(`greet`)},onPointerLeave:()=>{D.current||T(null)},onPointerDown:ie,onPointerMove:ae,onPointerUp:Q,onPointerCancel:Q,onLostPointerCapture:Q,title:e.openApp,children:(0,N.jsx)(u,{animationKey:J?.runId,pet:U,action:ne,reducedMotion:t.prefs.reducedMotion,displayHeight:Math.round(112*W)},U.id)})]})]})}function V(){let e=(0,f.c)(1),t;return e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=window.electronAPI?.pet?(0,N.jsx)(B,{}):(0,N.jsx)(o,{kind:`desktop`,backTo:`/`}),e[0]=t):t=e[0],t}export{V as DesktopPetPage};
|
|
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-B4o4aDCg.js";import{t as a}from"./messages-hlOsXkQ7.js";import{t as o}from"./resource-unavailable-Dccp_uis.js";import{t as s}from"./chevron-down-ccbiQQz_.js";import{t as c}from"./x-B_N4OPjy.js";import{t as l}from"./desktop-pet-narrative-Tlfyn0jb.js";import{t as u}from"./desktop-pet-sprite-D5YYq2zC.js";var d=e(t(),1),f=n(),p=9e4,m=3e4,h=20*6e4,g=45e3,_=45*6e4,v=58;function y(e,t){return e.state===`running`&&t-(e.startedAt??e.timestamp)>=p}function b(e,t){return e.state===`running`&&t-e.timestamp>=m}function x(e,t,n){if(e.progress){let t=`${e.progress.completed}/${e.progress.total}`;return e.action.includes(t)?``:` · ${t}`}return e.detail&&!e.action.includes(e.detail)?n.replace(/\{\{detail\}\}/g,e.detail):e.state===`running`?` · ${Math.max(1,Math.floor((t-e.timestamp)/1e3))}s`:``}function S(e,t){if(e.state!==`success`||!e.publicSummary)return;let n=e.publicSummary.replace(/\s+/g,` `).trim(),r=n.length>v?`${n.slice(0,v-1)}…`:n;return t.replace(/\{\{summary\}\}/g,r)}function C(e,t,n){if(b(e,t))return n.stale;if(y(e,t))return n.longRunning}function w(e,t){let n=e.feedback?.reassurance;return n?t[n]:void 0}function ee(e){let t=e.now-e.lastActivityAt,n=t>=h?(t-h)%_:1/0;return e.bubbleEnabled&&e.behaviorMode!==`focus`&&e.proactiveTipsEnabled&&(!e.remindersPausedUntil||e.now>=e.remindersPausedUntil)&&!e.collapsed&&e.queuedCount===0&&e.activeCount===0&&n<=g&&e.now>=e.dismissedUntil}function T(e,t,n){return e.state===`waiting`||e.state===`error`?`action_required`:e.state===`success`?t===`focus`?`ambient`:`notice`:b(e,n)||t===`playful`||t===`companion`&&y(e,n)?`notice`:`ambient`}function E(e,t,n,r){let i=T(e,t,n);return i===`action_required`?!0:r&&n<r?!1:i===`notice`}var D=8e3;function O(e,t){let n=e?.runId===t.runId,r=t.feedback?.sensitivity===`private`;return{...n?e:void 0,...t,startedAt:n?e.startedAt??e.timestamp:t.timestamp,publicSummary:r?void 0:t.publicSummary??(n?e.publicSummary:void 0),feedback:t.feedback??(n?e.feedback:void 0),expiresAt:t.state===`success`?t.timestamp+D:void 0}}function k(e,t){let n={...e};for(let e of t){let t=n[e.conversationId];t?.runId===e.runId&&e.sequence<=t.sequence||(n[e.conversationId]=O(t,e))}return n}function A(e,t){return t?.runId===e.runId&&t.state===e.state}function j(e,t){let n={error:0,waiting:1,running:2,success:3};return e.filter(e=>!e.expiresAt||e.expiresAt>t).sort((e,t)=>n[e.state]-n[t.state]||t.timestamp-e.timestamp).slice(0,3)}function M(e){return e?`/chat/${e.conversationId}`:void 0}var N=r();function P(e){return e?e.state===`error`?`concern`:e.state===`success`?`success`:e.animation??l(e.phase):`idle`}function F(e,t){if(!e?.length)return;let n=t.sequence;for(let e of`${t.conversationId}:${t.runId}`)n=n*31+e.charCodeAt(0)>>>0;return e[n%e.length]}function I(e,t,n){let r=e.persona?.phrases??n;if(t.state===`success`)return F(r?.success,t);if(t.state===`waiting`)return F(r?.waiting,t);if(t.state===`error`)return F(r?.error,t)}function L(e,t,n){return e?n?`${e} · ${t}`:e:t}function R(e,t){let n=e.feedback?.nextAction?.type;if(n===`confirm`)return t.needsInput;if(n===`review_error`)return t.reviewIssue;if(n===`open_session`)return t.open;if(e.state===`waiting`)return t.needsInput;if(e.state===`error`)return t.reviewIssue;if(e.state===`success`)return t.open}function z(){let e=Date.now();return{prefs:{enabled:!0,showOnStartup:!1,selectedPetId:`loopi`,alwaysOnTop:!0,bubbleEnabled:!0,clickThroughWhenIdle:!1,muted:!1,behaviorMode:`companion`,proactiveTipsEnabled:!0,interactionEnabled:!0,reducedMotion:!1,sizePercent:100,collapsed:!1},relationship:{firstMetAt:e,lastSeenAt:e,completedTaskCount:0,unlockedReactions:[],recentCompletedRunIds:[]},pets:[],visible:!0,customPetsDir:``,petIssues:[],activities:[]}}function B(){let e=a(i(e=>e.language)).desktopPet,[t,n]=(0,d.useState)(z),[r,o]=(0,d.useState)({}),[l,f]=(0,d.useState)({}),[p,m]=(0,d.useState)(Date.now()),[h,g]=(0,d.useState)(()=>Date.now()),[v,y]=(0,d.useState)(0),[b,T]=(0,d.useState)(null),D=(0,d.useRef)(null),O=(0,d.useRef)(!1),B=(0,d.useRef)(null),V=(0,d.useRef)(null),H=(0,d.useRef)(null),U=(0,d.useMemo)(()=>t.pets.find(e=>e.id===t.prefs.selectedPetId)??t.pets[0],[t]),W=Math.min(1.4,Math.max(.7,t.prefs.sizePercent/100)),G=(0,d.useMemo)(()=>j(Object.values(r),p),[r,p]),K=(0,d.useMemo)(()=>t.prefs.bubbleEnabled?G.filter(e=>!A(e,l[e.conversationId])&&E(e,t.prefs.behaviorMode,p,t.prefs.remindersPausedUntil)):[],[G,l,p,t.prefs.behaviorMode,t.prefs.bubbleEnabled,t.prefs.remindersPausedUntil]),q=(0,d.useMemo)(()=>t.prefs.bubbleEnabled?G.filter(e=>A(e,l[e.conversationId])&&E(e,t.prefs.behaviorMode,p,t.prefs.remindersPausedUntil)).length:0,[G,l,p,t.prefs.behaviorMode,t.prefs.bubbleEnabled,t.prefs.remindersPausedUntil]),J=K[0]??G[0],te=p-h>20*6e4&&(new Date(p).getHours()>=23||new Date(p).getHours()<7)?`sleep`:`idle`,ne=b??(J?P(J):te),Y=e.personaPhrases[U?.persona?.tone??`calm`],X=ee({bubbleEnabled:t.prefs.bubbleEnabled,behaviorMode:t.prefs.behaviorMode,proactiveTipsEnabled:t.prefs.proactiveTipsEnabled,remindersPausedUntil:t.prefs.remindersPausedUntil,collapsed:t.prefs.collapsed,queuedCount:K.length,activeCount:G.length,now:p,lastActivityAt:h,dismissedUntil:v});(0,d.useEffect)(()=>{document.documentElement.dataset.desktopPet=`true`;let e=window.electronAPI?.pet;if(!e)return;let t=e=>{n(e),o(t=>k(t,e.activities))};e.getState().then(t).catch(()=>{});let r=e.onStateChanged(t),i=e.onEvent(e=>o(t=>(g(Date.now()),k(t,[e])))),a=window.setInterval(()=>m(Date.now()),1e3);return()=>{delete document.documentElement.dataset.desktopPet,r(),i(),window.clearInterval(a)}},[]),(0,d.useEffect)(()=>{if(!t.relationshipMoment)return;T(t.relationshipMoment===`first_meeting`?`wake`:`greet`);let e=window.setTimeout(()=>T(null),1400);return()=>window.clearTimeout(e)},[t.relationshipMoment]),(0,d.useLayoutEffect)(()=>{let e=B.current,t=window.electronAPI?.pet;if(!e||!t)return;let n=()=>{let e=[V.current,H.current].filter(e=>e!==null).map(e=>({left:e.offsetLeft,top:e.offsetTop,right:e.offsetLeft+e.offsetWidth,bottom:e.offsetTop+e.offsetHeight}));if(!e.length)return;let n=Math.min(...e.map(e=>e.left)),r=Math.min(...e.map(e=>e.top)),i=Math.max(...e.map(e=>e.right)),a=Math.max(...e.map(e=>e.bottom)),o=Math.round(132*W),s=o+(V.current?8+V.current.offsetHeight:0);t.setContentSize({width:Math.ceil(Math.max(i-n,o)),height:Math.ceil(Math.max(a-r,s))})},r=new ResizeObserver(n);return r.observe(e),V.current&&r.observe(V.current),H.current&&r.observe(H.current),n(),()=>r.disconnect()},[X,K.length,t.prefs.collapsed,W]);let Z=(e=J)=>{e&&e.state!==`running`&&(window.electronAPI?.pet?.acknowledgeEvent(e.conversationId,e.runId),o(t=>{let{[e.conversationId]:n,...r}=t;return r})),window.electronAPI?.pet?.openMainWindow(M(e))},re=async()=>{if(Object.keys(l).length>0&&(f({}),!t.prefs.collapsed))return;let e=await window.electronAPI?.pet?.setPrefs({collapsed:!t.prefs.collapsed});e&&n(e)},ie=(0,d.useCallback)(e=>{e.button===0&&(D.current={pointerId:e.pointerId,x:e.screenX,y:e.screenY,moved:!1},e.currentTarget.setPointerCapture(e.pointerId),window.electronAPI?.pet?.startDrag({screenX:e.screenX,screenY:e.screenY}))},[]),ae=(0,d.useCallback)(e=>{let t=D.current;!t||t.pointerId!==e.pointerId||(t.moved||Math.abs(e.screenX-t.x)+Math.abs(e.screenY-t.y)>4)&&(t.moved=!0,T(`pickedUp`),window.electronAPI?.pet?.drag({screenX:e.screenX,screenY:e.screenY}))},[]),Q=(0,d.useCallback)(e=>{let t=D.current;if(!t||e&&t.pointerId!==e.pointerId)return;D.current=null;let n=e?.type===`pointerup`&&Number.isFinite(e.screenX)&&Number.isFinite(e.screenY),r=t.moved||n&&Math.abs(e.screenX-t.x)+Math.abs(e.screenY-t.y)>4;r&&n&&window.electronAPI?.pet?.drag({screenX:e.screenX,screenY:e.screenY}),window.electronAPI?.pet?.endDrag(),r&&(T(`released`),window.setTimeout(()=>T(null),700),O.current=!0,window.setTimeout(()=>{O.current=!1},0))},[]);(0,d.useEffect)(()=>{let e=e=>Q(e),t=()=>Q();return window.addEventListener(`pointerup`,e),window.addEventListener(`pointercancel`,e),window.addEventListener(`blur`,t),()=>{window.removeEventListener(`pointerup`,e),window.removeEventListener(`pointercancel`,e),window.removeEventListener(`blur`,t)}},[Q]);let oe=()=>{O.current||Z()};if(!U)return null;let se={"--desktop-pet-stage-size":`${Math.round(132*W)}px`,"--desktop-pet-menu-size":`${Math.round(28*W)}px`,"--desktop-pet-menu-left":`0px`,"--desktop-pet-menu-bottom":`${Math.round(12*W)}px`},$=t.prefs.collapsed?K.length:q;return(0,N.jsxs)(`div`,{ref:B,className:`desktop-pet-window`,"data-reduced-motion":t.prefs.reducedMotion,style:se,children:[!t.prefs.collapsed&&K.length>0?(0,N.jsx)(`div`,{ref:V,className:`desktop-pet-bubble desktop-pet-queue`,children:K.map(t=>{let n=C(t,p,{longRunning:e.tipLongRunning,stale:e.tipStaleSignal}),r=S(t,e.tipCompleteSummary),i=w(t,{making_progress:e.petReassuranceMakingProgress,waiting_safely:e.petReassuranceWaitingSafely,completed:e.petReassuranceCompleted,work_preserved:e.petReassuranceWorkPreserved,details_available:e.petReassuranceDetailsAvailable}),a=r??n??i??t.action,o=L(I(U,t,Y),a,!!(r||n||i)),s=R(t,{open:e.viewSession,needsInput:e.petCtaNeedsInput,reviewIssue:e.petCtaReviewIssue});return(0,N.jsxs)(`div`,{className:`desktop-pet-session desktop-pet-session--${t.state}${n?` desktop-pet-session--health`:``}`,children:[(0,N.jsxs)(`button`,{type:`button`,className:`desktop-pet-session-open`,onClick:()=>Z(t),children:[(0,N.jsx)(`span`,{className:`desktop-pet-session-dot`}),(0,N.jsxs)(`span`,{className:`desktop-pet-session-main`,children:[(0,N.jsx)(`strong`,{children:t.sessionLabel}),(0,N.jsxs)(`span`,{children:[o,r||n?``:x(t,p,e.tipTargetSuffix)]})]}),s?(0,N.jsx)(`span`,{className:`desktop-pet-session-cta`,children:s}):null]}),(0,N.jsx)(`button`,{type:`button`,className:`desktop-pet-session-close`,"aria-label":e.dismissSession,onClick:()=>{window.electronAPI?.pet?.acknowledgeEvent(t.conversationId,t.runId),f(e=>({...e,[t.conversationId]:{runId:t.runId,state:t.state}}))},children:(0,N.jsx)(c,{size:12})})]},t.conversationId)})}):null,X?(0,N.jsx)(`div`,{ref:V,className:`desktop-pet-bubble desktop-pet-queue desktop-pet-idle-tip`,children:(0,N.jsxs)(`div`,{className:`desktop-pet-session desktop-pet-session--idle`,children:[(0,N.jsxs)(`button`,{type:`button`,className:`desktop-pet-session-open`,onClick:()=>Z(),children:[(0,N.jsx)(`span`,{className:`desktop-pet-session-dot`}),(0,N.jsxs)(`span`,{className:`desktop-pet-session-main`,children:[(0,N.jsx)(`strong`,{children:e.idleTipTitle}),(0,N.jsx)(`span`,{children:F(U.persona?.phrases?.greeting??Y.greeting,{conversationId:`idle`,runId:`idle`,sessionLabel:``,sequence:0,timestamp:h,state:`running`,phase:`waiting`,action:e.idleTipBody})??e.idleTipBody})]})]}),(0,N.jsx)(`button`,{type:`button`,className:`desktop-pet-session-close`,"aria-label":e.dismissSession,onClick:()=>y(p+_),children:(0,N.jsx)(c,{size:12})})]})}):null,(0,N.jsxs)(`div`,{ref:H,className:`desktop-pet-stage`,children:[(0,N.jsx)(`button`,{type:`button`,className:`desktop-pet-menu-button`,onClick:()=>void re(),"aria-label":e.menu,children:$>0?(0,N.jsx)(`span`,{className:`desktop-pet-tip-count`,children:Math.min(99,$)}):(0,N.jsx)(s,{className:`desktop-pet-menu-chevron size-4`})}),(0,N.jsx)(`button`,{type:`button`,className:`desktop-pet-hit-area`,onClick:oe,onPointerEnter:()=>{!J&&t.prefs.interactionEnabled&&t.prefs.behaviorMode===`playful`&&T(`greet`)},onPointerLeave:()=>{D.current||T(null)},onPointerDown:ie,onPointerMove:ae,onPointerUp:Q,onPointerCancel:Q,onLostPointerCapture:Q,title:e.openApp,children:(0,N.jsx)(u,{animationKey:J?.runId,pet:U,action:ne,reducedMotion:t.prefs.reducedMotion,displayHeight:Math.round(112*W)},U.id)})]})]})}function V(){let e=(0,f.c)(1),t;return e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=window.electronAPI?.pet?(0,N.jsx)(B,{}):(0,N.jsx)(o,{kind:`desktop`,backTo:`/`}),e[0]=t):t=e[0],t}export{V as DesktopPetPage};
|
|
@@ -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{u as i}from"./chunk-KS7C4IRE-CiwuuyV8.js";import{n as a}from"./locale-store-CnHhWsDP.js";import{t as o}from"./messages-CZCXd6Pj.js";import{t as s}from"./resource-unavailable-ClTyW1KO.js";import{t as c}from"./chevron-down-ccbiQQz_.js";import{n as l,r as u}from"./popover-select-CLsphyzA.js";import{t as d}from"./circle-alert-BEjgurr2.js";import{t as f}from"./external-link-DjqjBmc3.js";import{t as p}from"./message-square-plus-XP0tGdlV.js";import{n as m,t as h}from"./wand-sparkles-CkSL-3Fy.js";import{t as g}from"./rotate-ccw-JM1TBLpp.js";import{t as _}from"./cn-0WouolD0.js";import{t as v}from"./skeleton-DzdOeGYz.js";import{n as y}from"./interaction-BdhHBbYa.js";import{n as b}from"./electron-env-DHOGevH3.js";import{t as x}from"./refresh-button-D6ihZgH3.js";import{t as S}from"./desktop-pet-sprite-D5YYq2zC.js";import{n as C,t as w}from"./settings-page-header-BnBbewrE.js";import"./settings-page-layout-DgRq0a-W.js";var T=n(),E=e(t(),1),D=r();function O(e){let t=(0,T.c)(16),{title:n,desc:r,checked:i,disabled:a,onChange:o}=e,s;t[0]===n?s=t[1]:(s=(0,D.jsx)(`span`,{className:`block text-sm font-medium text-fg`,children:n}),t[0]=n,t[1]=s);let c;t[2]===r?c=t[3]:(c=r?(0,D.jsx)(`span`,{className:`block text-xs text-fg-muted`,children:r}):null,t[2]=r,t[3]=c);let l;t[4]!==s||t[5]!==c?(l=(0,D.jsxs)(`span`,{className:`min-w-0`,children:[s,c]}),t[4]=s,t[5]=c,t[6]=l):l=t[6];let u;t[7]===o?u=t[8]:(u=e=>o(e.target.checked),t[7]=o,t[8]=u);let d;t[9]!==i||t[10]!==a||t[11]!==u?(d=(0,D.jsx)(`input`,{type:`checkbox`,role:`switch`,"aria-checked":i,className:`ui-checkbox`,disabled:a,checked:i,onChange:u}),t[9]=i,t[10]=a,t[11]=u,t[12]=d):d=t[12];let f;return t[13]!==l||t[14]!==d?(f=(0,D.jsxs)(`label`,{className:`flex min-h-12 cursor-pointer items-center justify-between gap-3 py-3`,children:[l,d]}),t[13]=l,t[14]=d,t[15]=f):f=t[15],f}function k(){let e=o(a(e=>e.language)).desktopPetSettings,t=i(),[n,r]=(0,E.useState)(null),[T,k]=(0,E.useState)(!1),[A,j]=(0,E.useState)(null),M=typeof window<`u`?window.electronAPI?.pet:void 0,N=(0,E.useMemo)(()=>n?.pets.find(e=>e.id===n.prefs.selectedPetId)??n?.pets[0],[n]),P=(0,E.useCallback)(async()=>{if(M){k(!0);try{r(await M.getState())}finally{k(!1)}}},[M]);if((0,E.useEffect)(()=>{if(M)return P(),M.onStateChanged(r)},[M,P]),!b()||!M)return(0,D.jsx)(s,{kind:`desktop`,backTo:`/settings/overview`});if(!n)return(0,D.jsxs)(C,{gap:`gap-4`,children:[(0,D.jsx)(w,{title:e.title,subtitle:e.subtitle}),(0,D.jsx)(`section`,{className:`rounded-xl bg-surface-hover/20 p-4`,"aria-busy":!0,"aria-label":e.loading,children:(0,D.jsxs)(`div`,{className:`space-y-3`,children:[(0,D.jsx)(v,{className:`h-14 rounded-xl`}),(0,D.jsx)(v,{className:`h-14 rounded-xl`}),(0,D.jsx)(v,{className:`h-24 rounded-xl`}),(0,D.jsx)(`div`,{className:`space-y-2 pt-2`,children:Array.from({length:3}).map((e,t)=>(0,D.jsx)(v,{className:`h-16 rounded-xl`},t))})]})})]});let F=async e=>{k(!0);try{r(await M.setPrefs(e))}finally{k(!1)}},I=async e=>{e?(await M.show(),r(await M.getState())):r(await M.setPrefs({enabled:!1}))},L=e=>{F({selectedPetId:e})},R=t=>{if(t.builtin&&t.i18nKey){let n=e.builtinPets[t.i18nKey];if(n)return n}return{name:t.name,description:t.description}},z=e=>{t({pathname:`/chat/new`,search:`?draft=${encodeURIComponent(e)}`})},B=e=>{if(e.sourcePrompt?.trim())return e.sourcePrompt.trim();let{description:t}=R(e);return t.replace(/^Custom pet generated from:\s*/i,``).trim()||t},V=(e,t)=>Object.entries(t).reduce((e,[t,n])=>e.split(`{${t}}`).join(n),e),H=()=>{z(e.createChatDraft)},U=t=>{let n=V(e.optimizeChatDraft,{id:t.id,name:R(t).name,description:R(t).description,sourcePrompt:B(t)});z(n)},W=t=>{let n=V(e.fixChatDraft,{dir:t.dir,reason:t.reason,details:t.details?.join(`; `)||e.noIssueDetails});z(n)},G=A??n.prefs.sizePercent,K=Math.max(1,Math.floor((Date.now()-n.relationship.firstMetAt)/864e5)+1),q=async(e=G)=>{let t=Math.min(140,Math.max(70,Math.round(e/5)*5));j(null),t!==n.prefs.sizePercent&&await F({sizePercent:t})};return(0,D.jsxs)(C,{gap:`gap-5`,children:[(0,D.jsx)(w,{title:e.title,subtitle:e.subtitle,actions:(0,D.jsx)(x,{className:`size-9 shrink-0 p-0`,disabled:T,label:e.refresh,onClick:P})}),(0,D.jsxs)(`section`,{className:`overflow-hidden rounded-xl border border-edge bg-surface-panel`,children:[(0,D.jsxs)(`div`,{className:`flex flex-col gap-4 p-5 sm:flex-row sm:items-center sm:gap-6`,children:[(0,D.jsx)(`div`,{className:`grid h-40 w-40 shrink-0 place-items-center self-center rounded-xl bg-surface-hover/35`,children:N?(0,D.jsx)(S,{pet:N,action:`idle`,displayHeight:Math.round(104*G/100),reducedMotion:n.prefs.reducedMotion}):null}),(0,D.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,D.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-x-6 gap-y-2`,children:[(0,D.jsx)(`h2`,{className:`break-words text-xl font-semibold text-fg`,children:N?R(N).name:e.title}),(0,D.jsx)(O,{title:e.enable,checked:n.prefs.enabled,disabled:T,onChange:e=>void I(e)})]}),(0,D.jsx)(`p`,{className:`text-xs text-fg-muted`,children:e.bondSummary.replace(`{days}`,String(K)).replace(`{tasks}`,String(n.relationship.completedTaskCount))}),n.pets.length>1?(0,D.jsx)(`div`,{className:`mt-4 max-w-56`,children:(0,D.jsx)(l,{"aria-label":e.petList,value:N?.id??``,onChange:e=>L(e.target.value),disabled:T,children:n.pets.map(e=>(0,D.jsx)(u,{value:e.id,children:R(e).name},e.id))})}):null,N&&!N.builtin?(0,D.jsxs)(`button`,{type:`button`,onClick:()=>U(N),className:`mt-3 inline-flex min-h-9 items-center gap-1.5 text-xs font-medium text-fg-muted hover:text-fg`,children:[(0,D.jsx)(m,{className:`size-3.5`}),e.optimizeInChat]}):null]})]}),(0,D.jsx)(`div`,{className:`border-t border-edge px-5 py-2`,children:(0,D.jsxs)(`button`,{type:`button`,onClick:H,className:_(`inline-flex min-h-10 items-center gap-2 text-xs font-medium text-fg-muted hover:text-accent-fg`,y.press),children:[(0,D.jsx)(h,{className:`size-4`}),e.createTitle]})})]}),n.petIssues.length>0?(0,D.jsxs)(`section`,{className:`rounded-xl border border-danger/20 bg-danger/5 p-4`,children:[(0,D.jsxs)(`h3`,{className:`flex items-center gap-2 text-sm font-medium text-danger`,children:[(0,D.jsx)(d,{className:`size-4`}),e.invalidPets]}),(0,D.jsx)(`div`,{className:`mt-3 space-y-3`,children:n.petIssues.map(t=>(0,D.jsxs)(`div`,{className:`flex flex-col gap-2 sm:flex-row sm:items-start sm:justify-between`,children:[(0,D.jsxs)(`div`,{className:`min-w-0 text-xs text-fg-muted`,children:[(0,D.jsx)(`p`,{className:`break-words`,children:t.reason}),(0,D.jsxs)(`details`,{className:`mt-1`,children:[(0,D.jsx)(`summary`,{className:`cursor-pointer`,children:e.issueDetails}),(0,D.jsx)(`p`,{className:`mt-2 break-all font-mono`,children:t.dir}),t.details?.length?(0,D.jsx)(`p`,{className:`mt-1 break-words`,children:t.details.join(`; `)}):null]})]}),(0,D.jsxs)(`button`,{type:`button`,onClick:()=>W(t),className:`inline-flex min-h-9 shrink-0 items-center gap-1.5 text-xs font-medium text-danger`,children:[(0,D.jsx)(p,{className:`size-3.5`}),e.fixInChat]})]},`${t.dir}-${t.reason}`))})]}):null,(0,D.jsxs)(`section`,{"aria-label":e.displayGroup,children:[(0,D.jsx)(`h3`,{className:`mb-2 text-xs font-medium text-fg-muted`,children:e.displayGroup}),(0,D.jsxs)(`div`,{className:`divide-y divide-edge rounded-xl border border-edge bg-surface-panel px-4`,children:[(0,D.jsx)(O,{title:e.showOnStartup,checked:n.prefs.showOnStartup,disabled:T,onChange:e=>void F({showOnStartup:e})}),(0,D.jsx)(O,{title:e.alwaysOnTop,checked:n.prefs.alwaysOnTop,disabled:T,onChange:e=>void F({alwaysOnTop:e})}),(0,D.jsx)(O,{title:e.bubbles,checked:n.prefs.bubbleEnabled,disabled:T,onChange:e=>void F({bubbleEnabled:e})}),(0,D.jsxs)(`div`,{className:`py-3`,children:[(0,D.jsxs)(`label`,{htmlFor:`desktop-pet-size`,className:`flex items-center justify-between gap-3 text-sm font-medium text-fg`,children:[e.size,(0,D.jsxs)(`span`,{className:`text-xs tabular-nums text-fg-muted`,children:[G,`%`]})]}),(0,D.jsx)(`input`,{id:`desktop-pet-size`,type:`range`,min:70,max:140,step:5,className:`mt-3 w-full accent-accent`,value:G,disabled:T,onChange:e=>j(Number(e.target.value)),onBlur:()=>void q(),onKeyUp:e=>{(e.key===`Enter`||e.key===` `||e.key.startsWith(`Arrow`))&&q()},onPointerUp:()=>void q()})]})]})]}),(0,D.jsxs)(`section`,{"aria-label":e.interactionGroup,children:[(0,D.jsx)(`h3`,{className:`mb-2 text-xs font-medium text-fg-muted`,children:e.interactionGroup}),(0,D.jsxs)(`div`,{className:`divide-y divide-edge rounded-xl border border-edge bg-surface-panel px-4`,children:[(0,D.jsx)(O,{title:e.proactiveTips,checked:n.prefs.proactiveTipsEnabled,disabled:T,onChange:e=>void F({proactiveTipsEnabled:e})}),(0,D.jsx)(O,{title:e.interactions,desc:e.interactionsDesc,checked:n.prefs.interactionEnabled,disabled:T,onChange:e=>void F({interactionEnabled:e})}),(0,D.jsx)(O,{title:e.reducedMotion,checked:n.prefs.reducedMotion,disabled:T,onChange:e=>void F({reducedMotion:e})}),(0,D.jsxs)(`div`,{className:`flex min-h-12 flex-wrap items-center justify-between gap-3 py-3`,children:[(0,D.jsx)(`span`,{className:`text-sm font-medium text-fg`,children:e.behaviorMode}),(0,D.jsxs)(l,{"aria-label":e.behaviorMode,className:`w-36`,triggerClassName:`h-9 bg-surface-panel`,value:n.prefs.behaviorMode,disabled:T,onChange:e=>void F({behaviorMode:e.target.value}),children:[(0,D.jsx)(u,{value:`focus`,children:e.behaviorFocus}),(0,D.jsx)(u,{value:`companion`,children:e.behaviorCompanion}),(0,D.jsx)(u,{value:`playful`,children:e.behaviorPlayful})]})]})]})]}),(0,D.jsxs)(`details`,{className:`group rounded-xl border border-edge bg-surface-panel`,children:[(0,D.jsxs)(`summary`,{className:`flex min-h-12 cursor-pointer list-none items-center justify-between gap-3 px-4 text-sm font-medium text-fg [&::-webkit-details-marker]:hidden`,children:[e.advanced,(0,D.jsx)(c,{className:`size-4 text-fg-muted transition-transform group-open:rotate-180`})]}),(0,D.jsxs)(`div`,{className:`space-y-3 border-t border-edge px-4 pb-4`,children:[(0,D.jsx)(O,{title:e.clickThrough,desc:e.clickThroughDesc,checked:n.prefs.clickThroughWhenIdle,disabled:T,onChange:e=>void F({clickThroughWhenIdle:e})}),(0,D.jsxs)(`div`,{className:`flex flex-col gap-2 border-t border-edge pt-4 sm:flex-row sm:items-center sm:justify-between`,children:[(0,D.jsxs)(`div`,{className:`min-w-0`,children:[(0,D.jsx)(`p`,{className:`text-sm font-medium text-fg`,children:e.customPets}),(0,D.jsx)(`p`,{className:`mt-1 break-all font-mono text-xs text-fg-muted`,children:n.customPetsDir})]}),(0,D.jsxs)(`button`,{type:`button`,onClick:()=>void M.openCustomPetsDir(),className:`inline-flex min-h-10 shrink-0 items-center gap-1.5 text-xs font-medium text-fg-muted hover:text-fg`,children:[(0,D.jsx)(f,{className:`size-3.5`}),e.openFolder]})]}),(0,D.jsxs)(`button`,{type:`button`,className:_(`inline-flex min-h-10 items-center gap-1.5 text-xs font-medium text-fg-muted hover:text-fg disabled:opacity-50`,y.press),disabled:T,onClick:()=>void M.resetPosition().then(r),children:[(0,D.jsx)(g,{className:`size-3.5`}),e.resetPosition]})]})]})]})}export{k as DesktopPetSettings};
|
|
1
|
+
import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{a as t,n,t as r}from"./vendor-react-BOUWij0V.js";import{u as i}from"./chunk-KS7C4IRE-BPb7KheU.js";import{n as a}from"./locale-store-B4o4aDCg.js";import{t as o}from"./messages-hlOsXkQ7.js";import{t as s}from"./resource-unavailable-Dccp_uis.js";import{t as c}from"./chevron-down-ccbiQQz_.js";import{n as l,r as u}from"./popover-select-CLsphyzA.js";import{t as d}from"./circle-alert-BEjgurr2.js";import{t as f}from"./external-link-DjqjBmc3.js";import{t as p}from"./message-square-plus-XP0tGdlV.js";import{n as m,t as h}from"./wand-sparkles-CkSL-3Fy.js";import{t as g}from"./rotate-ccw-JM1TBLpp.js";import{t as _}from"./cn-0WouolD0.js";import{t as v}from"./skeleton-DzdOeGYz.js";import{n as y}from"./interaction-BdhHBbYa.js";import{n as b}from"./electron-env-DHOGevH3.js";import{t as x}from"./refresh-button-D6ihZgH3.js";import{t as S}from"./desktop-pet-sprite-D5YYq2zC.js";import{n as C,t as w}from"./settings-page-header-DKgbD0Bc.js";import"./settings-page-layout-BE3vLWp_.js";var T=n(),E=e(t(),1),D=r();function O(e){let t=(0,T.c)(16),{title:n,desc:r,checked:i,disabled:a,onChange:o}=e,s;t[0]===n?s=t[1]:(s=(0,D.jsx)(`span`,{className:`block text-sm font-medium text-fg`,children:n}),t[0]=n,t[1]=s);let c;t[2]===r?c=t[3]:(c=r?(0,D.jsx)(`span`,{className:`block text-xs text-fg-muted`,children:r}):null,t[2]=r,t[3]=c);let l;t[4]!==s||t[5]!==c?(l=(0,D.jsxs)(`span`,{className:`min-w-0`,children:[s,c]}),t[4]=s,t[5]=c,t[6]=l):l=t[6];let u;t[7]===o?u=t[8]:(u=e=>o(e.target.checked),t[7]=o,t[8]=u);let d;t[9]!==i||t[10]!==a||t[11]!==u?(d=(0,D.jsx)(`input`,{type:`checkbox`,role:`switch`,"aria-checked":i,className:`ui-checkbox`,disabled:a,checked:i,onChange:u}),t[9]=i,t[10]=a,t[11]=u,t[12]=d):d=t[12];let f;return t[13]!==l||t[14]!==d?(f=(0,D.jsxs)(`label`,{className:`flex min-h-12 cursor-pointer items-center justify-between gap-3 py-3`,children:[l,d]}),t[13]=l,t[14]=d,t[15]=f):f=t[15],f}function k(){let e=o(a(e=>e.language)).desktopPetSettings,t=i(),[n,r]=(0,E.useState)(null),[T,k]=(0,E.useState)(!1),[A,j]=(0,E.useState)(null),M=typeof window<`u`?window.electronAPI?.pet:void 0,N=(0,E.useMemo)(()=>n?.pets.find(e=>e.id===n.prefs.selectedPetId)??n?.pets[0],[n]),P=(0,E.useCallback)(async()=>{if(M){k(!0);try{r(await M.getState())}finally{k(!1)}}},[M]);if((0,E.useEffect)(()=>{if(M)return P(),M.onStateChanged(r)},[M,P]),!b()||!M)return(0,D.jsx)(s,{kind:`desktop`,backTo:`/settings/overview`});if(!n)return(0,D.jsxs)(C,{gap:`gap-4`,children:[(0,D.jsx)(w,{title:e.title,subtitle:e.subtitle}),(0,D.jsx)(`section`,{className:`rounded-xl bg-surface-hover/20 p-4`,"aria-busy":!0,"aria-label":e.loading,children:(0,D.jsxs)(`div`,{className:`space-y-3`,children:[(0,D.jsx)(v,{className:`h-14 rounded-xl`}),(0,D.jsx)(v,{className:`h-14 rounded-xl`}),(0,D.jsx)(v,{className:`h-24 rounded-xl`}),(0,D.jsx)(`div`,{className:`space-y-2 pt-2`,children:Array.from({length:3}).map((e,t)=>(0,D.jsx)(v,{className:`h-16 rounded-xl`},t))})]})})]});let F=async e=>{k(!0);try{r(await M.setPrefs(e))}finally{k(!1)}},I=async e=>{e?(await M.show(),r(await M.getState())):r(await M.setPrefs({enabled:!1}))},L=e=>{F({selectedPetId:e})},R=t=>{if(t.builtin&&t.i18nKey){let n=e.builtinPets[t.i18nKey];if(n)return n}return{name:t.name,description:t.description}},z=e=>{t({pathname:`/chat/new`,search:`?draft=${encodeURIComponent(e)}`})},B=e=>{if(e.sourcePrompt?.trim())return e.sourcePrompt.trim();let{description:t}=R(e);return t.replace(/^Custom pet generated from:\s*/i,``).trim()||t},V=(e,t)=>Object.entries(t).reduce((e,[t,n])=>e.split(`{${t}}`).join(n),e),H=()=>{z(e.createChatDraft)},U=t=>{let n=V(e.optimizeChatDraft,{id:t.id,name:R(t).name,description:R(t).description,sourcePrompt:B(t)});z(n)},W=t=>{let n=V(e.fixChatDraft,{dir:t.dir,reason:t.reason,details:t.details?.join(`; `)||e.noIssueDetails});z(n)},G=A??n.prefs.sizePercent,K=Math.max(1,Math.floor((Date.now()-n.relationship.firstMetAt)/864e5)+1),q=async(e=G)=>{let t=Math.min(140,Math.max(70,Math.round(e/5)*5));j(null),t!==n.prefs.sizePercent&&await F({sizePercent:t})};return(0,D.jsxs)(C,{gap:`gap-5`,children:[(0,D.jsx)(w,{title:e.title,subtitle:e.subtitle,actions:(0,D.jsx)(x,{className:`size-9 shrink-0 p-0`,disabled:T,label:e.refresh,onClick:P})}),(0,D.jsxs)(`section`,{className:`overflow-hidden rounded-xl border border-edge bg-surface-panel`,children:[(0,D.jsxs)(`div`,{className:`flex flex-col gap-4 p-5 sm:flex-row sm:items-center sm:gap-6`,children:[(0,D.jsx)(`div`,{className:`grid h-40 w-40 shrink-0 place-items-center self-center rounded-xl bg-surface-hover/35`,children:N?(0,D.jsx)(S,{pet:N,action:`idle`,displayHeight:Math.round(104*G/100),reducedMotion:n.prefs.reducedMotion}):null}),(0,D.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,D.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-x-6 gap-y-2`,children:[(0,D.jsx)(`h2`,{className:`break-words text-xl font-semibold text-fg`,children:N?R(N).name:e.title}),(0,D.jsx)(O,{title:e.enable,checked:n.prefs.enabled,disabled:T,onChange:e=>void I(e)})]}),(0,D.jsx)(`p`,{className:`text-xs text-fg-muted`,children:e.bondSummary.replace(`{days}`,String(K)).replace(`{tasks}`,String(n.relationship.completedTaskCount))}),n.pets.length>1?(0,D.jsx)(`div`,{className:`mt-4 max-w-56`,children:(0,D.jsx)(l,{"aria-label":e.petList,value:N?.id??``,onChange:e=>L(e.target.value),disabled:T,children:n.pets.map(e=>(0,D.jsx)(u,{value:e.id,children:R(e).name},e.id))})}):null,N&&!N.builtin?(0,D.jsxs)(`button`,{type:`button`,onClick:()=>U(N),className:`mt-3 inline-flex min-h-9 items-center gap-1.5 text-xs font-medium text-fg-muted hover:text-fg`,children:[(0,D.jsx)(m,{className:`size-3.5`}),e.optimizeInChat]}):null]})]}),(0,D.jsx)(`div`,{className:`border-t border-edge px-5 py-2`,children:(0,D.jsxs)(`button`,{type:`button`,onClick:H,className:_(`inline-flex min-h-10 items-center gap-2 text-xs font-medium text-fg-muted hover:text-accent-fg`,y.press),children:[(0,D.jsx)(h,{className:`size-4`}),e.createTitle]})})]}),n.petIssues.length>0?(0,D.jsxs)(`section`,{className:`rounded-xl border border-danger/20 bg-danger/5 p-4`,children:[(0,D.jsxs)(`h3`,{className:`flex items-center gap-2 text-sm font-medium text-danger`,children:[(0,D.jsx)(d,{className:`size-4`}),e.invalidPets]}),(0,D.jsx)(`div`,{className:`mt-3 space-y-3`,children:n.petIssues.map(t=>(0,D.jsxs)(`div`,{className:`flex flex-col gap-2 sm:flex-row sm:items-start sm:justify-between`,children:[(0,D.jsxs)(`div`,{className:`min-w-0 text-xs text-fg-muted`,children:[(0,D.jsx)(`p`,{className:`break-words`,children:t.reason}),(0,D.jsxs)(`details`,{className:`mt-1`,children:[(0,D.jsx)(`summary`,{className:`cursor-pointer`,children:e.issueDetails}),(0,D.jsx)(`p`,{className:`mt-2 break-all font-mono`,children:t.dir}),t.details?.length?(0,D.jsx)(`p`,{className:`mt-1 break-words`,children:t.details.join(`; `)}):null]})]}),(0,D.jsxs)(`button`,{type:`button`,onClick:()=>W(t),className:`inline-flex min-h-9 shrink-0 items-center gap-1.5 text-xs font-medium text-danger`,children:[(0,D.jsx)(p,{className:`size-3.5`}),e.fixInChat]})]},`${t.dir}-${t.reason}`))})]}):null,(0,D.jsxs)(`section`,{"aria-label":e.displayGroup,children:[(0,D.jsx)(`h3`,{className:`mb-2 text-xs font-medium text-fg-muted`,children:e.displayGroup}),(0,D.jsxs)(`div`,{className:`divide-y divide-edge rounded-xl border border-edge bg-surface-panel px-4`,children:[(0,D.jsx)(O,{title:e.showOnStartup,checked:n.prefs.showOnStartup,disabled:T,onChange:e=>void F({showOnStartup:e})}),(0,D.jsx)(O,{title:e.alwaysOnTop,checked:n.prefs.alwaysOnTop,disabled:T,onChange:e=>void F({alwaysOnTop:e})}),(0,D.jsx)(O,{title:e.bubbles,checked:n.prefs.bubbleEnabled,disabled:T,onChange:e=>void F({bubbleEnabled:e})}),(0,D.jsxs)(`div`,{className:`py-3`,children:[(0,D.jsxs)(`label`,{htmlFor:`desktop-pet-size`,className:`flex items-center justify-between gap-3 text-sm font-medium text-fg`,children:[e.size,(0,D.jsxs)(`span`,{className:`text-xs tabular-nums text-fg-muted`,children:[G,`%`]})]}),(0,D.jsx)(`input`,{id:`desktop-pet-size`,type:`range`,min:70,max:140,step:5,className:`mt-3 w-full accent-accent`,value:G,disabled:T,onChange:e=>j(Number(e.target.value)),onBlur:()=>void q(),onKeyUp:e=>{(e.key===`Enter`||e.key===` `||e.key.startsWith(`Arrow`))&&q()},onPointerUp:()=>void q()})]})]})]}),(0,D.jsxs)(`section`,{"aria-label":e.interactionGroup,children:[(0,D.jsx)(`h3`,{className:`mb-2 text-xs font-medium text-fg-muted`,children:e.interactionGroup}),(0,D.jsxs)(`div`,{className:`divide-y divide-edge rounded-xl border border-edge bg-surface-panel px-4`,children:[(0,D.jsx)(O,{title:e.proactiveTips,checked:n.prefs.proactiveTipsEnabled,disabled:T,onChange:e=>void F({proactiveTipsEnabled:e})}),(0,D.jsx)(O,{title:e.interactions,desc:e.interactionsDesc,checked:n.prefs.interactionEnabled,disabled:T,onChange:e=>void F({interactionEnabled:e})}),(0,D.jsx)(O,{title:e.reducedMotion,checked:n.prefs.reducedMotion,disabled:T,onChange:e=>void F({reducedMotion:e})}),(0,D.jsxs)(`div`,{className:`flex min-h-12 flex-wrap items-center justify-between gap-3 py-3`,children:[(0,D.jsx)(`span`,{className:`text-sm font-medium text-fg`,children:e.behaviorMode}),(0,D.jsxs)(l,{"aria-label":e.behaviorMode,className:`w-36`,triggerClassName:`h-9 bg-surface-panel`,value:n.prefs.behaviorMode,disabled:T,onChange:e=>void F({behaviorMode:e.target.value}),children:[(0,D.jsx)(u,{value:`focus`,children:e.behaviorFocus}),(0,D.jsx)(u,{value:`companion`,children:e.behaviorCompanion}),(0,D.jsx)(u,{value:`playful`,children:e.behaviorPlayful})]})]})]})]}),(0,D.jsxs)(`details`,{className:`group rounded-xl border border-edge bg-surface-panel`,children:[(0,D.jsxs)(`summary`,{className:`flex min-h-12 cursor-pointer list-none items-center justify-between gap-3 px-4 text-sm font-medium text-fg [&::-webkit-details-marker]:hidden`,children:[e.advanced,(0,D.jsx)(c,{className:`size-4 text-fg-muted transition-transform group-open:rotate-180`})]}),(0,D.jsxs)(`div`,{className:`space-y-3 border-t border-edge px-4 pb-4`,children:[(0,D.jsx)(O,{title:e.clickThrough,desc:e.clickThroughDesc,checked:n.prefs.clickThroughWhenIdle,disabled:T,onChange:e=>void F({clickThroughWhenIdle:e})}),(0,D.jsxs)(`div`,{className:`flex flex-col gap-2 border-t border-edge pt-4 sm:flex-row sm:items-center sm:justify-between`,children:[(0,D.jsxs)(`div`,{className:`min-w-0`,children:[(0,D.jsx)(`p`,{className:`text-sm font-medium text-fg`,children:e.customPets}),(0,D.jsx)(`p`,{className:`mt-1 break-all font-mono text-xs text-fg-muted`,children:n.customPetsDir})]}),(0,D.jsxs)(`button`,{type:`button`,onClick:()=>void M.openCustomPetsDir(),className:`inline-flex min-h-10 shrink-0 items-center gap-1.5 text-xs font-medium text-fg-muted hover:text-fg`,children:[(0,D.jsx)(f,{className:`size-3.5`}),e.openFolder]})]}),(0,D.jsxs)(`button`,{type:`button`,className:_(`inline-flex min-h-10 items-center gap-1.5 text-xs font-medium text-fg-muted hover:text-fg disabled:opacity-50`,y.press),disabled:T,onClick:()=>void M.resetPosition().then(r),children:[(0,D.jsx)(g,{className:`size-3.5`}),e.resetPosition]})]})]})]})}export{k as DesktopPetSettings};
|
package/dist/gateway/static/root/assets/{dev-view-store-DM2X7oYZ.js → dev-view-store-CXE5-Egp.js}
RENAMED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{p as e}from"./locale-store-
|
|
1
|
+
import{p as e}from"./locale-store-B4o4aDCg.js";import{t}from"./middleware-Pd0e8Igk.js";var n=e(t(e=>({showRawToolData:!1,setShowRawToolData:t=>e({showRawToolData:t})}),{name:`xopc-web-dev-view`}));export{n as t};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{i as e,n as t}from"./rolldown-runtime-aKtaBQYM.js";import{a as n,n as r,t as i}from"./vendor-react-BOUWij0V.js";import{u as a}from"./chunk-KS7C4IRE-CiwuuyV8.js";import{n as o}from"./locale-store-CnHhWsDP.js";import{t as s}from"./messages-CZCXd6Pj.js";import{a as c,i as l,o as u,r as d,s as f,t as p}from"./dist-CY7CS_D3.js";import{t as m}from"./chevron-right-BweFrslA.js";import{t as h}from"./circle-check-C23XjkUj.js";import{t as g}from"./clock-3-DnrAnuyZ.js";import{t as _}from"./download-Dk-ZjtO6.js";import{t as v}from"./external-link-DjqjBmc3.js";import{t as y}from"./laptop-CI3hBVrl.js";import{t as b}from"./panel-right-CFGrHTsD.js";import{t as x}from"./smartphone-DSSsQFqA.js";import{t as ee}from"./x-B_N4OPjy.js";import{t as S}from"./cn-0WouolD0.js";import{t as C}from"./skeleton-DzdOeGYz.js";import{i as w}from"./vendor-swr-CdRzEUwF.js";import{t as T}from"./button-ChmVQg9O.js";import{a as E,i as D,o as O,s as k}from"./dist-GJ8-1PAx.js";import{a as A,i as te,o as ne}from"./settings-shell-dialog-layer-BU3UuiJr.js";import{n as j}from"./app-link-CauYDM-y.js";import{t as M}from"./use-async-resource-BHFGZCY2.js";import{t as N}from"./copy-text-row-BnSoJ0FX.js";import{a as re,n as P,r as F}from"./oauth-api-CaWkle-J.js";import{n as ie,r as I,t as L}from"./oauth-authorization-window-o6URRos4.js";import{_ as ae,a as R,b as oe,d as z,f as se,g as ce,h as le,i as ue,l as B,m as de,n as fe,p as pe,r as V,s as H,t as U,u as me,v as he,y as ge}from"./tunnel-api-DwTTVUxp.js";import{t as _e}from"./mobile-pair-qr-CuIbmw5x.js";var W=r(),G=e(n(),1),K=i();function ve(){let e=s(o(e=>e.language)),t=e.endpointToolsSettings.deviceAccess.flow,n=e.tunnelSettings,{data:r,error:i,mutate:a}=w(`tunnel-status`,fe,{refreshInterval:1500}),[c,l]=(0,G.useState)(!1),[u,d]=(0,G.useState)(!1),[f,p]=(0,G.useState)(!0),[m,h]=(0,G.useState)(`idle`),[g,_]=(0,G.useState)(null),[y,b]=(0,G.useState)(``),[x,ee]=(0,G.useState)(``),S=(0,G.useRef)(!0);(0,G.useEffect)(()=>(S.current=!0,()=>{S.current=!1}),[]),(0,G.useEffect)(()=>{r?.state===`connected`&&(_(null),b(``))},[r?.state]);let E=g?g===`registration-rejected`:r?.state===`error`&&se(Error(r.lastError??``)),D=g?g===`recovery-rejected`:r?.state===`error`&&z(Error(r.lastError??``)),O=async()=>{if(!r)return;if(r.consentRequired&&!c){d(!0);return}let e=E||!r.registrationSecret?.configured,t=e?I():null,n,i=!1;_(null),b(``);try{if(r.consentRequired&&await R(),e){h(`provisioning`),E&&await V({registrationSecret:null});let e=!1;try{await ue()}catch(t){if(!me(t))throw t;e=!0}if(e){h(`authorizing`);let e=sessionStorage.getItem(`device-pairing-oauth`),r=e?JSON.parse(e):null;n=r&&r.expiresAt>Date.now()?r.sessionId:(await re(`xopc-tunnel`)).sessionId,sessionStorage.setItem(`device-pairing-oauth`,JSON.stringify({sessionId:n,expiresAt:r&&r.expiresAt>Date.now()?r.expiresAt:Date.now()+5*6e4}));let a=``,o=Date.now()+5*6e4,s=!1;for(;S.current&&Date.now()<o;){let e=await F(n);if(e.authUrl&&e.authUrl!==a&&(a=e.authUrl,await ie(a,t)||ee(a)),e.status===`completed`){s=!0,i=!0;break}if(e.status===`failed`||e.status===`cancelled`)throw Error(`Authorization cancelled`);await new Promise(e=>setTimeout(e,1e3))}if(!S.current)return;if(!s)throw Error(`Authorization expired`);await ue()}await a()}if(!S.current)return;h(`starting`),await H(D?{recoverActiveLease:!0}:void 0),f&&await V({autoStart:!0}),await a(),i=!0}catch(e){i=!0,S.current&&(_(B(e)===`tunnel_key_limit_reached`?`key-limit`:se(e)?`registration-rejected`:z(e)?`recovery-rejected`:`failed`),b(e instanceof Error?e.message:``))}finally{L(t),i&&(sessionStorage.removeItem(`device-pairing-oauth`),n&&P(n).catch(()=>{})),S.current&&(h(`idle`),ee(``))}};if(!r&&!i)return(0,K.jsxs)(`div`,{className:`space-y-5`,children:[(0,K.jsx)(C,{className:`h-5 w-4/5`}),(0,K.jsx)(C,{className:`h-24 w-full`})]});let k=m===`provisioning`||m===`starting`||r?.state===`connecting`||r?.state===`reconnecting`,A=m===`idle`&&!k&&(g||i||r?.state===`error`),te=y||(i instanceof Error?i.message:``)||(r?.state===`error`?r.lastError:``);return(0,K.jsxs)(`div`,{className:`flex flex-col`,children:[(0,K.jsx)(`p`,{className:`text-sm leading-relaxed text-fg-muted`,children:k?t.preparingHint:m===`authorizing`?t.authorizing:t.enableHint}),x&&m===`authorizing`?(0,K.jsx)(`a`,{href:x,target:`_blank`,rel:`noopener noreferrer`,className:`mt-4 inline-flex min-h-11 items-center text-sm text-accent`,children:t.openAuthorization}):null,k?(0,K.jsxs)(`div`,{className:`mt-8 space-y-3`,"aria-label":t.preparing,children:[(0,K.jsx)(C,{className:`h-2 w-full`}),(0,K.jsx)(`p`,{className:`text-sm text-fg-muted`,children:t.preparing})]}):null,(u||r?.consentRequired)&&m===`idle`?(0,K.jsxs)(`div`,{className:`mt-6 space-y-4`,children:[(0,K.jsxs)(`details`,{open:u,className:`text-sm text-fg-muted`,children:[(0,K.jsx)(`summary`,{className:`cursor-pointer py-2`,children:t.details}),(0,K.jsx)(`p`,{className:`mt-2`,children:n.consentIntro}),(0,K.jsx)(`ul`,{className:`mt-3 list-disc space-y-2 pl-5`,children:[n.consentBullet1,n.consentBullet2,n.consentBullet3].map(e=>(0,K.jsx)(`li`,{children:e},e))})]}),(0,K.jsxs)(`label`,{className:`flex items-start gap-3 text-sm text-fg`,children:[(0,K.jsx)(`input`,{type:`checkbox`,checked:c,onChange:e=>l(e.target.checked),className:`mt-1 size-4 accent-accent`}),n.consentCheckbox]})]}):null,A&&g===`key-limit`?(0,K.jsxs)(`div`,{role:`alert`,className:`mt-4 rounded-lg border border-warning/30 bg-warning/5 p-4`,children:[(0,K.jsx)(`p`,{className:`text-sm font-medium text-fg`,children:t.routeKeyLimitTitle}),(0,K.jsx)(`p`,{className:`mt-1 text-xs leading-5 text-fg-muted`,children:t.routeKeyLimitHint}),(0,K.jsxs)(T,{variant:`secondary`,className:`mt-3`,onClick:()=>void j(U),children:[t.manageTunnelKeys,(0,K.jsx)(v,{className:`size-3`})]})]}):A?(0,K.jsxs)(`div`,{role:`alert`,className:`mt-4 text-sm text-danger`,children:[(0,K.jsx)(`p`,{children:i&&!r?t.readinessFailed:E?t.routeAuthorizationRequired:D?t.routeRecoveryRequired:t.routeSetupFailed}),te?(0,K.jsxs)(`details`,{className:`mt-2 text-xs text-fg-muted`,children:[(0,K.jsx)(`summary`,{className:`cursor-pointer py-2`,children:t.details}),(0,K.jsx)(`p`,{className:`break-words whitespace-pre-wrap`,children:te})]}):null]}):null,(0,K.jsxs)(`label`,{className:`my-5 flex items-center gap-3 text-sm text-fg-muted`,children:[(0,K.jsx)(`input`,{type:`checkbox`,checked:f,disabled:m!==`idle`,onChange:e=>p(e.target.checked),className:`size-4 accent-accent`}),t.autoStart]}),i&&!r?(0,K.jsx)(T,{className:`w-full`,variant:`primary`,onClick:()=>void a().catch(()=>{}),children:t.retry}):(0,K.jsx)(T,{className:`w-full`,variant:`primary`,disabled:!r||m!==`idle`||k||u&&!c,onClick:()=>void O(),children:m===`authorizing`?t.authorizing:k?t.preparing:E?t.authorize:D?t.recoverRoute:A?t.retry:t.enable})]})}var q=t({DevicePairingWizard:()=>J});function J(e){let t=(0,W.c)(16),{open:n,onOpenChange:r,onPaired:i,targetKind:o}=e,s=a(),[c,l]=(0,G.useState)(o),u,d;t[0]===o?(u=t[1],d=t[2]):(u=()=>{l(o)},d=[o],t[0]=o,t[1]=u,t[2]=d),(0,G.useEffect)(u,d);let f;t[3]!==r||t[4]!==o?(f=e=>{e||l(o),r(e)},t[3]=r,t[4]=o,t[5]=f):f=t[5];let m=f,h;t[6]!==m||t[7]!==s||t[8]!==i||t[9]!==n||t[10]!==c?(h=n?c?(0,K.jsx)(Z,{targetKind:c,onClose:()=>m(!1),onPaired:i}):(0,K.jsx)(X,{onChoose:l,onChooseLocalBrowser:()=>{m(!1),s(`/settings/agent-browser?driver=extension`)},onClose:()=>m(!1)}):null,t[6]=m,t[7]=s,t[8]=i,t[9]=n,t[10]=c,t[11]=h):h=t[11];let g;return t[12]!==m||t[13]!==n||t[14]!==h?(g=(0,K.jsx)(p,{open:n,onOpenChange:m,children:h}),t[12]=m,t[13]=n,t[14]=h,t[15]=g):g=t[15],g}function Y(e){let t=(0,W.c)(14),{icon:n,title:r,hint:i,onClick:a}=e,o;t[0]===n?o=t[1]:(o=(0,K.jsx)(`span`,{className:`flex size-10 shrink-0 items-center justify-center rounded-xl bg-accent-soft text-accent-fg`,children:(0,K.jsx)(n,{className:`size-5`,"aria-hidden":`true`})}),t[0]=n,t[1]=o);let s;t[2]===r?s=t[3]:(s=(0,K.jsx)(`span`,{className:`block text-sm font-semibold text-fg`,children:r}),t[2]=r,t[3]=s);let c;t[4]===i?c=t[5]:(c=(0,K.jsx)(`span`,{className:`mt-0.5 block text-xs leading-5 text-fg-muted`,children:i}),t[4]=i,t[5]=c);let l;t[6]!==s||t[7]!==c?(l=(0,K.jsxs)(`span`,{className:`min-w-0 flex-1`,children:[s,c]}),t[6]=s,t[7]=c,t[8]=l):l=t[8];let u;t[9]===Symbol.for(`react.memo_cache_sentinel`)?(u=(0,K.jsx)(m,{className:`size-4 shrink-0 text-fg-disabled transition-transform group-hover:translate-x-0.5 group-hover:text-fg-muted`,"aria-hidden":`true`}),t[9]=u):u=t[9];let d;return t[10]!==a||t[11]!==o||t[12]!==l?(d=(0,K.jsxs)(`button`,{type:`button`,className:`group flex min-h-18 w-full cursor-pointer items-center gap-4 rounded-xl border border-edge bg-surface-panel px-4 py-3.5 text-left shadow-surface transition-[background-color,border-color,box-shadow,transform] hover:border-edge-strong hover:bg-surface-active hover:shadow-elevated active:translate-y-px active:bg-surface-hover focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent focus-visible:ring-offset-2 focus-visible:ring-offset-surface-panel motion-reduce:active:translate-y-0`,onClick:a,children:[o,l,u]}),t[10]=a,t[11]=o,t[12]=l,t[13]=d):d=t[13],d}function X(e){let t=(0,W.c)(40),{onChoose:n,onChooseLocalBrowser:r,onClose:i}=e,a=o(ye),p;t[0]===a?p=t[1]:(p=s(a),t[0]=a,t[1]=p);let m=p.endpointToolsSettings.deviceAccess,h;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(h=(0,K.jsx)(c,{className:S(`xopc-dialog-overlay fixed inset-0 bg-scrim backdrop-blur-[1px]`,ne)}),t[2]=h):h=t[2];let g;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(g=S(`xopc-dialog-content fixed left-1/2 top-1/2 flex h-[min(28rem,calc(100dvh-2rem))] w-[min(40rem,calc(100vw-2rem))] -translate-x-1/2 -translate-y-1/2 flex-col overflow-hidden rounded-xl border border-edge bg-surface-overlay`,te),t[3]=g):g=t[3];let _;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(_=(0,K.jsx)(`span`,{className:`text-lg font-semibold tracking-tight text-fg`,children:`xopc`}),t[4]=_):_=t[4];let v;t[5]===Symbol.for(`react.memo_cache_sentinel`)?(v=(0,K.jsx)(ee,{className:`size-4`}),t[5]=v):v=t[5];let C;t[6]!==m.cancel||t[7]!==i?(C=(0,K.jsxs)(`header`,{className:`flex shrink-0 items-center justify-between border-b border-edge-subtle px-6 py-3`,children:[_,(0,K.jsx)(`button`,{type:`button`,className:`flex size-10 items-center justify-center rounded-lg text-fg-muted hover:bg-surface-hover`,"aria-label":m.cancel,onClick:i,children:v})]}),t[6]=m.cancel,t[7]=i,t[8]=C):C=t[8];let w;t[9]===m.chooseTitle?w=t[10]:(w=(0,K.jsx)(f,{className:`text-lg font-semibold tracking-tight text-fg sm:text-xl`,children:m.chooseTitle}),t[9]=m.chooseTitle,t[10]=w);let T;t[11]===m.chooseHint?T=t[12]:(T=(0,K.jsx)(l,{className:`mt-1.5 text-sm leading-6 text-fg-muted`,children:m.chooseHint}),t[11]=m.chooseHint,t[12]=T);let E;t[13]!==m.localBrowserHint||t[14]!==m.localBrowserTitle||t[15]!==r?(E=(0,K.jsx)(Y,{icon:y,title:m.localBrowserTitle,hint:m.localBrowserHint,onClick:r}),t[13]=m.localBrowserHint,t[14]=m.localBrowserTitle,t[15]=r,t[16]=E):E=t[16];let D;t[17]===n?D=t[18]:(D=()=>n(`mobile`),t[17]=n,t[18]=D);let O;t[19]!==m.mobileHint||t[20]!==m.mobileTitle||t[21]!==D?(O=(0,K.jsx)(Y,{icon:x,title:m.mobileTitle,hint:m.mobileHint,onClick:D}),t[19]=m.mobileHint,t[20]=m.mobileTitle,t[21]=D,t[22]=O):O=t[22];let k;t[23]===n?k=t[24]:(k=()=>n(`browser`),t[23]=n,t[24]=k);let A;t[25]!==m.remoteBrowserHint||t[26]!==m.remoteBrowserTitle||t[27]!==k?(A=(0,K.jsx)(Y,{icon:b,title:m.remoteBrowserTitle,hint:m.remoteBrowserHint,onClick:k}),t[25]=m.remoteBrowserHint,t[26]=m.remoteBrowserTitle,t[27]=k,t[28]=A):A=t[28];let j;t[29]!==O||t[30]!==A||t[31]!==E?(j=(0,K.jsxs)(`div`,{className:`mt-5 flex flex-col gap-2.5`,children:[E,O,A]}),t[29]=O,t[30]=A,t[31]=E,t[32]=j):j=t[32];let M;t[33]!==j||t[34]!==w||t[35]!==T?(M=(0,K.jsxs)(`div`,{className:`min-h-0 flex-1 overflow-y-auto px-5 py-6 sm:px-8`,children:[w,T,j]}),t[33]=j,t[34]=w,t[35]=T,t[36]=M):M=t[36];let N;return t[37]!==M||t[38]!==C?(N=(0,K.jsxs)(u,{children:[h,(0,K.jsxs)(d,{className:g,children:[C,M]})]}),t[37]=M,t[38]=C,t[39]=N):N=t[39],N}function ye(e){return e.language}function Z({targetKind:e,onClose:t,onPaired:n}){let r=o(e=>e.language),i=s(r),a=i.endpointToolsSettings.deviceAccess,p=a.flow,[y,b]=(0,G.useState)(e===`mobile`),[x,re]=(0,G.useState)(!1),P=w(y?`device-pairing-readiness`:null,ae,{refreshInterval:1500}),[F,ie]=(0,G.useState)(),[I,L]=(0,G.useState)(null),[R,z]=(0,G.useState)(!1),[se,ue]=(0,G.useState)(Date.now()),[B,fe]=(0,G.useState)(null),V=(0,G.useRef)(!0),H=(0,G.useRef)(null),U=(0,G.useRef)(!1),me=(0,G.useRef)(!1),W=w(F?[`device-pairing-setup`,F.id]:null,()=>he(F.id),{refreshInterval:1500}),q=W.data?.request,J=q?.status===`completed`,Y=J&&q.connectedAt!==void 0,X=w(Y&&window.electronAPI?.system?`system-behavior`:null,()=>window.electronAPI.system.getBehavior()),ye=F?.targetKind===`mobile`?F.universalLink:``,Z=M(()=>_e(ye),[ye],{enabled:!!ye,initial:null,errorData:null}),be=r===`zh`?`https://xopc.ai/zh#download`:`https://xopc.ai/en#download`,xe=r===`zh`?`https://xopcai.github.io/xopc/zh/browser-extension`:`https://xopcai.github.io/xopc/browser-extension`,Se=M(()=>_e(be),[be],{enabled:x&&e===`mobile`,initial:null,errorData:null});(0,G.useEffect)(()=>{V.current=!0;let e=setInterval(()=>ue(Date.now()),1e3);return()=>{V.current=!1,clearInterval(e),H.current&&pe(H.current).catch(()=>{})}},[]);let Ce=(0,G.useCallback)(async()=>{if(!U.current){U.current=!0,z(!0),L(null);try{H.current&&await pe(H.current),H.current=null,ie(void 0);let t=await de(e);if(t.kind===`ready`){if(!V.current){await pe(t.setup.id);return}H.current=t.setup.id,ie(t.setup)}else await P.mutate()}catch{V.current&&L(`create`)}finally{U.current=!1,V.current&&z(!1)}}},[P,e]);(0,G.useEffect)(()=>{P.data?.ready&&!F&&I!==`create`&&!U.current&&Ce()},[P.data,F,I,Ce]),(0,G.useEffect)(()=>{Y&&!me.current&&(me.current=!0,n?.())},[Y,n]);let we=async e=>{if(q){z(!0),L(null);try{await le(q,e),await W.mutate()}catch{L(`decision`),await W.mutate()}finally{V.current&&z(!1)}}},Te=(0,G.useRef)(0);(0,G.useEffect)(()=>{W.data&&(Te.current=W.data.serverTime-Date.now())},[W.data]);let Q=se+Te.current,Ee=F&&Q>=F.expiresAt&&!q,De=q&&[`expired`,`rejected`,`cancelled`].includes(q.status),Oe=F?F.expiresAt-Q<6e4:!1,ke=F?Oe?`${Math.max(0,Math.ceil((F.expiresAt-Q)/1e3))}s`:p.valid:``,$=e===`mobile`?{connect:a.mobileScan,connectHint:a.mobileScanHint,allowTitle:a.mobileAllowTitle,success:a.mobileSuccess,successHint:a.mobileSuccessHint}:{connect:a.browserConnect,connectHint:a.browserConnectHint,allowTitle:a.browserAllowTitle,success:a.browserSuccess,successHint:a.browserSuccessHint},Ae=a.browserPrepareTitle,je=a.browserPrepareHint,Me=y?Y?$.success:q?.status===`pending`?$.allowTitle:J||q?.status===`approved`?p.waiting:F?$.connect:p.title:Ae,Ne=I===`create`?p.createFailed:I===`decision`?p.decisionFailed:I===`background`?p.backgroundFailed:I===`download`?a.browserDownloadFailed:null,Pe=async()=>{z(!0),L(null);try{await ce()}catch{L(`download`)}finally{V.current&&z(!1)}};return(0,K.jsxs)(u,{children:[(0,K.jsx)(c,{className:S(`xopc-dialog-overlay fixed inset-0 bg-scrim backdrop-blur-[1px]`,ne)}),(0,K.jsxs)(d,{className:S(`xopc-dialog-content fixed left-1/2 top-1/2 flex h-[min(600px,calc(100dvh-48px))] w-[min(560px,calc(100vw-32px))] -translate-x-1/2 -translate-y-1/2 flex-col overflow-hidden rounded-xl border border-edge bg-surface-overlay`,te),children:[(0,K.jsxs)(`header`,{className:`flex shrink-0 items-center justify-between border-b border-edge-subtle px-6 py-3`,children:[(0,K.jsx)(`span`,{className:`text-lg font-semibold tracking-tight text-fg`,children:`xopc`}),(0,K.jsxs)(`div`,{className:`flex items-center gap-2`,children:[e===`mobile`?(0,K.jsxs)(O,{open:x,onOpenChange:re,children:[(0,K.jsx)(k,{asChild:!0,children:(0,K.jsxs)(T,{variant:`ghost`,className:`min-h-10`,children:[(0,K.jsx)(_,{className:`size-4`,"aria-hidden":`true`}),a.mobileDownloadAction]})}),(0,K.jsx)(E,{children:(0,K.jsxs)(D,{align:`end`,sideOffset:8,"aria-label":a.mobileDownloadAction,className:S(`w-[min(26rem,calc(100vw-2rem))] max-h-[var(--radix-popover-content-available-height)] overflow-y-auto rounded-xl border border-edge bg-surface-overlay p-6 sm:p-7 shadow-elevated`,A),children:[(0,K.jsx)(`p`,{className:`text-base font-semibold text-fg`,children:a.mobileDownloadAction}),(0,K.jsx)(`div`,{className:`my-6 flex justify-center`,children:Se.data?(0,K.jsx)(`img`,{src:Se.data,alt:a.mobileDownloadQrAlt,width:216,height:216,className:`size-[216px] max-w-full rounded-lg bg-white`}):Se.error?(0,K.jsx)(`p`,{role:`status`,className:`text-sm text-warning`,children:p.qrFailed}):(0,K.jsx)(C,{className:`size-[216px] max-w-full`})}),(0,K.jsx)(`p`,{className:`mt-3 text-sm leading-6 text-fg-muted`,children:a.mobileDownloadHint}),(0,K.jsxs)(T,{variant:`secondary`,className:`mt-5 w-full`,onClick:()=>void j(be),children:[(0,K.jsx)(v,{className:`size-4`,"aria-hidden":`true`}),a.mobileDownload]})]})})]}):null,(0,K.jsx)(`button`,{type:`button`,className:`flex size-10 items-center justify-center rounded-lg text-fg-muted hover:bg-surface-hover focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,"aria-label":p.cancel,onClick:t,children:(0,K.jsx)(ee,{className:`size-4`,"aria-hidden":`true`})})]})]}),(0,K.jsxs)(`div`,{className:`flex min-h-0 flex-1 flex-col overflow-y-auto px-8 py-7`,children:[Y?(0,K.jsx)(h,{className:`mb-5 size-7 text-success`}):null,(0,K.jsx)(f,{className:`text-xl font-semibold tracking-tight text-fg`,children:Me}),(0,K.jsx)(l,{className:`mt-2 text-sm leading-relaxed text-fg-muted`,children:y?Y?$.successHint:J?p.waitingForDevice:q?q.displayName:F?$.connectHint:p.intro:je}),Ne?(0,K.jsx)(`p`,{role:`alert`,className:`mt-4 text-sm text-danger`,children:Ne}):null,y&&P.error?(0,K.jsx)(`p`,{role:`alert`,className:`mt-4 text-sm text-danger`,children:p.readinessFailed}):null,y&&W.error?(0,K.jsx)(`p`,{role:`status`,className:`mt-4 text-sm text-warning`,children:p.statusUnavailable}):null,y?P.data?Y?(0,K.jsxs)(K.Fragment,{children:[X.data?(0,K.jsxs)(`label`,{className:`mt-8 flex items-center justify-between gap-4 border-y border-edge-subtle py-5 text-sm text-fg`,children:[a.background,(0,K.jsx)(`input`,{type:`checkbox`,role:`switch`,"aria-checked":X.data.runInBackground??!1,disabled:!X.data.backgroundSupported,checked:X.data.runInBackground??!1,className:`size-5 accent-accent`,onChange:e=>{window.electronAPI.system.setBehavior({runInBackground:e.target.checked}).then(e=>X.mutate(e.behavior)).catch(()=>L(`background`))}})]}):null,(0,K.jsx)(`p`,{className:`mt-4 text-xs text-fg-muted`,children:a.sleep})]}):De||Ee?(0,K.jsxs)(`div`,{className:`mt-10 space-y-5`,children:[(0,K.jsx)(`p`,{className:`text-sm text-fg-muted`,children:Ee||q?.status===`expired`?p.expired:p.declined}),(0,K.jsx)(T,{variant:`primary`,onClick:()=>void Ce(),disabled:R,children:p.refresh})]}):q?(0,K.jsxs)(K.Fragment,{children:[(0,K.jsx)(`p`,{className:`mt-2 text-xs text-fg-muted`,children:p.scope}),(0,K.jsxs)(`p`,{className:`mt-10 font-mono text-4xl tracking-[0.16em] text-fg`,"aria-live":`polite`,children:[q.confirmationCode.slice(0,3),` `,q.confirmationCode.slice(3)]}),(0,K.jsx)(`p`,{className:`mt-3 text-xs text-fg-muted`,children:p.compare}),(0,K.jsxs)(`details`,{className:`mt-6 text-xs text-fg-muted`,children:[(0,K.jsx)(`summary`,{className:`cursor-pointer py-2`,children:p.access}),(0,K.jsx)(`p`,{children:p.accessHint})]})]}):F?.targetKind===`mobile`?(0,K.jsxs)(K.Fragment,{children:[(0,K.jsxs)(`div`,{className:`my-6 flex flex-col items-center`,children:[(0,K.jsx)(`div`,{className:`rounded-[1.75rem] border border-edge bg-surface-hover/55 p-2.5 shadow-surface`,children:(0,K.jsx)(`div`,{className:`rounded-[1.25rem] bg-white p-2 shadow-sm ring-1 ring-black/5`,children:Z.data?(0,K.jsx)(`img`,{src:Z.data,alt:a.qrAlt,width:240,height:240,className:`size-[240px] max-w-full rounded-xl bg-white`}):Z.error?null:(0,K.jsx)(C,{className:`size-[240px] rounded-xl`})})}),Z.error?null:(0,K.jsxs)(`p`,{className:S(`mt-4 inline-flex min-h-8 items-center gap-1.5 rounded-full px-3 text-xs font-medium`,Oe?`bg-warning-soft text-warning`:`bg-surface-hover text-fg-muted`),"aria-live":`polite`,children:[(0,K.jsx)(g,{className:`size-3.5`,"aria-hidden":`true`}),ke]})]}),Z.error?(0,K.jsx)(`p`,{role:`status`,className:`text-center text-sm text-warning`,children:p.qrFailed}):null,Z.error?(0,K.jsx)(`div`,{className:`mt-5`,children:(0,K.jsx)(N,{text:F.universalLink,labels:{copy:a.copy,copied:a.copied,copyFailed:i.clipboard.copyFailed}})}):(0,K.jsxs)(`details`,{className:`group mx-auto mt-1 w-full max-w-sm rounded-xl border border-edge bg-surface-panel text-xs text-fg-muted`,children:[(0,K.jsxs)(`summary`,{className:`flex min-h-11 cursor-pointer list-none items-center justify-between gap-3 rounded-xl px-3.5 transition-colors hover:bg-surface-hover focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent [&::-webkit-details-marker]:hidden`,children:[(0,K.jsx)(`span`,{children:p.fallback}),(0,K.jsx)(m,{className:`size-3.5 shrink-0 transition-transform group-open:rotate-90`,"aria-hidden":`true`})]}),(0,K.jsx)(`div`,{className:`border-t border-edge-subtle p-3`,children:(0,K.jsx)(N,{text:F.universalLink,labels:{copy:a.copy,copied:a.copied,copyFailed:i.clipboard.copyFailed}})})]})]}):F?(0,K.jsxs)(K.Fragment,{children:[(0,K.jsxs)(`ol`,{className:`mt-7 space-y-2 text-sm leading-6 text-fg-muted`,children:[(0,K.jsxs)(`li`,{children:[(0,K.jsx)(`span`,{className:`mr-2 text-fg-subtle`,children:`1.`}),a.browserConnectStep1]}),(0,K.jsxs)(`li`,{children:[(0,K.jsx)(`span`,{className:`mr-2 text-fg-subtle`,children:`2.`}),a.browserConnectStep2]}),(0,K.jsxs)(`li`,{children:[(0,K.jsx)(`span`,{className:`mr-2 text-fg-subtle`,children:`3.`}),a.browserConnectStep3]})]}),(0,K.jsx)(`div`,{className:`mt-6`,children:(0,K.jsx)(N,{text:F.browserInvitation,labels:{copy:a.copy,copied:a.copied,copyFailed:i.clipboard.copyFailed}})}),(0,K.jsx)(`p`,{className:`mt-3 text-center text-xs text-fg-muted`,children:F.expiresAt-Q<6e4?`${Math.max(0,Math.ceil((F.expiresAt-Q)/1e3))}s`:p.valid})]}):P.data.ready?(0,K.jsx)(`div`,{className:`mt-8`,children:(0,K.jsx)(C,{className:`mx-auto size-[216px]`})}):(0,K.jsxs)(`div`,{className:`mt-6 flex flex-1 flex-col`,children:[B===`tailscale`?(0,K.jsx)(oe,{embedded:!0}):B===`https`?(0,K.jsx)(ge,{}):B===`choices`?(0,K.jsxs)(`div`,{className:`space-y-3`,children:[(0,K.jsx)(T,{variant:`secondary`,className:`w-full`,onClick:()=>fe(`tailscale`),children:a.useTailscale}),(0,K.jsx)(T,{variant:`secondary`,className:`w-full`,onClick:()=>fe(`https`),children:a.useOwnHttps})]}):(0,K.jsx)(ve,{}),(0,K.jsx)(T,{variant:`ghost`,className:`mt-3 w-full`,onClick:()=>fe(B?null:`choices`),children:B?p.back:p.existing})]}):(0,K.jsxs)(`div`,{className:`mt-8 space-y-4`,children:[(0,K.jsx)(C,{className:`h-5 w-3/4`}),(0,K.jsx)(C,{className:`h-40 w-full`})]}):(0,K.jsxs)(`div`,{className:`mt-7`,children:[(0,K.jsxs)(T,{variant:`secondary`,className:`w-full`,disabled:R,onClick:()=>void Pe(),children:[(0,K.jsx)(_,{className:`size-4`}),a.browserDownload]}),(0,K.jsxs)(`ol`,{className:`mt-5 space-y-3 text-sm leading-6 text-fg-muted`,children:[(0,K.jsxs)(`li`,{children:[(0,K.jsx)(`span`,{className:`mr-2 text-fg-subtle`,children:`1.`}),a.browserInstallStep1]}),(0,K.jsxs)(`li`,{children:[(0,K.jsx)(`span`,{className:`mr-2 text-fg-subtle`,children:`2.`}),a.browserInstallStep2]}),(0,K.jsxs)(`li`,{children:[(0,K.jsx)(`span`,{className:`mr-2 text-fg-subtle`,children:`3.`}),a.browserInstallStep3]})]}),(0,K.jsxs)(`button`,{type:`button`,className:`mt-5 inline-flex items-center gap-1 text-xs text-accent hover:underline`,onClick:()=>void j(xe),children:[a.browserInstallHelp,(0,K.jsx)(v,{className:`size-3`})]})]})]}),!y||P.error||Y||q?.status===`pending`||I===`create`||I===`decision`?(0,K.jsx)(`footer`,{className:`shrink-0 px-8 pb-6`,children:y?Y?(0,K.jsx)(T,{className:`w-full`,variant:`primary`,onClick:t,children:p.done}):q?.status===`pending`?(0,K.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,K.jsx)(T,{className:`w-full`,variant:`primary`,disabled:R,onClick:()=>void we(`approve`),children:p.allow}),(0,K.jsx)(T,{className:`w-full`,variant:`ghost`,disabled:R,onClick:()=>void we(`reject`),children:p.cancel})]}):P.error?(0,K.jsx)(T,{className:`w-full`,variant:`primary`,onClick:()=>void P.mutate(),children:p.retry}):(0,K.jsx)(T,{className:`w-full`,variant:`primary`,disabled:R,onClick:()=>void Ce(),children:p.retry}):(0,K.jsx)(T,{className:`w-full`,variant:`primary`,onClick:()=>{L(null),b(!0)},children:a.browserReady})}):null]})]})}export{q as n,J as t};
|
|
1
|
+
import{i as e,n as t}from"./rolldown-runtime-aKtaBQYM.js";import{a as n,n as r,t as i}from"./vendor-react-BOUWij0V.js";import{u as a}from"./chunk-KS7C4IRE-BPb7KheU.js";import{n as o}from"./locale-store-B4o4aDCg.js";import{t as s}from"./messages-hlOsXkQ7.js";import{a as c,i as l,o as u,r as d,s as f,t as p}from"./dist-CY7CS_D3.js";import{t as m}from"./chevron-right-BweFrslA.js";import{t as h}from"./circle-check-C23XjkUj.js";import{t as g}from"./clock-3-DnrAnuyZ.js";import{t as _}from"./download-Dk-ZjtO6.js";import{t as v}from"./external-link-DjqjBmc3.js";import{t as y}from"./laptop-CI3hBVrl.js";import{t as b}from"./panel-right-CFGrHTsD.js";import{t as x}from"./smartphone-DSSsQFqA.js";import{t as ee}from"./x-B_N4OPjy.js";import{t as S}from"./cn-0WouolD0.js";import{t as C}from"./skeleton-DzdOeGYz.js";import{i as w}from"./vendor-swr-CdRzEUwF.js";import{t as T}from"./button-ChmVQg9O.js";import{a as E,i as D,o as O,s as k}from"./dist-GJ8-1PAx.js";import{a as A,i as te,o as ne}from"./settings-shell-dialog-layer-BU3UuiJr.js";import{n as j}from"./app-link-CauYDM-y.js";import{t as M}from"./use-async-resource-BHFGZCY2.js";import{t as N}from"./copy-text-row-BnSoJ0FX.js";import{a as re,n as P,r as F}from"./oauth-api-CW1XhW42.js";import{n as ie,r as I,t as L}from"./oauth-authorization-window-o6URRos4.js";import{_ as ae,a as R,b as oe,d as z,f as se,g as ce,h as le,i as ue,l as B,m as de,n as fe,p as pe,r as V,s as H,t as U,u as me,v as he,y as ge}from"./tunnel-api-D713CJ9R.js";import{t as _e}from"./mobile-pair-qr-CuIbmw5x.js";var W=r(),G=e(n(),1),K=i();function ve(){let e=s(o(e=>e.language)),t=e.endpointToolsSettings.deviceAccess.flow,n=e.tunnelSettings,{data:r,error:i,mutate:a}=w(`tunnel-status`,fe,{refreshInterval:1500}),[c,l]=(0,G.useState)(!1),[u,d]=(0,G.useState)(!1),[f,p]=(0,G.useState)(!0),[m,h]=(0,G.useState)(`idle`),[g,_]=(0,G.useState)(null),[y,b]=(0,G.useState)(``),[x,ee]=(0,G.useState)(``),S=(0,G.useRef)(!0);(0,G.useEffect)(()=>(S.current=!0,()=>{S.current=!1}),[]),(0,G.useEffect)(()=>{r?.state===`connected`&&(_(null),b(``))},[r?.state]);let E=g?g===`registration-rejected`:r?.state===`error`&&se(Error(r.lastError??``)),D=g?g===`recovery-rejected`:r?.state===`error`&&z(Error(r.lastError??``)),O=async()=>{if(!r)return;if(r.consentRequired&&!c){d(!0);return}let e=E||!r.registrationSecret?.configured,t=e?I():null,n,i=!1;_(null),b(``);try{if(r.consentRequired&&await R(),e){h(`provisioning`),E&&await V({registrationSecret:null});let e=!1;try{await ue()}catch(t){if(!me(t))throw t;e=!0}if(e){h(`authorizing`);let e=sessionStorage.getItem(`device-pairing-oauth`),r=e?JSON.parse(e):null;n=r&&r.expiresAt>Date.now()?r.sessionId:(await re(`xopc-tunnel`)).sessionId,sessionStorage.setItem(`device-pairing-oauth`,JSON.stringify({sessionId:n,expiresAt:r&&r.expiresAt>Date.now()?r.expiresAt:Date.now()+5*6e4}));let a=``,o=Date.now()+5*6e4,s=!1;for(;S.current&&Date.now()<o;){let e=await F(n);if(e.authUrl&&e.authUrl!==a&&(a=e.authUrl,await ie(a,t)||ee(a)),e.status===`completed`){s=!0,i=!0;break}if(e.status===`failed`||e.status===`cancelled`)throw Error(`Authorization cancelled`);await new Promise(e=>setTimeout(e,1e3))}if(!S.current)return;if(!s)throw Error(`Authorization expired`);await ue()}await a()}if(!S.current)return;h(`starting`),await H(D?{recoverActiveLease:!0}:void 0),f&&await V({autoStart:!0}),await a(),i=!0}catch(e){i=!0,S.current&&(_(B(e)===`tunnel_key_limit_reached`?`key-limit`:se(e)?`registration-rejected`:z(e)?`recovery-rejected`:`failed`),b(e instanceof Error?e.message:``))}finally{L(t),i&&(sessionStorage.removeItem(`device-pairing-oauth`),n&&P(n).catch(()=>{})),S.current&&(h(`idle`),ee(``))}};if(!r&&!i)return(0,K.jsxs)(`div`,{className:`space-y-5`,children:[(0,K.jsx)(C,{className:`h-5 w-4/5`}),(0,K.jsx)(C,{className:`h-24 w-full`})]});let k=m===`provisioning`||m===`starting`||r?.state===`connecting`||r?.state===`reconnecting`,A=m===`idle`&&!k&&(g||i||r?.state===`error`),te=y||(i instanceof Error?i.message:``)||(r?.state===`error`?r.lastError:``);return(0,K.jsxs)(`div`,{className:`flex flex-col`,children:[(0,K.jsx)(`p`,{className:`text-sm leading-relaxed text-fg-muted`,children:k?t.preparingHint:m===`authorizing`?t.authorizing:t.enableHint}),x&&m===`authorizing`?(0,K.jsx)(`a`,{href:x,target:`_blank`,rel:`noopener noreferrer`,className:`mt-4 inline-flex min-h-11 items-center text-sm text-accent`,children:t.openAuthorization}):null,k?(0,K.jsxs)(`div`,{className:`mt-8 space-y-3`,"aria-label":t.preparing,children:[(0,K.jsx)(C,{className:`h-2 w-full`}),(0,K.jsx)(`p`,{className:`text-sm text-fg-muted`,children:t.preparing})]}):null,(u||r?.consentRequired)&&m===`idle`?(0,K.jsxs)(`div`,{className:`mt-6 space-y-4`,children:[(0,K.jsxs)(`details`,{open:u,className:`text-sm text-fg-muted`,children:[(0,K.jsx)(`summary`,{className:`cursor-pointer py-2`,children:t.details}),(0,K.jsx)(`p`,{className:`mt-2`,children:n.consentIntro}),(0,K.jsx)(`ul`,{className:`mt-3 list-disc space-y-2 pl-5`,children:[n.consentBullet1,n.consentBullet2,n.consentBullet3].map(e=>(0,K.jsx)(`li`,{children:e},e))})]}),(0,K.jsxs)(`label`,{className:`flex items-start gap-3 text-sm text-fg`,children:[(0,K.jsx)(`input`,{type:`checkbox`,checked:c,onChange:e=>l(e.target.checked),className:`mt-1 size-4 accent-accent`}),n.consentCheckbox]})]}):null,A&&g===`key-limit`?(0,K.jsxs)(`div`,{role:`alert`,className:`mt-4 rounded-lg border border-warning/30 bg-warning/5 p-4`,children:[(0,K.jsx)(`p`,{className:`text-sm font-medium text-fg`,children:t.routeKeyLimitTitle}),(0,K.jsx)(`p`,{className:`mt-1 text-xs leading-5 text-fg-muted`,children:t.routeKeyLimitHint}),(0,K.jsxs)(T,{variant:`secondary`,className:`mt-3`,onClick:()=>void j(U),children:[t.manageTunnelKeys,(0,K.jsx)(v,{className:`size-3`})]})]}):A?(0,K.jsxs)(`div`,{role:`alert`,className:`mt-4 text-sm text-danger`,children:[(0,K.jsx)(`p`,{children:i&&!r?t.readinessFailed:E?t.routeAuthorizationRequired:D?t.routeRecoveryRequired:t.routeSetupFailed}),te?(0,K.jsxs)(`details`,{className:`mt-2 text-xs text-fg-muted`,children:[(0,K.jsx)(`summary`,{className:`cursor-pointer py-2`,children:t.details}),(0,K.jsx)(`p`,{className:`break-words whitespace-pre-wrap`,children:te})]}):null]}):null,(0,K.jsxs)(`label`,{className:`my-5 flex items-center gap-3 text-sm text-fg-muted`,children:[(0,K.jsx)(`input`,{type:`checkbox`,checked:f,disabled:m!==`idle`,onChange:e=>p(e.target.checked),className:`size-4 accent-accent`}),t.autoStart]}),i&&!r?(0,K.jsx)(T,{className:`w-full`,variant:`primary`,onClick:()=>void a().catch(()=>{}),children:t.retry}):(0,K.jsx)(T,{className:`w-full`,variant:`primary`,disabled:!r||m!==`idle`||k||u&&!c,onClick:()=>void O(),children:m===`authorizing`?t.authorizing:k?t.preparing:E?t.authorize:D?t.recoverRoute:A?t.retry:t.enable})]})}var q=t({DevicePairingWizard:()=>J});function J(e){let t=(0,W.c)(16),{open:n,onOpenChange:r,onPaired:i,targetKind:o}=e,s=a(),[c,l]=(0,G.useState)(o),u,d;t[0]===o?(u=t[1],d=t[2]):(u=()=>{l(o)},d=[o],t[0]=o,t[1]=u,t[2]=d),(0,G.useEffect)(u,d);let f;t[3]!==r||t[4]!==o?(f=e=>{e||l(o),r(e)},t[3]=r,t[4]=o,t[5]=f):f=t[5];let m=f,h;t[6]!==m||t[7]!==s||t[8]!==i||t[9]!==n||t[10]!==c?(h=n?c?(0,K.jsx)(Z,{targetKind:c,onClose:()=>m(!1),onPaired:i}):(0,K.jsx)(X,{onChoose:l,onChooseLocalBrowser:()=>{m(!1),s(`/settings/agent-browser?driver=extension`)},onClose:()=>m(!1)}):null,t[6]=m,t[7]=s,t[8]=i,t[9]=n,t[10]=c,t[11]=h):h=t[11];let g;return t[12]!==m||t[13]!==n||t[14]!==h?(g=(0,K.jsx)(p,{open:n,onOpenChange:m,children:h}),t[12]=m,t[13]=n,t[14]=h,t[15]=g):g=t[15],g}function Y(e){let t=(0,W.c)(14),{icon:n,title:r,hint:i,onClick:a}=e,o;t[0]===n?o=t[1]:(o=(0,K.jsx)(`span`,{className:`flex size-10 shrink-0 items-center justify-center rounded-xl bg-accent-soft text-accent-fg`,children:(0,K.jsx)(n,{className:`size-5`,"aria-hidden":`true`})}),t[0]=n,t[1]=o);let s;t[2]===r?s=t[3]:(s=(0,K.jsx)(`span`,{className:`block text-sm font-semibold text-fg`,children:r}),t[2]=r,t[3]=s);let c;t[4]===i?c=t[5]:(c=(0,K.jsx)(`span`,{className:`mt-0.5 block text-xs leading-5 text-fg-muted`,children:i}),t[4]=i,t[5]=c);let l;t[6]!==s||t[7]!==c?(l=(0,K.jsxs)(`span`,{className:`min-w-0 flex-1`,children:[s,c]}),t[6]=s,t[7]=c,t[8]=l):l=t[8];let u;t[9]===Symbol.for(`react.memo_cache_sentinel`)?(u=(0,K.jsx)(m,{className:`size-4 shrink-0 text-fg-disabled transition-transform group-hover:translate-x-0.5 group-hover:text-fg-muted`,"aria-hidden":`true`}),t[9]=u):u=t[9];let d;return t[10]!==a||t[11]!==o||t[12]!==l?(d=(0,K.jsxs)(`button`,{type:`button`,className:`group flex min-h-18 w-full cursor-pointer items-center gap-4 rounded-xl border border-edge bg-surface-panel px-4 py-3.5 text-left shadow-surface transition-[background-color,border-color,box-shadow,transform] hover:border-edge-strong hover:bg-surface-active hover:shadow-elevated active:translate-y-px active:bg-surface-hover focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent focus-visible:ring-offset-2 focus-visible:ring-offset-surface-panel motion-reduce:active:translate-y-0`,onClick:a,children:[o,l,u]}),t[10]=a,t[11]=o,t[12]=l,t[13]=d):d=t[13],d}function X(e){let t=(0,W.c)(40),{onChoose:n,onChooseLocalBrowser:r,onClose:i}=e,a=o(ye),p;t[0]===a?p=t[1]:(p=s(a),t[0]=a,t[1]=p);let m=p.endpointToolsSettings.deviceAccess,h;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(h=(0,K.jsx)(c,{className:S(`xopc-dialog-overlay fixed inset-0 bg-scrim backdrop-blur-[1px]`,ne)}),t[2]=h):h=t[2];let g;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(g=S(`xopc-dialog-content fixed left-1/2 top-1/2 flex h-[min(28rem,calc(100dvh-2rem))] w-[min(40rem,calc(100vw-2rem))] -translate-x-1/2 -translate-y-1/2 flex-col overflow-hidden rounded-xl border border-edge bg-surface-overlay`,te),t[3]=g):g=t[3];let _;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(_=(0,K.jsx)(`span`,{className:`text-lg font-semibold tracking-tight text-fg`,children:`xopc`}),t[4]=_):_=t[4];let v;t[5]===Symbol.for(`react.memo_cache_sentinel`)?(v=(0,K.jsx)(ee,{className:`size-4`}),t[5]=v):v=t[5];let C;t[6]!==m.cancel||t[7]!==i?(C=(0,K.jsxs)(`header`,{className:`flex shrink-0 items-center justify-between border-b border-edge-subtle px-6 py-3`,children:[_,(0,K.jsx)(`button`,{type:`button`,className:`flex size-10 items-center justify-center rounded-lg text-fg-muted hover:bg-surface-hover`,"aria-label":m.cancel,onClick:i,children:v})]}),t[6]=m.cancel,t[7]=i,t[8]=C):C=t[8];let w;t[9]===m.chooseTitle?w=t[10]:(w=(0,K.jsx)(f,{className:`text-lg font-semibold tracking-tight text-fg sm:text-xl`,children:m.chooseTitle}),t[9]=m.chooseTitle,t[10]=w);let T;t[11]===m.chooseHint?T=t[12]:(T=(0,K.jsx)(l,{className:`mt-1.5 text-sm leading-6 text-fg-muted`,children:m.chooseHint}),t[11]=m.chooseHint,t[12]=T);let E;t[13]!==m.localBrowserHint||t[14]!==m.localBrowserTitle||t[15]!==r?(E=(0,K.jsx)(Y,{icon:y,title:m.localBrowserTitle,hint:m.localBrowserHint,onClick:r}),t[13]=m.localBrowserHint,t[14]=m.localBrowserTitle,t[15]=r,t[16]=E):E=t[16];let D;t[17]===n?D=t[18]:(D=()=>n(`mobile`),t[17]=n,t[18]=D);let O;t[19]!==m.mobileHint||t[20]!==m.mobileTitle||t[21]!==D?(O=(0,K.jsx)(Y,{icon:x,title:m.mobileTitle,hint:m.mobileHint,onClick:D}),t[19]=m.mobileHint,t[20]=m.mobileTitle,t[21]=D,t[22]=O):O=t[22];let k;t[23]===n?k=t[24]:(k=()=>n(`browser`),t[23]=n,t[24]=k);let A;t[25]!==m.remoteBrowserHint||t[26]!==m.remoteBrowserTitle||t[27]!==k?(A=(0,K.jsx)(Y,{icon:b,title:m.remoteBrowserTitle,hint:m.remoteBrowserHint,onClick:k}),t[25]=m.remoteBrowserHint,t[26]=m.remoteBrowserTitle,t[27]=k,t[28]=A):A=t[28];let j;t[29]!==O||t[30]!==A||t[31]!==E?(j=(0,K.jsxs)(`div`,{className:`mt-5 flex flex-col gap-2.5`,children:[E,O,A]}),t[29]=O,t[30]=A,t[31]=E,t[32]=j):j=t[32];let M;t[33]!==j||t[34]!==w||t[35]!==T?(M=(0,K.jsxs)(`div`,{className:`min-h-0 flex-1 overflow-y-auto px-5 py-6 sm:px-8`,children:[w,T,j]}),t[33]=j,t[34]=w,t[35]=T,t[36]=M):M=t[36];let N;return t[37]!==M||t[38]!==C?(N=(0,K.jsxs)(u,{children:[h,(0,K.jsxs)(d,{className:g,children:[C,M]})]}),t[37]=M,t[38]=C,t[39]=N):N=t[39],N}function ye(e){return e.language}function Z({targetKind:e,onClose:t,onPaired:n}){let r=o(e=>e.language),i=s(r),a=i.endpointToolsSettings.deviceAccess,p=a.flow,[y,b]=(0,G.useState)(e===`mobile`),[x,re]=(0,G.useState)(!1),P=w(y?`device-pairing-readiness`:null,ae,{refreshInterval:1500}),[F,ie]=(0,G.useState)(),[I,L]=(0,G.useState)(null),[R,z]=(0,G.useState)(!1),[se,ue]=(0,G.useState)(Date.now()),[B,fe]=(0,G.useState)(null),V=(0,G.useRef)(!0),H=(0,G.useRef)(null),U=(0,G.useRef)(!1),me=(0,G.useRef)(!1),W=w(F?[`device-pairing-setup`,F.id]:null,()=>he(F.id),{refreshInterval:1500}),q=W.data?.request,J=q?.status===`completed`,Y=J&&q.connectedAt!==void 0,X=w(Y&&window.electronAPI?.system?`system-behavior`:null,()=>window.electronAPI.system.getBehavior()),ye=F?.targetKind===`mobile`?F.universalLink:``,Z=M(()=>_e(ye),[ye],{enabled:!!ye,initial:null,errorData:null}),be=r===`zh`?`https://xopc.ai/zh#download`:`https://xopc.ai/en#download`,xe=r===`zh`?`https://xopcai.github.io/xopc/zh/browser-extension`:`https://xopcai.github.io/xopc/browser-extension`,Se=M(()=>_e(be),[be],{enabled:x&&e===`mobile`,initial:null,errorData:null});(0,G.useEffect)(()=>{V.current=!0;let e=setInterval(()=>ue(Date.now()),1e3);return()=>{V.current=!1,clearInterval(e),H.current&&pe(H.current).catch(()=>{})}},[]);let Ce=(0,G.useCallback)(async()=>{if(!U.current){U.current=!0,z(!0),L(null);try{H.current&&await pe(H.current),H.current=null,ie(void 0);let t=await de(e);if(t.kind===`ready`){if(!V.current){await pe(t.setup.id);return}H.current=t.setup.id,ie(t.setup)}else await P.mutate()}catch{V.current&&L(`create`)}finally{U.current=!1,V.current&&z(!1)}}},[P,e]);(0,G.useEffect)(()=>{P.data?.ready&&!F&&I!==`create`&&!U.current&&Ce()},[P.data,F,I,Ce]),(0,G.useEffect)(()=>{Y&&!me.current&&(me.current=!0,n?.())},[Y,n]);let we=async e=>{if(q){z(!0),L(null);try{await le(q,e),await W.mutate()}catch{L(`decision`),await W.mutate()}finally{V.current&&z(!1)}}},Te=(0,G.useRef)(0);(0,G.useEffect)(()=>{W.data&&(Te.current=W.data.serverTime-Date.now())},[W.data]);let Q=se+Te.current,Ee=F&&Q>=F.expiresAt&&!q,De=q&&[`expired`,`rejected`,`cancelled`].includes(q.status),Oe=F?F.expiresAt-Q<6e4:!1,ke=F?Oe?`${Math.max(0,Math.ceil((F.expiresAt-Q)/1e3))}s`:p.valid:``,$=e===`mobile`?{connect:a.mobileScan,connectHint:a.mobileScanHint,allowTitle:a.mobileAllowTitle,success:a.mobileSuccess,successHint:a.mobileSuccessHint}:{connect:a.browserConnect,connectHint:a.browserConnectHint,allowTitle:a.browserAllowTitle,success:a.browserSuccess,successHint:a.browserSuccessHint},Ae=a.browserPrepareTitle,je=a.browserPrepareHint,Me=y?Y?$.success:q?.status===`pending`?$.allowTitle:J||q?.status===`approved`?p.waiting:F?$.connect:p.title:Ae,Ne=I===`create`?p.createFailed:I===`decision`?p.decisionFailed:I===`background`?p.backgroundFailed:I===`download`?a.browserDownloadFailed:null,Pe=async()=>{z(!0),L(null);try{await ce()}catch{L(`download`)}finally{V.current&&z(!1)}};return(0,K.jsxs)(u,{children:[(0,K.jsx)(c,{className:S(`xopc-dialog-overlay fixed inset-0 bg-scrim backdrop-blur-[1px]`,ne)}),(0,K.jsxs)(d,{className:S(`xopc-dialog-content fixed left-1/2 top-1/2 flex h-[min(600px,calc(100dvh-48px))] w-[min(560px,calc(100vw-32px))] -translate-x-1/2 -translate-y-1/2 flex-col overflow-hidden rounded-xl border border-edge bg-surface-overlay`,te),children:[(0,K.jsxs)(`header`,{className:`flex shrink-0 items-center justify-between border-b border-edge-subtle px-6 py-3`,children:[(0,K.jsx)(`span`,{className:`text-lg font-semibold tracking-tight text-fg`,children:`xopc`}),(0,K.jsxs)(`div`,{className:`flex items-center gap-2`,children:[e===`mobile`?(0,K.jsxs)(O,{open:x,onOpenChange:re,children:[(0,K.jsx)(k,{asChild:!0,children:(0,K.jsxs)(T,{variant:`ghost`,className:`min-h-10`,children:[(0,K.jsx)(_,{className:`size-4`,"aria-hidden":`true`}),a.mobileDownloadAction]})}),(0,K.jsx)(E,{children:(0,K.jsxs)(D,{align:`end`,sideOffset:8,"aria-label":a.mobileDownloadAction,className:S(`w-[min(26rem,calc(100vw-2rem))] max-h-[var(--radix-popover-content-available-height)] overflow-y-auto rounded-xl border border-edge bg-surface-overlay p-6 sm:p-7 shadow-elevated`,A),children:[(0,K.jsx)(`p`,{className:`text-base font-semibold text-fg`,children:a.mobileDownloadAction}),(0,K.jsx)(`div`,{className:`my-6 flex justify-center`,children:Se.data?(0,K.jsx)(`img`,{src:Se.data,alt:a.mobileDownloadQrAlt,width:216,height:216,className:`size-[216px] max-w-full rounded-lg bg-white`}):Se.error?(0,K.jsx)(`p`,{role:`status`,className:`text-sm text-warning`,children:p.qrFailed}):(0,K.jsx)(C,{className:`size-[216px] max-w-full`})}),(0,K.jsx)(`p`,{className:`mt-3 text-sm leading-6 text-fg-muted`,children:a.mobileDownloadHint}),(0,K.jsxs)(T,{variant:`secondary`,className:`mt-5 w-full`,onClick:()=>void j(be),children:[(0,K.jsx)(v,{className:`size-4`,"aria-hidden":`true`}),a.mobileDownload]})]})})]}):null,(0,K.jsx)(`button`,{type:`button`,className:`flex size-10 items-center justify-center rounded-lg text-fg-muted hover:bg-surface-hover focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,"aria-label":p.cancel,onClick:t,children:(0,K.jsx)(ee,{className:`size-4`,"aria-hidden":`true`})})]})]}),(0,K.jsxs)(`div`,{className:`flex min-h-0 flex-1 flex-col overflow-y-auto px-8 py-7`,children:[Y?(0,K.jsx)(h,{className:`mb-5 size-7 text-success`}):null,(0,K.jsx)(f,{className:`text-xl font-semibold tracking-tight text-fg`,children:Me}),(0,K.jsx)(l,{className:`mt-2 text-sm leading-relaxed text-fg-muted`,children:y?Y?$.successHint:J?p.waitingForDevice:q?q.displayName:F?$.connectHint:p.intro:je}),Ne?(0,K.jsx)(`p`,{role:`alert`,className:`mt-4 text-sm text-danger`,children:Ne}):null,y&&P.error?(0,K.jsx)(`p`,{role:`alert`,className:`mt-4 text-sm text-danger`,children:p.readinessFailed}):null,y&&W.error?(0,K.jsx)(`p`,{role:`status`,className:`mt-4 text-sm text-warning`,children:p.statusUnavailable}):null,y?P.data?Y?(0,K.jsxs)(K.Fragment,{children:[X.data?(0,K.jsxs)(`label`,{className:`mt-8 flex items-center justify-between gap-4 border-y border-edge-subtle py-5 text-sm text-fg`,children:[a.background,(0,K.jsx)(`input`,{type:`checkbox`,role:`switch`,"aria-checked":X.data.runInBackground??!1,disabled:!X.data.backgroundSupported,checked:X.data.runInBackground??!1,className:`size-5 accent-accent`,onChange:e=>{window.electronAPI.system.setBehavior({runInBackground:e.target.checked}).then(e=>X.mutate(e.behavior)).catch(()=>L(`background`))}})]}):null,(0,K.jsx)(`p`,{className:`mt-4 text-xs text-fg-muted`,children:a.sleep})]}):De||Ee?(0,K.jsxs)(`div`,{className:`mt-10 space-y-5`,children:[(0,K.jsx)(`p`,{className:`text-sm text-fg-muted`,children:Ee||q?.status===`expired`?p.expired:p.declined}),(0,K.jsx)(T,{variant:`primary`,onClick:()=>void Ce(),disabled:R,children:p.refresh})]}):q?(0,K.jsxs)(K.Fragment,{children:[(0,K.jsx)(`p`,{className:`mt-2 text-xs text-fg-muted`,children:p.scope}),(0,K.jsxs)(`p`,{className:`mt-10 font-mono text-4xl tracking-[0.16em] text-fg`,"aria-live":`polite`,children:[q.confirmationCode.slice(0,3),` `,q.confirmationCode.slice(3)]}),(0,K.jsx)(`p`,{className:`mt-3 text-xs text-fg-muted`,children:p.compare}),(0,K.jsxs)(`details`,{className:`mt-6 text-xs text-fg-muted`,children:[(0,K.jsx)(`summary`,{className:`cursor-pointer py-2`,children:p.access}),(0,K.jsx)(`p`,{children:p.accessHint})]})]}):F?.targetKind===`mobile`?(0,K.jsxs)(K.Fragment,{children:[(0,K.jsxs)(`div`,{className:`my-6 flex flex-col items-center`,children:[(0,K.jsx)(`div`,{className:`rounded-[1.75rem] border border-edge bg-surface-hover/55 p-2.5 shadow-surface`,children:(0,K.jsx)(`div`,{className:`rounded-[1.25rem] bg-white p-2 shadow-sm ring-1 ring-black/5`,children:Z.data?(0,K.jsx)(`img`,{src:Z.data,alt:a.qrAlt,width:240,height:240,className:`size-[240px] max-w-full rounded-xl bg-white`}):Z.error?null:(0,K.jsx)(C,{className:`size-[240px] rounded-xl`})})}),Z.error?null:(0,K.jsxs)(`p`,{className:S(`mt-4 inline-flex min-h-8 items-center gap-1.5 rounded-full px-3 text-xs font-medium`,Oe?`bg-warning-soft text-warning`:`bg-surface-hover text-fg-muted`),"aria-live":`polite`,children:[(0,K.jsx)(g,{className:`size-3.5`,"aria-hidden":`true`}),ke]})]}),Z.error?(0,K.jsx)(`p`,{role:`status`,className:`text-center text-sm text-warning`,children:p.qrFailed}):null,Z.error?(0,K.jsx)(`div`,{className:`mt-5`,children:(0,K.jsx)(N,{text:F.universalLink,labels:{copy:a.copy,copied:a.copied,copyFailed:i.clipboard.copyFailed}})}):(0,K.jsxs)(`details`,{className:`group mx-auto mt-1 w-full max-w-sm rounded-xl border border-edge bg-surface-panel text-xs text-fg-muted`,children:[(0,K.jsxs)(`summary`,{className:`flex min-h-11 cursor-pointer list-none items-center justify-between gap-3 rounded-xl px-3.5 transition-colors hover:bg-surface-hover focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent [&::-webkit-details-marker]:hidden`,children:[(0,K.jsx)(`span`,{children:p.fallback}),(0,K.jsx)(m,{className:`size-3.5 shrink-0 transition-transform group-open:rotate-90`,"aria-hidden":`true`})]}),(0,K.jsx)(`div`,{className:`border-t border-edge-subtle p-3`,children:(0,K.jsx)(N,{text:F.universalLink,labels:{copy:a.copy,copied:a.copied,copyFailed:i.clipboard.copyFailed}})})]})]}):F?(0,K.jsxs)(K.Fragment,{children:[(0,K.jsxs)(`ol`,{className:`mt-7 space-y-2 text-sm leading-6 text-fg-muted`,children:[(0,K.jsxs)(`li`,{children:[(0,K.jsx)(`span`,{className:`mr-2 text-fg-subtle`,children:`1.`}),a.browserConnectStep1]}),(0,K.jsxs)(`li`,{children:[(0,K.jsx)(`span`,{className:`mr-2 text-fg-subtle`,children:`2.`}),a.browserConnectStep2]}),(0,K.jsxs)(`li`,{children:[(0,K.jsx)(`span`,{className:`mr-2 text-fg-subtle`,children:`3.`}),a.browserConnectStep3]})]}),(0,K.jsx)(`div`,{className:`mt-6`,children:(0,K.jsx)(N,{text:F.browserInvitation,labels:{copy:a.copy,copied:a.copied,copyFailed:i.clipboard.copyFailed}})}),(0,K.jsx)(`p`,{className:`mt-3 text-center text-xs text-fg-muted`,children:F.expiresAt-Q<6e4?`${Math.max(0,Math.ceil((F.expiresAt-Q)/1e3))}s`:p.valid})]}):P.data.ready?(0,K.jsx)(`div`,{className:`mt-8`,children:(0,K.jsx)(C,{className:`mx-auto size-[216px]`})}):(0,K.jsxs)(`div`,{className:`mt-6 flex flex-1 flex-col`,children:[B===`tailscale`?(0,K.jsx)(oe,{embedded:!0}):B===`https`?(0,K.jsx)(ge,{}):B===`choices`?(0,K.jsxs)(`div`,{className:`space-y-3`,children:[(0,K.jsx)(T,{variant:`secondary`,className:`w-full`,onClick:()=>fe(`tailscale`),children:a.useTailscale}),(0,K.jsx)(T,{variant:`secondary`,className:`w-full`,onClick:()=>fe(`https`),children:a.useOwnHttps})]}):(0,K.jsx)(ve,{}),(0,K.jsx)(T,{variant:`ghost`,className:`mt-3 w-full`,onClick:()=>fe(B?null:`choices`),children:B?p.back:p.existing})]}):(0,K.jsxs)(`div`,{className:`mt-8 space-y-4`,children:[(0,K.jsx)(C,{className:`h-5 w-3/4`}),(0,K.jsx)(C,{className:`h-40 w-full`})]}):(0,K.jsxs)(`div`,{className:`mt-7`,children:[(0,K.jsxs)(T,{variant:`secondary`,className:`w-full`,disabled:R,onClick:()=>void Pe(),children:[(0,K.jsx)(_,{className:`size-4`}),a.browserDownload]}),(0,K.jsxs)(`ol`,{className:`mt-5 space-y-3 text-sm leading-6 text-fg-muted`,children:[(0,K.jsxs)(`li`,{children:[(0,K.jsx)(`span`,{className:`mr-2 text-fg-subtle`,children:`1.`}),a.browserInstallStep1]}),(0,K.jsxs)(`li`,{children:[(0,K.jsx)(`span`,{className:`mr-2 text-fg-subtle`,children:`2.`}),a.browserInstallStep2]}),(0,K.jsxs)(`li`,{children:[(0,K.jsx)(`span`,{className:`mr-2 text-fg-subtle`,children:`3.`}),a.browserInstallStep3]})]}),(0,K.jsxs)(`button`,{type:`button`,className:`mt-5 inline-flex items-center gap-1 text-xs text-accent hover:underline`,onClick:()=>void j(xe),children:[a.browserInstallHelp,(0,K.jsx)(v,{className:`size-3`})]})]})]}),!y||P.error||Y||q?.status===`pending`||I===`create`||I===`decision`?(0,K.jsx)(`footer`,{className:`shrink-0 px-8 pb-6`,children:y?Y?(0,K.jsx)(T,{className:`w-full`,variant:`primary`,onClick:t,children:p.done}):q?.status===`pending`?(0,K.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,K.jsx)(T,{className:`w-full`,variant:`primary`,disabled:R,onClick:()=>void we(`approve`),children:p.allow}),(0,K.jsx)(T,{className:`w-full`,variant:`ghost`,disabled:R,onClick:()=>void we(`reject`),children:p.cancel})]}):P.error?(0,K.jsx)(T,{className:`w-full`,variant:`primary`,onClick:()=>void P.mutate(),children:p.retry}):(0,K.jsx)(T,{className:`w-full`,variant:`primary`,disabled:R,onClick:()=>void Ce(),children:p.retry}):(0,K.jsx)(T,{className:`w-full`,variant:`primary`,onClick:()=>{L(null),b(!0)},children:a.browserReady})}):null]})]})}export{q as n,J as t};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{n as e,t}from"./vendor-react-BOUWij0V.js";import{r as n,t as r}from"./working-directory-picker-modal-
|
|
1
|
+
import{n as e,t}from"./vendor-react-BOUWij0V.js";import{r as n,t as r}from"./working-directory-picker-modal-DvVtUxHW.js";import{t as i}from"./cn-0WouolD0.js";import{n as a}from"./interaction-BdhHBbYa.js";import{n as o,t as s}from"./use-directory-picker-C4p7AgWY.js";var c=e(),l=t();function u(e){let t=(0,c.c)(27),{value:r,onPick:s,disabled:u,placeholder:d,title:f,className:p,maxWidthClass:m,compact:h,"aria-label":g}=e,_=m===void 0?`max-w-[min(12rem,40vw)]`:m,v=h!==void 0&&h,y,b;t[0]!==d||t[1]!==r?(b=r.trim(),y=b?o(b):d??``,t[0]=d,t[1]=r,t[2]=y,t[3]=b):(y=t[2],b=t[3]);let x=y,S=f??(b||void 0),C=g??f??x,w=v?`inline-flex size-9 shrink-0 items-center justify-center rounded-lg p-0`:`inline-flex min-h-8 min-w-0 shrink-0 items-center gap-1 rounded-lg px-2 py-1 text-xs`,T=!v&&_,E=u&&`cursor-not-allowed opacity-60`,D;t[4]!==p||t[5]!==w||t[6]!==T||t[7]!==E?(D=i(w,`border border-edge-subtle/80 bg-surface-hover/40 dark:border-edge-subtle`,a.transition,a.focusRingPanel,`cursor-pointer hover:bg-surface-hover/70 dark:hover:bg-surface-hover/50`,T,E,p),t[4]=p,t[5]=w,t[6]=T,t[7]=E,t[8]=D):D=t[8];let O;t[9]!==u||t[10]!==s?(O=e=>{e.stopPropagation(),u||s()},t[9]=u,t[10]=s,t[11]=O):O=t[11];let k=v?`size-4`:`size-3.5`,A;t[12]===k?A=t[13]:(A=i(`shrink-0 text-fg-muted`,k),t[12]=k,t[13]=A);let j;t[14]===A?j=t[15]:(j=(0,l.jsx)(n,{className:A,"aria-hidden":!0}),t[14]=A,t[15]=j);let M;t[16]!==v||t[17]!==x?(M=v?null:(0,l.jsx)(`span`,{className:`min-w-0 truncate text-left font-medium text-fg`,children:x}),t[16]=v,t[17]=x,t[18]=M):M=t[18];let N;return t[19]!==u||t[20]!==O||t[21]!==j||t[22]!==M||t[23]!==S||t[24]!==C||t[25]!==D?(N=(0,l.jsxs)(`button`,{type:`button`,disabled:u,title:S,"aria-label":C,className:D,onClick:O,children:[j,M]}),t[19]=u,t[20]=O,t[21]=j,t[22]=M,t[23]=S,t[24]=C,t[25]=D,t[26]=N):N=t[26],N}function d(e){let t=(0,c.c)(39),{value:n,onChange:a,disabled:o,wd:d,placeholder:f,inputAriaLabel:p,inputClassName:m,autoFocus:h,trailing:g}=e,_;t[0]!==a||t[1]!==n?(_={initialPath:n,onPicked:a},t[0]=a,t[1]=n,t[2]=_):_=t[2];let v=s(_),y;t[3]===n?y=t[4]:(y=n.trim(),t[3]=n,t[4]=y);let b=y,x=b?`${b}\n${d.chooseFolder}`:`${f??d.notSet}\n${d.selectWorkingDirectory}`,S;t[5]===m?S=t[6]:(S=i(`min-w-0 flex-1`,m),t[5]=m,t[6]=S);let C=o||v.picking,w;t[7]===a?w=t[8]:(w=e=>void a(e.target.value),t[7]=a,t[8]=w);let T=f??d.pathInputPlaceholder,E;t[9]!==h||t[10]!==p||t[11]!==S||t[12]!==C||t[13]!==w||t[14]!==T||t[15]!==n?(E=(0,l.jsx)(`input`,{type:`text`,className:S,value:n,disabled:C,onChange:w,placeholder:T,"aria-label":p,autoFocus:h,autoComplete:`off`,spellCheck:!1}),t[9]=h,t[10]=p,t[11]=S,t[12]=C,t[13]=w,t[14]=T,t[15]=n,t[16]=E):E=t[16];let D=o||v.picking,O;t[17]!==x||t[18]!==v.pick||t[19]!==D||t[20]!==n||t[21]!==d.selectWorkingDirectory?(O=(0,l.jsx)(u,{compact:!0,value:n,onPick:v.pick,disabled:D,title:x,"aria-label":d.selectWorkingDirectory}),t[17]=x,t[18]=v.pick,t[19]=D,t[20]=n,t[21]=d.selectWorkingDirectory,t[22]=O):O=t[22];let k;t[23]!==O||t[24]!==g?(k=(0,l.jsxs)(`div`,{className:`flex shrink-0 flex-wrap items-center gap-2`,children:[O,g]}),t[23]=O,t[24]=g,t[25]=k):k=t[25];let A;t[26]!==k||t[27]!==E?(A=(0,l.jsxs)(`div`,{className:`flex flex-col gap-2 sm:flex-row sm:items-center`,children:[E,k]}),t[26]=k,t[27]=E,t[28]=A):A=t[28];let j;t[29]!==v.confirmPick||t[30]!==v.hasNativePicker||t[31]!==v.modalOpen||t[32]!==v.setModalOpen||t[33]!==b||t[34]!==d?(j=v.hasNativePicker?null:(0,l.jsx)(r,{open:v.modalOpen,onOpenChange:v.setModalOpen,initialAbsolutePath:b||void 0,onConfirm:v.confirmPick,wd:d}),t[29]=v.confirmPick,t[30]=v.hasNativePicker,t[31]=v.modalOpen,t[32]=v.setModalOpen,t[33]=b,t[34]=d,t[35]=j):j=t[35];let M;return t[36]!==A||t[37]!==j?(M=(0,l.jsxs)(l.Fragment,{children:[A,j]}),t[36]=A,t[37]=j,t[38]=M):M=t[38],M}export{d 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{i,n as a,o}from"./locale-store-CnHhWsDP.js";import{t as s}from"./messages-CZCXd6Pj.js";import{a as c,l,n as u}from"./dist-CY7CS_D3.js";import{i as d,n as f,r as p}from"./popover-select-CLsphyzA.js";import{t as m}from"./skeleton-DzdOeGYz.js";import{p as h}from"./product-delivery-4gEqUIsK.js";import{i as g}from"./vendor-swr-CdRzEUwF.js";var _=e(t(),1),v=n(),y={"capability:xopc.projects.get":`Read approved project details`,"capability:xopc.projects.list":`Search approved projects`,"capability:xopc.projects.list_milestones":`Read approved project milestones`,"capability:xopc.projects.list_updates":`Read approved project progress updates`,"capability:xopc.projects.update":`Update approved project metadata at an exact version`,"capability:xopc.projects.create_milestone":`Create milestones in approved projects`,"capability:xopc.projects.update_milestone":`Update milestones in approved projects`,"capability:xopc.projects.create_update":`Record progress in approved projects`,"capability:xopc.tasks.create":`Capture tasks without starting execution`,"capability:xopc.tasks.update":`Edit approved task details at an exact version`,"capability:xopc.files.read":`Read explicitly selected files and import selected attachments`,"capability:xopc.files.propose_export":`Propose a file export for host review`,"capability:xopc.connectors.describe":`Read contracts of approved connector operations`,"capability:xopc.connectors.read":`Run approved connector read operations on the selected account`,"capability:xopc.connectors.propose_write":`Propose connector writes for individual host review`,"capability:xopc.apps.get_request":`Read this app’s resource request outcomes`,"capability:xopc.automations.simulate":`Validate a proposed automation without running it`,"capability:xopc.automations.propose":`Submit automation changes for separate host review`,"capability:xopc.automations.get_proposal":`Read this app’s proposal review outcomes`,"capability:xopc.automations.history":`Recover this app’s authorized run history`,"capability:xopc.automations.run_events":`Read this app’s sanitized run progress events`,"capability:xopc.automations.list":`List approved automation summaries`,"capability:xopc.automations.get":`Read approved automation summaries`,"capability:xopc.automations.run":`Run individually approved automation configurations (may cause external effects and costs)`,"capability:xopc.automations.get_run":`Read results of runs submitted by this app`,"capability:xopc.automations.cancel":`Request cancellation of runs submitted by this app`,"capability:xopc.agent.delegate":`Delegate bounded text reasoning to the configured model (may incur costs)`,"capability:xopc.notes.create":`Create notes within the approved scope`,"capability:xopc.notes.update":`Change approved notes at an exact revision`,"capability:xopc.notes.append":`Append content to approved notes`,"capability:xopc.notes.get":`Read approved notes by ID`,"capability:xopc.notes.list":`Search and list approved notes`,"capability:xopc.tasks.get":`Read approved task summaries`,"capability:xopc.tasks.list":`Search and list approved task summaries`,theme:`Read theme (light / dark)`,"agent.send":`Send messages to the assistant`,"agent.subscribe":`Receive live agent stream events for a chat`,"session.read":`List and open chat sessions`,"config.read":`Read plugin configuration`,"config.write":`Write plugin configuration`,storage:`Read and write plugin storage`,notification:`Show in-app notifications`},b={"capability:xopc.projects.get":`读取授权项目详情`,"capability:xopc.projects.list":`搜索授权项目`,"capability:xopc.projects.list_milestones":`读取授权项目里程碑`,"capability:xopc.projects.list_updates":`读取授权项目进展`,"capability:xopc.projects.update":`按精确版本更新授权项目资料`,"capability:xopc.projects.create_milestone":`在授权项目内创建里程碑`,"capability:xopc.projects.update_milestone":`更新授权项目的里程碑`,"capability:xopc.projects.create_update":`记录授权项目进展`,"capability:xopc.tasks.create":`收集任务,不启动执行`,"capability:xopc.tasks.update":`按精确版本编辑授权任务资料`,"capability:xopc.files.read":`读取逐项授权的文件及手动选择的附件`,"capability:xopc.files.propose_export":`提出文件导出请求,由宿主审核`,"capability:xopc.connectors.describe":`读取授权连接器操作的接口定义`,"capability:xopc.connectors.read":`在指定账户执行授权的连接器读取操作`,"capability:xopc.connectors.propose_write":`提出连接器写入请求,由宿主逐次审核`,"capability:xopc.apps.get_request":`读取此应用资源请求的结果`,"capability:xopc.automations.simulate":`验证自动化方案,不执行操作`,"capability:xopc.automations.propose":`提交自动化变更,由宿主另行审核`,"capability:xopc.automations.get_proposal":`读取此应用提案的审核结果`,"capability:xopc.automations.history":`恢复此应用有权读取的运行历史`,"capability:xopc.automations.run_events":`读取此应用运行的脱敏进度事件`,"capability:xopc.automations.list":`列出授权范围内的自动化摘要`,"capability:xopc.automations.get":`读取授权范围内的自动化摘要`,"capability:xopc.automations.run":`运行逐项确认的自动化配置(可能产生外部影响和费用)`,"capability:xopc.automations.get_run":`读取此应用发起的自动化运行结果`,"capability:xopc.automations.cancel":`请求取消此应用发起的自动化运行`,"capability:xopc.agent.delegate":`委托已配置模型执行有预算限制的文本推理(可能产生费用)`,"capability:xopc.notes.create":`在授权范围内创建笔记`,"capability:xopc.notes.update":`按精确版本修改授权范围内的笔记`,"capability:xopc.notes.append":`向授权范围内的笔记追加内容`,"capability:xopc.notes.get":`按 ID 读取授权范围内的笔记`,"capability:xopc.notes.list":`搜索和列出授权范围内的笔记`,"capability:xopc.tasks.get":`读取授权范围内的任务摘要`,"capability:xopc.tasks.list":`搜索和列出授权范围内的任务摘要`,theme:`读取主题(浅色/深色)`,"agent.send":`向助手发送消息`,"agent.subscribe":`接收会话的实时助手流式事件`,"session.read":`列出并打开聊天会话`,"config.read":`读取插件配置`,"config.write":`写入插件配置`,storage:`读写插件存储`,notification:`显示应用内通知`};function x(e,t){let n=y[e];return t===`zh`&&b[e]?b[e]:n??e}var S=r();function C(e){let t=(0,v.c)(19),{extensionId:n,kind:r,values:i,onChange:a,zh:o}=e,[s,c]=(0,_.useState)(``),{data:l,error:u,isLoading:f}=g(`/api/extensions/${encodeURIComponent(n)}/resource-options?kind=${r}&search=${encodeURIComponent(s)}`,T),p=r===`notes`?o?`笔记`:`Notes`:r===`tasks`?o?`任务`:`Tasks`:r===`automations`?o?`自动化`:`Automations`:r===`files`?o?`文件`:`Files`:o?`项目`:`Projects`,h;if(t[0]!==l?.items||t[1]!==i){h=(l?.items??[]).map(w);for(let e of i)h.some(t=>t.value===e)||h.push({value:e,label:e});t[0]=l?.items,t[1]=i,t[2]=h}else h=t[2];let y=o?`搜索${p}`:`Search ${p}`,b;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(b=e=>c(e.target.value),t[3]=b):b=t[3];let x=o?`搜索${p}(最多显示 100 项)`:`Search ${p} (up to 100 results)`,C;t[4]!==s||t[5]!==y||t[6]!==x?(C=(0,S.jsx)(`input`,{"aria-label":y,value:s,onChange:b,placeholder:x,className:`w-full rounded-md border border-edge bg-surface-panel px-2 py-1.5 text-xs text-fg`}),t[4]=s,t[5]=y,t[6]=x,t[7]=C):C=t[7];let E;t[8]!==u||t[9]!==f||t[10]!==p||t[11]!==a||t[12]!==h||t[13]!==i||t[14]!==o?(E=(0,S.jsx)(`div`,{className:`mt-1 max-h-36 overflow-y-auto`,children:f?(0,S.jsx)(m,{className:`h-16`}):u?(0,S.jsx)(`p`,{role:`alert`,className:`text-xs text-danger`,children:o?`无法加载,请重试`:`Could not load resources`}):(0,S.jsx)(d,{ariaLabel:p,multiple:!0,options:h,values:i,onChange:a})}),t[8]=u,t[9]=f,t[10]=p,t[11]=a,t[12]=h,t[13]=i,t[14]=o,t[15]=E):E=t[15];let D;return t[16]!==C||t[17]!==E?(D=(0,S.jsxs)(`div`,{className:`mt-2 rounded-lg border border-edge p-2`,children:[C,E]}),t[16]=C,t[17]=E,t[18]=D):D=t[18],D}function w(e){return{value:e.id,label:e.title}}function T(e){return o(i(e))}function E(e){let t=(0,v.c)(92),{extensionId:n,permissions:r,value:i,onChange:a,zh:o}=e,s=o?`读取笔记的范围`:`Notes this app may read`,c;t[0]===r?c=t[1]:(c=r.some(F),t[0]=r,t[1]=c);let l;t[2]!==s||t[3]!==c?(l={key:`notesRead`,label:s,kind:`notes`,visible:c},t[2]=s,t[3]=c,t[4]=l):l=t[4];let u=o?`修改与创建笔记的范围`:`Notes this app may change or create`,d;t[5]===r?d=t[6]:(d=r.some(te),t[5]=r,t[6]=d);let m;t[7]!==u||t[8]!==d?(m={key:`notesWrite`,label:u,kind:`notes`,visible:d},t[7]=u,t[8]=d,t[9]=m):m=t[9];let h=o?`读取任务的范围`:`Tasks this app may read`,g;t[10]===r?g=t[11]:(g=r.some(ee),t[10]=r,t[11]=g);let _;t[12]!==h||t[13]!==g?(_={key:`tasksRead`,label:h,kind:`tasks`,visible:g},t[12]=h,t[13]=g,t[14]=_):_=t[14];let y=o?`读取自动化的范围`:`Automations this app may read`,b;t[15]===r?b=t[16]:(b=r.some(P),t[15]=r,t[16]=b);let x;t[17]!==y||t[18]!==b?(x={key:`automationsRead`,label:y,kind:`automations`,visible:b},t[17]=y,t[18]=b,t[19]=x):x=t[19];let w=o?`创建和更新任务的范围`:`Tasks this app may capture or edit`,T;t[20]===r?T=t[21]:(T=r.some(N),t[20]=r,t[21]=T);let E;t[22]!==w||t[23]!==T?(E={key:`tasksWrite`,label:w,kind:`tasks`,visible:T},t[22]=w,t[23]=T,t[24]=E):E=t[24];let L=o?`读取项目的范围`:`Projects this app may read`,R;t[25]===r?R=t[26]:(R=r.some(M),t[25]=r,t[26]=R);let B;t[27]!==L||t[28]!==R?(B={key:`projectsRead`,label:L,kind:`projects`,visible:R},t[27]=L,t[28]=R,t[29]=B):B=t[29];let V=o?`更新项目和进度的范围`:`Projects this app may update`,H;t[30]===r?H=t[31]:(H=r.some(j),t[30]=r,t[31]=H);let U;t[32]!==V||t[33]!==H?(U={key:`projectsWrite`,label:V,kind:`projects`,visible:H},t[32]=V,t[33]=H,t[34]=U):U=t[34];let W;t[35]!==x||t[36]!==E||t[37]!==B||t[38]!==U||t[39]!==l||t[40]!==m||t[41]!==_?(W=[l,m,_,x,E,B,U],t[35]=x,t[36]=E,t[37]=B,t[38]=U,t[39]=l,t[40]=m,t[41]=_,t[42]=W):W=t[42];let G=W,K;t[43]!==n||t[44]!==a||t[45]!==r||t[46]!==i||t[47]!==o?(K=r.some(A)?(0,S.jsx)(z,{extensionId:n,value:i,onChange:a,zh:o}):null,t[43]=n,t[44]=a,t[45]=r,t[46]=i,t[47]=o,t[48]=K):K=t[48];let q;t[49]!==n||t[50]!==a||t[51]!==r||t[52]!==i||t[53]!==o?(q=r.includes(`capability:xopc.files.read`)?(0,S.jsxs)(`fieldset`,{className:`rounded-lg border border-edge p-3`,children:[(0,S.jsx)(`legend`,{className:`text-sm font-medium text-fg`,children:o?`文件与附件读取`:`File and attachment reads`}),(0,S.jsxs)(`label`,{className:`flex items-start gap-2 text-sm text-fg`,children:[(0,S.jsx)(`input`,{type:`checkbox`,checked:i.filesRead.mode===`selected`,onChange:e=>a({...i,filesRead:e.target.checked?{mode:`selected`,ids:[]}:{mode:`none`}})}),o?`允许读取以下选定的工作区文件(每个最多 512 KiB)`:`Allow reading these selected workspace files (up to 512 KiB each)`]}),i.filesRead.mode===`selected`?(0,S.jsx)(C,{extensionId:n,kind:`files`,values:i.filesRead.ids,zh:o,onChange:e=>a({...i,filesRead:{mode:`selected`,ids:e}})}):null,(0,S.jsxs)(`label`,{className:`mt-2 flex items-start gap-2 text-sm text-fg`,children:[(0,S.jsx)(`input`,{type:`checkbox`,checked:i.filesImport,onChange:e=>a({...i,filesImport:e.target.checked})}),o?`允许在宿主中逐次选择并导入本机附件`:`Allow choosing a local attachment in the host for each import`]})]}):null,t[49]=n,t[50]=a,t[51]=r,t[52]=i,t[53]=o,t[54]=q):q=t[54];let J;t[55]!==a||t[56]!==r||t[57]!==i||t[58]!==o?(J=r.includes(`capability:xopc.files.propose_export`)?(0,S.jsxs)(`label`,{className:`flex items-start gap-2 text-sm text-fg`,children:[(0,S.jsx)(`input`,{type:`checkbox`,checked:i.filesExport,onChange:e=>a({...i,filesExport:e.target.checked})}),o?`允许提出文件导出请求;每次均需在宿主确认保存,不直接覆盖 Gateway 文件`:`Allow export requests; each browser save requires host confirmation and does not overwrite Gateway files`]}):null,t[55]=a,t[56]=r,t[57]=i,t[58]=o,t[59]=J):J=t[59];let Y;t[60]!==a||t[61]!==r||t[62]!==i||t[63]!==o?(Y=r.some(k)?(0,S.jsxs)(`label`,{className:`flex items-start gap-2 text-sm text-fg`,children:[(0,S.jsx)(`input`,{type:`checkbox`,checked:i.automationProposals,onChange:e=>a({...i,automationProposals:e.target.checked})}),o?`允许模拟和提交自动化提案;创建、修改或启用仍须在宿主逐项审核`:`Allow simulation and automation proposals; creation, changes and activation still require host review`]}):null,t[60]=a,t[61]=r,t[62]=i,t[63]=o,t[64]=Y):Y=t[64];let X;t[65]!==a||t[66]!==r||t[67]!==i||t[68]!==o?(X=r.includes(`capability:xopc.agent.delegate`)?(0,S.jsxs)(`fieldset`,{className:`rounded-lg border border-edge p-3`,children:[(0,S.jsx)(`legend`,{className:`text-sm font-medium text-fg`,children:o?`受限 Agent 委托`:`Restricted Agent delegation`}),(0,S.jsxs)(`label`,{className:`flex items-start gap-2 text-sm text-fg`,children:[(0,S.jsx)(`input`,{type:`checkbox`,checked:i.agentDelegate,onChange:e=>a({...i,agentDelegate:e.target.checked})}),o?`允许发送应用指令、上下文和授权引用到已配置的模型`:`Allow sending app instructions, context and approved references to the configured model`]}),(0,S.jsx)(`p`,{className:`mt-2 text-xs text-fg-muted`,children:o?`可能产生模型费用。每应用每小时最多 20 次,每次最多 30 秒、4096 输出 token,支持文本或 JSON。无聊天历史、记忆、文件、工具或自动写入权限。预览不运行真实委托。`:`May incur model costs. Up to 20 calls per app per hour, 30 seconds and 4096 output tokens per call, as text or JSON. No chat history, memory, files, tools or automatic writes. Unavailable in previews.`})]}):null,t[65]=a,t[66]=r,t[67]=i,t[68]=o,t[69]=X):X=t[69];let Z;t[70]!==n||t[71]!==a||t[72]!==r||t[73]!==i||t[74]!==o?(Z=r.some(O)?(0,S.jsx)(I,{extensionId:n,value:i,onChange:a,zh:o}):null,t[70]=n,t[71]=a,t[72]=r,t[73]=i,t[74]=o,t[75]=Z):Z=t[75];let Q;t[76]===G?Q=t[77]:(Q=G.filter(D),t[76]=G,t[77]=Q);let $;t[78]!==n||t[79]!==a||t[80]!==Q||t[81]!==i||t[82]!==o?($=Q.map(e=>{let t=i[e.key],r=t=>a({...i,[e.key]:t});return(0,S.jsxs)(`fieldset`,{className:`min-w-0`,children:[(0,S.jsx)(`legend`,{className:`mb-2 text-sm font-medium text-fg`,children:e.label}),(0,S.jsxs)(f,{"aria-label":e.label,value:t.mode,onChange:e=>r(e.target.value===`selected`?{mode:`selected`,ids:[],projectIds:[],includeCreated:!1}:{mode:e.target.value}),children:[(0,S.jsx)(p,{value:`none`,children:o?`不允许`:`No access`}),(0,S.jsx)(p,{value:`selected`,children:o?`仅选择的记录或项目`:`Selected records or projects`}),(0,S.jsx)(p,{value:`workspace`,children:o?`整个工作区(包含所有记录)`:`Entire workspace (all records)`})]}),t.mode===`workspace`?(0,S.jsx)(`p`,{className:`mt-1 text-xs text-warning`,children:o?`这会授权访问整个工作区,请确认符合此工具的用途。`:`This grants workspace-wide access. Check that this matches the tool’s purpose.`}):null,t.mode===`selected`?(0,S.jsxs)(S.Fragment,{children:[e.kind===`notes`||e.kind===`tasks`?(0,S.jsxs)(`label`,{className:`mt-2 flex items-center gap-2 text-xs text-fg`,children:[(0,S.jsx)(`input`,{type:`checkbox`,checked:t.includeCreated,onChange:e=>r({...t,includeCreated:e.target.checked})}),e.kind===`notes`?o?`包括此应用创建的笔记`:`Include notes created by this app`:o?`包括此应用创建的任务`:`Include tasks created by this app`]}):null,(0,S.jsx)(C,{extensionId:n,kind:e.kind,values:e.kind===`projects`?[...new Set([...t.ids,...t.projectIds])]:t.ids,onChange:n=>r({...t,ids:n,...e.kind===`projects`?{projectIds:[]}:{}}),zh:o}),e.kind===`projects`?null:(0,S.jsxs)(S.Fragment,{children:[(0,S.jsx)(`p`,{className:`mt-2 text-xs text-fg-muted`,children:o?`也可授权以下项目中的记录,包括以后加入项目的记录。`:`You may also allow records in these projects, including future additions.`}),(0,S.jsx)(C,{extensionId:n,kind:`projects`,values:t.projectIds,onChange:e=>r({...t,projectIds:e}),zh:o})]})]}):null]},e.key)}),t[78]=n,t[79]=a,t[80]=Q,t[81]=i,t[82]=o,t[83]=$):$=t[83];let ne;return t[84]!==K||t[85]!==q||t[86]!==J||t[87]!==Y||t[88]!==X||t[89]!==Z||t[90]!==$?(ne=(0,S.jsxs)(`div`,{className:`mt-4 space-y-4`,children:[K,q,J,Y,X,Z,$]}),t[84]=K,t[85]=q,t[86]=J,t[87]=Y,t[88]=X,t[89]=Z,t[90]=$,t[91]=ne):ne=t[91],ne}function D(e){return e.visible}function O(e){return/capability:xopc.automations.(run|cancel)$/.test(e)}function k(e){return/capability:xopc.automations.(propose|get_proposal|simulate)$/.test(e)}function A(e){return/capability:xopc.connectors./.test(e)}function j(e){return/capability:xopc.projects.(update|create_milestone|update_milestone|create_update)$/.test(e)}function M(e){return/capability:xopc.projects.(get|list|list_milestones|list_updates)$/.test(e)}function N(e){return/capability:xopc.tasks.(create|update)$/.test(e)}function P(e){return/capability:xopc.automations.(get|list|get_run|history|run_events)$/.test(e)}function ee(e){return/capability:xopc.tasks.(get|list)$/.test(e)}function te(e){return/capability:xopc.notes.(create|update|append)$/.test(e)}function F(e){return/capability:xopc.notes.(get|list)$/.test(e)}function I(e){let t=(0,v.c)(34),{extensionId:n,value:r,onChange:i,zh:a}=e,[o,s]=(0,_.useState)(``),c;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(c={},t[0]=c):c=t[0];let[l,u]=(0,_.useState)(c),{data:d,error:f,isLoading:p}=g(`/api/extensions/${encodeURIComponent(n)}/resource-options?kind=automations&search=${encodeURIComponent(o)}`,R),h;t[1]!==r.automationsRun.approvals||t[2]!==r.automationsRun.mode?(h=r.automationsRun.mode===`selected`?r.automationsRun.approvals:[],t[1]=r.automationsRun.approvals,t[2]=r.automationsRun.mode,t[3]=h):h=t[3];let y=h,b;t[4]!==i||t[5]!==r?(b=e=>i({...r,automationsRun:e.length?{mode:`selected`,approvals:e}:{mode:`none`}}),t[4]=i,t[5]=r,t[6]=b):b=t[6];let x=b,C=a?`允许执行的自动化`:`Approved automation execution`,w;t[7]===C?w=t[8]:(w=(0,S.jsx)(`legend`,{className:`text-sm font-medium text-fg`,children:C}),t[7]=C,t[8]=w);let T=a?`所选自动化可能使用 Agent 工具、修改文件或向外发送结果,并产生费用。请展开检查后再勾选。应用只能运行确认过的配置,每小时最多 20 次;配置变化需重新授权。授权到期或撤权后,受限运行会中止后续调用。`:`These automations may use Agent tools, change files, send results externally and incur costs. Inspect each before approving. Up to 20 submissions per app per hour. Configuration changes require new approval. Expiry or revocation stops further calls in bounded runs.`,E;t[9]===T?E=t[10]:(E=(0,S.jsx)(`p`,{className:`mb-2 text-xs text-warning`,children:T}),t[9]=T,t[10]=E);let D=a?`搜索可执行自动化`:`Search executable automations`,O;t[11]===Symbol.for(`react.memo_cache_sentinel`)?(O=e=>s(e.target.value),t[11]=O):O=t[11];let k=a?`搜索自动化`:`Search automations`,A;t[12]!==o||t[13]!==k||t[14]!==D?(A=(0,S.jsx)(`input`,{"aria-label":D,value:o,onChange:O,placeholder:k,className:`w-full rounded-md border border-edge bg-surface-panel px-2 py-1.5 text-xs text-fg`}),t[12]=o,t[13]=k,t[14]=D,t[15]=A):A=t[15];let j;t[16]!==y||t[17]!==d?.items||t[18]!==l||t[19]!==f||t[20]!==p||t[21]!==x||t[22]!==a?(j=p?(0,S.jsx)(m,{className:`mt-2 h-16`}):f?(0,S.jsx)(`p`,{role:`alert`,className:`text-xs text-danger`,children:a?`无法加载自动化`:`Could not load automations`}):(d?.items??[]).map(e=>{let t=y.some(t=>t.id===e.id&&t.configurationDigest===e.configurationDigest&&t.authority.model&&t.authority.maxRuns>0&&t.authority.expiresAt>Date.now()),n=!t&&y.some(t=>t.id===e.id),r=e.review.action,i=l[e.id]??y.find(t=>t.id===e.id)?.authority??{model:!1,tools:!1,dataWrite:!1,externalSend:!1,expiresAt:Date.now()+36e5,maxRuns:1,maxCostMicrousd:1e6},o=n=>{u(t=>({...t,[e.id]:n})),t&&x([...y.filter(t=>t.id!==e.id),...n.model?[{id:e.id,configurationDigest:e.configurationDigest,authority:n}]:[]])};return(0,S.jsxs)(`details`,{className:`mt-2 rounded-md border border-edge p-2 text-xs text-fg`,children:[(0,S.jsxs)(`summary`,{className:`cursor-pointer`,children:[e.title,n?a?`(配置已改变,需重新确认)`:` (changed; review again)`:``]}),(0,S.jsxs)(`div`,{className:`mt-2 space-y-2 break-words`,children:[(0,S.jsxs)(`p`,{children:[a?`执行方式`:`Action`,`: `,r.kind===`agent`?`Agent`:r.kind===`task_command`?a?`任务命令`:`Task command`:r.kind]}),r.instruction?(0,S.jsx)(`p`,{className:`whitespace-pre-wrap`,children:r.instruction}):null,r.agentId?(0,S.jsxs)(`p`,{children:[`Agent: `,r.agentId]}):null,r.model?(0,S.jsxs)(`p`,{children:[a?`模型`:`Model`,`: `,r.model]}):null,r.workingDirectory?(0,S.jsxs)(`p`,{children:[a?`工作目录`:`Working directory`,`: `,r.workingDirectory]}):null,r.mcpSourceId?(0,S.jsxs)(`p`,{children:[`MCP: `,r.mcpSourceId]}):null,r.taskId?(0,S.jsxs)(S.Fragment,{children:[(0,S.jsxs)(`p`,{children:[a?`任务`:`Task`,`: `,r.taskId]}),(0,S.jsx)(`pre`,{className:`whitespace-pre-wrap`,children:JSON.stringify(r.command,null,2)})]}):null,(0,S.jsxs)(`p`,{children:[a?`执行策略`:`Safety`,`: `,e.review.safety?.mode??`auto_apply`,` / `,e.review.conversationMode]}),(0,S.jsxs)(`p`,{children:[a?`超时与重试`:`Timeout / retries`,`: `,e.review.reliability?.executionTimeoutSeconds??r.timeoutSeconds??(a?`宿主默认`:`Host default`),` / `,e.review.reliability?.retryCount??0]}),(0,S.jsxs)(`p`,{children:[a?`结果投递`:`Delivery`,`: `,e.review.delivery.destinations.map(L).join(`, `)||(a?`无`:`None`)]}),[`model`,`tools`,`dataWrite`,`externalSend`].map(e=>(0,S.jsxs)(`label`,{className:`flex items-start gap-2`,children:[(0,S.jsx)(`input`,{type:`checkbox`,checked:i[e],onChange:t=>o({...i,[e]:t.target.checked})}),{model:a?`允许模型处理(上下文会发送给模型供应商)`:`Allow model processing (context is disclosed to the provider)`,tools:a?`允许本地文件读取工具`:`Allow local file read tools`,dataWrite:a?`允许本地文件写入(工具写入还需允许工具)`:`Allow local file writes (tool writes also require tools)`,externalSend:a?`允许向以上已审核目标投递结果`:`Allow delivery to the reviewed external destinations`}[e]]},e)),(0,S.jsx)(`p`,{className:`text-fg-muted`,children:a?`不开放 Shell、浏览器、MCP 或嵌套委托。预算按已知模型价格预留最坏情况费用,不代表供应商账单封顶;价格未知时拒绝执行。有效期结束或撤权会中止后续调用。`:`Shell, browser, MCP and nested delegation are unavailable. Known model prices reserve worst-case usage; this is not a provider billing guarantee. Unknown pricing is denied. Expiry or revocation stops further calls.`}),(0,S.jsxs)(`label`,{className:`block`,children:[a?`有效时长(分钟)`:`Valid for (minutes)`,(0,S.jsx)(`input`,{type:`number`,min:`1`,max:`43200`,value:Math.max(0,Math.ceil((i.expiresAt-Date.now())/6e4)),onChange:e=>o({...i,expiresAt:Date.now()+Number(e.target.value)*6e4}),className:`ml-2 w-24 rounded border border-edge bg-surface-panel p-1`})]}),(0,S.jsxs)(`label`,{className:`block`,children:[a?`本次授权最多运行次数`:`Maximum runs for this approval`,(0,S.jsx)(`input`,{type:`number`,min:`1`,max:`100`,value:i.maxRuns,onChange:e=>o({...i,maxRuns:Number(e.target.value)}),className:`ml-2 w-24 rounded border border-edge bg-surface-panel p-1`})]}),(0,S.jsxs)(`label`,{className:`block`,children:[a?`模型预留预算(美元)`:`Model reservation budget (USD)`,(0,S.jsx)(`input`,{type:`number`,min:`0`,max:`100`,step:`0.001`,value:i.maxCostMicrousd/1e6,onChange:e=>o({...i,maxCostMicrousd:Math.round(Number(e.target.value)*1e6)}),className:`ml-2 w-24 rounded border border-edge bg-surface-panel p-1`})]}),(0,S.jsxs)(`label`,{className:`flex items-start gap-2`,children:[(0,S.jsx)(`input`,{type:`checkbox`,disabled:!e.runnable||!i.model||i.expiresAt<=Date.now()||i.maxRuns<1,checked:t,onChange:t=>x([...y.filter(t=>t.id!==e.id),...t.target.checked?[{id:e.id,configurationDigest:e.configurationDigest,authority:i}]:[]])}),e.runnable?a?`允许此应用运行以上配置`:`Allow this app to run this configuration`:a?`此自动化当前不可授权执行`:`This automation cannot currently be approved`]})]})]},e.id)}),t[16]=y,t[17]=d?.items,t[18]=l,t[19]=f,t[20]=p,t[21]=x,t[22]=a,t[23]=j):j=t[23];let M;t[24]!==y.length||t[25]!==x||t[26]!==a?(M=y.length?(0,S.jsxs)(`button`,{type:`button`,className:`mt-2 text-xs text-accent`,onClick:()=>x([]),children:[a?`清除所有执行授权`:`Clear all execution approvals`,` (`,y.length,`)`]}):null,t[24]=y.length,t[25]=x,t[26]=a,t[27]=M):M=t[27];let N;return t[28]!==A||t[29]!==j||t[30]!==M||t[31]!==w||t[32]!==E?(N=(0,S.jsxs)(`fieldset`,{className:`rounded-lg border border-edge p-3`,children:[w,E,A,j,M]}),t[28]=A,t[29]=j,t[30]=M,t[31]=w,t[32]=E,t[33]=N):N=t[33],N}function L(e){return[e.kind,e.endpoint??e.conversationId??e.pathTemplate??e.channelId,e.targetId??e.templateId].filter(Boolean).join(`: `)}function R(e){return o(i(e))}function z(e){let t=(0,v.c)(25),{extensionId:n,value:r,onChange:i,zh:a}=e,{data:o,error:s,isLoading:c}=g(`/api/extensions/${encodeURIComponent(n)}/resource-options?kind=connectors`,B),l;t[0]!==r.connectors.bindings||t[1]!==r.connectors.mode?(l=r.connectors.mode===`selected`?r.connectors.bindings:[],t[0]=r.connectors.bindings,t[1]=r.connectors.mode,t[2]=l):l=t[2];let u=l,d=a?`外部服务与账户`:`External services and accounts`,f;t[3]===d?f=t[4]:(f=(0,S.jsx)(`legend`,{className:`text-sm font-medium text-fg`,children:d}),t[3]=d,t[4]=f);let p=a?`仅允许以下账户和操作。读取受连接器现有策略约束;写入每次另行审核。重新连接或操作契约变化后需重新选择,可能产生外部服务费用。`:`Only these accounts and actions. Reads retain existing connector policy; writes require a separate review each time. Reconnection or contract changes require a new selection. External service fees may apply.`,h;t[5]===p?h=t[6]:(h=(0,S.jsx)(`p`,{className:`mb-2 text-xs text-fg-muted`,children:p}),t[5]=p,t[6]=h);let _;t[7]!==u||t[8]!==o?.items||t[9]!==s||t[10]!==c||t[11]!==i||t[12]!==r||t[13]!==a?(_=c?(0,S.jsx)(m,{className:`h-20`}):s?(0,S.jsx)(`p`,{role:`alert`,className:`text-xs text-danger`,children:a?`无法加载连接器`:`Could not load connectors`}):(o?.items??[]).map(e=>(0,S.jsxs)(`label`,{className:`my-2 flex items-start gap-2 text-xs text-fg`,children:[(0,S.jsx)(`input`,{type:`checkbox`,checked:u.some(t=>JSON.stringify(t)===JSON.stringify(e.binding)),onChange:t=>{let n=u.filter(t=>!(t.toolRef===e.binding.toolRef&&t.accountId===e.binding.accountId));t.target.checked&&n.push(e.binding),i({...r,connectors:n.length?{mode:`selected`,bindings:n}:{mode:`none`}})}}),e.title]},e.id)),t[7]=u,t[8]=o?.items,t[9]=s,t[10]=c,t[11]=i,t[12]=r,t[13]=a,t[14]=_):_=t[14];let y;t[15]!==u.length||t[16]!==i||t[17]!==r||t[18]!==a?(y=u.length?(0,S.jsxs)(`button`,{type:`button`,className:`mt-2 text-xs text-accent`,onClick:()=>i({...r,connectors:{mode:`none`}}),children:[a?`清除连接器授权`:`Clear connector approvals`,` (`,u.length,`)`]}):null,t[15]=u.length,t[16]=i,t[17]=r,t[18]=a,t[19]=y):y=t[19];let b;return t[20]!==f||t[21]!==h||t[22]!==_||t[23]!==y?(b=(0,S.jsxs)(`fieldset`,{className:`rounded-lg border border-edge p-3`,children:[f,h,_,y]}),t[20]=f,t[21]=h,t[22]=_,t[23]=y,t[24]=b):b=t[24],b}function B(e){return o(i(e))}function V(e){let t=(0,v.c)(63),{open:n,onOpenChange:r,extensionId:i,extensionName:o,permissions:d,onConfirm:f,confirmDisabled:p,localApp:m,resourceScopes:g,error:y}=e,b=a(U),C=s(b).extensionUi,w;t[0]===g?w=t[1]:(w=()=>h.parse(g??{}),t[0]=g,t[1]=w);let[T,D]=(0,_.useState)(w),O;t[2]!==g||t[3]!==D?(O=()=>D(h.parse(g??{})),t[2]=g,t[3]=D,t[4]=O):O=t[4];let k;t[5]!==i||t[6]!==g?(k=[g,i],t[5]=i,t[6]=g,t[7]=k):k=t[7],(0,_.useEffect)(O,k);let A=l,j=l,M;t[8]===Symbol.for(`react.memo_cache_sentinel`)?(M=(0,S.jsx)(c,{className:`xopc-dialog-overlay fixed inset-0 z-[130] bg-scrim`}),t[8]=M):M=t[8];let N=l,P=H,ee=l,te=C.permissionTitle.replace(`{{name}}`,o),F;t[9]!==ee.Title||t[10]!==te?(F=(0,S.jsx)(ee.Title,{className:`text-base font-semibold text-fg`,children:te}),t[9]=ee.Title,t[10]=te,t[11]=F):F=t[11];let I;t[12]===i?I=t[13]:(I=(0,S.jsxs)(`span`,{className:`font-mono text-xs text-fg-muted`,title:i,children:[`(`,i,`)`]}),t[12]=i,t[13]=I);let L;t[14]!==C.permissionSubtitle||t[15]!==I?(L=(0,S.jsxs)(`p`,{className:`mt-2 text-sm text-fg-muted`,children:[C.permissionSubtitle,` `,I]}),t[14]=C.permissionSubtitle,t[15]=I,t[16]=L):L=t[16];let R;t[17]!==b||t[18]!==d||t[19]!==C.permissionsNone?(R=d.length===0?(0,S.jsx)(`p`,{className:`mt-4 text-sm text-fg-muted`,children:C.permissionsNone}):(0,S.jsx)(`ul`,{className:`mt-4 max-h-48 list-inside list-disc space-y-1 overflow-y-auto text-sm text-fg`,children:d.map(e=>(0,S.jsx)(`li`,{children:x(e,b)},e))}),t[17]=b,t[18]=d,t[19]=C.permissionsNone,t[20]=R):R=t[20];let z;t[21]!==i||t[22]!==b||t[23]!==m||t[24]!==d||t[25]!==T||t[26]!==D?(z=m?(0,S.jsx)(E,{extensionId:i,permissions:d,value:T,onChange:D,zh:b===`zh`}):null,t[21]=i,t[22]=b,t[23]=m,t[24]=d,t[25]=T,t[26]=D,t[27]=z):z=t[27];let B;t[28]!==R||t[29]!==z?(B=(0,S.jsxs)(`div`,{className:`min-h-0 flex-1 overflow-y-auto`,children:[R,z]}),t[28]=R,t[29]=z,t[30]=B):B=t[30];let V;t[31]===y?V=t[32]:(V=y?(0,S.jsx)(`p`,{role:`alert`,className:`mt-2 text-xs text-danger`,children:y}):null,t[31]=y,t[32]=V);let W;t[33]===C.deny?W=t[34]:(W=(0,S.jsx)(u,{asChild:!0,children:(0,S.jsx)(`button`,{type:`button`,className:`rounded-lg border border-edge px-3 py-2 text-sm text-fg hover:bg-surface-inset`,children:C.deny})}),t[33]=C.deny,t[34]=W);let G;t[35]!==m||t[36]!==f||t[37]!==T?(G=()=>{f(m?T:void 0)},t[35]=m,t[36]=f,t[37]=T,t[38]=G):G=t[38];let K;t[39]!==p||t[40]!==C.allow||t[41]!==G?(K=(0,S.jsx)(`button`,{type:`button`,disabled:p,className:`rounded-lg bg-accent px-3 py-2 text-sm font-medium text-on-accent hover:opacity-90`,onClick:G,children:C.allow}),t[39]=p,t[40]=C.allow,t[41]=G,t[42]=K):K=t[42];let q;t[43]!==W||t[44]!==K?(q=(0,S.jsxs)(`div`,{className:`mt-6 flex justify-end gap-2`,children:[W,K]}),t[43]=W,t[44]=K,t[45]=q):q=t[45];let J;t[46]!==F||t[47]!==L||t[48]!==B||t[49]!==V||t[50]!==q||t[51]!==N.Content||t[52]!==P?(J=(0,S.jsxs)(N.Content,{className:`xopc-dialog-content fixed left-1/2 top-1/2 z-[131] flex h-[min(720px,calc(100vh-32px))] w-[min(32rem,calc(100vw-32px))] -translate-x-1/2 -translate-y-1/2 flex-col overflow-hidden rounded-xl border border-edge bg-surface-overlay p-5`,onOpenAutoFocus:P,children:[F,L,B,V,q]}),t[46]=F,t[47]=L,t[48]=B,t[49]=V,t[50]=q,t[51]=N.Content,t[52]=P,t[53]=J):J=t[53];let Y;t[54]!==J||t[55]!==j.Portal||t[56]!==M?(Y=(0,S.jsxs)(j.Portal,{children:[M,J]}),t[54]=J,t[55]=j.Portal,t[56]=M,t[57]=Y):Y=t[57];let X;return t[58]!==r||t[59]!==n||t[60]!==Y||t[61]!==A.Root?(X=(0,S.jsx)(A.Root,{open:n,onOpenChange:r,children:Y}),t[58]=r,t[59]=n,t[60]=Y,t[61]=A.Root,t[62]=X):X=t[62],X}function H(e){return e.preventDefault()}function U(e){return e.language}async function W(e){let{grant:t}=await o(i(`/api/extensions/${encodeURIComponent(e)}/ui-grant`));return t}async function G(e,t,n){return(await o(i(`/api/extensions/${encodeURIComponent(e)}/ui-grant`),{method:`POST`,body:JSON.stringify({manifestDigest:t,resourceScopes:n})})).grant}export{E as i,W as n,V as r,G as t};
|
|
1
|
+
import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{a as t,n,t as r}from"./vendor-react-BOUWij0V.js";import{i,n as a,o}from"./locale-store-B4o4aDCg.js";import{t as s}from"./messages-hlOsXkQ7.js";import{a as c,l,n as u}from"./dist-CY7CS_D3.js";import{i as d,n as f,r as p}from"./popover-select-CLsphyzA.js";import{t as m}from"./skeleton-DzdOeGYz.js";import{p as h}from"./product-delivery-4gEqUIsK.js";import{i as g}from"./vendor-swr-CdRzEUwF.js";var _=e(t(),1),v=n(),y={"capability:xopc.projects.get":`Read approved project details`,"capability:xopc.projects.list":`Search approved projects`,"capability:xopc.projects.list_milestones":`Read approved project milestones`,"capability:xopc.projects.list_updates":`Read approved project progress updates`,"capability:xopc.projects.update":`Update approved project metadata at an exact version`,"capability:xopc.projects.create_milestone":`Create milestones in approved projects`,"capability:xopc.projects.update_milestone":`Update milestones in approved projects`,"capability:xopc.projects.create_update":`Record progress in approved projects`,"capability:xopc.tasks.create":`Capture tasks without starting execution`,"capability:xopc.tasks.update":`Edit approved task details at an exact version`,"capability:xopc.files.read":`Read explicitly selected files and import selected attachments`,"capability:xopc.files.propose_export":`Propose a file export for host review`,"capability:xopc.connectors.describe":`Read contracts of approved connector operations`,"capability:xopc.connectors.read":`Run approved connector read operations on the selected account`,"capability:xopc.connectors.propose_write":`Propose connector writes for individual host review`,"capability:xopc.apps.get_request":`Read this app’s resource request outcomes`,"capability:xopc.automations.simulate":`Validate a proposed automation without running it`,"capability:xopc.automations.propose":`Submit automation changes for separate host review`,"capability:xopc.automations.get_proposal":`Read this app’s proposal review outcomes`,"capability:xopc.automations.history":`Recover this app’s authorized run history`,"capability:xopc.automations.run_events":`Read this app’s sanitized run progress events`,"capability:xopc.automations.list":`List approved automation summaries`,"capability:xopc.automations.get":`Read approved automation summaries`,"capability:xopc.automations.run":`Run individually approved automation configurations (may cause external effects and costs)`,"capability:xopc.automations.get_run":`Read results of runs submitted by this app`,"capability:xopc.automations.cancel":`Request cancellation of runs submitted by this app`,"capability:xopc.agent.delegate":`Delegate bounded text reasoning to the configured model (may incur costs)`,"capability:xopc.notes.create":`Create notes within the approved scope`,"capability:xopc.notes.update":`Change approved notes at an exact revision`,"capability:xopc.notes.append":`Append content to approved notes`,"capability:xopc.notes.get":`Read approved notes by ID`,"capability:xopc.notes.list":`Search and list approved notes`,"capability:xopc.tasks.get":`Read approved task summaries`,"capability:xopc.tasks.list":`Search and list approved task summaries`,theme:`Read theme (light / dark)`,"agent.send":`Send messages to the assistant`,"agent.subscribe":`Receive live agent stream events for a chat`,"session.read":`List and open chat sessions`,"config.read":`Read plugin configuration`,"config.write":`Write plugin configuration`,storage:`Read and write plugin storage`,notification:`Show in-app notifications`},b={"capability:xopc.projects.get":`读取授权项目详情`,"capability:xopc.projects.list":`搜索授权项目`,"capability:xopc.projects.list_milestones":`读取授权项目里程碑`,"capability:xopc.projects.list_updates":`读取授权项目进展`,"capability:xopc.projects.update":`按精确版本更新授权项目资料`,"capability:xopc.projects.create_milestone":`在授权项目内创建里程碑`,"capability:xopc.projects.update_milestone":`更新授权项目的里程碑`,"capability:xopc.projects.create_update":`记录授权项目进展`,"capability:xopc.tasks.create":`收集任务,不启动执行`,"capability:xopc.tasks.update":`按精确版本编辑授权任务资料`,"capability:xopc.files.read":`读取逐项授权的文件及手动选择的附件`,"capability:xopc.files.propose_export":`提出文件导出请求,由宿主审核`,"capability:xopc.connectors.describe":`读取授权连接器操作的接口定义`,"capability:xopc.connectors.read":`在指定账户执行授权的连接器读取操作`,"capability:xopc.connectors.propose_write":`提出连接器写入请求,由宿主逐次审核`,"capability:xopc.apps.get_request":`读取此应用资源请求的结果`,"capability:xopc.automations.simulate":`验证自动化方案,不执行操作`,"capability:xopc.automations.propose":`提交自动化变更,由宿主另行审核`,"capability:xopc.automations.get_proposal":`读取此应用提案的审核结果`,"capability:xopc.automations.history":`恢复此应用有权读取的运行历史`,"capability:xopc.automations.run_events":`读取此应用运行的脱敏进度事件`,"capability:xopc.automations.list":`列出授权范围内的自动化摘要`,"capability:xopc.automations.get":`读取授权范围内的自动化摘要`,"capability:xopc.automations.run":`运行逐项确认的自动化配置(可能产生外部影响和费用)`,"capability:xopc.automations.get_run":`读取此应用发起的自动化运行结果`,"capability:xopc.automations.cancel":`请求取消此应用发起的自动化运行`,"capability:xopc.agent.delegate":`委托已配置模型执行有预算限制的文本推理(可能产生费用)`,"capability:xopc.notes.create":`在授权范围内创建笔记`,"capability:xopc.notes.update":`按精确版本修改授权范围内的笔记`,"capability:xopc.notes.append":`向授权范围内的笔记追加内容`,"capability:xopc.notes.get":`按 ID 读取授权范围内的笔记`,"capability:xopc.notes.list":`搜索和列出授权范围内的笔记`,"capability:xopc.tasks.get":`读取授权范围内的任务摘要`,"capability:xopc.tasks.list":`搜索和列出授权范围内的任务摘要`,theme:`读取主题(浅色/深色)`,"agent.send":`向助手发送消息`,"agent.subscribe":`接收会话的实时助手流式事件`,"session.read":`列出并打开聊天会话`,"config.read":`读取插件配置`,"config.write":`写入插件配置`,storage:`读写插件存储`,notification:`显示应用内通知`};function x(e,t){let n=y[e];return t===`zh`&&b[e]?b[e]:n??e}var S=r();function C(e){let t=(0,v.c)(19),{extensionId:n,kind:r,values:i,onChange:a,zh:o}=e,[s,c]=(0,_.useState)(``),{data:l,error:u,isLoading:f}=g(`/api/extensions/${encodeURIComponent(n)}/resource-options?kind=${r}&search=${encodeURIComponent(s)}`,T),p=r===`notes`?o?`笔记`:`Notes`:r===`tasks`?o?`任务`:`Tasks`:r===`automations`?o?`自动化`:`Automations`:r===`files`?o?`文件`:`Files`:o?`项目`:`Projects`,h;if(t[0]!==l?.items||t[1]!==i){h=(l?.items??[]).map(w);for(let e of i)h.some(t=>t.value===e)||h.push({value:e,label:e});t[0]=l?.items,t[1]=i,t[2]=h}else h=t[2];let y=o?`搜索${p}`:`Search ${p}`,b;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(b=e=>c(e.target.value),t[3]=b):b=t[3];let x=o?`搜索${p}(最多显示 100 项)`:`Search ${p} (up to 100 results)`,C;t[4]!==s||t[5]!==y||t[6]!==x?(C=(0,S.jsx)(`input`,{"aria-label":y,value:s,onChange:b,placeholder:x,className:`w-full rounded-md border border-edge bg-surface-panel px-2 py-1.5 text-xs text-fg`}),t[4]=s,t[5]=y,t[6]=x,t[7]=C):C=t[7];let E;t[8]!==u||t[9]!==f||t[10]!==p||t[11]!==a||t[12]!==h||t[13]!==i||t[14]!==o?(E=(0,S.jsx)(`div`,{className:`mt-1 max-h-36 overflow-y-auto`,children:f?(0,S.jsx)(m,{className:`h-16`}):u?(0,S.jsx)(`p`,{role:`alert`,className:`text-xs text-danger`,children:o?`无法加载,请重试`:`Could not load resources`}):(0,S.jsx)(d,{ariaLabel:p,multiple:!0,options:h,values:i,onChange:a})}),t[8]=u,t[9]=f,t[10]=p,t[11]=a,t[12]=h,t[13]=i,t[14]=o,t[15]=E):E=t[15];let D;return t[16]!==C||t[17]!==E?(D=(0,S.jsxs)(`div`,{className:`mt-2 rounded-lg border border-edge p-2`,children:[C,E]}),t[16]=C,t[17]=E,t[18]=D):D=t[18],D}function w(e){return{value:e.id,label:e.title}}function T(e){return o(i(e))}function E(e){let t=(0,v.c)(92),{extensionId:n,permissions:r,value:i,onChange:a,zh:o}=e,s=o?`读取笔记的范围`:`Notes this app may read`,c;t[0]===r?c=t[1]:(c=r.some(F),t[0]=r,t[1]=c);let l;t[2]!==s||t[3]!==c?(l={key:`notesRead`,label:s,kind:`notes`,visible:c},t[2]=s,t[3]=c,t[4]=l):l=t[4];let u=o?`修改与创建笔记的范围`:`Notes this app may change or create`,d;t[5]===r?d=t[6]:(d=r.some(te),t[5]=r,t[6]=d);let m;t[7]!==u||t[8]!==d?(m={key:`notesWrite`,label:u,kind:`notes`,visible:d},t[7]=u,t[8]=d,t[9]=m):m=t[9];let h=o?`读取任务的范围`:`Tasks this app may read`,g;t[10]===r?g=t[11]:(g=r.some(ee),t[10]=r,t[11]=g);let _;t[12]!==h||t[13]!==g?(_={key:`tasksRead`,label:h,kind:`tasks`,visible:g},t[12]=h,t[13]=g,t[14]=_):_=t[14];let y=o?`读取自动化的范围`:`Automations this app may read`,b;t[15]===r?b=t[16]:(b=r.some(P),t[15]=r,t[16]=b);let x;t[17]!==y||t[18]!==b?(x={key:`automationsRead`,label:y,kind:`automations`,visible:b},t[17]=y,t[18]=b,t[19]=x):x=t[19];let w=o?`创建和更新任务的范围`:`Tasks this app may capture or edit`,T;t[20]===r?T=t[21]:(T=r.some(N),t[20]=r,t[21]=T);let E;t[22]!==w||t[23]!==T?(E={key:`tasksWrite`,label:w,kind:`tasks`,visible:T},t[22]=w,t[23]=T,t[24]=E):E=t[24];let L=o?`读取项目的范围`:`Projects this app may read`,R;t[25]===r?R=t[26]:(R=r.some(M),t[25]=r,t[26]=R);let B;t[27]!==L||t[28]!==R?(B={key:`projectsRead`,label:L,kind:`projects`,visible:R},t[27]=L,t[28]=R,t[29]=B):B=t[29];let V=o?`更新项目和进度的范围`:`Projects this app may update`,H;t[30]===r?H=t[31]:(H=r.some(j),t[30]=r,t[31]=H);let U;t[32]!==V||t[33]!==H?(U={key:`projectsWrite`,label:V,kind:`projects`,visible:H},t[32]=V,t[33]=H,t[34]=U):U=t[34];let W;t[35]!==x||t[36]!==E||t[37]!==B||t[38]!==U||t[39]!==l||t[40]!==m||t[41]!==_?(W=[l,m,_,x,E,B,U],t[35]=x,t[36]=E,t[37]=B,t[38]=U,t[39]=l,t[40]=m,t[41]=_,t[42]=W):W=t[42];let G=W,K;t[43]!==n||t[44]!==a||t[45]!==r||t[46]!==i||t[47]!==o?(K=r.some(A)?(0,S.jsx)(z,{extensionId:n,value:i,onChange:a,zh:o}):null,t[43]=n,t[44]=a,t[45]=r,t[46]=i,t[47]=o,t[48]=K):K=t[48];let q;t[49]!==n||t[50]!==a||t[51]!==r||t[52]!==i||t[53]!==o?(q=r.includes(`capability:xopc.files.read`)?(0,S.jsxs)(`fieldset`,{className:`rounded-lg border border-edge p-3`,children:[(0,S.jsx)(`legend`,{className:`text-sm font-medium text-fg`,children:o?`文件与附件读取`:`File and attachment reads`}),(0,S.jsxs)(`label`,{className:`flex items-start gap-2 text-sm text-fg`,children:[(0,S.jsx)(`input`,{type:`checkbox`,checked:i.filesRead.mode===`selected`,onChange:e=>a({...i,filesRead:e.target.checked?{mode:`selected`,ids:[]}:{mode:`none`}})}),o?`允许读取以下选定的工作区文件(每个最多 512 KiB)`:`Allow reading these selected workspace files (up to 512 KiB each)`]}),i.filesRead.mode===`selected`?(0,S.jsx)(C,{extensionId:n,kind:`files`,values:i.filesRead.ids,zh:o,onChange:e=>a({...i,filesRead:{mode:`selected`,ids:e}})}):null,(0,S.jsxs)(`label`,{className:`mt-2 flex items-start gap-2 text-sm text-fg`,children:[(0,S.jsx)(`input`,{type:`checkbox`,checked:i.filesImport,onChange:e=>a({...i,filesImport:e.target.checked})}),o?`允许在宿主中逐次选择并导入本机附件`:`Allow choosing a local attachment in the host for each import`]})]}):null,t[49]=n,t[50]=a,t[51]=r,t[52]=i,t[53]=o,t[54]=q):q=t[54];let J;t[55]!==a||t[56]!==r||t[57]!==i||t[58]!==o?(J=r.includes(`capability:xopc.files.propose_export`)?(0,S.jsxs)(`label`,{className:`flex items-start gap-2 text-sm text-fg`,children:[(0,S.jsx)(`input`,{type:`checkbox`,checked:i.filesExport,onChange:e=>a({...i,filesExport:e.target.checked})}),o?`允许提出文件导出请求;每次均需在宿主确认保存,不直接覆盖 Gateway 文件`:`Allow export requests; each browser save requires host confirmation and does not overwrite Gateway files`]}):null,t[55]=a,t[56]=r,t[57]=i,t[58]=o,t[59]=J):J=t[59];let Y;t[60]!==a||t[61]!==r||t[62]!==i||t[63]!==o?(Y=r.some(k)?(0,S.jsxs)(`label`,{className:`flex items-start gap-2 text-sm text-fg`,children:[(0,S.jsx)(`input`,{type:`checkbox`,checked:i.automationProposals,onChange:e=>a({...i,automationProposals:e.target.checked})}),o?`允许模拟和提交自动化提案;创建、修改或启用仍须在宿主逐项审核`:`Allow simulation and automation proposals; creation, changes and activation still require host review`]}):null,t[60]=a,t[61]=r,t[62]=i,t[63]=o,t[64]=Y):Y=t[64];let X;t[65]!==a||t[66]!==r||t[67]!==i||t[68]!==o?(X=r.includes(`capability:xopc.agent.delegate`)?(0,S.jsxs)(`fieldset`,{className:`rounded-lg border border-edge p-3`,children:[(0,S.jsx)(`legend`,{className:`text-sm font-medium text-fg`,children:o?`受限 Agent 委托`:`Restricted Agent delegation`}),(0,S.jsxs)(`label`,{className:`flex items-start gap-2 text-sm text-fg`,children:[(0,S.jsx)(`input`,{type:`checkbox`,checked:i.agentDelegate,onChange:e=>a({...i,agentDelegate:e.target.checked})}),o?`允许发送应用指令、上下文和授权引用到已配置的模型`:`Allow sending app instructions, context and approved references to the configured model`]}),(0,S.jsx)(`p`,{className:`mt-2 text-xs text-fg-muted`,children:o?`可能产生模型费用。每应用每小时最多 20 次,每次最多 30 秒、4096 输出 token,支持文本或 JSON。无聊天历史、记忆、文件、工具或自动写入权限。预览不运行真实委托。`:`May incur model costs. Up to 20 calls per app per hour, 30 seconds and 4096 output tokens per call, as text or JSON. No chat history, memory, files, tools or automatic writes. Unavailable in previews.`})]}):null,t[65]=a,t[66]=r,t[67]=i,t[68]=o,t[69]=X):X=t[69];let Z;t[70]!==n||t[71]!==a||t[72]!==r||t[73]!==i||t[74]!==o?(Z=r.some(O)?(0,S.jsx)(I,{extensionId:n,value:i,onChange:a,zh:o}):null,t[70]=n,t[71]=a,t[72]=r,t[73]=i,t[74]=o,t[75]=Z):Z=t[75];let Q;t[76]===G?Q=t[77]:(Q=G.filter(D),t[76]=G,t[77]=Q);let $;t[78]!==n||t[79]!==a||t[80]!==Q||t[81]!==i||t[82]!==o?($=Q.map(e=>{let t=i[e.key],r=t=>a({...i,[e.key]:t});return(0,S.jsxs)(`fieldset`,{className:`min-w-0`,children:[(0,S.jsx)(`legend`,{className:`mb-2 text-sm font-medium text-fg`,children:e.label}),(0,S.jsxs)(f,{"aria-label":e.label,value:t.mode,onChange:e=>r(e.target.value===`selected`?{mode:`selected`,ids:[],projectIds:[],includeCreated:!1}:{mode:e.target.value}),children:[(0,S.jsx)(p,{value:`none`,children:o?`不允许`:`No access`}),(0,S.jsx)(p,{value:`selected`,children:o?`仅选择的记录或项目`:`Selected records or projects`}),(0,S.jsx)(p,{value:`workspace`,children:o?`整个工作区(包含所有记录)`:`Entire workspace (all records)`})]}),t.mode===`workspace`?(0,S.jsx)(`p`,{className:`mt-1 text-xs text-warning`,children:o?`这会授权访问整个工作区,请确认符合此工具的用途。`:`This grants workspace-wide access. Check that this matches the tool’s purpose.`}):null,t.mode===`selected`?(0,S.jsxs)(S.Fragment,{children:[e.kind===`notes`||e.kind===`tasks`?(0,S.jsxs)(`label`,{className:`mt-2 flex items-center gap-2 text-xs text-fg`,children:[(0,S.jsx)(`input`,{type:`checkbox`,checked:t.includeCreated,onChange:e=>r({...t,includeCreated:e.target.checked})}),e.kind===`notes`?o?`包括此应用创建的笔记`:`Include notes created by this app`:o?`包括此应用创建的任务`:`Include tasks created by this app`]}):null,(0,S.jsx)(C,{extensionId:n,kind:e.kind,values:e.kind===`projects`?[...new Set([...t.ids,...t.projectIds])]:t.ids,onChange:n=>r({...t,ids:n,...e.kind===`projects`?{projectIds:[]}:{}}),zh:o}),e.kind===`projects`?null:(0,S.jsxs)(S.Fragment,{children:[(0,S.jsx)(`p`,{className:`mt-2 text-xs text-fg-muted`,children:o?`也可授权以下项目中的记录,包括以后加入项目的记录。`:`You may also allow records in these projects, including future additions.`}),(0,S.jsx)(C,{extensionId:n,kind:`projects`,values:t.projectIds,onChange:e=>r({...t,projectIds:e}),zh:o})]})]}):null]},e.key)}),t[78]=n,t[79]=a,t[80]=Q,t[81]=i,t[82]=o,t[83]=$):$=t[83];let ne;return t[84]!==K||t[85]!==q||t[86]!==J||t[87]!==Y||t[88]!==X||t[89]!==Z||t[90]!==$?(ne=(0,S.jsxs)(`div`,{className:`mt-4 space-y-4`,children:[K,q,J,Y,X,Z,$]}),t[84]=K,t[85]=q,t[86]=J,t[87]=Y,t[88]=X,t[89]=Z,t[90]=$,t[91]=ne):ne=t[91],ne}function D(e){return e.visible}function O(e){return/capability:xopc.automations.(run|cancel)$/.test(e)}function k(e){return/capability:xopc.automations.(propose|get_proposal|simulate)$/.test(e)}function A(e){return/capability:xopc.connectors./.test(e)}function j(e){return/capability:xopc.projects.(update|create_milestone|update_milestone|create_update)$/.test(e)}function M(e){return/capability:xopc.projects.(get|list|list_milestones|list_updates)$/.test(e)}function N(e){return/capability:xopc.tasks.(create|update)$/.test(e)}function P(e){return/capability:xopc.automations.(get|list|get_run|history|run_events)$/.test(e)}function ee(e){return/capability:xopc.tasks.(get|list)$/.test(e)}function te(e){return/capability:xopc.notes.(create|update|append)$/.test(e)}function F(e){return/capability:xopc.notes.(get|list)$/.test(e)}function I(e){let t=(0,v.c)(34),{extensionId:n,value:r,onChange:i,zh:a}=e,[o,s]=(0,_.useState)(``),c;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(c={},t[0]=c):c=t[0];let[l,u]=(0,_.useState)(c),{data:d,error:f,isLoading:p}=g(`/api/extensions/${encodeURIComponent(n)}/resource-options?kind=automations&search=${encodeURIComponent(o)}`,R),h;t[1]!==r.automationsRun.approvals||t[2]!==r.automationsRun.mode?(h=r.automationsRun.mode===`selected`?r.automationsRun.approvals:[],t[1]=r.automationsRun.approvals,t[2]=r.automationsRun.mode,t[3]=h):h=t[3];let y=h,b;t[4]!==i||t[5]!==r?(b=e=>i({...r,automationsRun:e.length?{mode:`selected`,approvals:e}:{mode:`none`}}),t[4]=i,t[5]=r,t[6]=b):b=t[6];let x=b,C=a?`允许执行的自动化`:`Approved automation execution`,w;t[7]===C?w=t[8]:(w=(0,S.jsx)(`legend`,{className:`text-sm font-medium text-fg`,children:C}),t[7]=C,t[8]=w);let T=a?`所选自动化可能使用 Agent 工具、修改文件或向外发送结果,并产生费用。请展开检查后再勾选。应用只能运行确认过的配置,每小时最多 20 次;配置变化需重新授权。授权到期或撤权后,受限运行会中止后续调用。`:`These automations may use Agent tools, change files, send results externally and incur costs. Inspect each before approving. Up to 20 submissions per app per hour. Configuration changes require new approval. Expiry or revocation stops further calls in bounded runs.`,E;t[9]===T?E=t[10]:(E=(0,S.jsx)(`p`,{className:`mb-2 text-xs text-warning`,children:T}),t[9]=T,t[10]=E);let D=a?`搜索可执行自动化`:`Search executable automations`,O;t[11]===Symbol.for(`react.memo_cache_sentinel`)?(O=e=>s(e.target.value),t[11]=O):O=t[11];let k=a?`搜索自动化`:`Search automations`,A;t[12]!==o||t[13]!==k||t[14]!==D?(A=(0,S.jsx)(`input`,{"aria-label":D,value:o,onChange:O,placeholder:k,className:`w-full rounded-md border border-edge bg-surface-panel px-2 py-1.5 text-xs text-fg`}),t[12]=o,t[13]=k,t[14]=D,t[15]=A):A=t[15];let j;t[16]!==y||t[17]!==d?.items||t[18]!==l||t[19]!==f||t[20]!==p||t[21]!==x||t[22]!==a?(j=p?(0,S.jsx)(m,{className:`mt-2 h-16`}):f?(0,S.jsx)(`p`,{role:`alert`,className:`text-xs text-danger`,children:a?`无法加载自动化`:`Could not load automations`}):(d?.items??[]).map(e=>{let t=y.some(t=>t.id===e.id&&t.configurationDigest===e.configurationDigest&&t.authority.model&&t.authority.maxRuns>0&&t.authority.expiresAt>Date.now()),n=!t&&y.some(t=>t.id===e.id),r=e.review.action,i=l[e.id]??y.find(t=>t.id===e.id)?.authority??{model:!1,tools:!1,dataWrite:!1,externalSend:!1,expiresAt:Date.now()+36e5,maxRuns:1,maxCostMicrousd:1e6},o=n=>{u(t=>({...t,[e.id]:n})),t&&x([...y.filter(t=>t.id!==e.id),...n.model?[{id:e.id,configurationDigest:e.configurationDigest,authority:n}]:[]])};return(0,S.jsxs)(`details`,{className:`mt-2 rounded-md border border-edge p-2 text-xs text-fg`,children:[(0,S.jsxs)(`summary`,{className:`cursor-pointer`,children:[e.title,n?a?`(配置已改变,需重新确认)`:` (changed; review again)`:``]}),(0,S.jsxs)(`div`,{className:`mt-2 space-y-2 break-words`,children:[(0,S.jsxs)(`p`,{children:[a?`执行方式`:`Action`,`: `,r.kind===`agent`?`Agent`:r.kind===`task_command`?a?`任务命令`:`Task command`:r.kind]}),r.instruction?(0,S.jsx)(`p`,{className:`whitespace-pre-wrap`,children:r.instruction}):null,r.agentId?(0,S.jsxs)(`p`,{children:[`Agent: `,r.agentId]}):null,r.model?(0,S.jsxs)(`p`,{children:[a?`模型`:`Model`,`: `,r.model]}):null,r.workingDirectory?(0,S.jsxs)(`p`,{children:[a?`工作目录`:`Working directory`,`: `,r.workingDirectory]}):null,r.mcpSourceId?(0,S.jsxs)(`p`,{children:[`MCP: `,r.mcpSourceId]}):null,r.taskId?(0,S.jsxs)(S.Fragment,{children:[(0,S.jsxs)(`p`,{children:[a?`任务`:`Task`,`: `,r.taskId]}),(0,S.jsx)(`pre`,{className:`whitespace-pre-wrap`,children:JSON.stringify(r.command,null,2)})]}):null,(0,S.jsxs)(`p`,{children:[a?`执行策略`:`Safety`,`: `,e.review.safety?.mode??`auto_apply`,` / `,e.review.conversationMode]}),(0,S.jsxs)(`p`,{children:[a?`超时与重试`:`Timeout / retries`,`: `,e.review.reliability?.executionTimeoutSeconds??r.timeoutSeconds??(a?`宿主默认`:`Host default`),` / `,e.review.reliability?.retryCount??0]}),(0,S.jsxs)(`p`,{children:[a?`结果投递`:`Delivery`,`: `,e.review.delivery.destinations.map(L).join(`, `)||(a?`无`:`None`)]}),[`model`,`tools`,`dataWrite`,`externalSend`].map(e=>(0,S.jsxs)(`label`,{className:`flex items-start gap-2`,children:[(0,S.jsx)(`input`,{type:`checkbox`,checked:i[e],onChange:t=>o({...i,[e]:t.target.checked})}),{model:a?`允许模型处理(上下文会发送给模型供应商)`:`Allow model processing (context is disclosed to the provider)`,tools:a?`允许本地文件读取工具`:`Allow local file read tools`,dataWrite:a?`允许本地文件写入(工具写入还需允许工具)`:`Allow local file writes (tool writes also require tools)`,externalSend:a?`允许向以上已审核目标投递结果`:`Allow delivery to the reviewed external destinations`}[e]]},e)),(0,S.jsx)(`p`,{className:`text-fg-muted`,children:a?`不开放 Shell、浏览器、MCP 或嵌套委托。预算按已知模型价格预留最坏情况费用,不代表供应商账单封顶;价格未知时拒绝执行。有效期结束或撤权会中止后续调用。`:`Shell, browser, MCP and nested delegation are unavailable. Known model prices reserve worst-case usage; this is not a provider billing guarantee. Unknown pricing is denied. Expiry or revocation stops further calls.`}),(0,S.jsxs)(`label`,{className:`block`,children:[a?`有效时长(分钟)`:`Valid for (minutes)`,(0,S.jsx)(`input`,{type:`number`,min:`1`,max:`43200`,value:Math.max(0,Math.ceil((i.expiresAt-Date.now())/6e4)),onChange:e=>o({...i,expiresAt:Date.now()+Number(e.target.value)*6e4}),className:`ml-2 w-24 rounded border border-edge bg-surface-panel p-1`})]}),(0,S.jsxs)(`label`,{className:`block`,children:[a?`本次授权最多运行次数`:`Maximum runs for this approval`,(0,S.jsx)(`input`,{type:`number`,min:`1`,max:`100`,value:i.maxRuns,onChange:e=>o({...i,maxRuns:Number(e.target.value)}),className:`ml-2 w-24 rounded border border-edge bg-surface-panel p-1`})]}),(0,S.jsxs)(`label`,{className:`block`,children:[a?`模型预留预算(美元)`:`Model reservation budget (USD)`,(0,S.jsx)(`input`,{type:`number`,min:`0`,max:`100`,step:`0.001`,value:i.maxCostMicrousd/1e6,onChange:e=>o({...i,maxCostMicrousd:Math.round(Number(e.target.value)*1e6)}),className:`ml-2 w-24 rounded border border-edge bg-surface-panel p-1`})]}),(0,S.jsxs)(`label`,{className:`flex items-start gap-2`,children:[(0,S.jsx)(`input`,{type:`checkbox`,disabled:!e.runnable||!i.model||i.expiresAt<=Date.now()||i.maxRuns<1,checked:t,onChange:t=>x([...y.filter(t=>t.id!==e.id),...t.target.checked?[{id:e.id,configurationDigest:e.configurationDigest,authority:i}]:[]])}),e.runnable?a?`允许此应用运行以上配置`:`Allow this app to run this configuration`:a?`此自动化当前不可授权执行`:`This automation cannot currently be approved`]})]})]},e.id)}),t[16]=y,t[17]=d?.items,t[18]=l,t[19]=f,t[20]=p,t[21]=x,t[22]=a,t[23]=j):j=t[23];let M;t[24]!==y.length||t[25]!==x||t[26]!==a?(M=y.length?(0,S.jsxs)(`button`,{type:`button`,className:`mt-2 text-xs text-accent`,onClick:()=>x([]),children:[a?`清除所有执行授权`:`Clear all execution approvals`,` (`,y.length,`)`]}):null,t[24]=y.length,t[25]=x,t[26]=a,t[27]=M):M=t[27];let N;return t[28]!==A||t[29]!==j||t[30]!==M||t[31]!==w||t[32]!==E?(N=(0,S.jsxs)(`fieldset`,{className:`rounded-lg border border-edge p-3`,children:[w,E,A,j,M]}),t[28]=A,t[29]=j,t[30]=M,t[31]=w,t[32]=E,t[33]=N):N=t[33],N}function L(e){return[e.kind,e.endpoint??e.conversationId??e.pathTemplate??e.channelId,e.targetId??e.templateId].filter(Boolean).join(`: `)}function R(e){return o(i(e))}function z(e){let t=(0,v.c)(25),{extensionId:n,value:r,onChange:i,zh:a}=e,{data:o,error:s,isLoading:c}=g(`/api/extensions/${encodeURIComponent(n)}/resource-options?kind=connectors`,B),l;t[0]!==r.connectors.bindings||t[1]!==r.connectors.mode?(l=r.connectors.mode===`selected`?r.connectors.bindings:[],t[0]=r.connectors.bindings,t[1]=r.connectors.mode,t[2]=l):l=t[2];let u=l,d=a?`外部服务与账户`:`External services and accounts`,f;t[3]===d?f=t[4]:(f=(0,S.jsx)(`legend`,{className:`text-sm font-medium text-fg`,children:d}),t[3]=d,t[4]=f);let p=a?`仅允许以下账户和操作。读取受连接器现有策略约束;写入每次另行审核。重新连接或操作契约变化后需重新选择,可能产生外部服务费用。`:`Only these accounts and actions. Reads retain existing connector policy; writes require a separate review each time. Reconnection or contract changes require a new selection. External service fees may apply.`,h;t[5]===p?h=t[6]:(h=(0,S.jsx)(`p`,{className:`mb-2 text-xs text-fg-muted`,children:p}),t[5]=p,t[6]=h);let _;t[7]!==u||t[8]!==o?.items||t[9]!==s||t[10]!==c||t[11]!==i||t[12]!==r||t[13]!==a?(_=c?(0,S.jsx)(m,{className:`h-20`}):s?(0,S.jsx)(`p`,{role:`alert`,className:`text-xs text-danger`,children:a?`无法加载连接器`:`Could not load connectors`}):(o?.items??[]).map(e=>(0,S.jsxs)(`label`,{className:`my-2 flex items-start gap-2 text-xs text-fg`,children:[(0,S.jsx)(`input`,{type:`checkbox`,checked:u.some(t=>JSON.stringify(t)===JSON.stringify(e.binding)),onChange:t=>{let n=u.filter(t=>!(t.toolRef===e.binding.toolRef&&t.accountId===e.binding.accountId));t.target.checked&&n.push(e.binding),i({...r,connectors:n.length?{mode:`selected`,bindings:n}:{mode:`none`}})}}),e.title]},e.id)),t[7]=u,t[8]=o?.items,t[9]=s,t[10]=c,t[11]=i,t[12]=r,t[13]=a,t[14]=_):_=t[14];let y;t[15]!==u.length||t[16]!==i||t[17]!==r||t[18]!==a?(y=u.length?(0,S.jsxs)(`button`,{type:`button`,className:`mt-2 text-xs text-accent`,onClick:()=>i({...r,connectors:{mode:`none`}}),children:[a?`清除连接器授权`:`Clear connector approvals`,` (`,u.length,`)`]}):null,t[15]=u.length,t[16]=i,t[17]=r,t[18]=a,t[19]=y):y=t[19];let b;return t[20]!==f||t[21]!==h||t[22]!==_||t[23]!==y?(b=(0,S.jsxs)(`fieldset`,{className:`rounded-lg border border-edge p-3`,children:[f,h,_,y]}),t[20]=f,t[21]=h,t[22]=_,t[23]=y,t[24]=b):b=t[24],b}function B(e){return o(i(e))}function V(e){let t=(0,v.c)(63),{open:n,onOpenChange:r,extensionId:i,extensionName:o,permissions:d,onConfirm:f,confirmDisabled:p,localApp:m,resourceScopes:g,error:y}=e,b=a(U),C=s(b).extensionUi,w;t[0]===g?w=t[1]:(w=()=>h.parse(g??{}),t[0]=g,t[1]=w);let[T,D]=(0,_.useState)(w),O;t[2]!==g||t[3]!==D?(O=()=>D(h.parse(g??{})),t[2]=g,t[3]=D,t[4]=O):O=t[4];let k;t[5]!==i||t[6]!==g?(k=[g,i],t[5]=i,t[6]=g,t[7]=k):k=t[7],(0,_.useEffect)(O,k);let A=l,j=l,M;t[8]===Symbol.for(`react.memo_cache_sentinel`)?(M=(0,S.jsx)(c,{className:`xopc-dialog-overlay fixed inset-0 z-[130] bg-scrim`}),t[8]=M):M=t[8];let N=l,P=H,ee=l,te=C.permissionTitle.replace(`{{name}}`,o),F;t[9]!==ee.Title||t[10]!==te?(F=(0,S.jsx)(ee.Title,{className:`text-base font-semibold text-fg`,children:te}),t[9]=ee.Title,t[10]=te,t[11]=F):F=t[11];let I;t[12]===i?I=t[13]:(I=(0,S.jsxs)(`span`,{className:`font-mono text-xs text-fg-muted`,title:i,children:[`(`,i,`)`]}),t[12]=i,t[13]=I);let L;t[14]!==C.permissionSubtitle||t[15]!==I?(L=(0,S.jsxs)(`p`,{className:`mt-2 text-sm text-fg-muted`,children:[C.permissionSubtitle,` `,I]}),t[14]=C.permissionSubtitle,t[15]=I,t[16]=L):L=t[16];let R;t[17]!==b||t[18]!==d||t[19]!==C.permissionsNone?(R=d.length===0?(0,S.jsx)(`p`,{className:`mt-4 text-sm text-fg-muted`,children:C.permissionsNone}):(0,S.jsx)(`ul`,{className:`mt-4 max-h-48 list-inside list-disc space-y-1 overflow-y-auto text-sm text-fg`,children:d.map(e=>(0,S.jsx)(`li`,{children:x(e,b)},e))}),t[17]=b,t[18]=d,t[19]=C.permissionsNone,t[20]=R):R=t[20];let z;t[21]!==i||t[22]!==b||t[23]!==m||t[24]!==d||t[25]!==T||t[26]!==D?(z=m?(0,S.jsx)(E,{extensionId:i,permissions:d,value:T,onChange:D,zh:b===`zh`}):null,t[21]=i,t[22]=b,t[23]=m,t[24]=d,t[25]=T,t[26]=D,t[27]=z):z=t[27];let B;t[28]!==R||t[29]!==z?(B=(0,S.jsxs)(`div`,{className:`min-h-0 flex-1 overflow-y-auto`,children:[R,z]}),t[28]=R,t[29]=z,t[30]=B):B=t[30];let V;t[31]===y?V=t[32]:(V=y?(0,S.jsx)(`p`,{role:`alert`,className:`mt-2 text-xs text-danger`,children:y}):null,t[31]=y,t[32]=V);let W;t[33]===C.deny?W=t[34]:(W=(0,S.jsx)(u,{asChild:!0,children:(0,S.jsx)(`button`,{type:`button`,className:`rounded-lg border border-edge px-3 py-2 text-sm text-fg hover:bg-surface-inset`,children:C.deny})}),t[33]=C.deny,t[34]=W);let G;t[35]!==m||t[36]!==f||t[37]!==T?(G=()=>{f(m?T:void 0)},t[35]=m,t[36]=f,t[37]=T,t[38]=G):G=t[38];let K;t[39]!==p||t[40]!==C.allow||t[41]!==G?(K=(0,S.jsx)(`button`,{type:`button`,disabled:p,className:`rounded-lg bg-accent px-3 py-2 text-sm font-medium text-on-accent hover:opacity-90`,onClick:G,children:C.allow}),t[39]=p,t[40]=C.allow,t[41]=G,t[42]=K):K=t[42];let q;t[43]!==W||t[44]!==K?(q=(0,S.jsxs)(`div`,{className:`mt-6 flex justify-end gap-2`,children:[W,K]}),t[43]=W,t[44]=K,t[45]=q):q=t[45];let J;t[46]!==F||t[47]!==L||t[48]!==B||t[49]!==V||t[50]!==q||t[51]!==N.Content||t[52]!==P?(J=(0,S.jsxs)(N.Content,{className:`xopc-dialog-content fixed left-1/2 top-1/2 z-[131] flex h-[min(720px,calc(100vh-32px))] w-[min(32rem,calc(100vw-32px))] -translate-x-1/2 -translate-y-1/2 flex-col overflow-hidden rounded-xl border border-edge bg-surface-overlay p-5`,onOpenAutoFocus:P,children:[F,L,B,V,q]}),t[46]=F,t[47]=L,t[48]=B,t[49]=V,t[50]=q,t[51]=N.Content,t[52]=P,t[53]=J):J=t[53];let Y;t[54]!==J||t[55]!==j.Portal||t[56]!==M?(Y=(0,S.jsxs)(j.Portal,{children:[M,J]}),t[54]=J,t[55]=j.Portal,t[56]=M,t[57]=Y):Y=t[57];let X;return t[58]!==r||t[59]!==n||t[60]!==Y||t[61]!==A.Root?(X=(0,S.jsx)(A.Root,{open:n,onOpenChange:r,children:Y}),t[58]=r,t[59]=n,t[60]=Y,t[61]=A.Root,t[62]=X):X=t[62],X}function H(e){return e.preventDefault()}function U(e){return e.language}async function W(e){let{grant:t}=await o(i(`/api/extensions/${encodeURIComponent(e)}/ui-grant`));return t}async function G(e,t,n){return(await o(i(`/api/extensions/${encodeURIComponent(e)}/ui-grant`),{method:`POST`,body:JSON.stringify({manifestDigest:t,resourceScopes:n})})).grant}export{E as i,W as n,V as r,G as t};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import"./rolldown-runtime-aKtaBQYM.js";import{a as e,n as t,t as n}from"./vendor-react-BOUWij0V.js";import{n as r}from"./locale-store-
|
|
1
|
+
import"./rolldown-runtime-aKtaBQYM.js";import{a as e,n as t,t as n}from"./vendor-react-BOUWij0V.js";import{n as r}from"./locale-store-B4o4aDCg.js";import{t as i}from"./messages-hlOsXkQ7.js";import{r as a}from"./extension-provider-BNnLkq95.js";import{n as o,t as s}from"./settings-page-header-DKgbD0Bc.js";import"./settings-page-layout-BE3vLWp_.js";var c=t();e();var l=n();function u(){let e=(0,c.c)(40),t=r(p),n;e[0]===t?n=e[1]:(n=i(t),e[0]=t,e[1]=n);let u=n.extensionDebug,m=a(),h;e[2]===m?h=e[3]:(h=m.toSorted(f),e[2]=m,e[3]=h);let g=h,_;e[4]!==u.subtitle||e[5]!==u.title?(_=(0,l.jsx)(s,{title:u.title,subtitle:u.subtitle}),e[4]=u.subtitle,e[5]=u.title,e[6]=_):_=e[6];let v;e[7]===u.listHeading?v=e[8]:(v=(0,l.jsx)(`h2`,{className:`text-sm font-semibold text-fg`,children:u.listHeading}),e[7]=u.listHeading,e[8]=v);let y;e[9]===u.colId?y=e[10]:(y=(0,l.jsx)(`th`,{className:`px-3 py-2`,children:u.colId}),e[9]=u.colId,e[10]=y);let b;e[11]===u.colName?b=e[12]:(b=(0,l.jsx)(`th`,{className:`px-3 py-2`,children:u.colName}),e[11]=u.colName,e[12]=b);let x;e[13]===u.colPermissions?x=e[14]:(x=(0,l.jsx)(`th`,{className:`px-3 py-2`,children:u.colPermissions}),e[13]=u.colPermissions,e[14]=x);let S;e[15]!==y||e[16]!==b||e[17]!==x?(S=(0,l.jsx)(`thead`,{children:(0,l.jsxs)(`tr`,{className:`text-xs uppercase text-fg-muted`,children:[y,b,x]})}),e[15]=y,e[16]=b,e[17]=x,e[18]=S):S=e[18];let C;e[19]===g?C=e[20]:(C=g.map(d),e[19]=g,e[20]=C);let w;e[21]===C?w=e[22]:(w=(0,l.jsx)(`tbody`,{children:C}),e[21]=C,e[22]=w);let T;e[23]!==S||e[24]!==w?(T=(0,l.jsx)(`div`,{className:`mt-3 overflow-x-auto`,children:(0,l.jsxs)(`table`,{className:`w-full min-w-[32rem] border-separate border-spacing-y-1 text-left text-sm`,children:[S,w]})}),e[23]=S,e[24]=w,e[25]=T):T=e[25];let E;e[26]!==T||e[27]!==v?(E=(0,l.jsxs)(`section`,{className:`rounded-xl bg-surface-hover/20 p-4`,children:[v,T]}),e[26]=T,e[27]=v,e[28]=E):E=e[28];let D;e[29]===u.futureHeading?D=e[30]:(D=(0,l.jsx)(`h2`,{className:`text-sm font-semibold text-fg`,children:u.futureHeading}),e[29]=u.futureHeading,e[30]=D);let O;e[31]===u.futureBody?O=e[32]:(O=(0,l.jsx)(`p`,{className:`mt-2`,children:u.futureBody}),e[31]=u.futureBody,e[32]=O);let k;e[33]!==D||e[34]!==O?(k=(0,l.jsxs)(`section`,{className:`rounded-xl bg-surface-hover/20 p-4 text-sm text-fg-muted`,children:[D,O]}),e[33]=D,e[34]=O,e[35]=k):k=e[35];let A;return e[36]!==E||e[37]!==k||e[38]!==_?(A=(0,l.jsxs)(o,{gap:`gap-5`,children:[_,E,k]}),e[36]=E,e[37]=k,e[38]=_,e[39]=A):A=e[39],A}function d(e){return(0,l.jsxs)(`tr`,{className:`bg-surface-base/55`,children:[(0,l.jsx)(`td`,{className:`rounded-l-lg px-3 py-2 font-mono text-xs text-fg`,children:e.id}),(0,l.jsx)(`td`,{className:`px-3 py-2 text-fg`,children:e.name}),(0,l.jsx)(`td`,{className:`rounded-r-lg px-3 py-2 font-mono text-xs text-fg-muted`,children:(e.ui?.permissions??[]).join(`, `)||`—`})]},e.id)}function f(e,t){return e.id.localeCompare(t.id)}function p(e){return e.language}export{u as ExtensionDebugPage};
|