@xopcai/xopc 0.0.468 → 0.0.470
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/browser-ext/dist/sidepanel.js +5 -0
- package/dist/browser-ext/manifest.json +1 -1
- package/dist/extensions/telegram/xopc.extension.json +1 -1
- package/dist/gateway/static/root/assets/{agents-CIV2R_El.js → agents-DZftplJc.js} +3 -3
- package/dist/gateway/static/root/assets/{api-Cl08_xtM.js → api-BnS9d0p6.js} +1 -1
- package/dist/gateway/static/root/assets/{app-link-BkEO3eBe.js → app-link-CauYDM-y.js} +1 -1
- package/dist/gateway/static/root/assets/{apps-page-CncU5JvR.js → apps-page-CXKTWj1s.js} +1 -1
- package/dist/gateway/static/root/assets/arrow-down-to-line-C5D8Vt-L.js +1 -0
- package/dist/gateway/static/root/assets/{attachment-load-DrVGNxJm.js → attachment-load-C9iZLUHv.js} +1 -1
- package/dist/gateway/static/root/assets/attachment-preview-renderer-_6GhoCYk.js +12 -0
- package/dist/gateway/static/root/assets/attachment-utils-core-BPYdUI6y.js +1 -0
- package/dist/gateway/static/root/assets/{automation-task-card-sR61FFLn.js → automation-task-card-BNT3n0qu.js} +1 -1
- package/dist/gateway/static/root/assets/{automations-page-BNzj3R7A.js → automations-page-DqrAOReO.js} +1 -1
- package/dist/gateway/static/root/assets/automations-workspace-BYmFhO8E.js +9 -0
- package/dist/gateway/static/root/assets/binary-plugins-CnFVuJtL.js +2 -0
- package/dist/gateway/static/root/assets/{block-editor-B4Yqbxab.js → block-editor-jy5CCmhH.js} +9 -9
- package/dist/gateway/static/root/assets/{capabilities-CBSMm_jo.js → capabilities-CaJjMTli.js} +1 -1
- package/dist/gateway/static/root/assets/capabilities-YmBD7oK8.js +1 -0
- package/dist/gateway/static/root/assets/capabilities-page-XgIRdqCb.js +2 -0
- package/dist/gateway/static/root/assets/capabilities-settings-panel-DfyND0IO.js +8 -0
- package/dist/gateway/static/root/assets/channels-DwUmMnA1.js +1 -0
- package/dist/gateway/static/root/assets/{chat-chart-block-CS-cORJt.js → chat-chart-block-B_c5sy7q.js} +1 -1
- package/dist/gateway/static/root/assets/chat-page-DfFXhDRv.js +72 -0
- package/dist/gateway/static/root/assets/{chat-terminal-dock-D6LH3W5H.js → chat-terminal-dock-Dn7Cm1O4.js} +1 -1
- package/dist/gateway/static/root/assets/{connected-providers-grid-CxeXJKxg.js → connected-providers-grid-DUHMZjyV.js} +1 -1
- package/dist/gateway/static/root/assets/{connector-service-page-Bsec3-eZ.js → connector-service-page-DLbBblN2.js} +1 -1
- package/dist/gateway/static/root/assets/{connectors-page-C0ZCUtxF.js → connectors-page-HHGB3r3Q.js} +1 -1
- package/dist/gateway/static/root/assets/constants-D5Z-mUto.js +1 -0
- package/dist/gateway/static/root/assets/{device-pairing-wizard-diuSsk-H.js → device-pairing-wizard-eWeHH6Ru.js} +1 -1
- package/dist/gateway/static/root/assets/extension-authoritative-grants-BqtUnmq-.js +1 -0
- package/dist/gateway/static/root/assets/{extension-debug-page-DrpE2lQ3.js → extension-debug-page-DIAyDA-a.js} +1 -1
- package/dist/gateway/static/root/assets/{extension-iframe-host-hr60GwXQ.js → extension-iframe-host-CCe4R7L7.js} +1 -1
- package/dist/gateway/static/root/assets/{extension-message-router-aoF3x4-X.js → extension-message-router-BD0ZamBV.js} +1 -1
- package/dist/gateway/static/root/assets/{extension-page-BfM8zli6.js → extension-page-C09dlV3J.js} +1 -1
- package/dist/gateway/static/root/assets/{extension-provider-BcSgVeKW.js → extension-provider-BhluafoX.js} +1 -1
- package/dist/gateway/static/root/assets/{extension-settings-page-Db5t2Mz0.js → extension-settings-page-CB8KLYoG.js} +1 -1
- package/dist/gateway/static/root/assets/file-CStvVK2S.js +1 -0
- package/dist/gateway/static/root/assets/{file-BqMS_3DT.js → file-code-corner-byQA1VfD.js} +1 -1
- package/dist/gateway/static/root/assets/file-icon-N6WjUhq_.js +1 -0
- package/dist/gateway/static/root/assets/file-tree-CYUkQR1t.js +1 -0
- package/dist/gateway/static/root/assets/{home-page-DsS2UT08.js → home-page-8KwhWlYt.js} +3 -3
- package/dist/gateway/static/root/assets/index-CQNwlXpQ.js +11 -0
- package/dist/gateway/static/root/assets/index-CZUfwwLp.css +1 -0
- package/dist/gateway/static/root/assets/{install-connector-dialog-0_PeJJqO.js → install-connector-dialog-BZjodnUC.js} +1 -1
- package/dist/gateway/static/root/assets/local-app-workbench-page-DmzgjJNj.js +1 -0
- package/dist/gateway/static/root/assets/{local-apps-page-yBqRl5Bi.js → local-apps-page-Ct8z2B7R.js} +1 -1
- package/dist/gateway/static/root/assets/logs-page-CH9amuGc.js +2 -0
- package/dist/gateway/static/root/assets/{management-settings-D9HGIYXx.js → management-settings-CUQd0FJ3.js} +1 -1
- package/dist/gateway/static/root/assets/{markdown-view-CiGdWuN3.js → markdown-view-Dm01GIXv.js} +1 -1
- package/dist/gateway/static/root/assets/{media-plugins-C2lp7UmI.js → media-plugins-jsWNdARw.js} +1 -1
- package/dist/gateway/static/root/assets/models-hub-cache-B2QcrY4n.js +1 -0
- package/dist/gateway/static/root/assets/note-detail-panel-DeFb2HEC.js +7 -0
- package/dist/gateway/static/root/assets/note-image-lightbox-DUzoWZEe.js +1 -0
- package/dist/gateway/static/root/assets/notes-api-BMSPkAm8.js +1 -0
- package/dist/gateway/static/root/assets/notes-page-nvqpOeHp.js +8 -0
- package/dist/gateway/static/root/assets/{oauth-provider-connect-BW7zcXfb.js → oauth-provider-connect-BexlZuZ4.js} +1 -1
- package/dist/gateway/static/root/assets/{page-context-capture-button-Cw58-5P3.js → page-context-capture-button-Cn4zi3Mt.js} +1 -1
- package/dist/gateway/static/root/assets/page-header-store-1-lflHAx.js +1 -0
- package/dist/gateway/static/root/assets/personal-avatar-CM3vUGhL.js +1 -0
- package/dist/gateway/static/root/assets/personal-avatar-DsEp8QJ7.css +1 -0
- package/dist/gateway/static/root/assets/personal-page-HFjWZacf.js +1 -0
- package/dist/gateway/static/root/assets/{personal-profile-settings-CDrzvI35.js → personal-profile-settings-CNI5Eor6.js} +1 -1
- package/dist/gateway/static/root/assets/{personal-settings-panel-CoZ3qWSr.js → personal-settings-panel-BcrpYRn9.js} +1 -1
- package/dist/gateway/static/root/assets/{phone-model-connection-UHVwbC3H.js → phone-model-connection-DKvOEjWH.js} +1 -1
- package/dist/gateway/static/root/assets/{phone-settings-page-fS2IT-dK.js → phone-settings-page-DvX6okzz.js} +1 -1
- package/dist/gateway/static/root/assets/playback-coordinator-CWHIf0wr.js +1 -0
- package/dist/gateway/static/root/assets/presentation-D-Ui_vVA.js +1 -0
- package/dist/gateway/static/root/assets/preview-runtime-RnBDP-Lq.js +15 -0
- package/dist/gateway/static/root/assets/product-automation-feedback-xAcXeJM2.js +7 -0
- package/dist/gateway/static/root/assets/product-delivery-4gEqUIsK.js +1 -0
- package/dist/gateway/static/root/assets/{product-open-page-BMJ2x5m3.js → product-open-page-DXwOPgRP.js} +1 -1
- package/dist/gateway/static/root/assets/{product-preview-content-lkkZPvMa.js → product-preview-content-DiQbeaCK.js} +1 -1
- package/dist/gateway/static/root/assets/{product-preview-modal-DtUBJGs5.js → product-preview-modal-BU7Qojpq.js} +2 -2
- package/dist/gateway/static/root/assets/project-detail-page-Dr5_WPRB.js +7 -0
- package/dist/gateway/static/root/assets/{projects-page-Dua6taaG.js → projects-page-DGATZB23.js} +1 -1
- package/dist/gateway/static/root/assets/{providers-api-B6eZLEnh.js → providers-api-BXa2Aheb.js} +1 -1
- package/dist/gateway/static/root/assets/recording-upload-CQdhrRq3.js +1 -0
- package/dist/gateway/static/root/assets/{remote-access-hub-Dy3-oGK1.js → remote-access-hub-_7tmWand.js} +1 -1
- package/dist/gateway/static/root/assets/right-workspace-store-NXMrEuwH.js +1 -0
- package/dist/gateway/static/root/assets/route-preload-D-pdVwIK.js +2 -0
- package/dist/gateway/static/root/assets/routine-panel-rjq-8nZ8.js +2 -0
- package/dist/gateway/static/root/assets/scan-search-CSIGkseh.js +1 -0
- package/dist/gateway/static/root/assets/{service-recommendation-list-CsU74h1b.js → service-recommendation-list-2UOjV0Mx.js} +1 -1
- package/dist/gateway/static/root/assets/session-manager-BVS3zxRZ.js +22 -0
- package/dist/gateway/static/root/assets/{settings-page-ByFNIBfp.js → settings-page-bCW4rave.js} +1 -1
- package/dist/gateway/static/root/assets/{setup-interaction-page-Bsn4Wa4p.js → setup-interaction-page-BYXDX0F2.js} +1 -1
- package/dist/gateway/static/root/assets/{setup-status-panel-CstjOb7g.js → setup-status-panel-Bhda3jS2.js} +1 -1
- package/dist/gateway/static/root/assets/share-preview-page-nzWjWhqF.js +2 -0
- package/dist/gateway/static/root/assets/shares-settings-LB3SYKFS.js +1 -0
- package/dist/gateway/static/root/assets/sheet-C2H8iR8Y.js +1 -0
- package/dist/gateway/static/root/assets/{skills-page-CkkHufmv.js → skills-page-CfhEcU8L.js} +1 -1
- package/dist/gateway/static/root/assets/space-api-DaKpHc_7.js +1 -0
- package/dist/gateway/static/root/assets/space-page-BXyQdUvp.js +2 -0
- package/dist/gateway/static/root/assets/star-BuMAkjC9.js +1 -0
- package/dist/gateway/static/root/assets/task-detail-page-gffrDRvW.js +3 -0
- package/dist/gateway/static/root/assets/task-header-title-DwtjUOBg.js +1 -0
- package/dist/gateway/static/root/assets/{task-result-evidence-dtN1sSjU.js → task-result-evidence-Bmgta9z9.js} +1 -1
- package/dist/gateway/static/root/assets/tasks-BIehlq7k.js +1 -0
- package/dist/gateway/static/root/assets/turn-outcome-BSbEJx8h.js +1 -0
- package/dist/gateway/static/root/assets/use-composer-attachments-sszsCdh5.js +2 -0
- package/dist/gateway/static/root/assets/use-file-preview-expanded-D4b4fDeu.js +1 -0
- package/dist/gateway/static/root/assets/use-personal-profile-CNPszzzT.js +1 -0
- package/dist/gateway/static/root/assets/use-personal-work-C-rw8XVO.js +1 -0
- package/dist/gateway/static/root/assets/{use-realtime-voice-lRHVixh4.js → use-realtime-voice-cugjs8cK.js} +1 -1
- package/dist/gateway/static/root/assets/{use-workspace-tree-DrWnW1aA.js → use-workspace-tree-Crfx5ctU.js} +1 -1
- package/dist/gateway/static/root/assets/{user-model-page-Bw1_PGdD.js → user-model-page-BvnLbTYx.js} +1 -1
- package/dist/gateway/static/root/assets/video-generation-Cec49Jwg.js +1 -0
- package/dist/gateway/static/root/assets/voice-player-store-DZGlzjva.js +1 -0
- package/dist/gateway/static/root/assets/voice-settings-BzfNK5Jm.js +1 -0
- package/dist/gateway/static/root/assets/{work-discovery-overlay-DcZS4OMj.js → work-discovery-overlay-DpEYgcG2.js} +1 -1
- package/dist/gateway/static/root/assets/{work-discovery-page-CZF9iWPT.js → work-discovery-page-DappIHQq.js} +1 -1
- package/dist/gateway/static/root/assets/workspace-api-g-wCKoQU.js +2 -0
- package/dist/gateway/static/root/assets/workspace-file-preview-dialog-DxaxVC3q.js +1 -0
- package/dist/gateway/static/root/assets/workspace-preview-store-DoIjn_2j.js +1 -0
- package/dist/gateway/static/root/index.html +90 -77
- package/dist/package.js +1 -1
- package/dist/packages/gateway-contract/src/automations.js +7 -0
- package/dist/packages/gateway-contract/src/capabilities.js +1 -1
- package/dist/packages/gateway-contract/src/clarifications.js +20 -2
- package/dist/packages/gateway-contract/src/index.js +6 -4
- package/dist/packages/gateway-contract/src/space.js +23 -0
- package/dist/packages/gateway-contract/src/task-lifecycle.js +1 -0
- package/dist/packages/gateway-contract/src/task-result-delivery.js +1 -0
- package/dist/packages/gateway-contract/src/task-runs.js +1 -0
- package/dist/packages/gateway-contract/src/tasks.js +118 -6
- package/dist/packages/gateway-contract/src/turn-outcome.js +16 -2
- package/dist/packages/gateway-contract/src/video-generation.js +29 -4
- package/dist/src/agent/agent-manager.js +2 -2
- package/dist/src/agent/embedded/agent-profile-context.js +1 -1
- package/dist/src/agent/inbound/attachment-pipeline.js +1 -1
- package/dist/src/agent/orchestration/delegation-budget.d.ts +2 -2
- package/dist/src/agent/orchestration/turn-recovery.d.ts +12 -3
- package/dist/src/agent/orchestration/turn-recovery.js +25 -6
- package/dist/src/agent/service/process-direct-streaming.js +1 -1
- package/dist/src/agent/service/webchat-tts.js +1 -1
- package/dist/src/agent/service.js +1 -1
- package/dist/src/agent/tasks/task-judge-service.js +1 -1
- package/dist/src/agent/tools/apply-patch.js +1 -1
- package/dist/src/agent/tools/factory.js +1 -1
- package/dist/src/agent/tools/image-generate-tool.js +1 -0
- package/dist/src/agent/tools/language-diagnostics.js +1 -1
- package/dist/src/agent/tools/personal-task-tool.d.ts +1 -0
- package/dist/src/agent/tools/personal-task-tool.js +12 -7
- package/dist/src/agent/tools/publish-artifacts.js +2 -1
- package/dist/src/agent/tools/review-workspace.js +1 -1
- package/dist/src/agent/tools/send-media.js +1 -0
- package/dist/src/agent/tools/tool-media.d.ts +3 -1
- package/dist/src/agent/tools/tool-media.js +2 -0
- package/dist/src/agent/tools/xopc-use-tool.js +21 -4
- package/dist/src/agent-catalog/test-support.js +1 -1
- package/dist/src/agent-matching/delegation-service.js +1 -1
- package/dist/src/automations/capabilities/drafts.js +1 -1
- package/dist/src/automations/capabilities/write.d.ts +30 -6
- package/dist/src/automations/capabilities/write.js +2 -2
- package/dist/src/automations/configuration-conversation.js +1 -1
- package/dist/src/automations/domain/types.d.ts +6 -0
- package/dist/src/automations/domain/validation.d.ts +60 -12
- package/dist/src/automations/domain/validation.js +7 -0
- package/dist/src/automations/draft/automation-draft-validator.d.ts +12 -3
- package/dist/src/automations/draft/automation-draft-validator.js +1 -0
- package/dist/src/automations/service/action-executor.js +14 -2
- package/dist/src/automations/service/automation-service.js +2 -2
- package/dist/src/browser/providers/browser-ext-install.js +1 -1
- package/dist/src/cli/commands/doctor/checks/database-schema.js +1 -1
- package/dist/src/computer/diagnostics.d.ts +9 -9
- package/dist/src/computer/errors.d.ts +2 -2
- package/dist/src/computer/evaluation.d.ts +7 -7
- package/dist/src/computer/runtime.d.ts +4 -4
- package/dist/src/config/schema.d.ts +2 -2
- package/dist/src/discussions/action-tasks.d.ts +2 -2
- package/dist/src/execution-environments/local-worktree-manager.js +1 -1
- package/dist/src/extensions/agent-plugins/inventory.d.ts +2 -2
- package/dist/src/extensions/agent-plugins/setup.d.ts +3 -3
- package/dist/src/gateway/hono/routes/commands-skills.js +1 -1
- package/dist/src/gateway/hono/routes/connectors.js +2 -2
- package/dist/src/gateway/hono/routes/context-sources.js +1 -1
- package/dist/src/gateway/hono/routes/lazy-bundles.js +8 -0
- package/dist/src/gateway/hono/routes/music-generation.js +2 -0
- package/dist/src/gateway/hono/routes/personal-agent.js +214 -5
- package/dist/src/gateway/hono/routes/phone-setup.js +1 -1
- package/dist/src/gateway/hono/routes/space.d.ts +3 -0
- package/dist/src/gateway/hono/routes/space.js +105 -0
- package/dist/src/gateway/hono/routes/tasks.js +27 -28
- package/dist/src/gateway/hono/routes/video-generation.js +8 -5
- package/dist/src/gateway/html-preview-shell.d.ts +1 -1
- package/dist/src/gateway/html-preview-shell.js +3 -0
- package/dist/src/gateway/media-access.js +2 -2
- package/dist/src/gateway/security/gateway-scopes.js +2 -0
- package/dist/src/gateway/service/config-coordinator.d.ts +1 -1
- package/dist/src/gateway/service.d.ts +1 -0
- package/dist/src/gateway/service.js +10 -3
- package/dist/src/gateway/session-context-summary.js +1 -1
- package/dist/src/gateway/xopc-cloud-capability-setup.d.ts +2 -0
- package/dist/src/gateway/xopc-cloud-capability-setup.js +18 -1
- package/dist/src/home-intelligence/follow-ups.js +2 -1
- package/dist/src/home-intelligence/routines.js +1 -1
- package/dist/src/local-apps/automation-proposals.d.ts +54 -12
- package/dist/src/local-apps/capabilities/projections.d.ts +7 -7
- package/dist/src/local-apps/preview-fixtures.d.ts +1 -1
- package/dist/src/media/session-references.d.ts +4 -1
- package/dist/src/media/session-references.js +40 -8
- package/dist/src/music-generation/artifact.js +3 -1
- package/dist/src/music-generation/providers.js +26 -15
- package/dist/src/music-generation/repository.js +8 -1
- package/dist/src/music-generation/xopc-cloud.d.ts +2 -0
- package/dist/src/music-generation/xopc-cloud.js +38 -0
- package/dist/src/personal-agent/capability-service.js +1 -1
- package/dist/src/personal-agent/proactivity/service.js +1 -1
- package/dist/src/personal-agent/prompt-context.js +1 -1
- package/dist/src/personal-agent/prompts.js +1 -1
- package/dist/src/personal-agent/reply-composer.js +16 -7
- package/dist/src/personal-agent/repository.js +1 -1
- package/dist/src/personal-agent/request-delivery.js +17 -7
- package/dist/src/personal-agent/request-service.js +6 -10
- package/dist/src/personal-agent/result-extraction.js +13 -13
- package/dist/src/personal-agent/schedules.d.ts +9 -0
- package/dist/src/personal-agent/schedules.js +44 -0
- package/dist/src/personal-agent/service.js +1 -1
- package/dist/src/providers/model-catalog-persistence.js +6 -1
- package/dist/src/providers/model-catalog-store.js +1 -0
- package/dist/src/providers/model-catalog-types.d.ts +2 -0
- package/dist/src/providers/xopc-cloud-media-manifest.d.ts +24 -0
- package/dist/src/providers/xopc-cloud-media-manifest.js +28 -0
- package/dist/src/providers/xopc-cloud-media.d.ts +28 -0
- package/dist/src/providers/xopc-cloud-media.js +67 -0
- package/dist/src/providers/xopc-cloud-model-source.js +4 -0
- package/dist/src/runtime-tools/archive.js +1 -1
- package/dist/src/runtime-tools/manager.js +1 -1
- package/dist/src/runtime-tools/phone-dependencies.js +1 -1
- package/dist/src/session/client-history.d.ts +4 -1
- package/dist/src/session/client-history.js +18 -0
- package/dist/src/session/compact-history.js +30 -1
- package/dist/src/session/turn-outcome-projector.js +1 -1
- package/dist/src/space/ingest.d.ts +36 -0
- package/dist/src/space/ingest.js +149 -0
- package/dist/src/space/repository.d.ts +39 -0
- package/dist/src/space/repository.js +325 -0
- package/dist/src/space/worker.d.ts +14 -0
- package/dist/src/space/worker.js +199 -0
- package/dist/src/storage/sqlite/clarification-wait-repository.js +7 -4
- package/dist/src/storage/sqlite/row-mappers.d.ts +1 -0
- package/dist/src/storage/sqlite/row-mappers.js +9 -2
- package/dist/src/storage/sqlite/schema.d.ts +2 -2
- package/dist/src/storage/sqlite/schema.js +8 -7
- package/dist/src/storage/sqlite/schema.sql +103 -0
- package/dist/src/storage/sqlite/transcript-repository.js +8 -0
- package/dist/src/storage/sqlite/upgrades/279_task_model_cutover.sql +288 -0
- package/dist/src/storage/sqlite/upgrades/280_space.sql +61 -0
- package/dist/src/tasks/capabilities/management.d.ts +15 -2
- package/dist/src/tasks/capabilities/management.js +8 -2
- package/dist/src/tasks/capabilities/read.js +14 -2
- package/dist/src/tasks/capabilities/relations.d.ts +13 -7
- package/dist/src/tasks/capabilities/write.d.ts +118 -2
- package/dist/src/tasks/capabilities/write.js +2 -0
- package/dist/src/tasks/home-query-service.js +7 -9
- package/dist/src/tasks/task-allocation-service.js +2 -2
- package/dist/src/tasks/task-application-service.d.ts +8 -2
- package/dist/src/tasks/task-application-service.js +94 -27
- package/dist/src/tasks/task-collaboration-repository.js +12 -1
- package/dist/src/tasks/task-context-assembler.js +9 -3
- package/dist/src/tasks/task-contract-planner.js +1 -3
- package/dist/src/tasks/task-conversation-summary.d.ts +33 -2
- package/dist/src/tasks/task-conversation-summary.js +3 -1
- package/dist/src/tasks/task-criterion-review-repository.d.ts +31 -2
- package/dist/src/tasks/task-criterion-review-repository.js +70 -23
- package/dist/src/tasks/task-deliverables.d.ts +7 -0
- package/dist/src/tasks/task-deliverables.js +112 -0
- package/dist/src/tasks/task-handoff-service.js +1 -1
- package/dist/src/tasks/task-instruction-sequence.js +10 -3
- package/dist/src/tasks/task-json-acceptance.js +3 -5
- package/dist/src/tasks/task-origin-repository.d.ts +99 -1
- package/dist/src/tasks/task-origin-repository.js +67 -5
- package/dist/src/tasks/task-read-model-projector.d.ts +4 -1
- package/dist/src/tasks/task-read-model-projector.js +123 -9
- package/dist/src/tasks/task-repository.d.ts +4 -1
- package/dist/src/tasks/task-repository.js +34 -11
- package/dist/src/tasks/task-research-repair.d.ts +2 -2
- package/dist/src/tasks/task-research-result.d.ts +1 -0
- package/dist/src/tasks/task-research-result.js +13 -3
- package/dist/src/tasks/task-result-delivery-repository.d.ts +4 -3
- package/dist/src/tasks/task-result-delivery-repository.js +35 -17
- package/dist/src/tasks/task-result-delivery-service.js +22 -7
- package/dist/src/tasks/task-result-versions.d.ts +11 -0
- package/dist/src/tasks/task-result-versions.js +34 -0
- package/dist/src/tasks/task-run-coordinator.js +28 -15
- package/dist/src/tasks/task-run-dispatcher.js +29 -4
- package/dist/src/tasks/task-run-repository.d.ts +2 -0
- package/dist/src/tasks/task-run-repository.js +62 -19
- package/dist/src/tasks/task-workspace-verification.d.ts +16 -0
- package/dist/src/tasks/task-workspace-verification.js +95 -0
- package/dist/src/tui/backends/embedded-backend.js +2 -2
- package/dist/src/video-generation/artifact.js +3 -1
- package/dist/src/video-generation/drafts.js +4 -0
- package/dist/src/video-generation/providers.d.ts +1 -0
- package/dist/src/video-generation/providers.js +37 -5
- package/dist/src/video-generation/repository.js +8 -1
- package/dist/src/video-generation/settings.d.ts +1 -0
- package/dist/src/video-generation/settings.js +10 -4
- package/dist/src/voice/realtime/runtime.js +1 -1
- package/package.json +1 -1
- package/dist/gateway/static/root/assets/attachment-preview-renderer-DdOEgexg.js +0 -12
- package/dist/gateway/static/root/assets/attachment-utils-core-BIOUBrpT.js +0 -1
- package/dist/gateway/static/root/assets/automations-workspace-BWpA-X_S.js +0 -9
- package/dist/gateway/static/root/assets/binary-plugins-BjEE5sVq.js +0 -2
- package/dist/gateway/static/root/assets/capabilities-EmBa4Blq.js +0 -1
- package/dist/gateway/static/root/assets/capabilities-page-BQf7oyqc.js +0 -2
- package/dist/gateway/static/root/assets/capabilities-settings-panel-hlByP8SE.js +0 -8
- package/dist/gateway/static/root/assets/channels-oyMymJDx.js +0 -1
- package/dist/gateway/static/root/assets/chat-page-hcsqrv-7.js +0 -71
- package/dist/gateway/static/root/assets/constants-Bg1wM2nv.js +0 -1
- package/dist/gateway/static/root/assets/extension-authoritative-grants-CVQ7q0DU.js +0 -1
- package/dist/gateway/static/root/assets/file-tree-CFlZnV3Y.js +0 -1
- package/dist/gateway/static/root/assets/index-DFa0pZhC.js +0 -11
- package/dist/gateway/static/root/assets/index-DHPaL7Ku.css +0 -1
- package/dist/gateway/static/root/assets/local-app-workbench-page-OSinc6m6.js +0 -1
- package/dist/gateway/static/root/assets/local-apps-DeqzkJiF.js +0 -1
- package/dist/gateway/static/root/assets/logs-page-BJxQ_Jd5.js +0 -2
- package/dist/gateway/static/root/assets/models-hub-cache-CmdULYFt.js +0 -1
- package/dist/gateway/static/root/assets/note-detail-panel-CVEG1JdF.js +0 -7
- package/dist/gateway/static/root/assets/note-image-lightbox-WA8FiHsm.js +0 -1
- package/dist/gateway/static/root/assets/notes-api-BQXOYFQ5.js +0 -1
- package/dist/gateway/static/root/assets/notes-page-Cc-c1Yhg.js +0 -8
- package/dist/gateway/static/root/assets/page-header-store-DwFwq_lI.js +0 -1
- package/dist/gateway/static/root/assets/personal-avatar-B-Oes3ef.js +0 -1
- package/dist/gateway/static/root/assets/personal-avatar-BUCb7OiW.css +0 -1
- package/dist/gateway/static/root/assets/personal-page-DWPu-iwK.js +0 -1
- package/dist/gateway/static/root/assets/phone-DdhTnt6X.js +0 -1
- package/dist/gateway/static/root/assets/product-automation-feedback-DrBclzH1.js +0 -7
- package/dist/gateway/static/root/assets/product-delivery-CnvCn9L-.js +0 -1
- package/dist/gateway/static/root/assets/project-detail-page-DGFUj6jS.js +0 -7
- package/dist/gateway/static/root/assets/recording-upload-DXxD6grq.js +0 -1
- package/dist/gateway/static/root/assets/right-workspace-store-BzXnZDK5.js +0 -1
- package/dist/gateway/static/root/assets/route-preload-8KCgPcjp.js +0 -2
- package/dist/gateway/static/root/assets/routine-panel-BALhliq6.js +0 -2
- package/dist/gateway/static/root/assets/session-manager-Cby6Nkib.js +0 -25
- package/dist/gateway/static/root/assets/share-preview-page-9pOnypJv.js +0 -2
- package/dist/gateway/static/root/assets/shares-settings-CJdVDQqf.js +0 -1
- package/dist/gateway/static/root/assets/star-CnYNmpLd.js +0 -1
- package/dist/gateway/static/root/assets/task-detail-page-BjBkKeIf.js +0 -3
- package/dist/gateway/static/root/assets/tasks-BTLabOMp.js +0 -1
- package/dist/gateway/static/root/assets/use-composer-attachments-BEYkb8cs.js +0 -2
- package/dist/gateway/static/root/assets/use-file-preview-expanded-CQeo2Ztn.js +0 -15
- package/dist/gateway/static/root/assets/use-personal-profile-CKm5FaTl.js +0 -1
- package/dist/gateway/static/root/assets/video-generation-D08uZbsu.js +0 -1
- package/dist/gateway/static/root/assets/voice-settings-CssuMBjt.js +0 -1
- package/dist/gateway/static/root/assets/with-selector-xonYxPoM.js +0 -1
- package/dist/gateway/static/root/assets/workspace-api-BfApIXLw.js +0 -2
- package/dist/gateway/static/root/assets/workspace-file-preview-dialog-BRhsCs1S.js +0 -1
- package/dist/gateway/static/root/assets/workspace-preview-store-BrofEVle.js +0 -1
|
@@ -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-Cit_aHqC.js";import{t as s}from"./messages-DQveK9sk.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-Cc4hUNTt.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-BkEO3eBe.js";import{t as M}from"./use-async-resource-BHFGZCY2.js";import{t as N}from"./copy-text-row-CpiRzq4G.js";import{a as re,n as P,r as F}from"./oauth-api-Bz_PU9R_.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-BkhCBt38.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-CiwuuyV8.js";import{n as o}from"./locale-store-Cit_aHqC.js";import{t as s}from"./messages-DQveK9sk.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-Cc4hUNTt.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-CpiRzq4G.js";import{a as re,n as P,r as F}from"./oauth-api-Bz_PU9R_.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-BkhCBt38.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};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{a as t,n,t as r}from"./vendor-react-BOUWij0V.js";import{i,n as a,o}from"./locale-store-Cit_aHqC.js";import{t as s}from"./messages-DQveK9sk.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-Cit_aHqC.js";import{t as i}from"./messages-DQveK9sk.js";import{r as a}from"./extension-provider-
|
|
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-Cit_aHqC.js";import{t as i}from"./messages-DQveK9sk.js";import{r as a}from"./extension-provider-BhluafoX.js";import{n as o,t as s}from"./settings-page-header-B9Y_eGcH.js";import"./settings-page-layout-D1MgJ5zP.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};
|
|
@@ -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,l as a,n as o,o as s}from"./locale-store-Cit_aHqC.js";import{t as ee}from"./messages-DQveK9sk.js";import{a as c,i as l,o as u,r as d,s as te,t as f}from"./dist-CY7CS_D3.js";import{t as p}from"./skeleton-DzdOeGYz.js";import{i as m}from"./vendor-swr-CdRzEUwF.js";import{i as h}from"./theme-store-C1MxmBg7.js";import{n as g}from"./extension-provider-BcSgVeKW.js";import{r as _}from"./extension-message-router-aoF3x4-X.js";import{r as v}from"./settings-form-draft-Dy10ldo8.js";import{n as y,r as b,t as x}from"./extension-authoritative-grants-CVQ7q0DU.js";var S=e(t(),1),ne=n();function C(e){return e.split(`/`).filter(Boolean).map(e=>encodeURIComponent(e)).join(`/`)}function w(e,t){let n=C(t);return i(`/api/extensions/${encodeURIComponent(e)}/assets/${n}`)}var T=r();function E({extensionId:e,proposalId:t,zh:n,onClose:r}){let a=`/api/extensions/${encodeURIComponent(e)}/automation-proposals/${encodeURIComponent(t)}`,{data:o,error:ee,isLoading:h}=m(a,e=>s(i(e))),[g,_]=(0,S.useState)(!1),[v,y]=(0,S.useState)(!1),[b,x]=(0,S.useState)(``),ne=async e=>{if(o){y(!0),x(``);try{await s(i(`${a}/review`),{method:`POST`,body:JSON.stringify({digest:o.proposal.digest,approve:e,enable:e&&(o.proposal.decision?.enable??g)})}),r()}catch(e){x(e instanceof Error?e.message:String(e))}finally{y(!1)}}};return(0,T.jsx)(f,{open:!0,onOpenChange:e=>{!e&&!v&&r()},children:(0,T.jsxs)(u,{children:[(0,T.jsx)(c,{className:`fixed inset-0 z-[130] bg-scrim`}),(0,T.jsxs)(d,{className:`fixed left-1/2 top-1/2 z-[131] flex h-[min(720px,calc(100vh-32px))] w-[min(42rem,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`,children:[(0,T.jsx)(te,{className:`text-base font-semibold text-fg`,children:n?`审核应用提出的自动化`:`Review app automation proposal`}),(0,T.jsx)(l,{className:`mt-2 text-sm text-fg-muted`,children:n?`只有你在宿主中确认,才会创建或修改自动化。关闭此窗口不会批准提案。`:`Only your confirmation here creates or changes an automation. Closing this window grants nothing.`}),(0,T.jsx)(`div`,{className:`mt-3 min-h-0 flex-1 space-y-3 overflow-y-auto text-sm text-fg`,children:h?(0,T.jsx)(p,{className:`h-48`}):ee?(0,T.jsx)(`p`,{role:`alert`,children:n?`无法读取提案,请重新打开或检查授权。`:`Could not load proposal. Reopen or check authorization.`}):o?(0,T.jsxs)(T.Fragment,{children:[(0,T.jsxs)(`p`,{children:[n?`状态`:`Status`,`: `,o.proposal.status]}),o.proposal.decision?(0,T.jsx)(`p`,{children:n?`审核正在应用;重试将核对原操作结果。`:`Review is being applied; retry to reconcile the original operation.`}):null,o.simulation?(0,T.jsxs)(T.Fragment,{children:[(0,T.jsx)(`p`,{children:o.simulation.triggerSummary}),(0,T.jsx)(`p`,{children:o.simulation.actionSummary}),[...o.simulation.safetyNotes,...o.simulation.requiredConfirmations].map((e,t)=>(0,T.jsx)(`p`,{className:`text-warning`,children:e},t))]}):null,o.before?(0,T.jsxs)(`details`,{children:[(0,T.jsx)(`summary`,{children:n?`变更前的完整配置`:`Full configuration before change`}),(0,T.jsx)(`pre`,{className:`whitespace-pre-wrap break-all text-xs`,children:JSON.stringify(o.before,null,2)})]}):null,o.definition?(0,T.jsxs)(`details`,{open:!0,children:[(0,T.jsx)(`summary`,{children:n?`待采用的完整配置`:`Full proposed configuration`}),(0,T.jsx)(`pre`,{className:`whitespace-pre-wrap break-all text-xs`,children:JSON.stringify(o.definition,null,2)})]}):null,o.proposal.status===`pending`?(0,T.jsxs)(`label`,{className:`flex items-start gap-2 text-sm`,children:[(0,T.jsx)(`input`,{type:`checkbox`,disabled:!!o.proposal.decision,checked:o.proposal.decision?.enable??g,onChange:e=>_(e.target.checked)}),n?`采用后启用。计划将由宿主持续管理,可能调用工具、产生费用或对外发送结果;不会受应用手动运行的次数预算约束。`:`Enable after adoption. The host will manage this schedule independently; it may use tools, incur costs or send results. App manual-run budgets do not limit this adopted schedule.`]}):null]}):null}),b?(0,T.jsx)(`p`,{role:`alert`,className:`mt-2 text-xs text-danger`,children:b}):null,(0,T.jsxs)(`div`,{className:`mt-4 flex justify-end gap-2`,children:[(0,T.jsx)(`button`,{type:`button`,disabled:v,onClick:r,className:`rounded-lg border border-edge px-3 py-2`,children:n?`关闭`:`Close`}),(0,T.jsx)(`button`,{type:`button`,disabled:v||!o||!!o.proposal.decision||o.proposal.status!==`pending`,onClick:()=>void ne(!1),className:`rounded-lg border border-edge px-3 py-2`,children:n?`拒绝提案`:`Reject proposal`}),(0,T.jsx)(`button`,{type:`button`,disabled:v||!o||o.proposal.status!==`pending`,onClick:()=>void ne(!0),className:`rounded-lg bg-accent px-3 py-2 text-on-accent`,children:n?`确认采用`:`Approve proposal`})]})]})]})})}function D({extensionId:e,requestId:t,zh:n,onClose:r}){let a=`/api/extensions/${encodeURIComponent(e)}/resource-requests/${encodeURIComponent(t)}`,{data:o,isLoading:ee,error:h}=m(a,e=>s(i(e))),[g,_]=(0,S.useState)(!1),[v,y]=(0,S.useState)(``),b=async e=>{if(o){_(!0),y(``);try{let t=await s(i(`${a}/review`),{method:`POST`,body:JSON.stringify({digest:o.request.digest,approve:e})});if(e&&t.status===`approved`&&o.request.kind===`export`){let e=o.request.input,t=e.encoding===`base64`?Uint8Array.from(atob(e.content??``),e=>e.charCodeAt(0)):new TextEncoder().encode(e.content??``),n=URL.createObjectURL(new Blob([t],{type:`application/octet-stream`})),r=document.createElement(`a`);r.href=n,r.download=e.name??`export.bin`,document.body.append(r),r.click(),r.remove(),setTimeout(()=>URL.revokeObjectURL(n),3e4)}r()}catch(e){y(e instanceof Error?e.message:String(e))}finally{_(!1)}}};return(0,T.jsx)(f,{open:!0,onOpenChange:e=>{!e&&!g&&r()},children:(0,T.jsxs)(u,{children:[(0,T.jsx)(c,{className:`fixed inset-0 z-[130] bg-scrim`}),(0,T.jsxs)(d,{className:`fixed left-1/2 top-1/2 z-[131] flex h-[min(720px,calc(100vh-32px))] w-[min(42rem,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`,children:[(0,T.jsx)(te,{className:`text-base font-semibold text-fg`,children:n?`审核应用资源请求`:`Review app resource request`}),(0,T.jsx)(l,{className:`mt-2 text-sm text-fg-muted`,children:n?`连接器操作绑定以下账户和完整参数,可能产生外部影响或费用。文件导出由浏览器保存,不覆盖 Gateway 文件。关闭窗口不会批准请求。`:`Connector operations use the exact account and arguments below and may cause external effects or fees. Exports are browser saves and do not overwrite Gateway files. Closing grants nothing.`}),(0,T.jsx)(`div`,{className:`mt-3 min-h-0 flex-1 space-y-3 overflow-y-auto text-sm text-fg`,children:ee?(0,T.jsx)(p,{className:`h-48`}):h?(0,T.jsx)(`p`,{role:`alert`,children:n?`无法读取请求,请检查授权后重试。`:`Could not load request. Check authorization and retry.`}):o?(0,T.jsxs)(T.Fragment,{children:[(0,T.jsxs)(`p`,{children:[n?`状态`:`Status`,`: `,o.request.status]}),o.request.accountLabel?(0,T.jsxs)(`p`,{children:[n?`账户`:`Account`,`: `,o.request.accountLabel]}):null,o.request.binding?(0,T.jsx)(`pre`,{className:`whitespace-pre-wrap break-all text-xs`,children:JSON.stringify(o.request.binding,null,2)}):null,(0,T.jsx)(`pre`,{className:`whitespace-pre-wrap break-all text-xs`,children:JSON.stringify(o.request.input,null,2)})]}):null}),v?(0,T.jsx)(`p`,{role:`alert`,className:`mt-2 text-xs text-danger`,children:v}):null,(0,T.jsxs)(`div`,{className:`mt-4 flex justify-end gap-2`,children:[(0,T.jsx)(`button`,{type:`button`,disabled:g,onClick:r,className:`rounded-lg border border-edge px-3 py-2`,children:n?`关闭`:`Close`}),(0,T.jsx)(`button`,{type:`button`,disabled:g||!o||o.request.status!==`pending`,onClick:()=>void b(!1),className:`rounded-lg border border-edge px-3 py-2`,children:n?`拒绝请求`:`Reject request`}),(0,T.jsx)(`button`,{type:`button`,disabled:g||!o||![`pending`,`approved`].includes(o.request.status),onClick:()=>void b(!0),className:`rounded-lg bg-accent px-3 py-2 text-on-accent`,children:o?.request.kind===`export`?n?`确认并保存文件`:`Approve and save file`:n?`确认执行`:`Approve execution`})]})]})]})})}function re(e){let t=(0,ne.c)(36),{prompt:n,zh:r,onClose:i}=e,[a,o]=(0,S.useState)(``),[s,ee]=(0,S.useState)(!1),p;t[0]!==i||t[1]!==n?(p=()=>{n.finish().catch(O),i()},t[0]=i,t[1]=n,t[2]=p):p=t[2];let m=p,h;t[3]!==s||t[4]!==m?(h=e=>{!e&&!s&&m()},t[3]=s,t[4]=m,t[5]=h):h=t[5];let g;t[6]===Symbol.for(`react.memo_cache_sentinel`)?(g=(0,T.jsx)(c,{className:`fixed inset-0 z-[130] bg-scrim`}),t[6]=g):g=t[6];let _=r?`选择要交给应用的附件`:`Choose an attachment for this app`,v;t[7]===_?v=t[8]:(v=(0,T.jsx)(te,{className:`text-base font-semibold text-fg`,children:_}),t[7]=_,t[8]=v);let y=r?`应用将获得你在此选择的文件内容(最多 512 KiB),不会获得本机路径。取消不会交付任何文件。`:`The app receives the chosen file content (up to 512 KiB), without your local path. Canceling delivers nothing.`,b;t[9]===y?b=t[10]:(b=(0,T.jsx)(l,{className:`mt-2 text-sm text-fg-muted`,children:y}),t[9]=y,t[10]=b);let x=r?`选择附件`:`Choose attachment`,C;t[11]!==i||t[12]!==n||t[13]!==r?(C=e=>{let t=e.target.files?.[0];if(t){if(t.size>524288){o(r?`文件超过 512 KiB`:`File exceeds 512 KiB`);return}ee(!0),o(``),t.arrayBuffer().then(async e=>{let r=new Uint8Array(e),a=``;for(let e=0;e<r.length;e+=8192)a+=String.fromCharCode(...r.subarray(e,e+8192));await n.finish({name:t.name,mimeType:t.type||`application/octet-stream`,size:r.length,encoding:`base64`,content:btoa(a)}),i()}).catch(e=>o(e instanceof Error?e.message:String(e))).finally(()=>ee(!1))}},t[11]=i,t[12]=n,t[13]=r,t[14]=C):C=t[14];let w;t[15]!==s||t[16]!==x||t[17]!==C?(w=(0,T.jsx)(`input`,{type:`file`,"aria-label":x,disabled:s,onChange:C}),t[15]=s,t[16]=x,t[17]=C,t[18]=w):w=t[18];let E;t[19]===a?E=t[20]:(E=a?(0,T.jsx)(`p`,{role:`alert`,className:`mt-3 text-sm text-danger`,children:a}):null,t[19]=a,t[20]=E);let D;t[21]!==w||t[22]!==E?(D=(0,T.jsxs)(`div`,{className:`mt-4 min-h-0 flex-1 overflow-y-auto`,children:[w,E]}),t[21]=w,t[22]=E,t[23]=D):D=t[23];let re=r?`取消`:`Cancel`,k;t[24]!==s||t[25]!==m||t[26]!==re?(k=(0,T.jsx)(`div`,{className:`mt-4 flex justify-end`,children:(0,T.jsx)(`button`,{type:`button`,disabled:s,onClick:m,className:`rounded-lg border border-edge px-3 py-2`,children:re})}),t[24]=s,t[25]=m,t[26]=re,t[27]=k):k=t[27];let A;t[28]!==D||t[29]!==k||t[30]!==v||t[31]!==b?(A=(0,T.jsxs)(u,{children:[g,(0,T.jsxs)(d,{className:`fixed left-1/2 top-1/2 z-[131] flex h-[min(360px,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`,children:[v,b,D,k]})]}),t[28]=D,t[29]=k,t[30]=v,t[31]=b,t[32]=A):A=t[32];let ie;return t[33]!==A||t[34]!==h?(ie=(0,T.jsx)(f,{open:!0,onOpenChange:h,children:A}),t[33]=A,t[34]=h,t[35]=ie):ie=t[35],ie}function O(){}var k=48,A=2e3,ie=`allow-scripts allow-forms allow-popups`;function j(e){let t=(0,ne.c)(155),{extensionId:n,extensionName:r,entrypoint:i,permissions:s,title:c,className:l,fixedHeight:u,maxHeight:d,minHeight:te,initialData:f}=e,p=d===void 0?A:d,m=te===void 0?k:te,C=o(ce),O;t[0]===C?O=t[1]:(O=ee(C),t[0]=C,t[1]=O);let j=O.extensionUi,M=g(),N=a(se),P=a(oe),F=(0,S.useRef)(0),le=(0,S.useRef)(!1),[I,ue]=(0,S.useState)(null),[L,de]=(0,S.useState)(null),[R,fe]=(0,S.useState)(null),[pe,me]=(0,S.useState)(null),he;t[2]!==n||t[3]!==N||t[4]!==P?(he=JSON.stringify([n,N,P]),t[2]=n,t[3]=N,t[4]=P,t[5]=he):he=t[5];let z=he,ge,_e;t[6]!==n||t[7]!==z?(ge=()=>{let e=e=>{let t=e.detail;t?.extensionId===n&&fe({id:t.requestId,identity:z})},t=e=>{let t=e.detail;t?.extensionId===n&&me({prompt:t,identity:z})};return window.addEventListener(`extension-review-resource-request`,e),window.addEventListener(`extension-pick-attachment`,t),()=>{window.removeEventListener(`extension-review-resource-request`,e),window.removeEventListener(`extension-pick-attachment`,t)}},_e=[n,z],t[6]=n,t[7]=z,t[8]=ge,t[9]=_e):(ge=t[8],_e=t[9]),(0,S.useEffect)(ge,_e);let ve,ye;t[10]!==n||t[11]!==z?(ve=()=>{let e=e=>{let t=e.detail;t?.extensionId===n&&de({id:t.proposalId,identity:z})};return window.addEventListener(`extension-review-automation-proposal`,e),()=>window.removeEventListener(`extension-review-automation-proposal`,e)},ye=[n,z],t[10]=n,t[11]=z,t[12]=ve,t[13]=ye):(ve=t[12],ye=t[13]),(0,S.useEffect)(ve,ye);let be=(0,S.useRef)(null),xe=h(ae),Se;t[14]!==n||t[15]!==r?(Se=r?.trim()||n,t[14]=n,t[15]=r,t[16]=Se):Se=t[16];let Ce=Se,we;t[17]!==n||t[18]!==c?(we=c?.trim()||`Extension ${n}`,t[17]=n,t[18]=c,t[19]=we):we=t[19];let Te=we,Ee;t[20]===s?Ee=t[21]:(Ee=JSON.stringify(Array.from(s??[]).toSorted()),t[20]=s,t[21]=Ee);let De=Ee,Oe;t[22]===De?Oe=t[23]:(Oe=JSON.parse(De),t[22]=De,t[23]=Oe);let ke=Oe,Ae=u??Math.min(p,Math.max(m,320)),je;t[24]===Symbol.for(`react.memo_cache_sentinel`)?(je=[],t[24]=je):je=t[24];let Me;t[25]===Ae?Me=t[26]:(Me={allowed:!1,dialogOpen:!1,reloadKey:0,loadError:!1,dynamicHeight:Ae,grantResolved:!1,grantError:null,manifestDigest:null,grantedPermissions:je},t[25]=Ae,t[26]=Me);let[B,V]=(0,S.useReducer)(v,Me),{allowed:H,dialogOpen:U,reloadKey:W,loadError:Ne,dynamicHeight:Pe,grantResolved:Fe,grantError:G}=B,Ie;t[27]===n?Ie=t[28]:(Ie=()=>{let e=!0;return le.current=!1,ue(null),V({type:`patch`,patch:{allowed:!1,dialogOpen:!1,grantResolved:!1,grantError:null,manifestDigest:null,grantedPermissions:[]}}),y(n).then(t=>{if(e){if(t.extensionId!==n||!t.manifestDigest)throw Error(`Could not verify plugin permissions`);V({type:`patch`,patch:{allowed:t.granted,dialogOpen:!t.granted,grantResolved:!0,manifestDigest:t.manifestDigest,grantedPermissions:t.permissions,grantRevision:t.grantRevision,localApp:!!t.appId,resourceScopes:t.resourceScopes}})}}).catch(t=>{e&&V({type:`patch`,patch:{allowed:!1,dialogOpen:!0,grantResolved:!0,grantError:t instanceof Error?t.message:String(t)}})}),()=>{e=!1,F.current+=1}},t[27]=n,t[28]=Ie);let Le;t[29]!==n||t[30]!==N||t[31]!==P||t[32]!==ke||t[33]!==W?(Le=[n,ke,N,P,W],t[29]=n,t[30]=N,t[31]=P,t[32]=ke,t[33]=W,t[34]=Le):Le=t[34],(0,S.useEffect)(Ie,Le);let Re;t[35]===Symbol.for(`react.memo_cache_sentinel`)?(Re=e=>V({type:`patch`,patch:{dialogOpen:e}}),t[35]=Re):Re=t[35];let ze=Re,Be,Ve;t[36]!==n||t[37]!==N||t[38]!==P||t[39]!==j.loadFailed?(Be=()=>{let e=e=>{if(e.detail?.extensionId!==n)return;let t=F.current;y(n).then(e=>{t!==F.current||a.getState().baseUrl!==N||a.getState().conversationId!==P||(ue(e),V({type:`patch`,patch:{dialogOpen:!0,grantError:null}}))}).catch(()=>V({type:`patch`,patch:{grantError:j.loadFailed}}))};return window.addEventListener(`extension-review-permissions`,e),()=>window.removeEventListener(`extension-review-permissions`,e)},Ve=[n,N,P,j.loadFailed],t[36]=n,t[37]=N,t[38]=P,t[39]=j.loadFailed,t[40]=Be,t[41]=Ve):(Be=t[40],Ve=t[41]),(0,S.useEffect)(Be,Ve);let He;t[42]!==i||t[43]!==n?(He=w(n,i),t[42]=i,t[43]=n,t[44]=He):He=t[44];let Ue=He,We;t[45]!==H||t[46]!==n||t[47]!==u||t[48]!==p||t[49]!==m||t[50]!==M||t[51]!==B.grantRevision||t[52]!==B.grantedPermissions||t[53]!==B.localApp||t[54]!==B.manifestDigest?(We=()=>{if(!H)return;let e=be.current;if(!e)return;B.localApp?M.registerIframe(n,e,B.grantedPermissions,B.manifestDigest??void 0,B.grantRevision,!0):M.registerIframe(n,e,B.grantedPermissions,B.manifestDigest??void 0);let t=M.subscribeExtensionEvents(n,e=>{if(e.event!==`ui.resize`||!e.data||typeof e.data!=`object`||e.data===null)return;let t=Number(e.data.height);Number.isFinite(t)&&u===void 0&&V({type:`patch`,patch:{dynamicHeight:Math.min(p,Math.max(m,t))}})});return()=>{t(),M.unregisterIframe(n)}},t[45]=H,t[46]=n,t[47]=u,t[48]=p,t[49]=m,t[50]=M,t[51]=B.grantRevision,t[52]=B.grantedPermissions,t[53]=B.localApp,t[54]=B.manifestDigest,t[55]=We):We=t[55];let Ge;t[56]!==H||t[57]!==n||t[58]!==u||t[59]!==p||t[60]!==m||t[61]!==W||t[62]!==M||t[63]!==B.grantRevision||t[64]!==B.grantedPermissions||t[65]!==B.localApp||t[66]!==B.manifestDigest?(Ge=[H,n,u,p,m,B.grantedPermissions,B.manifestDigest,B.grantRevision,B.localApp,M,W],t[56]=H,t[57]=n,t[58]=u,t[59]=p,t[60]=m,t[61]=W,t[62]=M,t[63]=B.grantRevision,t[64]=B.grantedPermissions,t[65]=B.localApp,t[66]=B.manifestDigest,t[67]=Ge):Ge=t[67],(0,S.useLayoutEffect)(We,Ge);let Ke,qe;t[68]!==H||t[69]!==n||t[70]!==xe||t[71]!==M?(Ke=()=>{if(!H)return;let e=_(xe);M.sendEvent(n,`theme.changed`,e)},qe=[H,n,xe,M],t[68]=H,t[69]=n,t[70]=xe,t[71]=M,t[72]=Ke,t[73]=qe):(Ke=t[72],qe=t[73]),(0,S.useEffect)(Ke,qe);let Je;t[74]!==Pe||t[75]!==u?(Je=u===void 0?{width:`100%`,height:Pe,border:`none`}:{width:`100%`,height:u,border:`none`},t[74]=Pe,t[75]=u,t[76]=Je):Je=t[76];let Ye=Je,Xe;t[77]!==H||t[78]!==n||t[79]!==N||t[80]!==P||t[81]!==W||t[82]!==I?.manifestDigest||t[83]!==B.localApp||t[84]!==B.manifestDigest?(Xe=e=>{let t=I?.manifestDigest??B.manifestDigest;if(le.current||!t)return;le.current=!0;let r=F.current,i=()=>F.current===r&&a.getState().baseUrl===N&&a.getState().conversationId===P;(B.localApp?x(n,t,e):x(n,t)).then(e=>{if(i()){if(!e.granted||e.extensionId!==n||e.manifestDigest!==t)throw Error(`Permission grant was not persisted`);ue(null),V({type:`patch`,patch:{allowed:!0,dialogOpen:!1,grantError:null,manifestDigest:e.manifestDigest,grantedPermissions:e.permissions,grantRevision:e.grantRevision,resourceScopes:e.resourceScopes,reloadKey:H?W+1:W}})}}).catch(e=>{i()&&V({type:`patch`,patch:{allowed:!1,manifestDigest:null,grantError:e instanceof Error?e.message:String(e)}})}).finally(()=>{i()&&(le.current=!1)})},t[77]=H,t[78]=n,t[79]=N,t[80]=P,t[81]=W,t[82]=I?.manifestDigest,t[83]=B.localApp,t[84]=B.manifestDigest,t[85]=Xe):Xe=t[85];let Ze=Xe,Qe=I?.permissions??B.grantedPermissions,$e=I?.resourceScopes??B.resourceScopes,et=!(I?.manifestDigest??B.manifestDigest),tt;t[86]!==U||t[87]!==Ce||t[88]!==n||t[89]!==G||t[90]!==Ze||t[91]!==Qe||t[92]!==$e||t[93]!==et||t[94]!==B.localApp?(tt=(0,T.jsx)(b,{open:U,onOpenChange:ze,extensionId:n,extensionName:Ce,permissions:Qe,localApp:B.localApp,resourceScopes:$e,error:G,confirmDisabled:et,onConfirm:Ze}),t[86]=U,t[87]=Ce,t[88]=n,t[89]=G,t[90]=Ze,t[91]=Qe,t[92]=$e,t[93]=et,t[94]=B.localApp,t[95]=tt):tt=t[95];let K=tt;if(!Fe){let e=`${l??``} min-h-32 animate-pulse rounded-lg bg-surface-inset`,n;return t[96]===e?n=t[97]:(n=(0,T.jsx)(`div`,{className:e}),t[96]=e,t[97]=n),n}if(!H){let e;t[98]!==l||t[99]!==U||t[100]!==G||t[101]!==W||t[102]!==j.deniedHint||t[103]!==j.reviewPermissions?(e=U?null:(0,T.jsxs)(`div`,{className:l?`${l} rounded-lg border border-edge border-dashed bg-surface-base p-4 text-sm text-fg-muted`:`rounded-lg border border-edge border-dashed bg-surface-base p-4 text-sm text-fg-muted`,children:[G?(0,T.jsx)(`p`,{className:`mb-2 text-danger`,children:G}):null,(0,T.jsx)(`p`,{children:j.deniedHint}),(0,T.jsx)(`button`,{type:`button`,className:`mt-2 text-sm font-medium text-accent underline-offset-2 hover:underline`,onClick:()=>V({type:`patch`,patch:{reloadKey:W+1}}),children:j.reviewPermissions})]}),t[98]=l,t[99]=U,t[100]=G,t[101]=W,t[102]=j.deniedHint,t[103]=j.reviewPermissions,t[104]=e):e=t[104];let n;return t[105]!==K||t[106]!==e?(n=(0,T.jsxs)(T.Fragment,{children:[K,e]}),t[105]=K,t[106]=e,t[107]=n):n=t[107],n}let q;t[108]!==n||t[109]!==C||t[110]!==z||t[111]!==R||t[112]!==B.localApp?(q=B.localApp&&R?.identity===z?(0,T.jsx)(D,{extensionId:n,requestId:R.id,zh:C===`zh`,onClose:()=>fe(null)},R.id):null,t[108]=n,t[109]=C,t[110]=z,t[111]=R,t[112]=B.localApp,t[113]=q):q=t[113];let J;t[114]!==pe||t[115]!==C||t[116]!==z||t[117]!==B.localApp?(J=B.localApp&&pe?.identity===z?(0,T.jsx)(re,{prompt:pe.prompt,zh:C===`zh`,onClose:()=>me(null)}):null,t[114]=pe,t[115]=C,t[116]=z,t[117]=B.localApp,t[118]=J):J=t[118];let Y;t[119]!==n||t[120]!==C||t[121]!==z||t[122]!==L||t[123]!==B.localApp?(Y=B.localApp&&L?.identity===z?(0,T.jsx)(E,{extensionId:n,proposalId:L.id,zh:C===`zh`,onClose:()=>de(null)},L.id):null,t[119]=n,t[120]=C,t[121]=z,t[122]=L,t[123]=B.localApp,t[124]=Y):Y=t[124];let X;t[125]===G?X=t[126]:(X=G?(0,T.jsx)(`p`,{role:`alert`,className:`p-3 text-sm text-danger`,children:G}):null,t[125]=G,t[126]=X);let Z;t[127]!==Ne||t[128]!==W||t[129]!==j.loadFailed||t[130]!==j.loadFailedConnectionHint||t[131]!==j.retryLoad?(Z=Ne?(0,T.jsxs)(`div`,{className:`mb-2 rounded-lg border border-amber-500/40 bg-amber-500/10 px-3 py-2 text-sm text-fg`,children:[(0,T.jsx)(`p`,{children:j.loadFailed}),(0,T.jsx)(`p`,{className:`mt-2 text-xs text-fg-muted`,children:j.loadFailedConnectionHint}),(0,T.jsx)(`button`,{type:`button`,className:`mt-2 font-medium text-accent underline-offset-2 hover:underline`,onClick:()=>{V({type:`patch`,patch:{loadError:!1,reloadKey:W+1}})},children:j.retryLoad})]}):null,t[127]=Ne,t[128]=W,t[129]=j.loadFailed,t[130]=j.loadFailedConnectionHint,t[131]=j.retryLoad,t[132]=Z):Z=t[132];let nt=`${n}-${i}-${W}`,rt=B.localApp?`allow-scripts`:ie,it;t[133]===Symbol.for(`react.memo_cache_sentinel`)?(it=()=>V({type:`patch`,patch:{loadError:!0}}),t[133]=it):it=t[133];let Q;t[134]!==n||t[135]!==f||t[136]!==C||t[137]!==M?(Q=()=>{V({type:`patch`,patch:{loadError:!1}}),M.sendInit(n,_(h.getState().resolved),C),f!==void 0&&M.sendEvent(n,`widget.data`,f)},t[134]=n,t[135]=f,t[136]=C,t[137]=M,t[138]=Q):Q=t[138];let $;t[139]!==l||t[140]!==Te||t[141]!==Ue||t[142]!==Ye||t[143]!==nt||t[144]!==rt||t[145]!==Q?($=(0,T.jsx)(`iframe`,{ref:be,className:l,title:Te,src:Ue,style:Ye,sandbox:rt,referrerPolicy:`no-referrer`,onError:it,onLoad:Q},nt),t[139]=l,t[140]=Te,t[141]=Ue,t[142]=Ye,t[143]=nt,t[144]=rt,t[145]=Q,t[146]=$):$=t[146];let at;return t[147]!==K||t[148]!==q||t[149]!==J||t[150]!==Y||t[151]!==X||t[152]!==Z||t[153]!==$?(at=(0,T.jsxs)(`div`,{className:`flex flex-1 min-h-0 min-w-0 flex-col`,children:[q,J,Y,K,X,Z,$]}),t[147]=K,t[148]=q,t[149]=J,t[150]=Y,t[151]=X,t[152]=Z,t[153]=$,t[154]=at):at=t[154],at}function ae(e){return e.resolved}function oe(e){return e.conversationId}function se(e){return e.baseUrl}function ce(e){return e.language}export{j 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,l as a,n as o,o as s}from"./locale-store-Cit_aHqC.js";import{t as ee}from"./messages-DQveK9sk.js";import{a as c,i as l,o as u,r as d,s as te,t as f}from"./dist-CY7CS_D3.js";import{t as p}from"./skeleton-DzdOeGYz.js";import{i as m}from"./vendor-swr-CdRzEUwF.js";import{i as h}from"./theme-store-C1MxmBg7.js";import{n as g}from"./extension-provider-BhluafoX.js";import{r as _}from"./extension-message-router-BD0ZamBV.js";import{r as v}from"./settings-form-draft-Dy10ldo8.js";import{n as y,r as b,t as x}from"./extension-authoritative-grants-BqtUnmq-.js";var S=e(t(),1),ne=n();function C(e){return e.split(`/`).filter(Boolean).map(e=>encodeURIComponent(e)).join(`/`)}function w(e,t){let n=C(t);return i(`/api/extensions/${encodeURIComponent(e)}/assets/${n}`)}var T=r();function E({extensionId:e,proposalId:t,zh:n,onClose:r}){let a=`/api/extensions/${encodeURIComponent(e)}/automation-proposals/${encodeURIComponent(t)}`,{data:o,error:ee,isLoading:h}=m(a,e=>s(i(e))),[g,_]=(0,S.useState)(!1),[v,y]=(0,S.useState)(!1),[b,x]=(0,S.useState)(``),ne=async e=>{if(o){y(!0),x(``);try{await s(i(`${a}/review`),{method:`POST`,body:JSON.stringify({digest:o.proposal.digest,approve:e,enable:e&&(o.proposal.decision?.enable??g)})}),r()}catch(e){x(e instanceof Error?e.message:String(e))}finally{y(!1)}}};return(0,T.jsx)(f,{open:!0,onOpenChange:e=>{!e&&!v&&r()},children:(0,T.jsxs)(u,{children:[(0,T.jsx)(c,{className:`fixed inset-0 z-[130] bg-scrim`}),(0,T.jsxs)(d,{className:`fixed left-1/2 top-1/2 z-[131] flex h-[min(720px,calc(100vh-32px))] w-[min(42rem,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`,children:[(0,T.jsx)(te,{className:`text-base font-semibold text-fg`,children:n?`审核应用提出的自动化`:`Review app automation proposal`}),(0,T.jsx)(l,{className:`mt-2 text-sm text-fg-muted`,children:n?`只有你在宿主中确认,才会创建或修改自动化。关闭此窗口不会批准提案。`:`Only your confirmation here creates or changes an automation. Closing this window grants nothing.`}),(0,T.jsx)(`div`,{className:`mt-3 min-h-0 flex-1 space-y-3 overflow-y-auto text-sm text-fg`,children:h?(0,T.jsx)(p,{className:`h-48`}):ee?(0,T.jsx)(`p`,{role:`alert`,children:n?`无法读取提案,请重新打开或检查授权。`:`Could not load proposal. Reopen or check authorization.`}):o?(0,T.jsxs)(T.Fragment,{children:[(0,T.jsxs)(`p`,{children:[n?`状态`:`Status`,`: `,o.proposal.status]}),o.proposal.decision?(0,T.jsx)(`p`,{children:n?`审核正在应用;重试将核对原操作结果。`:`Review is being applied; retry to reconcile the original operation.`}):null,o.simulation?(0,T.jsxs)(T.Fragment,{children:[(0,T.jsx)(`p`,{children:o.simulation.triggerSummary}),(0,T.jsx)(`p`,{children:o.simulation.actionSummary}),[...o.simulation.safetyNotes,...o.simulation.requiredConfirmations].map((e,t)=>(0,T.jsx)(`p`,{className:`text-warning`,children:e},t))]}):null,o.before?(0,T.jsxs)(`details`,{children:[(0,T.jsx)(`summary`,{children:n?`变更前的完整配置`:`Full configuration before change`}),(0,T.jsx)(`pre`,{className:`whitespace-pre-wrap break-all text-xs`,children:JSON.stringify(o.before,null,2)})]}):null,o.definition?(0,T.jsxs)(`details`,{open:!0,children:[(0,T.jsx)(`summary`,{children:n?`待采用的完整配置`:`Full proposed configuration`}),(0,T.jsx)(`pre`,{className:`whitespace-pre-wrap break-all text-xs`,children:JSON.stringify(o.definition,null,2)})]}):null,o.proposal.status===`pending`?(0,T.jsxs)(`label`,{className:`flex items-start gap-2 text-sm`,children:[(0,T.jsx)(`input`,{type:`checkbox`,disabled:!!o.proposal.decision,checked:o.proposal.decision?.enable??g,onChange:e=>_(e.target.checked)}),n?`采用后启用。计划将由宿主持续管理,可能调用工具、产生费用或对外发送结果;不会受应用手动运行的次数预算约束。`:`Enable after adoption. The host will manage this schedule independently; it may use tools, incur costs or send results. App manual-run budgets do not limit this adopted schedule.`]}):null]}):null}),b?(0,T.jsx)(`p`,{role:`alert`,className:`mt-2 text-xs text-danger`,children:b}):null,(0,T.jsxs)(`div`,{className:`mt-4 flex justify-end gap-2`,children:[(0,T.jsx)(`button`,{type:`button`,disabled:v,onClick:r,className:`rounded-lg border border-edge px-3 py-2`,children:n?`关闭`:`Close`}),(0,T.jsx)(`button`,{type:`button`,disabled:v||!o||!!o.proposal.decision||o.proposal.status!==`pending`,onClick:()=>void ne(!1),className:`rounded-lg border border-edge px-3 py-2`,children:n?`拒绝提案`:`Reject proposal`}),(0,T.jsx)(`button`,{type:`button`,disabled:v||!o||o.proposal.status!==`pending`,onClick:()=>void ne(!0),className:`rounded-lg bg-accent px-3 py-2 text-on-accent`,children:n?`确认采用`:`Approve proposal`})]})]})]})})}function D({extensionId:e,requestId:t,zh:n,onClose:r}){let a=`/api/extensions/${encodeURIComponent(e)}/resource-requests/${encodeURIComponent(t)}`,{data:o,isLoading:ee,error:h}=m(a,e=>s(i(e))),[g,_]=(0,S.useState)(!1),[v,y]=(0,S.useState)(``),b=async e=>{if(o){_(!0),y(``);try{let t=await s(i(`${a}/review`),{method:`POST`,body:JSON.stringify({digest:o.request.digest,approve:e})});if(e&&t.status===`approved`&&o.request.kind===`export`){let e=o.request.input,t=e.encoding===`base64`?Uint8Array.from(atob(e.content??``),e=>e.charCodeAt(0)):new TextEncoder().encode(e.content??``),n=URL.createObjectURL(new Blob([t],{type:`application/octet-stream`})),r=document.createElement(`a`);r.href=n,r.download=e.name??`export.bin`,document.body.append(r),r.click(),r.remove(),setTimeout(()=>URL.revokeObjectURL(n),3e4)}r()}catch(e){y(e instanceof Error?e.message:String(e))}finally{_(!1)}}};return(0,T.jsx)(f,{open:!0,onOpenChange:e=>{!e&&!g&&r()},children:(0,T.jsxs)(u,{children:[(0,T.jsx)(c,{className:`fixed inset-0 z-[130] bg-scrim`}),(0,T.jsxs)(d,{className:`fixed left-1/2 top-1/2 z-[131] flex h-[min(720px,calc(100vh-32px))] w-[min(42rem,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`,children:[(0,T.jsx)(te,{className:`text-base font-semibold text-fg`,children:n?`审核应用资源请求`:`Review app resource request`}),(0,T.jsx)(l,{className:`mt-2 text-sm text-fg-muted`,children:n?`连接器操作绑定以下账户和完整参数,可能产生外部影响或费用。文件导出由浏览器保存,不覆盖 Gateway 文件。关闭窗口不会批准请求。`:`Connector operations use the exact account and arguments below and may cause external effects or fees. Exports are browser saves and do not overwrite Gateway files. Closing grants nothing.`}),(0,T.jsx)(`div`,{className:`mt-3 min-h-0 flex-1 space-y-3 overflow-y-auto text-sm text-fg`,children:ee?(0,T.jsx)(p,{className:`h-48`}):h?(0,T.jsx)(`p`,{role:`alert`,children:n?`无法读取请求,请检查授权后重试。`:`Could not load request. Check authorization and retry.`}):o?(0,T.jsxs)(T.Fragment,{children:[(0,T.jsxs)(`p`,{children:[n?`状态`:`Status`,`: `,o.request.status]}),o.request.accountLabel?(0,T.jsxs)(`p`,{children:[n?`账户`:`Account`,`: `,o.request.accountLabel]}):null,o.request.binding?(0,T.jsx)(`pre`,{className:`whitespace-pre-wrap break-all text-xs`,children:JSON.stringify(o.request.binding,null,2)}):null,(0,T.jsx)(`pre`,{className:`whitespace-pre-wrap break-all text-xs`,children:JSON.stringify(o.request.input,null,2)})]}):null}),v?(0,T.jsx)(`p`,{role:`alert`,className:`mt-2 text-xs text-danger`,children:v}):null,(0,T.jsxs)(`div`,{className:`mt-4 flex justify-end gap-2`,children:[(0,T.jsx)(`button`,{type:`button`,disabled:g,onClick:r,className:`rounded-lg border border-edge px-3 py-2`,children:n?`关闭`:`Close`}),(0,T.jsx)(`button`,{type:`button`,disabled:g||!o||o.request.status!==`pending`,onClick:()=>void b(!1),className:`rounded-lg border border-edge px-3 py-2`,children:n?`拒绝请求`:`Reject request`}),(0,T.jsx)(`button`,{type:`button`,disabled:g||!o||![`pending`,`approved`].includes(o.request.status),onClick:()=>void b(!0),className:`rounded-lg bg-accent px-3 py-2 text-on-accent`,children:o?.request.kind===`export`?n?`确认并保存文件`:`Approve and save file`:n?`确认执行`:`Approve execution`})]})]})]})})}function re(e){let t=(0,ne.c)(36),{prompt:n,zh:r,onClose:i}=e,[a,o]=(0,S.useState)(``),[s,ee]=(0,S.useState)(!1),p;t[0]!==i||t[1]!==n?(p=()=>{n.finish().catch(O),i()},t[0]=i,t[1]=n,t[2]=p):p=t[2];let m=p,h;t[3]!==s||t[4]!==m?(h=e=>{!e&&!s&&m()},t[3]=s,t[4]=m,t[5]=h):h=t[5];let g;t[6]===Symbol.for(`react.memo_cache_sentinel`)?(g=(0,T.jsx)(c,{className:`fixed inset-0 z-[130] bg-scrim`}),t[6]=g):g=t[6];let _=r?`选择要交给应用的附件`:`Choose an attachment for this app`,v;t[7]===_?v=t[8]:(v=(0,T.jsx)(te,{className:`text-base font-semibold text-fg`,children:_}),t[7]=_,t[8]=v);let y=r?`应用将获得你在此选择的文件内容(最多 512 KiB),不会获得本机路径。取消不会交付任何文件。`:`The app receives the chosen file content (up to 512 KiB), without your local path. Canceling delivers nothing.`,b;t[9]===y?b=t[10]:(b=(0,T.jsx)(l,{className:`mt-2 text-sm text-fg-muted`,children:y}),t[9]=y,t[10]=b);let x=r?`选择附件`:`Choose attachment`,C;t[11]!==i||t[12]!==n||t[13]!==r?(C=e=>{let t=e.target.files?.[0];if(t){if(t.size>524288){o(r?`文件超过 512 KiB`:`File exceeds 512 KiB`);return}ee(!0),o(``),t.arrayBuffer().then(async e=>{let r=new Uint8Array(e),a=``;for(let e=0;e<r.length;e+=8192)a+=String.fromCharCode(...r.subarray(e,e+8192));await n.finish({name:t.name,mimeType:t.type||`application/octet-stream`,size:r.length,encoding:`base64`,content:btoa(a)}),i()}).catch(e=>o(e instanceof Error?e.message:String(e))).finally(()=>ee(!1))}},t[11]=i,t[12]=n,t[13]=r,t[14]=C):C=t[14];let w;t[15]!==s||t[16]!==x||t[17]!==C?(w=(0,T.jsx)(`input`,{type:`file`,"aria-label":x,disabled:s,onChange:C}),t[15]=s,t[16]=x,t[17]=C,t[18]=w):w=t[18];let E;t[19]===a?E=t[20]:(E=a?(0,T.jsx)(`p`,{role:`alert`,className:`mt-3 text-sm text-danger`,children:a}):null,t[19]=a,t[20]=E);let D;t[21]!==w||t[22]!==E?(D=(0,T.jsxs)(`div`,{className:`mt-4 min-h-0 flex-1 overflow-y-auto`,children:[w,E]}),t[21]=w,t[22]=E,t[23]=D):D=t[23];let re=r?`取消`:`Cancel`,k;t[24]!==s||t[25]!==m||t[26]!==re?(k=(0,T.jsx)(`div`,{className:`mt-4 flex justify-end`,children:(0,T.jsx)(`button`,{type:`button`,disabled:s,onClick:m,className:`rounded-lg border border-edge px-3 py-2`,children:re})}),t[24]=s,t[25]=m,t[26]=re,t[27]=k):k=t[27];let A;t[28]!==D||t[29]!==k||t[30]!==v||t[31]!==b?(A=(0,T.jsxs)(u,{children:[g,(0,T.jsxs)(d,{className:`fixed left-1/2 top-1/2 z-[131] flex h-[min(360px,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`,children:[v,b,D,k]})]}),t[28]=D,t[29]=k,t[30]=v,t[31]=b,t[32]=A):A=t[32];let ie;return t[33]!==A||t[34]!==h?(ie=(0,T.jsx)(f,{open:!0,onOpenChange:h,children:A}),t[33]=A,t[34]=h,t[35]=ie):ie=t[35],ie}function O(){}var k=48,A=2e3,ie=`allow-scripts allow-forms allow-popups`;function j(e){let t=(0,ne.c)(155),{extensionId:n,extensionName:r,entrypoint:i,permissions:s,title:c,className:l,fixedHeight:u,maxHeight:d,minHeight:te,initialData:f}=e,p=d===void 0?A:d,m=te===void 0?k:te,C=o(ce),O;t[0]===C?O=t[1]:(O=ee(C),t[0]=C,t[1]=O);let j=O.extensionUi,M=g(),N=a(se),P=a(oe),F=(0,S.useRef)(0),le=(0,S.useRef)(!1),[I,ue]=(0,S.useState)(null),[L,de]=(0,S.useState)(null),[R,fe]=(0,S.useState)(null),[pe,me]=(0,S.useState)(null),he;t[2]!==n||t[3]!==N||t[4]!==P?(he=JSON.stringify([n,N,P]),t[2]=n,t[3]=N,t[4]=P,t[5]=he):he=t[5];let z=he,ge,_e;t[6]!==n||t[7]!==z?(ge=()=>{let e=e=>{let t=e.detail;t?.extensionId===n&&fe({id:t.requestId,identity:z})},t=e=>{let t=e.detail;t?.extensionId===n&&me({prompt:t,identity:z})};return window.addEventListener(`extension-review-resource-request`,e),window.addEventListener(`extension-pick-attachment`,t),()=>{window.removeEventListener(`extension-review-resource-request`,e),window.removeEventListener(`extension-pick-attachment`,t)}},_e=[n,z],t[6]=n,t[7]=z,t[8]=ge,t[9]=_e):(ge=t[8],_e=t[9]),(0,S.useEffect)(ge,_e);let ve,ye;t[10]!==n||t[11]!==z?(ve=()=>{let e=e=>{let t=e.detail;t?.extensionId===n&&de({id:t.proposalId,identity:z})};return window.addEventListener(`extension-review-automation-proposal`,e),()=>window.removeEventListener(`extension-review-automation-proposal`,e)},ye=[n,z],t[10]=n,t[11]=z,t[12]=ve,t[13]=ye):(ve=t[12],ye=t[13]),(0,S.useEffect)(ve,ye);let be=(0,S.useRef)(null),xe=h(ae),Se;t[14]!==n||t[15]!==r?(Se=r?.trim()||n,t[14]=n,t[15]=r,t[16]=Se):Se=t[16];let Ce=Se,we;t[17]!==n||t[18]!==c?(we=c?.trim()||`Extension ${n}`,t[17]=n,t[18]=c,t[19]=we):we=t[19];let Te=we,Ee;t[20]===s?Ee=t[21]:(Ee=JSON.stringify(Array.from(s??[]).toSorted()),t[20]=s,t[21]=Ee);let De=Ee,Oe;t[22]===De?Oe=t[23]:(Oe=JSON.parse(De),t[22]=De,t[23]=Oe);let ke=Oe,Ae=u??Math.min(p,Math.max(m,320)),je;t[24]===Symbol.for(`react.memo_cache_sentinel`)?(je=[],t[24]=je):je=t[24];let Me;t[25]===Ae?Me=t[26]:(Me={allowed:!1,dialogOpen:!1,reloadKey:0,loadError:!1,dynamicHeight:Ae,grantResolved:!1,grantError:null,manifestDigest:null,grantedPermissions:je},t[25]=Ae,t[26]=Me);let[B,V]=(0,S.useReducer)(v,Me),{allowed:H,dialogOpen:U,reloadKey:W,loadError:Ne,dynamicHeight:Pe,grantResolved:Fe,grantError:G}=B,Ie;t[27]===n?Ie=t[28]:(Ie=()=>{let e=!0;return le.current=!1,ue(null),V({type:`patch`,patch:{allowed:!1,dialogOpen:!1,grantResolved:!1,grantError:null,manifestDigest:null,grantedPermissions:[]}}),y(n).then(t=>{if(e){if(t.extensionId!==n||!t.manifestDigest)throw Error(`Could not verify plugin permissions`);V({type:`patch`,patch:{allowed:t.granted,dialogOpen:!t.granted,grantResolved:!0,manifestDigest:t.manifestDigest,grantedPermissions:t.permissions,grantRevision:t.grantRevision,localApp:!!t.appId,resourceScopes:t.resourceScopes}})}}).catch(t=>{e&&V({type:`patch`,patch:{allowed:!1,dialogOpen:!0,grantResolved:!0,grantError:t instanceof Error?t.message:String(t)}})}),()=>{e=!1,F.current+=1}},t[27]=n,t[28]=Ie);let Le;t[29]!==n||t[30]!==N||t[31]!==P||t[32]!==ke||t[33]!==W?(Le=[n,ke,N,P,W],t[29]=n,t[30]=N,t[31]=P,t[32]=ke,t[33]=W,t[34]=Le):Le=t[34],(0,S.useEffect)(Ie,Le);let Re;t[35]===Symbol.for(`react.memo_cache_sentinel`)?(Re=e=>V({type:`patch`,patch:{dialogOpen:e}}),t[35]=Re):Re=t[35];let ze=Re,Be,Ve;t[36]!==n||t[37]!==N||t[38]!==P||t[39]!==j.loadFailed?(Be=()=>{let e=e=>{if(e.detail?.extensionId!==n)return;let t=F.current;y(n).then(e=>{t!==F.current||a.getState().baseUrl!==N||a.getState().conversationId!==P||(ue(e),V({type:`patch`,patch:{dialogOpen:!0,grantError:null}}))}).catch(()=>V({type:`patch`,patch:{grantError:j.loadFailed}}))};return window.addEventListener(`extension-review-permissions`,e),()=>window.removeEventListener(`extension-review-permissions`,e)},Ve=[n,N,P,j.loadFailed],t[36]=n,t[37]=N,t[38]=P,t[39]=j.loadFailed,t[40]=Be,t[41]=Ve):(Be=t[40],Ve=t[41]),(0,S.useEffect)(Be,Ve);let He;t[42]!==i||t[43]!==n?(He=w(n,i),t[42]=i,t[43]=n,t[44]=He):He=t[44];let Ue=He,We;t[45]!==H||t[46]!==n||t[47]!==u||t[48]!==p||t[49]!==m||t[50]!==M||t[51]!==B.grantRevision||t[52]!==B.grantedPermissions||t[53]!==B.localApp||t[54]!==B.manifestDigest?(We=()=>{if(!H)return;let e=be.current;if(!e)return;B.localApp?M.registerIframe(n,e,B.grantedPermissions,B.manifestDigest??void 0,B.grantRevision,!0):M.registerIframe(n,e,B.grantedPermissions,B.manifestDigest??void 0);let t=M.subscribeExtensionEvents(n,e=>{if(e.event!==`ui.resize`||!e.data||typeof e.data!=`object`||e.data===null)return;let t=Number(e.data.height);Number.isFinite(t)&&u===void 0&&V({type:`patch`,patch:{dynamicHeight:Math.min(p,Math.max(m,t))}})});return()=>{t(),M.unregisterIframe(n)}},t[45]=H,t[46]=n,t[47]=u,t[48]=p,t[49]=m,t[50]=M,t[51]=B.grantRevision,t[52]=B.grantedPermissions,t[53]=B.localApp,t[54]=B.manifestDigest,t[55]=We):We=t[55];let Ge;t[56]!==H||t[57]!==n||t[58]!==u||t[59]!==p||t[60]!==m||t[61]!==W||t[62]!==M||t[63]!==B.grantRevision||t[64]!==B.grantedPermissions||t[65]!==B.localApp||t[66]!==B.manifestDigest?(Ge=[H,n,u,p,m,B.grantedPermissions,B.manifestDigest,B.grantRevision,B.localApp,M,W],t[56]=H,t[57]=n,t[58]=u,t[59]=p,t[60]=m,t[61]=W,t[62]=M,t[63]=B.grantRevision,t[64]=B.grantedPermissions,t[65]=B.localApp,t[66]=B.manifestDigest,t[67]=Ge):Ge=t[67],(0,S.useLayoutEffect)(We,Ge);let Ke,qe;t[68]!==H||t[69]!==n||t[70]!==xe||t[71]!==M?(Ke=()=>{if(!H)return;let e=_(xe);M.sendEvent(n,`theme.changed`,e)},qe=[H,n,xe,M],t[68]=H,t[69]=n,t[70]=xe,t[71]=M,t[72]=Ke,t[73]=qe):(Ke=t[72],qe=t[73]),(0,S.useEffect)(Ke,qe);let Je;t[74]!==Pe||t[75]!==u?(Je=u===void 0?{width:`100%`,height:Pe,border:`none`}:{width:`100%`,height:u,border:`none`},t[74]=Pe,t[75]=u,t[76]=Je):Je=t[76];let Ye=Je,Xe;t[77]!==H||t[78]!==n||t[79]!==N||t[80]!==P||t[81]!==W||t[82]!==I?.manifestDigest||t[83]!==B.localApp||t[84]!==B.manifestDigest?(Xe=e=>{let t=I?.manifestDigest??B.manifestDigest;if(le.current||!t)return;le.current=!0;let r=F.current,i=()=>F.current===r&&a.getState().baseUrl===N&&a.getState().conversationId===P;(B.localApp?x(n,t,e):x(n,t)).then(e=>{if(i()){if(!e.granted||e.extensionId!==n||e.manifestDigest!==t)throw Error(`Permission grant was not persisted`);ue(null),V({type:`patch`,patch:{allowed:!0,dialogOpen:!1,grantError:null,manifestDigest:e.manifestDigest,grantedPermissions:e.permissions,grantRevision:e.grantRevision,resourceScopes:e.resourceScopes,reloadKey:H?W+1:W}})}}).catch(e=>{i()&&V({type:`patch`,patch:{allowed:!1,manifestDigest:null,grantError:e instanceof Error?e.message:String(e)}})}).finally(()=>{i()&&(le.current=!1)})},t[77]=H,t[78]=n,t[79]=N,t[80]=P,t[81]=W,t[82]=I?.manifestDigest,t[83]=B.localApp,t[84]=B.manifestDigest,t[85]=Xe):Xe=t[85];let Ze=Xe,Qe=I?.permissions??B.grantedPermissions,$e=I?.resourceScopes??B.resourceScopes,et=!(I?.manifestDigest??B.manifestDigest),tt;t[86]!==U||t[87]!==Ce||t[88]!==n||t[89]!==G||t[90]!==Ze||t[91]!==Qe||t[92]!==$e||t[93]!==et||t[94]!==B.localApp?(tt=(0,T.jsx)(b,{open:U,onOpenChange:ze,extensionId:n,extensionName:Ce,permissions:Qe,localApp:B.localApp,resourceScopes:$e,error:G,confirmDisabled:et,onConfirm:Ze}),t[86]=U,t[87]=Ce,t[88]=n,t[89]=G,t[90]=Ze,t[91]=Qe,t[92]=$e,t[93]=et,t[94]=B.localApp,t[95]=tt):tt=t[95];let K=tt;if(!Fe){let e=`${l??``} min-h-32 animate-pulse rounded-lg bg-surface-inset`,n;return t[96]===e?n=t[97]:(n=(0,T.jsx)(`div`,{className:e}),t[96]=e,t[97]=n),n}if(!H){let e;t[98]!==l||t[99]!==U||t[100]!==G||t[101]!==W||t[102]!==j.deniedHint||t[103]!==j.reviewPermissions?(e=U?null:(0,T.jsxs)(`div`,{className:l?`${l} rounded-lg border border-edge border-dashed bg-surface-base p-4 text-sm text-fg-muted`:`rounded-lg border border-edge border-dashed bg-surface-base p-4 text-sm text-fg-muted`,children:[G?(0,T.jsx)(`p`,{className:`mb-2 text-danger`,children:G}):null,(0,T.jsx)(`p`,{children:j.deniedHint}),(0,T.jsx)(`button`,{type:`button`,className:`mt-2 text-sm font-medium text-accent underline-offset-2 hover:underline`,onClick:()=>V({type:`patch`,patch:{reloadKey:W+1}}),children:j.reviewPermissions})]}),t[98]=l,t[99]=U,t[100]=G,t[101]=W,t[102]=j.deniedHint,t[103]=j.reviewPermissions,t[104]=e):e=t[104];let n;return t[105]!==K||t[106]!==e?(n=(0,T.jsxs)(T.Fragment,{children:[K,e]}),t[105]=K,t[106]=e,t[107]=n):n=t[107],n}let q;t[108]!==n||t[109]!==C||t[110]!==z||t[111]!==R||t[112]!==B.localApp?(q=B.localApp&&R?.identity===z?(0,T.jsx)(D,{extensionId:n,requestId:R.id,zh:C===`zh`,onClose:()=>fe(null)},R.id):null,t[108]=n,t[109]=C,t[110]=z,t[111]=R,t[112]=B.localApp,t[113]=q):q=t[113];let J;t[114]!==pe||t[115]!==C||t[116]!==z||t[117]!==B.localApp?(J=B.localApp&&pe?.identity===z?(0,T.jsx)(re,{prompt:pe.prompt,zh:C===`zh`,onClose:()=>me(null)}):null,t[114]=pe,t[115]=C,t[116]=z,t[117]=B.localApp,t[118]=J):J=t[118];let Y;t[119]!==n||t[120]!==C||t[121]!==z||t[122]!==L||t[123]!==B.localApp?(Y=B.localApp&&L?.identity===z?(0,T.jsx)(E,{extensionId:n,proposalId:L.id,zh:C===`zh`,onClose:()=>de(null)},L.id):null,t[119]=n,t[120]=C,t[121]=z,t[122]=L,t[123]=B.localApp,t[124]=Y):Y=t[124];let X;t[125]===G?X=t[126]:(X=G?(0,T.jsx)(`p`,{role:`alert`,className:`p-3 text-sm text-danger`,children:G}):null,t[125]=G,t[126]=X);let Z;t[127]!==Ne||t[128]!==W||t[129]!==j.loadFailed||t[130]!==j.loadFailedConnectionHint||t[131]!==j.retryLoad?(Z=Ne?(0,T.jsxs)(`div`,{className:`mb-2 rounded-lg border border-amber-500/40 bg-amber-500/10 px-3 py-2 text-sm text-fg`,children:[(0,T.jsx)(`p`,{children:j.loadFailed}),(0,T.jsx)(`p`,{className:`mt-2 text-xs text-fg-muted`,children:j.loadFailedConnectionHint}),(0,T.jsx)(`button`,{type:`button`,className:`mt-2 font-medium text-accent underline-offset-2 hover:underline`,onClick:()=>{V({type:`patch`,patch:{loadError:!1,reloadKey:W+1}})},children:j.retryLoad})]}):null,t[127]=Ne,t[128]=W,t[129]=j.loadFailed,t[130]=j.loadFailedConnectionHint,t[131]=j.retryLoad,t[132]=Z):Z=t[132];let nt=`${n}-${i}-${W}`,rt=B.localApp?`allow-scripts`:ie,it;t[133]===Symbol.for(`react.memo_cache_sentinel`)?(it=()=>V({type:`patch`,patch:{loadError:!0}}),t[133]=it):it=t[133];let Q;t[134]!==n||t[135]!==f||t[136]!==C||t[137]!==M?(Q=()=>{V({type:`patch`,patch:{loadError:!1}}),M.sendInit(n,_(h.getState().resolved),C),f!==void 0&&M.sendEvent(n,`widget.data`,f)},t[134]=n,t[135]=f,t[136]=C,t[137]=M,t[138]=Q):Q=t[138];let $;t[139]!==l||t[140]!==Te||t[141]!==Ue||t[142]!==Ye||t[143]!==nt||t[144]!==rt||t[145]!==Q?($=(0,T.jsx)(`iframe`,{ref:be,className:l,title:Te,src:Ue,style:Ye,sandbox:rt,referrerPolicy:`no-referrer`,onError:it,onLoad:Q},nt),t[139]=l,t[140]=Te,t[141]=Ue,t[142]=Ye,t[143]=nt,t[144]=rt,t[145]=Q,t[146]=$):$=t[146];let at;return t[147]!==K||t[148]!==q||t[149]!==J||t[150]!==Y||t[151]!==X||t[152]!==Z||t[153]!==$?(at=(0,T.jsxs)(`div`,{className:`flex flex-1 min-h-0 min-w-0 flex-col`,children:[q,J,Y,K,X,Z,$]}),t[147]=K,t[148]=q,t[149]=J,t[150]=Y,t[151]=X,t[152]=Z,t[153]=$,t[154]=at):at=t[154],at}function ae(e){return e.resolved}function oe(e){return e.conversationId}function se(e){return e.baseUrl}function ce(e){return e.language}export{j as t};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{a as e,i as t,l as n,n as r,o as i}from"./locale-store-Cit_aHqC.js";import{c as a,m as o,p as s,u as c,y as l}from"./schemas-CCWMleym.js";import{
|
|
1
|
+
import{a as e,i as t,l as n,n as r,o as i}from"./locale-store-Cit_aHqC.js";import{c as a,m as o,p as s,u as c,y as l}from"./schemas-CCWMleym.js";import{f as u}from"./product-delivery-4gEqUIsK.js";import{i as d,p as f,t as p}from"./session-manager-BVS3zxRZ.js";import{t as m}from"./capabilities-YmBD7oK8.js";import{t as h}from"./activity-store-DKP2sWTJ.js";import{i as g}from"./theme-store-C1MxmBg7.js";var _=function(e){return e[e.PermissionDenied=4001]=`PermissionDenied`,e[e.InvalidRequest=4002]=`InvalidRequest`,e[e.MethodNotFound=4003]=`MethodNotFound`,e[e.InternalError=4004]=`InternalError`,e[e.Timeout=4005]=`Timeout`,e[e.ExtensionNotFound=4006]=`ExtensionNotFound`,e[e.RateLimited=4007]=`RateLimited`,e}({});async function v(e,t,n){let r=new p,i=await r.loadSessionAgentConfig(e);await r.loadSession(e),f(e,i),await new d().send(t,e,n,i.thinkingLevel)}var y=[`--color-surface-base`,`--color-surface-panel`,`--color-surface-hover`,`--color-fg`,`--color-fg-muted`,`--color-fg-subtle`,`--color-accent`,`--color-accent-hover`,`--color-accent-soft`,`--color-edge`,`--color-edge-subtle`,`--color-danger`,`--color-success`,`--color-warning`,`--radius-sm`,`--radius-lg`,`--radius-xl`];function b(e){let t=getComputedStyle(document.documentElement),n={};for(let e of y){let r=t.getPropertyValue(e).trim();r&&(n[e]=r)}return{mode:e,tokens:n,fontFamily:t.getPropertyValue(`font-family`).trim(),fontFamilyMono:t.getPropertyValue(`--font-mono`).trim()}}async function x(t,n,r){let i=500;for(;!n.aborted;){try{let a=await e(t,{signal:n,headers:{Accept:`text/event-stream`}});if(!a.ok||!a.body){r({type:`error`,message:`Run subscription unavailable; review access before retrying`});return}let o=a.body.pipeThrough(new TextDecoderStream).getReader(),s=``;try{for(;;){let e=await o.read();if(e.done)break;s=(s+e.value).replaceAll(`\r
|
|
2
2
|
`,`
|
|
3
3
|
`);let t;for(;(t=s.indexOf(`
|
|
4
4
|
|
package/dist/gateway/static/root/assets/{extension-page-BfM8zli6.js → extension-page-C09dlV3J.js}
RENAMED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{a as t,n,t as r}from"./vendor-react-BOUWij0V.js";import{f as i}from"./chunk-KS7C4IRE-CiwuuyV8.js";import{t as a}from"./resource-unavailable-fk26VrOL.js";import{t as o}from"./page-header-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{f as i}from"./chunk-KS7C4IRE-CiwuuyV8.js";import{t as a}from"./resource-unavailable-fk26VrOL.js";import{t as o}from"./page-header-store-1-lflHAx.js";import{r as s,s as c}from"./extension-provider-BhluafoX.js";import{t as l}from"./extension-iframe-host-CCe4R7L7.js";var u=n(),d=e(t(),1),f=r();function p(){let e=(0,u.c)(24),{extensionId:t,pageId:n}=i(),r=s(),p=o(h),g=o(m),_,v,y;e[0]!==t||e[1]!==r||e[2]!==n?(_=t?r.find(e=>e.id===t&&c(e)):void 0,v=_?.ui?.contributions?.pages,y=t&&v?.length?n?v.find(e=>e.id===n||e.id===`${t}.${n}`):v[0]:void 0,e[0]=t,e[1]=r,e[2]=n,e[3]=_,e[4]=v,e[5]=y):(_=e[3],v=e[4],y=e[5]);let b=y,x,S;if(e[6]!==g||e[7]!==_||e[8]!==t||e[9]!==b||e[10]!==p?(x=()=>{if(!t||!_||!b)return g(),()=>g();let e=b.title?.trim()||_.name||t;return p({startExtra:null,main:(0,f.jsx)(`div`,{className:`w-full min-w-0 px-3 sm:px-5 xl:px-6`,children:(0,f.jsx)(`h1`,{className:`min-w-0 truncate text-base font-semibold tracking-tight text-fg`,title:e,children:e})}),end:null}),()=>g()},S=[g,_,t,b,p],e[6]=g,e[7]=_,e[8]=t,e[9]=b,e[10]=p,e[11]=x,e[12]=S):(x=e[11],S=e[12]),(0,d.useLayoutEffect)(x,S),!t){let t;return e[13]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,f.jsx)(a,{kind:`plugin`,backTo:`/capabilities/extensions`}),e[13]=t):t=e[13],t}if(!_){let n=r.some(e=>e.id===t)?`plugin-page`:`plugin`,i;return e[14]===n?i=e[15]:(i=(0,f.jsx)(a,{kind:n,backTo:`/capabilities/extensions`}),e[14]=n,e[15]=i),i}if(!v?.length){let t;return e[16]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,f.jsx)(a,{kind:`plugin-page`,backTo:`/capabilities/extensions`}),e[16]=t):t=e[16],t}if(!b){let t;return e[17]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,f.jsx)(a,{kind:`plugin`,backTo:`/capabilities/extensions`}),e[17]=t):t=e[17],t}let C=_.ui?.permissions,w;return e[18]!==_.name||e[19]!==t||e[20]!==b.entrypoint||e[21]!==b.title||e[22]!==C?(w=(0,f.jsx)(`div`,{className:`flex min-h-0 flex-1 flex-col`,children:(0,f.jsx)(l,{extensionId:t,extensionName:_.name,entrypoint:b.entrypoint,permissions:C,title:b.title,className:`min-h-0 flex-1`,fixedHeight:void 0,maxHeight:99999})}),e[18]=_.name,e[19]=t,e[20]=b.entrypoint,e[21]=b.title,e[22]=C,e[23]=w):w=e[23],w}function m(e){return e.clearPageHeader}function h(e){return e.setPageHeader}export{p as ExtensionPage};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{a as t,n,t as r}from"./vendor-react-BOUWij0V.js";import{a as i,i as a,l as o,o as s}from"./locale-store-Cit_aHqC.js";import{i as c}from"./vendor-swr-CdRzEUwF.js";import{a as l}from"./gateway-realtime-BnwNxbyc.js";import{i as u}from"./theme-store-C1MxmBg7.js";import{n as d,r as f,t as p}from"./extension-message-router-
|
|
1
|
+
import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{a as t,n,t as r}from"./vendor-react-BOUWij0V.js";import{a as i,i as a,l as o,o as s}from"./locale-store-Cit_aHqC.js";import{i as c}from"./vendor-swr-CdRzEUwF.js";import{a as l}from"./gateway-realtime-BnwNxbyc.js";import{i as u}from"./theme-store-C1MxmBg7.js";import{n as d,r as f,t as p}from"./extension-message-router-BD0ZamBV.js";var m=e(t(),1),h=n(),g=`agent-stream-event`;function _(e){return e===`off`||e===`on`||e===`stream`}function v(e){if(!e||typeof e!=`object`||Array.isArray(e))return null;let t=e,n=typeof t.conversationId==`string`?t.conversationId.trim():``,r=typeof t.runId==`string`?t.runId.trim():``;return n&&r?{conversationId:n,runId:r}:null}function y(e,t,n){return t&&typeof t==`object`&&!Array.isArray(t)?{...t,seq:n}:{type:e,seq:n,payload:t}}async function b(e){try{let t=await i(a(`/api/sessions/${encodeURIComponent(e)}/agent-config`));if(!t.ok)return`on`;let n=await t.json(),r=n.payload?.activityDetail?.effective;if(_(r))return r;let o=n.payload?.activityDetail?.default;return _(o)?o:`on`}catch{return`on`}}function x(e){window.dispatchEvent(new CustomEvent(g,{detail:e}))}function S(e={}){let t=e.subscribe??l,n=e.loadActivityDetailLevel??b,r=e.dispatch??x,i=new Map,a=!1,o=e=>{let o=v(e.detail);if(!o||i.has(o.runId))return;let s=`on`,c=!1,l,u=!1,d=!1,f=()=>{},p=()=>{u||(u=!0,f(),i.get(o.runId)===p&&i.delete(o.runId))},m=e=>{a||u||r({conversationId:o.conversationId,event:e,activityDetailLevel:s})};n(o.conversationId).then(e=>{s=e,c=!0,e===`stream`&&l&&!d&&m(l),l=void 0}),f=t(`run:${o.runId}`,{onEvent:e=>{if(u||d)return;let t=y(e.event,e.data,e.seq);e.event===`thinking_delta`&&!c?l=t:m(t),e.event===`run_end`&&(d=!0,l=void 0,queueMicrotask(p))},onGap:e=>{e.recoverable||p()}},0),i.set(o.runId,p)},s=e=>{let t=v(e.detail);t&&i.get(t.runId)?.()};return window.addEventListener(`run-started`,o),window.addEventListener(`run-completed`,s),window.addEventListener(`agent-run-ended`,s),()=>{a=!0,window.removeEventListener(`run-started`,o),window.removeEventListener(`run-completed`,s),window.removeEventListener(`agent-run-ended`,s);for(let e of[...i.values()])e()}}function C(e){return e.active||e.activationEligible===!0}function w(e){let t=e.ui?.contributions;return t?Array.isArray(t.pages)&&t.pages.length>0||Array.isArray(t.settingsPanels)&&t.settingsPanels.length>0||Array.isArray(t.chatWidgets)&&t.chatWidgets.length>0:!1}function T(e){return e.source===`bundled`&&e.hasUi===!0&&w(e)}function E(e){return e.kind===`image-generation`||e.kind===`media-provider`}function D(e){return C(e)?e.hasConfigSchema||E(e)?!0:e.hasUi?w(e):!1:!1}function O(e){return D(e)||T(e)}var k=r(),A=(0,m.createContext)(null);function j({children:e}){let t=(0,m.useRef)(null);if(!t.current){let e=new p;d(e),t.current=e}let n=t.current,{data:r,isLoading:i,mutate:l}=c(o(e=>!!e.conversationId)?`gateway-extensions-list`:null,()=>s(a(`/api/extensions`)),{revalidateOnFocus:!1}),h=r?.extensions??[],_=u(e=>e.resolved);(0,m.useEffect)(()=>{let e=()=>{l()};return window.addEventListener(`config-reload`,e),window.addEventListener(`registry-updated`,e),()=>{window.removeEventListener(`config-reload`,e),window.removeEventListener(`registry-updated`,e)}},[l]);let v=(0,m.useCallback)(e=>{let t=e.detail;t?.conversationId&&n.forwardAgentStreamEvent(t.conversationId,t.event??t)},[n]),y=(0,m.useRef)(v);y.current=v,(0,m.useEffect)(()=>{let e=e=>{y.current(e)};return window.addEventListener(g,e),()=>{window.removeEventListener(g,e)}},[]),(0,m.useEffect)(()=>{let e=f(_);n.broadcastEvent(`theme.changed`,e)},[_,n]);let b=(0,m.useRef)(n);b.current=n,(0,m.useEffect)(()=>()=>{b.current.dispose(),t.current=null},[]);let x=(0,m.useMemo)(()=>({router:n,extensions:h,loading:i}),[n,h,i]);return(0,k.jsx)(A.Provider,{value:x,children:e})}function M(){let e=(0,m.useContext)(A);if(!e)throw Error(`useExtensionRouter must be used within ExtensionProvider`);return e.router}function N(){let e=(0,m.useContext)(A);if(!e)throw Error(`useExtensions must be used within ExtensionProvider`);return e.extensions}function P(){let e=(0,h.c)(2),t=N(),n;return e[0]===t?n=e[1]:(n=t.filter(D),e[0]=t,e[1]=n),n}function F(){let e=(0,m.useContext)(A);if(!e)throw Error(`useExtensionsLoading must be used within ExtensionProvider`);return e.loading}export{P as a,g as c,F as i,S as l,M as n,E as o,N as r,O as s,j 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{f as i,t as a}from"./chunk-KS7C4IRE-CiwuuyV8.js";import{a as o,i as s,l as c,n as l,o as u}from"./locale-store-Cit_aHqC.js";import{t as d}from"./messages-DQveK9sk.js";import{t as f}from"./resource-unavailable-fk26VrOL.js";import{n as p,r as m}from"./popover-select-CLsphyzA.js";import{t as h}from"./cn-0WouolD0.js";import{i as g}from"./vendor-swr-CdRzEUwF.js";import{t as _}from"./button-Cc4hUNTt.js";import{a as v,o as y,s as b}from"./form-field-width-DJw_jULe.js";import{r as x}from"./extension-provider-BcSgVeKW.js";import{n as S}from"./model-sort-_Tz8s_4N.js";import{t as C}from"./extension-iframe-host-hr60GwXQ.js";import{t as w}from"./settings-loading-skeleton-CAoOV17i.js";import{n as T,t as E}from"./settings-page-header-B9Y_eGcH.js";import"./settings-page-layout-D1MgJ5zP.js";import{n as D,t as O}from"./use-autosave-CvjQMyY8.js";import{r as k,t as A}from"./schema-form-DXHzZPMr.js";import{c as j,s as M,u as N}from"./voice-config-api-BLGbUq3v.js";import{t as P}from"./voice-api-key-field-M7KB_Gl1.js";var F=e(t(),1),I=n(),L=r();function R(e){let t=e?.manifest?.mediaUnderstandingProviders?.[0];if(typeof t==`string`&&t.trim())return t.trim();let n=e?.manifest?.contracts?.mediaUnderstandingProviders?.[0];if(typeof n==`string`&&n.trim())return n.trim()}function z(){return h(y,v)}function B(){return h(`w-full rounded-lg border border-edge bg-surface-panel px-3 py-2 text-sm text-fg`,`placeholder:text-fg-subtle`,b,`dark:border-edge`)}function V(e,t,n){if(!e||!t)return{apiKey:``,model:n};let r=e.stt.providers?.[t];return{apiKey:typeof r?.apiKey==`string`?r.apiKey:``,model:typeof r?.model==`string`?r.model:n}}function H({providerId:e,voiceSettings:t,mutateVoice:n}){let r=d(l(e=>e.language)),i=r.voiceSettings,a=r.extensionSttMedia,o={maskedHelp:i.apiKeyMaskedHelp,copy:i.apiKeyCopy,copied:i.apiKeyCopied,show:i.apiKeyShow,hide:i.apiKeyHide,notInConfigFile:i.apiKeyNotInConfigFile,loadFailed:i.apiKeyRevealFailed},{data:c}=g(s(`/api/voice/stt-providers`),j,{revalidateOnFocus:!1}),u=(0,F.useMemo)(()=>c?.providers.find(t=>t.id===e),[e,c]),f=u?.configured??!1,_=u?.models??[],y=_[0]?.id??u?.fields.find(e=>e.key===`model`)?.defaultValue??``,b=(0,F.useMemo)(()=>V(t,e,y),[y,e,t]),x=(0,F.useRef)(!1),[C,w]=(0,F.useState)(null),T=C??b,E=(0,F.useRef)(T);E.current=T;let A=b,M=O({value:T,dirty:T.apiKey!==A.apiKey||T.model!==A.model,onSave:(0,F.useCallback)(async r=>{let i=structuredClone(t);i.stt.enabled=!0,i.stt.provider=e,i.stt.providers={...i.stt.providers??{},[e]:{...i.stt.providers?.[e]??{},apiKey:r.apiKey,model:r.model}},await N(i,`transcription`),await n(i,!1),x.current=JSON.stringify(E.current)!==JSON.stringify(r),w(e=>e&&JSON.stringify(e)===JSON.stringify(r)?null:e)},[n,e,t])}),I=_.length>0?[..._].sort(S):T.model?[{id:T.model,name:T.model}]:[];return(0,L.jsxs)(`div`,{className:`flex flex-col gap-4 rounded-xl bg-surface-base p-4`,onBlurCapture:M.onBlurCapture,children:[(0,L.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-2`,children:[(0,L.jsxs)(`div`,{children:[(0,L.jsx)(`h2`,{className:`text-sm font-semibold text-fg`,children:a.credentialsTitle}),(0,L.jsx)(`p`,{className:`mt-1 text-xs text-fg-muted`,children:a.credentialsHint.replace(`{providerId}`,e)})]}),(0,L.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,L.jsx)(D,{status:M.status,error:M.error}),(0,L.jsx)(`span`,{className:h(`rounded-full px-2 py-0.5 text-xs font-medium`,f?`bg-emerald-500/10 text-emerald-700 dark:text-emerald-300`:`bg-amber-500/10 text-amber-800 dark:text-amber-200`),children:f?a.configured:a.notConfigured})]})]}),(0,L.jsxs)(`div`,{className:`grid gap-3 sm:grid-cols-2`,children:[(0,L.jsxs)(`div`,{className:h(`flex flex-col gap-1.5`,v),children:[(0,L.jsx)(k,{children:i.stt.apiKey}),(0,L.jsx)(P,{kind:`stt`,providerId:e,fieldId:`ext-stt-${e}-api-key`,value:T.apiKey,onChange:e=>{x.current=!0,w(t=>({...t??b,apiKey:e}))},labels:o,placeholder:e===`groq`?`gsk_...`:`sk-...`}),(0,L.jsxs)(`p`,{className:`text-xs text-fg-subtle`,children:[i.stt.apiKeyDesc,e===`groq`?` (GROQ_API_KEY)`:``]})]}),(0,L.jsxs)(`div`,{className:h(`flex flex-col gap-1.5`,v),children:[(0,L.jsx)(k,{children:i.stt.model}),I.length>0?(0,L.jsx)(p,{className:z(),value:T.model,onChange:e=>{x.current=!0,w(t=>({...t??b,model:e.target.value})),M.saveNow({...T,model:e.target.value})},children:I.map(e=>(0,L.jsx)(m,{value:e.id,children:e.name},e.id))}):(0,L.jsx)(`input`,{className:B(),value:T.model,onChange:e=>{x.current=!0,w(t=>({...t??b,model:e.target.value}))}})]})]})]})}function U(e){let t=(0,I.c)(13),{extensionId:n}=e,r=l(G),i=c(W),a;t[0]===n?a=t[1]:(a=()=>u(s(`/api/extensions/${encodeURIComponent(n)}`)),t[0]=n,t[1]=a);let{data:o,isLoading:d}=g(i&&n?`ext-stt-detail-${n}`:null,a),f;t[2]===o?f=t[3]:(f=R(o),t[2]=o,t[3]=f);let p=f,m;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(m={revalidateOnFocus:!1},t[4]=m):m=t[4];let{data:h,mutate:_,isLoading:v}=g(i?`voice-settings-ext-stt`:null,M,m);if(!i)return null;if(d||v){let e;return t[5]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,L.jsx)(w,{rows:2}),t[5]=e):e=t[5],e}if(!p){let e=r===`zh`?`该插件未声明 mediaUnderstandingProviders。`:`This plugin does not declare mediaUnderstandingProviders.`,n;return t[6]===e?n=t[7]:(n=(0,L.jsx)(`p`,{className:`text-sm text-fg-muted`,children:e}),t[6]=e,t[7]=n),n}if(!h)return null;let y=`${n}:${p}`,b;return t[8]!==_||t[9]!==p||t[10]!==y||t[11]!==h?(b=(0,L.jsx)(H,{providerId:p,voiceSettings:h,mutateVoice:_},y),t[8]=_,t[9]=p,t[10]=y,t[11]=h,t[12]=b):b=t[12],b}function W(e){return!!e.conversationId}function G(e){return e.language}function K(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function q(e){let t={};if(e.type!==`object`||!K(e.properties))return t;for(let[n,r]of Object.entries(e.properties))K(r)&&Object.prototype.hasOwnProperty.call(r,`default`)&&(t[n]=r.default);return t}function J(e,t){switch(t.type){case`sync`:return{localValues:t.value,isDirty:!1};case`change`:return{localValues:t.value,isDirty:!0};case`reset-defaults`:return{localValues:t.value,isDirty:!0};case`saved`:return JSON.stringify(e.localValues)===JSON.stringify(t.value)?{localValues:e.localValues,isDirty:!1}:e}}function Y({extensionId:e}){let t=c(e=>!!e.conversationId),{data:n,error:r}=g(t&&e?`ext-detail-${e}`:null,()=>u(s(`/api/extensions/${encodeURIComponent(e)}`))),{data:i,mutate:a,error:l}=g(t&&e?`ext-cfg-${e}`:null,()=>u(s(`/api/extensions/${encodeURIComponent(e)}/config`))),d=n?.manifest?.configSchema,f=(0,F.useMemo)(()=>d&&d.type===`object`?q(d):{},[d]),p=(0,F.useMemo)(()=>({...f,...i??{}}),[f,i]),[m,h]=(0,F.useReducer)(J,{localValues:{},isDirty:!1}),v=(0,F.useRef)(!1),y=(0,F.useRef)(m.localValues);y.current=m.localValues;let b=(0,F.useRef)(p);!v.current&&b.current!==p&&(b.current=p,h({type:`sync`,value:p}));let x=(0,F.useCallback)(e=>{v.current=!0,h({type:`change`,value:e})},[]),S=(0,F.useCallback)(()=>{!d||d.type!==`object`||(v.current=!0,h({type:`reset-defaults`,value:{...q(d)}}))},[d]),C=(0,F.useCallback)(async t=>{if(!e)return;let n=await o(s(`/api/extensions/${encodeURIComponent(e)}/config`),{method:`PATCH`,body:JSON.stringify(t)});if(!n.ok){let e=await n.json().catch(()=>({}));throw Error(e.error?.message??n.statusText)}await a(t,!1),h({type:`saved`,value:t}),v.current=JSON.stringify(y.current)!==JSON.stringify(t)},[e,a]),w=O({value:m.localValues,dirty:m.isDirty,onSave:C});if(!t)return null;if(r||l){let e=r??l;return(0,L.jsxs)(`p`,{className:`text-sm text-fg-muted`,children:[`Could not load extension settings: `,e instanceof Error?e.message:String(e)]})}return!d||d.type!==`object`?null:(0,L.jsxs)(`div`,{className:`flex flex-col gap-3 rounded-xl bg-surface-hover/20 p-4`,onBlurCapture:w.onBlurCapture,children:[(0,L.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-2`,children:[(0,L.jsx)(`h2`,{className:`text-sm font-semibold text-fg`,children:`Configuration`}),(0,L.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,L.jsx)(D,{status:w.status,error:w.error}),(0,L.jsx)(_,{type:`button`,variant:`ghost`,className:`h-8 text-xs`,onClick:S,children:`Reset to defaults`})]})]}),(0,L.jsx)(A,{schema:d,values:m.localValues,onChange:x})]})}function X(){let e=(0,I.c)(36),t=l(Z),n;e[0]===t?n=e[1]:(n=d(t),e[0]=t,e[1]=n);let r=n.extensionSttMedia,{extensionId:o,panelId:s}=i(),c=x();if(!o){let t;return e[2]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,L.jsx)(f,{kind:`plugin`,backTo:`/capabilities/extensions`}),e[2]=t):t=e[2],t}let u,p,m;if(e[3]!==o||e[4]!==c||e[5]!==s){m=Symbol.for(`react.early_return_sentinel`);bb0:{let t;if(e[9]===o?t=e[10]:(t=e=>e.id===o,e[9]=o,e[10]=t),u=c.find(t),!u){let t;e[11]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,L.jsx)(f,{kind:`plugin`,backTo:`/capabilities/extensions`}),e[11]=t):t=e[11],m=t;break bb0}let n=u.ui?.contributions?.settingsPanels;p=s?n?.find(e=>e.id===s||e.id===`${o}.${s}`):n?.[0]}e[3]=o,e[4]=c,e[5]=s,e[6]=u,e[7]=p,e[8]=m}else u=e[6],p=e[7],m=e[8];if(m!==Symbol.for(`react.early_return_sentinel`))return m;let h=p,g=!!(h&&u.ui),_=!!u.hasConfigSchema,v=u.kind===`media-provider`;if(!_&&!g&&!v){let t;return e[12]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,L.jsx)(f,{kind:`plugin-settings`,backTo:`/capabilities/extensions`}),e[12]=t):t=e[12],t}let y=h?.title??(t===`zh`?`${u.name} 设置`:`${u.name} Settings`),b;e[13]===y?b=e[14]:(b=(0,L.jsx)(E,{title:y}),e[13]=y,e[14]=b);let S;e[15]!==v||e[16]!==r?(S=v?(0,L.jsxs)(`div`,{className:`flex flex-col gap-2 rounded-lg bg-surface-base px-4 py-3 text-sm`,children:[(0,L.jsx)(`p`,{className:`leading-relaxed text-fg-muted`,children:r.banner}),(0,L.jsx)(a,{to:`/settings/capabilities/models?configure=transcription`,className:`w-fit font-medium text-accent hover:underline`,children:r.openVoice})]}):null,e[15]=v,e[16]=r,e[17]=S):S=e[17];let w;e[18]!==o||e[19]!==v?(w=v?(0,L.jsx)(U,{extensionId:o}):null,e[18]=o,e[19]=v,e[20]=w):w=e[20];let D;e[21]!==o||e[22]!==_?(D=_?(0,L.jsx)(Y,{extensionId:o}):null,e[21]=o,e[22]=_,e[23]=D):D=e[23];let O;e[24]!==u.name||e[25]!==u.ui||e[26]!==o||e[27]!==g||e[28]!==h?(O=g&&h&&u.ui?(0,L.jsx)(`div`,{className:`overflow-hidden rounded-xl bg-surface-base shadow-surface`,children:(0,L.jsx)(C,{extensionId:o,extensionName:u.name,entrypoint:h.entrypoint,permissions:u.ui?.permissions,title:h.title,className:`w-full`,minHeight:120,maxHeight:2e3})}):null,e[24]=u.name,e[25]=u.ui,e[26]=o,e[27]=g,e[28]=h,e[29]=O):O=e[29];let k;return e[30]!==b||e[31]!==S||e[32]!==w||e[33]!==D||e[34]!==O?(k=(0,L.jsxs)(T,{gap:`gap-5`,children:[b,S,w,D,O]}),e[30]=b,e[31]=S,e[32]=w,e[33]=D,e[34]=O,e[35]=k):k=e[35],k}function Z(e){return e.language}export{X as ExtensionSettingsPage};
|
|
1
|
+
import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{a as t,n,t as r}from"./vendor-react-BOUWij0V.js";import{f as i,t as a}from"./chunk-KS7C4IRE-CiwuuyV8.js";import{a as o,i as s,l as c,n as l,o as u}from"./locale-store-Cit_aHqC.js";import{t as d}from"./messages-DQveK9sk.js";import{t as f}from"./resource-unavailable-fk26VrOL.js";import{n as p,r as m}from"./popover-select-CLsphyzA.js";import{t as h}from"./cn-0WouolD0.js";import{i as g}from"./vendor-swr-CdRzEUwF.js";import{t as _}from"./button-Cc4hUNTt.js";import{a as v,o as y,s as b}from"./form-field-width-DJw_jULe.js";import{r as x}from"./extension-provider-BhluafoX.js";import{n as S}from"./model-sort-_Tz8s_4N.js";import{t as C}from"./extension-iframe-host-CCe4R7L7.js";import{t as w}from"./settings-loading-skeleton-CAoOV17i.js";import{n as T,t as E}from"./settings-page-header-B9Y_eGcH.js";import"./settings-page-layout-D1MgJ5zP.js";import{n as D,t as O}from"./use-autosave-CvjQMyY8.js";import{r as k,t as A}from"./schema-form-DXHzZPMr.js";import{c as j,s as M,u as N}from"./voice-config-api-BLGbUq3v.js";import{t as P}from"./voice-api-key-field-M7KB_Gl1.js";var F=e(t(),1),I=n(),L=r();function R(e){let t=e?.manifest?.mediaUnderstandingProviders?.[0];if(typeof t==`string`&&t.trim())return t.trim();let n=e?.manifest?.contracts?.mediaUnderstandingProviders?.[0];if(typeof n==`string`&&n.trim())return n.trim()}function z(){return h(y,v)}function B(){return h(`w-full rounded-lg border border-edge bg-surface-panel px-3 py-2 text-sm text-fg`,`placeholder:text-fg-subtle`,b,`dark:border-edge`)}function V(e,t,n){if(!e||!t)return{apiKey:``,model:n};let r=e.stt.providers?.[t];return{apiKey:typeof r?.apiKey==`string`?r.apiKey:``,model:typeof r?.model==`string`?r.model:n}}function H({providerId:e,voiceSettings:t,mutateVoice:n}){let r=d(l(e=>e.language)),i=r.voiceSettings,a=r.extensionSttMedia,o={maskedHelp:i.apiKeyMaskedHelp,copy:i.apiKeyCopy,copied:i.apiKeyCopied,show:i.apiKeyShow,hide:i.apiKeyHide,notInConfigFile:i.apiKeyNotInConfigFile,loadFailed:i.apiKeyRevealFailed},{data:c}=g(s(`/api/voice/stt-providers`),j,{revalidateOnFocus:!1}),u=(0,F.useMemo)(()=>c?.providers.find(t=>t.id===e),[e,c]),f=u?.configured??!1,_=u?.models??[],y=_[0]?.id??u?.fields.find(e=>e.key===`model`)?.defaultValue??``,b=(0,F.useMemo)(()=>V(t,e,y),[y,e,t]),x=(0,F.useRef)(!1),[C,w]=(0,F.useState)(null),T=C??b,E=(0,F.useRef)(T);E.current=T;let A=b,M=O({value:T,dirty:T.apiKey!==A.apiKey||T.model!==A.model,onSave:(0,F.useCallback)(async r=>{let i=structuredClone(t);i.stt.enabled=!0,i.stt.provider=e,i.stt.providers={...i.stt.providers??{},[e]:{...i.stt.providers?.[e]??{},apiKey:r.apiKey,model:r.model}},await N(i,`transcription`),await n(i,!1),x.current=JSON.stringify(E.current)!==JSON.stringify(r),w(e=>e&&JSON.stringify(e)===JSON.stringify(r)?null:e)},[n,e,t])}),I=_.length>0?[..._].sort(S):T.model?[{id:T.model,name:T.model}]:[];return(0,L.jsxs)(`div`,{className:`flex flex-col gap-4 rounded-xl bg-surface-base p-4`,onBlurCapture:M.onBlurCapture,children:[(0,L.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-2`,children:[(0,L.jsxs)(`div`,{children:[(0,L.jsx)(`h2`,{className:`text-sm font-semibold text-fg`,children:a.credentialsTitle}),(0,L.jsx)(`p`,{className:`mt-1 text-xs text-fg-muted`,children:a.credentialsHint.replace(`{providerId}`,e)})]}),(0,L.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,L.jsx)(D,{status:M.status,error:M.error}),(0,L.jsx)(`span`,{className:h(`rounded-full px-2 py-0.5 text-xs font-medium`,f?`bg-emerald-500/10 text-emerald-700 dark:text-emerald-300`:`bg-amber-500/10 text-amber-800 dark:text-amber-200`),children:f?a.configured:a.notConfigured})]})]}),(0,L.jsxs)(`div`,{className:`grid gap-3 sm:grid-cols-2`,children:[(0,L.jsxs)(`div`,{className:h(`flex flex-col gap-1.5`,v),children:[(0,L.jsx)(k,{children:i.stt.apiKey}),(0,L.jsx)(P,{kind:`stt`,providerId:e,fieldId:`ext-stt-${e}-api-key`,value:T.apiKey,onChange:e=>{x.current=!0,w(t=>({...t??b,apiKey:e}))},labels:o,placeholder:e===`groq`?`gsk_...`:`sk-...`}),(0,L.jsxs)(`p`,{className:`text-xs text-fg-subtle`,children:[i.stt.apiKeyDesc,e===`groq`?` (GROQ_API_KEY)`:``]})]}),(0,L.jsxs)(`div`,{className:h(`flex flex-col gap-1.5`,v),children:[(0,L.jsx)(k,{children:i.stt.model}),I.length>0?(0,L.jsx)(p,{className:z(),value:T.model,onChange:e=>{x.current=!0,w(t=>({...t??b,model:e.target.value})),M.saveNow({...T,model:e.target.value})},children:I.map(e=>(0,L.jsx)(m,{value:e.id,children:e.name},e.id))}):(0,L.jsx)(`input`,{className:B(),value:T.model,onChange:e=>{x.current=!0,w(t=>({...t??b,model:e.target.value}))}})]})]})]})}function U(e){let t=(0,I.c)(13),{extensionId:n}=e,r=l(G),i=c(W),a;t[0]===n?a=t[1]:(a=()=>u(s(`/api/extensions/${encodeURIComponent(n)}`)),t[0]=n,t[1]=a);let{data:o,isLoading:d}=g(i&&n?`ext-stt-detail-${n}`:null,a),f;t[2]===o?f=t[3]:(f=R(o),t[2]=o,t[3]=f);let p=f,m;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(m={revalidateOnFocus:!1},t[4]=m):m=t[4];let{data:h,mutate:_,isLoading:v}=g(i?`voice-settings-ext-stt`:null,M,m);if(!i)return null;if(d||v){let e;return t[5]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,L.jsx)(w,{rows:2}),t[5]=e):e=t[5],e}if(!p){let e=r===`zh`?`该插件未声明 mediaUnderstandingProviders。`:`This plugin does not declare mediaUnderstandingProviders.`,n;return t[6]===e?n=t[7]:(n=(0,L.jsx)(`p`,{className:`text-sm text-fg-muted`,children:e}),t[6]=e,t[7]=n),n}if(!h)return null;let y=`${n}:${p}`,b;return t[8]!==_||t[9]!==p||t[10]!==y||t[11]!==h?(b=(0,L.jsx)(H,{providerId:p,voiceSettings:h,mutateVoice:_},y),t[8]=_,t[9]=p,t[10]=y,t[11]=h,t[12]=b):b=t[12],b}function W(e){return!!e.conversationId}function G(e){return e.language}function K(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function q(e){let t={};if(e.type!==`object`||!K(e.properties))return t;for(let[n,r]of Object.entries(e.properties))K(r)&&Object.prototype.hasOwnProperty.call(r,`default`)&&(t[n]=r.default);return t}function J(e,t){switch(t.type){case`sync`:return{localValues:t.value,isDirty:!1};case`change`:return{localValues:t.value,isDirty:!0};case`reset-defaults`:return{localValues:t.value,isDirty:!0};case`saved`:return JSON.stringify(e.localValues)===JSON.stringify(t.value)?{localValues:e.localValues,isDirty:!1}:e}}function Y({extensionId:e}){let t=c(e=>!!e.conversationId),{data:n,error:r}=g(t&&e?`ext-detail-${e}`:null,()=>u(s(`/api/extensions/${encodeURIComponent(e)}`))),{data:i,mutate:a,error:l}=g(t&&e?`ext-cfg-${e}`:null,()=>u(s(`/api/extensions/${encodeURIComponent(e)}/config`))),d=n?.manifest?.configSchema,f=(0,F.useMemo)(()=>d&&d.type===`object`?q(d):{},[d]),p=(0,F.useMemo)(()=>({...f,...i??{}}),[f,i]),[m,h]=(0,F.useReducer)(J,{localValues:{},isDirty:!1}),v=(0,F.useRef)(!1),y=(0,F.useRef)(m.localValues);y.current=m.localValues;let b=(0,F.useRef)(p);!v.current&&b.current!==p&&(b.current=p,h({type:`sync`,value:p}));let x=(0,F.useCallback)(e=>{v.current=!0,h({type:`change`,value:e})},[]),S=(0,F.useCallback)(()=>{!d||d.type!==`object`||(v.current=!0,h({type:`reset-defaults`,value:{...q(d)}}))},[d]),C=(0,F.useCallback)(async t=>{if(!e)return;let n=await o(s(`/api/extensions/${encodeURIComponent(e)}/config`),{method:`PATCH`,body:JSON.stringify(t)});if(!n.ok){let e=await n.json().catch(()=>({}));throw Error(e.error?.message??n.statusText)}await a(t,!1),h({type:`saved`,value:t}),v.current=JSON.stringify(y.current)!==JSON.stringify(t)},[e,a]),w=O({value:m.localValues,dirty:m.isDirty,onSave:C});if(!t)return null;if(r||l){let e=r??l;return(0,L.jsxs)(`p`,{className:`text-sm text-fg-muted`,children:[`Could not load extension settings: `,e instanceof Error?e.message:String(e)]})}return!d||d.type!==`object`?null:(0,L.jsxs)(`div`,{className:`flex flex-col gap-3 rounded-xl bg-surface-hover/20 p-4`,onBlurCapture:w.onBlurCapture,children:[(0,L.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-2`,children:[(0,L.jsx)(`h2`,{className:`text-sm font-semibold text-fg`,children:`Configuration`}),(0,L.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,L.jsx)(D,{status:w.status,error:w.error}),(0,L.jsx)(_,{type:`button`,variant:`ghost`,className:`h-8 text-xs`,onClick:S,children:`Reset to defaults`})]})]}),(0,L.jsx)(A,{schema:d,values:m.localValues,onChange:x})]})}function X(){let e=(0,I.c)(36),t=l(Z),n;e[0]===t?n=e[1]:(n=d(t),e[0]=t,e[1]=n);let r=n.extensionSttMedia,{extensionId:o,panelId:s}=i(),c=x();if(!o){let t;return e[2]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,L.jsx)(f,{kind:`plugin`,backTo:`/capabilities/extensions`}),e[2]=t):t=e[2],t}let u,p,m;if(e[3]!==o||e[4]!==c||e[5]!==s){m=Symbol.for(`react.early_return_sentinel`);bb0:{let t;if(e[9]===o?t=e[10]:(t=e=>e.id===o,e[9]=o,e[10]=t),u=c.find(t),!u){let t;e[11]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,L.jsx)(f,{kind:`plugin`,backTo:`/capabilities/extensions`}),e[11]=t):t=e[11],m=t;break bb0}let n=u.ui?.contributions?.settingsPanels;p=s?n?.find(e=>e.id===s||e.id===`${o}.${s}`):n?.[0]}e[3]=o,e[4]=c,e[5]=s,e[6]=u,e[7]=p,e[8]=m}else u=e[6],p=e[7],m=e[8];if(m!==Symbol.for(`react.early_return_sentinel`))return m;let h=p,g=!!(h&&u.ui),_=!!u.hasConfigSchema,v=u.kind===`media-provider`;if(!_&&!g&&!v){let t;return e[12]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,L.jsx)(f,{kind:`plugin-settings`,backTo:`/capabilities/extensions`}),e[12]=t):t=e[12],t}let y=h?.title??(t===`zh`?`${u.name} 设置`:`${u.name} Settings`),b;e[13]===y?b=e[14]:(b=(0,L.jsx)(E,{title:y}),e[13]=y,e[14]=b);let S;e[15]!==v||e[16]!==r?(S=v?(0,L.jsxs)(`div`,{className:`flex flex-col gap-2 rounded-lg bg-surface-base px-4 py-3 text-sm`,children:[(0,L.jsx)(`p`,{className:`leading-relaxed text-fg-muted`,children:r.banner}),(0,L.jsx)(a,{to:`/settings/capabilities/models?configure=transcription`,className:`w-fit font-medium text-accent hover:underline`,children:r.openVoice})]}):null,e[15]=v,e[16]=r,e[17]=S):S=e[17];let w;e[18]!==o||e[19]!==v?(w=v?(0,L.jsx)(U,{extensionId:o}):null,e[18]=o,e[19]=v,e[20]=w):w=e[20];let D;e[21]!==o||e[22]!==_?(D=_?(0,L.jsx)(Y,{extensionId:o}):null,e[21]=o,e[22]=_,e[23]=D):D=e[23];let O;e[24]!==u.name||e[25]!==u.ui||e[26]!==o||e[27]!==g||e[28]!==h?(O=g&&h&&u.ui?(0,L.jsx)(`div`,{className:`overflow-hidden rounded-xl bg-surface-base shadow-surface`,children:(0,L.jsx)(C,{extensionId:o,extensionName:u.name,entrypoint:h.entrypoint,permissions:u.ui?.permissions,title:h.title,className:`w-full`,minHeight:120,maxHeight:2e3})}):null,e[24]=u.name,e[25]=u.ui,e[26]=o,e[27]=g,e[28]=h,e[29]=O):O=e[29];let k;return e[30]!==b||e[31]!==S||e[32]!==w||e[33]!==D||e[34]!==O?(k=(0,L.jsxs)(T,{gap:`gap-5`,children:[b,S,w,D,O]}),e[30]=b,e[31]=S,e[32]=w,e[33]=D,e[34]=O,e[35]=k):k=e[35],k}function Z(e){return e.language}export{X as ExtensionSettingsPage};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{t as e}from"./createLucideIcon-DPHK1VkS.js";var t=e(`file`,[[`path`,{d:`M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z`,key:`1oefj6`}],[`path`,{d:`M14 2v5a1 1 0 0 0 1 1h5`,key:`wfsgrz`}]]);export{t};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{t as e}from"./createLucideIcon-DPHK1VkS.js";var t=e(`file-code-corner`,[[`path`,{d:`M4 12.15V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.706.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2h-3.35`,key:`1wthlu`}],[`path`,{d:`M14 2v5a1 1 0 0 0 1 1h5`,key:`wfsgrz`}],[`path`,{d:`m5 16-3 3 3 3`,key:`331omg`}],[`path`,{d:`m9 22 3-3-3-3`,key:`lsp7cz`}]])
|
|
1
|
+
import{t as e}from"./createLucideIcon-DPHK1VkS.js";var t=e(`file-code-corner`,[[`path`,{d:`M4 12.15V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.706.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2h-3.35`,key:`1wthlu`}],[`path`,{d:`M14 2v5a1 1 0 0 0 1 1h5`,key:`wfsgrz`}],[`path`,{d:`m5 16-3 3 3 3`,key:`331omg`}],[`path`,{d:`m9 22 3-3-3-3`,key:`lsp7cz`}]]);export{t};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{n as e,t}from"./vendor-react-BOUWij0V.js";import{t as n}from"./createLucideIcon-DPHK1VkS.js";import{n as r,r as i,t as a}from"./file-tree-utils-DJs1faGv.js";import{t as o}from"./file-archive-DanfQJNe.js";import{t as s}from"./file-code-corner-byQA1VfD.js";import{t as c}from"./file-image-CDUPkZvG.js";import{t as l}from"./file-text-D12HbeVy.js";import{t as u}from"./file-CStvVK2S.js";import{t as d}from"./presentation-D-Ui_vVA.js";import{t as f}from"./cn-0WouolD0.js";var p=n(`file-braces`,[[`path`,{d:`M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z`,key:`1oefj6`}],[`path`,{d:`M14 2v5a1 1 0 0 0 1 1h5`,key:`wfsgrz`}],[`path`,{d:`M10 12a1 1 0 0 0-1 1v1a1 1 0 0 1-1 1 1 1 0 0 1 1 1v1a1 1 0 0 0 1 1`,key:`1oajmo`}],[`path`,{d:`M14 18a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1 1 1 0 0 1-1-1v-1a1 1 0 0 0-1-1`,key:`mpwhp6`}]]),m=n(`file-music`,[[`path`,{d:`M11.65 22H18a2 2 0 0 0 2-2V8a2.4 2.4 0 0 0-.706-1.706l-3.588-3.588A2.4 2.4 0 0 0 14 2H6a2 2 0 0 0-2 2v10.35`,key:`5ad7z2`}],[`path`,{d:`M14 2v5a1 1 0 0 0 1 1h5`,key:`wfsgrz`}],[`path`,{d:`M8 20v-7l3 1.474`,key:`1ggyb9`}],[`circle`,{cx:`6`,cy:`20`,r:`2`,key:`j7wjp0`}]]),h=e(),g=t();function _(e){let t=(0,h.c)(6),{name:n,className:_}=e,v=n.split(`.`).pop()?.toLowerCase()??``,y=/^(tsx?|jsx?|mjs|cjs|py|rb|go|rs|java|kt|swift|sh|css|scss|html|vue|svelte)$/.test(v)?s:/^(json|jsonc|jsonl)$/.test(v)?p:/^(png|jpe?g|gif|webp|svg|avif|ico|bmp)$/.test(v)?c:/^(xlsx?|csv|tsv|ods)$/.test(v)?r:/^(pptx?|odp)$/.test(v)?d:/^(mp3|wav|ogg|flac|m4a|aac)$/.test(v)?m:/^(mp4|webm|mov|mkv|avi)$/.test(v)?i:/^(zip|gz|tar|rar|7z|bz2)$/.test(v)?o:/^(md|mdx|txt|pdf|docx?|log|ya?ml|toml)$/.test(v)?l:u,b;t[0]!==_||t[1]!==n?(b=f(`size-4 shrink-0`,a(n),_),t[0]=_,t[1]=n,t[2]=b):b=t[2];let x;return t[3]!==y||t[4]!==b?(x=(0,g.jsx)(y,{className:b,strokeWidth:1.75,"aria-hidden":!0}),t[3]=y,t[4]=b,t[5]=x):x=t[5],x}export{m as n,p as r,_ as t};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{a as t,n,t as r}from"./vendor-react-BOUWij0V.js";import{t as i}from"./chevron-right-BweFrslA.js";import{t as a}from"./ellipsis-0k4rZLoy.js";import{t as o}from"./file-icon-N6WjUhq_.js";import{t as s}from"./folder-open-CyzJ19I9.js";import{t as c}from"./folder-CN-pC3XL.js";import{t as l}from"./cn-0WouolD0.js";import{n as u}from"./interaction-BdhHBbYa.js";import{n as d}from"./electron-env-DHOGevH3.js";var f=n(),p=e(t(),1),m=r();function h(e){let t=(0,f.c)(45),{entry:n,labels:r,onAction:i}=e,[o,s]=(0,p.useState)(!1),c;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(c=[],t[0]=c):c=t[0];let[h,C]=(0,p.useState)(c),w;t[1]===Symbol.for(`react.memo_cache_sentinel`)?(w=()=>s(!1),t[1]=w):w=t[1];let T=w,E;t[2]!==n.fileId||t[3]!==o?(E=()=>{if(!o||!n.fileId||!d()||!window.electronAPI?.shell?.getOpenWithAppsForFileResource){C([]);return}let e=!1;return window.electronAPI.shell.getOpenWithAppsForFileResource(n.fileId).then(t=>{e||C(t.recommended.map(S))}).catch(()=>{e||C([])}),()=>{e=!0}},t[2]=n.fileId,t[3]=o,t[4]=E):E=t[4];let D;t[5]!==n.fileId||t[6]!==n.isDirectory||t[7]!==o?(D=[n.fileId,n.isDirectory,o],t[5]=n.fileId,t[6]=n.isDirectory,t[7]=o,t[8]=D):D=t[8],(0,p.useEffect)(E,D);let O,k,A,j;if(t[9]!==n||t[10]!==r.copyPath||t[11]!==r.delete||t[12]!==r.desktopUpdateRequired||t[13]!==r.download||t[14]!==r.openDefault||t[15]!==r.openDirectory||t[16]!==r.openWith||t[17]!==r.preview||t[18]!==r.recommendedApps||t[19]!==r.revealInFolder||t[20]!==r.share||t[21]!==r.trash||t[22]!==o||t[23]!==i||t[24]!==h){let e=n.fileId?h.map(x):[],c=d()?window.electronAPI?.shell:void 0,f=n.isDirectory?r.openDirectory:r.openDefault,p=n.fileId?[...!f||!c?.openFileResource?[]:[{action:`openDefault`,label:f}],...!r.openWith||!c?.chooseAppAndOpenFileResource?[]:[{action:`openWith`,label:r.openWith}],...r.revealInFolder&&c?.showFileResourceInFolder?[{action:`revealInFolder`,label:r.revealInFolder}]:[],...!n.isDirectory&&r.trash&&c?.trashFileResource?[{action:`trash`,label:r.trash}]:[]]:[],S=n.isDirectory?[...p,...r.share?[{action:`share`,label:r.share}]:[],{action:`copyPath`,label:r.copyPath}]:[...p,{action:`preview`,label:r.preview},{action:`download`,label:r.download},...r.share?[{action:`share`,label:r.share}]:[],{action:`copyPath`,label:r.copyPath},...r.delete?[{action:`delete`,label:r.delete}]:[]];t[29]===o?j=t[30]:(j=o?(0,m.jsx)(`button`,{type:`button`,className:`fixed inset-0 z-40 cursor-default bg-transparent`,"aria-hidden":!0,tabIndex:-1,onPointerDown:e=>{e.preventDefault(),T()}}):null,t[29]=o,t[30]=j),O=`relative shrink-0`;let C=o&&`opacity-100`,w;t[31]===C?w=t[32]:(w=l(`rounded-md p-1 text-fg-muted opacity-0 transition-opacity hover:bg-surface-hover hover:text-fg`,`group-hover:opacity-100 group-focus-within:opacity-100 focus-visible:opacity-100`,u.focusRingPanel,C),t[31]=C,t[32]=w);let E,D;t[33]===Symbol.for(`react.memo_cache_sentinel`)?(E=e=>{e.stopPropagation(),s(y)},D=(0,m.jsx)(a,{className:`size-3.5`,"aria-hidden":!0}),t[33]=E,t[34]=D):(E=t[33],D=t[34]),t[35]!==o||t[36]!==w?(k=(0,m.jsx)(`button`,{type:`button`,className:w,"aria-haspopup":`menu`,"aria-expanded":o,"aria-label":`More`,onPointerDown:b,onClick:E,children:D}),t[35]=o,t[36]=w,t[37]=k):k=t[37],A=o?(0,m.jsxs)(`div`,{role:`menu`,className:`absolute right-0 top-full z-50 mt-0.5 min-w-[9rem] rounded-md border border-edge bg-surface-overlay py-1 shadow-popover`,onPointerDown:v,children:[d()&&n.fileId&&!c?.openFileResource&&r.desktopUpdateRequired?(0,m.jsx)(`button`,{type:`button`,role:`menuitem`,disabled:!0,className:`block w-full cursor-not-allowed px-3 py-1.5 text-left text-sm text-fg-subtle opacity-70`,title:r.desktopUpdateRequired,children:(0,m.jsx)(`span`,{className:`block truncate`,children:r.desktopUpdateRequired})}):null,p.filter(_).map(e=>{let{action:t,label:r,appPath:a}=e;return(0,m.jsx)(`button`,{type:`button`,role:`menuitem`,className:`block w-full px-3 py-1.5 text-left text-sm text-fg hover:bg-surface-hover`,title:a,onClick:()=>{i(t,n,a),T()},children:(0,m.jsx)(`span`,{className:`block truncate`,children:r})},a?`${t}:${a}`:t)}),r.recommendedApps&&e.length>0?(0,m.jsxs)(m.Fragment,{children:[(0,m.jsx)(`p`,{className:`border-t border-edge-subtle px-3 pb-1 pt-2 text-[11px] font-medium uppercase tracking-normal text-fg-subtle dark:border-edge`,children:r.recommendedApps}),e.map(e=>{let{action:t,label:r,appPath:a}=e;return(0,m.jsx)(`button`,{type:`button`,role:`menuitem`,className:`block w-full min-w-0 px-3 py-1.5 text-left text-sm text-fg hover:bg-surface-hover`,title:a,onClick:()=>{i(t,n,a),T()},children:(0,m.jsx)(`span`,{className:`block truncate`,children:r})},`${t}:${a}`)})]}):null,S.filter(g).map(e=>{let{action:t,label:r,appPath:a}=e;return(0,m.jsx)(`button`,{type:`button`,role:`menuitem`,className:l(`block w-full px-3 py-1.5 text-left text-sm text-fg hover:bg-surface-hover`,(t===`trash`||t===`delete`)&&`text-danger hover:bg-danger/10 hover:text-danger`),title:a,onClick:()=>{i(t,n,a),T()},children:(0,m.jsx)(`span`,{className:`block truncate`,children:r})},a?`${t}:${a}`:t)})]}):null,t[9]=n,t[10]=r.copyPath,t[11]=r.delete,t[12]=r.desktopUpdateRequired,t[13]=r.download,t[14]=r.openDefault,t[15]=r.openDirectory,t[16]=r.openWith,t[17]=r.preview,t[18]=r.recommendedApps,t[19]=r.revealInFolder,t[20]=r.share,t[21]=r.trash,t[22]=o,t[23]=i,t[24]=h,t[25]=O,t[26]=k,t[27]=A,t[28]=j}else O=t[25],k=t[26],A=t[27],j=t[28];let M;t[38]!==O||t[39]!==k||t[40]!==A?(M=(0,m.jsxs)(`div`,{className:O,children:[k,A]}),t[38]=O,t[39]=k,t[40]=A,t[41]=M):M=t[41];let N;return t[42]!==j||t[43]!==M?(N=(0,m.jsxs)(m.Fragment,{children:[j,M]}),t[42]=j,t[43]=M,t[44]=N):N=t[44],N}function g(e){return e.action!==`openDefault`}function _(e){return e.action===`openDefault`}function v(e){return e.stopPropagation()}function y(e){return!e}function b(e){return e.stopPropagation()}function x(e){return{action:`openWithApp`,label:e.name,appPath:e.path}}function S(e){return{name:e.name,path:e.path}}function C(e){return Array.from(e.dataTransfer.types).includes(`Files`)}function w(e){let t=e.lastIndexOf(`/`);return t<0?``:e.slice(0,t)}function T(e){let t=(0,f.c)(124),{entry:n,depth:r,selectedPath:a,forceOpen:d,onSelect:g,onExpandDir:_,onAction:v,actionLabels:y,onFileDragStart:b,onUploadFiles:x,onUploadTargetEnter:S}=e,E;t[0]!==n.isDirectory||t[1]!==n.path||t[2]!==a?(E=a&&n.isDirectory&&a.startsWith(`${n.path}/`),t[0]=n.isDirectory,t[1]=n.path,t[2]=a,t[3]=E):E=t[3];let D=!!E,O;t[4]!==D||t[5]!==a?(O={selectedPath:a,open:D},t[4]=D,t[5]=a,t[6]=O):O=t[6];let[k,A]=(0,p.useState)(O),[j,M]=(0,p.useState)(!1),N=k.open;k.selectedPath!==a&&(N||=D,A({selectedPath:a,open:N}));let P=!!(d||N),F,I;t[7]!==D||t[8]!==n.path||t[9]!==_?(F=()=>{D&&_?.(n.path)},I=[D,n.path,_],t[7]=D,t[8]=n.path,t[9]=_,t[10]=F,t[11]=I):(F=t[10],I=t[11]),(0,p.useEffect)(F,I);let L=a===n.path;if(n.isDirectory){let e;t[12]===Symbol.for(`react.memo_cache_sentinel`)?(e={containIntrinsicSize:`32px`},t[12]=e):e=t[12];let o=n.path,f=L&&`bg-accent-soft text-accent-fg`,p=j&&`bg-accent-soft text-accent-fg ring-1 ring-inset ring-accent`,w;t[13]!==f||t[14]!==p?(w=l(`flex min-w-0 flex-1 min-h-8 items-center gap-2 rounded-lg py-1.5 pr-2 text-left text-sm transition-colors`,`hover:bg-surface-hover`,u.focusRingPanel,f,p),t[13]=f,t[14]=p,t[15]=w):w=t[15];let E=8+r*16,D;t[16]===E?D=t[17]:(D={paddingLeft:E},t[16]=E,t[17]=D);let O;t[18]!==n.path||t[19]!==_||t[20]!==g||t[21]!==a||t[22]!==P?(O=()=>{let e=!P;A({selectedPath:a,open:e}),e&&_?.(n.path),g(n.path,!0)},t[18]=n.path,t[19]=_,t[20]=g,t[21]=a,t[22]=P,t[23]=O):O=t[23];let k;t[24]!==x||t[25]!==S?(k=x?e=>{C(e)&&(e.preventDefault(),e.stopPropagation(),S?.(),M(!0))}:void 0,t[24]=x,t[25]=S,t[26]=k):k=t[26];let N;t[27]===x?N=t[28]:(N=x?e=>{C(e)&&(e.preventDefault(),e.stopPropagation(),e.dataTransfer.dropEffect=`copy`,M(!0))}:void 0,t[27]=x,t[28]=N);let F;t[29]===x?F=t[30]:(F=x?e=>{e.stopPropagation(),e.currentTarget.contains(e.relatedTarget)||M(!1)}:void 0,t[29]=x,t[30]=F);let I;t[31]!==n.path||t[32]!==x?(I=x?e=>{if(!C(e))return;e.preventDefault(),e.stopPropagation(),M(!1);let t=Array.from(e.dataTransfer.files);t.length&&x(t,n.path)}:void 0,t[31]=n.path,t[32]=x,t[33]=I):I=t[33];let R=P&&`rotate-90`,z;t[34]===R?z=t[35]:(z=l(`size-3.5 shrink-0 text-fg-subtle transition-transform motion-reduce:transition-none`,R),t[34]=R,t[35]=z);let B;t[36]===z?B=t[37]:(B=(0,m.jsx)(i,{className:z,"aria-hidden":!0}),t[36]=z,t[37]=B);let V;t[38]===P?V=t[39]:(V=(0,m.jsx)(`span`,{className:`shrink-0 text-fg-muted`,children:P?(0,m.jsx)(s,{className:`size-4`,strokeWidth:1.75,"aria-hidden":!0}):(0,m.jsx)(c,{className:`size-4`,strokeWidth:1.75,"aria-hidden":!0})}),t[38]=P,t[39]=V);let H;t[40]===n.name?H=t[41]:(H=(0,m.jsx)(`span`,{className:`truncate`,children:n.name}),t[40]=n.name,t[41]=H);let U;t[42]!==n.path||t[43]!==D||t[44]!==O||t[45]!==k||t[46]!==N||t[47]!==F||t[48]!==I||t[49]!==B||t[50]!==V||t[51]!==H||t[52]!==w||t[53]!==P?(U=(0,m.jsxs)(`button`,{type:`button`,"aria-expanded":P,"data-file-drop-directory":o,className:w,style:D,onClick:O,onDragEnter:k,onDragOver:N,onDragLeave:F,onDrop:I,children:[B,V,H]}),t[42]=n.path,t[43]=D,t[44]=O,t[45]=k,t[46]=N,t[47]=F,t[48]=I,t[49]=B,t[50]=V,t[51]=H,t[52]=w,t[53]=P,t[54]=U):U=t[54];let W;t[55]!==y||t[56]!==n||t[57]!==v?(W=v&&y?(0,m.jsx)(h,{entry:n,labels:y,onAction:v}):null,t[55]=y,t[56]=n,t[57]=v,t[58]=W):W=t[58];let G;t[59]!==U||t[60]!==W?(G=(0,m.jsxs)(`div`,{className:`group mx-1 flex items-stretch gap-0.5 [content-visibility:auto] has-[[aria-expanded=true]]:[content-visibility:visible]`,style:e,children:[U,W]}),t[59]=U,t[60]=W,t[61]=G):G=t[61];let K;t[62]!==y||t[63]!==r||t[64]!==n.children||t[65]!==d||t[66]!==v||t[67]!==_||t[68]!==b||t[69]!==g||t[70]!==x||t[71]!==S||t[72]!==a||t[73]!==P?(K=P&&n.children?.length?(0,m.jsx)(`div`,{children:n.children.map(e=>(0,m.jsx)(T,{entry:e,depth:r+1,selectedPath:a,forceOpen:d,onSelect:g,onExpandDir:_,onAction:v,actionLabels:y,onFileDragStart:b,onUploadFiles:x,onUploadTargetEnter:S},e.path))}):null,t[62]=y,t[63]=r,t[64]=n.children,t[65]=d,t[66]=v,t[67]=_,t[68]=b,t[69]=g,t[70]=x,t[71]=S,t[72]=a,t[73]=P,t[74]=K):K=t[74];let q;return t[75]!==G||t[76]!==K?(q=(0,m.jsxs)(`div`,{className:`select-none`,children:[G,K]}),t[75]=G,t[76]=K,t[77]=q):q=t[77],q}let R;t[78]===Symbol.for(`react.memo_cache_sentinel`)?(R={containIntrinsicSize:`32px`},t[78]=R):R=t[78];let z=!!b,B=b&&`cursor-grab active:cursor-grabbing`,V=L&&`bg-accent-soft text-accent-fg`,H=j&&`bg-accent-soft text-accent-fg ring-1 ring-inset ring-accent`,U;t[79]!==B||t[80]!==V||t[81]!==H?(U=l(`flex min-w-0 flex-1 min-h-8 items-center gap-2 rounded-lg py-1.5 pr-2 text-left text-sm transition-colors`,`hover:bg-surface-hover`,u.focusRingPanel,B,V,H),t[79]=B,t[80]=V,t[81]=H,t[82]=U):U=t[82];let W=8+r*16,G;t[83]===W?G=t[84]:(G={paddingLeft:W},t[83]=W,t[84]=G);let K;t[85]!==n.path||t[86]!==g?(K=()=>g(n.path,!1),t[85]=n.path,t[86]=g,t[87]=K):K=t[87];let q;t[88]!==n||t[89]!==b?(q=b?e=>b(e,n):void 0,t[88]=n,t[89]=b,t[90]=q):q=t[90];let J;t[91]!==x||t[92]!==S?(J=x?e=>{C(e)&&(e.preventDefault(),e.stopPropagation(),S?.(),M(!0))}:void 0,t[91]=x,t[92]=S,t[93]=J):J=t[93];let Y;t[94]===x?Y=t[95]:(Y=x?e=>{C(e)&&(e.preventDefault(),e.stopPropagation(),e.dataTransfer.dropEffect=`copy`,M(!0))}:void 0,t[94]=x,t[95]=Y);let X;t[96]===x?X=t[97]:(X=x?e=>{e.stopPropagation(),e.currentTarget.contains(e.relatedTarget)||M(!1)}:void 0,t[96]=x,t[97]=X);let Z;t[98]!==n.path||t[99]!==x?(Z=x?e=>{if(!C(e))return;e.preventDefault(),e.stopPropagation(),M(!1);let t=Array.from(e.dataTransfer.files);t.length&&x(t,w(n.path))}:void 0,t[98]=n.path,t[99]=x,t[100]=Z):Z=t[100];let ee;t[101]===Symbol.for(`react.memo_cache_sentinel`)?(ee=(0,m.jsx)(`span`,{className:`size-3.5 shrink-0`,"aria-hidden":!0}),t[101]=ee):ee=t[101];let Q,$;t[102]===n.name?(Q=t[103],$=t[104]):(Q=(0,m.jsx)(o,{name:n.name}),$=(0,m.jsx)(`span`,{className:`truncate`,children:n.name}),t[102]=n.name,t[103]=Q,t[104]=$);let te;t[105]!==U||t[106]!==G||t[107]!==K||t[108]!==q||t[109]!==J||t[110]!==Y||t[111]!==X||t[112]!==Z||t[113]!==Q||t[114]!==$||t[115]!==z?(te=(0,m.jsxs)(`button`,{type:`button`,draggable:z,className:U,style:G,onClick:K,onDragStart:q,onDragEnter:J,onDragOver:Y,onDragLeave:X,onDrop:Z,children:[ee,Q,$]}),t[105]=U,t[106]=G,t[107]=K,t[108]=q,t[109]=J,t[110]=Y,t[111]=X,t[112]=Z,t[113]=Q,t[114]=$,t[115]=z,t[116]=te):te=t[116];let ne;t[117]!==y||t[118]!==n||t[119]!==v?(ne=v&&y?(0,m.jsx)(h,{entry:n,labels:y,onAction:v}):null,t[117]=y,t[118]=n,t[119]=v,t[120]=ne):ne=t[120];let re;return t[121]!==te||t[122]!==ne?(re=(0,m.jsxs)(`div`,{className:`group mx-1 flex items-stretch gap-0.5 [content-visibility:auto] has-[[aria-expanded=true]]:[content-visibility:visible]`,style:R,children:[te,ne]}),t[121]=te,t[122]=ne,t[123]=re):re=t[123],re}function E(e,t){return e.name.toLocaleLowerCase().includes(t)||e.path.toLocaleLowerCase().includes(t)}function D(e,t){return t?e.flatMap(e=>{let n=e.children?D(e.children,t):void 0;return E(e,t)||n?.length?[{...e,children:n}]:[]}):e}function O(e){let t=(0,f.c)(42),{tree:n,selectedPath:r,onSelectFile:i,onSelectEntry:a,onExpandDir:o,onAction:s,actionLabels:c,emptyHint:u,searchQuery:d,emptySearchHint:h,onFileDragStart:g,onUploadFiles:_,uploadDropHint:v}=e,[y,b]=(0,p.useState)(!1),x=d??``,S;t[0]===x?S=t[1]:(S=x.trim().toLocaleLowerCase(),t[0]=x,t[1]=S);let w=S,E;t[2]!==w||t[3]!==n?(E=D(n,w),t[2]=w,t[3]=n,t[4]=E):E=t[4];let O=E,k;t[5]!==a||t[6]!==i?(k=(e,t)=>{a?.(e,t),t||i(e)},t[5]=a,t[6]=i,t[7]=k):k=t[7];let A=k,j=y&&`bg-accent-soft/60 ring-1 ring-inset ring-accent`,M;t[8]===j?M=t[9]:(M=l(`relative min-h-0 flex-1 overflow-y-auto py-2`,j),t[8]=j,t[9]=M);let N;t[10]===_?N=t[11]:(N=_?e=>{C(e)&&(e.preventDefault(),b(!0))}:void 0,t[10]=_,t[11]=N);let P;t[12]===_?P=t[13]:(P=_?e=>{C(e)&&(e.preventDefault(),e.dataTransfer.dropEffect=`copy`,b(!0))}:void 0,t[12]=_,t[13]=P);let F;t[14]===_?F=t[15]:(F=_?e=>{e.currentTarget.contains(e.relatedTarget)||b(!1)}:void 0,t[14]=_,t[15]=F);let I;t[16]===_?I=t[17]:(I=_?e=>{if(!C(e))return;e.preventDefault(),b(!1);let t=Array.from(e.dataTransfer.files);t.length&&_(t,``)}:void 0,t[16]=_,t[17]=I);let L;t[18]!==y||t[19]!==v?(L=y&&v?(0,m.jsx)(`div`,{className:`pointer-events-none sticky top-0 z-20 mx-2 mb-1 rounded-md border border-accent bg-surface-overlay px-3 py-2 text-center text-xs font-medium text-accent-fg shadow-sm`,children:v}):null,t[18]=y,t[19]=v,t[20]=L):L=t[20];let R;t[21]!==c||t[22]!==u||t[23]!==h||t[24]!==A||t[25]!==w||t[26]!==s||t[27]!==o||t[28]!==g||t[29]!==_||t[30]!==r||t[31]!==n.length||t[32]!==O?(R=n.length?O.length?O.map(e=>(0,m.jsx)(T,{entry:e,depth:0,selectedPath:r,forceOpen:!!w,onSelect:A,onExpandDir:o,onAction:s,actionLabels:c,onFileDragStart:g,onUploadFiles:_,onUploadTargetEnter:()=>b(!1)},e.path)):(0,m.jsx)(`p`,{className:`px-3 py-2 text-xs text-fg-muted`,children:h??u}):(0,m.jsx)(`p`,{className:`px-3 py-2 text-xs text-fg-muted`,children:u}),t[21]=c,t[22]=u,t[23]=h,t[24]=A,t[25]=w,t[26]=s,t[27]=o,t[28]=g,t[29]=_,t[30]=r,t[31]=n.length,t[32]=O,t[33]=R):R=t[33];let z;return t[34]!==I||t[35]!==L||t[36]!==R||t[37]!==M||t[38]!==N||t[39]!==P||t[40]!==F?(z=(0,m.jsxs)(`div`,{className:M,"data-file-drop-directory":``,onDragEnter:N,onDragOver:P,onDragLeave:F,onDrop:I,children:[L,R]}),t[34]=I,t[35]=L,t[36]=R,t[37]=M,t[38]=N,t[39]=P,t[40]=F,t[41]=z):z=t[41],z}export{O as t};
|