@xopcai/xopc 0.0.413 → 0.0.414
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-BT6oqCMD.js → agent-avatar-dicebear-ClobpdW3.js} +1 -1
- package/dist/gateway/static/root/assets/{agent-defaults-settings-panel-BFmRRD_4.js → agent-defaults-settings-panel-mf0jgEPE.js} +1 -1
- package/dist/gateway/static/root/assets/agents-CKhZ4UYQ.js +77 -0
- package/dist/gateway/static/root/assets/{app-management-settings-panel-BdCgtTfT.js → app-management-settings-panel-CLunLNGp.js} +1 -1
- package/dist/gateway/static/root/assets/app-window-DXFNqt_0.js +1 -0
- package/dist/gateway/static/root/assets/{appearance-settings-C3-hCFlF.js → appearance-settings-DBEgoE9g.js} +1 -1
- package/dist/gateway/static/root/assets/apps-page-BZ_MaQJf.js +1 -0
- package/dist/gateway/static/root/assets/{archive-plugin-BviFGCy4.js → archive-plugin-JElK4Goq.js} +1 -1
- package/dist/gateway/static/root/assets/{automations-page-CfzazXE5.js → automations-page-CZ0UqwyU.js} +1 -1
- package/dist/gateway/static/root/assets/automations-workspace-CHUDHNVL.js +8 -0
- package/dist/gateway/static/root/assets/{binary-plugins-Dp-gtJEk.js → binary-plugins-CXFawow6.js} +1 -1
- package/dist/gateway/static/root/assets/{block-editor-D-DEPdpi.js → block-editor-BoduwSYI.js} +30 -30
- package/dist/gateway/static/root/assets/browser-automations-page-DStDm9y1.js +3 -0
- package/dist/gateway/static/root/assets/browser-settings-page-6I4oetKt.js +3 -0
- package/dist/gateway/static/root/assets/capabilities-page-C-EecWbS.js +2 -0
- package/dist/gateway/static/root/assets/capabilities-settings-panel-BQoCPk3x.js +8 -0
- package/dist/gateway/static/root/assets/{capability-header-actions-CP2fI9Fe.js → capability-header-actions-BasrAWA0.js} +1 -1
- package/dist/gateway/static/root/assets/{channels-DWlrUKBr.js → channels-BKf_-Mdt.js} +1 -1
- package/dist/gateway/static/root/assets/{chat-terminal-dock-BL3tFntQ.js → chat-terminal-dock-CwQbzcZ_.js} +1 -1
- package/dist/gateway/static/root/assets/chevron-down-ccbiQQz_.js +1 -0
- package/dist/gateway/static/root/assets/{computer-settings-page-DEQ5GYfC.js → computer-settings-page-DNWeJKfF.js} +1 -1
- package/dist/gateway/static/root/assets/{connector-service-page-CecwMnC5.js → connector-service-page-CxHgC5RM.js} +1 -1
- package/dist/gateway/static/root/assets/connectors-page-CUBg8spT.js +1 -0
- package/dist/gateway/static/root/assets/{date-picker-N5jnlvPs.js → date-picker-CXxLbLJb.js} +1 -1
- package/dist/gateway/static/root/assets/dependency-picker-DVuWMrSj.js +1 -0
- package/dist/gateway/static/root/assets/desktop-pet-KbVLtAlO.js +1 -0
- package/dist/gateway/static/root/assets/desktop-pet-settings-BDlg9g4s.js +1 -0
- package/dist/gateway/static/root/assets/device-pairing-wizard-PmP_vGem.js +1 -0
- package/dist/gateway/static/root/assets/{directory-picker-path-field-CbMbPimD.js → directory-picker-path-field-a7xEodzo.js} +1 -1
- package/dist/gateway/static/root/assets/ellipsis-0k4rZLoy.js +1 -0
- package/dist/gateway/static/root/assets/{extension-debug-page-OE1nJMQ8.js → extension-debug-page-CHelH5u_.js} +1 -1
- package/dist/gateway/static/root/assets/{extension-page-BEomiKhy.js → extension-page-CrVHmS9-.js} +1 -1
- package/dist/gateway/static/root/assets/{extension-settings-page-BFOjQeSX.js → extension-settings-page-CiMybi0r.js} +1 -1
- package/dist/gateway/static/root/assets/eye-CABVeTq0.js +1 -0
- package/dist/gateway/static/root/assets/folder-open-CyzJ19I9.js +1 -0
- package/dist/gateway/static/root/assets/{gateway-settings-CR4CsfNN.js → gateway-settings-DnrQ28E2.js} +1 -1
- package/dist/gateway/static/root/assets/{highlight-code-6ONPRH5r.js → highlight-code-AMjU04kR.js} +1 -1
- package/dist/gateway/static/root/assets/{highlighted-body-KQOG7T2V-EJ9Kg4iQ.js → highlighted-body-KQOG7T2V-8ACAVktj.js} +1 -1
- package/dist/gateway/static/root/assets/home-page-pTwVME-g.js +2 -0
- package/dist/gateway/static/root/assets/{image-generation-api-D0HNic89.js → image-generation-api-CVBaWmrV.js} +1 -1
- package/dist/gateway/static/root/assets/imports-page-C5IP3e6d.js +1 -0
- package/dist/gateway/static/root/assets/{index-D_7q1UkI.css → index-BLL0wKRZ.css} +1 -1
- package/dist/gateway/static/root/assets/index-ygkHNYyo.js +710 -0
- package/dist/gateway/static/root/assets/{keyboard-shortcuts-settings-Cmi-2SIh.js → keyboard-shortcuts-settings-BhU6VYvd.js} +1 -1
- package/dist/gateway/static/root/assets/local-app-workbench-page-Cwl6EvuX.js +1 -0
- package/dist/gateway/static/root/assets/{local-apps-page-jgaogH9Z.js → local-apps-page-DcP1Bdlk.js} +1 -1
- package/dist/gateway/static/root/assets/logs-page-CS3hcTOq.js +2 -0
- package/dist/gateway/static/root/assets/{management-settings-Dc1opXVr.js → management-settings-DC-Y_-GP.js} +1 -1
- package/dist/gateway/static/root/assets/{media-plugins-BRS9puQV.js → media-plugins-BnPpcJ2J.js} +1 -1
- package/dist/gateway/static/root/assets/mermaid-MCJ5UELQ-vckgHpON.js +1 -0
- package/dist/gateway/static/root/assets/note-detail-panel-C7u4dxEk.js +5 -0
- package/dist/gateway/static/root/assets/note-image-lightbox-jvqYtySx.js +1 -0
- package/dist/gateway/static/root/assets/notes-page-Bs7F5Hpf.js +8 -0
- package/dist/gateway/static/root/assets/page-context-capture-button-DO_yhXS1.js +1 -0
- package/dist/gateway/static/root/assets/personal-page-BexL2-PQ.js +1 -0
- package/dist/gateway/static/root/assets/{phone-dependencies-card-DhEsfEUN.js → phone-dependencies-card-ChFtdFhA.js} +1 -1
- package/dist/gateway/static/root/assets/phone-model-picker-CZoIAQ1j.js +1 -0
- package/dist/gateway/static/root/assets/phone-settings-page-DRyK0nHH.js +1 -0
- package/dist/gateway/static/root/assets/{plugin-details-dialog-1BwvmKZi.js → plugin-details-dialog-B-N61jJH.js} +1 -1
- package/dist/gateway/static/root/assets/{preview-open-alternatives-DaTaSKox.js → preview-open-alternatives-FGqN-mQx.js} +1 -1
- package/dist/gateway/static/root/assets/{product-open-page-wYlC0IVZ.js → product-open-page-CwnHLfdL.js} +1 -1
- package/dist/gateway/static/root/assets/{product-preview-content-Bxur-p6S.js → product-preview-content-BD6k5hF9.js} +1 -1
- package/dist/gateway/static/root/assets/project-detail-page-DtKmFBml.js +7 -0
- package/dist/gateway/static/root/assets/projects-page-CFZIz9mc.js +1 -0
- package/dist/gateway/static/root/assets/remote-access-hub-CWEc7W0m.js +1 -0
- package/dist/gateway/static/root/assets/{runtime-tools-settings-panel-DXNidliV.js → runtime-tools-settings-panel-q_oswAdV.js} +1 -1
- package/dist/gateway/static/root/assets/{schema-form-DeSZ7SiO.js → schema-form-DoVn5jJK.js} +1 -1
- package/dist/gateway/static/root/assets/sessions-page-BuPqNxpd.js +1 -0
- package/dist/gateway/static/root/assets/settings-advanced-gate-QTVDCGJG.js +1 -0
- package/dist/gateway/static/root/assets/{settings-form-section-BNYQjZU4.js → settings-form-section-Ce8vVv-9.js} +1 -1
- package/dist/gateway/static/root/assets/{settings-page-29Ix0jSQ.js → settings-page-DP2w3ejC.js} +1 -1
- package/dist/gateway/static/root/assets/{setup-status-panel-COQZgKX9.js → setup-status-panel-ZmlE8jIE.js} +1 -1
- package/dist/gateway/static/root/assets/{share-preview-page-CwMRULXc.js → share-preview-page-DV4dKrmG.js} +1 -1
- package/dist/gateway/static/root/assets/shares-settings-CtNxWqW-.js +1 -0
- package/dist/gateway/static/root/assets/{skill-api-xfB5fUAh.js → skill-api-DTdejInH.js} +1 -1
- package/dist/gateway/static/root/assets/{skill-reload-api-Bq-3_MCt.js → skill-reload-api-Egaf8PqZ.js} +1 -1
- package/dist/gateway/static/root/assets/skills-page-C6FKxf4J.js +2 -0
- package/dist/gateway/static/root/assets/{system-settings-panel-DRJu1ehM.js → system-settings-panel-Baxkhov7.js} +1 -1
- package/dist/gateway/static/root/assets/task-detail-page-C77-rpkt.js +2 -0
- package/dist/gateway/static/root/assets/{task-result-evidence-C4o_Yue_.js → task-result-evidence-DIGSC4qF.js} +1 -1
- package/dist/gateway/static/root/assets/{tracing-settings-page-CYslh-Pu.js → tracing-settings-page-BaU8frtc.js} +1 -1
- package/dist/gateway/static/root/assets/{tunnel-api-Bi_kw6bv.js → tunnel-api-BCcOUsqu.js} +1 -1
- package/dist/gateway/static/root/assets/usage-page-BFeIbpbi.js +1 -0
- package/dist/gateway/static/root/assets/{use-autosave-BkB9uD93.js → use-autosave-C1X47WVb.js} +1 -1
- package/dist/gateway/static/root/assets/user-model-page-u8zY5jea.js +2 -0
- package/dist/gateway/static/root/assets/{voice-api-key-field-bt8_Agih.js → voice-api-key-field-Bk4DQMTw.js} +1 -1
- package/dist/gateway/static/root/assets/{work-discovery-overlay-D3NG14dX.js → work-discovery-overlay-B7_NmTB5.js} +1 -1
- package/dist/gateway/static/root/assets/{xopc-cloud-account-card-B2OUKOQi.js → xopc-cloud-account-card-CJ_akAvc.js} +1 -1
- package/dist/gateway/static/root/index.html +7 -2
- package/dist/package.js +1 -1
- package/dist/src/agent/agent-manager.js +1 -1
- package/dist/src/agent/background-review/run-background-review.js +1 -1
- 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/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/phone.d.ts +1 -1
- package/dist/src/agent/tool-manuals/phone.js +2 -2
- package/dist/src/agent/tools/personal-read-tool.js +1 -1
- package/dist/src/agent/tools/phone-use-tool.js +2 -2
- 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/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/commands/agents.js +1 -1
- package/dist/src/cli/commands/extension-marketplace.js +2 -2
- package/dist/src/cli/commands/extension.js +2 -2
- 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/utils/init-workspace-core.js +1 -1
- package/dist/src/config/agent-profile.js +1 -1
- 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/extensions/update.js +1 -1
- package/dist/src/gateway/agents-admin.js +2 -2
- package/dist/src/gateway/global-defaults-admin.js +1 -1
- package/dist/src/gateway/hono/routes/agents.js +1 -1
- package/dist/src/gateway/hono/routes/auth-registry-extensions.js +1 -1
- package/dist/src/gateway/hono/routes/config-patch/misc.js +1 -1
- package/dist/src/gateway/hono/routes/notes.js +2 -2
- package/dist/src/gateway/hono/routes/phone.js +25 -4
- package/dist/src/gateway/hono/routes/projects.js +2 -2
- 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/service/config-coordinator.js +1 -1
- package/dist/src/gateway/service.js +2 -2
- package/dist/src/gateway/xopc-cloud-capability-setup.js +1 -1
- package/dist/src/imports/importService.js +1 -1
- package/dist/src/infra/update-runner.js +1 -1
- package/dist/src/local-apps/service.js +1 -1
- package/dist/src/personal-agent/service.js +1 -1
- package/dist/src/phone/adb-driver.d.ts +5 -2
- package/dist/src/phone/adb-driver.js +25 -1
- package/dist/src/phone/app-access.d.ts +10 -0
- package/dist/src/phone/app-access.js +21 -0
- package/dist/src/phone/applications.d.ts +4 -0
- package/dist/src/phone/applications.js +49 -0
- package/dist/src/phone/cloud-adb.d.ts +1 -0
- package/dist/src/phone/cloud-adb.js +52 -2
- package/dist/src/phone/cloud-phones.js +2 -1
- package/dist/src/phone/cloud-scrcpy.js +2 -1
- package/dist/src/phone/contracts.d.ts +9 -1
- package/dist/src/phone/contracts.js +2 -1
- package/dist/src/phone/model-adapter.d.ts +8 -2
- package/dist/src/phone/model-adapter.js +14 -4
- package/dist/src/phone/repository.js +4 -3
- package/dist/src/phone/runtime.d.ts +6 -1
- package/dist/src/phone/runtime.js +36 -8
- package/dist/src/phone/scrcpy-assets.d.ts +4 -0
- package/dist/src/phone/scrcpy-assets.js +16 -0
- package/dist/src/phone/scrcpy.d.ts +1 -4
- package/dist/src/phone/scrcpy.js +3 -11
- package/dist/src/runtime-tools/archive.js +1 -1
- package/dist/src/tasks/capabilities/read.js +2 -2
- package/dist/src/tasks/capabilities/write.js +1 -1
- package/dist/src/tui/backends/embedded-backend.js +1 -1
- package/dist/src/voice/realtime/persona-context.js +1 -1
- package/package.json +3 -3
- package/dist/gateway/static/root/assets/agents-Clwskw2J.js +0 -77
- package/dist/gateway/static/root/assets/apps-page-DJbKg3va.js +0 -1
- package/dist/gateway/static/root/assets/automations-workspace-D_X0_1X3.js +0 -8
- package/dist/gateway/static/root/assets/browser-automations-page-BI-ep6uM.js +0 -3
- package/dist/gateway/static/root/assets/browser-settings-page-BTyQ4-vN.js +0 -3
- package/dist/gateway/static/root/assets/capabilities-page-GNS95mG9.js +0 -2
- package/dist/gateway/static/root/assets/capabilities-settings-panel-DBiv1HN-.js +0 -8
- package/dist/gateway/static/root/assets/connectors-page-BcpUvrtl.js +0 -1
- package/dist/gateway/static/root/assets/dependency-picker-C4jddxFl.js +0 -1
- package/dist/gateway/static/root/assets/desktop-pet-BCbiUNQG.js +0 -1
- package/dist/gateway/static/root/assets/desktop-pet-settings-CkKU0JMY.js +0 -1
- package/dist/gateway/static/root/assets/device-pairing-wizard--E2GQoY1.js +0 -1
- package/dist/gateway/static/root/assets/home-page-B9w3a6r2.js +0 -2
- package/dist/gateway/static/root/assets/imports-page-bxTINe-2.js +0 -1
- package/dist/gateway/static/root/assets/index-D1oivYvN.js +0 -710
- package/dist/gateway/static/root/assets/local-app-workbench-page-NGCmXpa_.js +0 -1
- package/dist/gateway/static/root/assets/logs-page-drrr-c2W.js +0 -2
- package/dist/gateway/static/root/assets/mermaid-MCJ5UELQ-B--edI1I.js +0 -1
- package/dist/gateway/static/root/assets/note-detail-panel-C3s4-ytB.js +0 -5
- package/dist/gateway/static/root/assets/note-image-lightbox-D7q5-KuS.js +0 -1
- package/dist/gateway/static/root/assets/notes-page-qVxoErUS.js +0 -8
- package/dist/gateway/static/root/assets/page-context-capture-button-D_VOB2_C.js +0 -1
- package/dist/gateway/static/root/assets/personal-page-B-T8NzQo.js +0 -1
- package/dist/gateway/static/root/assets/phone-model-picker-J4mFDk21.js +0 -1
- package/dist/gateway/static/root/assets/phone-settings-page-BLflz8CQ.js +0 -1
- package/dist/gateway/static/root/assets/project-detail-page-DwowzxzD.js +0 -7
- package/dist/gateway/static/root/assets/projects-page-Bwvn4i_e.js +0 -1
- package/dist/gateway/static/root/assets/remote-access-hub-DrHisOUe.js +0 -1
- package/dist/gateway/static/root/assets/sessions-page-seP7t0kv.js +0 -1
- package/dist/gateway/static/root/assets/settings-advanced-gate-VqBu7gHu.js +0 -1
- package/dist/gateway/static/root/assets/shares-settings-BWaykw9E.js +0 -1
- package/dist/gateway/static/root/assets/skills-page-C3LfWsAZ.js +0 -2
- package/dist/gateway/static/root/assets/task-detail-page-XCJFP-Aa.js +0 -2
- package/dist/gateway/static/root/assets/usage-page-CTTmklCs.js +0 -1
- package/dist/gateway/static/root/assets/user-model-page-BDqguzRE.js +0 -2
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{a as t,n,t as r}from"./vendor-react-BOUWij0V.js";import{t as i}from"./chunk-KS7C4IRE-BvcCCgTW.js";import{n as a,r as o}from"./popover-select-DGKUpVsz.js";import{t as s}from"./folder-open-CyzJ19I9.js";import{t as c}from"./loader-circle-CifKLtgG.js";import{t as ee}from"./messages-RzwPiQNL.js";import{t as l}from"./cn-0WouolD0.js";import{n as u}from"./locale-store-JogcXC4J.js";import{t as d}from"./button-aIC072nz.js";import{t as f}from"./skeleton-BI5TyibZ.js";import{$u as te,Ba as p,Bc as m,Ea as h,Fa as g,Fc as _,Hl as v,Ia as y,Ic as b,Kl as x,La as S,Lc as C,Pl as w,Rc as T,Ta as E,Vc as D,Xd as ne,ba as O,da as k,ha as A,io as j,kl as M,qc as re,qd as N,ql as P,zc as ie}from"./index-ygkHNYyo.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)(f,{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=u(V),c,l,f,p,m,h,g,_;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,g=`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]})]}),u;t[20]===o?u=t[21]:(u=(0,R.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2`,children:[r,o]}),t[20]=o,t[21]=u);let d;t[22]===Symbol.for(`react.memo_cache_sentinel`)?(d=(0,R.jsx)(N,{className:`mt-2 size-4 shrink-0 text-fg-subtle transition-transform group-hover:translate-x-0.5`,"aria-hidden":!0}),t[22]=d):d=t[22];let v;t[23]===u?v=t[24]:(v=(0,R.jsxs)(`div`,{className:`flex items-start justify-between gap-3`,children:[u,d]}),t[23]=u,t[24]=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:[v,(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})]}),h=`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}),l=`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]=l,t[11]=f,t[12]=p,t[13]=m,t[14]=h,t[15]=g,t[16]=_}else c=t[9],l=t[10],f=t[11],p=t[12],m=t[13],h=t[14],g=t[15],_=t[16];let v;t[25]!==l||t[26]!==f?(v=(0,R.jsx)(`p`,{className:l,children:f}),t[25]=l,t[26]=f,t[27]=v):v=t[27];let y;t[28]!==p||t[29]!==m||t[30]!==v?(y=(0,R.jsxs)(`div`,{className:p,children:[m,v]}),t[28]=p,t[29]=m,t[30]=v,t[31]=y):y=t[31];let b=n.pinnedAt?c.unpin:c.pin,S=n.pinnedAt?c.unpin:c.pin,C;t[32]===n.pinnedAt?C=t[33]:(C=n.pinnedAt?(0,R.jsx)(x,{className:`size-4`,"aria-hidden":!0}):(0,R.jsx)(P,{className:`size-4`,"aria-hidden":!0}),t[32]=n.pinnedAt,t[33]=C);let T;t[34]!==r||t[35]!==a||t[36]!==b||t[37]!==S||t[38]!==C?(T=(0,R.jsx)(d,{type:`button`,variant:`ghost`,className:`size-8 p-0`,disabled:r,onClick:a,"aria-label":b,title:S,children:C}),t[34]=r,t[35]=a,t[36]=b,t[37]=S,t[38]=C,t[39]=T):T=t[39];let E=n.status===`archived`?c.restore:c.archive,D=n.status===`archived`?c.restore:c.archive,O;t[40]===n.status?O=t[41]:(O=n.status===`archived`?(0,R.jsx)(w,{className:`size-4`,"aria-hidden":!0}):(0,R.jsx)(ne,{className:`size-4`,"aria-hidden":!0}),t[40]=n.status,t[41]=O);let k;t[42]!==r||t[43]!==o||t[44]!==E||t[45]!==D||t[46]!==O?(k=(0,R.jsx)(d,{type:`button`,variant:`ghost`,className:`size-8 p-0`,disabled:r,onClick:o,"aria-label":E,title:D,children:O}),t[42]=r,t[43]=o,t[44]=E,t[45]=D,t[46]=O,t[47]=k):k=t[47];let A;t[48]!==T||t[49]!==k?(A=(0,R.jsxs)(`div`,{className:`flex shrink-0 gap-1`,children:[T,k]}),t[48]=T,t[49]=k,t[50]=A):A=t[50];let j;t[51]!==A||t[52]!==h||t[53]!==y?(j=(0,R.jsxs)(`div`,{className:h,children:[y,A]}),t[51]=A,t[52]=h,t[53]=y,t[54]=j):j=t[54];let M;return t[55]!==j||t[56]!==g||t[57]!==_?(M=(0,R.jsxs)(`article`,{className:g,children:[_,j]}),t[55]=j,t[56]=g,t[57]=_,t[58]=M):M=t[58],M}function V(e){return e.language}function H(){let e=ee(u(e=>e.language)),t=e.projectsPage,n=t.management,r=e.chat.workingDirectory,i=j(e=>e.setPageHeader),f=j(e=>e.clearPageHeader),[x,w]=(0,L.useState)([]),[ne,N]=(0,L.useState)(!0),[P,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||(N(!0),F(null));try{let e=await g({limit:100,sortBy:`updatedAt`,sortOrder:`desc`});t===Z.current&&w(ae(e.items))}catch(n){!e&&t===Z.current&&F(n instanceof Error?n.message:String(n))}finally{t===Z.current&&N(!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 x.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,x,I]),ve=(0,L.useMemo)(()=>(0,R.jsxs)(d,{type:`button`,variant:`primary`,className:`h-9 rounded-lg`,onClick:()=>U(!0),children:[(0,R.jsx)(v,{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}),()=>f()),[f,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 h({autoUnderstand:K,name:t,...J.trim()?{description:J.trim()}:{},workspaceRoot:n});w(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 p(e.id,e.version):await y(e.id,e.version):e.status===`archived`?await S(e.id,e.version):await E(e.id,e.version),w(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)(_,{open:de,onOpenChange:e=>{U(e),e||W(null)},children:(0,R.jsxs)(m,{children:[(0,R.jsx)(ie,{className:`xopc-dialog-overlay fixed inset-0 z-[80] bg-scrim backdrop-blur-[2px]`}),(0,R.jsxs)(C,{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)(D,{className:`text-base font-semibold text-fg`,children:t.createTitle}),(0,R.jsx)(T,{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)(c,{className:`size-5 shrink-0 animate-spin text-accent`,"aria-hidden":!0}):(0,R.jsx)(s,{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:l(`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)(O,{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)(b,{asChild:!0,children:(0,R.jsx)(d,{type:`button`,variant:`ghost`,children:t.cancel})}),(0,R.jsx)(d,{type:`submit`,variant:`primary`,disabled:G||!q.trim()||!Y.trim(),children:G?t.home.creating:t.create})]})]})]})]})}),X.hasNativePicker?null:(0,R.jsx)(k,{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:l(`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)(M,{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)(re,{className:`size-3.5`,"aria-hidden":!0})})]}):(0,R.jsx)(d,{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)(M,{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))})]})]}),P?(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:P}),(0,R.jsx)(d,{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};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{a as t,n,t as r}from"./vendor-react-BOUWij0V.js";import{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"./chevron-down-ccbiQQz_.js";import{t as l}from"./copy-Dv6d4Dvw.js";import{t as u}from"./external-link-DjqjBmc3.js";import{t as d}from"./globe-DSSGFWFn.js";import{t as f}from"./loader-circle-CifKLtgG.js";import{t as p}from"./messages-RzwPiQNL.js";import{t as m}from"./cn-0WouolD0.js";import{l as h,n as g}from"./locale-store-JogcXC4J.js";import{t as _}from"./copy-to-clipboard-HOJ79TWv.js";import{i as v}from"./vendor-swr-BIWyz7Rc.js";import{t as y}from"./button-aIC072nz.js";import{n as b,r as x}from"./gateway-config-swr-DF_HV6NP.js";import{i as S,o as C}from"./settings-shell-dialog-layer-BU3UuiJr.js";import{At as w,Bc as T,Bl as E,Cd as D,Dl as O,Eo as k,Fc as A,Fu as j,Ii as M,Lc as N,Lt as P,Nt as F,Pn as I,Rc as L,S as R,Vc as z,cl as B,f as V,iu as H,jd as U,jt as W,m as ee,ma as te,na as ne,p as re,qd as G,rl as K,vo as ie,xl as q,yl as J,zc as ae}from"./index-ygkHNYyo.js";import{n as oe,t as se}from"./settings-page-header-CYpuTXUW.js";import{t as ce}from"./settings-page-layout-B20AfmFG.js";import{n as Y,r as le,t as ue}from"./settings-form-section-Ce8vVv-9.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-BCcOUsqu.js";import{t as Ce}from"./settings-advanced-gate-QTVDCGJG.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=m(`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=m(`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=g(Oe),i;t[0]===r?i=t[1]:(i=p(r),t[0]=r,t[1]=i);let a=i.remoteAccess.guide,o=!!h(De),s;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(s={refreshInterval:3e4},t[2]=s):s=t[2];let{data:c}=v(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:u}=v(o?`tunnel-status`:null,ge,l),f=x(o);if(!o)return null;let _=c?.tailscale.active===!0,y=u?.state,b=u?.enabled&&y===`connected`,S=u?.enabled&&(y===`connecting`||y===`reconnecting`||!!u?.startProgress||!!u?.frpcDownload),C=f.data?.payload?.config,w=!!(C&&typeof C==`object`&&!Array.isArray(C)&&C.gateway?.publicUrl),T=_?`active`:`off`,E=_?a.statusActive:a.statusOff,D;t[4]!==a.tailscaleCardTitle||t[5]!==T||t[6]!==E?(D={tab:`tailscale`,icon:d,title:a.tailscaleCardTitle,kind:T,statusLabel:E},t[4]=a.tailscaleCardTitle,t[5]=T,t[6]=E,t[7]=D):D=t[7];let k=b?`active`:S?`connecting`:`off`,A=b?a.statusActive:S?a.statusConnecting:a.statusOff,j;t[8]!==a.publicCardTitle||t[9]!==k||t[10]!==A?(j={tab:`public`,icon:H,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:q,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:B,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:O,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]!==D||t[26]!==j?(L=[D,j,P,F,I],t[22]=P,t[23]=F,t[24]=I,t[25]=D,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:m(`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=m(`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 p;t[11]===r?p=t[12]:(p=(0,$.jsx)(`p`,{className:`mt-1 text-sm leading-relaxed text-fg-muted`,children:r}),t[11]=r,t[12]=p);let h;t[13]!==f||t[14]!==p?(h=(0,$.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[f,p]}),t[13]=f,t[14]=p,t[15]=h):h=t[15];let g;t[16]===Symbol.for(`react.memo_cache_sentinel`)?(g=(0,$.jsx)(U,{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=g(Ne),i;t[0]===r?i=t[1]:(i=p(r),t[0]=r,t[1]=i);let a=i.remoteAccess,o=a.guide,s=!!h(Me),c;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(c={refreshInterval:3e4},t[2]=c):c=t[2];let{data:l}=v(s?`exposure-status`:null,Se,c),u;t[3]===l?.conflicts?u=t[4]:(u=l?.conflicts??[],t[3]=l?.conflicts,t[4]=u);let f=u;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 m;t[7]===n?m=t[8]:(m=(0,$.jsx)(Ee,{onOpenTab:n}),t[7]=n,t[8]=m);let _;t[9]!==f||t[10]!==o.conflictsHint||t[11]!==o.conflictsTitle?(_=f.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:f.map(je)})]}):null,t[9]=f,t[10]=o.conflictsHint,t[11]=o.conflictsTitle,t[12]=_):_=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:d,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:H,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 T;t[30]!==o.reverseProxyCardDesc||t[31]!==o.reverseProxyCardTitle||t[32]!==w?(T=(0,$.jsx)(ke,{icon:q,title:o.reverseProxyCardTitle,description:o.reverseProxyCardDesc,onOpen:w}),t[30]=o.reverseProxyCardDesc,t[31]=o.reverseProxyCardTitle,t[32]=w,t[33]=T):T=t[33];let E;t[34]===n?E=t[35]:(E=()=>n(`ssh`),t[34]=n,t[35]=E);let D;t[36]!==o.sshCardDesc||t[37]!==o.sshCardTitle||t[38]!==E?(D=(0,$.jsx)(ke,{icon:B,title:o.sshCardTitle,description:o.sshCardDesc,onOpen:E}),t[36]=o.sshCardDesc,t[37]=o.sshCardTitle,t[38]=E,t[39]=D):D=t[39];let k;t[40]!==a.advanced.proxyBody||t[41]!==a.advanced.proxyTitle||t[42]!==T||t[43]!==D?(k=(0,$.jsxs)(R,{title:a.advanced.proxyTitle,summary:a.advanced.proxyBody,children:[T,D]}),t[40]=a.advanced.proxyBody,t[41]=a.advanced.proxyTitle,t[42]=T,t[43]=D,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:O,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 L;t[65]!==r||t[66]!==a.advanced.proxyDocs?(L=(0,$.jsx)(fe,{language:r,label:a.advanced.proxyDocs,section:`advanced`,className:`mt-2`}),t[65]=r,t[66]=a.advanced.proxyDocs,t[67]=L):L=t[67];let z;t[68]!==F||t[69]!==I||t[70]!==L?(z=(0,$.jsxs)(`div`,{className:`max-w-3xl rounded-xl bg-surface-hover/20 px-4 py-4`,children:[F,I,L]}),t[68]=F,t[69]=I,t[70]=L,t[71]=z):z=t[71];let V;return t[72]!==N||t[73]!==P||t[74]!==z||t[75]!==m||t[76]!==_?(V=(0,$.jsxs)(`div`,{className:`flex flex-col gap-6`,children:[m,_,N,P,z]}),t[72]=N,t[73]=P,t[74]=z,t[75]=m,t[76]=_,t[77]=V):V=t[77],V}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=g(Fe),n;e[0]===t?n=e[1]:(n=p(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:O,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)(u,{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 l;e[10]!==o||e[11]!==c?(l=(0,$.jsxs)(`div`,{className:`mt-4 space-y-3`,children:[o,c]}),e[10]=o,e[11]=c,e[12]=l):l=e[12];let d;return e[13]!==i||e[14]!==l?(d=(0,$.jsx)(`div`,{className:`flex flex-col gap-4`,children:(0,$.jsxs)(ue,{children:[i,l]})}),e[13]=i,e[14]=l,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=g(Le),a;t[0]===i?a=t[1]:(a=p(i),t[0]=i,t[1]=a);let o=a.remoteAccess.ssh,[s,c]=(0,Z.useState)(!1),u;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(u=async()=>{await _(`xopc gateway ssh-tunnel --target user@your-host --local-port 18790 --remote-port 18790`)&&(c(!0),setTimeout(()=>c(!1),2e3))},t[2]=u):u=t[2];let d=u,f;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(f=(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]=f):f=t[3];let m,h;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(m=()=>void d(),h=(0,$.jsx)(l,{className:`mr-1 size-4`}),t[4]=m,t[5]=h):(m=t[4],h=t[5]);let v=s?o.copied:o.copy,b;t[6]===v?b=t[7]:(b=(0,$.jsx)(`div`,{className:`mt-2`,children:(0,$.jsxs)(y,{type:`button`,variant:`ghost`,onClick:m,children:[h,v]})}),t[6]=v,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:[f,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:B,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:B,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:l,advancedOnly:u}=e,d=u===void 0?!1:u,[f,p]=(0,Z.useState)(l??!1),h;t[0]===s?h=t[1]:(h=m(`rounded-xl bg-surface-hover/20`,s),t[0]=s,t[1]=h);let g;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(g=()=>p(He),t[2]=g):g=t[2];let _=f&&`rotate-180`,v;t[3]===_?v=t[4]:(v=m(`size-4 shrink-0 text-fg-muted transition-transform duration-200 motion-reduce:transition-none`,_),t[3]=_,t[4]=v);let y;t[5]===v?y=t[6]:(y=(0,$.jsx)(c,{className:v,"aria-hidden":!0}),t[5]=v,t[6]=y);let b;t[7]===i?b=t[8]:(b=i?(0,$.jsx)(i,{className:`size-4 shrink-0 text-accent`,strokeWidth:1.75,"aria-hidden":!0}):null,t[7]=i,t[8]=b);let x=f?r:n,S;t[9]===x?S=t[10]:(S=(0,$.jsx)(`span`,{children:x}),t[9]=x,t[10]=S);let C;t[11]!==f||t[12]!==y||t[13]!==b||t[14]!==S?(C=(0,$.jsxs)(`button`,{type:`button`,"aria-expanded":f,onClick:g,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:[y,b,S]}),t[11]=f,t[12]=y,t[13]=b,t[14]=S,t[15]=C):C=t[15];let w=f?`grid-rows-[1fr] opacity-100`:`grid-rows-[0fr] opacity-0`,T;t[16]===w?T=t[17]:(T=m(`grid transition-[grid-template-rows,opacity] duration-200 ease-out motion-reduce:transition-none`,w),t[16]=w,t[17]=T);let E;t[18]===a?E=t[19]:(E=a?(0,$.jsx)(`p`,{className:`text-xs text-fg-subtle`,children:a}):null,t[18]=a,t[19]=E);let D;t[20]!==o||t[21]!==E?(D=(0,$.jsx)(`div`,{className:`overflow-hidden`,children:(0,$.jsxs)(`div`,{className:`flex flex-col gap-4 px-4 pb-4 pt-1`,children:[E,o]})}),t[20]=o,t[21]=E,t[22]=D):D=t[22];let O;t[23]!==T||t[24]!==D?(O=(0,$.jsx)(`div`,{className:T,children:D}),t[23]=T,t[24]=D,t[25]=O):O=t[25];let k;t[26]!==C||t[27]!==O||t[28]!==h?(k=(0,$.jsxs)(`section`,{className:h,children:[C,O]}),t[26]=C,t[27]=O,t[28]=h,t[29]=k):k=t[29];let A=k;if(d){let e;return t[30]===A?e=t[31]:(e=(0,$.jsx)(Ce,{children:A}),t[30]=A,t[31]=e),e}return A}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),p;t[0]===u?p=t[1]:(p=e=>{e||(f(!1),u())},t[0]=u,t[1]=p);let h;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(h=(0,$.jsx)(ae,{className:m(`xopc-dialog-overlay fixed inset-0 bg-scrim backdrop-blur-[1px]`,C)}),t[2]=h):h=t[2];let g;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(g=m(`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`,S),t[3]=g):g=t[3];let _;t[4]===r?_=t[5]:(_=(0,$.jsx)(z,{className:`text-base font-semibold text-fg`,children:r}),t[4]=r,t[5]=_);let v;t[6]===i?v=t[7]:(v=(0,$.jsx)(L,{className:`mt-2 text-sm text-fg-muted`,children:i}),t[6]=i,t[7]=v);let b;t[8]===a?b=t[9]:(b=a.map(We),t[8]=a,t[9]=b);let x;t[10]===b?x=t[11]:(x=(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]=x);let w;t[12]===Symbol.for(`react.memo_cache_sentinel`)?(w=e=>f(e.target.checked),t[12]=w):w=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:w}),t[13]=d,t[14]=E);let D;t[15]===o?D=t[16]:(D=(0,$.jsx)(`span`,{children:o}),t[15]=o,t[16]=D);let O;t[17]!==D||t[18]!==E?(O=(0,$.jsxs)(`label`,{className:`mt-5 flex cursor-pointer items-start gap-3 text-sm text-fg`,children:[E,D]}),t[17]=D,t[18]=E,t[19]=O):O=t[19];let k;t[20]!==c||t[21]!==u?(k=(0,$.jsx)(y,{type:`button`,variant:`secondary`,onClick:u,children:c}),t[20]=c,t[21]=u,t[22]=k):k=t[22];let j=!d,M;t[23]!==s||t[24]!==l||t[25]!==j?(M=(0,$.jsx)(y,{type:`button`,disabled:j,onClick:l,children:s}),t[23]=s,t[24]=l,t[25]=j,t[26]=M):M=t[26];let P;t[27]!==k||t[28]!==M?(P=(0,$.jsxs)(`div`,{className:`mt-6 flex justify-end gap-2`,children:[k,M]}),t[27]=k,t[28]=M,t[29]=P):P=t[29];let F;t[30]!==O||t[31]!==P||t[32]!==_||t[33]!==v||t[34]!==x?(F=(0,$.jsxs)(T,{children:[h,(0,$.jsxs)(N,{className:g,onOpenAutoFocus:Ge,children:[_,v,x,O,P]})]}),t[30]=O,t[31]=P,t[32]=_,t[33]=v,t[34]=x,t[35]=F):F=t[35];let I;return t[36]!==n||t[37]!==p||t[38]!==F?(I=(0,$.jsx)(A,{open:n,onOpenChange:p,children:F}),t[36]=n,t[37]=p,t[38]=F,t[39]=I):I=t[39],I}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,d,p,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?(d=(0,$.jsxs)(`div`,{children:[i,a]}),t[17]=i,t[18]=a,t[19]=d):d=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)(f,{className:`size-3.5 animate-spin text-accent`}):(0,$.jsx)(D,{className:`size-3.5`})}),(0,$.jsxs)(`div`,{className:`min-w-0`,children:[(0,$.jsx)(`div`,{className:m(`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:m(`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?p=t[21]:(p=(0,$.jsx)(`ol`,{className:`space-y-2`,children:o}),t[20]=o,t[21]=p),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]=d,t[11]=p,t[12]=h}else l=t[8],u=t[9],d=t[10],p=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]!==d||t[27]!==p||t[28]!==h||t[29]!==g?(_=(0,$.jsxs)(`div`,{className:u,children:[d,p,h,g]}),t[25]=u,t[26]=d,t[27]=p,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:u,startDisabledReason:p,stepLabel:h,onStart:g,onStop:_}=e,v=u===void 0?!1:u,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=m(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=m(`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`,N;t[10]!==O||t[11]!==k||t[12]!==A||t[13]!==j?(N=m(`size-1.5 rounded-full`,O,k,A,j),t[10]=O,t[11]=k,t[12]=A,t[13]=j,t[14]=N):N=t[14];let P;t[15]===N?P=t[16]:(P=(0,$.jsx)(`span`,{className:N,"aria-hidden":!0}),t[15]=N,t[16]=P);let F;t[17]!==i||t[18]!==r||t[19]!==n?(F=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]=F):F=t[20];let I;t[21]!==P||t[22]!==F||t[23]!==S?(I=(0,$.jsxs)(`span`,{className:S,children:[P,F]}),t[21]=P,t[22]=F,t[23]=S,t[24]=I):I=t[24];let L;t[25]!==r.connectedSince||t[26]!==r.state||t[27]!==n.uptime?(L=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]=L):L=t[28];let R;t[29]!==I||t[30]!==L||t[31]!==C?(R=(0,$.jsxs)(`div`,{className:C,children:[I,L]}),t[29]=I,t[30]=L,t[31]=C,t[32]=R):R=t[32];let z;t[33]===Symbol.for(`react.memo_cache_sentinel`)?(z=(0,$.jsx)(d,{className:`size-4 text-fg-subtle`,strokeWidth:1.75,"aria-hidden":!0}),t[33]=z):z=t[33];let B;t[34]!==R||t[35]!==w?(B=(0,$.jsxs)(`div`,{className:w,children:[R,z]}),t[34]=R,t[35]=w,t[36]=B):B=t[36];let V;t[37]===a?V=t[38]:(V=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]=V);let H;t[39]!==c||t[40]!==n.consentExpiredBanner?(H=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]=H):H=t[41];let U;t[42]!==b||t[43]!==l||t[44]!==g||t[45]!==_||t[46]!==x||t[47]!==r||t[48]!==v||t[49]!==p||t[50]!==o||t[51]!==h||t[52]!==s||t[53]!==n?(U=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)(M,{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)(y,{type:`button`,variant:`secondary`,disabled:s,onClick:_,children:[s?(0,$.jsx)(f,{className:`size-4 animate-spin`}):null,n.stop]}):(0,$.jsxs)(y,{type:`button`,disabled:o,onClick:g,children:[o?(0,$.jsx)(f,{className:`size-4 animate-spin`}):(0,$.jsx)(E,{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)(K,{className:`mt-0.5 size-4 shrink-0 text-amber-600 dark:text-amber-400`}),(0,$.jsx)(`p`,{children:n.riskBannerBody})]}),v&&p?(0,$.jsx)(`p`,{className:`text-sm text-amber-800 dark:text-amber-200`,children:p}):null,(0,$.jsxs)(y,{type:`button`,disabled:o||v,onClick:g,className:`w-full sm:w-auto`,children:[o?(0,$.jsx)(f,{className:`size-4 animate-spin`}):(0,$.jsx)(E,{className:`size-4`}),n.start]})]}),t[42]=b,t[43]=l,t[44]=g,t[45]=_,t[46]=x,t[47]=r,t[48]=v,t[49]=p,t[50]=o,t[51]=h,t[52]=s,t[53]=n,t[54]=U):U=t[54];let W;return t[55]!==B||t[56]!==V||t[57]!==H||t[58]!==U||t[59]!==T?(W=(0,$.jsxs)(`section`,{className:T,children:[B,V,H,U]}),t[55]=B,t[56]=V,t[57]=H,t[58]=U,t[59]=T,t[60]=W):W=t[60],W}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:l,brokerSecretAuthorizationUrl:d,brokerSecretNotice:p,copyFailedLabel:h,onDraftChange:g,onSave:_,onAuthorize:v,onClear:b,sectionRef:x}=e,S=(0,Z.useId)(),C=r,w=!C,[T,E]=(0,Z.useReducer)(te,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,M;t[4]!==n.copied||t[5]!==n.copyKey||t[6]!==n.hideKey||t[7]!==n.showKey?(M={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]=M):M=t[8];let N=M,F;t[9]===o?F=t[10]:(F=o.trim().length>0&&!P(o.trim()),t[9]=o,t[10]=F);let I=F,L;t[11]===g?L=t[12]:(L=()=>{E({type:`patch`,patch:{reconfiguring:!1}}),g(``)},t[11]=g,t[12]=L);let R=L,z=w&&`ring-1 ring-amber-500/30`,B;t[13]===z?B=t[14]:(B=m(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=m(`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)(j,{className:`size-4`,strokeWidth:1.75,"aria-hidden":!0}),t[17]=C,t[18]=U);let W;t[19]!==H||t[20]!==U?(W=(0,$.jsx)(`span`,{className:H,children:U}),t[19]=H,t[20]=U,t[21]=W):W=t[21];let ee=C?n.brokerSecretReadyTitle:n.brokerSecretStepTitle,ne;t[22]===ee?ne=t[23]:(ne=(0,$.jsx)(`p`,{className:`text-sm font-semibold text-fg`,children:ee}),t[22]=ee,t[23]=ne);let re=C?n.brokerSecretReadyHint:n.brokerSecretHint,G;t[24]===re?G=t[25]:(G=(0,$.jsx)(`p`,{className:`mt-1 text-sm leading-relaxed text-fg-muted`,children:re}),t[24]=re,t[25]=G);let K;t[26]!==w||t[27]!==n.brokerSecretMissingHint?(K=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]=K):K=t[28];let ie;t[29]!==ne||t[30]!==G||t[31]!==K?(ie=(0,$.jsxs)(`div`,{children:[ne,G,K]}),t[29]=ne,t[30]=G,t[31]=K,t[32]=ie):ie=t[32];let q;t[33]!==l||t[34]!==w||t[35]!==v||t[36]!==D||t[37]!==c||t[38]!==n.brokerSecretAuthorize||t[39]!==n.brokerSecretAuthorizing||t[40]!==n.brokerSecretConsoleLink?(q=w||D?(0,$.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,$.jsxs)(y,{type:`button`,disabled:c||l,onClick:v,children:[l?(0,$.jsx)(f,{className:`size-4 animate-spin`}):null,l?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)(u,{className:`size-3`,"aria-hidden":!0})]})]}):null,t[33]=l,t[34]=w,t[35]=v,t[36]=D,t[37]=c,t[38]=n.brokerSecretAuthorize,t[39]=n.brokerSecretAuthorizing,t[40]=n.brokerSecretConsoleLink,t[41]=q):q=t[41];let J;t[42]!==l||t[43]!==d||t[44]!==n.brokerSecretOpenAuthorization?(J=l&&d?(0,$.jsxs)(`a`,{href:d,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)(u,{className:`size-3`,"aria-hidden":!0})]}):null,t[42]=l,t[43]=d,t[44]=n.brokerSecretOpenAuthorization,t[45]=J):J=t[45];let ae;t[46]!==i||t[47]!==o||t[48]!==a||t[49]!==I||t[50]!==R||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]!==N||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?(ae=A?(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(`label`,{className:`sr-only`,htmlFor:S,children:n.brokerSecretTitle}),(0,$.jsx)(k,{id:S,value:a,labels:N,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)(y,{type:`button`,variant:`secondary`,disabled:c,onClick:()=>{E({type:`patch`,patch:{reconfiguring:!0}})},children:n.brokerSecretReconfigure}),(0,$.jsx)(y,{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)(k,{id:S,value:o,onChange:g,placeholder:n.brokerSecretPlaceholder,labels:N,disabled:c}),(0,$.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[(0,$.jsxs)(y,{type:`button`,disabled:c||!I,onClick:_,children:[c?(0,$.jsx)(f,{className:`size-4 animate-spin`}):null,w?n.brokerSecretSaveAndContinue:n.brokerSecretSave]}),i?(0,$.jsx)(y,{type:`button`,variant:`ghost`,disabled:c,onClick:b,children:n.brokerSecretClear}):null,D?(0,$.jsx)(y,{type:`button`,variant:`ghost`,disabled:c,onClick:R,children:n.brokerSecretCancelReconfigure}):null]})]}),t[46]=i,t[47]=o,t[48]=a,t[49]=I,t[50]=R,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]=N,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]=ae):ae=t[71];let oe;t[72]===p?oe=t[73]:(oe=p?(0,$.jsx)(`p`,{className:`text-xs text-emerald-700 dark:text-emerald-400`,children:p}):null,t[72]=p,t[73]=oe);let se;t[74]!==ie||t[75]!==q||t[76]!==J||t[77]!==ae||t[78]!==oe?(se=(0,$.jsxs)(`div`,{className:`min-w-0 flex-1 space-y-3`,children:[ie,q,J,ae,oe]}),t[74]=ie,t[75]=q,t[76]=J,t[77]=ae,t[78]=oe,t[79]=se):se=t[79];let ce;t[80]!==W||t[81]!==se?(ce=(0,$.jsxs)(`div`,{className:`flex items-start gap-3`,children:[W,se]}),t[80]=W,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=g(e=>e.language),n=p(t).tunnelSettings,r=!!h(e=>e.conversationId),[i,a]=(0,Z.useReducer)(te,ut),{actionError:o,starting:s,stopping:c,savingAutoStart:l,consentOpen:u,autoStartConfirmOpen:_,releaseConfirmOpen:S,releasing:C,brokerSecretDraft:T,savingBrokerSecret:E,authorizingBrokerSecret:D,brokerSecretAuthorizationUrl:O,brokerSecretNotice:k}=i,A=(0,Z.useRef)(null),{data:j}=x(r),{data:M,error:N,isLoading:I,mutate:L}=v(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=j?.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 M?.config?.autoStart===!0},[j,M?.config?.autoStart]),z=(0,Z.useMemo)(()=>{let e=j?.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``},[j]),B=P(z),H=M?.registrationSecret?.configured??B;(0,Z.useEffect)(()=>{let e=()=>{L()};return window.addEventListener(`tunnel-status`,e),()=>window.removeEventListener(`tunnel-status`,e)},[L]);let U=(0,Z.useMemo)(()=>[n.consentBullet1,n.consentBullet2,n.consentBullet3],[n.consentBullet1,n.consentBullet2,n.consentBullet3]),G=(0,Z.useCallback)(async()=>{a({type:`patch`,patch:{actionError:null}}),a({type:`patch`,patch:{starting:!0}});try{await ye(),await L(),b()}catch(e){a({type:`patch`,patch:{actionError:e instanceof Error?e.message:String(e)}})}finally{a({type:`patch`,patch:{starting:!1}})}},[L]),K=(0,Z.useCallback)(()=>{if(!H){a({type:`patch`,patch:{actionError:n.brokerSecretRequiredBeforeStart}}),A.current?.scrollIntoView({behavior:`smooth`,block:`start`});return}if(M?.consentRequired){a({type:`patch`,patch:{consentOpen:!0}});return}G()},[H,M?.consentRequired,G,n.brokerSecretRequiredBeforeStart]),ie=(0,Z.useCallback)(async()=>{a({type:`patch`,patch:{consentOpen:!1}}),a({type:`patch`,patch:{actionError:null}});try{await de(),await Promise.all([L(),G()])}catch(e){a({type:`patch`,patch:{actionError:e instanceof Error?e.message:String(e)}})}},[L,G]),q=(0,Z.useCallback)(async()=>{a({type:`patch`,patch:{actionError:null}}),a({type:`patch`,patch:{stopping:!0}});try{await pe(),await L(),b()}catch(e){a({type:`patch`,patch:{actionError:e instanceof Error?e.message:String(e)}})}finally{a({type:`patch`,patch:{stopping:!1}})}},[L]),J=(0,Z.useCallback)(async e=>{a({type:`patch`,patch:{savingAutoStart:!0}}),a({type:`patch`,patch:{actionError:null}});try{await ve({autoStart:e}),b()}catch(e){a({type:`patch`,patch:{actionError:e instanceof Error?e.message:String(e)}})}finally{a({type:`patch`,patch:{savingAutoStart:!1}})}},[]),ae=(0,Z.useCallback)(()=>{if(R){J(!1);return}if(M?.consentRequired){a({type:`patch`,patch:{actionError:n.consentExpiredBanner}});return}if(!M?.canAutoStart){a({type:`patch`,patch:{actionError:n.autoStartHint}});return}a({type:`patch`,patch:{autoStartConfirmOpen:!0}})},[J,M?.canAutoStart,M?.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}}),b(),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}}),b(),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=ee(),t=null,r=null;a({type:`patch`,patch:{authorizingBrokerSecret:!0,brokerSecretAuthorizationUrl:null,brokerSecretNotice:null,actionError:null}});try{for(t=(await F(`xopc-tunnel`)).sessionId;;){await new Promise(e=>window.setTimeout(e,1e3));let i=await W(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(),b()]),a({type:`patch`,patch:{brokerSecretNotice:n.brokerSecretSaved,brokerSecretDraft:``}});return}}}catch(e){a({type:`patch`,patch:{actionError:e instanceof Error?e.message:String(e)}})}finally{V(e),t&&w(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(),b()}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:p(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=M??{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=M?.consentRequired&&(X.enabled||R||M?.consent?.acceptedAt),_e=(0,$.jsx)(st,{t:n,brokerSecretReady:H,brokerSecretConfiguredInConfig:B,brokerSecretMaskedValue:B?z:``,brokerSecretDraft:T,savingBrokerSecret:E,authorizingBrokerSecret:D,brokerSecretAuthorizationUrl:O,brokerSecretNotice:k,copyFailedLabel:p(t).clipboard.copyFailed,onDraftChange:e=>a({type:`patch`,patch:{brokerSecretDraft:e}}),onSave:()=>void oe(),onAuthorize:()=>void ce(),onClear:()=>void se(),sectionRef:A}),be=(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(Ue,{open:u,title:n.consentTitle,intro:n.consentIntro,bullets:U,checkboxLabel:n.consentCheckbox,confirmLabel:me?n.consentReconfirm:n.consentConfirm,cancelLabel:n.consentCancel,onConfirm:()=>void ie(),onCancel:()=>a({type:`patch`,patch:{consentOpen:!1}})},u?`consent-open`:`consent-closed`),(0,$.jsx)(ne,{open:_,title:n.autoStartConfirmTitle,description:n.autoStartConfirmBody,confirmLabel:n.autoStartConfirmLabel,cancelLabel:n.consentCancel,onConfirm:()=>{a({type:`patch`,patch:{autoStartConfirmOpen:!1}}),J(!0)},onCancel:()=>a({type:`patch`,patch:{autoStartConfirmOpen:!1}})}),(0,$.jsx)(ne,{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:N,starting:s,stopping:c,showConsentExpired:!!me,copyLabels:le,startDisabled:!H,startDisabledReason:H?void 0:n.brokerSecretRequiredBeforeStart,stepLabel:n.flowStepStart,onStart:K,onStop:()=>void q()}),(0,$.jsxs)(Ve,{showLabel:n.showOptions,hideLabel:n.hideOptions,children:[(0,$.jsxs)(`label`,{className:m(`flex items-center gap-3 text-sm text-fg`,!R&&!M?.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&&!M?.canAutoStart,onChange:ae}),n.autoStart]}),!M?.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)(y,{type:`button`,variant:`secondary`,disabled:C||c,className:`border-danger/40 text-danger hover:bg-danger/10`,onClick:()=>a({type:`patch`,patch:{releaseConfirmOpen:!0}}),children:[C?(0,$.jsx)(f,{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)(d,{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:N,starting:s,stopping:c,showConsentExpired:!!me,copyLabels:le,startDisabled:!H,startDisabledReason:H?void 0:n.brokerSecretRequiredBeforeStart,onStart:K,onStop:()=>void q()}),X.subdomain||X.publicUrl?(0,$.jsx)(`div`,{className:`flex flex-wrap gap-2`,children:(0,$.jsxs)(y,{type:`button`,variant:`secondary`,disabled:C||c,className:`border-danger/40 text-danger hover:bg-danger/10`,onClick:()=>a({type:`patch`,patch:{releaseConfirmOpen:!0}}),children:[C?(0,$.jsx)(f,{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:m(`flex items-center gap-3 text-sm text-fg`,!R&&!M?.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&&!M?.canAutoStart,onChange:ae}),n.autoStart]}),!M?.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)(d,{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=g(vt),r=p(n).remoteAccess,a=!!h(_t),[s,c]=i(),l=I(),u=Be(s.get(`tab`)),d=s.get(`intent`)===`mobile-pairing`,f;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(f={refreshInterval:2e3},e[0]=f):f=e[0];let m=v(d?`device-pairing-readiness`:null,me,f),_;e[1]===c?_=e[2]:(_=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]=_);let b=_,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)(oe,{children:[(0,$.jsx)(se,{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)(J,{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:m.data?.ready?r.mobilePairingFlow.ready:r.mobilePairingFlow.hint})]})]}),(0,$.jsxs)(y,{variant:`primary`,disabled:!m.data?.ready,onClick:()=>t(`/settings/devices?startDevicePairing=mobile`),children:[m.data?.ready?r.mobilePairingFlow.continue:r.mobilePairingFlow.waiting,(0,$.jsx)(G,{className:`size-4`,"aria-hidden":!0})]})]}):null,(0,$.jsx)(ie,{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 +1 @@
|
|
|
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-RzwPiQNL.js";import{i as c,n as l}from"./locale-store-JogcXC4J.js";import{i as u}from"./vendor-swr-BIWyz7Rc.js";import{t as d}from"./button-aIC072nz.js";import{
|
|
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-RzwPiQNL.js";import{i as c,n as l}from"./locale-store-JogcXC4J.js";import{i as u}from"./vendor-swr-BIWyz7Rc.js";import{t as d}from"./button-aIC072nz.js";import{Ad as f,Pl as p,bn as m,ta as h}from"./index-ygkHNYyo.js";import{n as g,t as _}from"./settings-page-header-CYpuTXUW.js";import"./settings-page-layout-B20AfmFG.js";import{t as v}from"./settings-advanced-gate-QTVDCGJG.js";import{i as y,n as b,r as x}from"./runtime-tools-api-CSm5SpnR.js";import{t as S}from"./phone-dependencies-card-ChFtdFhA.js";var C=e(t(),1);function w(e){return e?.trim()||void 0}function T(e,t,n){return e?.state===`ready`?w(t)!==w(n):!0}var E=n(),D=[`node`,`python`,`uv`];function O(){let e=s(l(e=>e.language)).runtimeToolsSettings,{data:t,error:n,isLoading:w,mutate:O}=u(c(`/api/runtime-tools`)),[k,A]=(0,C.useState)(null),[j,M]=(0,C.useState)(!1),[N,P]=(0,C.useState)(!1),[F,I]=(0,C.useState)({}),[L,R]=(0,C.useState)({}),[z,B]=(0,C.useState)(null),V=Object.values(F).some(Boolean);if((0,C.useEffect)(()=>{t?.payload.config&&A(structuredClone(t.payload.config))},[t?.payload.config]),n)return(0,E.jsxs)(g,{children:[(0,E.jsx)(_,{title:e.title,subtitle:e.loadError}),(0,E.jsx)(d,{onClick:()=>void O(),children:e.refresh})]});if(w||!k)return(0,E.jsx)(g,{children:(0,E.jsx)(m,{sections:3})});let H=new Map(t?.payload.statuses.map(e=>[e.runtime,e])),U=(e,t)=>A(n=>n&&{...n,[e]:{...n[e],...t}}),W=async()=>{M(!0),B(null);try{await y(k),await O()}catch(e){B(e instanceof Error?e.message:String(e))}finally{M(!1)}},G=async(e,t)=>{I(t=>({...t,[e]:!0})),B(null);try{await y(k),await x({runtime:e,action:t,version:e===`uv`?k.uv.version:k[e].version,onProgress:t=>R(n=>({...n,[e]:t}))}),await O()}catch(e){B(e instanceof Error?e.message:String(e))}finally{I(t=>({...t,[e]:!1}))}},K=async()=>{P(!0),B(null);try{await b(),await O()}catch(e){B(e instanceof Error?e.message:String(e))}finally{P(!1)}};return(0,E.jsxs)(g,{gap:`gap-6`,children:[(0,E.jsx)(_,{title:e.title,actions:(0,E.jsxs)(E.Fragment,{children:[(0,E.jsx)(h,{className:`size-9 shrink-0 p-0`,disabled:V,label:e.refresh,onClick:async()=>{await O()}}),(0,E.jsx)(d,{onClick:()=>void K(),disabled:N||V,children:N?e.pruning:e.prune}),(0,E.jsx)(d,{variant:`primary`,onClick:()=>void W(),disabled:j||V,children:j?e.saving:e.save})]})}),z?(0,E.jsx)(`div`,{className:`rounded-xl bg-danger/10 px-4 py-3 text-sm text-danger`,children:z}):null,(0,E.jsx)(`section`,{className:`rounded-xl bg-surface-hover/20 p-4`,children:(0,E.jsxs)(`label`,{className:`flex items-center justify-between gap-4`,children:[(0,E.jsxs)(`span`,{children:[(0,E.jsx)(`span`,{className:`block text-sm font-medium text-fg`,children:e.enabled}),(0,E.jsx)(`span`,{className:`mt-1 block text-xs text-fg-muted`,children:e.enabledHint})]}),(0,E.jsx)(`input`,{type:`checkbox`,checked:k.enabled,onChange:e=>A({...k,enabled:e.target.checked}),className:`size-4 accent-accent`})]})}),(0,E.jsx)(v,{children:(0,E.jsxs)(`section`,{className:`grid gap-4 rounded-xl bg-surface-hover/20 p-4 md:grid-cols-2`,children:[(0,E.jsxs)(`label`,{className:`space-y-1.5 text-xs font-medium text-fg-muted`,children:[e.downloadSource,(0,E.jsxs)(r,{value:k.download.source,onChange:e=>A({...k,download:{...k.download,source:e.target.value}}),children:[(0,E.jsx)(i,{value:`auto`,children:e.downloadSources.auto}),(0,E.jsx)(i,{value:`website-only`,children:e.downloadSources.websiteOnly}),(0,E.jsx)(i,{value:`direct-only`,children:e.downloadSources.directOnly})]})]}),(0,E.jsxs)(`label`,{className:`space-y-1.5 text-xs font-medium text-fg-muted`,children:[e.gatewayBaseUrl,(0,E.jsx)(`input`,{value:k.download.gatewayBaseUrl,disabled:k.download.source===`direct-only`,onChange:e=>A({...k,download:{...k.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,E.jsxs)(`label`,{className:`space-y-1.5 text-xs font-medium text-fg-muted`,children:[e.offlineBundle,(0,E.jsx)(`input`,{value:k.download.bundleDir??``,placeholder:e.offlineBundlePlaceholder,onChange:e=>A({...k,download:{...k.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,E.jsxs)(`label`,{className:`space-y-1.5 text-xs font-medium text-fg-muted`,children:[e.proxy,(0,E.jsx)(`input`,{value:k.download.proxy??``,placeholder:`http://127.0.0.1:7890`,onChange:e=>A({...k,download:{...k.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,E.jsx)(S,{}),(0,E.jsx)(`div`,{className:`flex flex-col gap-4`,children:D.map(n=>{let s=H.get(n),c=s?.state===`ready`,l=L[n],u=n===`uv`?k.uv:k[n],m=n===`uv`?t?.payload.config.uv:t?.payload.config[n],h=F[n]===!0,g=T(s,u.version,m?.version);return(0,E.jsxs)(`section`,{className:`flex min-w-0 flex-col gap-5 rounded-xl bg-surface-base/55 p-5 sm:p-6`,children:[(0,E.jsxs)(`div`,{className:`flex items-start justify-between gap-3`,children:[(0,E.jsxs)(`div`,{children:[(0,E.jsx)(`h2`,{className:`text-base font-semibold text-fg`,children:e.runtimeNames[n]}),(0,E.jsx)(`p`,{className:`mt-1 break-words text-xs text-fg-muted`,children:s?.message??e.unknown})]}),(0,E.jsxs)(`div`,{className:`flex items-center gap-2`,children:[c?(0,E.jsx)(a,{className:`size-5 shrink-0 text-success`}):(0,E.jsx)(f,{className:`size-5 shrink-0 text-warning`}),(0,E.jsx)(`input`,{type:`checkbox`,"aria-label":`${e.runtimeNames[n]} ${e.enabled}`,checked:u.enabled,onChange:e=>{n===`uv`?A({...k,uv:{...k.uv,enabled:e.target.checked}}):U(n,{enabled:e.target.checked})},className:`size-4 accent-accent`})]})]}),(0,E.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,E.jsxs)(`label`,{className:`space-y-1.5 text-xs font-medium text-fg-muted`,children:[e.version,(0,E.jsx)(`input`,{value:u.version??``,placeholder:s?.requestedVersion,onChange:e=>{let t=e.target.value||void 0;n===`uv`?A({...k,uv:{...k.uv,version:t}}):U(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,E.jsxs)(E.Fragment,{children:[(0,E.jsxs)(`label`,{className:`space-y-1.5 text-xs font-medium text-fg-muted`,children:[e.sourcePolicy,(0,E.jsxs)(r,{value:k[n].preference,onChange:e=>U(n,{preference:e.target.value}),children:[(0,E.jsx)(i,{value:`managed-first`,children:e.preferences.managedFirst}),(0,E.jsx)(i,{value:`system-first`,children:e.preferences.systemFirst}),(0,E.jsx)(i,{value:`managed-only`,children:e.preferences.managedOnly}),(0,E.jsx)(i,{value:`system-only`,children:e.preferences.systemOnly})]})]}),(0,E.jsxs)(`label`,{className:`space-y-1.5 text-xs font-medium text-fg-muted`,children:[e.provisionPolicy,(0,E.jsxs)(r,{value:k[n].provision,onChange:e=>U(n,{provision:e.target.value}),children:[(0,E.jsx)(i,{value:`eager`,children:e.provisions.eager}),(0,E.jsx)(i,{value:`on-demand`,children:e.provisions.onDemand}),(0,E.jsx)(i,{value:`disabled`,children:e.provisions.disabled})]})]})]})]}),l&&h?(0,E.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,E.jsxs)(`div`,{className:`mt-auto flex flex-wrap items-center justify-between gap-3`,children:[(0,E.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[g?(0,E.jsxs)(d,{variant:`primary`,disabled:!k.enabled||!u.enabled||h,onClick:()=>void G(n,`install`),children:[(0,E.jsx)(o,{className:`size-4`}),h?e.working:e.install]}):(0,E.jsxs)(`span`,{className:`inline-flex h-9 items-center gap-2 px-1 text-sm text-success`,children:[(0,E.jsx)(a,{className:`size-4`}),e.installed]}),s?.repairable?(0,E.jsxs)(d,{disabled:!k.enabled||!u.enabled||h,onClick:()=>void G(n,`repair`),children:[(0,E.jsx)(p,{className:`size-4`}),e.repair]}):null]}),(0,E.jsx)(v,{children:s?.resolved?.executable?(0,E.jsx)(`code`,{className:`break-all text-[11px] text-fg-subtle`,children:s.resolved.executable}):null})]})]},n)})})]})}export{O as RuntimeToolsSettingsPanel};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import"./rolldown-runtime-aKtaBQYM.js";import{a as e,n as t,t as n}from"./vendor-react-BOUWij0V.js";import{n as r,r as i}from"./popover-select-DGKUpVsz.js";import{t as a}from"./cn-0WouolD0.js";import{Co as o,Eo as s}from"./index-D1oivYvN.js";import{t as c}from"./number-input-DDeqHK-G.js";var l=t();e();var u=n();function d(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function f(e){let t=e[`x-order`];return typeof t==`number`&&!Number.isNaN(t)?t:999}function p(e){let t=e[`x-group`];return typeof t==`string`&&t.length>0?t:``}function m(e){return e[`x-hidden`]===!0}function h(e){let t=e.properties;if(!d(t))return[];let n=[];for(let[e,r]of Object.entries(t))d(r)&&(m(r)||n.push({key:e,sub:r,order:f(r),group:p(r),hidden:!1}));return n.sort((e,t)=>e.order-t.order||e.key.localeCompare(t.key)),n}function g(e){let t=new Map;for(let n of e){let e=n.group;t.has(e)||t.set(e,[]),t.get(e).push(n)}return t}function _(e){let t=(0,l.c)(38),{name:n,s:i,value:a,onChange:c,disabled:d}=e,f=typeof i.description==`string`?i.description:void 0,p=(typeof i[`x-placeholder`]==`string`?i[`x-placeholder`]:null)||f,m=i.format;if(Array.isArray(i.enum)&&i.enum.every(y)){let e;t[0]===f?e=t[1]:(e=f?(0,u.jsx)(`label`,{className:`text-xs text-fg-muted`,children:f}):null,t[0]=f,t[1]=e);let o;t[2]===c?o=t[3]:(o=e=>c(e.target.value),t[2]=c,t[3]=o);let s;t[4]===i.enum?s=t[5]:(s=i.enum.map(v),t[4]=i.enum,t[5]=s);let l;t[6]!==d||t[7]!==n||t[8]!==o||t[9]!==s||t[10]!==a?(l=(0,u.jsx)(r,{name:n,className:`ui-input h-9 rounded-md border border-edge bg-surface-base px-2 text-sm text-fg`,value:a,disabled:d,onChange:o,children:s}),t[6]=d,t[7]=n,t[8]=o,t[9]=s,t[10]=a,t[11]=l):l=t[11];let p;return t[12]!==e||t[13]!==l?(p=(0,u.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[e,l]}),t[12]=e,t[13]=l,t[14]=p):p=t[14],p}if(m===`password`){let e;t[15]===f?e=t[16]:(e=f?(0,u.jsx)(`label`,{className:`text-xs text-fg-muted`,children:f}):null,t[15]=f,t[16]=e);let n;t[17]!==d||t[18]!==c||t[19]!==p||t[20]!==a?(n=(0,u.jsx)(s,{value:a,onChange:c,placeholder:p,labels:o,disabled:d,inputClassName:`ui-input h-9 rounded-md border border-edge bg-surface-base px-2.5 text-sm text-fg placeholder:text-fg-muted/70`}),t[17]=d,t[18]=c,t[19]=p,t[20]=a,t[21]=n):n=t[21];let r;return t[22]!==e||t[23]!==n?(r=(0,u.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[e,n]}),t[22]=e,t[23]=n,t[24]=r):r=t[24],r}let h;t[25]===f?h=t[26]:(h=f?(0,u.jsx)(`label`,{className:`text-xs text-fg-muted`,children:f}):null,t[25]=f,t[26]=h);let g;t[27]===c?g=t[28]:(g=e=>c(e.target.value),t[27]=c,t[28]=g);let _;t[29]!==d||t[30]!==n||t[31]!==p||t[32]!==g||t[33]!==a?(_=(0,u.jsx)(`input`,{name:n,type:`text`,className:`ui-input h-9 rounded-md border border-edge bg-surface-base px-2.5 text-sm text-fg placeholder:text-fg-muted/70`,value:a,placeholder:p,disabled:d,onChange:g}),t[29]=d,t[30]=n,t[31]=p,t[32]=g,t[33]=a,t[34]=_):_=t[34];let b;return t[35]!==h||t[36]!==_?(b=(0,u.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[h,_]}),t[35]=h,t[36]=_,t[37]=b):b=t[37],b}function v(e){return(0,u.jsx)(i,{value:e,children:e},e)}function y(e){return typeof e==`string`}function b(e){let t=(0,l.c)(11),{s:n,value:r,onChange:i,disabled:a}=e,o=typeof n.description==`string`?n.description:void 0,s;t[0]===o?s=t[1]:(s=o?(0,u.jsx)(`label`,{className:`text-xs text-fg-muted`,children:o}):null,t[0]=o,t[1]=s);let d=Number.isFinite(r)?r:0,f;t[2]===i?f=t[3]:(f=e=>i(Number(e.target.value)),t[2]=i,t[3]=f);let p;t[4]!==a||t[5]!==d||t[6]!==f?(p=(0,u.jsx)(c,{type:`number`,className:`ui-input h-9 rounded-md border border-edge bg-surface-base px-2.5 text-sm text-fg`,value:d,disabled:a,onChange:f}),t[4]=a,t[5]=d,t[6]=f,t[7]=p):p=t[7];let m;return t[8]!==s||t[9]!==p?(m=(0,u.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[s,p]}),t[8]=s,t[9]=p,t[10]=m):m=t[10],m}function x(e){let t=(0,l.c)(11),{s:n,value:r,onChange:i,disabled:a,labels:o}=e,s=(typeof n.description==`string`?n.description:void 0)??(typeof n.title==`string`&&n.title.length>0?n.title:o?.defaultBooleanLabel??`Enable`),c;t[0]===i?c=t[1]:(c=e=>i(e.target.checked),t[0]=i,t[1]=c);let d;t[2]!==a||t[3]!==c||t[4]!==r?(d=(0,u.jsx)(`input`,{type:`checkbox`,className:`size-4 rounded border border-edge`,checked:r,disabled:a,onChange:c}),t[2]=a,t[3]=c,t[4]=r,t[5]=d):d=t[5];let f;t[6]===s?f=t[7]:(f=(0,u.jsx)(`span`,{children:s}),t[6]=s,t[7]=f);let p;return t[8]!==d||t[9]!==f?(p=(0,u.jsxs)(`label`,{className:`flex items-center gap-2 text-sm text-fg`,children:[d,f]}),t[8]=d,t[9]=f,t[10]=p):p=t[10],p}function S(e){let t=(0,l.c)(27),{s:n,value:r,onChange:i,disabled:a,labels:o}=e,s=typeof n.description==`string`?n.description:void 0,c=n.items,f=d(c)?c.type:void 0;if(!(f===`string`||Array.isArray(f)&&f.includes(`string`))){let e=o?.unsupportedArrayType??`Unsupported array type`,n;return t[0]===e?n=t[1]:(n=(0,u.jsx)(`p`,{className:`text-xs text-fg-muted`,children:e}),t[0]=e,t[1]=n),n}let p,m,h,g,_;if(t[2]!==s||t[3]!==a||t[4]!==i||t[5]!==r){let e=r.map(String);p=t=>{let n=t.trim();!n||e.includes(n)||i([...e,n])},g=`flex flex-col gap-1.5`,t[11]===s?_=t[12]:(_=s?(0,u.jsx)(`label`,{className:`text-xs text-fg-muted`,children:s}):null,t[11]=s,t[12]=_),m=`flex flex-wrap gap-1`,h=e.map(t=>(0,u.jsxs)(`span`,{className:`inline-flex items-center gap-1 rounded-md border border-edge bg-surface-panel px-2 py-0.5 text-sm`,children:[t,(0,u.jsx)(`button`,{type:`button`,className:`text-fg-muted hover:text-fg`,disabled:a,onClick:()=>i(e.filter(e=>e!==t)),children:`×`})]},t)),t[2]=s,t[3]=a,t[4]=i,t[5]=r,t[6]=p,t[7]=m,t[8]=h,t[9]=g,t[10]=_}else p=t[6],m=t[7],h=t[8],g=t[9],_=t[10];let v;t[13]!==m||t[14]!==h?(v=(0,u.jsx)(`div`,{className:m,children:h}),t[13]=m,t[14]=h,t[15]=v):v=t[15];let y=o?.arrayAddPlaceholder??`Add and press Enter`,b;t[16]===p?b=t[17]:(b=e=>{e.key===`Enter`&&(e.preventDefault(),p(e.target.value),e.target.value=``)},t[16]=p,t[17]=b);let x;t[18]!==a||t[19]!==y||t[20]!==b?(x=(0,u.jsx)(`input`,{className:`ui-input h-9 rounded-md border border-edge bg-surface-base px-2.5 text-sm`,disabled:a,placeholder:y,onKeyDown:b}),t[18]=a,t[19]=y,t[20]=b,t[21]=x):x=t[21];let S;return t[22]!==g||t[23]!==_||t[24]!==v||t[25]!==x?(S=(0,u.jsxs)(`div`,{className:g,children:[_,v,x]}),t[22]=g,t[23]=_,t[24]=v,t[25]=x,t[26]=S):S=t[26],S}function C(e){let t=(0,l.c)(66),{k:n,sub:r,value:i,onValue:a,disabled:o,labels:s}=e,c=r.type,f=(typeof r.title==`string`&&r.title.length>0?r.title:null)??n;if(c===`boolean`){let e;t[0]===f?e=t[1]:(e=(0,u.jsx)(`p`,{className:`text-sm font-medium text-fg`,children:f}),t[0]=f,t[1]=e);let n=i===!0,c;t[2]===a?c=t[3]:(c=e=>a(e),t[2]=a,t[3]=c);let l;t[4]!==o||t[5]!==s||t[6]!==r||t[7]!==n||t[8]!==c?(l=(0,u.jsx)(x,{s:r,value:n,disabled:o,onChange:c,labels:s}),t[4]=o,t[5]=s,t[6]=r,t[7]=n,t[8]=c,t[9]=l):l=t[9];let d;return t[10]!==e||t[11]!==l?(d=(0,u.jsxs)(`div`,{className:`space-y-1.5`,children:[e,l]}),t[10]=e,t[11]=l,t[12]=d):d=t[12],d}if(c===`number`||c===`integer`){let e;t[13]===f?e=t[14]:(e=(0,u.jsx)(`p`,{className:`text-sm font-medium text-fg`,children:f}),t[13]=f,t[14]=e);let n=typeof i==`number`?i:0,s;t[15]!==o||t[16]!==a||t[17]!==r||t[18]!==n?(s=(0,u.jsx)(b,{s:r,value:n,disabled:o,onChange:a}),t[15]=o,t[16]=a,t[17]=r,t[18]=n,t[19]=s):s=t[19];let c;return t[20]!==e||t[21]!==s?(c=(0,u.jsxs)(`div`,{className:`space-y-1.5`,children:[e,s]}),t[20]=e,t[21]=s,t[22]=c):c=t[22],c}if(c===`string`){let e;t[23]===f?e=t[24]:(e=(0,u.jsx)(`p`,{className:`text-sm font-medium text-fg`,children:f}),t[23]=f,t[24]=e);let s=typeof i==`string`?i:``,c;t[25]!==o||t[26]!==n||t[27]!==a||t[28]!==r||t[29]!==s?(c=(0,u.jsx)(_,{name:n,s:r,value:s,disabled:o,onChange:a}),t[25]=o,t[26]=n,t[27]=a,t[28]=r,t[29]=s,t[30]=c):c=t[30];let l;return t[31]!==e||t[32]!==c?(l=(0,u.jsxs)(`div`,{className:`space-y-1.5`,children:[e,c]}),t[31]=e,t[32]=c,t[33]=l):l=t[33],l}if(c===`array`){let e=r.items,n=d(e)?e.type:void 0;if(n===`string`||Array.isArray(n)&&n.includes(`string`)){let e;t[34]===f?e=t[35]:(e=(0,u.jsx)(`p`,{className:`text-sm font-medium text-fg`,children:f}),t[34]=f,t[35]=e);let n;t[36]===i?n=t[37]:(n=Array.isArray(i)&&i.every(w)?i.map(String):[],t[36]=i,t[37]=n);let c;t[38]!==o||t[39]!==s||t[40]!==a||t[41]!==r||t[42]!==n?(c=(0,u.jsx)(S,{s:r,value:n,disabled:o,onChange:a,labels:s}),t[38]=o,t[39]=s,t[40]=a,t[41]=r,t[42]=n,t[43]=c):c=t[43];let l;return t[44]!==e||t[45]!==c?(l=(0,u.jsxs)(`div`,{className:`space-y-1.5`,children:[e,c]}),t[44]=e,t[45]=c,t[46]=l):l=t[46],l}}if(c===`object`){let e;t[47]===i?e=t[48]:(e=d(i)?i:{},t[47]=i,t[48]=e);let n=e,c;t[49]===f?c=t[50]:(c=(0,u.jsx)(`summary`,{className:`cursor-pointer select-none px-3 py-2 text-sm font-medium text-fg group-open:rounded-b-none`,children:f}),t[49]=f,t[50]=c);let l;t[51]!==o||t[52]!==s||t[53]!==n||t[54]!==a||t[55]!==r?(l=(0,u.jsx)(`div`,{className:`border-t border-edge p-3`,children:(0,u.jsx)(T,{schema:r,values:n,onChange:a,disabled:o,labels:s})}),t[51]=o,t[52]=s,t[53]=n,t[54]=a,t[55]=r,t[56]=l):l=t[56];let p;return t[57]!==c||t[58]!==l?(p=(0,u.jsxs)(`details`,{className:`group rounded-lg border border-edge bg-surface-panel/40 open:bg-surface-base`,open:!0,children:[c,l]}),t[57]=c,t[58]=l,t[59]=p):p=t[59],p}let p;t[60]!==s||t[61]!==c||t[62]!==f?(p=s?.unsupportedFieldType?.(f,typeof c==`string`?c:void 0)??`${f}: unsupported field type${typeof c==`string`?` (${c})`:``}`,t[60]=s,t[61]=c,t[62]=f,t[63]=p):p=t[63];let m;return t[64]===p?m=t[65]:(m=(0,u.jsx)(`p`,{className:`text-xs text-fg-muted`,children:p}),t[64]=p,t[65]=m),m}function w(e){return typeof e==`string`||typeof e==`number`}function T(e){let t=(0,l.c)(28),{schema:n,values:r,onChange:i,disabled:o,className:s,labels:c}=e,f=o===void 0?!1:o,p;bb0:{if(n.type!==`object`){let e;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(e=[],t[0]=e):e=t[0],p=e;break bb0}let e;t[1]===n?e=t[2]:(e=h(n),t[1]=n,t[2]=e),p=e}let m=p,_;bb1:{if(m.length===0){let e;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(e=new Map,t[3]=e):e=t[3],_=e;break bb1}let e;t[4]===m?e=t[5]:(e=g(m),t[4]=m,t[5]=e),_=e}let v=_,y;t[6]!==i||t[7]!==r?(y=(e,t)=>{i({...r,[e]:t})},t[6]=i,t[7]=r,t[8]=y):y=t[8];let b=y;if(n.type!==`object`||!d(n.properties)||m.length===0)return null;let x,S;if(t[9]!==s||t[10]!==f||t[11]!==v||t[12]!==c||t[13]!==b||t[14]!==r){let e=Array.from(v.keys()).sort(E);t[17]===s?x=t[18]:(x=a(`flex flex-col gap-4`,s),t[17]=s,t[18]=x);let n;t[19]!==f||t[20]!==v||t[21]!==c||t[22]!==b||t[23]!==r?(n=e=>{let t=(v.get(e)??[]).map(e=>(0,u.jsx)(C,{k:e.key,sub:e.sub,value:r[e.key],onValue:t=>b(e.key,t),disabled:f,labels:c},e.key));return e===``?(0,u.jsx)(`div`,{children:t},`default`):(0,u.jsxs)(`details`,{className:`group rounded-lg border border-edge bg-surface-panel/40 open:bg-surface-base`,open:!0,children:[(0,u.jsx)(`summary`,{className:`cursor-pointer select-none px-3 py-2 text-sm font-medium text-fg group-open:rounded-b-none`,children:e}),(0,u.jsx)(`div`,{className:`space-y-4 border-t border-edge p-3`,children:t})]},e)},t[19]=f,t[20]=v,t[21]=c,t[22]=b,t[23]=r,t[24]=n):n=t[24],S=e.map(n),t[9]=s,t[10]=f,t[11]=v,t[12]=c,t[13]=b,t[14]=r,t[15]=x,t[16]=S}else x=t[15],S=t[16];let w;return t[25]!==x||t[26]!==S?(w=(0,u.jsx)(`div`,{className:x,children:S}),t[25]=x,t[26]=S,t[27]=w):w=t[27],w}function E(e,t){return e===``?-1:t===``?1:e.localeCompare(t)}export{T as t};
|
|
1
|
+
import"./rolldown-runtime-aKtaBQYM.js";import{a as e,n as t,t as n}from"./vendor-react-BOUWij0V.js";import{n as r,r as i}from"./popover-select-DGKUpVsz.js";import{t as a}from"./cn-0WouolD0.js";import{Co as o,Eo as s}from"./index-ygkHNYyo.js";import{t as c}from"./number-input-DDeqHK-G.js";var l=t();e();var u=n();function d(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function f(e){let t=e[`x-order`];return typeof t==`number`&&!Number.isNaN(t)?t:999}function p(e){let t=e[`x-group`];return typeof t==`string`&&t.length>0?t:``}function m(e){return e[`x-hidden`]===!0}function h(e){let t=e.properties;if(!d(t))return[];let n=[];for(let[e,r]of Object.entries(t))d(r)&&(m(r)||n.push({key:e,sub:r,order:f(r),group:p(r),hidden:!1}));return n.sort((e,t)=>e.order-t.order||e.key.localeCompare(t.key)),n}function g(e){let t=new Map;for(let n of e){let e=n.group;t.has(e)||t.set(e,[]),t.get(e).push(n)}return t}function _(e){let t=(0,l.c)(38),{name:n,s:i,value:a,onChange:c,disabled:d}=e,f=typeof i.description==`string`?i.description:void 0,p=(typeof i[`x-placeholder`]==`string`?i[`x-placeholder`]:null)||f,m=i.format;if(Array.isArray(i.enum)&&i.enum.every(y)){let e;t[0]===f?e=t[1]:(e=f?(0,u.jsx)(`label`,{className:`text-xs text-fg-muted`,children:f}):null,t[0]=f,t[1]=e);let o;t[2]===c?o=t[3]:(o=e=>c(e.target.value),t[2]=c,t[3]=o);let s;t[4]===i.enum?s=t[5]:(s=i.enum.map(v),t[4]=i.enum,t[5]=s);let l;t[6]!==d||t[7]!==n||t[8]!==o||t[9]!==s||t[10]!==a?(l=(0,u.jsx)(r,{name:n,className:`ui-input h-9 rounded-md border border-edge bg-surface-base px-2 text-sm text-fg`,value:a,disabled:d,onChange:o,children:s}),t[6]=d,t[7]=n,t[8]=o,t[9]=s,t[10]=a,t[11]=l):l=t[11];let p;return t[12]!==e||t[13]!==l?(p=(0,u.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[e,l]}),t[12]=e,t[13]=l,t[14]=p):p=t[14],p}if(m===`password`){let e;t[15]===f?e=t[16]:(e=f?(0,u.jsx)(`label`,{className:`text-xs text-fg-muted`,children:f}):null,t[15]=f,t[16]=e);let n;t[17]!==d||t[18]!==c||t[19]!==p||t[20]!==a?(n=(0,u.jsx)(s,{value:a,onChange:c,placeholder:p,labels:o,disabled:d,inputClassName:`ui-input h-9 rounded-md border border-edge bg-surface-base px-2.5 text-sm text-fg placeholder:text-fg-muted/70`}),t[17]=d,t[18]=c,t[19]=p,t[20]=a,t[21]=n):n=t[21];let r;return t[22]!==e||t[23]!==n?(r=(0,u.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[e,n]}),t[22]=e,t[23]=n,t[24]=r):r=t[24],r}let h;t[25]===f?h=t[26]:(h=f?(0,u.jsx)(`label`,{className:`text-xs text-fg-muted`,children:f}):null,t[25]=f,t[26]=h);let g;t[27]===c?g=t[28]:(g=e=>c(e.target.value),t[27]=c,t[28]=g);let _;t[29]!==d||t[30]!==n||t[31]!==p||t[32]!==g||t[33]!==a?(_=(0,u.jsx)(`input`,{name:n,type:`text`,className:`ui-input h-9 rounded-md border border-edge bg-surface-base px-2.5 text-sm text-fg placeholder:text-fg-muted/70`,value:a,placeholder:p,disabled:d,onChange:g}),t[29]=d,t[30]=n,t[31]=p,t[32]=g,t[33]=a,t[34]=_):_=t[34];let b;return t[35]!==h||t[36]!==_?(b=(0,u.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[h,_]}),t[35]=h,t[36]=_,t[37]=b):b=t[37],b}function v(e){return(0,u.jsx)(i,{value:e,children:e},e)}function y(e){return typeof e==`string`}function b(e){let t=(0,l.c)(11),{s:n,value:r,onChange:i,disabled:a}=e,o=typeof n.description==`string`?n.description:void 0,s;t[0]===o?s=t[1]:(s=o?(0,u.jsx)(`label`,{className:`text-xs text-fg-muted`,children:o}):null,t[0]=o,t[1]=s);let d=Number.isFinite(r)?r:0,f;t[2]===i?f=t[3]:(f=e=>i(Number(e.target.value)),t[2]=i,t[3]=f);let p;t[4]!==a||t[5]!==d||t[6]!==f?(p=(0,u.jsx)(c,{type:`number`,className:`ui-input h-9 rounded-md border border-edge bg-surface-base px-2.5 text-sm text-fg`,value:d,disabled:a,onChange:f}),t[4]=a,t[5]=d,t[6]=f,t[7]=p):p=t[7];let m;return t[8]!==s||t[9]!==p?(m=(0,u.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[s,p]}),t[8]=s,t[9]=p,t[10]=m):m=t[10],m}function x(e){let t=(0,l.c)(11),{s:n,value:r,onChange:i,disabled:a,labels:o}=e,s=(typeof n.description==`string`?n.description:void 0)??(typeof n.title==`string`&&n.title.length>0?n.title:o?.defaultBooleanLabel??`Enable`),c;t[0]===i?c=t[1]:(c=e=>i(e.target.checked),t[0]=i,t[1]=c);let d;t[2]!==a||t[3]!==c||t[4]!==r?(d=(0,u.jsx)(`input`,{type:`checkbox`,className:`size-4 rounded border border-edge`,checked:r,disabled:a,onChange:c}),t[2]=a,t[3]=c,t[4]=r,t[5]=d):d=t[5];let f;t[6]===s?f=t[7]:(f=(0,u.jsx)(`span`,{children:s}),t[6]=s,t[7]=f);let p;return t[8]!==d||t[9]!==f?(p=(0,u.jsxs)(`label`,{className:`flex items-center gap-2 text-sm text-fg`,children:[d,f]}),t[8]=d,t[9]=f,t[10]=p):p=t[10],p}function S(e){let t=(0,l.c)(27),{s:n,value:r,onChange:i,disabled:a,labels:o}=e,s=typeof n.description==`string`?n.description:void 0,c=n.items,f=d(c)?c.type:void 0;if(!(f===`string`||Array.isArray(f)&&f.includes(`string`))){let e=o?.unsupportedArrayType??`Unsupported array type`,n;return t[0]===e?n=t[1]:(n=(0,u.jsx)(`p`,{className:`text-xs text-fg-muted`,children:e}),t[0]=e,t[1]=n),n}let p,m,h,g,_;if(t[2]!==s||t[3]!==a||t[4]!==i||t[5]!==r){let e=r.map(String);p=t=>{let n=t.trim();!n||e.includes(n)||i([...e,n])},g=`flex flex-col gap-1.5`,t[11]===s?_=t[12]:(_=s?(0,u.jsx)(`label`,{className:`text-xs text-fg-muted`,children:s}):null,t[11]=s,t[12]=_),m=`flex flex-wrap gap-1`,h=e.map(t=>(0,u.jsxs)(`span`,{className:`inline-flex items-center gap-1 rounded-md border border-edge bg-surface-panel px-2 py-0.5 text-sm`,children:[t,(0,u.jsx)(`button`,{type:`button`,className:`text-fg-muted hover:text-fg`,disabled:a,onClick:()=>i(e.filter(e=>e!==t)),children:`×`})]},t)),t[2]=s,t[3]=a,t[4]=i,t[5]=r,t[6]=p,t[7]=m,t[8]=h,t[9]=g,t[10]=_}else p=t[6],m=t[7],h=t[8],g=t[9],_=t[10];let v;t[13]!==m||t[14]!==h?(v=(0,u.jsx)(`div`,{className:m,children:h}),t[13]=m,t[14]=h,t[15]=v):v=t[15];let y=o?.arrayAddPlaceholder??`Add and press Enter`,b;t[16]===p?b=t[17]:(b=e=>{e.key===`Enter`&&(e.preventDefault(),p(e.target.value),e.target.value=``)},t[16]=p,t[17]=b);let x;t[18]!==a||t[19]!==y||t[20]!==b?(x=(0,u.jsx)(`input`,{className:`ui-input h-9 rounded-md border border-edge bg-surface-base px-2.5 text-sm`,disabled:a,placeholder:y,onKeyDown:b}),t[18]=a,t[19]=y,t[20]=b,t[21]=x):x=t[21];let S;return t[22]!==g||t[23]!==_||t[24]!==v||t[25]!==x?(S=(0,u.jsxs)(`div`,{className:g,children:[_,v,x]}),t[22]=g,t[23]=_,t[24]=v,t[25]=x,t[26]=S):S=t[26],S}function C(e){let t=(0,l.c)(66),{k:n,sub:r,value:i,onValue:a,disabled:o,labels:s}=e,c=r.type,f=(typeof r.title==`string`&&r.title.length>0?r.title:null)??n;if(c===`boolean`){let e;t[0]===f?e=t[1]:(e=(0,u.jsx)(`p`,{className:`text-sm font-medium text-fg`,children:f}),t[0]=f,t[1]=e);let n=i===!0,c;t[2]===a?c=t[3]:(c=e=>a(e),t[2]=a,t[3]=c);let l;t[4]!==o||t[5]!==s||t[6]!==r||t[7]!==n||t[8]!==c?(l=(0,u.jsx)(x,{s:r,value:n,disabled:o,onChange:c,labels:s}),t[4]=o,t[5]=s,t[6]=r,t[7]=n,t[8]=c,t[9]=l):l=t[9];let d;return t[10]!==e||t[11]!==l?(d=(0,u.jsxs)(`div`,{className:`space-y-1.5`,children:[e,l]}),t[10]=e,t[11]=l,t[12]=d):d=t[12],d}if(c===`number`||c===`integer`){let e;t[13]===f?e=t[14]:(e=(0,u.jsx)(`p`,{className:`text-sm font-medium text-fg`,children:f}),t[13]=f,t[14]=e);let n=typeof i==`number`?i:0,s;t[15]!==o||t[16]!==a||t[17]!==r||t[18]!==n?(s=(0,u.jsx)(b,{s:r,value:n,disabled:o,onChange:a}),t[15]=o,t[16]=a,t[17]=r,t[18]=n,t[19]=s):s=t[19];let c;return t[20]!==e||t[21]!==s?(c=(0,u.jsxs)(`div`,{className:`space-y-1.5`,children:[e,s]}),t[20]=e,t[21]=s,t[22]=c):c=t[22],c}if(c===`string`){let e;t[23]===f?e=t[24]:(e=(0,u.jsx)(`p`,{className:`text-sm font-medium text-fg`,children:f}),t[23]=f,t[24]=e);let s=typeof i==`string`?i:``,c;t[25]!==o||t[26]!==n||t[27]!==a||t[28]!==r||t[29]!==s?(c=(0,u.jsx)(_,{name:n,s:r,value:s,disabled:o,onChange:a}),t[25]=o,t[26]=n,t[27]=a,t[28]=r,t[29]=s,t[30]=c):c=t[30];let l;return t[31]!==e||t[32]!==c?(l=(0,u.jsxs)(`div`,{className:`space-y-1.5`,children:[e,c]}),t[31]=e,t[32]=c,t[33]=l):l=t[33],l}if(c===`array`){let e=r.items,n=d(e)?e.type:void 0;if(n===`string`||Array.isArray(n)&&n.includes(`string`)){let e;t[34]===f?e=t[35]:(e=(0,u.jsx)(`p`,{className:`text-sm font-medium text-fg`,children:f}),t[34]=f,t[35]=e);let n;t[36]===i?n=t[37]:(n=Array.isArray(i)&&i.every(w)?i.map(String):[],t[36]=i,t[37]=n);let c;t[38]!==o||t[39]!==s||t[40]!==a||t[41]!==r||t[42]!==n?(c=(0,u.jsx)(S,{s:r,value:n,disabled:o,onChange:a,labels:s}),t[38]=o,t[39]=s,t[40]=a,t[41]=r,t[42]=n,t[43]=c):c=t[43];let l;return t[44]!==e||t[45]!==c?(l=(0,u.jsxs)(`div`,{className:`space-y-1.5`,children:[e,c]}),t[44]=e,t[45]=c,t[46]=l):l=t[46],l}}if(c===`object`){let e;t[47]===i?e=t[48]:(e=d(i)?i:{},t[47]=i,t[48]=e);let n=e,c;t[49]===f?c=t[50]:(c=(0,u.jsx)(`summary`,{className:`cursor-pointer select-none px-3 py-2 text-sm font-medium text-fg group-open:rounded-b-none`,children:f}),t[49]=f,t[50]=c);let l;t[51]!==o||t[52]!==s||t[53]!==n||t[54]!==a||t[55]!==r?(l=(0,u.jsx)(`div`,{className:`border-t border-edge p-3`,children:(0,u.jsx)(T,{schema:r,values:n,onChange:a,disabled:o,labels:s})}),t[51]=o,t[52]=s,t[53]=n,t[54]=a,t[55]=r,t[56]=l):l=t[56];let p;return t[57]!==c||t[58]!==l?(p=(0,u.jsxs)(`details`,{className:`group rounded-lg border border-edge bg-surface-panel/40 open:bg-surface-base`,open:!0,children:[c,l]}),t[57]=c,t[58]=l,t[59]=p):p=t[59],p}let p;t[60]!==s||t[61]!==c||t[62]!==f?(p=s?.unsupportedFieldType?.(f,typeof c==`string`?c:void 0)??`${f}: unsupported field type${typeof c==`string`?` (${c})`:``}`,t[60]=s,t[61]=c,t[62]=f,t[63]=p):p=t[63];let m;return t[64]===p?m=t[65]:(m=(0,u.jsx)(`p`,{className:`text-xs text-fg-muted`,children:p}),t[64]=p,t[65]=m),m}function w(e){return typeof e==`string`||typeof e==`number`}function T(e){let t=(0,l.c)(28),{schema:n,values:r,onChange:i,disabled:o,className:s,labels:c}=e,f=o===void 0?!1:o,p;bb0:{if(n.type!==`object`){let e;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(e=[],t[0]=e):e=t[0],p=e;break bb0}let e;t[1]===n?e=t[2]:(e=h(n),t[1]=n,t[2]=e),p=e}let m=p,_;bb1:{if(m.length===0){let e;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(e=new Map,t[3]=e):e=t[3],_=e;break bb1}let e;t[4]===m?e=t[5]:(e=g(m),t[4]=m,t[5]=e),_=e}let v=_,y;t[6]!==i||t[7]!==r?(y=(e,t)=>{i({...r,[e]:t})},t[6]=i,t[7]=r,t[8]=y):y=t[8];let b=y;if(n.type!==`object`||!d(n.properties)||m.length===0)return null;let x,S;if(t[9]!==s||t[10]!==f||t[11]!==v||t[12]!==c||t[13]!==b||t[14]!==r){let e=Array.from(v.keys()).sort(E);t[17]===s?x=t[18]:(x=a(`flex flex-col gap-4`,s),t[17]=s,t[18]=x);let n;t[19]!==f||t[20]!==v||t[21]!==c||t[22]!==b||t[23]!==r?(n=e=>{let t=(v.get(e)??[]).map(e=>(0,u.jsx)(C,{k:e.key,sub:e.sub,value:r[e.key],onValue:t=>b(e.key,t),disabled:f,labels:c},e.key));return e===``?(0,u.jsx)(`div`,{children:t},`default`):(0,u.jsxs)(`details`,{className:`group rounded-lg border border-edge bg-surface-panel/40 open:bg-surface-base`,open:!0,children:[(0,u.jsx)(`summary`,{className:`cursor-pointer select-none px-3 py-2 text-sm font-medium text-fg group-open:rounded-b-none`,children:e}),(0,u.jsx)(`div`,{className:`space-y-4 border-t border-edge p-3`,children:t})]},e)},t[19]=f,t[20]=v,t[21]=c,t[22]=b,t[23]=r,t[24]=n):n=t[24],S=e.map(n),t[9]=s,t[10]=f,t[11]=v,t[12]=c,t[13]=b,t[14]=r,t[15]=x,t[16]=S}else x=t[15],S=t[16];let w;return t[25]!==x||t[26]!==S?(w=(0,u.jsx)(`div`,{className:x,children:S}),t[25]=x,t[26]=S,t[27]=w):w=t[27],w}function E(e,t){return e===``?-1:t===``?1:e.localeCompare(t)}export{T as t};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{a as t,n,t as r}from"./vendor-react-BOUWij0V.js";import{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"./folder-open-CyzJ19I9.js";import{t as l}from"./messages-RzwPiQNL.js";import{t as u}from"./cn-0WouolD0.js";import{i as d,l as f,n as p,o as m}from"./locale-store-JogcXC4J.js";import{a as h,c as g,f as _,n as v,o as y,p as b,r as x,s as S,t as C}from"./session-api-DTxZyMta.js";import{i as w}from"./vendor-swr-BIWyz7Rc.js";import{t as T}from"./button-aIC072nz.js";import{t as E}from"./skeleton-BI5TyibZ.js";import{n as D,r as O}from"./gateway-config-swr-DF_HV6NP.js";import{n as k,t as A}from"./registry-api-BGqSwITi.js";import{i as j,o as ee}from"./settings-shell-dialog-layer-BU3UuiJr.js";import{Au as M,Bc as N,Ca as P,Cd as F,Fc as te,Ga as I,Gt as L,Ha as R,Hl as z,Ic as B,Kl as V,Lc as ne,Mu as re,Os as H,S as U,Sa as ie,Tl as W,Vc as ae,Wt as oe,Xd as se,Zd as ce,dd as le,fa as ue,fu as G,hd as de,ii as fe,il as pe,jo as K,kl as me,ks as q,ku as he,ma as ge,pa as _e,qc as J,ql as ve,uu as ye,vo as be,ya as xe,zc as Se}from"./index-ygkHNYyo.js";import{t as Y}from"./number-input-DDeqHK-G.js";import{n as Ce,t as we}from"./settings-page-header-CYpuTXUW.js";import"./settings-page-layout-B20AfmFG.js";import{n as Te,t as X}from"./settings-form-section-Ce8vVv-9.js";import{n as Ee,t as De}from"./use-autosave-C1X47WVb.js";import{t as Oe}from"./settings-advanced-gate-QTVDCGJG.js";var Z=e(t(),1),ke=n(),Q=r();function Ae(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 je(e,t){return new Intl.NumberFormat(t===`zh`?`zh-CN`:`en-US`).format(e)}function Me(e){return`$${Number(e).toLocaleString(void 0,{minimumFractionDigits:0,maximumFractionDigits:6})}`}function Ne(e){let t=(0,ke.c)(124),{session:n,variant:r,labels:i,sessionAgentId:a,sessionAgentAvatar:o,onOpen:c,onAction:d}=e,f;t[0]!==i.unnamedSession||t[1]!==n.name?(f=n.name?.trim()||i.unnamedSession,t[0]=i.unnamedSession,t[1]=n.name,t[2]=f):f=t[2];let m=f,h=p(Le),g;t[3]!==h||t[4]!==n?(g=P(n,l(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 y=!!v,b=n.status===`archived`,x=n.status===`pinned`,S=n.usage,C;t[8]!==i.costUnknown||t[9]!==i.noUsage||t[10]!==S?(C=S?.calls?S.costCompleteness===`unknown`?i.costUnknown:`${S.costCompleteness===`partial`?`≥ `:`≈ `}${Me(S.knownCostUsd)}`:i.noUsage,t[8]=i.costUnknown,t[9]=i.noUsage,t[10]=S,t[11]=C):C=t[11];let w=C,T=S?.calls?S.costCompleteness===`partial`?i.costPartial:S.costCompleteness===`unknown`?i.costUnknown:i.cost:i.noUsage,E=r===`list`&&`sm:flex-row sm:items-center sm:gap-4`,D;t[12]===E?D=t[13]:(D=u(`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`,E),t[12]=E,t[13]=D);let O;t[14]===c?O=t[15]:(O=e=>{(e.key===`Enter`||e.key===` `)&&(e.preventDefault(),c())},t[14]=c,t[15]=O);let k=r===`list`&&`sm:py-3`,A;t[16]===k?A=t[17]:(A=u(`flex min-w-0 items-start justify-between gap-2 bg-surface-hover/35 px-3 py-2 dark:bg-surface-hover/25`,k),t[16]=k,t[17]=A);let j;t[18]===n?j=t[19]:(j=(0,Q.jsx)(ie,{sourceChannel:n.sourceChannel,session:n,className:`size-3.5`}),t[18]=n,t[19]=j);let ee;t[20]===_?ee=t[21]:(ee=(0,Q.jsx)(`span`,{className:`truncate text-[11px] font-medium uppercase tracking-wide text-fg-subtle`,children:_}),t[20]=_,t[21]=ee);let M;t[22]!==j||t[23]!==ee?(M=(0,Q.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2`,children:[j,ee]}),t[22]=j,t[23]=ee,t[24]=M):M=t[24];let N;t[25]===x?N=t[26]:(N=x?(0,Q.jsx)(ve,{className:`size-3.5 text-accent-fg`,strokeWidth:1.75,"aria-hidden":!0}):null,t[25]=x,t[26]=N);let F;t[27]===n.updatedAt?F=t[28]:(F=Ae(n.updatedAt),t[27]=n.updatedAt,t[28]=F);let te;t[29]===F?te=t[30]:(te=(0,Q.jsx)(`span`,{children:F}),t[29]=F,t[30]=te);let L;t[31]!==N||t[32]!==te?(L=(0,Q.jsxs)(`div`,{className:`flex shrink-0 items-center gap-1.5 text-xs text-fg-muted`,children:[N,te]}),t[31]=N,t[32]=te,t[33]=L):L=t[33];let R;t[34]!==M||t[35]!==L||t[36]!==A?(R=(0,Q.jsxs)(`div`,{className:A,children:[M,L]}),t[34]=M,t[35]=L,t[36]=A,t[37]=R):R=t[37];let z=r===`list`&&`sm:py-3`,B;t[38]===z?B=t[39]:(B=u(`min-w-0 flex-1 px-3 py-2`,z),t[38]=z,t[39]=B);let ne=r===`list`&&`sm:items-start`,re;t[40]===ne?re=t[41]:(re=u(`flex gap-3`,ne),t[40]=ne,t[41]=re);let U;t[42]!==o||t[43]!==a?(U=(0,Q.jsx)(I,{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]=U):U=t[44];let W;t[45]===m?W=t[46]:(W=(0,Q.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]=W);let ae;t[47]!==n.key||t[48]!==y?(ae=y?(0,Q.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]=y,t[49]=ae):ae=t[49];let oe;t[50]!==W||t[51]!==ae?(oe=(0,Q.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[W,ae]}),t[50]=W,t[51]=ae,t[52]=oe):oe=t[52];let ue;t[53]!==re||t[54]!==U||t[55]!==oe?(ue=(0,Q.jsxs)(`div`,{className:re,children:[U,oe]}),t[53]=re,t[54]=U,t[55]=oe,t[56]=ue):ue=t[56];let fe;t[57]===Symbol.for(`react.memo_cache_sentinel`)?(fe=(0,Q.jsx)(G,{className:`size-3.5`,strokeWidth:1.75,"aria-hidden":!0}),t[57]=fe):fe=t[57];let K;t[58]===n.messageCount?K=t[59]:(K=(0,Q.jsxs)(`span`,{className:`inline-flex items-center gap-1`,children:[fe,n.messageCount]}),t[58]=n.messageCount,t[59]=K);let me;t[60]===Symbol.for(`react.memo_cache_sentinel`)?(me=(0,Q.jsx)(le,{className:`size-3.5`,strokeWidth:1.75,"aria-hidden":!0}),t[60]=me):me=t[60];let q=S?.totalTokens??0,he;t[61]!==h||t[62]!==q?(he=je(q,h),t[61]=h,t[62]=q,t[63]=he):he=t[63];let ge;t[64]!==i.tokens||t[65]!==he?(ge=(0,Q.jsxs)(`span`,{className:`inline-flex items-center gap-1`,children:[me,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,Q.jsx)(de,{className:`size-3.5`,strokeWidth:1.75,"aria-hidden":!0}),t[67]=_e):_e=t[67];let J;t[68]!==w||t[69]!==T?(J=(0,Q.jsxs)(`span`,{className:`inline-flex items-center gap-1`,title:T,children:[_e,w]}),t[68]=w,t[69]=T,t[70]=J):J=t[70];let ye;t[71]!==K||t[72]!==ge||t[73]!==J?(ye=(0,Q.jsxs)(`div`,{className:`mt-2 flex flex-wrap items-center gap-3 text-xs text-fg-muted`,children:[K,ge,J]}),t[71]=K,t[72]=ge,t[73]=J,t[74]=ye):ye=t[74];let be;t[75]===n.tags?be=t[76]:(be=n.tags.length>0?(0,Q.jsxs)(`div`,{className:`mt-2 flex flex-wrap gap-1`,children:[n.tags.slice(0,3).map(Ie),n.tags.length>3?(0,Q.jsxs)(`span`,{className:`text-[11px] text-fg-disabled`,children:[`+`,n.tags.length-3]}):null]}):null,t[75]=n.tags,t[76]=be);let xe;t[77]!==B||t[78]!==ue||t[79]!==ye||t[80]!==be?(xe=(0,Q.jsxs)(`div`,{className:B,children:[ue,ye,be]}),t[77]=B,t[78]=ue,t[79]=ye,t[80]=be,t[81]=xe):xe=t[81];let Se;t[82]===d?Se=t[83]:(Se=()=>d(`continue`),t[82]=d,t[83]=Se);let Y;t[84]===Symbol.for(`react.memo_cache_sentinel`)?(Y=(0,Q.jsx)(G,{className:`size-4`,strokeWidth:1.75}),t[84]=Y):Y=t[84];let Ce;t[85]!==i.continueChat||t[86]!==Se?(Ce=(0,Q.jsx)(`button`,{type:`button`,className:H,title:i.continueChat,"aria-label":i.continueChat,onClick:Se,children:Y}),t[85]=i.continueChat,t[86]=Se,t[87]=Ce):Ce=t[87];let we;t[88]!==b||t[89]!==i.archive||t[90]!==i.unarchive||t[91]!==d?(we=b?(0,Q.jsx)(`button`,{type:`button`,className:H,title:i.unarchive,"aria-label":i.unarchive,onClick:()=>d(`unarchive`),children:(0,Q.jsx)(ce,{className:`size-4`,strokeWidth:1.75})}):(0,Q.jsx)(`button`,{type:`button`,className:H,title:i.archive,"aria-label":i.archive,onClick:()=>d(`archive`),children:(0,Q.jsx)(se,{className:`size-4`,strokeWidth:1.75})}),t[88]=b,t[89]=i.archive,t[90]=i.unarchive,t[91]=d,t[92]=we):we=t[92];let Te;t[93]!==x||t[94]!==i.pin||t[95]!==i.unpin||t[96]!==d?(Te=x?(0,Q.jsx)(`button`,{type:`button`,className:H,title:i.unpin,"aria-label":i.unpin,onClick:()=>d(`unpin`),children:(0,Q.jsx)(V,{className:`size-4`,strokeWidth:1.75})}):(0,Q.jsx)(`button`,{type:`button`,className:H,title:i.pin,"aria-label":i.pin,onClick:()=>d(`pin`),children:(0,Q.jsx)(ve,{className:`size-4`,strokeWidth:1.75})}),t[93]=x,t[94]=i.pin,t[95]=i.unpin,t[96]=d,t[97]=Te):Te=t[97];let X;t[98]===d?X=t[99]:(X=()=>d(`export`),t[98]=d,t[99]=X);let Ee;t[100]===Symbol.for(`react.memo_cache_sentinel`)?(Ee=(0,Q.jsx)(s,{className:`size-4`,strokeWidth:1.75}),t[100]=Ee):Ee=t[100];let De;t[101]!==i.export||t[102]!==X?(De=(0,Q.jsx)(`button`,{type:`button`,className:H,title:i.export,"aria-label":i.export,onClick:X,children:Ee}),t[101]=i.export,t[102]=X,t[103]=De):De=t[103];let Oe;t[104]===Symbol.for(`react.memo_cache_sentinel`)?(Oe=u(H,`text-red-600 hover:bg-red-50 dark:text-red-400 dark:hover:bg-red-950/40`),t[104]=Oe):Oe=t[104];let Z;t[105]===d?Z=t[106]:(Z=()=>d(`delete`),t[105]=d,t[106]=Z);let Ne;t[107]===Symbol.for(`react.memo_cache_sentinel`)?(Ne=(0,Q.jsx)(pe,{className:`size-4`,strokeWidth:1.75}),t[107]=Ne):Ne=t[107];let Re;t[108]!==i.delete||t[109]!==Z?(Re=(0,Q.jsx)(`button`,{type:`button`,className:Oe,title:i.delete,"aria-label":i.delete,onClick:Z,children:Ne}),t[108]=i.delete,t[109]=Z,t[110]=Re):Re=t[110];let ze;t[111]!==Ce||t[112]!==we||t[113]!==Te||t[114]!==De||t[115]!==Re?(ze=(0,Q.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:Fe,onKeyDown:Pe,children:[Ce,we,Te,De,Re]}),t[111]=Ce,t[112]=we,t[113]=Te,t[114]=De,t[115]=Re,t[116]=ze):ze=t[116];let Be;return t[117]!==c||t[118]!==R||t[119]!==xe||t[120]!==ze||t[121]!==D||t[122]!==O?(Be=(0,Q.jsxs)(`div`,{role:`button`,tabIndex:0,className:D,onClick:c,onKeyDown:O,children:[R,xe,ze]}),t[117]=c,t[118]=R,t[119]=xe,t[120]=ze,t[121]=D,t[122]=O,t[123]=Be):Be=t[123],Be}function Pe(e){return e.stopPropagation()}function Fe(e){return e.stopPropagation()}function Ie(e){return(0,Q.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 Le(e){return e.language}function Re(e,t){return e.routing?.agentId?.trim().toLowerCase()||t.trim().toLowerCase()||`main`}function ze(e,t){return t.find(t=>t.id===e)?.avatar}var Be={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 Ve(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function He(e,t,n,r=1/0){return typeof e==`number`&&Number.isFinite(e)&&e>=n&&e<=r?e:t}function Ue(e,t,n,r=1/0){return Number.isInteger(e)&&e>=n&&e<=r?e:t}function We(e){let t=Ve(e)?e:{},n=Ve(t.userContext)?t.userContext:{},r=Ve(n.contextPlanning)?n.contextPlanning:{},i=Ve(r.compaction)?r.compaction:{},a=Be,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:He(i.triggerThreshold,a.triggerThreshold,.1,.98),reserveTokens:Ue(i.reserveTokens,a.reserveTokens,1024),minMessagesBeforeCompact:Ue(i.minMessagesBeforeCompact,a.minMessagesBeforeCompact,2),keepRecentTokens:Ue(i.keepRecentTokens,a.keepRecentTokens,1e3),recentTurnsPreserve:Ue(i.recentTurnsPreserve,a.recentTurnsPreserve,1,12),summaryMaxTokens:Ue(i.summaryMaxTokens,a.summaryMaxTokens,256),summaryChunkTokens:Ue(i.summaryChunkTokens,a.summaryChunkTokens,1e3),summaryTimeoutMs:Ue(i.summaryTimeoutMs,a.summaryTimeoutMs,1e3,6e5),summaryRetries:Ue(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:Ue(i.minToolResultKeepChars,a.minToolResultKeepChars,200),maxActiveTranscriptBytes:Ue(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 m(d(`/api/config`),{method:`PATCH`,body:JSON.stringify(Ke(e))}),await D()}var Je=128e3,Ye={balanced:Be,preserve:{...Be,triggerThreshold:.88,keepRecentTokens:32e3,recentTurnsPreserve:5,maxActiveTranscriptBytes:4e6},early:{...Be,triggerThreshold:.65,reserveTokens:12e3,minMessagesBeforeCompact:6,keepRecentTokens:12e3,recentTurnsPreserve:2}},Xe=ue();function Ze(){return u(`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`,K,`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,ke.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,Q.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,Q.jsx)(Y,{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,Q.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,Q.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,ke.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=u(`flex items-start gap-2 text-sm text-fg`,s),t[0]=s,t[1]=c);let l;t[2]===o?l=t[3]:(l=e=>o(e.target.checked),t[2]=o,t[3]=l);let d;t[4]!==i||t[5]!==a||t[6]!==l?(d=(0,Q.jsx)(`input`,{type:`checkbox`,className:`ui-checkbox mt-0.5`,checked:i,disabled:a,onChange:l}),t[4]=i,t[5]=a,t[6]=l,t[7]=d):d=t[7];let f;t[8]===n?f=t[9]:(f=(0,Q.jsx)(`span`,{className:`font-medium`,children:n}),t[8]=n,t[9]=f);let p;t[10]===r?p=t[11]:(p=(0,Q.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,Q.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,Q.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=l(p(e=>e.language)).sessions.compaction,{data:n,isLoading:r}=O(e),{data:i=[],isLoading:a}=w(e?A:null,k,{revalidateOnFocus:!1}),o=(0,Z.useMemo)(()=>n?.payload?.config===void 0?null:We(n.payload.config),[n]),[s,c]=(0,Z.useReducer)(Xe,{form:null,baseline:null}),[d,f]=(0,Z.useState)(``),m=(0,Z.useRef)(!1),h=(0,Z.useRef)(s.form);h.current=s.form;let g=(0,Z.useRef)(null);_e({enabled:e,parsed:o,dirty:m.current,trackedParsedRef:g,dispatch:c,onResetDirty:()=>{m.current=!1}});let _=s.form,v=s.baseline,y=!!(_&&v&&JSON.stringify(_)!==JSON.stringify(v)),b=(0,Z.useCallback)(e=>{m.current=!0,c({type:`patch`,patch:e})},[]),x=(0,Z.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]),S=De({value:_,dirty:y,onSave:(0,Z.useCallback)(async e=>{try{await qe(e),c({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}}`,x(n)):null}});if(!e||!_)return r?(0,Q.jsx)(X,{children:(0,Q.jsxs)(`div`,{className:`space-y-3`,"aria-busy":!0,children:[(0,Q.jsx)(E,{className:`h-5 w-48`}),(0,Q.jsx)(E,{className:`h-20 w-full rounded-xl`}),(0,Q.jsx)(E,{className:`h-36 w-full rounded-xl`})]})}):null;let C=$e(_),D=Math.max(0,Je-_.reserveTokens),j=Math.min(Math.floor(Je*_.triggerThreshold),D),ee=Math.min(100,j/Je*100),M=Math.min(100,D/Je*100),N=_.model?i.find(e=>e.id===_.model):void 0,P=N?.contextWindow&&_.summaryChunkTokens+_.summaryMaxTokens+4096>N.contextWindow,F=_.keepRecentTokens+_.reserveTokens>j,te=Math.round(_.summaryTimeoutMs*(_.summaryRetries+1)/1e3),I=e=>{let t=Ye[e];b({...t,..._.model?{model:_.model}:{model:void 0},postCompactionSections:_.postCompactionSections})},L={balanced:{title:t.presetBalanced,hint:t.presetBalancedHint},preserve:{title:t.presetPreserve,hint:t.presetPreserveHint},early:{title:t.presetEarly,hint:t.presetEarlyHint}},R=()=>{let e=d.trim();!e||_.postCompactionSections.includes(e)||_.postCompactionSections.length>=12||(b({postCompactionSections:[..._.postCompactionSections,e]}),f(``))};return(0,Q.jsxs)(X,{onBlurCapture:S.onBlurCapture,children:[(0,Q.jsx)(Te,{icon:ye,title:t.title,subtitle:t.hint,trailing:(0,Q.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,Q.jsx)(Ee,{status:S.status,error:S.error}),(0,Q.jsxs)(`label`,{className:`flex cursor-pointer items-center gap-2 text-sm font-medium text-fg`,children:[(0,Q.jsx)(`input`,{type:`checkbox`,className:`ui-checkbox`,checked:_.enabled,onChange:e=>b({enabled:e.target.checked})}),_.enabled?t.enabled:t.disabled]})]})}),S.error?(0,Q.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:S.error}):null,_.enabled?null:(0,Q.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,Q.jsxs)(`fieldset`,{disabled:!_.enabled,className:`space-y-5 disabled:opacity-60`,children:[(0,Q.jsxs)(`div`,{children:[(0,Q.jsxs)(`div`,{className:`mb-2 flex items-center justify-between gap-3`,children:[(0,Q.jsxs)(`div`,{children:[(0,Q.jsx)(`div`,{className:`text-sm font-medium text-fg`,children:t.presetTitle}),(0,Q.jsx)(`p`,{className:`mt-0.5 text-xs text-fg-subtle`,children:t.presetHint})]}),C===`custom`?(0,Q.jsx)(`span`,{className:`rounded-full bg-surface-hover px-2 py-1 text-[11px] font-medium text-fg-muted`,children:t.presetCustom}):null]}),(0,Q.jsx)(`div`,{className:`grid gap-2 sm:grid-cols-3`,children:[`balanced`,`preserve`,`early`].map(e=>(0,Q.jsxs)(`button`,{type:`button`,"aria-pressed":C===e,className:u(`rounded-xl bg-surface-base/55 px-3 py-3 text-left focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,q.transition,q.focusRingPanel,C===e?`bg-accent-soft text-accent-fg shadow-surface`:`text-fg hover:bg-surface-hover`),onClick:()=>I(e),children:[(0,Q.jsx)(`span`,{className:`block text-sm font-medium`,children:L[e].title}),(0,Q.jsx)(`span`,{className:`mt-1 block text-xs text-fg-muted`,children:L[e].hint})]},e))})]}),(0,Q.jsxs)(U,{title:t.advancedTitle,summary:C===`custom`?t.presetCustom:t.presetHint,children:[(0,Q.jsxs)(`div`,{className:`rounded-xl bg-surface-base/45 p-4`,children:[(0,Q.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-2`,children:[(0,Q.jsxs)(`div`,{children:[(0,Q.jsx)(`div`,{className:`text-sm font-medium text-fg`,children:t.budgetPreview}),(0,Q.jsx)(`p`,{className:`mt-0.5 text-xs text-fg-subtle`,children:t.budgetPreviewHint})]}),(0,Q.jsx)(`span`,{className:`rounded-full bg-surface-panel px-2.5 py-1 font-mono text-xs text-fg-muted`,children:t.previewModel128k})]}),(0,Q.jsxs)(`div`,{className:`mt-4 space-y-3`,children:[(0,Q.jsxs)(`div`,{children:[(0,Q.jsxs)(`div`,{className:`mb-1 flex justify-between gap-3 text-xs text-fg-muted`,children:[(0,Q.jsx)(`span`,{children:t.compactionTrigger}),(0,Q.jsx)(`span`,{className:`font-mono text-fg`,children:et(j)})]}),(0,Q.jsx)(`div`,{className:`h-2 overflow-hidden rounded-full bg-surface-active`,children:(0,Q.jsx)(`div`,{className:`h-full rounded-full bg-accent`,style:{width:`${ee}%`}})})]}),(0,Q.jsxs)(`div`,{children:[(0,Q.jsxs)(`div`,{className:`mb-1 flex justify-between gap-3 text-xs text-fg-muted`,children:[(0,Q.jsx)(`span`,{children:t.hardInputLimit}),(0,Q.jsx)(`span`,{className:`font-mono text-fg`,children:et(D)})]}),(0,Q.jsx)(`div`,{className:`h-2 overflow-hidden rounded-full bg-surface-active`,children:(0,Q.jsx)(`div`,{className:`h-full rounded-full bg-fg-subtle`,style:{width:`${M}%`}})})]})]}),(0,Q.jsx)(`p`,{className:`mt-3 text-xs text-fg-subtle`,children:t.budgetFormula})]}),(0,Q.jsxs)(`div`,{className:`grid gap-4 sm:grid-cols-2`,children:[(0,Q.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=>b({triggerThreshold:e/100})}),(0,Q.jsx)($,{id:`compaction-reserve-tokens`,label:t.reserveTokens,hint:t.reserveTokensHint.replace(`{{tokens}}`,et(_.reserveTokens)),value:_.reserveTokens,min:1024,step:1024,onChange:e=>b({reserveTokens:Math.floor(e)})}),(0,Q.jsx)($,{id:`compaction-recent-turns`,label:t.recentTurnsPreserve,hint:t.recentTurnsPreserveHint,value:_.recentTurnsPreserve,min:1,max:12,onChange:e=>b({recentTurnsPreserve:Math.floor(e)})}),(0,Q.jsx)($,{id:`compaction-keep-recent-tokens`,label:t.keepRecentTokens,hint:t.keepRecentTokensHint.replace(`{{tokens}}`,et(_.keepRecentTokens)),value:_.keepRecentTokens,min:1e3,step:1e3,onChange:e=>b({keepRecentTokens:Math.floor(e)})})]}),F?(0,Q.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,Q.jsxs)(`div`,{className:`grid gap-4 sm:grid-cols-2`,children:[(0,Q.jsxs)(`div`,{children:[(0,Q.jsx)(`label`,{className:`mb-1 block text-sm font-medium text-fg`,children:t.summaryModel}),(0,Q.jsxs)(`div`,{className:`flex min-w-0 gap-2`,children:[(0,Q.jsx)(fe,{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=>b({model:e})}),_.model?(0,Q.jsx)(T,{type:`button`,variant:`secondary`,onClick:()=>b({model:void 0}),children:t.summaryModelUseSession}):null]}),(0,Q.jsx)(`p`,{className:`mt-1 text-xs text-fg-subtle`,children:t.summaryModelHint})]}),(0,Q.jsx)(tt,{label:t.qualityGuard,hint:t.qualityGuardHint,checked:_.qualityGuard,onChange:e=>b({qualityGuard:e})}),(0,Q.jsx)(tt,{label:t.gapAudit,hint:t.gapAuditHint,checked:_.gapAudit,onChange:e=>b({gapAudit:e})})]}),_.qualityGuard?null:(0,Q.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,Q.jsx)(Oe,{children:(0,Q.jsxs)(`div`,{className:`space-y-5 rounded-xl bg-surface-base/45 p-4`,children:[(0,Q.jsxs)(`div`,{children:[(0,Q.jsx)(`div`,{className:`text-sm font-semibold text-fg`,children:t.advancedTitle}),(0,Q.jsx)(`p`,{className:`mt-0.5 text-xs text-fg-subtle`,children:t.advancedHint})]}),(0,Q.jsxs)(`div`,{className:`grid gap-4 sm:grid-cols-2`,children:[(0,Q.jsx)($,{id:`compaction-min-messages`,label:t.minMessagesBeforeCompact,hint:t.minMessagesBeforeCompactHint,value:_.minMessagesBeforeCompact,min:2,onChange:e=>b({minMessagesBeforeCompact:Math.floor(e)})}),(0,Q.jsx)($,{id:`compaction-max-transcript-mb`,label:t.maxActiveTranscriptMb,hint:t.maxActiveTranscriptMbHint,value:Number((_.maxActiveTranscriptBytes/1e6).toFixed(3)),min:.064,step:.1,onChange:e=>b({maxActiveTranscriptBytes:Math.max(64e3,Math.round(e*1e6))})}),(0,Q.jsx)($,{id:`compaction-summary-max-tokens`,label:t.summaryMaxTokens,hint:t.summaryMaxTokensHint,value:_.summaryMaxTokens,min:256,step:256,onChange:e=>b({summaryMaxTokens:Math.floor(e)})}),(0,Q.jsx)($,{id:`compaction-summary-chunk-tokens`,label:t.summaryChunkTokens,hint:t.summaryChunkTokensHint,value:_.summaryChunkTokens,min:1e3,step:1e3,onChange:e=>b({summaryChunkTokens:Math.floor(e)})}),(0,Q.jsx)($,{id:`compaction-summary-timeout`,label:t.summaryTimeoutSeconds,hint:t.summaryTimeoutSecondsHint.replace(`{{seconds}}`,String(te)),value:_.summaryTimeoutMs/1e3,min:1,max:600,onChange:e=>b({summaryTimeoutMs:Math.round(e*1e3)})}),(0,Q.jsx)($,{id:`compaction-summary-retries`,label:t.summaryRetries,hint:t.summaryRetriesHint,value:_.summaryRetries,min:0,max:5,onChange:e=>b({summaryRetries:Math.floor(e)})}),(0,Q.jsx)($,{id:`compaction-min-tool-result-chars`,label:t.minToolResultKeepChars,hint:t.minToolResultKeepCharsHint,value:_.minToolResultKeepChars,min:200,step:100,onChange:e=>b({minToolResultKeepChars:Math.floor(e)})})]}),P?(0,Q.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,Q.jsxs)(`div`,{className:`rounded-xl bg-surface-base/45 p-4`,children:[(0,Q.jsx)(`div`,{className:`text-sm font-medium text-fg`,children:t.postCompactionSections}),(0,Q.jsx)(`p`,{className:`mt-1 text-xs text-fg-subtle`,children:t.postCompactionSectionsHint}),_.postCompactionSections.length>0?(0,Q.jsx)(`div`,{className:`mt-3 flex flex-wrap gap-2`,children:_.postCompactionSections.map(e=>(0,Q.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,Q.jsx)(`button`,{type:`button`,className:u(`text-fg-muted hover:text-fg`,q.press),"aria-label":t.removeSection.replace(`{{section}}`,e),onClick:()=>b({postCompactionSections:_.postCompactionSections.filter(t=>t!==e)}),children:(0,Q.jsx)(J,{className:`size-3.5`,"aria-hidden":!0})})]},e))}):(0,Q.jsx)(`p`,{className:`mt-3 text-xs text-fg-muted`,children:t.postCompactionSectionsEmpty}),(0,Q.jsxs)(`div`,{className:`mt-3 flex gap-2`,children:[(0,Q.jsx)(`input`,{className:Ze(),value:d,maxLength:120,disabled:_.postCompactionSections.length>=12,placeholder:t.postCompactionSectionsPlaceholder,onChange:e=>f(e.target.value),onKeyDown:e=>{e.key===`Enter`&&(e.preventDefault(),R())}}),(0,Q.jsxs)(T,{type:`button`,variant:`secondary`,disabled:!d.trim()||_.postCompactionSections.length>=12,onClick:R,children:[(0,Q.jsx)(z,{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 m(d(`/api/config`),{method:`PATCH`,body:JSON.stringify({session:{dmScope:e.dmScope,storage:{pruneAfterMs:e.pruneAfterDays===null?null:e.pruneAfterDays*864e5,maxEntries:e.maxEntries}}})}),D()}function st(){return u(`w-full rounded-lg border border-edge bg-surface-panel px-3 py-2 text-sm text-fg`,K,`dark:border-edge`)}var ct=ue();function lt({hasToken:e}){let t=l(p(e=>e.language)).sessions.config,{data:n,isLoading:r}=O(e),i=(0,Z.useMemo)(()=>n?.payload?.config===void 0?null:at(n.payload.config),[n]),[s,c]=(0,Z.useReducer)(ct,{form:null,baseline:null}),u=s.form,d=s.baseline,f=(0,Z.useRef)(!1),m=(0,Z.useRef)(u);m.current=u;let h=(0,Z.useRef)(null);_e({enabled:e,parsed:i,dirty:f.current,trackedParsedRef:h,dispatch:c,onResetDirty:()=>{f.current=!1}});let g=!!(u&&d&&JSON.stringify(u)!==JSON.stringify(d)),_=(0,Z.useCallback)(e=>{f.current=!0,c({type:`patch`,patch:e})},[]),v=De({value:u,dirty:g,onSave:(0,Z.useCallback)(async e=>{try{await ot(e),c({type:`saved`,value:e}),f.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,Q.jsx)(X,{children:(0,Q.jsxs)(`div`,{className:`space-y-3`,"aria-busy":!0,children:[(0,Q.jsx)(E,{className:`h-5 w-40`}),(0,Q.jsx)(E,{className:`h-24 w-full rounded-xl`})]})}):null:(0,Q.jsxs)(X,{onBlurCapture:v.onBlurCapture,children:[(0,Q.jsx)(Te,{icon:le,title:t.title,subtitle:t.hint,trailing:(0,Q.jsx)(Ee,{status:v.status,error:v.error})}),(0,Q.jsxs)(`div`,{className:`grid gap-4 sm:grid-cols-2`,children:[(0,Q.jsx)(U,{title:t.dmScope,summary:u.dmScope,children:(0,Q.jsxs)(`div`,{className:`sm:col-span-2`,children:[(0,Q.jsx)(`label`,{className:`mb-1 block text-sm font-medium text-fg`,children:t.dmScope}),(0,Q.jsxs)(a,{className:st(),value:u.dmScope,onChange:e=>_({dmScope:e.target.value}),children:[(0,Q.jsx)(o,{value:`main`,children:t.dmScopeMain}),(0,Q.jsx)(o,{value:`per-peer`,children:t.dmScopePerPeer}),(0,Q.jsx)(o,{value:`per-channel-peer`,children:t.dmScopePerChannelPeer}),(0,Q.jsx)(o,{value:`per-account-channel-peer`,children:t.dmScopePerAccountChannelPeer})]}),(0,Q.jsx)(`p`,{className:`mt-1 text-xs text-fg-subtle`,children:t.dmScopeHint})]})}),(0,Q.jsxs)(`div`,{children:[(0,Q.jsx)(`label`,{className:`mb-1 block text-sm font-medium text-fg`,children:t.pruneAfterDays}),(0,Q.jsx)(Y,{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,Q.jsx)(U,{title:t.maxEntries,summary:u.maxEntries??t.unsetPlaceholder,children:(0,Q.jsxs)(`div`,{children:[(0,Q.jsx)(`label`,{className:`mb-1 block text-sm font-medium text-fg`,children:t.maxEntries}),(0,Q.jsx)(Y,{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,ke.c)(60),{open:n,loading:r,session:i,sessionAgentId:a,sessionAgentAvatar:o,labels:s,onClose:c,onArchive:l,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 y;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(y=(0,Q.jsx)(Se,{className:u(`xopc-dialog-overlay fixed inset-0 bg-scrim`,ee)}),t[2]=y):y=t[2];let b;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(b=u(`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`,j,`dark:border-edge`),t[3]=b):b=t[3];let x;t[4]!==i||t[5]!==o||t[6]!==a?(x=i&&a?(0,Q.jsx)(I,{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]=x):x=t[7];let S;t[8]!==s.unnamedSession||t[9]!==i?.name?(S=i?.name?.trim()||s.unnamedSession,t[8]=s.unnamedSession,t[9]=i?.name,t[10]=S):S=t[10];let C;t[11]===S?C=t[12]:(C=(0,Q.jsx)(ae,{className:`min-w-0 flex-1 truncate text-base font-semibold tracking-tight text-fg`,children:S}),t[11]=S,t[12]=C);let w;t[13]!==x||t[14]!==C?(w=(0,Q.jsxs)(`div`,{className:`flex min-w-0 flex-1 items-center gap-3`,children:[x,C]}),t[13]=x,t[14]=C,t[15]=w):w=t[15];let E;t[16]===Symbol.for(`react.memo_cache_sentinel`)?(E=(0,Q.jsx)(J,{className:`size-5`,strokeWidth:1.75}),t[16]=E):E=t[16];let D;t[17]===s.close?D=t[18]:(D=(0,Q.jsx)(B,{asChild:!0,children:(0,Q.jsx)(T,{type:`button`,variant:`ghost`,className:`size-9 shrink-0 p-0`,"aria-label":s.close,children:E})}),t[17]=s.close,t[18]=D);let O;t[19]!==w||t[20]!==D?(O=(0,Q.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,D]}),t[19]=w,t[20]=D,t[21]=O):O=t[21];let k;t[22]!==s.detailLoading||t[23]!==s.detailMessages||t[24]!==r||t[25]!==i?(k=r?(0,Q.jsx)(`p`,{className:`text-sm text-fg-muted`,children:s.detailLoading}):i?(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsxs)(`dl`,{className:`mb-4 grid gap-2 text-xs text-fg-muted`,children:[(0,Q.jsxs)(`div`,{children:[(0,Q.jsx)(`dt`,{className:`text-fg-disabled`,children:`Key`}),(0,Q.jsx)(`dd`,{className:`mt-0.5 break-all font-mono text-fg`,children:i.key})]}),(0,Q.jsx)(`div`,{className:`flex flex-wrap gap-4`,children:(0,Q.jsxs)(`span`,{children:[i.messageCount,` msgs · `,i.estimatedTokens,` tok`]})})]}),(0,Q.jsx)(`h3`,{className:`mb-2 text-xs font-medium uppercase tracking-wide text-fg-subtle`,children:s.detailMessages}),(0,Q.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]=k):k=t[26];let A;t[27]===k?A=t[28]:(A=(0,Q.jsx)(`div`,{className:`min-h-0 flex-1 overflow-y-auto px-4 py-3`,children:k}),t[27]=k,t[28]=A);let M;t[29]!==s.detailExport||t[30]!==m?(M=(0,Q.jsx)(T,{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]!==l||t[36]!==d?(P=g?(0,Q.jsx)(T,{type:`button`,variant:`secondary`,className:`text-sm`,onClick:d,children:s.unarchive}):(0,Q.jsx)(T,{type:`button`,variant:`secondary`,className:`text-sm`,onClick:l,children:s.archive}),t[32]=g,t[33]=s.archive,t[34]=s.unarchive,t[35]=l,t[36]=d,t[37]=P):P=t[37];let F;t[38]!==_||t[39]!==s.pin||t[40]!==s.unpin||t[41]!==f||t[42]!==p?(F=_?(0,Q.jsx)(T,{type:`button`,variant:`secondary`,className:`text-sm`,onClick:p,children:s.unpin}):(0,Q.jsx)(T,{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]=F):F=t[43];let L;t[44]!==s.delete||t[45]!==h?(L=(0,Q.jsx)(T,{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 R;t[47]!==M||t[48]!==P||t[49]!==F||t[50]!==L?(R=(0,Q.jsx)(`div`,{className:`shrink-0 border-t border-edge px-4 py-3 dark:border-edge`,children:(0,Q.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[M,P,F,L]})}),t[47]=M,t[48]=P,t[49]=F,t[50]=L,t[51]=R):R=t[51];let z;t[52]!==O||t[53]!==A||t[54]!==R?(z=(0,Q.jsxs)(N,{children:[y,(0,Q.jsxs)(ne,{className:b,"aria-describedby":void 0,children:[O,A,R]})]}),t[52]=O,t[53]=A,t[54]=R,t[55]=z):z=t[55];let V;return t[56]!==n||t[57]!==v||t[58]!==z?(V=(0,Q.jsx)(te,{open:n,onOpenChange:v,children:z}),t[56]=n,t[57]=v,t[58]=z,t[59]=V):V=t[59],V}function ft(e){return(0,Q.jsxs)(`li`,{className:`rounded-lg border border-edge-subtle bg-surface-hover/50 p-2 dark:border-edge`,children:[(0,Q.jsx)(`div`,{className:`mb-1 text-[10px] font-medium uppercase text-fg-subtle`,children:e.role}),(0,Q.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,ke.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`?re:W})),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,Q.jsx)(be,{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,ke.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,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsxs)(`div`,{className:`mb-5`,children:[(0,Q.jsx)(`div`,{className:`text-sm font-semibold text-fg`,children:yt(n,r)}),(0,Q.jsx)(`p`,{className:`mt-1 text-xs text-fg-subtle`,children:bt(n,r)})]}),(0,Q.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,Q.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=l(p(e=>e.language)),t=e.sessions,n=f(e=>e.conversationId),r=!!n,{data:a,mutate:o}=w(r?[`gateway-chat-agents`,n]:null,xe,{revalidateOnFocus:!1}),s=a?.defaultId??`main`,d=a?.items??[],[m,E]=i(),D=vt(m.get(`tab`)),O=(0,Z.useCallback)(e=>{let t=new URLSearchParams(m);e===`sessions`?t.delete(`tab`):t.set(`tab`,e),E(t,{replace:!0})},[m,E]),[k,A]=(0,Z.useReducer)(ge,m,Ct),{searchInput:P,debouncedSearch:I,statusFilter:z,viewMode:B,channelFilter:V,sessions:H,loading:U,error:ie,hasMore:W,stats:ce,detailOpen:le,detailLoading:ue,detailSession:G,confirmOpen:de,confirmKey:fe}=k;(0,Z.useEffect)(()=>{let e=setTimeout(()=>{let e=P.trim();I!==e&&A({type:`patch`,patch:{debouncedSearch:e}})},300);return()=>clearTimeout(e)},[P,I]);let pe=m.toString(),K=(0,Z.useRef)(pe);if(K.current!==pe){K.current=pe;let e=m.get(`q`)??``,t=m.get(`status`),n=m.get(`view`),r=(m.get(`channel`)??``).trim(),i=ht.has(t)?t:`all`,a=gt.has(n)?n:`grid`,o=e.trim();A({type:`patch`,patch:{...P===e?{}:{searchInput:e},...I===o?{}:{debouncedSearch:o},...z===i?{}:{statusFilter:i},...B===a?{}:{viewMode:a},...V===r?{}:{channelFilter:r}}})}(0,Z.useEffect)(()=>{let e=new URLSearchParams(m),t=I.trim();t?e.set(`q`,t):e.delete(`q`),z===`all`?e.delete(`status`):e.set(`status`,z),B===`grid`?e.delete(`view`):e.set(`view`,B),V?e.set(`channel`,V):e.delete(`channel`),e.toString()!==m.toString()&&E(e,{replace:!0})},[I,m,E,z,B,V]),(0,Z.useEffect)(()=>{if(!r||D!==`sessions`)return;let e=!1;return(async()=>{A({type:`patch`,patch:{loading:!0,error:null}});try{let t=await S({limit:pt,offset:0,...I?{search:I}:{},...z===`all`?{}:{status:z},...V?{channel:V}:{}});if(e)return;A({type:`patch`,patch:{sessions:t.items,hasMore:t.hasMore}})}catch(n){e||A({type:`patch`,patch:{error:n instanceof Error?n.message:t.loadError}})}finally{e||A({type:`patch`,patch:{loading:!1}})}})(),()=>{e=!0}},[r,D,I,z,V,t.loadError]),(0,Z.useEffect)(()=>{!r||D!==`sessions`||y().then(e=>A({type:`patch`,patch:{stats:e}})).catch(()=>{})},[r,D]),(0,Z.useEffect)(()=>{if(!r||D!==`sessions`)return;let e=()=>void o();return window.addEventListener(`config-reload`,e),()=>window.removeEventListener(`config-reload`,e)},[r,D,o]),(0,Z.useEffect)(()=>{if(!r||D!==`sessions`)return;let e=e=>{let t=e.detail;!t?.key||t.name===void 0||A({type:`patch`,patch:{sessions:H.map(e=>e.key===t.key?{...e,name:t.name}:e),detailSession:G&&G.key===t.key?{...G,name:t.name}:G}})};return window.addEventListener(`session-updated`,e),()=>{window.removeEventListener(`session-updated`,e)}},[r,D,H,G]);let _e=(0,Z.useCallback)(async()=>{if(!(!r||U||!W)){A({type:`patch`,patch:{loading:!0,error:null}});try{let e=await S({limit:pt,offset:H.length,...I?{search:I}:{},...z===`all`?{}:{status:z},...V?{channel:V}:{}});A({type:`patch`,patch:{sessions:[...H,...e.items],hasMore:e.hasMore}})}catch(e){A({type:`patch`,patch:{error:e instanceof Error?e.message:t.loadError}})}finally{A({type:`patch`,patch:{loading:!1}})}}},[r,U,W,H.length,I,z,V,t.loadError]),J=(0,Z.useCallback)((e,t)=>{A({type:`patch`,patch:{sessions:H.map(n=>n.key===e?{...n,status:t}:n),detailSession:G&&G.key===e?{...G,status:t}:G}})},[H,G]),ye=(0,Z.useCallback)(async e=>{A({type:`patch`,patch:{detailOpen:!0,detailLoading:!0,detailSession:null}});try{A({type:`patch`,patch:{detailSession:await h(e)}})}catch{A({type:`patch`,patch:{detailOpen:!1}})}finally{A({type:`patch`,patch:{detailLoading:!1}})}},[]),be=e=>{ye(e)},Y=async(e,t)=>{if(t===`continue`){window.dispatchEvent(new CustomEvent(`navigate-to-chat`,{detail:{conversationId:e},bubbles:!0}));return}if(t===`delete`){A({type:`patch`,patch:{confirmKey:e,confirmOpen:!0}});return}try{switch(t){case`archive`:await C(e),J(e,`archived`);break;case`unarchive`:await _(e),J(e,`active`);break;case`pin`:await g(e),J(e,`pinned`);break;case`unpin`:await b(e),J(e,`active`);break;case`export`:{let t=await x(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}y().then(e=>A({type:`patch`,patch:{stats:e}})).catch(()=>{})}catch{}},Te=async e=>{try{await v(e),A({type:`patch`,patch:{sessions:H.filter(t=>t.key!==e),detailSession:G?.key===e?null:G,...G?.key===e?{detailOpen:!1}:{}}}),y().then(e=>A({type:`patch`,patch:{stats:e}})).catch(()=>{})}catch{}},X={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},Ee={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},De=[{key:`all`,label:t.filterAll,icon:re},{key:`active`,label:t.filterActive,icon:F},{key:`pinned`,label:t.filterPinned,icon:ve},{key:`archived`,label:t.filterArchived,icon:se}],Oe=(()=>{let e=Object.entries(ce?.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,Q.jsxs)(`div`,{className:`flex min-h-0 min-w-0 flex-1 flex-col overflow-x-hidden bg-surface-panel`,children:[(0,Q.jsxs)(Ce,{gap:`gap-6`,children:[(0,Q.jsx)(we,{title:t.title}),(0,Q.jsx)(xt,{s:t,activeTab:D,onChange:O}),(0,Q.jsx)(St,{s:t,id:`settings`,activeTab:D,plain:!0,children:(0,Q.jsxs)(`div`,{className:`space-y-4`,children:[(0,Q.jsx)(nt,{hasToken:r}),(0,Q.jsx)(lt,{hasToken:r})]})}),(0,Q.jsxs)(St,{s:t,id:`sessions`,activeTab:D,plain:!0,children:[(0,Q.jsxs)(`div`,{className:`flex flex-col gap-3 lg:flex-row lg:items-center lg:justify-between`,children:[(0,Q.jsx)(R,{className:`flex flex-wrap gap-2`,role:`group`,"aria-label":t.tabsSessions,indicatorClassName:`rounded-xl bg-accent-soft`,children:De.map(({key:e,label:t,icon:n})=>(0,Q.jsxs)(`button`,{type:`button`,"aria-pressed":z===e,onClick:()=>A({type:`patch`,patch:{statusFilter:e}}),className:u(`inline-flex items-center gap-1.5 rounded-xl px-3 py-2 text-sm font-medium`,q.transition,q.focusRingPanel,z===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,Q.jsx)(n,{className:`size-4`,strokeWidth:1.75,"aria-hidden":!0}),t]},e))}),(0,Q.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,Q.jsx)(me,{className:`size-4 shrink-0 text-fg-disabled`,strokeWidth:1.75,"aria-hidden":!0}),(0,Q.jsx)(`input`,{type:`search`,value:P,onChange:e=>A({type:`patch`,patch:{searchInput:e.target.value}}),placeholder:t.searchPlaceholder,"aria-label":t.searchPlaceholder,"data-debounced-query":I||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,Q.jsxs)(R,{className:`flex flex-wrap items-center gap-2`,role:`group`,"aria-label":t.filterChannelLabel,indicatorClassName:`rounded-xl bg-accent-soft`,children:[(0,Q.jsx)(`span`,{className:`text-xs font-medium text-fg-subtle`,children:t.filterChannelLabel}),(0,Q.jsx)(`button`,{type:`button`,"aria-pressed":!V,onClick:()=>A({type:`patch`,patch:{channelFilter:``}}),className:u(`touch-target inline-flex items-center rounded-xl px-3 py-2 text-sm font-medium`,q.transition,q.focusRingPanel,V?`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}),Oe.map(e=>(0,Q.jsxs)(`button`,{type:`button`,"aria-pressed":V===e,onClick:()=>A({type:`patch`,patch:{channelFilter:e}}),className:u(`touch-target inline-flex items-center rounded-xl px-3 py-2 text-sm font-medium`,q.transition,q.focusRingPanel,V===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,ce?.byChannel?.[e]==null?null:(0,Q.jsx)(`span`,{className:`ml-2 rounded-full bg-surface-hover px-2 py-0.5 text-[11px] text-fg-subtle`,children:ce.byChannel[e]})]},e))]}),ce?(0,Q.jsx)(`div`,{className:`grid grid-cols-2 gap-3 sm:grid-cols-4`,children:[[ce.totalSessions,t.totalSessions],[ce.activeSessions,t.activeSessions],[ce.pinnedSessions,t.pinnedSessions],[ce.archivedSessions,t.archivedSessions]].map(([e,t])=>(0,Q.jsxs)(`div`,{className:`rounded-xl bg-surface-base p-3 dark:bg-surface-hover/30`,children:[(0,Q.jsx)(`div`,{className:`text-lg font-semibold tabular-nums text-fg`,children:e}),(0,Q.jsx)(`div`,{className:`text-xs text-fg-muted`,children:t})]},t))}):null,ie?(0,Q.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:ie}):null,(0,Q.jsxs)(`div`,{className:`flex items-center justify-between gap-2`,children:[(0,Q.jsx)(`p`,{className:`text-xs text-fg-muted`,children:mt(t.sessionCount,{count:H.length})}),(0,Q.jsxs)(R,{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,Q.jsx)(T,{type:`button`,variant:`segmented`,title:t.gridView,"aria-pressed":B===`grid`,onClick:()=>A({type:`patch`,patch:{viewMode:`grid`}}),className:u(oe,`size-7 p-0`,B===`grid`&&`bg-surface-panel shadow-sm dark:bg-surface-panel dark:shadow-sm dark:ring-1 dark:ring-edge-strong/40`,B===`grid`&&`text-accent-fg`),children:(0,Q.jsx)(M,{className:`size-3.5`,strokeWidth:1.5})}),(0,Q.jsx)(T,{type:`button`,variant:`segmented`,title:t.listView,"aria-pressed":B===`list`,onClick:()=>A({type:`patch`,patch:{viewMode:`list`}}),className:u(oe,`size-9 p-0`,B===`list`&&`bg-surface-panel shadow-sm dark:bg-surface-panel dark:shadow-sm dark:ring-1 dark:ring-edge-strong/40`,B===`list`&&`text-accent-fg`),children:(0,Q.jsx)(he,{className:`size-3.5`,strokeWidth:1.5})})]})]}),U&&H.length===0?(0,Q.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,Q.jsx)(`div`,{className:`h-40 animate-pulse rounded-xl bg-surface-hover/60 dark:bg-surface-hover/40`},t))}):H.length===0?(0,Q.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,Q.jsx)(c,{className:`mb-3 size-12 text-fg-disabled`,strokeWidth:1.25,"aria-hidden":!0}),(0,Q.jsx)(`p`,{className:`text-base font-semibold text-fg`,children:t.noSessions}),(0,Q.jsx)(`p`,{className:`mt-1 max-w-sm text-sm text-fg-muted`,children:t.noSessionsDescription}),(0,Q.jsx)(T,{variant:`primary`,className:`mt-6`,onClick:()=>{window.dispatchEvent(new CustomEvent(`navigate-to-chat`,{detail:{conversationId:``},bubbles:!0}))},children:t.startNewChat})]}):(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(`div`,{className:u(`grid min-w-0 gap-3`,B===`grid`?`sm:grid-cols-2 lg:grid-cols-3`:`grid-cols-1`),"data-debounced-query":I||void 0,children:H.map(e=>{let t=Re(e,s);return(0,Q.jsx)(Ne,{session:e,variant:B,labels:X,sessionAgentId:t,sessionAgentAvatar:ze(t,d),onOpen:()=>be(e.key),onAction:t=>void Y(e.key,t)},e.key)})}),W?(0,Q.jsx)(`div`,{className:`flex justify-center pt-2`,children:(0,Q.jsx)(T,{type:`button`,variant:`secondary`,disabled:U,onClick:()=>void _e(),children:t.loadMore})}):null]})]})]}),(0,Q.jsx)(dt,{open:le,loading:ue,session:G,sessionAgentId:G?Re(G,s):void 0,sessionAgentAvatar:G?ze(Re(G,s),d):void 0,labels:Ee,onClose:()=>{A({type:`patch`,patch:{detailOpen:!1,detailSession:null}})},onArchive:()=>G&&void Y(G.key,`archive`),onUnarchive:()=>G&&void Y(G.key,`unarchive`),onPin:()=>G&&void Y(G.key,`pin`),onUnpin:()=>G&&void Y(G.key,`unpin`),onExport:()=>G&&void Y(G.key,`export`),onDelete:()=>G&&A({type:`patch`,patch:{confirmKey:G.key,confirmOpen:!0}})}),(0,Q.jsx)(te,{open:de,onOpenChange:e=>A({type:`patch`,patch:{confirmOpen:e}}),children:(0,Q.jsxs)(N,{children:[(0,Q.jsx)(Se,{className:u(`xopc-dialog-overlay fixed inset-0 bg-scrim`,ee)}),(0,Q.jsxs)(ne,{className:u(`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`,j),children:[(0,Q.jsx)(ae,{className:`text-base font-semibold text-fg`,children:t.deleteSessionTitle}),(0,Q.jsx)(`p`,{className:`mt-2 text-sm text-fg-muted`,children:fe?mt(t.deleteSessionMessage,{name:H.find(e=>e.key===fe)?.name?.trim()||e.chat.newSession}):``}),(0,Q.jsxs)(`div`,{className:`mt-4 flex justify-end gap-2`,children:[(0,Q.jsx)(T,{type:`button`,variant:`secondary`,onClick:()=>A({type:`patch`,patch:{confirmOpen:!1}}),children:t.cancel}),(0,Q.jsx)(T,{type:`button`,variant:`primary`,className:`bg-red-600 hover:bg-red-700`,onClick:()=>{fe&&Te(fe),A({type:`patch`,patch:{confirmOpen:!1,confirmKey:null}})},children:t.delete})]})]})]})})]}):(0,Q.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};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{Pn as e}from"./index-ygkHNYyo.js";function t(t){let{children:n,fallback:r}=t,i=r===void 0?null:r;return e()?n:i}export{t};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{n as e,t}from"./vendor-react-BOUWij0V.js";import{t as n}from"./cn-0WouolD0.js";import{Yl as r,ks as i}from"./index-
|
|
1
|
+
import{n as e,t}from"./vendor-react-BOUWij0V.js";import{t as n}from"./cn-0WouolD0.js";import{Yl as r,ks as i}from"./index-ygkHNYyo.js";var a=e();function o(){return`rounded-xl bg-surface-hover/20 px-4 py-5 sm:px-5`}var s=t();function c(e){let t=(0,a.c)(7),{children:r,className:i,id:c,onBlurCapture:l}=e,u;t[0]===i?u=t[1]:(u=n(o(),i),t[0]=i,t[1]=u);let d;return t[2]!==r||t[3]!==c||t[4]!==l||t[5]!==u?(d=(0,s.jsx)(`section`,{id:c,className:u,onBlurCapture:l,children:r}),t[2]=r,t[3]=c,t[4]=l,t[5]=u,t[6]=d):d=t[6],d}var l=`mt-0.5 flex size-7 shrink-0 items-center justify-center text-fg-muted transition-colors`;function u(e){let t=(0,a.c)(27),{icon:o,title:c,subtitle:u,trailing:d,titleAccessory:f,className:p,iconInteractive:m,iconLeading:h}=e,g;t[0]===o?g=t[1]:(g=(0,s.jsx)(o,{className:`size-4`,strokeWidth:1.75,"aria-hidden":!0}),t[0]=o,t[1]=g);let _=h??g,v,y;if(t[2]!==p||t[3]!==m||t[4]!==h||t[5]!==_){let e=h?n(`flex size-9 shrink-0 items-center justify-center overflow-hidden rounded-lg bg-surface-panel p-0 ring-1 ring-inset ring-edge-subtle transition-[box-shadow] hover:ring-accent/40 dark:ring-edge-subtle`,`focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent focus-visible:ring-offset-2 focus-visible:ring-offset-surface-base`,i.press):n(l,`hover:text-fg`,`focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent focus-visible:ring-offset-2 focus-visible:ring-offset-surface-base`,i.press),a=!!(m&&h);t[8]===p?v=t[9]:(v=n(`mb-4 flex items-start gap-2.5`,p),t[8]=p,t[9]=v),y=m?a?(0,s.jsxs)(`span`,{className:`relative shrink-0`,children:[(0,s.jsx)(`button`,{type:`button`,id:m.id,onClick:m.onClick,"aria-label":m.ariaLabel,className:n(`touch-target`,e),children:_}),(0,s.jsx)(`span`,{className:`pointer-events-none absolute -bottom-0.5 -right-0.5 flex size-4 items-center justify-center rounded-md border border-edge bg-surface-panel text-fg-muted shadow-sm dark:border-edge dark:bg-surface-base`,"aria-hidden":!0,children:(0,s.jsx)(r,{className:`size-2.5`,strokeWidth:2.25})})]}):(0,s.jsx)(`button`,{type:`button`,id:m.id,onClick:m.onClick,"aria-label":m.ariaLabel,className:n(`touch-target`,e),children:_}):(0,s.jsx)(`div`,{className:n(h?`flex size-9 shrink-0 items-center justify-center overflow-hidden rounded-lg bg-surface-panel ring-1 ring-inset ring-edge-subtle dark:ring-edge-subtle`:l),"aria-hidden":!h,children:_}),t[2]=p,t[3]=m,t[4]=h,t[5]=_,t[6]=v,t[7]=y}else v=t[6],y=t[7];let b;t[10]===c?b=t[11]:(b=(0,s.jsx)(`h2`,{className:`text-sm font-semibold text-fg`,children:c}),t[10]=c,t[11]=b);let x;t[12]!==b||t[13]!==f?(x=(0,s.jsxs)(`div`,{className:`flex min-w-0 flex-wrap items-center gap-1.5`,children:[b,f]}),t[12]=b,t[13]=f,t[14]=x):x=t[14];let S;t[15]===u?S=t[16]:(S=u?(0,s.jsx)(`p`,{className:`mt-0.5 text-xs text-fg-muted`,children:u}):null,t[15]=u,t[16]=S);let C;t[17]!==x||t[18]!==S?(C=(0,s.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[x,S]}),t[17]=x,t[18]=S,t[19]=C):C=t[19];let w;t[20]===d?w=t[21]:(w=d?(0,s.jsx)(`div`,{className:`shrink-0`,children:d}):null,t[20]=d,t[21]=w);let T;return t[22]!==v||t[23]!==y||t[24]!==C||t[25]!==w?(T=(0,s.jsxs)(`div`,{className:v,children:[y,C,w]}),t[22]=v,t[23]=y,t[24]=C,t[25]=w,t[26]=T):T=t[26],T}export{u as n,o as r,c as t};
|
package/dist/gateway/static/root/assets/{settings-page-29Ix0jSQ.js → settings-page-DP2w3ejC.js}
RENAMED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{a as t,n,t as r}from"./vendor-react-BOUWij0V.js";import{f as i,r as a}from"./chunk-KS7C4IRE-BvcCCgTW.js";import{t as o}from"./messages-RzwPiQNL.js";import{n as s}from"./locale-store-JogcXC4J.js";import{_o as c,ao as l,co as u,do as d,fo as f,go as p,ho as m,lo as h,mo as g,oo as _,po as v,so as y,uo as b}from"./index-
|
|
1
|
+
import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{a as t,n,t as r}from"./vendor-react-BOUWij0V.js";import{f as i,r as a}from"./chunk-KS7C4IRE-BvcCCgTW.js";import{t as o}from"./messages-RzwPiQNL.js";import{n as s}from"./locale-store-JogcXC4J.js";import{_o as c,ao as l,co as u,do as d,fo as f,go as p,ho as m,lo as h,mo as g,oo as _,po as v,so as y,uo as b}from"./index-ygkHNYyo.js";var x=n(),S=e(t(),1),C=r(),w=[`overview`,`appearance`,`keyboard-shortcuts`,`personal`,`system`,`desktop-pet`,`desktop-app`,`agent-defaults`,`gateway`,`runtimes`,`devices`,`remote-access`,`shares`],T=(0,S.lazy)(()=>m().then(e=>({default:e.SetupStatusPanel}))),E=(0,S.lazy)(()=>y().then(e=>({default:e.AppearanceSettingsPanel}))),D=(0,S.lazy)(()=>d().then(e=>({default:e.KeyboardShortcutsSettingsPanel}))),O=(0,S.lazy)(()=>f().then(e=>({default:e.PersonalSettingsPanel}))),k=(0,S.lazy)(()=>c().then(e=>({default:e.SystemSettingsPanel}))),A=(0,S.lazy)(()=>u().then(e=>({default:e.DesktopPetSettings}))),j=(0,S.lazy)(()=>_().then(e=>({default:e.AppManagementSettingsPanel}))),M=(0,S.lazy)(()=>b().then(e=>({default:e.GatewaySettingsPanel}))),N=(0,S.lazy)(()=>g().then(e=>({default:e.RuntimeToolsSettingsPanel}))),P=(0,S.lazy)(()=>v().then(e=>({default:e.RemoteAccessHub}))),F=(0,S.lazy)(()=>p().then(e=>({default:e.SharesSettingsPanel}))),I=(0,S.lazy)(()=>l().then(e=>({default:e.AgentDefaultsSettingsPanel}))),L=(0,S.lazy)(()=>h().then(e=>({default:e.EndpointToolsManagementSettings})));function R(){let e=(0,x.c)(1),t;return e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,C.jsxs)(`div`,{className:`w-full flex-1 px-3 py-8 sm:px-5 xl:px-6`,"aria-busy":!0,children:[(0,C.jsx)(`div`,{className:`h-8 w-48 max-w-full animate-pulse rounded-md bg-surface-hover`}),(0,C.jsx)(`div`,{className:`mt-6 h-36 animate-pulse rounded-xl bg-surface-hover`}),(0,C.jsx)(`div`,{className:`mt-4 h-24 animate-pulse rounded-xl bg-surface-hover`})]}),e[0]=t):t=e[0],t}function z(e){return(0,C.jsx)(S.Suspense,{fallback:(0,C.jsx)(R,{}),children:(0,C.jsx)(e,{})})}function B(){let e=(0,x.c)(28),{section:t}=i(),n=s(V),r,c,l,u,d;if(e[0]!==n||e[1]!==t){d=Symbol.for(`react.early_return_sentinel`);bb0:{let i=o(n);if(!t||!w.includes(t)){let t;e[7]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,C.jsx)(a,{to:`/settings/overview`,replace:!0}),e[7]=t):t=e[7],d=t;break bb0}let s=t;if(s===`overview`){let t;e[8]===Symbol.for(`react.memo_cache_sentinel`)?(t=z(T),e[8]=t):t=e[8],d=t;break bb0}let f=i.settingsSections[s];if(s===`appearance`){let t;e[9]===Symbol.for(`react.memo_cache_sentinel`)?(t=z(E),e[9]=t):t=e[9],d=t;break bb0}if(s===`keyboard-shortcuts`){let t;e[10]===Symbol.for(`react.memo_cache_sentinel`)?(t=z(D),e[10]=t):t=e[10],d=t;break bb0}if(s===`personal`){let t;e[11]===Symbol.for(`react.memo_cache_sentinel`)?(t=z(O),e[11]=t):t=e[11],d=t;break bb0}if(s===`system`){let t;e[12]===Symbol.for(`react.memo_cache_sentinel`)?(t=z(k),e[12]=t):t=e[12],d=t;break bb0}if(s===`desktop-pet`){let t;e[13]===Symbol.for(`react.memo_cache_sentinel`)?(t=z(A),e[13]=t):t=e[13],d=t;break bb0}if(s===`desktop-app`){let t;e[14]===Symbol.for(`react.memo_cache_sentinel`)?(t=z(j),e[14]=t):t=e[14],d=t;break bb0}if(s===`agent-defaults`){let t;e[15]===Symbol.for(`react.memo_cache_sentinel`)?(t=z(I),e[15]=t):t=e[15],d=t;break bb0}if(s===`gateway`){let t;e[16]===Symbol.for(`react.memo_cache_sentinel`)?(t=z(M),e[16]=t):t=e[16],d=t;break bb0}if(s===`runtimes`){let t;e[17]===Symbol.for(`react.memo_cache_sentinel`)?(t=z(N),e[17]=t):t=e[17],d=t;break bb0}if(s===`devices`){let t;e[18]===Symbol.for(`react.memo_cache_sentinel`)?(t=z(L),e[18]=t):t=e[18],d=t;break bb0}if(s===`remote-access`){let t;e[19]===Symbol.for(`react.memo_cache_sentinel`)?(t=z(P),e[19]=t):t=e[19],d=t;break bb0}if(s===`shares`){let t;e[20]===Symbol.for(`react.memo_cache_sentinel`)?(t=z(F),e[20]=t):t=e[20],d=t;break bb0}l=`flex w-full flex-col gap-3 px-3 py-8 sm:px-5 xl:px-6`,u=(0,C.jsx)(`h1`,{className:`text-lg font-semibold text-fg`,children:f}),r=`text-sm text-fg-muted`,c=i.settingsPage.comingSoon.replace(`{{title}}`,f)}e[0]=n,e[1]=t,e[2]=r,e[3]=c,e[4]=l,e[5]=u,e[6]=d}else r=e[2],c=e[3],l=e[4],u=e[5],d=e[6];if(d!==Symbol.for(`react.early_return_sentinel`))return d;let f;e[21]!==r||e[22]!==c?(f=(0,C.jsx)(`p`,{className:r,children:c}),e[21]=r,e[22]=c,e[23]=f):f=e[23];let p;return e[24]!==l||e[25]!==u||e[26]!==f?(p=(0,C.jsxs)(`div`,{className:l,children:[u,f]}),e[24]=l,e[25]=u,e[26]=f,e[27]=p):p=e[27],p}function V(e){return e.language}export{B as SettingsPage};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{a as t,n,t as r}from"./vendor-react-BOUWij0V.js";import{t as i}from"./chunk-KS7C4IRE-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-RzwPiQNL.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-JogcXC4J.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-DF_HV6NP.js";import{n as _}from"./gateway-realtime-store-CoIgC1Al.js";import{n as v,t as y}from"./registry-api-BGqSwITi.js";import{n as b}from"./electron-env-Dit0bHgy.js";import{Dd as x,Do as S,Ed as C,Fl as w,It as T,Lu as E,Pd as D,bn as O,ci as k,fl as A,ks as j,nf as M,rl as N}from"./index-D1oivYvN.js";import{n as P,t as F}from"./settings-page-header-CYpuTXUW.js";import"./settings-page-layout-B20AfmFG.js";import{n as I,t as L}from"./settings-form-section-BNYQjZU4.js";import{t as R}from"./settings-advanced-gate-VqBu7gHu.js";import{r as z,t as ee}from"./runtime-tools-api-CSm5SpnR.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`),ee),[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 z({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`&&S(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:S,error:C,isLoading:w,mutate:E}=p(t?`setup-checklist-skills`:null,he,x),D;e[3]===Symbol.for(`react.memo_cache_sentinel`)?(D={revalidateOnFocus:!1},e[3]=D):D=e[3];let{data:O,error:k,isLoading:A,mutate:j}=p(t?`setup-checklist-provider-meta`:null,T,D),M;e[4]===t?M=e[5]:(M=t?se():null,e[4]=t,e[5]=M);let N;e[6]===Symbol.for(`react.memo_cache_sentinel`)?(N={revalidateOnFocus:!1},e[6]=N):N=e[6];let{data:P,error:F,isLoading:I,mutate:L}=p(M,ce,N),R;e[7]===t?R=e[8]:(R=t?le():null,e[7]=t,e[8]=R);let z;e[9]===Symbol.for(`react.memo_cache_sentinel`)?(z={revalidateOnFocus:!1},e[9]=z):z=e[9];let{data:ee,isLoading:V,mutate:H}=p(R,ue,z);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&&!w&&!A&&!I&&!V&&!te,ne=!!(f||C||k||F),re;bb0:{if(!t||!Z){re=null;break bb0}let n=S?.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]!==P||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]!==ee||e[51]!==i.setupStatus.requiredCompleteMessage||e[52]!==O||e[53]!==c||e[54]!==n||e[55]!==t){let s=O?.filter(pe).length??0,u=O?.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:P,logsHealth:ee,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]=P,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]=ee,e[51]=i.setupStatus.requiredCompleteMessage,e[52]=O,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]!==L||e[86]!==H||e[87]!==j||e[88]!==E?(Q=async()=>{await Promise.all([h(),E(),j(),L(),H(),Y()])},e[83]=Y,e[84]=h,e[85]=L,e[86]=H,e[87]=j,e[88]=E,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 k()}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`?N:e===`fail`?x:E}function xe(e,t){return e===`blocked`?{icon:x,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:N,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:C,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)(D,{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)(D,{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 T;t[16]!==y||t[17]!==b||t[18]!==C?(T=(0,H.jsxs)(`div`,{className:y,children:[b,C]}),t[16]=y,t[17]=b,t[18]=C,t[19]=T):T=t[19];let E;t[20]===Symbol.for(`react.memo_cache_sentinel`)?(E=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`,j.press),t[20]=E):E=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)(w,{className:`size-4`,"aria-hidden":!0}),t[21]=u,t[22]=k);let A=u?h.health.runDoctorRunning:h.health.runDoctor,M;t[23]!==u||t[24]!==a||t[25]!==O||t[26]!==k||t[27]!==A?(M=(0,H.jsxs)(`button`,{type:`button`,className:E,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]=M):M=t[28];let N;t[29]!==m||t[30]!==M?(N=(0,H.jsxs)(`div`,{className:`flex shrink-0 flex-wrap gap-2`,children:[m,M]}),t[29]=m,t[30]=M,t[31]=N):N=t[31];let P;t[32]!==N||t[33]!==x||t[34]!==T?(P=(0,H.jsxs)(`div`,{className:x,children:[T,N]}),t[32]=N,t[33]=x,t[34]=T,t[35]=P):P=t[35];let F;t[36]!==f||t[37]!==u||t[38]!==h.health.doctorCompleteMessage||t[39]!==h.health.doctorFailedMessage||t[40]!==h.health.doctorRunningMessage?(F=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]=F):F=t[41];let I;return t[42]!==P||t[43]!==F||t[44]!==S?(I=(0,H.jsxs)(`section`,{className:S,children:[P,F]}),t[42]=P,t[43]=F,t[44]=S,t[45]=I):I=t[45],I}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)(D,{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)(D,{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)(F,{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)(O,{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)(L,{id:`next-steps`,children:[(0,H.jsx)(I,{icon:r.issues.length?N:M,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)(R,{children:(0,H.jsxs)(L,{children:[(0,H.jsx)(I,{icon:A,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
|
+
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-RzwPiQNL.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-JogcXC4J.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-DF_HV6NP.js";import{n as _}from"./gateway-realtime-store-CoIgC1Al.js";import{n as v,t as y}from"./registry-api-BGqSwITi.js";import{n as b}from"./electron-env-Dit0bHgy.js";import{Cd as x,Do as S,Fl as C,It as w,Lu as T,Qd as E,bn as D,ci as O,fl as k,jd as A,ks as j,rl as M,wd as N}from"./index-ygkHNYyo.js";import{n as P,t as F}from"./settings-page-header-CYpuTXUW.js";import"./settings-page-layout-B20AfmFG.js";import{n as I,t as L}from"./settings-form-section-Ce8vVv-9.js";import{t as R}from"./settings-advanced-gate-QTVDCGJG.js";import{r as z,t as ee}from"./runtime-tools-api-CSm5SpnR.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`),ee),[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 z({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`&&S(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:S,error:C,isLoading:T,mutate:E}=p(t?`setup-checklist-skills`:null,he,x),D;e[3]===Symbol.for(`react.memo_cache_sentinel`)?(D={revalidateOnFocus:!1},e[3]=D):D=e[3];let{data:O,error:k,isLoading:A,mutate:j}=p(t?`setup-checklist-provider-meta`:null,w,D),M;e[4]===t?M=e[5]:(M=t?se():null,e[4]=t,e[5]=M);let N;e[6]===Symbol.for(`react.memo_cache_sentinel`)?(N={revalidateOnFocus:!1},e[6]=N):N=e[6];let{data:P,error:F,isLoading:I,mutate:L}=p(M,ce,N),R;e[7]===t?R=e[8]:(R=t?le():null,e[7]=t,e[8]=R);let z;e[9]===Symbol.for(`react.memo_cache_sentinel`)?(z={revalidateOnFocus:!1},e[9]=z):z=e[9];let{data:ee,isLoading:V,mutate:H}=p(R,ue,z);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&&!T&&!A&&!I&&!V&&!te,ne=!!(f||C||k||F),re;bb0:{if(!t||!Z){re=null;break bb0}let n=S?.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]!==P||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]!==ee||e[51]!==i.setupStatus.requiredCompleteMessage||e[52]!==O||e[53]!==c||e[54]!==n||e[55]!==t){let s=O?.filter(pe).length??0,u=O?.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:P,logsHealth:ee,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]=P,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]=ee,e[51]=i.setupStatus.requiredCompleteMessage,e[52]=O,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]!==L||e[86]!==H||e[87]!==j||e[88]!==E?(Q=async()=>{await Promise.all([h(),E(),j(),L(),H(),Y()])},e[83]=Y,e[84]=h,e[85]=L,e[86]=H,e[87]=j,e[88]=E,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`?M:e===`fail`?N:T}function xe(e,t){return e===`blocked`?{icon:N,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:M,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:x,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)(A,{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)(A,{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 w;t[12]!==g||t[13]!==_||t[14]!==v?(w=(0,H.jsxs)(`div`,{className:g,children:[_,v]}),t[12]=g,t[13]=_,t[14]=v,t[15]=w):w=t[15];let T;t[16]!==y||t[17]!==b||t[18]!==w?(T=(0,H.jsxs)(`div`,{className:y,children:[b,w]}),t[16]=y,t[17]=b,t[18]=w,t[19]=T):T=t[19];let E;t[20]===Symbol.for(`react.memo_cache_sentinel`)?(E=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`,j.press),t[20]=E):E=t[20];let D=!l||u,O;t[21]===u?O=t[22]:(O=u?(0,H.jsx)(o,{className:`size-4 animate-spin`,"aria-hidden":!0}):(0,H.jsx)(C,{className:`size-4`,"aria-hidden":!0}),t[21]=u,t[22]=O);let k=u?h.health.runDoctorRunning:h.health.runDoctor,M;t[23]!==u||t[24]!==a||t[25]!==D||t[26]!==O||t[27]!==k?(M=(0,H.jsxs)(`button`,{type:`button`,className:E,onClick:a,disabled:D,"aria-busy":u,children:[O,k]}),t[23]=u,t[24]=a,t[25]=D,t[26]=O,t[27]=k,t[28]=M):M=t[28];let N;t[29]!==m||t[30]!==M?(N=(0,H.jsxs)(`div`,{className:`flex shrink-0 flex-wrap gap-2`,children:[m,M]}),t[29]=m,t[30]=M,t[31]=N):N=t[31];let P;t[32]!==N||t[33]!==x||t[34]!==T?(P=(0,H.jsxs)(`div`,{className:x,children:[T,N]}),t[32]=N,t[33]=x,t[34]=T,t[35]=P):P=t[35];let F;t[36]!==f||t[37]!==u||t[38]!==h.health.doctorCompleteMessage||t[39]!==h.health.doctorFailedMessage||t[40]!==h.health.doctorRunningMessage?(F=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]=F):F=t[41];let I;return t[42]!==P||t[43]!==F||t[44]!==S?(I=(0,H.jsxs)(`section`,{className:S,children:[P,F]}),t[42]=P,t[43]=F,t[44]=S,t[45]=I):I=t[45],I}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)(A,{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)(A,{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)(F,{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)(L,{id:`next-steps`,children:[(0,H.jsx)(I,{icon:r.issues.length?M:E,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)(R,{children:(0,H.jsxs)(L,{children:[(0,H.jsx)(I,{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};
|