@xopcai/xopc 0.0.412 → 0.0.413
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/browser-ext/manifest.json +1 -1
- package/dist/extensions/telegram/xopc.extension.json +1 -1
- package/dist/gateway/static/root/assets/{agent-avatar-dicebear-BrGZdh5N.js → agent-avatar-dicebear-BT6oqCMD.js} +1 -1
- package/dist/gateway/static/root/assets/agent-defaults-settings-panel-BFmRRD_4.js +1 -0
- package/dist/gateway/static/root/assets/agents-Clwskw2J.js +77 -0
- package/dist/gateway/static/root/assets/{agents-admin-api-uGDeJR1f.js → agents-admin-api-CeBkHnl8.js} +1 -1
- package/dist/gateway/static/root/assets/app-management-settings-panel-BdCgtTfT.js +1 -0
- package/dist/gateway/static/root/assets/appearance-settings-C3-hCFlF.js +1 -0
- package/dist/gateway/static/root/assets/apps-page-DJbKg3va.js +1 -0
- package/dist/gateway/static/root/assets/{archive-plugin-DAmsio91.js → archive-plugin-BviFGCy4.js} +1 -1
- package/dist/gateway/static/root/assets/{automations-page-BVutrwON.js → automations-page-CfzazXE5.js} +1 -1
- package/dist/gateway/static/root/assets/automations-workspace-D_X0_1X3.js +8 -0
- package/dist/gateway/static/root/assets/{binary-plugins-41QCRAxz.js → binary-plugins-Dp-gtJEk.js} +1 -1
- package/dist/gateway/static/root/assets/{block-editor-BQ8AA-Ot.js → block-editor-D-DEPdpi.js} +4 -4
- package/dist/gateway/static/root/assets/{browser-automation-inputs-D4-vQc4g.js → browser-automation-inputs-D1pDgMJu.js} +1 -1
- package/dist/gateway/static/root/assets/browser-automations-page-BI-ep6uM.js +3 -0
- package/dist/gateway/static/root/assets/browser-settings-page-BTyQ4-vN.js +3 -0
- package/dist/gateway/static/root/assets/capabilities-Bpeh6E22.js +1 -0
- package/dist/gateway/static/root/assets/capabilities-page-GNS95mG9.js +2 -0
- package/dist/gateway/static/root/assets/capabilities-settings-panel-DBiv1HN-.js +8 -0
- package/dist/gateway/static/root/assets/{capability-header-actions-CDgI-YZF.js → capability-header-actions-CP2fI9Fe.js} +1 -1
- package/dist/gateway/static/root/assets/channels-DWlrUKBr.js +1 -0
- package/dist/gateway/static/root/assets/{chat-terminal-dock-CUkCx_9x.js → chat-terminal-dock-BL3tFntQ.js} +2 -2
- package/dist/gateway/static/root/assets/computer-settings-page-DEQ5GYfC.js +1 -0
- package/dist/gateway/static/root/assets/{connector-service-page-49mgdRET.js → connector-service-page-CecwMnC5.js} +1 -1
- package/dist/gateway/static/root/assets/connectors-page-BcpUvrtl.js +1 -0
- package/dist/gateway/static/root/assets/{date-picker-BpBjADAk.js → date-picker-N5jnlvPs.js} +1 -1
- package/dist/gateway/static/root/assets/{dependency-picker-R8kdHLr3.js → dependency-picker-C4jddxFl.js} +1 -1
- package/dist/gateway/static/root/assets/{desktop-pet-BpiosRqb.js → desktop-pet-BCbiUNQG.js} +1 -1
- package/dist/gateway/static/root/assets/desktop-pet-settings-CkKU0JMY.js +1 -0
- package/dist/gateway/static/root/assets/device-pairing-wizard--E2GQoY1.js +1 -0
- package/dist/gateway/static/root/assets/{directory-picker-path-field-DwXqp_iu.js → directory-picker-path-field-CbMbPimD.js} +1 -1
- package/dist/gateway/static/root/assets/extension-debug-page-OE1nJMQ8.js +1 -0
- package/dist/gateway/static/root/assets/{extension-page-Bri62YsN.js → extension-page-BEomiKhy.js} +1 -1
- package/dist/gateway/static/root/assets/extension-settings-page-BFOjQeSX.js +1 -0
- package/dist/gateway/static/root/assets/{gateway-config-swr-BVqYVaGy.js → gateway-config-swr-DF_HV6NP.js} +1 -1
- package/dist/gateway/static/root/assets/{gateway-realtime-CY1LBGBS.js → gateway-realtime-DMAzNlm-.js} +1 -1
- package/dist/gateway/static/root/assets/gateway-realtime-store-CoIgC1Al.js +1 -0
- package/dist/gateway/static/root/assets/gateway-settings-CR4CsfNN.js +1 -0
- package/dist/gateway/static/root/assets/{gateway-startup-retry-CPKGkr6D.js → gateway-startup-retry-B91CBTzO.js} +1 -1
- package/dist/gateway/static/root/assets/highlight-code-6ONPRH5r.js +1 -0
- package/dist/gateway/static/root/assets/{highlighted-body-KQOG7T2V-Ci1QpkBn.js → highlighted-body-KQOG7T2V-EJ9Kg4iQ.js} +1 -1
- package/dist/gateway/static/root/assets/home-page-B9w3a6r2.js +2 -0
- package/dist/gateway/static/root/assets/{image-generation-api-N5MYXlxr.js → image-generation-api-D0HNic89.js} +1 -1
- package/dist/gateway/static/root/assets/imports-page-bxTINe-2.js +1 -0
- package/dist/gateway/static/root/assets/index-D1oivYvN.js +710 -0
- package/dist/gateway/static/root/assets/index-D_7q1UkI.css +1 -0
- package/dist/gateway/static/root/assets/keyboard-shortcuts-settings-Cmi-2SIh.js +1 -0
- package/dist/gateway/static/root/assets/local-app-workbench-page-NGCmXpa_.js +1 -0
- package/dist/gateway/static/root/assets/{local-apps-page-BjzaB1ls.js → local-apps-page-jgaogH9Z.js} +1 -1
- package/dist/gateway/static/root/assets/{local-session-drafts-BCaC-1rH.js → local-session-drafts-DvmwiLUx.js} +1 -1
- package/dist/gateway/static/root/assets/{locale-store-DAgpZxAS.js → locale-store-JogcXC4J.js} +1 -1
- package/dist/gateway/static/root/assets/logs-page-drrr-c2W.js +2 -0
- package/dist/gateway/static/root/assets/management-settings-Dc1opXVr.js +1 -0
- package/dist/gateway/static/root/assets/{media-plugins-8mlDAjD6.js → media-plugins-BRS9puQV.js} +1 -1
- package/dist/gateway/static/root/assets/mermaid-MCJ5UELQ-B--edI1I.js +1 -0
- package/dist/gateway/static/root/assets/{messages-DMXSIJUO.js → messages-RzwPiQNL.js} +2 -2
- package/dist/gateway/static/root/assets/note-detail-panel-C3s4-ytB.js +5 -0
- package/dist/gateway/static/root/assets/note-image-lightbox-D7q5-KuS.js +1 -0
- package/dist/gateway/static/root/assets/notes-page-qVxoErUS.js +8 -0
- package/dist/gateway/static/root/assets/{page-context-capture-button-oSJIFF3E.js → page-context-capture-button-D_VOB2_C.js} +1 -1
- package/dist/gateway/static/root/assets/personal-page-B-T8NzQo.js +1 -0
- package/dist/gateway/static/root/assets/personal-settings-panel-BKA4fbYH.js +1 -0
- package/dist/gateway/static/root/assets/phone-dependencies-card-DhEsfEUN.js +1 -0
- package/dist/gateway/static/root/assets/phone-model-picker-J4mFDk21.js +1 -0
- package/dist/gateway/static/root/assets/phone-settings-page-BLflz8CQ.js +1 -0
- package/dist/gateway/static/root/assets/plugin-details-dialog-1BwvmKZi.js +1 -0
- package/dist/gateway/static/root/assets/{preview-open-alternatives-n6Shdp3u.js → preview-open-alternatives-DaTaSKox.js} +1 -1
- package/dist/gateway/static/root/assets/{product-open-page-BPF5rRTI.js → product-open-page-wYlC0IVZ.js} +1 -1
- package/dist/gateway/static/root/assets/{product-preview-content-BOsGPNbw.js → product-preview-content-Bxur-p6S.js} +1 -1
- package/dist/gateway/static/root/assets/project-detail-page-DwowzxzD.js +7 -0
- package/dist/gateway/static/root/assets/projects-page-Bwvn4i_e.js +1 -0
- package/dist/gateway/static/root/assets/{registry-api-B6kqbuw8.js → registry-api-BGqSwITi.js} +1 -1
- package/dist/gateway/static/root/assets/remote-access-hub-DrHisOUe.js +1 -0
- package/dist/gateway/static/root/assets/runtime-tools-api-CSm5SpnR.js +5 -0
- package/dist/gateway/static/root/assets/runtime-tools-settings-panel-DXNidliV.js +1 -0
- package/dist/gateway/static/root/assets/{schema-form-cXD1BC02.js → schema-form-DeSZ7SiO.js} +1 -1
- package/dist/gateway/static/root/assets/{session-api-D6-Vz8xK.js → session-api-DTxZyMta.js} +1 -1
- package/dist/gateway/static/root/assets/{session-manager-DWbcMHcj.js → session-manager-B2HDomj4.js} +1 -1
- package/dist/gateway/static/root/assets/sessions-page-seP7t0kv.js +1 -0
- package/dist/gateway/static/root/assets/settings-advanced-gate-VqBu7gHu.js +1 -0
- package/dist/gateway/static/root/assets/{settings-form-section-BXeszXR7.js → settings-form-section-BNYQjZU4.js} +1 -1
- package/dist/gateway/static/root/assets/{settings-page-CNmh4YmR.js → settings-page-29Ix0jSQ.js} +1 -1
- package/dist/gateway/static/root/assets/{settings-page-layout-Dx5S-Msc.js → settings-page-header-CYpuTXUW.js} +1 -1
- package/dist/gateway/static/root/assets/settings-page-layout-B20AfmFG.js +1 -0
- package/dist/gateway/static/root/assets/setup-status-panel-COQZgKX9.js +1 -0
- package/dist/gateway/static/root/assets/{share-preview-page-CS9cOCgX.js → share-preview-page-CwMRULXc.js} +1 -1
- package/dist/gateway/static/root/assets/shares-settings-BWaykw9E.js +1 -0
- package/dist/gateway/static/root/assets/{skill-api-B5lDCuOH.js → skill-api-xfB5fUAh.js} +1 -1
- package/dist/gateway/static/root/assets/skill-reload-api-Bq-3_MCt.js +1 -0
- package/dist/gateway/static/root/assets/skills-page-C3LfWsAZ.js +2 -0
- package/dist/gateway/static/root/assets/system-settings-panel-DRJu1ehM.js +1 -0
- package/dist/gateway/static/root/assets/task-detail-page-XCJFP-Aa.js +2 -0
- package/dist/gateway/static/root/assets/{task-result-evidence-HJO1BlJm.js → task-result-evidence-C4o_Yue_.js} +1 -1
- package/dist/gateway/static/root/assets/tracing-settings-page-CYslh-Pu.js +1 -0
- package/dist/gateway/static/root/assets/{tunnel-api-DXU94F2Y.js → tunnel-api-Bi_kw6bv.js} +1 -1
- package/dist/gateway/static/root/assets/usage-page-CTTmklCs.js +1 -0
- package/dist/gateway/static/root/assets/{use-autosave-B1z_TIBu.js → use-autosave-BkB9uD93.js} +1 -1
- package/dist/gateway/static/root/assets/user-model-page-BDqguzRE.js +2 -0
- package/dist/gateway/static/root/assets/{voice-api-key-field-HOLjEhh3.js → voice-api-key-field-bt8_Agih.js} +1 -1
- package/dist/gateway/static/root/assets/{voice-config-api-CPKzUb4R.js → voice-config-api-D7xsWrdh.js} +1 -1
- package/dist/gateway/static/root/assets/{work-discovery-overlay-C9RklDaR.js → work-discovery-overlay-D3NG14dX.js} +1 -1
- package/dist/gateway/static/root/assets/{xopc-cloud-account-card-CWwGTBib.js → xopc-cloud-account-card-B2OUKOQi.js} +1 -1
- package/dist/gateway/static/root/index.html +14 -14
- package/dist/package.js +1 -1
- package/dist/packages/gateway-contract/src/capabilities.js +1 -0
- package/dist/src/agent/agent-manager.js +1 -1
- package/dist/src/agent/background-review/prompts.js +4 -3
- package/dist/src/agent/background-review/run-background-review.js +1 -1
- package/dist/src/agent/embedded/run-turn.js +1 -1
- package/dist/src/agent/embedded/xopc-stream-bridge.js +7 -3
- package/dist/src/agent/external-tools/cliProvider.js +2 -2
- package/dist/src/agent/external-tools/composio-provider.js +2 -2
- package/dist/src/agent/external-tools/endpoint-provider.js +2 -2
- package/dist/src/agent/prompt/system-prompt.js +1 -1
- package/dist/src/agent/service.js +1 -1
- package/dist/src/agent/skills/index.js +1 -1
- package/dist/src/agent/skills/managed-store.js +1 -1
- package/dist/src/agent/skills/skill-manage-ops.js +1 -1
- package/dist/src/agent/tool-manuals/index.js +7 -0
- package/dist/src/agent/tool-manuals/phone.d.ts +1 -0
- package/dist/src/agent/tool-manuals/phone.js +16 -0
- package/dist/src/agent/tools/factory.js +15 -0
- package/dist/src/agent/tools/knowledge-memory-tool.js +1 -1
- package/dist/src/agent/tools/personal-read-tool.js +1 -1
- package/dist/src/agent/tools/personal-task-tool.d.ts +2 -1
- package/dist/src/agent/tools/personal-task-tool.js +43 -20
- package/dist/src/agent/tools/phone-use-tool.d.ts +8 -0
- package/dist/src/agent/tools/phone-use-tool.js +49 -0
- package/dist/src/agent/tools/session-recall-tool.js +2 -1
- package/dist/src/agent/tools/session-search-tool.js +11 -5
- package/dist/src/agent/tools/user-context-tool.js +1 -1
- package/dist/src/agent/tools/xopc-use-tool.js +2 -2
- package/dist/src/agent-catalog/capabilities.js +2 -2
- package/dist/src/agent-catalog/repository.js +1 -1
- package/dist/src/agent-config/index.js +2 -2
- package/dist/src/agent-config/resolver.js +5 -0
- package/dist/src/agent-config/schema.d.ts +24 -0
- package/dist/src/agent-config/schema.js +5 -2
- package/dist/src/automations/capabilities/drafts.js +1 -1
- package/dist/src/browser/providers/browser-ext-install.js +1 -1
- package/dist/src/capabilities/runtime/dispatcher.js +1 -1
- package/dist/src/capabilities/runtime/product.js +1 -1
- package/dist/src/cli/command-manifest.js +1 -1
- package/dist/src/cli/commands/agents.js +1 -1
- package/dist/src/cli/commands/models.js +1 -1
- package/dist/src/cli/commands/onboard/model.js +1 -1
- package/dist/src/cli/commands/onboard.js +1 -1
- package/dist/src/cli/commands/runtime.js +32 -4
- package/dist/src/cli/utils/init-workspace-core.js +1 -1
- package/dist/src/computer/diagnostics.d.ts +1 -1
- package/dist/src/config/agent-profile.js +1 -1
- package/dist/src/config/models-json.d.ts +36 -0
- package/dist/src/config/models-json.js +9 -0
- package/dist/src/config/schema.d.ts +12 -0
- package/dist/src/config/schema.js +6 -2
- package/dist/src/execution-environments/local-worktree-manager.js +1 -1
- package/dist/src/extensions/agent-plugins/skill-catalog.js +1 -1
- package/dist/src/extensions/agent-plugins/validation.js +1 -1
- package/dist/src/gateway/agent-builtin-tools.d.ts +7 -1
- package/dist/src/gateway/agent-builtin-tools.js +7 -0
- package/dist/src/gateway/agents-admin.js +2 -2
- package/dist/src/gateway/global-defaults-admin.js +2 -0
- package/dist/src/gateway/hono/lib/config-payload.d.ts +8 -0
- package/dist/src/gateway/hono/routes/agents.js +1 -1
- package/dist/src/gateway/hono/routes/config-patch/misc.js +1 -1
- package/dist/src/gateway/hono/routes/lazy-bundles.js +8 -0
- package/dist/src/gateway/hono/routes/models.js +3 -0
- package/dist/src/gateway/hono/routes/notes.js +2 -2
- package/dist/src/gateway/hono/routes/phone-dependencies.d.ts +3 -0
- package/dist/src/gateway/hono/routes/phone-dependencies.js +137 -0
- package/dist/src/gateway/hono/routes/phone.d.ts +4 -0
- package/dist/src/gateway/hono/routes/phone.js +445 -0
- package/dist/src/gateway/hono/routes/projects.js +2 -2
- package/dist/src/gateway/hono/routes/runtime-tools.js +2 -0
- package/dist/src/gateway/hono/routes/session-input-handler.js +1 -1
- package/dist/src/gateway/hono/routes/tasks.js +1 -1
- package/dist/src/gateway/image-generation-setup.js +1 -1
- package/dist/src/gateway/server.js +1 -0
- package/dist/src/gateway/service/config-coordinator.d.ts +8 -0
- package/dist/src/gateway/service.d.ts +2 -0
- package/dist/src/gateway/service.js +13 -8
- package/dist/src/gateway/xopc-cloud-capability-setup.js +1 -1
- package/dist/src/imports/importService.js +1 -1
- package/dist/src/knowledge-memory/repository.js +5 -0
- package/dist/src/local-apps/service.js +1 -1
- package/dist/src/memory-learning/forget-capture.js +12 -3
- package/dist/src/memory-learning/forgotten-history.d.ts +4 -0
- package/dist/src/memory-learning/forgotten-history.js +71 -4
- package/dist/src/memory-learning/work-capture.d.ts +1 -0
- package/dist/src/memory-learning/work-capture.js +28 -17
- package/dist/src/personal-agent/prompts.js +3 -2
- package/dist/src/personal-agent/service.js +1 -1
- package/dist/src/phone/adb-driver.d.ts +35 -0
- package/dist/src/phone/adb-driver.js +368 -0
- package/dist/src/phone/cloud-adb.d.ts +34 -0
- package/dist/src/phone/cloud-adb.js +223 -0
- package/dist/src/phone/cloud-phones.d.ts +29 -0
- package/dist/src/phone/cloud-phones.js +141 -0
- package/dist/src/phone/cloud-scrcpy.d.ts +20 -0
- package/dist/src/phone/cloud-scrcpy.js +122 -0
- package/dist/src/phone/contracts.d.ts +204 -0
- package/dist/src/phone/contracts.js +115 -0
- package/dist/src/phone/interactive-session.d.ts +34 -0
- package/dist/src/phone/interactive-session.js +164 -0
- package/dist/src/phone/live-provider.d.ts +57 -0
- package/dist/src/phone/live-provider.js +18 -0
- package/dist/src/phone/live-state.d.ts +28 -0
- package/dist/src/phone/live-state.js +71 -0
- package/dist/src/phone/model-adapter.d.ts +25 -0
- package/dist/src/phone/model-adapter.js +340 -0
- package/dist/src/phone/repository.d.ts +19 -0
- package/dist/src/phone/repository.js +100 -0
- package/dist/src/phone/runtime.d.ts +83 -0
- package/dist/src/phone/runtime.js +896 -0
- package/dist/src/phone/scrcpy.d.ts +62 -0
- package/dist/src/phone/scrcpy.js +345 -0
- package/dist/src/phone/stream-gateway.d.ts +26 -0
- package/dist/src/phone/stream-gateway.js +210 -0
- package/dist/src/process/phone-process.d.ts +4 -0
- package/dist/src/process/phone-process.js +38 -0
- package/dist/src/providers/extension-stream-bridge.js +8 -1
- package/dist/src/providers/model-call.js +6 -2
- package/dist/src/providers/model-catalog-persistence.js +3 -0
- package/dist/src/providers/model-catalog-types.d.ts +3 -0
- package/dist/src/providers/model-reference-auditor.js +5 -1
- package/dist/src/providers/model-registry.js +3 -0
- package/dist/src/runtime-tools/archive.d.ts +2 -2
- package/dist/src/runtime-tools/archive.js +1 -1
- package/dist/src/runtime-tools/downloader.d.ts +2 -2
- package/dist/src/runtime-tools/errors.d.ts +3 -3
- package/dist/src/runtime-tools/phone-dependencies.d.ts +40 -0
- package/dist/src/runtime-tools/phone-dependencies.js +188 -0
- package/dist/src/runtime-tools/phone-dependency-catalog.d.ts +16 -0
- package/dist/src/runtime-tools/phone-dependency-catalog.js +51 -0
- package/dist/src/runtime-tools/types.d.ts +1 -0
- package/dist/src/storage/sqlite/context-extraction-repository.d.ts +1 -0
- package/dist/src/storage/sqlite/context-extraction-repository.js +12 -2
- package/dist/src/tasks/capabilities/read.js +2 -2
- package/dist/src/tasks/capabilities/write.js +1 -1
- package/dist/src/tasks/task-research-result.js +19 -2
- package/dist/src/tui/backends/embedded-backend.js +1 -1
- package/dist/src/usage/cloud-receipts.d.ts +5 -1
- package/dist/src/usage/cloud-receipts.js +10 -4
- package/dist/src/usage/cloud-wire.d.ts +37 -0
- package/dist/src/usage/cloud-wire.js +181 -0
- package/dist/src/usage/recorder.js +5 -4
- package/dist/src/user-model/capture/semantic.js +2 -2
- package/dist/src/voice/platform-catalog.d.ts +3 -0
- package/dist/src/voice/realtime/persona-context.js +1 -1
- package/package.json +10 -5
- package/dist/gateway/static/root/assets/agent-defaults-settings-panel-BjZpom5V.js +0 -1
- package/dist/gateway/static/root/assets/agents-s3ws5Qi-.js +0 -77
- package/dist/gateway/static/root/assets/app-management-settings-panel-C6DHuX0L.js +0 -1
- package/dist/gateway/static/root/assets/appearance-settings-DYGY92Yr.js +0 -1
- package/dist/gateway/static/root/assets/apps-page-PpT_YMmD.js +0 -1
- package/dist/gateway/static/root/assets/automations-workspace-G6-9IYbR.js +0 -8
- package/dist/gateway/static/root/assets/browser-automations-page-o3jNFlCb.js +0 -3
- package/dist/gateway/static/root/assets/browser-settings-page-G0dVwiX4.js +0 -3
- package/dist/gateway/static/root/assets/capabilities-B9b5KCBb.js +0 -1
- package/dist/gateway/static/root/assets/capabilities-page-BZQanmZY.js +0 -2
- package/dist/gateway/static/root/assets/capabilities-settings-panel-D-YadSx_.js +0 -8
- package/dist/gateway/static/root/assets/channels-3WX3f0bR.js +0 -1
- package/dist/gateway/static/root/assets/computer-settings-page-CuZrL9gL.js +0 -1
- package/dist/gateway/static/root/assets/connectors-page-Bjj2wAeG.js +0 -1
- package/dist/gateway/static/root/assets/desktop-pet-settings-9h6evrKB.js +0 -1
- package/dist/gateway/static/root/assets/device-pairing-wizard-CZ5lwiLE.js +0 -1
- package/dist/gateway/static/root/assets/extension-debug-page-Bj93A2Gn.js +0 -1
- package/dist/gateway/static/root/assets/extension-settings-page-BSo6vRhS.js +0 -1
- package/dist/gateway/static/root/assets/gateway-realtime-store-Dafw95ol.js +0 -1
- package/dist/gateway/static/root/assets/gateway-settings-DgEwWJwz.js +0 -1
- package/dist/gateway/static/root/assets/highlight-code-CSFBakwF.js +0 -1
- package/dist/gateway/static/root/assets/home-page-BKj-aPsL.js +0 -2
- package/dist/gateway/static/root/assets/imports-page-YfaRnpk1.js +0 -1
- package/dist/gateway/static/root/assets/index-CiDVRMmX.js +0 -710
- package/dist/gateway/static/root/assets/index-caRW34rg.css +0 -1
- package/dist/gateway/static/root/assets/keyboard-shortcuts-settings-BTQcPOix.js +0 -1
- package/dist/gateway/static/root/assets/local-app-workbench-page-kCZ_fbSZ.js +0 -1
- package/dist/gateway/static/root/assets/logs-page-5Jt3uqYt.js +0 -2
- package/dist/gateway/static/root/assets/management-settings-DOQMLPrI.js +0 -1
- package/dist/gateway/static/root/assets/mermaid-MCJ5UELQ-B4nztFE4.js +0 -1
- package/dist/gateway/static/root/assets/note-detail-panel-1wsKlkk3.js +0 -5
- package/dist/gateway/static/root/assets/note-image-lightbox-B82cToeV.js +0 -1
- package/dist/gateway/static/root/assets/notes-page-DKREWOku.js +0 -8
- package/dist/gateway/static/root/assets/personal-page-CoqQTkkS.js +0 -1
- package/dist/gateway/static/root/assets/personal-settings-panel-BgcJLmZN.js +0 -1
- package/dist/gateway/static/root/assets/plugin-details-dialog-CdOJ3Tir.js +0 -1
- package/dist/gateway/static/root/assets/project-detail-page-ZADyvA7-.js +0 -7
- package/dist/gateway/static/root/assets/projects-page-BkRe6Z8S.js +0 -1
- package/dist/gateway/static/root/assets/remote-access-hub-CCGf5kF4.js +0 -1
- package/dist/gateway/static/root/assets/runtime-tools-api-CY3R7unQ.js +0 -5
- package/dist/gateway/static/root/assets/runtime-tools-settings-panel-BxaxVlwM.js +0 -1
- package/dist/gateway/static/root/assets/sessions-page-B81rRu2-.js +0 -1
- package/dist/gateway/static/root/assets/settings-advanced-gate-DLHGV-I-.js +0 -1
- package/dist/gateway/static/root/assets/setup-status-panel-gEqkJWyw.js +0 -1
- package/dist/gateway/static/root/assets/shares-settings-D9Ul96XW.js +0 -1
- package/dist/gateway/static/root/assets/skill-reload-api-NLAaNaDn.js +0 -1
- package/dist/gateway/static/root/assets/skills-page-dWeFt-6J.js +0 -2
- package/dist/gateway/static/root/assets/system-settings-panel-DdDsFdCh.js +0 -1
- package/dist/gateway/static/root/assets/task-detail-page-DO3FM--W.js +0 -2
- package/dist/gateway/static/root/assets/tracing-settings-page-Dm3yToJ1.js +0 -1
- package/dist/gateway/static/root/assets/usage-page-DJJhACRJ.js +0 -1
- package/dist/gateway/static/root/assets/user-model-page-DnZ4qFaO.js +0 -2
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{a as t,n,t as r}from"./vendor-react-BOUWij0V.js";import{t as i}from"./chunk-KS7C4IRE-BvcCCgTW.js";import{n as a,r as o}from"./popover-select-DGKUpVsz.js";import{t as s}from"./loader-circle-CifKLtgG.js";import{t as ee}from"./messages-DMXSIJUO.js";import{t as c}from"./cn-0WouolD0.js";import{n as l}from"./locale-store-DAgpZxAS.js";import{t as u}from"./button-aIC072nz.js";import{t as d}from"./skeleton-BI5TyibZ.js";import{$u as te,Bc as f,Fa as p,Fc as m,Gl as h,Ia as g,Ic as _,Kc as v,Kl as y,Lc as b,Nl as ne,Ol as x,Pa as S,Pc as C,Qd as w,Qu as T,Rc as E,Ta as D,Vl as O,Yd as k,ma as A,ro as j,ua as M,wa as N,ya as P,za as re,zc as ie}from"./index-CiDVRMmX.js";import{t as F}from"./date-formatters-DukWSVwc.js";var I=n(),L=e(t(),1),R=r();function z(e,t){if(e==null)return t;let n=new Date(e);return Number.isNaN(n.getTime())?t:F(n)}function ae(e){return[...e].sort((e,t)=>{let n=Number(!!t.pinnedAt)-Number(!!e.pinnedAt);return n===0?new Date(t.lastActiveAt??t.updatedAt).getTime()-new Date(e.lastActiveAt??e.updatedAt).getTime():n})}function oe(){let e=(0,I.c)(1),t;return e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,R.jsx)(`div`,{className:`grid gap-3 md:grid-cols-2 xl:grid-cols-3`,"aria-busy":!0,children:Array.from({length:6},B)}),e[0]=t):t=e[0],t}function B(e,t){return(0,R.jsx)(d,{className:`h-40 rounded-xl`},t)}function se(e){let t=(0,I.c)(59),{project:n,busy:r,onTogglePin:a,onToggleArchive:o}=e,s=l(V),c,d,f,p,m,g,_,v;if(t[0]!==s||t[1]!==n.brief||t[2]!==n.description||t[3]!==n.id||t[4]!==n.lastActiveAt||t[5]!==n.name||t[6]!==n.status||t[7]!==n.updatedAt||t[8]!==n.workspaceRoot){let e=ee(s).projectsPage;c=e.management,_=`flex h-full flex-col rounded-xl border border-edge-subtle bg-surface-base p-4`;let r;t[17]===Symbol.for(`react.memo_cache_sentinel`)?(r=(0,R.jsx)(`span`,{className:`flex size-9 shrink-0 items-center justify-center rounded-lg bg-surface-hover text-fg-muted`,children:(0,R.jsx)(te,{className:`size-4`,"aria-hidden":!0})}),t[17]=r):r=t[17];let a;t[18]===n.name?a=t[19]:(a=(0,R.jsx)(`h2`,{className:`truncate text-base font-semibold sm:text-sm text-fg`,children:n.name}),t[18]=n.name,t[19]=a);let o=(0,R.jsxs)(`div`,{className:`min-w-0`,children:[a,(0,R.jsx)(`p`,{className:`mt-0.5 text-xs text-fg-subtle`,children:e.statuses[n.status]})]}),l;t[20]===o?l=t[21]:(l=(0,R.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2`,children:[r,o]}),t[20]=o,t[21]=l);let u;t[22]===Symbol.for(`react.memo_cache_sentinel`)?(u=(0,R.jsx)(k,{className:`mt-2 size-4 shrink-0 text-fg-subtle transition-transform group-hover:translate-x-0.5`,"aria-hidden":!0}),t[22]=u):u=t[22];let h;t[23]===l?h=t[24]:(h=(0,R.jsxs)(`div`,{className:`flex items-start justify-between gap-3`,children:[l,u]}),t[23]=l,t[24]=h),v=(0,R.jsxs)(i,{to:`/projects/${encodeURIComponent(n.id)}`,className:`group flex min-w-0 flex-1 flex-col rounded-lg focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,children:[h,(0,R.jsx)(`p`,{className:`mt-3 line-clamp-2 min-h-10 text-sm leading-6 sm:text-xs sm:leading-5 text-fg-muted`,children:n.description||n.brief||e.noDescription})]}),g=`mt-3 flex shrink-0 items-end justify-between gap-3 border-t border-edge-subtle pt-3`,p=`min-w-0 text-xs text-fg-muted`,m=(0,R.jsx)(`p`,{className:`hidden truncate sm:block`,children:n.workspaceRoot||e.agentDefault}),d=`mt-1`,f=z(n.lastActiveAt??n.updatedAt,e.never),t[0]=s,t[1]=n.brief,t[2]=n.description,t[3]=n.id,t[4]=n.lastActiveAt,t[5]=n.name,t[6]=n.status,t[7]=n.updatedAt,t[8]=n.workspaceRoot,t[9]=c,t[10]=d,t[11]=f,t[12]=p,t[13]=m,t[14]=g,t[15]=_,t[16]=v}else c=t[9],d=t[10],f=t[11],p=t[12],m=t[13],g=t[14],_=t[15],v=t[16];let b;t[25]!==d||t[26]!==f?(b=(0,R.jsx)(`p`,{className:d,children:f}),t[25]=d,t[26]=f,t[27]=b):b=t[27];let x;t[28]!==p||t[29]!==m||t[30]!==b?(x=(0,R.jsxs)(`div`,{className:p,children:[m,b]}),t[28]=p,t[29]=m,t[30]=b,t[31]=x):x=t[31];let S=n.pinnedAt?c.unpin:c.pin,C=n.pinnedAt?c.unpin:c.pin,T;t[32]===n.pinnedAt?T=t[33]:(T=n.pinnedAt?(0,R.jsx)(h,{className:`size-4`,"aria-hidden":!0}):(0,R.jsx)(y,{className:`size-4`,"aria-hidden":!0}),t[32]=n.pinnedAt,t[33]=T);let E;t[34]!==r||t[35]!==a||t[36]!==S||t[37]!==C||t[38]!==T?(E=(0,R.jsx)(u,{type:`button`,variant:`ghost`,className:`size-8 p-0`,disabled:r,onClick:a,"aria-label":S,title:C,children:T}),t[34]=r,t[35]=a,t[36]=S,t[37]=C,t[38]=T,t[39]=E):E=t[39];let D=n.status===`archived`?c.restore:c.archive,O=n.status===`archived`?c.restore:c.archive,A;t[40]===n.status?A=t[41]:(A=n.status===`archived`?(0,R.jsx)(ne,{className:`size-4`,"aria-hidden":!0}):(0,R.jsx)(w,{className:`size-4`,"aria-hidden":!0}),t[40]=n.status,t[41]=A);let j;t[42]!==r||t[43]!==o||t[44]!==D||t[45]!==O||t[46]!==A?(j=(0,R.jsx)(u,{type:`button`,variant:`ghost`,className:`size-8 p-0`,disabled:r,onClick:o,"aria-label":D,title:O,children:A}),t[42]=r,t[43]=o,t[44]=D,t[45]=O,t[46]=A,t[47]=j):j=t[47];let M;t[48]!==E||t[49]!==j?(M=(0,R.jsxs)(`div`,{className:`flex shrink-0 gap-1`,children:[E,j]}),t[48]=E,t[49]=j,t[50]=M):M=t[50];let N;t[51]!==M||t[52]!==g||t[53]!==x?(N=(0,R.jsxs)(`div`,{className:g,children:[x,M]}),t[51]=M,t[52]=g,t[53]=x,t[54]=N):N=t[54];let P;return t[55]!==N||t[56]!==_||t[57]!==v?(P=(0,R.jsxs)(`article`,{className:_,children:[v,N]}),t[55]=N,t[56]=_,t[57]=v,t[58]=P):P=t[58],P}function V(e){return e.language}function H(){let e=ee(l(e=>e.language)),t=e.projectsPage,n=t.management,r=e.chat.workingDirectory,i=j(e=>e.setPageHeader),d=j(e=>e.clearPageHeader),[h,y]=(0,L.useState)([]),[ne,w]=(0,L.useState)(!0),[k,F]=(0,L.useState)(null),[I,z]=(0,L.useState)(``),[B,V]=(0,L.useState)(!1),[H,ce]=(0,L.useState)(`active`),[le,ue]=(0,L.useState)(null),[de,U]=(0,L.useState)(!1),[fe,W]=(0,L.useState)(null),[G,pe]=(0,L.useState)(!1),[K,me]=(0,L.useState)(!0),[q,he]=(0,L.useState)(``),[J,ge]=(0,L.useState)(``),[Y,_e]=(0,L.useState)(``),X=A({initialPath:Y,onPicked:_e}),Z=(0,L.useRef)(0),Q=(0,L.useCallback)(async(e=!1)=>{let t=++Z.current;e||(w(!0),F(null));try{let e=await S({limit:100,sortBy:`updatedAt`,sortOrder:`desc`});t===Z.current&&y(ae(e.items))}catch(n){!e&&t===Z.current&&F(n instanceof Error?n.message:String(n))}finally{t===Z.current&&w(!1)}},[]);(0,L.useEffect)(()=>(Q(),()=>{Z.current++}),[Q]),(0,L.useEffect)(()=>{let e=()=>{Q(!0)};return window.addEventListener(`project-resource-changed`,e),()=>{window.removeEventListener(`project-resource-changed`,e)}},[Q]);let $=(0,L.useMemo)(()=>{let e=I.trim().toLocaleLowerCase();return h.filter(e=>H===`all`||e.status===H).filter(t=>!e||[t.name,t.description,t.brief,t.workspaceRoot].filter(Boolean).some(t=>t.toLocaleLowerCase().includes(e)))},[H,h,I]),ve=(0,L.useMemo)(()=>(0,R.jsxs)(u,{type:`button`,variant:`primary`,className:`h-9 rounded-lg`,onClick:()=>U(!0),children:[(0,R.jsx)(O,{className:`size-4`,"aria-hidden":!0}),t.create]}),[t.create]);(0,L.useLayoutEffect)(()=>(i({startExtra:null,main:(0,R.jsx)(`h1`,{className:`truncate text-base font-semibold tracking-tight text-fg`,children:n.title}),end:ve}),()=>d()),[d,ve,n.title,i]);let ye=(0,L.useCallback)(async e=>{e.preventDefault();let t=q.trim(),n=Y.trim();if(!(!t||!n||G)){pe(!0),W(null);try{let e=await D({autoUnderstand:K,name:t,...J.trim()?{description:J.trim()}:{},workspaceRoot:n});y(t=>[e,...t.filter(t=>t.id!==e.id)]),he(``),ge(``),_e(``),me(!0),U(!1),window.dispatchEvent(new CustomEvent(`project-updated`,{detail:{id:e.id}}))}catch(e){W(e instanceof Error?e.message:String(e))}finally{pe(!1)}}},[G,J,q,Y,K]),be=(0,L.useCallback)(async(e,t)=>{ue(e.id),F(null);try{let n;n=t===`pin`?e.pinnedAt?await re(e.id,e.version):await p(e.id,e.version):e.status===`archived`?await g(e.id,e.version):await N(e.id,e.version),y(e=>e.map(e=>e.id===n.id?n:e)),window.dispatchEvent(new CustomEvent(`project-updated`,{detail:{id:e.id}}))}catch(e){F(e instanceof Error?e.message:String(e))}finally{ue(null)}},[]),xe=[{id:`active`,label:t.statuses.active},{id:`paused`,label:t.statuses.paused},{id:`archived`,label:t.statuses.archived},{id:`all`,label:t.all}],Se=xe.find(e=>e.id===H)?.label??t.all,Ce=n.resultCount.replace(`{{status}}`,Se).replace(`{{count}}`,String($.length));return(0,R.jsxs)(`main`,{className:`mx-auto flex w-full max-w-7xl flex-1 flex-col gap-5 px-4 pb-7 pt-3 sm:px-6 lg:px-8 lg:pb-9 lg:pt-4`,children:[(0,R.jsx)(C,{open:de,onOpenChange:e=>{U(e),e||W(null)},children:(0,R.jsxs)(ie,{children:[(0,R.jsx)(E,{className:`xopc-dialog-overlay fixed inset-0 z-[80] bg-scrim backdrop-blur-[2px]`}),(0,R.jsxs)(_,{className:`xopc-dialog-content fixed left-1/2 top-1/2 z-[90] flex h-[min(34rem,calc(100vh-2rem))] w-[min(38rem,calc(100vw-2rem))] -translate-x-1/2 -translate-y-1/2 flex-col overflow-hidden rounded-xl border border-edge bg-surface-overlay shadow-float focus:outline-none`,children:[(0,R.jsxs)(`div`,{className:`shrink-0 border-b border-edge px-5 py-4`,children:[(0,R.jsx)(f,{className:`text-base font-semibold text-fg`,children:t.createTitle}),(0,R.jsx)(b,{className:`mt-1 text-sm text-fg-muted`,children:t.createDescription})]}),(0,R.jsxs)(`form`,{onSubmit:ye,className:`flex min-h-0 flex-1 flex-col`,children:[(0,R.jsxs)(`div`,{className:`min-h-0 flex-1 space-y-4 overflow-y-auto px-5 py-4`,children:[(0,R.jsxs)(`label`,{className:`grid gap-1.5 text-sm font-medium text-fg`,children:[t.projectName,(0,R.jsx)(`input`,{className:`h-10 rounded-lg border border-edge bg-surface-base px-3 font-normal outline-none focus:border-accent focus:ring-2 focus:ring-accent/20`,value:q,onChange:e=>he(e.target.value),maxLength:160})]}),(0,R.jsxs)(`label`,{className:`grid gap-1.5 text-sm font-medium text-fg`,children:[n.descriptionLabel,(0,R.jsx)(`textarea`,{className:`min-h-28 resize-none rounded-lg border border-edge bg-surface-base px-3 py-2 font-normal leading-6 outline-none focus:border-accent focus:ring-2 focus:ring-accent/20`,value:J,onChange:e=>ge(e.target.value),maxLength:2e3,placeholder:n.descriptionPlaceholder})]}),(0,R.jsxs)(`div`,{className:`grid gap-1.5 text-sm`,children:[(0,R.jsx)(`span`,{className:`font-medium text-fg`,children:t.workspaceRoot}),(0,R.jsxs)(`button`,{type:`button`,className:`flex min-h-12 w-full items-center gap-3 rounded-lg border border-edge bg-surface-base px-3 py-2 text-left outline-none transition-colors hover:bg-surface-hover focus-visible:border-accent focus-visible:ring-2 focus-visible:ring-accent/20 disabled:cursor-not-allowed disabled:opacity-60`,onClick:X.pick,disabled:G||X.picking,children:[X.picking?(0,R.jsx)(s,{className:`size-5 shrink-0 animate-spin text-accent`,"aria-hidden":!0}):(0,R.jsx)(T,{className:`size-5 shrink-0 text-accent`,"aria-hidden":!0}),(0,R.jsxs)(`span`,{className:`min-w-0 flex-1`,children:[(0,R.jsx)(`span`,{className:`block text-sm font-medium text-fg`,children:Y?r.chooseFolder:r.selectWorkingDirectory}),(0,R.jsx)(`span`,{className:c(`mt-0.5 block truncate font-mono text-xs font-normal`,Y?`text-fg-muted`:`text-fg-subtle`),title:Y||void 0,children:Y||t.workspaceSelectionPlaceholder})]})]}),(0,R.jsx)(`p`,{className:`text-xs font-normal text-fg-subtle`,children:t.workspaceSelectionHint})]}),(0,R.jsx)(P,{checked:K,onChange:me,disabled:G}),fe?(0,R.jsx)(`p`,{className:`rounded-lg bg-danger-soft px-3 py-2 text-xs text-danger`,role:`alert`,children:fe}):null]}),(0,R.jsxs)(`div`,{className:`flex shrink-0 justify-end gap-2 border-t border-edge px-5 py-4`,children:[(0,R.jsx)(m,{asChild:!0,children:(0,R.jsx)(u,{type:`button`,variant:`ghost`,children:t.cancel})}),(0,R.jsx)(u,{type:`submit`,variant:`primary`,disabled:G||!q.trim()||!Y.trim(),children:G?t.home.creating:t.create})]})]})]})]})}),X.hasNativePicker?null:(0,R.jsx)(M,{open:X.modalOpen,onOpenChange:X.setModalOpen,initialAbsolutePath:Y||void 0,onConfirm:X.confirmPick,wd:r}),(0,R.jsxs)(`section`,{className:`flex min-h-10 flex-wrap items-center justify-between gap-3`,"aria-label":n.filterLabel,children:[(0,R.jsx)(`p`,{className:`text-sm font-medium text-fg-muted`,"aria-live":`polite`,children:Ce}),(0,R.jsxs)(`div`,{className:c(`ml-auto flex min-w-0 items-center justify-end gap-2`,B&&`w-full sm:w-auto`),children:[B?(0,R.jsxs)(`div`,{className:`relative min-w-0 flex-1 sm:w-64 sm:flex-none`,children:[(0,R.jsx)(x,{className:`pointer-events-none absolute left-3 top-1/2 size-4 -translate-y-1/2 text-fg-subtle`,"aria-hidden":!0}),(0,R.jsx)(`input`,{autoFocus:!0,className:`h-11 w-full rounded-lg border border-edge bg-surface-panel pl-9 pr-12 text-base sm:h-9 sm:text-sm text-fg outline-none placeholder:text-fg-muted focus:border-accent`,value:I,onChange:e=>z(e.target.value),placeholder:t.searchPlaceholder,"aria-label":t.searchPlaceholder}),(0,R.jsx)(`button`,{type:`button`,className:`touch-target absolute right-0 top-1/2 flex size-6 -translate-y-1/2 items-center justify-center rounded-md text-fg-subtle transition-colors hover:bg-surface-hover hover:text-fg`,onClick:()=>{z(``),V(!1)},"aria-label":n.clearSearch,title:n.clearSearch,children:(0,R.jsx)(v,{className:`size-3.5`,"aria-hidden":!0})})]}):(0,R.jsx)(u,{type:`button`,variant:`ghost`,className:`size-9 shrink-0 p-0`,onClick:()=>V(!0),"aria-label":t.searchPlaceholder,title:t.searchPlaceholder,children:(0,R.jsx)(x,{className:`size-4`,"aria-hidden":!0})}),(0,R.jsx)(a,{className:`w-28 sm:w-32`,triggerClassName:`h-9 border-edge bg-surface-panel px-2.5 text-xs font-medium`,contentClassName:`min-w-36`,align:`end`,value:H,"aria-label":n.filterLabel,onChange:e=>ce(e.target.value),children:xe.map(e=>(0,R.jsx)(o,{value:e.id,children:e.label},e.id))})]})]}),k?(0,R.jsxs)(`div`,{className:`flex items-center justify-between gap-3 rounded-xl border border-danger/25 bg-danger-soft px-4 py-3 text-sm text-danger`,role:`alert`,children:[(0,R.jsx)(`span`,{children:k}),(0,R.jsx)(u,{type:`button`,variant:`ghost`,className:`h-8 px-2`,onClick:()=>void Q(),children:t.home.retry})]}):null,ne?(0,R.jsx)(oe,{}):$.length?(0,R.jsx)(`section`,{className:`grid gap-3 md:grid-cols-2 xl:grid-cols-3`,children:$.map(e=>(0,R.jsx)(se,{project:e,busy:le===e.id,onTogglePin:()=>void be(e,`pin`),onToggleArchive:()=>void be(e,`archive`)},e.id))}):(0,R.jsxs)(`section`,{className:`py-16 text-center`,children:[(0,R.jsx)(te,{className:`mx-auto size-7 text-fg-subtle`,"aria-hidden":!0}),(0,R.jsx)(`h2`,{className:`mt-3 text-sm font-semibold text-fg`,children:n.emptyTitle}),(0,R.jsx)(`p`,{className:`mt-1 text-sm text-fg-muted`,children:n.emptyHint})]})]})}export{H as ProjectsPage};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{a as t,n,t as r}from"./vendor-react-BOUWij0V.js";import{m as i,t as a,u as o}from"./chunk-KS7C4IRE-BvcCCgTW.js";import{t as s}from"./check-DUBLcKHA.js";import{t as c}from"./copy-Dv6d4Dvw.js";import{t as l}from"./external-link-DjqjBmc3.js";import{t as u}from"./globe-DSSGFWFn.js";import{t as d}from"./loader-circle-CifKLtgG.js";import{t as f}from"./messages-DMXSIJUO.js";import{t as p}from"./cn-0WouolD0.js";import{l as m,n as h}from"./locale-store-DAgpZxAS.js";import{t as g}from"./copy-to-clipboard-HOJ79TWv.js";import{i as _}from"./vendor-swr-BIWyz7Rc.js";import{t as v}from"./button-aIC072nz.js";import{n as y,r as b}from"./gateway-config-swr-BVqYVaGy.js";import{i as x,o as S}from"./settings-shell-dialog-layer-BU3UuiJr.js";import{At as C,Bc as w,El as T,Hi as E,Ic as D,Lc as O,Lt as k,Md as A,Nt as j,Pc as M,Pd as N,Pn as P,Pu as F,Rc as I,S as L,To as R,Yd as z,_o as B,bl as V,ca as H,f as U,jt as ee,m as te,nl as ne,p as re,pa as ie,ru as W,sl as G,vl as ae,wd as K,zc as q,zl as J}from"./index-CiDVRMmX.js";import{n as oe,r as se,t as ce}from"./settings-page-layout-Dx5S-Msc.js";import{n as Y,r as le,t as ue}from"./settings-form-section-BXeszXR7.js";import{_ as X,a as de,b as fe,c as pe,h as me,i as he,n as ge,o as _e,r as ve,s as ye,t as be,v as xe,y as Se}from"./tunnel-api-DXU94F2Y.js";import{t as Ce}from"./settings-advanced-gate-DLHGV-I-.js";var Z=e(t(),1),Q=n(),$=r();function we(e){switch(e){case`active`:return`text-emerald-700 dark:text-emerald-400`;case`connecting`:return`text-amber-700 dark:text-amber-400`;default:return`text-fg-muted`}}function Te(e){let t=(0,Q.c)(11),{label:n,kind:r}=e,i;t[0]===r?i=t[1]:(i=p(`inline-flex items-center gap-1.5 text-xs font-medium`,we(r)),t[0]=r,t[1]=i);let a=r===`active`&&`bg-emerald-500`,o=r===`connecting`&&`bg-amber-500`,s;t[2]!==a||t[3]!==o?(s=p(`size-1.5 rounded-full bg-fg-subtle/50`,a,o),t[2]=a,t[3]=o,t[4]=s):s=t[4];let c;t[5]===s?c=t[6]:(c=(0,$.jsx)(`span`,{className:s,"aria-hidden":!0}),t[5]=s,t[6]=c);let l;return t[7]!==n||t[8]!==i||t[9]!==c?(l=(0,$.jsxs)(`span`,{className:i,children:[c,n]}),t[7]=n,t[8]=i,t[9]=c,t[10]=l):l=t[10],l}function Ee(e){let t=(0,Q.c)(31),{onOpenTab:n}=e,r=h(Oe),i;t[0]===r?i=t[1]:(i=f(r),t[0]=r,t[1]=i);let a=i.remoteAccess.guide,o=!!m(De),s;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(s={refreshInterval:3e4},t[2]=s):s=t[2];let{data:c}=_(o?`exposure-status`:null,Se,s),l;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(l={refreshInterval:15e3},t[3]=l):l=t[3];let{data:d}=_(o?`tunnel-status`:null,ge,l),g=b(o);if(!o)return null;let v=c?.tailscale.active===!0,y=d?.state,x=d?.enabled&&y===`connected`,S=d?.enabled&&(y===`connecting`||y===`reconnecting`||!!d?.startProgress||!!d?.frpcDownload),C=g.data?.payload?.config,w=!!(C&&typeof C==`object`&&!Array.isArray(C)&&C.gateway?.publicUrl),E=v?`active`:`off`,D=v?a.statusActive:a.statusOff,O;t[4]!==a.tailscaleCardTitle||t[5]!==E||t[6]!==D?(O={tab:`tailscale`,icon:u,title:a.tailscaleCardTitle,kind:E,statusLabel:D},t[4]=a.tailscaleCardTitle,t[5]=E,t[6]=D,t[7]=O):O=t[7];let k=x?`active`:S?`connecting`:`off`,A=x?a.statusActive:S?a.statusConnecting:a.statusOff,j;t[8]!==a.publicCardTitle||t[9]!==k||t[10]!==A?(j={tab:`public`,icon:W,title:a.publicCardTitle,kind:k,statusLabel:A},t[8]=a.publicCardTitle,t[9]=k,t[10]=A,t[11]=j):j=t[11];let M=w?`active`:`off`,N=w?a.statusActive:a.statusOff,P;t[12]!==a.reverseProxyCardTitle||t[13]!==M||t[14]!==N?(P={tab:`reverse-proxy`,icon:V,title:a.reverseProxyCardTitle,kind:M,statusLabel:N},t[12]=a.reverseProxyCardTitle,t[13]=M,t[14]=N,t[15]=P):P=t[15];let F;t[16]!==a.sshCardStatus||t[17]!==a.sshCardTitle?(F={tab:`ssh`,icon:G,title:a.sshCardTitle,kind:`off`,statusLabel:a.sshCardStatus},t[16]=a.sshCardStatus,t[17]=a.sshCardTitle,t[18]=F):F=t[18];let I;t[19]!==a.lanCardStatus||t[20]!==a.lanCardTitle?(I={tab:`lan`,icon:T,title:a.lanCardTitle,kind:`off`,statusLabel:a.lanCardStatus},t[19]=a.lanCardStatus,t[20]=a.lanCardTitle,t[21]=I):I=t[21];let L;t[22]!==P||t[23]!==F||t[24]!==I||t[25]!==O||t[26]!==j?(L=[O,j,P,F,I],t[22]=P,t[23]=F,t[24]=I,t[25]=O,t[26]=j,t[27]=L):L=t[27];let R=L,z;return t[28]!==R||t[29]!==n?(z=(0,$.jsx)(`div`,{className:`grid gap-1 rounded-xl bg-surface-hover/20 p-1 sm:grid-cols-2 lg:grid-cols-3 xl:grid-cols-5`,children:R.map(e=>{let t=e.icon;return(0,$.jsxs)(`button`,{type:`button`,onClick:()=>n(e.tab),className:p(`flex items-start gap-3 rounded-lg bg-surface-base/45 px-2 py-3 text-left transition-colors`,`hover:bg-surface-hover/30`,`focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`),children:[(0,$.jsx)(`span`,{className:`flex size-8 shrink-0 items-center justify-center text-fg-muted`,children:(0,$.jsx)(t,{className:`size-4`,strokeWidth:1.75,"aria-hidden":!0})}),(0,$.jsxs)(`span`,{className:`min-w-0 flex-1`,children:[(0,$.jsx)(`span`,{className:`block truncate text-sm font-medium text-fg`,children:e.title}),(0,$.jsx)(Te,{label:e.statusLabel,kind:e.kind})]})]},`${e.tab}-${e.title}`)})}),t[28]=R,t[29]=n,t[30]=z):z=t[30],z}function De(e){return e.conversationId}function Oe(e){return e.language}function ke(e){let t=(0,Q.c)(21),{title:n,description:r,recommended:i,icon:a,onOpen:o,recommendedLabel:s}=e,c;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(c=p(`group flex w-full items-start gap-3 px-3 py-4 text-left transition-colors`,`hover:bg-surface-hover/30`,`focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`),t[0]=c):c=t[0];let l;t[1]===a?l=t[2]:(l=(0,$.jsx)(`span`,{className:`flex size-9 shrink-0 items-center justify-center rounded-lg bg-surface-hover/70 text-fg-muted`,children:(0,$.jsx)(a,{className:`size-4`,strokeWidth:1.75,"aria-hidden":!0})}),t[1]=a,t[2]=l);let u;t[3]===n?u=t[4]:(u=(0,$.jsx)(`h3`,{className:`text-sm font-semibold text-fg`,children:n}),t[3]=n,t[4]=u);let d;t[5]!==i||t[6]!==s?(d=i&&s?(0,$.jsx)(`span`,{className:`rounded-full bg-accent-soft px-2 py-0.5 text-[11px] font-medium text-accent-fg`,children:s}):null,t[5]=i,t[6]=s,t[7]=d):d=t[7];let f;t[8]!==u||t[9]!==d?(f=(0,$.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[u,d]}),t[8]=u,t[9]=d,t[10]=f):f=t[10];let m;t[11]===r?m=t[12]:(m=(0,$.jsx)(`p`,{className:`mt-1 text-sm leading-relaxed text-fg-muted`,children:r}),t[11]=r,t[12]=m);let h;t[13]!==f||t[14]!==m?(h=(0,$.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[f,m]}),t[13]=f,t[14]=m,t[15]=h):h=t[15];let g;t[16]===Symbol.for(`react.memo_cache_sentinel`)?(g=(0,$.jsx)(A,{className:`mt-2 size-4 shrink-0 text-fg-subtle transition-transform group-hover:translate-x-0.5 group-hover:text-fg-muted`,"aria-hidden":!0}),t[16]=g):g=t[16];let _;return t[17]!==o||t[18]!==l||t[19]!==h?(_=(0,$.jsxs)(`button`,{type:`button`,onClick:o,className:c,children:[l,h,g]}),t[17]=o,t[18]=l,t[19]=h,t[20]=_):_=t[20],_}function Ae(e){let t=(0,Q.c)(78),{onOpenTab:n}=e,r=h(Ne),i;t[0]===r?i=t[1]:(i=f(r),t[0]=r,t[1]=i);let a=i.remoteAccess,o=a.guide,s=!!m(Me),c;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(c={refreshInterval:3e4},t[2]=c):c=t[2];let{data:l}=_(s?`exposure-status`:null,Se,c),d;t[3]===l?.conflicts?d=t[4]:(d=l?.conflicts??[],t[3]=l?.conflicts,t[4]=d);let p=d;if(!s){let e;return t[5]===o.needToken?e=t[6]:(e=(0,$.jsx)(`p`,{className:`text-sm text-fg-muted`,children:o.needToken}),t[5]=o.needToken,t[6]=e),e}let g;t[7]===n?g=t[8]:(g=(0,$.jsx)(Ee,{onOpenTab:n}),t[7]=n,t[8]=g);let v;t[9]!==p||t[10]!==o.conflictsHint||t[11]!==o.conflictsTitle?(v=p.length>0?(0,$.jsxs)(`div`,{className:`rounded-xl bg-amber-500/10 px-4 py-3 text-sm text-fg-muted`,children:[(0,$.jsx)(`p`,{className:`font-medium text-fg`,children:o.conflictsTitle}),(0,$.jsx)(`p`,{className:`mt-1`,children:o.conflictsHint}),(0,$.jsx)(`ul`,{className:`mt-2 list-inside list-disc text-xs`,children:p.map(je)})]}):null,t[9]=p,t[10]=o.conflictsHint,t[11]=o.conflictsTitle,t[12]=v):v=t[12];let y;t[13]===o.pickMethod?y=t[14]:(y=(0,$.jsx)(`h2`,{className:`text-sm font-semibold text-fg`,children:o.pickMethod}),t[13]=o.pickMethod,t[14]=y);let b;t[15]===n?b=t[16]:(b=()=>n(`tailscale`),t[15]=n,t[16]=b);let x;t[17]!==o.recommended||t[18]!==o.tailscaleCardDesc||t[19]!==o.tailscaleCardTitle||t[20]!==b?(x=(0,$.jsx)(ke,{icon:u,title:o.tailscaleCardTitle,description:o.tailscaleCardDesc,recommended:!0,recommendedLabel:o.recommended,onOpen:b}),t[17]=o.recommended,t[18]=o.tailscaleCardDesc,t[19]=o.tailscaleCardTitle,t[20]=b,t[21]=x):x=t[21];let S;t[22]===n?S=t[23]:(S=()=>n(`public`),t[22]=n,t[23]=S);let C;t[24]!==o.publicCardDesc||t[25]!==o.publicCardTitle||t[26]!==S?(C=(0,$.jsx)(ke,{icon:W,title:o.publicCardTitle,description:o.publicCardDesc,onOpen:S}),t[24]=o.publicCardDesc,t[25]=o.publicCardTitle,t[26]=S,t[27]=C):C=t[27];let w;t[28]===n?w=t[29]:(w=()=>n(`reverse-proxy`),t[28]=n,t[29]=w);let E;t[30]!==o.reverseProxyCardDesc||t[31]!==o.reverseProxyCardTitle||t[32]!==w?(E=(0,$.jsx)(ke,{icon:V,title:o.reverseProxyCardTitle,description:o.reverseProxyCardDesc,onOpen:w}),t[30]=o.reverseProxyCardDesc,t[31]=o.reverseProxyCardTitle,t[32]=w,t[33]=E):E=t[33];let D;t[34]===n?D=t[35]:(D=()=>n(`ssh`),t[34]=n,t[35]=D);let O;t[36]!==o.sshCardDesc||t[37]!==o.sshCardTitle||t[38]!==D?(O=(0,$.jsx)(ke,{icon:G,title:o.sshCardTitle,description:o.sshCardDesc,onOpen:D}),t[36]=o.sshCardDesc,t[37]=o.sshCardTitle,t[38]=D,t[39]=O):O=t[39];let k;t[40]!==a.advanced.proxyBody||t[41]!==a.advanced.proxyTitle||t[42]!==E||t[43]!==O?(k=(0,$.jsxs)(L,{title:a.advanced.proxyTitle,summary:a.advanced.proxyBody,children:[E,O]}),t[40]=a.advanced.proxyBody,t[41]=a.advanced.proxyTitle,t[42]=E,t[43]=O,t[44]=k):k=t[44];let A;t[45]===n?A=t[46]:(A=()=>n(`lan`),t[45]=n,t[46]=A);let j;t[47]!==o.lanCardDesc||t[48]!==o.lanCardTitle||t[49]!==A?(j=(0,$.jsx)(ke,{icon:T,title:o.lanCardTitle,description:o.lanCardDesc,onOpen:A}),t[47]=o.lanCardDesc,t[48]=o.lanCardTitle,t[49]=A,t[50]=j):j=t[50];let M;t[51]!==C||t[52]!==k||t[53]!==j||t[54]!==x?(M=(0,$.jsxs)(`div`,{className:`mt-2 flex max-w-3xl flex-col gap-1 rounded-xl bg-surface-hover/20 p-1 [&>*]:rounded-lg [&>*]:bg-surface-base/45`,children:[x,C,k,j]}),t[51]=C,t[52]=k,t[53]=j,t[54]=x,t[55]=M):M=t[55];let N;t[56]!==M||t[57]!==y?(N=(0,$.jsxs)(`div`,{children:[y,M]}),t[56]=M,t[57]=y,t[58]=N):N=t[58];let P;t[59]===o.oneAtATimeHint?P=t[60]:(P=(0,$.jsx)(`p`,{className:`text-xs leading-relaxed text-fg-subtle`,children:o.oneAtATimeHint}),t[59]=o.oneAtATimeHint,t[60]=P);let F;t[61]===a.advanced.proxyTitle?F=t[62]:(F=(0,$.jsx)(`h3`,{className:`text-sm font-semibold text-fg`,children:a.advanced.proxyTitle}),t[61]=a.advanced.proxyTitle,t[62]=F);let I;t[63]===a.advanced.proxyBody?I=t[64]:(I=(0,$.jsx)(`p`,{className:`mt-1 text-sm text-fg-muted`,children:a.advanced.proxyBody}),t[63]=a.advanced.proxyBody,t[64]=I);let R;t[65]!==r||t[66]!==a.advanced.proxyDocs?(R=(0,$.jsx)(fe,{language:r,label:a.advanced.proxyDocs,section:`advanced`,className:`mt-2`}),t[65]=r,t[66]=a.advanced.proxyDocs,t[67]=R):R=t[67];let z;t[68]!==F||t[69]!==I||t[70]!==R?(z=(0,$.jsxs)(`div`,{className:`max-w-3xl rounded-xl bg-surface-hover/20 px-4 py-4`,children:[F,I,R]}),t[68]=F,t[69]=I,t[70]=R,t[71]=z):z=t[71];let B;return t[72]!==N||t[73]!==P||t[74]!==z||t[75]!==g||t[76]!==v?(B=(0,$.jsxs)(`div`,{className:`flex flex-col gap-6`,children:[g,v,N,P,z]}),t[72]=N,t[73]=P,t[74]=z,t[75]=g,t[76]=v,t[77]=B):B=t[77],B}function je(e){return(0,$.jsx)(`li`,{children:e.message},e.code)}function Me(e){return e.conversationId}function Ne(e){return e.language}function Pe(){let e=(0,Q.c)(16),t=h(Fe),n;e[0]===t?n=e[1]:(n=f(t),e[0]=t,e[1]=n);let r=n.remoteAccess.lan,i;e[2]!==r.subtitle||e[3]!==r.title?(i=(0,$.jsx)(Y,{icon:T,title:r.title,subtitle:r.subtitle}),e[2]=r.subtitle,e[3]=r.title,e[4]=i):i=e[4];let o;e[5]===r.body?o=e[6]:(o=(0,$.jsx)(`p`,{className:`text-sm text-fg-muted`,children:r.body}),e[5]=r.body,e[6]=o);let s;e[7]===Symbol.for(`react.memo_cache_sentinel`)?(s=(0,$.jsx)(l,{className:`size-3.5`,"aria-hidden":!0}),e[7]=s):s=e[7];let c;e[8]===r.link?c=e[9]:(c=(0,$.jsxs)(a,{to:`/settings/gateway`,className:`inline-flex items-center gap-1.5 text-sm font-medium text-accent hover:underline`,children:[r.link,s]}),e[8]=r.link,e[9]=c);let u;e[10]!==o||e[11]!==c?(u=(0,$.jsxs)(`div`,{className:`mt-4 space-y-3`,children:[o,c]}),e[10]=o,e[11]=c,e[12]=u):u=e[12];let d;return e[13]!==i||e[14]!==u?(d=(0,$.jsx)(`div`,{className:`flex flex-col gap-4`,children:(0,$.jsxs)(ue,{children:[i,u]})}),e[13]=i,e[14]=u,e[15]=d):d=e[15],d}function Fe(e){return e.language}function Ie(e){let t=(0,Q.c)(30),{embedded:n}=e,r=n===void 0?!1:n,i=h(Le),a;t[0]===i?a=t[1]:(a=f(i),t[0]=i,t[1]=a);let o=a.remoteAccess.ssh,[s,l]=(0,Z.useState)(!1),u;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(u=async()=>{await g(`xopc gateway ssh-tunnel --target user@your-host --local-port 18790 --remote-port 18790`)&&(l(!0),setTimeout(()=>l(!1),2e3))},t[2]=u):u=t[2];let d=u,p;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(p=(0,$.jsx)(`pre`,{className:`overflow-x-auto rounded-lg bg-surface-base/55 px-3 py-2 text-xs text-fg-muted`,children:`xopc gateway ssh-tunnel --target user@your-host --local-port 18790 --remote-port 18790`}),t[3]=p):p=t[3];let m,_;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(m=()=>void d(),_=(0,$.jsx)(c,{className:`mr-1 size-4`}),t[4]=m,t[5]=_):(m=t[4],_=t[5]);let y=s?o.copied:o.copy,b;t[6]===y?b=t[7]:(b=(0,$.jsx)(`div`,{className:`mt-2`,children:(0,$.jsxs)(v,{type:`button`,variant:`ghost`,onClick:m,children:[_,y]})}),t[6]=y,t[7]=b);let x;t[8]!==r||t[9]!==o.hint?(x=r?(0,$.jsx)(`p`,{className:`mt-2 text-xs text-fg-subtle`,children:o.hint}):null,t[8]=r,t[9]=o.hint,t[10]=x):x=t[10];let S;t[11]!==b||t[12]!==x?(S=(0,$.jsxs)($.Fragment,{children:[p,b,x]}),t[11]=b,t[12]=x,t[13]=S):S=t[13];let C=S;if(r){let e;t[14]!==o.subtitle||t[15]!==o.title?(e=(0,$.jsx)(Y,{icon:G,title:o.title,subtitle:o.subtitle}),t[14]=o.subtitle,t[15]=o.title,t[16]=e):e=t[16];let n;t[17]===C?n=t[18]:(n=(0,$.jsx)(`div`,{className:`mt-4 space-y-2`,children:C}),t[17]=C,t[18]=n);let r;return t[19]!==e||t[20]!==n?(r=(0,$.jsxs)(ue,{children:[e,n]}),t[19]=e,t[20]=n,t[21]=r):r=t[21],r}let w;t[22]!==o.subtitle||t[23]!==o.title?(w=(0,$.jsx)(Y,{icon:G,title:o.title,subtitle:o.subtitle}),t[22]=o.subtitle,t[23]=o.title,t[24]=w):w=t[24];let T;t[25]===C?T=t[26]:(T=(0,$.jsx)(`div`,{className:`mt-4`,children:C}),t[25]=C,t[26]=T);let E;return t[27]!==w||t[28]!==T?(E=(0,$.jsxs)(ue,{children:[w,T]}),t[27]=w,t[28]=T,t[29]=E):E=t[29],E}function Le(e){return e.language}function Re(){let e=(0,Q.c)(1),t;return e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,$.jsx)(Ie,{embedded:!0}),e[0]=t):t=e[0],t}var ze=[`guide`,`tailscale`,`public`,`reverse-proxy`,`ssh`,`lan`];function Be(e){return e&&ze.includes(e)?e:`guide`}function Ve(e){let t=(0,Q.c)(32),{showLabel:n,hideLabel:r,icon:i,hint:a,children:o,className:s,defaultOpen:c,advancedOnly:l}=e,u=l===void 0?!1:l,[d,f]=(0,Z.useState)(c??!1),m;t[0]===s?m=t[1]:(m=p(`rounded-xl bg-surface-hover/20`,s),t[0]=s,t[1]=m);let h;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(h=()=>f(He),t[2]=h):h=t[2];let g=d&&`rotate-180`,_;t[3]===g?_=t[4]:(_=p(`size-4 shrink-0 text-fg-muted transition-transform duration-200 motion-reduce:transition-none`,g),t[3]=g,t[4]=_);let v;t[5]===_?v=t[6]:(v=(0,$.jsx)(N,{className:_,"aria-hidden":!0}),t[5]=_,t[6]=v);let y;t[7]===i?y=t[8]:(y=i?(0,$.jsx)(i,{className:`size-4 shrink-0 text-accent`,strokeWidth:1.75,"aria-hidden":!0}):null,t[7]=i,t[8]=y);let b=d?r:n,x;t[9]===b?x=t[10]:(x=(0,$.jsx)(`span`,{children:b}),t[9]=b,t[10]=x);let S;t[11]!==d||t[12]!==v||t[13]!==y||t[14]!==x?(S=(0,$.jsxs)(`button`,{type:`button`,"aria-expanded":d,onClick:h,className:`flex w-full items-center gap-2 rounded-2xl px-4 py-3.5 text-left text-sm font-medium text-fg transition-colors hover:text-fg`,children:[v,y,x]}),t[11]=d,t[12]=v,t[13]=y,t[14]=x,t[15]=S):S=t[15];let C=d?`grid-rows-[1fr] opacity-100`:`grid-rows-[0fr] opacity-0`,w;t[16]===C?w=t[17]:(w=p(`grid transition-[grid-template-rows,opacity] duration-200 ease-out motion-reduce:transition-none`,C),t[16]=C,t[17]=w);let T;t[18]===a?T=t[19]:(T=a?(0,$.jsx)(`p`,{className:`text-xs text-fg-subtle`,children:a}):null,t[18]=a,t[19]=T);let E;t[20]!==o||t[21]!==T?(E=(0,$.jsx)(`div`,{className:`overflow-hidden`,children:(0,$.jsxs)(`div`,{className:`flex flex-col gap-4 px-4 pb-4 pt-1`,children:[T,o]})}),t[20]=o,t[21]=T,t[22]=E):E=t[22];let D;t[23]!==w||t[24]!==E?(D=(0,$.jsx)(`div`,{className:w,children:E}),t[23]=w,t[24]=E,t[25]=D):D=t[25];let O;t[26]!==S||t[27]!==D||t[28]!==m?(O=(0,$.jsxs)(`section`,{className:m,children:[S,D]}),t[26]=S,t[27]=D,t[28]=m,t[29]=O):O=t[29];let k=O;if(u){let e;return t[30]===k?e=t[31]:(e=(0,$.jsx)(Ce,{children:k}),t[30]=k,t[31]=e),e}return k}function He(e){return!e}function Ue(e){let t=(0,Q.c)(40),{open:n,title:r,intro:i,bullets:a,checkboxLabel:o,confirmLabel:s,cancelLabel:c,onConfirm:l,onCancel:u}=e,[d,f]=(0,Z.useState)(!1),m;t[0]===u?m=t[1]:(m=e=>{e||(f(!1),u())},t[0]=u,t[1]=m);let h;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(h=(0,$.jsx)(I,{className:p(`xopc-dialog-overlay fixed inset-0 bg-scrim backdrop-blur-[1px]`,S)}),t[2]=h):h=t[2];let g;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(g=p(`xopc-dialog-content fixed left-1/2 top-1/2 max-h-[min(90vh,40rem)] w-[min(100%-2rem,32rem)] -translate-x-1/2 -translate-y-1/2`,`overflow-y-auto rounded-2xl border border-edge bg-surface-overlay p-6 shadow-popover outline-none dark:border-edge`,x),t[3]=g):g=t[3];let _;t[4]===r?_=t[5]:(_=(0,$.jsx)(w,{className:`text-base font-semibold text-fg`,children:r}),t[4]=r,t[5]=_);let y;t[6]===i?y=t[7]:(y=(0,$.jsx)(O,{className:`mt-2 text-sm text-fg-muted`,children:i}),t[6]=i,t[7]=y);let b;t[8]===a?b=t[9]:(b=a.map(We),t[8]=a,t[9]=b);let C;t[10]===b?C=t[11]:(C=(0,$.jsx)(`ul`,{className:`mt-4 list-disc space-y-2 pl-5 text-sm text-fg-muted`,children:b}),t[10]=b,t[11]=C);let T;t[12]===Symbol.for(`react.memo_cache_sentinel`)?(T=e=>f(e.target.checked),t[12]=T):T=t[12];let E;t[13]===d?E=t[14]:(E=(0,$.jsx)(`input`,{type:`checkbox`,className:`mt-0.5 size-4 shrink-0 rounded border-edge accent-accent`,checked:d,onChange:T}),t[13]=d,t[14]=E);let k;t[15]===o?k=t[16]:(k=(0,$.jsx)(`span`,{children:o}),t[15]=o,t[16]=k);let A;t[17]!==k||t[18]!==E?(A=(0,$.jsxs)(`label`,{className:`mt-5 flex cursor-pointer items-start gap-3 text-sm text-fg`,children:[E,k]}),t[17]=k,t[18]=E,t[19]=A):A=t[19];let j;t[20]!==c||t[21]!==u?(j=(0,$.jsx)(v,{type:`button`,variant:`secondary`,onClick:u,children:c}),t[20]=c,t[21]=u,t[22]=j):j=t[22];let N=!d,P;t[23]!==s||t[24]!==l||t[25]!==N?(P=(0,$.jsx)(v,{type:`button`,disabled:N,onClick:l,children:s}),t[23]=s,t[24]=l,t[25]=N,t[26]=P):P=t[26];let F;t[27]!==j||t[28]!==P?(F=(0,$.jsxs)(`div`,{className:`mt-6 flex justify-end gap-2`,children:[j,P]}),t[27]=j,t[28]=P,t[29]=F):F=t[29];let L;t[30]!==A||t[31]!==F||t[32]!==_||t[33]!==y||t[34]!==C?(L=(0,$.jsxs)(q,{children:[h,(0,$.jsxs)(D,{className:g,onOpenAutoFocus:Ge,children:[_,y,C,A,F]})]}),t[30]=A,t[31]=F,t[32]=_,t[33]=y,t[34]=C,t[35]=L):L=t[35];let R;return t[36]!==n||t[37]!==m||t[38]!==L?(R=(0,$.jsx)(M,{open:n,onOpenChange:m,children:L}),t[36]=n,t[37]=m,t[38]=L,t[39]=R):R=t[39],R}function We(e){return(0,$.jsx)(`li`,{children:e},e)}function Ge(e){return e.preventDefault()}function Ke(e){return e<1024?`${e} B`:e<1024*1024?`${(e/1024).toFixed(1)} KB`:`${(e/(1024*1024)).toFixed(1)} MB`}var qe=[`preparing_frpc`,`registering`,`starting_frpc`];function Je(e){return e?e===`reconnecting_frpc`?qe.indexOf(`starting_frpc`):qe.indexOf(e):-1}function Ye(e,t){if(t.state===`connected`)return`done`;let n=t.startProgress?.phase,r=qe.indexOf(e),i=Je(n);return i<0?t.state===`connecting`||t.state===`reconnecting`?`active`:`pending`:r<i?`done`:r===i?`active`:`pending`}function Xe(e,t,n){let r=n.startProgress;return Ye(t,n)===`active`?t===`preparing_frpc`&&n.frpcDownload?n.frpcDownload.phase===`extracting`?e.frpcExtracting:n.frpcDownload.percent==null?e.frpcDownloading:e.frpcDownloadingPercent.replace(`{{percent}}`,String(n.frpcDownload.percent)):t===`registering`&&r?.publicUrl?e.stepRegisterDetail:t===`starting_frpc`?r?.phase===`reconnecting_frpc`?e.stepReconnectDetail:e.stepFrpcDetail:null:null}function Ze(e,t){switch(t){case`preparing_frpc`:return e.stepPrepareFrpc;case`registering`:return e.stepRegister;case`starting_frpc`:return e.stepFrpcLogin}}function Qe(e){if(!e)return null;let t=Math.max(0,Math.floor((Date.now()-new Date(e).getTime())/1e3));return t<60?`${t}s`:`${Math.floor(t/60)}m ${t%60}s`}function $e(e){let t=(0,Q.c)(31),{status:n,t:r}=e,[,i]=(0,Z.useState)(0),a;t[0]!==i||t[1]!==n.state?(a=()=>{if(n.state!==`connecting`&&n.state!==`reconnecting`)return;let e=window.setInterval(()=>i(et),1e3);return()=>window.clearInterval(e)},t[0]=i,t[1]=n.state,t[2]=a):a=t[2];let o=n.startProgress?.startedAt,c;if(t[3]!==n.state||t[4]!==o?(c=[n.state,o],t[3]=n.state,t[4]=o,t[5]=c):c=t[5],(0,Z.useEffect)(a,c),!(n.state===`connecting`||n.state===`reconnecting`||n.state===`connected`&&n.startProgress))return null;let l,u,f,m,h;if(t[6]!==n||t[7]!==r){let e=Qe(n.startProgress?.startedAt);l=!!n.publicUrl&&n.state!==`connected`&&n.startProgress?.phase!==`registering`,u=`mt-3 space-y-3 rounded-lg bg-surface-panel/80 p-3 shadow-surface`;let i;t[13]===r.startProgressTitle?i=t[14]:(i=(0,$.jsx)(`p`,{className:`text-xs font-medium text-fg`,children:r.startProgressTitle}),t[13]=r.startProgressTitle,t[14]=i);let a;t[15]===r.startProgressHint?a=t[16]:(a=(0,$.jsx)(`p`,{className:`mt-1 text-xs text-fg-muted`,children:r.startProgressHint}),t[15]=r.startProgressHint,t[16]=a),t[17]!==i||t[18]!==a?(f=(0,$.jsxs)(`div`,{children:[i,a]}),t[17]=i,t[18]=a,t[19]=f):f=t[19];let o=qe.map(e=>{let t=Ye(e,n),i=Xe(r,e,n);return(0,$.jsxs)(`li`,{className:`flex gap-2 text-xs`,children:[(0,$.jsx)(`span`,{className:`mt-0.5 shrink-0 text-fg-subtle`,"aria-hidden":!0,children:t===`done`?(0,$.jsx)(s,{className:`size-3.5 text-emerald-600 dark:text-emerald-400`}):t===`active`?(0,$.jsx)(d,{className:`size-3.5 animate-spin text-accent`}):(0,$.jsx)(K,{className:`size-3.5`})}),(0,$.jsxs)(`div`,{className:`min-w-0`,children:[(0,$.jsx)(`div`,{className:p(`font-medium`,t===`active`?`text-fg`:t===`done`?`text-fg-muted`:`text-fg-subtle`),children:Ze(r,e)}),i?(0,$.jsx)(`div`,{className:`mt-0.5 text-fg-muted`,children:i}):null,e===`preparing_frpc`&&t===`active`&&n.frpcDownload&&n.frpcDownload.phase===`downloading`?(0,$.jsxs)(`div`,{className:`mt-2 space-y-1`,children:[(0,$.jsx)(`div`,{className:`h-1.5 w-full overflow-hidden rounded-full bg-surface-panel`,children:(0,$.jsx)(`div`,{className:p(`h-full rounded-full bg-accent transition-[width] duration-300`,n.frpcDownload.percent==null&&`w-1/3 animate-pulse`),style:n.frpcDownload.percent==null?void 0:{width:`${n.frpcDownload.percent}%`}})}),n.frpcDownload.bytesReceived!=null&&n.frpcDownload.totalBytes?(0,$.jsxs)(`p`,{className:`text-fg-subtle`,children:[Ke(n.frpcDownload.bytesReceived),` /`,` `,Ke(n.frpcDownload.totalBytes)]}):null]}):null,e===`preparing_frpc`&&t===`active`&&n.frpcDownload?.url?(0,$.jsxs)(`p`,{className:`mt-2 text-fg-subtle`,children:[(0,$.jsxs)(`span`,{className:`font-sans`,children:[r.frpcDownloadingUrlLabel,`: `]}),(0,$.jsx)(`a`,{href:n.frpcDownload.url,target:`_blank`,rel:`noopener noreferrer`,className:`break-all font-mono text-[11px] text-accent hover:underline`,children:n.frpcDownload.url})]}):null]})]},e)});t[20]===o?m=t[21]:(m=(0,$.jsx)(`ol`,{className:`space-y-2`,children:o}),t[20]=o,t[21]=m),h=e&&n.startProgress?(0,$.jsx)(`p`,{className:`text-xs text-fg-subtle`,children:r.startProgressElapsed.replace(`{{elapsed}}`,e)}):null,t[6]=n,t[7]=r,t[8]=l,t[9]=u,t[10]=f,t[11]=m,t[12]=h}else l=t[8],u=t[9],f=t[10],m=t[11],h=t[12];let g;t[22]!==l||t[23]!==r.publicUrlPendingNotice?(g=l?(0,$.jsx)(`p`,{className:`text-xs text-fg-muted`,children:r.publicUrlPendingNotice}):null,t[22]=l,t[23]=r.publicUrlPendingNotice,t[24]=g):g=t[24];let _;return t[25]!==u||t[26]!==f||t[27]!==m||t[28]!==h||t[29]!==g?(_=(0,$.jsxs)(`div`,{className:u,children:[f,m,h,g]}),t[25]=u,t[26]=f,t[27]=m,t[28]=h,t[29]=g,t[30]=_):_=t[30],_}function et(e){return e+1}function tt(e,t){return t.state===`connected`?e.statusConnected:t.state===`error`?e.statusError:t.startProgress?.phase===`reconnecting_frpc`?e.statusReconnecting:t.startProgress?.phase===`starting_frpc`?e.statusStartingFrpc:t.startProgress?.phase===`registering`?e.statusRegistering:t.startProgress?.phase===`preparing_frpc`||t.frpcDownload?e.statusPreparingFrpc:t.state===`connecting`||t.state===`reconnecting`?e.statusConnecting:e.statusOff}function nt(e){return e.state===`connected`?`connected`:e.state===`error`?`error`:e.state===`connecting`||e.state===`reconnecting`||e.startProgress||e.frpcDownload?`progress`:`off`}function rt(e){switch(e){case`connected`:return`bg-emerald-500/15 text-emerald-700 dark:text-emerald-400`;case`progress`:return`bg-amber-500/15 text-amber-700 dark:text-amber-400`;case`error`:return`bg-red-500/15 text-red-700 dark:text-red-400`;default:return`bg-surface-hover text-fg-muted`}}function it(e){if(!e)return`—`;let t=Date.now()-new Date(e).getTime();if(t<0)return`—`;let n=Math.floor(t/6e4);return n<60?`${n}m`:`${Math.floor(n/60)}h ${n%60}m`}function at(e){let t=(0,Q.c)(61),{t:n,status:r,isLoading:i,statusErr:a,starting:o,stopping:s,showConsentExpired:c,copyLabels:l,startDisabled:f,startDisabledReason:m,stepLabel:h,onStart:g,onStop:_}=e,y=f===void 0?!1:f,b,x,S,C,w,T,D;t[0]!==r||t[1]!==o?(D=nt(r),b=r.enabled||o,x=o||r.state===`connecting`||r.state===`reconnecting`||!!r.startProgress||!!r.frpcDownload,t[9]===Symbol.for(`react.memo_cache_sentinel`)?(T=p(le(),`space-y-4`),t[9]=T):T=t[9],w=`flex flex-wrap items-start justify-between gap-3`,C=`flex items-center gap-2`,S=p(`inline-flex items-center gap-1.5 rounded-full px-2.5 py-1 text-xs font-medium`,rt(D)),t[0]=r,t[1]=o,t[2]=b,t[3]=x,t[4]=S,t[5]=C,t[6]=w,t[7]=T,t[8]=D):(b=t[2],x=t[3],S=t[4],C=t[5],w=t[6],T=t[7],D=t[8]);let O=D===`connected`&&`bg-emerald-500`,k=D===`progress`&&`bg-amber-500 animate-pulse`,A=D===`error`&&`bg-red-500`,j=D===`off`&&`bg-fg-subtle`,M;t[10]!==O||t[11]!==k||t[12]!==A||t[13]!==j?(M=p(`size-1.5 rounded-full`,O,k,A,j),t[10]=O,t[11]=k,t[12]=A,t[13]=j,t[14]=M):M=t[14];let N;t[15]===M?N=t[16]:(N=(0,$.jsx)(`span`,{className:M,"aria-hidden":!0}),t[15]=M,t[16]=N);let P;t[17]!==i||t[18]!==r||t[19]!==n?(P=i&&!r.enabled?(0,$.jsx)(`span`,{"aria-hidden":`true`,className:`inline-block h-3 w-16 animate-pulse rounded-full bg-surface-hover/70 motion-reduce:animate-none`}):tt(n,r),t[17]=i,t[18]=r,t[19]=n,t[20]=P):P=t[20];let F;t[21]!==N||t[22]!==P||t[23]!==S?(F=(0,$.jsxs)(`span`,{className:S,children:[N,P]}),t[21]=N,t[22]=P,t[23]=S,t[24]=F):F=t[24];let I;t[25]!==r.connectedSince||t[26]!==r.state||t[27]!==n.uptime?(I=r.connectedSince&&r.state===`connected`?(0,$.jsxs)(`span`,{className:`text-xs text-fg-subtle`,children:[n.uptime,` `,it(r.connectedSince)]}):null,t[25]=r.connectedSince,t[26]=r.state,t[27]=n.uptime,t[28]=I):I=t[28];let L;t[29]!==F||t[30]!==I||t[31]!==C?(L=(0,$.jsxs)(`div`,{className:C,children:[F,I]}),t[29]=F,t[30]=I,t[31]=C,t[32]=L):L=t[32];let R;t[33]===Symbol.for(`react.memo_cache_sentinel`)?(R=(0,$.jsx)(u,{className:`size-4 text-fg-subtle`,strokeWidth:1.75,"aria-hidden":!0}),t[33]=R):R=t[33];let z;t[34]!==L||t[35]!==w?(z=(0,$.jsxs)(`div`,{className:w,children:[L,R]}),t[34]=L,t[35]=w,t[36]=z):z=t[36];let B;t[37]===a?B=t[38]:(B=a?(0,$.jsx)(`p`,{className:`text-sm text-red-600 dark:text-red-400`,children:a instanceof Error?a.message:String(a)}):null,t[37]=a,t[38]=B);let V;t[39]!==c||t[40]!==n.consentExpiredBanner?(V=c?(0,$.jsx)(`p`,{className:`rounded-lg bg-amber-500/10 px-3 py-2 text-xs text-fg-muted`,children:n.consentExpiredBanner}):null,t[39]=c,t[40]=n.consentExpiredBanner,t[41]=V):V=t[41];let H;t[42]!==b||t[43]!==l||t[44]!==g||t[45]!==_||t[46]!==x||t[47]!==r||t[48]!==y||t[49]!==m||t[50]!==o||t[51]!==h||t[52]!==s||t[53]!==n?(H=b?(0,$.jsxs)(`div`,{className:`space-y-4`,children:[r.publicUrl?(0,$.jsx)(`div`,{className:`rounded-xl bg-surface-panel/80 p-3 shadow-surface`,children:(0,$.jsx)(E,{label:n.publicUrlLabel,text:r.publicUrl,labels:l})}):null,x?(0,$.jsx)($e,{status:r,t:n}):null,r.lastError&&r.state===`error`?(0,$.jsx)(`p`,{className:`text-sm text-red-600 dark:text-red-400`,children:r.lastError}):null,(0,$.jsx)(`div`,{className:`flex flex-wrap gap-2`,children:r.enabled?(0,$.jsxs)(v,{type:`button`,variant:`secondary`,disabled:s,onClick:_,children:[s?(0,$.jsx)(d,{className:`size-4 animate-spin`}):null,n.stop]}):(0,$.jsxs)(v,{type:`button`,disabled:o,onClick:g,children:[o?(0,$.jsx)(d,{className:`size-4 animate-spin`}):(0,$.jsx)(J,{className:`size-4`}),n.start]})})]}):(0,$.jsxs)(`div`,{className:`space-y-4`,children:[h?(0,$.jsx)(`p`,{className:`text-xs font-medium uppercase tracking-wide text-fg-subtle`,children:h}):null,(0,$.jsxs)(`div`,{children:[(0,$.jsx)(`h2`,{className:`text-base font-semibold text-fg`,children:n.emptyStateTitle}),(0,$.jsx)(`p`,{className:`mt-1 text-sm leading-relaxed text-fg-muted`,children:n.emptyStateBody})]}),(0,$.jsxs)(`div`,{className:`flex items-start gap-2 rounded-lg bg-amber-500/10 px-3 py-2.5 text-xs text-fg-muted`,children:[(0,$.jsx)(ne,{className:`mt-0.5 size-4 shrink-0 text-amber-600 dark:text-amber-400`}),(0,$.jsx)(`p`,{children:n.riskBannerBody})]}),y&&m?(0,$.jsx)(`p`,{className:`text-sm text-amber-800 dark:text-amber-200`,children:m}):null,(0,$.jsxs)(v,{type:`button`,disabled:o||y,onClick:g,className:`w-full sm:w-auto`,children:[o?(0,$.jsx)(d,{className:`size-4 animate-spin`}):(0,$.jsx)(J,{className:`size-4`}),n.start]})]}),t[42]=b,t[43]=l,t[44]=g,t[45]=_,t[46]=x,t[47]=r,t[48]=y,t[49]=m,t[50]=o,t[51]=h,t[52]=s,t[53]=n,t[54]=H):H=t[54];let U;return t[55]!==z||t[56]!==B||t[57]!==V||t[58]!==H||t[59]!==T?(U=(0,$.jsxs)(`section`,{className:T,children:[z,B,V,H]}),t[55]=z,t[56]=B,t[57]=V,t[58]=H,t[59]=T,t[60]=U):U=t[60],U}var ot={reconfiguring:!1};function st(e){let t=(0,Q.c)(89),{t:n,brokerSecretReady:r,brokerSecretConfiguredInConfig:i,brokerSecretMaskedValue:a,brokerSecretDraft:o,savingBrokerSecret:c,authorizingBrokerSecret:u,brokerSecretAuthorizationUrl:f,brokerSecretNotice:m,copyFailedLabel:h,onDraftChange:g,onSave:_,onAuthorize:y,onClear:b,sectionRef:x}=e,S=(0,Z.useId)(),C=r,w=!C,[T,E]=(0,Z.useReducer)(ie,ot),{reconfiguring:D}=T,O;t[0]!==i||t[1]!==o||t[2]!==D?(O=i&&!D&&!o.trim(),t[0]=i,t[1]=o,t[2]=D,t[3]=O):O=t[3];let A=O,j;t[4]!==n.copied||t[5]!==n.copyKey||t[6]!==n.hideKey||t[7]!==n.showKey?(j={show:n.showKey,hide:n.hideKey,copy:n.copyKey,copied:n.copied},t[4]=n.copied,t[5]=n.copyKey,t[6]=n.hideKey,t[7]=n.showKey,t[8]=j):j=t[8];let M=j,N;t[9]===o?N=t[10]:(N=o.trim().length>0&&!k(o.trim()),t[9]=o,t[10]=N);let P=N,I;t[11]===g?I=t[12]:(I=()=>{E({type:`patch`,patch:{reconfiguring:!1}}),g(``)},t[11]=g,t[12]=I);let L=I,z=w&&`ring-1 ring-amber-500/30`,B;t[13]===z?B=t[14]:(B=p(z),t[13]=z,t[14]=B);let V=C?`bg-emerald-500/10 text-emerald-600 dark:text-emerald-400`:w?`bg-amber-500/10 text-amber-700 dark:text-amber-400`:`bg-surface-hover text-fg-muted`,H;t[15]===V?H=t[16]:(H=p(`flex size-9 shrink-0 items-center justify-center rounded-lg`,V),t[15]=V,t[16]=H);let U;t[17]===C?U=t[18]:(U=C?(0,$.jsx)(s,{className:`size-4`,strokeWidth:2,"aria-hidden":!0}):(0,$.jsx)(F,{className:`size-4`,strokeWidth:1.75,"aria-hidden":!0}),t[17]=C,t[18]=U);let ee;t[19]!==H||t[20]!==U?(ee=(0,$.jsx)(`span`,{className:H,children:U}),t[19]=H,t[20]=U,t[21]=ee):ee=t[21];let te=C?n.brokerSecretReadyTitle:n.brokerSecretStepTitle,ne;t[22]===te?ne=t[23]:(ne=(0,$.jsx)(`p`,{className:`text-sm font-semibold text-fg`,children:te}),t[22]=te,t[23]=ne);let re=C?n.brokerSecretReadyHint:n.brokerSecretHint,W;t[24]===re?W=t[25]:(W=(0,$.jsx)(`p`,{className:`mt-1 text-sm leading-relaxed text-fg-muted`,children:re}),t[24]=re,t[25]=W);let G;t[26]!==w||t[27]!==n.brokerSecretMissingHint?(G=w?(0,$.jsx)(`p`,{className:`mt-2 text-xs text-amber-800 dark:text-amber-200`,children:n.brokerSecretMissingHint}):null,t[26]=w,t[27]=n.brokerSecretMissingHint,t[28]=G):G=t[28];let ae;t[29]!==ne||t[30]!==W||t[31]!==G?(ae=(0,$.jsxs)(`div`,{children:[ne,W,G]}),t[29]=ne,t[30]=W,t[31]=G,t[32]=ae):ae=t[32];let K;t[33]!==u||t[34]!==w||t[35]!==y||t[36]!==D||t[37]!==c||t[38]!==n.brokerSecretAuthorize||t[39]!==n.brokerSecretAuthorizing||t[40]!==n.brokerSecretConsoleLink?(K=w||D?(0,$.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,$.jsxs)(v,{type:`button`,disabled:c||u,onClick:y,children:[u?(0,$.jsx)(d,{className:`size-4 animate-spin`}):null,u?n.brokerSecretAuthorizing:n.brokerSecretAuthorize]}),(0,$.jsxs)(`a`,{href:be,target:`_blank`,rel:`noopener noreferrer`,className:`inline-flex w-fit items-center gap-1 text-xs font-medium text-accent-fg hover:underline focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,children:[n.brokerSecretConsoleLink,(0,$.jsx)(l,{className:`size-3`,"aria-hidden":!0})]})]}):null,t[33]=u,t[34]=w,t[35]=y,t[36]=D,t[37]=c,t[38]=n.brokerSecretAuthorize,t[39]=n.brokerSecretAuthorizing,t[40]=n.brokerSecretConsoleLink,t[41]=K):K=t[41];let q;t[42]!==u||t[43]!==f||t[44]!==n.brokerSecretOpenAuthorization?(q=u&&f?(0,$.jsxs)(`a`,{href:f,target:`_blank`,rel:`noopener noreferrer`,className:`inline-flex w-fit items-center gap-1 text-xs font-medium text-accent-fg hover:underline`,children:[n.brokerSecretOpenAuthorization,(0,$.jsx)(l,{className:`size-3`,"aria-hidden":!0})]}):null,t[42]=u,t[43]=f,t[44]=n.brokerSecretOpenAuthorization,t[45]=q):q=t[45];let J;t[46]!==i||t[47]!==o||t[48]!==a||t[49]!==P||t[50]!==L||t[51]!==h||t[52]!==S||t[53]!==w||t[54]!==b||t[55]!==g||t[56]!==_||t[57]!==D||t[58]!==c||t[59]!==M||t[60]!==A||t[61]!==n.brokerSecretCancelReconfigure||t[62]!==n.brokerSecretClear||t[63]!==n.brokerSecretMaskedHelp||t[64]!==n.brokerSecretNotInConfigFile||t[65]!==n.brokerSecretPlaceholder||t[66]!==n.brokerSecretReconfigure||t[67]!==n.brokerSecretRevealFailed||t[68]!==n.brokerSecretSave||t[69]!==n.brokerSecretSaveAndContinue||t[70]!==n.brokerSecretTitle?(J=A?(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(`label`,{className:`sr-only`,htmlFor:S,children:n.brokerSecretTitle}),(0,$.jsx)(R,{id:S,value:a,labels:M,reveal:ct,loadFailedLabel:h||n.brokerSecretRevealFailed,maskedHelp:n.brokerSecretMaskedHelp,notInConfigFile:n.brokerSecretNotInConfigFile,readOnly:!0}),(0,$.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[(0,$.jsx)(v,{type:`button`,variant:`secondary`,disabled:c,onClick:()=>{E({type:`patch`,patch:{reconfiguring:!0}})},children:n.brokerSecretReconfigure}),(0,$.jsx)(v,{type:`button`,variant:`ghost`,disabled:c,onClick:b,children:n.brokerSecretClear})]})]}):(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(`label`,{className:`sr-only`,htmlFor:S,children:n.brokerSecretTitle}),(0,$.jsx)(R,{id:S,value:o,onChange:g,placeholder:n.brokerSecretPlaceholder,labels:M,disabled:c}),(0,$.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[(0,$.jsxs)(v,{type:`button`,disabled:c||!P,onClick:_,children:[c?(0,$.jsx)(d,{className:`size-4 animate-spin`}):null,w?n.brokerSecretSaveAndContinue:n.brokerSecretSave]}),i?(0,$.jsx)(v,{type:`button`,variant:`ghost`,disabled:c,onClick:b,children:n.brokerSecretClear}):null,D?(0,$.jsx)(v,{type:`button`,variant:`ghost`,disabled:c,onClick:L,children:n.brokerSecretCancelReconfigure}):null]})]}),t[46]=i,t[47]=o,t[48]=a,t[49]=P,t[50]=L,t[51]=h,t[52]=S,t[53]=w,t[54]=b,t[55]=g,t[56]=_,t[57]=D,t[58]=c,t[59]=M,t[60]=A,t[61]=n.brokerSecretCancelReconfigure,t[62]=n.brokerSecretClear,t[63]=n.brokerSecretMaskedHelp,t[64]=n.brokerSecretNotInConfigFile,t[65]=n.brokerSecretPlaceholder,t[66]=n.brokerSecretReconfigure,t[67]=n.brokerSecretRevealFailed,t[68]=n.brokerSecretSave,t[69]=n.brokerSecretSaveAndContinue,t[70]=n.brokerSecretTitle,t[71]=J):J=t[71];let oe;t[72]===m?oe=t[73]:(oe=m?(0,$.jsx)(`p`,{className:`text-xs text-emerald-700 dark:text-emerald-400`,children:m}):null,t[72]=m,t[73]=oe);let se;t[74]!==ae||t[75]!==K||t[76]!==q||t[77]!==J||t[78]!==oe?(se=(0,$.jsxs)(`div`,{className:`min-w-0 flex-1 space-y-3`,children:[ae,K,q,J,oe]}),t[74]=ae,t[75]=K,t[76]=q,t[77]=J,t[78]=oe,t[79]=se):se=t[79];let ce;t[80]!==ee||t[81]!==se?(ce=(0,$.jsxs)(`div`,{className:`flex items-start gap-3`,children:[ee,se]}),t[80]=ee,t[81]=se,t[82]=ce):ce=t[82];let Y;t[83]!==ce||t[84]!==B?(Y=(0,$.jsx)(ue,{className:B,children:ce}),t[83]=ce,t[84]=B,t[85]=Y):Y=t[85];let le;return t[86]!==x||t[87]!==Y?(le=(0,$.jsx)(`div`,{ref:x,id:`tunnel-broker-secret-setup`,children:Y}),t[86]=x,t[87]=Y,t[88]=le):le=t[88],le}function ct(){return _e().then(lt)}function lt(e){return e.registrationSecret??null}var ut={actionError:null,starting:!1,stopping:!1,savingAutoStart:!1,consentOpen:!1,autoStartConfirmOpen:!1,releaseConfirmOpen:!1,releasing:!1,brokerSecretDraft:``,savingBrokerSecret:!1,authorizingBrokerSecret:!1,brokerSecretAuthorizationUrl:null,brokerSecretNotice:null};function dt({embedded:e=!1}){let t=h(e=>e.language),n=f(t).tunnelSettings,r=!!m(e=>e.conversationId),[i,a]=(0,Z.useReducer)(ie,ut),{actionError:o,starting:s,stopping:c,savingAutoStart:l,consentOpen:g,autoStartConfirmOpen:x,releaseConfirmOpen:S,releasing:w,brokerSecretDraft:T,savingBrokerSecret:E,authorizingBrokerSecret:D,brokerSecretAuthorizationUrl:O,brokerSecretNotice:A}=i,M=(0,Z.useRef)(null),{data:N}=b(r),{data:P,error:F,isLoading:I,mutate:L}=_(r?`tunnel-status`:null,ge,{refreshInterval:e=>s?1e3:e?.frpcDownload||e?.state===`connecting`||e?.state===`reconnecting`?2e3:6e4}),R=(0,Z.useMemo)(()=>{let e=N?.payload?.config;if(e&&typeof e==`object`&&!Array.isArray(e)){let t=e.tunnel;if(t&&typeof t==`object`&&!Array.isArray(t)&&t.autoStart===!0)return!0}return P?.config?.autoStart===!0},[N,P?.config?.autoStart]),z=(0,Z.useMemo)(()=>{let e=N?.payload?.config;if(e&&typeof e==`object`&&!Array.isArray(e)){let t=e.tunnel;if(t&&typeof t==`object`&&!Array.isArray(t)){let e=t.registrationSecret;if(typeof e==`string`)return e}}return``},[N]),B=k(z),V=P?.registrationSecret?.configured??B;(0,Z.useEffect)(()=>{let e=()=>{L()};return window.addEventListener(`tunnel-status`,e),()=>window.removeEventListener(`tunnel-status`,e)},[L]);let ne=(0,Z.useMemo)(()=>[n.consentBullet1,n.consentBullet2,n.consentBullet3],[n.consentBullet1,n.consentBullet2,n.consentBullet3]),W=(0,Z.useCallback)(async()=>{a({type:`patch`,patch:{actionError:null}}),a({type:`patch`,patch:{starting:!0}});try{await ye(),await L(),y()}catch(e){a({type:`patch`,patch:{actionError:e instanceof Error?e.message:String(e)}})}finally{a({type:`patch`,patch:{starting:!1}})}},[L]),G=(0,Z.useCallback)(()=>{if(!V){a({type:`patch`,patch:{actionError:n.brokerSecretRequiredBeforeStart}}),M.current?.scrollIntoView({behavior:`smooth`,block:`start`});return}if(P?.consentRequired){a({type:`patch`,patch:{consentOpen:!0}});return}W()},[V,P?.consentRequired,W,n.brokerSecretRequiredBeforeStart]),ae=(0,Z.useCallback)(async()=>{a({type:`patch`,patch:{consentOpen:!1}}),a({type:`patch`,patch:{actionError:null}});try{await de(),await Promise.all([L(),W()])}catch(e){a({type:`patch`,patch:{actionError:e instanceof Error?e.message:String(e)}})}},[L,W]),K=(0,Z.useCallback)(async()=>{a({type:`patch`,patch:{actionError:null}}),a({type:`patch`,patch:{stopping:!0}});try{await pe(),await L(),y()}catch(e){a({type:`patch`,patch:{actionError:e instanceof Error?e.message:String(e)}})}finally{a({type:`patch`,patch:{stopping:!1}})}},[L]),q=(0,Z.useCallback)(async e=>{a({type:`patch`,patch:{savingAutoStart:!0}}),a({type:`patch`,patch:{actionError:null}});try{await ve({autoStart:e}),y()}catch(e){a({type:`patch`,patch:{actionError:e instanceof Error?e.message:String(e)}})}finally{a({type:`patch`,patch:{savingAutoStart:!1}})}},[]),J=(0,Z.useCallback)(()=>{if(R){q(!1);return}if(P?.consentRequired){a({type:`patch`,patch:{actionError:n.consentExpiredBanner}});return}if(!P?.canAutoStart){a({type:`patch`,patch:{actionError:n.autoStartHint}});return}a({type:`patch`,patch:{autoStartConfirmOpen:!0}})},[q,P?.canAutoStart,P?.consentRequired,n,R]),oe=(0,Z.useCallback)(async()=>{let e=T.trim();if(e){a({type:`patch`,patch:{savingBrokerSecret:!0,actionError:null,brokerSecretNotice:null}});try{await ve({registrationSecret:e}),a({type:`patch`,patch:{brokerSecretDraft:``,brokerSecretNotice:n.brokerSecretSaved}}),y(),await L(),a({type:`patch`,patch:{actionError:null}})}catch(e){a({type:`patch`,patch:{actionError:e instanceof Error?e.message:String(e)}})}finally{a({type:`patch`,patch:{savingBrokerSecret:!1}})}}},[T,L,n.brokerSecretSaved]),se=(0,Z.useCallback)(async()=>{a({type:`patch`,patch:{savingBrokerSecret:!0,actionError:null,brokerSecretNotice:null}});try{await ve({registrationSecret:null}),a({type:`patch`,patch:{brokerSecretDraft:``,brokerSecretNotice:n.brokerSecretCleared}}),y(),await L()}catch(e){a({type:`patch`,patch:{actionError:e instanceof Error?e.message:String(e)}})}finally{a({type:`patch`,patch:{savingBrokerSecret:!1}})}},[L,n.brokerSecretCleared]),ce=(0,Z.useCallback)(async()=>{let e=te(),t=null,r=null;a({type:`patch`,patch:{authorizingBrokerSecret:!0,brokerSecretAuthorizationUrl:null,brokerSecretNotice:null,actionError:null}});try{for(t=(await j(`xopc-tunnel`)).sessionId;;){await new Promise(e=>window.setTimeout(e,1e3));let i=await ee(t);if(i.authUrl&&i.authUrl!==r&&(r=i.authUrl,a({type:`patch`,patch:{brokerSecretAuthorizationUrl:i.authUrl}}),await re(i.authUrl,e)),i.status===`failed`||i.status===`cancelled`)throw Error(i.error??i.message??`OAuth authorization failed`);if(i.status===`completed`){await he(),await Promise.all([L(),y()]),a({type:`patch`,patch:{brokerSecretNotice:n.brokerSecretSaved,brokerSecretDraft:``}});return}}}catch(e){a({type:`patch`,patch:{actionError:e instanceof Error?e.message:String(e)}})}finally{U(e),t&&C(t).catch(()=>void 0),a({type:`patch`,patch:{authorizingBrokerSecret:!1,brokerSecretAuthorizationUrl:null}})}},[L,n.brokerSecretSaved]),Y=(0,Z.useCallback)(async()=>{a({type:`patch`,patch:{releaseConfirmOpen:!1,actionError:null,releasing:!0}});try{await pe({release:!0}),await L(),y()}catch(e){a({type:`patch`,patch:{actionError:e instanceof Error?e.message:String(e)}})}finally{a({type:`patch`,patch:{releasing:!1}})}},[L]),le=(0,Z.useMemo)(()=>({copy:n.copyUrl,copied:n.copied,copyFailed:f(t).clipboard.copyFailed}),[t,n.copyUrl,n.copied]);if(!r)return(0,$.jsx)(`div`,{className:e?void 0:`w-full px-3 py-8 sm:px-5 xl:px-6`,children:(0,$.jsx)(`p`,{className:`text-sm text-fg-muted`,children:n.needToken})});let X=P??{enabled:!1,state:`disconnected`,subdomain:null,publicUrl:null,connectedSince:null,frpcPid:null,lastHeartbeatAt:null,lastError:null,consentRequired:!0,config:{autoStart:R,brokerUrl:`https://frp.xopc.ai/api`}},me=P?.consentRequired&&(X.enabled||R||P?.consent?.acceptedAt),_e=(0,$.jsx)(st,{t:n,brokerSecretReady:V,brokerSecretConfiguredInConfig:B,brokerSecretMaskedValue:B?z:``,brokerSecretDraft:T,savingBrokerSecret:E,authorizingBrokerSecret:D,brokerSecretAuthorizationUrl:O,brokerSecretNotice:A,copyFailedLabel:f(t).clipboard.copyFailed,onDraftChange:e=>a({type:`patch`,patch:{brokerSecretDraft:e}}),onSave:()=>void oe(),onAuthorize:()=>void ce(),onClear:()=>void se(),sectionRef:M}),be=(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(Ue,{open:g,title:n.consentTitle,intro:n.consentIntro,bullets:ne,checkboxLabel:n.consentCheckbox,confirmLabel:me?n.consentReconfirm:n.consentConfirm,cancelLabel:n.consentCancel,onConfirm:()=>void ae(),onCancel:()=>a({type:`patch`,patch:{consentOpen:!1}})},g?`consent-open`:`consent-closed`),(0,$.jsx)(H,{open:x,title:n.autoStartConfirmTitle,description:n.autoStartConfirmBody,confirmLabel:n.autoStartConfirmLabel,cancelLabel:n.consentCancel,onConfirm:()=>{a({type:`patch`,patch:{autoStartConfirmOpen:!1}}),q(!0)},onCancel:()=>a({type:`patch`,patch:{autoStartConfirmOpen:!1}})}),(0,$.jsx)(H,{open:S,title:n.releaseConfirmTitle,description:n.releaseConfirmBody,confirmLabel:n.releaseConfirmLabel,cancelLabel:n.consentCancel,destructive:!0,onConfirm:()=>void Y(),onCancel:()=>a({type:`patch`,patch:{releaseConfirmOpen:!1}})})]});return e?(0,$.jsxs)(`div`,{className:`flex w-full flex-col gap-4`,children:[o?(0,$.jsx)(`p`,{className:`text-sm text-red-600 dark:text-red-400`,children:o}):null,_e,(0,$.jsx)(at,{t:n,status:X,isLoading:I,statusErr:F,starting:s,stopping:c,showConsentExpired:!!me,copyLabels:le,startDisabled:!V,startDisabledReason:V?void 0:n.brokerSecretRequiredBeforeStart,stepLabel:n.flowStepStart,onStart:G,onStop:()=>void K()}),(0,$.jsxs)(Ve,{showLabel:n.showOptions,hideLabel:n.hideOptions,children:[(0,$.jsxs)(`label`,{className:p(`flex items-center gap-3 text-sm text-fg`,!R&&!P?.canAutoStart?`cursor-not-allowed opacity-60`:`cursor-pointer`),children:[(0,$.jsx)(`input`,{type:`checkbox`,className:`size-4 rounded border-edge accent-accent`,checked:R,disabled:l||!R&&!P?.canAutoStart,onChange:J}),n.autoStart]}),!P?.canAutoStart&&!R?(0,$.jsx)(`p`,{className:`text-xs text-fg-subtle`,children:n.autoStartHint}):null,X.subdomain||X.publicUrl?(0,$.jsxs)(`div`,{className:`space-y-2 rounded-xl bg-surface-base/45 p-4`,children:[(0,$.jsxs)(v,{type:`button`,variant:`secondary`,disabled:w||c,className:`border-danger/40 text-danger hover:bg-danger/10`,onClick:()=>a({type:`patch`,patch:{releaseConfirmOpen:!0}}),children:[w?(0,$.jsx)(d,{className:`size-4 animate-spin`}):null,n.release]}),(0,$.jsx)(`p`,{className:`text-xs text-fg-subtle`,children:n.releaseHint})]}):null]}),(0,$.jsx)(Ve,{showLabel:n.showAdvanced,hideLabel:n.hideAdvanced,children:(0,$.jsxs)(`div`,{className:`flex flex-col gap-2 rounded-xl bg-surface-base/45 p-4 text-xs text-fg-subtle`,children:[(0,$.jsxs)(`p`,{className:`flex items-start gap-2`,children:[(0,$.jsx)(u,{className:`mt-0.5 size-4 shrink-0 text-accent`}),(0,$.jsx)(`span`,{children:n.brokerNote})]}),(0,$.jsx)(fe,{language:t,label:n.brokerDocsLink,section:`public-tunnel`,className:`text-xs`})]})}),be]}):(0,$.jsxs)(`div`,{className:e?`flex w-full flex-col gap-6`:`flex w-full flex-col gap-6 px-3 py-8 sm:px-5 xl:px-6`,children:[e?null:(0,$.jsxs)(`div`,{children:[(0,$.jsx)(`h1`,{className:`text-lg font-semibold text-fg`,children:n.title}),(0,$.jsx)(`p`,{className:`mt-1 text-sm text-fg-muted`,children:n.subtitle})]}),o?(0,$.jsx)(`p`,{className:`text-sm text-red-600 dark:text-red-400`,children:o}):null,_e,(0,$.jsx)(at,{t:n,status:X,isLoading:I,statusErr:F,starting:s,stopping:c,showConsentExpired:!!me,copyLabels:le,startDisabled:!V,startDisabledReason:V?void 0:n.brokerSecretRequiredBeforeStart,onStart:G,onStop:()=>void K()}),X.subdomain||X.publicUrl?(0,$.jsx)(`div`,{className:`flex flex-wrap gap-2`,children:(0,$.jsxs)(v,{type:`button`,variant:`secondary`,disabled:w||c,className:`border-danger/40 text-danger hover:bg-danger/10`,onClick:()=>a({type:`patch`,patch:{releaseConfirmOpen:!0}}),children:[w?(0,$.jsx)(d,{className:`size-4 animate-spin`}):null,n.release]})}):null,X.subdomain||X.publicUrl?(0,$.jsx)(`p`,{className:`text-xs text-fg-subtle`,children:n.releaseHint}):null,(0,$.jsxs)(ue,{children:[(0,$.jsx)(`h2`,{className:`mb-3 text-sm font-semibold text-fg`,children:n.optionsTitle}),(0,$.jsxs)(`label`,{className:p(`flex items-center gap-3 text-sm text-fg`,!R&&!P?.canAutoStart?`cursor-not-allowed opacity-60`:`cursor-pointer`),children:[(0,$.jsx)(`input`,{type:`checkbox`,className:`size-4 rounded border-edge accent-accent`,checked:R,disabled:l||!R&&!P?.canAutoStart,onChange:J}),n.autoStart]}),!P?.canAutoStart&&!R?(0,$.jsx)(`p`,{className:`mt-2 text-xs text-fg-subtle`,children:n.autoStartHint}):null]}),(0,$.jsxs)(`div`,{className:`flex flex-col gap-2 rounded-lg bg-surface-panel/80 px-3 py-2 text-xs text-fg-subtle shadow-surface`,children:[(0,$.jsxs)(`p`,{className:`flex items-start gap-2`,children:[(0,$.jsx)(u,{className:`mt-0.5 size-4 shrink-0 text-accent`}),(0,$.jsx)(`span`,{children:n.brokerNote})]}),(0,$.jsx)(fe,{language:t,label:n.brokerDocsLink,section:`public-tunnel`,className:`text-xs`})]}),be]})}function ft(e,t){return e.tabs[t]}function pt(e,t){return e.tabIntro[t]}function mt(e){switch(e){case`tailscale`:return`tailscale-serve`;case`public`:return`public-tunnel`;case`reverse-proxy`:return`reverse-proxy`;case`ssh`:return`ssh-tunnel`;case`lan`:return`lan`;default:return}}function ht(e){let t=(0,Q.c)(7),{tab:n,onOpenTab:r}=e;switch(n){case`guide`:{let e;return t[0]===r?e=t[1]:(e=(0,$.jsx)(Ae,{onOpenTab:r}),t[0]=r,t[1]=e),e}case`tailscale`:{let e;return t[2]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,$.jsx)(xe,{embedded:!0}),t[2]=e):e=t[2],e}case`public`:{let e;return t[3]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,$.jsx)(dt,{embedded:!0}),t[3]=e):e=t[3],e}case`reverse-proxy`:{let e;return t[4]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,$.jsx)(X,{}),t[4]=e):e=t[4],e}case`ssh`:{let e;return t[5]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,$.jsx)(Re,{}),t[5]=e):e=t[5],e}case`lan`:{let e;return t[6]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,$.jsx)(Pe,{}),t[6]=e):e=t[6],e}}}function gt(){let e=(0,Q.c)(3),t=o(),n=h(vt),r=f(n).remoteAccess,a=!!m(_t),[s,c]=i(),l=P(),u=Be(s.get(`tab`)),d=s.get(`intent`)===`mobile-pairing`,p;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(p={refreshInterval:2e3},e[0]=p):p=e[0];let g=_(d?`device-pairing-readiness`:null,me,p),y;e[1]===c?y=e[2]:(y=e=>{c(t=>{let n=new URLSearchParams(t);return e===`guide`?n.delete(`tab`):n.set(`tab`,e),n},{replace:!0})},e[1]=c,e[2]=y);let b=y,x=pt(r,u),S=ze.filter(e=>l||e!==`ssh`&&e!==`reverse-proxy`||e===u).map(e=>({id:e,label:ft(r,e)}));return(0,$.jsxs)(se,{children:[(0,$.jsx)(oe,{title:r.pageTitle,meta:(0,$.jsx)(fe,{language:n,label:r.docsLink,section:mt(u),className:`mt-1`})}),a?(0,$.jsxs)($.Fragment,{children:[d?(0,$.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-3 rounded-xl bg-accent-soft px-4 py-3`,children:[(0,$.jsxs)(`div`,{className:`flex min-w-0 items-start gap-3`,children:[(0,$.jsx)(ae,{className:`mt-0.5 size-5 shrink-0 text-accent`,"aria-hidden":!0}),(0,$.jsxs)(`div`,{children:[(0,$.jsx)(`p`,{className:`text-sm font-medium text-fg`,children:r.mobilePairingFlow.title}),(0,$.jsx)(`p`,{className:`mt-0.5 text-xs text-fg-muted`,children:g.data?.ready?r.mobilePairingFlow.ready:r.mobilePairingFlow.hint})]})]}),(0,$.jsxs)(v,{variant:`primary`,disabled:!g.data?.ready,onClick:()=>t(`/settings/devices?startDevicePairing=mobile`),children:[g.data?.ready?r.mobilePairingFlow.continue:r.mobilePairingFlow.waiting,(0,$.jsx)(z,{className:`size-4`,"aria-hidden":!0})]})]}):null,(0,$.jsx)(B,{items:S,activeTab:u,onChange:b,ariaLabel:r.tabsAria,tabIdPrefix:`remote-access-tab`,panelIdPrefix:`remote-access-panel`}),(0,$.jsx)(ce,{id:u,activeTab:u,tabIdPrefix:`remote-access-tab`,panelIdPrefix:`remote-access-panel`,title:ft(r,u),hint:u===`public`?void 0:x,showHeading:!1,framed:!1,children:(0,$.jsx)(ht,{tab:u,onOpenTab:b})})]}):(0,$.jsx)(`p`,{className:`text-sm text-fg-muted`,children:r.guide.needToken})]})}function _t(e){return e.conversationId}function vt(e){return e.language}export{gt as RemoteAccessHub};
|
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
import{a as e,i as t,o as n}from"./locale-store-DAgpZxAS.js";async function r(){return n(t(`/api/runtime-tools`))}async function i(e){await n(t(`/api/runtime-tools/config`),{method:`PATCH`,body:JSON.stringify(e)})}async function a(){return(await n(t(`/api/runtime-tools/prune`),{method:`POST`})).payload}async function o(n){let r=await e(t(`/api/runtime-tools/${n.runtime}/${n.action}/stream`),{method:`POST`,headers:{Accept:`text/event-stream`},body:JSON.stringify({version:n.version})});if(!r.ok||!r.body)throw Error(`HTTP ${r.status}`);let i=r.body.getReader(),a=new TextDecoder,o=``,s=!1;try{for(;!s;){let{done:e,value:t}=await i.read();if(e)break;o+=a.decode(t,{stream:!0}).replace(/\r\n/g,`
|
|
2
|
-
`);let r=o.split(`
|
|
3
|
-
|
|
4
|
-
`);o=r.pop()??``;for(let e of r){let t=``,r=``;for(let n of e.split(`
|
|
5
|
-
`))n.startsWith(`event:`)&&(t=n.slice(6).trim()),n.startsWith(`data:`)&&(r+=n.slice(5).trimStart());if(!r)continue;let i=JSON.parse(r);if(t===`progress`&&n.onProgress(i),t===`result`&&(s=!0,!i.ok))throw Error(i.message??`${n.action} failed`)}}}finally{i.releaseLock()}if(!s)throw Error(`Runtime operation ended without a result`)}export{i,a as n,o as r,r as t};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{a as t,t as n}from"./vendor-react-BOUWij0V.js";import{n as r,r as i}from"./popover-select-DGKUpVsz.js";import{t as a}from"./circle-check-C23XjkUj.js";import{t as o}from"./download-Dk-ZjtO6.js";import{t as s}from"./messages-DMXSIJUO.js";import{i as c,n as l}from"./locale-store-DAgpZxAS.js";import{i as u}from"./vendor-swr-BIWyz7Rc.js";import{t as d}from"./button-aIC072nz.js";import{Nl as f,bn as p,jd as m,sa as h}from"./index-CiDVRMmX.js";import{n as g,r as _}from"./settings-page-layout-Dx5S-Msc.js";import{t as v}from"./settings-advanced-gate-DLHGV-I-.js";import{i as y,n as b,r as x}from"./runtime-tools-api-CY3R7unQ.js";var S=e(t(),1);function C(e){return e?.trim()||void 0}function w(e,t,n){return e?.state===`ready`?C(t)!==C(n):!0}var T=n(),E=[`node`,`python`,`uv`];function D(){let e=s(l(e=>e.language)).runtimeToolsSettings,{data:t,error:n,isLoading:C,mutate:D}=u(c(`/api/runtime-tools`)),[O,k]=(0,S.useState)(null),[A,j]=(0,S.useState)(!1),[M,N]=(0,S.useState)(!1),[P,F]=(0,S.useState)({}),[I,L]=(0,S.useState)({}),[R,z]=(0,S.useState)(null),B=Object.values(P).some(Boolean);if((0,S.useEffect)(()=>{t?.payload.config&&k(structuredClone(t.payload.config))},[t?.payload.config]),n)return(0,T.jsxs)(_,{children:[(0,T.jsx)(g,{title:e.title,subtitle:e.loadError}),(0,T.jsx)(d,{onClick:()=>void D(),children:e.refresh})]});if(C||!O)return(0,T.jsx)(_,{children:(0,T.jsx)(p,{sections:3})});let V=new Map(t?.payload.statuses.map(e=>[e.runtime,e])),H=(e,t)=>k(n=>n&&{...n,[e]:{...n[e],...t}}),U=async()=>{j(!0),z(null);try{await y(O),await D()}catch(e){z(e instanceof Error?e.message:String(e))}finally{j(!1)}},W=async(e,t)=>{F(t=>({...t,[e]:!0})),z(null);try{await y(O),await x({runtime:e,action:t,version:e===`uv`?O.uv.version:O[e].version,onProgress:t=>L(n=>({...n,[e]:t}))}),await D()}catch(e){z(e instanceof Error?e.message:String(e))}finally{F(t=>({...t,[e]:!1}))}},G=async()=>{N(!0),z(null);try{await b(),await D()}catch(e){z(e instanceof Error?e.message:String(e))}finally{N(!1)}};return(0,T.jsxs)(_,{gap:`gap-6`,children:[(0,T.jsx)(g,{title:e.title,actions:(0,T.jsxs)(T.Fragment,{children:[(0,T.jsx)(h,{className:`size-9 shrink-0 p-0`,disabled:B,label:e.refresh,onClick:async()=>{await D()}}),(0,T.jsx)(d,{onClick:()=>void G(),disabled:M||B,children:M?e.pruning:e.prune}),(0,T.jsx)(d,{variant:`primary`,onClick:()=>void U(),disabled:A||B,children:A?e.saving:e.save})]})}),R?(0,T.jsx)(`div`,{className:`rounded-xl bg-danger/10 px-4 py-3 text-sm text-danger`,children:R}):null,(0,T.jsx)(`section`,{className:`rounded-xl bg-surface-hover/20 p-4`,children:(0,T.jsxs)(`label`,{className:`flex items-center justify-between gap-4`,children:[(0,T.jsxs)(`span`,{children:[(0,T.jsx)(`span`,{className:`block text-sm font-medium text-fg`,children:e.enabled}),(0,T.jsx)(`span`,{className:`mt-1 block text-xs text-fg-muted`,children:e.enabledHint})]}),(0,T.jsx)(`input`,{type:`checkbox`,checked:O.enabled,onChange:e=>k({...O,enabled:e.target.checked}),className:`size-4 accent-accent`})]})}),(0,T.jsx)(v,{children:(0,T.jsxs)(`section`,{className:`grid gap-4 rounded-xl bg-surface-hover/20 p-4 md:grid-cols-2`,children:[(0,T.jsxs)(`label`,{className:`space-y-1.5 text-xs font-medium text-fg-muted`,children:[e.downloadSource,(0,T.jsxs)(r,{value:O.download.source,onChange:e=>k({...O,download:{...O.download,source:e.target.value}}),children:[(0,T.jsx)(i,{value:`auto`,children:e.downloadSources.auto}),(0,T.jsx)(i,{value:`website-only`,children:e.downloadSources.websiteOnly}),(0,T.jsx)(i,{value:`direct-only`,children:e.downloadSources.directOnly})]})]}),(0,T.jsxs)(`label`,{className:`space-y-1.5 text-xs font-medium text-fg-muted`,children:[e.gatewayBaseUrl,(0,T.jsx)(`input`,{value:O.download.gatewayBaseUrl,disabled:O.download.source===`direct-only`,onChange:e=>k({...O,download:{...O.download,gatewayBaseUrl:e.target.value}}),className:`h-10 w-full rounded-lg border border-edge bg-surface-panel px-3 text-sm text-fg outline-none focus:border-edge-strong disabled:opacity-50`})]}),(0,T.jsxs)(`label`,{className:`space-y-1.5 text-xs font-medium text-fg-muted`,children:[e.offlineBundle,(0,T.jsx)(`input`,{value:O.download.bundleDir??``,placeholder:e.offlineBundlePlaceholder,onChange:e=>k({...O,download:{...O.download,bundleDir:e.target.value||void 0}}),className:`h-10 w-full rounded-lg border border-edge bg-surface-panel px-3 text-sm text-fg outline-none focus:border-edge-strong`})]}),(0,T.jsxs)(`label`,{className:`space-y-1.5 text-xs font-medium text-fg-muted`,children:[e.proxy,(0,T.jsx)(`input`,{value:O.download.proxy??``,placeholder:`http://127.0.0.1:7890`,onChange:e=>k({...O,download:{...O.download,proxy:e.target.value||void 0}}),className:`h-10 w-full rounded-lg border border-edge bg-surface-panel px-3 text-sm text-fg outline-none focus:border-edge-strong`})]})]})}),(0,T.jsx)(`div`,{className:`flex flex-col gap-4`,children:E.map(n=>{let s=V.get(n),c=s?.state===`ready`,l=I[n],u=n===`uv`?O.uv:O[n],p=n===`uv`?t?.payload.config.uv:t?.payload.config[n],h=P[n]===!0,g=w(s,u.version,p?.version);return(0,T.jsxs)(`section`,{className:`flex min-w-0 flex-col gap-5 rounded-xl bg-surface-base/55 p-5 sm:p-6`,children:[(0,T.jsxs)(`div`,{className:`flex items-start justify-between gap-3`,children:[(0,T.jsxs)(`div`,{children:[(0,T.jsx)(`h2`,{className:`text-base font-semibold text-fg`,children:e.runtimeNames[n]}),(0,T.jsx)(`p`,{className:`mt-1 break-words text-xs text-fg-muted`,children:s?.message??e.unknown})]}),(0,T.jsxs)(`div`,{className:`flex items-center gap-2`,children:[c?(0,T.jsx)(a,{className:`size-5 shrink-0 text-success`}):(0,T.jsx)(m,{className:`size-5 shrink-0 text-warning`}),(0,T.jsx)(`input`,{type:`checkbox`,"aria-label":`${e.runtimeNames[n]} ${e.enabled}`,checked:u.enabled,onChange:e=>{n===`uv`?k({...O,uv:{...O.uv,enabled:e.target.checked}}):H(n,{enabled:e.target.checked})},className:`size-4 accent-accent`})]})]}),(0,T.jsxs)(`div`,{className:n===`uv`?`grid gap-4 md:grid-cols-[minmax(16rem,28rem)]`:`grid gap-4 md:grid-cols-2 xl:grid-cols-3`,children:[(0,T.jsxs)(`label`,{className:`space-y-1.5 text-xs font-medium text-fg-muted`,children:[e.version,(0,T.jsx)(`input`,{value:u.version??``,placeholder:s?.requestedVersion,onChange:e=>{let t=e.target.value||void 0;n===`uv`?k({...O,uv:{...O.uv,version:t}}):H(n,{version:t})},className:`h-10 w-full rounded-lg border border-edge bg-surface-inset px-3 text-sm text-fg outline-none focus:border-edge-strong`})]}),n===`uv`?null:(0,T.jsxs)(T.Fragment,{children:[(0,T.jsxs)(`label`,{className:`space-y-1.5 text-xs font-medium text-fg-muted`,children:[e.sourcePolicy,(0,T.jsxs)(r,{value:O[n].preference,onChange:e=>H(n,{preference:e.target.value}),children:[(0,T.jsx)(i,{value:`managed-first`,children:e.preferences.managedFirst}),(0,T.jsx)(i,{value:`system-first`,children:e.preferences.systemFirst}),(0,T.jsx)(i,{value:`managed-only`,children:e.preferences.managedOnly}),(0,T.jsx)(i,{value:`system-only`,children:e.preferences.systemOnly})]})]}),(0,T.jsxs)(`label`,{className:`space-y-1.5 text-xs font-medium text-fg-muted`,children:[e.provisionPolicy,(0,T.jsxs)(r,{value:O[n].provision,onChange:e=>H(n,{provision:e.target.value}),children:[(0,T.jsx)(i,{value:`eager`,children:e.provisions.eager}),(0,T.jsx)(i,{value:`on-demand`,children:e.provisions.onDemand}),(0,T.jsx)(i,{value:`disabled`,children:e.provisions.disabled})]})]})]})]}),l&&h?(0,T.jsxs)(`div`,{className:`rounded-lg bg-accent-soft px-3 py-2 text-xs text-accent-fg`,children:[l.message,l.totalBytes&&l.downloadedBytes?` · ${Math.round(l.downloadedBytes/l.totalBytes*100)}%`:``]}):null,(0,T.jsxs)(`div`,{className:`mt-auto flex flex-wrap items-center justify-between gap-3`,children:[(0,T.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[g?(0,T.jsxs)(d,{variant:`primary`,disabled:!O.enabled||!u.enabled||h,onClick:()=>void W(n,`install`),children:[(0,T.jsx)(o,{className:`size-4`}),h?e.working:e.install]}):(0,T.jsxs)(`span`,{className:`inline-flex h-9 items-center gap-2 px-1 text-sm text-success`,children:[(0,T.jsx)(a,{className:`size-4`}),e.installed]}),s?.repairable?(0,T.jsxs)(d,{disabled:!O.enabled||!u.enabled||h,onClick:()=>void W(n,`repair`),children:[(0,T.jsx)(f,{className:`size-4`}),e.repair]}):null]}),(0,T.jsx)(v,{children:s?.resolved?.executable?(0,T.jsx)(`code`,{className:`break-all text-[11px] text-fg-subtle`,children:s.resolved.executable}):null})]})]},n)})})]})}export{D as RuntimeToolsSettingsPanel};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{a as t,n,t as r}from"./vendor-react-BOUWij0V.js";import{m as i}from"./chunk-KS7C4IRE-BvcCCgTW.js";import{n as a,r as o}from"./popover-select-DGKUpVsz.js";import{t as s}from"./download-Dk-ZjtO6.js";import{t as c}from"./messages-DMXSIJUO.js";import{t as l}from"./cn-0WouolD0.js";import{i as u,l as d,n as f,o as p}from"./locale-store-DAgpZxAS.js";import{a as m,c as h,f as g,n as _,o as v,p as ee,r as y,s as b,t as x}from"./session-api-D6-Vz8xK.js";import{i as S}from"./vendor-swr-BIWyz7Rc.js";import{t as C}from"./button-aIC072nz.js";import{t as w}from"./skeleton-BI5TyibZ.js";import{n as T,r as E}from"./gateway-config-swr-BVqYVaGy.js";import{n as D,t as O}from"./registry-api-B6kqbuw8.js";import{i as k,o as A}from"./settings-shell-dialog-layer-BU3UuiJr.js";import{$d as j,Ao as M,Bc as N,Ds as P,Fc as F,Gl as I,Gt as L,Ic as R,Kc as z,Kl as B,Ol as V,Os as H,Ou as te,Pc as ne,Qd as re,Qu as ie,Rc as ae,S as U,Sa as oe,Va as se,Vl as W,Wa as G,Wt as ce,_o as le,da as ue,du as K,fa as de,fd as fe,gd as pe,ii as me,ju as he,ku as ge,lu as _e,pa as ve,rl as ye,va as be,wd as xe,wl as Se,xa as Ce,zc as we}from"./index-CiDVRMmX.js";import{t as q}from"./number-input-DDeqHK-G.js";import{n as Te,r as Ee}from"./settings-page-layout-Dx5S-Msc.js";import{n as De,t as J}from"./settings-form-section-BXeszXR7.js";import{n as Oe,t as Y}from"./use-autosave-B1z_TIBu.js";import{t as ke}from"./settings-advanced-gate-DLHGV-I-.js";var X=e(t(),1),Ae=n(),Z=r();function je(e){let t=new Date(e),n=Math.floor((new Date().getTime()-t.getTime())/(1e3*60*60*24));return n===0?t.toLocaleTimeString([],{hour:`2-digit`,minute:`2-digit`}):n===1?`Yesterday`:n<7?t.toLocaleDateString([],{weekday:`short`}):t.toLocaleDateString([],{month:`short`,day:`numeric`})}function Me(e,t){return new Intl.NumberFormat(t===`zh`?`zh-CN`:`en-US`).format(e)}function Ne(e){return`$${Number(e).toLocaleString(void 0,{minimumFractionDigits:0,maximumFractionDigits:6})}`}function Pe(e){let t=(0,Ae.c)(124),{session:n,variant:r,labels:i,sessionAgentId:a,sessionAgentAvatar:o,onOpen:u,onAction:d}=e,p;t[0]!==i.unnamedSession||t[1]!==n.name?(p=n.name?.trim()||i.unnamedSession,t[0]=i.unnamedSession,t[1]=n.name,t[2]=p):p=t[2];let m=p,h=f(Re),g;t[3]!==h||t[4]!==n?(g=oe(n,c(h).sidebar.sessionFilters),t[3]=h,t[4]=n,t[5]=g):g=t[5];let _=g,v;t[6]===n.name?v=t[7]:(v=n.name?.trim(),t[6]=n.name,t[7]=v);let ee=!!v,y=n.status===`archived`,b=n.status===`pinned`,x=n.usage,S;t[8]!==i.costUnknown||t[9]!==i.noUsage||t[10]!==x?(S=x?.calls?x.costCompleteness===`unknown`?i.costUnknown:`${x.costCompleteness===`partial`?`≥ `:`≈ `}${Ne(x.knownCostUsd)}`:i.noUsage,t[8]=i.costUnknown,t[9]=i.noUsage,t[10]=x,t[11]=S):S=t[11];let C=S,w=x?.calls?x.costCompleteness===`partial`?i.costPartial:x.costCompleteness===`unknown`?i.costUnknown:i.cost:i.noUsage,T=r===`list`&&`sm:flex-row sm:items-center sm:gap-4`,E;t[12]===T?E=t[13]:(E=l(`group flex min-w-0 w-full max-w-full cursor-pointer flex-col rounded-xl bg-surface-base text-left transition-colors duration-150 ease-out`,`hover:bg-surface-hover active:scale-[0.99]`,`focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent focus-visible:ring-offset-2 focus-visible:ring-offset-surface-panel`,T),t[12]=T,t[13]=E);let D;t[14]===u?D=t[15]:(D=e=>{(e.key===`Enter`||e.key===` `)&&(e.preventDefault(),u())},t[14]=u,t[15]=D);let O=r===`list`&&`sm:py-3`,k;t[16]===O?k=t[17]:(k=l(`flex min-w-0 items-start justify-between gap-2 bg-surface-hover/35 px-3 py-2 dark:bg-surface-hover/25`,O),t[16]=O,t[17]=k);let A;t[18]===n?A=t[19]:(A=(0,Z.jsx)(Ce,{sourceChannel:n.sourceChannel,session:n,className:`size-3.5`}),t[18]=n,t[19]=A);let M;t[20]===_?M=t[21]:(M=(0,Z.jsx)(`span`,{className:`truncate text-[11px] font-medium uppercase tracking-wide text-fg-subtle`,children:_}),t[20]=_,t[21]=M);let N;t[22]!==A||t[23]!==M?(N=(0,Z.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2`,children:[A,M]}),t[22]=A,t[23]=M,t[24]=N):N=t[24];let F;t[25]===b?F=t[26]:(F=b?(0,Z.jsx)(B,{className:`size-3.5 text-accent-fg`,strokeWidth:1.75,"aria-hidden":!0}):null,t[25]=b,t[26]=F);let L;t[27]===n.updatedAt?L=t[28]:(L=je(n.updatedAt),t[27]=n.updatedAt,t[28]=L);let R;t[29]===L?R=t[30]:(R=(0,Z.jsx)(`span`,{children:L}),t[29]=L,t[30]=R);let z;t[31]!==F||t[32]!==R?(z=(0,Z.jsxs)(`div`,{className:`flex shrink-0 items-center gap-1.5 text-xs text-fg-muted`,children:[F,R]}),t[31]=F,t[32]=R,t[33]=z):z=t[33];let V;t[34]!==N||t[35]!==z||t[36]!==k?(V=(0,Z.jsxs)(`div`,{className:k,children:[N,z]}),t[34]=N,t[35]=z,t[36]=k,t[37]=V):V=t[37];let H=r===`list`&&`sm:py-3`,te;t[38]===H?te=t[39]:(te=l(`min-w-0 flex-1 px-3 py-2`,H),t[38]=H,t[39]=te);let ne=r===`list`&&`sm:items-start`,ie;t[40]===ne?ie=t[41]:(ie=l(`flex gap-3`,ne),t[40]=ne,t[41]=ie);let ae;t[42]!==o||t[43]!==a?(ae=(0,Z.jsx)(G,{agentId:a,avatar:o,size:40,className:`size-10 shrink-0 ring-1 ring-edge/60 dark:ring-edge`}),t[42]=o,t[43]=a,t[44]=ae):ae=t[44];let U;t[45]===m?U=t[46]:(U=(0,Z.jsx)(`div`,{className:`min-w-0 max-w-full truncate text-sm font-semibold text-fg`,title:m,children:m}),t[45]=m,t[46]=U);let se;t[47]!==n.key||t[48]!==ee?(se=ee?(0,Z.jsx)(`div`,{className:`mt-0.5 min-w-0 max-w-full truncate font-mono text-[11px] text-fg-subtle`,title:n.key,children:n.key}):null,t[47]=n.key,t[48]=ee,t[49]=se):se=t[49];let W;t[50]!==U||t[51]!==se?(W=(0,Z.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[U,se]}),t[50]=U,t[51]=se,t[52]=W):W=t[52];let ce;t[53]!==ie||t[54]!==ae||t[55]!==W?(ce=(0,Z.jsxs)(`div`,{className:ie,children:[ae,W]}),t[53]=ie,t[54]=ae,t[55]=W,t[56]=ce):ce=t[56];let le;t[57]===Symbol.for(`react.memo_cache_sentinel`)?(le=(0,Z.jsx)(K,{className:`size-3.5`,strokeWidth:1.75,"aria-hidden":!0}),t[57]=le):le=t[57];let ue;t[58]===n.messageCount?ue=t[59]:(ue=(0,Z.jsxs)(`span`,{className:`inline-flex items-center gap-1`,children:[le,n.messageCount]}),t[58]=n.messageCount,t[59]=ue);let de;t[60]===Symbol.for(`react.memo_cache_sentinel`)?(de=(0,Z.jsx)(fe,{className:`size-3.5`,strokeWidth:1.75,"aria-hidden":!0}),t[60]=de):de=t[60];let me=x?.totalTokens??0,he;t[61]!==h||t[62]!==me?(he=Me(me,h),t[61]=h,t[62]=me,t[63]=he):he=t[63];let ge;t[64]!==i.tokens||t[65]!==he?(ge=(0,Z.jsxs)(`span`,{className:`inline-flex items-center gap-1`,children:[de,he,` `,i.tokens]}),t[64]=i.tokens,t[65]=he,t[66]=ge):ge=t[66];let _e;t[67]===Symbol.for(`react.memo_cache_sentinel`)?(_e=(0,Z.jsx)(pe,{className:`size-3.5`,strokeWidth:1.75,"aria-hidden":!0}),t[67]=_e):_e=t[67];let ve;t[68]!==C||t[69]!==w?(ve=(0,Z.jsxs)(`span`,{className:`inline-flex items-center gap-1`,title:w,children:[_e,C]}),t[68]=C,t[69]=w,t[70]=ve):ve=t[70];let be;t[71]!==ue||t[72]!==ge||t[73]!==ve?(be=(0,Z.jsxs)(`div`,{className:`mt-2 flex flex-wrap items-center gap-3 text-xs text-fg-muted`,children:[ue,ge,ve]}),t[71]=ue,t[72]=ge,t[73]=ve,t[74]=be):be=t[74];let xe;t[75]===n.tags?xe=t[76]:(xe=n.tags.length>0?(0,Z.jsxs)(`div`,{className:`mt-2 flex flex-wrap gap-1`,children:[n.tags.slice(0,3).map(Le),n.tags.length>3?(0,Z.jsxs)(`span`,{className:`text-[11px] text-fg-disabled`,children:[`+`,n.tags.length-3]}):null]}):null,t[75]=n.tags,t[76]=xe);let Se;t[77]!==te||t[78]!==ce||t[79]!==be||t[80]!==xe?(Se=(0,Z.jsxs)(`div`,{className:te,children:[ce,be,xe]}),t[77]=te,t[78]=ce,t[79]=be,t[80]=xe,t[81]=Se):Se=t[81];let we;t[82]===d?we=t[83]:(we=()=>d(`continue`),t[82]=d,t[83]=we);let q;t[84]===Symbol.for(`react.memo_cache_sentinel`)?(q=(0,Z.jsx)(K,{className:`size-4`,strokeWidth:1.75}),t[84]=q):q=t[84];let Te;t[85]!==i.continueChat||t[86]!==we?(Te=(0,Z.jsx)(`button`,{type:`button`,className:P,title:i.continueChat,"aria-label":i.continueChat,onClick:we,children:q}),t[85]=i.continueChat,t[86]=we,t[87]=Te):Te=t[87];let Ee;t[88]!==y||t[89]!==i.archive||t[90]!==i.unarchive||t[91]!==d?(Ee=y?(0,Z.jsx)(`button`,{type:`button`,className:P,title:i.unarchive,"aria-label":i.unarchive,onClick:()=>d(`unarchive`),children:(0,Z.jsx)(j,{className:`size-4`,strokeWidth:1.75})}):(0,Z.jsx)(`button`,{type:`button`,className:P,title:i.archive,"aria-label":i.archive,onClick:()=>d(`archive`),children:(0,Z.jsx)(re,{className:`size-4`,strokeWidth:1.75})}),t[88]=y,t[89]=i.archive,t[90]=i.unarchive,t[91]=d,t[92]=Ee):Ee=t[92];let De;t[93]!==b||t[94]!==i.pin||t[95]!==i.unpin||t[96]!==d?(De=b?(0,Z.jsx)(`button`,{type:`button`,className:P,title:i.unpin,"aria-label":i.unpin,onClick:()=>d(`unpin`),children:(0,Z.jsx)(I,{className:`size-4`,strokeWidth:1.75})}):(0,Z.jsx)(`button`,{type:`button`,className:P,title:i.pin,"aria-label":i.pin,onClick:()=>d(`pin`),children:(0,Z.jsx)(B,{className:`size-4`,strokeWidth:1.75})}),t[93]=b,t[94]=i.pin,t[95]=i.unpin,t[96]=d,t[97]=De):De=t[97];let J;t[98]===d?J=t[99]:(J=()=>d(`export`),t[98]=d,t[99]=J);let Oe;t[100]===Symbol.for(`react.memo_cache_sentinel`)?(Oe=(0,Z.jsx)(s,{className:`size-4`,strokeWidth:1.75}),t[100]=Oe):Oe=t[100];let Y;t[101]!==i.export||t[102]!==J?(Y=(0,Z.jsx)(`button`,{type:`button`,className:P,title:i.export,"aria-label":i.export,onClick:J,children:Oe}),t[101]=i.export,t[102]=J,t[103]=Y):Y=t[103];let ke;t[104]===Symbol.for(`react.memo_cache_sentinel`)?(ke=l(P,`text-red-600 hover:bg-red-50 dark:text-red-400 dark:hover:bg-red-950/40`),t[104]=ke):ke=t[104];let X;t[105]===d?X=t[106]:(X=()=>d(`delete`),t[105]=d,t[106]=X);let Pe;t[107]===Symbol.for(`react.memo_cache_sentinel`)?(Pe=(0,Z.jsx)(ye,{className:`size-4`,strokeWidth:1.75}),t[107]=Pe):Pe=t[107];let ze;t[108]!==i.delete||t[109]!==X?(ze=(0,Z.jsx)(`button`,{type:`button`,className:ke,title:i.delete,"aria-label":i.delete,onClick:X,children:Pe}),t[108]=i.delete,t[109]=X,t[110]=ze):ze=t[110];let Be;t[111]!==Te||t[112]!==Ee||t[113]!==De||t[114]!==Y||t[115]!==ze?(Be=(0,Z.jsxs)(`div`,{role:`group`,className:`m-1 mt-0 flex flex-wrap items-center gap-0.5 rounded-lg bg-surface-hover/35 p-1.5`,onClick:Ie,onKeyDown:Fe,children:[Te,Ee,De,Y,ze]}),t[111]=Te,t[112]=Ee,t[113]=De,t[114]=Y,t[115]=ze,t[116]=Be):Be=t[116];let Ve;return t[117]!==u||t[118]!==V||t[119]!==Se||t[120]!==Be||t[121]!==E||t[122]!==D?(Ve=(0,Z.jsxs)(`div`,{role:`button`,tabIndex:0,className:E,onClick:u,onKeyDown:D,children:[V,Se,Be]}),t[117]=u,t[118]=V,t[119]=Se,t[120]=Be,t[121]=E,t[122]=D,t[123]=Ve):Ve=t[123],Ve}function Fe(e){return e.stopPropagation()}function Ie(e){return e.stopPropagation()}function Le(e){return(0,Z.jsx)(`span`,{className:`max-w-full break-words rounded-md bg-surface-hover px-1.5 py-0.5 text-[11px] text-fg-muted`,children:e},e)}function Re(e){return e.language}function ze(e,t){return e.routing?.agentId?.trim().toLowerCase()||t.trim().toLowerCase()||`main`}function Be(e,t){return t.find(t=>t.id===e)?.avatar}var Ve={enabled:!0,triggerThreshold:.8,reserveTokens:8192,minMessagesBeforeCompact:10,keepRecentTokens:2e4,recentTurnsPreserve:3,summaryMaxTokens:16e3,summaryChunkTokens:24e3,summaryTimeoutMs:18e4,summaryRetries:2,qualityGuard:!0,gapAudit:!0,minToolResultKeepChars:1e3,maxActiveTranscriptBytes:2e6,postCompactionSections:[`Session Startup`,`Red Lines`]};function He(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function Ue(e,t,n,r=1/0){return typeof e==`number`&&Number.isFinite(e)&&e>=n&&e<=r?e:t}function Q(e,t,n,r=1/0){return Number.isInteger(e)&&e>=n&&e<=r?e:t}function We(e){let t=He(e)?e:{},n=He(t.userContext)?t.userContext:{},r=He(n.contextPlanning)?n.contextPlanning:{},i=He(r.compaction)?r.compaction:{},a=Ve,o=typeof i.model==`string`&&i.model.trim()?i.model.trim():void 0,s=Array.isArray(i.postCompactionSections)&&i.postCompactionSections.length<=12&&i.postCompactionSections.every(e=>typeof e==`string`&&e.trim())?[...new Set(i.postCompactionSections.map(e=>e.trim()))]:[...a.postCompactionSections];return{enabled:typeof i.enabled==`boolean`?i.enabled:a.enabled,triggerThreshold:Ue(i.triggerThreshold,a.triggerThreshold,.1,.98),reserveTokens:Q(i.reserveTokens,a.reserveTokens,1024),minMessagesBeforeCompact:Q(i.minMessagesBeforeCompact,a.minMessagesBeforeCompact,2),keepRecentTokens:Q(i.keepRecentTokens,a.keepRecentTokens,1e3),recentTurnsPreserve:Q(i.recentTurnsPreserve,a.recentTurnsPreserve,1,12),summaryMaxTokens:Q(i.summaryMaxTokens,a.summaryMaxTokens,256),summaryChunkTokens:Q(i.summaryChunkTokens,a.summaryChunkTokens,1e3),summaryTimeoutMs:Q(i.summaryTimeoutMs,a.summaryTimeoutMs,1e3,6e5),summaryRetries:Q(i.summaryRetries,a.summaryRetries,0,5),qualityGuard:typeof i.qualityGuard==`boolean`?i.qualityGuard:a.qualityGuard,gapAudit:typeof i.gapAudit==`boolean`?i.gapAudit:a.gapAudit,...o?{model:o}:{},minToolResultKeepChars:Q(i.minToolResultKeepChars,a.minToolResultKeepChars,200),maxActiveTranscriptBytes:Q(i.maxActiveTranscriptBytes,a.maxActiveTranscriptBytes,64e3),postCompactionSections:s}}function Ge(e){return e.triggerThreshold<.1||e.triggerThreshold>.98?`triggerThreshold`:!Number.isInteger(e.reserveTokens)||e.reserveTokens<1024?`reserveTokens`:!Number.isInteger(e.minMessagesBeforeCompact)||e.minMessagesBeforeCompact<2?`minMessagesBeforeCompact`:!Number.isInteger(e.keepRecentTokens)||e.keepRecentTokens<1e3?`keepRecentTokens`:!Number.isInteger(e.recentTurnsPreserve)||e.recentTurnsPreserve<1||e.recentTurnsPreserve>12?`recentTurnsPreserve`:!Number.isInteger(e.summaryMaxTokens)||e.summaryMaxTokens<256?`summaryMaxTokens`:!Number.isInteger(e.summaryChunkTokens)||e.summaryChunkTokens<1e3?`summaryChunkTokens`:!Number.isInteger(e.summaryTimeoutMs)||e.summaryTimeoutMs<1e3||e.summaryTimeoutMs>6e5?`summaryTimeoutMs`:!Number.isInteger(e.summaryRetries)||e.summaryRetries<0||e.summaryRetries>5?`summaryRetries`:e.model!==void 0&&!e.model.trim()?`model`:!Number.isInteger(e.minToolResultKeepChars)||e.minToolResultKeepChars<200?`minToolResultKeepChars`:!Number.isInteger(e.maxActiveTranscriptBytes)||e.maxActiveTranscriptBytes<64e3?`maxActiveTranscriptBytes`:e.postCompactionSections.length>12||e.postCompactionSections.some(e=>!e.trim())?`postCompactionSections`:null}function Ke(e){let t={...e,...e.model?.trim()?{model:e.model.trim()}:{}};return e.model?.trim()||delete t.model,{userContext:{contextPlanning:{compaction:t}}}}async function qe(e){await p(u(`/api/config`),{method:`PATCH`,body:JSON.stringify(Ke(e))}),await T()}var Je=128e3,Ye={balanced:Ve,preserve:{...Ve,triggerThreshold:.88,keepRecentTokens:32e3,recentTurnsPreserve:5,maxActiveTranscriptBytes:4e6},early:{...Ve,triggerThreshold:.65,reserveTokens:12e3,minMessagesBeforeCompact:6,keepRecentTokens:12e3,recentTurnsPreserve:2}},Xe=ue();function Ze(){return l(`w-full rounded-lg border border-edge bg-surface-panel px-3 py-2 text-sm text-fg disabled:cursor-not-allowed disabled:opacity-55`,M,`dark:border-edge`)}function Qe(e){let{enabled:t,model:n,postCompactionSections:r,...i}=e;return JSON.stringify(i)}function $e(e){let t=Qe(e);for(let[e,n]of Object.entries(Ye))if(t===Qe(n))return e;return`custom`}function et(e){return e>=1e6?`${(e/1e6).toFixed(e%1e6==0?0:1)}m`:e>=1e3?`${(e/1e3).toFixed(e%1e3==0?0:1)}k`:String(e)}function $(e){let t=(0,Ae.c)(20),{id:n,label:r,hint:i,value:a,min:o,max:s,step:c,disabled:l,onChange:u}=e,d=c===void 0?1:c,f;t[0]!==n||t[1]!==r?(f=(0,Z.jsx)(`label`,{className:`mb-1 block text-sm font-medium text-fg`,htmlFor:n,children:r}),t[0]=n,t[1]=r,t[2]=f):f=t[2];let p;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(p=Ze(),t[3]=p):p=t[3];let m;t[4]===u?m=t[5]:(m=e=>{if(!e.target.value.trim())return;let t=Number(e.target.value);Number.isFinite(t)&&u(t)},t[4]=u,t[5]=m);let h;t[6]!==l||t[7]!==n||t[8]!==s||t[9]!==o||t[10]!==d||t[11]!==m||t[12]!==a?(h=(0,Z.jsx)(q,{id:n,type:`number`,min:o,max:s,step:d,disabled:l,className:p,value:a,onChange:m}),t[6]=l,t[7]=n,t[8]=s,t[9]=o,t[10]=d,t[11]=m,t[12]=a,t[13]=h):h=t[13];let g;t[14]===i?g=t[15]:(g=i?(0,Z.jsx)(`p`,{className:`mt-1 text-xs text-fg-subtle`,children:i}):null,t[14]=i,t[15]=g);let _;return t[16]!==f||t[17]!==h||t[18]!==g?(_=(0,Z.jsxs)(`div`,{children:[f,h,g]}),t[16]=f,t[17]=h,t[18]=g,t[19]=_):_=t[19],_}function tt(e){let t=(0,Ae.c)(19),{label:n,hint:r,checked:i,disabled:a,onChange:o}=e,s=a?`cursor-not-allowed opacity-55`:`cursor-pointer`,c;t[0]===s?c=t[1]:(c=l(`flex items-start gap-2 text-sm text-fg`,s),t[0]=s,t[1]=c);let u;t[2]===o?u=t[3]:(u=e=>o(e.target.checked),t[2]=o,t[3]=u);let d;t[4]!==i||t[5]!==a||t[6]!==u?(d=(0,Z.jsx)(`input`,{type:`checkbox`,className:`ui-checkbox mt-0.5`,checked:i,disabled:a,onChange:u}),t[4]=i,t[5]=a,t[6]=u,t[7]=d):d=t[7];let f;t[8]===n?f=t[9]:(f=(0,Z.jsx)(`span`,{className:`font-medium`,children:n}),t[8]=n,t[9]=f);let p;t[10]===r?p=t[11]:(p=(0,Z.jsx)(`span`,{className:`mt-0.5 block text-xs text-fg-subtle`,children:r}),t[10]=r,t[11]=p);let m;t[12]!==f||t[13]!==p?(m=(0,Z.jsxs)(`span`,{children:[f,p]}),t[12]=f,t[13]=p,t[14]=m):m=t[14];let h;return t[15]!==c||t[16]!==d||t[17]!==m?(h=(0,Z.jsxs)(`label`,{className:c,children:[d,m]}),t[15]=c,t[16]=d,t[17]=m,t[18]=h):h=t[18],h}function nt({hasToken:e}){let t=c(f(e=>e.language)).sessions.compaction,{data:n,isLoading:r}=E(e),{data:i=[],isLoading:a}=S(e?O:null,D,{revalidateOnFocus:!1}),o=(0,X.useMemo)(()=>n?.payload?.config===void 0?null:We(n.payload.config),[n]),[s,u]=(0,X.useReducer)(Xe,{form:null,baseline:null}),[d,p]=(0,X.useState)(``),m=(0,X.useRef)(!1),h=(0,X.useRef)(s.form);h.current=s.form;let g=(0,X.useRef)(null);de({enabled:e,parsed:o,dirty:m.current,trackedParsedRef:g,dispatch:u,onResetDirty:()=>{m.current=!1}});let _=s.form,v=s.baseline,ee=!!(_&&v&&JSON.stringify(_)!==JSON.stringify(v)),y=(0,X.useCallback)(e=>{m.current=!0,u({type:`patch`,patch:e})},[]),b=(0,X.useCallback)(e=>({enabled:t.enabled,triggerThreshold:t.triggerThreshold,reserveTokens:t.reserveTokens,minMessagesBeforeCompact:t.minMessagesBeforeCompact,keepRecentTokens:t.keepRecentTokens,recentTurnsPreserve:t.recentTurnsPreserve,summaryMaxTokens:t.summaryMaxTokens,summaryChunkTokens:t.summaryChunkTokens,summaryTimeoutMs:t.summaryTimeoutSeconds,summaryRetries:t.summaryRetries,qualityGuard:t.qualityGuard,gapAudit:t.gapAudit,model:t.summaryModel,minToolResultKeepChars:t.minToolResultKeepChars,maxActiveTranscriptBytes:t.maxActiveTranscriptMb,postCompactionSections:t.postCompactionSections})[e],[t]),x=Y({value:_,dirty:ee,onSave:(0,X.useCallback)(async e=>{try{await qe(e),u({type:`saved`,value:e}),m.current=!!(h.current&&JSON.stringify(h.current)!==JSON.stringify(e))}catch(e){throw Error(e instanceof Error?e.message:t.saveError)}},[t.saveError]),validate:e=>{let n=Ge(e);return n?t.invalidValue.replace(`{{field}}`,b(n)):null}});if(!e||!_)return r?(0,Z.jsx)(J,{children:(0,Z.jsxs)(`div`,{className:`space-y-3`,"aria-busy":!0,children:[(0,Z.jsx)(w,{className:`h-5 w-48`}),(0,Z.jsx)(w,{className:`h-20 w-full rounded-xl`}),(0,Z.jsx)(w,{className:`h-36 w-full rounded-xl`})]})}):null;let T=$e(_),k=Math.max(0,Je-_.reserveTokens),A=Math.min(Math.floor(Je*_.triggerThreshold),k),j=Math.min(100,A/Je*100),M=Math.min(100,k/Je*100),N=_.model?i.find(e=>e.id===_.model):void 0,P=N?.contextWindow&&_.summaryChunkTokens+_.summaryMaxTokens+4096>N.contextWindow,F=_.keepRecentTokens+_.reserveTokens>A,I=Math.round(_.summaryTimeoutMs*(_.summaryRetries+1)/1e3),L=e=>{let t=Ye[e];y({...t,..._.model?{model:_.model}:{model:void 0},postCompactionSections:_.postCompactionSections})},R={balanced:{title:t.presetBalanced,hint:t.presetBalancedHint},preserve:{title:t.presetPreserve,hint:t.presetPreserveHint},early:{title:t.presetEarly,hint:t.presetEarlyHint}},B=()=>{let e=d.trim();!e||_.postCompactionSections.includes(e)||_.postCompactionSections.length>=12||(y({postCompactionSections:[..._.postCompactionSections,e]}),p(``))};return(0,Z.jsxs)(J,{onBlurCapture:x.onBlurCapture,children:[(0,Z.jsx)(De,{icon:_e,title:t.title,subtitle:t.hint,trailing:(0,Z.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,Z.jsx)(Oe,{status:x.status,error:x.error}),(0,Z.jsxs)(`label`,{className:`flex cursor-pointer items-center gap-2 text-sm font-medium text-fg`,children:[(0,Z.jsx)(`input`,{type:`checkbox`,className:`ui-checkbox`,checked:_.enabled,onChange:e=>y({enabled:e.target.checked})}),_.enabled?t.enabled:t.disabled]})]})}),x.error?(0,Z.jsx)(`p`,{className:`mb-4 rounded-lg bg-red-50 px-3 py-2 text-sm text-red-700 dark:bg-red-950/40 dark:text-red-300`,role:`alert`,children:x.error}):null,_.enabled?null:(0,Z.jsx)(`p`,{className:`mb-4 rounded-lg bg-amber-50 px-3 py-2 text-xs text-amber-950 dark:bg-amber-950/40 dark:text-amber-100`,children:t.disabledWarning}),(0,Z.jsxs)(`fieldset`,{disabled:!_.enabled,className:`space-y-5 disabled:opacity-60`,children:[(0,Z.jsxs)(`div`,{children:[(0,Z.jsxs)(`div`,{className:`mb-2 flex items-center justify-between gap-3`,children:[(0,Z.jsxs)(`div`,{children:[(0,Z.jsx)(`div`,{className:`text-sm font-medium text-fg`,children:t.presetTitle}),(0,Z.jsx)(`p`,{className:`mt-0.5 text-xs text-fg-subtle`,children:t.presetHint})]}),T===`custom`?(0,Z.jsx)(`span`,{className:`rounded-full bg-surface-hover px-2 py-1 text-[11px] font-medium text-fg-muted`,children:t.presetCustom}):null]}),(0,Z.jsx)(`div`,{className:`grid gap-2 sm:grid-cols-3`,children:[`balanced`,`preserve`,`early`].map(e=>(0,Z.jsxs)(`button`,{type:`button`,"aria-pressed":T===e,className:l(`rounded-xl bg-surface-base/55 px-3 py-3 text-left focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,H.transition,H.focusRingPanel,T===e?`bg-accent-soft text-accent-fg shadow-surface`:`text-fg hover:bg-surface-hover`),onClick:()=>L(e),children:[(0,Z.jsx)(`span`,{className:`block text-sm font-medium`,children:R[e].title}),(0,Z.jsx)(`span`,{className:`mt-1 block text-xs text-fg-muted`,children:R[e].hint})]},e))})]}),(0,Z.jsxs)(U,{title:t.advancedTitle,summary:T===`custom`?t.presetCustom:t.presetHint,children:[(0,Z.jsxs)(`div`,{className:`rounded-xl bg-surface-base/45 p-4`,children:[(0,Z.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-2`,children:[(0,Z.jsxs)(`div`,{children:[(0,Z.jsx)(`div`,{className:`text-sm font-medium text-fg`,children:t.budgetPreview}),(0,Z.jsx)(`p`,{className:`mt-0.5 text-xs text-fg-subtle`,children:t.budgetPreviewHint})]}),(0,Z.jsx)(`span`,{className:`rounded-full bg-surface-panel px-2.5 py-1 font-mono text-xs text-fg-muted`,children:t.previewModel128k})]}),(0,Z.jsxs)(`div`,{className:`mt-4 space-y-3`,children:[(0,Z.jsxs)(`div`,{children:[(0,Z.jsxs)(`div`,{className:`mb-1 flex justify-between gap-3 text-xs text-fg-muted`,children:[(0,Z.jsx)(`span`,{children:t.compactionTrigger}),(0,Z.jsx)(`span`,{className:`font-mono text-fg`,children:et(A)})]}),(0,Z.jsx)(`div`,{className:`h-2 overflow-hidden rounded-full bg-surface-active`,children:(0,Z.jsx)(`div`,{className:`h-full rounded-full bg-accent`,style:{width:`${j}%`}})})]}),(0,Z.jsxs)(`div`,{children:[(0,Z.jsxs)(`div`,{className:`mb-1 flex justify-between gap-3 text-xs text-fg-muted`,children:[(0,Z.jsx)(`span`,{children:t.hardInputLimit}),(0,Z.jsx)(`span`,{className:`font-mono text-fg`,children:et(k)})]}),(0,Z.jsx)(`div`,{className:`h-2 overflow-hidden rounded-full bg-surface-active`,children:(0,Z.jsx)(`div`,{className:`h-full rounded-full bg-fg-subtle`,style:{width:`${M}%`}})})]})]}),(0,Z.jsx)(`p`,{className:`mt-3 text-xs text-fg-subtle`,children:t.budgetFormula})]}),(0,Z.jsxs)(`div`,{className:`grid gap-4 sm:grid-cols-2`,children:[(0,Z.jsx)($,{id:`compaction-trigger-threshold`,label:t.triggerThreshold,hint:t.triggerThresholdHint,value:Number((_.triggerThreshold*100).toFixed(2)),min:10,max:98,step:.1,onChange:e=>y({triggerThreshold:e/100})}),(0,Z.jsx)($,{id:`compaction-reserve-tokens`,label:t.reserveTokens,hint:t.reserveTokensHint.replace(`{{tokens}}`,et(_.reserveTokens)),value:_.reserveTokens,min:1024,step:1024,onChange:e=>y({reserveTokens:Math.floor(e)})}),(0,Z.jsx)($,{id:`compaction-recent-turns`,label:t.recentTurnsPreserve,hint:t.recentTurnsPreserveHint,value:_.recentTurnsPreserve,min:1,max:12,onChange:e=>y({recentTurnsPreserve:Math.floor(e)})}),(0,Z.jsx)($,{id:`compaction-keep-recent-tokens`,label:t.keepRecentTokens,hint:t.keepRecentTokensHint.replace(`{{tokens}}`,et(_.keepRecentTokens)),value:_.keepRecentTokens,min:1e3,step:1e3,onChange:e=>y({keepRecentTokens:Math.floor(e)})})]}),F?(0,Z.jsx)(`p`,{className:`rounded-lg bg-amber-50 px-3 py-2 text-xs text-amber-950 dark:bg-amber-950/40 dark:text-amber-100`,children:t.retentionWarning}):null,(0,Z.jsxs)(`div`,{className:`grid gap-4 sm:grid-cols-2`,children:[(0,Z.jsxs)(`div`,{children:[(0,Z.jsx)(`label`,{className:`mb-1 block text-sm font-medium text-fg`,children:t.summaryModel}),(0,Z.jsxs)(`div`,{className:`flex min-w-0 gap-2`,children:[(0,Z.jsx)(me,{value:_.model??``,disabled:!_.enabled,placeholder:t.summaryModelInherited,searchPlaceholder:t.summaryModelSearch,noMatches:t.summaryModelNoMatches,models:i,modelsLoading:a,className:`min-w-0 flex-1 justify-between`,contentAlign:`start`,showProviderSettingsFooter:!0,onChange:e=>y({model:e})}),_.model?(0,Z.jsx)(C,{type:`button`,variant:`secondary`,onClick:()=>y({model:void 0}),children:t.summaryModelUseSession}):null]}),(0,Z.jsx)(`p`,{className:`mt-1 text-xs text-fg-subtle`,children:t.summaryModelHint})]}),(0,Z.jsx)(tt,{label:t.qualityGuard,hint:t.qualityGuardHint,checked:_.qualityGuard,onChange:e=>y({qualityGuard:e})}),(0,Z.jsx)(tt,{label:t.gapAudit,hint:t.gapAuditHint,checked:_.gapAudit,onChange:e=>y({gapAudit:e})})]}),_.qualityGuard?null:(0,Z.jsx)(`p`,{className:`rounded-lg bg-amber-50 px-3 py-2 text-xs text-amber-950 dark:bg-amber-950/40 dark:text-amber-100`,children:t.qualityGuardWarning})]}),(0,Z.jsx)(ke,{children:(0,Z.jsxs)(`div`,{className:`space-y-5 rounded-xl bg-surface-base/45 p-4`,children:[(0,Z.jsxs)(`div`,{children:[(0,Z.jsx)(`div`,{className:`text-sm font-semibold text-fg`,children:t.advancedTitle}),(0,Z.jsx)(`p`,{className:`mt-0.5 text-xs text-fg-subtle`,children:t.advancedHint})]}),(0,Z.jsxs)(`div`,{className:`grid gap-4 sm:grid-cols-2`,children:[(0,Z.jsx)($,{id:`compaction-min-messages`,label:t.minMessagesBeforeCompact,hint:t.minMessagesBeforeCompactHint,value:_.minMessagesBeforeCompact,min:2,onChange:e=>y({minMessagesBeforeCompact:Math.floor(e)})}),(0,Z.jsx)($,{id:`compaction-max-transcript-mb`,label:t.maxActiveTranscriptMb,hint:t.maxActiveTranscriptMbHint,value:Number((_.maxActiveTranscriptBytes/1e6).toFixed(3)),min:.064,step:.1,onChange:e=>y({maxActiveTranscriptBytes:Math.max(64e3,Math.round(e*1e6))})}),(0,Z.jsx)($,{id:`compaction-summary-max-tokens`,label:t.summaryMaxTokens,hint:t.summaryMaxTokensHint,value:_.summaryMaxTokens,min:256,step:256,onChange:e=>y({summaryMaxTokens:Math.floor(e)})}),(0,Z.jsx)($,{id:`compaction-summary-chunk-tokens`,label:t.summaryChunkTokens,hint:t.summaryChunkTokensHint,value:_.summaryChunkTokens,min:1e3,step:1e3,onChange:e=>y({summaryChunkTokens:Math.floor(e)})}),(0,Z.jsx)($,{id:`compaction-summary-timeout`,label:t.summaryTimeoutSeconds,hint:t.summaryTimeoutSecondsHint.replace(`{{seconds}}`,String(I)),value:_.summaryTimeoutMs/1e3,min:1,max:600,onChange:e=>y({summaryTimeoutMs:Math.round(e*1e3)})}),(0,Z.jsx)($,{id:`compaction-summary-retries`,label:t.summaryRetries,hint:t.summaryRetriesHint,value:_.summaryRetries,min:0,max:5,onChange:e=>y({summaryRetries:Math.floor(e)})}),(0,Z.jsx)($,{id:`compaction-min-tool-result-chars`,label:t.minToolResultKeepChars,hint:t.minToolResultKeepCharsHint,value:_.minToolResultKeepChars,min:200,step:100,onChange:e=>y({minToolResultKeepChars:Math.floor(e)})})]}),P?(0,Z.jsx)(`p`,{className:`rounded-lg bg-amber-50 px-3 py-2 text-xs text-amber-950 dark:bg-amber-950/40 dark:text-amber-100`,children:t.summaryBudgetWarning}):null,(0,Z.jsxs)(`div`,{className:`rounded-xl bg-surface-base/45 p-4`,children:[(0,Z.jsx)(`div`,{className:`text-sm font-medium text-fg`,children:t.postCompactionSections}),(0,Z.jsx)(`p`,{className:`mt-1 text-xs text-fg-subtle`,children:t.postCompactionSectionsHint}),_.postCompactionSections.length>0?(0,Z.jsx)(`div`,{className:`mt-3 flex flex-wrap gap-2`,children:_.postCompactionSections.map(e=>(0,Z.jsxs)(`span`,{className:`inline-flex items-center gap-1.5 rounded-lg border border-edge bg-surface-panel px-2.5 py-1.5 text-xs text-fg`,children:[e,(0,Z.jsx)(`button`,{type:`button`,className:l(`text-fg-muted hover:text-fg`,H.press),"aria-label":t.removeSection.replace(`{{section}}`,e),onClick:()=>y({postCompactionSections:_.postCompactionSections.filter(t=>t!==e)}),children:(0,Z.jsx)(z,{className:`size-3.5`,"aria-hidden":!0})})]},e))}):(0,Z.jsx)(`p`,{className:`mt-3 text-xs text-fg-muted`,children:t.postCompactionSectionsEmpty}),(0,Z.jsxs)(`div`,{className:`mt-3 flex gap-2`,children:[(0,Z.jsx)(`input`,{className:Ze(),value:d,maxLength:120,disabled:_.postCompactionSections.length>=12,placeholder:t.postCompactionSectionsPlaceholder,onChange:e=>p(e.target.value),onKeyDown:e=>{e.key===`Enter`&&(e.preventDefault(),B())}}),(0,Z.jsxs)(C,{type:`button`,variant:`secondary`,disabled:!d.trim()||_.postCompactionSections.length>=12,onClick:B,children:[(0,Z.jsx)(W,{className:`size-4`,"aria-hidden":!0}),t.addSection]})]})]})]})})]})]})}function rt(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function it(e){return e===`main`||e===`per-peer`||e===`per-channel-peer`||e===`per-account-channel-peer`?e:`main`}function at(e){let t=rt(e)?e:{},n=rt(t.session)?t.session:{},r=rt(n.storage)?n.storage:{},i=typeof r.pruneAfterDays==`number`&&Number.isFinite(r.pruneAfterDays)?Math.max(0,Math.floor(r.pruneAfterDays)):typeof r.pruneAfterMs==`number`&&Number.isFinite(r.pruneAfterMs)?Math.max(0,Math.round(r.pruneAfterMs/864e5)):null,a=typeof r.maxEntries==`number`&&Number.isFinite(r.maxEntries)?Math.max(1,Math.floor(r.maxEntries)):null;return{dmScope:it(n.dmScope),pruneAfterDays:i,maxEntries:a}}async function ot(e){await p(u(`/api/config`),{method:`PATCH`,body:JSON.stringify({session:{dmScope:e.dmScope,storage:{pruneAfterMs:e.pruneAfterDays===null?null:e.pruneAfterDays*864e5,maxEntries:e.maxEntries}}})}),T()}function st(){return l(`w-full rounded-lg border border-edge bg-surface-panel px-3 py-2 text-sm text-fg`,M,`dark:border-edge`)}var ct=ue();function lt({hasToken:e}){let t=c(f(e=>e.language)).sessions.config,{data:n,isLoading:r}=E(e),i=(0,X.useMemo)(()=>n?.payload?.config===void 0?null:at(n.payload.config),[n]),[s,l]=(0,X.useReducer)(ct,{form:null,baseline:null}),u=s.form,d=s.baseline,p=(0,X.useRef)(!1),m=(0,X.useRef)(u);m.current=u;let h=(0,X.useRef)(null);de({enabled:e,parsed:i,dirty:p.current,trackedParsedRef:h,dispatch:l,onResetDirty:()=>{p.current=!1}});let g=!!(u&&d&&JSON.stringify(u)!==JSON.stringify(d)),_=(0,X.useCallback)(e=>{p.current=!0,l({type:`patch`,patch:e})},[]),v=Y({value:u,dirty:g,onSave:(0,X.useCallback)(async e=>{try{await ot(e),l({type:`saved`,value:e}),p.current=!!(m.current&&JSON.stringify(m.current)!==JSON.stringify(e))}catch(e){throw Error(e instanceof Error?e.message:t.saveError)}},[t.saveError])});return!e||!u?r?(0,Z.jsx)(J,{children:(0,Z.jsxs)(`div`,{className:`space-y-3`,"aria-busy":!0,children:[(0,Z.jsx)(w,{className:`h-5 w-40`}),(0,Z.jsx)(w,{className:`h-24 w-full rounded-xl`})]})}):null:(0,Z.jsxs)(J,{onBlurCapture:v.onBlurCapture,children:[(0,Z.jsx)(De,{icon:fe,title:t.title,subtitle:t.hint,trailing:(0,Z.jsx)(Oe,{status:v.status,error:v.error})}),(0,Z.jsxs)(`div`,{className:`grid gap-4 sm:grid-cols-2`,children:[(0,Z.jsx)(U,{title:t.dmScope,summary:u.dmScope,children:(0,Z.jsxs)(`div`,{className:`sm:col-span-2`,children:[(0,Z.jsx)(`label`,{className:`mb-1 block text-sm font-medium text-fg`,children:t.dmScope}),(0,Z.jsxs)(a,{className:st(),value:u.dmScope,onChange:e=>_({dmScope:e.target.value}),children:[(0,Z.jsx)(o,{value:`main`,children:t.dmScopeMain}),(0,Z.jsx)(o,{value:`per-peer`,children:t.dmScopePerPeer}),(0,Z.jsx)(o,{value:`per-channel-peer`,children:t.dmScopePerChannelPeer}),(0,Z.jsx)(o,{value:`per-account-channel-peer`,children:t.dmScopePerAccountChannelPeer})]}),(0,Z.jsx)(`p`,{className:`mt-1 text-xs text-fg-subtle`,children:t.dmScopeHint})]})}),(0,Z.jsxs)(`div`,{children:[(0,Z.jsx)(`label`,{className:`mb-1 block text-sm font-medium text-fg`,children:t.pruneAfterDays}),(0,Z.jsx)(q,{allowEmpty:!0,type:`number`,min:0,className:st(),value:u.pruneAfterDays??``,placeholder:t.unsetPlaceholder,onChange:e=>{let t=e.target.value.trim();_({pruneAfterDays:t===``?null:Math.max(0,Math.floor(Number(t)||0))})}})]}),(0,Z.jsx)(U,{title:t.maxEntries,summary:u.maxEntries??t.unsetPlaceholder,children:(0,Z.jsxs)(`div`,{children:[(0,Z.jsx)(`label`,{className:`mb-1 block text-sm font-medium text-fg`,children:t.maxEntries}),(0,Z.jsx)(q,{allowEmpty:!0,type:`number`,min:1,className:st(),value:u.maxEntries??``,placeholder:t.unsetPlaceholder,onChange:e=>{let t=e.target.value.trim();_({maxEntries:t===``?null:Math.max(1,Math.floor(Number(t)||1))})}})]})})]})]})}function ut(e){if(typeof e==`string`)return e.length>2e3?`${e.slice(0,2e3)}…`:e;try{let t=JSON.stringify(e,null,2);return t.length>2e3?`${t.slice(0,2e3)}…`:t}catch{return String(e)}}function dt(e){let t=(0,Ae.c)(60),{open:n,loading:r,session:i,sessionAgentId:a,sessionAgentAvatar:o,labels:s,onClose:c,onArchive:u,onUnarchive:d,onPin:f,onUnpin:p,onExport:m,onDelete:h}=e,g=i?.status===`archived`,_=i?.status===`pinned`,v;t[0]===c?v=t[1]:(v=e=>!e&&c(),t[0]=c,t[1]=v);let ee;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(ee=(0,Z.jsx)(ae,{className:l(`xopc-dialog-overlay fixed inset-0 bg-scrim`,A)}),t[2]=ee):ee=t[2];let y;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(y=l(`xopc-drawer-right fixed right-0 top-0 flex size-full max-w-lg flex-col border-l border-edge bg-surface-overlay shadow-popover outline-none`,k,`dark:border-edge`),t[3]=y):y=t[3];let b;t[4]!==i||t[5]!==o||t[6]!==a?(b=i&&a?(0,Z.jsx)(G,{agentId:a,avatar:o,size:40,className:`size-10 shrink-0 ring-1 ring-edge/60 dark:ring-edge`}):null,t[4]=i,t[5]=o,t[6]=a,t[7]=b):b=t[7];let x;t[8]!==s.unnamedSession||t[9]!==i?.name?(x=i?.name?.trim()||s.unnamedSession,t[8]=s.unnamedSession,t[9]=i?.name,t[10]=x):x=t[10];let S;t[11]===x?S=t[12]:(S=(0,Z.jsx)(N,{className:`min-w-0 flex-1 truncate text-base font-semibold tracking-tight text-fg`,children:x}),t[11]=x,t[12]=S);let w;t[13]!==b||t[14]!==S?(w=(0,Z.jsxs)(`div`,{className:`flex min-w-0 flex-1 items-center gap-3`,children:[b,S]}),t[13]=b,t[14]=S,t[15]=w):w=t[15];let T;t[16]===Symbol.for(`react.memo_cache_sentinel`)?(T=(0,Z.jsx)(z,{className:`size-5`,strokeWidth:1.75}),t[16]=T):T=t[16];let E;t[17]===s.close?E=t[18]:(E=(0,Z.jsx)(F,{asChild:!0,children:(0,Z.jsx)(C,{type:`button`,variant:`ghost`,className:`size-9 shrink-0 p-0`,"aria-label":s.close,children:T})}),t[17]=s.close,t[18]=E);let D;t[19]!==w||t[20]!==E?(D=(0,Z.jsxs)(`div`,{className:`flex min-w-0 shrink-0 items-center justify-between gap-2 border-b border-edge px-4 py-3 dark:border-edge`,children:[w,E]}),t[19]=w,t[20]=E,t[21]=D):D=t[21];let O;t[22]!==s.detailLoading||t[23]!==s.detailMessages||t[24]!==r||t[25]!==i?(O=r?(0,Z.jsx)(`p`,{className:`text-sm text-fg-muted`,children:s.detailLoading}):i?(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsxs)(`dl`,{className:`mb-4 grid gap-2 text-xs text-fg-muted`,children:[(0,Z.jsxs)(`div`,{children:[(0,Z.jsx)(`dt`,{className:`text-fg-disabled`,children:`Key`}),(0,Z.jsx)(`dd`,{className:`mt-0.5 break-all font-mono text-fg`,children:i.key})]}),(0,Z.jsx)(`div`,{className:`flex flex-wrap gap-4`,children:(0,Z.jsxs)(`span`,{children:[i.messageCount,` msgs · `,i.estimatedTokens,` tok`]})})]}),(0,Z.jsx)(`h3`,{className:`mb-2 text-xs font-medium uppercase tracking-wide text-fg-subtle`,children:s.detailMessages}),(0,Z.jsx)(`ul`,{className:`space-y-3`,children:i.messages.map(ft)})]}):null,t[22]=s.detailLoading,t[23]=s.detailMessages,t[24]=r,t[25]=i,t[26]=O):O=t[26];let j;t[27]===O?j=t[28]:(j=(0,Z.jsx)(`div`,{className:`min-h-0 flex-1 overflow-y-auto px-4 py-3`,children:O}),t[27]=O,t[28]=j);let M;t[29]!==s.detailExport||t[30]!==m?(M=(0,Z.jsx)(C,{type:`button`,variant:`secondary`,className:`text-sm`,onClick:m,children:s.detailExport}),t[29]=s.detailExport,t[30]=m,t[31]=M):M=t[31];let P;t[32]!==g||t[33]!==s.archive||t[34]!==s.unarchive||t[35]!==u||t[36]!==d?(P=g?(0,Z.jsx)(C,{type:`button`,variant:`secondary`,className:`text-sm`,onClick:d,children:s.unarchive}):(0,Z.jsx)(C,{type:`button`,variant:`secondary`,className:`text-sm`,onClick:u,children:s.archive}),t[32]=g,t[33]=s.archive,t[34]=s.unarchive,t[35]=u,t[36]=d,t[37]=P):P=t[37];let I;t[38]!==_||t[39]!==s.pin||t[40]!==s.unpin||t[41]!==f||t[42]!==p?(I=_?(0,Z.jsx)(C,{type:`button`,variant:`secondary`,className:`text-sm`,onClick:p,children:s.unpin}):(0,Z.jsx)(C,{type:`button`,variant:`secondary`,className:`text-sm`,onClick:f,children:s.pin}),t[38]=_,t[39]=s.pin,t[40]=s.unpin,t[41]=f,t[42]=p,t[43]=I):I=t[43];let L;t[44]!==s.delete||t[45]!==h?(L=(0,Z.jsx)(C,{type:`button`,variant:`secondary`,className:`text-sm text-red-600 hover:bg-red-50 dark:text-red-400 dark:hover:bg-red-950/40`,onClick:h,children:s.delete}),t[44]=s.delete,t[45]=h,t[46]=L):L=t[46];let B;t[47]!==M||t[48]!==P||t[49]!==I||t[50]!==L?(B=(0,Z.jsx)(`div`,{className:`shrink-0 border-t border-edge px-4 py-3 dark:border-edge`,children:(0,Z.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[M,P,I,L]})}),t[47]=M,t[48]=P,t[49]=I,t[50]=L,t[51]=B):B=t[51];let V;t[52]!==D||t[53]!==j||t[54]!==B?(V=(0,Z.jsxs)(we,{children:[ee,(0,Z.jsxs)(R,{className:y,"aria-describedby":void 0,children:[D,j,B]})]}),t[52]=D,t[53]=j,t[54]=B,t[55]=V):V=t[55];let H;return t[56]!==n||t[57]!==v||t[58]!==V?(H=(0,Z.jsx)(ne,{open:n,onOpenChange:v,children:V}),t[56]=n,t[57]=v,t[58]=V,t[59]=H):H=t[59],H}function ft(e){return(0,Z.jsxs)(`li`,{className:`rounded-lg border border-edge-subtle bg-surface-hover/50 p-2 dark:border-edge`,children:[(0,Z.jsx)(`div`,{className:`mb-1 text-[10px] font-medium uppercase text-fg-subtle`,children:e.role}),(0,Z.jsx)(`pre`,{className:`max-h-40 overflow-auto whitespace-pre-wrap break-words font-mono text-[11px] leading-relaxed text-fg-muted`,children:ut(e.content)})]},`${e.timestamp??``}-${e.role}-${ut(e.content).slice(0,24)}`)}var pt=20;function mt(e,t){return e.replace(/\{\{(\w+)\}\}/g,(e,n)=>String(t[n]??``))}var ht=new Set([`all`,`active`,`pinned`,`archived`]),gt=new Set([`grid`,`list`]),_t=[`sessions`,`settings`];function vt(e){return e&&_t.includes(e)?e:`sessions`}function yt(e,t){return t===`sessions`?e.tabsSessions:e.tabsSettings}function bt(e,t){return t===`sessions`?e.tabsSessionsHint:e.tabsSettingsHint}function xt(e){let t=(0,Ae.c)(7),{s:n,activeTab:r,onChange:i}=e,a;t[0]===n?a=t[1]:(a=_t.map(e=>({id:e,label:yt(n,e),icon:e===`sessions`?he:Se})),t[0]=n,t[1]=a);let o=a,s;return t[2]!==r||t[3]!==o||t[4]!==i||t[5]!==n.tabsAriaLabel?(s=(0,Z.jsx)(le,{items:o,activeTab:r,onChange:i,ariaLabel:n.tabsAriaLabel,tabIdPrefix:`sessions-tab`,panelIdPrefix:`sessions-panel`}),t[2]=r,t[3]=o,t[4]=i,t[5]=n.tabsAriaLabel,t[6]=s):s=t[6],s}function St(e){let t=(0,Ae.c)(10),{s:n,id:r,activeTab:i,plain:a,children:o}=e,s=a===void 0?!1:a;if(i!==r)return null;let c=`sessions-panel-${r}`,l=`sessions-tab-${r}`,u=s?`contents`:`rounded-xl bg-surface-hover/20 px-4 py-5 sm:px-5`,d;t[0]!==o||t[1]!==r||t[2]!==s||t[3]!==n?(d=s?o:(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsxs)(`div`,{className:`mb-5`,children:[(0,Z.jsx)(`div`,{className:`text-sm font-semibold text-fg`,children:yt(n,r)}),(0,Z.jsx)(`p`,{className:`mt-1 text-xs text-fg-subtle`,children:bt(n,r)})]}),(0,Z.jsx)(`div`,{className:`space-y-4`,children:o})]}),t[0]=o,t[1]=r,t[2]=s,t[3]=n,t[4]=d):d=t[4];let f;return t[5]!==c||t[6]!==l||t[7]!==u||t[8]!==d?(f=(0,Z.jsx)(`section`,{id:c,role:`tabpanel`,"aria-labelledby":l,className:u,children:d}),t[5]=c,t[6]=l,t[7]=u,t[8]=d,t[9]=f):f=t[9],f}function Ct(e){let t=e.get(`status`),n=e.get(`view`);return{searchInput:e.get(`q`)??``,debouncedSearch:(e.get(`q`)??``).trim(),statusFilter:ht.has(t)?t:`all`,viewMode:gt.has(n)?n:`grid`,channelFilter:(e.get(`channel`)??``).trim(),sessions:[],loading:!1,error:null,hasMore:!1,stats:null,detailOpen:!1,detailLoading:!1,detailSession:null,confirmOpen:!1,confirmKey:null}}function wt(){let e=c(f(e=>e.language)),t=e.sessions,n=d(e=>e.conversationId),r=!!n,{data:a,mutate:o}=S(r?[`gateway-chat-agents`,n]:null,be,{revalidateOnFocus:!1}),s=a?.defaultId??`main`,u=a?.items??[],[p,w]=i(),T=vt(p.get(`tab`)),E=(0,X.useCallback)(e=>{let t=new URLSearchParams(p);e===`sessions`?t.delete(`tab`):t.set(`tab`,e),w(t,{replace:!0})},[p,w]),[D,O]=(0,X.useReducer)(ve,p,Ct),{searchInput:j,debouncedSearch:M,statusFilter:P,viewMode:F,channelFilter:I,sessions:z,loading:U,error:oe,hasMore:W,stats:G,detailOpen:le,detailLoading:ue,detailSession:K,confirmOpen:de,confirmKey:fe}=D;(0,X.useEffect)(()=>{let e=setTimeout(()=>{let e=j.trim();M!==e&&O({type:`patch`,patch:{debouncedSearch:e}})},300);return()=>clearTimeout(e)},[j,M]);let pe=p.toString(),me=(0,X.useRef)(pe);if(me.current!==pe){me.current=pe;let e=p.get(`q`)??``,t=p.get(`status`),n=p.get(`view`),r=(p.get(`channel`)??``).trim(),i=ht.has(t)?t:`all`,a=gt.has(n)?n:`grid`,o=e.trim();O({type:`patch`,patch:{...j===e?{}:{searchInput:e},...M===o?{}:{debouncedSearch:o},...P===i?{}:{statusFilter:i},...F===a?{}:{viewMode:a},...I===r?{}:{channelFilter:r}}})}(0,X.useEffect)(()=>{let e=new URLSearchParams(p),t=M.trim();t?e.set(`q`,t):e.delete(`q`),P===`all`?e.delete(`status`):e.set(`status`,P),F===`grid`?e.delete(`view`):e.set(`view`,F),I?e.set(`channel`,I):e.delete(`channel`),e.toString()!==p.toString()&&w(e,{replace:!0})},[M,p,w,P,F,I]),(0,X.useEffect)(()=>{if(!r||T!==`sessions`)return;let e=!1;return(async()=>{O({type:`patch`,patch:{loading:!0,error:null}});try{let t=await b({limit:pt,offset:0,...M?{search:M}:{},...P===`all`?{}:{status:P},...I?{channel:I}:{}});if(e)return;O({type:`patch`,patch:{sessions:t.items,hasMore:t.hasMore}})}catch(n){e||O({type:`patch`,patch:{error:n instanceof Error?n.message:t.loadError}})}finally{e||O({type:`patch`,patch:{loading:!1}})}})(),()=>{e=!0}},[r,T,M,P,I,t.loadError]),(0,X.useEffect)(()=>{!r||T!==`sessions`||v().then(e=>O({type:`patch`,patch:{stats:e}})).catch(()=>{})},[r,T]),(0,X.useEffect)(()=>{if(!r||T!==`sessions`)return;let e=()=>void o();return window.addEventListener(`config-reload`,e),()=>window.removeEventListener(`config-reload`,e)},[r,T,o]),(0,X.useEffect)(()=>{if(!r||T!==`sessions`)return;let e=e=>{let t=e.detail;!t?.key||t.name===void 0||O({type:`patch`,patch:{sessions:z.map(e=>e.key===t.key?{...e,name:t.name}:e),detailSession:K&&K.key===t.key?{...K,name:t.name}:K}})};return window.addEventListener(`session-updated`,e),()=>{window.removeEventListener(`session-updated`,e)}},[r,T,z,K]);let _e=(0,X.useCallback)(async()=>{if(!(!r||U||!W)){O({type:`patch`,patch:{loading:!0,error:null}});try{let e=await b({limit:pt,offset:z.length,...M?{search:M}:{},...P===`all`?{}:{status:P},...I?{channel:I}:{}});O({type:`patch`,patch:{sessions:[...z,...e.items],hasMore:e.hasMore}})}catch(e){O({type:`patch`,patch:{error:e instanceof Error?e.message:t.loadError}})}finally{O({type:`patch`,patch:{loading:!1}})}}},[r,U,W,z.length,M,P,I,t.loadError]),ye=(0,X.useCallback)((e,t)=>{O({type:`patch`,patch:{sessions:z.map(n=>n.key===e?{...n,status:t}:n),detailSession:K&&K.key===e?{...K,status:t}:K}})},[z,K]),Se=(0,X.useCallback)(async e=>{O({type:`patch`,patch:{detailOpen:!0,detailLoading:!0,detailSession:null}});try{O({type:`patch`,patch:{detailSession:await m(e)}})}catch{O({type:`patch`,patch:{detailOpen:!1}})}finally{O({type:`patch`,patch:{detailLoading:!1}})}},[]),Ce=e=>{Se(e)},q=async(e,t)=>{if(t===`continue`){window.dispatchEvent(new CustomEvent(`navigate-to-chat`,{detail:{conversationId:e},bubbles:!0}));return}if(t===`delete`){O({type:`patch`,patch:{confirmKey:e,confirmOpen:!0}});return}try{switch(t){case`archive`:await x(e),ye(e,`archived`);break;case`unarchive`:await g(e),ye(e,`active`);break;case`pin`:await h(e),ye(e,`pinned`);break;case`unpin`:await ee(e),ye(e,`active`);break;case`export`:{let t=await y(e),n=new Blob([t],{type:`application/json`}),r=URL.createObjectURL(n),i=document.createElement(`a`);i.href=r,i.download=`session-${e.replace(/[^a-z0-9]/gi,`_`)}.json`,document.body.appendChild(i),i.click(),document.body.removeChild(i),URL.revokeObjectURL(r);break}default:break}v().then(e=>O({type:`patch`,patch:{stats:e}})).catch(()=>{})}catch{}},De=async e=>{try{await _(e),O({type:`patch`,patch:{sessions:z.filter(t=>t.key!==e),detailSession:K?.key===e?null:K,...K?.key===e?{detailOpen:!1}:{}}}),v().then(e=>O({type:`patch`,patch:{stats:e}})).catch(()=>{})}catch{}},J={continueChat:t.continueChat,archive:t.archive,unarchive:t.unarchive,pin:t.pin,unpin:t.unpin,export:t.export,delete:t.delete,tokens:t.tokens,cost:t.cost,costPartial:t.costPartial,costUnknown:t.costUnknown,noUsage:t.noUsage,unnamedSession:e.chat.newSession},Oe={close:t.close,detailLoading:t.detailLoading,detailMessages:t.detailMessages,detailExport:t.detailExport,archive:t.archive,unarchive:t.unarchive,pin:t.pin,unpin:t.unpin,delete:t.delete,unnamedSession:e.chat.newSession},Y=[{key:`all`,label:t.filterAll,icon:he},{key:`active`,label:t.filterActive,icon:xe},{key:`pinned`,label:t.filterPinned,icon:B},{key:`archived`,label:t.filterArchived,icon:re}],ke=(()=>{let e=Object.entries(G?.byChannel??{}).sort((e,t)=>t[1]-e[1]).slice(0,6).map(([e])=>e),t=new Set(e);for(let n of[`telegram`,`weixin`,`feishu`])t.has(n)||(e.push(n),t.add(n));return e.slice(0,8)})();return r?(0,Z.jsxs)(`div`,{className:`flex min-h-0 min-w-0 flex-1 flex-col overflow-x-hidden bg-surface-panel`,children:[(0,Z.jsxs)(Ee,{gap:`gap-6`,children:[(0,Z.jsx)(Te,{title:t.title}),(0,Z.jsx)(xt,{s:t,activeTab:T,onChange:E}),(0,Z.jsx)(St,{s:t,id:`settings`,activeTab:T,plain:!0,children:(0,Z.jsxs)(`div`,{className:`space-y-4`,children:[(0,Z.jsx)(nt,{hasToken:r}),(0,Z.jsx)(lt,{hasToken:r})]})}),(0,Z.jsxs)(St,{s:t,id:`sessions`,activeTab:T,plain:!0,children:[(0,Z.jsxs)(`div`,{className:`flex flex-col gap-3 lg:flex-row lg:items-center lg:justify-between`,children:[(0,Z.jsx)(se,{className:`flex flex-wrap gap-2`,role:`group`,"aria-label":t.tabsSessions,indicatorClassName:`rounded-xl bg-accent-soft`,children:Y.map(({key:e,label:t,icon:n})=>(0,Z.jsxs)(`button`,{type:`button`,"aria-pressed":P===e,onClick:()=>O({type:`patch`,patch:{statusFilter:e}}),className:l(`inline-flex items-center gap-1.5 rounded-xl px-3 py-2 text-sm font-medium`,H.transition,H.focusRingPanel,P===e?`bg-accent-soft text-accent-fg`:`bg-surface-base text-fg-muted hover:bg-surface-hover hover:text-fg dark:bg-surface-hover/35`),children:[(0,Z.jsx)(n,{className:`size-4`,strokeWidth:1.75,"aria-hidden":!0}),t]},e))}),(0,Z.jsxs)(`div`,{className:`flex min-h-11 w-full min-w-0 items-center gap-2 rounded-xl bg-surface-base focus-within:ring-2 focus-within:ring-accent px-3 py-2 transition-colors lg:max-w-md dark:bg-surface-hover/40`,children:[(0,Z.jsx)(V,{className:`size-4 shrink-0 text-fg-disabled`,strokeWidth:1.75,"aria-hidden":!0}),(0,Z.jsx)(`input`,{type:`search`,value:j,onChange:e=>O({type:`patch`,patch:{searchInput:e.target.value}}),placeholder:t.searchPlaceholder,"aria-label":t.searchPlaceholder,"data-debounced-query":M||void 0,className:`min-w-0 flex-1 border-0 bg-transparent text-base sm:text-sm text-fg placeholder:text-fg-disabled focus:outline-none focus:ring-0`})]})]}),(0,Z.jsxs)(se,{className:`flex flex-wrap items-center gap-2`,role:`group`,"aria-label":t.filterChannelLabel,indicatorClassName:`rounded-xl bg-accent-soft`,children:[(0,Z.jsx)(`span`,{className:`text-xs font-medium text-fg-subtle`,children:t.filterChannelLabel}),(0,Z.jsx)(`button`,{type:`button`,"aria-pressed":!I,onClick:()=>O({type:`patch`,patch:{channelFilter:``}}),className:l(`touch-target inline-flex items-center rounded-xl px-3 py-2 text-sm font-medium`,H.transition,H.focusRingPanel,I?`bg-surface-base text-fg-muted hover:bg-surface-hover hover:text-fg dark:bg-surface-hover/35`:`bg-accent-soft text-accent-fg`),children:t.filterChannelAll}),ke.map(e=>(0,Z.jsxs)(`button`,{type:`button`,"aria-pressed":I===e,onClick:()=>O({type:`patch`,patch:{channelFilter:e}}),className:l(`touch-target inline-flex items-center rounded-xl px-3 py-2 text-sm font-medium`,H.transition,H.focusRingPanel,I===e?`bg-accent-soft text-accent-fg`:`bg-surface-base text-fg-muted hover:bg-surface-hover hover:text-fg dark:bg-surface-hover/35`),children:[e,G?.byChannel?.[e]==null?null:(0,Z.jsx)(`span`,{className:`ml-2 rounded-full bg-surface-hover px-2 py-0.5 text-[11px] text-fg-subtle`,children:G.byChannel[e]})]},e))]}),G?(0,Z.jsx)(`div`,{className:`grid grid-cols-2 gap-3 sm:grid-cols-4`,children:[[G.totalSessions,t.totalSessions],[G.activeSessions,t.activeSessions],[G.pinnedSessions,t.pinnedSessions],[G.archivedSessions,t.archivedSessions]].map(([e,t])=>(0,Z.jsxs)(`div`,{className:`rounded-xl bg-surface-base p-3 dark:bg-surface-hover/30`,children:[(0,Z.jsx)(`div`,{className:`text-lg font-semibold tabular-nums text-fg`,children:e}),(0,Z.jsx)(`div`,{className:`text-xs text-fg-muted`,children:t})]},t))}):null,oe?(0,Z.jsx)(`div`,{className:`rounded-lg bg-red-50 px-3 py-2 text-sm text-red-700 dark:bg-red-950/40 dark:text-red-300`,children:oe}):null,(0,Z.jsxs)(`div`,{className:`flex items-center justify-between gap-2`,children:[(0,Z.jsx)(`p`,{className:`text-xs text-fg-muted`,children:mt(t.sessionCount,{count:z.length})}),(0,Z.jsxs)(se,{className:L,role:`group`,"aria-label":t.layoutToggleGroup,indicatorClassName:`rounded-pill bg-surface-panel shadow-sm dark:ring-1 dark:ring-edge-strong/40`,children:[(0,Z.jsx)(C,{type:`button`,variant:`segmented`,title:t.gridView,"aria-pressed":F===`grid`,onClick:()=>O({type:`patch`,patch:{viewMode:`grid`}}),className:l(ce,`size-7 p-0`,F===`grid`&&`bg-surface-panel shadow-sm dark:bg-surface-panel dark:shadow-sm dark:ring-1 dark:ring-edge-strong/40`,F===`grid`&&`text-accent-fg`),children:(0,Z.jsx)(ge,{className:`size-3.5`,strokeWidth:1.5})}),(0,Z.jsx)(C,{type:`button`,variant:`segmented`,title:t.listView,"aria-pressed":F===`list`,onClick:()=>O({type:`patch`,patch:{viewMode:`list`}}),className:l(ce,`size-9 p-0`,F===`list`&&`bg-surface-panel shadow-sm dark:bg-surface-panel dark:shadow-sm dark:ring-1 dark:ring-edge-strong/40`,F===`list`&&`text-accent-fg`),children:(0,Z.jsx)(te,{className:`size-3.5`,strokeWidth:1.5})})]})]}),U&&z.length===0?(0,Z.jsx)(`div`,{className:`grid grid-cols-1 gap-3 sm:grid-cols-2 lg:grid-cols-3`,children:Array.from({length:6}).map((e,t)=>(0,Z.jsx)(`div`,{className:`h-40 animate-pulse rounded-xl bg-surface-hover/60 dark:bg-surface-hover/40`},t))}):z.length===0?(0,Z.jsxs)(`div`,{className:`flex flex-col items-center justify-center rounded-2xl bg-surface-base py-16 text-center dark:bg-surface-hover/25`,children:[(0,Z.jsx)(ie,{className:`mb-3 size-12 text-fg-disabled`,strokeWidth:1.25,"aria-hidden":!0}),(0,Z.jsx)(`p`,{className:`text-base font-semibold text-fg`,children:t.noSessions}),(0,Z.jsx)(`p`,{className:`mt-1 max-w-sm text-sm text-fg-muted`,children:t.noSessionsDescription}),(0,Z.jsx)(C,{variant:`primary`,className:`mt-6`,onClick:()=>{window.dispatchEvent(new CustomEvent(`navigate-to-chat`,{detail:{conversationId:``},bubbles:!0}))},children:t.startNewChat})]}):(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(`div`,{className:l(`grid min-w-0 gap-3`,F===`grid`?`sm:grid-cols-2 lg:grid-cols-3`:`grid-cols-1`),"data-debounced-query":M||void 0,children:z.map(e=>{let t=ze(e,s);return(0,Z.jsx)(Pe,{session:e,variant:F,labels:J,sessionAgentId:t,sessionAgentAvatar:Be(t,u),onOpen:()=>Ce(e.key),onAction:t=>void q(e.key,t)},e.key)})}),W?(0,Z.jsx)(`div`,{className:`flex justify-center pt-2`,children:(0,Z.jsx)(C,{type:`button`,variant:`secondary`,disabled:U,onClick:()=>void _e(),children:t.loadMore})}):null]})]})]}),(0,Z.jsx)(dt,{open:le,loading:ue,session:K,sessionAgentId:K?ze(K,s):void 0,sessionAgentAvatar:K?Be(ze(K,s),u):void 0,labels:Oe,onClose:()=>{O({type:`patch`,patch:{detailOpen:!1,detailSession:null}})},onArchive:()=>K&&void q(K.key,`archive`),onUnarchive:()=>K&&void q(K.key,`unarchive`),onPin:()=>K&&void q(K.key,`pin`),onUnpin:()=>K&&void q(K.key,`unpin`),onExport:()=>K&&void q(K.key,`export`),onDelete:()=>K&&O({type:`patch`,patch:{confirmKey:K.key,confirmOpen:!0}})}),(0,Z.jsx)(ne,{open:de,onOpenChange:e=>O({type:`patch`,patch:{confirmOpen:e}}),children:(0,Z.jsxs)(we,{children:[(0,Z.jsx)(ae,{className:l(`xopc-dialog-overlay fixed inset-0 bg-scrim`,A)}),(0,Z.jsxs)(R,{className:l(`xopc-dialog-content fixed left-1/2 top-1/2 w-[min(100%-2rem,24rem)] -translate-x-1/2 -translate-y-1/2 rounded-xl border border-edge bg-surface-overlay p-4 shadow-popover dark:border-edge`,k),children:[(0,Z.jsx)(N,{className:`text-base font-semibold text-fg`,children:t.deleteSessionTitle}),(0,Z.jsx)(`p`,{className:`mt-2 text-sm text-fg-muted`,children:fe?mt(t.deleteSessionMessage,{name:z.find(e=>e.key===fe)?.name?.trim()||e.chat.newSession}):``}),(0,Z.jsxs)(`div`,{className:`mt-4 flex justify-end gap-2`,children:[(0,Z.jsx)(C,{type:`button`,variant:`secondary`,onClick:()=>O({type:`patch`,patch:{confirmOpen:!1}}),children:t.cancel}),(0,Z.jsx)(C,{type:`button`,variant:`primary`,className:`bg-red-600 hover:bg-red-700`,onClick:()=>{fe&&De(fe),O({type:`patch`,patch:{confirmOpen:!1,confirmKey:null}})},children:t.delete})]})]})]})})]}):(0,Z.jsx)(`div`,{className:`w-full px-3 py-16 text-center text-sm text-fg-muted sm:px-5 xl:px-6`,children:t.needToken})}export{wt as SessionsPage};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{Pn as e}from"./index-CiDVRMmX.js";function t(t){let{children:n,fallback:r}=t,i=r===void 0?null:r;return e()?n:i}export{t};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{a as t,n,t as r}from"./vendor-react-BOUWij0V.js";import{t as i}from"./chunk-KS7C4IRE-BvcCCgTW.js";import{t as a}from"./circle-check-C23XjkUj.js";import{t as o}from"./loader-circle-CifKLtgG.js";import{t as s}from"./messages-DMXSIJUO.js";import{t as c}from"./cn-0WouolD0.js";import{i as l,l as u,n as d,o as f}from"./locale-store-DAgpZxAS.js";import{i as p}from"./vendor-swr-BIWyz7Rc.js";import{t as m}from"./button-aIC072nz.js";import{t as h}from"./skeleton-BI5TyibZ.js";import{r as g}from"./gateway-config-swr-BVqYVaGy.js";import{n as _}from"./gateway-realtime-store-Dafw95ol.js";import{n as v,t as y}from"./registry-api-B6kqbuw8.js";import{n as b}from"./electron-env-Dit0bHgy.js";import{Eo as x,It as S,Iu as C,Md as w,Os as ee,Pl as T,Td as E,bn as D,ci as O,dl as k,ef as A,nl as j,wd as M}from"./index-CiDVRMmX.js";import{n as N,r as P}from"./settings-page-layout-Dx5S-Msc.js";import{n as F,t as I}from"./settings-form-section-BXeszXR7.js";import{t as L}from"./settings-advanced-gate-DLHGV-I-.js";import{r as R,t as z}from"./runtime-tools-api-CY3R7unQ.js";var B=n(),V=e(t(),1),H=r();function U(){let e=d(e=>e.language)===`zh`,t=s(e?`zh`:`en`).runtimeToolsSettings,{data:n,error:r,mutate:i}=p(l(`/api/runtime-tools`),z),[a,o]=(0,V.useState)(),[c,u]=(0,V.useState)(),f=n?.payload.statuses??[],g=f.some(e=>![`ready`,`disabled`,`unsupported`].includes(e.state));async function _(t,r){o(t),u(void 0);try{await R({runtime:t,action:r?`repair`:`install`,version:n?.payload.config[t].version,onProgress:e=>u(e.message)}),await i(),u(e?`操作完成,已刷新执行环境状态。`:`Completed and refreshed environment status.`)}catch(e){u(e instanceof Error?e.message:String(e))}finally{o(void 0)}}return(0,H.jsxs)(`details`,{open:g||void 0,className:`rounded-xl bg-surface-hover/20 p-4`,children:[(0,H.jsxs)(`summary`,{className:`cursor-pointer text-sm font-medium text-fg`,children:[e?`执行环境状态`:`Execution environment status`,n?` · ${f.filter(e=>e.state===`ready`).length}/${f.length}`:``]}),r?(0,H.jsxs)(`div`,{role:`alert`,className:`mt-3 text-sm text-danger`,children:[t.loadError,(0,H.jsx)(m,{variant:`ghost`,onClick:()=>void i(),children:t.refresh})]}):n?(0,H.jsx)(`div`,{className:`mt-3 space-y-3`,children:f.map(e=>(0,H.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-3`,children:[(0,H.jsxs)(`div`,{className:`min-w-0`,children:[(0,H.jsx)(`p`,{className:`text-sm text-fg`,children:t.runtimeNames[e.runtime]}),(0,H.jsx)(`p`,{className:`text-xs text-fg-muted`,children:e.message})]}),n.payload.config.enabled&&n.payload.config[e.runtime].enabled&&![`ready`,`disabled`,`unsupported`,`installing`].includes(e.state)?(0,H.jsx)(m,{disabled:!!a,onClick:()=>void _(e.runtime,e.repairable),children:a===e.runtime?t.working:e.repairable?t.repair:t.install}):null]},e.runtime))}):(0,H.jsx)(h,{className:`mt-3 h-20`}),c?(0,H.jsx)(`p`,{role:`status`,className:`mt-3 text-xs text-fg-muted`,children:c}):null]})}function W(e){if(!e||typeof e!=`object`)return 0;let t=e.providers;return!t||typeof t!=`object`||Array.isArray(t)?0:Object.values(t).filter(e=>typeof e==`string`&&x(e)).length}function G(e){if(!e||typeof e!=`object`)return``;let t=e.agents;if(!t||typeof t!=`object`||Array.isArray(t))return``;let n=t.defaults,r=n&&typeof n==`object`&&!Array.isArray(n)?n.models:void 0;if(!r||typeof r!=`object`||Array.isArray(r))return``;let i=r.chat;if(!i||typeof i!=`object`||Array.isArray(i))return``;let a=i.primary;return typeof a==`string`?a.trim():``}function K(e){if(!e||typeof e!=`object`)return!1;let t=e.channels;return!t||typeof t!=`object`||Array.isArray(t)?!1:Object.values(t).some(e=>{if(!e||typeof e!=`object`||Array.isArray(e))return!1;let t=e;if(`configured`in t||`config`in t||`schema`in t||`uiHints`in t){if(t.configured===!0)return!0;let e=t.config;if(!e||typeof e!=`object`||Array.isArray(e))return!1;let n=e;return n.enabled===!0||Object.keys(n).length>0}return t.enabled===!0||Object.keys(t).length>0})}function q(e){if(!e||typeof e!=`object`)return{enabled:!1,driverKind:`extension`};let t=e.browser;if(!t||typeof t!=`object`||Array.isArray(t))return{enabled:!1,driverKind:`extension`};let n=t,r=n.driver&&typeof n.driver==`object`&&!Array.isArray(n.driver)?n.driver:void 0;return{enabled:n.enabled===!0,driverKind:typeof r?.kind==`string`&&r.kind.trim()?r.kind.trim():`extension`}}function J(e){return e?`pass`:`fail`}function te(e){if(e===`tool-runtimes`)return`/settings/runtimes`;if(e===`provider-auth`)return`/settings/capabilities/models`;if(e===`config-health`)return`/settings/gateway`;if(e===`state-integrity`||e===`workspace-status`)return`/capabilities/agents`;if(e===`database-schema`||e===`session-integrity`)return`/settings/sessions`;if(e===`channel-config`||e===`channel-pairing-pending`||e.startsWith(`channel:`))return`/capabilities/channels`;if(e===`security-audit`||e===`gateway-service`||e===`gateway-health`)return`/settings/gateway`;if(e===`version-check`)return`/settings/desktop-app`}function Y(e){return{fail:4,warn:3,skip:2,pass:1}[e]}function X(e,t){let n=e.match(/^Run(?::|\s)(.*)$/i);if(n?.[1])return t.runCommand(n[1].trim());let r=e.match(/^Install(?::|\s)(.*)$/i);if(r?.[1])return t.installCommand(r[1].trim());let i=e.match(/^Start(?::|\s)(.*)$/i);return i?.[1]?t.startCommand(i[1].trim()):e}function Z(e,t){if(!t)return e;let n=e.message;if(e.id===`tool-runtimes`){let r=e.message.match(/^(.*) runtime is not installed\.$/),i=e.message.match(/^(.*) runtime installation is invalid\.$/);r?.[1]?n=t.runtimeMissing(r[1]):i?.[1]&&(n=t.runtimeInvalid(i[1]))}else if(e.id===`gateway-service`)if(e.message===`Gateway is not installed as a system service.`)n=t.gatewayNotInstalled;else{let r=e.message.match(/^Service backend unavailable: (.*)$/),i=e.message.match(/^Gateway service is installed but not running \(status: (.*)\)\.$/);r?.[1]?n=t.gatewayUnavailable(r[1]):i?.[1]&&(n=t.gatewayNotRunning(i[1]))}else e.id===`provider-auth`&&e.message===`No API keys detected for configured providers.`&&(n=t.providerAuthMissing);return{...e,label:t.labels[e.id]??e.label,message:n,hints:e.hints.map(e=>X(e,t))}}function ne(e,t){return e.filter(e=>e.status===`fail`||e.status===`warn`).map(e=>{let n=Z(e,t);return{id:n.id,label:n.label,status:n.status,message:n.message,hints:n.hints,path:te(n.id),source:`doctor`}}).toSorted((e,t)=>Y(t.status)-Y(e.status)||e.label.localeCompare(t.label))}function re(e){let t=new Map(e.doctorChecks.map(e=>[e.id,e])),n=[];for(let r of[`security-audit`,`channel-config`,`channel-pairing-pending`,`gateway-health`]){let i=t.get(r);if(i){let t=Z(i,e.copy);n.push({id:t.id,label:t.label,status:t.status,message:t.message,path:te(t.id)})}}if(e.logsHealth){let t=e.logsHealth.stats?.errorsLast24h??0;n.push({id:`logs-health`,label:e.copy?.labels[`logs-health`]??`Logs`,status:e.logsHealth.shuttingDown||t>0?`warn`:`pass`,message:e.copy?e.logsHealth.shuttingDown?e.copy.logsShuttingDown:t>0?e.copy.logsErrors(t):e.copy.logsHealthy:e.logsHealth.shuttingDown?`Logger is shutting down.`:t>0?`${t} error(s) in the last 24 hours.`:`Log system is healthy.`,path:`/settings/logs`})}for(let t of e.browserDiagnostics??[]){let r=t.message;if(e.copy){r={"Local Chromium is installed.":e.copy.chromiumInstalled,"Local Chromium is not installed.":e.copy.chromiumNotInstalled,"Chrome extension bridge is connected.":e.copy.extensionConnected,"Chrome extension needs refresh.":e.copy.extensionNeedsRefresh,"Chrome extension is installed but not connected.":e.copy.extensionNotConnected,"Chrome extension is not installed.":e.copy.extensionNotInstalled}[t.message]??t.message;let n=t.message.match(/^Browser driver "(.*)" is configured\.$/);n?.[1]&&(r=e.copy.browserDriverConfigured(n[1]))}n.push({...t,label:e.copy?.labels[t.id]??t.label,message:r})}return n}function ie(e){let t=W(e.config),n=e.providerMeta?.configured??t,r=e.providerMeta?.total??0,i=n>0||t>0,a=G(e.config),o=a.length>0,s=e.hasToken&&e.realtimeConnected,c=K(e.config),l=e.skillCount>0,u=(e.doctorChecks??[]).filter(t=>!e.isElectron||t.id!==`gateway-service`),d=ne(u,e.labels.diagnostics),f=[{id:`gateway`,done:s,detail:s?e.labels.gatewayOnline:e.labels.gatewayOffline},{id:`provider`,done:i,detail:i?e.providerMeta&&e.providerMeta.total>0?e.labels.providersMetaReady(n,r):e.labels.providersConfigured(t):e.labels.providersMissing},{id:`defaultModel`,done:o,detail:o?e.labels.modelConfigured(a):e.labels.modelMissing},{id:`channel`,done:c,optional:!0,detail:c?e.labels.channelConfigured:e.labels.channelMissing},{id:`skill`,done:l,optional:!0,detail:l?e.labels.skillsConfigured(e.skillCount):e.labels.skillsMissing}],p=f.filter(e=>!e.optional).every(e=>e.done),m=f.every(e=>e.done),h=[{id:`gateway`,status:J(s),title:`Gateway`,detail:s?e.labels.gatewayOnline:e.labels.gatewayOffline,path:`/settings/gateway`},{id:`provider`,status:J(i),title:`Model provider`,detail:i?e.providerMeta&&e.providerMeta.total>0?e.labels.providersMetaReady(n,r):e.labels.providersConfigured(t):e.labels.providersMissing,path:`/settings/capabilities/models`},{id:`defaultModel`,status:J(o),title:`Default model`,detail:o?e.labels.modelConfigured(a):e.labels.modelMissing,path:`/settings/capabilities/models`},{id:`ready`,status:p?`pass`:`fail`,title:`Chat readiness`,detail:p?e.labels.readyToChat:e.labels.modelMissing,path:`/chat`}],g=d.some(e=>e.status===`fail`),_=d.some(e=>e.status===`warn`),v=g?`blocked`:_?`attention`:p?`ready`:`setup`,y=re({doctorChecks:u,logsHealth:e.logsHealth,browserDiagnostics:e.browserDiagnostics,copy:e.labels.diagnostics});return{gatewayConnected:s,providerConfigured:i,providerCount:t,providerMetaConfigured:n,providerMetaTotal:r,defaultModel:a,defaultModelConfigured:o,channelConfigured:c,skillInstalled:l,skillCount:e.skillCount,checklist:f,readiness:h,issues:d,healthTier:v,diagnosticSignals:y,requiredComplete:p,allComplete:m}}function ae(e){return q(e)}function oe(e){return!e.id||!e.label||!e.status||!e.message||![`pass`,`warn`,`fail`,`skip`].includes(e.status)?null:{id:e.id,label:e.label,status:e.status,message:e.message,hints:Array.isArray(e.hints)?e.hints.filter(e=>typeof e==`string`):[],fixed:e.fixed===!0,findings:Array.isArray(e.findings)?e.findings:void 0}}function se(){return l(`/api/doctor`)}async function ce(){return((await f(se())).checks??[]).map(oe).filter(e=>e!==null)}function le(){return l(`/api/logs/health`)}async function ue(){return f(le())}function Q(e){return e?`pass`:`warn`}function de(e){return e?.enabled?[`setup-browser-diagnostics`,e]:null}async function fe(e){if(!e.enabled)return[];if(e.driverKind===`playwright`){let e=await f(l(`/api/browser/playwright/doctor`)),t=e.payload?.installed===!0;return[{id:`browser-playwright`,label:`Browser: Playwright`,status:Q(t),message:t?`Local Chromium is installed.`:e.payload?.reason??`Local Chromium is not installed.`,path:`/settings/agent-browser`}]}if(e.driverKind===`extension`){let e=await f(l(`/api/browser/extension-status?probe=true`)),t=e.artifacts?.installed===!0,n=e.connected===!0,r=e.artifacts?.needsRefresh===!0||e.artifacts?.needsChromeReload===!0;return[{id:`browser-extension`,label:`Browser: Chrome extension`,status:n?`pass`:`warn`,message:n?`Chrome extension bridge is connected.`:t?r?`Chrome extension needs refresh.`:`Chrome extension is installed but not connected.`:`Chrome extension is not installed.`,path:`/settings/agent-browser`}]}return[{id:`browser-playwright`,label:`Browser`,status:`skip`,message:`Browser driver "${e.driverKind}" is configured.`,path:`/settings/agent-browser`}]}function $(){let e=(0,B.c)(95),t=u(ve),n=d(_e),r;e[0]===n?r=e[1]:(r=s(n),e[0]=n,e[1]=r);let i=r,a=i.setupStatus.labels,o=i.setupStatus.diagnostics,c=_(ge),{data:l,error:f,isLoading:m,mutate:h}=g(!!t),x;e[2]===Symbol.for(`react.memo_cache_sentinel`)?(x={revalidateOnFocus:!1},e[2]=x):x=e[2];let{data:C,error:w,isLoading:ee,mutate:T}=p(t?`setup-checklist-skills`:null,he,x),E;e[3]===Symbol.for(`react.memo_cache_sentinel`)?(E={revalidateOnFocus:!1},e[3]=E):E=e[3];let{data:D,error:O,isLoading:k,mutate:A}=p(t?`setup-checklist-provider-meta`:null,S,E),j;e[4]===t?j=e[5]:(j=t?se():null,e[4]=t,e[5]=j);let M;e[6]===Symbol.for(`react.memo_cache_sentinel`)?(M={revalidateOnFocus:!1},e[6]=M):M=e[6];let{data:N,error:P,isLoading:F,mutate:I}=p(j,ce,M),L;e[7]===t?L=e[8]:(L=t?le():null,e[7]=t,e[8]=L);let R;e[9]===Symbol.for(`react.memo_cache_sentinel`)?(R={revalidateOnFocus:!1},e[9]=R):R=e[9];let{data:z,isLoading:V,mutate:H}=p(L,ue,R);l?.payload?.config;let U=l?.payload?.config,W;e[10]===U?W=e[11]:(W=ae(U),e[10]=U,e[11]=W);let G=t?W:null,K;e[12]===G?K=e[13]:(K=de(G),e[12]=G,e[13]=K);let q;e[14]===Symbol.for(`react.memo_cache_sentinel`)?(q={revalidateOnFocus:!1},e[14]=q):q=e[14];let{data:J,isLoading:te,mutate:Y}=p(K,me,q),X;e[15]===Symbol.for(`react.memo_cache_sentinel`)?(X={revalidateOnFocus:!1},e[15]=X):X=e[15],p(t?y:null,v,X);let Z=!t||!m&&!ee&&!k&&!F&&!V&&!te,ne=!!(f||w||O||P),re;bb0:{if(!t||!Z){re=null;break bb0}let n=C?.catalog?.length??0,r;if(e[16]!==J||e[17]!==l?.payload?.config||e[18]!==o.browserDriverConfigured||e[19]!==o.chromiumInstalled||e[20]!==o.chromiumNotInstalled||e[21]!==o.extensionConnected||e[22]!==o.extensionNeedsRefresh||e[23]!==o.extensionNotConnected||e[24]!==o.extensionNotInstalled||e[25]!==o.gatewayNotInstalled||e[26]!==o.gatewayNotRunning||e[27]!==o.gatewayUnavailable||e[28]!==o.installCommand||e[29]!==o.labels||e[30]!==o.logsErrors||e[31]!==o.logsHealthy||e[32]!==o.logsShuttingDown||e[33]!==o.providerAuthMissing||e[34]!==o.runCommand||e[35]!==o.runtimeInvalid||e[36]!==o.runtimeMissing||e[37]!==o.startCommand||e[38]!==N||e[39]!==a.channelConfigured||e[40]!==a.channelMissing||e[41]!==a.gatewayOffline||e[42]!==a.gatewayOnline||e[43]!==a.modelConfigured||e[44]!==a.modelMissing||e[45]!==a.providersConfigured||e[46]!==a.providersMetaReady||e[47]!==a.providersMissing||e[48]!==a.skillsConfigured||e[49]!==a.skillsMissing||e[50]!==z||e[51]!==i.setupStatus.requiredCompleteMessage||e[52]!==D||e[53]!==c||e[54]!==n||e[55]!==t){let s=D?.filter(pe).length??0,u=D?.length??0,d;e[57]===a.providersConfigured?d=e[58]:(d=e=>a.providersConfigured.replace(`{{count}}`,String(e)),e[57]=a.providersConfigured,e[58]=d);let f;e[59]===a.providersMetaReady?f=e[60]:(f=(e,t)=>a.providersMetaReady.replace(`{{configured}}`,String(e)).replace(`{{total}}`,String(t)),e[59]=a.providersMetaReady,e[60]=f);let p;e[61]===a.modelConfigured?p=e[62]:(p=e=>a.modelConfigured.replace(`{{model}}`,e),e[61]=a.modelConfigured,e[62]=p);let m;e[63]===a.skillsConfigured?m=e[64]:(m=e=>a.skillsConfigured.replace(`{{count}}`,String(e)),e[63]=a.skillsConfigured,e[64]=m);let h;e[65]===o.runtimeMissing?h=e[66]:(h=e=>o.runtimeMissing.replace(`{{runtimes}}`,e),e[65]=o.runtimeMissing,e[66]=h);let g;e[67]===o.runtimeInvalid?g=e[68]:(g=e=>o.runtimeInvalid.replace(`{{runtimes}}`,e),e[67]=o.runtimeInvalid,e[68]=g);let _;e[69]===o.gatewayUnavailable?_=e[70]:(_=e=>o.gatewayUnavailable.replace(`{{detail}}`,e),e[69]=o.gatewayUnavailable,e[70]=_);let v;e[71]===o.gatewayNotRunning?v=e[72]:(v=e=>o.gatewayNotRunning.replace(`{{status}}`,e),e[71]=o.gatewayNotRunning,e[72]=v);let y;e[73]===o.runCommand?y=e[74]:(y=e=>o.runCommand.replace(`{{command}}`,e),e[73]=o.runCommand,e[74]=y);let x;e[75]===o.installCommand?x=e[76]:(x=e=>o.installCommand.replace(`{{command}}`,e),e[75]=o.installCommand,e[76]=x);let S;e[77]===o.startCommand?S=e[78]:(S=e=>o.startCommand.replace(`{{command}}`,e),e[77]=o.startCommand,e[78]=S);let C;e[79]===o.logsErrors?C=e[80]:(C=e=>o.logsErrors.replace(`{{count}}`,String(e)),e[79]=o.logsErrors,e[80]=C);let w;e[81]===o.browserDriverConfigured?w=e[82]:(w=e=>o.browserDriverConfigured.replace(`{{driver}}`,e),e[81]=o.browserDriverConfigured,e[82]=w),r=ie({isElectron:b(),hasToken:!!t,realtimeConnected:c,config:l?.payload?.config,skillCount:n,providerMeta:u>0?{configured:s,total:u}:null,doctorChecks:N,logsHealth:z,browserDiagnostics:J,labels:{gatewayOnline:a.gatewayOnline,gatewayOffline:a.gatewayOffline,providersConfigured:d,providersMetaReady:f,providersMissing:a.providersMissing,modelConfigured:p,modelMissing:a.modelMissing,channelConfigured:a.channelConfigured,channelMissing:a.channelMissing,skillsConfigured:m,skillsMissing:a.skillsMissing,readyToChat:i.setupStatus.requiredCompleteMessage,diagnostics:{labels:o.labels,runtimeMissing:h,runtimeInvalid:g,gatewayNotInstalled:o.gatewayNotInstalled,gatewayUnavailable:_,gatewayNotRunning:v,providerAuthMissing:o.providerAuthMissing,runCommand:y,installCommand:x,startCommand:S,logsHealthy:o.logsHealthy,logsShuttingDown:o.logsShuttingDown,logsErrors:C,chromiumInstalled:o.chromiumInstalled,chromiumNotInstalled:o.chromiumNotInstalled,extensionConnected:o.extensionConnected,extensionNeedsRefresh:o.extensionNeedsRefresh,extensionNotConnected:o.extensionNotConnected,extensionNotInstalled:o.extensionNotInstalled,browserDriverConfigured:w}}}),e[16]=J,e[17]=l?.payload?.config,e[18]=o.browserDriverConfigured,e[19]=o.chromiumInstalled,e[20]=o.chromiumNotInstalled,e[21]=o.extensionConnected,e[22]=o.extensionNeedsRefresh,e[23]=o.extensionNotConnected,e[24]=o.extensionNotInstalled,e[25]=o.gatewayNotInstalled,e[26]=o.gatewayNotRunning,e[27]=o.gatewayUnavailable,e[28]=o.installCommand,e[29]=o.labels,e[30]=o.logsErrors,e[31]=o.logsHealthy,e[32]=o.logsShuttingDown,e[33]=o.providerAuthMissing,e[34]=o.runCommand,e[35]=o.runtimeInvalid,e[36]=o.runtimeMissing,e[37]=o.startCommand,e[38]=N,e[39]=a.channelConfigured,e[40]=a.channelMissing,e[41]=a.gatewayOffline,e[42]=a.gatewayOnline,e[43]=a.modelConfigured,e[44]=a.modelMissing,e[45]=a.providersConfigured,e[46]=a.providersMetaReady,e[47]=a.providersMissing,e[48]=a.skillsConfigured,e[49]=a.skillsMissing,e[50]=z,e[51]=i.setupStatus.requiredCompleteMessage,e[52]=D,e[53]=c,e[54]=n,e[55]=t,e[56]=r}else r=e[56];re=r}let oe=re,Q;e[83]!==Y||e[84]!==h||e[85]!==I||e[86]!==H||e[87]!==A||e[88]!==T?(Q=async()=>{await Promise.all([h(),T(),A(),I(),H(),Y()])},e[83]=Y,e[84]=h,e[85]=I,e[86]=H,e[87]=A,e[88]=T,e[89]=Q):Q=e[89];let fe=Q,$;return e[90]!==ne||e[91]!==Z||e[92]!==fe||e[93]!==oe?($={ready:Z,error:ne,snapshot:oe,refresh:fe},e[90]=ne,e[91]=Z,e[92]=fe,e[93]=oe,e[94]=$):$=e[94],$}function pe(e){return e.configured}function me(e){let[,t]=e;return fe(t)}function he(){return O()}function ge(e){return e.connectionState===`connected`}function _e(e){return e.language}function ve(e){return e.conversationId}function ye(e){return e===`pass`?`bg-success-soft text-success`:e===`warn`?`bg-amber-500/10 text-amber-700 dark:text-amber-300`:e===`fail`?`bg-red-500/10 text-red-700 dark:text-red-300`:`bg-surface-hover text-fg-muted`}function be(e){return e===`pass`?a:e===`warn`?j:e===`fail`?E:C}function xe(e,t){return e===`blocked`?{icon:E,className:`bg-red-500/10 text-red-950 dark:text-red-100`,title:t.health.blockedTitle,body:t.health.blockedBody,action:t.health.viewIssues,targetId:`next-steps`}:e===`attention`?{icon:j,className:`bg-amber-500/10 text-amber-950 dark:text-amber-100`,title:t.health.attentionTitle,body:t.health.attentionBody,action:t.health.viewIssues,targetId:`next-steps`}:e===`setup`?{icon:M,className:`bg-surface-hover/50 text-fg`,title:t.health.setupTitle,body:t.health.setupBody,action:t.health.continueSetup,targetId:`next-steps`}:{icon:a,className:`bg-success-soft text-success`,title:t.health.readyTitle,body:t.health.readyBody,action:t.health.startChat,actionPath:`/chat`}}function Se(e){let t=(0,B.c)(46),{tier:n,issueCount:r,onRunDoctor:a,ready:l,doctorRunning:u,doctorRunState:f}=e,p=d(Ce),m,h,g,_,v,y,b,x,S;if(t[0]!==r||t[1]!==p||t[2]!==n){h=s(p).setupStatus;let e=xe(n,h),a=e.icon,o=`targetId`in e&&typeof e.targetId==`string`?e.targetId:null,l=`actionPath`in e&&typeof e.actionPath==`string`?e.actionPath:`/chat`;m=o?(0,H.jsxs)(`button`,{type:`button`,onClick:()=>document.getElementById(o)?.scrollIntoView({block:`start`,behavior:window.matchMedia(`(prefers-reduced-motion: reduce)`).matches?`auto`:`smooth`}),className:`inline-flex items-center gap-1 rounded-lg bg-surface-base px-3 py-2 text-sm font-medium text-fg shadow-sm hover:bg-surface-hover focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,children:[e.action,(0,H.jsx)(w,{className:`size-4`,"aria-hidden":!0})]}):(0,H.jsxs)(i,{to:l,className:`inline-flex items-center gap-1 rounded-lg bg-surface-base px-3 py-2 text-sm font-medium text-fg shadow-sm hover:bg-surface-hover focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,children:[e.action,(0,H.jsx)(w,{className:`size-4`,"aria-hidden":!0})]}),S=c(`rounded-xl p-4`,e.className),x=`flex flex-col gap-3 sm:flex-row sm:items-start sm:justify-between`,y=`flex min-w-0 gap-3`,b=(0,H.jsx)(a,{className:`mt-0.5 size-5 shrink-0`,"aria-hidden":!0}),g=`min-w-0`,_=(0,H.jsx)(`h2`,{className:`text-base font-semibold`,children:e.title}),v=r>0?(0,H.jsx)(`p`,{className:`mt-1 text-sm opacity-80`,children:h.health.issueCount.replace(`{{count}}`,String(r))}):null,t[0]=r,t[1]=p,t[2]=n,t[3]=m,t[4]=h,t[5]=g,t[6]=_,t[7]=v,t[8]=y,t[9]=b,t[10]=x,t[11]=S}else m=t[3],h=t[4],g=t[5],_=t[6],v=t[7],y=t[8],b=t[9],x=t[10],S=t[11];let C;t[12]!==g||t[13]!==_||t[14]!==v?(C=(0,H.jsxs)(`div`,{className:g,children:[_,v]}),t[12]=g,t[13]=_,t[14]=v,t[15]=C):C=t[15];let E;t[16]!==y||t[17]!==b||t[18]!==C?(E=(0,H.jsxs)(`div`,{className:y,children:[b,C]}),t[16]=y,t[17]=b,t[18]=C,t[19]=E):E=t[19];let D;t[20]===Symbol.for(`react.memo_cache_sentinel`)?(D=c(`inline-flex items-center gap-2 rounded-lg bg-surface-base/70 px-3 py-2 text-sm font-medium text-fg`,`hover:bg-surface-hover focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,ee.press),t[20]=D):D=t[20];let O=!l||u,k;t[21]===u?k=t[22]:(k=u?(0,H.jsx)(o,{className:`size-4 animate-spin`,"aria-hidden":!0}):(0,H.jsx)(T,{className:`size-4`,"aria-hidden":!0}),t[21]=u,t[22]=k);let A=u?h.health.runDoctorRunning:h.health.runDoctor,j;t[23]!==u||t[24]!==a||t[25]!==O||t[26]!==k||t[27]!==A?(j=(0,H.jsxs)(`button`,{type:`button`,className:D,onClick:a,disabled:O,"aria-busy":u,children:[k,A]}),t[23]=u,t[24]=a,t[25]=O,t[26]=k,t[27]=A,t[28]=j):j=t[28];let M;t[29]!==m||t[30]!==j?(M=(0,H.jsxs)(`div`,{className:`flex shrink-0 flex-wrap gap-2`,children:[m,j]}),t[29]=m,t[30]=j,t[31]=M):M=t[31];let N;t[32]!==M||t[33]!==x||t[34]!==E?(N=(0,H.jsxs)(`div`,{className:x,children:[E,M]}),t[32]=M,t[33]=x,t[34]=E,t[35]=N):N=t[35];let P;t[36]!==f||t[37]!==u||t[38]!==h.health.doctorCompleteMessage||t[39]!==h.health.doctorFailedMessage||t[40]!==h.health.doctorRunningMessage?(P=u||f!==`idle`?(0,H.jsx)(`p`,{className:`mt-3 text-xs opacity-75`,role:`status`,"aria-live":`polite`,children:u?h.health.doctorRunningMessage:f===`success`?h.health.doctorCompleteMessage:h.health.doctorFailedMessage}):null,t[36]=f,t[37]=u,t[38]=h.health.doctorCompleteMessage,t[39]=h.health.doctorFailedMessage,t[40]=h.health.doctorRunningMessage,t[41]=P):P=t[41];let F;return t[42]!==N||t[43]!==P||t[44]!==S?(F=(0,H.jsxs)(`section`,{className:S,children:[N,P]}),t[42]=N,t[43]=P,t[44]=S,t[45]=F):F=t[45],F}function Ce(e){return e.language}function we(e){let t=(0,B.c)(26),{issue:n,fixLabel:r}=e,a;t[0]===n.status?a=t[1]:(a=be(n.status),t[0]=n.status,t[1]=a);let o=a,s;t[2]===o?s=t[3]:(s=(0,H.jsx)(o,{className:`mt-0.5 size-4 shrink-0`,"aria-hidden":!0}),t[2]=o,t[3]=s);let c;t[4]===n.label?c=t[5]:(c=(0,H.jsx)(`span`,{className:`text-sm font-semibold text-fg`,children:n.label}),t[4]=n.label,t[5]=c);let l;t[6]===n.message?l=t[7]:(l=(0,H.jsx)(`span`,{className:`mt-1 block text-sm text-fg-muted`,children:n.message}),t[6]=n.message,t[7]=l);let u;t[8]===n.hints[0]?u=t[9]:(u=n.hints[0]?(0,H.jsx)(`span`,{className:`mt-1 block truncate text-xs text-fg-subtle`,children:n.hints[0]}):null,t[8]=n.hints[0],t[9]=u);let d;t[10]!==c||t[11]!==l||t[12]!==u?(d=(0,H.jsxs)(`span`,{className:`min-w-0 flex-1`,children:[c,l,u]}),t[10]=c,t[11]=l,t[12]=u,t[13]=d):d=t[13];let f;t[14]!==r||t[15]!==n.path?(f=n.path?(0,H.jsxs)(`span`,{className:`inline-flex shrink-0 items-center gap-1 text-xs font-medium text-accent-fg`,children:[r,(0,H.jsx)(w,{className:`size-4`,"aria-hidden":!0})]}):null,t[14]=r,t[15]=n.path,t[16]=f):f=t[16];let p;t[17]!==s||t[18]!==d||t[19]!==f?(p=(0,H.jsxs)(H.Fragment,{children:[s,d,f]}),t[17]=s,t[18]=d,t[19]=f,t[20]=p):p=t[20];let m=p;if(n.path){let e;return t[21]!==m||t[22]!==n.path?(e=(0,H.jsx)(i,{to:n.path,className:`flex items-start gap-3 px-1 py-3 hover:bg-surface-hover/30 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,children:m}),t[21]=m,t[22]=n.path,t[23]=e):e=t[23],e}let h;return t[24]===m?h=t[25]:(h=(0,H.jsx)(`div`,{className:`flex items-start gap-3 px-1 py-3`,children:m}),t[24]=m,t[25]=h),h}function Te(e){let t=(0,B.c)(27),{item:n,labels:r}=e,a;t[0]===n.status?a=t[1]:(a=be(n.status),t[0]=n.status,t[1]=a);let o=a,s=r[n.id]??n.title,l;t[2]===n.status?l=t[3]:(l=c(`flex size-7 shrink-0 items-center justify-center rounded-full`,ye(n.status)),t[2]=n.status,t[3]=l);let u;t[4]===o?u=t[5]:(u=(0,H.jsx)(o,{className:`size-4`,"aria-hidden":!0}),t[4]=o,t[5]=u);let d;t[6]!==l||t[7]!==u?(d=(0,H.jsx)(`span`,{className:l,children:u}),t[6]=l,t[7]=u,t[8]=d):d=t[8];let f;t[9]===s?f=t[10]:(f=(0,H.jsx)(`span`,{className:`block text-sm font-medium text-fg`,children:s}),t[9]=s,t[10]=f);let p;t[11]===n.detail?p=t[12]:(p=(0,H.jsx)(`span`,{className:`mt-0.5 block truncate text-xs text-fg-muted`,children:n.detail}),t[11]=n.detail,t[12]=p);let m;t[13]!==f||t[14]!==p?(m=(0,H.jsxs)(`span`,{className:`min-w-0 flex-1`,children:[f,p]}),t[13]=f,t[14]=p,t[15]=m):m=t[15];let h;t[16]===n.path?h=t[17]:(h=n.path?(0,H.jsx)(w,{className:`size-4 shrink-0 text-fg-subtle`,"aria-hidden":!0}):null,t[16]=n.path,t[17]=h);let g;t[18]!==d||t[19]!==m||t[20]!==h?(g=(0,H.jsxs)(H.Fragment,{children:[d,m,h]}),t[18]=d,t[19]=m,t[20]=h,t[21]=g):g=t[21];let _=g;if(n.path){let e;return t[22]!==_||t[23]!==n.path?(e=(0,H.jsx)(i,{to:n.path,className:`flex items-center gap-3 rounded-lg p-3 hover:bg-surface-hover focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,children:_}),t[22]=_,t[23]=n.path,t[24]=e):e=t[24],e}let v;return t[25]===_?v=t[26]:(v=(0,H.jsx)(`div`,{className:`flex items-center gap-3 rounded-lg p-3`,children:_}),t[25]=_,t[26]=v),v}function Ee(e){let t=(0,B.c)(23),{signal:n,fixLabel:r}=e,a;t[0]===n.status?a=t[1]:(a=be(n.status),t[0]=n.status,t[1]=a);let o=a,s;t[2]===o?s=t[3]:(s=(0,H.jsx)(o,{className:`mt-0.5 size-4 shrink-0`,"aria-hidden":!0}),t[2]=o,t[3]=s);let c;t[4]===n.label?c=t[5]:(c=(0,H.jsx)(`span`,{className:`block truncate text-sm font-medium text-fg`,children:n.label}),t[4]=n.label,t[5]=c);let l;t[6]===n.message?l=t[7]:(l=(0,H.jsx)(`span`,{className:`mt-0.5 block truncate text-xs text-fg-muted`,children:n.message}),t[6]=n.message,t[7]=l);let u;t[8]!==c||t[9]!==l?(u=(0,H.jsxs)(`span`,{className:`min-w-0 flex-1`,children:[c,l]}),t[8]=c,t[9]=l,t[10]=u):u=t[10];let d;t[11]!==r||t[12]!==n.path?(d=n.path?(0,H.jsx)(`span`,{className:`sr-only`,children:r}):null,t[11]=r,t[12]=n.path,t[13]=d):d=t[13];let f;t[14]!==s||t[15]!==u||t[16]!==d?(f=(0,H.jsxs)(H.Fragment,{children:[s,u,d]}),t[14]=s,t[15]=u,t[16]=d,t[17]=f):f=t[17];let p=f;if(n.path){let e;return t[18]!==p||t[19]!==n.path?(e=(0,H.jsx)(i,{to:n.path,className:`flex min-w-0 items-start gap-2 px-1 py-3 hover:bg-surface-hover/30 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,children:p}),t[18]=p,t[19]=n.path,t[20]=e):e=t[20],e}let m;return t[21]===p?m=t[22]:(m=(0,H.jsx)(`div`,{className:`flex min-w-0 items-start gap-2 px-1 py-3`,children:p}),t[21]=p,t[22]=m),m}function De(){let e=s(d(e=>e.language)).setupStatus,{ready:t,error:n,snapshot:r,refresh:i}=$(),[a,o]=(0,V.useState)(!1),[c,l]=(0,V.useState)(`idle`),u=r?.diagnosticSignals.filter(e=>e.status===`fail`||e.status===`warn`)??[],f=async()=>{if(!(a||!t)){o(!0),l(`idle`);try{await i(),l(`success`)}catch{l(`error`)}finally{o(!1)}}};return(0,H.jsxs)(P,{gap:`gap-6`,children:[(0,H.jsx)(N,{title:e.title}),n?(0,H.jsx)(`p`,{className:`rounded-xl bg-red-50 px-4 py-3 text-sm text-red-700 dark:bg-red-950/30 dark:text-red-300`,children:e.loadError}):null,!t||!r?(0,H.jsx)(D,{sections:2}):(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(Se,{tier:r.healthTier,issueCount:r.issues.length,ready:t,onRunDoctor:()=>void f(),doctorRunning:a,doctorRunState:c}),(0,H.jsxs)(I,{id:`next-steps`,children:[(0,H.jsx)(F,{icon:r.issues.length?j:A,title:e.nextStepsTitle}),r.issues.length?(0,H.jsx)(`div`,{className:`mt-3 flex flex-col gap-1 [&>*]:rounded-lg [&>*]:bg-surface-base/45 [&>*]:px-3`,children:r.issues.slice(0,8).map(t=>(0,H.jsx)(we,{issue:t,fixLabel:e.fixIssue},`${t.source}:${t.id}`))}):(0,H.jsx)(`div`,{className:`mt-3 flex flex-col gap-1 [&>*]:bg-surface-base/45`,children:r.readiness.map(t=>(0,H.jsx)(Te,{item:t,labels:e.readinessLabels},t.id))})]}),(0,H.jsx)(U,{}),(0,H.jsx)(L,{children:(0,H.jsxs)(I,{children:[(0,H.jsx)(F,{icon:k,title:e.diagnosticsTitle}),u.length?(0,H.jsx)(`div`,{className:`mt-3 flex flex-col gap-1 [&>*]:rounded-lg [&>*]:bg-surface-base/45 [&>*]:px-3`,children:u.map(t=>(0,H.jsx)(Ee,{signal:t,fixLabel:e.fixIssue},t.id))}):(0,H.jsx)(`p`,{className:`mt-3 py-2 text-sm text-fg-muted`,children:r.diagnosticSignals.length?e.diagnosticsAllClear:e.diagnosticsEmpty})]})})]})]})}export{De as SetupStatusPanel};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{a as t,n,t as r}from"./vendor-react-BOUWij0V.js";import{m as i}from"./chunk-KS7C4IRE-BvcCCgTW.js";import{t as a}from"./check-DUBLcKHA.js";import{n as o,r as s}from"./popover-select-DGKUpVsz.js";import{t as c}from"./copy-Dv6d4Dvw.js";import{t as l}from"./loader-circle-CifKLtgG.js";import{t as u}from"./messages-DMXSIJUO.js";import{t as d}from"./cn-0WouolD0.js";import{i as f,l as p,n as m,o as h}from"./locale-store-DAgpZxAS.js";import{t as g}from"./copy-to-clipboard-HOJ79TWv.js";import{i as _}from"./vendor-swr-BIWyz7Rc.js";import{t as v}from"./button-aIC072nz.js";import{t as y}from"./skeleton-BI5TyibZ.js";import{n as b,r as x}from"./gateway-config-swr-BVqYVaGy.js";import{o as S}from"./agents-admin-api-uGDeJR1f.js";import{An as C,Ao as w,Bc as T,Bi as E,Di as D,Ei as O,Fc as k,Fi as A,Hu as j,Ic as M,Ii as N,Kc as ee,Li as P,Mi as te,Oi as F,Ot as I,Pc as L,Pd as R,Pi as ne,Pl as re,Qu as ie,Rc as z,Ri as B,Si as ae,Vi as V,Vl as H,_o as U,bd as oe,ca as W,du as se,ji as ce,ki as le,oa as ue,pa as G,rd as de,rl as fe,ul as pe,wi as me,yd as K,yn as he,zc as ge,zi as _e}from"./index-CiDVRMmX.js";import{t as ve}from"./number-input-DDeqHK-G.js";import{n as ye,r as be,t as q}from"./settings-page-layout-Dx5S-Msc.js";import{t as J}from"./settings-form-section-BXeszXR7.js";var Y=e(t(),1),xe=n(),X={enabled:!0,defaultTtlHours:24,maxTtlDays:30,maxActiveShares:500,maxFileSizeMb:500,directoryMaxFolderSizeMb:2048,directoryMaxFileCount:1e4,inlinePreviewMimes:[`image/png`,`image/jpeg`,`image/gif`,`image/webp`,`image/svg+xml`,`application/pdf`,`text/html`,`text/markdown`,`text/plain`,`application/json`],noteEnabled:!0,noteMaxTotalSizeMb:250,noteMaxAttachmentCount:50,siteEnabled:!0,siteDefaultTtlHours:24,siteMaxTtlDays:30,maxActiveSites:50,siteMaxRootDirSizeMb:1024,siteMaxFileCount:2e4};function Se(){return structuredClone(X)}var Z=36e5,Ce=864e5,Q=1048576;function we(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function Te(e,t=32){return Array.isArray(e)?e.filter(e=>typeof e==`string`&&e.trim().length>0).map(e=>e.trim()).slice(0,t):[]}function Ee(e){let t=we(e)?e:{},n=we(t.gateway)?t.gateway:{},r=we(n.share)?n.share:{},i=we(r.directory)?r.directory:{},a=we(r.note)?r.note:{},o=we(n.siteShare)?n.siteShare:{},s=we(o.static)?o.static:{},c=typeof r.defaultTtlMs==`number`&&Number.isFinite(r.defaultTtlMs)?Math.floor(r.defaultTtlMs):X.defaultTtlHours*Z,l=typeof r.maxTtlMs==`number`&&Number.isFinite(r.maxTtlMs)?Math.floor(r.maxTtlMs):X.maxTtlDays*Ce,u=typeof r.maxFileSize==`number`&&Number.isFinite(r.maxFileSize)?Math.floor(r.maxFileSize):X.maxFileSizeMb*Q,d=typeof i.maxFolderSize==`number`&&Number.isFinite(i.maxFolderSize)?Math.floor(i.maxFolderSize):X.directoryMaxFolderSizeMb*Q,f=typeof o.defaultTtlMs==`number`&&Number.isFinite(o.defaultTtlMs)?Math.floor(o.defaultTtlMs):X.siteDefaultTtlHours*Z,p=typeof o.maxTtlMs==`number`&&Number.isFinite(o.maxTtlMs)?Math.floor(o.maxTtlMs):X.siteMaxTtlDays*Ce,m=typeof s.maxRootDirSize==`number`&&Number.isFinite(s.maxRootDirSize)?Math.floor(s.maxRootDirSize):X.siteMaxRootDirSizeMb*Q,h=typeof a.maxTotalSize==`number`&&Number.isFinite(a.maxTotalSize)?Math.floor(a.maxTotalSize):X.noteMaxTotalSizeMb*Q;return{enabled:r.enabled!==!1,defaultTtlHours:Math.max(1,Math.round(c/Z)),maxTtlDays:Math.max(1,Math.round(l/Ce)),maxActiveShares:typeof r.maxActiveShares==`number`&&Number.isFinite(r.maxActiveShares)?Math.max(1,Math.min(1e4,Math.floor(r.maxActiveShares))):X.maxActiveShares,maxFileSizeMb:Math.max(1,Math.round(u/Q)),directoryMaxFolderSizeMb:Math.max(1,Math.round(d/Q)),directoryMaxFileCount:typeof i.maxFileCount==`number`&&Number.isFinite(i.maxFileCount)?Math.max(1,Math.min(1e5,Math.floor(i.maxFileCount))):X.directoryMaxFileCount,inlinePreviewMimes:Te(r.inlinePreviewMimes,32).length?Te(r.inlinePreviewMimes,32):[...X.inlinePreviewMimes],noteEnabled:a.enabled!==!1,noteMaxTotalSizeMb:Math.max(1,Math.round(h/Q)),noteMaxAttachmentCount:typeof a.maxAttachmentCount==`number`&&Number.isFinite(a.maxAttachmentCount)?Math.max(0,Math.min(500,Math.floor(a.maxAttachmentCount))):X.noteMaxAttachmentCount,siteEnabled:o.enabled!==!1,siteDefaultTtlHours:Math.max(1,Math.round(f/Z)),siteMaxTtlDays:Math.max(1,Math.round(p/Ce)),maxActiveSites:typeof o.maxActiveSites==`number`&&Number.isFinite(o.maxActiveSites)?Math.max(1,Math.min(1e3,Math.floor(o.maxActiveSites))):X.maxActiveSites,siteMaxRootDirSizeMb:Math.max(1,Math.round(m/Q)),siteMaxFileCount:typeof s.maxFileCount==`number`&&Number.isFinite(s.maxFileCount)?Math.max(1,Math.min(1e5,Math.floor(s.maxFileCount))):X.siteMaxFileCount}}function De(e){let t=e.defaultTtlHours*Z,n=e.maxTtlDays*Ce,r=e.siteDefaultTtlHours*Z,i=e.siteMaxTtlDays*Ce;return t<6e4||t>6048e5?`Default share TTL must be between 1 minute and 7 days.`:n<6e4||n>2592e6?`Maximum share TTL must be between 1 minute and 30 days.`:t>n?`Default TTL cannot exceed maximum TTL.`:e.maxActiveShares<1||e.maxActiveShares>1e4?`Maximum active shares must be between 1 and 10,000.`:e.maxActiveSites<1||e.maxActiveSites>1e3?`Maximum active site shares must be between 1 and 1,000.`:e.maxFileSizeMb<1||e.maxFileSizeMb>10240?`Maximum file size must be between 1 MB and 10 GB.`:e.directoryMaxFolderSizeMb<1||e.directoryMaxFolderSizeMb>10240?`Maximum folder size must be between 1 MB and 10 GB.`:e.directoryMaxFileCount<1||e.directoryMaxFileCount>1e5?`Maximum directory file count must be between 1 and 100,000.`:e.noteMaxTotalSizeMb<1||e.noteMaxTotalSizeMb>2048?`Maximum Note snapshot size must be between 1 MB and 2 GB.`:e.noteMaxAttachmentCount<0||e.noteMaxAttachmentCount>500?`Maximum Note attachment count must be between 0 and 500.`:r<6e4||r>6048e5?`Default site share TTL must be between 1 minute and 7 days.`:i<6e4||i>2592e6?`Maximum site share TTL must be between 1 minute and 30 days.`:r>i?`Default site TTL cannot exceed maximum site TTL.`:e.siteMaxRootDirSizeMb<1||e.siteMaxRootDirSizeMb>10240?`Maximum static site size must be between 1 MB and 10 GB.`:e.siteMaxFileCount<1||e.siteMaxFileCount>1e5?`Maximum static site file count must be between 1 and 100,000.`:null}async function Oe(e){let t=De(e);if(t)throw Error(t);await h(f(`/api/config`),{method:`PATCH`,body:JSON.stringify({gateway:{share:{enabled:e.enabled,defaultTtlMs:e.defaultTtlHours*Z,maxTtlMs:e.maxTtlDays*Ce,maxActiveShares:e.maxActiveShares,maxFileSize:e.maxFileSizeMb*Q,inlinePreviewMimes:e.inlinePreviewMimes,directory:{maxFolderSize:e.directoryMaxFolderSizeMb*Q,maxFileCount:e.directoryMaxFileCount},note:{enabled:e.noteEnabled,maxTotalSize:e.noteMaxTotalSizeMb*Q,maxAttachmentCount:e.noteMaxAttachmentCount}},siteShare:{enabled:e.siteEnabled,defaultTtlMs:e.siteDefaultTtlHours*Z,maxTtlMs:e.siteMaxTtlDays*Ce,maxActiveSites:e.maxActiveSites,static:{maxRootDirSize:e.siteMaxRootDirSizeMb*Q,maxFileCount:e.siteMaxFileCount}}}})}),b()}var $=r();function ke(){return d(`w-full rounded-lg border border-edge bg-surface-panel px-3 py-2 text-sm text-fg`,`placeholder:text-fg-subtle`,w,`dark:border-edge`)}function Ae({hasToken:e}){let t=u(m(e=>e.language)).sharesSettings,{data:n,isLoading:r}=x(e),i=(0,Y.useMemo)(()=>n?.payload?.config===void 0?null:structuredClone(Ee(n.payload.config)),[n]),a=(0,Y.useRef)(!1),[o,s]=(0,Y.useState)(null),[c,l]=(0,Y.useState)(!1),[d,f]=(0,Y.useState)(null),[p,h]=(0,Y.useState)(!1),g=o??i,_=i,y=(0,Y.useMemo)(()=>!g||!_?!1:JSON.stringify(g)!==JSON.stringify(_),[g,_]),b=(0,Y.useCallback)(e=>{a.current=!0,s(t=>{let n=t??_;return n?{...n,...e}:null})},[_]),S=(0,Y.useCallback)(async()=>{if(!(!g||c)){l(!0),f(null),h(!1);try{await Oe(g),a.current=!1,s(null),h(!0),window.setTimeout(()=>h(!1),2500)}catch(e){f(e instanceof Error?e.message:t.policySaveError)}finally{l(!1)}}},[g,c,t.policySaveError]),C=(0,Y.useCallback)(()=>{a.current=!1,s(null),f(null),h(!1)},[]);return!e||!g?r?(0,$.jsx)(J,{children:(0,$.jsx)(he,{rows:2})}):null:(0,$.jsxs)(J,{children:[(0,$.jsxs)(`div`,{className:`mb-4 flex flex-col gap-2 sm:flex-row sm:items-start sm:justify-between`,children:[(0,$.jsxs)(`div`,{children:[(0,$.jsx)(`h2`,{className:`text-sm font-semibold text-fg`,children:t.policyTitle}),(0,$.jsx)(`p`,{className:`mt-0.5 text-xs text-fg-muted`,children:t.policyHint})]}),(0,$.jsxs)(`div`,{className:`flex shrink-0 flex-wrap items-center gap-2`,children:[p?(0,$.jsx)(`span`,{className:`text-sm text-fg-muted`,children:t.policySaved}):null,(0,$.jsx)(v,{type:`button`,variant:`secondary`,disabled:c,onClick:()=>b(Se()),children:t.policyUseRecommended}),(0,$.jsx)(v,{type:`button`,variant:`secondary`,disabled:!y||c,onClick:C,children:t.policyDiscard}),(0,$.jsx)(v,{type:`button`,variant:`primary`,disabled:!y||c,onClick:()=>void S(),children:c?t.policySaving:t.policySave})]})]}),y?(0,$.jsx)(`p`,{className:`mb-3 text-xs text-amber-800 dark:text-amber-200`,children:t.policyUnsaved}):null,d?(0,$.jsx)(`p`,{className:`mb-3 text-sm text-red-600 dark:text-red-400`,children:d}):null,(0,$.jsx)(`p`,{className:`mb-4 text-xs text-fg-subtle`,children:t.policyRestartHint}),(0,$.jsx)(je,{t,form:g,onChange:b})]})}function je(e){let t=(0,xe.c)(189),{t:n,form:r,onChange:i}=e,a;t[0]===n.policyFileSection?a=t[1]:(a=(0,$.jsx)(`h3`,{className:`text-sm font-semibold text-fg`,children:n.policyFileSection}),t[0]=n.policyFileSection,t[1]=a);let o;t[2]===n.policyFileSectionHint?o=t[3]:(o=(0,$.jsx)(`p`,{className:`mt-0.5 text-xs text-fg-muted`,children:n.policyFileSectionHint}),t[2]=n.policyFileSectionHint,t[3]=o);let s;t[4]!==a||t[5]!==o?(s=(0,$.jsxs)(`div`,{className:`mb-4`,children:[a,o]}),t[4]=a,t[5]=o,t[6]=s):s=t[6];let c;t[7]===i?c=t[8]:(c=e=>i({enabled:e.target.checked}),t[7]=i,t[8]=c);let l;t[9]!==r.enabled||t[10]!==c?(l=(0,$.jsx)(`input`,{type:`checkbox`,className:`ui-checkbox`,checked:r.enabled,onChange:c}),t[9]=r.enabled,t[10]=c,t[11]=l):l=t[11];let u;t[12]!==n.policyEnabled||t[13]!==l?(u=(0,$.jsxs)(`label`,{className:`mb-4 flex cursor-pointer items-center gap-2 text-sm text-fg`,children:[l,n.policyEnabled]}),t[12]=n.policyEnabled,t[13]=l,t[14]=u):u=t[14];let d=!r.enabled,f;t[15]===i?f=t[16]:(f=e=>i({defaultTtlHours:e}),t[15]=i,t[16]=f);let p;t[17]!==r.defaultTtlHours||t[18]!==n.policyDefaultTtlHint||t[19]!==n.policyDefaultTtlHours||t[20]!==d||t[21]!==f?(p=(0,$.jsx)(Me,{id:`share-default-ttl-hours`,label:n.policyDefaultTtlHours,hint:n.policyDefaultTtlHint,value:r.defaultTtlHours,min:1,max:168,disabled:d,onChange:f}),t[17]=r.defaultTtlHours,t[18]=n.policyDefaultTtlHint,t[19]=n.policyDefaultTtlHours,t[20]=d,t[21]=f,t[22]=p):p=t[22];let m=!r.enabled,h;t[23]===i?h=t[24]:(h=e=>i({maxTtlDays:e}),t[23]=i,t[24]=h);let g;t[25]!==r.maxTtlDays||t[26]!==n.policyMaxTtlDays||t[27]!==n.policyMaxTtlHint||t[28]!==m||t[29]!==h?(g=(0,$.jsx)(Me,{id:`share-max-ttl-days`,label:n.policyMaxTtlDays,hint:n.policyMaxTtlHint,value:r.maxTtlDays,min:1,max:30,disabled:m,onChange:h}),t[25]=r.maxTtlDays,t[26]=n.policyMaxTtlDays,t[27]=n.policyMaxTtlHint,t[28]=m,t[29]=h,t[30]=g):g=t[30];let _=!r.enabled,v;t[31]===i?v=t[32]:(v=e=>i({maxActiveShares:e}),t[31]=i,t[32]=v);let y;t[33]!==r.maxActiveShares||t[34]!==n.policyMaxActiveShares||t[35]!==n.policyMaxActiveSharesHint||t[36]!==_||t[37]!==v?(y=(0,$.jsx)(Me,{id:`share-max-active`,label:n.policyMaxActiveShares,hint:n.policyMaxActiveSharesHint,value:r.maxActiveShares,min:1,max:1e4,disabled:_,onChange:v}),t[33]=r.maxActiveShares,t[34]=n.policyMaxActiveShares,t[35]=n.policyMaxActiveSharesHint,t[36]=_,t[37]=v,t[38]=y):y=t[38];let b=!r.enabled,x;t[39]===i?x=t[40]:(x=e=>i({maxFileSizeMb:e}),t[39]=i,t[40]=x);let S;t[41]!==r.maxFileSizeMb||t[42]!==n.policyMaxFileSizeHint||t[43]!==n.policyMaxFileSizeMb||t[44]!==b||t[45]!==x?(S=(0,$.jsx)(Me,{id:`share-max-file-mb`,label:n.policyMaxFileSizeMb,hint:n.policyMaxFileSizeHint,value:r.maxFileSizeMb,min:1,max:10240,disabled:b,onChange:x}),t[41]=r.maxFileSizeMb,t[42]=n.policyMaxFileSizeHint,t[43]=n.policyMaxFileSizeMb,t[44]=b,t[45]=x,t[46]=S):S=t[46];let C=!r.enabled,w;t[47]===i?w=t[48]:(w=e=>i({directoryMaxFolderSizeMb:e}),t[47]=i,t[48]=w);let T;t[49]!==r.directoryMaxFolderSizeMb||t[50]!==n.policyDirectoryMaxFolderSizeHint||t[51]!==n.policyDirectoryMaxFolderSizeMb||t[52]!==C||t[53]!==w?(T=(0,$.jsx)(Me,{id:`share-directory-max-size-mb`,label:n.policyDirectoryMaxFolderSizeMb,hint:n.policyDirectoryMaxFolderSizeHint,value:r.directoryMaxFolderSizeMb,min:1,max:10240,disabled:C,onChange:w}),t[49]=r.directoryMaxFolderSizeMb,t[50]=n.policyDirectoryMaxFolderSizeHint,t[51]=n.policyDirectoryMaxFolderSizeMb,t[52]=C,t[53]=w,t[54]=T):T=t[54];let E=!r.enabled,D;t[55]===i?D=t[56]:(D=e=>i({directoryMaxFileCount:e}),t[55]=i,t[56]=D);let O;t[57]!==r.directoryMaxFileCount||t[58]!==n.policyDirectoryMaxFileCount||t[59]!==n.policyDirectoryMaxFileCountHint||t[60]!==E||t[61]!==D?(O=(0,$.jsx)(Me,{id:`share-directory-max-files`,label:n.policyDirectoryMaxFileCount,hint:n.policyDirectoryMaxFileCountHint,value:r.directoryMaxFileCount,min:1,max:1e5,disabled:E,onChange:D}),t[57]=r.directoryMaxFileCount,t[58]=n.policyDirectoryMaxFileCount,t[59]=n.policyDirectoryMaxFileCountHint,t[60]=E,t[61]=D,t[62]=O):O=t[62];let k;t[63]!==g||t[64]!==y||t[65]!==S||t[66]!==T||t[67]!==O||t[68]!==p?(k=(0,$.jsxs)(`div`,{className:`grid gap-3 sm:grid-cols-2`,children:[p,g,y,S,T,O]}),t[63]=g,t[64]=y,t[65]=S,t[66]=T,t[67]=O,t[68]=p,t[69]=k):k=t[69];let A=!r.enabled,j;t[70]===i?j=t[71]:(j=e=>i({inlinePreviewMimes:e}),t[70]=i,t[71]=j);let M;t[72]!==r.inlinePreviewMimes||t[73]!==n||t[74]!==A||t[75]!==j?(M=(0,$.jsx)(Ne,{t:n,values:r.inlinePreviewMimes,disabled:A,onChange:j}),t[72]=r.inlinePreviewMimes,t[73]=n,t[74]=A,t[75]=j,t[76]=M):M=t[76];let N;t[77]!==k||t[78]!==M||t[79]!==s||t[80]!==u?(N=(0,$.jsxs)(`div`,{className:`rounded-xl bg-surface-base/45 p-4`,children:[s,u,k,M]}),t[77]=k,t[78]=M,t[79]=s,t[80]=u,t[81]=N):N=t[81];let ee;t[82]===n.policyNoteSection?ee=t[83]:(ee=(0,$.jsx)(`h3`,{className:`text-sm font-semibold text-fg`,children:n.policyNoteSection}),t[82]=n.policyNoteSection,t[83]=ee);let P;t[84]===n.policyNoteSectionHint?P=t[85]:(P=(0,$.jsx)(`p`,{className:`mt-0.5 text-xs text-fg-muted`,children:n.policyNoteSectionHint}),t[84]=n.policyNoteSectionHint,t[85]=P);let te;t[86]!==ee||t[87]!==P?(te=(0,$.jsxs)(`div`,{className:`mb-4`,children:[ee,P]}),t[86]=ee,t[87]=P,t[88]=te):te=t[88];let F;t[89]===i?F=t[90]:(F=e=>i({noteEnabled:e.target.checked}),t[89]=i,t[90]=F);let I;t[91]!==r.noteEnabled||t[92]!==F?(I=(0,$.jsx)(`input`,{type:`checkbox`,className:`ui-checkbox`,checked:r.noteEnabled,onChange:F}),t[91]=r.noteEnabled,t[92]=F,t[93]=I):I=t[93];let L;t[94]!==n.policyNoteEnabled||t[95]!==I?(L=(0,$.jsxs)(`label`,{className:`mb-4 flex cursor-pointer items-center gap-2 text-sm text-fg`,children:[I,n.policyNoteEnabled]}),t[94]=n.policyNoteEnabled,t[95]=I,t[96]=L):L=t[96];let R=!r.enabled||!r.noteEnabled,ne;t[97]===i?ne=t[98]:(ne=e=>i({noteMaxTotalSizeMb:e}),t[97]=i,t[98]=ne);let re;t[99]!==r.noteMaxTotalSizeMb||t[100]!==n.policyNoteMaxTotalSizeHint||t[101]!==n.policyNoteMaxTotalSizeMb||t[102]!==R||t[103]!==ne?(re=(0,$.jsx)(Me,{id:`share-note-max-size-mb`,label:n.policyNoteMaxTotalSizeMb,hint:n.policyNoteMaxTotalSizeHint,value:r.noteMaxTotalSizeMb,min:1,max:2048,disabled:R,onChange:ne}),t[99]=r.noteMaxTotalSizeMb,t[100]=n.policyNoteMaxTotalSizeHint,t[101]=n.policyNoteMaxTotalSizeMb,t[102]=R,t[103]=ne,t[104]=re):re=t[104];let ie=!r.enabled||!r.noteEnabled,z;t[105]===i?z=t[106]:(z=e=>i({noteMaxAttachmentCount:e}),t[105]=i,t[106]=z);let B;t[107]!==r.noteMaxAttachmentCount||t[108]!==n.policyNoteMaxAttachmentCount||t[109]!==n.policyNoteMaxAttachmentCountHint||t[110]!==ie||t[111]!==z?(B=(0,$.jsx)(Me,{id:`share-note-max-attachments`,label:n.policyNoteMaxAttachmentCount,hint:n.policyNoteMaxAttachmentCountHint,value:r.noteMaxAttachmentCount,min:0,max:500,disabled:ie,onChange:z}),t[107]=r.noteMaxAttachmentCount,t[108]=n.policyNoteMaxAttachmentCount,t[109]=n.policyNoteMaxAttachmentCountHint,t[110]=ie,t[111]=z,t[112]=B):B=t[112];let ae;t[113]!==re||t[114]!==B?(ae=(0,$.jsxs)(`div`,{className:`grid gap-3 sm:grid-cols-2`,children:[re,B]}),t[113]=re,t[114]=B,t[115]=ae):ae=t[115];let V;t[116]!==te||t[117]!==L||t[118]!==ae?(V=(0,$.jsxs)(`div`,{className:`rounded-xl bg-surface-base/45 p-4`,children:[te,L,ae]}),t[116]=te,t[117]=L,t[118]=ae,t[119]=V):V=t[119];let H;t[120]===n.policySiteSection?H=t[121]:(H=(0,$.jsx)(`h3`,{className:`text-sm font-semibold text-fg`,children:n.policySiteSection}),t[120]=n.policySiteSection,t[121]=H);let U;t[122]===n.policySiteSectionHint?U=t[123]:(U=(0,$.jsx)(`p`,{className:`mt-0.5 text-xs text-fg-muted`,children:n.policySiteSectionHint}),t[122]=n.policySiteSectionHint,t[123]=U);let oe;t[124]!==H||t[125]!==U?(oe=(0,$.jsxs)(`div`,{className:`mb-4`,children:[H,U]}),t[124]=H,t[125]=U,t[126]=oe):oe=t[126];let W;t[127]===i?W=t[128]:(W=e=>i({siteEnabled:e.target.checked}),t[127]=i,t[128]=W);let se;t[129]!==r.siteEnabled||t[130]!==W?(se=(0,$.jsx)(`input`,{type:`checkbox`,className:`ui-checkbox`,checked:r.siteEnabled,onChange:W}),t[129]=r.siteEnabled,t[130]=W,t[131]=se):se=t[131];let ce;t[132]!==n.policySiteEnabled||t[133]!==se?(ce=(0,$.jsxs)(`label`,{className:`mb-4 flex cursor-pointer items-center gap-2 text-sm text-fg`,children:[se,n.policySiteEnabled]}),t[132]=n.policySiteEnabled,t[133]=se,t[134]=ce):ce=t[134];let le=!r.siteEnabled,ue;t[135]===i?ue=t[136]:(ue=e=>i({siteDefaultTtlHours:e}),t[135]=i,t[136]=ue);let G;t[137]!==r.siteDefaultTtlHours||t[138]!==n.policySiteDefaultTtlHint||t[139]!==n.policySiteDefaultTtlHours||t[140]!==le||t[141]!==ue?(G=(0,$.jsx)(Me,{id:`site-share-default-ttl-hours`,label:n.policySiteDefaultTtlHours,hint:n.policySiteDefaultTtlHint,value:r.siteDefaultTtlHours,min:1,max:168,disabled:le,onChange:ue}),t[137]=r.siteDefaultTtlHours,t[138]=n.policySiteDefaultTtlHint,t[139]=n.policySiteDefaultTtlHours,t[140]=le,t[141]=ue,t[142]=G):G=t[142];let de=!r.siteEnabled,fe;t[143]===i?fe=t[144]:(fe=e=>i({siteMaxTtlDays:e}),t[143]=i,t[144]=fe);let pe;t[145]!==r.siteMaxTtlDays||t[146]!==n.policySiteMaxTtlDays||t[147]!==n.policySiteMaxTtlHint||t[148]!==de||t[149]!==fe?(pe=(0,$.jsx)(Me,{id:`site-share-max-ttl-days`,label:n.policySiteMaxTtlDays,hint:n.policySiteMaxTtlHint,value:r.siteMaxTtlDays,min:1,max:30,disabled:de,onChange:fe}),t[145]=r.siteMaxTtlDays,t[146]=n.policySiteMaxTtlDays,t[147]=n.policySiteMaxTtlHint,t[148]=de,t[149]=fe,t[150]=pe):pe=t[150];let me=!r.siteEnabled,K;t[151]===i?K=t[152]:(K=e=>i({maxActiveSites:e}),t[151]=i,t[152]=K);let he;t[153]!==r.maxActiveSites||t[154]!==n.policyMaxActiveSites||t[155]!==n.policyMaxActiveSitesHint||t[156]!==me||t[157]!==K?(he=(0,$.jsx)(Me,{id:`site-share-max-active`,label:n.policyMaxActiveSites,hint:n.policyMaxActiveSitesHint,value:r.maxActiveSites,min:1,max:1e3,disabled:me,onChange:K}),t[153]=r.maxActiveSites,t[154]=n.policyMaxActiveSites,t[155]=n.policyMaxActiveSitesHint,t[156]=me,t[157]=K,t[158]=he):he=t[158];let ge=!r.siteEnabled,_e;t[159]===i?_e=t[160]:(_e=e=>i({siteMaxRootDirSizeMb:e}),t[159]=i,t[160]=_e);let ve;t[161]!==r.siteMaxRootDirSizeMb||t[162]!==n.policySiteMaxRootDirSizeHint||t[163]!==n.policySiteMaxRootDirSizeMb||t[164]!==ge||t[165]!==_e?(ve=(0,$.jsx)(Me,{id:`site-share-max-root-size-mb`,label:n.policySiteMaxRootDirSizeMb,hint:n.policySiteMaxRootDirSizeHint,value:r.siteMaxRootDirSizeMb,min:1,max:10240,disabled:ge,onChange:_e}),t[161]=r.siteMaxRootDirSizeMb,t[162]=n.policySiteMaxRootDirSizeHint,t[163]=n.policySiteMaxRootDirSizeMb,t[164]=ge,t[165]=_e,t[166]=ve):ve=t[166];let ye=!r.siteEnabled,be;t[167]===i?be=t[168]:(be=e=>i({siteMaxFileCount:e}),t[167]=i,t[168]=be);let q;t[169]!==r.siteMaxFileCount||t[170]!==n.policySiteMaxFileCount||t[171]!==n.policySiteMaxFileCountHint||t[172]!==ye||t[173]!==be?(q=(0,$.jsx)(Me,{id:`site-share-max-files`,label:n.policySiteMaxFileCount,hint:n.policySiteMaxFileCountHint,value:r.siteMaxFileCount,min:1,max:1e5,disabled:ye,onChange:be}),t[169]=r.siteMaxFileCount,t[170]=n.policySiteMaxFileCount,t[171]=n.policySiteMaxFileCountHint,t[172]=ye,t[173]=be,t[174]=q):q=t[174];let J;t[175]!==G||t[176]!==pe||t[177]!==he||t[178]!==ve||t[179]!==q?(J=(0,$.jsxs)(`div`,{className:`grid gap-3 sm:grid-cols-2`,children:[G,pe,he,ve,q]}),t[175]=G,t[176]=pe,t[177]=he,t[178]=ve,t[179]=q,t[180]=J):J=t[180];let Y;t[181]!==oe||t[182]!==ce||t[183]!==J?(Y=(0,$.jsxs)(`div`,{className:`rounded-xl bg-surface-base/45 p-4`,children:[oe,ce,J]}),t[181]=oe,t[182]=ce,t[183]=J,t[184]=Y):Y=t[184];let X;return t[185]!==N||t[186]!==V||t[187]!==Y?(X=(0,$.jsxs)(`div`,{className:`space-y-4`,children:[N,V,Y]}),t[185]=N,t[186]=V,t[187]=Y,t[188]=X):X=t[188],X}function Me(e){let t=(0,xe.c)(21),{id:n,label:r,hint:i,value:a,min:o,max:s,disabled:c,onChange:l}=e,u;t[0]!==n||t[1]!==r?(u=(0,$.jsx)(`label`,{className:`mb-1 block text-sm font-medium text-fg`,htmlFor:n,children:r}),t[0]=n,t[1]=r,t[2]=u):u=t[2];let f;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(f=d(ke(),`max-w-xs font-mono text-xs`),t[3]=f):f=t[3];let p;t[4]!==s||t[5]!==o||t[6]!==l?(p=e=>{let t=Number(e.target.value);Number.isFinite(t)&&l(Math.max(o,Math.min(s,Math.floor(t))))},t[4]=s,t[5]=o,t[6]=l,t[7]=p):p=t[7];let m;t[8]!==c||t[9]!==n||t[10]!==s||t[11]!==o||t[12]!==p||t[13]!==a?(m=(0,$.jsx)(ve,{id:n,type:`number`,min:o,max:s,disabled:c,className:f,value:a,onChange:p}),t[8]=c,t[9]=n,t[10]=s,t[11]=o,t[12]=p,t[13]=a,t[14]=m):m=t[14];let h;t[15]===i?h=t[16]:(h=(0,$.jsx)(`p`,{className:`mt-1 text-xs text-fg-subtle`,children:i}),t[15]=i,t[16]=h);let g;return t[17]!==u||t[18]!==m||t[19]!==h?(g=(0,$.jsxs)(`div`,{children:[u,m,h]}),t[17]=u,t[18]=m,t[19]=h,t[20]=g):g=t[20],g}function Ne(e){let t=(0,xe.c)(25),{t:n,values:r,disabled:i,onChange:a}=e,o;t[0]!==a||t[1]!==r?(o=e=>{let t=e.trim();!t||r.includes(t)||r.length>=32||a([...r,t])},t[0]=a,t[1]=r,t[2]=o):o=t[2];let s=o,c;t[3]===n.policyInlinePreviewMimes?c=t[4]:(c=(0,$.jsx)(`div`,{className:`text-sm font-medium text-fg`,children:n.policyInlinePreviewMimes}),t[3]=n.policyInlinePreviewMimes,t[4]=c);let l;t[5]===n.policyInlinePreviewMimesHint?l=t[6]:(l=(0,$.jsx)(`p`,{className:`text-xs text-fg-subtle`,children:n.policyInlinePreviewMimesHint}),t[5]=n.policyInlinePreviewMimesHint,t[6]=l);let u;t[7]!==i||t[8]!==a||t[9]!==r?(u=r.map(e=>(0,$.jsxs)(`span`,{className:`inline-flex items-center gap-1 rounded-md border border-edge bg-surface-panel px-2 py-0.5 font-mono text-xs text-fg`,children:[e,i?null:(0,$.jsx)(`button`,{type:`button`,className:`text-fg-muted hover:text-fg`,"aria-label":`Remove ${e}`,onClick:()=>a(r.filter(t=>t!==e)),children:`×`})]},e)),t[7]=i,t[8]=a,t[9]=r,t[10]=u):u=t[10];let f;t[11]===u?f=t[12]:(f=(0,$.jsx)(`div`,{className:`flex flex-wrap gap-1.5`,children:u}),t[11]=u,t[12]=f);let p;t[13]===Symbol.for(`react.memo_cache_sentinel`)?(p=d(ke(),`font-mono text-xs`),t[13]=p):p=t[13];let m=i||r.length>=32,h;t[14]===s?h=t[15]:(h=e=>{e.key===`Enter`&&(e.preventDefault(),s(e.target.value),e.target.value=``)},t[14]=s,t[15]=h);let g;t[16]!==n.policyMimePlaceholder||t[17]!==m||t[18]!==h?(g=(0,$.jsx)(`input`,{className:p,placeholder:n.policyMimePlaceholder,disabled:m,onKeyDown:h}),t[16]=n.policyMimePlaceholder,t[17]=m,t[18]=h,t[19]=g):g=t[19];let _;return t[20]!==c||t[21]!==l||t[22]!==f||t[23]!==g?(_=(0,$.jsxs)(`div`,{className:`space-y-2 rounded-xl bg-surface-base/45 p-4`,children:[c,l,f,g]}),t[20]=c,t[21]=l,t[22]=f,t[23]=g,t[24]=_):_=t[24],_}function Pe(e){let t=(0,xe.c)(70),{open:n,onOpenChange:r,onConfirm:i,initialPath:a,selectKind:c,conversationId:f,agentId:h}=e,g=c===void 0?`any`:c,y=u(m(Le)),b=y.workspace,x=y.sharesSettings,w=ae(Ie),{data:E}=_(p(Fe)?`picker-agents-list`:null,S),D;bb0:{let e;t[0]===h?e=t[1]:(e=h?.trim(),t[0]=h,t[1]=e);let n=e;if(n){D=n;break bb0}let r;t[2]===w?r=t[3]:(r=w.trim(),t[2]=w,t[3]=r);let i=r;if(i){D=i;break bb0}if(E?.defaultId){D=E.defaultId;break bb0}if(E?.agents?.[0]?.id){D=E.agents[0].id;break bb0}D=``}let O=D,[A,j]=(0,Y.useState)(O),N,P;t[4]===O?(N=t[5],P=t[6]):(N=()=>{j(O)},P=[O],t[4]=O,t[5]=N,t[6]=P),(0,Y.useEffect)(N,P);let{tree:te,loading:F,error:I,loadRoot:R,loadChildren:ne,reset:B}=me(A,f??null),V;t[7]===a?V=t[8]:(V=a?{path:a,isDirectory:!1}:null,t[7]=a,t[8]=V);let[H,U]=(0,Y.useState)(V),oe;t[9]!==a||t[10]!==R||t[11]!==n||t[12]!==B||t[13]!==U?(oe=()=>{if(!n){B(),U(a?{path:a,isDirectory:!1}:null);return}R()},t[9]=a,t[10]=R,t[11]=n,t[12]=B,t[13]=U,t[14]=oe):oe=t[14];let W;t[15]!==f||t[16]!==a||t[17]!==R||t[18]!==n||t[19]!==A||t[20]!==B?(W=[n,A,f,R,B,a],t[15]=f,t[16]=a,t[17]=R,t[18]=n,t[19]=A,t[20]=B,t[21]=W):W=t[21],(0,Y.useEffect)(oe,W);let se;t[22]===ne?se=t[23]:(se=e=>{ne(e)},t[22]=ne,t[23]=se);let ce=se,le=H!==null&&(g===`any`||g===`file`&&!H.isDirectory||g===`directory`&&H.isDirectory),G;bb1:{if(!H){G=x.pickerHintNone;break bb1}if(g===`file`&&H.isDirectory){G=x.pickerHintNeedsFile;break bb1}if(g===`directory`&&!H.isDirectory){G=x.pickerHintNeedsDirectory;break bb1}G=`${H.isDirectory?`📁`:`📄`} ${H.path}`}let de=G,fe=E?.agents??[],pe;t[24]===Symbol.for(`react.memo_cache_sentinel`)?(pe=(0,$.jsx)(z,{className:`xopc-dialog-overlay fixed inset-0 z-[70] bg-scrim backdrop-blur-[2px]`}),t[24]=pe):pe=t[24];let K;t[25]===Symbol.for(`react.memo_cache_sentinel`)?(K=d(`xopc-dialog-content fixed left-1/2 top-1/2 z-[71] w-[min(34rem,calc(100vw-2rem))] -translate-x-1/2 -translate-y-1/2`,`flex h-[min(28rem,calc(100vh-3rem))] flex-col overflow-hidden rounded-lg border border-edge bg-surface-overlay shadow-popover outline-none`),t[25]=K):K=t[25];let he;t[26]===Symbol.for(`react.memo_cache_sentinel`)?(he=(0,$.jsx)(ie,{className:`size-4 shrink-0 text-fg-muted`,"aria-hidden":!0}),t[26]=he):he=t[26];let _e=y.cron.refresh,ve=y.cron.refresh,ye;t[27]===R?ye=t[28]:(ye=()=>void R(),t[27]=R,t[28]=ye);let be=F&&`animate-spin`,q;t[29]===be?q=t[30]:(q=d(`size-4`,be),t[29]=be,t[30]=q);let J;t[31]===q?J=t[32]:(J=(0,$.jsx)(re,{className:q,"aria-hidden":!0}),t[31]=q,t[32]=J);let X;t[33]===Symbol.for(`react.memo_cache_sentinel`)?(X=(0,$.jsx)(ee,{className:`size-4`}),t[33]=X):X=t[33];let Se;t[34]!==I||t[35]!==b.loadError?(Se=I?(0,$.jsxs)(`p`,{className:`shrink-0 px-4 py-2 text-xs text-red-600 dark:text-red-400`,children:[b.loadError,`: `,I]}):null,t[34]=I,t[35]=b.loadError,t[36]=Se):Se=t[36];let Z;t[37]!==ce||t[38]!==F||t[39]!==H?.path||t[40]!==U||t[41]!==b.emptyDir||t[42]!==b.title||t[43]!==te?(Z=F&&te.length===0?(0,$.jsxs)(`p`,{className:`flex shrink-0 items-center gap-2 px-4 py-3 text-sm text-fg-muted`,children:[(0,$.jsx)(l,{className:`size-4 animate-spin`}),b.title,`…`]}):(0,$.jsx)(ue,{tree:te,selectedPath:H?.path??null,onSelectFile:e=>U({path:e,isDirectory:!1}),onSelectEntry:(e,t)=>U({path:e,isDirectory:t}),onExpandDir:ce,onAction:void 0,emptyHint:b.emptyDir}),t[37]=ce,t[38]=F,t[39]=H?.path,t[40]=U,t[41]=b.emptyDir,t[42]=b.title,t[43]=te,t[44]=Z):Z=t[44];let Ce;t[45]!==Se||t[46]!==Z?(Ce=(0,$.jsxs)(`div`,{className:`flex min-h-0 flex-1 flex-col overflow-hidden`,children:[Se,Z]}),t[45]=Se,t[46]=Z,t[47]=Ce):Ce=t[47];let Q;t[48]===de?Q=t[49]:(Q=(0,$.jsx)(`p`,{className:`min-w-0 flex-1 truncate text-xs text-fg-muted`,children:de}),t[48]=de,t[49]=Q);let we;t[50]===r?we=t[51]:(we=()=>r(!1),t[50]=r,t[51]=we);let Te;t[52]!==x.cancel||t[53]!==we?(Te=(0,$.jsx)(v,{type:`button`,variant:`ghost`,onClick:we,children:x.cancel}),t[52]=x.cancel,t[53]=we,t[54]=Te):Te=t[54];let Ee=!le,De;t[55]!==i||t[56]!==r||t[57]!==A||t[58]!==H?(De=()=>{H&&(i({...H,agentId:A}),r(!1))},t[55]=i,t[56]=r,t[57]=A,t[58]=H,t[59]=De):De=t[59];let Oe;t[60]!==x.pickerConfirm||t[61]!==Ee||t[62]!==De?(Oe=(0,$.jsx)(v,{type:`button`,disabled:Ee,onClick:De,children:x.pickerConfirm}),t[60]=x.pickerConfirm,t[61]=Ee,t[62]=De,t[63]=Oe):Oe=t[63];let ke;t[64]!==Te||t[65]!==Oe?(ke=(0,$.jsxs)(`div`,{className:`flex shrink-0 gap-2`,children:[Te,Oe]}),t[64]=Te,t[65]=Oe,t[66]=ke):ke=t[66];let Ae;return t[67]!==Q||t[68]!==ke?(Ae=(0,$.jsxs)(`div`,{className:`flex shrink-0 items-center justify-between gap-3 border-t border-edge px-4 py-3`,children:[Q,ke]}),t[67]=Q,t[68]=ke,t[69]=Ae):Ae=t[69],(0,$.jsx)(L,{open:n,onOpenChange:r,children:(0,$.jsxs)(ge,{children:[pe,(0,$.jsxs)(M,{className:K,children:[(0,$.jsxs)(`div`,{className:`flex h-11 shrink-0 items-center gap-2 border-b border-edge px-4`,children:[he,(0,$.jsx)(T,{className:`min-w-0 flex-1 truncate text-base font-semibold text-fg`,children:x.pickerTitle}),(0,$.jsx)(`button`,{type:`button`,className:`inline-flex size-8 shrink-0 items-center justify-center rounded-md text-fg-muted hover:bg-surface-hover hover:text-fg disabled:opacity-50`,title:_e,"aria-label":ve,disabled:F,onClick:ye,children:J}),(0,$.jsx)(k,{asChild:!0,children:(0,$.jsx)(`button`,{type:`button`,className:`inline-flex size-8 shrink-0 items-center justify-center rounded-md text-fg-muted hover:bg-surface-hover hover:text-fg`,"aria-label":b.close,children:X})})]}),fe.length>0?(0,$.jsxs)(`div`,{className:`flex shrink-0 items-center gap-2 border-b border-edge px-4 py-2`,children:[(0,$.jsx)(`label`,{className:`text-xs text-fg-muted`,htmlFor:`picker-agent-select`,children:x.pickerAgentLabel}),(0,$.jsx)(o,{id:`picker-agent-select`,className:`min-w-0 flex-1 rounded-md border border-edge bg-surface-panel px-2 py-1 text-sm text-fg focus:outline-none focus:ring-2 focus:ring-accent`,value:A,onChange:e=>{j(e.target.value),U(null)},children:fe.map(e=>(0,$.jsxs)(s,{value:e.id,children:[C(e,y.agentsSettings),e.id===E?.defaultId?` ★`:``]},e.id))})]}):null,Ce,Ae]})]})})}function Fe(e){return e.conversationId}function Ie(e){return e.agentId}function Le(e){return e.language}var Re=[`shares`,`policy`];function ze(e){let t=(e??``).trim();return Re.includes(t)?t:`shares`}function Be(e){return e<1024?`${e} B`:e<1024*1024?`${(e/1024).toFixed(1)} KB`:e<1024*1024*1024?`${(e/(1024*1024)).toFixed(1)} MB`:`${(e/(1024*1024*1024)).toFixed(1)} GB`}function Ve(e,t){let n=new Date(e).getTime()-Date.now(),r=Math.abs(n),i=n<0;if(r<6e4)return t===`zh`?`刚刚`:`just now`;let a=Math.floor(r/6e4);if(a<60){let e=t===`zh`?`${a} 分钟`:`${a}m`;return i?t===`zh`?`${e}前`:`${e} ago`:e}let o=Math.floor(a/60);if(o<24){let e=t===`zh`?`${o} 小时`:`${o}h`;return i?t===`zh`?`${e}前`:`${e} ago`:e}let s=Math.floor(o/24),c=t===`zh`?`${s} 天`:`${s}d`;return i?t===`zh`?`${c}前`:`${c} ago`:c}var He=[{value:36e5,key:`1h`},{value:216e5,key:`6h`},{value:864e5,key:`24h`},{value:2592e5,key:`3d`},{value:6048e5,key:`7d`},{value:2592e6,key:`30d`}];function Ue(){let e=(0,xe.c)(23),t=m(Ge),n=u(t).sharesSettings,r=!!p(We),[a,o]=i(),s;e[0]===a?s=e[1]:(s=ze(a.get(`tab`)),e[0]=a,e[1]=s);let c=s,l;e[2]===o?l=e[3]:(l=e=>{o(t=>{let n=new URLSearchParams(t);return e===`shares`?n.delete(`tab`):n.set(`tab`,e),n},{replace:!0})},e[2]=o,e[3]=l);let d=l;if(!r)return(0,$.jsx)(be,{gap:`gap-3`,padding:`px-3 py-8 sm:px-5 xl:px-6`,children:(0,$.jsx)(`p`,{className:`text-sm text-fg-muted`,children:n.needToken})});let f={shares:n.tabShares,policy:n.tabPolicy},h=Re.map(e=>({id:e,label:f[e]})),g;e[4]===n.title?g=e[5]:(g=(0,$.jsx)(ye,{title:n.title}),e[4]=n.title,e[5]=g);let _;e[6]!==c||e[7]!==d||e[8]!==n.tabsAria||e[9]!==h?(_=(0,$.jsx)(U,{items:h,activeTab:c,onChange:d,ariaLabel:n.tabsAria,tabIdPrefix:`shares-tab`,panelIdPrefix:`shares-panel`}),e[6]=c,e[7]=d,e[8]=n.tabsAria,e[9]=h,e[10]=_):_=e[10];let v;e[11]!==c||e[12]!==r||e[13]!==t||e[14]!==n?(v=c===`shares`?(0,$.jsx)(Ke,{t:n,language:t}):(0,$.jsx)(Ae,{hasToken:r}),e[11]=c,e[12]=r,e[13]=t,e[14]=n,e[15]=v):v=e[15];let y;e[16]!==c||e[17]!==v?(y=(0,$.jsx)(q,{id:c,activeTab:c,tabIdPrefix:`shares-tab`,panelIdPrefix:`shares-panel`,showHeading:!1,children:v}),e[16]=c,e[17]=v,e[18]=y):y=e[18];let b;return e[19]!==g||e[20]!==_||e[21]!==y?(b=(0,$.jsxs)(be,{children:[g,_,y]}),e[19]=g,e[20]=_,e[21]=y,e[22]=b):b=e[22],b}function We(e){return e.conversationId}function Ge(e){return e.language}function Ke(e){let t=(0,xe.c)(79),{t:n,language:r}=e,i;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(i={refreshInterval:3e4},t[0]=i):i=t[0];let{data:a,error:o,isLoading:s,mutate:c}=_(`shares-list`,ne,i),l;t[1]===Symbol.for(`react.memo_cache_sentinel`)?(l={refreshInterval:3e4},t[1]=l):l=t[1];let u=_(`hosted-publications-list`,te,l),f;t[2]===a?.payload?.shares?f=t[3]:(f=a?.payload?.shares??[],t[2]=a?.payload?.shares,t[3]=f);let p=f,[m,h]=(0,Y.useState)(!1),g;bb0:{if(m){g=p;break bb0}let e;t[4]===p?e=t[5]:(e=p.filter(Ze),t[4]=p,t[5]=e),g=e}let y=g,b;t[6]===p?b=t[7]:(b=p.filter(Xe),t[6]=p,t[7]=b);let x=b.length,S;t[8]===p?S=t[9]:(S=p.filter(Ye),t[8]=p,t[9]=S);let C=S.length,w;t[10]===c?w=t[11]:(w=()=>void c(),t[10]=c,t[11]=w);let T;t[12]!==n||t[13]!==w?(T=(0,$.jsx)(rt,{t:n,onCreated:w}),t[12]=n,t[13]=w,t[14]=T):T=t[14];let E=u.data?.connected===!0,D=u.data?.publishingAllowed===!0,O;t[15]===u?O=t[16]:(O=()=>void u.mutate(),t[15]=u,t[16]=O);let k;t[17]!==r||t[18]!==D||t[19]!==O||t[20]!==E?(k=(0,$.jsx)(Qe,{language:r,connected:E,publishingAllowed:D,onCreated:O}),t[17]=r,t[18]=D,t[19]=O,t[20]=E,t[21]=k):k=t[21];let A=m?n.allSharesTitle:n.listTitle,j;t[22]===x?j=t[23]:(j=x>0&&(0,$.jsxs)(`span`,{className:`ml-2 text-xs font-normal text-fg-muted`,children:[`(`,x,`)`]}),t[22]=x,t[23]=j);let M;t[24]!==A||t[25]!==j?(M=(0,$.jsxs)(`h2`,{className:`text-sm font-semibold text-fg`,children:[A,j]}),t[24]=A,t[25]=j,t[26]=M):M=t[26];let N;t[27]===c?N=t[28]:(N=()=>void c(),t[27]=c,t[28]=N);let ee=s&&`animate-spin`,P;t[29]===ee?P=t[30]:(P=d(`size-3.5`,ee),t[29]=ee,t[30]=P);let F;t[31]===P?F=t[32]:(F=(0,$.jsx)(re,{className:P}),t[31]=P,t[32]=F);let I;t[33]!==s||t[34]!==N||t[35]!==F?(I=(0,$.jsx)(v,{type:`button`,variant:`ghost`,className:`px-2 py-1`,onClick:N,disabled:s,children:F}),t[33]=s,t[34]=N,t[35]=F,t[36]=I):I=t[36];let L;t[37]!==C||t[38]!==m||t[39]!==n.hideExpired||t[40]!==n.showExpired?(L=C>0&&(0,$.jsx)(`button`,{type:`button`,className:`text-xs text-accent hover:underline`,onClick:()=>h(Je),children:m?n.hideExpired:n.showExpired}),t[37]=C,t[38]=m,t[39]=n.hideExpired,t[40]=n.showExpired,t[41]=L):L=t[41];let R;t[42]!==I||t[43]!==L?(R=(0,$.jsxs)(`div`,{className:`flex items-center gap-2`,children:[I,L]}),t[42]=I,t[43]=L,t[44]=R):R=t[44];let ie;t[45]!==M||t[46]!==R?(ie=(0,$.jsxs)(`div`,{className:`mb-3 flex items-center justify-between`,children:[M,R]}),t[45]=M,t[46]=R,t[47]=ie):ie=t[47];let z;t[48]!==a||t[49]!==o||t[50]!==y||t[51]!==s||t[52]!==r||t[53]!==c||t[54]!==n?(z=s&&!a?(0,$.jsx)(`div`,{className:`grid gap-2`,"aria-busy":`true`,children:Array.from({length:4}).map(qe)}):o?(0,$.jsxs)(`div`,{className:`flex items-center gap-2 text-sm text-red-600 dark:text-red-400`,children:[(0,$.jsx)(`span`,{children:n.error}),(0,$.jsx)(v,{type:`button`,variant:`ghost`,className:`px-2 py-1 text-xs`,onClick:()=>void c(),children:n.retry})]}):y.length===0?(0,$.jsx)(`p`,{className:`text-sm text-fg-muted`,children:n.emptyState}):(0,$.jsx)(`div`,{className:`flex flex-col gap-2`,children:y.map(e=>(0,$.jsx)(at,{share:e,t:n,language:r,onRevoked:()=>void c(),onExtended:()=>void c()},e.id))}),t[48]=a,t[49]=o,t[50]=y,t[51]=s,t[52]=r,t[53]=c,t[54]=n,t[55]=z):z=t[55];let B;t[56]!==C||t[57]!==c||t[58]!==m||t[59]!==n?(B=C>0&&m&&(0,$.jsx)(ot,{t:n,onCleaned:()=>void c()}),t[56]=C,t[57]=c,t[58]=m,t[59]=n,t[60]=B):B=t[60];let ae;t[61]!==ie||t[62]!==z||t[63]!==B?(ae=(0,$.jsxs)(J,{children:[ie,z,B]}),t[61]=ie,t[62]=z,t[63]=B,t[64]=ae):ae=t[64];let V;t[65]===u?V=t[66]:(V=()=>void u.mutate(),t[65]=u,t[66]=V);let H;t[67]!==u.data||t[68]!==u.error||t[69]!==u.isLoading||t[70]!==r||t[71]!==n||t[72]!==V?(H=(0,$.jsx)($e,{data:u.data,error:u.error,isLoading:u.isLoading,language:r,t:n,onChanged:V}),t[67]=u.data,t[68]=u.error,t[69]=u.isLoading,t[70]=r,t[71]=n,t[72]=V,t[73]=H):H=t[73];let U;return t[74]!==k||t[75]!==ae||t[76]!==H||t[77]!==T?(U=(0,$.jsxs)(`div`,{className:`flex flex-col gap-6`,children:[T,k,ae,H]}),t[74]=k,t[75]=ae,t[76]=H,t[77]=T,t[78]=U):U=t[78],U}function qe(e,t){return(0,$.jsx)(`div`,{className:`rounded-lg bg-surface-base/55 p-3`,children:(0,$.jsxs)(`div`,{className:`flex items-start justify-between gap-3`,children:[(0,$.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,$.jsx)(y,{className:`h-4 w-2/3`}),(0,$.jsx)(y,{className:`mt-2 h-3 w-1/2`})]}),(0,$.jsx)(y,{className:`h-7 w-20 rounded-md`})]})},t)}function Je(e){return!e}function Ye(e){return e.expired||e.revoked}function Xe(e){return!e.expired&&!e.revoked}function Ze(e){return!e.expired&&!e.revoked}function Qe({language:e,connected:t,publishingAllowed:n,onCreated:r}){let i=e===`zh`,[a,c]=(0,Y.useState)(``),[u,d]=(0,Y.useState)(``),[f,p]=(0,Y.useState)(!1),[m,h]=(0,Y.useState)(!1),[_,y]=(0,Y.useState)(``),[b,x]=(0,Y.useState)(6048e5),[S,C]=(0,Y.useState)(!1),[w,T]=(0,Y.useState)(null),[E,O]=(0,Y.useState)(null),k=async()=>{if(a.trim()){C(!0),O(null);try{T(await D({path:a.trim(),title:_.trim()||void 0,ttlMs:b,spaFallback:!0,...u?{agentId:u}:{}})),r()}catch(e){O(e instanceof Error?e.message:String(e))}finally{C(!1)}}};return(0,$.jsxs)(J,{children:[(0,$.jsxs)(`div`,{className:`flex items-start gap-3`,children:[(0,$.jsx)(K,{className:`mt-0.5 size-4 shrink-0 text-accent`,"aria-hidden":!0}),(0,$.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,$.jsx)(`h2`,{className:`text-sm font-semibold text-fg`,children:i?`发布静态网站`:`Publish static website`}),(0,$.jsx)(`p`,{className:`mt-1 text-xs text-fg-muted`,children:i?`把工作区内的 HTML 文件,或包含 index.html 的网站目录,发布到隔离的托管域名。`:`Publish an HTML file or a website directory containing index.html to the isolated hosted origin.`}),t&&!n?(0,$.jsx)(`p`,{className:`mt-3 rounded-md bg-warning-soft px-3 py-2 text-xs text-warning`,children:i?`管理员已暂停你的公网分享能力。已有远端链接当前不可访问;你仍可在下方撤销它们。`:`An administrator has paused public sharing for your account. Existing hosted links are unavailable, but you can still revoke them below.`}):null,(0,$.jsxs)(`div`,{className:`mt-3 grid gap-3 sm:grid-cols-[1fr_12rem]`,children:[(0,$.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2`,children:[(0,$.jsx)(`input`,{value:a,onChange:e=>{c(e.target.value),p(!1),T(null)},placeholder:i?`选择 HTML 文件或网站目录`:`Select an HTML file or website directory`,className:`h-9 min-w-0 flex-1 rounded-md border border-edge bg-surface-panel px-3 text-sm text-fg outline-none placeholder:text-fg-subtle focus:border-accent`}),(0,$.jsxs)(v,{type:`button`,variant:`ghost`,className:`shrink-0`,onClick:()=>h(!0),children:[a&&!f?(0,$.jsx)(de,{className:`size-4`}):(0,$.jsx)(ie,{className:`size-4`}),a?i?`更换`:`Change`:i?`选择`:`Browse`]})]}),(0,$.jsxs)(o,{value:String(b),onChange:e=>x(Number(e.target.value)),children:[(0,$.jsx)(s,{value:`86400000`,children:i?`24 小时`:`24 hours`}),(0,$.jsx)(s,{value:`604800000`,children:i?`7 天`:`7 days`}),(0,$.jsx)(s,{value:`2592000000`,children:i?`30 天`:`30 days`})]}),(0,$.jsx)(`input`,{value:_,onChange:e=>y(e.target.value),placeholder:i?`网站标题(可选)`:`Site title (optional)`,className:`h-9 rounded-md border border-edge bg-surface-panel px-3 text-sm text-fg outline-none focus:border-accent sm:col-span-2`})]}),(0,$.jsxs)(`div`,{className:`mt-3 flex items-center gap-3`,children:[(0,$.jsxs)(v,{type:`button`,onClick:()=>void k(),disabled:!a.trim()||S||!t||!n,children:[S?(0,$.jsx)(l,{className:`size-4 animate-spin`}):(0,$.jsx)(K,{className:`size-4`}),S?i?`发布中…`:`Publishing…`:i?`发布网站`:`Publish site`]}),w?(0,$.jsxs)(`button`,{type:`button`,className:`min-w-0 truncate text-xs text-accent hover:underline`,onClick:()=>void g(w.shareUrl),children:[w.shareUrl,` · `,w.fileCount,` `,i?`个文件`:`files`,` · `,Be(w.totalBytes)]}):null]}),E?(0,$.jsx)(`p`,{className:`mt-3 text-xs text-danger`,children:E}):null]})]}),(0,$.jsx)(Pe,{open:m,onOpenChange:h,initialPath:a||void 0,agentId:u||void 0,selectKind:`any`,onConfirm:e=>{c(e.path),d(e.agentId),p(e.isDirectory),T(null),O(null)}})]})}function $e(e){let t=(0,xe.c)(18),{data:n,error:r,isLoading:i,language:a,t:o,onChanged:s}=e,c;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(c=(0,$.jsx)(K,{className:`size-4 text-accent`,"aria-hidden":!0}),t[0]=c):c=t[0];let l;t[1]===o.hostedTitle?l=t[2]:(l=(0,$.jsxs)(`h2`,{className:`flex items-center gap-2 text-sm font-semibold text-fg`,children:[c,o.hostedTitle]}),t[1]=o.hostedTitle,t[2]=l);let u;t[3]===o.hostedHint?u=t[4]:(u=(0,$.jsx)(`p`,{className:`mt-1 text-xs text-fg-muted`,children:o.hostedHint}),t[3]=o.hostedHint,t[4]=u);let d;t[5]!==l||t[6]!==u?(d=(0,$.jsx)(`div`,{className:`mb-3 flex items-start justify-between gap-3`,children:(0,$.jsxs)(`div`,{children:[l,u]})}),t[5]=l,t[6]=u,t[7]=d):d=t[7];let f;t[8]!==n||t[9]!==r||t[10]!==i||t[11]!==a||t[12]!==s||t[13]!==o?(f=i&&!n?(0,$.jsx)(`div`,{className:`grid gap-2`,"aria-busy":`true`,children:Array.from({length:2}).map(et)}):r?(0,$.jsx)(`p`,{className:`text-sm text-red-600 dark:text-red-400`,children:o.error}):n?.connected?(0,$.jsxs)(`div`,{className:`space-y-3`,children:[n.publishingAllowed?null:(0,$.jsx)(`p`,{className:`rounded-md bg-warning-soft px-3 py-2 text-xs text-warning`,children:a===`zh`?`管理员已暂停公网分享。已有托管链接当前不可访问,也不能更新;撤销操作仍然可用。`:`An administrator has paused public sharing. Existing hosted links are unavailable and cannot be updated; revocation remains available.`}),n.publications.length===0?(0,$.jsx)(`p`,{className:`text-sm text-fg-muted`,children:o.hostedEmpty}):(0,$.jsx)(`div`,{className:`flex flex-col gap-2`,children:n.publications.map(e=>(0,$.jsx)(tt,{publication:e,language:a,t:o,publishingAllowed:n.publishingAllowed,onChanged:s},e.id))})]}):(0,$.jsxs)(`div`,{className:`space-y-3`,children:[(0,$.jsx)(`p`,{className:`text-sm text-fg-muted`,children:o.hostedDisconnected}),(0,$.jsx)(I,{providerId:`xopc-share`,displayName:`XOPC Hosted Share`,connected:!1,onConnected:s})]}),t[8]=n,t[9]=r,t[10]=i,t[11]=a,t[12]=s,t[13]=o,t[14]=f):f=t[14];let p;return t[15]!==d||t[16]!==f?(p=(0,$.jsxs)(J,{children:[d,f]}),t[15]=d,t[16]=f,t[17]=p):p=t[17],p}function et(e,t){return(0,$.jsxs)(`div`,{className:`rounded-lg bg-surface-base/55 p-3`,children:[(0,$.jsx)(y,{className:`h-4 w-2/3`}),(0,$.jsx)(y,{className:`mt-2 h-3 w-1/2`})]},t)}function tt({publication:e,language:t,t:n,publishingAllowed:r,onChanged:i}){let[o,s]=(0,Y.useState)(!1),[u,f]=(0,Y.useState)(!1),[p,m]=(0,Y.useState)(!1),[h,_]=(0,Y.useState)(!1),[y,b]=(0,Y.useState)(!1),x=Date.now()>=new Date(e.expiresAt).getTime(),S=e.status===`active`&&!x,C=e.status===`revoked`?n.statusRevoked:x?n.statusExpired:e.status===`staging`?t===`zh`?`准备中`:`Staging`:n.statusActive,w=e.kind===`note_document`?pe:e.kind===`static_site`?K:se,T=e.kind===`note_document`?t===`zh`?`笔记文档`:`Note document`:e.kind===`static_site`?t===`zh`?`静态网站`:`Static website`:t===`zh`?`会话快照`:`Conversation snapshot`,E=(0,Y.useCallback)(async()=>{e.shareUrl&&await g(e.shareUrl)&&(m(!0),window.setTimeout(()=>m(!1),2e3))},[e.shareUrl]),D=(0,Y.useCallback)(async()=>{s(!1),f(!0);try{await N(e.id),i()}catch{}finally{f(!1)}},[e.id,i]),O=(0,Y.useCallback)(async()=>{if(!(!e.revision||e.revision<=1)){_(!0);try{let t=(await ce(e.id)).find(t=>t.revision<e.revision);if(!t)return;await B(e.id,e.revision,t.revision),i()}catch{}finally{_(!1)}}},[e.id,e.revision,i]),k=(0,Y.useCallback)(async()=>{b(!0);try{await A(e.id),i()}catch{}finally{b(!1)}},[e.id,i]);return(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(`div`,{className:`rounded-lg bg-surface-base/55 px-3 py-2.5`,children:(0,$.jsxs)(`div`,{className:`flex items-start gap-3`,children:[(0,$.jsx)(w,{className:`mt-0.5 size-4 shrink-0 text-fg-muted`,"aria-hidden":!0}),(0,$.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,$.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,$.jsx)(`span`,{className:`truncate text-sm font-medium text-fg`,children:e.title}),(0,$.jsx)(`span`,{className:d(`text-xs font-medium`,S?`text-emerald-600 dark:text-emerald-400`:`text-fg-subtle`),children:C})]}),(0,$.jsxs)(`p`,{className:`mt-0.5 text-xs text-fg-subtle`,children:[T,` · `,n.hostedRevision,` `,e.revision??`—`,` · `,e.managedFromThisDevice?n.hostedThisDevice:n.hostedOtherDevice]}),(0,$.jsxs)(`div`,{className:`mt-1 flex flex-wrap gap-x-3 gap-y-1 text-xs text-fg-muted`,children:[(0,$.jsxs)(`span`,{children:[t===`zh`?`浏览`:`Views`,`: `,e.viewCount,e.maxViews===null?``:` / ${e.maxViews}`]}),(0,$.jsx)(`span`,{children:x?n.statusExpired:Ve(e.expiresAt,t)}),e.description?(0,$.jsx)(`span`,{className:`italic`,children:e.description}):null]})]}),S?(0,$.jsxs)(`div`,{className:`flex shrink-0 items-center gap-1`,children:[e.shareUrl?(0,$.jsx)(v,{type:`button`,variant:`ghost`,className:`px-2 py-1`,disabled:!r,title:n.copyUrl,onClick:()=>void E(),children:p?(0,$.jsx)(a,{className:`size-3.5 text-emerald-500`}):(0,$.jsx)(c,{className:`size-3.5`})}):null,(e.revision??0)>1?(0,$.jsx)(v,{type:`button`,variant:`ghost`,className:`px-2 py-1`,disabled:h||!r,onClick:()=>void O(),title:t===`zh`?`回滚上一版本`:`Roll back one revision`,children:h?(0,$.jsx)(l,{className:`size-3.5 animate-spin`}):(0,$.jsx)(j,{className:`size-3.5`})}):null,e.kind===`static_site`&&e.managedFromThisDevice?(0,$.jsx)(v,{type:`button`,variant:`ghost`,className:`px-2 py-1`,disabled:y||!r,onClick:()=>void k(),title:t===`zh`?`发布工作区中的最新版本`:`Publish latest workspace version`,children:(0,$.jsx)(re,{className:d(`size-3.5`,y&&`animate-spin`)})}):null,(0,$.jsx)(v,{type:`button`,variant:`ghost`,className:`px-2 py-1 text-red-600 hover:text-red-700 dark:text-red-400`,disabled:u,onClick:()=>s(!0),children:u?(0,$.jsx)(l,{className:`size-3.5 animate-spin`}):(0,$.jsx)(fe,{className:`size-3.5`})})]}):null]})}),(0,$.jsx)(W,{open:o,title:n.revokeConfirmTitle,description:n.revokeConfirmBody,confirmLabel:n.revokeConfirmLabel,cancelLabel:n.cancel,destructive:!0,onConfirm:()=>void D(),onCancel:()=>s(!1)})]})}var nt={expanded:!0,path:``,isDirectory:!1,agentId:``,ttlMs:864e5,maxViews:null,description:``,directoryMode:`browse`,creating:!1,result:null,errorMsg:null,resultDialogOpen:!1,pickerOpen:!1};function rt({t:e,onCreated:t}){let[n,r]=(0,Y.useReducer)(G,nt),{expanded:i,path:a,isDirectory:c,agentId:u,ttlMs:f,maxViews:p,description:m,directoryMode:h,creating:g,result:_,errorMsg:y,resultDialogOpen:b,pickerOpen:x}=n,S=(0,Y.useCallback)(async()=>{if(a.trim()){r({type:`patch`,patch:{creating:!0,errorMsg:null,result:null}});try{r({type:`patch`,patch:{result:(await F({path:a.trim(),ttlMs:f,maxViews:p,description:m.trim()||void 0,...u?{agentId:u}:{},...c?{kind:`directory`,directoryMode:h}:{}})).payload,resultDialogOpen:!0}}),t()}catch(e){r({type:`patch`,patch:{errorMsg:e instanceof Error?e.message:String(e)}})}finally{r({type:`patch`,patch:{creating:!1}})}}},[a,c,u,f,p,m,h,t]),C=(0,Y.useCallback)(()=>{r({type:`patch`,patch:{path:``,isDirectory:!1,agentId:``,description:``,maxViews:null,ttlMs:864e5,directoryMode:`browse`,result:null,errorMsg:null}})},[]);return i?(0,$.jsxs)(J,{children:[(0,$.jsx)(`h2`,{className:`mb-1 text-sm font-semibold text-fg`,children:e.createTitle}),(0,$.jsx)(`p`,{className:`mb-4 text-xs text-fg-muted`,children:e.createHint}),(0,$.jsxs)(`div`,{className:`flex flex-col gap-3`,children:[(0,$.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,$.jsx)(`span`,{className:`text-xs font-medium text-fg`,children:e.pathLabel}),(0,$.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,$.jsx)(`div`,{className:d(`flex min-w-0 flex-1 items-center gap-2 rounded-lg border border-edge bg-surface-panel px-3 py-2 text-sm`,a?`text-fg`:`text-fg-subtle`),children:a?(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(`span`,{"aria-hidden":!0,children:c?`📁`:`📄`}),(0,$.jsx)(`span`,{className:`min-w-0 flex-1 truncate`,title:a,children:a})]}):(0,$.jsx)(`span`,{className:`truncate`,children:e.pathPlaceholder})}),(0,$.jsxs)(v,{type:`button`,variant:`ghost`,onClick:()=>r({type:`patch`,patch:{pickerOpen:!0}}),children:[(0,$.jsx)(de,{className:`size-4`}),a?e.pathBrowseChange:e.pathBrowse]})]})]}),c?(0,$.jsxs)(`label`,{className:`flex flex-col gap-1`,children:[(0,$.jsx)(`span`,{className:`text-xs font-medium text-fg`,children:e.directoryModeLabel}),(0,$.jsxs)(o,{className:`rounded-lg border border-edge bg-surface-panel px-3 py-2 text-sm text-fg focus:outline-none focus:ring-2 focus:ring-accent`,value:h,onChange:e=>r({type:`patch`,patch:{directoryMode:e.target.value===`zip-only`?`zip-only`:`browse`}}),children:[(0,$.jsx)(s,{value:`browse`,children:e.directoryModeBrowse}),(0,$.jsx)(s,{value:`zip-only`,children:e.directoryModeZipOnly})]})]}):null,(0,$.jsxs)(`div`,{className:`flex flex-wrap gap-3`,children:[(0,$.jsxs)(`label`,{className:`flex flex-col gap-1`,children:[(0,$.jsx)(`span`,{className:`text-xs font-medium text-fg`,children:e.ttlLabel}),(0,$.jsx)(o,{className:`rounded-lg border border-edge bg-surface-panel px-3 py-2 text-sm text-fg focus:outline-none focus:ring-2 focus:ring-accent`,value:f,onChange:e=>r({type:`patch`,patch:{ttlMs:Number(e.target.value)}}),children:He.map(t=>(0,$.jsx)(s,{value:t.value,children:e.ttlOptions[t.key]},t.key))})]}),(0,$.jsxs)(`label`,{className:`flex flex-col gap-1`,children:[(0,$.jsx)(`span`,{className:`text-xs font-medium text-fg`,children:e.maxViewsLabel}),(0,$.jsxs)(o,{className:`rounded-lg border border-edge bg-surface-panel px-3 py-2 text-sm text-fg focus:outline-none focus:ring-2 focus:ring-accent`,value:p??`unlimited`,onChange:e=>r({type:`patch`,patch:{maxViews:e.target.value===`unlimited`?null:Number(e.target.value)}}),children:[(0,$.jsx)(s,{value:`unlimited`,children:e.maxViewsUnlimited}),(0,$.jsx)(s,{value:`1`,children:`1`}),(0,$.jsx)(s,{value:`5`,children:`5`}),(0,$.jsx)(s,{value:`10`,children:`10`}),(0,$.jsx)(s,{value:`50`,children:`50`}),(0,$.jsx)(s,{value:`100`,children:`100`})]})]})]}),(0,$.jsxs)(`label`,{className:`flex flex-col gap-1`,children:[(0,$.jsx)(`span`,{className:`text-xs font-medium text-fg`,children:e.descriptionLabel}),(0,$.jsx)(`input`,{type:`text`,className:`rounded-lg border border-edge bg-surface-panel px-3 py-2 text-sm text-fg placeholder:text-fg-subtle focus:outline-none focus:ring-2 focus:ring-accent`,placeholder:e.descriptionPlaceholder,value:m,onChange:e=>r({type:`patch`,patch:{description:e.target.value}})})]}),(0,$.jsxs)(`div`,{className:`flex items-center gap-2 pt-1`,children:[(0,$.jsxs)(v,{type:`button`,disabled:g||!a.trim(),onClick:()=>void S(),children:[g?(0,$.jsx)(l,{className:`size-4 animate-spin`}):(0,$.jsx)(H,{className:`size-4`}),g?e.creating:e.createButton]}),(0,$.jsx)(v,{type:`button`,variant:`ghost`,onClick:()=>{C(),r({type:`patch`,patch:{expanded:!1}})},children:e.cancel})]}),y&&(0,$.jsx)(`p`,{className:`text-sm text-red-600 dark:text-red-400`,children:y})]}),(0,$.jsx)(E,{open:b,onOpenChange:e=>{r({type:`patch`,patch:{resultDialogOpen:e,...e?{}:{result:null}}})},result:_}),(0,$.jsx)(Pe,{open:x,onOpenChange:e=>r({type:`patch`,patch:{pickerOpen:e}}),initialPath:a||void 0,selectKind:`any`,onConfirm:e=>r({type:`patch`,patch:{path:e.path,isDirectory:e.isDirectory,agentId:e.agentId,directoryMode:`browse`}})})]}):(0,$.jsxs)(v,{type:`button`,onClick:()=>r({type:`patch`,patch:{expanded:!0}}),className:`self-start`,children:[(0,$.jsx)(H,{className:`size-4`}),e.createTitle]})}var it={revokeOpen:!1,revoking:!1,linksOpen:!1,urlCopied:!1,copyFailed:!1,extending:!1};function at({share:e,t,language:n,onRevoked:r,onExtended:i}){let[o,s]=(0,Y.useReducer)(G,it),{revokeOpen:u,revoking:f,linksOpen:p,urlCopied:m,copyFailed:h,extending:_}=o,y=!e.expired&&!e.revoked,b=e.revoked?t.statusRevoked:e.expired?t.statusExpired:t.statusActive,x=e.revoked?`text-red-600 dark:text-red-400`:e.expired?`text-fg-subtle`:`text-emerald-600 dark:text-emerald-400`,S=(0,Y.useCallback)(async()=>{s({type:`patch`,patch:{revokeOpen:!1,revoking:!0}});try{await P(e.id),r()}catch{}finally{s({type:`patch`,patch:{revoking:!1}})}},[e.id,r]),C=(0,Y.useCallback)(async()=>{if(s({type:`patch`,patch:{linksOpen:!0,copyFailed:!1}}),!await g(e.shareUrl)){s({type:`patch`,patch:{copyFailed:!0}}),window.setTimeout(()=>s({type:`patch`,patch:{copyFailed:!1}}),2500);return}s({type:`patch`,patch:{urlCopied:!0}}),window.setTimeout(()=>s({type:`patch`,patch:{urlCopied:!1}}),2e3)},[e.shareUrl]),w=(0,Y.useCallback)(async()=>{s({type:`patch`,patch:{extending:!0}});try{await le(e.id,864e5),i()}catch{}finally{s({type:`patch`,patch:{extending:!1}})}},[e.id,i]),T=`share-links-${e.id}`;return(0,$.jsxs)($.Fragment,{children:[(0,$.jsxs)(`div`,{className:`rounded-lg bg-surface-panel/80 px-3 py-2.5 shadow-surface`,children:[(0,$.jsxs)(`div`,{className:`flex items-start gap-3`,children:[(0,$.jsxs)(`button`,{type:`button`,className:d(`flex min-w-0 flex-1 items-start gap-3 rounded-md text-left`,`focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`),"aria-expanded":p,"aria-controls":T,onClick:()=>s({type:`patch`,patch:{linksOpen:!p}}),children:[(0,$.jsx)(R,{className:d(`mt-0.5 size-4 shrink-0 text-fg-muted transition-transform`,p?`rotate-0`:`-rotate-90`),"aria-hidden":!0}),e.kind===`note`?(0,$.jsx)(pe,{className:`mt-0.5 size-4 shrink-0 text-fg-muted`,"aria-hidden":!0}):e.kind===`session`?(0,$.jsx)(se,{className:`mt-0.5 size-4 shrink-0 text-fg-muted`,"aria-hidden":!0}):(0,$.jsx)(de,{className:`mt-0.5 size-4 shrink-0 text-fg-muted`,"aria-hidden":!0}),(0,$.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,$.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,$.jsx)(`span`,{className:`truncate text-sm font-medium text-fg`,children:e.fileName}),(0,$.jsx)(`span`,{className:d(`text-xs font-medium`,x),children:b})]}),(0,$.jsx)(`p`,{className:`truncate text-xs text-fg-subtle`,children:e.kind===`note`?n===`zh`?`笔记快照 · 版本 ${e.snapshotRevision??1}`:`Note snapshot · revision ${e.snapshotRevision??1}`:e.kind===`session`?n===`zh`?`会话快照 · ${e.messageCount??0} 条消息 · 版本 ${e.snapshotRevision??1}`:`Conversation snapshot · ${e.messageCount??0} messages · revision ${e.snapshotRevision??1}`:e.workspaceRelativePath}),(0,$.jsxs)(`div`,{className:`mt-1 flex flex-wrap items-center gap-x-3 gap-y-1 text-xs text-fg-muted`,children:[(0,$.jsx)(`span`,{children:Be(e.fileSize)}),(0,$.jsxs)(`span`,{className:`flex items-center gap-1`,children:[(0,$.jsx)(oe,{className:`size-3`}),e.expired?n===`zh`?`已过期`:`expired`:Ve(e.expiresAt,n)]}),(0,$.jsxs)(`span`,{children:[t.views,`: `,e.downloadCount,e.maxViews!==null&&` ${t.viewsOf} ${e.maxViews}`]}),e.description&&(0,$.jsx)(`span`,{className:`italic text-fg-subtle`,children:e.description})]})]})]}),(0,$.jsx)(`div`,{className:`flex shrink-0 items-center gap-1`,children:y&&(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(v,{type:`button`,variant:`ghost`,className:`px-2 py-1`,title:t.copyUrl,onClick:()=>void C(),children:m?(0,$.jsx)(a,{className:`size-3.5 text-emerald-500`}):(0,$.jsx)(c,{className:`size-3.5`})}),(0,$.jsx)(v,{type:`button`,variant:`ghost`,className:`px-2 py-1`,onClick:()=>void w(),disabled:_,title:t.extend,children:_?(0,$.jsx)(l,{className:`size-3.5 animate-spin`}):(0,$.jsx)(oe,{className:`size-3.5`})}),(0,$.jsx)(v,{type:`button`,variant:`ghost`,className:`px-2 py-1 text-red-600 hover:text-red-700 dark:text-red-400`,onClick:()=>s({type:`patch`,patch:{revokeOpen:!0}}),disabled:f,children:f?(0,$.jsx)(l,{className:`size-3.5 animate-spin`}):(0,$.jsx)(fe,{className:`size-3.5`})})]})})]}),y&&p?(0,$.jsxs)(`div`,{id:T,className:`mt-3 bg-surface-base/45 py-3 pl-7 pr-3`,children:[(0,$.jsx)(V,{shareUrl:e.shareUrl,lanUrl:e.lanUrl,reachability:e.reachability,compact:!0}),h?(0,$.jsx)(`p`,{className:`mt-2 text-xs text-red-600 dark:text-red-400`,children:t.copyFailed}):null,(0,$.jsx)(`div`,{className:`mt-2`,children:(0,$.jsx)(_e,{reachability:e.reachability})})]}):null]}),(0,$.jsx)(W,{open:u,title:t.revokeConfirmTitle,description:t.revokeConfirmBody,confirmLabel:t.revokeConfirmLabel,cancelLabel:t.cancel,destructive:!0,onConfirm:()=>void S(),onCancel:()=>s({type:`patch`,patch:{revokeOpen:!1}})})]})}function ot({t:e,onCleaned:t}){let[n,r]=(0,Y.useState)(!1),[i,a]=(0,Y.useState)(!1),o=(0,Y.useCallback)(async()=>{r(!1),a(!0);try{await O(),t()}catch{}finally{a(!1)}},[t]);return(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(`div`,{className:`mt-3 flex justify-end`,children:(0,$.jsxs)(v,{type:`button`,variant:`secondary`,disabled:i,onClick:()=>r(!0),className:`border-danger/40 px-2 py-1 text-xs text-danger hover:bg-danger/10`,children:[i?(0,$.jsx)(l,{className:`size-3.5 animate-spin`}):(0,$.jsx)(fe,{className:`size-3.5`}),e.cleanExpired]})}),(0,$.jsx)(W,{open:n,title:e.cleanExpiredConfirmTitle,description:e.cleanExpiredConfirmBody,confirmLabel:e.cleanExpiredConfirmLabel,cancelLabel:e.cancel,destructive:!0,onConfirm:()=>void o(),onCancel:()=>r(!1)})]})}export{Ue as SharesSettingsPanel};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{n as e}from"./rolldown-runtime-aKtaBQYM.js";import{a as t,i as n}from"./locale-store-DAgpZxAS.js";import{li as r}from"./index-CiDVRMmX.js";var i=e({reloadSkills:()=>a});async function a(){let e=await t(n(`/api/skills/reload`),{method:`POST`});if(!e.ok)throw Error(await r(e))}export{i as n,a as t};
|