diff --git a/console-ui/.gitignore b/console-ui/.gitignore index c2658d7..f0a232b 100644 --- a/console-ui/.gitignore +++ b/console-ui/.gitignore @@ -1 +1,4 @@ node_modules/ +dist/ +test-results/ +playwright-report/ diff --git a/console-ui/e2e/shortcuts.spec.js b/console-ui/e2e/shortcuts.spec.js new file mode 100644 index 0000000..5c36f6f --- /dev/null +++ b/console-ui/e2e/shortcuts.spec.js @@ -0,0 +1,77 @@ +import { expect, test } from '@playwright/test' + +const device = { + deviceName: 'e2e-node', hostname: 'e2e-node', platform: 'linux', cpuModel: 'fixture', uptimeHuman: '1h', agentVersion: 'test', +} + +async function launchConsole(page) { + await page.addInitScript(() => localStorage.setItem('edge_token', 'e2e-token')) + await page.route('**/api/v1/**', async route => { + const url = new URL(route.request().url()) + let body = [] + if (url.pathname.endsWith('/device')) body = device + if (url.pathname.endsWith('/metrics')) body = { + cpuUsedPercent: 12, + memoryUsed: 2 * 1024 ** 3, + memoryTotal: 8 * 1024 ** 3, + memoryUsedPercent: 25, + gpuData: [], + diskData: [], + } + if (url.pathname.endsWith('/metrics/history')) body = {} + await route.fulfill({ status: 200, contentType: 'application/json', body: JSON.stringify(body) }) + }) + await page.goto('/') +} + +test('opens keyboard help from shortcut and status bar', async ({ page }) => { + await launchConsole(page) + await page.keyboard.press('Control+/') + await expect(page.getByRole('dialog', { name: '键盘快捷键' })).toBeVisible() + await page.keyboard.press('Escape') + await expect(page.getByRole('dialog', { name: '键盘快捷键' })).toBeHidden() + await page.getByRole('button', { name: '打开键盘快捷键帮助' }).click() + await expect(page.getByText('跨域 iframe')).toBeVisible() +}) + +test('window shortcuts operate current apps and ignore input', async ({ page }) => { + await launchConsole(page) + await page.getByText('仪表盘', { exact: true }).dblclick() + await expect(page.getByText('仪表盘 · 总览', { exact: true })).toBeVisible() + + await page.keyboard.press('Control+Alt+m') + await expect(page.getByText('仪表盘 · 总览', { exact: true })).toBeHidden() + await page.keyboard.press('Alt+1') + await expect(page.getByText('仪表盘 · 总览', { exact: true })).toBeVisible() + await page.keyboard.press('Control+Alt+f') + await page.keyboard.press('Control+Alt+d') + await expect(page.getByText('仪表盘 · 总览', { exact: true })).toBeHidden() + await page.keyboard.press('Alt+1') + await page.keyboard.press('Control+Alt+w') + await expect(page.getByText('仪表盘 · 总览', { exact: true })).toBeHidden() + + await page.getByText('操作日志', { exact: true }).dblclick() + const input = page.getByPlaceholder('用户名(模糊)') + await input.focus() + await page.keyboard.press('Control+Alt+w') + await expect(input).toBeVisible() +}) + +test('ordinary app content keeps shortcuts active while terminal scope suppresses them', async ({ page }) => { + await launchConsole(page) + await page.getByText('文件', { exact: true }).dblclick() + const ordinaryApp = page.getByText('工作区', { exact: true }).first() + await ordinaryApp.click() + await page.keyboard.press('Control+Alt+m') + await expect(ordinaryApp).toBeHidden() + await page.evaluate(() => { + const scope = document.createElement('div') + scope.dataset.shortcutScope = 'terminal' + scope.tabIndex = 0 + scope.textContent = 'terminal shortcut scope fixture' + document.body.append(scope) + scope.focus() + }) + await page.keyboard.press('Alt+1') + await expect(ordinaryApp).toBeHidden() +}) diff --git a/console-ui/eslint.config.js b/console-ui/eslint.config.js index ea36dd3..01502a7 100644 --- a/console-ui/eslint.config.js +++ b/console-ui/eslint.config.js @@ -5,7 +5,7 @@ import reactRefresh from 'eslint-plugin-react-refresh' import { defineConfig, globalIgnores } from 'eslint/config' export default defineConfig([ - globalIgnores(['dist']), + globalIgnores(['dist', 'public/vendor']), { files: ['**/*.{js,jsx}'], extends: [ @@ -18,4 +18,14 @@ export default defineConfig([ parserOptions: { ecmaFeatures: { jsx: true } }, }, }, + { + files: ['src/overlays/OverlayProvider.jsx'], + rules: { 'react-refresh/only-export-components': 'off' }, + }, + { + files: ['**/*.{test,spec}.{js,jsx}', 'src/test/**/*.{js,jsx}', 'e2e/**/*.{js,jsx}', 'playwright.config.js'], + languageOptions: { + globals: { ...globals.browser, ...globals.node }, + }, + }, ]) diff --git a/console-ui/package-lock.json b/console-ui/package-lock.json index 3aec1bc..7500a79 100644 --- a/console-ui/package-lock.json +++ b/console-ui/package-lock.json @@ -18,6 +18,10 @@ }, "devDependencies": { "@eslint/js": "^10.0.1", + "@playwright/test": "^1.62.0", + "@testing-library/jest-dom": "^7.0.0", + "@testing-library/react": "^16.3.2", + "@testing-library/user-event": "^14.6.1", "@types/react": "^19.2.14", "@types/react-dom": "^19.2.3", "@vitejs/plugin-react": "^6.0.1", @@ -26,9 +30,69 @@ "eslint-plugin-react-hooks": "^7.1.1", "eslint-plugin-react-refresh": "^0.5.2", "globals": "^17.6.0", - "vite": "^8.0.12" + "jsdom": "^29.1.1", + "vite": "^8.0.12", + "vitest": "^4.1.10" } }, + "node_modules/@adobe/css-tools": { + "version": "4.5.0", + "resolved": "https://registry.npmjs.org/@adobe/css-tools/-/css-tools-4.5.0.tgz", + "integrity": "sha512-6OzddxPio9UiWTCemp4N8cYLV2ZN1ncRnV1cVGtve7dhPOtRkleRyx32GQCYSwDYgaHU3USMm84tNsvKzRCa1Q==", + "dev": true, + "license": "MIT" + }, + "node_modules/@asamuzakjp/css-color": { + "version": "5.1.11", + "resolved": "https://registry.npmjs.org/@asamuzakjp/css-color/-/css-color-5.1.11.tgz", + "integrity": "sha512-KVw6qIiCTUQhByfTd78h2yD1/00waTmm9uy/R7Ck/ctUyAPj+AEDLkQIdJW0T8+qGgj3j5bpNKK7Q3G+LedJWg==", + "dev": true, + "license": "MIT", + "dependencies": { + "@asamuzakjp/generational-cache": "^1.0.1", + "@csstools/css-calc": "^3.2.0", + "@csstools/css-color-parser": "^4.1.0", + "@csstools/css-parser-algorithms": "^4.0.0", + "@csstools/css-tokenizer": "^4.0.0" + }, + "engines": { + "node": "^20.19.0 || ^22.12.0 || >=24.0.0" + } + }, + "node_modules/@asamuzakjp/dom-selector": { + "version": "7.1.1", + "resolved": "https://registry.npmjs.org/@asamuzakjp/dom-selector/-/dom-selector-7.1.1.tgz", + "integrity": "sha512-67RZDnYRc8H/8MLDgQCDE//zoqVFwajkepHZgmXrbwybzXOEwOWGPYGmALYl9J2DOLfFPPs6kKCqmbzV895hTQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "@asamuzakjp/generational-cache": "^1.0.1", + "@asamuzakjp/nwsapi": "^2.3.9", + "bidi-js": "^1.0.3", + "css-tree": "^3.2.1", + "is-potential-custom-element-name": "^1.0.1" + }, + "engines": { + "node": "^20.19.0 || ^22.12.0 || >=24.0.0" + } + }, + "node_modules/@asamuzakjp/generational-cache": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/@asamuzakjp/generational-cache/-/generational-cache-1.0.1.tgz", + "integrity": "sha512-wajfB8KqzMCN2KGNFdLkReeHncd0AslUSrvHVvvYWuU8ghncRJoA50kT3zP9MVL0+9g4/67H+cdvBskj9THPzg==", + "dev": true, + "license": "MIT", + "engines": { + "node": "^20.19.0 || ^22.12.0 || >=24.0.0" + } + }, + "node_modules/@asamuzakjp/nwsapi": { + "version": "2.3.9", + "resolved": "https://registry.npmjs.org/@asamuzakjp/nwsapi/-/nwsapi-2.3.9.tgz", + "integrity": "sha512-n8GuYSrI9bF7FFZ/SjhwevlHc8xaVlb/7HmHelnc/PZXBD2ZR49NnN9sMMuDdEGPeeRQ5d0hqlSlEpgCX3Wl0Q==", + "dev": true, + "license": "MIT" + }, "node_modules/@babel/code-frame": { "version": "7.29.7", "resolved": "https://registry.npmjs.org/@babel/code-frame/-/code-frame-7.29.7.tgz", @@ -221,6 +285,16 @@ "node": ">=6.0.0" } }, + "node_modules/@babel/runtime": { + "version": "7.29.7", + "resolved": "https://registry.npmjs.org/@babel/runtime/-/runtime-7.29.7.tgz", + "integrity": "sha512-Nq8OhGWiZIZGV6hLHoyAKLLcJihP/xFeBMGJoUrxTX2psI8dCifzLhZISFb+VWS3wFMRDmCGw5R+dOySCqPLhw==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=6.9.0" + } + }, "node_modules/@babel/template": { "version": "7.29.7", "resolved": "https://registry.npmjs.org/@babel/template/-/template-7.29.7.tgz", @@ -269,6 +343,19 @@ "node": ">=6.9.0" } }, + "node_modules/@bramus/specificity": { + "version": "2.4.2", + "resolved": "https://registry.npmjs.org/@bramus/specificity/-/specificity-2.4.2.tgz", + "integrity": "sha512-ctxtJ/eA+t+6q2++vj5j7FYX3nRu311q1wfYH3xjlLOsczhlhxAg2FWNUXhpGvAw3BWo1xBcvOV6/YLc2r5FJw==", + "dev": true, + "license": "MIT", + "dependencies": { + "css-tree": "^3.0.0" + }, + "bin": { + "specificity": "bin/cli.js" + } + }, "node_modules/@code-inspector/core": { "version": "1.5.3", "resolved": "https://registry.npmjs.org/@code-inspector/core/-/core-1.5.3.tgz", @@ -335,6 +422,146 @@ "@code-inspector/core": "1.5.3" } }, + "node_modules/@csstools/color-helpers": { + "version": "6.1.0", + "resolved": "https://registry.npmjs.org/@csstools/color-helpers/-/color-helpers-6.1.0.tgz", + "integrity": "sha512-064IFJdjTfUqnjpCVpMOdbr8FLQBhinbZj6yRv2An2E41O/pLEXqfFRWqGq/SxlE5PEUYTlvWsG2r8MswAVvkg==", + "dev": true, + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/csstools" + }, + { + "type": "opencollective", + "url": "https://opencollective.com/csstools" + } + ], + "license": "MIT-0", + "engines": { + "node": ">=20.19.0" + } + }, + "node_modules/@csstools/css-calc": { + "version": "3.3.0", + "resolved": "https://registry.npmjs.org/@csstools/css-calc/-/css-calc-3.3.0.tgz", + "integrity": "sha512-c5ihYsPkdG6JCkU2zTMm4+k6r7RXuGxtWYhu5DHMIiF1FHzrfmHL5so11AoFpUv/tu61xfcmT4AmKoFfMPoqdQ==", + "dev": true, + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/csstools" + }, + { + "type": "opencollective", + "url": "https://opencollective.com/csstools" + } + ], + "license": "MIT", + "engines": { + "node": ">=20.19.0" + }, + "peerDependencies": { + "@csstools/css-parser-algorithms": "^4.0.0", + "@csstools/css-tokenizer": "^4.0.0" + } + }, + "node_modules/@csstools/css-color-parser": { + "version": "4.1.10", + "resolved": "https://registry.npmjs.org/@csstools/css-color-parser/-/css-color-parser-4.1.10.tgz", + "integrity": "sha512-UZhQLIUyJaaMepqehrCODwCg2KW25vFvLWBmqYFaPclYvvxzj/sG8LBOhBFCp11i9uE7t1EyS+RAoV9tztPFyw==", + "dev": true, + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/csstools" + }, + { + "type": "opencollective", + "url": "https://opencollective.com/csstools" + } + ], + "license": "MIT", + "dependencies": { + "@csstools/color-helpers": "^6.1.0", + "@csstools/css-calc": "^3.3.0" + }, + "engines": { + "node": ">=20.19.0" + }, + "peerDependencies": { + "@csstools/css-parser-algorithms": "^4.0.0", + "@csstools/css-tokenizer": "^4.0.0" + } + }, + "node_modules/@csstools/css-parser-algorithms": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/@csstools/css-parser-algorithms/-/css-parser-algorithms-4.0.0.tgz", + "integrity": "sha512-+B87qS7fIG3L5h3qwJ/IFbjoVoOe/bpOdh9hAjXbvx0o8ImEmUsGXN0inFOnk2ChCFgqkkGFQ+TpM5rbhkKe4w==", + "dev": true, + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/csstools" + }, + { + "type": "opencollective", + "url": "https://opencollective.com/csstools" + } + ], + "license": "MIT", + "engines": { + "node": ">=20.19.0" + }, + "peerDependencies": { + "@csstools/css-tokenizer": "^4.0.0" + } + }, + "node_modules/@csstools/css-syntax-patches-for-csstree": { + "version": "1.1.7", + "resolved": "https://registry.npmjs.org/@csstools/css-syntax-patches-for-csstree/-/css-syntax-patches-for-csstree-1.1.7.tgz", + "integrity": "sha512-fQ+05118eQS1cofO3aJpB5efgpBZMvIzwr/sbC8kDLVA5XLG8q1kJV5yzrUAI1f7lvhPnm8fgIjzFB8/O/5Dig==", + "dev": true, + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/csstools" + }, + { + "type": "opencollective", + "url": "https://opencollective.com/csstools" + } + ], + "license": "MIT-0", + "peerDependencies": { + "css-tree": "^3.2.1" + }, + "peerDependenciesMeta": { + "css-tree": { + "optional": true + } + } + }, + "node_modules/@csstools/css-tokenizer": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/@csstools/css-tokenizer/-/css-tokenizer-4.0.0.tgz", + "integrity": "sha512-QxULHAm7cNu72w97JUNCBFODFaXpbDg+dP8b/oWFAZ2MTRppA3U00Y2L1HqaS4J6yBqxwa/Y3nMBaxVKbB/NsA==", + "dev": true, + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/csstools" + }, + { + "type": "opencollective", + "url": "https://opencollective.com/csstools" + } + ], + "license": "MIT", + "engines": { + "node": ">=20.19.0" + } + }, "node_modules/@emnapi/core": { "version": "1.10.0", "resolved": "https://registry.npmjs.org/@emnapi/core/-/core-1.10.0.tgz", @@ -497,6 +724,24 @@ "node": "^20.19.0 || ^22.13.0 || >=24" } }, + "node_modules/@exodus/bytes": { + "version": "1.15.1", + "resolved": "https://registry.npmjs.org/@exodus/bytes/-/bytes-1.15.1.tgz", + "integrity": "sha512-S6mL0yNB/Abt9Ei4tq8gDhcczc4S3+vQ4ra7vxnAf+YHC02srtqxKKZghx2Dq6p0e66THKwR6r8N6P95wEty7Q==", + "dev": true, + "license": "MIT", + "engines": { + "node": "^20.19.0 || ^22.12.0 || >=24.0.0" + }, + "peerDependencies": { + "@noble/hashes": "^1.8.0 || ^2.0.0" + }, + "peerDependenciesMeta": { + "@noble/hashes": { + "optional": true + } + } + }, "node_modules/@humanfs/core": { "version": "0.19.2", "resolved": "https://registry.npmjs.org/@humanfs/core/-/core-0.19.2.tgz", @@ -642,6 +887,22 @@ "url": "https://github.com/sponsors/Boshen" } }, + "node_modules/@playwright/test": { + "version": "1.62.0", + "resolved": "https://registry.npmjs.org/@playwright/test/-/test-1.62.0.tgz", + "integrity": "sha512-9zOJ6ZQRAena31MpOH9VSzIz8Ou3YJ/wtY/eQm5T2uhfhG7/U3COrMS8xOtUrZrp9OgdmzEnIYODye3nY1VqzA==", + "dev": true, + "license": "Apache-2.0", + "dependencies": { + "playwright": "1.62.0" + }, + "bin": { + "playwright": "cli.js" + }, + "engines": { + "node": ">=20" + } + }, "node_modules/@rolldown/binding-android-arm64": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/@rolldown/binding-android-arm64/-/binding-android-arm64-1.0.2.tgz", @@ -906,6 +1167,106 @@ "dev": true, "license": "MIT" }, + "node_modules/@standard-schema/spec": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/@standard-schema/spec/-/spec-1.1.0.tgz", + "integrity": "sha512-l2aFy5jALhniG5HgqrD6jXLi/rUWrKvqN/qJx6yoJsgKhblVd+iqqU4RCXavm/jPityDo5TCvKMnpjKnOriy0w==", + "dev": true, + "license": "MIT" + }, + "node_modules/@testing-library/dom": { + "version": "10.4.1", + "resolved": "https://registry.npmjs.org/@testing-library/dom/-/dom-10.4.1.tgz", + "integrity": "sha512-o4PXJQidqJl82ckFaXUeoAW+XysPLauYI43Abki5hABd853iMhitooc6znOnczgbTYmEP6U6/y1ZyKAIsvMKGg==", + "dev": true, + "license": "MIT", + "peer": true, + "dependencies": { + "@babel/code-frame": "^7.10.4", + "@babel/runtime": "^7.12.5", + "@types/aria-query": "^5.0.1", + "aria-query": "5.3.0", + "dom-accessibility-api": "^0.5.9", + "lz-string": "^1.5.0", + "picocolors": "1.1.1", + "pretty-format": "^27.0.2" + }, + "engines": { + "node": ">=18" + } + }, + "node_modules/@testing-library/jest-dom": { + "version": "7.0.0", + "resolved": "https://registry.npmjs.org/@testing-library/jest-dom/-/jest-dom-7.0.0.tgz", + "integrity": "sha512-HKAH9C6mBo5yBG6yRO5i43L2iisencAo5z+o5P/saHUoY+miC5ivXRxHBJcFyB5ypPNxHJdK3BoF/3O4DIptMg==", + "dev": true, + "license": "MIT", + "dependencies": { + "@adobe/css-tools": "^4.4.0", + "aria-query": "^5.0.0", + "css.escape": "^1.5.1", + "dom-accessibility-api": "^0.6.3", + "picocolors": "^1.1.1", + "redent": "^3.0.0" + }, + "engines": { + "node": ">=22", + "npm": ">=6", + "yarn": ">=1" + }, + "peerDependencies": { + "@testing-library/dom": ">=10 <11" + } + }, + "node_modules/@testing-library/jest-dom/node_modules/dom-accessibility-api": { + "version": "0.6.3", + "resolved": "https://registry.npmjs.org/dom-accessibility-api/-/dom-accessibility-api-0.6.3.tgz", + "integrity": "sha512-7ZgogeTnjuHbo+ct10G9Ffp0mif17idi0IyWNVA/wcwcm7NPOD/WEHVP3n7n3MhXqxoIYm8d6MuZohYWIZ4T3w==", + "dev": true, + "license": "MIT" + }, + "node_modules/@testing-library/react": { + "version": "16.3.2", + "resolved": "https://registry.npmjs.org/@testing-library/react/-/react-16.3.2.tgz", + "integrity": "sha512-XU5/SytQM+ykqMnAnvB2umaJNIOsLF3PVv//1Ew4CTcpz0/BRyy/af40qqrt7SjKpDdT1saBMc42CUok5gaw+g==", + "dev": true, + "license": "MIT", + "dependencies": { + "@babel/runtime": "^7.12.5" + }, + "engines": { + "node": ">=18" + }, + "peerDependencies": { + "@testing-library/dom": "^10.0.0", + "@types/react": "^18.0.0 || ^19.0.0", + "@types/react-dom": "^18.0.0 || ^19.0.0", + "react": "^18.0.0 || ^19.0.0", + "react-dom": "^18.0.0 || ^19.0.0" + }, + "peerDependenciesMeta": { + "@types/react": { + "optional": true + }, + "@types/react-dom": { + "optional": true + } + } + }, + "node_modules/@testing-library/user-event": { + "version": "14.6.1", + "resolved": "https://registry.npmjs.org/@testing-library/user-event/-/user-event-14.6.1.tgz", + "integrity": "sha512-vq7fv0rnt+QTXgPxr5Hjc210p6YKq2kmdziLgnsZGgLJ9e6VAShx1pACLuRjd/AS/sr7phAR58OIIpf0LlmQNw==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=12", + "npm": ">=6" + }, + "peerDependencies": { + "@testing-library/dom": ">=7.21.4" + } + }, "node_modules/@tybys/wasm-util": { "version": "0.10.2", "resolved": "https://registry.npmjs.org/@tybys/wasm-util/-/wasm-util-0.10.2.tgz", @@ -917,6 +1278,32 @@ "tslib": "^2.4.0" } }, + "node_modules/@types/aria-query": { + "version": "5.0.4", + "resolved": "https://registry.npmjs.org/@types/aria-query/-/aria-query-5.0.4.tgz", + "integrity": "sha512-rfT93uj5s0PRL7EzccGMs3brplhcrghnDoV26NqKhCAS1hVo+WdNsPvE/yb6ilfr5hi2MEk6d5EWJTKdxg8jVw==", + "dev": true, + "license": "MIT", + "peer": true + }, + "node_modules/@types/chai": { + "version": "5.2.3", + "resolved": "https://registry.npmjs.org/@types/chai/-/chai-5.2.3.tgz", + "integrity": "sha512-Mw558oeA9fFbv65/y4mHtXDs9bPnFMZAL/jxdPFUpOHHIXX91mcgEHbS5Lahr+pwZFR8A7GQleRWeI6cGFC2UA==", + "dev": true, + "license": "MIT", + "dependencies": { + "@types/deep-eql": "*", + "assertion-error": "^2.0.1" + } + }, + "node_modules/@types/deep-eql": { + "version": "4.0.2", + "resolved": "https://registry.npmjs.org/@types/deep-eql/-/deep-eql-4.0.2.tgz", + "integrity": "sha512-c9h9dVVMigMPc4bwTvC5dxqtqJZwQPePsWjPlpSOnojbor6pGqdk541lfA7AqFQr5pB1BRdq0juY9db81BwyFw==", + "dev": true, + "license": "MIT" + }, "node_modules/@types/esrecurse": { "version": "4.3.1", "resolved": "https://registry.npmjs.org/@types/esrecurse/-/esrecurse-4.3.1.tgz", @@ -984,6 +1371,129 @@ } } }, + "node_modules/@vitest/expect": { + "version": "4.1.10", + "resolved": "https://registry.npmjs.org/@vitest/expect/-/expect-4.1.10.tgz", + "integrity": "sha512-YsCn+qAk1GWjQOWFEsEcL2gNQ0zmVmQu3T03qP6UyjhtmdtwtbuI+DASn/7iQB3HGTXkdBwGddzxPlmiql5vlA==", + "dev": true, + "license": "MIT", + "dependencies": { + "@standard-schema/spec": "^1.1.0", + "@types/chai": "^5.2.2", + "@vitest/spy": "4.1.10", + "@vitest/utils": "4.1.10", + "chai": "^6.2.2", + "tinyrainbow": "^3.1.0" + }, + "funding": { + "url": "https://opencollective.com/vitest" + } + }, + "node_modules/@vitest/mocker": { + "version": "4.1.10", + "resolved": "https://registry.npmjs.org/@vitest/mocker/-/mocker-4.1.10.tgz", + "integrity": "sha512-v0xaezt+DKEmKfaxg133ldzADrwLGd7Ze1MfQQTYfvs8OqZIwbxyxaYURivwV7sWy5fqn3rH5uOrSp07bp44Ow==", + "dev": true, + "license": "MIT", + "dependencies": { + "@vitest/spy": "4.1.10", + "estree-walker": "^3.0.3", + "magic-string": "^0.30.21" + }, + "funding": { + "url": "https://opencollective.com/vitest" + }, + "peerDependencies": { + "msw": "^2.4.9", + "vite": "^6.0.0 || ^7.0.0 || ^8.0.0" + }, + "peerDependenciesMeta": { + "msw": { + "optional": true + }, + "vite": { + "optional": true + } + } + }, + "node_modules/@vitest/mocker/node_modules/estree-walker": { + "version": "3.0.3", + "resolved": "https://registry.npmjs.org/estree-walker/-/estree-walker-3.0.3.tgz", + "integrity": "sha512-7RUKfXgSMMkzt6ZuXmqapOurLGPPfgj6l9uRZ7lRGolvk0y2yocc35LdcxKC5PQZdn2DMqioAQ2NoWcrTKmm6g==", + "dev": true, + "license": "MIT", + "dependencies": { + "@types/estree": "^1.0.0" + } + }, + "node_modules/@vitest/pretty-format": { + "version": "4.1.10", + "resolved": "https://registry.npmjs.org/@vitest/pretty-format/-/pretty-format-4.1.10.tgz", + "integrity": "sha512-W1HsjSH4MXQ9YfmmhLAoIYf1HRfekQCGngeIgcei6MP5QQGWUe0gkopdZQaVCFO+JDJMrAJGwa5pRpNpvy4P8Q==", + "dev": true, + "license": "MIT", + "dependencies": { + "tinyrainbow": "^3.1.0" + }, + "funding": { + "url": "https://opencollective.com/vitest" + } + }, + "node_modules/@vitest/runner": { + "version": "4.1.10", + "resolved": "https://registry.npmjs.org/@vitest/runner/-/runner-4.1.10.tgz", + "integrity": "sha512-IKI6kpIH+LmpROplyLwBBaCfMgOZOMsygVa6BARD6ahA04VRuJSa6OaVG7kRvSEMD870Vd91rSSw0eegtWyLGg==", + "dev": true, + "license": "MIT", + "dependencies": { + "@vitest/utils": "4.1.10", + "pathe": "^2.0.3" + }, + "funding": { + "url": "https://opencollective.com/vitest" + } + }, + "node_modules/@vitest/snapshot": { + "version": "4.1.10", + "resolved": "https://registry.npmjs.org/@vitest/snapshot/-/snapshot-4.1.10.tgz", + "integrity": "sha512-xRkfOT1qpTAi/Ti4Y1LtfRc3kEuqxGw59eN2jN9pRWMtS/XDevekhcFSqvQqjUNGksfjMJu3Y+oJ+4Ypn2OaJw==", + "dev": true, + "license": "MIT", + "dependencies": { + "@vitest/pretty-format": "4.1.10", + "@vitest/utils": "4.1.10", + "magic-string": "^0.30.21", + "pathe": "^2.0.3" + }, + "funding": { + "url": "https://opencollective.com/vitest" + } + }, + "node_modules/@vitest/spy": { + "version": "4.1.10", + "resolved": "https://registry.npmjs.org/@vitest/spy/-/spy-4.1.10.tgz", + "integrity": "sha512-PLf/Ugvoq5wO/b4rwYCR1h2PSIdXz7wnkQFMiUpLdtM7l6pqVFcQIBEHyT1+l+cj7mNwAfZHzqXqDyjvOuwbDw==", + "dev": true, + "license": "MIT", + "funding": { + "url": "https://opencollective.com/vitest" + } + }, + "node_modules/@vitest/utils": { + "version": "4.1.10", + "resolved": "https://registry.npmjs.org/@vitest/utils/-/utils-4.1.10.tgz", + "integrity": "sha512-fy9am/HWxbaGt/Sawrp90vt6Y6jQwf1RX77cz3uwoJwJVMli/e1IEwRPnMNJ7vKfPTwo0diXifkpPvwH9v7nGA==", + "dev": true, + "license": "MIT", + "dependencies": { + "@vitest/pretty-format": "4.1.10", + "convert-source-map": "^2.0.0", + "tinyrainbow": "^3.1.0" + }, + "funding": { + "url": "https://opencollective.com/vitest" + } + }, "node_modules/@vue/compiler-core": { "version": "3.5.35", "resolved": "https://registry.npmjs.org/@vue/compiler-core/-/compiler-core-3.5.35.tgz", @@ -1136,6 +1646,16 @@ "readable-stream": "^2.0.6" } }, + "node_modules/aria-query": { + "version": "5.3.0", + "resolved": "https://registry.npmjs.org/aria-query/-/aria-query-5.3.0.tgz", + "integrity": "sha512-b0P0sZPKtyu8HkeRAfCq0IfURZK+SuwMjY1UXGBU27wpAiTwQAIlq56IbIO+ytk/JjS1fMR14ee5WBBfKi5J6A==", + "dev": true, + "license": "Apache-2.0", + "dependencies": { + "dequal": "^2.0.3" + } + }, "node_modules/array-flatten": { "version": "1.1.1", "resolved": "https://registry.npmjs.org/array-flatten/-/array-flatten-1.1.1.tgz", @@ -1143,6 +1663,16 @@ "dev": true, "license": "MIT" }, + "node_modules/assertion-error": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/assertion-error/-/assertion-error-2.0.1.tgz", + "integrity": "sha512-Izi8RQcffqCeNVgFigKli1ssklIbpHnCYc6AknXGYoB6grJqyeby7jv12JUQgmTAnIDnbck1uxksT4dzN3PWBA==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=12" + } + }, "node_modules/async": { "version": "3.2.6", "resolved": "https://registry.npmjs.org/async/-/async-3.2.6.tgz", @@ -1193,6 +1723,16 @@ "node": ">=6.0.0" } }, + "node_modules/bidi-js": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/bidi-js/-/bidi-js-1.0.3.tgz", + "integrity": "sha512-RKshQI1R3YQ+n9YJz2QQ147P66ELpa1FQEg20Dk8oW9t2KgLbpDLLp9aGZ7y8WHSshDknG0bknqGw5/tyCs5tw==", + "dev": true, + "license": "MIT", + "dependencies": { + "require-from-string": "^2.0.2" + } + }, "node_modules/bl": { "version": "4.1.0", "resolved": "https://registry.npmjs.org/bl/-/bl-4.1.0.tgz", @@ -1413,6 +1953,16 @@ "vite": ">=5.0.0" } }, + "node_modules/chai": { + "version": "6.2.2", + "resolved": "https://registry.npmjs.org/chai/-/chai-6.2.2.tgz", + "integrity": "sha512-NUPRluOfOiTKBKvWPtSD4PhFvWCqOi0BGStNWs57X9js7XGTprSmFoz5F0tWhR4WPjNeR9jXqdC7/UpSJTnlRg==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=18" + } + }, "node_modules/chalk": { "version": "4.1.1", "resolved": "https://registry.npmjs.org/chalk/-/chalk-4.1.1.tgz", @@ -1555,6 +2105,27 @@ "node": ">= 8" } }, + "node_modules/css-tree": { + "version": "3.2.1", + "resolved": "https://registry.npmjs.org/css-tree/-/css-tree-3.2.1.tgz", + "integrity": "sha512-X7sjQzceUhu1u7Y/ylrRZFU2FS6LRiFVp6rKLPg23y3x3c3DOKAwuXGDp+PAGjh6CSnCjYeAul8pcT8bAl+lSA==", + "dev": true, + "license": "MIT", + "dependencies": { + "mdn-data": "2.27.1", + "source-map-js": "^1.2.1" + }, + "engines": { + "node": "^10 || ^12.20.0 || ^14.13.0 || >=15.0.0" + } + }, + "node_modules/css.escape": { + "version": "1.5.1", + "resolved": "https://registry.npmjs.org/css.escape/-/css.escape-1.5.1.tgz", + "integrity": "sha512-YUifsXXuknHlUsmlgyY0PKzgPOr7/FjCePfHNt0jxm83wHZi44VDMQ7/fGNkjY3/jV1MC+1CmZbaHzugyeRtpg==", + "dev": true, + "license": "MIT" + }, "node_modules/csstype": { "version": "3.2.3", "resolved": "https://registry.npmjs.org/csstype/-/csstype-3.2.3.tgz", @@ -1562,6 +2133,20 @@ "dev": true, "license": "MIT" }, + "node_modules/data-urls": { + "version": "7.0.0", + "resolved": "https://registry.npmjs.org/data-urls/-/data-urls-7.0.0.tgz", + "integrity": "sha512-23XHcCF+coGYevirZceTVD7NdJOqVn+49IHyxgszm+JIiHLoB2TkmPtsYkNWT1pvRSGkc35L6NHs0yHkN2SumA==", + "dev": true, + "license": "MIT", + "dependencies": { + "whatwg-mimetype": "^5.0.0", + "whatwg-url": "^16.0.0" + }, + "engines": { + "node": "^20.19.0 || ^22.12.0 || >=24.0.0" + } + }, "node_modules/debug": { "version": "4.4.3", "resolved": "https://registry.npmjs.org/debug/-/debug-4.4.3.tgz", @@ -1580,6 +2165,13 @@ } } }, + "node_modules/decimal.js": { + "version": "10.6.0", + "resolved": "https://registry.npmjs.org/decimal.js/-/decimal.js-10.6.0.tgz", + "integrity": "sha512-YpgQiITW3JXGntzdUmyUR1V812Hn8T1YVXhCu+wO3OpS4eU9l4YdD3qjyiKdV6mvV29zapkMeD390UVEf2lkUg==", + "dev": true, + "license": "MIT" + }, "node_modules/decompress-response": { "version": "4.2.1", "resolved": "https://registry.npmjs.org/decompress-response/-/decompress-response-4.2.1.tgz", @@ -1624,6 +2216,16 @@ "node": ">= 0.8" } }, + "node_modules/dequal": { + "version": "2.0.3", + "resolved": "https://registry.npmjs.org/dequal/-/dequal-2.0.3.tgz", + "integrity": "sha512-0je+qPKHEMohvfRTCEo3CrPG6cAzAYgmzKyxRiYSSDkS6eGJdyVJm7WaYA5ECaAD9wLB2T4EEeymA5aFVcYXCA==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=6" + } + }, "node_modules/destroy": { "version": "1.2.0", "resolved": "https://registry.npmjs.org/destroy/-/destroy-1.2.0.tgz", @@ -1645,6 +2247,14 @@ "node": ">=8" } }, + "node_modules/dom-accessibility-api": { + "version": "0.5.16", + "resolved": "https://registry.npmjs.org/dom-accessibility-api/-/dom-accessibility-api-0.5.16.tgz", + "integrity": "sha512-X7BJ2yElsnOJ30pZF4uIIDfBEVgF4XEBxL9Bxhy6dnrm5hkzqmsWHGTiHqRiITNhMyFLyAiWndIJP7Z1NTteDg==", + "dev": true, + "license": "MIT", + "peer": true + }, "node_modules/dotenv": { "version": "16.6.1", "resolved": "https://registry.npmjs.org/dotenv/-/dotenv-16.6.1.tgz", @@ -1739,6 +2349,13 @@ "node": ">= 0.4" } }, + "node_modules/es-module-lexer": { + "version": "2.3.1", + "resolved": "https://registry.npmjs.org/es-module-lexer/-/es-module-lexer-2.3.1.tgz", + "integrity": "sha512-shc1dbU90Yl/xq1QrC7QRtfcwURZuVRfPhZbDoldJ1cn1gzDvBaBWlv0eFolj5+0znnPJz5TXLxsN77X/12KTA==", + "dev": true, + "license": "MIT" + }, "node_modules/es-object-atoms": { "version": "1.1.2", "resolved": "https://registry.npmjs.org/es-object-atoms/-/es-object-atoms-1.1.2.tgz", @@ -1990,6 +2607,16 @@ "node": ">=6" } }, + "node_modules/expect-type": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/expect-type/-/expect-type-1.4.0.tgz", + "integrity": "sha512-KfYbmpRm0VbLjEvVa9yGwCi9GI34xvi7A/HXYWQO65CSD2u3MczUJSuwXKFIxlGsgBQizV9q5J9NHj4VG0n+pA==", + "dev": true, + "license": "Apache-2.0", + "engines": { + "node": ">=12.0.0" + } + }, "node_modules/express": { "version": "4.22.2", "resolved": "https://registry.npmjs.org/express/-/express-4.22.2.tgz", @@ -2428,6 +3055,19 @@ "hermes-estree": "0.25.1" } }, + "node_modules/html-encoding-sniffer": { + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/html-encoding-sniffer/-/html-encoding-sniffer-6.0.0.tgz", + "integrity": "sha512-CV9TW3Y3f8/wT0BRFc1/KAVQ3TUHiXmaAb6VW9vtiMFf7SLoMd1PdAc4W3KFOFETBJUb90KatHqlsZMWV+R9Gg==", + "dev": true, + "license": "MIT", + "dependencies": { + "@exodus/bytes": "^1.6.0" + }, + "engines": { + "node": "^20.19.0 || ^22.12.0 || >=24.0.0" + } + }, "node_modules/http-errors": { "version": "2.0.1", "resolved": "https://registry.npmjs.org/http-errors/-/http-errors-2.0.1.tgz", @@ -2502,6 +3142,16 @@ "node": ">=0.8.19" } }, + "node_modules/indent-string": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/indent-string/-/indent-string-4.0.0.tgz", + "integrity": "sha512-EdDDZu4A2OyIK7Lr/2zG+w5jmbuk1DVBnEwREQvBzspBJkCEbRa8GxU1lghYcaGJCnRWibjDXlq779X1/y5xwg==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=8" + } + }, "node_modules/inherits": { "version": "2.0.4", "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.4.tgz", @@ -2559,6 +3209,13 @@ "node": ">=0.10.0" } }, + "node_modules/is-potential-custom-element-name": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/is-potential-custom-element-name/-/is-potential-custom-element-name-1.0.1.tgz", + "integrity": "sha512-bCYeRA2rVibKZd+s2625gGnGF/t7DSqDs4dP7CrLA1m7jKWz6pps0LpYLJN8Q64HtmPKJ1hrN3nzPNKFEKOUiQ==", + "dev": true, + "license": "MIT" + }, "node_modules/isarray": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/isarray/-/isarray-1.0.0.tgz", @@ -2579,6 +3236,57 @@ "dev": true, "license": "MIT" }, + "node_modules/jsdom": { + "version": "29.1.1", + "resolved": "https://registry.npmjs.org/jsdom/-/jsdom-29.1.1.tgz", + "integrity": "sha512-ECi4Fi2f7BdJtUKTflYRTiaMxIB0O6zfR1fX0GXpUrf6flp8QIYn1UT20YQqdSOfk2dfkCwS8LAFoJDEppNK5Q==", + "dev": true, + "license": "MIT", + "dependencies": { + "@asamuzakjp/css-color": "^5.1.11", + "@asamuzakjp/dom-selector": "^7.1.1", + "@bramus/specificity": "^2.4.2", + "@csstools/css-syntax-patches-for-csstree": "^1.1.3", + "@exodus/bytes": "^1.15.0", + "css-tree": "^3.2.1", + "data-urls": "^7.0.0", + "decimal.js": "^10.6.0", + "html-encoding-sniffer": "^6.0.0", + "is-potential-custom-element-name": "^1.0.1", + "lru-cache": "^11.3.5", + "parse5": "^8.0.1", + "saxes": "^6.0.0", + "symbol-tree": "^3.2.4", + "tough-cookie": "^6.0.1", + "undici": "^7.25.0", + "w3c-xmlserializer": "^5.0.0", + "webidl-conversions": "^8.0.1", + "whatwg-mimetype": "^5.0.0", + "whatwg-url": "^16.0.1", + "xml-name-validator": "^5.0.0" + }, + "engines": { + "node": "^20.19.0 || ^22.13.0 || >=24.0.0" + }, + "peerDependencies": { + "canvas": "^3.0.0" + }, + "peerDependenciesMeta": { + "canvas": { + "optional": true + } + } + }, + "node_modules/jsdom/node_modules/lru-cache": { + "version": "11.5.2", + "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-11.5.2.tgz", + "integrity": "sha512-4pfM1Ff0x50o0tQwb5ucw/RzNyD0/YJME6IVcStalZuMWxdt3sR3huStTtxz4PUmvZfRguvDejasvQ2kifR11g==", + "dev": true, + "license": "BlueOak-1.0.0", + "engines": { + "node": "20 || >=22" + } + }, "node_modules/jsesc": { "version": "3.1.0", "resolved": "https://registry.npmjs.org/jsesc/-/jsesc-3.1.0.tgz", @@ -2948,6 +3656,27 @@ "yallist": "^3.0.2" } }, + "node_modules/lz-string": { + "version": "1.5.0", + "resolved": "https://registry.npmjs.org/lz-string/-/lz-string-1.5.0.tgz", + "integrity": "sha512-h5bgJWpxJNswbU7qCrV0tIKQCaS3blPDrqKWx+QxzuzL1zGUzij9XCWLrSLsJPu5t+eWA/ycetzYAO5IOMcWAQ==", + "dev": true, + "license": "MIT", + "peer": true, + "bin": { + "lz-string": "bin/bin.js" + } + }, + "node_modules/magic-string": { + "version": "0.30.21", + "resolved": "https://registry.npmjs.org/magic-string/-/magic-string-0.30.21.tgz", + "integrity": "sha512-vd2F4YUyEXKGcLHoq+TEyCjxueSeHnFxyyjNp80yg0XV4vUhnDer/lvvlqM/arB5bXQN5K2/3oinyCRyx8T2CQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "@jridgewell/sourcemap-codec": "^1.5.5" + } + }, "node_modules/math-intrinsics": { "version": "1.1.0", "resolved": "https://registry.npmjs.org/math-intrinsics/-/math-intrinsics-1.1.0.tgz", @@ -2958,6 +3687,13 @@ "node": ">= 0.4" } }, + "node_modules/mdn-data": { + "version": "2.27.1", + "resolved": "https://registry.npmjs.org/mdn-data/-/mdn-data-2.27.1.tgz", + "integrity": "sha512-9Yubnt3e8A0OKwxYSXyhLymGW4sCufcLG6VdiDdUGVkPhpqLxlvP5vl1983gQjJl3tqbrM731mjaZaP68AgosQ==", + "dev": true, + "license": "CC0-1.0" + }, "node_modules/media-typer": { "version": "0.3.0", "resolved": "https://registry.npmjs.org/media-typer/-/media-typer-0.3.0.tgz", @@ -3036,6 +3772,16 @@ "url": "https://github.com/sponsors/sindresorhus" } }, + "node_modules/min-indent": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/min-indent/-/min-indent-1.0.1.tgz", + "integrity": "sha512-I9jwMn07Sy/IwOj3zVkVik2JTvgpaykDZEigL6Rx6N9LbMywwUSMtxET+7lVoDLLd3O3IXwJwvuuns8UB/HeAg==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=4" + } + }, "node_modules/minimatch": { "version": "10.2.5", "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-10.2.5.tgz", @@ -3240,10 +3986,24 @@ "dev": true, "license": "MIT", "engines": { - "node": ">= 0.4" - }, - "funding": { - "url": "https://github.com/sponsors/ljharb" + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/obug": { + "version": "2.1.4", + "resolved": "https://registry.npmjs.org/obug/-/obug-2.1.4.tgz", + "integrity": "sha512-4a+OsYv9UktOJKE+l1A4OufDgdRF9PifWj+tJnHURo/P+WOxpG4GzUFL9qCalmWauao6ogiG+QvnCovwPoyAWA==", + "dev": true, + "funding": [ + "https://github.com/sponsors/sxzz", + "https://opencollective.com/debug" + ], + "license": "MIT", + "engines": { + "node": ">=12.20.0" } }, "node_modules/on-finished": { @@ -3318,6 +4078,32 @@ "url": "https://github.com/sponsors/sindresorhus" } }, + "node_modules/parse5": { + "version": "8.0.1", + "resolved": "https://registry.npmjs.org/parse5/-/parse5-8.0.1.tgz", + "integrity": "sha512-z1e/HMG90obSGeidlli3hj7cbocou0/wa5HacvI3ASx34PecNjNQeaHNo5WIZpWofN9kgkqV1q5YvXe3F0FoPw==", + "dev": true, + "license": "MIT", + "dependencies": { + "entities": "^8.0.0" + }, + "funding": { + "url": "https://github.com/inikulin/parse5?sponsor=1" + } + }, + "node_modules/parse5/node_modules/entities": { + "version": "8.0.0", + "resolved": "https://registry.npmjs.org/entities/-/entities-8.0.0.tgz", + "integrity": "sha512-zwfzJecQ/Uej6tusMqwAqU/6KL2XaB2VZ2Jg54Je6ahNBGNH6Ek6g3jjNCF0fG9EWQKGZNddNjU5F1ZQn/sBnA==", + "dev": true, + "license": "BSD-2-Clause", + "engines": { + "node": ">=20.19.0" + }, + "funding": { + "url": "https://github.com/fb55/entities?sponsor=1" + } + }, "node_modules/parseurl": { "version": "1.3.3", "resolved": "https://registry.npmjs.org/parseurl/-/parseurl-1.3.3.tgz", @@ -3355,6 +4141,13 @@ "dev": true, "license": "MIT" }, + "node_modules/pathe": { + "version": "2.0.3", + "resolved": "https://registry.npmjs.org/pathe/-/pathe-2.0.3.tgz", + "integrity": "sha512-WUjGcAqP1gQacoQe+OBJsFA7Ld4DyXuUIjZ5cc75cLHvJ7dtNsTugphxIADwspS+AraAUePCKrSVtPLFj/F88w==", + "dev": true, + "license": "MIT" + }, "node_modules/picocolors": { "version": "1.1.1", "resolved": "https://registry.npmjs.org/picocolors/-/picocolors-1.1.1.tgz", @@ -3375,6 +4168,53 @@ "url": "https://github.com/sponsors/jonschlinkert" } }, + "node_modules/playwright": { + "version": "1.62.0", + "resolved": "https://registry.npmjs.org/playwright/-/playwright-1.62.0.tgz", + "integrity": "sha512-Z14dG305dgaLu6foB1TXQagFiW8JfSUIUaUuPaKQ6NtBPKF1P/qXcqfh6c6K/icPqdy37JmjbiBXf6JNg6Sylw==", + "dev": true, + "license": "Apache-2.0", + "dependencies": { + "playwright-core": "1.62.0" + }, + "bin": { + "playwright": "cli.js" + }, + "engines": { + "node": ">=20" + }, + "optionalDependencies": { + "fsevents": "2.3.2" + } + }, + "node_modules/playwright-core": { + "version": "1.62.0", + "resolved": "https://registry.npmjs.org/playwright-core/-/playwright-core-1.62.0.tgz", + "integrity": "sha512-nsNRyq0r2zsG8AcRHWknc9QRA5XCueC7gWMrs+Gx2tlZn9hcl8zudfh00lhJPY1DE7NmZ6bDsT9g2yey8mXljA==", + "dev": true, + "license": "Apache-2.0", + "bin": { + "playwright-core": "cli.js" + }, + "engines": { + "node": ">=20" + } + }, + "node_modules/playwright/node_modules/fsevents": { + "version": "2.3.2", + "resolved": "https://registry.npmjs.org/fsevents/-/fsevents-2.3.2.tgz", + "integrity": "sha512-xiqMQR4xAeHTuB9uWm+fFRcIOgKBMiOBP+eXiyT7jsgVCq1bkVygt00oASowB7EdtpOHaaPgKt812P9ab+DDKA==", + "dev": true, + "hasInstallScript": true, + "license": "MIT", + "optional": true, + "os": [ + "darwin" + ], + "engines": { + "node": "^8.16.0 || ^10.6.0 || >=11.0.0" + } + }, "node_modules/portfinder": { "version": "1.0.38", "resolved": "https://registry.npmjs.org/portfinder/-/portfinder-1.0.38.tgz", @@ -3468,6 +4308,47 @@ "node": ">= 0.8.0" } }, + "node_modules/pretty-format": { + "version": "27.5.1", + "resolved": "https://registry.npmjs.org/pretty-format/-/pretty-format-27.5.1.tgz", + "integrity": "sha512-Qb1gy5OrP5+zDf2Bvnzdl3jsTf1qXVMazbvCoKhtKqVs4/YK4ozX4gKQJJVyNe+cajNPn0KoC0MC3FUmaHWEmQ==", + "dev": true, + "license": "MIT", + "peer": true, + "dependencies": { + "ansi-regex": "^5.0.1", + "ansi-styles": "^5.0.0", + "react-is": "^17.0.1" + }, + "engines": { + "node": "^10.13.0 || ^12.13.0 || ^14.15.0 || >=15.0.0" + } + }, + "node_modules/pretty-format/node_modules/ansi-regex": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-5.0.1.tgz", + "integrity": "sha512-quJQXlTSUGL2LH9SUXo8VwsY4soanhgo6LNSm84E1LBcE8s3O0wpdiRzyR9z/ZZJMlMWv37qOOb9pdJlMUEKFQ==", + "dev": true, + "license": "MIT", + "peer": true, + "engines": { + "node": ">=8" + } + }, + "node_modules/pretty-format/node_modules/ansi-styles": { + "version": "5.2.0", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-5.2.0.tgz", + "integrity": "sha512-Cxwpt2SfTzTtXcfOlzGEee8O+c+MmUgGrNiBcXnuWxuFJHe6a5Hz7qwhwe5OgaSYI0IJvkLqWX1ASG+cJOkEiA==", + "dev": true, + "license": "MIT", + "peer": true, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/chalk/ansi-styles?sponsor=1" + } + }, "node_modules/process-nextick-args": { "version": "2.0.1", "resolved": "https://registry.npmjs.org/process-nextick-args/-/process-nextick-args-2.0.1.tgz", @@ -3586,6 +4467,14 @@ "react": "^19.2.6" } }, + "node_modules/react-is": { + "version": "17.0.2", + "resolved": "https://registry.npmjs.org/react-is/-/react-is-17.0.2.tgz", + "integrity": "sha512-w2GsyukL62IJnlaff/nRegPQR94C/XXamvMWmSHRJ4y7Ts/4ocGRmTHvOs8PSE6pB3dWOrD/nueuU5sduBsQ4w==", + "dev": true, + "license": "MIT", + "peer": true + }, "node_modules/readable-stream": { "version": "2.3.8", "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-2.3.8.tgz", @@ -3607,6 +4496,30 @@ "integrity": "sha512-Gd2UZBJDkXlY7GbJxfsE8/nvKkUEU1G38c1siN6QP6a9PT9MmHB8GnpscSmMJSoF8LOIrt8ud/wPtojys4G6+g==", "license": "MIT" }, + "node_modules/redent": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/redent/-/redent-3.0.0.tgz", + "integrity": "sha512-6tDA8g98We0zd0GvVeMT9arEOnTw9qM03L9cJXaCjrip1OO764RDBLBfrB4cwzNGDj5OA5ioymC9GkizgWJDUg==", + "dev": true, + "license": "MIT", + "dependencies": { + "indent-string": "^4.0.0", + "strip-indent": "^3.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/require-from-string": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/require-from-string/-/require-from-string-2.0.2.tgz", + "integrity": "sha512-Xf0nWe6RseziFMu+Ap9biiUbmplq6S9/p+7w7YXP/JBHhrUDDUhwa+vANyubuqfZWTveU//DYVGsDG7RKL/vEw==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=0.10.0" + } + }, "node_modules/rolldown": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/rolldown/-/rolldown-1.0.2.tgz", @@ -3668,6 +4581,19 @@ "dev": true, "license": "MIT" }, + "node_modules/saxes": { + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/saxes/-/saxes-6.0.0.tgz", + "integrity": "sha512-xAg7SOnEhrm5zI3puOOKyy1OMcMlIJZYNJY7xLBwSze0UjhPLnWfj2GF2EpT0jmzaJKIWKHLsaSSajf35bcYnA==", + "dev": true, + "license": "ISC", + "dependencies": { + "xmlchars": "^2.2.0" + }, + "engines": { + "node": ">=v12.22.7" + } + }, "node_modules/scheduler": { "version": "0.27.0", "resolved": "https://registry.npmjs.org/scheduler/-/scheduler-0.27.0.tgz", @@ -3854,6 +4780,13 @@ "url": "https://github.com/sponsors/ljharb" } }, + "node_modules/siginfo": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/siginfo/-/siginfo-2.0.0.tgz", + "integrity": "sha512-ybx0WO1/8bSBLEWXZvEd7gMW3Sn3JFlW3TvX1nREbDLRNQNaeNN8WK0meBwPdAaOI7TtRRRJn/Es1zhrrCHu7g==", + "dev": true, + "license": "ISC" + }, "node_modules/signal-exit": { "version": "3.0.7", "resolved": "https://registry.npmjs.org/signal-exit/-/signal-exit-3.0.7.tgz", @@ -3901,6 +4834,13 @@ "node": ">=0.10.0" } }, + "node_modules/stackback": { + "version": "0.0.2", + "resolved": "https://registry.npmjs.org/stackback/-/stackback-0.0.2.tgz", + "integrity": "sha512-1XMJE5fQo1jGH6Y/7ebnwPOBEkIEnT4QF32d5R1+VXdXveM0IBMJt8zfaxX1P3QhVwrYe+576+jkANtSS2mBbw==", + "dev": true, + "license": "MIT" + }, "node_modules/statuses": { "version": "2.0.2", "resolved": "https://registry.npmjs.org/statuses/-/statuses-2.0.2.tgz", @@ -3911,6 +4851,13 @@ "node": ">= 0.8" } }, + "node_modules/std-env": { + "version": "4.2.0", + "resolved": "https://registry.npmjs.org/std-env/-/std-env-4.2.0.tgz", + "integrity": "sha512-oCUKSupKTHX53EyjDtuZQ64pjLJ6yYCtpmEw0goYxtjG9KpbRe8KAsl2tBUGU9DyMcJ0RwJ8GqJAFzMXcXW1Rw==", + "dev": true, + "license": "MIT" + }, "node_modules/string_decoder": { "version": "1.1.1", "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.1.1.tgz", @@ -3952,6 +4899,19 @@ "node": ">=0.10.0" } }, + "node_modules/strip-indent": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/strip-indent/-/strip-indent-3.0.0.tgz", + "integrity": "sha512-laJTa3Jb+VQpaC6DseHhF7dXVqHTfJPCRDaEbid/drOhgitgYku/letMUqOXFoWV0zIIUbjpdH2t+tYj4bQMRQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "min-indent": "^1.0.0" + }, + "engines": { + "node": ">=8" + } + }, "node_modules/strip-json-comments": { "version": "2.0.1", "resolved": "https://registry.npmjs.org/strip-json-comments/-/strip-json-comments-2.0.1.tgz", @@ -3974,6 +4934,13 @@ "node": ">=8" } }, + "node_modules/symbol-tree": { + "version": "3.2.4", + "resolved": "https://registry.npmjs.org/symbol-tree/-/symbol-tree-3.2.4.tgz", + "integrity": "sha512-9QNk5KwDF+Bvz+PyObkmSYjI5ksVUYtjW7AU22r2NKcfLJcXp96hkDWU3+XndOsUb+AQ9QhfzfCT2O+CNWT5Tw==", + "dev": true, + "license": "MIT" + }, "node_modules/tar-fs": { "version": "2.1.4", "resolved": "https://registry.npmjs.org/tar-fs/-/tar-fs-2.1.4.tgz", @@ -4016,6 +4983,23 @@ "node": ">= 6" } }, + "node_modules/tinybench": { + "version": "2.9.0", + "resolved": "https://registry.npmjs.org/tinybench/-/tinybench-2.9.0.tgz", + "integrity": "sha512-0+DUvqWMValLmha6lr4kD8iAMK1HzV0/aKnCtWb9v9641TnP/MFb7Pc2bxoxQjTXAErryXVgUOfv2YqNllqGeg==", + "dev": true, + "license": "MIT" + }, + "node_modules/tinyexec": { + "version": "1.2.4", + "resolved": "https://registry.npmjs.org/tinyexec/-/tinyexec-1.2.4.tgz", + "integrity": "sha512-SHf/r48b7vOrjve9PxJo3MN5v5yuyjHvdUcrQffT3WXMUfnGmHDVbC4k3sHJaJTgZCwpUplIaAo5ANtMyp3YHg==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=18" + } + }, "node_modules/tinyglobby": { "version": "0.2.17", "resolved": "https://registry.npmjs.org/tinyglobby/-/tinyglobby-0.2.17.tgz", @@ -4033,6 +5017,36 @@ "url": "https://github.com/sponsors/SuperchupuDev" } }, + "node_modules/tinyrainbow": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/tinyrainbow/-/tinyrainbow-3.1.0.tgz", + "integrity": "sha512-Bf+ILmBgretUrdJxzXM0SgXLZ3XfiaUuOj/IKQHuTXip+05Xn+uyEYdVg0kYDipTBcLrCVyUzAPz7QmArb0mmw==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=14.0.0" + } + }, + "node_modules/tldts": { + "version": "7.4.9", + "resolved": "https://registry.npmjs.org/tldts/-/tldts-7.4.9.tgz", + "integrity": "sha512-3kZ8wQQ/k5DrChD4X4FVvr2D7E5uoRgAqkPyLpSCGUvqOvqu+JEdr3mwMUaVWb+vMHZaKhF5fp2PBigKsui7hA==", + "dev": true, + "license": "MIT", + "dependencies": { + "tldts-core": "^7.4.9" + }, + "bin": { + "tldts": "bin/cli.js" + } + }, + "node_modules/tldts-core": { + "version": "7.4.9", + "resolved": "https://registry.npmjs.org/tldts-core/-/tldts-core-7.4.9.tgz", + "integrity": "sha512-DxKfPBI52p2msTEu7MPhdpdDTBhhVQg1a/8PjQckeyAvO13eMYElX545grIp6nnTGIMZlRvFZPvFhvI/WIz2Vg==", + "dev": true, + "license": "MIT" + }, "node_modules/toidentifier": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/toidentifier/-/toidentifier-1.0.1.tgz", @@ -4043,6 +5057,32 @@ "node": ">=0.6" } }, + "node_modules/tough-cookie": { + "version": "6.0.2", + "resolved": "https://registry.npmjs.org/tough-cookie/-/tough-cookie-6.0.2.tgz", + "integrity": "sha512-exgYmnmL/sJpR3upZfXG5PoatXQii55xAiXGXzY+sROLZ/Y+SLcp9PgJNI9Vz37HpQ74WvDcLT8eqm+kV3FzrA==", + "dev": true, + "license": "BSD-3-Clause", + "dependencies": { + "tldts": "^7.0.5" + }, + "engines": { + "node": ">=16" + } + }, + "node_modules/tr46": { + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/tr46/-/tr46-6.0.0.tgz", + "integrity": "sha512-bLVMLPtstlZ4iMQHpFHTR7GAGj2jxi8Dg0s2h2MafAE4uSWF98FC/3MomU51iQAMf8/qDUbKWf5GxuvvVcXEhw==", + "dev": true, + "license": "MIT", + "dependencies": { + "punycode": "^2.3.1" + }, + "engines": { + "node": ">=20" + } + }, "node_modules/tslib": { "version": "2.8.1", "resolved": "https://registry.npmjs.org/tslib/-/tslib-2.8.1.tgz", @@ -4088,6 +5128,16 @@ "node": ">= 0.6" } }, + "node_modules/undici": { + "version": "7.29.0", + "resolved": "https://registry.npmjs.org/undici/-/undici-7.29.0.tgz", + "integrity": "sha512-IDxfleLmmbSskfWSUATiN1nfn2rDuvnMOqb5CWR92iIfojA0Ud+ulOAAEQ57LPr9rWmsreUyf5lwyao+7GNNVw==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=20.18.1" + } + }, "node_modules/unpipe": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/unpipe/-/unpipe-1.0.0.tgz", @@ -4243,6 +5293,144 @@ } } }, + "node_modules/vitest": { + "version": "4.1.10", + "resolved": "https://registry.npmjs.org/vitest/-/vitest-4.1.10.tgz", + "integrity": "sha512-R9jUTe5S4Qb0HCd4TNqpC7oGcrMssMRGXLW80ubjWsW9VH5GF8y1Y0SFLY9AbqSk6nt0PnOx4H4WNJYZ13GUPw==", + "dev": true, + "license": "MIT", + "dependencies": { + "@vitest/expect": "4.1.10", + "@vitest/mocker": "4.1.10", + "@vitest/pretty-format": "4.1.10", + "@vitest/runner": "4.1.10", + "@vitest/snapshot": "4.1.10", + "@vitest/spy": "4.1.10", + "@vitest/utils": "4.1.10", + "es-module-lexer": "^2.0.0", + "expect-type": "^1.3.0", + "magic-string": "^0.30.21", + "obug": "^2.1.1", + "pathe": "^2.0.3", + "picomatch": "^4.0.3", + "std-env": "^4.0.0-rc.1", + "tinybench": "^2.9.0", + "tinyexec": "^1.0.2", + "tinyglobby": "^0.2.15", + "tinyrainbow": "^3.1.0", + "vite": "^6.0.0 || ^7.0.0 || ^8.0.0", + "why-is-node-running": "^2.3.0" + }, + "bin": { + "vitest": "vitest.mjs" + }, + "engines": { + "node": "^20.0.0 || ^22.0.0 || >=24.0.0" + }, + "funding": { + "url": "https://opencollective.com/vitest" + }, + "peerDependencies": { + "@edge-runtime/vm": "*", + "@opentelemetry/api": "^1.9.0", + "@types/node": "^20.0.0 || ^22.0.0 || >=24.0.0", + "@vitest/browser-playwright": "4.1.10", + "@vitest/browser-preview": "4.1.10", + "@vitest/browser-webdriverio": "4.1.10", + "@vitest/coverage-istanbul": "4.1.10", + "@vitest/coverage-v8": "4.1.10", + "@vitest/ui": "4.1.10", + "happy-dom": "*", + "jsdom": "*", + "vite": "^6.0.0 || ^7.0.0 || ^8.0.0" + }, + "peerDependenciesMeta": { + "@edge-runtime/vm": { + "optional": true + }, + "@opentelemetry/api": { + "optional": true + }, + "@types/node": { + "optional": true + }, + "@vitest/browser-playwright": { + "optional": true + }, + "@vitest/browser-preview": { + "optional": true + }, + "@vitest/browser-webdriverio": { + "optional": true + }, + "@vitest/coverage-istanbul": { + "optional": true + }, + "@vitest/coverage-v8": { + "optional": true + }, + "@vitest/ui": { + "optional": true + }, + "happy-dom": { + "optional": true + }, + "jsdom": { + "optional": true + }, + "vite": { + "optional": false + } + } + }, + "node_modules/w3c-xmlserializer": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/w3c-xmlserializer/-/w3c-xmlserializer-5.0.0.tgz", + "integrity": "sha512-o8qghlI8NZHU1lLPrpi2+Uq7abh4GGPpYANlalzWxyWteJOCsr/P+oPBA49TOLu5FTZO4d3F9MnWJfiMo4BkmA==", + "dev": true, + "license": "MIT", + "dependencies": { + "xml-name-validator": "^5.0.0" + }, + "engines": { + "node": ">=18" + } + }, + "node_modules/webidl-conversions": { + "version": "8.0.1", + "resolved": "https://registry.npmjs.org/webidl-conversions/-/webidl-conversions-8.0.1.tgz", + "integrity": "sha512-BMhLD/Sw+GbJC21C/UgyaZX41nPt8bUTg+jWyDeg7e7YN4xOM05YPSIXceACnXVtqyEw/LMClUQMtMZ+PGGpqQ==", + "dev": true, + "license": "BSD-2-Clause", + "engines": { + "node": ">=20" + } + }, + "node_modules/whatwg-mimetype": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/whatwg-mimetype/-/whatwg-mimetype-5.0.0.tgz", + "integrity": "sha512-sXcNcHOC51uPGF0P/D4NVtrkjSU2fNsm9iog4ZvZJsL3rjoDAzXZhkm2MWt1y+PUdggKAYVoMAIYcs78wJ51Cw==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=20" + } + }, + "node_modules/whatwg-url": { + "version": "16.0.1", + "resolved": "https://registry.npmjs.org/whatwg-url/-/whatwg-url-16.0.1.tgz", + "integrity": "sha512-1to4zXBxmXHV3IiSSEInrreIlu02vUOvrhxJJH5vcxYTBDAx51cqZiKdyTxlecdKNSjj8EcxGBxNf6Vg+945gw==", + "dev": true, + "license": "MIT", + "dependencies": { + "@exodus/bytes": "^1.11.0", + "tr46": "^6.0.0", + "webidl-conversions": "^8.0.1" + }, + "engines": { + "node": "^20.19.0 || ^22.12.0 || >=24.0.0" + } + }, "node_modules/which": { "version": "2.0.2", "resolved": "https://registry.npmjs.org/which/-/which-2.0.2.tgz", @@ -4259,6 +5447,23 @@ "node": ">= 8" } }, + "node_modules/why-is-node-running": { + "version": "2.3.0", + "resolved": "https://registry.npmjs.org/why-is-node-running/-/why-is-node-running-2.3.0.tgz", + "integrity": "sha512-hUrmaWBdVDcxvYqnyh09zunKzROWjbZTiNy8dBEjkS7ehEDQibXJ7XvlmtbwuTclUiIyN+CyXQD4Vmko8fNm8w==", + "dev": true, + "license": "MIT", + "dependencies": { + "siginfo": "^2.0.0", + "stackback": "0.0.2" + }, + "bin": { + "why-is-node-running": "cli.js" + }, + "engines": { + "node": ">=8" + } + }, "node_modules/wide-align": { "version": "1.1.5", "resolved": "https://registry.npmjs.org/wide-align/-/wide-align-1.1.5.tgz", @@ -4284,6 +5489,23 @@ "integrity": "sha512-l4Sp/DRseor9wL6EvV2+TuQn63dMkPjZ/sp9XkghTEbV9KlPS1xUsZ3u7/IQO4wxtcFB4bgpQPRcR3QCvezPcQ==", "license": "ISC" }, + "node_modules/xml-name-validator": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/xml-name-validator/-/xml-name-validator-5.0.0.tgz", + "integrity": "sha512-EvGK8EJ3DhaHfbRlETOWAS5pO9MZITeauHKJyb8wyajUfQUenkIg2MvLDTZ4T/TgIcm3HU0TFBgWWboAZ30UHg==", + "dev": true, + "license": "Apache-2.0", + "engines": { + "node": ">=18" + } + }, + "node_modules/xmlchars": { + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/xmlchars/-/xmlchars-2.2.0.tgz", + "integrity": "sha512-JZnDKK8B0RCDw84FNdDAIpZK+JuJw+s7Lz8nksI7SIuU3UXJJslUthsi+uWBUYOwPFwW7W7PRLRfUKpxjtjFCw==", + "dev": true, + "license": "MIT" + }, "node_modules/yallist": { "version": "3.1.1", "resolved": "https://registry.npmjs.org/yallist/-/yallist-3.1.1.tgz", diff --git a/console-ui/package.json b/console-ui/package.json index 35ff60c..a843785 100644 --- a/console-ui/package.json +++ b/console-ui/package.json @@ -7,7 +7,10 @@ "dev": "vite", "build": "vite build", "lint": "eslint .", - "test": "node --test src/lib/compose.test.js", + "test": "vitest run && node --test src/lib/compose.test.js", + "test:unit": "vitest run", + "test:watch": "vitest", + "test:e2e": "playwright test", "preview": "vite preview" }, "dependencies": { @@ -21,6 +24,10 @@ }, "devDependencies": { "@eslint/js": "^10.0.1", + "@playwright/test": "^1.62.0", + "@testing-library/jest-dom": "^7.0.0", + "@testing-library/react": "^16.3.2", + "@testing-library/user-event": "^14.6.1", "@types/react": "^19.2.14", "@types/react-dom": "^19.2.3", "@vitejs/plugin-react": "^6.0.1", @@ -29,6 +36,8 @@ "eslint-plugin-react-hooks": "^7.1.1", "eslint-plugin-react-refresh": "^0.5.2", "globals": "^17.6.0", - "vite": "^8.0.12" + "jsdom": "^29.1.1", + "vite": "^8.0.12", + "vitest": "^4.1.10" } } diff --git a/console-ui/playwright.config.js b/console-ui/playwright.config.js new file mode 100644 index 0000000..1dad124 --- /dev/null +++ b/console-ui/playwright.config.js @@ -0,0 +1,21 @@ +import { existsSync } from 'node:fs' +import { defineConfig } from '@playwright/test' + +const cachedChromium = '/home/kasm-user/.cache/ms-playwright/chromium-1234/chrome-linux64/chrome' +const executablePath = process.env.PLAYWRIGHT_CHROMIUM_EXECUTABLE + || (existsSync(cachedChromium) ? cachedChromium : undefined) + +export default defineConfig({ + testDir: './e2e', + fullyParallel: true, + use: { + baseURL: 'http://127.0.0.1:4173', + trace: 'retain-on-failure', + launchOptions: executablePath ? { executablePath } : undefined, + }, + webServer: { + command: 'npm run dev -- --host 127.0.0.1 --port 4173', + url: 'http://127.0.0.1:4173', + reuseExistingServer: !process.env.CI, + }, +}) diff --git a/console-ui/src/App.jsx b/console-ui/src/App.jsx index 1673655..d403ab5 100644 --- a/console-ui/src/App.jsx +++ b/console-ui/src/App.jsx @@ -58,6 +58,10 @@ import { TweaksPanel, useTweaks, TweakSection, TweakRadio, TweakToggle, TweakCol import { useMetrics, useMetricsHistory, useApps, useAlerts, useDevice, setAuthToken, getAuthToken, clearAuth, setOnAuthExpired } from './hooks/useApi' import { SYSTEM_APPS } from './data/systemApps' import { AnimatePresence } from './motion' +import { ShortcutHelpDialog } from './components/ShortcutHelpDialog' +import { shortcutRegistry } from './shortcuts/shortcuts' +import { useGlobalShortcuts } from './shortcuts/useGlobalShortcuts' +import { useOverlayStack } from './overlays/OverlayProvider' const TWEAK_DEFAULTS = { "preset": "platform-dark", @@ -144,6 +148,7 @@ function clampGeo(g, vw, vh) { export default function App() { const [loggedIn, setLoggedIn] = useState(() => !!getAuthToken()); const [loginUser, setLoginUser] = useState(''); + const overlayStack = useOverlayStack(); const handleLogin = (token, username) => { setAuthToken(token); @@ -254,6 +259,7 @@ export default function App() { const [authReason, setAuthReason] = useState(null); const [pendingAction, setPendingAction] = useState(null); const [uninstalled, setUninstalled] = useState(() => new Set()); + const [shortcutHelpOpen, setShortcutHelpOpen] = useState(false); // Launch an app: add to running set + focus its window. // New apps default to full-screen; already-running apps keep their last mode. @@ -365,6 +371,29 @@ export default function App() { // device 必须在 LoginScreen early-return 前定义(line 290 引用它) const device = liveDevice || {}; + const shortcutDockApps = useMemo(() => openApps + .map(id => appById[id]) + .filter(Boolean), [openApps, appById]); + const appShortcutRegistry = shortcutHelpOpen + ? shortcutRegistry.filter(shortcut => shortcut.action === 'toggle-shortcut-help') + : shortcutRegistry; + useGlobalShortcuts({ + enabled: loggedIn && (!overlayStack.hasLayers || shortcutHelpOpen), + registry: appShortcutRegistry, + actions: { + 'toggle-shortcut-help': () => setShortcutHelpOpen(open => !open), + 'show-desktop': showDesktop, + 'minimize-window': minimizeWindow, + 'toggle-maximized': () => setMaximized(current => !current), + 'close-window': closeWindow, + 'focus-dock-app': (index) => { + const app = shortcutDockApps[index]; + if (app) focusApp(app.id); + }, + }, + context: { activeId, dockApps: shortcutDockApps }, + }); + if (!loggedIn) { return ( @@ -432,6 +461,7 @@ export default function App() { online={t.online} lastSync="5 分钟前" onOpenAlerts={() => launchApp({ id: 'alerts' })} + onOpenShortcutHelp={() => setShortcutHelpOpen(true)} loginUser={loginUser} onLogout={handleLogout} /> @@ -544,6 +574,13 @@ export default function App() { {/* [Story 4.2 Disabled] AuthModal "节点访问授权" 入口删除 (LF 报告冲突 2026-06-21) 受控开发界面下登录是唯一身份门槛,退出在右上头像下拉 */} + {shortcutHelpOpen && ( + setShortcutHelpOpen(false)} + context={{ activeId, dockApps }} + /> + )} + {/* Tweaks panel */} diff --git a/console-ui/src/components/AppMgmtDrawer.jsx b/console-ui/src/components/AppMgmtDrawer.jsx index 30d0732..1a244e8 100644 --- a/console-ui/src/components/AppMgmtDrawer.jsx +++ b/console-ui/src/components/AppMgmtDrawer.jsx @@ -5,6 +5,7 @@ import { Icon } from '../icons' import { StatusDot, Chip } from '../components/ui' import { useAppLogs, useAppVersions, switchAppVersion, appOp, deleteApp, useAppDetail, appActionAsync, useTask } from '../hooks/useApi' import { motion, project, springs, useMotionPref } from '../motion' +import { useOverlayLayer } from '../overlays/OverlayProvider' import { btnSecondary, btnPrimary, btnDanger } from './AppWindow' import TabBar from './TabBar' import UninstallDialog from './UninstallDialog' @@ -864,15 +865,21 @@ function MgmtVersions({ app }) { function UninstallConfirm({ app, onCancel, onConfirm }) { const [typed, setTyped] = useState(''); const matches = typed === app.name; + const dialogRef = useRef(null); + const inputRef = useRef(null); + const { backdropProps, layerProps } = useOverlayLayer({ + id: 'uninstall-confirm', onDismiss: onCancel, layerRef: dialogRef, initialFocusRef: inputRef, modal: true, + }); return ( -
-
e.stopPropagation()} className="edge-fade-in" style={{ +
-
卸载应用
+
卸载应用
此操作不可撤销
{app.name} 确认:
- setTyped(e.target.value)} + setTyped(e.target.value)} autoFocus placeholder={app.name} style={{ @@ -1029,6 +1036,14 @@ export default function AppMgmtDrawer({ app, open, onClose, onUninstall, metrics const x = useMotionValue(open ? 0 : 1000); const [drawerWidth, setDrawerWidth] = useState(980); const backdropOpacity = useTransform(x, [0, drawerWidth || 1], [0.18, 0]); + const closeRef = useRef(null); + const { backdropProps, layerProps } = useOverlayLayer({ + id: 'app-management', + onDismiss: onClose, + layerRef: drawerRef, + initialFocusRef: closeRef, + active: open, + }); const measureDrawer = useCallback(() => { const width = drawerRef.current?.getBoundingClientRect().width; @@ -1139,7 +1154,7 @@ export default function AppMgmtDrawer({ app, open, onClose, onUninstall, metrics <> {/* Backdrop */}
-
{app.name}
+
{app.name}
{stateCfg.label} @@ -1227,7 +1247,7 @@ export default function AppMgmtDrawer({ app, open, onClose, onUninstall, metrics {app.gpu || 'CPU'}
- + +
+ {groups.map(group => ( +
+

{group.label}

+ {group.shortcuts.map(shortcut => ( +
+
+
{shortcut.name}{shortcut.unavailable ? '(当前不可用)' : ''}
+
{shortcut.description}
+
+
formatBinding(binding, platform)).join(' 或 ')}> + {shortcut.bindings.map((binding, index) => ( + {formatBinding(binding, platform)} + ))} +
+
+ ))} +
+ ))} +
+ 快捷键仅在焦点位于 devbox Console UI 时生效。跨域 iframe、终端、代码编辑器和输入区域会接收自己的键盘事件,父页面无法也不会拦截这些按键。 +
+
+ +
+ ) +} diff --git a/console-ui/src/components/ShortcutHelpDialog.module.css b/console-ui/src/components/ShortcutHelpDialog.module.css new file mode 100644 index 0000000..4a51e6d --- /dev/null +++ b/console-ui/src/components/ShortcutHelpDialog.module.css @@ -0,0 +1,88 @@ +.backdrop { + position: fixed; + inset: 0; + z-index: 10000; + display: flex; + align-items: center; + justify-content: center; + padding: 24px; + background: rgba(15, 23, 42, 0.48); + backdrop-filter: blur(8px); +} + +.dialog { + width: min(680px, calc(100vw - 32px)); + max-height: min(720px, calc(100vh - 48px)); + overflow: hidden; + border: 1px solid rgba(148, 163, 184, 0.3); + border-radius: 18px; + background: #fff; + color: #0f172a; + box-shadow: 0 30px 80px -20px rgba(15, 23, 42, 0.55); +} + +.header { + display: flex; + align-items: flex-start; + gap: 16px; + padding: 22px 24px 18px; + border-bottom: 1px solid #e2e8f0; + background: linear-gradient(180deg, #f8fafc, #fff); +} + +.title { margin: 0; font-size: 19px; letter-spacing: -0.02em; } +.subtitle { margin: 5px 0 0; color: #64748b; font-size: 12.5px; } +.close { + margin-left: auto; + width: 32px; + height: 32px; + border: 0; + border-radius: 9px; + background: #f1f5f9; + color: #475569; + cursor: pointer; +} +.close:hover { background: #e2e8f0; color: #0f172a; } + +.body { max-height: calc(min(720px, 100vh - 48px) - 104px); overflow: auto; padding: 18px 24px 22px; } +.section + .section { margin-top: 20px; } +.sectionTitle { margin: 0 0 8px; color: #64748b; font-size: 11px; letter-spacing: .08em; text-transform: uppercase; } +.row { + display: grid; + grid-template-columns: minmax(150px, 1fr) minmax(180px, auto); + gap: 16px; + align-items: center; + padding: 10px 0; + border-top: 1px solid #f1f5f9; +} +.name { font-size: 13px; font-weight: 650; } +.description { margin-top: 3px; color: #64748b; font-size: 11.5px; line-height: 1.45; } +.keys { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 5px; } +.key { + min-width: 28px; + padding: 4px 8px; + border: 1px solid #cbd5e1; + border-bottom-width: 2px; + border-radius: 7px; + background: #f8fafc; + color: #334155; + font: 600 11.5px ui-monospace, SFMono-Regular, Menlo, monospace; + text-align: center; +} +.notice { + margin-top: 20px; + padding: 11px 13px; + border: 1px solid #bfdbfe; + border-radius: 9px; + background: #eff6ff; + color: #1e40af; + font-size: 11.5px; + line-height: 1.6; +} + +@media (prefers-reduced-motion: no-preference) { + .backdrop { animation: backdropIn .16s ease-out; } + .dialog { animation: dialogIn .2s cubic-bezier(.2,.8,.2,1); } +} +@keyframes backdropIn { from { opacity: 0; } } +@keyframes dialogIn { from { opacity: 0; transform: translateY(8px) scale(.98); } } diff --git a/console-ui/src/components/StatusBar.jsx b/console-ui/src/components/StatusBar.jsx index dadf041..229f494 100644 --- a/console-ui/src/components/StatusBar.jsx +++ b/console-ui/src/components/StatusBar.jsx @@ -4,7 +4,7 @@ import { Icon } from '../icons' import { StatusDot, useClock } from './ui' import { AnimatePresence, PopScale } from '../motion' -export function StatusBar({ cpu, gpu, mem, alertCount, online, lastSync, onOpenAlerts, theme = 'light', deviceLabel, DEVICE, loginUser, onLogout }) { +export function StatusBar({ cpu, gpu, mem, alertCount, online, lastSync, onOpenAlerts, onOpenShortcutHelp, theme = 'light', deviceLabel, DEVICE, loginUser, onLogout }) { const isDarkBar = theme === 'dark' const now = useClock(); const hh = String(now.getHours()).padStart(2, '0'); @@ -134,6 +134,12 @@ export function StatusBar({ cpu, gpu, mem, alertCount, online, lastSync, onOpenA {/* Right: cloud + time */}
+
+ ) diff --git a/console-ui/src/overlays/OverlayProvider.jsx b/console-ui/src/overlays/OverlayProvider.jsx new file mode 100644 index 0000000..1fba311 --- /dev/null +++ b/console-ui/src/overlays/OverlayProvider.jsx @@ -0,0 +1,181 @@ +import { createContext, useCallback, useContext, useEffect, useLayoutEffect, useMemo, useRef, useState } from 'react' + +const OverlayContext = createContext(null) + +let scrollLockCount = 0 +let scrollLockPrevious = '' + +function lockBodyScroll() { + if (scrollLockCount === 0) { + scrollLockPrevious = document.body.style.overflow + document.body.style.overflow = 'hidden' + } + scrollLockCount += 1 + return () => { + scrollLockCount = Math.max(0, scrollLockCount - 1) + if (scrollLockCount === 0) document.body.style.overflow = scrollLockPrevious + } +} + +const focusableSelector = [ + 'a[href]', + 'button:not([disabled])', + 'input:not([disabled])', + 'select:not([disabled])', + 'textarea:not([disabled])', + '[tabindex]:not([tabindex="-1"])', +].join(',') + +export function OverlayProvider({ children }) { + const layers = useRef([]) + const [layerCount, setLayerCount] = useState(0) + + const register = useCallback((layer) => { + layers.current.push(layer) + setLayerCount(layers.current.length) + return () => { + layers.current = layers.current.filter(item => item.token !== layer.token) + setLayerCount(layers.current.length) + } + }, []) + + const isTop = useCallback((token) => layers.current.at(-1)?.token === token, []) + const hasLayers = layerCount > 0 + + useEffect(() => { + function onKeyDown(event) { + if (event.code !== 'Escape' && event.key !== 'Escape') return + const top = layers.current.at(-1) + if (!top?.dismissible || typeof top.onDismiss !== 'function') return + event.preventDefault() + event.stopPropagation() + top.onDismiss() + } + window.addEventListener('keydown', onKeyDown, true) + return () => window.removeEventListener('keydown', onKeyDown, true) + }, []) + + const value = useMemo(() => ({ register, isTop, hasLayers }), [register, isTop, hasLayers]) + return {children} +} + +export function useOverlayStack() { + const context = useContext(OverlayContext) + if (!context) throw new Error('useOverlayStack must be used inside OverlayProvider') + return context +} + +function setBackgroundInert(layerElement) { + const restores = [] + let current = layerElement + while (current?.parentElement) { + const parent = current.parentElement + let sibling = current.previousElementSibling + while (sibling) { + const element = sibling + const hadInert = element.hasAttribute('inert') + const previousAriaHidden = element.getAttribute('aria-hidden') + element.setAttribute('inert', '') + element.setAttribute('aria-hidden', 'true') + restores.push(() => { + if (!hadInert) element.removeAttribute('inert') + if (previousAriaHidden == null) element.removeAttribute('aria-hidden') + else element.setAttribute('aria-hidden', previousAriaHidden) + }) + sibling = element.previousElementSibling + } + if (parent === document.body) break + current = parent + } + return () => restores.reverse().forEach(restore => restore()) +} + +export function useOverlayLayer({ + id, + onDismiss, + layerRef, + initialFocusRef, + modal = false, + dismissible = true, + active = true, +}) { + const context = useContext(OverlayContext) + if (!context) throw new Error('useOverlayLayer must be used inside OverlayProvider') + const { register, isTop } = context + + const tokenRef = useRef(Symbol(id || 'overlay')) + const dismissRef = useRef(onDismiss) + const previousFocusRef = useRef(null) + + useLayoutEffect(() => { + dismissRef.current = onDismiss + }, [onDismiss]) + + useLayoutEffect(() => { + if (!active) return undefined + const token = tokenRef.current + const unregister = register({ + token, + dismissible, + onDismiss: () => dismissRef.current?.(), + }) + return () => { + unregister() + const previous = previousFocusRef.current + if (previous?.isConnected) previous.focus({ preventScroll: true }) + } + }, [active, dismissible, register]) + + useLayoutEffect(() => { + if (!active) return undefined + const layer = layerRef.current + if (!layer) return undefined + previousFocusRef.current = document.activeElement instanceof HTMLElement ? document.activeElement : null + const focusTarget = initialFocusRef?.current + || layer.querySelector('[autofocus], [data-initial-focus]') + || layer.querySelector(focusableSelector) + || layer + focusTarget.focus({ preventScroll: true }) + + const restoreEnvironment = modal ? setBackgroundInert(layer) : () => {} + const restoreScroll = modal ? lockBodyScroll() : () => {} + + return () => { + restoreEnvironment() + restoreScroll() + } + }, [active, initialFocusRef, layerRef, modal]) + + const onKeyDown = useCallback((event) => { + if (event.code !== 'Tab' || !isTop(tokenRef.current)) return + const layer = layerRef.current + if (!layer) return + const focusable = [...layer.querySelectorAll(focusableSelector)] + .filter(element => !element.hasAttribute('disabled') && element.getAttribute('aria-hidden') !== 'true') + if (focusable.length === 0) { + event.preventDefault() + layer.focus() + return + } + const first = focusable[0] + const last = focusable.at(-1) + if (event.shiftKey && (document.activeElement === first || !layer.contains(document.activeElement))) { + event.preventDefault() + last.focus() + } else if (!event.shiftKey && (document.activeElement === last || !layer.contains(document.activeElement))) { + event.preventDefault() + first.focus() + } + }, [isTop, layerRef]) + + const onBackdropClick = useCallback((event) => { + if (event.target !== event.currentTarget || !dismissible || !isTop(tokenRef.current)) return + onDismiss?.() + }, [dismissible, isTop, onDismiss]) + + return { + isTopLayer: () => isTop(tokenRef.current), + layerProps: { onKeyDown }, + backdropProps: { onClick: onBackdropClick }, + } +} diff --git a/console-ui/src/overlays/OverlayProvider.test.jsx b/console-ui/src/overlays/OverlayProvider.test.jsx new file mode 100644 index 0000000..2ac4021 --- /dev/null +++ b/console-ui/src/overlays/OverlayProvider.test.jsx @@ -0,0 +1,97 @@ +import { useRef, useState } from 'react' +import { fireEvent, render, screen } from '@testing-library/react' +import userEvent from '@testing-library/user-event' +import { describe, expect, it, vi } from 'vitest' +import { OverlayProvider, useOverlayLayer } from './OverlayProvider' + +function Layer({ name, onDismiss, modal = true }) { + const ref = useRef(null) + const { backdropProps, layerProps } = useOverlayLayer({ + id: name, + onDismiss, + modal, + layerRef: ref, + initialFocusRef: ref, + }) + return ( +
+
+ + +
+
+ ) +} + +function Stack({ firstDismiss, secondDismiss }) { + return ( + +
+ + +
+ ) +} + +describe('overlay stack', () => { + it('dismisses only the last registered layer and consumes Escape', () => { + const firstDismiss = vi.fn() + const secondDismiss = vi.fn() + render() + + const event = new KeyboardEvent('keydown', { code: 'Escape', key: 'Escape', bubbles: true, cancelable: true }) + window.dispatchEvent(event) + + expect(secondDismiss).toHaveBeenCalledOnce() + expect(firstDismiss).not.toHaveBeenCalled() + expect(event.defaultPrevented).toBe(true) + }) + + it('dismisses only when the top layer backdrop itself is clicked', async () => { + const user = userEvent.setup() + const firstDismiss = vi.fn() + const secondDismiss = vi.fn() + render() + + await user.click(screen.getByTestId('second')) + expect(secondDismiss).not.toHaveBeenCalled() + await user.click(screen.getByTestId('second-backdrop')) + expect(secondDismiss).toHaveBeenCalledOnce() + }) + + it('traps focus inside the top layer', () => { + render() + const [first, last] = screen.getAllByRole('button', { name: /second/, hidden: true }) + last.focus() + fireEvent.keyDown(last, { code: 'Tab', key: 'Tab' }) + expect(document.activeElement).toBe(first) + fireEvent.keyDown(first, { code: 'Tab', key: 'Tab', shiftKey: true }) + expect(document.activeElement).toBe(last) + }) + + it('locks scrolling, hides background, and restores focus after close', async () => { + const user = userEvent.setup() + function Harness() { + const [open, setOpen] = useState(false) + return ( + +
+ {open && setOpen(false)}/>} +
+ ) + } + render() + const launcher = screen.getByRole('button', { name: 'launcher' }) + await user.click(launcher) + + expect(document.body.style.overflow).toBe('hidden') + expect(screen.getByTestId('background')).toHaveAttribute('aria-hidden', 'true') + expect(screen.getByTestId('background')).toHaveAttribute('inert') + + fireEvent.keyDown(window, { code: 'Escape', key: 'Escape' }) + expect(screen.queryByTestId('dialog')).not.toBeInTheDocument() + expect(launcher).toHaveFocus() + expect(document.body.style.overflow).toBe('') + expect(screen.getByTestId('background')).not.toHaveAttribute('aria-hidden') + }) +}) diff --git a/console-ui/src/pages/AuditLog.jsx b/console-ui/src/pages/AuditLog.jsx index 8de24cb..86411ad 100644 --- a/console-ui/src/pages/AuditLog.jsx +++ b/console-ui/src/pages/AuditLog.jsx @@ -1,9 +1,10 @@ -import { useState, useEffect, useMemo } from 'react' +import { useState, useEffect, useMemo, useRef } from 'react' import { T } from '../tokens' import { Icon } from '../icons' import { btnSecondary } from '../components/AppWindow' import { getAuthToken } from '../hooks/useApi' import { AnimatePresence, PopScale } from '../motion' +import { useOverlayLayer } from '../overlays/OverlayProvider' // Story 7.1 audit 需要 Bearer token。所有 fetch 调用走 authFetch 自动带 token。 function authFetch(url, opts = {}) { @@ -285,31 +286,32 @@ function EventRow({ ev, meta, onClick }) { // CR C7: 右侧详情抽屉(spec AC-AUDIT-PAGE-TABLE 要求) function DetailDrawer({ ev, meta, onClose }) { const tone = TONE_COLOR[meta.tone] || TONE_COLOR.slate - useEffect(() => { - function onKey(e) { if (e.key === 'Escape') onClose() } - document.addEventListener('keydown', onKey) - return () => document.removeEventListener('keydown', onKey) - }, [onClose]) + const drawerRef = useRef(null) + const closeRef = useRef(null) + const { backdropProps, layerProps } = useOverlayLayer({ + id: 'audit-detail', onDismiss: onClose, layerRef: drawerRef, initialFocusRef: closeRef, + }) return ( <> {/* 半透明蒙层(点击关闭) */} -
{/* 右侧抽屉 */} -
{/* header */}
- {meta.label}
事件 #{ev.id}
- diff --git a/console-ui/src/shortcuts/shortcuts.js b/console-ui/src/shortcuts/shortcuts.js new file mode 100644 index 0000000..8c172f0 --- /dev/null +++ b/console-ui/src/shortcuts/shortcuts.js @@ -0,0 +1,132 @@ +const modAlt = { primary: true, alt: true } + +export const shortcutRegistry = [ + { + id: 'shortcut-help', + action: 'toggle-shortcut-help', + name: '快捷键帮助', + description: '打开或关闭此快捷键面板', + category: 'general', + bindings: [ + { code: 'Slash', key: '?', shift: true, displayKey: '?' }, + { code: 'Slash', key: '/', primary: true, displayKey: '/' }, + ], + }, + { + id: 'show-desktop', + action: 'show-desktop', + name: '显示桌面', + description: '最小化当前窗口并返回桌面', + category: 'navigation', + bindings: [{ code: 'KeyD', key: 'd', ...modAlt, displayKey: 'D' }], + }, + { + id: 'dock-app', + action: 'focus-dock-app', + name: '聚焦 Dock 应用', + description: '按当前运行中的 Dock 顺序聚焦第 1–9 个应用', + category: 'navigation', + bindings: Array.from({ length: 9 }, (_, index) => ({ + code: `Digit${index + 1}`, + key: String(index + 1), + alt: true, + displayKey: String(index + 1), + argument: index, + })), + enabled: ({ dockApps = [] }, binding) => Boolean(dockApps[binding.argument]), + }, + { + id: 'window-minimize', + action: 'minimize-window', + name: '最小化当前应用', + description: '最小化当前活动窗口', + category: 'window', + bindings: [{ code: 'KeyM', key: 'm', ...modAlt, displayKey: 'M' }], + enabled: ({ activeId }) => Boolean(activeId), + }, + { + id: 'window-maximize', + action: 'toggle-maximized', + name: '最大化或还原', + description: '切换当前活动窗口的显示模式', + category: 'window', + bindings: [{ code: 'KeyF', key: 'f', ...modAlt, displayKey: 'F' }], + enabled: ({ activeId }) => Boolean(activeId), + }, + { + id: 'window-close', + action: 'close-window', + name: '关闭当前应用', + description: '关闭当前活动窗口并退出运行', + category: 'window', + bindings: [{ code: 'KeyW', key: 'w', ...modAlt, displayKey: 'W' }], + enabled: ({ activeId }) => Boolean(activeId), + }, +] + +export const shortcutCategories = [ + { id: 'general', label: '通用' }, + { id: 'navigation', label: '导航' }, + { id: 'window', label: '窗口' }, +] + +export function getPlatform(userAgent = navigator.userAgent, platform = navigator.platform) { + const value = `${userAgent} ${platform}`.toLowerCase() + if (/mac|iphone|ipad|ipod/.test(value)) return 'mac' + if (/win/.test(value)) return 'windows' + return 'linux' +} + +function matchesModifier(event, binding, key) { + return Boolean(event[key]) === Boolean(binding[key === 'ctrlKey' || key === 'metaKey' ? 'primary' : key.replace('Key', '')]) +} + +export function bindingMatches(event, binding) { + const primaryMatches = binding.primary + ? (event.ctrlKey || event.metaKey) && !(event.ctrlKey && event.metaKey) + : !event.ctrlKey && !event.metaKey + const hasUsableCode = event.code && event.code !== 'Unidentified' + const keyMatches = hasUsableCode ? event.code === binding.code : event.key === binding.key + return keyMatches + && primaryMatches + && matchesModifier(event, binding, 'altKey') + && matchesModifier(event, binding, 'shiftKey') +} + +export function isEditableContext(target) { + if (!(target instanceof Element)) return false + return Boolean(target.closest([ + 'input', + 'textarea', + 'select', + '[contenteditable]:not([contenteditable="false"])', + '[role="textbox"]', + '.xterm', + '[data-shortcut-scope]', + ].join(','))) +} + +export function matchShortcut(event, registry = shortcutRegistry, context = {}) { + if (event.repeat || event.isComposing || event.keyCode === 229 || isEditableContext(event.target)) return null + for (const shortcut of registry) { + for (const binding of shortcut.bindings) { + if (!bindingMatches(event, binding)) continue + if (shortcut.enabled && !shortcut.enabled(context, binding)) continue + return { shortcut, binding } + } + } + return null +} + +export function formatBinding(binding, platform = getPlatform()) { + const parts = [] + if (binding.primary) parts.push(platform === 'mac' ? '⌘' : 'Ctrl') + if (binding.alt) parts.push(platform === 'mac' ? 'Option' : 'Alt') + if (binding.shift && binding.displayKey !== '?') parts.push('Shift') + parts.push(binding.displayKey) + return parts.join(' + ') +} + +export function formatShortcut(shortcut, platform = getPlatform()) { + return shortcut.bindings.map(binding => formatBinding(binding, platform)).join(' / ') +} diff --git a/console-ui/src/shortcuts/shortcuts.test.js b/console-ui/src/shortcuts/shortcuts.test.js new file mode 100644 index 0000000..c50e893 --- /dev/null +++ b/console-ui/src/shortcuts/shortcuts.test.js @@ -0,0 +1,86 @@ +import { describe, expect, it, vi } from 'vitest' +import { formatShortcut, isEditableContext, matchShortcut, shortcutRegistry } from './shortcuts' + +describe('keyboard shortcut matcher', () => { + it('matches KeyboardEvent.code instead of the visible key', () => { + const event = new KeyboardEvent('keydown', { code: 'Slash', key: '§', ctrlKey: true }) + expect(matchShortcut(event, shortcutRegistry, {})).toMatchObject({ shortcut: { id: 'shortcut-help' } }) + }) + + it.each([ + [{ code: '', key: 'm' }, 'window-minimize'], + [{ code: 'Unidentified', key: 'm' }, 'window-minimize'], + ])('falls back to the declared key when code is unavailable: %o', (identity, id) => { + const event = new KeyboardEvent('keydown', { ...identity, ctrlKey: true, altKey: true }) + expect(matchShortcut(event, shortcutRegistry, { activeId: 'dashboard' })?.shortcut.id).toBe(id) + }) + + it('prefers a usable code over the visible key', () => { + const event = new KeyboardEvent('keydown', { code: 'KeyW', key: 'm', ctrlKey: true, altKey: true }) + expect(matchShortcut(event, shortcutRegistry, { activeId: 'dashboard' })?.shortcut.id).toBe('window-close') + }) + + it('matches help by character semantics when code is unavailable', () => { + const event = new KeyboardEvent('keydown', { code: 'Unidentified', key: '?', shiftKey: true }) + expect(matchShortcut(event, shortcutRegistry, {})?.shortcut.id).toBe('shortcut-help') + }) + + it('does not match repeated keydown events by default', () => { + const event = new KeyboardEvent('keydown', { code: 'KeyD', ctrlKey: true, altKey: true, repeat: true }) + expect(matchShortcut(event, shortcutRegistry, {})).toBeNull() + }) + + it.each([ + { code: 'KeyD', key: 'd', ctrlKey: true, altKey: true, isComposing: true }, + { code: 'KeyD', key: 'd', ctrlKey: true, altKey: true, keyCode: 229 }, + ])('ignores IME composition keydown: %o', (init) => { + const event = new KeyboardEvent('keydown', init) + expect(matchShortcut(event, shortcutRegistry, {})).toBeNull() + }) + + it('only returns enabled shortcuts', () => { + const event = new KeyboardEvent('keydown', { code: 'KeyM', ctrlKey: true, altKey: true }) + expect(matchShortcut(event, shortcutRegistry, { activeId: null })).toBeNull() + expect(matchShortcut(event, shortcutRegistry, { activeId: 'dashboard' })?.shortcut.id).toBe('window-minimize') + }) +}) + +describe('editable shortcut contexts', () => { + it.each([ + ['input', ''], + ['textarea', ''], + ['select', ''], + ['contenteditable', '
'], + ['ARIA textbox', '
'], + ['xterm', '
'], + ['declared shortcut scope', '
'], + ])('suppresses shortcuts inside %s', (_label, markup) => { + document.body.innerHTML = markup + const target = document.body.querySelector('span, button, input, textarea, select, [contenteditable], [role="textbox"], .xterm') + expect(isEditableContext(target)).toBe(true) + }) + + it('allows shortcuts from ordinary controls', () => { + document.body.innerHTML = '' + expect(isEditableContext(document.querySelector('button'))).toBe(false) + }) +}) + +describe('platform shortcut labels', () => { + it('uses Apple modifier names on macOS', () => { + expect(formatShortcut(shortcutRegistry.find(item => item.id === 'window-close'), 'mac')).toBe('⌘ + Option + W') + }) + + it('uses Ctrl and Alt on Windows and Linux', () => { + expect(formatShortcut(shortcutRegistry.find(item => item.id === 'window-close'), 'windows')).toBe('Ctrl + Alt + W') + }) +}) + +describe('shortcut event consumption', () => { + it('leaves unmatched events untouched', () => { + const event = new KeyboardEvent('keydown', { code: 'KeyZ', ctrlKey: true, cancelable: true }) + const preventDefault = vi.spyOn(event, 'preventDefault') + expect(matchShortcut(event, shortcutRegistry, {})).toBeNull() + expect(preventDefault).not.toHaveBeenCalled() + }) +}) diff --git a/console-ui/src/shortcuts/useGlobalShortcuts.js b/console-ui/src/shortcuts/useGlobalShortcuts.js new file mode 100644 index 0000000..f13c2a9 --- /dev/null +++ b/console-ui/src/shortcuts/useGlobalShortcuts.js @@ -0,0 +1,19 @@ +import { useEffect, useEffectEvent } from 'react' +import { matchShortcut, shortcutRegistry } from './shortcuts' + +export function useGlobalShortcuts({ enabled, actions, context, registry = shortcutRegistry }) { + const onKeyDown = useEffectEvent((event) => { + if (!enabled) return + const match = matchShortcut(event, registry, context) + if (!match) return + const action = actions[match.shortcut.action] + if (typeof action !== 'function') return + event.preventDefault() + action(match.binding.argument, match) + }) + + useEffect(() => { + window.addEventListener('keydown', onKeyDown, true) + return () => window.removeEventListener('keydown', onKeyDown, true) + }, []) +} diff --git a/console-ui/src/shortcuts/useGlobalShortcuts.test.jsx b/console-ui/src/shortcuts/useGlobalShortcuts.test.jsx new file mode 100644 index 0000000..e7a1a1a --- /dev/null +++ b/console-ui/src/shortcuts/useGlobalShortcuts.test.jsx @@ -0,0 +1,70 @@ +import { render } from '@testing-library/react' +import { describe, expect, it, vi } from 'vitest' +import { useGlobalShortcuts } from './useGlobalShortcuts' + +function Harness({ enabled = true, actions, context = {} }) { + useGlobalShortcuts({ enabled, actions, context }) + return null +} + +function keydown(init) { + const event = new KeyboardEvent('keydown', { bubbles: true, cancelable: true, ...init }) + document.dispatchEvent(event) + return event +} + +describe('useGlobalShortcuts', () => { + it('dispatches an enabled action and prevents its browser default', () => { + const actions = { 'show-desktop': vi.fn() } + render() + const event = keydown({ code: 'KeyD', ctrlKey: true, altKey: true }) + expect(actions['show-desktop']).toHaveBeenCalledOnce() + expect(event.defaultPrevented).toBe(true) + }) + + it('does not preventDefault when disabled or in an editable context', () => { + const actions = { 'show-desktop': vi.fn() } + const { rerender } = render() + expect(keydown({ code: 'KeyD', ctrlKey: true, altKey: true }).defaultPrevented).toBe(false) + expect(actions['show-desktop']).not.toHaveBeenCalled() + + rerender() + const input = document.createElement('input') + document.body.append(input) + const event = new KeyboardEvent('keydown', { code: 'KeyD', ctrlKey: true, altKey: true, bubbles: true, cancelable: true }) + input.dispatchEvent(event) + expect(event.defaultPrevented).toBe(false) + expect(actions['show-desktop']).not.toHaveBeenCalled() + }) + + it('handles keydown in the window capture phase before descendants stop propagation', () => { + const actions = { 'show-desktop': vi.fn() } + render() + const target = document.createElement('button') + target.addEventListener('keydown', event => event.stopPropagation()) + document.body.append(target) + target.dispatchEvent(new KeyboardEvent('keydown', { + code: 'KeyD', key: 'd', ctrlKey: true, altKey: true, bubbles: true, cancelable: true, + })) + expect(actions['show-desktop']).toHaveBeenCalledOnce() + }) + + it('suppresses repeated actions', () => { + const actions = { 'show-desktop': vi.fn() } + render() + const event = keydown({ code: 'KeyD', ctrlKey: true, altKey: true, repeat: true }) + expect(event.defaultPrevented).toBe(false) + expect(actions['show-desktop']).not.toHaveBeenCalled() + }) + + it.each([ + { code: 'KeyD', key: 'd', ctrlKey: true, altKey: true, isComposing: true }, + { code: 'KeyD', key: 'd', ctrlKey: true, altKey: true, keyCode: 229 }, + ])('ignores composition events: %o', (init) => { + const actions = { 'show-desktop': vi.fn() } + render() + const event = keydown(init) + expect(event.defaultPrevented).toBe(false) + expect(actions['show-desktop']).not.toHaveBeenCalled() + }) +}) diff --git a/console-ui/src/test/setup.js b/console-ui/src/test/setup.js new file mode 100644 index 0000000..a6dbe2b --- /dev/null +++ b/console-ui/src/test/setup.js @@ -0,0 +1,18 @@ +import '@testing-library/jest-dom/vitest' +import { cleanup } from '@testing-library/react' +import { afterEach } from 'vitest' + +afterEach(() => { + cleanup() + document.body.style.overflow = '' + document.body.removeAttribute('aria-hidden') + document.body.removeAttribute('inert') +}) + +if (!Object.prototype.hasOwnProperty.call(HTMLElement.prototype, 'inert')) { + Object.defineProperty(HTMLElement.prototype, 'inert', { + configurable: true, + get() { return this.hasAttribute('inert') }, + set(value) { value ? this.setAttribute('inert', '') : this.removeAttribute('inert') }, + }) +} diff --git a/console-ui/vite.config.js b/console-ui/vite.config.js index 7b97ccf..4824a1e 100644 --- a/console-ui/vite.config.js +++ b/console-ui/vite.config.js @@ -6,12 +6,19 @@ import { codeInspectorPlugin } from 'code-inspector-plugin' const apiTarget = process.env.DEVBOX_API_TARGET || 'http://localhost:9090' -export default defineConfig({ +export default defineConfig(({ mode }) => ({ + test: { + environment: 'jsdom', + setupFiles: './src/test/setup.js', + css: false, + restoreMocks: true, + exclude: ['e2e/**', 'node_modules/**', 'src/lib/compose.test.js'], + }, plugins: [ - codeInspectorPlugin({ bundler: 'vite' }), - ccPromptPlugin({ inspector: false }), + mode !== 'test' && codeInspectorPlugin({ bundler: 'vite' }), + mode !== 'test' && ccPromptPlugin({ inspector: false }), react(), - ], + ].filter(Boolean), build: { outDir: 'dist', emptyOutDir: true, @@ -28,4 +35,4 @@ export default defineConfig({ '/app-icons': apiTarget, }, }, -}) +})) diff --git a/pkg/console/dist/assets/index-Bm_BEi_3.js b/pkg/console/dist/assets/index-Bm_BEi_3.js deleted file mode 100644 index 9566dc1..0000000 --- a/pkg/console/dist/assets/index-Bm_BEi_3.js +++ /dev/null @@ -1,186 +0,0 @@ -var e=Object.create,t=Object.defineProperty,n=Object.getOwnPropertyDescriptor,r=Object.getOwnPropertyNames,i=Object.getPrototypeOf,a=Object.prototype.hasOwnProperty,o=(e,t)=>()=>(e&&(t=e(e=0)),t),s=(e,t)=>()=>(t||(e((t={exports:{}}).exports,t),e=null),t.exports),c=(e,n)=>{let r={};for(var i in e)t(r,i,{get:e[i],enumerable:!0});return n||t(r,Symbol.toStringTag,{value:`Module`}),r},l=(e,i,o,s)=>{if(i&&typeof i==`object`||typeof i==`function`)for(var c=r(i),l=0,u=c.length,d;li[e]).bind(null,d),enumerable:!(s=n(i,d))||s.enumerable});return e},u=(n,r,a)=>(a=n==null?{}:e(i(n)),l(r||!n||!n.__esModule?t(a,`default`,{value:n,enumerable:!0}):a,n)),d=e=>a.call(e,`module.exports`)?e[`module.exports`]:l(t({},`__esModule`,{value:!0}),e);(function(){let e=document.createElement(`link`).relList;if(e&&e.supports&&e.supports(`modulepreload`))return;for(let e of document.querySelectorAll(`link[rel="modulepreload"]`))n(e);new MutationObserver(e=>{for(let t of e)if(t.type===`childList`)for(let e of t.addedNodes)e.tagName===`LINK`&&e.rel===`modulepreload`&&n(e)}).observe(document,{childList:!0,subtree:!0});function t(e){let t={};return e.integrity&&(t.integrity=e.integrity),e.referrerPolicy&&(t.referrerPolicy=e.referrerPolicy),e.crossOrigin===`use-credentials`?t.credentials=`include`:e.crossOrigin===`anonymous`?t.credentials=`omit`:t.credentials=`same-origin`,t}function n(e){if(e.ep)return;e.ep=!0;let n=t(e);fetch(e.href,n)}})();var f=s((e=>{var t=Symbol.for(`react.transitional.element`),n=Symbol.for(`react.portal`),r=Symbol.for(`react.fragment`),i=Symbol.for(`react.strict_mode`),a=Symbol.for(`react.profiler`),o=Symbol.for(`react.consumer`),s=Symbol.for(`react.context`),c=Symbol.for(`react.forward_ref`),l=Symbol.for(`react.suspense`),u=Symbol.for(`react.memo`),d=Symbol.for(`react.lazy`),f=Symbol.for(`react.activity`),p=Symbol.iterator;function m(e){return typeof e!=`object`||!e?null:(e=p&&e[p]||e[`@@iterator`],typeof e==`function`?e:null)}var h={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},g=Object.assign,_={};function v(e,t,n){this.props=e,this.context=t,this.refs=_,this.updater=n||h}v.prototype.isReactComponent={},v.prototype.setState=function(e,t){if(typeof e!=`object`&&typeof e!=`function`&&e!=null)throw Error(`takes an object of state variables to update or a function which returns an object of state variables.`);this.updater.enqueueSetState(this,e,t,`setState`)},v.prototype.forceUpdate=function(e){this.updater.enqueueForceUpdate(this,e,`forceUpdate`)};function y(){}y.prototype=v.prototype;function b(e,t,n){this.props=e,this.context=t,this.refs=_,this.updater=n||h}var x=b.prototype=new y;x.constructor=b,g(x,v.prototype),x.isPureReactComponent=!0;var S=Array.isArray;function C(){}var w={H:null,A:null,T:null,S:null},T=Object.prototype.hasOwnProperty;function E(e,n,r){var i=r.ref;return{$$typeof:t,type:e,key:n,ref:i===void 0?null:i,props:r}}function D(e,t){return E(e.type,t,e.props)}function O(e){return typeof e==`object`&&!!e&&e.$$typeof===t}function k(e){var t={"=":`=0`,":":`=2`};return`$`+e.replace(/[=:]/g,function(e){return t[e]})}var A=/\/+/g;function j(e,t){return typeof e==`object`&&e&&e.key!=null?k(``+e.key):t.toString(36)}function ee(e){switch(e.status){case`fulfilled`:return e.value;case`rejected`:throw e.reason;default:switch(typeof e.status==`string`?e.then(C,C):(e.status=`pending`,e.then(function(t){e.status===`pending`&&(e.status=`fulfilled`,e.value=t)},function(t){e.status===`pending`&&(e.status=`rejected`,e.reason=t)})),e.status){case`fulfilled`:return e.value;case`rejected`:throw e.reason}}throw e}function M(e,r,i,a,o){var s=typeof e;(s===`undefined`||s===`boolean`)&&(e=null);var c=!1;if(e===null)c=!0;else switch(s){case`bigint`:case`string`:case`number`:c=!0;break;case`object`:switch(e.$$typeof){case t:case n:c=!0;break;case d:return c=e._init,M(c(e._payload),r,i,a,o)}}if(c)return o=o(e),c=a===``?`.`+j(e,0):a,S(o)?(i=``,c!=null&&(i=c.replace(A,`$&/`)+`/`),M(o,r,i,``,function(e){return e})):o!=null&&(O(o)&&(o=D(o,i+(o.key==null||e&&e.key===o.key?``:(``+o.key).replace(A,`$&/`)+`/`)+c)),r.push(o)),1;c=0;var l=a===``?`.`:a+`:`;if(S(e))for(var u=0;u{t.exports=f()})),m=s((e=>{function t(e,t){var n=e.length;e.push(t);a:for(;0>>1,a=e[r];if(0>>1;ri(c,n))li(u,c)?(e[r]=u,e[l]=n,r=l):(e[r]=c,e[s]=n,r=s);else if(li(u,n))e[r]=u,e[l]=n,r=l;else break a}}return t}function i(e,t){var n=e.sortIndex-t.sortIndex;return n===0?e.id-t.id:n}if(e.unstable_now=void 0,typeof performance==`object`&&typeof performance.now==`function`){var a=performance;e.unstable_now=function(){return a.now()}}else{var o=Date,s=o.now();e.unstable_now=function(){return o.now()-s}}var c=[],l=[],u=1,d=null,f=3,p=!1,m=!1,h=!1,g=!1,_=typeof setTimeout==`function`?setTimeout:null,v=typeof clearTimeout==`function`?clearTimeout:null,y=typeof setImmediate<`u`?setImmediate:null;function b(e){for(var i=n(l);i!==null;){if(i.callback===null)r(l);else if(i.startTime<=e)r(l),i.sortIndex=i.expirationTime,t(c,i);else break;i=n(l)}}function x(e){if(h=!1,b(e),!m)if(n(c)!==null)m=!0,S||(S=!0,O());else{var t=n(l);t!==null&&j(x,t.startTime-e)}}var S=!1,C=-1,w=5,T=-1;function E(){return g?!0:!(e.unstable_now()-Tt&&E());){var o=d.callback;if(typeof o==`function`){d.callback=null,f=d.priorityLevel;var s=o(d.expirationTime<=t);if(t=e.unstable_now(),typeof s==`function`){d.callback=s,b(t),i=!0;break b}d===n(c)&&r(c),b(t)}else r(c);d=n(c)}if(d!==null)i=!0;else{var u=n(l);u!==null&&j(x,u.startTime-t),i=!1}}break a}finally{d=null,f=a,p=!1}i=void 0}}finally{i?O():S=!1}}}var O;if(typeof y==`function`)O=function(){y(D)};else if(typeof MessageChannel<`u`){var k=new MessageChannel,A=k.port2;k.port1.onmessage=D,O=function(){A.postMessage(null)}}else O=function(){_(D,0)};function j(t,n){C=_(function(){t(e.unstable_now())},n)}e.unstable_IdlePriority=5,e.unstable_ImmediatePriority=1,e.unstable_LowPriority=4,e.unstable_NormalPriority=3,e.unstable_Profiling=null,e.unstable_UserBlockingPriority=2,e.unstable_cancelCallback=function(e){e.callback=null},e.unstable_forceFrameRate=function(e){0>e||125o?(r.sortIndex=a,t(l,r),n(c)===null&&r===n(l)&&(h?(v(C),C=-1):h=!0,j(x,a-o))):(r.sortIndex=s,t(c,r),m||p||(m=!0,S||(S=!0,O()))),r},e.unstable_shouldYield=E,e.unstable_wrapCallback=function(e){var t=f;return function(){var n=f;f=t;try{return e.apply(this,arguments)}finally{f=n}}}})),h=s(((e,t)=>{t.exports=m()})),g=s((e=>{var t=p();function n(e){var t=`https://react.dev/errors/`+e;if(1{function n(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>`u`||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!=`function`))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(n)}catch(e){console.error(e)}}n(),t.exports=g()})),v=s((e=>{var t=h(),n=p(),r=_();function i(e){var t=`https://react.dev/errors/`+e;if(1L||(e.current=ne[L],ne[L]=null,L--)}function z(e,t){L++,ne[L]=e.current,e.current=t}var B=re(null),ie=re(null),ae=re(null),oe=re(null);function se(e,t){switch(z(ae,t),z(ie,e),z(B,null),t.nodeType){case 9:case 11:e=(e=t.documentElement)&&(e=e.namespaceURI)?Ud(e):0;break;default:if(e=t.tagName,t=t.namespaceURI)t=Ud(t),e=Wd(t,e);else switch(e){case`svg`:e=1;break;case`math`:e=2;break;default:e=0}}R(B),z(B,e)}function ce(){R(B),R(ie),R(ae)}function le(e){e.memoizedState!==null&&z(oe,e);var t=B.current,n=Wd(t,e.type);t!==n&&(z(ie,e),z(B,n))}function ue(e){ie.current===e&&(R(B),R(ie)),oe.current===e&&(R(oe),ep._currentValue=te)}var de,fe;function pe(e){if(de===void 0)try{throw Error()}catch(e){var t=e.stack.trim().match(/\n( *(at )?)/);de=t&&t[1]||``,fe=-1)`:-1i||c[r]!==l[i]){var u=` -`+c[r].replace(` at new `,` at `);return e.displayName&&u.includes(``)&&(u=u.replace(``,e.displayName)),u}while(1<=r&&0<=i);break}}}finally{me=!1,Error.prepareStackTrace=n}return(n=e?e.displayName||e.name:``)?pe(n):``}function ge(e,t){switch(e.tag){case 26:case 27:case 5:return pe(e.type);case 16:return pe(`Lazy`);case 13:return e.child!==t&&t!==null?pe(`Suspense Fallback`):pe(`Suspense`);case 19:return pe(`SuspenseList`);case 0:case 15:return he(e.type,!1);case 11:return he(e.type.render,!1);case 1:return he(e.type,!0);case 31:return pe(`Activity`);default:return``}}function _e(e){try{var t=``,n=null;do t+=ge(e,n),n=e,e=e.return;while(e);return t}catch(e){return` -Error generating stack: `+e.message+` -`+e.stack}}var ve=Object.prototype.hasOwnProperty,ye=t.unstable_scheduleCallback,be=t.unstable_cancelCallback,xe=t.unstable_shouldYield,Se=t.unstable_requestPaint,Ce=t.unstable_now,we=t.unstable_getCurrentPriorityLevel,Te=t.unstable_ImmediatePriority,Ee=t.unstable_UserBlockingPriority,De=t.unstable_NormalPriority,Oe=t.unstable_LowPriority,ke=t.unstable_IdlePriority,Ae=t.log,je=t.unstable_setDisableYieldValue,V=null,Me=null;function Ne(e){if(typeof Ae==`function`&&je(e),Me&&typeof Me.setStrictMode==`function`)try{Me.setStrictMode(V,e)}catch{}}var Pe=Math.clz32?Math.clz32:Le,Fe=Math.log,Ie=Math.LN2;function Le(e){return e>>>=0,e===0?32:31-(Fe(e)/Ie|0)|0}var Re=256,ze=262144,Be=4194304;function Ve(e){var t=e&42;if(t!==0)return t;switch(e&-e){case 1:return 1;case 2:return 2;case 4:return 4;case 8:return 8;case 16:return 16;case 32:return 32;case 64:return 64;case 128:return 128;case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:return e&261888;case 262144:case 524288:case 1048576:case 2097152:return e&3932160;case 4194304:case 8388608:case 16777216:case 33554432:return e&62914560;case 67108864:return 67108864;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 0;default:return e}}function He(e,t,n){var r=e.pendingLanes;if(r===0)return 0;var i=0,a=e.suspendedLanes,o=e.pingedLanes;e=e.warmLanes;var s=r&134217727;return s===0?(s=r&~a,s===0?o===0?n||(n=r&~e,n!==0&&(i=Ve(n))):i=Ve(o):i=Ve(s)):(r=s&~a,r===0?(o&=s,o===0?n||(n=s&~e,n!==0&&(i=Ve(n))):i=Ve(o)):i=Ve(r)),i===0?0:t!==0&&t!==i&&(t&a)===0&&(a=i&-i,n=t&-t,a>=n||a===32&&n&4194048)?t:i}function Ue(e,t){return(e.pendingLanes&~(e.suspendedLanes&~e.pingedLanes)&t)===0}function We(e,t){switch(e){case 1:case 2:case 4:case 8:case 64:return t+250;case 16:case 32:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return t+5e3;case 4194304:case 8388608:case 16777216:case 33554432:return-1;case 67108864:case 134217728:case 268435456:case 536870912:case 1073741824:return-1;default:return-1}}function Ge(){var e=Be;return Be<<=1,!(Be&62914560)&&(Be=4194304),e}function Ke(e){for(var t=[],n=0;31>n;n++)t.push(e);return t}function qe(e,t){e.pendingLanes|=t,t!==268435456&&(e.suspendedLanes=0,e.pingedLanes=0,e.warmLanes=0)}function Je(e,t,n,r,i,a){var o=e.pendingLanes;e.pendingLanes=n,e.suspendedLanes=0,e.pingedLanes=0,e.warmLanes=0,e.expiredLanes&=n,e.entangledLanes&=n,e.errorRecoveryDisabledLanes&=n,e.shellSuspendCounter=0;var s=e.entanglements,c=e.expirationTimes,l=e.hiddenUpdates;for(n=o&~n;0`u`||window.document===void 0||window.document.createElement===void 0),on=!1;if(an)try{var sn={};Object.defineProperty(sn,"passive",{get:function(){on=!0}}),window.addEventListener(`test`,sn,sn),window.removeEventListener(`test`,sn,sn)}catch{on=!1}var cn=null,ln=null,un=null;function dn(){if(un)return un;var e,t=ln,n=t.length,r,i=`value`in cn?cn.value:cn.textContent,a=i.length;for(e=0;e=Un),Kn=` `,qn=!1;function Jn(e,t){switch(e){case`keyup`:return Vn.indexOf(t.keyCode)!==-1;case`keydown`:return t.keyCode!==229;case`keypress`:case`mousedown`:case`focusout`:return!0;default:return!1}}function Yn(e){return e=e.detail,typeof e==`object`&&`data`in e?e.data:null}var Xn=!1;function Zn(e,t){switch(e){case`compositionend`:return Yn(t);case`keypress`:return t.which===32?(qn=!0,Kn):null;case`textInput`:return e=t.data,e===Kn&&qn?null:e;default:return null}}function Qn(e,t){if(Xn)return e===`compositionend`||!Hn&&Jn(e,t)?(e=dn(),un=ln=cn=null,Xn=!1,e):null;switch(e){case`paste`:return null;case`keypress`:if(!(t.ctrlKey||t.altKey||t.metaKey)||t.ctrlKey&&t.altKey){if(t.char&&1=t)return{node:n,offset:t-e};e=r}a:{for(;n;){if(n.nextSibling){n=n.nextSibling;break a}n=n.parentNode}n=void 0}n=br(n)}}function Sr(e,t){return e&&t?e===t?!0:e&&e.nodeType===3?!1:t&&t.nodeType===3?Sr(e,t.parentNode):`contains`in e?e.contains(t):e.compareDocumentPosition?!!(e.compareDocumentPosition(t)&16):!1:!1}function Cr(e){e=e!=null&&e.ownerDocument!=null&&e.ownerDocument.defaultView!=null?e.ownerDocument.defaultView:window;for(var t=Mt(e.document);t instanceof e.HTMLIFrameElement;){try{var n=typeof t.contentWindow.location.href==`string`}catch{n=!1}if(n)e=t.contentWindow;else break;t=Mt(e.document)}return t}function wr(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return t&&(t===`input`&&(e.type===`text`||e.type===`search`||e.type===`tel`||e.type===`url`||e.type===`password`)||t===`textarea`||e.contentEditable===`true`)}var Tr=an&&`documentMode`in document&&11>=document.documentMode,Er=null,Dr=null,Or=null,kr=!1;function Ar(e,t,n){var r=n.window===n?n.document:n.nodeType===9?n:n.ownerDocument;kr||Er==null||Er!==Mt(r)||(r=Er,`selectionStart`in r&&wr(r)?r={start:r.selectionStart,end:r.selectionEnd}:(r=(r.ownerDocument&&r.ownerDocument.defaultView||window).getSelection(),r={anchorNode:r.anchorNode,anchorOffset:r.anchorOffset,focusNode:r.focusNode,focusOffset:r.focusOffset}),Or&&yr(Or,r)||(Or=r,r=kd(Dr,`onSelect`),0>=o,i-=o,Si=1<<32-Pe(t)+i|n<h?(g=d,d=null):g=d.sibling;var _=p(i,d,s[h],c);if(_===null){d===null&&(d=g);break}e&&d&&_.alternate===null&&t(i,d),a=o(_,a,h),u===null?l=_:u.sibling=_,u=_,d=g}if(h===s.length)return n(i,d),U&&wi(i,h),l;if(d===null){for(;hg?(_=h,h=null):_=h.sibling;var y=p(a,h,v.value,l);if(y===null){h===null&&(h=_);break}e&&h&&y.alternate===null&&t(a,h),s=o(y,s,g),d===null?u=y:d.sibling=y,d=y,h=_}if(v.done)return n(a,h),U&&wi(a,g),u;if(h===null){for(;!v.done;g++,v=c.next())v=f(a,v.value,l),v!==null&&(s=o(v,s,g),d===null?u=v:d.sibling=v,d=v);return U&&wi(a,g),u}for(h=r(h);!v.done;g++,v=c.next())v=m(h,a,g,v.value,l),v!==null&&(e&&v.alternate!==null&&h.delete(v.key===null?g:v.key),s=o(v,s,g),d===null?u=v:d.sibling=v,d=v);return e&&h.forEach(function(e){return t(a,e)}),U&&wi(a,g),u}function b(e,r,o,c){if(typeof o==`object`&&o&&o.type===y&&o.key===null&&(o=o.props.children),typeof o==`object`&&o){switch(o.$$typeof){case g:a:{for(var l=o.key;r!==null;){if(r.key===l){if(l=o.type,l===y){if(r.tag===7){n(e,r.sibling),c=a(r,o.props.children),c.return=e,e=c;break a}}else if(r.elementType===l||typeof l==`object`&&l&&l.$$typeof===O&&wa(l)===r.type){n(e,r.sibling),c=a(r,o.props),ja(c,o),c.return=e,e=c;break a}n(e,r);break}else t(e,r);r=r.sibling}o.type===y?(c=li(o.props.children,e.mode,c,o.key),c.return=e,e=c):(c=ci(o.type,o.key,o.props,null,e.mode,c),ja(c,o),c.return=e,e=c)}return s(e);case v:a:{for(l=o.key;r!==null;){if(r.key===l)if(r.tag===4&&r.stateNode.containerInfo===o.containerInfo&&r.stateNode.implementation===o.implementation){n(e,r.sibling),c=a(r,o.children||[]),c.return=e,e=c;break a}else{n(e,r);break}else t(e,r);r=r.sibling}c=fi(o,e.mode,c),c.return=e,e=c}return s(e);case O:return o=wa(o),b(e,r,o,c)}if(P(o))return h(e,r,o,c);if(ee(o)){if(l=ee(o),typeof l!=`function`)throw Error(i(150));return o=l.call(o),_(e,r,o,c)}if(typeof o.then==`function`)return b(e,r,Aa(o),c);if(o.$$typeof===C)return b(e,r,Qi(e,o),c);Ma(e,o)}return typeof o==`string`&&o!==``||typeof o==`number`||typeof o==`bigint`?(o=``+o,r!==null&&r.tag===6?(n(e,r.sibling),c=a(r,o),c.return=e,e=c):(n(e,r),c=ui(o,e.mode,c),c.return=e,e=c),s(e)):n(e,r)}return function(e,t,n,r){try{ka=0;var i=b(e,t,n,r);return Oa=null,i}catch(t){if(t===va||t===ba)throw t;var a=ii(29,t,null,e.mode);return a.lanes=r,a.return=e,a}}}var Pa=Na(!0),Fa=Na(!1),Ia=!1;function La(e){e.updateQueue={baseState:e.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,lanes:0,hiddenCallbacks:null},callbacks:null}}function Ra(e,t){e=e.updateQueue,t.updateQueue===e&&(t.updateQueue={baseState:e.baseState,firstBaseUpdate:e.firstBaseUpdate,lastBaseUpdate:e.lastBaseUpdate,shared:e.shared,callbacks:null})}function za(e){return{lane:e,tag:0,payload:null,callback:null,next:null}}function Ba(e,t,n){var r=e.updateQueue;if(r===null)return null;if(r=r.shared,Bl&2){var i=r.pending;return i===null?t.next=t:(t.next=i.next,i.next=t),r.pending=t,t=ti(e),ei(e,null,n),t}return Zr(e,r,t,n),ti(e)}function Va(e,t,n){if(t=t.updateQueue,t!==null&&(t=t.shared,n&4194048)){var r=t.lanes;r&=e.pendingLanes,n|=r,t.lanes=n,Xe(e,n)}}function Ha(e,t){var n=e.updateQueue,r=e.alternate;if(r!==null&&(r=r.updateQueue,n===r)){var i=null,a=null;if(n=n.firstBaseUpdate,n!==null){do{var o={lane:n.lane,tag:n.tag,payload:n.payload,callback:null,next:null};a===null?i=a=o:a=a.next=o,n=n.next}while(n!==null);a===null?i=a=t:a=a.next=t}else i=a=t;n={baseState:r.baseState,firstBaseUpdate:i,lastBaseUpdate:a,shared:r.shared,callbacks:r.callbacks},e.updateQueue=n;return}e=n.lastBaseUpdate,e===null?n.firstBaseUpdate=t:e.next=t,n.lastBaseUpdate=t}var Ua=!1;function Wa(){if(Ua){var e=la;if(e!==null)throw e}}function Ga(e,t,n,r){Ua=!1;var i=e.updateQueue;Ia=!1;var a=i.firstBaseUpdate,o=i.lastBaseUpdate,s=i.shared.pending;if(s!==null){i.shared.pending=null;var c=s,l=c.next;c.next=null,o===null?a=l:o.next=l,o=c;var u=e.alternate;u!==null&&(u=u.updateQueue,s=u.lastBaseUpdate,s!==o&&(s===null?u.firstBaseUpdate=l:s.next=l,u.lastBaseUpdate=c))}if(a!==null){var d=i.baseState;o=0,u=l=c=null,s=a;do{var p=s.lane&-536870913,m=p!==s.lane;if(m?(K&p)===p:(r&p)===p){p!==0&&p===ca&&(Ua=!0),u!==null&&(u=u.next={lane:0,tag:s.tag,payload:s.payload,callback:null,next:null});a:{var h=e,g=s;p=t;var _=n;switch(g.tag){case 1:if(h=g.payload,typeof h==`function`){d=h.call(_,d,p);break a}d=h;break a;case 3:h.flags=h.flags&-65537|128;case 0:if(h=g.payload,p=typeof h==`function`?h.call(_,d,p):h,p==null)break a;d=f({},d,p);break a;case 2:Ia=!0}}p=s.callback,p!==null&&(e.flags|=64,m&&(e.flags|=8192),m=i.callbacks,m===null?i.callbacks=[p]:m.push(p))}else m={lane:p,tag:s.tag,payload:s.payload,callback:s.callback,next:null},u===null?(l=u=m,c=d):u=u.next=m,o|=p;if(s=s.next,s===null){if(s=i.shared.pending,s===null)break;m=s,s=m.next,m.next=null,i.lastBaseUpdate=m,i.shared.pending=null}}while(1);u===null&&(c=d),i.baseState=c,i.firstBaseUpdate=l,i.lastBaseUpdate=u,a===null&&(i.shared.lanes=0),Yl|=o,e.lanes=o,e.memoizedState=d}}function Ka(e,t){if(typeof e!=`function`)throw Error(i(191,e));e.call(t)}function qa(e,t){var n=e.callbacks;if(n!==null)for(e.callbacks=null,e=0;ea?a:8;var o=F.T,s={};F.T=s,Ns(e,!1,t,n);try{var c=i(),l=F.S;l!==null&&l(s,c),typeof c==`object`&&c&&typeof c.then==`function`?Ms(e,t,fa(c,r),_u(e)):Ms(e,t,r,_u(e))}catch(n){Ms(e,t,{then:function(){},status:`rejected`,reason:n},_u())}finally{I.p=a,o!==null&&s.types!==null&&(o.types=s.types),F.T=o}}function Ss(){}function Cs(e,t,n,r){if(e.tag!==5)throw Error(i(476));var a=ws(e).queue;xs(e,a,t,te,n===null?Ss:function(){return Ts(e),n(r)})}function ws(e){var t=e.memoizedState;if(t!==null)return t;t={memoizedState:te,baseState:te,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:Po,lastRenderedState:te},next:null};var n={};return t.next={memoizedState:n,baseState:n,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:Po,lastRenderedState:n},next:null},e.memoizedState=t,e=e.alternate,e!==null&&(e.memoizedState=t),t}function Ts(e){var t=ws(e);t.next===null&&(t=e.alternate.memoizedState),Ms(e,t.next.queue,{},_u())}function Es(){return Zi(ep)}function Ds(){return ko().memoizedState}function Os(){return ko().memoizedState}function ks(e){for(var t=e.return;t!==null;){switch(t.tag){case 24:case 3:var n=_u();e=za(n);var r=Ba(t,e,n);r!==null&&(yu(r,t,n),Va(r,t,n)),t={cache:ia()},e.payload=t;return}t=t.return}}function As(e,t,n){var r=_u();n={lane:r,revertLane:0,gesture:null,action:n,hasEagerState:!1,eagerState:null,next:null},Ps(e)?Fs(t,n):(n=Qr(e,t,n,r),n!==null&&(yu(n,e,r),Is(n,t,r)))}function js(e,t,n){Ms(e,t,n,_u())}function Ms(e,t,n,r){var i={lane:r,revertLane:0,gesture:null,action:n,hasEagerState:!1,eagerState:null,next:null};if(Ps(e))Fs(t,i);else{var a=e.alternate;if(e.lanes===0&&(a===null||a.lanes===0)&&(a=t.lastRenderedReducer,a!==null))try{var o=t.lastRenderedState,s=a(o,n);if(i.hasEagerState=!0,i.eagerState=s,vr(s,o))return Zr(e,t,i,0),Vl===null&&Xr(),!1}catch{}if(n=Qr(e,t,i,r),n!==null)return yu(n,e,r),Is(n,t,r),!0}return!1}function Ns(e,t,n,r){if(r={lane:2,revertLane:md(),gesture:null,action:r,hasEagerState:!1,eagerState:null,next:null},Ps(e)){if(t)throw Error(i(479))}else t=Qr(e,n,r,2),t!==null&&yu(t,e,2)}function Ps(e){var t=e.alternate;return e===W||t!==null&&t===W}function Fs(e,t){po=fo=!0;var n=e.pending;n===null?t.next=t:(t.next=n.next,n.next=t),e.pending=t}function Is(e,t,n){if(n&4194048){var r=t.lanes;r&=e.pendingLanes,n|=r,t.lanes=n,Xe(e,n)}}var Ls={readContext:Zi,use:Mo,useCallback:yo,useContext:yo,useEffect:yo,useImperativeHandle:yo,useLayoutEffect:yo,useInsertionEffect:yo,useMemo:yo,useReducer:yo,useRef:yo,useState:yo,useDebugValue:yo,useDeferredValue:yo,useTransition:yo,useSyncExternalStore:yo,useId:yo,useHostTransitionStatus:yo,useFormState:yo,useActionState:yo,useOptimistic:yo,useMemoCache:yo,useCacheRefresh:yo};Ls.useEffectEvent=yo;var Rs={readContext:Zi,use:Mo,useCallback:function(e,t){return Oo().memoizedState=[e,t===void 0?null:t],e},useContext:Zi,useEffect:cs,useImperativeHandle:function(e,t,n){n=n==null?null:n.concat([e]),os(4194308,4,ms.bind(null,t,e),n)},useLayoutEffect:function(e,t){return os(4194308,4,e,t)},useInsertionEffect:function(e,t){os(4,2,e,t)},useMemo:function(e,t){var n=Oo();t=t===void 0?null:t;var r=e();if(mo){Ne(!0);try{e()}finally{Ne(!1)}}return n.memoizedState=[r,t],r},useReducer:function(e,t,n){var r=Oo();if(n!==void 0){var i=n(t);if(mo){Ne(!0);try{n(t)}finally{Ne(!1)}}}else i=t;return r.memoizedState=r.baseState=i,e={pending:null,lanes:0,dispatch:null,lastRenderedReducer:e,lastRenderedState:i},r.queue=e,e=e.dispatch=As.bind(null,W,e),[r.memoizedState,e]},useRef:function(e){var t=Oo();return e={current:e},t.memoizedState=e},useState:function(e){e=Wo(e);var t=e.queue,n=js.bind(null,W,t);return t.dispatch=n,[e.memoizedState,n]},useDebugValue:gs,useDeferredValue:function(e,t){return ys(Oo(),e,t)},useTransition:function(){var e=Wo(!1);return e=xs.bind(null,W,e.queue,!0,!1),Oo().memoizedState=e,[!1,e]},useSyncExternalStore:function(e,t,n){var r=W,a=Oo();if(U){if(n===void 0)throw Error(i(407));n=n()}else{if(n=t(),Vl===null)throw Error(i(349));K&127||zo(r,t,n)}a.memoizedState=n;var o={value:n,getSnapshot:t};return a.queue=o,cs(Vo.bind(null,r,o,e),[e]),r.flags|=2048,is(9,{destroy:void 0},Bo.bind(null,r,o,n,t),null),n},useId:function(){var e=Oo(),t=Vl.identifierPrefix;if(U){var n=Ci,r=Si;n=(r&~(1<<32-Pe(r)-1)).toString(32)+n,t=`_`+t+`R_`+n,n=ho++,0<\/script>`,o=o.removeChild(o.firstChild);break;case`select`:o=typeof r.is==`string`?s.createElement(`select`,{is:r.is}):s.createElement(`select`),r.multiple?o.multiple=!0:r.size&&(o.size=r.size);break;default:o=typeof r.is==`string`?s.createElement(a,{is:r.is}):s.createElement(a)}}o[rt]=t,o[it]=r;a:for(s=t.child;s!==null;){if(s.tag===5||s.tag===6)o.appendChild(s.stateNode);else if(s.tag!==4&&s.tag!==27&&s.child!==null){s.child.return=s,s=s.child;continue}if(s===t)break a;for(;s.sibling===null;){if(s.return===null||s.return===t)break a;s=s.return}s.sibling.return=s.return,s=s.sibling}t.stateNode=o;a:switch(Z(o,a,r),a){case`button`:case`input`:case`select`:case`textarea`:r=!!r.autoFocus;break a;case`img`:r=!0;break a;default:r=!1}r&&Mc(t)}}return Lc(t),Nc(t,t.type,e===null?null:e.memoizedProps,t.pendingProps,n),null;case 6:if(e&&t.stateNode!=null)e.memoizedProps!==r&&Mc(t);else{if(typeof r!=`string`&&t.stateNode===null)throw Error(i(166));if(e=ae.current,Li(t)){if(e=t.stateNode,n=t.memoizedProps,r=null,a=ki,a!==null)switch(a.tag){case 27:case 5:r=a.memoizedProps}e[rt]=t,e=!!(e.nodeValue===n||r!==null&&!0===r.suppressHydrationWarning||Fd(e.nodeValue,n)),e||Pi(t,!0)}else e=Hd(e).createTextNode(r),e[rt]=t,t.stateNode=e}return Lc(t),null;case 31:if(n=t.memoizedState,e===null||e.memoizedState!==null){if(r=Li(t),n!==null){if(e===null){if(!r)throw Error(i(318));if(e=t.memoizedState,e=e===null?null:e.dehydrated,!e)throw Error(i(557));e[rt]=t}else Ri(),!(t.flags&128)&&(t.memoizedState=null),t.flags|=4;Lc(t),e=!1}else n=zi(),e!==null&&e.memoizedState!==null&&(e.memoizedState.hydrationErrors=n),e=!0;if(!e)return t.flags&256?(ao(t),t):(ao(t),null);if(t.flags&128)throw Error(i(558))}return Lc(t),null;case 13:if(r=t.memoizedState,e===null||e.memoizedState!==null&&e.memoizedState.dehydrated!==null){if(a=Li(t),r!==null&&r.dehydrated!==null){if(e===null){if(!a)throw Error(i(318));if(a=t.memoizedState,a=a===null?null:a.dehydrated,!a)throw Error(i(317));a[rt]=t}else Ri(),!(t.flags&128)&&(t.memoizedState=null),t.flags|=4;Lc(t),a=!1}else a=zi(),e!==null&&e.memoizedState!==null&&(e.memoizedState.hydrationErrors=a),a=!0;if(!a)return t.flags&256?(ao(t),t):(ao(t),null)}return ao(t),t.flags&128?(t.lanes=n,t):(n=r!==null,e=e!==null&&e.memoizedState!==null,n&&(r=t.child,a=null,r.alternate!==null&&r.alternate.memoizedState!==null&&r.alternate.memoizedState.cachePool!==null&&(a=r.alternate.memoizedState.cachePool.pool),o=null,r.memoizedState!==null&&r.memoizedState.cachePool!==null&&(o=r.memoizedState.cachePool.pool),o!==a&&(r.flags|=2048)),n!==e&&n&&(t.child.flags|=8192),Fc(t,t.updateQueue),Lc(t),null);case 4:return ce(),e===null&&Td(t.stateNode.containerInfo),Lc(t),null;case 10:return Gi(t.type),Lc(t),null;case 19:if(R(oo),r=t.memoizedState,r===null)return Lc(t),null;if(a=(t.flags&128)!=0,o=r.rendering,o===null)if(a)Ic(r,!1);else{if(Jl!==0||e!==null&&e.flags&128)for(e=t.child;e!==null;){if(o=so(e),o!==null){for(t.flags|=128,Ic(r,!1),e=o.updateQueue,t.updateQueue=e,Fc(t,e),t.subtreeFlags=0,e=n,n=t.child;n!==null;)si(n,e),n=n.sibling;return z(oo,oo.current&1|2),U&&wi(t,r.treeForkCount),t.child}e=e.sibling}r.tail!==null&&Ce()>au&&(t.flags|=128,a=!0,Ic(r,!1),t.lanes=4194304)}else{if(!a)if(e=so(o),e!==null){if(t.flags|=128,a=!0,e=e.updateQueue,t.updateQueue=e,Fc(t,e),Ic(r,!0),r.tail===null&&r.tailMode===`hidden`&&!o.alternate&&!U)return Lc(t),null}else 2*Ce()-r.renderingStartTime>au&&n!==536870912&&(t.flags|=128,a=!0,Ic(r,!1),t.lanes=4194304);r.isBackwards?(o.sibling=t.child,t.child=o):(e=r.last,e===null?t.child=o:e.sibling=o,r.last=o)}return r.tail===null?(Lc(t),null):(e=r.tail,r.rendering=e,r.tail=e.sibling,r.renderingStartTime=Ce(),e.sibling=null,n=oo.current,z(oo,a?n&1|2:n&1),U&&wi(t,r.treeForkCount),e);case 22:case 23:return ao(t),Qa(),r=t.memoizedState!==null,e===null?r&&(t.flags|=8192):e.memoizedState!==null!==r&&(t.flags|=8192),r?n&536870912&&!(t.flags&128)&&(Lc(t),t.subtreeFlags&6&&(t.flags|=8192)):Lc(t),n=t.updateQueue,n!==null&&Fc(t,n.retryQueue),n=null,e!==null&&e.memoizedState!==null&&e.memoizedState.cachePool!==null&&(n=e.memoizedState.cachePool.pool),r=null,t.memoizedState!==null&&t.memoizedState.cachePool!==null&&(r=t.memoizedState.cachePool.pool),r!==n&&(t.flags|=2048),e!==null&&R(ma),null;case 24:return n=null,e!==null&&(n=e.memoizedState.cache),t.memoizedState.cache!==n&&(t.flags|=2048),Gi(ra),Lc(t),null;case 25:return null;case 30:return null}throw Error(i(156,t.tag))}function zc(e,t){switch(Di(t),t.tag){case 1:return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 3:return Gi(ra),ce(),e=t.flags,e&65536&&!(e&128)?(t.flags=e&-65537|128,t):null;case 26:case 27:case 5:return ue(t),null;case 31:if(t.memoizedState!==null){if(ao(t),t.alternate===null)throw Error(i(340));Ri()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 13:if(ao(t),e=t.memoizedState,e!==null&&e.dehydrated!==null){if(t.alternate===null)throw Error(i(340));Ri()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 19:return R(oo),null;case 4:return ce(),null;case 10:return Gi(t.type),null;case 22:case 23:return ao(t),Qa(),e!==null&&R(ma),e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 24:return Gi(ra),null;case 25:return null;default:return null}}function Bc(e,t){switch(Di(t),t.tag){case 3:Gi(ra),ce();break;case 26:case 27:case 5:ue(t);break;case 4:ce();break;case 31:t.memoizedState!==null&&ao(t);break;case 13:ao(t);break;case 19:R(oo);break;case 10:Gi(t.type);break;case 22:case 23:ao(t),Qa(),e!==null&&R(ma);break;case 24:Gi(ra)}}function Vc(e,t){try{var n=t.updateQueue,r=n===null?null:n.lastEffect;if(r!==null){var i=r.next;n=i;do{if((n.tag&e)===e){r=void 0;var a=n.create,o=n.inst;r=a(),o.destroy=r}n=n.next}while(n!==i)}}catch(e){qu(t,t.return,e)}}function Hc(e,t,n){try{var r=t.updateQueue,i=r===null?null:r.lastEffect;if(i!==null){var a=i.next;r=a;do{if((r.tag&e)===e){var o=r.inst,s=o.destroy;if(s!==void 0){o.destroy=void 0,i=t;var c=n,l=s;try{l()}catch(e){qu(i,c,e)}}}r=r.next}while(r!==a)}}catch(e){qu(t,t.return,e)}}function Uc(e){var t=e.updateQueue;if(t!==null){var n=e.stateNode;try{qa(t,n)}catch(t){qu(e,e.return,t)}}}function Wc(e,t,n){n.props=Gs(e.type,e.memoizedProps),n.state=e.memoizedState;try{n.componentWillUnmount()}catch(n){qu(e,t,n)}}function Gc(e,t){try{var n=e.ref;if(n!==null){switch(e.tag){case 26:case 27:case 5:var r=e.stateNode;break;case 30:r=e.stateNode;break;default:r=e.stateNode}typeof n==`function`?e.refCleanup=n(r):n.current=r}}catch(n){qu(e,t,n)}}function Kc(e,t){var n=e.ref,r=e.refCleanup;if(n!==null)if(typeof r==`function`)try{r()}catch(n){qu(e,t,n)}finally{e.refCleanup=null,e=e.alternate,e!=null&&(e.refCleanup=null)}else if(typeof n==`function`)try{n(null)}catch(n){qu(e,t,n)}else n.current=null}function qc(e){var t=e.type,n=e.memoizedProps,r=e.stateNode;try{a:switch(t){case`button`:case`input`:case`select`:case`textarea`:n.autoFocus&&r.focus();break a;case`img`:n.src?r.src=n.src:n.srcSet&&(r.srcset=n.srcSet)}}catch(t){qu(e,e.return,t)}}function Jc(e,t,n){try{var r=e.stateNode;Ld(r,e.type,n,t),r[it]=t}catch(t){qu(e,e.return,t)}}function Yc(e){return e.tag===5||e.tag===3||e.tag===26||e.tag===27&&$d(e.type)||e.tag===4}function Xc(e){a:for(;;){for(;e.sibling===null;){if(e.return===null||Yc(e.return))return null;e=e.return}for(e.sibling.return=e.return,e=e.sibling;e.tag!==5&&e.tag!==6&&e.tag!==18;){if(e.tag===27&&$d(e.type)||e.flags&2||e.child===null||e.tag===4)continue a;e.child.return=e,e=e.child}if(!(e.flags&2))return e.stateNode}}function Zc(e,t,n){var r=e.tag;if(r===5||r===6)e=e.stateNode,t?(n.nodeType===9?n.body:n.nodeName===`HTML`?n.ownerDocument.body:n).insertBefore(e,t):(t=n.nodeType===9?n.body:n.nodeName===`HTML`?n.ownerDocument.body:n,t.appendChild(e),n=n._reactRootContainer,n!=null||t.onclick!==null||(t.onclick=Yt));else if(r!==4&&(r===27&&$d(e.type)&&(n=e.stateNode,t=null),e=e.child,e!==null))for(Zc(e,t,n),e=e.sibling;e!==null;)Zc(e,t,n),e=e.sibling}function Qc(e,t,n){var r=e.tag;if(r===5||r===6)e=e.stateNode,t?n.insertBefore(e,t):n.appendChild(e);else if(r!==4&&(r===27&&$d(e.type)&&(n=e.stateNode),e=e.child,e!==null))for(Qc(e,t,n),e=e.sibling;e!==null;)Qc(e,t,n),e=e.sibling}function $c(e){var t=e.stateNode,n=e.memoizedProps;try{for(var r=e.type,i=t.attributes;i.length;)t.removeAttributeNode(i[0]);Z(t,r,n),t[rt]=e,t[it]=n}catch(t){qu(e,e.return,t)}}var el=!1,tl=!1,nl=!1,rl=typeof WeakSet==`function`?WeakSet:Set,il=null;function al(e,t){if(e=e.containerInfo,Bd=lp,e=Cr(e),wr(e)){if(`selectionStart`in e)var n={start:e.selectionStart,end:e.selectionEnd};else a:{n=(n=e.ownerDocument)&&n.defaultView||window;var r=n.getSelection&&n.getSelection();if(r&&r.rangeCount!==0){n=r.anchorNode;var a=r.anchorOffset,o=r.focusNode;r=r.focusOffset;try{n.nodeType,o.nodeType}catch{n=null;break a}var s=0,c=-1,l=-1,u=0,d=0,f=e,p=null;b:for(;;){for(var m;f!==n||a!==0&&f.nodeType!==3||(c=s+a),f!==o||r!==0&&f.nodeType!==3||(l=s+r),f.nodeType===3&&(s+=f.nodeValue.length),(m=f.firstChild)!==null;)p=f,f=m;for(;;){if(f===e)break b;if(p===n&&++u===a&&(c=s),p===o&&++d===r&&(l=s),(m=f.nextSibling)!==null)break;f=p,p=f.parentNode}f=m}n=c===-1||l===-1?null:{start:c,end:l}}else n=null}n||={start:0,end:0}}else n=null;for(Vd={focusedElem:e,selectionRange:n},lp=!1,il=t;il!==null;)if(t=il,e=t.child,t.subtreeFlags&1028&&e!==null)e.return=t,il=e;else for(;il!==null;){switch(t=il,o=t.alternate,e=t.flags,t.tag){case 0:if(e&4&&(e=t.updateQueue,e=e===null?null:e.events,e!==null))for(n=0;n title`))),Z(o,r,n),o[rt]=e,ht(o),r=o;break a;case`link`:var s=Uf(`link`,`href`,a).get(r+(n.href||``));if(s){for(var c=0;cg&&(o=g,g=h,h=o);var _=xr(s,h),v=xr(s,g);if(_&&v&&(p.rangeCount!==1||p.anchorNode!==_.node||p.anchorOffset!==_.offset||p.focusNode!==v.node||p.focusOffset!==v.offset)){var y=d.createRange();y.setStart(_.node,_.offset),p.removeAllRanges(),h>g?(p.addRange(y),p.extend(v.node,v.offset)):(y.setEnd(v.node,v.offset),p.addRange(y))}}}}for(d=[],p=s;p=p.parentNode;)p.nodeType===1&&d.push({element:p,left:p.scrollLeft,top:p.scrollTop});for(typeof s.focus==`function`&&s.focus(),s=0;sn?32:n,F.T=null,n=pu,pu=null;var o=lu,s=du;if(cu=0,uu=lu=null,du=0,Bl&6)throw Error(i(331));var c=Bl;if(Bl|=4,Fl(o.current),Dl(o,o.current,s,n),Bl=c,sd(0,!1),Me&&typeof Me.onPostCommitFiberRoot==`function`)try{Me.onPostCommitFiberRoot(V,o)}catch{}return!0}finally{I.p=a,F.T=r,Gu(e,t)}}function J(e,t,n){t=mi(n,t),t=Zs(e.stateNode,t,2),e=Ba(e,t,2),e!==null&&(qe(e,2),od(e))}function qu(e,t,n){if(e.tag===3)J(e,e,n);else for(;t!==null;){if(t.tag===3){J(t,e,n);break}else if(t.tag===1){var r=t.stateNode;if(typeof t.type.getDerivedStateFromError==`function`||typeof r.componentDidCatch==`function`&&(su===null||!su.has(r))){e=mi(n,e),n=Qs(2),r=Ba(t,n,2),r!==null&&($s(n,r,t,e),qe(r,2),od(r));break}}t=t.return}}function Ju(e,t,n){var r=e.pingCache;if(r===null){r=e.pingCache=new zl;var i=new Set;r.set(t,i)}else i=r.get(t),i===void 0&&(i=new Set,r.set(t,i));i.has(n)||(Kl=!0,i.add(n),e=Yu.bind(null,e,t,n),t.then(e,e))}function Yu(e,t,n){var r=e.pingCache;r!==null&&r.delete(t),e.pingedLanes|=e.suspendedLanes&n,e.warmLanes&=~n,Vl===e&&(K&n)===n&&(Jl===4||Jl===3&&(K&62914560)===K&&300>Ce()-ru?!(Bl&2)&&Eu(e,0):Zl|=n,$l===K&&($l=0)),od(e)}function Xu(e,t){t===0&&(t=Ge()),e=$r(e,t),e!==null&&(qe(e,t),od(e))}function Zu(e){var t=e.memoizedState,n=0;t!==null&&(n=t.retryLane),Xu(e,n)}function Qu(e,t){var n=0;switch(e.tag){case 31:case 13:var r=e.stateNode,a=e.memoizedState;a!==null&&(n=a.retryLane);break;case 19:r=e.stateNode;break;case 22:r=e.stateNode._retryCache;break;default:throw Error(i(314))}r!==null&&r.delete(t),Xu(e,n)}function $u(e,t){return ye(e,t)}var ed=null,td=null,nd=!1,rd=!1,id=!1,ad=0;function od(e){e!==td&&e.next===null&&(td===null?ed=td=e:td=td.next=e),rd=!0,nd||(nd=!0,pd())}function sd(e,t){if(!id&&rd){id=!0;do for(var n=!1,r=ed;r!==null;){if(!t)if(e!==0){var i=r.pendingLanes;if(i===0)var a=0;else{var o=r.suspendedLanes,s=r.pingedLanes;a=(1<<31-Pe(42|e)+1)-1,a&=i&~(o&~s),a=a&201326741?a&201326741|1:a?a|2:0}a!==0&&(n=!0,fd(r,a))}else a=K,a=He(r,r===Vl?a:0,r.cancelPendingCommit!==null||r.timeoutHandle!==-1),!(a&3)||Ue(r,a)||(n=!0,fd(r,a));r=r.next}while(n);id=!1}}function cd(){ld()}function ld(){rd=nd=!1;var e=0;ad!==0&&qd()&&(e=ad);for(var t=Ce(),n=null,r=ed;r!==null;){var i=r.next,a=ud(r,t);a===0?(r.next=null,n===null?ed=i:n.next=i,i===null&&(td=n)):(n=r,(e!==0||a&3)&&(rd=!0)),r=i}cu!==0&&cu!==5||sd(e,!1),ad!==0&&(ad=0)}function ud(e,t){for(var n=e.suspendedLanes,r=e.pingedLanes,i=e.expirationTimes,a=e.pendingLanes&-62914561;0s)break;var u=c.transferSize,d=c.initiatorType;u&&Rd(d)&&(c=c.responseEnd,o+=u*(c`u`?null:document;function Cf(e,t,n){var r=Sf;if(r&&typeof t==`string`&&t){var i=Pt(t);i=`link[rel="`+e+`"][href="`+i+`"]`,typeof n==`string`&&(i+=`[crossorigin="`+n+`"]`),_f.has(i)||(_f.add(i),e={rel:e,crossOrigin:n,href:t},r.querySelector(i)===null&&(t=r.createElement(`link`),Z(t,`link`,e),ht(t),r.head.appendChild(t)))}}function wf(e){yf.D(e),Cf(`dns-prefetch`,e,null)}function Tf(e,t){yf.C(e,t),Cf(`preconnect`,e,t)}function Ef(e,t,n){yf.L(e,t,n);var r=Sf;if(r&&e&&t){var i=`link[rel="preload"][as="`+Pt(t)+`"]`;t===`image`&&n&&n.imageSrcSet?(i+=`[imagesrcset="`+Pt(n.imageSrcSet)+`"]`,typeof n.imageSizes==`string`&&(i+=`[imagesizes="`+Pt(n.imageSizes)+`"]`)):i+=`[href="`+Pt(e)+`"]`;var a=i;switch(t){case`style`:a=Mf(e);break;case`script`:a=If(e)}gf.has(a)||(e=f({rel:`preload`,href:t===`image`&&n&&n.imageSrcSet?void 0:e,as:t},n),gf.set(a,e),r.querySelector(i)!==null||t===`style`&&r.querySelector(Nf(a))||t===`script`&&r.querySelector(Lf(a))||(t=r.createElement(`link`),Z(t,`link`,e),ht(t),r.head.appendChild(t)))}}function Df(e,t){yf.m(e,t);var n=Sf;if(n&&e){var r=t&&typeof t.as==`string`?t.as:`script`,i=`link[rel="modulepreload"][as="`+Pt(r)+`"][href="`+Pt(e)+`"]`,a=i;switch(r){case`audioworklet`:case`paintworklet`:case`serviceworker`:case`sharedworker`:case`worker`:case`script`:a=If(e)}if(!gf.has(a)&&(e=f({rel:`modulepreload`,href:e},t),gf.set(a,e),n.querySelector(i)===null)){switch(r){case`audioworklet`:case`paintworklet`:case`serviceworker`:case`sharedworker`:case`worker`:case`script`:if(n.querySelector(Lf(a)))return}r=n.createElement(`link`),Z(r,`link`,e),ht(r),n.head.appendChild(r)}}}function Of(e,t,n){yf.S(e,t,n);var r=Sf;if(r&&e){var i=mt(r).hoistableStyles,a=Mf(e);t||=`default`;var o=i.get(a);if(!o){var s={loading:0,preload:null};if(o=r.querySelector(Nf(a)))s.loading=5;else{e=f({rel:`stylesheet`,href:e,"data-precedence":t},n),(n=gf.get(a))&&Bf(e,n);var c=o=r.createElement(`link`);ht(c),Z(c,`link`,e),c._p=new Promise(function(e,t){c.onload=e,c.onerror=t}),c.addEventListener(`load`,function(){s.loading|=1}),c.addEventListener(`error`,function(){s.loading|=2}),s.loading|=4,zf(o,t,r)}o={type:`stylesheet`,instance:o,count:1,state:s},i.set(a,o)}}}function kf(e,t){yf.X(e,t);var n=Sf;if(n&&e){var r=mt(n).hoistableScripts,i=If(e),a=r.get(i);a||(a=n.querySelector(Lf(i)),a||(e=f({src:e,async:!0},t),(t=gf.get(i))&&Vf(e,t),a=n.createElement(`script`),ht(a),Z(a,`link`,e),n.head.appendChild(a)),a={type:`script`,instance:a,count:1,state:null},r.set(i,a))}}function Af(e,t){yf.M(e,t);var n=Sf;if(n&&e){var r=mt(n).hoistableScripts,i=If(e),a=r.get(i);a||(a=n.querySelector(Lf(i)),a||(e=f({src:e,async:!0,type:`module`},t),(t=gf.get(i))&&Vf(e,t),a=n.createElement(`script`),ht(a),Z(a,`link`,e),n.head.appendChild(a)),a={type:`script`,instance:a,count:1,state:null},r.set(i,a))}}function jf(e,t,n,r){var a=(a=ae.current)?vf(a):null;if(!a)throw Error(i(446));switch(e){case`meta`:case`title`:return null;case`style`:return typeof n.precedence==`string`&&typeof n.href==`string`?(t=Mf(n.href),n=mt(a).hoistableStyles,r=n.get(t),r||(r={type:`style`,instance:null,count:0,state:null},n.set(t,r)),r):{type:`void`,instance:null,count:0,state:null};case`link`:if(n.rel===`stylesheet`&&typeof n.href==`string`&&typeof n.precedence==`string`){e=Mf(n.href);var o=mt(a).hoistableStyles,s=o.get(e);if(s||(a=a.ownerDocument||a,s={type:`stylesheet`,instance:null,count:0,state:{loading:0,preload:null}},o.set(e,s),(o=a.querySelector(Nf(e)))&&!o._p&&(s.instance=o,s.state.loading=5),gf.has(e)||(n={rel:`preload`,as:`style`,href:n.href,crossOrigin:n.crossOrigin,integrity:n.integrity,media:n.media,hrefLang:n.hrefLang,referrerPolicy:n.referrerPolicy},gf.set(e,n),o||Ff(a,e,n,s.state))),t&&r===null)throw Error(i(528,``));return s}if(t&&r!==null)throw Error(i(529,``));return null;case`script`:return t=n.async,n=n.src,typeof n==`string`&&t&&typeof t!=`function`&&typeof t!=`symbol`?(t=If(n),n=mt(a).hoistableScripts,r=n.get(t),r||(r={type:`script`,instance:null,count:0,state:null},n.set(t,r)),r):{type:`void`,instance:null,count:0,state:null};default:throw Error(i(444,e))}}function Mf(e){return`href="`+Pt(e)+`"`}function Nf(e){return`link[rel="stylesheet"][`+e+`]`}function Pf(e){return f({},e,{"data-precedence":e.precedence,precedence:null})}function Ff(e,t,n,r){e.querySelector(`link[rel="preload"][as="style"][`+t+`]`)?r.loading=1:(t=e.createElement(`link`),r.preload=t,t.addEventListener(`load`,function(){return r.loading|=1}),t.addEventListener(`error`,function(){return r.loading|=2}),Z(t,`link`,n),ht(t),e.head.appendChild(t))}function If(e){return`[src="`+Pt(e)+`"]`}function Lf(e){return`script[async]`+e}function Rf(e,t,n){if(t.count++,t.instance===null)switch(t.type){case`style`:var r=e.querySelector(`style[data-href~="`+Pt(n.href)+`"]`);if(r)return t.instance=r,ht(r),r;var a=f({},n,{"data-href":n.href,"data-precedence":n.precedence,href:null,precedence:null});return r=(e.ownerDocument||e).createElement(`style`),ht(r),Z(r,`style`,a),zf(r,n.precedence,e),t.instance=r;case`stylesheet`:a=Mf(n.href);var o=e.querySelector(Nf(a));if(o)return t.state.loading|=4,t.instance=o,ht(o),o;r=Pf(n),(a=gf.get(a))&&Bf(r,a),o=(e.ownerDocument||e).createElement(`link`),ht(o);var s=o;return s._p=new Promise(function(e,t){s.onload=e,s.onerror=t}),Z(o,`link`,r),t.state.loading|=4,zf(o,n.precedence,e),t.instance=o;case`script`:return o=If(n.src),(a=e.querySelector(Lf(o)))?(t.instance=a,ht(a),a):(r=n,(a=gf.get(o))&&(r=f({},n),Vf(r,a)),e=e.ownerDocument||e,a=e.createElement(`script`),ht(a),Z(a,`link`,r),e.head.appendChild(a),t.instance=a);case`void`:return null;default:throw Error(i(443,t.type))}else t.type===`stylesheet`&&!(t.state.loading&4)&&(r=t.instance,t.state.loading|=4,zf(r,n.precedence,e));return t.instance}function zf(e,t,n){for(var r=n.querySelectorAll(`link[rel="stylesheet"][data-precedence],style[data-precedence]`),i=r.length?r[r.length-1]:null,a=i,o=0;o title`):null)}function Gf(e,t,n){if(n===1||t.itemProp!=null)return!1;switch(e){case`meta`:case`title`:return!0;case`style`:if(typeof t.precedence!=`string`||typeof t.href!=`string`||t.href===``)break;return!0;case`link`:if(typeof t.rel!=`string`||typeof t.href!=`string`||t.href===``||t.onLoad||t.onError)break;switch(t.rel){case`stylesheet`:return e=t.disabled,typeof t.precedence==`string`&&e==null;default:return!0}case`script`:if(t.async&&typeof t.async!=`function`&&typeof t.async!=`symbol`&&!t.onLoad&&!t.onError&&t.src&&typeof t.src==`string`)return!0}return!1}function Kf(e){return!(e.type===`stylesheet`&&!(e.state.loading&3))}function qf(e,t,n,r){if(n.type===`stylesheet`&&(typeof r.media!=`string`||!1!==matchMedia(r.media).matches)&&!(n.state.loading&4)){if(n.instance===null){var i=Mf(r.href),a=t.querySelector(Nf(i));if(a){t=a._p,typeof t==`object`&&t&&typeof t.then==`function`&&(e.count++,e=Xf.bind(e),t.then(e,e)),n.state.loading|=4,n.instance=a,ht(a);return}a=t.ownerDocument||t,r=Pf(r),(i=gf.get(i))&&Bf(r,i),a=a.createElement(`link`),ht(a);var o=a;o._p=new Promise(function(e,t){o.onload=e,o.onerror=t}),Z(a,`link`,r),n.instance=a}e.stylesheets===null&&(e.stylesheets=new Map),e.stylesheets.set(n,t),(t=n.state.preload)&&!(n.state.loading&3)&&(e.count++,n=Xf.bind(e),t.addEventListener(`load`,n),t.addEventListener(`error`,n))}}var Jf=0;function Yf(e,t){return e.stylesheets&&e.count===0&&Qf(e,e.stylesheets),0Jf?50:800)+t);return e.unsuspend=n,function(){e.unsuspend=null,clearTimeout(r),clearTimeout(i)}}:null}function Xf(){if(this.count--,this.count===0&&(this.imgCount===0||!this.waitingForImages)){if(this.stylesheets)Qf(this,this.stylesheets);else if(this.unsuspend){var e=this.unsuspend;this.unsuspend=null,e()}}}var Zf=null;function Qf(e,t){e.stylesheets=null,e.unsuspend!==null&&(e.count++,Zf=new Map,t.forEach($f,e),Zf=null,Xf.call(e))}function $f(e,t){if(!(t.state.loading&4)){var n=Zf.get(e);if(n)var r=n.get(null);else{n=new Map,Zf.set(e,n);for(var i=e.querySelectorAll(`link[data-precedence],style[data-precedence]`),a=0;a{function n(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>`u`||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!=`function`))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(n)}catch(e){console.error(e)}}n(),t.exports=v()})),b=u(p(),1),x=u(y(),1),S={mono:`'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, monospace`,bg:`#eef3fa`,surface:`#ffffff`,surfaceAlt:`#f8fafc`,border:`#e2e8f0`,borderSoft:`#eef1f5`,ink:`#0f172a`,ink2:`#334155`,ink3:`#64748b`,ink4:`#94a3b8`,blue:`#2563eb`,blueDeep:`#1d4ed8`,blueSoft:`#eff4ff`,cyan:`#06b6d4`,indigo:`#6366f1`,teal:`#14b8a6`,violet:`#8b5cf6`,green:`#10b981`,greenSoft:`#ecfdf5`,amber:`#f59e0b`,amberSoft:`#fffbeb`,red:`#ef4444`,redSoft:`#fef2f2`,slate:`#475569`,windowBg:`#ffffff`,titleBar:`#f8fafc`,space:[0,4,8,12,16,20,24,32,40,48],radius:{xs:4,sm:6,md:8,lg:10,xl:14,pill:999},shadow:{sm:`0 1px 2px rgba(15,23,42,0.08), 0 0 0 1px rgba(15,23,42,0.04)`,md:`0 8px 24px -12px rgba(15,23,42,0.22), 0 0 0 1px rgba(15,23,42,0.06)`,lg:`0 16px 42px -18px rgba(15,23,42,0.28), 0 0 0 1px rgba(15,23,42,0.07)`,xl:`0 24px 60px -12px rgba(15,23,42,0.32), 0 0 0 1px rgba(15,23,42,0.08)`},type:{display:{fontSize:28,lineHeight:1.12,fontWeight:800,letterSpacing:`-0.015em`},title:{fontSize:22,lineHeight:1.18,fontWeight:750,letterSpacing:`-0.015em`},heading:{fontSize:17,lineHeight:1.25,fontWeight:700,letterSpacing:`-0.01em`},body:{fontSize:13,lineHeight:1.5,fontWeight:400,letterSpacing:0},caption:{fontSize:11.5,lineHeight:1.35,fontWeight:500,letterSpacing:0},label:{fontSize:10.5,lineHeight:1.25,fontWeight:700,letterSpacing:`0.06em`,textTransform:`uppercase`}},ease:`cubic-bezier(0.2,0.7,0.2,1)`,duration:{press:`0.1s`,hover:`0.15s`,fade:`0.2s`}},C=s((e=>{var t=Symbol.for(`react.transitional.element`),n=Symbol.for(`react.fragment`);function r(e,n,r){var i=null;if(r!==void 0&&(i=``+r),n.key!==void 0&&(i=``+n.key),`key`in n)for(var a in r={},n)a!==`key`&&(r[a]=n[a]);else r=n;return n=r.ref,{$$typeof:t,type:e,key:i,ref:n===void 0?null:n,props:r}}e.Fragment=n,e.jsx=r,e.jsxs=r})),w=s(((e,t)=>{t.exports=C()}))(),T=({children:e,size:t=18,stroke:n=1.7,style:r,fill:i=`none`})=>(0,w.jsx)(`svg`,{width:t,height:t,viewBox:`0 0 24 24`,fill:i,stroke:`currentColor`,strokeWidth:n,strokeLinecap:`round`,strokeLinejoin:`round`,style:r,children:e}),E={dashboard:e=>(0,w.jsxs)(T,{...e,children:[(0,w.jsx)(`rect`,{x:`3`,y:`3`,width:`7`,height:`9`,rx:`1.5`}),(0,w.jsx)(`rect`,{x:`14`,y:`3`,width:`7`,height:`5`,rx:`1.5`}),(0,w.jsx)(`rect`,{x:`14`,y:`12`,width:`7`,height:`9`,rx:`1.5`}),(0,w.jsx)(`rect`,{x:`3`,y:`16`,width:`7`,height:`5`,rx:`1.5`})]}),bell:e=>(0,w.jsxs)(T,{...e,children:[(0,w.jsx)(`path`,{d:`M6 8a6 6 0 0 1 12 0c0 7 3 9 3 9H3s3-2 3-9`}),(0,w.jsx)(`path`,{d:`M10 21a2 2 0 0 0 4 0`})]}),wrench:e=>(0,w.jsxs)(T,{...e,children:[(0,w.jsx)(`path`,{d:`M14.7 6.3a4 4 0 0 0 5 5L21 13l-8 8a3 3 0 0 1-4.2-4.2l8-8z`}),(0,w.jsx)(`path`,{d:`m6 14-3 3a2 2 0 1 0 2.8 2.8L9 17`})]}),gear:e=>(0,w.jsxs)(T,{...e,children:[(0,w.jsx)(`circle`,{cx:`12`,cy:`12`,r:`3`}),(0,w.jsx)(`path`,{d:`M19.4 15a1.7 1.7 0 0 0 .3 1.8l.1.1a2 2 0 1 1-2.8 2.8l-.1-.1a1.7 1.7 0 0 0-1.8-.3 1.7 1.7 0 0 0-1 1.5V21a2 2 0 1 1-4 0v-.1a1.7 1.7 0 0 0-1.1-1.5 1.7 1.7 0 0 0-1.8.3l-.1.1a2 2 0 1 1-2.8-2.8l.1-.1a1.7 1.7 0 0 0 .3-1.8 1.7 1.7 0 0 0-1.5-1H3a2 2 0 1 1 0-4h.1A1.7 1.7 0 0 0 4.6 9a1.7 1.7 0 0 0-.3-1.8l-.1-.1a2 2 0 1 1 2.8-2.8l.1.1a1.7 1.7 0 0 0 1.8.3H9a1.7 1.7 0 0 0 1-1.5V3a2 2 0 1 1 4 0v.1a1.7 1.7 0 0 0 1 1.5 1.7 1.7 0 0 0 1.8-.3l.1-.1a2 2 0 1 1 2.8 2.8l-.1.1a1.7 1.7 0 0 0-.3 1.8V9c.3.6.9 1 1.5 1H21a2 2 0 1 1 0 4h-.1a1.7 1.7 0 0 0-1.5 1Z`})]}),lock:e=>(0,w.jsxs)(T,{...e,children:[(0,w.jsx)(`rect`,{x:`4`,y:`11`,width:`16`,height:`10`,rx:`2`}),(0,w.jsx)(`path`,{d:`M8 11V7a4 4 0 0 1 8 0v4`})]}),shield:e=>(0,w.jsx)(T,{...e,children:(0,w.jsx)(`path`,{d:`M12 22s8-4 8-10V5l-8-3-8 3v7c0 6 8 10 8 10Z`})}),apps:e=>(0,w.jsxs)(T,{...e,children:[(0,w.jsx)(`rect`,{x:`3`,y:`3`,width:`7`,height:`7`,rx:`1.5`}),(0,w.jsx)(`rect`,{x:`14`,y:`3`,width:`7`,height:`7`,rx:`1.5`}),(0,w.jsx)(`rect`,{x:`3`,y:`14`,width:`7`,height:`7`,rx:`1.5`}),(0,w.jsx)(`rect`,{x:`14`,y:`14`,width:`7`,height:`7`,rx:`1.5`})]}),home:e=>(0,w.jsx)(T,{...e,children:(0,w.jsx)(`path`,{d:`m3 11 9-8 9 8v9a2 2 0 0 1-2 2h-4v-7h-6v7H5a2 2 0 0 1-2-2Z`})}),eye:e=>(0,w.jsxs)(T,{...e,children:[(0,w.jsx)(`path`,{d:`M2 12s4-7 10-7 10 7 10 7-4 7-10 7S2 12 2 12Z`}),(0,w.jsx)(`circle`,{cx:`12`,cy:`12`,r:`3`})]}),ruler:e=>(0,w.jsxs)(T,{...e,children:[(0,w.jsx)(`path`,{d:`M21.3 7.9 16.1 2.7a1.4 1.4 0 0 0-2 0L2.7 14.1a1.4 1.4 0 0 0 0 2l5.2 5.2a1.4 1.4 0 0 0 2 0L21.3 9.9a1.4 1.4 0 0 0 0-2Z`}),(0,w.jsx)(`path`,{d:`m7.5 10.5 2 2`}),(0,w.jsx)(`path`,{d:`m10.5 7.5 2 2`}),(0,w.jsx)(`path`,{d:`m13.5 4.5 2 2`}),(0,w.jsx)(`path`,{d:`m4.5 13.5 2 2`})]}),database:e=>(0,w.jsxs)(T,{...e,children:[(0,w.jsx)(`ellipse`,{cx:`12`,cy:`5`,rx:`9`,ry:`3`}),(0,w.jsx)(`path`,{d:`M3 5v6c0 1.7 4 3 9 3s9-1.3 9-3V5`}),(0,w.jsx)(`path`,{d:`M3 11v6c0 1.7 4 3 9 3s9-1.3 9-3v-6`})]}),zap:e=>(0,w.jsx)(T,{...e,children:(0,w.jsx)(`path`,{d:`M13 2 3 14h7l-1 8 10-12h-7l1-8Z`})}),code:e=>(0,w.jsxs)(T,{...e,children:[(0,w.jsx)(`path`,{d:`m8 6-6 6 6 6`}),(0,w.jsx)(`path`,{d:`m16 6 6 6-6 6`}),(0,w.jsx)(`path`,{d:`m14 4-4 16`})]}),jupyter:e=>(0,w.jsxs)(T,{...e,children:[(0,w.jsx)(`circle`,{cx:`8`,cy:`6`,r:`1.4`,fill:`currentColor`}),(0,w.jsx)(`circle`,{cx:`16`,cy:`18`,r:`1.4`,fill:`currentColor`}),(0,w.jsx)(`path`,{d:`M5 9c2 4 6 7 11 7`}),(0,w.jsx)(`path`,{d:`M19 15c-2-4-6-7-11-7`})]}),vllm:e=>(0,w.jsxs)(T,{...e,children:[(0,w.jsx)(`path`,{d:`M5 4v8a7 7 0 1 0 14 0V4`}),(0,w.jsx)(`path`,{d:`M9 4v6a3 3 0 0 0 6 0V4`})]}),comfy:e=>(0,w.jsxs)(T,{...e,children:[(0,w.jsx)(`rect`,{x:`3`,y:`3`,width:`6`,height:`5`,rx:`1`}),(0,w.jsx)(`rect`,{x:`15`,y:`3`,width:`6`,height:`5`,rx:`1`}),(0,w.jsx)(`rect`,{x:`9`,y:`16`,width:`6`,height:`5`,rx:`1`}),(0,w.jsx)(`path`,{d:`M9 5.5h6`}),(0,w.jsx)(`path`,{d:`M6 8v5l6 3`}),(0,w.jsx)(`path`,{d:`M18 8v5l-6 3`})]}),palette:e=>(0,w.jsxs)(T,{...e,children:[(0,w.jsx)(`circle`,{cx:`12`,cy:`12`,r:`9`}),(0,w.jsx)(`circle`,{cx:`7`,cy:`11`,r:`1.2`,fill:`currentColor`}),(0,w.jsx)(`circle`,{cx:`11`,cy:`7`,r:`1.2`,fill:`currentColor`}),(0,w.jsx)(`circle`,{cx:`16`,cy:`9`,r:`1.2`,fill:`currentColor`}),(0,w.jsx)(`path`,{d:`M12 21a3 3 0 0 1 0-6 2 2 0 0 0 2-2 3 3 0 0 1 3-3`})]}),folder:e=>(0,w.jsx)(T,{...e,children:(0,w.jsx)(`path`,{d:`M3 7a2 2 0 0 1 2-2h4l2 2h8a2 2 0 0 1 2 2v9a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2Z`})}),port:e=>(0,w.jsxs)(T,{...e,children:[(0,w.jsx)(`rect`,{x:`3`,y:`9`,width:`18`,height:`10`,rx:`2`}),(0,w.jsx)(`circle`,{cx:`7`,cy:`14`,r:`0.8`,fill:`currentColor`}),(0,w.jsx)(`circle`,{cx:`11`,cy:`14`,r:`0.8`,fill:`currentColor`}),(0,w.jsx)(`circle`,{cx:`15`,cy:`14`,r:`0.8`,fill:`currentColor`}),(0,w.jsx)(`path`,{d:`M8 9V5h8v4`})]}),brain:e=>(0,w.jsxs)(T,{...e,children:[(0,w.jsx)(`path`,{d:`M8 4a3 3 0 0 0-3 3 3 3 0 0 0-2 3 3 3 0 0 0 1 2 3 3 0 0 0 1 4 3 3 0 0 0 5 2c1 0 2-1 2-2`}),(0,w.jsx)(`path`,{d:`M16 4a3 3 0 0 1 3 3 3 3 0 0 1 2 3 3 3 0 0 1-1 2 3 3 0 0 1-1 4 3 3 0 0 1-5 2c-1 0-2-1-2-2`}),(0,w.jsx)(`path`,{d:`M12 4v14`})]}),maxkb:e=>(0,w.jsxs)(T,{...e,children:[(0,w.jsx)(`path`,{d:`M4 4v15a2 2 0 0 0 2 2h13`}),(0,w.jsx)(`path`,{d:`M8 7h10`}),(0,w.jsx)(`path`,{d:`M8 11h6`}),(0,w.jsx)(`rect`,{x:`13`,y:`13`,width:`8`,height:`6`,rx:`1.5`}),(0,w.jsx)(`path`,{d:`m15.5 15.5 1.5 1.5 2-2`})]}),ollama:e=>(0,w.jsxs)(T,{...e,children:[(0,w.jsx)(`path`,{d:`M12 3a6 6 0 0 0-6 6c0 2 1 3 1 5v3a2 2 0 0 0 2 2h6a2 2 0 0 0 2-2v-3c0-2 1-3 1-5a6 6 0 0 0-6-6Z`}),(0,w.jsx)(`circle`,{cx:`10`,cy:`10`,r:`0.6`,fill:`currentColor`}),(0,w.jsx)(`circle`,{cx:`14`,cy:`10`,r:`0.6`,fill:`currentColor`}),(0,w.jsx)(`path`,{d:`M10 16h4`})]}),openclaw:e=>(0,w.jsxs)(T,{...e,children:[(0,w.jsx)(`circle`,{cx:`12`,cy:`9`,r:`4`}),(0,w.jsx)(`path`,{d:`M8 9c-2 0-4 1.5-4 4M16 9c2 0 4 1.5 4 4`}),(0,w.jsx)(`path`,{d:`M9 13v3a3 3 0 0 0 6 0v-3`}),(0,w.jsx)(`path`,{d:`m9 6 1 1M14 7l1-1`})]}),openwebui:e=>(0,w.jsxs)(T,{...e,children:[(0,w.jsx)(`rect`,{x:`3`,y:`4`,width:`18`,height:`13`,rx:`2`}),(0,w.jsx)(`path`,{d:`M8 11h2M14 11h2`}),(0,w.jsx)(`path`,{d:`m12 17-3 4h6Z`})]}),hermes:e=>(0,w.jsxs)(T,{...e,children:[(0,w.jsx)(`path`,{d:`M12 3 4 19h16Z`}),(0,w.jsx)(`circle`,{cx:`12`,cy:`13`,r:`2.5`})]}),sparkle:e=>(0,w.jsx)(T,{...e,children:(0,w.jsx)(`path`,{d:`M12 3v4M12 17v4M3 12h4M17 12h4M6 6l2.5 2.5M15.5 15.5 18 18M6 18l2.5-2.5M15.5 8.5 18 6`})}),store:e=>(0,w.jsxs)(T,{...e,children:[(0,w.jsx)(`path`,{d:`M3 8 5 4h14l2 4`}),(0,w.jsx)(`path`,{d:`M3 8v11a1 1 0 0 0 1 1h16a1 1 0 0 0 1-1V8`}),(0,w.jsx)(`path`,{d:`M3 8c0 2 1.5 3 3 3s3-1 3-3c0 2 1.5 3 3 3s3-1 3-3c0 2 1.5 3 3 3s3-1 3-3`}),(0,w.jsx)(`path`,{d:`M9 20v-6h6v6`})]}),tag:e=>(0,w.jsxs)(T,{...e,children:[(0,w.jsx)(`path`,{d:`M20 12 12 20l-9-9V3h8Z`}),(0,w.jsx)(`circle`,{cx:`7.5`,cy:`7.5`,r:`1.2`,fill:`currentColor`})]}),rocket:e=>(0,w.jsxs)(T,{...e,children:[(0,w.jsx)(`path`,{d:`M14 4.5C18 5 19 9 19 13l-4 1-4 4-3-3 4-4 1-4c0-2 1-2 2-2.5Z`}),(0,w.jsx)(`path`,{d:`m12 14-3 3a3 3 0 1 0 4 3`}),(0,w.jsx)(`path`,{d:`M9 11 5 9l2-2 4 1`})]}),filter:e=>(0,w.jsx)(T,{...e,children:(0,w.jsx)(`path`,{d:`M3 5h18l-7 9v6l-4-2v-4Z`})}),send:e=>(0,w.jsx)(T,{...e,children:(0,w.jsx)(`path`,{d:`m3 11 18-8-8 18-2-8Z`})}),plus:e=>(0,w.jsx)(T,{...e,children:(0,w.jsx)(`path`,{d:`M12 5v14M5 12h14`})}),copy:e=>(0,w.jsxs)(T,{...e,children:[(0,w.jsx)(`rect`,{x:`9`,y:`9`,width:`12`,height:`12`,rx:`2`}),(0,w.jsx)(`path`,{d:`M5 15V5a1 1 0 0 1 1-1h10`})]}),book:e=>(0,w.jsxs)(T,{...e,children:[(0,w.jsx)(`path`,{d:`M4 4v15a2 2 0 0 0 2 2h13V3H6a2 2 0 0 0-2 2Z`}),(0,w.jsx)(`path`,{d:`M19 17H6a2 2 0 0 0-2 2`})]}),message:e=>(0,w.jsx)(T,{...e,children:(0,w.jsx)(`path`,{d:`M21 12a8 8 0 0 1-13 6.3L3 20l1.7-5A8 8 0 1 1 21 12Z`})}),mic:e=>(0,w.jsxs)(T,{...e,children:[(0,w.jsx)(`rect`,{x:`9`,y:`3`,width:`6`,height:`13`,rx:`3`}),(0,w.jsx)(`path`,{d:`M5 11a7 7 0 0 0 14 0`}),(0,w.jsx)(`path`,{d:`M12 18v3`})]}),attach:e=>(0,w.jsx)(T,{...e,children:(0,w.jsx)(`path`,{d:`m21 11-9 9a5 5 0 0 1-7-7l9-9a3.5 3.5 0 0 1 5 5l-9 9a2 2 0 0 1-3-3l8-8`})}),chevLeft:e=>(0,w.jsx)(T,{...e,children:(0,w.jsx)(`path`,{d:`m15 6-6 6 6 6`})}),star:e=>(0,w.jsx)(T,{...e,children:(0,w.jsx)(`path`,{d:`M12 2 15 9l7 .6-5.3 4.6 1.6 6.8L12 17.3 5.7 21l1.6-6.8L2 9.6 9 9z`})}),external:e=>(0,w.jsxs)(T,{...e,children:[(0,w.jsx)(`path`,{d:`M15 3h6v6`}),(0,w.jsx)(`path`,{d:`M21 3 10 14`}),(0,w.jsx)(`path`,{d:`M21 14v6a1 1 0 0 1-1 1H4a1 1 0 0 1-1-1V4a1 1 0 0 1 1-1h6`})]}),thumbs:e=>(0,w.jsxs)(T,{...e,children:[(0,w.jsx)(`path`,{d:`M7 22V10l5-7a2 2 0 0 1 2 2v6h6a2 2 0 0 1 2 2l-2 7a2 2 0 0 1-2 1H7Z`}),(0,w.jsx)(`path`,{d:`M7 22H3V10h4`})]}),globe:e=>(0,w.jsxs)(T,{...e,children:[(0,w.jsx)(`circle`,{cx:`12`,cy:`12`,r:`9`}),(0,w.jsx)(`path`,{d:`M3 12h18`}),(0,w.jsx)(`path`,{d:`M12 3a14 14 0 0 1 0 18M12 3a14 14 0 0 0 0 18`})]}),flame:e=>(0,w.jsx)(T,{...e,children:(0,w.jsx)(`path`,{d:`M14 4c0 4-4 5-4 9a2 2 0 1 0 4 0 4 4 0 0 1 4-4c0 4-4 6-4 9a5 5 0 1 1-10 0c0-6 6-7 4-14 4 0 6 4 6 0Z`})}),x:e=>(0,w.jsx)(T,{...e,children:(0,w.jsx)(`path`,{d:`M18 6 6 18M6 6l12 12`})}),minus:e=>(0,w.jsx)(T,{...e,children:(0,w.jsx)(`path`,{d:`M5 12h14`})}),maximize:e=>(0,w.jsx)(T,{...e,children:(0,w.jsx)(`rect`,{x:`4`,y:`4`,width:`16`,height:`16`,rx:`2`})}),restore:e=>(0,w.jsxs)(T,{...e,children:[(0,w.jsx)(`rect`,{x:`7`,y:`7`,width:`13`,height:`13`,rx:`2`}),(0,w.jsx)(`path`,{d:`M4 16V5a1 1 0 0 1 1-1h11`})]}),cpu:e=>(0,w.jsxs)(T,{...e,children:[(0,w.jsx)(`rect`,{x:`5`,y:`5`,width:`14`,height:`14`,rx:`2`}),(0,w.jsx)(`rect`,{x:`9`,y:`9`,width:`6`,height:`6`}),(0,w.jsx)(`path`,{d:`M9 1v3M15 1v3M9 20v3M15 20v3M1 9h3M1 15h3M20 9h3M20 15h3`})]}),hardDrive:e=>(0,w.jsxs)(T,{...e,children:[(0,w.jsx)(`rect`,{x:`3`,y:`13`,width:`18`,height:`8`,rx:`2`}),(0,w.jsx)(`path`,{d:`M3 13 6 4a2 2 0 0 1 2-1h8a2 2 0 0 1 2 1l3 9`}),(0,w.jsx)(`circle`,{cx:`7`,cy:`17`,r:`0.6`,fill:`currentColor`})]}),memory:e=>(0,w.jsxs)(T,{...e,children:[(0,w.jsx)(`rect`,{x:`2`,y:`7`,width:`20`,height:`10`,rx:`2`}),(0,w.jsx)(`path`,{d:`M6 11v2M10 11v2M14 11v2M18 11v2`}),(0,w.jsx)(`path`,{d:`M2 17v2M22 17v2`})]}),thermo:e=>(0,w.jsx)(T,{...e,children:(0,w.jsx)(`path`,{d:`M14 14.8V4a2 2 0 1 0-4 0v10.8a4 4 0 1 0 4 0Z`})}),bolt:e=>(0,w.jsx)(T,{...e,children:(0,w.jsx)(`path`,{d:`M13 2 3 14h7l-1 8 10-12h-7l1-8Z`})}),refresh:e=>(0,w.jsxs)(T,{...e,children:[(0,w.jsx)(`path`,{d:`M3 12a9 9 0 0 1 15-6.7L21 8`}),(0,w.jsx)(`path`,{d:`M21 3v5h-5`}),(0,w.jsx)(`path`,{d:`M21 12a9 9 0 0 1-15 6.7L3 16`}),(0,w.jsx)(`path`,{d:`M3 21v-5h5`})]}),stop:e=>(0,w.jsx)(T,{...e,children:(0,w.jsx)(`rect`,{x:`6`,y:`6`,width:`12`,height:`12`,rx:`1.5`})}),play:e=>(0,w.jsx)(T,{...e,children:(0,w.jsx)(`path`,{d:`M6 4v16l14-8Z`})}),chevDown:e=>(0,w.jsx)(T,{...e,children:(0,w.jsx)(`path`,{d:`m6 9 6 6 6-6`})}),chevRight:e=>(0,w.jsx)(T,{...e,children:(0,w.jsx)(`path`,{d:`m9 6 6 6-6 6`})}),cloud:e=>(0,w.jsx)(T,{...e,children:(0,w.jsx)(`path`,{d:`M17.5 19a4.5 4.5 0 0 0 .5-9 6 6 0 0 0-11.6 1.4A4 4 0 0 0 6.5 19Z`})}),cloudOff:e=>(0,w.jsxs)(T,{...e,children:[(0,w.jsx)(`path`,{d:`M2 2 22 22`}),(0,w.jsx)(`path`,{d:`M17.5 19a4.5 4.5 0 0 0 .5-9 6 6 0 0 0-9.6-2.4`}),(0,w.jsx)(`path`,{d:`M6.5 19a4 4 0 0 1-.6-7.6`})]}),check:e=>(0,w.jsx)(T,{...e,children:(0,w.jsx)(`path`,{d:`m5 12 5 5 9-11`})}),alertTri:e=>(0,w.jsxs)(T,{...e,children:[(0,w.jsx)(`path`,{d:`m10.3 3.9-8 14a2 2 0 0 0 1.7 3h16a2 2 0 0 0 1.7-3l-8-14a2 2 0 0 0-3.4 0Z`}),(0,w.jsx)(`path`,{d:`M12 9v4`}),(0,w.jsx)(`circle`,{cx:`12`,cy:`17`,r:`0.6`,fill:`currentColor`})]}),info:e=>(0,w.jsxs)(T,{...e,children:[(0,w.jsx)(`circle`,{cx:`12`,cy:`12`,r:`9`}),(0,w.jsx)(`path`,{d:`M12 16v-4`}),(0,w.jsx)(`circle`,{cx:`12`,cy:`8.5`,r:`0.6`,fill:`currentColor`})]}),search:e=>(0,w.jsxs)(T,{...e,children:[(0,w.jsx)(`circle`,{cx:`11`,cy:`11`,r:`7`}),(0,w.jsx)(`path`,{d:`m20 20-3.5-3.5`})]}),user:e=>(0,w.jsxs)(T,{...e,children:[(0,w.jsx)(`circle`,{cx:`12`,cy:`8`,r:`4`}),(0,w.jsx)(`path`,{d:`M4 21a8 8 0 0 1 16 0`})]}),terminal:e=>(0,w.jsxs)(T,{...e,children:[(0,w.jsx)(`path`,{d:`m4 7 5 5-5 5`}),(0,w.jsx)(`path`,{d:`M12 19h8`})]}),network:e=>(0,w.jsxs)(T,{...e,children:[(0,w.jsx)(`circle`,{cx:`12`,cy:`12`,r:`9`}),(0,w.jsx)(`path`,{d:`M3 12h18`}),(0,w.jsx)(`path`,{d:`M12 3a14 14 0 0 1 0 18M12 3a14 14 0 0 0 0 18`})]}),download:e=>(0,w.jsxs)(T,{...e,children:[(0,w.jsx)(`path`,{d:`M12 3v12`}),(0,w.jsx)(`path`,{d:`m7 10 5 5 5-5`}),(0,w.jsx)(`path`,{d:`M5 21h14`})]}),expand:e=>(0,w.jsx)(T,{...e,children:(0,w.jsx)(`path`,{d:`M3 9V3h6M21 9V3h-6M3 15v6h6M21 15v6h-6`})}),dot:e=>(0,w.jsx)(T,{...e,children:(0,w.jsx)(`circle`,{cx:`12`,cy:`12`,r:`4`,fill:`currentColor`})}),arrowUp:e=>(0,w.jsx)(T,{...e,children:(0,w.jsx)(`path`,{d:`M12 19V5M5 12l7-7 7 7`})}),arrowDown:e=>(0,w.jsx)(T,{...e,children:(0,w.jsx)(`path`,{d:`M12 5v14M19 12l-7 7-7-7`})}),badge:e=>(0,w.jsx)(T,{...e,children:(0,w.jsx)(`path`,{d:`M12 2 4 6v6c0 5 3.5 8.5 8 10 4.5-1.5 8-5 8-10V6Z`})}),history:e=>(0,w.jsxs)(T,{...e,children:[(0,w.jsx)(`path`,{d:`M3 12a9 9 0 1 0 3-6.7L3 8`}),(0,w.jsx)(`path`,{d:`M3 3v5h5`}),(0,w.jsx)(`path`,{d:`M12 7v5l3 2`})]}),power:e=>(0,w.jsxs)(T,{...e,children:[(0,w.jsx)(`path`,{d:`M12 3v9`}),(0,w.jsx)(`path`,{d:`M18.4 6.6a9 9 0 1 1-12.8 0`})]}),qrcode:e=>(0,w.jsxs)(T,{...e,children:[(0,w.jsx)(`rect`,{x:`3`,y:`3`,width:`7`,height:`7`,rx:`1`}),(0,w.jsx)(`rect`,{x:`14`,y:`3`,width:`7`,height:`7`,rx:`1`}),(0,w.jsx)(`rect`,{x:`3`,y:`14`,width:`7`,height:`7`,rx:`1`}),(0,w.jsx)(`path`,{d:`M14 14h3v3M20 14v3M14 20h3M20 20h1`})]}),calendar:e=>(0,w.jsxs)(T,{...e,children:[(0,w.jsx)(`rect`,{x:`3`,y:`4`,width:`18`,height:`17`,rx:`2`}),(0,w.jsx)(`path`,{d:`M16 2v4M8 2v4M3 9h18`})]}),clock:e=>(0,w.jsxs)(T,{...e,children:[(0,w.jsx)(`circle`,{cx:`12`,cy:`12`,r:`9`}),(0,w.jsx)(`path`,{d:`M12 6v6l4 2`})]}),upload:e=>(0,w.jsxs)(T,{...e,children:[(0,w.jsx)(`path`,{d:`M12 15V3`}),(0,w.jsx)(`path`,{d:`m7 8 5-5 5 5`}),(0,w.jsx)(`path`,{d:`M5 21h14`})]}),trash:e=>(0,w.jsxs)(T,{...e,children:[(0,w.jsx)(`path`,{d:`M4 7h16`}),(0,w.jsx)(`path`,{d:`M6 7v12a2 2 0 0 0 2 2h8a2 2 0 0 0 2-2V7`}),(0,w.jsx)(`path`,{d:`M9 7V4a1 1 0 0 1 1-1h4a1 1 0 0 1 1 1v3`})]}),edit:e=>(0,w.jsx)(T,{...e,children:(0,w.jsx)(`path`,{d:`M17 3a2.8 2.8 0 1 1 4 4L8 20l-5 1 1-5Z`})}),file:e=>(0,w.jsxs)(T,{...e,children:[(0,w.jsx)(`path`,{d:`M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8Z`}),(0,w.jsx)(`path`,{d:`M14 2v6h6`})]}),image:e=>(0,w.jsxs)(T,{...e,children:[(0,w.jsx)(`rect`,{x:`3`,y:`3`,width:`18`,height:`18`,rx:`2`}),(0,w.jsx)(`circle`,{cx:`8.5`,cy:`8.5`,r:`1.5`}),(0,w.jsx)(`path`,{d:`m21 15-5-5L5 21`})]}),wifi:e=>(0,w.jsxs)(T,{...e,children:[(0,w.jsx)(`path`,{d:`M5 12.6a14 14 0 0 1 14 0`}),(0,w.jsx)(`path`,{d:`M8.5 16.1a7 7 0 0 1 7 0`}),(0,w.jsx)(`circle`,{cx:`12`,cy:`20`,r:`0.6`,fill:`currentColor`})]}),log:e=>(0,w.jsx)(T,{...e,children:(0,w.jsx)(`path`,{d:`M4 6h16M4 10h16M4 14h10M4 18h6`})}),key:e=>(0,w.jsxs)(T,{...e,children:[(0,w.jsx)(`circle`,{cx:`8`,cy:`15`,r:`4`}),(0,w.jsx)(`path`,{d:`m14.7 7.3 4-4 2 2-4 4M14.7 7.3l-3.4 3.4`})]}),chart:e=>(0,w.jsx)(T,{...e,children:(0,w.jsx)(`path`,{d:`M3 21 9 9l4 6 4-8 4 6`})}),gpu:e=>(0,w.jsxs)(T,{...e,children:[(0,w.jsx)(`rect`,{x:`2`,y:`6`,width:`20`,height:`12`,rx:`2`}),(0,w.jsx)(`path`,{d:`M6 10h2v4H6zM10 10h2v4h-2zM14 10h2v4h-2z`}),(0,w.jsx)(`path`,{d:`M6 6V4M10 6V4M14 6V4M18 6V4M6 18v2M10 18v2M14 18v2M18 18v2`})]}),layers:e=>(0,w.jsxs)(T,{...e,children:[(0,w.jsx)(`path`,{d:`m12 2-9 5 9 5 9-5Z`}),(0,w.jsx)(`path`,{d:`m3 12 9 5 9-5`}),(0,w.jsx)(`path`,{d:`m3 17 9 5 9-5`})]}),server:e=>(0,w.jsxs)(T,{...e,children:[(0,w.jsx)(`rect`,{x:`3`,y:`3`,width:`18`,height:`6`,rx:`2`}),(0,w.jsx)(`rect`,{x:`3`,y:`15`,width:`18`,height:`6`,rx:`2`}),(0,w.jsx)(`circle`,{cx:`7`,cy:`6`,r:`0.6`,fill:`currentColor`}),(0,w.jsx)(`circle`,{cx:`7`,cy:`18`,r:`0.6`,fill:`currentColor`})]}),link:e=>(0,w.jsxs)(T,{...e,children:[(0,w.jsx)(`path`,{d:`M10 14a3.5 3.5 0 0 0 5 0l3-3a3.5 3.5 0 0 0-5-5l-1 1`}),(0,w.jsx)(`path`,{d:`M14 10a3.5 3.5 0 0 0-5 0l-3 3a3.5 3.5 0 0 0 5 5l1-1`})]}),pin:e=>(0,w.jsxs)(T,{...e,children:[(0,w.jsx)(`path`,{d:`m15 4.5-4 7.5-1 1L4.5 9.5l1-1L13 4.5a2 2 0 0 1 2 0Z`}),(0,w.jsx)(`path`,{d:`M9 15 4 20`})]}),minio:e=>(0,w.jsxs)(T,{...e,children:[(0,w.jsx)(`ellipse`,{cx:`12`,cy:`6`,rx:`8`,ry:`3`}),(0,w.jsx)(`path`,{d:`M4 6v6c0 1.7 3.6 3 8 3s8-1.3 8-3V6`}),(0,w.jsx)(`path`,{d:`M4 12v6c0 1.7 3.6 3 8 3s8-1.3 8-3v-6`})]}),swap:e=>(0,w.jsxs)(T,{...e,children:[(0,w.jsx)(`path`,{d:`m7 3-4 4 4 4`}),(0,w.jsx)(`path`,{d:`M3 7h14M17 21l4-4-4-4`}),(0,w.jsx)(`path`,{d:`M21 17H7`})]}),trendUp:e=>(0,w.jsxs)(T,{...e,children:[(0,w.jsx)(`path`,{d:`m23 6-9.5 9.5-5-5L1 18`}),(0,w.jsx)(`path`,{d:`M17 6h6v6`})]}),logout:e=>(0,w.jsxs)(T,{...e,children:[(0,w.jsx)(`path`,{d:`M9 21H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h4`}),(0,w.jsx)(`path`,{d:`m16 17 5-5-5-5`}),(0,w.jsx)(`path`,{d:`M21 12H9`})]}),sidebar:e=>(0,w.jsxs)(T,{...e,children:[(0,w.jsx)(`rect`,{x:`3`,y:`3`,width:`18`,height:`18`,rx:`2`}),(0,w.jsx)(`path`,{d:`M9 3v18`})]})},D=({name:e,size:t=16,stroke:n=1.7,style:r})=>{let i=E[e];return i?(0,w.jsx)(i,{size:t,stroke:n,style:r}):null},O=(0,b.createContext)({});function k(e){let t=(0,b.useRef)(null);return t.current===null&&(t.current=e()),t.current}var A=typeof window<`u`?b.useLayoutEffect:b.useEffect,j=(0,b.createContext)(null);function ee(e,t){e.indexOf(t)===-1&&e.push(t)}function M(e,t){let n=e.indexOf(t);n>-1&&e.splice(n,1)}var N=(e,t,n)=>n>t?t:n/^-?(?:\d+(?:\.\d+)?|\.\d+)$/u.test(e),I=e=>typeof e==`object`&&!!e,te=e=>/^0[^.\s]+$/u.test(e);function ne(e){let t;return()=>(t===void 0&&(t=e()),t)}var L=e=>e,re=(...e)=>e.reduce((e,t)=>n=>t(e(n))),R=(e,t,n)=>{let r=t-e;return r?(n-e)/r:1},z=class{constructor(){this.subscriptions=[]}add(e){return ee(this.subscriptions,e),()=>M(this.subscriptions,e)}notify(e,t,n){let r=this.subscriptions.length;if(r)if(r===1)this.subscriptions[0](e,t,n);else for(let i=0;ie*1e3,ie=e=>e/1e3,ae=(e,t)=>t?1e3/t*e:0,oe=(e,t,n)=>(((1-3*n+3*t)*e+(3*n-6*t))*e+3*t)*e,se=1e-7,ce=12;function le(e,t,n,r,i){let a,o,s=0;do o=t+(n-t)/2,a=oe(o,r,i)-e,a>0?n=o:t=o;while(Math.abs(a)>se&&++sle(t,0,1,e,n);return e=>e===0||e===1?e:oe(i(e),t,r)}var de=e=>t=>t<=.5?e(2*t)/2:(2-e(2*(1-t)))/2,fe=e=>t=>1-e(1-t),pe=ue(.33,1.53,.69,.99),me=fe(pe),he=de(me),ge=e=>e>=1?1:(e*=2)<1?.5*me(e):.5*(2-2**(-10*(e-1))),_e=e=>1-Math.sin(Math.acos(e)),ve=fe(_e),ye=de(_e),be=ue(.42,0,1,1),xe=ue(0,0,.58,1),Se=ue(.42,0,.58,1),Ce=e=>Array.isArray(e)&&typeof e[0]!=`number`,we=e=>Array.isArray(e)&&typeof e[0]==`number`,Te={linear:L,easeIn:be,easeInOut:Se,easeOut:xe,circIn:_e,circInOut:ye,circOut:ve,backIn:me,backInOut:he,backOut:pe,anticipate:ge},Ee=e=>typeof e==`string`,De=e=>{if(we(e)){e.length;let[t,n,r,i]=e;return ue(t,n,r,i)}else if(Ee(e))return Te[e],`${e}`,Te[e];return e},Oe=[`setup`,`read`,`resolveKeyframes`,`preUpdate`,`update`,`preRender`,`render`,`postRender`];function ke(e){let t=new Set,n=new Set,r=!1,i=!1,a=new WeakSet,o={delta:0,timestamp:0,isProcessing:!1};function s(t){a.has(t)&&(c.schedule(t),e()),t(o)}let c={schedule:(e,i=!1,o=!1)=>{let s=o&&r?t:n;return i&&a.add(e),s.add(e),e},cancel:e=>{n.delete(e),a.delete(e)},process:e=>{if(o=e,r){i=!0;return}r=!0;let a=t;t=n,n=a,t.forEach(s),t.clear(),r=!1,i&&(i=!1,c.process(e))}};return c}var Ae=40;function je(e,t){let n=!1,r=!0,i={delta:0,timestamp:0,isProcessing:!1},a=()=>n=!0,o=Oe.reduce((e,t)=>(e[t]=ke(a),e),{}),{setup:s,read:c,resolveKeyframes:l,preUpdate:u,update:d,preRender:f,render:p,postRender:m}=o,h=()=>{let a=P.useManualTiming,o=a?i.timestamp:performance.now();n=!1,a||(i.delta=r?1e3/60:Math.max(Math.min(o-i.timestamp,Ae),1)),i.timestamp=o,i.isProcessing=!0,s.process(i),c.process(i),l.process(i),u.process(i),d.process(i),f.process(i),p.process(i),m.process(i),i.isProcessing=!1,n&&t&&(r=!1,e(h))},g=()=>{n=!0,r=!0,i.isProcessing||e(h)};return{schedule:Oe.reduce((e,t)=>{let r=o[t];return e[t]=(e,t=!1,i=!1)=>(n||g(),r.schedule(e,t,i)),e},{}),cancel:e=>{for(let t=0;t(Fe===void 0&&Le.set(Ne.isProcessing||P.useManualTiming?Ne.timestamp:performance.now()),Fe),set:e=>{Fe=e,queueMicrotask(Ie)}},Re=e=>t=>typeof t==`string`&&t.startsWith(e),ze=Re(`--`),Be=Re(`var(--`),Ve=e=>Be(e)?He.test(e.split(`/*`)[0].trim()):!1,He=/var\(--(?:[\w-]+\s*|[\w-]+\s*,(?:\s*[^)(\s]|\s*\((?:[^)(]|\([^)(]*\))*\))+\s*)\)$/iu;function Ue(e){return typeof e==`string`?e.split(`/*`)[0].includes(`var(--`):!1}var We={test:e=>typeof e==`number`,parse:parseFloat,transform:e=>e},Ge={...We,transform:e=>N(0,1,e)},Ke={...We,default:1},qe=e=>Math.round(e*1e5)/1e5,Je=/-?(?:\d+(?:\.\d+)?|\.\d+)/gu;function Ye(e){return e==null}var Xe=/^(?:#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\))$/iu,Ze=(e,t)=>n=>!!(typeof n==`string`&&Xe.test(n)&&n.startsWith(e)||t&&!Ye(n)&&Object.prototype.hasOwnProperty.call(n,t)),Qe=(e,t,n)=>r=>{if(typeof r!=`string`)return r;let[i,a,o,s]=r.match(Je);return{[e]:parseFloat(i),[t]:parseFloat(a),[n]:parseFloat(o),alpha:s===void 0?1:parseFloat(s)}},$e=e=>N(0,255,e),et={...We,transform:e=>Math.round($e(e))},tt={test:Ze(`rgb`,`red`),parse:Qe(`red`,`green`,`blue`),transform:({red:e,green:t,blue:n,alpha:r=1})=>`rgba(`+et.transform(e)+`, `+et.transform(t)+`, `+et.transform(n)+`, `+qe(Ge.transform(r))+`)`};function nt(e){let t=``,n=``,r=``,i=``;return e.length>5?(t=e.substring(1,3),n=e.substring(3,5),r=e.substring(5,7),i=e.substring(7,9)):(t=e.substring(1,2),n=e.substring(2,3),r=e.substring(3,4),i=e.substring(4,5),t+=t,n+=n,r+=r,i+=i),{red:parseInt(t,16),green:parseInt(n,16),blue:parseInt(r,16),alpha:i?parseInt(i,16)/255:1}}var rt={test:Ze(`#`),parse:nt,transform:tt.transform},it=e=>({test:t=>typeof t==`string`&&t.endsWith(e)&&t.split(` `).length===1,parse:parseFloat,transform:t=>`${t}${e}`}),at=it(`deg`),ot=it(`%`),H=it(`px`),st=it(`vh`),ct=it(`vw`),lt={...ot,parse:e=>ot.parse(e)/100,transform:e=>ot.transform(e*100)},ut={test:Ze(`hsl`,`hue`),parse:Qe(`hue`,`saturation`,`lightness`),transform:({hue:e,saturation:t,lightness:n,alpha:r=1})=>`hsla(`+Math.round(e)+`, `+ot.transform(qe(t))+`, `+ot.transform(qe(n))+`, `+qe(Ge.transform(r))+`)`},dt={test:e=>tt.test(e)||rt.test(e)||ut.test(e),parse:e=>tt.test(e)?tt.parse(e):ut.test(e)?ut.parse(e):rt.parse(e),transform:e=>typeof e==`string`?e:e.hasOwnProperty(`red`)?tt.transform(e):ut.transform(e),getAnimatableNone:e=>{let t=dt.parse(e);return t.alpha=0,dt.transform(t)}},ft=/(?:#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\))/giu;function pt(e){return isNaN(e)&&typeof e==`string`&&(e.match(Je)?.length||0)+(e.match(ft)?.length||0)>0}var mt=`number`,ht=`color`,gt=`var`,_t=`var(`,vt="${}",yt=/var\s*\(\s*--(?:[\w-]+\s*|[\w-]+\s*,(?:\s*[^)(\s]|\s*\((?:[^)(]|\([^)(]*\))*\))+\s*)\)|#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\)|-?(?:\d+(?:\.\d+)?|\.\d+)/giu;function bt(e){let t=e.toString(),n=[],r={color:[],number:[],var:[]},i=[],a=0;return{values:n,split:t.replace(yt,e=>(dt.test(e)?(r.color.push(a),i.push(ht),n.push(dt.parse(e))):e.startsWith(_t)?(r.var.push(a),i.push(gt),n.push(e)):(r.number.push(a),i.push(mt),n.push(parseFloat(e))),++a,vt)).split(vt),indexes:r,types:i}}function xt(e){return bt(e).values}function St({split:e,types:t}){let n=e.length;return r=>{let i=``;for(let a=0;atypeof e==`number`?0:dt.test(e)?dt.getAnimatableNone(e):e,Tt=(e,t)=>typeof e==`number`?t?.trim().endsWith(`/`)?e:0:wt(e);function Et(e){let t=bt(e);return St(t)(t.values.map((e,n)=>Tt(e,t.split[n])))}var Dt={test:pt,parse:xt,createTransformer:Ct,getAnimatableNone:Et};function Ot(e,t,n){return n<0&&(n+=1),n>1&&--n,n<1/6?e+(t-e)*6*n:n<1/2?t:n<2/3?e+(t-e)*(2/3-n)*6:e}function kt({hue:e,saturation:t,lightness:n,alpha:r}){e/=360,t/=100,n/=100;let i=0,a=0,o=0;if(!t)i=a=o=n;else{let r=n<.5?n*(1+t):n+t-n*t,s=2*n-r;i=Ot(s,r,e+1/3),a=Ot(s,r,e),o=Ot(s,r,e-1/3)}return{red:Math.round(i*255),green:Math.round(a*255),blue:Math.round(o*255),alpha:r}}function At(e,t){return n=>n>0?t:e}var jt=(e,t,n)=>e+(t-e)*n,Mt=(e,t,n)=>{let r=e*e,i=n*(t*t-r)+r;return i<0?0:Math.sqrt(i)},Nt=[rt,tt,ut],Pt=e=>Nt.find(t=>t.test(e));function Ft(e){let t=Pt(e);if(`${e}`,!t)return!1;let n=t.parse(e);return t===ut&&(n=kt(n)),n}var It=(e,t)=>{let n=Ft(e),r=Ft(t);if(!n||!r)return At(e,t);let i={...n};return e=>(i.red=Mt(n.red,r.red,e),i.green=Mt(n.green,r.green,e),i.blue=Mt(n.blue,r.blue,e),i.alpha=jt(n.alpha,r.alpha,e),tt.transform(i))},Lt=new Set([`none`,`hidden`]);function Rt(e,t){return Lt.has(e)?n=>n<=0?e:t:n=>n>=1?t:e}function zt(e,t){return n=>jt(e,t,n)}function Bt(e){return typeof e==`number`?zt:typeof e==`string`?Ve(e)?At:dt.test(e)?It:Wt:Array.isArray(e)?Vt:typeof e==`object`?dt.test(e)?It:Ht:At}function Vt(e,t){let n=[...e],r=n.length,i=e.map((e,n)=>Bt(e)(e,t[n]));return e=>{for(let t=0;t{for(let t in r)n[t]=r[t](e);return n}}function Ut(e,t){let n=[],r={color:0,var:0,number:0};for(let i=0;i{let n=Dt.createTransformer(t),r=bt(e),i=bt(t);return r.indexes.var.length===i.indexes.var.length&&r.indexes.color.length===i.indexes.color.length&&r.indexes.number.length>=i.indexes.number.length?Lt.has(e)&&!i.values.length||Lt.has(t)&&!r.values.length?Rt(e,t):re(Vt(Ut(r,i),i.values),n):(`${e}${t}`,At(e,t))};function Gt(e,t,n){return typeof e==`number`&&typeof t==`number`&&typeof n==`number`?jt(e,t,n):Bt(e)(e,t)}var Kt=e=>{let t=({timestamp:t})=>e(t);return{start:(e=!0)=>V.update(t,e),stop:()=>Me(t),now:()=>Ne.isProcessing?Ne.timestamp:Le.now()}},qt=(e,t,n=10)=>{let r=``,i=Math.max(Math.round(t/n),2);for(let t=0;t=2e4?1/0:t}function Xt(e,t=100,n){let r=n({...e,keyframes:[0,t]}),i=Math.min(Yt(r),Jt);return{type:`keyframes`,ease:e=>r.next(i*e).value/t,duration:ie(i)}}var Zt={stiffness:100,damping:10,mass:1,velocity:0,duration:800,bounce:.3,visualDuration:.3,restSpeed:{granular:.01,default:2},restDelta:{granular:.005,default:.5},minDuration:.01,maxDuration:10,minDamping:.05,maxDamping:1};function Qt(e,t){return e*Math.sqrt(1-t*t)}var $t=12;function en(e,t,n){let r=n;for(let n=1;n<$t;n++)r-=e(r)/t(r);return r}var tn=.001;function nn({duration:e=Zt.duration,bounce:t=Zt.bounce,velocity:n=Zt.velocity,mass:r=Zt.mass}){let i,a;Zt.maxDuration;let o=1-t;o=N(Zt.minDamping,Zt.maxDamping,o),e=N(Zt.minDuration,Zt.maxDuration,ie(e)),o<1?(i=t=>{let r=t*o,i=r*e,a=r-n,s=Qt(t,o),c=Math.exp(-i);return tn-a/s*c},a=t=>{let r=t*o*e,a=r*n+n,s=o**2*t**2*e,c=Math.exp(-r),l=Qt(t**2,o);return(-i(t)+tn>0?-1:1)*((a-s)*c)/l}):(i=t=>-.001+Math.exp(-t*e)*((t-n)*e+1),a=t=>Math.exp(-t*e)*((n-t)*(e*e)));let s=5/e,c=en(i,a,s);if(e=B(e),isNaN(c))return{stiffness:Zt.stiffness,damping:Zt.damping,duration:e};{let t=c**2*r;return{stiffness:t,damping:o*2*Math.sqrt(r*t),duration:e}}}var rn=[`duration`,`bounce`],an=[`stiffness`,`damping`,`mass`];function on(e,t){return t.some(t=>e[t]!==void 0)}function sn(e){let t={velocity:Zt.velocity,stiffness:Zt.stiffness,damping:Zt.damping,mass:Zt.mass,isResolvedFromDuration:!1,...e};if(!on(e,an)&&on(e,rn))if(t.velocity=0,e.visualDuration){let n=e.visualDuration,r=2*Math.PI/(n*1.2),i=r*r,a=2*N(.05,1,1-(e.bounce||0))*Math.sqrt(i);t={...t,mass:Zt.mass,stiffness:i,damping:a}}else{let n=nn({...e,velocity:0});t={...t,...n,mass:Zt.mass},t.isResolvedFromDuration=!0}return t}function cn(e=Zt.visualDuration,t=Zt.bounce){let n=typeof e==`object`?e:{visualDuration:e,keyframes:[0,1],bounce:t},{restSpeed:r,restDelta:i}=n,a=n.keyframes[0],o=n.keyframes[n.keyframes.length-1],s={done:!1,value:a},{stiffness:c,damping:l,mass:u,duration:d,velocity:f,isResolvedFromDuration:p}=sn({...n,velocity:-ie(n.velocity||0)}),m=f||0,h=l/(2*Math.sqrt(c*u)),g=o-a,_=ie(Math.sqrt(c/u)),v=Math.abs(g)<5;r||=v?Zt.restSpeed.granular:Zt.restSpeed.default,i||=v?Zt.restDelta.granular:Zt.restDelta.default;let y,b,x,S,C,w;if(h<1)x=Qt(_,h),S=(m+h*_*g)/x,y=e=>o-Math.exp(-h*_*e)*(S*Math.sin(x*e)+g*Math.cos(x*e)),C=h*_*S+g*x,w=h*_*g-S*x,b=e=>Math.exp(-h*_*e)*(C*Math.sin(x*e)+w*Math.cos(x*e));else if(h===1){y=e=>o-Math.exp(-_*e)*(g+(m+_*g)*e);let e=m+_*g;b=t=>Math.exp(-_*t)*(_*e*t-m)}else{let e=_*Math.sqrt(h*h-1);y=t=>{let n=Math.exp(-h*_*t),r=Math.min(e*t,300);return o-n*((m+h*_*g)*Math.sinh(r)+e*g*Math.cosh(r))/e};let t=(m+h*_*g)/e,n=h*_*t-g*e,r=h*_*g-t*e;b=t=>{let i=Math.exp(-h*_*t),a=Math.min(e*t,300);return i*(n*Math.sinh(a)+r*Math.cosh(a))}}let T={calculatedDuration:p&&d||null,velocity:e=>B(b(e)),next:e=>{if(!p&&h<1){let t=Math.exp(-h*_*e),n=Math.sin(x*e),a=Math.cos(x*e),c=o-t*(S*n+g*a),l=B(t*(C*n+w*a));return s.done=Math.abs(l)<=r&&Math.abs(o-c)<=i,s.value=s.done?o:c,s}let t=y(e);if(p)s.done=e>=d;else{let n=B(b(e));s.done=Math.abs(n)<=r&&Math.abs(o-t)<=i}return s.value=s.done?o:t,s},toString:()=>{let e=Math.min(Yt(T),Jt),t=qt(t=>T.next(e*t).value,e,30);return e+`ms `+t},toTransition:()=>{}};return T}cn.applyToOptions=e=>{let t=Xt(e,100,cn);return e.ease=t.ease,e.duration=B(t.duration),e.type=`keyframes`,e};var ln=5;function un(e,t,n){let r=Math.max(t-ln,0);return ae(n-e(r),t-r)}function dn({keyframes:e,velocity:t=0,power:n=.8,timeConstant:r=325,bounceDamping:i=10,bounceStiffness:a=500,modifyTarget:o,min:s,max:c,restDelta:l=.5,restSpeed:u}){let d=e[0],f={done:!1,value:d},p=e=>s!==void 0&&ec,m=e=>s===void 0?c:c===void 0||Math.abs(s-e)-h*Math.exp(-e/r),y=e=>_+v(e),b=e=>{let t=v(e),n=y(e);f.done=Math.abs(t)<=l,f.value=f.done?_:n},x,S,C=e=>{p(f.value)&&(x=e,S=cn({keyframes:[f.value,m(f.value)],velocity:un(y,e,f.value),damping:i,stiffness:a,restDelta:l,restSpeed:u}))};return C(0),{calculatedDuration:null,next:e=>{let t=!1;return!S&&x===void 0&&(t=!0,b(e),C(e)),x!==void 0&&e>=x?S.next(e-x):(!t&&b(e),f)}}}function fn(e,t,n){let r=[],i=n||P.mix||Gt,a=e.length-1;for(let n=0;nt[0];if(a===2&&t[0]===t[1])return()=>t[1];let o=e[0]===e[1];e[0]>e[a-1]&&(e=[...e].reverse(),t=[...t].reverse());let s=fn(t,r,i),c=s.length,l=n=>{if(o&&n1)for(;rl(N(e[0],e[a-1],t)):l}function mn(e,t){let n=e[e.length-1];for(let r=1;r<=t;r++){let i=R(0,t,r);e.push(jt(n,1,i))}}function hn(e){let t=[0];return mn(t,e.length-1),t}function gn(e,t){return e.map(e=>e*t)}function _n(e,t){return e.map(()=>t||Se).splice(0,e.length-1)}function vn({duration:e=300,keyframes:t,times:n,ease:r=`easeInOut`}){let i=Ce(r)?r.map(De):De(r),a={done:!1,value:t[0]},o=pn(gn(n&&n.length===t.length?n:hn(t),e),t,{ease:Array.isArray(i)?i:_n(t,i)});return{calculatedDuration:e,next:t=>(a.value=o(t),a.done=t>=e,a)}}var yn=e=>e!==null;function bn(e,{repeat:t,repeatType:n=`loop`},r,i=1){let a=e.filter(yn),o=i<0||t&&n!==`loop`&&t%2==1?0:a.length-1;return!o||r===void 0?a[o]:r}var xn={decay:dn,inertia:dn,tween:vn,keyframes:vn,spring:cn};function Sn(e){typeof e.type==`string`&&(e.type=xn[e.type])}var Cn=class{constructor(){this.updateFinished()}get finished(){return this._finished}updateFinished(){this._finished=new Promise(e=>{this.resolve=e})}notifyFinished(){this.resolve()}then(e,t){return this.finished.then(e,t)}},wn=e=>e/100,Tn=class extends Cn{constructor(e){super(),this.state=`idle`,this.startTime=null,this.isStopped=!1,this.currentTime=0,this.holdTime=null,this.playbackSpeed=1,this.delayState={done:!1,value:void 0},this.stop=()=>{let{motionValue:e}=this.options;e&&e.updatedAt!==Le.now()&&this.tick(Le.now()),this.isStopped=!0,this.state!==`idle`&&(this.teardown(),this.options.onStop?.())},this.options=e,this.initAnimation(),this.play(),e.autoplay===!1&&this.pause()}initAnimation(){let{options:e}=this;Sn(e);let{type:t=vn,repeat:n=0,repeatDelay:r=0,repeatType:i,velocity:a=0}=e,{keyframes:o}=e,s=t||vn;s!==vn&&typeof o[0]!=`number`&&(this.mixKeyframes=re(wn,Gt(o[0],o[1])),o=[0,100]);let c=s({...e,keyframes:o});i===`mirror`&&(this.mirroredGenerator=s({...e,keyframes:[...o].reverse(),velocity:-a})),c.calculatedDuration===null&&(c.calculatedDuration=Yt(c));let{calculatedDuration:l}=c;this.calculatedDuration=l,this.resolvedDuration=l+r,this.totalDuration=this.resolvedDuration*(n+1)-r,this.generator=c}updateTime(e){let t=Math.round(e-this.startTime)*this.playbackSpeed;this.holdTime===null?this.currentTime=t:this.currentTime=this.holdTime}tick(e,t=!1){let{generator:n,totalDuration:r,mixKeyframes:i,mirroredGenerator:a,resolvedDuration:o,calculatedDuration:s}=this;if(this.startTime===null)return n.next(0);let{delay:c=0,keyframes:l,repeat:u,repeatType:d,repeatDelay:f,type:p,onUpdate:m,finalKeyframe:h}=this.options;this.speed>0?this.startTime=Math.min(this.startTime,e):this.speed<0&&(this.startTime=Math.min(e-r/this.speed,this.startTime)),t?this.currentTime=e:this.updateTime(e);let g=this.currentTime-c*(this.playbackSpeed>=0?1:-1),_=this.playbackSpeed>=0?g<0:g>r;this.currentTime=Math.max(g,0),this.state===`finished`&&this.holdTime===null&&(this.currentTime=r);let v=this.currentTime,y=n;if(u){let e=Math.min(this.currentTime,r)/o,t=Math.floor(e),n=e%1;!n&&e>=1&&(n=1),n===1&&t--,t=Math.min(t,u+1),t%2&&(d===`reverse`?(n=1-n,f&&(n-=f/o)):d===`mirror`&&(y=a)),v=N(0,1,n)*o}let b;_?(this.delayState.value=l[0],b=this.delayState):b=y.next(v),i&&!_&&(b.value=i(b.value));let{done:x}=b;!_&&s!==null&&(x=this.playbackSpeed>=0?this.currentTime>=r:this.currentTime<=0);let S=this.holdTime===null&&(this.state===`finished`||this.state===`running`&&x);return S&&p!==dn&&(b.value=bn(l,this.options,h,this.speed)),m&&m(b.value),S&&this.finish(),b}then(e,t){return this.finished.then(e,t)}get duration(){return ie(this.calculatedDuration)}get iterationDuration(){let{delay:e=0}=this.options||{};return this.duration+ie(e)}get time(){return ie(this.currentTime)}set time(e){e=B(e),this.currentTime=e,this.startTime===null||this.holdTime!==null||this.playbackSpeed===0?this.holdTime=e:this.driver&&(this.startTime=this.driver.now()-e/this.playbackSpeed),this.driver?this.driver.start(!1):(this.startTime=0,this.state=`paused`,this.holdTime=e,this.tick(e))}getGeneratorVelocity(){let e=this.currentTime;if(e<=0)return this.options.velocity||0;if(this.generator.velocity)return this.generator.velocity(e);let t=this.generator.next(e).value;return un(e=>this.generator.next(e).value,e,t)}get speed(){return this.playbackSpeed}set speed(e){let t=this.playbackSpeed!==e;t&&this.driver&&this.updateTime(Le.now()),this.playbackSpeed=e,t&&this.driver&&(this.time=ie(this.currentTime))}play(){if(this.isStopped)return;let{driver:e=Kt,startTime:t}=this.options;this.driver||=e(e=>this.tick(e)),this.options.onPlay?.();let n=this.driver.now();this.state===`finished`?(this.updateFinished(),this.startTime=n):this.holdTime===null?this.startTime||=t??n:this.startTime=n-this.holdTime,this.state===`finished`&&this.speed<0&&(this.startTime+=this.calculatedDuration),this.holdTime=null,this.state=`running`,this.driver.start()}pause(){this.state=`paused`,this.updateTime(Le.now()),this.holdTime=this.currentTime}complete(){this.state!==`running`&&this.play(),this.state=`finished`,this.holdTime=null}finish(){this.notifyFinished(),this.teardown(),this.state=`finished`,this.options.onComplete?.()}cancel(){this.holdTime=null,this.startTime=0,this.tick(0),this.teardown(),this.options.onCancel?.()}teardown(){this.state=`idle`,this.stopDriver(),this.startTime=this.holdTime=null}stopDriver(){this.driver&&=(this.driver.stop(),void 0)}sample(e){return this.startTime=0,this.tick(e,!0)}attachTimeline(e){return this.options.allowFlatten&&(this.options.type=`keyframes`,this.options.ease=`linear`,this.initAnimation()),this.driver?.stop(),e.observe(this)}};function En(e){for(let t=1;te*180/Math.PI,On=e=>An(Dn(Math.atan2(e[1],e[0]))),kn={x:4,y:5,translateX:4,translateY:5,scaleX:0,scaleY:3,scale:e=>(Math.abs(e[0])+Math.abs(e[3]))/2,rotate:On,rotateZ:On,skewX:e=>Dn(Math.atan(e[1])),skewY:e=>Dn(Math.atan(e[2])),skew:e=>(Math.abs(e[1])+Math.abs(e[2]))/2},An=e=>(e%=360,e<0&&(e+=360),e),jn=On,Mn=e=>Math.sqrt(e[0]*e[0]+e[1]*e[1]),Nn=e=>Math.sqrt(e[4]*e[4]+e[5]*e[5]),Pn={x:12,y:13,z:14,translateX:12,translateY:13,translateZ:14,scaleX:Mn,scaleY:Nn,scale:e=>(Mn(e)+Nn(e))/2,rotateX:e=>An(Dn(Math.atan2(e[6],e[5]))),rotateY:e=>An(Dn(Math.atan2(-e[2],e[0]))),rotateZ:jn,rotate:jn,skewX:e=>Dn(Math.atan(e[4])),skewY:e=>Dn(Math.atan(e[1])),skew:e=>(Math.abs(e[1])+Math.abs(e[4]))/2};function Fn(e){return+!!e.includes(`scale`)}function In(e,t){if(!e||e===`none`)return Fn(t);let n=e.match(/^matrix3d\(([-\d.e\s,]+)\)$/u),r,i;if(n)r=Pn,i=n;else{let t=e.match(/^matrix\(([-\d.e\s,]+)\)$/u);r=kn,i=t}if(!i)return Fn(t);let a=r[t],o=i[1].split(`,`).map(Rn);return typeof a==`function`?a(o):o[a]}var Ln=(e,t)=>{let{transform:n=`none`}=getComputedStyle(e);return In(n,t)};function Rn(e){return parseFloat(e.trim())}var zn=[`transformPerspective`,`x`,`y`,`z`,`translateX`,`translateY`,`translateZ`,`scale`,`scaleX`,`scaleY`,`rotate`,`rotateX`,`rotateY`,`rotateZ`,`skew`,`skewX`,`skewY`],Bn=new Set([...zn,`pathRotation`]),Vn=e=>e===We||e===H,Hn=new Set([`x`,`y`,`z`]),Un=zn.filter(e=>!Hn.has(e));function Wn(e){let t=[];return Un.forEach(n=>{let r=e.getValue(n);r!==void 0&&(t.push([n,r.get()]),r.set(+!!n.startsWith(`scale`)))}),t}var Gn={width:({x:e},{paddingLeft:t=`0`,paddingRight:n=`0`,boxSizing:r})=>{let i=e.max-e.min;return r===`border-box`?i:i-parseFloat(t)-parseFloat(n)},height:({y:e},{paddingTop:t=`0`,paddingBottom:n=`0`,boxSizing:r})=>{let i=e.max-e.min;return r===`border-box`?i:i-parseFloat(t)-parseFloat(n)},top:(e,{top:t})=>parseFloat(t),left:(e,{left:t})=>parseFloat(t),bottom:({y:e},{top:t})=>parseFloat(t)+(e.max-e.min),right:({x:e},{left:t})=>parseFloat(t)+(e.max-e.min),x:(e,{transform:t})=>In(t,`x`),y:(e,{transform:t})=>In(t,`y`)};Gn.translateX=Gn.x,Gn.translateY=Gn.y;var Kn=new Set,qn=!1,Jn=!1,Yn=!1;function Xn(){if(Jn){let e=Array.from(Kn).filter(e=>e.needsMeasurement),t=new Set(e.map(e=>e.element)),n=new Map;t.forEach(e=>{let t=Wn(e);t.length&&(n.set(e,t),e.render())}),e.forEach(e=>e.measureInitialState()),t.forEach(e=>{e.render();let t=n.get(e);t&&t.forEach(([t,n])=>{e.getValue(t)?.set(n)})}),e.forEach(e=>e.measureEndState()),e.forEach(e=>{e.suspendedScrollY!==void 0&&window.scrollTo(0,e.suspendedScrollY)})}Jn=!1,qn=!1,Kn.forEach(e=>e.complete(Yn)),Kn.clear()}function Zn(){Kn.forEach(e=>{e.readKeyframes(),e.needsMeasurement&&(Jn=!0)})}function Qn(){Yn=!0,Zn(),Xn(),Yn=!1}var $n=class{constructor(e,t,n,r,i,a=!1){this.state=`pending`,this.isAsync=!1,this.needsMeasurement=!1,this.unresolvedKeyframes=[...e],this.onComplete=t,this.name=n,this.motionValue=r,this.element=i,this.isAsync=a}scheduleResolve(){this.state=`scheduled`,this.isAsync?(Kn.add(this),qn||(qn=!0,V.read(Zn),V.resolveKeyframes(Xn))):(this.readKeyframes(),this.complete())}readKeyframes(){let{unresolvedKeyframes:e,name:t,element:n,motionValue:r}=this;if(e[0]===null){let i=r?.get(),a=e[e.length-1];if(i!==void 0)e[0]=i;else if(n&&t){let r=n.readValue(t,a);r!=null&&(e[0]=r)}e[0]===void 0&&(e[0]=a),r&&i===void 0&&r.set(e[0])}En(e)}setFinalKeyframe(){}measureInitialState(){}renderEndStyles(){}measureEndState(){}complete(e=!1){this.state=`complete`,this.onComplete(this.unresolvedKeyframes,this.finalKeyframe,e),Kn.delete(this)}cancel(){this.state===`scheduled`&&(Kn.delete(this),this.state=`pending`)}resume(){this.state===`pending`&&this.scheduleResolve()}},er=e=>e.startsWith(`--`);function tr(e,t,n){er(t)?e.style.setProperty(t,n):e.style[t]=n}var nr={};function rr(e,t){let n=ne(e);return()=>nr[t]??n()}var ir=rr(()=>window.ScrollTimeline!==void 0,`scrollTimeline`),ar=rr(()=>{try{document.createElement(`div`).animate({opacity:0},{easing:`linear(0, 1)`})}catch{return!1}return!0},`linearEasing`),or=([e,t,n,r])=>`cubic-bezier(${e}, ${t}, ${n}, ${r})`,sr={linear:`linear`,ease:`ease`,easeIn:`ease-in`,easeOut:`ease-out`,easeInOut:`ease-in-out`,circIn:or([0,.65,.55,1]),circOut:or([.55,0,1,.45]),backIn:or([.31,.01,.66,-.59]),backOut:or([.33,1.53,.69,.99])};function cr(e,t){if(e)return typeof e==`function`?ar()?qt(e,t):`ease-out`:we(e)?or(e):Array.isArray(e)?e.map(e=>cr(e,t)||sr.easeOut):sr[e]}function lr(e,t,n,{delay:r=0,duration:i=300,repeat:a=0,repeatType:o=`loop`,ease:s=`easeOut`,times:c}={},l=void 0){let u={[t]:n};c&&(u.offset=c);let d=cr(s,i);Array.isArray(d)&&(u.easing=d);let f={delay:r,duration:i,easing:Array.isArray(d)?`linear`:d,fill:`both`,iterations:a+1,direction:o===`reverse`?`alternate`:`normal`};return l&&(f.pseudoElement=l),e.animate(u,f)}function ur(e){return typeof e==`function`&&`applyToOptions`in e}function dr({type:e,...t}){return ur(e)&&ar()?e.applyToOptions(t):(t.duration??=300,t.ease??=`easeOut`,t)}var fr=class extends Cn{constructor(e){if(super(),this.finishedTime=null,this.isStopped=!1,this.manualStartTime=null,!e)return;let{element:t,name:n,keyframes:r,pseudoElement:i,allowFlatten:a=!1,finalKeyframe:o,onComplete:s}=e;this.isPseudoElement=!!i,this.allowFlatten=a,this.options=e,e.type;let c=dr(e);this.animation=lr(t,n,r,c,i),c.autoplay===!1&&this.animation.pause(),this.animation.onfinish=()=>{if(this.finishedTime=this.time,!i){let e=bn(r,this.options,o,this.speed);this.updateMotionValue&&this.updateMotionValue(e),tr(t,n,e),this.animation.cancel()}s?.(),this.notifyFinished()}}play(){this.isStopped||(this.manualStartTime=null,this.animation.play(),this.state===`finished`&&this.updateFinished())}pause(){this.animation.pause()}complete(){this.animation.finish?.()}cancel(){try{this.animation.cancel()}catch{}}stop(){if(this.isStopped)return;this.isStopped=!0;let{state:e}=this;e===`idle`||e===`finished`||(this.updateMotionValue?this.updateMotionValue():this.commitStyles(),this.isPseudoElement||this.cancel())}commitStyles(){let e=this.options?.element;!this.isPseudoElement&&e?.isConnected&&this.animation.commitStyles?.()}get duration(){let e=this.animation.effect?.getComputedTiming?.().duration||0;return ie(Number(e))}get iterationDuration(){let{delay:e=0}=this.options||{};return this.duration+ie(e)}get time(){return ie(Number(this.animation.currentTime)||0)}set time(e){let t=this.finishedTime!==null;this.manualStartTime=null,this.finishedTime=null,this.animation.currentTime=B(e),t&&this.animation.pause()}get speed(){return this.animation.playbackRate}set speed(e){e<0&&(this.finishedTime=null),this.animation.playbackRate=e}get state(){return this.finishedTime===null?this.animation.playState:`finished`}get startTime(){return this.manualStartTime??Number(this.animation.startTime)}set startTime(e){this.manualStartTime=this.animation.startTime=e}attachTimeline({timeline:e,rangeStart:t,rangeEnd:n,observe:r}){return this.allowFlatten&&this.animation.effect?.updateTiming({easing:`linear`}),this.animation.onfinish=null,e&&ir()?(this.animation.timeline=e,t&&(this.animation.rangeStart=t),n&&(this.animation.rangeEnd=n),L):r(this)}},pr={anticipate:ge,backInOut:he,circInOut:ye};function mr(e){return e in pr}function hr(e){typeof e.ease==`string`&&mr(e.ease)&&(e.ease=pr[e.ease])}var gr=10,_r=class extends fr{constructor(e){hr(e),Sn(e),super(e),e.startTime!==void 0&&e.autoplay!==!1&&(this.startTime=e.startTime),this.options=e}updateMotionValue(e){let{motionValue:t,onUpdate:n,onComplete:r,element:i,...a}=this.options;if(!t)return;if(e!==void 0){t.set(e);return}let o=new Tn({...a,autoplay:!1}),s=Math.max(gr,Le.now()-this.startTime),c=N(0,gr,s-gr),l=o.sample(s).value,{name:u}=this.options;i&&u&&tr(i,u,l),t.setWithVelocity(o.sample(Math.max(0,s-c)).value,l,c),o.stop()}},vr=(e,t)=>t===`zIndex`?!1:!!(typeof e==`number`||Array.isArray(e)||typeof e==`string`&&(Dt.test(e)||e===`0`)&&!e.startsWith(`url(`));function yr(e){let t=e[0];if(e.length===1)return!0;for(let n=0;nObject.hasOwnProperty.call(Element.prototype,`animate`));function Dr(e){let{motionValue:t,name:n,repeatDelay:r,repeatType:i,damping:a,type:o,keyframes:s}=e;if(!(t?.owner?.current instanceof HTMLElement))return!1;let{onUpdate:c,transformTemplate:l}=t.owner.getProps();return Er()&&n&&(Sr.has(n)||Tr.has(n)&&wr(s))&&(n!==`transform`||!l)&&!c&&!r&&i!==`mirror`&&a!==0&&o!==`inertia`}var Or=40,kr=class extends Cn{constructor({autoplay:e=!0,delay:t=0,type:n=`keyframes`,repeat:r=0,repeatDelay:i=0,repeatType:a=`loop`,keyframes:o,name:s,motionValue:c,element:l,...u}){super(),this.stop=()=>{this._animation&&(this._animation.stop(),this.stopTimeline?.()),this.keyframeResolver?.cancel()},this.createdAt=Le.now();let d={autoplay:e,delay:t,type:n,repeat:r,repeatDelay:i,repeatType:a,name:s,motionValue:c,element:l,...u},f=l?.KeyframeResolver||$n;this.keyframeResolver=new f(o,(e,t,n)=>this.onKeyframesResolved(e,t,d,!n),s,c,l),this.keyframeResolver?.scheduleResolve()}onKeyframesResolved(e,t,n,r){this.keyframeResolver=void 0;let{name:i,type:a,velocity:o,delay:s,isHandoff:c,onUpdate:l}=n;this.resolvedAt=Le.now();let u=!0;br(e,i,a,o)||(u=!1,(P.instantAnimations||!s)&&l?.(bn(e,n,t)),e[0]=e[e.length-1],xr(n),n.repeat=0);let d={startTime:r?this.resolvedAt&&this.resolvedAt-this.createdAt>Or?this.resolvedAt:this.createdAt:void 0,finalKeyframe:t,...n,keyframes:e},f=u&&!c&&Dr(d),p=d.motionValue?.owner?.current,m;if(f)try{m=new _r({...d,element:p})}catch{m=new Tn(d)}else m=new Tn(d);m.finished.then(()=>{this.notifyFinished()}).catch(L),this.pendingTimeline&&=(this.stopTimeline=m.attachTimeline(this.pendingTimeline),void 0),this._animation=m}get finished(){return this._animation?this.animation.finished:this._finished}then(e,t){return this.finished.finally(e).then(()=>{})}get animation(){return this._animation||(this.keyframeResolver?.resume(),Qn()),this._animation}get duration(){return this.animation.duration}get iterationDuration(){return this.animation.iterationDuration}get time(){return this.animation.time}set time(e){this.animation.time=e}get speed(){return this.animation.speed}get state(){return this.animation.state}set speed(e){this.animation.speed=e}get startTime(){return this.animation.startTime}attachTimeline(e){return this._animation?this.stopTimeline=this.animation.attachTimeline(e):this.pendingTimeline=e,()=>this.stop()}play(){this.animation.play()}pause(){this.animation.pause()}complete(){this.animation.complete()}cancel(){this._animation&&this.animation.cancel(),this.keyframeResolver?.cancel()}};function Ar(e,t,n,r=0,i=1){let a=Array.from(e).sort((e,t)=>e.sortNodePosition(t)).indexOf(t),o=e.size,s=(o-1)*r;return typeof n==`function`?n(a,o):i===1?a*r:s-a*r}var jr=30,Mr=e=>!isNaN(parseFloat(e)),Nr={current:void 0},Pr=class{constructor(e,t={}){this.canTrackVelocity=null,this.events={},this.updateAndNotify=e=>{let t=Le.now();if(this.updatedAt!==t&&this.setPrevFrameValue(),this.prev=this.current,this.setCurrent(e),this.current!==this.prev&&(this.events.change?.notify(this.current),this.dependents))for(let e of this.dependents)e.dirty()},this.hasAnimated=!1,this.setCurrent(e),this.owner=t.owner}setCurrent(e){this.current=e,this.updatedAt=Le.now(),this.canTrackVelocity===null&&e!==void 0&&(this.canTrackVelocity=Mr(this.current))}setPrevFrameValue(e=this.current){this.prevFrameValue=e,this.prevUpdatedAt=this.updatedAt}onChange(e){return this.on(`change`,e)}on(e,t){this.events[e]||(this.events[e]=new z);let n=this.events[e].add(t);return e===`change`?()=>{n(),V.read(()=>{this.events.change.getSize()||this.stop()})}:n}clearListeners(){for(let e in this.events)this.events[e].clear()}attach(e,t){this.passiveEffect=e,this.stopPassiveEffect=t}set(e){this.passiveEffect?this.passiveEffect(e,this.updateAndNotify):this.updateAndNotify(e)}setWithVelocity(e,t,n){this.set(t),this.prev=void 0,this.prevFrameValue=e,this.prevUpdatedAt=this.updatedAt-n}jump(e,t=!0){this.updateAndNotify(e),this.prev=e,this.prevUpdatedAt=this.prevFrameValue=void 0,t&&this.stop(),this.stopPassiveEffect&&this.stopPassiveEffect()}dirty(){this.events.change?.notify(this.current)}addDependent(e){this.dependents||=new Set,this.dependents.add(e)}removeDependent(e){this.dependents&&this.dependents.delete(e)}get(){return Nr.current&&Nr.current.push(this),this.current}getPrevious(){return this.prev}getVelocity(){let e=Le.now();if(!this.canTrackVelocity||this.prevFrameValue===void 0||e-this.updatedAt>jr)return 0;let t=Math.min(this.updatedAt-this.prevUpdatedAt,jr);return ae(parseFloat(this.current)-parseFloat(this.prevFrameValue),t)}start(e){return this.stop(),new Promise(t=>{this.hasAnimated=!0,this.animation=e(t),this.events.animationStart&&this.events.animationStart.notify()}).then(()=>{this.events.animationComplete&&this.events.animationComplete.notify(),this.clearAnimation()})}stop(){this.animation&&(this.animation.stop(),this.events.animationCancel&&this.events.animationCancel.notify()),this.clearAnimation()}isAnimating(){return!!this.animation}clearAnimation(){delete this.animation}destroy(){this.dependents?.clear(),this.events.destroy?.notify(),this.clearListeners(),this.stop(),this.stopPassiveEffect&&this.stopPassiveEffect()}};function Fr(e,t){return new Pr(e,t)}function Ir(e,t){if(e?.inherit&&t){let{inherit:n,...r}=e;return{...t,...r}}return e}function Lr(e,t){let n=e?.[t]??e?.default??e;return n===e?n:Ir(n,e)}var Rr={type:`spring`,stiffness:500,damping:25,restSpeed:10},zr=e=>({type:`spring`,stiffness:550,damping:e===0?2*Math.sqrt(550):30,restSpeed:10}),Br={type:`keyframes`,duration:.8},Vr={type:`keyframes`,ease:[.25,.1,.35,1],duration:.3},Hr=(e,{keyframes:t})=>t.length>2?Br:Bn.has(e)?e.startsWith(`scale`)?zr(t[1]):Rr:Vr,Ur=new Set([`when`,`delay`,`delayChildren`,`staggerChildren`,`staggerDirection`,`repeat`,`repeatType`,`repeatDelay`,`from`,`elapsed`]);function Wr(e){for(let t in e)if(!Ur.has(t))return!0;return!1}var Gr=(e,t,n,r={},i,a)=>o=>{let s=Lr(r,e)||{},c=s.delay||r.delay||0,{elapsed:l=0}=r;l-=B(c);let u={keyframes:Array.isArray(n)?n:[null,n],ease:`easeOut`,velocity:t.getVelocity(),...s,delay:-l,onUpdate:e=>{t.set(e),s.onUpdate&&s.onUpdate(e)},onComplete:()=>{o(),s.onComplete&&s.onComplete()},name:e,motionValue:t,element:a?void 0:i};Wr(s)||Object.assign(u,Hr(e,u)),u.duration&&=B(u.duration),u.repeatDelay&&=B(u.repeatDelay),u.from!==void 0&&(u.keyframes[0]=u.from);let d=!1;if((u.type===!1||u.duration===0&&!u.repeatDelay)&&(xr(u),u.delay===0&&(d=!0)),(P.instantAnimations||P.skipAnimations||i?.shouldSkipAnimations||s.skipAnimations)&&(d=!0,xr(u),u.delay=0),u.allowFlatten=!s.type&&!s.ease,d&&!a&&t.get()!==void 0){let e=bn(u.keyframes,s);if(e!==void 0){V.update(()=>{u.onUpdate(e),u.onComplete()});return}}return s.isSync?new Tn(u):new kr(u)},Kr=/^var\(--(?:([\w-]+)|([\w-]+), ?([a-zA-Z\d ()%#.,-]+))\)/u;function qr(e){let t=Kr.exec(e);if(!t)return[,];let[,n,r,i]=t;return[`--${n??r}`,i]}function Jr(e,t,n=1){`${e}`;let[r,i]=qr(e);if(!r)return;let a=window.getComputedStyle(t).getPropertyValue(r);if(a){let e=a.trim();return F(e)?parseFloat(e):e}return Ve(i)?Jr(i,t,n+1):i}function Yr(e){let t=[{},{}];return e?.values.forEach((e,n)=>{t[0][n]=e.get(),t[1][n]=e.getVelocity()}),t}function Xr(e,t,n,r){if(typeof t==`function`){let[i,a]=Yr(r);t=t(n===void 0?e.custom:n,i,a)}if(typeof t==`string`&&(t=e.variants&&e.variants[t]),typeof t==`function`){let[i,a]=Yr(r);t=t(n===void 0?e.custom:n,i,a)}return t}function Zr(e,t,n){let r=e.getProps();return Xr(r,t,n===void 0?r.custom:n,e)}var Qr=new Set([`width`,`height`,`top`,`left`,`right`,`bottom`,...zn]),$r=e=>Array.isArray(e);function ei(e,t,n){e.hasValue(t)?e.getValue(t).set(n):e.addValue(t,Fr(n))}function ti(e){return $r(e)?e[e.length-1]||0:e}function ni(e,t){let{transitionEnd:n={},transition:r={},...i}=Zr(e,t)||{};i={...i,...n};for(let t in i)ei(e,t,ti(i[t]))}var ri=e=>!!(e&&e.getVelocity);function ii(e){return!!(ri(e)&&e.add)}function ai(e,t){let n=e.getValue(`willChange`);if(ii(n))return n.add(t);if(!n&&P.WillChange){let n=new P.WillChange(`auto`);e.addValue(`willChange`,n),n.add(t)}}function oi(e){return e.replace(/([A-Z])/g,e=>`-${e.toLowerCase()}`)}var si=`data-`+oi(`framerAppearId`);function ci(e){return e.props[si]}function li({protectedKeys:e,needsAnimating:t},n){let r=e.hasOwnProperty(n)&&t[n]!==!0;return t[n]=!1,r}function ui(e,t,{delay:n=0,transitionOverride:r,type:i}={}){let{transition:a,transitionEnd:o,...s}=t,c=e.getDefaultTransition();a=a?Ir(a,c):c;let l=a?.reduceMotion,u=a?.skipAnimations;r&&(a=r);let d=[],f=i&&e.animationState&&e.animationState.getState()[i],p=a?.path;p&&p.animateVisualElement(e,s,a,n,d);for(let t in s){let r=e.getValue(t,e.latestValues[t]??null),i=s[t];if(i===void 0||f&&li(f,t))continue;let o={delay:n,...Lr(a||{},t)};u&&(o.skipAnimations=!0);let c=r.get();if(c!==void 0&&!r.isAnimating()&&!Array.isArray(i)&&i===c&&!o.velocity){V.update(()=>r.set(i));continue}let p=!1;if(window.MotionHandoffAnimation){let n=ci(e);if(n){let e=window.MotionHandoffAnimation(n,t,V);e!==null&&(o.startTime=e,p=!0)}}ai(e,t);let m=l??e.shouldReduceMotion;r.start(Gr(t,r,i,m&&Qr.has(t)?{type:!1}:o,e,p));let h=r.animation;h&&d.push(h)}if(o){let t=()=>V.update(()=>{o&&ni(e,o)});d.length?Promise.all(d).then(t):t()}return d}function di(e,t,n={}){let r=Zr(e,t,n.type===`exit`?e.presenceContext?.custom:void 0),{transition:i=e.getDefaultTransition()||{}}=r||{};n.transitionOverride&&(i=n.transitionOverride);let a=r?()=>Promise.all(ui(e,r,n)):()=>Promise.resolve(),o=e.variantChildren&&e.variantChildren.size?(r=0)=>{let{delayChildren:a=0,staggerChildren:o,staggerDirection:s}=i;return fi(e,t,r,a,o,s,n)}:()=>Promise.resolve(),{when:s}=i;if(s){let[e,t]=s===`beforeChildren`?[a,o]:[o,a];return e().then(()=>t())}else return Promise.all([a(),o(n.delay)])}function fi(e,t,n=0,r=0,i=0,a=1,o){let s=[];for(let c of e.variantChildren)c.notify(`AnimationStart`,t),s.push(di(c,t,{...o,delay:n+(typeof r==`function`?0:r)+Ar(e.variantChildren,c,r,i,a)}).then(()=>c.notify(`AnimationComplete`,t)));return Promise.all(s)}function pi(e,t,n={}){e.notify(`AnimationStart`,t);let r;if(Array.isArray(t)){let i=t.map(t=>di(e,t,n));r=Promise.all(i)}else if(typeof t==`string`)r=di(e,t,n);else{let i=typeof t==`function`?Zr(e,t,n.custom):t;r=Promise.all(ui(e,i,n))}return r.then(()=>{e.notify(`AnimationComplete`,t)})}var mi={test:e=>e===`auto`,parse:e=>e},hi=e=>t=>t.test(e),gi=[We,H,ot,at,ct,st,mi],_i=e=>gi.find(hi(e));function vi(e){return typeof e==`number`?e===0:e===null?!0:e===`none`||e===`0`||te(e)}var yi=new Set([`brightness`,`contrast`,`saturate`,`opacity`]);function bi(e){let[t,n]=e.slice(0,-1).split(`(`);if(t===`drop-shadow`)return e;let[r]=n.match(Je)||[];if(!r)return e;let i=n.replace(r,``),a=+!!yi.has(t);return r!==n&&(a*=100),t+`(`+a+i+`)`}var xi=/\b([a-z-]*)\(.*?\)/gu,Si={...Dt,getAnimatableNone:e=>{let t=e.match(xi);return t?t.map(bi).join(` `):e}},Ci={...Dt,getAnimatableNone:e=>{let t=Dt.parse(e);return Dt.createTransformer(e)(t.map(e=>typeof e==`number`?0:typeof e==`object`?{...e,alpha:1}:e))}},wi={...We,transform:Math.round},Ti={borderWidth:H,borderTopWidth:H,borderRightWidth:H,borderBottomWidth:H,borderLeftWidth:H,borderRadius:H,borderTopLeftRadius:H,borderTopRightRadius:H,borderBottomRightRadius:H,borderBottomLeftRadius:H,width:H,maxWidth:H,height:H,maxHeight:H,top:H,right:H,bottom:H,left:H,inset:H,insetBlock:H,insetBlockStart:H,insetBlockEnd:H,insetInline:H,insetInlineStart:H,insetInlineEnd:H,padding:H,paddingTop:H,paddingRight:H,paddingBottom:H,paddingLeft:H,paddingBlock:H,paddingBlockStart:H,paddingBlockEnd:H,paddingInline:H,paddingInlineStart:H,paddingInlineEnd:H,margin:H,marginTop:H,marginRight:H,marginBottom:H,marginLeft:H,marginBlock:H,marginBlockStart:H,marginBlockEnd:H,marginInline:H,marginInlineStart:H,marginInlineEnd:H,fontSize:H,backgroundPositionX:H,backgroundPositionY:H,rotate:at,pathRotation:at,rotateX:at,rotateY:at,rotateZ:at,scale:Ke,scaleX:Ke,scaleY:Ke,scaleZ:Ke,skew:at,skewX:at,skewY:at,distance:H,translateX:H,translateY:H,translateZ:H,x:H,y:H,z:H,perspective:H,transformPerspective:H,opacity:Ge,originX:lt,originY:lt,originZ:H,zIndex:wi,fillOpacity:Ge,strokeOpacity:Ge,numOctaves:wi},Ei={...Ti,color:dt,backgroundColor:dt,outlineColor:dt,fill:dt,stroke:dt,borderColor:dt,borderTopColor:dt,borderRightColor:dt,borderBottomColor:dt,borderLeftColor:dt,filter:Si,WebkitFilter:Si,mask:Ci,WebkitMask:Ci},Di=e=>Ei[e],Oi=new Set([Si,Ci]);function ki(e,t){let n=Di(e);return Oi.has(n)||(n=Dt),n.getAnimatableNone?n.getAnimatableNone(t):void 0}var Ai=new Set([`auto`,`none`,`0`]);function U(e,t,n){let r=0,i;for(;r{e.getValue(t).set(n)}),this.resolveNoneKeyframes()}},Mi=[`borderTopLeftRadius`,`borderTopRightRadius`,`borderBottomRightRadius`,`borderBottomLeftRadius`];function Ni(e,t,n){if(e==null)return[];if(e instanceof EventTarget)return[e];if(typeof e==`string`){let r=document;t&&(r=t.current);let i=n?.[e]??r.querySelectorAll(e);return i?Array.from(i):[]}return Array.from(e).filter(e=>e!=null)}var Pi=(e,t)=>t&&typeof e==`number`?t.transform(e):e;function Fi(e){return I(e)&&`offsetHeight`in e&&!(`ownerSVGElement`in e)}var{schedule:Ii,cancel:Li}=je(queueMicrotask,!1),Ri={x:!1,y:!1};function zi(){return Ri.x||Ri.y}function Bi(e){return e===`x`||e===`y`?Ri[e]?null:(Ri[e]=!0,()=>{Ri[e]=!1}):Ri.x||Ri.y?null:(Ri.x=Ri.y=!0,()=>{Ri.x=Ri.y=!1})}function Vi(e,t){let n=Ni(e),r=new AbortController;return[n,{passive:!0,...t,signal:r.signal},()=>r.abort()]}function Hi(e){return!(e.pointerType===`touch`||zi())}function Ui(e,t,n={}){let[r,i,a]=Vi(e,n);return r.forEach(e=>{let n=!1,r=!1,a,o=()=>{e.removeEventListener(`pointerleave`,u)},s=e=>{a&&=(a(e),void 0),o()},c=e=>{n=!1,window.removeEventListener(`pointerup`,c),window.removeEventListener(`pointercancel`,c),r&&(r=!1,s(e))},l=()=>{n=!0,window.addEventListener(`pointerup`,c,i),window.addEventListener(`pointercancel`,c,i)},u=e=>{if(e.pointerType!==`touch`){if(n){r=!0;return}s(e)}};e.addEventListener(`pointerenter`,n=>{if(!Hi(n))return;r=!1;let o=t(e,n);typeof o==`function`&&(a=o,e.addEventListener(`pointerleave`,u,i))},i),e.addEventListener(`pointerdown`,l,i)}),a}var Wi=(e,t)=>t?e===t?!0:Wi(e,t.parentElement):!1,Gi=e=>e.pointerType===`mouse`?typeof e.button!=`number`||e.button<=0:e.isPrimary!==!1,Ki=new Set([`BUTTON`,`INPUT`,`SELECT`,`TEXTAREA`,`A`]);function qi(e){return Ki.has(e.tagName)||e.isContentEditable===!0}var Ji=new Set([`INPUT`,`SELECT`,`TEXTAREA`]);function Yi(e){return Ji.has(e.tagName)||e.isContentEditable===!0}var Xi=new WeakSet;function Zi(e){return t=>{t.key===`Enter`&&e(t)}}function Qi(e,t){e.dispatchEvent(new PointerEvent(`pointer`+t,{isPrimary:!0,bubbles:!0}))}var $i=(e,t)=>{let n=e.currentTarget;if(!n)return;let r=Zi(()=>{if(Xi.has(n))return;Qi(n,`down`);let e=Zi(()=>{Qi(n,`up`)});n.addEventListener(`keyup`,e,t),n.addEventListener(`blur`,()=>Qi(n,`cancel`),t)});n.addEventListener(`keydown`,r,t),n.addEventListener(`blur`,()=>n.removeEventListener(`keydown`,r),t)};function ea(e){return Gi(e)&&!zi()}var ta=new WeakSet;function na(e,t,n={}){let[r,i,a]=Vi(e,n),o=e=>{let r=e.currentTarget;if(!ea(e)||ta.has(e))return;Xi.add(r),n.stopPropagation&&ta.add(e);let a=t(r,e),o={...i,capture:!0},s=(e,t)=>{window.removeEventListener(`pointerup`,c,o),window.removeEventListener(`pointercancel`,l,o),Xi.has(r)&&Xi.delete(r),ea(e)&&typeof a==`function`&&a(e,{success:t})},c=e=>{s(e,r===window||r===document||n.useGlobalTarget||Wi(r,e.target))},l=e=>{s(e,!1)};window.addEventListener(`pointerup`,c,o),window.addEventListener(`pointercancel`,l,o)};return r.forEach(e=>{(n.useGlobalTarget?window:e).addEventListener(`pointerdown`,o,i),Fi(e)&&(e.addEventListener(`focus`,e=>$i(e,i)),!qi(e)&&!e.hasAttribute(`tabindex`)&&(e.tabIndex=0))}),a}function ra(e){return I(e)&&`ownerSVGElement`in e}var ia=new WeakMap,aa,oa=(e,t,n)=>(r,i)=>i&&i[0]?i[0][e+`Size`]:ra(r)&&`getBBox`in r?r.getBBox()[t]:r[n],sa=oa(`inline`,`width`,`offsetWidth`),ca=oa(`block`,`height`,`offsetHeight`);function la({target:e,borderBoxSize:t}){ia.get(e)?.forEach(n=>{n(e,{get width(){return sa(e,t)},get height(){return ca(e,t)}})})}function ua(e){e.forEach(la)}function da(){typeof ResizeObserver>`u`||(aa=new ResizeObserver(ua))}function fa(e,t){aa||da();let n=Ni(e);return n.forEach(e=>{let n=ia.get(e);n||(n=new Set,ia.set(e,n)),n.add(t),aa?.observe(e)}),()=>{n.forEach(e=>{let n=ia.get(e);n?.delete(t),n?.size||aa?.unobserve(e)})}}var pa=new Set,ma;function ha(){ma=()=>{let e={get width(){return window.innerWidth},get height(){return window.innerHeight}};pa.forEach(t=>t(e))},window.addEventListener(`resize`,ma)}function ga(e){return pa.add(e),ma||ha(),()=>{pa.delete(e),!pa.size&&typeof ma==`function`&&(window.removeEventListener(`resize`,ma),ma=void 0)}}function _a(e,t){return typeof e==`function`?ga(e):fa(e,t)}var va={value:null,addProjectionMetrics:null};function ya(e){return ra(e)&&e.tagName===`svg`}function ba(...e){let t=!Array.isArray(e[0]),n=t?0:-1,r=e[0+n],i=e[1+n],a=e[2+n],o=e[3+n],s=pn(i,a,o);return t?s(r):s}var xa=[...gi,dt,Dt],Sa=e=>xa.find(hi(e)),Ca=()=>({translate:0,scale:1,origin:0,originPoint:0}),wa=()=>({x:Ca(),y:Ca()}),Ta=()=>({min:0,max:0}),Ea=()=>({x:Ta(),y:Ta()}),Da=new WeakMap;function Oa(e){return typeof e==`object`&&!!e&&typeof e.start==`function`}function ka(e){return typeof e==`string`||Array.isArray(e)}var Aa=[`animate`,`whileInView`,`whileFocus`,`whileHover`,`whileTap`,`whileDrag`,`exit`],ja=[`initial`,...Aa];function Ma(e){return Oa(e.animate)||ja.some(t=>ka(e[t]))}function Na(e){return!!(Ma(e)||e.variants)}function Pa(e,t,n){for(let r in t){let i=t[r],a=n[r];if(ri(i))e.addValue(r,i);else if(ri(a))e.addValue(r,Fr(i,{owner:e}));else if(a!==i)if(e.hasValue(r)){let t=e.getValue(r);t.liveStyle===!0?t.jump(i):t.hasAnimated||t.set(i)}else{let t=e.getStaticValue(r);e.addValue(r,Fr(t===void 0?i:t,{owner:e}))}}for(let r in n)t[r]===void 0&&e.removeValue(r);return t}var Fa={current:null},Ia={current:!1},La=typeof window<`u`;function Ra(){if(Ia.current=!0,La)if(window.matchMedia){let e=window.matchMedia(`(prefers-reduced-motion)`),t=()=>Fa.current=e.matches;e.addEventListener(`change`,t),t()}else Fa.current=!1}var za=[`AnimationStart`,`AnimationComplete`,`Update`,`BeforeLayoutMeasure`,`LayoutMeasure`,`LayoutAnimationStart`,`LayoutAnimationComplete`],Ba={};function Va(e){Ba=e}function Ha(){return Ba}var Ua=class{scrapeMotionValuesFromProps(e,t,n){return{}}constructor({parent:e,props:t,presenceContext:n,reducedMotionConfig:r,skipAnimations:i,blockInitialAnimation:a,visualState:o},s={}){this.current=null,this.children=new Set,this.isVariantNode=!1,this.isControllingVariants=!1,this.shouldReduceMotion=null,this.shouldSkipAnimations=!1,this.values=new Map,this.KeyframeResolver=$n,this.features={},this.valueSubscriptions=new Map,this.prevMotionValues={},this.hasBeenMounted=!1,this.events={},this.propEventSubscriptions={},this.notifyUpdate=()=>this.notify(`Update`,this.latestValues),this.render=()=>{this.current&&(this.triggerBuild(),this.renderInstance(this.current,this.renderState,this.props.style,this.projection))},this.renderScheduledAt=0,this.scheduleRender=()=>{let e=Le.now();this.renderScheduledAtthis.bindToMotionValue(t,e)),this.reducedMotionConfig===`never`?this.shouldReduceMotion=!1:this.reducedMotionConfig===`always`?this.shouldReduceMotion=!0:(Ia.current||Ra(),this.shouldReduceMotion=Fa.current),this.shouldSkipAnimations=this.skipAnimationsConfig??!1,this.parent?.addChild(this),this.update(this.props,this.presenceContext),this.hasBeenMounted=!0}unmount(){this.projection&&this.projection.unmount(),Me(this.notifyUpdate),Me(this.render),this.valueSubscriptions.forEach(e=>e()),this.valueSubscriptions.clear(),this.removeFromVariantTree&&this.removeFromVariantTree(),this.parent?.removeChild(this);for(let e in this.events)this.events[e].clear();for(let e in this.features){let t=this.features[e];t&&(t.unmount(),t.isMounted=!1)}this.current=null}addChild(e){this.children.add(e),this.enteringChildren??=new Set,this.enteringChildren.add(e)}removeChild(e){this.children.delete(e),this.enteringChildren&&this.enteringChildren.delete(e)}bindToMotionValue(e,t){if(this.valueSubscriptions.has(e)&&this.valueSubscriptions.get(e)(),t.accelerate&&Sr.has(e)&&this.current instanceof HTMLElement){let{factory:n,keyframes:r,times:i,ease:a,duration:o}=t.accelerate,s=new fr({element:this.current,name:e,keyframes:r,times:i,ease:a,duration:B(o)}),c=n(s);this.valueSubscriptions.set(e,()=>{c(),s.cancel()});return}let n=Bn.has(e);n&&this.onBindTransform&&this.onBindTransform();let r=t.on(`change`,t=>{this.latestValues[e]=t,this.props.onUpdate&&V.preRender(this.notifyUpdate),n&&this.projection&&(this.projection.isTransformDirty=!0),this.scheduleRender()}),i;typeof window<`u`&&window.MotionCheckAppearSync&&(i=window.MotionCheckAppearSync(this,e,t)),this.valueSubscriptions.set(e,()=>{r(),i&&i()})}sortNodePosition(e){return!this.current||!this.sortInstanceNodePosition||this.type!==e.type?0:this.sortInstanceNodePosition(this.current,e.current)}updateFeatures(){let e=`animation`;for(e in Ba){let t=Ba[e];if(!t)continue;let{isEnabled:n,Feature:r}=t;if(!this.features[e]&&r&&n(this.props)&&(this.features[e]=new r(this)),this.features[e]){let t=this.features[e];t.isMounted?t.update():(t.mount(),t.isMounted=!0)}}}triggerBuild(){this.build(this.renderState,this.latestValues,this.props)}measureViewportBox(){return this.current?this.measureInstanceViewportBox(this.current,this.props):Ea()}getStaticValue(e){return this.latestValues[e]}setStaticValue(e,t){this.latestValues[e]=t}update(e,t){(e.transformTemplate||this.props.transformTemplate)&&this.scheduleRender(),this.prevProps=this.props,this.props=e,this.prevPresenceContext=this.presenceContext,this.presenceContext=t;for(let t=0;tt.variantChildren.delete(e)}addValue(e,t){let n=this.values.get(e);t!==n&&(n&&this.removeValue(e),this.bindToMotionValue(e,t),this.values.set(e,t),this.latestValues[e]=t.get())}removeValue(e){this.values.delete(e);let t=this.valueSubscriptions.get(e);t&&(t(),this.valueSubscriptions.delete(e)),delete this.latestValues[e],this.removeValueFromRenderState(e,this.renderState)}hasValue(e){return this.values.has(e)}getValue(e,t){if(this.props.values&&this.props.values[e])return this.props.values[e];let n=this.values.get(e);return n===void 0&&t!==void 0&&(n=Fr(t===null?void 0:t,{owner:this}),this.addValue(e,n)),n}readValue(e,t){let n=this.latestValues[e]!==void 0||!this.current?this.latestValues[e]:this.getBaseTargetFromProps(this.props,e)??this.readValueFromInstance(this.current,e,this.options);return n!=null&&(typeof n==`string`&&(F(n)||te(n))?n=parseFloat(n):!Sa(n)&&Dt.test(t)&&(n=ki(e,t)),this.setBaseTarget(e,ri(n)?n.get():n)),ri(n)?n.get():n}setBaseTarget(e,t){this.baseTarget[e]=t}getBaseTarget(e){let{initial:t}=this.props,n;if(typeof t==`string`||typeof t==`object`){let r=Xr(this.props,t,this.presenceContext?.custom);r&&(n=r[e])}if(t&&n!==void 0)return n;let r=this.getBaseTargetFromProps(this.props,e);return r!==void 0&&!ri(r)?r:this.initialValues[e]!==void 0&&n===void 0?void 0:this.baseTarget[e]}on(e,t){return this.events[e]||(this.events[e]=new z),this.events[e].add(t)}notify(e,...t){this.events[e]&&this.events[e].notify(...t)}scheduleRenderMicrotask(){Ii.render(this.render)}},Wa=class extends Ua{constructor(){super(...arguments),this.KeyframeResolver=ji}sortInstanceNodePosition(e,t){return e.compareDocumentPosition(t)&2?1:-1}getBaseTargetFromProps(e,t){let n=e.style;return n?n[t]:void 0}removeValueFromRenderState(e,{vars:t,style:n}){delete t[e],delete n[e]}handleChildMotionValue(){this.childSubscription&&(this.childSubscription(),delete this.childSubscription);let{children:e}=this.props;ri(e)&&(this.childSubscription=e.on(`change`,e=>{this.current&&(this.current.textContent=`${e}`)}))}},Ga=class{constructor(e){this.isMounted=!1,this.node=e}update(){}};function Ka({top:e,left:t,right:n,bottom:r}){return{x:{min:t,max:n},y:{min:e,max:r}}}function qa({x:e,y:t}){return{top:t.min,right:e.max,bottom:t.max,left:e.min}}function Ja(e,t){if(!t)return e;let n=t({x:e.left,y:e.top}),r=t({x:e.right,y:e.bottom});return{top:n.y,left:n.x,bottom:r.y,right:r.x}}function Ya(e){return e===void 0||e===1}function Xa({scale:e,scaleX:t,scaleY:n}){return!Ya(e)||!Ya(t)||!Ya(n)}function Za(e){return Xa(e)||Qa(e)||e.z||e.rotate||e.rotateX||e.rotateY||e.skewX||e.skewY}function Qa(e){return $a(e.x)||$a(e.y)}function $a(e){return e&&e!==`0%`}function eo(e,t,n){return n+t*(e-n)}function to(e,t,n,r,i){return i!==void 0&&(e=eo(e,i,r)),eo(e,n,r)+t}function no(e,t=0,n=1,r,i){e.min=to(e.min,t,n,r,i),e.max=to(e.max,t,n,r,i)}function ro(e,{x:t,y:n}){no(e.x,t.translate,t.scale,t.originPoint),no(e.y,n.translate,n.scale,n.originPoint)}var io=.999999999999,ao=1.0000000000001;function oo(e,t,n,r=!1){let i=n.length;if(!i)return;t.x=t.y=1;let a,o;for(let s=0;sio&&(t.x=1),t.yio&&(t.y=1)}function so(e,t){e.min+=t,e.max+=t}function co(e,t,n,r,i=.5){no(e,t,n,jt(e.min,e.max,i),r)}function W(e,t){return typeof e==`string`?parseFloat(e)/100*(t.max-t.min):e}function lo(e,t,n){let r=n??e;co(e.x,W(t.x,r.x),t.scaleX,t.scale,t.originX),co(e.y,W(t.y,r.y),t.scaleY,t.scale,t.originY)}function uo(e,t){return Ka(Ja(e.getBoundingClientRect(),t))}function fo(e,t,n){let r=uo(e,n),{scroll:i}=t;return i&&(so(r.x,i.offset.x),so(r.y,i.offset.y)),r}var po={x:`translateX`,y:`translateY`,z:`translateZ`,transformPerspective:`perspective`},mo=zn.length;function ho(e,t,n){let r=``,i=!0;for(let a=0;a{if(!t.target)return e;if(typeof e==`string`)if(H.test(e))e=parseFloat(e);else return e;return`${vo(e,t.target.x)}% ${vo(e,t.target.y)}%`}},bo={correct:(e,{treeScale:t,projectionDelta:n})=>{let r=e,i=Dt.parse(e);if(i.length>5)return r;let a=Dt.createTransformer(e),o=typeof i[0]==`number`?0:1,s=n.x.scale*t.x,c=n.y.scale*t.y;i[0+o]/=s,i[1+o]/=c;let l=jt(s,c,.5);return typeof i[2+o]==`number`&&(i[2+o]/=l),typeof i[3+o]==`number`&&(i[3+o]/=l),a(i)}},xo={borderRadius:{...yo,applyTo:[...Mi]},borderTopLeftRadius:yo,borderTopRightRadius:yo,borderBottomLeftRadius:yo,borderBottomRightRadius:yo,boxShadow:bo};function So(e,{layout:t,layoutId:n}){return Bn.has(e)||e.startsWith(`origin`)||(t||n!==void 0)&&(!!xo[e]||e===`opacity`)}function Co(e,t,n){let r=e.style,i=t?.style,a={};if(!r)return a;for(let t in r)(ri(r[t])||i&&ri(i[t])||So(t,e)||n?.getValue(t)?.liveStyle!==void 0)&&(a[t]=r[t]);return a}function wo(e){return window.getComputedStyle(e)}var To=class extends Wa{constructor(){super(...arguments),this.type=`html`,this.renderInstance=_o}readValueFromInstance(e,t){if(Bn.has(t))return this.projection?.isProjecting?Fn(t):Ln(e,t);{let n=wo(e),r=(ze(t)?n.getPropertyValue(t):n[t])||0;return typeof r==`string`?r.trim():r}}measureInstanceViewportBox(e,{transformPagePoint:t}){return uo(e,t)}build(e,t,n){go(e,t,n.transformTemplate)}scrapeMotionValuesFromProps(e,t,n){return Co(e,t,n)}},Eo={offset:`stroke-dashoffset`,array:`stroke-dasharray`},Do={offset:`strokeDashoffset`,array:`strokeDasharray`};function Oo(e,t,n=1,r=0,i=!0){e.pathLength=1;let a=i?Eo:Do;e[a.offset]=`${-r}`,e[a.array]=`${t} ${n}`}var ko=[`offsetDistance`,`offsetPath`,`offsetRotate`,`offsetAnchor`];function Ao(e,{attrX:t,attrY:n,attrScale:r,pathLength:i,pathSpacing:a=1,pathOffset:o=0,...s},c,l,u){if(go(e,s,l),c){e.style.viewBox&&(e.attrs.viewBox=e.style.viewBox);return}e.attrs=e.style,e.style={};let{attrs:d,style:f}=e;d.transform&&(f.transform=d.transform,delete d.transform),(f.transform||d.transformOrigin)&&(f.transformOrigin=d.transformOrigin??`50% 50%`,delete d.transformOrigin),f.transform&&(f.transformBox=u?.transformBox??`fill-box`,delete d.transformBox);for(let e of ko)d[e]!==void 0&&(f[e]=d[e],delete d[e]);t!==void 0&&(d.x=t),n!==void 0&&(d.y=n),r!==void 0&&(d.scale=r),i!==void 0&&Oo(d,i,a,o,!1)}var jo=new Set([`baseFrequency`,`diffuseConstant`,`kernelMatrix`,`kernelUnitLength`,`keySplines`,`keyTimes`,`limitingConeAngle`,`markerHeight`,`markerWidth`,`numOctaves`,`targetX`,`targetY`,`surfaceScale`,`specularConstant`,`specularExponent`,`stdDeviation`,`tableValues`,`viewBox`,`gradientTransform`,`pathLength`,`startOffset`,`textLength`,`lengthAdjust`]),Mo=e=>typeof e==`string`&&e.toLowerCase()===`svg`;function No(e,t,n,r){_o(e,t,void 0,r);for(let n in t.attrs)e.setAttribute(jo.has(n)?n:oi(n),t.attrs[n])}function Po(e,t,n){let r=Co(e,t,n);for(let n in e)if(ri(e[n])||ri(t[n])){let t=zn.indexOf(n)===-1?n:`attr`+n.charAt(0).toUpperCase()+n.substring(1);r[t]=e[n]}return r}var Fo=class extends Wa{constructor(){super(...arguments),this.type=`svg`,this.isSVGTag=!1,this.measureInstanceViewportBox=Ea}getBaseTargetFromProps(e,t){return e[t]}readValueFromInstance(e,t){if(Bn.has(t)){let e=Di(t);return e&&e.default||0}return t=jo.has(t)?t:oi(t),e.getAttribute(t)}scrapeMotionValuesFromProps(e,t,n){return Po(e,t,n)}build(e,t,n){Ao(e,t,this.isSVGTag,n.transformTemplate,n.style)}renderInstance(e,t,n,r){No(e,t,n,r)}mount(e){this.isSVGTag=Mo(e.tagName),super.mount(e)}},Io=ja.length;function Lo(e){if(!e)return;if(!e.isControllingVariants){let t=e.parent&&Lo(e.parent)||{};return e.props.initial!==void 0&&(t.initial=e.props.initial),t}let t={};for(let n=0;nPromise.all(t.map(({animation:t,options:n})=>pi(e,t,n)))}function Ho(e){let t=Vo(e),n=Go(),r=!0,i=!1,a=t=>(n,r)=>{let i=Zr(e,r,t===`exit`?e.presenceContext?.custom:void 0);if(i){let{transition:e,transitionEnd:t,...r}=i;n={...n,...r,...t}}return n};function o(n){t=n(e)}function s(o){let{props:s}=e,c=Lo(e.parent)||{},l=[],u=new Set,d={},f=1/0;for(let t=0;tf&&g,x=!1,S=Array.isArray(h)?h:[h],C=S.reduce(a(p),{});_===!1&&(C={});let{prevResolvedValues:w={}}=m,T={...w,...C},E=t=>{b=!0,u.has(t)&&(x=!0,u.delete(t)),m.needsAnimating[t]=!0;let n=e.getValue(t);n&&(n.liveStyle=!1)};for(let e in T){let t=C[e],n=w[e];if(d.hasOwnProperty(e))continue;let r=!1;r=$r(t)&&$r(n)?!Ro(t,n)||y:t!==n,r?t==null?u.add(e):E(e):t!==void 0&&u.has(e)?E(e):m.protectedKeys[e]=!0}m.prevProp=h,m.prevResolvedValues=C,m.isActive&&(d={...d,...C}),(r||i)&&e.blockInitialAnimation&&(b=!1);let D=v&&y;b&&(!D||x)&&l.push(...S.map(t=>{let n={type:p};if(typeof t==`string`&&(r||i)&&!D&&e.manuallyAnimateOnMount&&e.parent){let{parent:r}=e,i=Zr(r,t);if(r.enteringChildren&&i){let{delayChildren:t}=i.transition||{};n.delay=Ar(r.enteringChildren,e,t)}}return{animation:t,options:n}}))}if(u.size){let t={};if(typeof s.initial!=`boolean`){let n=Zr(e,Array.isArray(s.initial)?s.initial[0]:s.initial);n&&n.transition&&(t.transition=n.transition)}u.forEach(n=>{let r=e.getBaseTarget(n),i=e.getValue(n);i&&(i.liveStyle=!0),t[n]=r??null}),l.push({animation:t})}let p=!!l.length;return r&&(s.initial===!1||s.initial===s.animate)&&!e.manuallyAnimateOnMount&&(p=!1),r=!1,i=!1,p?t(l):Promise.resolve()}function c(t,r){if(n[t].isActive===r)return Promise.resolve();e.variantChildren?.forEach(e=>e.animationState?.setActive(t,r)),n[t].isActive=r;let i=s(t);for(let e in n)n[e].protectedKeys={};return i}return{animateChanges:s,setActive:c,setAnimateFunction:o,getState:()=>n,reset:()=>{n=Go(),i=!0}}}function Uo(e,t){return typeof t==`string`?t!==e:Array.isArray(t)?!Ro(t,e):!1}function Wo(e=!1){return{isActive:e,protectedKeys:{},needsAnimating:{},prevResolvedValues:{}}}function Go(){return{animate:Wo(!0),whileInView:Wo(),whileHover:Wo(),whileTap:Wo(),whileDrag:Wo(),whileFocus:Wo(),exit:Wo()}}function Ko(e,t){e.min=t.min,e.max=t.max}function qo(e,t){Ko(e.x,t.x),Ko(e.y,t.y)}function Jo(e,t){e.translate=t.translate,e.scale=t.scale,e.originPoint=t.originPoint,e.origin=t.origin}var Yo=.9999,Xo=1.0001,Zo=-.01,Qo=.01;function $o(e){return e.max-e.min}function es(e,t,n){return Math.abs(e-t)<=n}function ts(e,t,n,r=.5){e.origin=r,e.originPoint=jt(t.min,t.max,e.origin),e.scale=$o(n)/$o(t),e.translate=jt(n.min,n.max,e.origin)-e.originPoint,(e.scale>=Yo&&e.scale<=Xo||isNaN(e.scale))&&(e.scale=1),(e.translate>=Zo&&e.translate<=Qo||isNaN(e.translate))&&(e.translate=0)}function ns(e,t,n,r){ts(e.x,t.x,n.x,r?r.originX:void 0),ts(e.y,t.y,n.y,r?r.originY:void 0)}function rs(e,t,n,r=0){e.min=(r?jt(n.min,n.max,r):n.min)+t.min,e.max=e.min+$o(t)}function is(e,t,n,r){rs(e.x,t.x,n.x,r?.x),rs(e.y,t.y,n.y,r?.y)}function as(e,t,n,r=0){let i=r?jt(n.min,n.max,r):n.min;e.min=t.min-i,e.max=e.min+$o(t)}function os(e,t,n,r){as(e.x,t.x,n.x,r?.x),as(e.y,t.y,n.y,r?.y)}function ss(e,t,n,r,i){return e-=t,e=eo(e,1/n,r),i!==void 0&&(e=eo(e,1/i,r)),e}function cs(e,t=0,n=1,r=.5,i,a=e,o=e){if(ot.test(t)&&(t=parseFloat(t),t=jt(o.min,o.max,t/100)-o.min),typeof t!=`number`)return;let s=jt(a.min,a.max,r);e===a&&(s-=t),e.min=ss(e.min,t,n,s,i),e.max=ss(e.max,t,n,s,i)}function ls(e,t,[n,r,i],a,o){cs(e,t[n],t[r],t[i],t.scale,a,o)}var us=[`x`,`scaleX`,`originX`],ds=[`y`,`scaleY`,`originY`];function fs(e,t,n,r){ls(e.x,t,us,n?n.x:void 0,r?r.x:void 0),ls(e.y,t,ds,n?n.y:void 0,r?r.y:void 0)}function ps(e){return e.translate===0&&e.scale===1}function ms(e){return ps(e.x)&&ps(e.y)}function hs(e,t){return e.min===t.min&&e.max===t.max}function gs(e,t){return hs(e.x,t.x)&&hs(e.y,t.y)}function _s(e,t){return Math.round(e.min)===Math.round(t.min)&&Math.round(e.max)===Math.round(t.max)}function vs(e,t){return _s(e.x,t.x)&&_s(e.y,t.y)}function ys(e){return $o(e.x)/$o(e.y)}function bs(e,t){return e.translate===t.translate&&e.scale===t.scale&&e.originPoint===t.originPoint}function xs(e){return[e(`x`),e(`y`)]}function Ss(e,t,n){let r=``,i=e.x.translate/t.x,a=e.y.translate/t.y,o=n?.z||0;if((i||a||o)&&(r=`translate3d(${i}px, ${a}px, ${o}px) `),(t.x!==1||t.y!==1)&&(r+=`scale(${1/t.x}, ${1/t.y}) `),n){let{transformPerspective:e,rotate:t,pathRotation:i,rotateX:a,rotateY:o,skewX:s,skewY:c}=n;e&&(r=`perspective(${e}px) ${r}`),t&&(r+=`rotate(${t}deg) `),i&&(r+=`rotate(${i}deg) `),a&&(r+=`rotateX(${a}deg) `),o&&(r+=`rotateY(${o}deg) `),s&&(r+=`skewX(${s}deg) `),c&&(r+=`skewY(${c}deg) `)}let s=e.x.scale*t.x,c=e.y.scale*t.y;return(s!==1||c!==1)&&(r+=`scale(${s}, ${c})`),r||`none`}var Cs=Mi.length,ws=e=>typeof e==`string`?parseFloat(e):e,Ts=e=>typeof e==`number`||H.test(e);function Es(e,t,n,r,i,a){i?(e.opacity=jt(0,n.opacity??1,Os(r)),e.opacityExit=jt(t.opacity??1,0,ks(r))):a&&(e.opacity=jt(t.opacity??1,n.opacity??1,r));for(let i=0;irt?1:n(R(e,t,r))}function js(e,t,n){let r=ri(e)?e:Fr(e);return r.start(Gr(``,r,t,n)),r.animation}function Ms(e,t,n,r={passive:!0}){return e.addEventListener(t,n,r),()=>e.removeEventListener(t,n,r)}var Ns=(e,t)=>e.depth-t.depth,Ps=class{constructor(){this.children=[],this.isDirty=!1}add(e){ee(this.children,e),this.isDirty=!0}remove(e){M(this.children,e),this.isDirty=!0}forEach(e){this.isDirty&&this.children.sort(Ns),this.isDirty=!1,this.children.forEach(e)}};function Fs(e,t){let n=Le.now(),r=({timestamp:i})=>{let a=i-n;a>=t&&(Me(r),e(a-t))};return V.setup(r,!0),()=>Me(r)}function Is(e){return ri(e)?e.get():e}var Ls=class{constructor(){this.members=[]}add(e){ee(this.members,e);for(let t=this.members.length-1;t>=0;t--){let n=this.members[t];if(n===e||n===this.lead||n===this.prevLead)continue;let r=n.instance;(!r||r.isConnected===!1)&&!n.snapshot&&(M(this.members,n),n.unmount())}e.scheduleRender()}remove(e){if(M(this.members,e),e===this.prevLead&&(this.prevLead=void 0),e===this.lead){let e=this.members[this.members.length-1];e&&this.promote(e)}}relegate(e){for(let t=this.members.indexOf(e)-1;t>=0;t--){let e=this.members[t];if(e.isPresent!==!1&&e.instance?.isConnected!==!1)return this.promote(e),!0}return!1}promote(e,t){let n=this.lead;if(e!==n&&(this.prevLead=n,this.lead=e,e.show(),n)){n.updateSnapshot(),e.scheduleRender();let{layoutDependency:r}=n.options,{layoutDependency:i}=e.options;(r===void 0||r!==i)&&(e.resumeFrom=n,t&&(n.preserveOpacity=!0),n.snapshot&&(e.snapshot=n.snapshot,e.snapshot.latestValues=n.animationValues||n.latestValues),e.root?.isUpdating&&(e.isLayoutDirty=!0)),e.options.crossfade===!1&&n.hide()}}exitAnimationComplete(){this.members.forEach(e=>{e.options.onExitComplete?.(),e.resumingFrom?.options.onExitComplete?.()})}scheduleRender(){this.members.forEach(e=>e.instance&&e.scheduleRender(!1))}removeLeadSnapshot(){this.lead?.snapshot&&(this.lead.snapshot=void 0)}},Rs={hasAnimatedSinceResize:!0,hasEverUpdated:!1},zs={nodes:0,calculatedTargetDeltas:0,calculatedProjections:0},Bs=[``,`X`,`Y`,`Z`],Vs=1e3,Hs=0;function Us(e,t,n,r){let{latestValues:i}=t;i[e]&&(n[e]=i[e],t.setStaticValue(e,0),r&&(r[e]=0))}function Ws(e){if(e.hasCheckedOptimisedAppear=!0,e.root===e)return;let{visualElement:t}=e.options;if(!t)return;let n=ci(t);if(window.MotionHasOptimisedAnimation(n,`transform`)){let{layout:t,layoutId:r}=e.options;window.MotionCancelOptimisedAnimation(n,`transform`,V,!(t||r))}let{parent:r}=e;r&&!r.hasCheckedOptimisedAppear&&Ws(r)}function Gs({attachResizeListener:e,defaultParent:t,measureScroll:n,checkIsScrollRoot:r,resetTransform:i}){return class{constructor(e={},n=t?.()){this.id=Hs++,this.animationId=0,this.animationCommitId=0,this.children=new Set,this.options={},this.isTreeAnimating=!1,this.isAnimationBlocked=!1,this.isLayoutDirty=!1,this.isProjectionDirty=!1,this.isSharedProjectionDirty=!1,this.isTransformDirty=!1,this.updateManuallyBlocked=!1,this.updateBlockedByResize=!1,this.isUpdating=!1,this.isSVG=!1,this.needsReset=!1,this.shouldResetTransform=!1,this.hasCheckedOptimisedAppear=!1,this.treeScale={x:1,y:1},this.eventHandlers=new Map,this.hasTreeAnimated=!1,this.layoutVersion=0,this.updateScheduled=!1,this.scheduleUpdate=()=>this.update(),this.projectionUpdateScheduled=!1,this.checkUpdateFailed=()=>{this.isUpdating&&(this.isUpdating=!1,this.clearAllSnapshots())},this.updateProjection=()=>{this.projectionUpdateScheduled=!1,va.value&&(zs.nodes=zs.calculatedTargetDeltas=zs.calculatedProjections=0),this.nodes.forEach(Js),this.nodes.forEach(rc),this.nodes.forEach(ic),this.nodes.forEach(Ys),va.addProjectionMetrics&&va.addProjectionMetrics(zs)},this.resolvedRelativeTargetAt=0,this.linkedParentVersion=0,this.hasProjected=!1,this.isVisible=!0,this.animationProgress=0,this.sharedNodes=new Map,this.latestValues=e,this.root=n?n.root||n:this,this.path=n?[...n.path,n]:[],this.parent=n,this.depth=n?n.depth+1:0;for(let e=0;ethis.root.updateBlockedByResize=!1;V.read(()=>{r=window.innerWidth}),e(t,()=>{let e=window.innerWidth;e!==r&&(r=e,this.root.updateBlockedByResize=!0,n&&n(),n=Fs(i,250),Rs.hasAnimatedSinceResize&&(Rs.hasAnimatedSinceResize=!1,this.nodes.forEach(nc)))})}n&&this.root.registerSharedNode(n,this),this.options.animate!==!1&&i&&(n||r)&&this.addEventListener(`didUpdate`,({delta:e,hasLayoutChanged:t,hasRelativeLayoutChanged:n,layout:r})=>{if(this.isTreeAnimationBlocked()){this.target=void 0,this.relativeTarget=void 0;return}let a=this.options.transition||i.getDefaultTransition()||dc,{onLayoutAnimationStart:o,onLayoutAnimationComplete:s}=i.getProps(),c=!this.targetLayout||!vs(this.targetLayout,r),l=!t&&n;if(this.options.layoutRoot||this.resumeFrom||l||t&&(c||!this.currentAnimation)){this.resumeFrom&&(this.resumingFrom=this.resumeFrom,this.resumingFrom.resumingFrom=void 0);let t={...Lr(a,`layout`),onPlay:o,onComplete:s};(i.shouldReduceMotion||this.options.layoutRoot)&&(t.delay=0,t.type=!1),this.startAnimation(t),this.setAnimationOrigin(e,l,t.path)}else t||nc(this),this.isLead()&&this.options.onExitComplete&&this.options.onExitComplete();this.targetLayout=r})}unmount(){this.options.layoutId&&this.willUpdate(),this.root.nodes.remove(this);let e=this.getStack();e&&e.remove(this),this.parent&&this.parent.children.delete(this),this.instance=void 0,this.eventHandlers.clear(),Me(this.updateProjection)}blockUpdate(){this.updateManuallyBlocked=!0}unblockUpdate(){this.updateManuallyBlocked=!1}isUpdateBlocked(){return this.updateManuallyBlocked||this.updateBlockedByResize}isTreeAnimationBlocked(){return this.isAnimationBlocked||this.parent&&this.parent.isTreeAnimationBlocked()||!1}startUpdate(){this.isUpdateBlocked()||(this.isUpdating=!0,this.nodes&&this.nodes.forEach(ac),this.animationId++)}getTransformTemplate(){let{visualElement:e}=this.options;return e&&e.getProps().transformTemplate}willUpdate(e=!0){if(this.root.hasTreeAnimated=!0,this.root.isUpdateBlocked()){this.options.onExitComplete&&this.options.onExitComplete();return}if(window.MotionCancelOptimisedAnimation&&!this.hasCheckedOptimisedAppear&&Ws(this),!this.root.isUpdating&&this.root.startUpdate(),this.isLayoutDirty)return;this.isLayoutDirty=!0;for(let e=0;e{this.isLayoutDirty?this.root.didUpdate():this.root.checkUpdateFailed()})}updateSnapshot(){this.snapshot||!this.instance||(this.snapshot=this.measure(),this.snapshot&&!$o(this.snapshot.measuredBox.x)&&!$o(this.snapshot.measuredBox.y)&&(this.snapshot=void 0))}updateLayout(){if(!this.instance||(this.updateScroll(),!(this.options.alwaysMeasureLayout&&this.isLead())&&!this.isLayoutDirty))return;if(this.resumeFrom&&!this.resumeFrom.instance)for(let e=0;e{let n=t/1e3,r=p?.(n);r?(o.x.translate=r.x,o.x.scale=jt(e.x.scale,1,n),o.x.origin=e.x.origin,o.x.originPoint=e.x.originPoint,o.y.translate=r.y,o.y.scale=jt(e.y.scale,1,n),o.y.origin=e.y.origin,o.y.originPoint=e.y.originPoint):(sc(o.x,e.x,n),sc(o.y,e.y,n)),this.setTargetDelta(o),this.relativeTarget&&this.relativeTargetOrigin&&this.layout&&this.relativeParent&&this.relativeParent.layout&&(os(s,this.layout.layoutBox,this.relativeParent.layout.layoutBox,this.options.layoutAnchor||void 0),lc(this.relativeTarget,this.relativeTargetOrigin,s,n),f&&gs(this.relativeTarget,f)&&(this.isProjectionDirty=!1),f||=Ea(),qo(f,this.relativeTarget)),c&&(this.animationValues=a,Es(a,i,this.latestValues,n,d,u)),r&&r.rotate!==void 0&&(this.animationValues||=a,this.animationValues.pathRotation=r.rotate),this.root.scheduleUpdateProjection(),this.scheduleRender(),this.animationProgress=n},this.mixTargetDelta(this.options.layoutRoot?1e3:0)}startAnimation(e){this.notifyListeners(`animationStart`),this.currentAnimation?.stop(),this.resumingFrom?.currentAnimation?.stop(),this.pendingAnimation&&=(Me(this.pendingAnimation),void 0),this.pendingAnimation=V.update(()=>{Rs.hasAnimatedSinceResize=!0,this.motionValue||=Fr(0),this.motionValue.jump(0,!1),this.currentAnimation=js(this.motionValue,[0,1e3],{...e,velocity:0,isSync:!0,onUpdate:t=>{this.mixTargetDelta(t),e.onUpdate&&e.onUpdate(t)},onComplete:()=>{e.onComplete&&e.onComplete(),this.completeAnimation()}}),this.resumingFrom&&(this.resumingFrom.currentAnimation=this.currentAnimation),this.pendingAnimation=void 0})}completeAnimation(){this.resumingFrom&&(this.resumingFrom.currentAnimation=void 0,this.resumingFrom.preserveOpacity=void 0);let e=this.getStack();e&&e.exitAnimationComplete(),this.resumingFrom=this.currentAnimation=this.animationValues=void 0,this.notifyListeners(`animationComplete`)}finishAnimation(){this.currentAnimation&&(this.mixTargetDelta&&this.mixTargetDelta(Vs),this.currentAnimation.stop()),this.completeAnimation()}applyTransformsToTarget(){let e=this.getLead(),{targetWithTransforms:t,target:n,layout:r,latestValues:i}=e;if(!(!t||!n||!r)){if(this!==e&&this.layout&&r&&gc(this.options.animationType,this.layout.layoutBox,r.layoutBox)){n=this.target||Ea();let t=$o(this.layout.layoutBox.x);n.x.min=e.target.x.min,n.x.max=n.x.min+t;let r=$o(this.layout.layoutBox.y);n.y.min=e.target.y.min,n.y.max=n.y.min+r}qo(t,n),lo(t,i),ns(this.projectionDeltaWithTransform,this.layoutCorrected,t,i)}}registerSharedNode(e,t){this.sharedNodes.has(e)||this.sharedNodes.set(e,new Ls),this.sharedNodes.get(e).add(t);let n=t.options.initialPromotionConfig;t.promote({transition:n?n.transition:void 0,preserveFollowOpacity:n&&n.shouldPreserveFollowOpacity?n.shouldPreserveFollowOpacity(t):void 0})}isLead(){let e=this.getStack();return e?e.lead===this:!0}getLead(){let{layoutId:e}=this.options;return e&&this.getStack()?.lead||this}getPrevLead(){let{layoutId:e}=this.options;return e?this.getStack()?.prevLead:void 0}getStack(){let{layoutId:e}=this.options;if(e)return this.root.sharedNodes.get(e)}promote({needsReset:e,transition:t,preserveFollowOpacity:n}={}){let r=this.getStack();r&&r.promote(this,n),e&&(this.projectionDelta=void 0,this.needsReset=!0),t&&this.setOptions({transition:t})}relegate(){let e=this.getStack();return e?e.relegate(this):!1}resetSkewAndRotation(){let{visualElement:e}=this.options;if(!e)return;let t=!1,{latestValues:n}=e;if((n.z||n.rotate||n.rotateX||n.rotateY||n.rotateZ||n.skewX||n.skewY)&&(t=!0),!t)return;let r={};n.z&&Us(`z`,e,r,this.animationValues);for(let t=0;te.currentAnimation?.stop()),this.root.nodes.forEach(Zs),this.root.sharedNodes.clear()}}}function Ks(e){e.updateLayout()}function qs(e){let t=e.resumeFrom?.snapshot||e.snapshot;if(e.isLead()&&e.layout&&t&&e.hasListeners(`didUpdate`)){let{layoutBox:n,measuredBox:r}=e.layout,{animationType:i}=e.options,a=t.source!==e.layout.source;if(i===`size`)xs(e=>{let r=a?t.measuredBox[e]:t.layoutBox[e],i=$o(r);r.min=n[e].min,r.max=r.min+i});else if(i===`x`||i===`y`){let e=i===`x`?`y`:`x`;Ko(a?t.measuredBox[e]:t.layoutBox[e],n[e])}else gc(i,t.layoutBox,n)&&xs(r=>{let i=a?t.measuredBox[r]:t.layoutBox[r],o=$o(n[r]);i.max=i.min+o,e.relativeTarget&&!e.currentAnimation&&(e.isProjectionDirty=!0,e.relativeTarget[r].max=e.relativeTarget[r].min+o)});let o=wa();ns(o,n,t.layoutBox);let s=wa();a?ns(s,e.applyTransform(r,!0),t.measuredBox):ns(s,n,t.layoutBox);let c=!ms(o),l=!1;if(!e.resumeFrom){let r=e.getClosestProjectingParent();if(r&&!r.resumeFrom){let{snapshot:i,layout:a}=r;if(i&&a){let o=e.options.layoutAnchor||void 0,s=Ea();os(s,t.layoutBox,i.layoutBox,o);let c=Ea();os(c,n,a.layoutBox,o),vs(s,c)||(l=!0),r.options.layoutRoot&&(e.relativeTarget=c,e.relativeTargetOrigin=s,e.relativeParent=r)}}}e.notifyListeners(`didUpdate`,{layout:n,snapshot:t,delta:s,layoutDelta:o,hasLayoutChanged:c,hasRelativeLayoutChanged:l})}else if(e.isLead()){let{onExitComplete:t}=e.options;t&&t()}e.options.transition=void 0}function Js(e){va.value&&zs.nodes++,e.parent&&(e.isProjecting()||(e.isProjectionDirty=e.parent.isProjectionDirty),e.isSharedProjectionDirty||=!!(e.isProjectionDirty||e.parent.isProjectionDirty||e.parent.isSharedProjectionDirty),e.isTransformDirty||=e.parent.isTransformDirty)}function Ys(e){e.isProjectionDirty=e.isSharedProjectionDirty=e.isTransformDirty=!1}function Xs(e){e.clearSnapshot()}function Zs(e){e.clearMeasurements()}function Qs(e){e.isLayoutDirty=!0,e.updateLayout()}function $s(e){e.isLayoutDirty=!1}function ec(e){e.isAnimationBlocked&&e.layout&&!e.isLayoutDirty&&(e.snapshot=e.layout,e.isLayoutDirty=!0)}function tc(e){let{visualElement:t}=e.options;t&&t.getProps().onBeforeLayoutMeasure&&t.notify(`BeforeLayoutMeasure`),e.resetTransform()}function nc(e){e.finishAnimation(),e.targetDelta=e.relativeTarget=e.target=void 0,e.isProjectionDirty=!0}function rc(e){e.resolveTargetDelta()}function ic(e){e.calcProjection()}function ac(e){e.resetSkewAndRotation()}function oc(e){e.removeLeadSnapshot()}function sc(e,t,n){e.translate=jt(t.translate,0,n),e.scale=jt(t.scale,1,n),e.origin=t.origin,e.originPoint=t.originPoint}function cc(e,t,n,r){e.min=jt(t.min,n.min,r),e.max=jt(t.max,n.max,r)}function lc(e,t,n,r){cc(e.x,t.x,n.x,r),cc(e.y,t.y,n.y,r)}function uc(e){return e.animationValues&&e.animationValues.opacityExit!==void 0}var dc={duration:.45,ease:[.4,0,.1,1]},fc=e=>typeof navigator<`u`&&navigator.userAgent&&navigator.userAgent.toLowerCase().includes(e),pc=fc(`applewebkit/`)&&!fc(`chrome/`)?Math.round:L;function mc(e){e.min=pc(e.min),e.max=pc(e.max)}function hc(e){mc(e.x),mc(e.y)}function gc(e,t,n){return e===`position`||e===`preserve-aspect`&&!es(ys(t),ys(n),.2)}function _c(e){return e!==e.root&&e.scroll?.wasRoot}var vc=Gs({attachResizeListener:(e,t)=>Ms(e,`resize`,t),measureScroll:()=>({x:document.documentElement.scrollLeft||document.body?.scrollLeft||0,y:document.documentElement.scrollTop||document.body?.scrollTop||0}),checkIsScrollRoot:()=>!0}),yc={current:void 0},bc=Gs({measureScroll:e=>({x:e.scrollLeft,y:e.scrollTop}),defaultParent:()=>{if(!yc.current){let e=new vc({});e.mount(window),e.setOptions({layoutScroll:!0}),yc.current=e}return yc.current},resetTransform:(e,t)=>{e.style.transform=t===void 0?`none`:t},checkIsScrollRoot:e=>window.getComputedStyle(e).position===`fixed`}),xc=(0,b.createContext)({transformPagePoint:e=>e,isStatic:!1,reducedMotion:`never`});function Sc(e,t){if(typeof e==`function`)return e(t);e!=null&&(e.current=t)}function Cc(...e){return t=>{let n=!1,r=e.map(e=>{let r=Sc(e,t);return!n&&typeof r==`function`&&(n=!0),r});if(n)return()=>{for(let t=0;t{let{width:e,height:u,top:d,left:f,right:p,bottom:m,direction:h}=c.current;if(t||a===!1||!s.current||!e||!u)return;let g=h===`rtl`,_=n===`left`?g?`right: ${p}`:`left: ${f}`:g?`left: ${f}`:`right: ${p}`,v=r===`bottom`?`bottom: ${m}`:`top: ${d}`;s.current.dataset.motionPopId=o;let y=document.createElement(`style`);l&&(y.nonce=l);let b=i??document.head;return b.appendChild(y),y.sheet&&y.sheet.insertRule(` - [data-motion-pop-id="${o}"] { - position: absolute !important; - width: ${e}px !important; - height: ${u}px !important; - ${_}px !important; - ${v}px !important; - } - `),()=>{s.current?.removeAttribute(`data-motion-pop-id`),b.contains(y)&&b.removeChild(y)}},[t]),(0,w.jsx)(Tc,{isPresent:t,childRef:s,sizeRef:c,pop:a,children:a===!1?e:b.cloneElement(e,{ref:u})})}var Dc=({children:e,initial:t,isPresent:n,onExitComplete:r,custom:i,presenceAffectsLayout:a,mode:o,anchorX:s,anchorY:c,root:l})=>{let u=k(Oc),d=(0,b.useId)(),f=(0,b.useRef)(n),p=(0,b.useRef)(r);A(()=>{f.current=n,p.current=r});let m=!0,h=(0,b.useMemo)(()=>(m=!1,{id:d,initial:t,isPresent:n,custom:i,onExitComplete:e=>{u.set(e,!0);for(let e of u.values())if(!e)return;r&&r()},register:e=>(u.set(e,!1),()=>{u.delete(e),!f.current&&!u.size&&p.current?.()})}),[n,u,r]);return a&&m&&(h={...h}),(0,b.useMemo)(()=>{u.forEach((e,t)=>u.set(t,!1))},[n]),b.useEffect(()=>{!n&&!u.size&&r&&r()},[n]),e=(0,w.jsx)(Ec,{pop:o===`popLayout`,isPresent:n,anchorX:s,anchorY:c,root:l,children:e}),(0,w.jsx)(j.Provider,{value:h,children:e})};function Oc(){return new Map}function kc(e=!0){let t=(0,b.useContext)(j);if(t===null)return[!0,null];let{isPresent:n,onExitComplete:r,register:i}=t,a=(0,b.useId)();(0,b.useEffect)(()=>{if(e)return i(a)},[e]);let o=(0,b.useCallback)(()=>e&&r&&r(a),[a,r,e]);return!n&&r?[!1,o]:[!0]}var Ac=e=>e.key||``;function jc(e){let t=[];return b.Children.forEach(e,e=>{(0,b.isValidElement)(e)&&t.push(e)}),t}var Mc=({children:e,custom:t,initial:n=!0,onExitComplete:r,presenceAffectsLayout:i=!0,mode:a=`sync`,propagate:o=!1,anchorX:s=`left`,anchorY:c=`top`,root:l})=>{let[u,d]=kc(o),f=(0,b.useMemo)(()=>jc(e),[e]),p=o&&!u?[]:f.map(Ac),m=(0,b.useRef)(!0),h=(0,b.useRef)(f),g=k(()=>new Map),_=(0,b.useRef)(new Set),[v,y]=(0,b.useState)(f),[x,S]=(0,b.useState)(f);A(()=>{m.current=!1,h.current=f;for(let e=0;e{let v=Ac(e),y=o&&!u?!1:f===x||p.includes(v);return(0,w.jsx)(Dc,{isPresent:y,initial:!m.current||n?void 0:!1,custom:t,presenceAffectsLayout:i,mode:a,root:l,onExitComplete:y?void 0:()=>{if(_.current.has(v))return;if(g.has(v))_.current.add(v),g.set(v,!0);else return;let e=!0;g.forEach(t=>{t||(e=!1)}),e&&(T?.(),S(h.current),o&&d?.(),r&&r())},anchorX:s,anchorY:c,children:e},v)})})},Nc=(0,b.createContext)({strict:!1}),Pc={animation:[`animate`,`variants`,`whileHover`,`whileTap`,`exit`,`whileInView`,`whileFocus`,`whileDrag`],exit:[`exit`],drag:[`drag`,`dragControls`],focus:[`whileFocus`],hover:[`whileHover`,`onHoverStart`,`onHoverEnd`],tap:[`whileTap`,`onTap`,`onTapStart`,`onTapCancel`],pan:[`onPan`,`onPanStart`,`onPanSessionStart`,`onPanEnd`],inView:[`whileInView`,`onViewportEnter`,`onViewportLeave`],layout:[`layout`,`layoutId`]},Fc=!1;function Ic(){if(Fc)return;let e={};for(let t in Pc)e[t]={isEnabled:e=>Pc[t].some(t=>!!e[t])};Va(e),Fc=!0}function Lc(){return Ic(),Ha()}function Rc(e){let t=Lc();for(let n in e)t[n]={...t[n],...e[n]};Va(t)}var zc=new Set(`animate.exit.variants.initial.style.values.variants.transition.transformTemplate.custom.inherit.onBeforeLayoutMeasure.onAnimationStart.onAnimationComplete.onUpdate.onDragStart.onDrag.onDragEnd.onMeasureDragConstraints.onDirectionLock.onDragTransitionEnd._dragX._dragY.onHoverStart.onHoverEnd.onViewportEnter.onViewportLeave.globalTapTarget.propagate.ignoreStrict.viewport`.split(`.`));function Bc(e){return e.startsWith(`while`)||e.startsWith(`drag`)&&e!==`draggable`||e.startsWith(`layout`)||e.startsWith(`onTap`)||e.startsWith(`onPan`)||e.startsWith(`onLayout`)||zc.has(e)}var Vc=c({default:()=>Hc}),Hc,Uc=o((()=>{throw Hc={},Error(`Could not resolve "@emotion/is-prop-valid" imported by "framer-motion". Is it installed?`)})),Wc=e=>!Bc(e);function Gc(e){typeof e==`function`&&(Wc=t=>t.startsWith(`on`)?!Bc(t):e(t))}try{Gc((Uc(),d(Vc)).default)}catch{}function Kc(e,t,n){let r={};for(let i in e)i===`values`&&typeof e.values==`object`||ri(e[i])||(Wc(i)||n===!0&&Bc(i)||!t&&!Bc(i)||e.draggable&&i.startsWith(`onDrag`))&&(r[i]=e[i]);return r}var qc=(0,b.createContext)({});function Jc(e,t){if(Ma(e)){let{initial:t,animate:n}=e;return{initial:t===!1||ka(t)?t:void 0,animate:ka(n)?n:void 0}}return e.inherit===!1?{}:t}function Yc(e){let{initial:t,animate:n}=Jc(e,(0,b.useContext)(qc));return(0,b.useMemo)(()=>({initial:t,animate:n}),[Xc(t),Xc(n)])}function Xc(e){return Array.isArray(e)?e.join(` `):e}var Zc=()=>({style:{},transform:{},transformOrigin:{},vars:{}});function Qc(e,t,n){for(let r in t)!ri(t[r])&&!So(r,n)&&(e[r]=t[r])}function $c({transformTemplate:e},t){return(0,b.useMemo)(()=>{let n=Zc();return go(n,t,e),Object.assign({},n.vars,n.style)},[t])}function el(e,t){let n=e.style||{},r={};return Qc(r,n,e),Object.assign(r,$c(e,t)),r}function tl(e,t){let n={},r=el(e,t);return e.drag&&e.dragListener!==!1&&(n.draggable=!1,r.userSelect=r.WebkitUserSelect=r.WebkitTouchCallout=`none`,r.touchAction=e.drag===!0?`none`:`pan-${e.drag===`x`?`y`:`x`}`),e.tabIndex===void 0&&(e.onTap||e.onTapStart||e.whileTap)&&(n.tabIndex=0),n.style=r,n}var nl=()=>({...Zc(),attrs:{}});function rl(e,t,n,r){let i=(0,b.useMemo)(()=>{let n=nl();return Ao(n,t,Mo(r),e.transformTemplate,e.style),{...n.attrs,style:{...n.style}}},[t]);if(e.style){let t={};Qc(t,e.style,e),i.style={...t,...i.style}}return i}var il=[`animate`,`circle`,`defs`,`desc`,`ellipse`,`g`,`image`,`line`,`filter`,`marker`,`mask`,`metadata`,`path`,`pattern`,`polygon`,`polyline`,`rect`,`stop`,`switch`,`symbol`,`svg`,`text`,`tspan`,`use`,`view`];function al(e){return typeof e!=`string`||e.includes(`-`)?!1:!!(il.indexOf(e)>-1||/[A-Z]/u.test(e))}function ol(e,t,n,{latestValues:r},i,a=!1,o){let s=(o??al(e)?rl:tl)(t,r,i,e),c=Kc(t,typeof e==`string`,a),l=e===b.Fragment?{}:{...c,...s,ref:n},{children:u}=t,d=(0,b.useMemo)(()=>ri(u)?u.get():u,[u]);return(0,b.createElement)(e,{...l,children:d})}function sl({scrapeMotionValuesFromProps:e,createRenderState:t},n,r,i){return{latestValues:cl(n,r,i,e),renderState:t()}}function cl(e,t,n,r){let i={},a=r(e,{});for(let e in a)i[e]=Is(a[e]);let{initial:o,animate:s}=e,c=Ma(e),l=Na(e);t&&l&&!c&&e.inherit!==!1&&(o===void 0&&(o=t.initial),s===void 0&&(s=t.animate));let u=n?n.initial===!1:!1;u||=o===!1;let d=u?s:o;if(d&&typeof d!=`boolean`&&!Oa(d)){let t=Array.isArray(d)?d:[d];for(let n=0;n(t,n)=>{let r=(0,b.useContext)(qc),i=(0,b.useContext)(j),a=()=>sl(e,t,r,i);return n?a():k(a)},ul=ll({scrapeMotionValuesFromProps:Co,createRenderState:Zc}),dl=ll({scrapeMotionValuesFromProps:Po,createRenderState:nl}),fl=Symbol.for(`motionComponentSymbol`);function pl(e,t,n){let r=(0,b.useRef)(n);(0,b.useInsertionEffect)(()=>{r.current=n});let i=(0,b.useRef)(null);return(0,b.useCallback)(n=>{n&&e.onMount?.(n),t&&(n?t.mount(n):t.unmount());let a=r.current;if(typeof a==`function`)if(n){let e=a(n);typeof e==`function`&&(i.current=e)}else i.current?(i.current(),i.current=null):a(n);else a&&(a.current=n)},[t])}var ml=(0,b.createContext)({});function hl(e){return e&&typeof e==`object`&&Object.prototype.hasOwnProperty.call(e,`current`)}function gl(e,t,n,r,i,a){let{visualElement:o}=(0,b.useContext)(qc),s=(0,b.useContext)(Nc),c=(0,b.useContext)(j),l=(0,b.useContext)(xc),u=l.reducedMotion,d=l.skipAnimations,f=(0,b.useRef)(null),p=(0,b.useRef)(!1);r||=s.renderer,!f.current&&r&&(f.current=r(e,{visualState:t,parent:o,props:n,presenceContext:c,blockInitialAnimation:c?c.initial===!1:!1,reducedMotionConfig:u,skipAnimations:d,isSVG:a}),p.current&&f.current&&(f.current.manuallyAnimateOnMount=!0));let m=f.current,h=(0,b.useContext)(ml);m&&!m.projection&&i&&(m.type===`html`||m.type===`svg`)&&_l(f.current,n,i,h);let g=(0,b.useRef)(!1);(0,b.useInsertionEffect)(()=>{m&&g.current&&m.update(n,c)});let _=n[si],v=(0,b.useRef)(!!_&&typeof window<`u`&&!window.MotionHandoffIsComplete?.(_)&&window.MotionHasOptimisedAnimation?.(_));return A(()=>{p.current=!0,m&&(g.current=!0,window.MotionIsMounted=!0,m.updateFeatures(),m.scheduleRenderMicrotask(),v.current&&m.animationState&&m.animationState.animateChanges())}),(0,b.useEffect)(()=>{m&&(!v.current&&m.animationState&&m.animationState.animateChanges(),v.current&&=(queueMicrotask(()=>{window.MotionHandoffMarkAsComplete?.(_)}),!1),m.enteringChildren=void 0)}),m}function _l(e,t,n,r){let{layoutId:i,layout:a,drag:o,dragConstraints:s,layoutScroll:c,layoutRoot:l,layoutAnchor:u,layoutCrossfade:d}=t;e.projection=new n(e.latestValues,t[`data-framer-portal-id`]?void 0:vl(e.parent)),e.projection.setOptions({layoutId:i,layout:a,alwaysMeasureLayout:!!o||s&&hl(s),visualElement:e,animationType:typeof a==`string`?a:`both`,initialPromotionConfig:r,crossfade:d,layoutScroll:c,layoutRoot:l,layoutAnchor:u})}function vl(e){if(e)return e.options.allowProjection===!1?vl(e.parent):e.projection}function yl(e,{forwardMotionProps:t=!1,type:n}={},r,i){r&&Rc(r);let a=n?n===`svg`:al(e),o=a?dl:ul;function s(n,s){let c,l={...(0,b.useContext)(xc),...n,layoutId:bl(n)},{isStatic:u}=l,d=Yc(n),f=o(n,u);if(!u&&typeof window<`u`){xl(l,r);let t=Sl(l);c=t.MeasureLayout,d.visualElement=gl(e,f,l,i,t.ProjectionNode,a)}return(0,w.jsxs)(qc.Provider,{value:d,children:[c&&d.visualElement?(0,w.jsx)(c,{visualElement:d.visualElement,...l}):null,ol(e,n,pl(f,d.visualElement,s),f,u,t,a)]})}s.displayName=`motion.${typeof e==`string`?e:`create(${e.displayName??e.name??``})`}`;let c=(0,b.forwardRef)(s);return c[fl]=e,c}function bl({layoutId:e}){let t=(0,b.useContext)(O).id;return t&&e!==void 0?t+`-`+e:e}function xl(e,t){(0,b.useContext)(Nc).strict}function Sl(e){let{drag:t,layout:n}=Lc();if(!t&&!n)return{};let r={...t,...n};return{MeasureLayout:t?.isEnabled(e)||n?.isEnabled(e)?r.MeasureLayout:void 0,ProjectionNode:r.ProjectionNode}}function Cl(e,t){if(typeof Proxy>`u`)return yl;let n=new Map,r=(n,r)=>yl(n,r,e,t);return new Proxy((e,t)=>r(e,t),{get:(i,a)=>a===`create`?r:(n.has(a)||n.set(a,yl(a,void 0,e,t)),n.get(a))})}var wl=(e,t)=>t.isSVG??al(e)?new Fo(t):new To(t,{allowProjection:e!==b.Fragment}),Tl=class extends Ga{constructor(e){super(e),e.animationState||=Ho(e)}updateAnimationControlsSubscription(){let{animate:e}=this.node.getProps();Oa(e)&&(this.unmountControls=e.subscribe(this.node))}mount(){this.updateAnimationControlsSubscription()}update(){let{animate:e}=this.node.getProps(),{animate:t}=this.node.prevProps||{};e!==t&&this.updateAnimationControlsSubscription()}unmount(){this.node.animationState.reset(),this.unmountControls?.()}},El=0,Dl={animation:{Feature:Tl},exit:{Feature:class extends Ga{constructor(){super(...arguments),this.id=El++,this.isExitComplete=!1}update(){if(!this.node.presenceContext)return;let{isPresent:e,onExitComplete:t}=this.node.presenceContext,{isPresent:n}=this.node.prevPresenceContext||{};if(!this.node.animationState||e===n)return;if(e&&n===!1){if(this.isExitComplete){let{initial:e,custom:t}=this.node.getProps();if(typeof e==`string`||typeof e==`object`&&e&&!Array.isArray(e)){let n=Zr(this.node,e,t);if(n){let{transition:e,transitionEnd:t,...r}=n;for(let e in r)this.node.getValue(e)?.jump(r[e])}}this.node.animationState.reset(),this.node.animationState.animateChanges()}else this.node.animationState.setActive(`exit`,!1);this.isExitComplete=!1;return}let r=this.node.animationState.setActive(`exit`,!e);t&&!e&&r.then(()=>{this.isExitComplete=!0,t(this.id)})}mount(){let{register:e,onExitComplete:t}=this.node.presenceContext||{};t&&t(this.id),e&&(this.unmount=e(this.id))}unmount(){}}}};function Ol(e){return{point:{x:e.pageX,y:e.pageY}}}var kl=e=>t=>Gi(t)&&e(t,Ol(t));function Al(e,t,n,r){return Ms(e,t,kl(n),r)}var jl=({current:e})=>e?e.ownerDocument.defaultView:null,Ml=(e,t)=>Math.abs(e-t);function Nl(e,t){let n=Ml(e.x,t.x),r=Ml(e.y,t.y);return Math.sqrt(n**2+r**2)}var Pl=new Set([`auto`,`scroll`]),Fl=class{constructor(e,t,{transformPagePoint:n,contextWindow:r=window,dragSnapToOrigin:i=!1,distanceThreshold:a=3,element:o}={}){if(this.startEvent=null,this.lastMoveEvent=null,this.lastMoveEventInfo=null,this.lastRawMoveEventInfo=null,this.handlers={},this.contextWindow=window,this.scrollPositions=new Map,this.removeScrollListeners=null,this.onElementScroll=e=>{this.handleScroll(e.target)},this.onWindowScroll=()=>{this.handleScroll(window)},this.updatePoint=()=>{if(!(this.lastMoveEvent&&this.lastMoveEventInfo))return;this.lastRawMoveEventInfo&&(this.lastMoveEventInfo=Il(this.lastRawMoveEventInfo,this.transformPagePoint));let e=Rl(this.lastMoveEventInfo,this.history),t=this.startEvent!==null,n=Nl(e.offset,{x:0,y:0})>=this.distanceThreshold;if(!t&&!n)return;let{point:r}=e,{timestamp:i}=Ne;this.history.push({...r,timestamp:i});let{onStart:a,onMove:o}=this.handlers;t||(a&&a(this.lastMoveEvent,e),this.startEvent=this.lastMoveEvent),o&&o(this.lastMoveEvent,e)},this.handlePointerMove=(e,t)=>{this.lastMoveEvent=e,this.lastRawMoveEventInfo=t,this.lastMoveEventInfo=Il(t,this.transformPagePoint),V.update(this.updatePoint,!0)},this.handlePointerUp=(e,t)=>{this.end();let{onEnd:n,onSessionEnd:r,resumeAnimation:i}=this.handlers;if((this.dragSnapToOrigin||!this.startEvent)&&i&&i(),!(this.lastMoveEvent&&this.lastMoveEventInfo))return;let a=Rl(e.type===`pointercancel`?this.lastMoveEventInfo:Il(t,this.transformPagePoint),this.history);this.startEvent&&n&&n(e,a),r&&r(e,a)},!Gi(e))return;this.dragSnapToOrigin=i,this.handlers=t,this.transformPagePoint=n,this.distanceThreshold=a,this.contextWindow=r||window;let s=Il(Ol(e),this.transformPagePoint),{point:c}=s,{timestamp:l}=Ne;this.history=[{...c,timestamp:l}];let{onSessionStart:u}=t;u&&u(e,Rl(s,this.history));let d={passive:!0,capture:!0};this.removeListeners=re(Al(this.contextWindow,`pointermove`,this.handlePointerMove,d),Al(this.contextWindow,`pointerup`,this.handlePointerUp,d),Al(this.contextWindow,`pointercancel`,this.handlePointerUp,d)),o&&this.startScrollTracking(o)}startScrollTracking(e){let t=e.parentElement;for(;t;){let e=getComputedStyle(t);(Pl.has(e.overflowX)||Pl.has(e.overflowY))&&this.scrollPositions.set(t,{x:t.scrollLeft,y:t.scrollTop}),t=t.parentElement}this.scrollPositions.set(window,{x:window.scrollX,y:window.scrollY}),window.addEventListener(`scroll`,this.onElementScroll,{capture:!0}),window.addEventListener(`scroll`,this.onWindowScroll),this.removeScrollListeners=()=>{window.removeEventListener(`scroll`,this.onElementScroll,{capture:!0}),window.removeEventListener(`scroll`,this.onWindowScroll)}}handleScroll(e){let t=this.scrollPositions.get(e);if(!t)return;let n=e===window,r=n?{x:window.scrollX,y:window.scrollY}:{x:e.scrollLeft,y:e.scrollTop},i={x:r.x-t.x,y:r.y-t.y};i.x===0&&i.y===0||(n?this.lastMoveEventInfo&&(this.lastMoveEventInfo.point.x+=i.x,this.lastMoveEventInfo.point.y+=i.y):this.history.length>0&&(this.history[0].x-=i.x,this.history[0].y-=i.y),this.scrollPositions.set(e,r),V.update(this.updatePoint,!0))}updateHandlers(e){this.handlers=e}end(){this.removeListeners&&this.removeListeners(),this.removeScrollListeners&&this.removeScrollListeners(),this.scrollPositions.clear(),Me(this.updatePoint)}};function Il(e,t){return t?{point:t(e.point)}:e}function Ll(e,t){return{x:e.x-t.x,y:e.y-t.y}}function Rl({point:e},t){return{point:e,delta:Ll(e,Bl(t)),offset:Ll(e,zl(t)),velocity:Vl(t,.1)}}function zl(e){return e[0]}function Bl(e){return e[e.length-1]}function Vl(e,t){if(e.length<2)return{x:0,y:0};let n=e.length-1,r=null,i=Bl(e);for(;n>=0&&(r=e[n],!(i.timestamp-r.timestamp>B(t)));)n--;if(!r)return{x:0,y:0};r===e[0]&&e.length>2&&i.timestamp-r.timestamp>B(t)*2&&(r=e[1]);let a=ie(i.timestamp-r.timestamp);if(a===0)return{x:0,y:0};let o={x:(i.x-r.x)/a,y:(i.y-r.y)/a};return o.x===1/0&&(o.x=0),o.y===1/0&&(o.y=0),o}function G(e,{min:t,max:n},r){return t!==void 0&&en&&(e=r?jt(n,e,r.max):Math.min(e,n)),e}function K(e,t,n){return{min:t===void 0?void 0:e.min+t,max:n===void 0?void 0:e.max+n-(e.max-e.min)}}function Hl(e,{top:t,left:n,bottom:r,right:i}){return{x:K(e.x,n,i),y:K(e.y,t,r)}}function Ul(e,t){let n=t.min-e.min,r=t.max-e.max;return t.max-t.minr?n=R(t.min,t.max-r,e.min):r>i&&(n=R(e.min,e.max-i,t.min)),N(0,1,n)}function Kl(e,t){let n={};return t.min!==void 0&&(n.min=t.min-e.min),t.max!==void 0&&(n.max=t.max-e.min),n}var ql=.35;function Jl(e=ql){return e===!1?e=0:e===!0&&(e=ql),{x:Yl(e,`left`,`right`),y:Yl(e,`top`,`bottom`)}}function Yl(e,t,n){return{min:Xl(e,t),max:Xl(e,n)}}function Xl(e,t){return typeof e==`number`?e:e[t]||0}var Zl=new WeakMap,Ql=class{constructor(e){this.openDragLock=null,this.isDragging=!1,this.currentDirection=null,this.originPoint={x:0,y:0},this.constraints=!1,this.hasMutatedConstraints=!1,this.elastic=Ea(),this.latestPointerEvent=null,this.latestPanInfo=null,this.visualElement=e}start(e,{snapToCursor:t=!1,distanceThreshold:n}={}){let{presenceContext:r}=this.visualElement;if(r&&r.isPresent===!1)return;let i=e=>{t&&this.snapToCursor(Ol(e).point),this.stopAnimation()},a=(e,t)=>{let{drag:n,dragPropagation:r,onDragStart:i}=this.getProps();if(n&&!r&&(this.openDragLock&&this.openDragLock(),this.openDragLock=Bi(n),!this.openDragLock))return;this.latestPointerEvent=e,this.latestPanInfo=t,this.isDragging=!0,this.currentDirection=null,this.resolveConstraints(),this.visualElement.projection&&(this.visualElement.projection.isAnimationBlocked=!0,this.visualElement.projection.target=void 0),xs(e=>{let t=this.getAxisMotionValue(e).get()||0;if(ot.test(t)){let{projection:n}=this.visualElement;if(n&&n.layout){let r=n.layout.layoutBox[e];r&&(t=$o(r)*(parseFloat(t)/100))}}this.originPoint[e]=t}),i&&V.update(()=>i(e,t),!1,!0),ai(this.visualElement,`transform`);let{animationState:a}=this.visualElement;a&&a.setActive(`whileDrag`,!0)},o=(e,t)=>{this.latestPointerEvent=e,this.latestPanInfo=t;let{dragPropagation:n,dragDirectionLock:r,onDirectionLock:i,onDrag:a}=this.getProps();if(!n&&!this.openDragLock)return;let{offset:o}=t;if(r&&this.currentDirection===null){this.currentDirection=nu(o),this.currentDirection!==null&&i&&i(this.currentDirection);return}this.updateAxis(`x`,t.point,o),this.updateAxis(`y`,t.point,o),this.visualElement.render(),a&&V.update(()=>a(e,t),!1,!0)},s=(e,t)=>{this.latestPointerEvent=e,this.latestPanInfo=t,this.stop(e,t),this.latestPointerEvent=null,this.latestPanInfo=null},c=()=>{let{dragSnapToOrigin:e}=this.getProps();(e||this.constraints)&&this.startAnimation({x:0,y:0})},{dragSnapToOrigin:l}=this.getProps();this.panSession=new Fl(e,{onSessionStart:i,onStart:a,onMove:o,onSessionEnd:s,resumeAnimation:c},{transformPagePoint:this.visualElement.getTransformPagePoint(),dragSnapToOrigin:l,distanceThreshold:n,contextWindow:jl(this.visualElement),element:this.visualElement.current})}stop(e,t){let n=e||this.latestPointerEvent,r=t||this.latestPanInfo,i=this.isDragging;if(this.cancel(),!i||!r||!n)return;let{velocity:a}=r;this.startAnimation(a);let{onDragEnd:o}=this.getProps();o&&V.postRender(()=>o(n,r))}cancel(){this.isDragging=!1;let{projection:e,animationState:t}=this.visualElement;e&&(e.isAnimationBlocked=!1),this.endPanSession();let{dragPropagation:n}=this.getProps();!n&&this.openDragLock&&(this.openDragLock(),this.openDragLock=null),t&&t.setActive(`whileDrag`,!1)}endPanSession(){this.panSession&&this.panSession.end(),this.panSession=void 0}updateAxis(e,t,n){let{drag:r}=this.getProps();if(!n||!tu(e,r,this.currentDirection))return;let i=this.getAxisMotionValue(e),a=this.originPoint[e]+n[e];this.constraints&&this.constraints[e]&&(a=G(a,this.constraints[e],this.elastic[e])),i.set(a)}resolveConstraints(){let{dragConstraints:e,dragElastic:t}=this.getProps(),n=this.visualElement.projection&&!this.visualElement.projection.layout?this.visualElement.projection.measure(!1):this.visualElement.projection?.layout,r=this.constraints;e&&hl(e)?this.constraints||=this.resolveRefConstraints():e&&n?this.constraints=Hl(n.layoutBox,e):this.constraints=!1,this.elastic=Jl(t),r!==this.constraints&&!hl(e)&&n&&this.constraints&&!this.hasMutatedConstraints&&xs(e=>{this.constraints!==!1&&this.getAxisMotionValue(e)&&(this.constraints[e]=Kl(n.layoutBox[e],this.constraints[e]))})}resolveRefConstraints(){let{dragConstraints:e,onMeasureDragConstraints:t}=this.getProps();if(!e||!hl(e))return!1;let n=e.current,{projection:r}=this.visualElement;if(!r||!r.layout)return!1;r.root&&(r.root.scroll=void 0,r.root.updateScroll());let i=fo(n,r.root,this.visualElement.getTransformPagePoint()),a=Wl(r.layout.layoutBox,i);if(t){let e=t(qa(a));this.hasMutatedConstraints=!!e,e&&(a=Ka(e))}return a}startAnimation(e){let{drag:t,dragMomentum:n,dragElastic:r,dragTransition:i,dragSnapToOrigin:a,onDragTransitionEnd:o}=this.getProps(),s=this.constraints||{},c=xs(o=>{if(!tu(o,t,this.currentDirection))return;let c=s&&s[o]||{};(a===!0||a===o)&&(c={min:0,max:0});let l=r?200:1e6,u=r?40:1e7,d={type:`inertia`,velocity:n?e[o]:0,bounceStiffness:l,bounceDamping:u,timeConstant:750,restDelta:1,restSpeed:10,...i,...c};return this.startAxisValueAnimation(o,d)});return Promise.all(c).then(o)}startAxisValueAnimation(e,t){let n=this.getAxisMotionValue(e);return ai(this.visualElement,e),n.start(Gr(e,n,0,t,this.visualElement,!1))}stopAnimation(){xs(e=>this.getAxisMotionValue(e).stop())}getAxisMotionValue(e){let t=`_drag${e.toUpperCase()}`;return this.visualElement.getProps()[t]||this.visualElement.getValue(e,this.visualElement.latestValues[e]??0)}snapToCursor(e){xs(t=>{let{drag:n}=this.getProps();if(!tu(t,n,this.currentDirection))return;let{projection:r}=this.visualElement,i=this.getAxisMotionValue(t);if(r&&r.layout){let{min:n,max:a}=r.layout.layoutBox[t],o=i.get()||0;i.set(e[t]-jt(n,a,.5)+o)}})}scalePositionWithinConstraints(){if(!this.visualElement.current)return;let{drag:e,dragConstraints:t}=this.getProps(),{projection:n}=this.visualElement;if(!hl(t)||!n||!this.constraints)return;this.stopAnimation();let r={x:0,y:0};xs(e=>{let t=this.getAxisMotionValue(e);if(t&&this.constraints!==!1){let n=t.get();r[e]=Gl({min:n,max:n},this.constraints[e])}});let{transformTemplate:i}=this.visualElement.getProps();this.visualElement.current.style.transform=i?i({},``):`none`,n.root&&n.root.updateScroll(),n.updateLayout(),this.constraints=!1,this.resolveConstraints(),xs(t=>{if(!tu(t,e,null))return;let n=this.getAxisMotionValue(t),{min:i,max:a}=this.constraints[t];n.set(jt(i,a,r[t]))}),this.visualElement.render()}addListeners(){if(!this.visualElement.current)return;Zl.set(this.visualElement,this);let e=this.visualElement.current,t=Al(e,`pointerdown`,t=>{let{drag:n,dragListener:r=!0}=this.getProps(),i=t.target,a=i!==e&&Yi(i);n&&r&&!a&&this.start(t)}),n,r=()=>{let{dragConstraints:t}=this.getProps();hl(t)&&t.current&&(this.constraints=this.resolveRefConstraints(),n||=eu(e,t.current,()=>this.scalePositionWithinConstraints()))},{projection:i}=this.visualElement,a=i.addEventListener(`measure`,r);i&&!i.layout&&(i.root&&i.root.updateScroll(),i.updateLayout()),V.read(r);let o=Ms(window,`resize`,()=>this.scalePositionWithinConstraints()),s=i.addEventListener(`didUpdate`,(({delta:e,hasLayoutChanged:t})=>{this.isDragging&&t&&(xs(t=>{let n=this.getAxisMotionValue(t);n&&(this.originPoint[t]+=e[t].translate,n.set(n.get()+e[t].translate))}),this.visualElement.render())}));return()=>{o(),t(),a(),s&&s(),n&&n()}}getProps(){let e=this.visualElement.getProps(),{drag:t=!1,dragDirectionLock:n=!1,dragPropagation:r=!1,dragConstraints:i=!1,dragElastic:a=ql,dragMomentum:o=!0}=e;return{...e,drag:t,dragDirectionLock:n,dragPropagation:r,dragConstraints:i,dragElastic:a,dragMomentum:o}}};function $l(e){let t=!0;return()=>{if(t){t=!1;return}e()}}function eu(e,t,n){let r=_a(e,$l(n)),i=_a(t,$l(n));return()=>{r(),i()}}function tu(e,t,n){return(t===!0||t===e)&&(n===null||n===e)}function nu(e,t=10){let n=null;return Math.abs(e.y)>t?n=`y`:Math.abs(e.x)>t&&(n=`x`),n}var ru=class extends Ga{constructor(e){super(e),this.removeGroupControls=L,this.removeListeners=L,this.controls=new Ql(e)}mount(){let{dragControls:e}=this.node.getProps();e&&(this.removeGroupControls=e.subscribe(this.controls)),this.removeListeners=this.controls.addListeners()||L}update(){let{dragControls:e}=this.node.getProps(),{dragControls:t}=this.node.prevProps||{};e!==t&&(this.removeGroupControls(),e&&(this.removeGroupControls=e.subscribe(this.controls)))}unmount(){this.removeGroupControls(),this.removeListeners(),this.controls.isDragging||this.controls.endPanSession()}},iu=e=>(t,n)=>{e&&V.update(()=>e(t,n),!1,!0)},au=class extends Ga{constructor(){super(...arguments),this.removePointerDownListener=L}onPointerDown(e){this.session=new Fl(e,this.createPanHandlers(),{transformPagePoint:this.node.getTransformPagePoint(),contextWindow:jl(this.node)})}createPanHandlers(){let{onPanSessionStart:e,onPanStart:t,onPan:n,onPanEnd:r}=this.node.getProps();return{onSessionStart:iu(e),onStart:iu(t),onMove:iu(n),onEnd:(e,t)=>{delete this.session,r&&V.postRender(()=>r(e,t))}}}mount(){this.removePointerDownListener=Al(this.node.current,`pointerdown`,e=>this.onPointerDown(e))}update(){this.session&&this.session.updateHandlers(this.createPanHandlers())}unmount(){this.removePointerDownListener(),this.session&&this.session.end()}},ou=!1,su=class extends b.Component{componentDidMount(){let{visualElement:e,layoutGroup:t,switchLayoutGroup:n,layoutId:r}=this.props,{projection:i}=e;i&&(t.group&&t.group.add(i),n&&n.register&&r&&n.register(i),ou&&i.root.didUpdate(),i.addEventListener(`animationComplete`,()=>{this.safeToRemove()}),i.setOptions({...i.options,layoutDependency:this.props.layoutDependency,onExitComplete:()=>this.safeToRemove()})),Rs.hasEverUpdated=!0}getSnapshotBeforeUpdate(e){let{layoutDependency:t,visualElement:n,drag:r,isPresent:i}=this.props,{projection:a}=n;return a?(a.isPresent=i,e.layoutDependency!==t&&a.setOptions({...a.options,layoutDependency:t}),ou=!0,r||e.layoutDependency!==t||t===void 0||e.isPresent!==i?a.willUpdate():this.safeToRemove(),e.isPresent!==i&&(i?a.promote():a.relegate()||V.postRender(()=>{let e=a.getStack();(!e||!e.members.length)&&this.safeToRemove()})),null):null}componentDidUpdate(){let{visualElement:e,layoutAnchor:t}=this.props,{projection:n}=e;n&&(n.options.layoutAnchor=t,n.root.didUpdate(),Ii.postRender(()=>{!n.currentAnimation&&n.isLead()&&this.safeToRemove()}))}componentWillUnmount(){let{visualElement:e,layoutGroup:t,switchLayoutGroup:n}=this.props,{projection:r}=e;ou=!0,r&&(r.scheduleCheckAfterUnmount(),t&&t.group&&t.group.remove(r),n&&n.deregister&&n.deregister(r))}safeToRemove(){let{safeToRemove:e}=this.props;e&&e()}render(){return null}};function cu(e){let[t,n]=kc(),r=(0,b.useContext)(O);return(0,w.jsx)(su,{...e,layoutGroup:r,switchLayoutGroup:(0,b.useContext)(ml),isPresent:t,safeToRemove:n})}var lu={pan:{Feature:au},drag:{Feature:ru,ProjectionNode:bc,MeasureLayout:cu}};function uu(e,t,n){let{props:r}=e;e.animationState&&r.whileHover&&e.animationState.setActive(`whileHover`,n===`Start`);let i=r[`onHover`+n];i&&V.postRender(()=>i(t,Ol(t)))}var du=class extends Ga{mount(){let{current:e}=this.node;e&&(this.unmount=Ui(e,(e,t)=>(uu(this.node,t,`Start`),e=>uu(this.node,e,`End`))))}unmount(){}},fu=class extends Ga{constructor(){super(...arguments),this.isActive=!1}onFocus(){let e=!1;try{e=this.node.current.matches(`:focus-visible`)}catch{e=!0}!e||!this.node.animationState||(this.node.animationState.setActive(`whileFocus`,!0),this.isActive=!0)}onBlur(){!this.isActive||!this.node.animationState||(this.node.animationState.setActive(`whileFocus`,!1),this.isActive=!1)}mount(){this.unmount=re(Ms(this.node.current,`focus`,()=>this.onFocus()),Ms(this.node.current,`blur`,()=>this.onBlur()))}unmount(){}};function pu(e,t,n){let{props:r}=e;if(e.current instanceof HTMLButtonElement&&e.current.disabled)return;e.animationState&&r.whileTap&&e.animationState.setActive(`whileTap`,n===`Start`);let i=r[`onTap`+(n===`End`?``:n)];i&&V.postRender(()=>i(t,Ol(t)))}var mu=class extends Ga{mount(){let{current:e}=this.node;if(!e)return;let{globalTapTarget:t,propagate:n}=this.node.props;this.unmount=na(e,(e,t)=>(pu(this.node,t,`Start`),(e,{success:t})=>pu(this.node,e,t?`End`:`Cancel`)),{useGlobalTarget:t,stopPropagation:n?.tap===!1})}unmount(){}},hu=new WeakMap,gu=new WeakMap,_u=e=>{let t=hu.get(e.target);t&&t(e)},vu=e=>{e.forEach(_u)};function yu({root:e,...t}){let n=e||document;gu.has(n)||gu.set(n,{});let r=gu.get(n),i=JSON.stringify(t);return r[i]||(r[i]=new IntersectionObserver(vu,{root:e,...t})),r[i]}function bu(e,t,n){let r=yu(t);return hu.set(e,n),r.observe(e),()=>{hu.delete(e),r.unobserve(e)}}var xu={some:0,all:1},Su=class extends Ga{constructor(){super(...arguments),this.hasEnteredView=!1,this.isInView=!1}startObserver(){this.stopObserver?.();let{viewport:e={}}=this.node.getProps(),{root:t,margin:n,amount:r=`some`,once:i}=e,a={root:t?t.current:void 0,rootMargin:n,threshold:typeof r==`number`?r:xu[r]},o=e=>{let{isIntersecting:t}=e;if(this.isInView===t||(this.isInView=t,i&&!t&&this.hasEnteredView))return;t&&(this.hasEnteredView=!0),this.node.animationState&&this.node.animationState.setActive(`whileInView`,t);let{onViewportEnter:n,onViewportLeave:r}=this.node.getProps(),a=t?n:r;a&&a(e)};this.stopObserver=bu(this.node.current,a,o)}mount(){this.startObserver()}update(){if(typeof IntersectionObserver>`u`)return;let{props:e,prevProps:t}=this.node;[`amount`,`margin`,`root`].some(Cu(e,t))&&this.startObserver()}unmount(){this.stopObserver?.(),this.hasEnteredView=!1,this.isInView=!1}};function Cu({viewport:e={}},{viewport:t={}}={}){return n=>e[n]!==t[n]}var wu={inView:{Feature:Su},tap:{Feature:mu},focus:{Feature:fu},hover:{Feature:du}},Tu={layout:{ProjectionNode:bc,MeasureLayout:cu}},Eu=Cl({...Dl,...wu,...lu,...Tu},wl);function Du(e){let t=k(()=>Fr(e)),{isStatic:n}=(0,b.useContext)(xc);if(n){let[,n]=(0,b.useState)(e);(0,b.useEffect)(()=>t.on(`change`,n),[])}return t}function Ou(e,t){let n=Du(t()),r=()=>n.set(t());return r(),A(()=>{let t=()=>V.preRender(r,!1,!0),n=e.map(e=>e.on(`change`,t));return()=>{n.forEach(e=>e()),Me(r)}}),n}function ku(e){Nr.current=[],e();let t=Ou(Nr.current,e);return Nr.current=void 0,t}function Au(e,t,n,r){if(typeof e==`function`)return ku(e);if(n!==void 0&&!Array.isArray(n)&&typeof t!=`function`)return Mu(e,t,n,r);let i=typeof t==`function`?t:ba(t,n,r),a=Array.isArray(e)?ju(e,i):ju([e],([e])=>i(e)),o=Array.isArray(e)?void 0:e.accelerate;return o&&!o.isTransformed&&typeof t!=`function`&&Array.isArray(n)&&r?.clamp!==!1&&(a.accelerate={...o,times:t,keyframes:n,isTransformed:!0,...r?.ease?{ease:r.ease}:{}}),a}function ju(e,t){let n=k(()=>[]);return Ou(e,()=>{n.length=0;let r=e.length;for(let t=0;tObject.keys(n)),a=k(()=>({}));for(let o of i)a[o]=Au(e,t,n[o],r);return a}function Nu(){!Ia.current&&Ra();let[e]=(0,b.useState)(Fa.current);return e}function Pu(e){e.values.forEach(e=>e.stop())}function Fu(e,t){[...t].reverse().forEach(n=>{let r=e.getVariant(n);r&&ni(e,r),e.variantChildren&&e.variantChildren.forEach(e=>{Fu(e,t)})})}function Iu(e,t){if(Array.isArray(t))return Fu(e,t);if(typeof t==`string`)return Fu(e,[t]);ni(e,t)}function Lu(){let e=new Set,t={subscribe(t){return e.add(t),()=>void e.delete(t)},start(t,n){let r=[];return e.forEach(e=>{r.push(pi(e,t,{transitionOverride:n}))}),Promise.all(r)},set(t){return e.forEach(e=>{Iu(e,t)})},stop(){e.forEach(e=>{Pu(e)})},mount(){return()=>{t.stop()}}};return t}function Ru(){let e=k(Lu);return A(e.mount,[]),e}var zu=class{constructor(){this.componentControls=new Set}subscribe(e){return this.componentControls.add(e),()=>this.componentControls.delete(e)}start(e,t){this.componentControls.forEach(n=>{n.start(e.nativeEvent||e,t)})}cancel(){this.componentControls.forEach(e=>{e.cancel()})}stop(){this.componentControls.forEach(e=>{e.stop()})}},Bu=()=>new zu;function Vu(){return k(Bu)}var Hu=Eu,Uu={default:{type:`spring`,bounce:0,duration:.35},gentle:{type:`spring`,bounce:0,duration:.45},momentum:{type:`spring`,bounce:.2,duration:.4},snappy:{type:`spring`,bounce:0,duration:.25}};function Wu(){let e=Nu();return{reduced:e,fadeTransition:{duration:.2},spring:(t=`default`)=>e?{duration:.2}:Uu[t],transform:t=>e?{}:t}}function Gu({children:e,origin:t=`top right`,...n}){let r=Wu();return(0,b.createElement)(Hu.div,{...n,initial:r.reduced?{opacity:0}:{opacity:0,scale:.9},animate:r.reduced?{opacity:1}:{opacity:1,scale:1},exit:r.reduced?{opacity:0}:{opacity:0,scale:.9},transition:r.reduced?r.fadeTransition:Uu.snappy,style:{transformOrigin:t,...n.style}},e)}function Ku(e,t=.998){return Number.isFinite(e)?e/1e3*t/(1-t):0}var q=({tone:e=`green`,size:t=8,pulse:n=!1})=>{let r={green:S.green,amber:S.amber,red:S.red,gray:S.ink4,blue:S.blue};return(0,w.jsx)(`span`,{style:{display:`inline-block`,width:t,height:t,borderRadius:`50%`,background:r[e],flexShrink:0,boxShadow:n?`0 0 0 0 ${r[e]}55`:`none`},className:n?`edge-live-dot`:``})},J=({tone:e=`gray`,children:t,style:n})=>{let r={green:{bg:`#ecfdf5`,fg:`#047857`,bd:`#a7f3d0`},amber:{bg:`#fffbeb`,fg:`#b45309`,bd:`#fde68a`},red:{bg:`#fef2f2`,fg:`#b91c1c`,bd:`#fecaca`},blue:{bg:`#eff6ff`,fg:`#1d4ed8`,bd:`#bfdbfe`},gray:{bg:`#f1f5f9`,fg:`#475569`,bd:`#e2e8f0`},violet:{bg:`#f5f3ff`,fg:`#6d28d9`,bd:`#ddd6fe`}},i=r[e]||r.gray;return(0,w.jsx)(`span`,{style:{display:`inline-flex`,alignItems:`center`,gap:4,padding:`2px 7px`,borderRadius:4,background:i.bg,color:i.fg,border:`1px solid ${i.bd}`,fontSize:11,fontWeight:600,letterSpacing:.2,...n},children:t})};function qu(e){if(e.length<2)return``;if(e.length===2)return`M${e[0][0]} ${e[0][1]} L${e[1][0]} ${e[1][1]}`;let t=[`M${e[0][0]} ${e[0][1]}`];for(let n=0;n{let u=Wu(),d=(0,b.useRef)(!1),[f,p]=(0,b.useState)(!1),m=!!e?.length&&!u.reduced&&!f,h=()=>{d.current||(d.current=!0,p(!0))};if(!e||e.length===0)return null;let g=Math.max(...e,1),_=o??Math.ceil(g*1.1),v=a?32:0,y=n-v-4,x=r-4-4,C=y/(e.length-1),T=qu(e.map((e,t)=>[v+t*C,4+x-(e-0)/(_-0)*x])),E=`${T} L ${v+y} ${4+x} L ${v} ${4+x} Z`,D=[0,_*.33,_*.66,_].map(e=>({v:e,y:4+x-(e-0)/(_-0)*x}));return(0,w.jsxs)(`svg`,{...l,viewBox:`0 0 ${n} ${r}`,preserveAspectRatio:`none`,style:{display:`block`,width:`100%`,height:r,...c},children:[a&&D.map((e,t)=>(0,w.jsx)(`line`,{x1:v,x2:v+y,y1:e.y,y2:e.y,stroke:`#e5e7eb`,strokeDasharray:`3 3`,vectorEffect:`non-scaling-stroke`},t)),a&&D.map((e,t)=>(0,w.jsxs)(`text`,{x:v-4,y:e.y+3,textAnchor:`end`,fontSize:`9`,fill:`#9ca3af`,children:[Math.round(e.v),s]},`l-${t}`)),i&&(0,w.jsx)(Hu.path,{d:E,fill:t,initial:m?{opacity:0}:!1,animate:{opacity:.2},transition:m?{duration:.2,delay:.6,ease:`easeOut`}:{duration:0},onAnimationComplete:h}),(0,w.jsx)(Hu.path,{d:T,fill:`none`,stroke:t,strokeWidth:`1.6`,strokeLinejoin:`round`,strokeLinecap:`round`,vectorEffect:`non-scaling-stroke`,initial:m?{pathLength:0}:!1,animate:{pathLength:1},transition:m?{duration:.6,ease:`easeOut`}:{duration:0},onAnimationComplete:i?void 0:h})]})},Yu=({children:e,style:t,padding:n=16,title:r,action:i})=>(0,w.jsxs)(`div`,{style:{background:S.surface,border:`1px solid ${S.border}`,borderRadius:10,boxShadow:`0 1px 2px rgba(15,23,42,0.04)`,...t},children:[r&&(0,w.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,padding:`12px 16px`,borderBottom:`1px solid ${S.borderSoft}`},children:[(0,w.jsx)(`div`,{style:{fontSize:13,fontWeight:600,color:S.ink},children:r}),(0,w.jsx)(`div`,{style:{flex:1}}),i]}),(0,w.jsx)(`div`,{style:{padding:n},children:e})]});function Xu(){let[e,t]=(0,b.useState)(()=>new Date);return(0,b.useEffect)(()=>{let e=setInterval(()=>t(new Date),1e3);return()=>clearInterval(e)},[]),e}function Zu({cpu:e,gpu:t,mem:n,alertCount:r,online:i,lastSync:a,onOpenAlerts:o,theme:s=`light`,deviceLabel:c,DEVICE:l,loginUser:u,onLogout:d}){let f=Xu(),p=String(f.getHours()).padStart(2,`0`),m=String(f.getMinutes()).padStart(2,`0`),h=String(f.getSeconds()).padStart(2,`0`),g=`${f.getFullYear()}-${String(f.getMonth()+1).padStart(2,`0`)}-${String(f.getDate()).padStart(2,`0`)}`,_=[`周日`,`周一`,`周二`,`周三`,`周四`,`周五`,`周六`][f.getDay()],v=s===`dark`,y=v?{bar:`#0b1220`,barBd:`rgba(255,255,255,0.06)`,text:`#f1f5f9`,text2:`rgba(241,245,249,0.65)`,text3:`rgba(241,245,249,0.45)`,pillBg:`rgba(255,255,255,0.06)`,pillBdNone:`transparent`,timeBg:`rgba(255,255,255,0.06)`,sep:`rgba(255,255,255,0.18)`,logoBg:`linear-gradient(140deg, ${S.blue}, ${S.blueDeep})`,chevron:`rgba(241,245,249,0.55)`,alertBg:`rgba(245,158,11,0.18)`,alertFg:`#fbbf24`,alertBd:`rgba(245,158,11,0.45)`,cloudOnBg:`rgba(16,185,129,0.16)`,cloudOnFg:`#34d399`,cloudOnBd:`rgba(16,185,129,0.4)`,cloudOffBg:`rgba(239,68,68,0.16)`,cloudOffFg:`#fca5a5`,cloudOffBd:`rgba(239,68,68,0.4)`,cloudSyncFg:`rgba(241,245,249,0.55)`}:{bar:`rgba(255,255,255,0.85)`,barBd:`rgba(226,232,240,0.7)`,text:S.ink,text2:S.ink2,text3:S.ink3,pillBg:`rgba(15,23,42,0.04)`,pillBdNone:`transparent`,timeBg:`rgba(15,23,42,0.04)`,sep:`#cbd5e1`,logoBg:`linear-gradient(140deg, ${S.blue}, ${S.blueDeep})`,chevron:S.ink4,alertBg:`#fef3c7`,alertFg:`#b45309`,alertBd:`#fde68a`,cloudOnBg:`#ecfdf5`,cloudOnFg:`#047857`,cloudOnBd:`#a7f3d0`,cloudOffBg:`#fef2f2`,cloudOffFg:`#b91c1c`,cloudOffBd:`#fecaca`,cloudSyncFg:S.ink3},b=({tone:e,label:t,value:n})=>(0,w.jsxs)(`div`,{style:{display:`inline-flex`,alignItems:`center`,gap:6,padding:`3px 9px 3px 8px`,borderRadius:999,background:y.pillBg,fontSize:12,color:y.text2,whiteSpace:`nowrap`,flexShrink:0},children:[(0,w.jsx)(q,{tone:e,size:7}),(0,w.jsx)(`span`,{style:{color:y.text3},children:t}),(0,w.jsx)(`span`,{className:`mono tnum`,style:{color:y.text,fontWeight:600},children:n})]});return(0,w.jsxs)(`div`,{style:{height:48,paddingLeft:16,paddingRight:14,display:`flex`,alignItems:`center`,gap:12,background:y.bar,backdropFilter:v?`none`:`saturate(180%) blur(14px)`,WebkitBackdropFilter:v?`none`:`saturate(180%) blur(14px)`,borderBottom:`1px solid ${y.barBd}`,position:`relative`,zIndex:30,flexShrink:0},children:[(0,w.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,gap:10,minWidth:0,flexShrink:0},children:[(0,w.jsx)(`div`,{style:{width:28,height:28,borderRadius:8,background:y.logoBg,color:`white`,display:`flex`,alignItems:`center`,justifyContent:`center`,fontSize:11,fontWeight:700,letterSpacing:.5,boxShadow:`0 2px 4px rgba(37,99,235,0.3)`},children:`E`}),(0,w.jsxs)(`div`,{style:{minWidth:0,lineHeight:1.15},children:[(0,w.jsxs)(`div`,{style:{fontSize:13,fontWeight:600,color:y.text,display:`flex`,alignItems:`center`,gap:6},children:[c||l.name,(0,w.jsx)(`span`,{style:{fontSize:9.5,padding:`1px 5px`,borderRadius:3,background:v?`rgba(255,255,255,0.08)`:`rgba(15,23,42,0.06)`,color:y.text3,fontWeight:600,letterSpacing:`0.04em`},children:l.dept})]}),(0,w.jsxs)(`div`,{style:{fontSize:10.5,color:y.text3,marginTop:1,display:`flex`,alignItems:`center`,gap:6},children:[(0,w.jsx)(`span`,{children:l.site}),(0,w.jsx)(`span`,{style:{color:y.sep},children:`·`}),(0,w.jsx)(`span`,{className:`mono`,children:l.sn})]})]})]}),(0,w.jsxs)(`div`,{style:{flex:1,display:`flex`,justifyContent:`center`,gap:6,flexWrap:`nowrap`,overflow:`hidden`},children:[(0,w.jsx)(b,{tone:e<70?`green`:`amber`,label:`CPU`,value:`${e}%`}),(0,w.jsx)(b,{tone:t<80?`green`:`amber`,label:`GPU`,value:`${t}%`}),(0,w.jsx)(b,{tone:n<80?`green`:`amber`,label:`内存`,value:`${n}%`}),(0,w.jsxs)(`div`,{onClick:o,style:{display:`inline-flex`,alignItems:`center`,gap:6,padding:`3px 9px 3px 8px`,borderRadius:999,background:r>0?y.alertBg:y.pillBg,border:r>0?`1px solid ${y.alertBd}`:`1px solid transparent`,color:r>0?y.alertFg:y.text2,fontSize:12,cursor:`pointer`,whiteSpace:`nowrap`,flexShrink:0},children:[(0,w.jsx)(D,{name:`alertTri`,size:12,stroke:2}),(0,w.jsx)(`span`,{className:`tnum`,style:{fontWeight:600},children:r}),(0,w.jsx)(`span`,{children:`条告警`})]})]}),(0,w.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,gap:12,flexShrink:0},children:[(0,w.jsxs)(`div`,{style:{display:`inline-flex`,alignItems:`center`,gap:6,padding:`4px 10px`,borderRadius:999,background:i?y.cloudOnBg:y.cloudOffBg,color:i?y.cloudOnFg:y.cloudOffFg,fontSize:11.5,fontWeight:500,border:`1px solid ${i?y.cloudOnBd:y.cloudOffBd}`,whiteSpace:`nowrap`},children:[(0,w.jsx)(D,{name:i?`cloud`:`cloudOff`,size:13,stroke:1.8}),(0,w.jsx)(`span`,{style:{fontWeight:600},children:i?`云端在线`:`云端离线`}),(0,w.jsx)(`span`,{style:{opacity:.6},children:`·`}),(0,w.jsxs)(`span`,{style:{color:y.cloudSyncFg},children:[`同步 `,a]})]}),(0,w.jsxs)(`div`,{style:{display:`inline-flex`,alignItems:`center`,gap:8,padding:`4px 10px`,borderRadius:8,background:y.timeBg,whiteSpace:`nowrap`},children:[(0,w.jsxs)(`div`,{className:`mono tnum`,style:{fontSize:13.5,fontWeight:600,color:y.text,letterSpacing:.5},children:[p,`:`,m,(0,w.jsxs)(`span`,{style:{color:y.text3,fontWeight:500},children:[`:`,h]})]}),(0,w.jsxs)(`div`,{style:{fontSize:10.5,color:y.text3,lineHeight:1.15,whiteSpace:`nowrap`},children:[(0,w.jsx)(`div`,{children:g}),(0,w.jsx)(`div`,{children:_})]})]}),(u||d)&&(0,w.jsx)(Qu,{user:u||`user`,theme:s,onLogout:d})]})]})}function Qu({user:e,theme:t,onLogout:n}){let[r,i]=(0,b.useState)(!1),a=(0,b.useRef)(null);(0,b.useEffect)(()=>{if(!r)return;function e(e){a.current&&!a.current.contains(e.target)&&i(!1)}return document.addEventListener(`mousedown`,e),()=>document.removeEventListener(`mousedown`,e)},[r]);let o=t===`dark`,s=(e||`?`).charAt(0).toUpperCase();return(0,w.jsxs)(`div`,{ref:a,style:{position:`relative`},children:[(0,w.jsxs)(`button`,{onClick:()=>i(e=>!e),title:e,style:{display:`inline-flex`,alignItems:`center`,gap:6,height:28,padding:`0 4px 0 4px`,border:`none`,background:o?`rgba(255,255,255,0.06)`:`rgba(15,23,42,0.04)`,borderRadius:999,cursor:`pointer`},children:[(0,w.jsx)(`span`,{style:{width:22,height:22,borderRadius:`50%`,background:`linear-gradient(135deg, #3b82f6, #1d4ed8)`,color:`white`,fontSize:11.5,fontWeight:600,display:`flex`,alignItems:`center`,justifyContent:`center`},children:s}),(0,w.jsx)(D,{name:`chevDown`,size:11,stroke:2,style:{color:o?`rgba(255,255,255,0.6)`:`#64748b`}})]}),(0,w.jsx)(Mc,{children:r&&(0,w.jsxs)(Gu,{origin:`top right`,style:{position:`absolute`,top:34,right:0,zIndex:1e3,minWidth:180,background:`white`,borderRadius:10,boxShadow:`0 12px 32px -4px rgba(15,23,42,0.18), 0 0 0 1px rgba(15,23,42,0.06)`,padding:6,color:`#0f172a`},children:[(0,w.jsxs)(`div`,{style:{padding:`8px 12px 10px`,borderBottom:`1px solid #f1f5f9`},children:[(0,w.jsx)(`div`,{style:{fontSize:12.5,fontWeight:600,color:`#0f172a`},children:e}),(0,w.jsx)(`div`,{style:{fontSize:10.5,color:`#64748b`,marginTop:2},children:`已登录`})]}),(0,w.jsxs)(`button`,{className:`edge-menu-item`,onClick:()=>{i(!1),n&&n()},style:{width:`100%`,textAlign:`left`,padding:`8px 12px`,border:`none`,background:`transparent`,cursor:`pointer`,fontSize:13,color:`#dc2626`,fontWeight:500,borderRadius:6,display:`flex`,alignItems:`center`,gap:8},children:[(0,w.jsx)(D,{name:`lock`,size:13,stroke:1.8}),`退出登录`]})]})})]})}function $u({app:e,onOpen:t,size:n=76,dense:r=!1,iconStyle:i=`gradient`,accent:a=`#2563eb`,labelSize:o=12.5}){let s=e.state===`error`,c={running:S.green,error:S.red,warn:S.amber,stopped:S.ink4}[e.state]||null,l=e.bg,u=`0 4px 10px -2px ${e.color}33, 0 0 0 1px rgba(15,23,42,0.04), inset 0 1px 0 rgba(255,255,255,0.4)`,d=!0;return i===`flat`&&(l=e.color,u=`0 0 0 1px rgba(15,23,42,0.08)`,d=!1),(0,w.jsxs)(`div`,{onClick:()=>t(e),draggable:!e.locked,onDragStart:t=>{if(e.locked){t.preventDefault();return}t.dataTransfer.setData(`application/x-edgex-app`,e.id),t.dataTransfer.effectAllowed=`copy`},className:`edge-row-hover`,style:{display:`flex`,flexDirection:`column`,alignItems:`center`,gap:8,cursor:`pointer`,userSelect:`none`,padding:`8px 4px`,borderRadius:14,background:`transparent`,transition:`background 0.15s ease`,width:n+28,"--edge-row-hover-bg":`rgba(255,255,255,0.55)`},children:[(0,w.jsxs)(`div`,{className:`edge-icon-hover ${s?`edge-pulse`:``}`,style:{position:`relative`,width:n,height:n,borderRadius:i===`flat`?14:18,background:l,color:`white`,display:`flex`,alignItems:`center`,justifyContent:`center`,boxShadow:u,"--edge-icon-hover-shadow":`0 10px 22px -6px ${e.color}55, 0 0 0 1px rgba(15,23,42,0.06)${d?`, inset 0 1px 0 rgba(255,255,255,0.4)`:``}`},children:[(0,w.jsx)(D,{name:e.icon,size:n*.46,stroke:1.6}),d&&(0,w.jsx)(`div`,{style:{position:`absolute`,inset:1,borderRadius:17,pointerEvents:`none`,background:`radial-gradient(ellipse at 30% 0%, rgba(255,255,255,0.35), transparent 60%)`}}),e.kind===`app`&&c&&(0,w.jsx)(`div`,{style:{position:`absolute`,right:-3,bottom:-3,width:18,height:18,borderRadius:`50%`,background:`white`,display:`flex`,alignItems:`center`,justifyContent:`center`,boxShadow:`0 1px 3px rgba(15,23,42,0.18)`},children:(0,w.jsx)(`span`,{style:{width:10,height:10,borderRadius:`50%`,background:c,boxShadow:s?`0 0 0 0 ${c}`:`none`},className:s?`edge-live-dot`:``})}),e.badge&&(0,w.jsx)(`div`,{style:{position:`absolute`,top:-5,right:-5,minWidth:20,height:20,padding:`0 6px`,borderRadius:10,background:S.red,color:`white`,fontSize:11.5,fontWeight:700,display:`flex`,alignItems:`center`,justifyContent:`center`,boxShadow:`0 2px 6px rgba(239,68,68,0.4), 0 0 0 2px white`,fontFamily:`inherit`},children:e.badge}),e.locked&&(0,w.jsx)(`div`,{style:{position:`absolute`,top:-4,right:-4,width:20,height:20,borderRadius:6,background:`white`,color:S.slate,display:`flex`,alignItems:`center`,justifyContent:`center`,boxShadow:`0 2px 4px rgba(15,23,42,0.18)`},children:(0,w.jsx)(D,{name:`lock`,size:12,stroke:2})})]}),(0,w.jsx)(`div`,{style:{fontSize:o,color:S.ink,lineHeight:1.3,textAlign:`center`,fontWeight:500,maxWidth:n+24,whiteSpace:`nowrap`,overflow:`hidden`,textOverflow:`ellipsis`},children:e.name}),e.kind===`app`&&(0,w.jsxs)(`div`,{style:{marginTop:-4,fontSize:10.5,color:S.ink3,display:`flex`,alignItems:`center`,gap:4},className:`tnum`,children:[e.state===`running`&&e.gpuPct>0&&(0,w.jsxs)(`span`,{className:`mono`,children:[`GPU `,e.gpuPct,`%`]}),e.state===`running`&&e.gpuPct===0&&(0,w.jsx)(`span`,{children:`仅 CPU`}),e.state===`error`&&(0,w.jsxs)(`span`,{style:{color:S.red,fontWeight:600},children:[`异常 · `,e.lastOk]})]})]})}var ed=`edge-console.memo`,td=1e3;function nd(){try{return localStorage.getItem(ed)??``}catch{return``}}function rd(e){try{localStorage.setItem(ed,e)}catch{}}function id(){try{localStorage.removeItem(ed)}catch{}}function ad(){let[e,t]=(0,b.useState)(nd),n=(0,b.useRef)(null),r=(0,b.useRef)(e);return r.current=e,(0,b.useEffect)(()=>()=>{n.current!=null&&(clearTimeout(n.current),n.current=null,rd(r.current))},[]),(0,w.jsxs)(`div`,{style:{padding:16,background:`rgba(255,255,255,0.7)`,backdropFilter:`blur(12px)`,WebkitBackdropFilter:`blur(12px)`,border:`1px solid rgba(255,255,255,0.9)`,borderRadius:14,boxShadow:`0 6px 20px -6px rgba(15,23,42,0.10)`},children:[(0,w.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,gap:8,marginBottom:10},children:[(0,w.jsx)(D,{name:`edit`,size:14,stroke:1.8,style:{color:S.blueDeep}}),(0,w.jsx)(`div`,{style:{fontSize:12,fontWeight:700,color:S.ink,letterSpacing:`0.02em`},children:`备忘录`}),(0,w.jsx)(`div`,{style:{flex:1}}),e.length>0&&(0,w.jsx)(`button`,{type:`button`,onClick:()=>{window.confirm(`清空备忘录内容?`)&&(n.current!=null&&(clearTimeout(n.current),n.current=null),t(``),id())},title:`清空备忘录`,"aria-label":`清空备忘录`,className:`edge-press edge-btn-danger`,style:{display:`inline-flex`,alignItems:`center`,justifyContent:`center`,width:22,height:22,borderRadius:6,background:`transparent`,color:S.ink3,border:`1px solid transparent`,cursor:`pointer`,padding:0},children:(0,w.jsx)(D,{name:`trash`,size:13,stroke:1.8})}),(0,w.jsxs)(`span`,{className:`tnum`,style:{fontSize:10.5,color:S.ink3,fontWeight:600,fontFamily:S.mono},children:[e.length,` 字`]})]}),(0,w.jsx)(`textarea`,{value:e,onChange:e=>{let r=e.target.value;t(r),n.current!=null&&clearTimeout(n.current),n.current=setTimeout(()=>{n.current=null,rd(r)},td)},placeholder:`临时笔记 · 仅本地保存`,spellCheck:!1,style:{width:`100%`,height:200,boxSizing:`border-box`,resize:`none`,background:`transparent`,color:S.ink,border:`1px solid ${S.borderSoft}`,borderRadius:8,padding:10,fontFamily:S.mono,fontSize:12,lineHeight:1.55,outline:`none`},onFocus:e=>{e.currentTarget.style.borderColor=S.blue},onBlur:e=>{e.currentTarget.style.borderColor=S.borderSoft}})]})}function od(){let e=Xu(),t=String(e.getHours()).padStart(2,`0`),n=String(e.getMinutes()).padStart(2,`0`),r=String(e.getSeconds()).padStart(2,`0`),i=e.getFullYear(),a=e.getMonth(),o=e.getDate(),s=[`星期日`,`星期一`,`星期二`,`星期三`,`星期四`,`星期五`,`星期六`][e.getDay()],c=new Date(i,a,1).getDay(),l=new Date(i,a+1,0).getDate(),u=[];for(let e=0;e(0,w.jsx)(`div`,{style:{textAlign:`center`,fontSize:10,color:t===0||t===6?S.red:S.ink3,fontWeight:600,padding:`3px 0`},children:e},e))}),(0,w.jsx)(`div`,{style:{display:`grid`,gridTemplateColumns:`repeat(7, 1fr)`,gap:2},children:u.map((e,t)=>{if(e==null)return(0,w.jsx)(`div`,{},t);let n=e===o,r=(c+e-1)%7;return(0,w.jsx)(`div`,{style:{aspectRatio:`1`,display:`flex`,alignItems:`center`,justifyContent:`center`,fontSize:11.5,color:n?`white`:r===0||r===6?S.red:S.ink2,fontWeight:n?700:500,background:n?S.blue:`transparent`,borderRadius:6,fontFamily:`ui-monospace, SFMono-Regular, Menlo, monospace`,boxShadow:n?`0 2px 6px -1px ${S.blue}55`:`none`},className:`tnum`,children:e},t)})})]})}function sd({apps:e,onOpen:t,variant:n=`compact`}){return n===`row`?(0,w.jsx)(`div`,{style:{display:`flex`,gap:8,flexWrap:`wrap`},children:e.map(e=>(0,w.jsxs)(`div`,{onClick:()=>t(e),style:{display:`inline-flex`,alignItems:`center`,gap:8,padding:`6px 12px 6px 6px`,borderRadius:999,background:`rgba(255,255,255,0.7)`,border:`1px solid rgba(226,232,240,0.85)`,cursor:`pointer`,boxShadow:`0 1px 2px rgba(15,23,42,0.04)`},children:[(0,w.jsx)(`div`,{style:{width:26,height:26,borderRadius:7,background:e.bg,color:`white`,display:`flex`,alignItems:`center`,justifyContent:`center`,flexShrink:0},children:(0,w.jsx)(D,{name:e.icon,size:14,stroke:1.8})}),(0,w.jsx)(`span`,{style:{fontSize:12,color:S.ink,fontWeight:500},children:e.name})]},e.id))}):(0,w.jsxs)(`div`,{style:{width:188,padding:12,background:`rgba(255,255,255,0.55)`,backdropFilter:`blur(10px)`,WebkitBackdropFilter:`blur(10px)`,border:`1px solid rgba(255,255,255,0.8)`,borderRadius:14,boxShadow:`0 4px 14px -4px rgba(15,23,42,0.10)`},children:[(0,w.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,gap:6,marginBottom:10,fontSize:10.5,color:S.ink3,fontWeight:600,letterSpacing:`0.06em`,textTransform:`uppercase`},children:[(0,w.jsx)(D,{name:`history`,size:11,stroke:2}),`最近使用`]}),(0,w.jsx)(`div`,{style:{display:`grid`,gridTemplateColumns:`repeat(2, 1fr)`,gap:6},children:e.map(e=>(0,w.jsxs)(`div`,{onClick:()=>t(e),style:{display:`flex`,alignItems:`center`,gap:8,padding:6,borderRadius:8,background:`rgba(255,255,255,0.7)`,border:`1px solid rgba(226,232,240,0.7)`,cursor:`pointer`},children:[(0,w.jsx)(`div`,{style:{width:26,height:26,borderRadius:7,background:e.bg,color:`white`,display:`flex`,alignItems:`center`,justifyContent:`center`,flexShrink:0},children:(0,w.jsx)(D,{name:e.icon,size:14,stroke:1.8})}),(0,w.jsx)(`div`,{style:{minWidth:0,fontSize:10.5,color:S.ink,fontWeight:500,whiteSpace:`nowrap`,overflow:`hidden`,textOverflow:`ellipsis`},children:e.name})]},e.id))})]})}function cd({DEVICE:e}){return(0,w.jsxs)(`div`,{style:{padding:16,background:`rgba(255,255,255,0.7)`,backdropFilter:`blur(12px)`,WebkitBackdropFilter:`blur(12px)`,border:`1px solid rgba(255,255,255,0.9)`,borderRadius:14,boxShadow:`0 6px 20px -6px rgba(15,23,42,0.10)`},children:[(0,w.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,gap:8,marginBottom:12},children:[(0,w.jsx)(D,{name:`cpu`,size:14,stroke:1.8,style:{color:S.blueDeep}}),(0,w.jsx)(`div`,{style:{fontSize:12,fontWeight:700,color:S.ink,letterSpacing:`0.02em`},children:`设备信息`}),(0,w.jsx)(`div`,{style:{flex:1}}),(0,w.jsx)(`span`,{style:{fontSize:10,fontWeight:600,padding:`2px 6px`,borderRadius:999,background:`#ecfdf5`,color:`#047857`,border:`1px solid #a7f3d0`},children:`在线`})]}),(0,w.jsx)(`div`,{style:{display:`flex`,flexDirection:`column`,gap:7},children:[[`硬件`,e.model],[`系统`,e.os],[`Agent`,e.agent],[`持续在线`,e.uptime]].map(([e,t])=>(0,w.jsxs)(`div`,{style:{display:`flex`,alignItems:`baseline`,gap:10,fontSize:11.5},children:[(0,w.jsx)(`span`,{style:{color:S.ink3,width:56,flexShrink:0},children:e}),(0,w.jsx)(`span`,{style:{color:S.ink,flex:1,fontWeight:500,overflow:`hidden`,textOverflow:`ellipsis`,whiteSpace:`nowrap`},children:t})]},e))})]})}function ld({running:e,error:t}){return t>0?(0,w.jsxs)(`span`,{style:{display:`inline-flex`,alignItems:`center`,gap:5,fontSize:11,fontWeight:600,color:`#b91c1c`,padding:`2px 8px`,borderRadius:999,background:`#fef2f2`,border:`1px solid #fecaca`,whiteSpace:`nowrap`,flexShrink:0},children:[(0,w.jsx)(q,{tone:`red`,size:6,pulse:!0}),(0,w.jsx)(`span`,{className:`tnum`,children:t}),(0,w.jsx)(`span`,{children:`个应用异常`})]}):(0,w.jsxs)(`span`,{style:{display:`inline-flex`,alignItems:`center`,gap:5,fontSize:11,color:`#047857`,whiteSpace:`nowrap`,flexShrink:0},children:[(0,w.jsx)(q,{tone:`green`,size:6}),(0,w.jsx)(`span`,{style:{fontWeight:600},children:`全部运行中`})]})}function ud({label:e,meta:t,right:n,children:r}){return(0,w.jsxs)(`div`,{children:[(0,w.jsxs)(`div`,{style:{display:`flex`,alignItems:`baseline`,gap:10,marginBottom:14},children:[(0,w.jsx)(`div`,{style:{fontSize:12,fontWeight:700,color:S.ink,letterSpacing:`0.04em`},children:e}),(0,w.jsx)(`div`,{style:{fontSize:11.5,color:S.ink3},children:t}),(0,w.jsx)(`div`,{style:{flex:1}}),n]}),r]})}function dd({apps:e,onOpen:t,iconStyle:n,accent:r,iconPx:i=76,tilePx:a=104,labelSize:o=12.5}){return(0,w.jsx)(`div`,{style:{display:`grid`,gridTemplateColumns:`repeat(auto-fill, minmax(${a+8}px, ${a+8}px))`,gap:8},children:e.map(e=>(0,w.jsx)($u,{app:e,onOpen:t,iconStyle:n,accent:r,size:i,labelSize:o},e.id))})}function fd({onOpenApp:e,sysApps:t,deployedApps:n,showRecent:r=!0,iconStyle:i=`gradient`,accent:a=`#2563eb`,layout:o=`workstation`,iconSize:s=`md`,APPS:c,RECENT_IDS:l,DEVICE:u}){let d=n.filter(e=>e.state===`running`).length,f=n.filter(e=>e.state===`error`).length,p={sm:60,md:76,lg:96}[s]||76,m=p+(s===`sm`?22:s===`lg`?36:28),h=s===`sm`?11.5:s===`lg`?13.5:12.5;return o===`launcher`?(0,w.jsxs)(`div`,{style:{flex:1,padding:`40px 56px 110px`,display:`flex`,flexDirection:`column`,gap:32,overflow:`auto`,alignContent:`start`},children:[(0,w.jsx)(ud,{label:`系统工具`,meta:`本地固定`,children:(0,w.jsx)(dd,{apps:t,onOpen:e,iconStyle:i,accent:a,iconPx:Math.max(p,88),tilePx:m+12,labelSize:h})}),(0,w.jsx)(ud,{label:`已部署应用`,meta:`云端下发`,right:(0,w.jsx)(ld,{running:d,error:f}),children:(0,w.jsx)(dd,{apps:n,onOpen:e,iconStyle:i,accent:a,iconPx:Math.max(p,88),tilePx:m+12,labelSize:h})}),r&&(0,w.jsx)(ud,{label:`最近使用`,meta:`按访问时间`,children:(0,w.jsx)(sd,{apps:l.map(e=>c.find(t=>t.id===e)).filter(Boolean),onOpen:e,variant:`row`})})]}):o===`compact`?(0,w.jsxs)(`div`,{style:{flex:1,padding:`20px 36px 110px`,display:`grid`,gridTemplateColumns:`1fr 280px`,gap:22,overflow:`auto`,alignContent:`start`},children:[(0,w.jsxs)(`div`,{style:{display:`flex`,flexDirection:`column`,gap:18,minWidth:0},children:[(0,w.jsx)(ud,{label:`系统工具`,meta:`本地固定`,children:(0,w.jsx)(dd,{apps:t,onOpen:e,iconStyle:i,accent:a,iconPx:Math.min(p,64),tilePx:Math.min(m,94),labelSize:11})}),(0,w.jsx)(ud,{label:`已部署应用`,meta:`云端下发`,right:(0,w.jsx)(ld,{running:d,error:f}),children:(0,w.jsx)(dd,{apps:n,onOpen:e,iconStyle:i,accent:a,iconPx:Math.min(p,64),tilePx:Math.min(m,94),labelSize:11})}),r&&(0,w.jsx)(ud,{label:`最近使用`,meta:`按访问时间`,children:(0,w.jsx)(sd,{apps:l.map(e=>c.find(t=>t.id===e)).filter(Boolean),onOpen:e,variant:`row`})})]}),(0,w.jsxs)(`div`,{style:{display:`flex`,flexDirection:`column`,gap:10},children:[(0,w.jsx)(od,{}),(0,w.jsx)(cd,{DEVICE:u}),(0,w.jsx)(ad,{})]})]}):(0,w.jsxs)(`div`,{style:{flex:1,position:`relative`,padding:`28px 48px 110px`,display:`grid`,gridTemplateColumns:`1fr 340px`,gap:32,overflow:`auto`,alignContent:`start`},children:[(0,w.jsxs)(`div`,{style:{display:`flex`,flexDirection:`column`,gap:26,minWidth:0},children:[(0,w.jsx)(ud,{label:`系统工具`,meta:`本地固定 · 始终可用`,children:(0,w.jsx)(dd,{apps:t,onOpen:e,iconStyle:i,accent:a,iconPx:p,tilePx:m,labelSize:h})}),(0,w.jsx)(ud,{label:`已部署应用`,meta:`云端下发`,right:(0,w.jsx)(ld,{running:d,error:f}),children:(0,w.jsx)(dd,{apps:n,onOpen:e,iconStyle:i,accent:a,iconPx:p,tilePx:m,labelSize:h})}),r&&(0,w.jsx)(ud,{label:`最近使用`,meta:`按访问时间`,children:(0,w.jsx)(sd,{apps:l.map(e=>c.find(t=>t.id===e)).filter(Boolean),onOpen:e,variant:`row`})})]}),(0,w.jsxs)(`div`,{style:{display:`flex`,flexDirection:`column`,gap:14},children:[(0,w.jsx)(od,{}),(0,w.jsx)(cd,{DEVICE:u}),(0,w.jsx)(ad,{})]})]})}function pd({label:e}){let t=Wu();return(0,w.jsx)(`div`,{style:{position:`absolute`,bottom:`calc(100% + 10px)`,left:`50%`,transform:`translateX(-50%)`,pointerEvents:`none`},children:(0,w.jsx)(Hu.div,{initial:t.reduced?{opacity:0}:{opacity:0,y:4},animate:t.reduced?{opacity:1}:{opacity:1,y:0},exit:t.reduced?{opacity:0}:{opacity:0,y:4},transition:t.reduced?t.fadeTransition:Uu.snappy,children:(0,w.jsx)(Gu,{origin:`bottom center`,style:{background:`rgba(15,23,42,0.92)`,color:`white`,fontSize:11.5,fontWeight:500,padding:`4px 9px`,borderRadius:6,whiteSpace:`nowrap`,boxShadow:`0 4px 12px -2px rgba(15,23,42,0.3)`},children:e})})})}function md({apps:e,registerDockIconRect:t,onShowDesktop:n,onFocusApp:r,onCloseApp:i,anyVisible:a,hidden:o=!1,authed:s,authBadge:c,onToggleAuth:l,alertBadge:u,loginUser:d,onLogout:f}){let[p,m]=(0,b.useState)(null),h=Wu(),g=h.reduced?{}:{whileHover:{y:-4,scale:1.1},whileTap:{scale:.95}},_=!a;return(0,b.useEffect)(()=>{if(!o)return;let e=requestAnimationFrame(()=>m(null));return()=>cancelAnimationFrame(e)},[o]),(0,w.jsx)(`div`,{"aria-hidden":o,inert:o?!0:void 0,style:{position:`absolute`,bottom:18,left:`50%`,transform:`translateX(-50%)`,zIndex:25,opacity:+!o,visibility:o?`hidden`:`visible`,pointerEvents:o?`none`:`auto`},children:(0,w.jsxs)(`div`,{className:`edge-material-chrome`,style:{display:`flex`,alignItems:`center`,gap:6,padding:`8px 12px`,borderRadius:20,border:`1px solid rgba(255,255,255,0.9)`,boxShadow:`0 12px 32px -8px rgba(15,23,42,0.18), 0 0 0 1px rgba(15,23,42,0.04)`,transition:`border-color 0.15s ease, box-shadow 0.15s ease`},children:[(0,w.jsxs)(Hu.div,{onClick:n,onMouseEnter:()=>m(`__home`),onMouseLeave:()=>m(null),title:`显示桌面`,transition:h.spring(`snappy`),...g,style:{position:`relative`,width:44,height:44,borderRadius:12,background:_?`#1f2937`:`rgba(15,23,42,0.04)`,color:_?`white`:S.ink2,display:`flex`,alignItems:`center`,justifyContent:`center`,cursor:`pointer`,boxShadow:_?`0 4px 10px -2px rgba(31,41,55,0.45)`:`none`},children:[(0,w.jsx)(D,{name:`home`,size:20,stroke:1.7}),_&&(0,w.jsx)(`div`,{style:{position:`absolute`,bottom:-6,left:`50%`,transform:`translateX(-50%)`,width:5,height:5,borderRadius:`50%`,background:S.ink2}}),(0,w.jsx)(Mc,{children:p===`__home`&&(0,w.jsx)(pd,{label:`显示桌面`})})]}),(0,w.jsx)(`div`,{style:{width:1,height:28,background:`rgba(15,23,42,0.08)`,margin:`0 4px`}}),e.length===0?(0,w.jsxs)(`div`,{style:{height:44,padding:`0 14px`,display:`flex`,alignItems:`center`,gap:8,color:S.ink3,fontSize:12},children:[(0,w.jsx)(D,{name:`apps`,size:14,stroke:1.7}),(0,w.jsx)(`span`,{children:`从桌面单击应用以启动`})]}):e.map(e=>{let n={running:S.green,error:S.red,warn:S.amber,stopped:S.ink4}[e.state]||null,a=e.state===`error`,o=p===e.id,s=n=>t?.(e.id,n);return(0,w.jsxs)(Hu.div,{ref:s,onClick:t=>{s(t.currentTarget),r(e.id)},onMouseEnter:t=>{s(t.currentTarget),m(e.id)},onMouseLeave:()=>m(null),onContextMenu:t=>{t.preventDefault(),i(e.id)},title:e.name,transition:h.spring(`snappy`),...g,style:{position:`relative`,width:44,height:44,borderRadius:12,background:e.isActive?e.bg:`rgba(15,23,42,0.04)`,color:e.isActive?`white`:S.ink2,display:`flex`,alignItems:`center`,justifyContent:`center`,cursor:`pointer`,boxShadow:e.isActive?`0 4px 10px -2px ${e.color}55, inset 0 1px 0 rgba(255,255,255,0.3)`:`none`,opacity:e.isMinimized?.92:1},children:[!e.isActive&&(0,w.jsx)(`div`,{style:{position:`absolute`,inset:6,borderRadius:8,background:e.bg,color:`white`,display:`flex`,alignItems:`center`,justifyContent:`center`,boxShadow:`0 1px 2px rgba(15,23,42,0.12), inset 0 1px 0 rgba(255,255,255,0.25)`},children:(0,w.jsx)(D,{name:e.icon,size:18,stroke:1.7})}),e.isActive&&(0,w.jsx)(D,{name:e.icon,size:20,stroke:1.7}),e.kind===`app`&&n&&(0,w.jsx)(`div`,{style:{position:`absolute`,right:1,top:1,width:10,height:10,borderRadius:`50%`,background:`white`,display:`flex`,alignItems:`center`,justifyContent:`center`,boxShadow:`0 1px 2px rgba(15,23,42,0.18)`},children:(0,w.jsx)(`span`,{className:a?`edge-live-dot`:``,style:{width:6,height:6,borderRadius:`50%`,background:n}})}),e.id===`alerts`&&u>0&&(0,w.jsx)(`div`,{style:{position:`absolute`,top:0,right:0,minWidth:18,height:18,padding:`0 5px`,borderRadius:9,background:S.red,color:`white`,fontSize:10.5,fontWeight:700,display:`flex`,alignItems:`center`,justifyContent:`center`,boxShadow:`0 0 0 2px white`,transform:`translate(25%, -25%)`},children:u}),o&&(0,w.jsx)(`button`,{onClick:t=>{t.stopPropagation(),i(e.id)},title:`退出应用`,style:{position:`absolute`,top:-5,left:-5,width:18,height:18,borderRadius:`50%`,background:`#0f172a`,color:`white`,border:`none`,display:`flex`,alignItems:`center`,justifyContent:`center`,cursor:`pointer`,boxShadow:`0 1px 4px rgba(15,23,42,0.3), 0 0 0 2px white`,padding:0,zIndex:2},children:(0,w.jsx)(D,{name:`x`,size:11,stroke:2.4})}),(0,w.jsx)(`div`,{style:{position:`absolute`,bottom:-6,left:`50%`,transform:`translateX(-50%)`,width:e.isActive?5:4,height:e.isActive?5:4,borderRadius:`50%`,background:e.isActive?S.ink2:S.ink3,opacity:e.isMinimized?.6:1}}),(0,w.jsx)(Mc,{children:o&&(0,w.jsx)(pd,{label:`${e.name}${e.isMinimized?` · 已最小化`:``}`})})]},e.id)})]})})}var hd=_(),gd={display:`inline-flex`,alignItems:`center`,gap:6,height:32,padding:`0 12px`,borderRadius:7,background:S.surface,border:`1px solid ${S.border}`,fontSize:12.5,fontWeight:500,color:S.ink2,cursor:`pointer`},_d={...gd,background:S.blue,color:`white`,border:`1px solid ${S.blueDeep}`,fontWeight:600},vd={...gd,background:`white`,color:S.red,border:`1px solid #fecaca`},yd=`0 24px 60px -12px rgba(15,23,42,0.32), 0 0 0 1px rgba(15,23,42,0.08)`,bd=`0 10px 28px -14px rgba(15,23,42,0.20), 0 0 0 1px rgba(15,23,42,0.05)`,xd=`0 24px 60px -12px rgba(15,23,42,0), 0 0 0 1px rgba(15,23,42,0)`,Sd=420,Y=300,Cd=[{dir:`n`,css:{top:0,left:10,right:10,height:6},cursor:`ns-resize`},{dir:`s`,css:{bottom:0,left:10,right:10,height:6},cursor:`ns-resize`},{dir:`e`,css:{right:0,top:10,bottom:10,width:6},cursor:`ew-resize`},{dir:`w`,css:{left:0,top:10,bottom:10,width:6},cursor:`ew-resize`},{dir:`ne`,css:{top:0,right:0,width:12,height:12},cursor:`nesw-resize`},{dir:`nw`,css:{top:0,left:0,width:12,height:12},cursor:`nwse-resize`},{dir:`se`,css:{bottom:0,right:0,width:12,height:12},cursor:`nwse-resize`},{dir:`sw`,css:{bottom:0,left:0,width:12,height:12},cursor:`nesw-resize`}];function wd(e,t,n){if(!t)return{x:0,y:0};let r=n?.(e),i=t.offsetParent?.getBoundingClientRect?.(),a=(i?.left||0)+t.offsetLeft+t.offsetWidth/2,o=(i?.top||0)+t.offsetTop+t.offsetHeight/2,s=r?r.left+r.width/2:window.innerWidth/2,c=r?r.top+r.height/2:window.innerHeight-42;return{x:s-a,y:c-o}}function Td({app:e,active:t=!1,visible:n=!0,minimized:r=!1,maximized:i,geo:a,zIndex:o=10,interacting:s,getDockIconRect:c,onMaximize:l,onMinimize:u,onClose:d,onBringToFront:f,onChangeGeo:p,onInteractStart:m,onInteractEnd:h,children:g,headerActions:_,breadcrumb:v,mgmtOpen:y,onToggleMgmt:x,canManage:C}){let T=Wu(),[E,O]=(0,b.useState)(null),[k,A]=(0,b.useState)(`default`),j=a||{x:40,y:40,w:820,h:560},ee=(e,t,n,r=`edge-btn-secondary`)=>(0,w.jsx)(`div`,{onClick:t,onPointerDown:e=>e.stopPropagation(),className:`edge-press ${r}`,style:{width:22,height:22,borderRadius:6,cursor:`pointer`,display:`flex`,alignItems:`center`,justifyContent:`center`,color:e,transition:`background 0.15s, color 0.15s`},children:n}),M=r?wd(e.id,E,c):{x:0,y:0},N={left:j.x,top:j.y,width:j.w,height:j.h,opacity:+!!n,visibility:`visible`,transitionEnd:n?{visibility:`visible`}:{visibility:`hidden`},...T.reduced?{}:{x:r?M.x:0,y:r?M.y:0,scale:n?1:r?.35:.98}},P=s?{left:{duration:0},top:{duration:0},width:{duration:0},height:{duration:0}}:{left:Uu.gentle,top:Uu.gentle,width:Uu.gentle,height:Uu.gentle},F=T.reduced?{opacity:T.fadeTransition,left:{duration:0},top:{duration:0},width:{duration:0},height:{duration:0},borderRadius:{duration:0},boxShadow:{duration:0}}:{...P,x:Uu.default,y:Uu.default,scale:Uu.default,opacity:{duration:.2}},I=e=>{if(i||e.button!==0)return;f?.(),m?.(),A(`grabbing`);let t=e.clientX,n=e.clientY,r={x:j.x,y:j.y},a=e=>{p?.({x:r.x+(e.clientX-t),y:r.y+(e.clientY-n)})},o=()=>{window.removeEventListener(`pointermove`,a),window.removeEventListener(`pointerup`,o),A(`default`),h?.(),window.dispatchEvent(new Event(`resize`))};window.addEventListener(`pointermove`,a),window.addEventListener(`pointerup`,o)},te=(e,t)=>n=>{if(i||n.button!==0)return;f?.(),m?.(),A(t);let r=n.clientX,a=n.clientY,o={x:j.x,y:j.y,w:j.w,h:j.h},s=t=>{let n=t.clientX-r,i=t.clientY-a,s={x:o.x,y:o.y,w:o.w,h:o.h};if(e.includes(`e`)&&(s.w=Math.max(Sd,o.w+n)),e.includes(`s`)&&(s.h=Math.max(Y,o.h+i)),e.includes(`w`)){let e=Math.max(Sd,o.w-n);s.x=o.x+(o.w-e),s.w=e}if(e.includes(`n`)){let e=Math.max(Y,o.h-i);s.y=o.y+(o.h-e),s.h=e}p?.(s)},c=()=>{window.removeEventListener(`pointermove`,s),window.removeEventListener(`pointerup`,c),A(`default`),h?.(),window.dispatchEvent(new Event(`resize`))};window.addEventListener(`pointermove`,s),window.addEventListener(`pointerup`,c)};return(0,w.jsxs)(Hu.div,{ref:O,initial:T.reduced?{opacity:0}:{opacity:0,scale:.96},animate:N,exit:T.reduced?{opacity:0}:{opacity:0,scale:.97,x:0,y:0},transition:F,onPointerDown:()=>f?.(),onAnimationComplete:()=>{n&&window.dispatchEvent(new Event(`resize`))},style:{position:`absolute`,left:j.x,top:j.y,width:j.w,height:j.h,borderRadius:i?0:14,boxShadow:i?xd:t?yd:bd,background:S.windowBg,display:`flex`,flexDirection:`column`,overflow:`hidden`,zIndex:o,pointerEvents:n?`auto`:`none`},children:[s&&(0,hd.createPortal)((0,w.jsx)(`div`,{style:{position:`fixed`,inset:0,zIndex:9998,cursor:k}}),document.body),(0,w.jsxs)(`div`,{onPointerDown:I,onDoubleClick:l,style:{height:44,display:`flex`,alignItems:`center`,paddingLeft:14,paddingRight:8,gap:10,background:S.titleBar,borderBottom:`1px solid ${S.borderSoft}`,flexShrink:0,touchAction:`none`,userSelect:`none`,cursor:i?`default`:`grab`},children:[(0,w.jsx)(`div`,{style:{width:22,height:22,borderRadius:6,color:`white`,background:e.bg,display:`flex`,alignItems:`center`,justifyContent:`center`},children:(0,w.jsx)(D,{name:e.icon,size:13,stroke:1.8})}),(0,w.jsx)(`div`,{style:{...S.type.body,fontWeight:600,color:S.ink},children:e.name}),v&&(0,w.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,gap:6,color:S.ink3,fontSize:12.5},children:[(0,w.jsx)(D,{name:`chevRight`,size:12,stroke:2}),v]}),(0,w.jsx)(`div`,{style:{flex:1}}),_,C&&(0,w.jsxs)(`button`,{onPointerDown:e=>e.stopPropagation(),onClick:x,title:`应用运维信息`,className:`edge-press edge-btn-secondary`,style:{display:`flex`,alignItems:`center`,gap:5,height:26,padding:`0 10px`,borderRadius:6,appearance:`none`,background:y?S.blueSoft:void 0,border:`1px solid ${y?`#bfdbfe`:`transparent`}`,color:y?S.blueDeep:S.ink3,cursor:`pointer`,fontSize:11.5,fontWeight:600,marginRight:4},children:[(0,w.jsx)(D,{name:`info`,size:12,stroke:2}),`运维信息`]}),(0,w.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,gap:2,marginLeft:4},children:[ee(S.ink3,u,(0,w.jsx)(D,{name:`minus`,size:14,stroke:2})),ee(S.ink3,l,(0,w.jsx)(D,{name:i?`restore`:`maximize`,size:12,stroke:2})),ee(S.red,d,(0,w.jsx)(D,{name:`x`,size:14,stroke:2}),`edge-btn-danger`)]})]}),!i&&Cd.map(e=>(0,w.jsx)(`div`,{onPointerDown:te(e.dir,e.cursor),style:{position:`absolute`,zIndex:50,cursor:e.cursor,...e.css}},e.dir)),(0,w.jsx)(`div`,{style:{flex:1,overflow:`hidden`,display:`flex`,position:`relative`},children:g})]})}var Ed=`/api/v1`,Dd=localStorage.getItem(`edge_token`)||``;function Od(e){Dd=e||``,e?localStorage.setItem(`edge_token`,e):localStorage.removeItem(`edge_token`)}function kd(){return Dd}function Ad(){Dd=``,localStorage.removeItem(`edge_token`)}function jd(){return Dd?{Authorization:`Bearer `+Dd}:{}}var Md=null;function Nd(e){Md=e}var Pd=3,Fd=0;async function X(e,t={}){if(!Dd)return new Response(null,{status:401,statusText:`no token (pre-login)`});let n=await fetch(e,{...t,headers:{...jd(),...t.headers}});return n.status===401&&Dd?(Fd+=1,Fd>=Pd&&(Fd=0,Ad(),Md&&Md())):n.ok&&(Fd=0),n}function Id(e){let t=e.toLowerCase();return t.includes(`code`)||t.includes(`vscode`)?`code`:t.includes(`jupyter`)?`jupyter`:t.includes(`ollama`)?`ollama`:t.includes(`vllm`)?`vllm`:t.includes(`comfy`)?`comfy`:t.includes(`webui`)||t.includes(`sd`)?`palette`:t.includes(`open-webui`)||t.includes(`openwebui`)?`openwebui`:t.includes(`train`)?`flame`:`apps`}function Z(e,{interval:t=0,fallback:n=null,transform:r}={}){let[i,a]=(0,b.useState)(n),[o,s]=(0,b.useState)(()=>!!e),[c,l]=(0,b.useState)(null),[u,d]=(0,b.useState)(0),f=(0,b.useRef)(!0),p=(0,b.useCallback)(()=>{s(!0),d(e=>e+1)},[]);return(0,b.useEffect)(()=>{f.current=!0;let n=null;if(!e)return()=>{f.current=!1};async function i(){try{let t=await X(Ed+e);if(!t.ok)throw Error(`HTTP ${t.status}`);let n=await t.json();if(!f.current)return;a(r?r(n):n),l(null)}catch(e){if(!f.current)return;l(e)}finally{f.current&&s(!1)}}return i(),t>0&&(n=setInterval(i,t)),()=>{f.current=!1,n&&clearInterval(n)}},[e,t,u]),{data:i,loading:o,error:c,refresh:p}}function Ld(){return Z(`/device`,{fallback:null,transform:e=>({deviceName:e.deviceName,hostname:e.hostname,name:e.deviceName||e.hostname,alias:e.deviceName||e.hostname,os:e.platform||e.os,model:e.cpuModel,uptime:e.uptimeHuman,agent:`Edge Platform `+(e.agentVersion||``),sn:e.hostname,site:``,dept:``,username:``})})}function Rd(e=5e3){let[t,n]=(0,b.useState)({metrics:null,gpus:[]}),[r,i]=(0,b.useState)(!0),[a,o]=(0,b.useState)(null),s=(0,b.useRef)(!0);return(0,b.useEffect)(()=>{s.current=!0;async function r(){try{let e=await X(`/api/v1/metrics`);if(!e.ok)throw Error(`HTTP ${e.status}`);let r=await e.json();if(!s.current)return;let i=t.metrics||{},a={cpu:{used:Math.round(r.cpuUsedPercent),total:100,series:i.cpu?.series||[]},gpu:{used:r.gpuData&&r.gpuData.length>0?Math.round(r.gpuData[0].gpuUtil):0,total:100,series:i.gpu?.series||[]},mem:{used:Math.round(r.memoryUsed/(1024*1024*1024)),total:Math.round(r.memoryTotal/(1024*1024*1024)),pct:Math.round(r.memoryUsedPercent),series:i.mem?.series||[]},dsk:i.dsk||{used:0,total:0,pct:0,series:[]}};if(r.diskData&&r.diskData.length>0){let e=r.diskData[0];a.dsk={used:Math.round(e.used/(1024*1024*1024)),total:Math.round(e.total/(1024*1024*1024)),pct:Math.round(e.usedPercent),series:i.dsk?.series||[]}}let c=t.gpus;r.gpuData&&r.gpuData.length>0&&(c=r.gpuData.map(e=>({id:e.index,model:e.productName,util:Math.round(e.gpuUtil),memUsed:e.memUsed,memTotal:e.memTotal,temp:e.temperature,power:e.powerDraw,max:e.powerLimit,tasks:[]}))),n({metrics:a,gpus:c}),o(null)}catch(e){if(!s.current)return;o(e)}finally{s.current&&i(!1)}}r();let a=setInterval(r,e);return()=>{s.current=!1,clearInterval(a)}},[e]),{data:t,loading:r,error:a}}function zd(e=5e3){let[t,n]=(0,b.useState)({cpuPercent:[],memoryPercent:[],diskPercent:[],gpuUtil:[]}),[r,i]=(0,b.useState)(!0),[a,o]=(0,b.useState)(null),s=(0,b.useRef)(!0);return(0,b.useEffect)(()=>{s.current=!0;async function t(){try{let e=await X(`/api/v1/metrics/history`);if(!e.ok)throw Error(`HTTP ${e.status}`);let t=await e.json();if(!s.current)return;n(e=>({cpuPercent:t.cpuPercent||e.cpuPercent,memoryPercent:t.memoryPercent||e.memoryPercent,diskPercent:t.diskPercent||e.diskPercent,gpuUtil:t.gpuUtil||e.gpuUtil,gpuMemPercent:t.gpuMemPercent||e.gpuMemPercent,netBytesSent:t.netBytesSent||e.netBytesSent,netBytesRecv:t.netBytesRecv||e.netBytesRecv,timestamps:t.timestamps||e.timestamps})),o(null)}catch(e){if(!s.current)return;o(e)}finally{s.current&&i(!1)}}t();let r=setInterval(t,e);return()=>{s.current=!1,clearInterval(r)}},[e]),{data:t,loading:r,error:a}}function Bd(e=1e4){return Z(`/apps`,{interval:e,fallback:[],transform:e=>Array.isArray(e)?e.map(e=>({id:e.id,kind:`app`,runtime:e.runtime||`kubernetes`,name:e.name,icon:Id(e.name),color:`#3b82f6`,bg:`linear-gradient(160deg,#3b82f6,#1d4ed8)`,state:e.state,version:e.version||`latest`,category:``,gpu:`CPU`,gpuPct:0,desc:e.image,ports:e.ports||[],deployedAt:e.createdAt?new Date(e.createdAt).toLocaleString(`zh-CN`):``,image:e.image,namespace:e.namespace,replicas:e.replicas,ready:e.ready,createdAt:e.createdAt,containerID:e.containerID||``,restartCount:e.restartCount||0,restartPolicy:e.restartPolicy||``,volumeMounts:e.volumeMounts||[],podName:e.podName||``,nodeName:e.nodeName||``,startedAt:e.startedAt,cpuRequest:e.cpuRequest||``,cpuLimit:e.cpuLimit||``,memRequest:e.memRequest||``,memLimit:e.memLimit||``,observed:e.observed||null,source:e.source||null,revision:e.revision||0,lastTask:e.lastTask||null,ownership:e.ownership||``,discovered:e.discovered||null})):[]})}function Vd(e){return Z(e?`/apps/${encodeURIComponent(e)}`:null,{interval:0,fallback:null})}function Hd(e=3e4){return Z(`/alerts`,{interval:e,fallback:[],transform:e=>Array.isArray(e)?e:[]})}function Ud(e,t=3e3,n=200,r=``){let[i,a]=(0,b.useState)([]),[o,s]=(0,b.useState)(()=>!!e),c=(0,b.useRef)(!0);return(0,b.useEffect)(()=>{if(c.current=!0,!e)return()=>{c.current=!1};async function i(){try{let t=new URLSearchParams({tail:String(n)});r&&t.set(`service`,r);let i=await X(`${Ed}/apps/${encodeURIComponent(e)}/logs?${t}`);if(!i.ok)return;let o=await i.json();if(!c.current)return;let s=o&&o.logs||``;a(s?s.split(` -`).filter(Boolean):[])}catch{}finally{c.current&&s(!1)}}i();let o=setInterval(i,t);return()=>{c.current=!1,clearInterval(o)}},[e,t,n,r]),{lines:i,loading:o}}function Wd(e){return Z(e?`/apps/${e}/versions`:null,{fallback:null})}async function Gd(e,t){let n=await X(`${Ed}/apps/${e}/versions/switch`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({version:t})});if(!n.ok){let e=await n.text();throw Error(e||`HTTP ${n.status}`)}return n.json().catch(()=>null)}async function Kd(e,t){let n=await X(`${Ed}/apps/${e}/${t}`,{method:`POST`});if(!n.ok)throw Error(`HTTP ${n.status}`);return n.json().catch(()=>null)}async function qd(e){let t=await X(`${Ed}/apps/${e}`,{method:`DELETE`});if(!t.ok)throw Error(`HTTP ${t.status}`);return t.json().catch(()=>null)}function Jd(e=5e3){return Z(`/supervisor/status`,{interval:e,fallback:null})}function Yd(e=5e3){return Z(`/vms`,{interval:e,fallback:[]})}function Xd(e=3e4){return Z(`/hardware`,{interval:e,fallback:null})}function Zd(e=3e3){return Z(`/hardware/sensors`,{interval:e,fallback:null})}function Qd(e=5e3){return Z(`/links`,{interval:e,fallback:null})}function $d(e=5e3){return Z(`/ai/activity`,{interval:e,fallback:null})}function ef(e,t=200,n=3e3){let r=Math.max(1,Math.min(Number(t)||200,1e3));return Z(e?`/ai/transcript?path=${encodeURIComponent(e)}&tail=${r}`:null,{interval:n,fallback:null})}async function tf(){let e=await X(`${Ed}/ai/codex/cleanup-stale`,{method:`POST`});if(!e.ok)throw Error(`HTTP ${e.status}`);return e.json().catch(()=>null)}async function nf(e,t){let n=await X(`${Ed}/supervisor/services/${e}/control`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({action:t})});if(!n.ok)throw Error(`HTTP ${n.status}`);return n.json().catch(()=>null)}async function rf(e,t){let n=await X(`${Ed}/vms/${encodeURIComponent(e)}/control`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({action:t})});if(!n.ok){let e=await n.text();throw Error(e||`HTTP ${n.status}`)}return n.json().catch(()=>null)}async function af(e,t){let n=await X(`${Ed}/vms/${encodeURIComponent(e)}/config`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify(t)});if(!n.ok){let e=await n.text();throw Error(e||`HTTP ${n.status}`)}return n.json().catch(()=>null)}async function of(e){try{let t=await X(`${Ed}/supervisor/services/${e}/logs`);return t.ok?await t.json():{name:e,log:``}}catch{return{name:e,log:``}}}function sf(){return Z(`/browser/bookmarks`,{fallback:[]})}function cf(){return Z(`/browser/history`,{fallback:[]})}async function lf(e,t){let n=await X(`${Ed}/browser/bookmarks`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({title:e,url:t})});if(!n.ok)throw Error(`HTTP ${n.status}`);return n.json().catch(()=>null)}async function uf(e){let t=await X(`${Ed}/browser/bookmarks/${encodeURIComponent(e)}`,{method:`DELETE`});if(!t.ok)throw Error(`HTTP ${t.status}`);return t.json().catch(()=>null)}async function df(e,t){try{await X(`${Ed}/browser/history`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({url:e,title:t})})}catch{}}async function ff(){let e=await X(`${Ed}/browser/history`,{method:`DELETE`});if(!e.ok)throw Error(`HTTP ${e.status}`);return e.json().catch(()=>null)}async function pf(e){try{let t=await X(`${Ed}/browser/probe?url=${encodeURIComponent(e)}`);if(!t.ok)return{direct:!0,reason:`probe-failed`};let n=await t.json();return n&&typeof n.direct==`boolean`?n:{direct:!0,reason:`unknown`}}catch{return{direct:!0,reason:`error`}}}function mf(e=15e3){return Z(`/apps/capability`,{interval:e,fallback:null})}function hf(e,t=1500){let[n,r]=(0,b.useState)(null),[i,a]=(0,b.useState)(!0),o=(0,b.useRef)(!0);return(0,b.useEffect)(()=>{if(o.current=!0,!e)return()=>{o.current=!1};let n=null;async function i(){let t=!1;try{let i=await X(`${Ed}/tasks/${encodeURIComponent(e)}`);if(!i.ok)return;let s=await i.json();if(!o.current)return;if(r(s),s.status&&[`succeeded`,`failed`,`canceled`,`superseded`].includes(s.status)){t=!0,n&&clearInterval(n),a(!1);return}}catch{}finally{o.current&&a(!1)}return t}return i().then(e=>{!e&&o.current&&(n=setInterval(i,t))}),()=>{o.current=!1,n&&clearInterval(n)}},[e,t]),{task:e&&n?.id===e?n:null,loading:e?i:!1}}function gf(e,t=4e3){return Z(e?`/apps/${encodeURIComponent(e)}/operations`:null,{interval:t,fallback:[]})}function _f(e){return Z(e?`/apps/${encodeURIComponent(e)}/revisions`:null,{interval:0,fallback:[]})}async function vf(e){let t=await e.text().catch(()=>``),n=Error(`HTTP ${e.status}`);if(n.status=e.status,n.reason=``,n.findings=null,t){try{let e=JSON.parse(t);if(e&&typeof e.error==`string`)return n.message=e.error,typeof e.reason==`string`&&(n.reason=e.reason),e.detail&&(n.detail=e.detail),Array.isArray(e.findings)&&(n.findings=e.findings),n}catch{}return n.message=t.length>500?t.slice(0,500)+`…`:t,n}return n}async function yf(e){let t=await X(`${Ed}/apps/validate`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify(e)});if(!t.ok)throw await vf(t);return t.json()}async function bf(e,t){let n={"Content-Type":`application/json`};t&&(n[`Idempotency-Key`]=t);let r=!!e.id,i=await X(`${Ed}/apps${r?`/`+encodeURIComponent(e.id):``}`,{method:r?`PUT`:`POST`,headers:n,body:JSON.stringify(e)});if(!i.ok)throw await vf(i);return i.json()}async function xf(e,t){let n=await X(`${Ed}/apps/${encodeURIComponent(e)}/actions/${t}`,{method:`POST`});if(!n.ok)throw await vf(n);return n.json()}async function Sf(e,t=!1){let n=await X(`${Ed}/apps/${encodeURIComponent(e)}${t?`?purge=true`:``}`,{method:`DELETE`});if(!n.ok)throw await vf(n);return n.json()}async function Cf(e,t){let n=await X(`${Ed}/apps/${encodeURIComponent(e)}/revisions/${t}/restore`,{method:`POST`});if(!n.ok)throw await vf(n);return n.json()}async function wf(e,t=!1,n){let r={"Content-Type":`application/json`};n&&(r[`Idempotency-Key`]=n);let i=await X(`${Ed}/apps/${encodeURIComponent(e)}/takeover`,{method:`POST`,headers:r,body:JSON.stringify({confirmRisky:!!t})});if(!i.ok)throw await vf(i);return i.json()}function Tf(e){return Z(e?`/apps/${encodeURIComponent(e)}/compose`:null,{interval:0,fallback:null})}function Ef(e){return Z(e?`/apps/${encodeURIComponent(e)}/env`:null,{interval:0,fallback:null})}function Df(e){return Z(e?`/apps/${encodeURIComponent(e)}/storage`:null,{interval:0,fallback:null})}async function Of(e,t){let n={"Content-Type":`application/json`};t&&(n[`Idempotency-Key`]=t);let r=await X(`${Ed}/apps/${encodeURIComponent(e.id)}`,{method:`PUT`,headers:n,body:JSON.stringify(e)});if(!r.ok)throw await vf(r);return r.json()}async function kf(e,t=!1){let n=await X(`${Ed}/apps/${encodeURIComponent(e)}/remove-preview${t?`?purge=true`:`?purge=false`}`);if(!n.ok)throw await vf(n);return n.json()}function Af(){return Z(`/store/apps`,{interval:0,fallback:null})}async function jf(e,t=``){let n=await X(`${Ed}/store/version${`?appId=${encodeURIComponent(e)}&v=${encodeURIComponent(t||``)}`}`);if(!n.ok)throw await vf(n);return n.json()}async function Mf({appId:e,version:t,values:n,idempotencyKey:r,confirmRisky:i=!1}){let a={"Content-Type":`application/json`};r&&(a[`Idempotency-Key`]=r);let o=await X(`${Ed}/store/install`,{method:`POST`,headers:a,body:JSON.stringify({appId:e,version:t,values:n,idempotencyKey:r,confirmRisky:i})});if(!o.ok)throw await vf(o);return o.json()}function Nf(e=3e4){return Z(`/catalogs`,{interval:e,fallback:[]})}function Pf(e=3e4){return Z(`/catalogs/sources`,{interval:e,fallback:[]})}async function Ff(e,t,n){let r=await X(`${Ed}/catalogs/sources${e}`,{method:t,headers:n?{"Content-Type":`application/json`}:void 0,body:n?JSON.stringify(n):void 0});if(!r.ok)throw await vf(r);return r.status===204?null:r.json()}function If(e){return Ff(`/test`,`POST`,e)}function Lf(e){return Ff(``,`POST`,e)}function Rf(e,t){return Ff(`/${encodeURIComponent(e)}`,`PUT`,t)}function zf(e){return Ff(`/${encodeURIComponent(e)}`,`DELETE`)}function Bf(e){return Ff(`/${encodeURIComponent(e)}/refresh`,`POST`)}function Vf(e=3e4){return Z(`/catalogs/apps`,{interval:e,fallback:[]})}async function Hf(){let e=await X(`${Ed}/catalogs`,{method:`POST`});if(!e.ok)throw await vf(e);return e.json()}async function Uf(e,t,n=``){let r=await X(`${Ed}/catalogs/version${`?sourceId=${encodeURIComponent(e)}&appId=${encodeURIComponent(t)}&v=${encodeURIComponent(n||``)}`}`);if(!r.ok)throw await vf(r);return r.json()}async function Wf({sourceId:e,appId:t,version:n,values:r,idempotencyKey:i,confirmRisky:a=!1}){let o={"Content-Type":`application/json`};i&&(o[`Idempotency-Key`]=i);let s=await X(`${Ed}/catalogs/install`,{method:`POST`,headers:o,body:JSON.stringify({sourceId:e,appId:t,version:n,values:r,idempotencyKey:i,confirmRisky:a})});if(!s.ok)throw await vf(s);return s.json()}function Gf({icon:e,label:t,value:n,sub:r,color:i}){let a=n==null||n===``;return(0,w.jsxs)(`div`,{style:{background:S.surface,border:`1px solid ${S.border}`,borderRadius:10,padding:`16px 18px`},children:[(0,w.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,gap:6,marginBottom:10},children:[(0,w.jsx)(D,{name:e,size:14,stroke:1.8,style:{color:a?S.ink4:i}}),(0,w.jsx)(`div`,{style:{fontSize:12.5,fontWeight:600,color:S.ink,letterSpacing:`0.02em`},children:t})]}),(0,w.jsx)(`div`,{className:`mono tnum`,style:{fontSize:30,fontWeight:700,color:a?S.ink4:i,lineHeight:1,letterSpacing:`-0.02em`},children:a?`—`:n}),(0,w.jsx)(`div`,{style:{fontSize:11.5,color:S.ink3,marginTop:8},children:r||`—`})]})}function Kf(e){let t=kd(),n=t?{Authorization:`Bearer `+t}:{};return fetch(e,{headers:n}).then(e=>e.ok?e.json():null).catch(()=>null)}function qf(){let{data:e}=Bd(),t=(e||[]).filter(e=>e.kind===`app`),n={fontSize:10.5,fontWeight:600,color:S.ink3,letterSpacing:`0.06em`,textTransform:`uppercase`};return(0,w.jsxs)(`table`,{style:{width:`100%`,borderCollapse:`collapse`},children:[(0,w.jsx)(`thead`,{children:(0,w.jsxs)(`tr`,{style:{background:`#fafbfc`},children:[(0,w.jsx)(`th`,{style:{...n,textAlign:`left`,padding:`10px 16px`},children:`服务`}),(0,w.jsx)(`th`,{style:{...n,textAlign:`left`,padding:`10px 12px`},children:`状态`}),(0,w.jsx)(`th`,{style:{...n,textAlign:`left`,padding:`10px 12px`},children:`版本`}),(0,w.jsx)(`th`,{style:{...n,textAlign:`left`,padding:`10px 12px`},children:`关联资源`}),(0,w.jsx)(`th`,{style:{...n,textAlign:`right`,padding:`10px 12px`},children:`QPS`}),(0,w.jsx)(`th`,{style:{...n,textAlign:`right`,padding:`10px 12px`},children:`延迟 P99`}),(0,w.jsx)(`th`,{style:{...n,textAlign:`right`,padding:`10px 16px`},children:`占用`})]})}),(0,w.jsx)(`tbody`,{children:t.map((e,t)=>{let n=e.state===`running`;return(0,w.jsxs)(`tr`,{style:{borderTop:t?`1px solid ${S.borderSoft}`:`none`},children:[(0,w.jsx)(`td`,{style:{padding:`10px 16px`},children:(0,w.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,gap:8},children:[(0,w.jsx)(`div`,{style:{width:22,height:22,borderRadius:6,background:e.bg,color:`white`,display:`flex`,alignItems:`center`,justifyContent:`center`},children:(0,w.jsx)(D,{name:e.icon,size:12,stroke:1.8})}),(0,w.jsx)(`span`,{style:{fontSize:12.5,color:S.ink,fontWeight:500},children:e.name})]})}),(0,w.jsx)(`td`,{style:{padding:`10px 12px`},children:n?(0,w.jsxs)(J,{tone:`green`,children:[(0,w.jsx)(q,{tone:`green`,size:6}),`运行中`]}):(0,w.jsxs)(J,{tone:`red`,children:[(0,w.jsx)(q,{tone:`red`,size:6,pulse:!0}),`异常`]})}),(0,w.jsx)(`td`,{style:{padding:`10px 12px`,fontSize:12},className:`mono`,children:e.version}),(0,w.jsx)(`td`,{style:{padding:`10px 12px`,fontSize:12,color:S.ink2},children:e.gpu}),(0,w.jsx)(`td`,{style:{padding:`10px 12px`,textAlign:`right`,fontSize:12,color:S.ink},className:`mono tnum`,children:n?e.qps:`—`}),(0,w.jsx)(`td`,{style:{padding:`10px 12px`,textAlign:`right`,fontSize:12,color:S.ink},className:`mono tnum`,children:n?`${e.p99} ms`:`—`}),(0,w.jsx)(`td`,{style:{padding:`10px 16px`,textAlign:`right`,fontSize:12,color:S.ink2},className:`mono tnum`,children:n&&e.gpuPct?`${e.gpuPct}%`:`—`})]},e.id)})})]})}function Jf({onOpenApp:e}){let[t,n]=(0,b.useState)({}),[r,i]=(0,b.useState)(null),[a,o]=(0,b.useState)([]),[s,c]=(0,b.useState)([]);(0,b.useEffect)(()=>{let e=async()=>{try{let[e,t,r]=await Promise.all([Kf(`/api/v1/metrics`),Kf(`/api/v1/device`),Kf(`/api/v1/apps`)]);if(e&&i(e),t&&n({model:t.cpuModel,name:t.hostname}),e&&e.gpuData&&o(e.gpuData),r&&Array.isArray(r)&&r.length>0){let e=s.filter(e=>e.kind===`system`),t=r.map(e=>({id:e.id,kind:`app`,name:e.name,state:e.state,version:e.version||`latest`,icon:`apps`,color:`#3b82f6`,bg:`linear-gradient(160deg,#3b82f6,#1d4ed8)`,category:``,desc:e.image}));c([...e,...t])}}catch{}};e();let t=setInterval(e,5e3);return()=>clearInterval(t)},[]);let l=r?Math.round(r.cpuUsedPercent):null,u=a.length>0?Math.round(a.reduce((e,t)=>e+t.gpuUtil,0)/a.length):null,d=r?Math.round(r.memoryTotal/(1024*1024*1024)):null,f=r?Math.round(r.memoryUsed/(1024*1024*1024)):null,p=r?Math.round(r.memoryUsedPercent):null,m=r&&r.diskData&&r.diskData.length>0?r.diskData.reduce((e,t)=>t.total>e.total?t:e,r.diskData[0]):null,h=m?Math.round(m.usedPercent):null,g=m?Math.round(m.used/(1024*1024*1024)):null,_=m?Math.round(m.total/(1024*1024*1024)):null,v=r&&r.cpuPercent?r.cpuPercent.length:null;return(0,w.jsxs)(`div`,{style:{flex:1,padding:`20px 24px`,overflow:`auto`,background:S.surfaceAlt},children:[(0,w.jsx)(`div`,{style:{display:`flex`,alignItems:`center`,marginBottom:14},children:(0,w.jsxs)(`div`,{children:[(0,w.jsx)(`div`,{style:{...S.type.heading,color:S.ink},children:`仪表盘 · 总览`}),(0,w.jsxs)(`div`,{style:{fontSize:12,color:S.ink3,marginTop:3,display:`flex`,alignItems:`center`,gap:8},children:[(0,w.jsxs)(`span`,{children:[(0,w.jsx)(`span`,{className:`edge-live-dot`,style:{display:`inline-block`,width:6,height:6,borderRadius:`50%`,background:S.green,marginRight:5,verticalAlign:`middle`}}),`实时刷新中`]}),(0,w.jsx)(`span`,{style:{color:`#cbd5e1`},children:`·`}),(0,w.jsx)(`span`,{children:`采样间隔 5s`}),(0,w.jsx)(`span`,{style:{color:`#cbd5e1`},children:`·`}),(0,w.jsx)(`span`,{children:t.model||``})]})]})}),(0,w.jsxs)(`div`,{style:{display:`grid`,gridTemplateColumns:`repeat(4, 1fr)`,gap:12,marginBottom:14},children:[(0,w.jsx)(Gf,{icon:`cpu`,label:`CPU 使用率`,color:S.blue,value:l==null?null:`${l}%`,sub:v==null?`加载中…`:`${v}C 当前负载`}),(0,w.jsx)(Gf,{icon:`bolt`,label:`GPU 平均`,color:S.indigo,value:a.length>0?u==null?null:`${u}%`:`无 GPU`,sub:a.length>0?`${a.length} × ${a[0].productName}`:`本节点未检测到 NVIDIA GPU`}),(0,w.jsx)(Gf,{icon:`memory`,label:`内存`,color:S.teal,value:p==null?null:`${p}%`,sub:f!=null&&d!=null?`${f} GB / ${d} GB`:`加载中…`}),(0,w.jsx)(Gf,{icon:`hardDrive`,label:`磁盘`,color:S.amber,value:h==null?null:`${h}%`,sub:g!=null&&_!=null?`${g} GB / ${_} GB`:`加载中…`})]}),(0,w.jsx)(`div`,{style:{display:`flex`,justifyContent:`flex-end`,marginBottom:14},children:(0,w.jsxs)(`button`,{onClick:()=>{e?e({id:`monitoring`,kind:`system`,name:`监控`}):window.alert(`监控 App 尚未就绪`)},className:`edge-press edge-btn-primary`,style:{..._d,height:32,padding:`0 14px`,fontSize:12.5},children:[(0,w.jsx)(D,{name:`sparkle`,size:13,stroke:1.8}),`进入监控查看详细曲线 →`]})}),(0,w.jsxs)(`div`,{style:{background:S.surface,border:`1px solid ${S.border}`,borderRadius:10,padding:0,overflow:`hidden`},children:[(0,w.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,padding:`12px 16px`,borderBottom:`1px solid ${S.borderSoft}`},children:[(0,w.jsx)(`div`,{style:{fontSize:13,fontWeight:600,color:S.ink},children:`应用摘要`}),(0,w.jsx)(`div`,{style:{flex:1}}),(0,w.jsxs)(`span`,{style:{fontSize:11.5,color:S.ink3},children:[`共 `,s.filter(e=>e.kind===`app`).length,` 个 · `,s.filter(e=>e.kind===`app`&&e.state===`running`).length,` 运行中 · `,s.filter(e=>e.kind===`app`&&e.state===`error`).length,` 异常`]})]}),(0,w.jsx)(qf,{})]})]})}var Yf={position:`relative`,border:`none`,background:`transparent`,cursor:`pointer`,display:`flex`,alignItems:`center`,gap:6,boxSizing:`border-box`,whiteSpace:`nowrap`,fontFamily:`inherit`};function Xf(e,t,n){return typeof e==`function`?e(t,n):e}function Zf({tabs:e,active:t,onChange:n,getId:r=e=>e.id,renderLabel:i,itemAs:a=`div`,style:o,itemStyle:s,activeItemStyle:c,inactiveItemStyle:l,activeColor:u=S.blue,activeTextColor:d=S.blueDeep,inactiveTextColor:f=S.ink3,activeWeight:p=600,inactiveWeight:m=500,indicatorPosition:h=`bottom`,indicatorInset:g=0,indicatorRadius:_=0,reserveIndicatorSpace:v=!0,getItemProps:y}){let x=`tabbar-${(0,b.useId)()}-indicator`,C=Wu();return(0,w.jsx)(`div`,{style:{display:`flex`,gap:2,...o},children:e.map(e=>{let o=r(e),S=t===o,T=y?y(e,S):null,E={position:`absolute`,left:g,right:g,height:2,background:u,borderRadius:_,pointerEvents:`none`,[h]:0};return(0,b.createElement)(a,{key:o,onClick:()=>n(o,e),type:a===`button`?`button`:void 0,...T,style:{...Yf,...v?{[h===`top`?`borderTop`:`borderBottom`]:`2px solid transparent`}:null,color:S?d:f,fontWeight:S?p:m,...Xf(s,e,S),...Xf(S?c:l,e,S),...T?.style}},i?i(e,S):e.label,S&&(0,w.jsx)(Hu.div,{layoutId:x,style:E,transition:C.reduced?{duration:0}:Uu.snappy}))})})}function Qf(e,t){if(!e&&!t)return 0;if(!e)return-1;if(!t)return 1;let n=e=>String(e).replace(/^v/i,``).split(/[.\-+]/),r=n(e),i=n(t),a=Math.max(r.length,i.length);for(let e=0;e0&&(t[e.slice(0,r).trim()]=e.slice(r+1))}return t}function tp(e){return e&&typeof e==`object`&&`raw`in e?String(e.raw):e==null?``:String(e)}function np(e){if(!e)return``;if(e.label){if(e.label.zh)return e.label.zh;if(e.label.en)return e.label.en}return e.key||``}function rp(e,t){if(!e)return t;if(e.type===`number`&&t!==``&&t!=null){let e=Number(t);return Number.isNaN(e)?t:e}return e.type===`boolean`?t===!0||t===`true`:t}function ip(e,t){return Array.isArray(e)?e.filter(e=>e.required&&(t[e.key]==null||t[e.key]===``)).map(e=>np(e)):[]}function ap(e){let t={blocked:[],confirmation:[],warning:[]};if(!Array.isArray(e))return t;for(let n of e){let e=n&&n.level;e===`blocked`||e===`confirmation`||e===`warning`?t[e].push(n):t.warning.push(n)}return t}function op(e,t){return e.blocked.length>0?{deployable:!1,reason:`blocked`}:e.confirmation.length>0&&!t?{deployable:!1,reason:`confirmation`}:{deployable:!0,reason:`ok`}}function sp(e){if(!e)return{label:`未知`,tone:`gray`,hint:``};switch(e.kind){case`managed`:return{label:`受管卷`,tone:`blue`,hint:e.deletable?`卸载并清除数据(purge)时会删除`:`由 devbox 托管`};case`external`:return{label:`外部卷`,tone:`amber`,hint:`external:true 外部数据,卸载时永不删除`};case`bind`:return{label:`宿主挂载`,tone:`amber`,hint:`绑定宿主路径,生命周期由宿主管,卸载时不删除`};case`socket`:return{label:`Socket`,tone:`red`,hint:`特权 socket 挂载(安装期已阻断,仅防御性标识)`};default:return{label:e.kind||`卷`,tone:`gray`,hint:``}}}function cp(e){if(!e)return{typeLabel:`—`,secret:!1};let t=e.type===`password`;return{typeLabel:t?`Secret`:e.type===`text`?`文本`:e.type||`—`,secret:t}}function lp(e,t=Date.now()){if(!e)return`—`;let n=new Date(e).getTime();if(Number.isNaN(n))return`—`;let r=Math.max(0,t-n),i=Math.floor(r/6e4);if(i<1)return`刚刚`;if(i<60)return`${i} 分钟前`;let a=Math.floor(i/60);if(a<24)return`${a} 小时前`;let o=Math.floor(a/24);if(o===1)return`昨天`;if(o<7)return`${o} 天前`;try{return new Date(e).toLocaleString(`zh-CN`,{year:`numeric`,month:`2-digit`,day:`2-digit`,hour:`2-digit`,minute:`2-digit`})}catch{return`—`}}function up(e){if(!e)return`—`;let t=new Date(e).getTime();if(Number.isNaN(t))return`—`;try{return new Date(e).toLocaleString(`zh-CN`,{year:`numeric`,month:`2-digit`,day:`2-digit`,hour:`2-digit`,minute:`2-digit`})}catch{return`—`}}var dp={running:`运行中`,stopped:`已停止`,degraded:`降级`,deploying:`部署中`,failed:`失败`,pending:`等待`,removing:`卸载中`,unknown:`未知`},fp={running:`green`,stopped:`gray`,degraded:`amber`,deploying:`blue`,failed:`red`,pending:`blue`,removing:`violet`,unknown:`gray`};function pp(e){return e?.observed?.phase||e?.state||`unknown`}function mp(e){return e===`compose`?`Docker Compose`:e===`kubernetes`?`Kubernetes`:`未知`}function hp(e){if(!e)return``;let t=String(e.protocol||`tcp`).toLowerCase();return e.hostPort&&e.hostPort>0?`${e.hostPort}:${e.containerPort}/${t}`:e.containerPort?`${e.containerPort}/${t}`:``}function gp(e,t=4){let n=(e&&e.observed&&e.observed.services||[]).map(e=>({name:e.name||`—`,state:e.state||``,health:e.health||``,ports:(e.ports||[]).map(hp).filter(Boolean)})),r=n.length,i=r>t;return{rows:n.slice(0,t),total:r,truncated:i}}var _p={healthy:`健康`,unhealthy:`不健康`,starting:`启动中`,none:`—`};function vp(e){let t=e?.source?.kind;return t===`store`?{label:`平台商店`,tone:`blue`,kind:`store`}:t===`catalog`?{label:`第三方 Catalog`,tone:`violet`,kind:`catalog`}:t===`inline`?{label:`自定义`,tone:`gray`,kind:`inline`}:{label:e?.runtime===`compose`?`本地`:`K8s`,tone:`gray`,kind:`local`}}function yp(e,t,n){let r=e?.source?.kind,i=e?.source?.storeId;return i?r===`store`&&Array.isArray(t)?t.find(e=>e&&e.id===i)||null:r===`catalog`&&Array.isArray(n)&&n.find(t=>t&&t.catalogId===e.source.catalogId&&t.id===i)||null:null}function bp(e,t,n){let r=yp(e,t,n),i=e?.source?.version||e?.version||``;if(!r)return{upgradable:!1,latestVersion:``,installedVersion:i,installable:!1};let a=r.version||``;return{upgradable:!!i&&!!a&&Qf(i,a)<0,latestVersion:a,installedVersion:i,installable:!!r.installable}}var xp=(0,b.createContext)(null);function Sp(){let e=(0,b.useContext)(xp);if(!e)throw Error(`useToast must be used inside ToastProvider`);return e}function Cp(e,t,n){let r=(e+` `+t).toLowerCase();for(let[e,t]of Object.entries({code:{icon:`code`,bg:`linear-gradient(160deg,#3b82f6,#1e40af)`},vscode:{icon:`code`,bg:`linear-gradient(160deg,#3b82f6,#1e40af)`},jupyter:{icon:`jupyter`,bg:`linear-gradient(160deg,#fb923c,#c2410c)`},ollama:{icon:`ollama`,bg:`linear-gradient(160deg,#475569,#0f172a)`},vllm:{icon:`vllm`,bg:`linear-gradient(160deg,#fb7185,#be123c)`},qwen:{icon:`sparkle`,bg:`linear-gradient(160deg,#818cf8,#4338ca)`},deepseek:{icon:`sparkle`,bg:`linear-gradient(160deg,#1e293b,#020617)`},lobe:{icon:`openwebui`,bg:`linear-gradient(160deg,#a78bfa,#7c3aed)`},webui:{icon:`openwebui`,bg:`linear-gradient(160deg,#22d3ee,#0891b2)`},mysql:{icon:`database`,bg:`linear-gradient(160deg,#22d3ee,#0891b2)`},postgres:{icon:`database`,bg:`linear-gradient(160deg,#60a5fa,#2563eb)`},redis:{icon:`database`,bg:`linear-gradient(160deg,#fb7185,#e11d48)`},comfy:{icon:`palette`,bg:`linear-gradient(160deg,#a78bfa,#6d28d9)`}}))if(r.includes(e))return t;return{"ai-inference":{icon:`sparkle`,bg:`linear-gradient(160deg,#818cf8,#4338ca)`},"ai-tools":{icon:`wrench`,bg:`linear-gradient(160deg,#34d399,#059669)`},"dev-environment":{icon:`code`,bg:`linear-gradient(160deg,#3b82f6,#1d4ed8)`},database:{icon:`database`,bg:`linear-gradient(160deg,#22d3ee,#0891b2)`}}[n]||{icon:`apps`,bg:`linear-gradient(160deg,#64748b,#334155)`}}var wp={"ai-inference":`AI 推理`,"ai-tools":`AI 工具`,"dev-environment":`开发环境`,database:`存储`},Tp={"ai-inference":`sparkle`,"ai-tools":`wrench`,"dev-environment":`code`,database:`database`};function Ep({app:e,onClose:t,onSuccess:n}){let[r,i]=(0,b.useState)(!0),[a,o]=(0,b.useState)(null),[s,c]=(0,b.useState)({}),[l,u]=(0,b.useState)(!1),[d,f]=(0,b.useState)(null),[p,m]=(0,b.useState)([]),[h,g]=(0,b.useState)(!1),[_,v]=(0,b.useState)({}),y=e.origin===`catalog`;(0,b.useEffect)(()=>{let t=!1;return(y?Uf(e.sourceId,e.id,e.ver||``):jf(e.id,e.ver||``)).then(e=>{if(t)return;let n=e.valuesSchema,r=e.defaultValues||{};o(n);let i={};n&&n.fields&&n.fields.forEach(e=>{i[e.key]=tp(r[e.key])}),c(i),e.installable===!1&&f(e.notInstallableReason||`该应用不可在本机安装`)}).catch(e=>{t||f(e.message||`获取版本信息失败`)}).finally(()=>{t||i(!1)}),()=>{t=!0}},[e.id,e.ver,e.sourceId,y]);let x=(e,t)=>{c(n=>({...n,[e]:t})),m([]),g(!1),f(null)};async function C(){let t=a?.fields||[],r=ip(t,s);if(r.length>0){f(`请填写必填项: ${r.join(`, `)}`);return}u(!0),f(null);try{let r={};t.forEach(e=>{r[e.key]=rp(e,s[e.key])});let i=y?{sourceId:e.sourceId,appId:e.id,version:e.ver||``,values:r,confirmRisky:h}:{appId:e.id,version:e.ver||``,values:r,confirmRisky:h};n(y?await Wf(i):await Mf(i))}catch(e){e.reason===`risk_blocked`&&Array.isArray(e.findings)&&(m(e.findings),g(!1)),f(e.message||`部署失败`)}finally{u(!1)}}let T=a?.fields||[],E=p.some(e=>e.level===`blocked`),O=p.some(e=>e.level===`confirmation`),k=d&&/不可|installable|Kubernetes/i.test(d)&&!T.length,A={width:`100%`,height:34,padding:`0 10px`,borderRadius:7,border:`1px solid ${S.border}`,fontSize:13,background:S.surface,color:S.ink,outline:`none`,boxSizing:`border-box`};return(0,w.jsx)(`div`,{style:{position:`fixed`,inset:0,zIndex:999,display:`flex`,alignItems:`center`,justifyContent:`center`,background:`rgba(15,23,42,0.5)`,backdropFilter:`blur(4px)`},onClick:t,children:(0,w.jsxs)(`div`,{onClick:e=>e.stopPropagation(),style:{width:480,maxWidth:`94vw`,maxHeight:`84vh`,borderRadius:14,background:S.surface,border:`1px solid ${S.border}`,boxShadow:`0 24px 48px -12px rgba(0,0,0,0.2)`,display:`flex`,flexDirection:`column`,overflow:`hidden`},children:[(0,w.jsxs)(`div`,{style:{padding:`16px 20px`,borderBottom:`1px solid ${S.border}`,display:`flex`,alignItems:`center`,gap:10},children:[(0,w.jsx)(`div`,{style:{width:32,height:32,borderRadius:8,background:e.iconUrl?S.surfaceAlt:e.bg,color:`white`,display:`flex`,alignItems:`center`,justifyContent:`center`,flexShrink:0,overflow:`hidden`},children:e.iconUrl?(0,w.jsx)(`img`,{src:e.iconUrl,alt:``,style:{width:32,height:32,objectFit:`cover`}}):(0,w.jsx)(D,{name:e.icon,size:18,stroke:1.7})}),(0,w.jsxs)(`div`,{style:{flex:1,minWidth:0},children:[(0,w.jsxs)(`div`,{style:{...S.type.heading,color:S.ink},children:[`部署 `,e.name]}),(0,w.jsxs)(`div`,{style:{fontSize:11,color:S.ink3},className:`mono`,children:[e.ver,` · `,y?e.sourceName||`第三方 Catalog`:`平台商店`]})]}),(0,w.jsx)(`button`,{onClick:t,"aria-label":`关闭`,style:{background:`none`,border:`none`,cursor:`pointer`,padding:4,color:S.ink3},children:(0,w.jsx)(D,{name:`x`,size:16,stroke:2})})]}),(0,w.jsxs)(`div`,{style:{flex:1,overflow:`auto`,padding:`16px 20px`},children:[r&&(0,w.jsx)(`div`,{style:{textAlign:`center`,padding:40,color:S.ink3},children:`加载配置中…`}),!r&&k&&(0,w.jsx)(`div`,{style:{padding:20,textAlign:`center`,color:`#b45309`,fontSize:12.5},children:d}),!r&&!k&&T.length===0&&!d&&(0,w.jsx)(`div`,{style:{textAlign:`center`,padding:40,color:S.ink3},children:`此应用无需配置参数`}),!r&&T.length>0&&(0,w.jsx)(`div`,{style:{display:`flex`,flexDirection:`column`,gap:14},children:T.map(e=>{let t=np(e);return(0,w.jsxs)(`div`,{children:[(0,w.jsxs)(`label`,{style:{fontSize:12,color:S.ink2,fontWeight:600,marginBottom:5,display:`block`},htmlFor:`fld-${e.key}`,children:[t,e.required&&(0,w.jsx)(`span`,{style:{color:`#ef4444`,marginLeft:2},children:`*`})]}),e.type===`select`?(0,w.jsx)(`select`,{id:`fld-${e.key}`,value:s[e.key]||``,onChange:t=>x(e.key,t.target.value),style:{...A,cursor:`pointer`},children:(e.options||[]).map(e=>(0,w.jsx)(`option`,{value:e.value,children:e.label},e.value))}):e.type===`password`?(0,w.jsxs)(`div`,{style:{position:`relative`},children:[(0,w.jsx)(`input`,{id:`fld-${e.key}`,type:_[e.key]?`text`:`password`,value:s[e.key]||``,onChange:t=>x(e.key,t.target.value),placeholder:t,autoComplete:`new-password`,style:{...A,paddingRight:36}}),(0,w.jsx)(`button`,{type:`button`,onClick:()=>v(t=>({...t,[e.key]:!t[e.key]})),"aria-label":_[e.key]?`隐藏`:`显示`,style:{position:`absolute`,right:6,top:7,background:`none`,border:`none`,cursor:`pointer`,color:S.ink4,padding:2},children:(0,w.jsx)(D,{name:`eye`,size:14,stroke:1.8})})]}):e.type===`boolean`?(0,w.jsxs)(`label`,{style:{display:`flex`,alignItems:`center`,gap:8,cursor:`pointer`},children:[(0,w.jsx)(`input`,{id:`fld-${e.key}`,type:`checkbox`,checked:s[e.key]===!0||s[e.key]===`true`,onChange:t=>x(e.key,t.target.checked)}),(0,w.jsx)(`span`,{style:{fontSize:12.5,color:S.ink2},children:t})]}):(0,w.jsx)(`input`,{id:`fld-${e.key}`,type:e.type===`number`?`number`:`text`,value:s[e.key]??``,onChange:t=>x(e.key,t.target.value),placeholder:t,style:A})]},e.key)})}),d&&!k&&(0,w.jsx)(`div`,{style:{fontSize:12,color:`#ef4444`,marginTop:10,padding:`8px 10px`,background:`#fef2f2`,borderRadius:6},children:d}),p.length>0&&(0,w.jsxs)(`div`,{style:{marginTop:10,padding:`10px 12px`,borderRadius:7,background:`#fffbeb`,border:`1px solid #fde68a`},children:[(0,w.jsx)(`div`,{style:{fontSize:12,fontWeight:700,color:`#92400e`,marginBottom:6},children:`运行权限风险`}),p.map((e,t)=>(0,w.jsxs)(`div`,{style:{fontSize:11.5,color:e.level===`blocked`?`#b91c1c`:`#92400e`,marginTop:3},children:[e.level===`blocked`?`已阻断`:e.level===`confirmation`?`需确认`:`警告`,`:`,e.message]},`${e.field||`risk`}-${t}`)),O&&!E&&(0,w.jsxs)(`label`,{style:{display:`flex`,alignItems:`flex-start`,gap:7,marginTop:9,cursor:`pointer`,fontSize:11.5,color:`#78350f`},children:[(0,w.jsx)(`input`,{type:`checkbox`,checked:h,onChange:e=>g(e.target.checked)}),(0,w.jsx)(`span`,{children:`我了解该应用将获得列出的宿主权限,并确认继续部署`})]})]})]}),(0,w.jsxs)(`div`,{style:{padding:`12px 20px`,borderTop:`1px solid ${S.border}`,display:`flex`,justifyContent:`flex-end`,gap:8},children:[(0,w.jsx)(`button`,{onClick:t,className:`edge-press edge-btn-secondary`,style:{...gd,height:34,padding:`0 16px`},children:`取消`}),(0,w.jsxs)(`button`,{onClick:C,disabled:l||r||k||E||O&&!h,className:`edge-press edge-btn-primary`,style:{..._d,height:34,padding:`0 20px`,opacity:l||r||k||E||O&&!h?.6:1},children:[(0,w.jsx)(D,{name:`download`,size:13,stroke:2}),l?`部署中...`:h?`确认风险并部署`:`确认部署`]})]})]})})}function Dp({taskId:e}){let{task:t}=hf(e,1500),n=!t||!t.status?`Pending`:t.status===`succeeded`?`Running`:t.status===`failed`?`Failed`:`Pending`,r={Pending:`部署中`,Running:`已部署`,Failed:`部署失败`}[n],i=t?.message||``,a={Pending:`#f59e0b`,Running:`#10b981`,Failed:`#ef4444`}[n]||S.ink3;return(0,w.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,gap:8,padding:`8px 12px`,borderRadius:8,background:S.surfaceAlt,border:`1px solid ${S.borderSoft}`},children:[(0,w.jsx)(q,{tone:n===`Running`?`green`:n===`Failed`?`red`:`amber`,size:8}),(0,w.jsx)(`span`,{style:{fontSize:12.5,fontWeight:600,color:a},children:r}),i&&(0,w.jsxs)(`span`,{style:{fontSize:11,color:S.ink3},children:[`— `,i]})]})}function Op({app:e,onBack:t,onOpenApp:n}){let[r,i]=(0,b.useState)(!1),[a,o]=(0,b.useState)(null);return(0,w.jsxs)(`div`,{style:{flex:1,display:`flex`,flexDirection:`column`,background:S.surfaceAlt,overflow:`auto`},children:[(0,w.jsxs)(`div`,{style:{padding:`12px 24px`,borderBottom:`1px solid ${S.border}`,background:S.surface,display:`flex`,alignItems:`center`,gap:10},children:[(0,w.jsxs)(`button`,{onClick:t,className:`edge-press edge-btn-secondary`,style:{...gd,height:28,padding:`0 10px`},children:[(0,w.jsx)(D,{name:`chevDown`,size:12,stroke:2,style:{transform:`rotate(90deg)`}}),`返回应用列表`]}),(0,w.jsxs)(`span`,{style:{fontSize:11.5,color:S.ink3},children:[`应用列表 `,(0,w.jsx)(`span`,{style:{color:S.ink4},children:`/`}),` `,(0,w.jsx)(`span`,{style:{color:S.ink,fontWeight:600},children:e.name})]})]}),(0,w.jsxs)(`div`,{style:{padding:24},children:[(0,w.jsxs)(`div`,{style:{background:S.surface,border:`1px solid ${S.border}`,borderRadius:12,padding:24,marginBottom:16,display:`flex`,alignItems:`flex-start`,gap:18},children:[(0,w.jsx)(`div`,{style:{width:64,height:64,borderRadius:14,background:e.iconUrl?S.surfaceAlt:e.bg,color:`white`,display:`flex`,alignItems:`center`,justifyContent:`center`,flexShrink:0,overflow:`hidden`},children:e.iconUrl?(0,w.jsx)(`img`,{src:e.iconUrl,alt:``,style:{width:64,height:64,objectFit:`cover`}}):(0,w.jsx)(D,{name:e.icon,size:30,stroke:1.6})}),(0,w.jsxs)(`div`,{style:{flex:1,minWidth:0},children:[(0,w.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,gap:8,flexWrap:`wrap`},children:[(0,w.jsx)(`div`,{style:{...S.type.title,fontWeight:700,color:S.ink},children:e.name}),(0,w.jsx)(J,{tone:e.runtime===`compose`?`blue`:`gray`,children:e.runtime===`compose`?`Docker Compose`:`Kubernetes`}),(0,w.jsx)(J,{tone:`gray`,children:(0,w.jsx)(`span`,{className:`mono`,children:e.ver})}),e.cat&&(0,w.jsx)(J,{tone:`blue`,children:e.cat}),(0,w.jsx)(J,{tone:e.origin===`catalog`?`violet`:`blue`,children:e.origin===`catalog`?e.sourceName||`第三方 Catalog`:`平台商店`}),(e.installed||a)&&(0,w.jsxs)(J,{tone:`green`,children:[(0,w.jsx)(q,{tone:`green`,size:6}),a?`已部署`:`已安装`]})]}),(0,w.jsxs)(`div`,{style:{fontSize:12,color:S.ink3,marginTop:6,display:`flex`,gap:10,flexWrap:`wrap`},children:[e.provider&&(0,w.jsxs)(w.Fragment,{children:[(0,w.jsxs)(`span`,{children:[`提供方 `,(0,w.jsx)(`span`,{style:{color:S.ink2,fontWeight:600},children:e.provider})]}),(0,w.jsx)(`span`,{style:{color:`#cbd5e1`},children:`·`})]}),e.date&&(0,w.jsxs)(`span`,{children:[`更新于 `,(0,w.jsx)(`span`,{className:`mono`,children:e.date})]})]}),(0,w.jsx)(`div`,{style:{fontSize:13,color:S.ink2,marginTop:12,lineHeight:1.7},children:e.desc})]}),(0,w.jsxs)(`div`,{style:{display:`flex`,flexDirection:`column`,gap:8,flexShrink:0,alignItems:`flex-end`},children:[e.installable?(0,w.jsxs)(`button`,{onClick:()=>i(!0),className:`edge-press edge-btn-primary`,style:{..._d,height:36,padding:`0 18px`},children:[(0,w.jsx)(D,{name:`download`,size:13,stroke:2}),e.upgradable?`升级到 ${e.ver}`:e.installed?`重新部署`:`部署`]}):(0,w.jsx)(`div`,{title:e.notInstallableReason||``,style:{fontSize:11.5,color:S.ink3,padding:`8px 12px`,borderRadius:8,background:S.surfaceAlt,border:`1px solid ${S.borderSoft}`,maxWidth:180,textAlign:`center`},children:e.notInstallableReason||`仅 Kubernetes 环境支持`}),e.installed&&e.installable&&(0,w.jsxs)(`button`,{onClick:()=>n&&n({id:e.devboxId||e.id}),className:`edge-press edge-btn-secondary`,style:{...gd,height:30,padding:`0 14px`},children:[(0,w.jsx)(D,{name:`play`,size:12,stroke:2}),`打开应用`]})]})]}),a&&(0,w.jsx)(Yu,{title:`部署状态`,padding:16,style:{marginBottom:12},children:(0,w.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,gap:12},children:[(0,w.jsx)(Dp,{taskId:a.taskId}),(0,w.jsx)(`span`,{style:{fontSize:12,color:S.ink3},className:`mono`,children:a.appId||a.name})]})}),(0,w.jsx)(Yu,{title:`README · 简介`,padding:20,children:(0,w.jsx)(`div`,{style:{fontSize:13,color:S.ink2,lineHeight:1.75},children:(0,w.jsxs)(`p`,{style:{margin:`0 0 10px`},children:[(0,w.jsx)(`strong`,{style:{color:S.ink},children:e.name}),` — `,e.desc]})})})]}),r&&(0,w.jsx)(Ep,{app:e,onClose:()=>i(!1),onSuccess:e=>{i(!1),o(e)}})]})}function kp({app:e,onOpen:t,onOpenApp:n}){return(0,w.jsxs)(`div`,{onClick:t,className:`edge-row-hover`,role:`button`,tabIndex:0,onKeyDown:e=>{e.key===`Enter`&&t()},style:{background:S.surface,border:`1px solid ${S.border}`,borderRadius:10,padding:14,cursor:`pointer`,transition:`all 0.15s ease`,display:`flex`,flexDirection:`column`,gap:10,"--edge-row-hover-bg":S.surface,"--edge-row-hover-border-color":`#bfdbfe`,"--edge-row-hover-box-shadow":`0 6px 14px -6px rgba(15,23,42,0.12)`},children:[(0,w.jsxs)(`div`,{style:{display:`flex`,alignItems:`flex-start`,gap:10},children:[(0,w.jsx)(`div`,{style:{width:40,height:40,borderRadius:10,background:e.iconUrl?S.surfaceAlt:e.bg,color:`white`,display:`flex`,alignItems:`center`,justifyContent:`center`,flexShrink:0,overflow:`hidden`,boxShadow:e.iconUrl?`0 1px 3px rgba(0,0,0,0.08)`:`inset 0 1px 0 rgba(255,255,255,0.3)`},children:e.iconUrl?(0,w.jsx)(`img`,{src:e.iconUrl,alt:``,style:{width:40,height:40,objectFit:`cover`}}):(0,w.jsx)(D,{name:e.icon,size:20,stroke:1.7})}),(0,w.jsxs)(`div`,{style:{minWidth:0,flex:1},children:[(0,w.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,gap:5},children:[(0,w.jsx)(`div`,{style:{fontSize:14,fontWeight:600,color:S.ink,whiteSpace:`nowrap`,overflow:`hidden`,textOverflow:`ellipsis`},children:e.name}),e.installed&&!e.upgradable&&(0,w.jsx)(`span`,{style:{fontSize:9.5,padding:`1px 5px`,borderRadius:3,background:`#ecfdf5`,color:`#047857`,border:`1px solid #a7f3d0`,fontWeight:600,flexShrink:0},children:`已安装`}),e.upgradable&&(0,w.jsx)(`span`,{title:`已装 ${e.installedVersion} → ${e.ver}`,style:{fontSize:9.5,padding:`1px 5px`,borderRadius:3,background:`#fffbeb`,color:`#b45309`,border:`1px solid #fde68a`,fontWeight:600,flexShrink:0},children:`可升级`})]}),(0,w.jsxs)(`div`,{style:{fontSize:11,color:S.ink3,marginTop:3,display:`flex`,gap:6,alignItems:`center`},children:[(0,w.jsx)(`span`,{className:`mono`,children:e.ver}),(0,w.jsx)(`span`,{style:{color:`#cbd5e1`},children:`·`}),(0,w.jsx)(`span`,{children:e.origin===`catalog`?e.sourceName||`Catalog`:`平台`})]})]})]}),(0,w.jsx)(`div`,{style:{fontSize:12,color:S.ink2,lineHeight:1.55,display:`-webkit-box`,WebkitLineClamp:2,WebkitBoxOrient:`vertical`,overflow:`hidden`,minHeight:38},children:e.desc}),(0,w.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,gap:6,paddingTop:10,borderTop:`1px dashed ${S.border}`},children:[e.cat&&(0,w.jsx)(`span`,{style:{fontSize:10.5,padding:`2px 6px`,borderRadius:3,background:S.surfaceAlt,color:S.ink3,border:`1px solid ${S.borderSoft}`},children:e.cat}),(0,w.jsx)(`span`,{style:{fontSize:9.5,padding:`1px 5px`,borderRadius:3,fontWeight:600,flexShrink:0,background:e.runtime===`compose`?`#eff6ff`:S.surfaceAlt,color:e.runtime===`compose`?`#1d4ed8`:S.ink3,border:`1px solid ${e.runtime===`compose`?`#bfdbfe`:S.borderSoft}`},children:e.runtime===`compose`?`Compose`:`K8s`}),(0,w.jsx)(`div`,{style:{flex:1}}),e.installable?e.installed?(0,w.jsxs)(`button`,{onClick:t=>{t.stopPropagation(),n&&n({id:e.devboxId||e.id})},className:`edge-press edge-btn-secondary`,style:{...gd,height:26,padding:`0 10px`,fontSize:11.5},children:[(0,w.jsx)(D,{name:`play`,size:11,stroke:2}),`打开`]}):(0,w.jsxs)(`button`,{onClick:e=>{e.stopPropagation(),t()},className:`edge-press edge-btn-primary`,style:{..._d,height:26,padding:`0 10px`,fontSize:11.5},children:[(0,w.jsx)(D,{name:`download`,size:11,stroke:2}),`部署`]}):(0,w.jsx)(`span`,{title:e.notInstallableReason||``,style:{fontSize:10.5,color:`#b45309`,fontWeight:600,flexShrink:0},children:e.runtime===`compose`?`暂不可安装`:`仅 Kubernetes`})]})]})}function Ap({source:e,onClose:t,onSaved:n}){let r=!!e,[i,a]=(0,b.useState)({id:e?.id||``,name:e?.name||``,kind:e?.kind||`auto`,url:e?.url||`https://github.com/1Panel-dev/appstore`,ref:e?.ref||``,token:``}),[o,s]=(0,b.useState)(``),[c,l]=(0,b.useState)(null),[u,d]=(0,b.useState)(``),f=(e,t)=>a(n=>({...n,[e]:t}));(0,b.useEffect)(()=>{let e=e=>{e.key===`Escape`&&t()};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},[t]);async function p(){s(`test`),d(``),l(null);try{l(await If(i))}catch(e){d(e.message)}finally{s(``)}}async function m(){s(`save`),d(``);try{n(r?await Rf(e.id,i):await Lf(i))}catch(e){d(e.message)}finally{s(``)}}let h={width:`100%`,boxSizing:`border-box`,height:36,padding:`0 10px`,borderRadius:7,border:`1px solid ${S.border}`,background:S.surface,color:S.ink,fontSize:12.5,outline:`none`};return(0,w.jsx)(`div`,{role:`dialog`,"aria-modal":`true`,"aria-label":r?`编辑应用市场`:`添加应用市场`,style:{position:`fixed`,inset:0,zIndex:1100,display:`flex`,alignItems:`center`,justifyContent:`center`,padding:20,background:`rgba(15,23,42,0.42)`,backdropFilter:`blur(3px)`},onMouseDown:e=>{e.target===e.currentTarget&&t()},children:(0,w.jsxs)(`div`,{style:{width:520,maxWidth:`100%`,borderRadius:13,background:S.surface,boxShadow:`0 24px 70px rgba(15,23,42,0.24), 0 2px 10px rgba(15,23,42,0.08)`,overflow:`hidden`},children:[(0,w.jsxs)(`div`,{style:{padding:`18px 20px 14px`,borderBottom:`1px solid ${S.borderSoft}`,display:`flex`,alignItems:`center`,gap:10},children:[(0,w.jsx)(`div`,{style:{width:34,height:34,borderRadius:9,display:`flex`,alignItems:`center`,justifyContent:`center`,background:S.blueSoft,color:S.blueDeep},children:(0,w.jsx)(D,{name:`store`,size:17})}),(0,w.jsxs)(`div`,{children:[(0,w.jsx)(`div`,{style:{fontSize:15,fontWeight:700,color:S.ink},children:r?`编辑应用市场`:`添加 1Panel 应用市场`}),(0,w.jsx)(`div`,{style:{fontSize:11.5,color:S.ink4,marginTop:2},children:`直接填写官方或兼容的开源 Git 仓库地址`})]}),(0,w.jsx)(`div`,{style:{flex:1}}),(0,w.jsx)(`button`,{onClick:t,"aria-label":`关闭`,className:`edge-press`,style:{width:40,height:40,border:0,background:`transparent`,color:S.ink3,cursor:`pointer`},children:(0,w.jsx)(D,{name:`x`,size:16})})]}),(0,w.jsxs)(`div`,{style:{padding:20,display:`grid`,gap:13},children:[(0,w.jsxs)(`label`,{style:{display:`grid`,gap:6,fontSize:11.5,color:S.ink2},children:[`名称`,(0,w.jsx)(`input`,{autoFocus:!0,value:i.name,onChange:e=>f(`name`,e.target.value),placeholder:`例如:1Panel 官方商店`,style:h})]}),!r&&(0,w.jsxs)(`label`,{style:{display:`grid`,gap:6,fontSize:11.5,color:S.ink2},children:[`来源 ID(可留空自动生成)`,(0,w.jsx)(`input`,{value:i.id,onChange:e=>f(`id`,e.target.value),placeholder:`onepanel-official`,style:h})]}),(0,w.jsxs)(`label`,{style:{display:`grid`,gap:6,fontSize:11.5,color:S.ink2},children:[`Git 仓库地址`,(0,w.jsx)(`input`,{value:i.url,onChange:e=>f(`url`,e.target.value),spellCheck:!1,style:{...h,fontFamily:S.type?.mono}})]}),(0,w.jsxs)(`div`,{style:{display:`grid`,gridTemplateColumns:`140px 1fr`,gap:10},children:[(0,w.jsxs)(`label`,{style:{display:`grid`,gap:6,fontSize:11.5,color:S.ink2},children:[`格式`,(0,w.jsxs)(`select`,{value:i.kind,onChange:e=>f(`kind`,e.target.value),style:h,children:[(0,w.jsx)(`option`,{value:`auto`,children:`自动识别`}),(0,w.jsx)(`option`,{value:`1panel`,children:`1Panel`})]})]}),(0,w.jsxs)(`label`,{style:{display:`grid`,gap:6,fontSize:11.5,color:S.ink2},children:[`分支 / Tag(留空使用远端默认)`,(0,w.jsx)(`input`,{value:i.ref,onChange:e=>f(`ref`,e.target.value),placeholder:`官方源默认 dev`,style:h})]})]}),(0,w.jsxs)(`label`,{style:{display:`grid`,gap:6,fontSize:11.5,color:S.ink2},children:[`只读 Token(可选,仅写不回显)`,(0,w.jsx)(`input`,{type:`password`,value:i.token,onChange:e=>f(`token`,e.target.value),placeholder:e?.tokenConfigured?`已配置;留空保持不变`:`公开仓库无需填写`,autoComplete:`new-password`,style:h})]}),c&&(0,w.jsxs)(`div`,{style:{padding:`9px 11px`,borderRadius:7,background:`#ecfdf5`,color:`#047857`,fontSize:11.5},children:[(0,w.jsx)(`b`,{children:`连接成功`}),` · 已识别 `,c.kind,`,发现 `,c.appCount,` 个应用`]}),u&&(0,w.jsx)(`div`,{style:{padding:`9px 11px`,borderRadius:7,background:`#fff7ed`,color:`#c2410c`,fontSize:11.5},children:u})]}),(0,w.jsxs)(`div`,{style:{padding:`13px 20px 17px`,display:`flex`,justifyContent:`flex-end`,gap:8,borderTop:`1px solid ${S.borderSoft}`},children:[(0,w.jsx)(`button`,{onClick:p,disabled:!!o||!i.url,className:`edge-press edge-btn-secondary`,style:{...gd,minHeight:40},children:o===`test`?`检测中…`:`测试连接`}),(0,w.jsx)(`button`,{onClick:m,disabled:!!o||!i.url,className:`edge-press edge-btn-primary`,style:{..._d,minHeight:40},children:o===`save`?`保存中…`:`保存来源`})]})]})})}function jp({configs:e,onRefresh:t,onConfigsChanged:n,refreshing:r}){let[i,a]=(0,b.useState)(null),o=Sp(),s={ok:{tone:`green`,label:`正常`},error:{tone:`red`,label:`异常`},syncing:{tone:`amber`,label:`同步中`},unconfigured:{tone:`gray`,label:`未配置`}};return(0,w.jsxs)(`div`,{style:{padding:10,borderRadius:8,background:S.surface,border:`1px solid ${S.borderSoft}`},children:[(0,w.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,gap:6,marginBottom:8},children:[(0,w.jsx)(D,{name:`layers`,size:13,stroke:1.8,style:{color:S.violet}}),(0,w.jsx)(`span`,{style:{fontSize:12,fontWeight:700,color:S.ink},children:`Catalog 数据源`}),(0,w.jsx)(`div`,{style:{flex:1}}),(0,w.jsx)(`button`,{onClick:()=>a({}),title:`添加来源`,"aria-label":`添加应用市场来源`,className:`edge-press edge-btn-secondary`,style:{...gd,minWidth:40,height:32,padding:`0 8px`,fontSize:11},children:(0,w.jsx)(D,{name:`plus`,size:12})}),(0,w.jsxs)(`button`,{onClick:t,disabled:r,className:`edge-press edge-btn-secondary`,style:{...gd,height:32,padding:`0 8px`,fontSize:11},children:[(0,w.jsx)(D,{name:`refresh`,size:11,stroke:2}),r?`刷新中`:`刷新`]})]}),(0,w.jsxs)(`div`,{style:{display:`flex`,flexDirection:`column`,gap:6},children:[(e||[]).map(e=>{let t=s[e.status?.state]||s.unconfigured;return(0,w.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,gap:7,fontSize:11.5},children:[(0,w.jsx)(q,{tone:t.tone,size:7,pulse:e.status?.state===`error`}),(0,w.jsx)(`span`,{title:e.url,style:{color:S.ink2,fontWeight:600,flex:1,overflow:`hidden`,textOverflow:`ellipsis`,whiteSpace:`nowrap`},children:e.name||e.id}),(0,w.jsxs)(`span`,{style:{fontSize:10,color:S.ink4},children:[e.status?.appCount??0,` 个应用`]}),(0,w.jsx)(`span`,{style:{fontSize:10,color:t.tone===`red`?`#dc2626`:S.ink4},children:t.label}),!e.readOnly&&(0,w.jsx)(`button`,{title:`刷新`,"aria-label":`刷新来源 ${e.name||e.id}`,disabled:!e.enabled,onClick:async()=>{try{await Bf(e.id),n(),o.ok(`来源已刷新`)}catch(e){o.err(e.message)}},className:`edge-press`,style:{width:40,height:40,border:0,background:`transparent`,color:S.ink3,cursor:e.enabled?`pointer`:`default`},children:(0,w.jsx)(D,{name:`refresh`,size:12})}),!e.readOnly&&(0,w.jsx)(`button`,{title:`编辑`,"aria-label":`编辑来源 ${e.name||e.id}`,onClick:()=>a(e),className:`edge-press`,style:{width:40,height:40,border:0,background:`transparent`,color:S.ink3,cursor:`pointer`},children:(0,w.jsx)(D,{name:`edit`,size:12})}),!e.readOnly&&(0,w.jsx)(`button`,{title:e.enabled?`停用`:`启用`,"aria-label":`${e.enabled?`停用`:`启用`}来源 ${e.name||e.id}`,onClick:async()=>{try{await Rf(e.id,{enabled:!e.enabled}),n()}catch(e){o.err(e.message)}},className:`edge-press`,style:{width:40,height:40,border:0,background:`transparent`,color:e.enabled?`#16a34a`:S.ink4,cursor:`pointer`},children:(0,w.jsx)(D,{name:e.enabled?`stop`:`play`,size:12})}),!e.readOnly&&(0,w.jsx)(`button`,{title:`删除`,"aria-label":`删除来源 ${e.name||e.id}`,onClick:async()=>{if(window.confirm(`删除来源「${e.name||e.id}」?已安装应用不会被删除。`))try{await zf(e.id),n()}catch(e){o.err(e.message)}},className:`edge-press`,style:{width:40,height:40,border:0,background:`transparent`,color:`#dc2626`,cursor:`pointer`},children:(0,w.jsx)(D,{name:`trash`,size:12})})]},e.id)}),(!e||e.length===0)&&(0,w.jsx)(`div`,{style:{color:S.ink4,fontSize:11,lineHeight:1.5},children:`尚未添加市场来源。可直接添加 1Panel 官方或兼容仓库。`})]}),i&&(0,w.jsx)(Ap,{source:i.id?i:null,onClose:()=>a(null),onSaved:()=>{a(null),n(),o.ok(`应用市场来源已保存`)}})]})}function Mp({onOpenApp:e,authed:t,onRequireAuth:n}){let[r,i]=(0,b.useState)(`all`),[a,o]=(0,b.useState)(`all`),[s,c]=(0,b.useState)(`all`),[l,u]=(0,b.useState)(``),[d,f]=(0,b.useState)(null),[p,m]=(0,b.useState)(!1),h=Sp(),{data:g}=Bd(1e4),{data:_,error:v,refresh:y}=Af(),{data:x,error:C,refresh:T}=Vf(),{data:E,refresh:O}=Nf(),{data:k,refresh:A}=Pf(),j=Array.isArray(_)?_:null,ee=Array.isArray(x)?x:null,M=Array.isArray(E)?E:[],N=(0,b.useMemo)(()=>{let e={};return(g||[]).forEach(t=>{!t.source||(t.runtime||`kubernetes`)!==`compose`||(t.source.kind===`store`&&(e[`store:${t.source.storeId}`]={version:t.source.version||t.version,devboxId:t.id}),t.source.kind===`catalog`&&(e[`catalog:${t.source.catalogId}:${t.source.storeId}`]={version:t.source.version||t.version,devboxId:t.id}))}),e},[g]),P=(0,b.useMemo)(()=>{let e=[];return(j||[]).forEach(t=>{let n=N[`store:${t.id}`],r=n?.version||null,i=r!=null&&t.version!=null&&Qf(r,t.version)<0,{bg:a,icon:o}=Cp(t.id,t.name,t.category);e.push({id:t.id,name:t.name,cat:wp[t.category]||t.category,ver:t.version,desc:t.description||``,iconUrl:t.icon,icon:o,bg:a,provider:t.provider,runtime:t.runtime||`kubernetes`,installable:t.installable===!0,notInstallableReason:t.notInstallableReason||``,origin:`platform`,sourceId:``,sourceName:`平台商店`,installed:r!=null,installedVersion:r,upgradable:i,devboxId:n?.devboxId,pinned:t.pinned,date:``})}),(ee||[]).forEach(t=>{let n=N[`catalog:${t.catalogId}:${t.id}`],r=n?.version||null,i=r!=null&&t.version!=null&&Qf(r,t.version)<0,{bg:a,icon:o}=Cp(t.id,t.name,t.category);e.push({id:t.id,name:t.name,cat:wp[t.category]||t.category,ver:t.version,desc:t.description||``,iconUrl:t.icon,icon:o,bg:a,provider:t.provider,runtime:t.runtime||`compose`,installable:t.installable===!0,notInstallableReason:t.notInstallableReason||``,origin:`catalog`,sourceId:t.catalogId,sourceName:t.catalogName,installed:r!=null,installedVersion:r,upgradable:i,devboxId:n?.devboxId,pinned:t.pinned,date:``})}),e},[j,ee,N]),F=P.length>0?(()=>{let e={};P.forEach(t=>{t.cat&&(e[t.cat]=(e[t.cat]||0)+1)});let t=[{id:`all`,name:`全部`,icon:`apps`,count:P.length}];return Object.entries(e).forEach(([e,n])=>t.push({id:e,name:e,icon:`apps`,count:n})),t})():[{id:`all`,name:`全部`,icon:`apps`,count:0}],I=P.length,te=P.filter(e=>e.installed).length,ne=P.filter(e=>e.upgradable).length,L=P.filter(e=>!(a===`installed`&&!e.installed||a===`upgradable`&&!e.upgradable||s===`platform`&&e.origin!==`platform`||s!==`all`&&s!==`platform`&&e.sourceId!==s||r!==`all`&&e.cat!==r||l&&!e.name.toLowerCase().includes(l.toLowerCase())&&!(e.desc||``).includes(l))),re=!j&&!ee&&M.length===0&&!v&&!C,R=_===null&&x===null;async function z(){if(!t){n?.();return}m(!0);try{await Hf(),O(),A(),T(),y(),h.ok(`已刷新应用清单`)}catch(e){h.err(`刷新失败:${e.message}`)}finally{m(!1)}}if(d)return(0,w.jsx)(Op,{app:d,onBack:()=>f(null),onOpenApp:e});let B=[{id:`all`,label:`全部来源`}];return j&&j.length>0&&B.push({id:`platform`,label:`平台商店`}),M.forEach(e=>B.push({id:e.sourceId,label:e.sourceName||e.sourceId})),(0,w.jsxs)(`div`,{style:{flex:1,display:`flex`,background:S.surfaceAlt,overflow:`hidden`},children:[(0,w.jsxs)(`div`,{style:{width:208,flexShrink:0,padding:`20px 12px`,background:S.surface,borderRight:`1px solid ${S.border}`,overflow:`auto`},children:[(0,w.jsx)(`div`,{style:{fontSize:10.5,fontWeight:600,color:S.ink3,letterSpacing:`0.06em`,textTransform:`uppercase`,padding:`0 8px 6px`},children:`发现`}),(0,w.jsx)(`div`,{style:{fontSize:10.5,color:S.ink4,padding:`0 8px 8px`},children:`应用分类`}),(0,w.jsx)(`div`,{style:{display:`flex`,flexDirection:`column`,gap:1},children:F.map(e=>{let t=r===e.id;return(0,w.jsxs)(`div`,{onClick:()=>i(e.id),role:`button`,tabIndex:0,onKeyDown:t=>{t.key===`Enter`&&i(e.id)},style:{display:`flex`,alignItems:`center`,gap:8,padding:`8px 10px`,borderRadius:7,cursor:`pointer`,background:t?S.blueSoft:`transparent`,color:t?S.blueDeep:S.ink2,fontSize:12.5,fontWeight:t?600:500},children:[(0,w.jsx)(D,{name:Tp[e.id]||e.icon||`apps`,size:14,stroke:1.8}),(0,w.jsx)(`span`,{style:{flex:1},children:e.name}),(0,w.jsx)(`span`,{className:`mono tnum`,style:{fontSize:10.5,color:t?S.blueDeep:S.ink4,background:t?`#dbeafe`:S.surfaceAlt,padding:`0 6px`,borderRadius:999,lineHeight:`17px`},children:e.count})]},e.id)})}),(0,w.jsx)(`div`,{style:{height:1,background:S.borderSoft,margin:`16px 8px`}}),(0,w.jsx)(jp,{configs:Array.isArray(k)&&k.length>0?k:M.map(e=>({id:e.sourceId,name:e.sourceName,kind:e.kind,url:``,enabled:!0,managedBy:`config`,readOnly:!0,status:e.status})),onRefresh:z,onConfigsChanged:()=>{A(),O(),T()},refreshing:p}),M.some(e=>e.status?.state===`error`)&&(0,w.jsx)(`div`,{style:{marginTop:10,padding:`8px 10px`,borderRadius:7,background:`#fffbeb`,border:`1px solid #fde68a`,fontSize:11,color:`#92400e`,lineHeight:1.5},children:`部分 catalog 数据源同步异常,已使用上次缓存的应用清单。`})]}),(0,w.jsxs)(`div`,{style:{flex:1,overflow:`auto`,padding:`20px 24px`},children:[(0,w.jsx)(Zf,{tabs:[{id:`all`,label:`全部`,count:I},{id:`installed`,label:`已安装`,count:te},{id:`upgradable`,label:`可升级`,count:ne}],active:a,onChange:o,style:{gap:4,marginBottom:16,borderBottom:`1px solid ${S.borderSoft}`},itemStyle:{padding:`10px 16px 12px`,fontSize:13,marginBottom:-1},renderLabel:(e,t)=>(0,w.jsxs)(w.Fragment,{children:[e.label,(0,w.jsx)(`span`,{style:{fontSize:11,color:S.ink4,fontWeight:500,padding:`1px 6px`,borderRadius:3,background:t?S.blueSoft:S.surfaceAlt},className:`mono tnum`,children:e.count})]})}),(0,w.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,gap:10,marginBottom:12,flexWrap:`wrap`},children:[(0,w.jsx)(`div`,{style:{fontSize:14,fontWeight:700,color:S.ink},children:F.find(e=>e.id===r)?.name}),(0,w.jsxs)(`div`,{style:{fontSize:11.5,padding:`2px 8px`,borderRadius:999,background:S.surface,border:`1px solid ${S.border}`,color:S.ink3},children:[`共 `,L.length,` 个应用`]}),(0,w.jsx)(`div`,{style:{flex:1}}),B.length>1&&(0,w.jsx)(`div`,{style:{display:`flex`,gap:4},children:B.map(e=>(0,w.jsx)(`button`,{onClick:()=>c(e.id),title:e.label,style:s===e.id?Pp:Np,children:e.label},e.id))}),(0,w.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,gap:8,height:30,padding:`0 10px`,borderRadius:7,background:S.surface,border:`1px solid ${S.border}`,width:200},children:[(0,w.jsx)(D,{name:`search`,size:13,stroke:1.8,style:{color:S.ink4}}),(0,w.jsx)(`input`,{value:l,onChange:e=>u(e.target.value),placeholder:`按名称搜索`,"aria-label":`搜索`,style:{flex:1,border:`none`,outline:`none`,fontSize:12.5,background:`transparent`}})]}),(0,w.jsxs)(`button`,{onClick:z,disabled:p,className:`edge-press edge-btn-secondary`,style:{...gd,height:30},children:[(0,w.jsx)(D,{name:`refresh`,size:13,stroke:1.8}),p?`同步中`:`同步`]})]}),a===`all`&&s!==`platform`&&P.filter(e=>e.pinned).length>0&&(0,w.jsx)(`div`,{style:{display:`grid`,gridTemplateColumns:`1fr 1fr`,gap:12,marginBottom:18},children:P.filter(e=>e.pinned).slice(0,4).map((e,t)=>(0,w.jsxs)(`div`,{style:{padding:`20px 22px`,borderRadius:12,background:e.bg,color:`white`,position:`relative`,overflow:`hidden`,minHeight:140,display:`flex`,flexDirection:`column`,justifyContent:`space-between`,boxShadow:`0 4px 14px -4px rgba(15,23,42,0.18)`},children:[(0,w.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,gap:10},children:[(0,w.jsx)(`div`,{style:{width:36,height:36,borderRadius:9,background:`rgba(255,255,255,0.18)`,display:`flex`,alignItems:`center`,justifyContent:`center`,backdropFilter:`blur(8px)`},children:e.iconUrl?(0,w.jsx)(`img`,{src:e.iconUrl,alt:``,style:{width:20,height:20}}):(0,w.jsx)(D,{name:e.icon,size:20,stroke:1.7})}),(0,w.jsxs)(`div`,{children:[(0,w.jsx)(`div`,{style:{...S.type.heading},children:e.name}),(0,w.jsx)(`div`,{style:{fontSize:11.5,opacity:.85,marginTop:2},children:e.cat||e.origin})]})]}),(0,w.jsx)(`div`,{style:{fontSize:12.5,opacity:.95,lineHeight:1.55,marginBottom:10},children:e.desc}),(0,w.jsx)(`div`,{style:{position:`absolute`,top:-20,right:-20,width:140,height:140,background:`radial-gradient(circle, rgba(255,255,255,0.18), transparent 70%)`,pointerEvents:`none`}})]},t))}),(0,w.jsx)(`div`,{style:{display:`grid`,gridTemplateColumns:`repeat(auto-fill, minmax(290px, 1fr))`,gap:12},children:L.map(t=>(0,w.jsx)(kp,{app:t,onOpen:()=>f(t),onOpenApp:e},(t.origin===`catalog`?`c:`:`p:`)+t.sourceId+`:`+t.id))}),L.length===0&&(0,w.jsx)(`div`,{style:{textAlign:`center`,padding:`60px 20px`,color:S.ink3,fontSize:13},children:R?(0,w.jsxs)(w.Fragment,{children:[(0,w.jsx)(D,{name:`refresh`,size:28,stroke:1.5,style:{color:S.ink4,marginBottom:8}}),(0,w.jsx)(`div`,{children:`正在加载应用商店…`})]}):re?(0,w.jsxs)(w.Fragment,{children:[(0,w.jsx)(D,{name:`store`,size:28,stroke:1.5,style:{color:S.ink4,marginBottom:8}}),(0,w.jsx)(`div`,{children:`未配置应用市场与 Catalog`}),(0,w.jsx)(`div`,{style:{fontSize:11.5,color:S.ink4,marginTop:6},children:`本机未配置平台应用商店或第三方 Catalog 数据源`})]}):v&&!ee?(0,w.jsxs)(w.Fragment,{children:[(0,w.jsx)(D,{name:`cloudOff`,size:28,stroke:1.5,style:{color:S.ink4,marginBottom:8}}),(0,w.jsx)(`div`,{children:`无法访问平台应用商店`}),(0,w.jsx)(`div`,{style:{fontSize:11.5,color:S.ink4,marginTop:6},children:v.message})]}):(0,w.jsxs)(w.Fragment,{children:[(0,w.jsx)(D,{name:a===`upgradable`?`check`:a===`installed`?`apps`:`search`,size:28,stroke:1.5,style:{color:S.ink4,marginBottom:8}}),(0,w.jsx)(`div`,{children:a===`upgradable`?`所有已安装应用都是最新版本`:a===`installed`?`本节点尚未安装任何应用`:`没有匹配的应用`})]})}),(0,w.jsxs)(`div`,{style:{textAlign:`center`,margin:`24px 0 8px`,fontSize:11.5,color:S.ink4,display:`flex`,alignItems:`center`,gap:12,justifyContent:`center`},children:[(0,w.jsx)(`span`,{style:{height:1,width:60,background:S.border}}),`已加载全部`,(0,w.jsx)(`span`,{style:{height:1,width:60,background:S.border}})]})]})]})}var Np={padding:`4px 10px`,fontSize:11.5,borderRadius:999,border:`1px solid ${S.border}`,background:S.surface,color:S.ink2,cursor:`pointer`},Pp={...Np,background:S.blue,color:`#fff`,borderColor:S.blue};function Fp({app:e,onClose:t,onDone:n,trackTask:r=!1}){let i=(e?.runtime||`kubernetes`)===`compose`,[a,o]=(0,b.useState)(!1),[s,c]=(0,b.useState)(null),[l,u]=(0,b.useState)(i),[d,f]=(0,b.useState)(!1),[p,m]=(0,b.useState)(``),[h,g]=(0,b.useState)(null),[_,v]=(0,b.useState)(null),{task:y}=hf(_),x=Sp(),C=(0,b.useRef)(!0),T=(0,b.useRef)(null);(0,b.useEffect)(()=>()=>{C.current=!1},[]),(0,b.useEffect)(()=>{!r||!_||!y||y.status===`succeeded`&&T.current!==_&&(T.current=_,x.ok(`已卸载「${e.name}」`),n?.(_,a))},[r,_,y,e.name,n,a,x]),(0,b.useEffect)(()=>{if(!i)return;let t=!1;return kf(e.id,a).then(e=>{!t&&C.current&&(c(e),u(!1))}).catch(e=>{t||!C.current||(g(e?.message||`无法获取删除预览`),c(null),u(!1))}),()=>{t=!0}},[e.id,a,i]);let E=r&&y&&[`failed`,`canceled`,`superseded`].includes(y.status)?y.message||`卸载任务 ${y.status}`:null,O=d&&!E,k=p.trim()===e.name,A=!O&&(i?a?k:!0:k);async function j(){if(A){T.current=null,v(null),f(!0),g(null);try{let t=await Sf(e.id,i?a:!1),o=t?.taskId||t?.id||null;x.ok(`已提交卸载「${e.name}」`),r&&o?C.current&&v(o):(C.current&&f(!1),n?.(o,a))}catch(e){C.current&&(f(!1),g(e?.message||`卸载失败`))}}}let ee=h||E,M=Array.isArray(s?.willDelete)?s.willDelete:[],N=Array.isArray(s?.willKeep)?s.willKeep:[];return(0,w.jsx)(`div`,{className:`edge-backdrop-in`,onClick:O?void 0:t,style:{position:`fixed`,inset:0,zIndex:250,background:`rgba(15,23,41,0.5)`,display:`flex`,alignItems:`center`,justifyContent:`center`,backdropFilter:`blur(4px)`,WebkitBackdropFilter:`blur(4px)`},children:(0,w.jsxs)(`div`,{onClick:e=>e.stopPropagation(),className:`edge-fade-in`,style:{width:480,maxWidth:`92vw`,maxHeight:`88vh`,overflow:`auto`,background:`white`,borderRadius:12,boxShadow:`0 28px 64px -12px rgba(15,23,42,0.45)`},children:[(0,w.jsxs)(`div`,{style:{padding:`14px 20px`,display:`flex`,alignItems:`center`,gap:10,background:a?`#fef2f2`:`#fff7ed`,borderBottom:`1px solid ${a?`#fecaca`:`#fed7aa`}`},children:[(0,w.jsx)(`div`,{style:{width:30,height:30,borderRadius:8,background:S.red,color:`white`,display:`flex`,alignItems:`center`,justifyContent:`center`,flexShrink:0},children:(0,w.jsx)(D,{name:`trash`,size:15,stroke:2})}),(0,w.jsxs)(`div`,{style:{flex:1,minWidth:0},children:[(0,w.jsx)(`div`,{style:{fontSize:14,fontWeight:700,color:S.ink},children:a?`卸载并删除受管数据`:`卸载应用`}),(0,w.jsx)(`div`,{style:{fontSize:11.5,color:a?`#b91c1c`:`#9a3412`,marginTop:2},children:a?`受管数据将被永久删除 · 此操作不可恢复`:`默认保留受管数据`})]}),!O&&(0,w.jsx)(`button`,{onClick:t,"aria-label":`关闭`,style:{width:28,height:28,borderRadius:7,cursor:`pointer`,border:`none`,background:`transparent`,display:`flex`,alignItems:`center`,justifyContent:`center`,color:S.ink3},children:(0,w.jsx)(D,{name:`x`,size:15,stroke:2})})]}),(0,w.jsxs)(`div`,{style:{padding:`16px 20px 20px`},children:[(0,w.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,gap:12,marginBottom:14},children:[(0,w.jsx)(`div`,{style:{width:44,height:44,borderRadius:11,background:e.bg||S.slate,color:`white`,display:`flex`,alignItems:`center`,justifyContent:`center`,flexShrink:0,boxShadow:`inset 0 1px 0 rgba(255,255,255,0.3)`},children:(0,w.jsx)(D,{name:e.icon||`apps`,size:22,stroke:1.6})}),(0,w.jsxs)(`div`,{style:{minWidth:0},children:[(0,w.jsx)(`div`,{style:{...S.type.heading,color:S.ink},children:e.name}),(0,w.jsxs)(`div`,{style:{fontSize:11.5,color:S.ink3,marginTop:2},className:`mono`,children:[e.version||`—`,` · `,(e.runtime||`kubernetes`)===`compose`?`Docker Compose`:`Kubernetes`]})]})]}),i&&(0,w.jsxs)(w.Fragment,{children:[(0,w.jsxs)(`div`,{style:{padding:12,borderRadius:8,marginBottom:12,background:S.surfaceAlt,border:`1px solid ${S.borderSoft}`},children:[(0,w.jsx)(`div`,{style:{fontSize:12,fontWeight:700,color:S.ink,marginBottom:8},children:a?`将被删除`:`将被删除(仅容器/网络)`}),l?(0,w.jsx)(`div`,{style:{fontSize:11.5,color:S.ink3},children:`正在加载删除预览…`}):M.length>0?(0,w.jsx)(`ul`,{style:{margin:0,paddingLeft:18,fontSize:11.5,color:S.ink2,lineHeight:1.7},children:M.map((e,t)=>(0,w.jsx)(`li`,{className:`mono`,style:{wordBreak:`break-all`},children:e},t))}):(0,w.jsx)(`div`,{style:{fontSize:11.5,color:S.ink3},children:`容器与网络资源`}),(0,w.jsx)(`div`,{style:{fontSize:12,fontWeight:700,color:S.ink,margin:`10px 0 6px`},children:`将被保留(卸载不影响)`}),N.length>0?(0,w.jsx)(`ul`,{style:{margin:0,paddingLeft:18,fontSize:11.5,color:S.ink3,lineHeight:1.7},children:N.map((e,t)=>(0,w.jsx)(`li`,{className:`mono`,style:{wordBreak:`break-all`},children:e},t))}):(0,w.jsx)(`div`,{style:{fontSize:11.5,color:S.ink3},children:`无`}),s?.note&&(0,w.jsx)(`div`,{style:{fontSize:11,color:S.ink4,marginTop:8,lineHeight:1.5},children:s.note})]}),(0,w.jsxs)(`label`,{style:{display:`flex`,alignItems:`flex-start`,gap:10,marginBottom:12,cursor:`pointer`,padding:10,borderRadius:8,background:a?`#fef2f2`:S.surfaceAlt,border:`1px solid ${a?`#fecaca`:S.borderSoft}`},children:[(0,w.jsx)(`input`,{type:`checkbox`,checked:a,disabled:O,onChange:e=>{u(!0),g(null),o(e.target.checked)},style:{marginTop:2,width:15,height:15}}),(0,w.jsxs)(`div`,{children:[(0,w.jsx)(`div`,{style:{fontSize:12.5,fontWeight:600,color:a?`#b91c1c`:S.ink},children:`同时删除受管数据(purge)`}),(0,w.jsxs)(`div`,{style:{fontSize:11,color:S.ink3,marginTop:3,lineHeight:1.5},children:[`删除受管命名卷与受管数据目录。`,(0,w.jsx)(`strong`,{children:`外部卷(external)、宿主挂载(bind)、socket 永远不会被删除。`})]})]})]})]}),!i&&(0,w.jsxs)(`div`,{style:{padding:12,borderRadius:8,marginBottom:12,background:S.surfaceAlt,border:`1px solid ${S.borderSoft}`,fontSize:12,color:S.ink2,lineHeight:1.65},children:[(0,w.jsx)(`strong`,{style:{color:S.ink},children:`将会发生什么`}),(0,w.jsxs)(`ul`,{style:{margin:`6px 0 0`,paddingLeft:20,fontSize:11.5,color:S.ink3},children:[(0,w.jsx)(`li`,{children:`立即终止该 Pod,释放占用的 GPU / 内存 / 端口`}),(0,w.jsx)(`li`,{children:`删除容器与配置`})]})]}),(i?a:!0)&&(0,w.jsxs)(`div`,{style:{marginBottom:12},children:[(0,w.jsxs)(`div`,{style:{fontSize:12,color:S.ink2,marginBottom:6},children:[`请输入应用名称 `,(0,w.jsx)(`span`,{className:`mono`,style:{background:S.surfaceAlt,padding:`1px 6px`,borderRadius:3,color:S.ink,fontWeight:600,border:`1px solid ${S.border}`},children:e.name}),` 确认:`]}),(0,w.jsx)(`input`,{value:p,disabled:O,autoFocus:!0,onChange:e=>m(e.target.value),placeholder:e.name,"aria-label":`输入应用名称以确认`,style:{width:`100%`,height:38,padding:`0 12px`,border:`1px solid ${k?S.red:S.border}`,borderRadius:7,fontSize:13,color:S.ink,background:`white`,outline:`none`,boxShadow:k?`0 0 0 3px ${S.red}22`:`none`,boxSizing:`border-box`},className:`mono`})]}),i&&a&&(0,w.jsxs)(`div`,{style:{padding:`8px 10px`,marginBottom:12,borderRadius:7,background:`#fffbeb`,border:`1px solid #fde68a`,fontSize:11.5,color:`#92400e`,lineHeight:1.5,display:`flex`,gap:8,alignItems:`flex-start`},children:[(0,w.jsx)(D,{name:`alertTri`,size:13,stroke:1.8,style:{color:`#b45309`,marginTop:1,flexShrink:0}}),(0,w.jsx)(`div`,{children:`删除受管数据不可恢复。若该应用持有数据库等内容,删除后无法找回。`})]}),ee&&(0,w.jsx)(`div`,{style:{padding:`8px 10px`,marginBottom:12,borderRadius:7,background:`#fef2f2`,border:`1px solid #fecaca`,fontSize:11.5,color:`#b91c1c`},children:ee}),r&&_&&!ee&&(0,w.jsxs)(`div`,{style:{padding:`8px 10px`,marginBottom:12,borderRadius:7,background:`#eff6ff`,border:`1px solid #bfdbfe`,fontSize:11.5,color:`#1e40af`},children:[`卸载任务 `,y?.status||`queued`,` · `,y?.phase||`queued`,y?.message?` · ${y.message}`:``]}),(0,w.jsxs)(`div`,{style:{display:`flex`,gap:8},children:[(0,w.jsx)(`button`,{onClick:t,disabled:O,style:{flex:1,height:38,borderRadius:8,background:`white`,border:`1px solid ${S.border}`,fontSize:13,fontWeight:500,color:S.ink2,cursor:O?`not-allowed`:`pointer`},children:`取消`}),(0,w.jsxs)(`button`,{onClick:j,disabled:!A,style:{flex:1.4,height:38,borderRadius:8,background:A?S.red:`#fca5a5`,color:`white`,border:`none`,fontSize:13,fontWeight:600,cursor:A?`pointer`:`not-allowed`,display:`flex`,alignItems:`center`,justifyContent:`center`,gap:6,opacity:A?1:.7},children:[(0,w.jsx)(D,{name:`trash`,size:13,stroke:2}),O?`卸载中…`:a?`确认删除数据并卸载`:`我已了解,卸载`]})]})]})]})})}var Ip=[{id:`dashboard`,kind:`system`,name:`仪表盘`,icon:`dashboard`,color:S.blue,bg:`linear-gradient(160deg,#3b82f6,#1d4ed8)`},{id:`monitoring`,kind:`system`,name:`监控`,icon:`sparkle`,color:S.indigo,bg:`linear-gradient(160deg,#6366f1,#4f46e5)`},{id:`ai-activity`,kind:`system`,name:`AI 活动`,icon:`brain`,color:S.violet,bg:`linear-gradient(160deg,#a855f7,#6d28d9)`},{id:`store`,kind:`system`,name:`应用商店`,icon:`store`,color:S.green,bg:`linear-gradient(160deg,#34d399,#059669)`},{id:`compose-manager`,kind:`system`,name:`Compose 应用`,icon:`apps`,color:`#0891b2`,bg:`linear-gradient(160deg,#22d3ee,#0891b2)`},{id:`files`,kind:`system`,name:`文件`,icon:`folder`,color:`#0891b2`,bg:`linear-gradient(160deg,#22d3ee,#0891b2)`},{id:`processes`,kind:`system`,name:`进程`,icon:`cpu`,color:`#475569`,bg:`linear-gradient(160deg,#64748b,#1e293b)`},{id:`supervisor`,kind:`system`,name:`进程守护`,icon:`shield`,color:`#0d9488`,bg:`linear-gradient(160deg,#14b8a6,#0f766e)`},{id:`virtual-machines`,kind:`system`,name:`虚拟机`,icon:`server`,color:`#155e75`,bg:`linear-gradient(160deg,#22d3ee,#155e75)`},{id:`hardware`,kind:`system`,name:`硬件中心`,icon:`cpu`,color:`#7c3aed`,bg:`linear-gradient(160deg,#a855f7,#6d28d9)`},{id:`links`,kind:`system`,name:`服务导航`,icon:`network`,color:`#0369a1`,bg:`linear-gradient(160deg,#38bdf8,#0369a1)`},{id:`disks`,kind:`system`,name:`磁盘`,icon:`hardDrive`,color:`#1e40af`,bg:`linear-gradient(160deg,#3b82f6,#1e3a8a)`},{id:`network-connections`,kind:`system`,name:`网络连接`,icon:`network`,color:`#0e7490`,bg:`linear-gradient(160deg,#06b6d4,#0e7490)`},{id:`alerts`,kind:`system`,name:`告警中心`,icon:`bell`,color:S.amber,bg:`linear-gradient(160deg,#fbbf24,#d97706)`},{id:`audit`,kind:`system`,name:`操作日志`,icon:`shield`,color:`#7c3aed`,bg:`linear-gradient(160deg,#a78bfa,#5b21b6)`},{id:`settings`,kind:`system`,name:`系统设置`,icon:`gear`,color:S.slate,bg:`linear-gradient(160deg,#64748b,#334155)`},{id:`browser`,kind:`system`,name:`浏览器`,icon:`globe`,color:S.blue,bg:`linear-gradient(160deg,#3b82f6,#1d4ed8)`}];function Lp({authed:e,onRequireAuth:t,onOpenStore:n,onOpenApp:r}){let{data:i,refresh:a}=Bd(5e3),{data:o}=mf(),{data:s}=Af(),{data:c}=Vf(),[l,u]=(0,b.useState)(`all`),[d,f]=(0,b.useState)(!1),[p,m]=(0,b.useState)(null),[h,g]=(0,b.useState)(null),[_,v]=(0,b.useState)(null),y=Sp(),{task:x}=hf(p?.id);(0,b.useEffect)(()=>{if(!(!x||!p)&&[`succeeded`,`failed`,`canceled`,`superseded`].includes(x.status)){x.status===`succeeded`?y.ok(`${p.label}完成`):y.err(`${p.label}失败:${x.message||x.status}`);let e=setTimeout(()=>m(null),1500);return a(),()=>clearTimeout(e)}},[x,p,y,a]);let C=o?.compose,T=C&&C.available===!1,E=(0,b.useMemo)(()=>Array.isArray(i)?i:[],[i]),D={all:E.length,compose:E.filter(e=>(e.runtime||`kubernetes`)===`compose`).length,kubernetes:E.filter(e=>(e.runtime||`kubernetes`)===`kubernetes`).length,system:Ip.length},O=(0,b.useMemo)(()=>l===`system`?[]:l===`all`?E:E.filter(e=>(e.runtime||`kubernetes`)===l),[E,l]);function k(n){return(...r)=>{if(!e){t?.();return}return n(...r)}}async function A(e,t,n){try{m({id:(await xf(e,t)).id,label:n,appId:e}),y.ok(`${n}已提交`)}catch(e){y.err(`${n}失败:${e.message}`)}}return(0,w.jsxs)(`div`,{style:{padding:24,height:`100%`,overflow:`auto`,background:S.bg},children:[(0,w.jsx)(Rp,{composeCap:C,filter:l,setFilter:u,counts:D,authed:e,onRequireAuth:t,onCreate:()=>f(!0)}),p&&x&&(0,w.jsx)(zp,{task:x,label:p.label}),T&&(0,w.jsxs)(`div`,{style:om,children:[`Docker Compose 运行时不可用:`,C.reason||``,`。已部署的 Compose 应用仍可观测;K8s 应用与系统工具不受影响。`]}),(0,w.jsxs)(`div`,{style:{display:`grid`,gap:10,marginTop:14},children:[l===`system`&&(0,w.jsx)(`div`,{style:{display:`grid`,gridTemplateColumns:`repeat(auto-fill, minmax(260px, 1fr))`,gap:10},children:Ip.map(e=>(0,w.jsx)(Vp,{app:e,onOpen:()=>r?r(e):null},e.id))}),l!==`system`&&O.length===0&&(0,w.jsx)(Hp,{composeDown:T,hasCap:!!o,onCreate:()=>e?f(!0):t?.()}),l!==`system`&&O.map(n=>n.ownership===`discovered`?(0,w.jsx)(Qp,{app:n,disabled:!!p,onTakeover:()=>e?v(n):t?.()},n.id):(0,w.jsx)(Bp,{app:n,storeApps:s,catalogApps:c,disabled:!!p,onAction:(e,t)=>k(A)(n.id,e,t),onUninstall:()=>g(n),onOpenApp:r},n.id))]}),d&&(0,w.jsx)(qp,{composeCap:C,onClose:()=>f(!1),onOpenStore:()=>{f(!1),n?.()},onDeployed:e=>{f(!1),m({id:e.id,label:`部署`,appId:e.appId}),a()}}),h&&(0,w.jsx)(Fp,{app:h,onClose:()=>g(null),onDone:e=>{g(null),e?m({id:e,label:`卸载`,appId:h.id}):(y.ok(`已卸载`),a())}}),_&&(0,w.jsx)(em,{app:_,onClose:()=>v(null),onDone:e=>{v(null),e&&(y.ok(`已接管,现在可以编辑与部署`),a())}})]})}function Rp({composeCap:e,filter:t,setFilter:n,counts:r,authed:i,onRequireAuth:a,onCreate:o}){let s=[{id:`all`,label:`全部`,count:r.all},{id:`compose`,label:`Docker Compose`,count:r.compose},{id:`kubernetes`,label:`Kubernetes`,count:r.kubernetes},{id:`system`,label:`系统工具`,count:r.system}];return(0,w.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,gap:12,flexWrap:`wrap`},children:[(0,w.jsx)(`div`,{style:{fontSize:20,fontWeight:700,color:S.ink},children:`应用管理`}),(0,w.jsx)(`div`,{style:{fontSize:12,color:S.ink3},children:e?.available?`Compose ${e.version||`可用`}`:e?`Compose 未就绪`:`检测运行时中…`}),(0,w.jsx)(`div`,{style:{flex:1}}),(0,w.jsx)(`div`,{style:{display:`flex`,gap:6,flexWrap:`wrap`},children:s.map(e=>(0,w.jsxs)(`button`,{onClick:()=>n(e.id),title:e.label,style:t===e.id?rm:nm,children:[e.label,(0,w.jsx)(`span`,{className:`mono tnum`,style:{marginLeft:5,opacity:.8},children:e.count})]},e.id))}),(0,w.jsxs)(`button`,{onClick:()=>i?o():a?.(),className:`edge-press`,style:im,children:[(0,w.jsx)(D,{name:`plus`,size:13,stroke:2}),`新建 Compose`]})]})}function zp({task:e,label:t}){let n=e.status===`failed`?`#dc2626`:e.status===`succeeded`?`#16a34a`:`#2563eb`;return(0,w.jsxs)(`div`,{style:{marginTop:12,padding:`10px 14px`,borderRadius:10,background:`#fff`,border:`1px solid ${n}33`},children:[(0,w.jsx)(`span`,{style:{color:n,fontWeight:600},children:t}),(0,w.jsxs)(`span`,{style:{color:S.ink3,marginLeft:8,fontSize:13},children:[e.status,` · `,e.phase||``,` `,e.message?`· ${e.message}`:``]})]})}function Bp({app:e,storeApps:t,catalogApps:n,disabled:r,onAction:i,onUninstall:a,onOpenApp:o}){let s=pp(e),c=(e.runtime||`kubernetes`)===`compose`,l=s===`running`,u=vp(e),d=bp(e,t,n),f=e.observed?.services||[],p=e.observed?.endpoints||[],m=e.lastTask;return(0,w.jsxs)(`div`,{style:tm,children:[(0,w.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,gap:10,flexWrap:`wrap`},children:[(0,w.jsx)(q,{tone:fp[s]||`gray`,size:9,pulse:s===`failed`||s===`degraded`}),(0,w.jsx)(`strong`,{style:{color:S.ink,fontSize:14},children:e.name}),(0,w.jsx)(`span`,{style:hm(c),title:mp(e.runtime),children:c?`Compose`:`K8s`}),(0,w.jsx)(`span`,{style:{fontSize:12,color:S.ink3,fontWeight:600},children:dp[s]||s}),(0,w.jsx)(J,{tone:u.tone,children:u.label}),e.version&&(0,w.jsx)(`span`,{style:{fontSize:11,color:S.ink4},className:`mono`,children:e.version}),(0,w.jsx)(`span`,{style:{flex:1}}),(0,w.jsx)(`span`,{style:{fontSize:11.5,color:S.ink3},children:f.length>0?`${f.length} 服务 · ${e.ready||0}/${e.replicas||f.length} 就绪`:c?`0 服务`:`${e.ready||0}/${e.replicas||0} Pod`})]}),(0,w.jsxs)(`div`,{style:{fontSize:12,color:S.ink3,marginTop:6,display:`flex`,alignItems:`center`,gap:8,flexWrap:`wrap`},children:[(0,w.jsx)(`span`,{className:`mono`,style:{color:S.ink4},children:e.image||`—`}),p.length>0&&p.map((e,t)=>(0,w.jsxs)(`a`,{href:e.url,target:`_blank`,rel:`noreferrer`,title:e.name||e.url,style:{display:`inline-flex`,alignItems:`center`,gap:3,color:S.blue,textDecoration:`none`,fontSize:11.5,padding:`1px 7px`,borderRadius:4,background:S.blueSoft,border:`1px solid #bfdbfe`},children:[(0,w.jsx)(D,{name:`external`,size:10,stroke:2}),e.name||Gp(e.url)]},t)),d.upgradable&&(0,w.jsxs)(`span`,{title:`已装 ${d.installedVersion||`—`} → 可用 ${d.latestVersion}`,style:{fontSize:10.5,padding:`1px 6px`,borderRadius:3,fontWeight:600,background:`#fffbeb`,color:`#b45309`,border:`1px solid #fde68a`},children:[`可升级 → `,d.latestVersion]})]}),m&&(0,w.jsxs)(`div`,{style:{fontSize:11,color:S.ink4,marginTop:5},children:[`最近:`,Wp(m),` · `,m.status||`—`,` · `,lp(m.createdAt||m.finishedAt)]}),(0,w.jsxs)(`div`,{style:{display:`flex`,gap:8,marginTop:10,flexWrap:`wrap`},children:[(0,w.jsx)(Up,{disabled:r||l,onClick:()=>i(`start`,`启动`),title:`启动`,children:`启动`}),(0,w.jsx)(Up,{disabled:r||!l,onClick:()=>i(`stop`,`停止`),title:`停止`,children:`停止`}),(0,w.jsx)(Up,{disabled:r,onClick:()=>i(`restart`,`重启`),title:`重启`,children:`重启`}),c&&(0,w.jsx)(Up,{disabled:r,onClick:()=>i(`redeploy`,`重部署`),title:`重新部署`,children:`重部署`}),(0,w.jsx)(`div`,{style:{flex:1}}),o&&(0,w.jsx)(Up,{onClick:()=>o(e),title:`打开详情`,children:`详情`}),(0,w.jsxs)(`button`,{onClick:a,disabled:r,className:`edge-press edge-btn-danger`,style:{...vd,height:28,padding:`0 10px`,fontSize:12},children:[(0,w.jsx)(D,{name:`trash`,size:11,stroke:2}),`卸载`]})]})]})}function Vp({app:e,onOpen:t}){return(0,w.jsxs)(`button`,{onClick:t,className:`edge-press`,style:{textAlign:`left`,cursor:`pointer`,padding:`12px 14px`,borderRadius:10,background:`#fff`,border:`1px solid ${S.border}`,display:`flex`,alignItems:`center`,gap:10},children:[(0,w.jsx)(`div`,{style:{width:36,height:36,borderRadius:9,background:e.bg,color:`white`,display:`flex`,alignItems:`center`,justifyContent:`center`,flexShrink:0},children:(0,w.jsx)(D,{name:e.icon,size:18,stroke:1.7})}),(0,w.jsxs)(`div`,{style:{minWidth:0,flex:1},children:[(0,w.jsx)(`div`,{style:{fontSize:13,fontWeight:600,color:S.ink},children:e.name}),(0,w.jsx)(`div`,{style:{fontSize:11,color:S.ink3},children:`系统工具 · 本地内置`})]}),(0,w.jsx)(D,{name:`chevRight`,size:14,stroke:2,style:{color:S.ink4}})]})}function Hp({composeDown:e,hasCap:t,onCreate:n}){return(0,w.jsxs)(`div`,{style:sm,children:[(0,w.jsx)(D,{name:`apps`,size:30,stroke:1.5,style:{color:S.ink4,marginBottom:8}}),(0,w.jsx)(`div`,{style:{fontSize:14,fontWeight:600,color:S.ink2},children:`暂无已部署应用`}),(0,w.jsx)(`div`,{style:{fontSize:12,color:S.ink3,marginTop:6,maxWidth:420},children:e?`Docker Compose 运行时不可用,无法新建 Compose 应用;K8s 应用将由云端下发后显示在此。`:`点击右上角「新建 Compose」粘贴或上传一个 compose.yaml,或从应用商店安装。`}),!e&&(0,w.jsxs)(`button`,{onClick:n,className:`edge-press`,style:{...im,marginTop:12},children:[(0,w.jsx)(D,{name:`plus`,size:13,stroke:2}),`新建 Compose`]}),!t&&(0,w.jsx)(`div`,{style:{fontSize:11,color:S.ink4,marginTop:8},children:`正在检测本机运行时能力…`})]})}function Up({children:e,onClick:t,disabled:n,danger:r,title:i}){return(0,w.jsx)(`button`,{onClick:t,disabled:n,title:i,className:`edge-press ${r?`edge-btn-danger`:`edge-btn-secondary`}`,style:r?{...vd,height:28,padding:`0 10px`,fontSize:12}:{...gd,height:28,padding:`0 10px`,fontSize:12},children:e})}function Wp(e){let t={apply:`部署/更新`,operate:`操作`,remove:`卸载`,restore:`回滚`}[e?.type]||e?.type||`操作`;return e?.action?`${t}·${e.action}`:t}function Gp(e){try{return new URL(e).host||e}catch{return e}}var Kp=`services: - web: - image: nginx:1.27 - ports: ["8080:80"] -`;function qp({composeCap:e,onClose:t,onOpenStore:n,onDeployed:r}){let[i,a]=(0,b.useState)(`paste`),[o,s]=(0,b.useState)(``),[c,l]=(0,b.useState)(Kp),[u,d]=(0,b.useState)(``),[f,p]=(0,b.useState)(null),[m,h]=(0,b.useState)(!1),[g,_]=(0,b.useState)(!1),[v,y]=(0,b.useState)(``),[x,C]=(0,b.useState)(``),[T,E]=(0,b.useState)(``),[O,k]=(0,b.useState)(`/data`),[A,j]=(0,b.useState)(``),[ee,M]=(0,b.useState)(``),[N,P]=(0,b.useState)(!0),[F,I]=(0,b.useState)(!1),[te,ne]=(0,b.useState)(null),L=(0,b.useRef)(null),re=Sp(),R=!e||e.available!==!1,z=()=>{p(null),I(!1)},B={dataPath:T,dataTarget:O,cpuLimit:A,memoryLimit:ee,autoStart:N};async function ie(e){let t=e.target.files?.[0];if(t){if(t.size>1*1024*1024){re.err(`文件过大(>1MB),请粘贴或拆分`);return}try{let e=await t.text();l(e),d(t.name),a(`upload`),p(null),I(!1),re.ok(`已读取 ${t.name}(${e.length} 字符)`)}catch(e){re.err(`读取失败:${e.message}`)}finally{L.current&&(L.current.value=``)}}}async function ae(){p(null),I(!1),ne(null),h(!0);try{let e=await yf({compose:c,name:o,parameters:ep(x),secrets:ep(v),settings:B});p(e),e.ok?re.ok(`预检通过`):re.warn(`预检发现阻断 / 错误`)}catch(e){ne(e.message||`预检失败`),re.err(`预检失败:${e.message}`)}finally{h(!1)}}let oe=f?ap(f.risks):{blocked:[],confirmation:[],warning:[]},se=op(oe,F),ce=se.reason===`blocked`,le=se.reason===`confirmation`,ue=!!$f(o),de=R&&ue&&!!f&&se.deployable&&!g;async function fe(){if(de){_(!0),ne(null);try{let e=ep(v),t=await bf({name:o.trim(),source:{kind:`inline`},compose:c,parameters:ep(x),secrets:e,confirmRisky:F,settings:B});re.ok(`已提交部署任务`),r(t)}catch(e){ne(e.message||`部署失败`),re.err(`部署失败:${e.message}`),_(!1)}}}return(0,w.jsx)(`div`,{style:cm,onClick:t,children:(0,w.jsxs)(`div`,{style:lm,onClick:e=>e.stopPropagation(),children:[(0,w.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,gap:8},children:[(0,w.jsx)(D,{name:`plus`,size:16,stroke:2,style:{color:S.blue}}),(0,w.jsx)(`strong`,{style:{fontSize:16,color:S.ink},children:`新建 Compose 应用`}),(0,w.jsx)(`span`,{style:{flex:1}}),(0,w.jsx)(`button`,{onClick:t,"aria-label":`关闭`,style:am,children:(0,w.jsx)(D,{name:`x`,size:15,stroke:2})})]}),(0,w.jsx)(`div`,{style:um,children:`来源`}),(0,w.jsxs)(`div`,{style:{display:`flex`,gap:8,flexWrap:`wrap`},children:[(0,w.jsx)(Jp,{active:i===`paste`,onClick:()=>{a(`paste`),p(null),I(!1)},icon:`edit`,label:`粘贴 YAML`}),(0,w.jsx)(Jp,{active:i===`upload`,onClick:()=>L.current?.click(),icon:`upload`,label:u||`上传 YAML 文件`}),(0,w.jsx)(`input`,{ref:L,type:`file`,accept:`.yaml,.yml,text/yaml,text/plain,application/yaml`,onChange:ie,style:{display:`none`}}),(0,w.jsxs)(`button`,{onClick:n,className:`edge-press edge-btn-secondary`,style:{...gd,height:32,padding:`0 12px`,fontSize:12.5},children:[(0,w.jsx)(D,{name:`store`,size:12,stroke:2}),`从应用商店安装`]})]}),(0,w.jsx)(`label`,{style:um,children:`应用名称(生成 ID:小写 / 数字 / 连字符)`}),(0,w.jsx)(`input`,{value:o,onChange:e=>{s(e.target.value),z()},placeholder:`my-app`,"aria-label":`应用名称`,style:dm}),(0,w.jsx)(`div`,{style:{fontSize:11,color:S.ink4,marginTop:3},children:o?`ID: ${$f(o)||`(需含字母或数字)`}`:`应用名称为必填项,用于生成稳定的应用 ID`}),(0,w.jsxs)(`label`,{style:um,children:[`Compose YAML `,i===`upload`&&u?`· ${u}`:``]}),(0,w.jsx)(`textarea`,{value:c,onChange:e=>{l(e.target.value),a(`paste`),p(null),I(!1)},"aria-label":`Compose YAML`,spellCheck:!1,style:fm,rows:9}),(0,w.jsxs)(`label`,{style:um,children:[`Secret(KEY=VALUE 每行;Compose 中请用 $`,`{`,`KEY`,`}`,` 引用;仅写入 .env,不回传 / 不入 revision)`]}),(0,w.jsx)(`textarea`,{value:v,onChange:e=>{y(e.target.value),z()},spellCheck:!1,style:fm,rows:3,placeholder:`DB_PASSWORD=change-me`}),(0,w.jsx)(`div`,{style:um,children:`配置(应用到第一个 service;复杂多服务配置请直接编辑 YAML)`}),(0,w.jsx)(`label`,{style:{...um,marginTop:6},children:`非敏感环境变量(KEY=VALUE,每行;写入 .env 并记录到 revision)`}),(0,w.jsx)(`textarea`,{value:x,onChange:e=>{C(e.target.value),z()},spellCheck:!1,style:fm,rows:2,placeholder:`HTTP_PORT=8080`}),(0,w.jsxs)(`div`,{style:{display:`grid`,gridTemplateColumns:`1fr 1fr`,gap:8},children:[(0,w.jsxs)(`div`,{children:[(0,w.jsx)(`label`,{style:um,children:`宿主数据路径`}),(0,w.jsx)(`input`,{value:T,onChange:e=>{E(e.target.value),z()},placeholder:`/srv/my-app`,style:dm})]}),(0,w.jsxs)(`div`,{children:[(0,w.jsx)(`label`,{style:um,children:`容器挂载点`}),(0,w.jsx)(`input`,{value:O,onChange:e=>{k(e.target.value),z()},placeholder:`/data`,style:dm})]}),(0,w.jsxs)(`div`,{children:[(0,w.jsx)(`label`,{style:um,children:`CPU 限制`}),(0,w.jsx)(`input`,{value:A,onChange:e=>{j(e.target.value),z()},placeholder:`1.5`,style:dm})]}),(0,w.jsxs)(`div`,{children:[(0,w.jsx)(`label`,{style:um,children:`内存限制`}),(0,w.jsx)(`input`,{value:ee,onChange:e=>{M(e.target.value),z()},placeholder:`512M`,style:dm})]})]}),(0,w.jsxs)(`label`,{style:{display:`flex`,alignItems:`center`,gap:8,marginTop:10,fontSize:12,color:S.ink2,cursor:`pointer`},children:[(0,w.jsx)(`input`,{type:`checkbox`,checked:N,onChange:e=>{P(e.target.checked),z()}}),(0,w.jsx)(`span`,{children:`Docker 启动后自动恢复应用(restart: unless-stopped)`})]}),T&&(0,w.jsx)(`div`,{style:{fontSize:11,color:S.ink4,marginTop:4},children:`绝对宿主路径会在预检中标为 confirmation,需明确确认数据与权限边界。`}),(0,w.jsxs)(`div`,{style:{display:`flex`,gap:8,marginTop:10,alignItems:`center`,flexWrap:`wrap`},children:[(0,w.jsxs)(`button`,{onClick:ae,disabled:m||!R||!c.trim(),className:`edge-press edge-btn-secondary`,style:{...am,opacity:m||!R?.6:1},children:[(0,w.jsx)(D,{name:`check`,size:12,stroke:2}),m?`预检中…`:`预检`]}),(0,w.jsxs)(`button`,{onClick:fe,disabled:!de,className:`edge-press edge-btn-primary`,style:{...im,opacity:de?1:.6},children:[(0,w.jsx)(D,{name:`download`,size:12,stroke:2}),g?`部署中…`:`部署`]}),ce&&(0,w.jsx)(`span`,{style:{color:`#dc2626`,fontSize:12},children:`存在阻断级风险,无法部署`}),!ue&&(0,w.jsx)(`span`,{style:{color:`#dc2626`,fontSize:12},children:`请填写有效的应用名称`}),!R&&(0,w.jsx)(`span`,{style:{color:`#dc2626`,fontSize:12},children:`Compose 运行时不可用`})]}),te&&(0,w.jsx)(`div`,{style:mm,children:te}),f&&(0,w.jsx)(Yp,{result:f,grouped:oe,needConfirm:le,confirmed:F,setConfirmed:I})]})})}function Jp({active:e,onClick:t,icon:n,label:r}){return(0,w.jsxs)(`button`,{onClick:t,className:`edge-press ${e?`edge-btn-primary`:`edge-btn-secondary`}`,style:e?{...im,height:32,padding:`0 12px`,fontSize:12.5}:{...gd,height:32,padding:`0 12px`,fontSize:12.5},children:[(0,w.jsx)(D,{name:n,size:12,stroke:2}),r]})}function Yp({result:e,grouped:t,needConfirm:n,confirmed:r,setConfirmed:i}){let a=(e.services||[]).flatMap(e=>e.ports||[]),o=(e.services||[]).flatMap(e=>e.volumes||[]);return(0,w.jsxs)(`div`,{style:{marginTop:12,fontSize:12.5,color:S.ink2},children:[(0,w.jsxs)(`div`,{style:{display:`flex`,gap:6,flexWrap:`wrap`,marginBottom:8},children:[(0,w.jsx)(Xp,{icon:`apps`,label:`服务`,value:(e.services||[]).length,tone:`blue`}),(0,w.jsx)(Xp,{icon:`download`,label:`镜像`,value:(e.services||[]).length,tone:`gray`}),(0,w.jsx)(Xp,{icon:`port`,label:`端口`,value:a.length,tone:`blue`}),(0,w.jsx)(Xp,{icon:`database`,label:`卷`,value:o.length,tone:`gray`}),(0,w.jsx)(Xp,{icon:`network`,label:`网络`,value:(e.networks||[]).length,tone:`gray`}),(0,w.jsx)(Xp,{icon:`lock`,label:`Secret`,value:(e.secrets||[]).length,tone:`gray`})]}),e.services?.length>0&&(0,w.jsx)(`div`,{style:{...pm,marginBottom:8},children:(e.services||[]).map((e,t)=>(0,w.jsxs)(`div`,{style:{padding:`6px 0`,borderTop:t?`1px solid ${S.borderSoft}`:`none`},children:[(0,w.jsxs)(`div`,{style:{fontWeight:600,color:S.ink},children:[e.name,(0,w.jsx)(`span`,{className:`mono`,style:{fontWeight:400,color:S.ink3,marginLeft:8},children:e.image||`—`})]}),(e.ports?.length||e.volumes?.length)>0&&(0,w.jsxs)(`div`,{style:{fontSize:11,color:S.ink4,marginTop:2},children:[e.ports?.length?`端口 ${e.ports.join(`, `)} `:``,e.volumes?.length?`卷 ${e.volumes.join(`, `)}`:``]})]},t))}),(e.networks?.length>0||e.secrets?.length>0)&&(0,w.jsxs)(`div`,{style:{...pm,marginBottom:8,fontSize:11.5,color:S.ink3},children:[e.networks?.length>0&&(0,w.jsxs)(`div`,{children:[`网络:`,(0,w.jsx)(`span`,{className:`mono`,children:e.networks.join(`, `)})]}),e.secrets?.length>0&&(0,w.jsxs)(`div`,{style:{marginTop:3},children:[`Secret keys:`,(0,w.jsx)(`span`,{className:`mono`,children:e.secrets.join(`, `)}),`(值不回显)`]})]}),(0,w.jsx)(Zp,{tone:`#dc2626`,label:`阻断(禁止部署)`,items:t.blocked}),(0,w.jsx)(Zp,{tone:`#d97706`,label:`需确认`,items:t.confirmation}),(0,w.jsx)(Zp,{tone:`#d97706`,label:`警告`,items:t.warning}),e.ok&&t.blocked.length===0&&t.confirmation.length===0&&t.warning.length===0&&(0,w.jsxs)(`div`,{style:{...pm,color:`#166534`,background:`#f0fdf4`,border:`1px solid #bbf7d0`},children:[(0,w.jsx)(D,{name:`check`,size:12,stroke:2,style:{verticalAlign:`-2px`}}),` 无风险项(safe)— 可部署`]}),e.errors?.length>0&&(0,w.jsxs)(`div`,{style:{color:`#dc2626`,marginTop:6},children:[`错误:`,e.errors.join(`;`)]}),e.warnings?.length>0&&(0,w.jsx)(`div`,{style:{marginTop:6,fontSize:11.5,color:`#92400e`},children:e.warnings.map((e,t)=>(0,w.jsxs)(`div`,{children:[`⚠ `,e]},t))}),n&&(0,w.jsxs)(`label`,{style:{display:`flex`,alignItems:`flex-start`,gap:8,marginTop:10,cursor:`pointer`,padding:10,borderRadius:8,background:`#fffbeb`,border:`1px solid #fde68a`},children:[(0,w.jsx)(`input`,{type:`checkbox`,checked:r,onChange:e=>i(e.target.checked),style:{marginTop:2}}),(0,w.jsx)(`span`,{style:{fontSize:12,color:`#92400e`},children:`我已知晓上述「需确认」级风险(敏感 capability / IPC 共享等),确认以此配置部署。阻断级风险不可 override。`})]})]})}function Xp({icon:e,label:t,value:n,tone:r}){return(0,w.jsxs)(`span`,{style:{display:`inline-flex`,alignItems:`center`,gap:4,fontSize:11,padding:`2px 8px`,borderRadius:999,background:r===`blue`?`#eff6ff`:S.surfaceAlt,color:r===`blue`?`#1d4ed8`:S.ink3,border:`1px solid ${r===`blue`?`#bfdbfe`:S.borderSoft}`},children:[(0,w.jsx)(D,{name:e,size:11,stroke:2}),t,` `,(0,w.jsx)(`strong`,{className:`mono tnum`,style:{color:S.ink},children:n})]})}function Zp({tone:e,label:t,items:n}){return!n||n.length===0?null:(0,w.jsxs)(`div`,{style:{marginTop:6},children:[(0,w.jsxs)(`div`,{style:{fontSize:11.5,fontWeight:700,color:e,marginBottom:3},children:[t,` · `,n.length]}),n.map((t,n)=>(0,w.jsxs)(`div`,{style:{color:e,fontSize:11.5,paddingLeft:10,borderLeft:`2px solid ${e}55`,marginBottom:2},children:[t.service?(0,w.jsxs)(`strong`,{children:[t.service,`:`]}):null,t.message,t.field&&(0,w.jsxs)(`span`,{style:{color:S.ink4},children:[`(`,t.field,`)`]})]},n))]})}function Qp({app:e,disabled:t,onTakeover:n}){let r=pp(e),i=e.discovered||{},a=e.observed?.services||[],o=e.observed?.endpoints||[],s=!!i.takeoverAvailable,c=Array.isArray(i.configFiles)?i.configFiles.length:0;return(0,w.jsxs)(`div`,{style:{...tm,border:`1px dashed ${S.border}`,background:`#fcfcfd`},children:[(0,w.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,gap:10,flexWrap:`wrap`},children:[(0,w.jsxs)(`span`,{style:gm,title:`由 Docker Compose 创建、尚未由 devbox 接管的外部 project`,children:[(0,w.jsx)(D,{name:`eye`,size:11,stroke:2}),`已发现 · 只读`]}),(0,w.jsx)(`strong`,{style:{color:S.ink,fontSize:14},children:e.name}),(0,w.jsx)(`span`,{style:hm(!0),title:mp(`compose`),children:`Compose`}),(0,w.jsx)(`span`,{style:{fontSize:12,color:S.ink3,fontWeight:600},children:dp[r]||r}),(0,w.jsx)(`span`,{style:{flex:1}}),(0,w.jsx)(`span`,{className:`tnum`,style:{fontSize:11.5,color:S.ink3},children:a.length>0?`${a.length} 服务 · ${e.ready||0}/${e.replicas||a.length} 就绪`:`0 服务`})]}),(0,w.jsxs)(`div`,{style:{fontSize:12,color:S.ink3,marginTop:6,display:`flex`,flexDirection:`column`,gap:3},children:[i.workingDir&&(0,w.jsxs)(`div`,{style:_m,title:`工作目录:${i.workingDir}`,children:[(0,w.jsx)(`span`,{style:{color:S.ink4},children:`工作目录`}),(0,w.jsx)(`span`,{className:`mono`,style:vm,children:i.workingDir})]}),c>0&&(0,w.jsxs)(`div`,{style:_m,title:`配置文件(${c}):${(i.configFiles||[]).join(`, `)}`,children:[(0,w.jsx)(`span`,{style:{color:S.ink4},children:`配置文件`}),(0,w.jsxs)(`span`,{className:`mono`,style:vm,children:[c,` 个`]})]}),o.length>0&&(0,w.jsx)(`div`,{style:{display:`flex`,alignItems:`center`,gap:6,flexWrap:`wrap`},children:o.map((e,t)=>(0,w.jsxs)(`a`,{href:e.url,target:`_blank`,rel:`noreferrer`,title:e.name||e.url,style:{display:`inline-flex`,alignItems:`center`,gap:3,color:S.blue,textDecoration:`none`,fontSize:11.5,padding:`1px 7px`,borderRadius:4,background:S.blueSoft,border:`1px solid #bfdbfe`},children:[(0,w.jsx)(D,{name:`external`,size:10,stroke:2}),e.name||Gp(e.url)]},t))})]}),(0,w.jsx)($p,{app:e}),!s&&i.reason&&(0,w.jsxs)(`div`,{style:{fontSize:11.5,color:`#92400e`,marginTop:8,padding:`6px 9px`,background:`#fffbeb`,border:`1px solid #fde68a`,borderRadius:7},children:[`暂不可接管:`,i.reason]}),(0,w.jsxs)(`div`,{style:{fontSize:11,color:S.ink4,marginTop:8},children:[`列表仅显示仍有容器记录的 project;若已 `,(0,w.jsx)(`span`,{className:`mono`,children:`compose down`}),` 且容器记录被删除,则无法自动发现,可改用「新建 Compose」粘贴/上传导入。`]}),(0,w.jsxs)(`div`,{style:{display:`flex`,gap:8,marginTop:10,alignItems:`center`},children:[(0,w.jsxs)(`button`,{onClick:n,disabled:t||!s,className:`edge-press edge-btn-primary`,"aria-label":`接管并编辑 ${e.name}`,style:{...im,minHeight:40,opacity:t||!s?.6:1},children:[(0,w.jsx)(D,{name:`download`,size:13,stroke:2}),`接管并编辑`]}),!s&&(0,w.jsx)(`span`,{style:{fontSize:11.5,color:S.ink4},children:`解决上述问题后即可接管`})]})]})}function $p({app:e}){let{rows:t,total:n,truncated:r}=gp(e);return n===0?(0,w.jsx)(`div`,{style:{fontSize:11.5,color:S.ink4,marginTop:6},children:`0 服务`}):(0,w.jsxs)(`div`,{style:{marginTop:6,display:`flex`,flexDirection:`column`,gap:3},children:[t.map((e,t)=>(0,w.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,gap:8,fontSize:11.5,minWidth:0},children:[(0,w.jsx)(`span`,{style:{color:S.ink2,fontWeight:600,minWidth:0,overflow:`hidden`,textOverflow:`ellipsis`,whiteSpace:`nowrap`,maxWidth:160},title:e.name,children:e.name}),e.state&&(0,w.jsx)(`span`,{className:`tnum`,style:{color:S.ink4},children:e.state}),e.health&&e.health!==`none`&&(0,w.jsx)(`span`,{style:{fontSize:10.5,padding:`0 6px`,borderRadius:999,background:e.health===`healthy`?`#ecfdf5`:e.health===`unhealthy`?`#fef2f2`:`#fffbeb`,color:e.health===`healthy`?`#047857`:e.health===`unhealthy`?`#b91c1c`:`#92400e`,border:`1px solid ${e.health===`healthy`?`#a7f3d0`:e.health===`unhealthy`?`#fecaca`:`#fde68a`}`},children:_p[e.health]||e.health}),e.ports.length>0&&(0,w.jsx)(`span`,{className:`mono tnum`,style:{color:S.ink3,minWidth:0,overflow:`hidden`,textOverflow:`ellipsis`,whiteSpace:`nowrap`},title:e.ports.join(`, `),children:e.ports.join(`, `)})]},t)),r&&(0,w.jsxs)(`div`,{className:`tnum`,style:{fontSize:11,color:S.ink4},children:[`还有 `,n-t.length,` 个服务…`]})]})}function em({app:e,onClose:t,onDone:n}){let[r,i]=(0,b.useState)(!1),[a,o]=(0,b.useState)(null),[s,c]=(0,b.useState)(null),[l,u]=(0,b.useState)(!1),d=(0,b.useRef)(null),f=e.discovered||{},p=s?ap(s):{blocked:[],confirmation:[],warning:[]},m=p.confirmation.length>0&&!l,h=p.blocked.length>0,g=!r&&!h&&!m,_=(0,b.useRef)(!1);(0,b.useEffect)(()=>{_.current=r},[r]);let v=()=>{_.current||t()};(0,b.useEffect)(()=>{let e=document.activeElement;return d.current?.focus(),()=>{if(e&&typeof e.focus==`function`)try{e.focus()}catch{}}},[]);let y=(0,b.useRef)(null);(0,b.useEffect)(()=>{let e=e=>{if(e.key===`Escape`){_.current||t();return}if(e.key!==`Tab`)return;let n=y.current;if(!n)return;let r=n.querySelectorAll(`button:not([disabled]), input:not([disabled]), a[href], [tabindex]:not([tabindex="-1"])`);if(r.length===0)return;let i=r[0],a=r[r.length-1];e.shiftKey&&document.activeElement===i?(e.preventDefault(),a.focus()):!e.shiftKey&&document.activeElement===a&&(e.preventDefault(),i.focus())};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},[t]);async function x(){if(g){i(!0),o(null),c(null);try{await wf(e.id,l,`takeover-${e.id}`),n(!0)}catch(e){c(e.findings||null),o(e.message||`接管失败`),i(!1)}}}return(0,w.jsx)(`div`,{style:cm,onClick:v,children:(0,w.jsxs)(`div`,{ref:y,style:lm,role:`dialog`,"aria-modal":`true`,"aria-label":`接管 Compose project ${e.name}`,onClick:e=>e.stopPropagation(),children:[(0,w.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,gap:8},children:[(0,w.jsx)(D,{name:`download`,size:16,stroke:2,style:{color:S.blue}}),(0,w.jsxs)(`strong`,{style:{fontSize:16,color:S.ink},children:[`接管并编辑「`,e.name,`」`]}),(0,w.jsx)(`span`,{style:{flex:1}}),(0,w.jsx)(`button`,{ref:d,onClick:v,disabled:r,"aria-disabled":r,"aria-label":`关闭接管对话框`,style:am,children:(0,w.jsx)(D,{name:`x`,size:15,stroke:2})})]}),(0,w.jsxs)(`div`,{style:{fontSize:12.5,color:S.ink2,marginTop:12,lineHeight:1.6},children:[`接管会把该外部 Compose project 转为 devbox 受管:`,(0,w.jsxs)(`ul`,{style:{margin:`6px 0 0 18px`,padding:0},children:[(0,w.jsxs)(`li`,{children:[`保留原 project name `,(0,w.jsx)(`span`,{className:`mono`,children:f.project||e.name}),` 原地管理,容器/网络/named volume 不改名(数据不变)。`]}),(0,w.jsx)(`li`,{children:`源目录只读:把归一化后的 compose 写入 devbox 托管副本,不修改你的原始文件。`}),(0,w.jsx)(`li`,{children:`接管后进入编辑 / 版本 / 日志 / 生命周期 / 卸载边界。`})]})]}),f.workingDir&&(0,w.jsxs)(`div`,{style:_m,title:f.workingDir,children:[(0,w.jsx)(`span`,{style:{color:S.ink4,fontSize:12},children:`来源`}),(0,w.jsx)(`span`,{className:`mono`,style:vm,children:f.workingDir})]}),a&&(0,w.jsx)(`div`,{style:mm,children:a}),s&&(0,w.jsxs)(w.Fragment,{children:[(0,w.jsx)(Zp,{tone:`#dc2626`,label:`阻断(不可接管)`,items:p.blocked}),(0,w.jsx)(Zp,{tone:`#d97706`,label:`需确认`,items:p.confirmation}),(0,w.jsx)(Zp,{tone:`#d97706`,label:`警告`,items:p.warning})]}),m&&(0,w.jsxs)(`label`,{style:{display:`flex`,alignItems:`flex-start`,gap:8,marginTop:10,cursor:`pointer`,padding:10,borderRadius:8,background:`#fffbeb`,border:`1px solid #fde68a`},children:[(0,w.jsx)(`input`,{type:`checkbox`,checked:l,onChange:e=>u(e.target.checked),style:{marginTop:2}}),(0,w.jsx)(`span`,{style:{fontSize:12,color:`#92400e`},children:`我已知晓上述「需确认」级风险,确认接管。阻断级风险不可 override。`})]}),(0,w.jsxs)(`div`,{style:{display:`flex`,gap:8,marginTop:14,alignItems:`center`},children:[(0,w.jsxs)(`button`,{onClick:x,disabled:!g,className:`edge-press edge-btn-primary`,"aria-label":`确认接管`,style:{...im,minHeight:40,opacity:g?1:.6},children:[(0,w.jsx)(D,{name:`check`,size:13,stroke:2}),r?`接管中…`:`确认接管`]}),(0,w.jsx)(`button`,{onClick:v,className:`edge-press edge-btn-secondary`,style:{...gd,minHeight:40,padding:`0 14px`},children:`取消`})]})]})})}var tm={padding:`13px 16px`,borderRadius:12,background:`#fff`,border:`1px solid ${S.border}`,boxShadow:`0 1px 2px rgba(15,23,42,0.04)`},nm={padding:`5px 11px`,fontSize:12.5,borderRadius:999,border:`1px solid ${S.border}`,background:`#fff`,color:S.ink2,cursor:`pointer`},rm={...nm,background:S.blue,color:`#fff`,borderColor:S.blue},im={display:`inline-flex`,alignItems:`center`,gap:6,padding:`7px 14px`,fontSize:13,fontWeight:600,borderRadius:8,cursor:`pointer`,border:`1px solid ${S.blueDeep}`,background:S.blue,color:`#fff`},am={display:`inline-flex`,alignItems:`center`,justifyContent:`center`,padding:`6px 10px`,fontSize:12.5,borderRadius:8,cursor:`pointer`,border:`1px solid ${S.border}`,background:`#fff`,color:S.ink2},om={marginTop:12,padding:`10px 14px`,borderRadius:10,background:`#fffbeb`,border:`1px solid #fde68a`,color:`#92400e`,fontSize:13},sm={padding:36,textAlign:`center`,color:S.ink3,fontSize:13,border:`1px dashed ${S.border}`,borderRadius:12,background:`#fff`},cm={position:`fixed`,inset:0,background:`rgba(15,23,42,0.5)`,zIndex:100,display:`flex`,alignItems:`center`,justifyContent:`center`,backdropFilter:`blur(2px)`},lm={width:`min(760px, 94vw)`,maxHeight:`90vh`,overflow:`auto`,background:`#fff`,borderRadius:14,padding:22,boxShadow:`0 12px 40px rgba(15,23,42,0.25)`},um={display:`block`,fontSize:12,fontWeight:600,color:S.ink3,marginTop:12,marginBottom:5},dm={width:`100%`,padding:`8px 10px`,borderRadius:8,border:`1px solid ${S.border}`,fontSize:13,boxSizing:`border-box`},fm={...dm,fontFamily:`ui-monospace, monospace`,resize:`vertical`},pm={padding:`8px 10px`,borderRadius:7,background:S.surfaceAlt,border:`1px solid ${S.borderSoft}`},mm={marginTop:10,padding:`8px 10px`,borderRadius:7,background:`#fef2f2`,border:`1px solid #fecaca`,fontSize:12,color:`#b91c1c`};function hm(e){return{fontSize:11,padding:`2px 8px`,borderRadius:999,fontWeight:600,background:e?`#ecfeff`:`#eef2ff`,color:e?`#0e7490`:`#3730a3`,border:`1px solid ${e?`#a5f3fc`:`#c7d2fe`}`}}var gm={display:`inline-flex`,alignItems:`center`,gap:4,fontSize:11,padding:`2px 9px`,borderRadius:999,fontWeight:700,background:`#fff7ed`,color:`#9a3412`,border:`1px solid #fed7aa`},_m={display:`flex`,alignItems:`center`,gap:8,minWidth:0,fontSize:11.5,marginTop:4},vm={color:S.ink3,minWidth:0,overflow:`hidden`,textOverflow:`ellipsis`,whiteSpace:`nowrap`};function ym({authed:e,onRequireAuth:t}){let[n,r]=(0,b.useState)(`active`),[i,a]=(0,b.useState)(null),[o,s]=(0,b.useState)([]);(0,b.useEffect)(()=>{let e=()=>X(`/api/v1/alerts`).then(e=>e.ok?e.json():null).then(e=>{Array.isArray(e)&&s(e)}).catch(()=>{});e();let t=setInterval(e,3e4);return()=>clearInterval(t)},[]);let c=o.filter(e=>n===`active`?e.state===`active`:n===`history`?e.state===`recovered`:!0),l={critical:{tone:`red`,icon:`alertTri`,label:`紧急`,color:S.red},warning:{tone:`amber`,icon:`alertTri`,label:`警告`,color:S.amber},info:{tone:`blue`,icon:`info`,label:`信息`,color:S.blue},recovered:{tone:`green`,icon:`check`,label:`已恢复`,color:S.green}};return(0,w.jsxs)(`div`,{style:{flex:1,display:`flex`,flexDirection:`column`,background:S.surfaceAlt},children:[(0,w.jsxs)(`div`,{style:{padding:`18px 24px 0`,background:S.surface,borderBottom:`1px solid ${S.border}`},children:[(0,w.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,gap:12,marginBottom:14},children:[(0,w.jsxs)(`div`,{children:[(0,w.jsx)(`div`,{style:{fontSize:17,fontWeight:700,color:S.ink,letterSpacing:`-0.01em`},children:`告警中心`}),(0,w.jsxs)(`div`,{style:{fontSize:11.5,color:S.ink3,marginTop:4},children:[`共 `,o.length,` 条 · `,(0,w.jsxs)(`span`,{style:{color:S.red,fontWeight:600},children:[o.filter(e=>e.state===`active`).length,` 活跃`]}),` · `,o.filter(e=>e.state!==`active`).length,` 已恢复`]})]}),(0,w.jsx)(`div`,{style:{flex:1}}),(0,w.jsxs)(`div`,{style:{display:`flex`,gap:8},children:[(0,w.jsxs)(`button`,{className:`edge-press edge-btn-secondary`,style:gd,children:[(0,w.jsx)(D,{name:`download`,size:13,stroke:1.8}),`导出`]}),(0,w.jsxs)(`button`,{className:`edge-press ${e?`edge-btn-primary`:`edge-btn-secondary`}`,style:e?_d:{...gd,color:S.ink3},onClick:()=>!e&&t(`全部确认告警`),children:[(0,w.jsx)(D,{name:`check`,size:13,stroke:2}),e?`全部确认`:`需验证后确认`]})]})]}),(0,w.jsx)(Zf,{tabs:(()=>{let e=o.filter(e=>e.state===`active`).length,t=o.filter(e=>e.state===`recovered`).length,n=o.length;return[{id:`active`,label:`活跃`,count:e},{id:`history`,label:`已恢复`,count:t},{id:`all`,label:`全部`,count:n}]})(),active:n,onChange:r,style:{gap:4},itemStyle:{padding:`8px 14px 10px`,fontSize:13,marginBottom:-1},renderLabel:e=>(0,w.jsxs)(w.Fragment,{children:[e.label,` `,(0,w.jsxs)(`span`,{style:{color:S.ink4,fontWeight:500},children:[`· `,e.count]})]})})]}),(0,w.jsx)(`div`,{style:{flex:1,overflow:`auto`,padding:24},children:c.length===0?(0,w.jsxs)(`div`,{style:{display:`flex`,flexDirection:`column`,alignItems:`center`,justifyContent:`center`,padding:`60px 20px`,color:S.ink3},children:[(0,w.jsx)(`div`,{style:{width:56,height:56,borderRadius:`50%`,background:`#ecfdf5`,display:`flex`,alignItems:`center`,justifyContent:`center`,color:S.green,marginBottom:16},children:(0,w.jsx)(D,{name:`check`,size:26,stroke:2})}),(0,w.jsx)(`div`,{style:{fontSize:14,fontWeight:600,color:S.ink2},children:n===`active`?`当前无活跃告警`:n===`history`?`暂无已恢复告警`:`暂无告警记录`}),(0,w.jsx)(`div`,{style:{fontSize:12,color:S.ink4,marginTop:6},children:`系统运行正常,alert engine 未触发任何规则`})]}):(0,w.jsx)(`div`,{style:{display:`flex`,flexDirection:`column`,gap:10},children:c.map(n=>{let r=l[n.severity||n.sev],o=i===n.id;return(0,w.jsxs)(`div`,{style:{background:S.surface,borderRadius:10,border:`1px solid ${S.border}`,borderLeft:`3px solid ${r.color}`,overflow:`hidden`},children:[(0,w.jsxs)(`div`,{onClick:()=>a(o?null:n.id),style:{padding:`14px 16px`,display:`flex`,alignItems:`center`,gap:12,cursor:`pointer`},children:[(0,w.jsx)(`div`,{style:{width:30,height:30,borderRadius:8,flexShrink:0,background:`${r.color}15`,color:r.color,display:`flex`,alignItems:`center`,justifyContent:`center`},children:(0,w.jsx)(D,{name:r.icon,size:15,stroke:1.8})}),(0,w.jsxs)(`div`,{style:{minWidth:0,flex:1},children:[(0,w.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,gap:8},children:[(0,w.jsx)(`span`,{style:{fontSize:13.5,fontWeight:600,color:S.ink},children:n.title}),(0,w.jsx)(J,{tone:r.tone,children:r.label}),n.state===`active`&&(0,w.jsxs)(J,{tone:`red`,children:[(0,w.jsx)(q,{tone:`red`,size:6,pulse:!0}),`活跃`]}),n.state===`recovered`&&(0,w.jsx)(J,{tone:`gray`,children:`已恢复`})]}),(0,w.jsxs)(`div`,{style:{fontSize:11.5,color:S.ink3,marginTop:4,display:`flex`,gap:8},children:[(0,w.jsx)(`span`,{className:`mono`,children:n.time}),(0,w.jsx)(`span`,{style:{color:`#cbd5e1`},children:`·`}),(0,w.jsx)(`span`,{children:n.target})]})]}),n.state===`active`&&(0,w.jsxs)(`button`,{onClick:r=>{if(r.stopPropagation(),!e){t(`确认告警 `+n.id);return}X(`/api/v1/alerts/`+n.id+`/ack`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({id:n.id})}).then(()=>{s(e=>e.map(e=>e.id===n.id?{...e,state:`recovered`}:e))}).catch(()=>{})},className:`edge-press ${e?`edge-btn-primary`:`edge-btn-secondary`}`,style:e?_d:gd,children:[(0,w.jsx)(D,{name:`check`,size:13,stroke:2}),e?`确认`:`需验证`]}),(0,w.jsx)(D,{name:`chevDown`,size:14,stroke:2,style:{color:S.ink4,transform:`rotate(${o?180:0}deg)`,transition:`transform 0.2s`}})]}),o&&(0,w.jsxs)(`div`,{className:`edge-fade-in`,style:{padding:`12px 16px 16px`,background:S.surfaceAlt,borderTop:`1px solid ${S.borderSoft}`},children:[(0,w.jsx)(`div`,{style:{fontSize:12.5,color:S.ink2,lineHeight:1.7},children:n.detail}),n.suggest&&(0,w.jsxs)(`div`,{style:{marginTop:12},children:[(0,w.jsx)(`div`,{style:{fontSize:10.5,color:S.ink3,fontWeight:600,letterSpacing:`0.04em`,textTransform:`uppercase`,marginBottom:6},children:`建议操作`}),(0,w.jsx)(`div`,{style:{display:`flex`,flexDirection:`column`,gap:6},children:n.suggest.map((e,t)=>(0,w.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,gap:8,padding:`8px 10px`,background:S.surface,border:`1px solid ${S.borderSoft}`,borderRadius:6,fontSize:12,color:S.ink2},children:[(0,w.jsx)(`span`,{style:{width:18,height:18,borderRadius:`50%`,background:S.blueSoft,color:S.blueDeep,display:`inline-flex`,alignItems:`center`,justifyContent:`center`,fontSize:10.5,fontWeight:700,flexShrink:0},className:`mono`,children:t+1}),(0,w.jsx)(`span`,{style:{flex:1},children:e}),(0,w.jsx)(D,{name:`chevRight`,size:12,stroke:2,style:{color:S.ink4}})]},t))})]})]})]},n.id)})})})]})}function bm(e,t={}){let n=kd(),r={...t.headers||{}};return n&&(r.Authorization=`Bearer `+n),fetch(e,{...t,headers:r})}var xm=[{value:`LOGIN_SUCCESS`,label:`登录成功`,tone:`green`},{value:`LOGIN_FAILED`,label:`登录失败`,tone:`red`},{value:`APP_INSTALL`,label:`应用安装`,tone:`blue`,notImpl:!0},{value:`APP_UNINSTALL`,label:`应用卸载`,tone:`amber`},{value:`APP_START`,label:`应用启动`,tone:`blue`},{value:`APP_STOP`,label:`应用停止`,tone:`slate`},{value:`APP_RESTART`,label:`应用重启`,tone:`blue`},{value:`SHELL_OPEN`,label:`打开 Shell`,tone:`violet`},{value:`SHELL_CLOSE`,label:`关闭 Shell`,tone:`slate`},{value:`FILE_LIST`,label:`浏览文件`,tone:`slate`},{value:`FILE_DOWNLOAD`,label:`下载文件`,tone:`amber`,notImpl:!0},{value:`MEMO_EDIT`,label:`备忘录编辑`,tone:`slate`,notImpl:!0},{value:`SETTING_CHANGE`,label:`系统设置变更`,tone:`slate`,notImpl:!0}],Sm={green:`#059669`,red:`#dc2626`,blue:`#2563eb`,amber:`#d97706`,violet:`#7c3aed`,slate:`#475569`},Cm=50;function wm(){let[e,t]=(0,b.useState)(`24h`),[n,r]=(0,b.useState)([]),[i,a]=(0,b.useState)(``),[o,s]=(0,b.useState)(`all`),[c,l]=(0,b.useState)(0),[u,d]=(0,b.useState)([]),[f,p]=(0,b.useState)(0),[m,h]=(0,b.useState)(!1),[g,_]=(0,b.useState)(``),[v,y]=(0,b.useState)(null),[x,C]=(0,b.useState)(null);(0,b.useEffect)(()=>{let e=!1;function t(){fetch(`/api/v1/cloud/status`).then(e=>e.ok?e.json():{cloudOnline:!1}).then(t=>{e||y(!!t.cloudOnline)}).catch(()=>{e||y(!1)})}t();let n=setInterval(t,3e4);return()=>{e=!0,clearInterval(n)}},[]);let T=(0,b.useMemo)(()=>{let t=new Date,n={"1h":1,"6h":6,"24h":24,"7d":168,"30d":720}[e]??24;return new Date(t.getTime()-n*3600*1e3).toISOString()},[e]),E=(0,b.useMemo)(()=>{let e=new URLSearchParams;return e.set(`limit`,String(Cm)),e.set(`offset`,String(c*Cm)),e.set(`since`,T),i&&e.set(`user`,i),o!==`all`&&e.append(`outcome`,o),n.forEach(t=>e.append(`type`,t)),`/api/v1/audit/events?`+e.toString()},[c,T,i,o,n]);(0,b.useEffect)(()=>{let e=!1,t=null;function n(){h(!0),_(``),bm(E).then(async t=>{if(!t.ok){e||_(`查询失败 (${t.status})`);return}let n=await t.json();e||(d(Array.isArray(n.events)?n.events:[]),p(n.total||0))}).catch(t=>{e||_(`网络错误:`+String(t))}).finally(()=>{e||h(!1)})}function r(){t??=(n(),setInterval(n,3e4))}function i(){t!=null&&(clearInterval(t),t=null)}function a(){document.hidden?i():r()}return document.hidden||r(),document.addEventListener(`visibilitychange`,a),()=>{e=!0,i(),document.removeEventListener(`visibilitychange`,a)}},[E]);let O=Math.max(1,Math.ceil(f/Cm)),k=e=>xm.find(t=>t.value===e)||{label:e,tone:`slate`};return(0,w.jsxs)(`div`,{style:{flex:1,display:`flex`,flexDirection:`column`,background:S.surfaceAlt},children:[(0,w.jsxs)(`div`,{style:{padding:`18px 24px 14px`,background:S.surface,borderBottom:`1px solid ${S.border}`},children:[(0,w.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,gap:12,marginBottom:12},children:[(0,w.jsxs)(`div`,{children:[(0,w.jsx)(`div`,{style:{fontSize:17,fontWeight:700,color:S.ink,letterSpacing:`-0.01em`},children:`操作日志`}),(0,w.jsxs)(`div`,{style:{fontSize:11.5,color:S.ink3,marginTop:4},children:[`共 `,f,` 条 · 当前页 `,c+1,`/`,O,v===!1&&(0,w.jsx)(`span`,{style:{color:`#a16207`,marginLeft:8},children:`· 云端聚合不可用(仅本节点)`})]})]}),(0,w.jsx)(`div`,{style:{flex:1}}),m&&(0,w.jsx)(`span`,{style:{fontSize:11,color:S.ink4},children:`加载中…`})]}),(0,w.jsxs)(`div`,{style:{display:`flex`,gap:10,flexWrap:`wrap`,alignItems:`center`},children:[(0,w.jsx)(`div`,{style:{display:`flex`,gap:2,background:S.surfaceAlt,padding:2,borderRadius:8},children:[`1h`,`6h`,`24h`,`7d`,`30d`].map(n=>(0,w.jsx)(`button`,{onClick:()=>{t(n),l(0)},style:{padding:`5px 10px`,fontSize:12,fontWeight:500,border:`none`,background:e===n?S.surface:`transparent`,color:e===n?S.blueDeep:S.ink3,borderRadius:6,cursor:`pointer`,boxShadow:e===n?`0 1px 2px rgba(0,0,0,0.04)`:`none`},children:n},n))}),(0,w.jsx)(`input`,{placeholder:`用户名(模糊)`,value:i,onChange:e=>{a(e.target.value),l(0)},style:{height:30,border:`1px solid ${S.border}`,borderRadius:6,padding:`0 10px`,fontSize:12.5,color:S.ink,outline:`none`,width:160}}),(0,w.jsx)(`div`,{style:{display:`flex`,gap:2,background:S.surfaceAlt,padding:2,borderRadius:8},children:[[`all`,`全部`],[`success`,`成功`],[`failure`,`失败`]].map(([e,t])=>(0,w.jsx)(`button`,{onClick:()=>{s(e),l(0)},style:{padding:`5px 10px`,fontSize:12,fontWeight:500,border:`none`,background:o===e?S.surface:`transparent`,color:o===e?S.blueDeep:S.ink3,borderRadius:6,cursor:`pointer`},children:t},e))}),(0,w.jsx)(Om,{value:n,onChange:e=>{r(e),l(0)}}),(n.length>0||i||o!==`all`||e!==`24h`)&&(0,w.jsxs)(`button`,{className:`edge-press edge-btn-secondary`,style:{...gd,height:30,padding:`0 10px`},onClick:()=>{r([]),a(``),s(`all`),t(`24h`),l(0)},children:[(0,w.jsx)(D,{name:`x`,size:12,stroke:2}),`重置`]})]})]}),(0,w.jsxs)(`div`,{style:{flex:1,overflow:`auto`,padding:16},children:[g&&(0,w.jsx)(`div`,{style:{padding:12,background:`#fef2f2`,border:`1px solid #fecaca`,borderRadius:8,color:`#dc2626`,fontSize:13,marginBottom:12},children:g}),(0,w.jsx)(`div`,{style:{background:S.surface,borderRadius:10,border:`1px solid ${S.border}`,overflow:`hidden`},children:(0,w.jsxs)(`table`,{style:{width:`100%`,borderCollapse:`collapse`,fontSize:12.5},children:[(0,w.jsx)(`thead`,{children:(0,w.jsxs)(`tr`,{style:{background:S.surfaceAlt,color:S.ink3,fontWeight:600,fontSize:11.5},children:[(0,w.jsx)(`th`,{style:km,children:`时间`}),(0,w.jsx)(`th`,{style:km,children:`用户`}),(0,w.jsx)(`th`,{style:km,children:`事件`}),(0,w.jsx)(`th`,{style:km,children:`资源`}),(0,w.jsx)(`th`,{style:km,children:`源 IP`}),(0,w.jsx)(`th`,{style:km,children:`结果`})]})}),(0,w.jsxs)(`tbody`,{children:[u.length===0&&!m&&(0,w.jsx)(`tr`,{children:(0,w.jsx)(`td`,{colSpan:6,style:{...Am,textAlign:`center`,padding:32,color:S.ink4},children:`没有匹配的事件`})}),u.map(e=>(0,w.jsx)(Tm,{ev:e,meta:k(e.event_type),onClick:()=>C(e)},e.id))]})]})}),O>1&&(0,w.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,justifyContent:`center`,gap:8,marginTop:16},children:[(0,w.jsx)(`button`,{onClick:()=>l(e=>Math.max(0,e-1)),disabled:c===0,style:jm(c===0),children:`← 上一页`}),(0,w.jsxs)(`span`,{style:{fontSize:12.5,color:S.ink2},children:[`第 `,c+1,` / `,O,` 页`]}),(0,w.jsx)(`button`,{onClick:()=>l(e=>Math.min(O-1,e+1)),disabled:c>=O-1,style:jm(c>=O-1),children:`下一页 →`})]})]}),x&&(0,w.jsx)(Em,{ev:x,meta:k(x.event_type),onClose:()=>C(null)})]})}function Tm({ev:e,meta:t,onClick:n}){let r=Sm[t.tone]||Sm.slate;return(0,w.jsxs)(`tr`,{onClick:n,style:{cursor:`pointer`,borderTop:`1px solid ${S.border}`},children:[(0,w.jsxs)(`td`,{style:Am,children:[(0,w.jsx)(`div`,{style:{fontWeight:500,color:S.ink},children:Mm(e.ts)}),(0,w.jsx)(`div`,{style:{fontSize:10.5,color:S.ink4},title:e.ts,children:Nm(e.ts)})]}),(0,w.jsx)(`td`,{style:Am,children:e.username||`-`}),(0,w.jsx)(`td`,{style:Am,children:(0,w.jsx)(`span`,{style:{padding:`2px 8px`,borderRadius:6,fontSize:11.5,fontWeight:600,background:r+`18`,color:r},children:t.label})}),(0,w.jsx)(`td`,{style:Am,children:e.resource_id?(0,w.jsxs)(`span`,{style:{color:S.ink2,fontFamily:`ui-monospace,SFMono-Regular,Menlo,monospace`,fontSize:11.5},children:[e.resource_kind&&(0,w.jsxs)(`span`,{style:{color:S.ink4},children:[e.resource_kind,`:`]}),e.resource_id]}):(0,w.jsx)(`span`,{style:{color:S.ink4},children:`-`})}),(0,w.jsx)(`td`,{style:Am,children:e.source_ip||`-`}),(0,w.jsx)(`td`,{style:Am,children:e.outcome===`success`?(0,w.jsx)(`span`,{style:{color:`#059669`,fontWeight:600},children:`● 成功`}):(0,w.jsx)(`span`,{style:{color:`#dc2626`,fontWeight:600},children:`● 失败`})})]})}function Em({ev:e,meta:t,onClose:n}){let r=Sm[t.tone]||Sm.slate;return(0,b.useEffect)(()=>{function e(e){e.key===`Escape`&&n()}return document.addEventListener(`keydown`,e),()=>document.removeEventListener(`keydown`,e)},[n]),(0,w.jsxs)(w.Fragment,{children:[(0,w.jsx)(`div`,{onClick:n,style:{position:`absolute`,inset:0,background:`rgba(15,23,42,0.32)`,zIndex:50}}),(0,w.jsxs)(`div`,{style:{position:`absolute`,top:0,right:0,bottom:0,width:440,zIndex:51,background:S.surface,boxShadow:`-12px 0 32px -4px rgba(0,0,0,0.12)`,display:`flex`,flexDirection:`column`},children:[(0,w.jsxs)(`div`,{style:{padding:`16px 20px`,borderBottom:`1px solid ${S.border}`,display:`flex`,alignItems:`center`,gap:12},children:[(0,w.jsx)(`span`,{style:{padding:`3px 10px`,borderRadius:6,fontSize:12,fontWeight:600,background:r+`18`,color:r},children:t.label}),(0,w.jsxs)(`div`,{style:{flex:1,fontSize:11.5,color:S.ink3},children:[`事件 #`,e.id]}),(0,w.jsx)(`button`,{onClick:n,style:{border:`none`,background:`transparent`,cursor:`pointer`,color:S.ink3,padding:4,display:`flex`},children:(0,w.jsx)(D,{name:`x`,size:16,stroke:2})})]}),(0,w.jsxs)(`div`,{style:{flex:1,overflow:`auto`,padding:20,fontSize:12.5,color:S.ink2},children:[(0,w.jsx)(Dm,{label:`时间`,value:Nm(e.ts),mono:!0}),(0,w.jsx)(Dm,{label:`UTC`,value:e.ts,mono:!0}),(0,w.jsx)(Dm,{label:`用户`,value:e.username||`-`}),(0,w.jsx)(Dm,{label:`资源`,value:e.resource_id?`${e.resource_kind||`?`}:${e.resource_id}`:`-`,mono:!0}),(0,w.jsx)(Dm,{label:`源 IP`,value:e.source_ip||`-`,mono:!0}),(0,w.jsx)(Dm,{label:`结果`,value:e.outcome,valueStyle:{color:e.outcome===`success`?`#059669`:`#dc2626`,fontWeight:600}}),(0,w.jsx)(Dm,{label:`User Agent`,value:e.user_agent||`-`,small:!0}),(0,w.jsx)(`div`,{style:{marginTop:16,fontSize:11,fontWeight:600,color:S.ink4},children:`PAYLOAD`}),(0,w.jsx)(`pre`,{style:{margin:`6px 0 0`,padding:12,background:S.surfaceAlt,border:`1px solid ${S.border}`,borderRadius:6,fontSize:11.5,color:S.ink2,overflow:`auto`,maxHeight:280},children:e.payload?JSON.stringify(e.payload,null,2):`(无)`})]})]})]})}function Dm({label:e,value:t,mono:n,small:r,valueStyle:i}){return(0,w.jsxs)(`div`,{style:{display:`grid`,gridTemplateColumns:`90px 1fr`,gap:10,padding:`8px 0`,borderBottom:`1px solid ${S.borderSoft}`},children:[(0,w.jsx)(`div`,{style:{color:S.ink4,fontSize:11.5},children:e}),(0,w.jsx)(`div`,{style:{...n&&{fontFamily:`ui-monospace,SFMono-Regular,Menlo,monospace`},...r&&{fontSize:11},wordBreak:`break-all`,...i||{}},children:t})]})}function Om({value:e,onChange:t}){let[n,r]=(0,b.useState)(!1),i=n=>{e.includes(n)?t(e.filter(e=>e!==n)):t([...e,n])};return(0,w.jsxs)(`div`,{style:{position:`relative`},children:[(0,w.jsxs)(`button`,{onClick:()=>r(e=>!e),style:{height:30,padding:`0 10px`,border:`1px solid ${S.border}`,borderRadius:6,background:S.surface,fontSize:12.5,color:S.ink,cursor:`pointer`,display:`flex`,alignItems:`center`,gap:6},children:[`事件类型`,e.length>0?` (${e.length})`:``,(0,w.jsx)(D,{name:`chevDown`,size:12,stroke:2})]}),(0,w.jsx)(Mc,{children:n&&(0,w.jsxs)(Gu,{origin:`top left`,className:`edge-material-surface`,style:{position:`absolute`,top:34,left:0,zIndex:100,border:`1px solid ${S.border}`,borderRadius:8,boxShadow:`0 8px 32px -4px rgba(0,0,0,0.12)`,minWidth:200,padding:6,maxHeight:320,overflow:`auto`},children:[xm.map(t=>(0,w.jsxs)(`label`,{className:`edge-menu-item`,title:t.notImpl?`NOT_IMPL:当前 sprint 未触发,保留枚举常量`:``,style:{display:`flex`,alignItems:`center`,gap:8,padding:`6px 8px`,cursor:t.notImpl?`not-allowed`:`pointer`,borderRadius:4,fontSize:12.5,opacity:t.notImpl?.42:1},onMouseDown:e=>e.preventDefault(),children:[(0,w.jsx)(`input`,{type:`checkbox`,disabled:t.notImpl,checked:e.includes(t.value),onChange:()=>!t.notImpl&&i(t.value)}),(0,w.jsx)(`span`,{style:{color:S.ink2},children:t.label}),(0,w.jsx)(`span`,{style:{marginLeft:`auto`,fontSize:10,color:S.ink4,fontFamily:`ui-monospace`},children:t.value})]},t.value)),(0,w.jsx)(`div`,{style:{borderTop:`1px solid ${S.border}`,marginTop:4,padding:6,textAlign:`right`},children:(0,w.jsx)(`button`,{onClick:()=>{r(!1)},className:`edge-press edge-btn-secondary`,style:{...gd,height:26,padding:`0 10px`,fontSize:11.5},children:`完成`})})]})})]})}var km={padding:`10px 14px`,textAlign:`left`,borderBottom:`1px solid ${S.border}`},Am={padding:`10px 14px`,verticalAlign:`top`},jm=e=>({padding:`6px 14px`,border:`1px solid ${S.border}`,borderRadius:6,background:e?S.surfaceAlt:S.surface,fontSize:12.5,color:e?S.ink4:S.ink2,cursor:e?`default`:`pointer`});function Mm(e){if(!e)return`-`;let t=new Date(e).getTime();if(isNaN(t))return e;let n=Date.now()-t;return n<6e4?`刚刚`:n<36e5?`${Math.floor(n/6e4)} 分钟前`:n<864e5?`${Math.floor(n/36e5)} 小时前`:`${Math.floor(n/864e5)} 天前`}function Nm(e){if(!e)return``;let t=new Date(e);return isNaN(t.getTime())?e:t.toLocaleString(`zh-CN`,{hour12:!1})}var Pm={RUNNING:`#22c55e`,STOPPED:`#94a3b8`,FATAL:`#ef4444`,STARTING:`#f59e0b`,BACKOFF:`#f59e0b`,EXITED:`#94a3b8`,UNKNOWN:`#94a3b8`},Fm=[`ALL`,`RUNNING`,`STOPPED`,`FATAL`],Im=typeof window<`u`?window.location.hostname:`localhost`;function Lm(e,t){if(!e||!t||e<=0)return``;let n=t-e;return n<60?`${n}s`:n<3600?`${Math.floor(n/60)}m`:n<86400?`${Math.floor(n/3600)}h ${Math.floor(n%3600/60)}m`:`${Math.floor(n/86400)}d ${Math.floor(n%86400/3600)}h`}function Rm({label:e,count:t,color:n,active:r,onClick:i}){return(0,w.jsxs)(`button`,{onClick:i,style:{display:`inline-flex`,alignItems:`center`,gap:5,padding:`4px 10px`,borderRadius:12,background:r?n+`18`:`white`,border:`1px solid ${r?n:S.border}`,fontSize:12,fontWeight:r?600:400,color:r?n:S.ink2,cursor:`pointer`},children:[e,(0,w.jsx)(`span`,{style:{fontSize:11,fontWeight:700,color:`white`,background:n,borderRadius:8,padding:`1px 6px`,minWidth:18,textAlign:`center`},children:t})]})}function zm({proc:e,onViewLog:t,onControl:n}){let r=Pm[e.statename]||`#94a3b8`,i=e.statename===`RUNNING`,a=e.port?`http://${Im}:${e.port}`:null,o=i&&a;return(0,w.jsxs)(`div`,{style:{background:`white`,borderRadius:8,border:`1px solid ${S.border}`,padding:`10px 14px`,display:`flex`,alignItems:`center`,gap:10},children:[(0,w.jsx)(`div`,{style:{width:8,height:8,borderRadius:`50%`,background:r,flexShrink:0,boxShadow:i?`0 0 6px ${r}60`:`none`}}),(0,w.jsxs)(`div`,{style:{flex:1,minWidth:0},children:[(0,w.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,gap:6},children:[(0,w.jsx)(`span`,{style:{fontSize:13,fontWeight:600,color:S.ink},children:e.name}),(0,w.jsx)(`span`,{style:{fontSize:10,padding:`1px 6px`,borderRadius:4,background:S.blueSoft,color:S.blueDeep},children:e.group})]}),(0,w.jsxs)(`div`,{style:{fontSize:11,color:S.ink3,marginTop:2,display:`flex`,alignItems:`center`,gap:5,flexWrap:`wrap`},children:[i&&e.pid>0&&(0,w.jsxs)(`span`,{children:[`PID `,e.pid]}),e.port&&(o?(0,w.jsxs)(`a`,{href:a,target:`_blank`,rel:`noreferrer`,onClick:e=>e.stopPropagation(),title:`打开 ${a}`,style:{display:`inline-flex`,alignItems:`center`,gap:2,color:S.blueDeep,fontWeight:600,textDecoration:`none`},children:[`:`,e.port,(0,w.jsx)(D,{name:`external`,size:10,stroke:2})]}):(0,w.jsxs)(`span`,{children:[`:`,e.port]})),i&&(0,w.jsx)(`span`,{children:Lm(e.start,e.now)}),!i&&(0,w.jsx)(`span`,{children:e.statename})]}),e.directory&&(0,w.jsxs)(`div`,{title:e.directory,style:{fontSize:10.5,color:S.ink3,marginTop:2,display:`flex`,alignItems:`center`,gap:4,whiteSpace:`nowrap`,overflow:`hidden`,textOverflow:`ellipsis`},children:[(0,w.jsx)(D,{name:`folder`,size:11,stroke:1.6,style:{flexShrink:0,opacity:.7}}),(0,w.jsx)(`span`,{style:{overflow:`hidden`,textOverflow:`ellipsis`},children:e.directory})]})]}),(0,w.jsxs)(`div`,{style:{display:`flex`,gap:4,flexShrink:0},children:[o&&(0,w.jsx)(`a`,{href:a,target:`_blank`,rel:`noreferrer`,title:`打开服务`,style:{...Bm,color:S.blueDeep,textDecoration:`none`},children:(0,w.jsx)(D,{name:`external`,size:13,stroke:1.8})}),(0,w.jsx)(`button`,{onClick:()=>t(e.name),title:`查看日志`,style:Bm,children:(0,w.jsx)(D,{name:`terminal`,size:13,stroke:1.8})}),i?(0,w.jsx)(`button`,{onClick:()=>n(e.name,`restart`),title:`重启`,style:Bm,children:(0,w.jsx)(D,{name:`refresh`,size:13,stroke:1.8})}):(0,w.jsx)(`button`,{onClick:()=>n(e.name,`start`),title:`启动`,style:{...Bm,color:`#22c55e`},children:(0,w.jsx)(D,{name:`play`,size:13,stroke:2})}),i&&(0,w.jsx)(`button`,{onClick:()=>n(e.name,`stop`),title:`停止`,style:{...Bm,color:`#ef4444`},children:(0,w.jsx)(D,{name:`stop`,size:13,stroke:2})})]})]})}var Bm={display:`inline-flex`,alignItems:`center`,justifyContent:`center`,width:28,height:28,borderRadius:6,background:`#f8fafc`,border:`1px solid ${S.border}`,color:S.ink2,cursor:`pointer`};function Vm({name:e,onClose:t}){let[n,r]=(0,b.useState)(``),[i,a]=(0,b.useState)(!0),o=(0,b.useRef)(null);return(0,b.useEffect)(()=>{a(!0),of(e).then(e=>{r(e.log||``),a(!1)}).catch(()=>{r(`Failed to fetch logs`),a(!1)})},[e]),(0,b.useEffect)(()=>{o.current&&(o.current.scrollTop=o.current.scrollHeight)},[n]),(0,w.jsx)(`div`,{style:{position:`fixed`,inset:0,background:`rgba(0,0,0,0.4)`,display:`flex`,alignItems:`center`,justifyContent:`center`,zIndex:1e3},onClick:t,children:(0,w.jsxs)(`div`,{onClick:e=>e.stopPropagation(),style:{width:`80%`,maxWidth:900,height:`70vh`,background:`#1e293b`,borderRadius:12,display:`flex`,flexDirection:`column`,boxShadow:`0 20px 60px rgba(0,0,0,0.3)`},children:[(0,w.jsxs)(`div`,{style:{padding:`10px 16px`,borderBottom:`1px solid #334155`,display:`flex`,alignItems:`center`,justifyContent:`space-between`},children:[(0,w.jsxs)(`span`,{style:{fontSize:13,fontWeight:600,color:`#e2e8f0`},children:[e,` — stdout`]}),(0,w.jsx)(`button`,{onClick:t,style:{background:`none`,border:`none`,color:`#94a3b8`,cursor:`pointer`,fontSize:18,lineHeight:1},children:`×`})]}),(0,w.jsx)(`pre`,{ref:o,style:{flex:1,margin:0,padding:14,overflow:`auto`,fontSize:12,lineHeight:1.6,color:`#cbd5e1`,fontFamily:`ui-monospace, "Cascadia Code", Menlo, monospace`,whiteSpace:`pre-wrap`,wordBreak:`break-all`},children:i?`Loading...`:n||`(empty)`})]})})}function Hm(){let{data:e,loading:t}=Jd(5e3),[n,r]=(0,b.useState)(`ALL`),[i,a]=(0,b.useState)(null),[o,s]=(0,b.useState)(null),c=e?.processes||[],l={ALL:c.length,RUNNING:c.filter(e=>e.statename===`RUNNING`).length,STOPPED:c.filter(e=>e.statename===`STOPPED`||e.statename===`EXITED`).length,FATAL:c.filter(e=>e.statename===`FATAL`).length},u=n===`ALL`?c:c.filter(e=>n===`STOPPED`?e.statename===`STOPPED`||e.statename===`EXITED`:e.statename===n),d={};u.forEach(e=>{d[e.group]||(d[e.group]={order:e.groupOrder,procs:[]}),d[e.group].procs.push(e)});let f=Object.entries(d).sort((e,t)=>e[1].order-t[1].order),p=(0,b.useCallback)(async(e,t)=>{s(e);try{await nf(e,t)}catch(e){console.error(`Control failed:`,e)}s(null)},[]);return(0,w.jsxs)(`div`,{style:{height:`100%`,display:`flex`,flexDirection:`column`,background:`#f8fafc`},children:[(0,w.jsxs)(`div`,{style:{padding:`10px 16px`,borderBottom:`1px solid ${S.borderSoft}`,background:S.surface,display:`flex`,alignItems:`center`,gap:12,flexShrink:0},children:[(0,w.jsx)(D,{name:`gear`,size:16,stroke:1.8,style:{color:S.ink2}}),(0,w.jsx)(`span`,{style:{fontSize:13,fontWeight:600,color:S.ink},children:`Supervisor`}),e?.hostname&&(0,w.jsxs)(`span`,{style:{fontSize:11.5,color:S.ink3},children:[e.hostname,` · `,e.ip]}),(0,w.jsx)(`div`,{style:{flex:1}}),(0,w.jsx)(`div`,{style:{display:`flex`,gap:6},children:Fm.map(e=>(0,w.jsx)(Rm,{label:e,count:l[e],color:e===`RUNNING`?`#22c55e`:e===`STOPPED`?`#94a3b8`:e===`FATAL`?`#ef4444`:S.blueDeep,active:n===e,onClick:()=>r(e)},e))})]}),(0,w.jsx)(`div`,{style:{flex:1,overflow:`auto`,padding:16},children:t&&c.length===0?(0,w.jsx)(`div`,{style:{textAlign:`center`,padding:40,color:S.ink3,fontSize:13},children:`Loading...`}):f.length===0?(0,w.jsx)(`div`,{style:{textAlign:`center`,padding:40,color:S.ink3,fontSize:13},children:n===`ALL`?`没有找到 Supervisor 进程`:`没有 ${n} 状态的进程`}):f.map(([e,{procs:t}])=>(0,w.jsxs)(`div`,{style:{marginBottom:20},children:[(0,w.jsxs)(`div`,{style:{fontSize:12,fontWeight:600,color:S.ink2,marginBottom:8,paddingLeft:2},children:[e,(0,w.jsxs)(`span`,{style:{fontWeight:400,color:S.ink3,marginLeft:6},children:[`(`,t.length,`)`]})]}),(0,w.jsx)(`div`,{style:{display:`flex`,flexDirection:`column`,gap:6},children:t.map(e=>(0,w.jsx)(zm,{proc:e,onViewLog:a,onControl:p},e.name))})]},e))}),i&&(0,w.jsx)(Vm,{name:i,onClose:()=>a(null)})]})}var Um={running:{bg:`#dcfce7`,fg:`#047857`,dot:`#22c55e`},"shut off":{bg:`#f1f5f9`,fg:`#475569`,dot:`#94a3b8`},paused:{bg:`#fef3c7`,fg:`#a16207`,dot:`#f59e0b`},crashed:{bg:`#fee2e2`,fg:`#991b1b`,dot:`#ef4444`},unknown:{bg:`#f1f5f9`,fg:`#64748b`,dot:`#94a3b8`}};function Wm(e){return Um[(e||``).toLowerCase()]||Um.unknown}function Gm(e){let t=Number(e)||0;return t>=1024**4?`${(t/1024**4).toFixed(1)} TB`:t>=1024**3?`${(t/1024**3).toFixed(1)} GB`:t>=1024**2?`${(t/1024**2).toFixed(1)} MB`:t>=1024?`${(t/1024).toFixed(0)} KB`:`${t} B`}function Km(e){return Gm((Number(e)||0)*1024)}function qm(e,t){return t?Math.max(0,Math.min(100,Math.round(e/t*100))):0}function Jm({state:e}){let t=Wm(e);return(0,w.jsxs)(`span`,{style:{display:`inline-flex`,alignItems:`center`,gap:6,height:24,padding:`0 9px`,borderRadius:12,background:t.bg,color:t.fg,fontSize:11.5,fontWeight:700},children:[(0,w.jsx)(`span`,{style:{width:7,height:7,borderRadius:`50%`,background:t.dot}}),e||`unknown`]})}function Ym({label:e,value:t,sub:n}){return(0,w.jsxs)(`div`,{style:{minHeight:76,padding:12,border:`1px solid ${S.border}`,borderRadius:8,background:S.surface},children:[(0,w.jsx)(`div`,{style:{fontSize:11,color:S.ink3,marginBottom:7},children:e}),(0,w.jsx)(`div`,{className:`tnum`,style:{fontSize:20,lineHeight:1,fontWeight:750,color:S.ink},children:t}),n&&(0,w.jsx)(`div`,{style:{fontSize:11,color:S.ink3,marginTop:7},children:n})]})}function Xm({icon:e,label:t,tone:n=`neutral`,disabled:r,onClick:i}){let a=n===`danger`?`#dc2626`:n===`ok`?`#047857`:S.ink2,o=n===`danger`?`#fecaca`:n===`ok`?`#bbf7d0`:S.border,s=n===`danger`?`#fff7f7`:n===`ok`?`#f0fdf4`:S.surface;return(0,w.jsxs)(`button`,{disabled:r,onClick:i,title:t,style:{height:32,padding:`0 11px`,borderRadius:7,display:`inline-flex`,alignItems:`center`,gap:7,background:r?`#f8fafc`:s,border:`1px solid ${r?S.borderSoft:o}`,color:r?S.ink4:a,fontSize:12,fontWeight:650,cursor:r?`not-allowed`:`pointer`},children:[(0,w.jsx)(D,{name:e,size:13,stroke:2}),t]})}function Zm({label:e,children:t,hint:n}){return(0,w.jsxs)(`label`,{style:{display:`flex`,flexDirection:`column`,gap:6,minWidth:0},children:[(0,w.jsx)(`span`,{style:{fontSize:11.5,color:S.ink3,fontWeight:650},children:e}),t,n&&(0,w.jsx)(`span`,{style:{fontSize:10.5,color:S.ink4},children:n})]})}var Qm={height:34,borderRadius:7,border:`1px solid ${S.border}`,background:S.surface,color:S.ink,padding:`0 10px`,fontSize:12.5,outline:`none`,minWidth:0};function $m({vm:e,active:t,onClick:n}){let r=qm(e.memory?.usedKiB||e.memory?.actualKiB||0,e.memory?.maxKiB||0),i=(e.disks?.length||0)+(e.filesystems?.length||0);return(0,w.jsxs)(`button`,{onClick:n,style:{width:`100%`,padding:12,borderRadius:8,textAlign:`left`,border:`1px solid ${t?`#bfdbfe`:S.border}`,background:t?S.blueSoft:S.surface,cursor:`pointer`,display:`grid`,gridTemplateColumns:`1fr auto`,gap:8},children:[(0,w.jsxs)(`div`,{style:{minWidth:0},children:[(0,w.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,gap:8,minWidth:0},children:[(0,w.jsx)(D,{name:`server`,size:15,stroke:1.8,style:{color:t?S.blueDeep:S.ink2,flexShrink:0}}),(0,w.jsx)(`span`,{style:{fontSize:13,fontWeight:750,color:S.ink,whiteSpace:`nowrap`,overflow:`hidden`,textOverflow:`ellipsis`},children:e.name})]}),(0,w.jsxs)(`div`,{style:{fontSize:11,color:S.ink3,marginTop:6},children:[e.vcpus||0,` vCPU · `,Km(e.memory?.maxKiB),` · `,i,` 设备`]}),(0,w.jsx)(`div`,{style:{marginTop:8,height:5,borderRadius:3,background:`#e2e8f0`,overflow:`hidden`},children:(0,w.jsx)(`div`,{style:{width:`${r}%`,height:`100%`,background:t?S.blue:`#64748b`}})})]}),(0,w.jsx)(Jm,{state:e.state})]})}function eh(e,t){let n=e?.target||``;return(t||[]).find(e=>e.source===n||e.target===n)?.target||n||`-`}function th({disks:e}){let t=(e||[]).filter(e=>e.device!==`cdrom`);return t.length?(0,w.jsxs)(`table`,{style:{width:`100%`,borderCollapse:`collapse`},children:[(0,w.jsx)(`thead`,{children:(0,w.jsx)(`tr`,{style:{background:`#f8fafc`},children:[`目标`,`容量`,`已分配`,`读写`,`路径`].map(e=>(0,w.jsx)(`th`,{style:{padding:`8px 10px`,textAlign:e===`路径`?`left`:`right`,fontSize:10.5,color:S.ink3,fontWeight:700,borderBottom:`1px solid ${S.borderSoft}`},children:e},e))})}),(0,w.jsx)(`tbody`,{children:t.map(e=>(0,w.jsxs)(`tr`,{style:{borderTop:`1px solid ${S.borderSoft}`},children:[(0,w.jsx)(`td`,{style:{padding:`9px 10px`,fontSize:12,fontWeight:700,color:S.ink},children:e.target}),(0,w.jsx)(`td`,{className:`tnum`,style:rh,children:Gm(e.capacityBytes)}),(0,w.jsx)(`td`,{className:`tnum`,style:rh,children:Gm(e.physicalBytes||e.allocationBytes)}),(0,w.jsxs)(`td`,{className:`tnum`,style:rh,children:[Gm(e.readBytes),` / `,Gm(e.writeBytes)]}),(0,w.jsx)(`td`,{title:e.source,style:{padding:`9px 10px`,fontSize:11.5,color:S.ink2,fontFamily:`ui-monospace, monospace`,maxWidth:360,whiteSpace:`nowrap`,overflow:`hidden`,textOverflow:`ellipsis`},children:e.source||`-`})]},e.target))})]}):(0,w.jsx)(`div`,{style:{padding:14,color:S.ink3,fontSize:12},children:`暂无块设备`})}function nh({filesystems:e,mounts:t}){let n=e||[];return n.length?(0,w.jsxs)(`table`,{style:{width:`100%`,borderCollapse:`collapse`},children:[(0,w.jsx)(`thead`,{children:(0,w.jsx)(`tr`,{style:{background:`#f8fafc`},children:[`类型`,`Host 路径`,`Guest 挂载点`,`模式`].map(e=>(0,w.jsx)(`th`,{style:{padding:`8px 10px`,textAlign:e===`Host 路径`?`left`:`right`,fontSize:10.5,color:S.ink3,fontWeight:700,borderBottom:`1px solid ${S.borderSoft}`},children:e},e))})}),(0,w.jsx)(`tbody`,{children:n.map(e=>{let n=eh(e,t);return(0,w.jsxs)(`tr`,{style:{borderTop:`1px solid ${S.borderSoft}`},children:[(0,w.jsx)(`td`,{style:{padding:`9px 10px`,fontSize:12,fontWeight:700,color:S.ink,textAlign:`right`},children:e.driver||e.type||`-`}),(0,w.jsx)(`td`,{title:e.source,style:{padding:`9px 10px`,fontSize:11.5,color:S.ink2,fontFamily:`ui-monospace, monospace`,maxWidth:520,whiteSpace:`nowrap`,overflow:`hidden`,textOverflow:`ellipsis`},children:e.source||`-`}),(0,w.jsx)(`td`,{title:n,style:{padding:`9px 10px`,fontSize:11.5,color:S.ink2,textAlign:`right`,fontFamily:`ui-monospace, monospace`,whiteSpace:`nowrap`},children:n}),(0,w.jsx)(`td`,{style:rh,children:e.accessMode||`-`})]},`${e.source}-${e.target}`)})})]}):(0,w.jsx)(`div`,{style:{padding:14,color:S.ink3,fontSize:12},children:`暂无共享挂载`})}var rh={padding:`9px 10px`,textAlign:`right`,fontSize:12,color:S.ink2,fontFamily:`ui-monospace, monospace`,whiteSpace:`nowrap`};function ih(){let{data:e,loading:t,error:n,refresh:r}=Yd(5e3),[i,a]=(0,b.useState)(``),[o,s]=(0,b.useState)(``),[c,l]=(0,b.useState)(``),[u,d]=(0,b.useState)({vcpus:``,memoryMiB:``,autostart:!1}),f=Array.isArray(e)?e:[];(0,b.useEffect)(()=>{!i&&f.length&&a(f[0].name),i&&f.length&&!f.some(e=>e.name===i)&&a(f[0].name)},[i,f]);let p=(0,b.useMemo)(()=>f.find(e=>e.name===i)||f[0]||null,[f,i]);(0,b.useEffect)(()=>{p&&d({vcpus:String(p.vcpus||``),memoryMiB:String(Math.round((p.memory?.maxKiB||0)/1024)),autostart:!!p.autostart})},[p?.name,p?.vcpus,p?.memory?.maxKiB,p?.autostart]);let m=f.filter(e=>(e.state||``).toLowerCase()===`running`).length,h=f.filter(e=>(e.state||``).toLowerCase()===`shut off`).length,g=p?.guest?.memory,_=g?g.usedBytes:(p?.memory?.usedKiB||p?.memory?.actualKiB||0)*1024,v=g?g.totalBytes:(p?.memory?.maxKiB||0)*1024,y=g?g.availableBytes:(p?.memory?.usableKiB||p?.memory?.availableKiB||0)*1024,x=p?.guest?.loadAverage||[],C=p?.interfaces?.map(e=>e.address).filter(Boolean)||[],T=(p?.state||``).toLowerCase()===`running`,E=(p?.state||``).toLowerCase()===`shut off`,O=async e=>{if(!(!p||o)){s(e),l(``);try{await rf(p.name,e),l(`${p.name}: ${e} 已提交`),r()}catch(e){l(e.message||`操作失败`)}finally{s(``)}}},k=async()=>{if(!p||o)return;let e=Number(u.vcpus),t=Number(u.memoryMiB);if(!Number.isInteger(e)||e<1||e>128){l(`vCPU 必须是 1 到 128 的整数`);return}if(!Number.isInteger(t)||t<512){l(`内存必须是不小于 512 的 MiB 整数`);return}s(`config`),l(``);try{await af(p.name,{vcpus:e,memoryMiB:t,autostart:!!u.autostart}),l(T?`配置已保存;运行中 VM 需要重启后完全生效`:`配置已保存`),r()}catch(e){l(e.message||`保存配置失败`)}finally{s(``)}};return(0,w.jsxs)(`div`,{style:{flex:1,width:`100%`,minWidth:0,height:`100%`,display:`flex`,flexDirection:`column`,background:S.surfaceAlt,overflow:`hidden`},children:[(0,w.jsxs)(`div`,{style:{height:62,padding:`0 18px`,borderBottom:`1px solid ${S.border}`,background:S.surface,display:`flex`,alignItems:`center`,gap:14,flexShrink:0},children:[(0,w.jsx)(D,{name:`server`,size:18,stroke:1.8,style:{color:S.ink2}}),(0,w.jsxs)(`div`,{children:[(0,w.jsx)(`div`,{style:{fontSize:16,fontWeight:780,color:S.ink},children:`虚拟机管理`}),(0,w.jsxs)(`div`,{style:{fontSize:11.5,color:S.ink3,marginTop:2},children:[`libvirt 本机实例 · `,m,` 运行 · `,h,` 关机`]})]}),(0,w.jsx)(`div`,{style:{flex:1}}),c&&(0,w.jsx)(`div`,{style:{fontSize:12,color:c.includes(`失败`)||c.includes(`error`)?`#dc2626`:S.ink3},children:c}),(0,w.jsx)(Xm,{icon:`refresh`,label:`刷新`,disabled:t,onClick:r})]}),(0,w.jsxs)(`div`,{style:{flex:1,minHeight:0,width:`100%`,minWidth:0,display:`grid`,gridTemplateColumns:`320px minmax(0, 1fr)`},children:[(0,w.jsxs)(`aside`,{style:{borderRight:`1px solid ${S.border}`,background:`#f8fafc`,padding:14,overflow:`auto`},children:[t&&!f.length&&(0,w.jsx)(`div`,{style:{padding:20,color:S.ink3,fontSize:12},children:`加载虚拟机...`}),n&&!f.length&&(0,w.jsx)(`div`,{style:{padding:20,color:`#dc2626`,fontSize:12},children:`无法读取虚拟机列表`}),!t&&!f.length&&(0,w.jsx)(`div`,{style:{padding:20,color:S.ink3,fontSize:12},children:`没有发现 libvirt 虚拟机`}),(0,w.jsx)(`div`,{style:{display:`flex`,flexDirection:`column`,gap:8},children:f.map(e=>(0,w.jsx)($m,{vm:e,active:p?.name===e.name,onClick:()=>a(e.name)},e.name))})]}),(0,w.jsx)(`main`,{style:{minWidth:0,overflow:`auto`,padding:18},children:p?(0,w.jsxs)(`div`,{style:{display:`flex`,flexDirection:`column`,gap:14},children:[(0,w.jsxs)(`section`,{style:{border:`1px solid ${S.border}`,borderRadius:8,background:S.surface,padding:16,display:`grid`,gridTemplateColumns:`1fr auto`,gap:16},children:[(0,w.jsxs)(`div`,{style:{minWidth:0},children:[(0,w.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,gap:10},children:[(0,w.jsx)(`h2`,{style:{margin:0,fontSize:20,color:S.ink,letterSpacing:0},children:p.name}),(0,w.jsx)(Jm,{state:p.state})]}),(0,w.jsxs)(`div`,{style:{marginTop:8,fontSize:12,color:S.ink3,display:`flex`,gap:14,flexWrap:`wrap`},children:[(0,w.jsxs)(`span`,{children:[`UUID `,(0,w.jsx)(`span`,{className:`mono`,children:p.uuid||`-`})]}),(0,w.jsxs)(`span`,{children:[p.vcpus||0,` vCPU`]}),(0,w.jsxs)(`span`,{children:[`Autostart `,p.autostart?`enable`:`disable`]}),C.length>0&&(0,w.jsxs)(`span`,{children:[`IP `,C.join(`, `)]})]})]}),(0,w.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,gap:8,flexWrap:`wrap`,justifyContent:`flex-end`},children:[E&&(0,w.jsx)(Xm,{icon:`play`,label:`启动`,tone:`ok`,disabled:!!o,onClick:()=>O(`start`)}),T&&(0,w.jsx)(Xm,{icon:`refresh`,label:`重启`,disabled:!!o,onClick:()=>O(`reboot`)}),T&&(0,w.jsx)(Xm,{icon:`power`,label:`关机`,disabled:!!o,onClick:()=>O(`shutdown`)}),T&&(0,w.jsx)(Xm,{icon:`stop`,label:`强制断电`,tone:`danger`,disabled:!!o,onClick:()=>O(`destroy`)})]})]}),(0,w.jsxs)(`section`,{style:{display:`grid`,gridTemplateColumns:`repeat(4, minmax(140px, 1fr))`,gap:10},children:[(0,w.jsx)(Ym,{label:`CPU 时间`,value:`${Math.round(p.cpuTimeSec||0)}s`,sub:`${p.vcpus||0} 个 vCPU`}),(0,w.jsx)(Ym,{label:`内存`,value:`${qm(_,v)}%`,sub:`${Gm(_)} / ${Gm(v)}`}),(0,w.jsx)(Ym,{label:`可用内存`,value:Gm(y),sub:p.guest?.agentOK?`guest agent`:`libvirt balloon`}),(0,w.jsx)(Ym,{label:`Load`,value:x.length?x.map(e=>e.toFixed(2)).join(` / `):`-`,sub:p.guest?.agentOK?`1 / 5 / 15 min`:`guest agent 不可用`})]}),(0,w.jsxs)(`section`,{style:{border:`1px solid ${S.border}`,borderRadius:8,background:S.surface,padding:14,display:`flex`,flexDirection:`column`,gap:12},children:[(0,w.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,gap:8},children:[(0,w.jsx)(D,{name:`gear`,size:15,stroke:1.8,style:{color:S.ink2}}),(0,w.jsx)(`span`,{style:{fontSize:13,fontWeight:720,color:S.ink},children:`持久配置`}),(0,w.jsx)(`span`,{style:{fontSize:11.5,color:S.ink3},children:`写入 libvirt 配置`})]}),(0,w.jsxs)(`div`,{style:{display:`grid`,gridTemplateColumns:`repeat(auto-fit, minmax(150px, 1fr))`,gap:10,alignItems:`end`},children:[(0,w.jsx)(Zm,{label:`vCPU`,children:(0,w.jsx)(`input`,{type:`number`,min:`1`,max:`128`,step:`1`,value:u.vcpus,onChange:e=>d(t=>({...t,vcpus:e.target.value})),style:{...Qm,width:`100%`}})}),(0,w.jsx)(Zm,{label:`内存`,children:(0,w.jsxs)(`div`,{style:{position:`relative`},children:[(0,w.jsx)(`input`,{type:`number`,min:`512`,step:`512`,value:u.memoryMiB,onChange:e=>d(t=>({...t,memoryMiB:e.target.value})),style:{...Qm,width:`100%`,paddingRight:42}}),(0,w.jsx)(`span`,{style:{position:`absolute`,right:10,top:`50%`,transform:`translateY(-50%)`,fontSize:11.5,color:S.ink3,pointerEvents:`none`},children:`MiB`})]})}),(0,w.jsx)(Zm,{label:`开机自启`,children:(0,w.jsxs)(`button`,{onClick:()=>d(e=>({...e,autostart:!e.autostart})),style:{height:34,width:`100%`,borderRadius:7,border:`1px solid ${u.autostart?`#bbf7d0`:S.border}`,background:u.autostart?`#f0fdf4`:S.surface,color:u.autostart?`#047857`:S.ink2,display:`inline-flex`,alignItems:`center`,justifyContent:`center`,gap:7,fontSize:12.5,fontWeight:700,cursor:`pointer`},children:[(0,w.jsx)(D,{name:u.autostart?`check`:`minus`,size:13,stroke:2}),u.autostart?`已启用`:`未启用`]})}),(0,w.jsx)(Xm,{icon:`check`,label:o===`config`?`保存中`:`保存配置`,tone:`ok`,disabled:!!o,onClick:k})]}),T&&(0,w.jsxs)(`div`,{style:{paddingTop:2,fontSize:11.5,color:S.ink3,display:`flex`,alignItems:`center`,gap:6,flexWrap:`wrap`},children:[(0,w.jsx)(D,{name:`info`,size:12,stroke:1.8,style:{color:S.ink4}}),(0,w.jsx)(`span`,{children:`运行中 VM 的 vCPU/内存变更需重启后完整生效;开机自启立即生效。`})]})]}),(0,w.jsxs)(`section`,{style:{border:`1px solid ${S.border}`,borderRadius:8,background:S.surface,overflow:`hidden`},children:[(0,w.jsxs)(`div`,{style:{height:42,padding:`0 14px`,display:`flex`,alignItems:`center`,borderBottom:`1px solid ${S.borderSoft}`,gap:8},children:[(0,w.jsx)(D,{name:`hardDrive`,size:15,stroke:1.8,style:{color:S.ink2}}),(0,w.jsx)(`span`,{style:{fontSize:13,fontWeight:720,color:S.ink},children:`块设备`})]}),(0,w.jsx)(th,{disks:p.disks})]}),(0,w.jsxs)(`section`,{style:{border:`1px solid ${S.border}`,borderRadius:8,background:S.surface,overflow:`hidden`},children:[(0,w.jsxs)(`div`,{style:{height:42,padding:`0 14px`,display:`flex`,alignItems:`center`,borderBottom:`1px solid ${S.borderSoft}`,gap:8},children:[(0,w.jsx)(D,{name:`folder`,size:15,stroke:1.8,style:{color:S.ink2}}),(0,w.jsx)(`span`,{style:{fontSize:13,fontWeight:720,color:S.ink},children:`共享挂载`})]}),(0,w.jsx)(nh,{filesystems:p.filesystems,mounts:p.guest?.mounts})]}),(0,w.jsxs)(`section`,{style:{display:`grid`,gridTemplateColumns:`1fr 1fr`,gap:12},children:[(0,w.jsxs)(`div`,{style:{border:`1px solid ${S.border}`,borderRadius:8,background:S.surface,padding:14},children:[(0,w.jsx)(`div`,{style:{fontSize:13,fontWeight:720,color:S.ink,marginBottom:10},children:`网络`}),(p.interfaces||[]).length?p.interfaces.map(e=>(0,w.jsxs)(`div`,{style:{display:`grid`,gridTemplateColumns:`90px 1fr`,gap:8,padding:`7px 0`,borderTop:`1px solid ${S.borderSoft}`,fontSize:12,color:S.ink2},children:[(0,w.jsx)(`span`,{style:{fontWeight:700,color:S.ink},children:e.name}),(0,w.jsx)(`span`,{className:`mono`,children:e.address})]},`${e.name}-${e.address}`)):(0,w.jsx)(`div`,{style:{fontSize:12,color:S.ink3},children:`暂无租约地址`})]}),(0,w.jsxs)(`div`,{style:{border:`1px solid ${S.border}`,borderRadius:8,background:S.surface,padding:14},children:[(0,w.jsx)(`div`,{style:{fontSize:13,fontWeight:720,color:S.ink,marginBottom:10},children:`Memory Pressure`}),(p.guest?.memoryPressure||[]).length?p.guest.memoryPressure.map(e=>(0,w.jsxs)(`div`,{style:{display:`grid`,gridTemplateColumns:`70px repeat(3, 1fr)`,gap:8,padding:`7px 0`,borderTop:`1px solid ${S.borderSoft}`,fontSize:12,color:S.ink2},children:[(0,w.jsx)(`span`,{style:{fontWeight:700,color:S.ink},children:e.kind}),(0,w.jsxs)(`span`,{className:`tnum`,children:[`10s `,e.avg10.toFixed(2)]}),(0,w.jsxs)(`span`,{className:`tnum`,children:[`60s `,e.avg60.toFixed(2)]}),(0,w.jsxs)(`span`,{className:`tnum`,children:[`300s `,e.avg300.toFixed(2)]})]},e.kind)):(0,w.jsx)(`div`,{style:{fontSize:12,color:S.ink3},children:`guest agent 未返回压力数据`})]})]})]}):(0,w.jsx)(`div`,{style:{color:S.ink3,fontSize:13},children:`请选择虚拟机`})})]})]})}function ah(e,t,n){return e?n&&e>=n-5?`#dc2626`:t&&e>=t-5?`#b45309`:e>=70?`#f59e0b`:`#059669`:S.ink3}function oh({tempC:e,maxC:t,critC:n,w:r=220}){let i=n||t||100,a=Math.max(0,Math.min(100,e/i*100)),o=ah(e,t,n),s=t?t/i*100:null;return(0,w.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,gap:8},children:[(0,w.jsxs)(`div`,{style:{width:r,height:8,borderRadius:4,background:`#e2e8f0`,position:`relative`,overflow:`hidden`},children:[(0,w.jsx)(`div`,{style:{position:`absolute`,left:0,top:0,bottom:0,width:`${a}%`,background:o,transition:`width 400ms ease`}}),s!=null&&s<100&&(0,w.jsx)(`div`,{style:{position:`absolute`,top:0,bottom:0,left:`${s}%`,width:2,background:`#94a3b8`}})]}),(0,w.jsxs)(`div`,{style:{minWidth:60,fontSize:12,fontWeight:700,color:o,fontFamily:`"JetBrains Mono", ui-monospace, monospace`},children:[e?.toFixed(0),` °C`]})]})}function sh({label:e,value:t,unit:n,color:r=S.ink}){return(0,w.jsxs)(`div`,{children:[(0,w.jsx)(`div`,{style:{...S.type.caption,color:S.ink3,marginBottom:2},children:e}),(0,w.jsxs)(`div`,{className:`tnum`,style:{...S.type.title,fontWeight:700,color:r,fontFamily:`"JetBrains Mono", ui-monospace, monospace`,lineHeight:1.1},children:[t,n&&(0,w.jsx)(`span`,{style:{fontSize:11,marginLeft:4,color:S.ink3,fontWeight:500},children:n})]})]})}var ch={fontFamily:`"JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, monospace`};function lh(e){return e?e>=1024**4?(e/1024**4).toFixed(2)+` TiB`:e>=1024**3?(e/1024**3).toFixed(2)+` GiB`:e>=1024**2?(e/1024**2).toFixed(2)+` MiB`:e>=1024?(e/1024).toFixed(2)+` KiB`:e+` B`:`—`}function uh(e){if(!e)return`—`;let t=Math.floor(e/86400),n=Math.floor(e%86400/3600),r=Math.floor(e%3600/60),i=[];return t&&i.push(`${t} 天`),n&&i.push(`${n} 小时`),i.push(`${r} 分`),i.join(` `)}function dh(e){return e?{"2.5GT/s":`Gen1`,"5GT/s":`Gen2`,"8GT/s":`Gen3`,"16GT/s":`Gen4`,"32GT/s":`Gen5`,"64GT/s":`Gen6`}[e]||e:``}function fh(e){let t=e.classCode;return t===`0300`||t===`0302`||t===`0301`||t===`0380`?{kind:`gpu`,label:`显卡`,color:`#7c3aed`}:t===`0106`||t===`0101`||t===`0108`?{kind:`storage`,label:`存储`,color:`#0891b2`}:t===`0200`||t===`0280`?{kind:`net`,label:`网络`,color:`#0e7490`}:t===`0403`||t===`0401`?{kind:`audio`,label:`音频`,color:`#0d9488`}:t===`0c03`||t===`0c05`?{kind:`usb`,label:`USB`,color:`#64748b`}:t===`0604`||t===`0600`?{kind:`bridge`,label:`桥/根`,color:`#94a3b8`}:{kind:`other`,label:e.class||`其它`,color:`#94a3b8`}}function ph(e){try{navigator.clipboard.writeText(e)}catch{}}var mh={ok:{label:``,color:S.ink,bg:`transparent`,marker:``},empty:{label:`空槽`,color:`#94a3b8`,bg:`transparent`,marker:`·`},idle:{label:`省电`,color:`#94a3b8`,bg:`#f8fafc`,marker:`⚡`},downgrade:{label:`降级`,color:`#b45309`,bg:`#fef3c7`,marker:`⚠`}};function hh(e){return mh[e]||mh.ok}function gh(){let{data:e,loading:t}=Xd();return t&&!e?(0,w.jsx)(`div`,{style:{padding:40,color:S.ink3},children:`正在采集硬件清单…`}):e?(0,w.jsxs)(`div`,{style:{flex:1,width:`100%`,display:`flex`,flexDirection:`column`,height:`100%`,background:S.canvas||`#f8fafc`},children:[(0,w.jsx)(_h,{data:e}),(0,w.jsx)(`div`,{style:{flex:1,overflow:`hidden`},children:(0,w.jsx)(vh,{data:e})})]}):(0,w.jsx)(`div`,{style:{padding:40,color:S.ink3},children:`硬件采集失败。`})}function _h({data:e}){return(0,w.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,gap:10,padding:`10px 20px`,borderBottom:`1px solid ${S.border}`,background:`white`,flexShrink:0},children:[(0,w.jsx)(`div`,{style:{...S.type.heading,color:S.ink},children:`硬件中心`}),(0,w.jsxs)(`div`,{style:{color:S.ink3,fontSize:12},children:[`· `,e.os?.hostname,` · 采集于 `,new Date(e.collectedAt).toLocaleTimeString()]})]})}function vh({data:e}){let t=[{id:`overview`,name:`概览`,icon:`dashboard`},{id:`sensors`,name:`传感器`,icon:`bell`},{id:`gpu`,name:`显卡`,icon:`sparkle`},{id:`cpu`,name:`CPU`,icon:`cpu`},{id:`memory`,name:`内存`,icon:`cpu`},{id:`storage`,name:`存储`,icon:`hardDrive`},{id:`network`,name:`网络`,icon:`network`},{id:`pcie`,name:`PCIe`,icon:`cpu`},{id:`system`,name:`BIOS/主板`,icon:`gear`}],[n,r]=(0,b.useState)(`overview`);return(0,w.jsxs)(`div`,{style:{display:`flex`,height:`100%`,width:`100%`},children:[(0,w.jsx)(`aside`,{style:{width:180,flexShrink:0,borderRight:`1px solid ${S.border}`,background:`white`,overflow:`auto`,padding:`10px 0`},children:t.map(e=>(0,w.jsxs)(`button`,{onClick:()=>r(e.id),style:{display:`flex`,alignItems:`center`,gap:8,width:`100%`,padding:`9px 16px`,border:`none`,background:n===e.id?S.blueSoft:`transparent`,color:n===e.id?S.blueDeep:S.ink2,fontSize:13,fontWeight:n===e.id?600:500,cursor:`pointer`,textAlign:`left`,borderLeft:`3px solid ${n===e.id?S.blueDeep:`transparent`}`},children:[(0,w.jsx)(D,{name:e.icon,size:15}),e.name]},e.id))}),(0,w.jsxs)(`main`,{style:{flex:1,minWidth:0,overflow:`auto`,padding:20},children:[n===`overview`&&(0,w.jsx)(xh,{data:e}),n===`sensors`&&(0,w.jsx)(Nh,{data:e}),n===`gpu`&&(0,w.jsx)(Eh,{data:e}),n===`cpu`&&(0,w.jsx)(Oh,{data:e}),n===`memory`&&(0,w.jsx)(kh,{data:e}),n===`storage`&&(0,w.jsx)(Ah,{data:e}),n===`network`&&(0,w.jsx)(jh,{data:e}),n===`pcie`&&(0,w.jsx)(Mh,{data:e}),n===`system`&&(0,w.jsx)(Ph,{data:e})]})]})}function yh({title:e,cmd:t,children:n,action:r}){return(0,w.jsxs)(`div`,{style:{background:`white`,border:`1px solid ${S.border}`,borderRadius:10,marginBottom:16},children:[(0,w.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,gap:10,padding:`10px 14px`,borderBottom:`1px solid ${S.borderSoft||`#f1f5f9`}`},children:[(0,w.jsx)(`div`,{style:{fontSize:13.5,fontWeight:700,color:S.ink},children:e}),t&&(0,w.jsxs)(`button`,{onClick:()=>ph(t),style:{padding:`2px 8px`,fontSize:10.5,borderRadius:4,background:`#f1f5f9`,color:S.ink3,border:`1px solid ${S.border}`,cursor:`pointer`,...ch},children:[`复制 `,t]}),(0,w.jsx)(`div`,{style:{flex:1}}),r]}),(0,w.jsx)(`div`,{style:{padding:14},children:n})]})}function Q({k:e,v:t,warn:n,mono:r=!0}){return(0,w.jsxs)(`div`,{style:{display:`flex`,gap:16,padding:`5px 0`,borderBottom:`1px dashed ${S.borderSoft||`#f1f5f9`}`,alignItems:`baseline`},children:[(0,w.jsx)(`div`,{style:{width:150,color:S.ink3,fontSize:12.5,flexShrink:0},children:e}),(0,w.jsxs)(`div`,{style:{flex:1,fontSize:12.5,color:n?`#b45309`:S.ink,fontWeight:n?600:400,wordBreak:`break-word`,...r?ch:{}},children:[n&&(0,w.jsx)(`span`,{style:{marginRight:6},children:`⚠`}),t!=null&&t!==``?t:(0,w.jsx)(`span`,{style:{color:S.ink3},children:`—`})]})]})}function bh(){let{data:e}=Zd();if(!e)return null;let t=e.cpu||{},n=(e.gpus||[])[0];return(0,w.jsx)(yh,{title:`当前状态`,action:(0,w.jsx)(`span`,{style:{fontSize:11,color:S.ink3},children:`每 3 秒刷新`}),children:(0,w.jsxs)(`div`,{style:{display:`grid`,gridTemplateColumns:`repeat(3, 1fr)`,gap:20},children:[(0,w.jsxs)(`div`,{children:[(0,w.jsx)(`div`,{style:{fontSize:11,color:S.ink3,marginBottom:6},children:`CPU 包温度`}),(0,w.jsx)(oh,{tempC:t.packageTempC,maxC:t.maxTempC,critC:t.critTempC,w:180})]}),(0,w.jsx)(sh,{label:`CPU 包功耗 (RAPL)`,value:t.powerAvailable?t.packagePowerW.toFixed(1):`—`,unit:t.powerAvailable?`W`:``,color:S.blueDeep}),n&&(0,w.jsxs)(`div`,{children:[(0,w.jsxs)(`div`,{style:{fontSize:11,color:S.ink3,marginBottom:6},children:[`GPU 温度 · `,n.hwmon]}),(0,w.jsx)(oh,{tempC:n.tempC,maxC:n.maxTempC,critC:n.critTempC,w:180})]})]})})}function xh({data:e}){let t=(e.memory.dimms||[]).filter(e=>e.populated),n=(e.network||[]).filter(e=>!e.isVirtual),r=e.storage||[],i=e.gpus||[],a=e.pcie||[],o=a.filter(e=>e.linkStatus===`downgrade`),s=a.filter(e=>e.linkStatus===`idle`),c=a.filter(e=>e.linkStatus===`empty`),l=i.filter(e=>e.driver===`nouveau`),u=o.length>0||l.length>0;return(0,w.jsxs)(`div`,{children:[(0,w.jsxs)(yh,{title:`系统身份`,children:[(0,w.jsx)(Q,{k:`主机名`,v:e.os.hostname}),(0,w.jsx)(Q,{k:`发行版`,v:e.os.distro}),(0,w.jsx)(Q,{k:`内核 / 架构`,v:`${e.os.kernel} · ${e.os.arch}`}),(0,w.jsx)(Q,{k:`运行时长`,v:uh(e.os.uptimeSeconds),mono:!1})]}),(0,w.jsxs)(yh,{title:`硬件摘要`,children:[(0,w.jsx)(Q,{k:`主板`,v:e.board.available?`${e.board.manufacturer} ${e.board.product}`:`—`}),(0,w.jsx)(Q,{k:`BIOS`,v:e.bios.available?`${e.bios.vendor} · ${e.bios.version} · ${e.bios.date}`:`—`}),(0,w.jsx)(Q,{k:`CPU`,v:`${e.cpu.model||`—`} · ${e.cpu.cores||`?`} 核 / ${e.cpu.threads||`?`} 线程`}),(0,w.jsx)(Q,{k:`内存`,v:`${lh(e.memory.totalBytes)} · ${t.length} / ${e.memory.dimms?.length||`?`} DIMM 已插`}),(0,w.jsx)(Q,{k:`GPU`,v:i.length?i.map(e=>e.model).join(` · `):`未检测到独立显卡`}),(0,w.jsx)(Q,{k:`存储`,v:`${r.length} 块磁盘 · 合计 ${lh(r.reduce((e,t)=>e+(t.sizeBytes||0),0))}`}),(0,w.jsx)(Q,{k:`物理网卡`,v:`${n.length} 个 · 虚拟接口 ${(e.network||[]).length-n.length} 个`}),(0,w.jsx)(Q,{k:`PCIe`,v:`${a.length} 个设备 · 空槽 ${c.length} · 省电空闲 ${s.length} · 真降级 ${o.length}`,mono:!1})]}),(0,w.jsx)(bh,{}),u&&(0,w.jsxs)(yh,{title:`⚠ 检查异常`,children:[l.map(e=>(0,w.jsx)(Q,{k:`GPU 驱动`,warn:!0,mono:!1,v:`${e.pciAddress} 使用 nouveau 开源驱动 (无 CUDA),AI 场景应改用 NVIDIA 官方驱动`},e.pciAddress)),o.map(e=>(0,w.jsx)(Q,{k:`PCIe 真降级`,warn:!0,mono:!1,v:`${e.address} ${e.device} · 能力 ${dh(e.linkGenCap)} ${e.linkWidCap},当前 ${dh(e.linkGenCur)} ${e.linkWidCur}`},e.address))]}),!u&&(0,w.jsxs)(yh,{title:`检查结果`,children:[(0,w.jsx)(`div`,{style:{color:`#059669`,fontWeight:600,fontSize:13},children:`无异常。`}),s.length>0&&(0,w.jsxs)(`div`,{style:{color:S.ink3,fontSize:12,marginTop:6},children:[`有 `,s.length,` 个设备处于 PCIe ASPM 省电空闲,实际使用时会自动升速,非故障。`]})]})]})}function Sh(e){return e.fanKnown?e.source===`nvidia-smi`?{value:e.fanPct??0,unit:`%`}:{value:e.fanRpm??0,unit:`RPM`}:{value:`—`,unit:``}}function Ch(){let{data:e}=Zd(),t=e?.gpus||[];return t.length?(0,w.jsx)(yh,{title:`当前状态`,cmd:t[0].source===`nvidia-smi`?`nvidia-smi -q -d TEMPERATURE,POWER,UTILIZATION`:void 0,action:(0,w.jsxs)(`span`,{style:{fontSize:11,color:S.ink3},children:[`每 3 秒刷新 · 来源 `,t[0].source]}),children:t.map((e,n)=>{let r=Sh(e);return(0,w.jsxs)(`div`,{style:{marginBottom:ne.powerLimitW*.9?`#dc2626`:S.blueDeep}),e.powerKnown&&(0,w.jsx)(sh,{label:`Util`,value:e.utilPct,unit:`%`,color:e.utilPct>=80?`#059669`:S.ink}),!e.powerKnown&&(0,w.jsx)(sh,{label:`功耗`,value:`—`,unit:``,color:S.ink3})]}),e.powerKnown&&(0,w.jsxs)(`div`,{style:{display:`grid`,gridTemplateColumns:`1fr 1fr 1fr`,gap:20,marginTop:12},children:[(0,w.jsxs)(`div`,{children:[(0,w.jsx)(`div`,{style:{fontSize:11,color:S.ink3,marginBottom:4},children:`显存`}),(0,w.jsxs)(`div`,{style:{fontSize:13,fontWeight:700,...ch,color:e.memUsedMiB/e.memTotalMiB>.9?`#dc2626`:S.ink},children:[e.memUsedMiB,` / `,e.memTotalMiB,` `,(0,w.jsx)(`span`,{style:{fontSize:11,color:S.ink3},children:`MiB`})]}),(0,w.jsx)(`div`,{style:{width:`100%`,height:5,background:`#e2e8f0`,borderRadius:3,marginTop:4,overflow:`hidden`},children:(0,w.jsx)(`div`,{style:{width:`${e.memUsedMiB/e.memTotalMiB*100}%`,height:`100%`,background:S.blueDeep,transition:`width 400ms ease`}})})]}),(0,w.jsxs)(`div`,{children:[(0,w.jsx)(`div`,{style:{fontSize:11,color:S.ink3,marginBottom:4},children:`P-State`}),(0,w.jsx)(`div`,{style:{fontSize:13,fontWeight:700,...ch,color:S.ink},children:e.pState||`—`}),(0,w.jsx)(`div`,{style:{fontSize:10.5,color:S.ink3,marginTop:2},children:`P0 = 满速, P8/12 = 深度省电`})]}),(0,w.jsxs)(`div`,{children:[(0,w.jsx)(`div`,{style:{fontSize:11,color:S.ink3,marginBottom:4},children:`PCIe 地址`}),(0,w.jsx)(`div`,{style:{fontSize:13,fontWeight:700,...ch,color:S.ink},children:e.pciAddress})]})]}),!e.powerKnown&&(0,w.jsx)(`div`,{style:{marginTop:10,fontSize:10.5,color:S.ink3},children:`当前从 sysfs hwmon 读取。装了 NVIDIA 官方驱动 (nvidia-smi) 后可拿到功耗 / util / 显存 / P-State。`})]},n)})}):null}var wh=[{group:`PCIe / 硬件`,desc:`完整 PCIe 配置和链路信息`,cmd:e=>`lspci -vvv -s ${e}`},{group:`PCIe / 硬件`,desc:`拓扑树,看 GPU 挂在哪根总线`,cmd:()=>`lspci -tvnnmm`},{group:`PCIe / 硬件`,desc:`当前 PCIe 链路速率/宽度`,cmd:e=>`lspci -vv -s ${e} | grep -E 'LnkCap|LnkSta'`},{group:`内核模块`,desc:`看当前用的是哪个驱动`,cmd:()=>`lsmod | grep -iE "nvidia|nouveau|amdgpu"`},{group:`内核模块`,desc:`nouveau/nvidia 冲突排查`,cmd:()=>`dmesg | grep -iE "nvidia|nouveau|drm" | tail -30`},{group:`NVIDIA (需官方驱动)`,desc:`完整状态 (温度/功耗/进程)`,cmd:()=>`nvidia-smi -q`},{group:`NVIDIA (需官方驱动)`,desc:`紧凑指标 CSV,方便脚本采集`,cmd:()=>`nvidia-smi --query-gpu=name,driver_version,utilization.gpu,memory.used,memory.total,temperature.gpu,power.draw --format=csv`},{group:`NVIDIA (需官方驱动)`,desc:`多卡拓扑 (NVLink / PCIe / SYS)`,cmd:()=>`nvidia-smi topo -m`},{group:`NVIDIA (需官方驱动)`,desc:`看 CUDA / driver 版本`,cmd:()=>`nvidia-smi --query-gpu=driver_version --format=csv,noheader && nvcc --version`},{group:`nouveau (当前驱动)`,desc:`看当前功率/频率状态`,cmd:()=>`cat /sys/kernel/debug/dri/*/pstate 2>/dev/null || echo "需 root 且加载 debugfs"`},{group:`OpenGL / 图形栈`,desc:`OpenGL 后端和 renderer`,cmd:()=>`glxinfo -B | head -20`},{group:`OpenGL / 图形栈`,desc:`VA-API 硬解能力`,cmd:()=>`vainfo`}];function Th({pciAddress:e}){let t={};for(let e of wh)t[e.group]||(t[e.group]=[]),t[e.group].push(e);return(0,w.jsx)(yh,{title:`常用诊断命令`,action:(0,w.jsx)(`span`,{style:{fontSize:11,color:S.ink3},children:`点复制到剪贴板`}),children:Object.entries(t).map(([t,n])=>(0,w.jsxs)(`div`,{style:{marginBottom:12},children:[(0,w.jsx)(`div`,{style:{fontSize:11.5,color:S.ink3,fontWeight:600,marginBottom:4},children:t}),n.map((t,n)=>{let r=t.cmd(e);return(0,w.jsxs)(`button`,{onClick:()=>ph(r),className:`edge-press edge-row-hover`,style:{display:`flex`,gap:10,alignItems:`baseline`,width:`100%`,textAlign:`left`,border:`none`,background:`transparent`,cursor:`pointer`,padding:`5px 6px`,borderRadius:6,borderBottom:`1px dashed ${S.borderSoft||`#f1f5f9`}`},children:[(0,w.jsx)(`span`,{style:{fontSize:11.5,color:S.ink3,minWidth:200,flexShrink:0},children:t.desc}),(0,w.jsx)(`span`,{style:{...ch,fontSize:12,color:S.ink,flex:1,wordBreak:`break-all`},children:r}),(0,w.jsx)(`span`,{style:{fontSize:10,color:S.blueDeep,fontWeight:600,padding:`1px 6px`,borderRadius:4,background:S.blueSoft,flexShrink:0},children:`复制`})]},n)})]},t))})}function Eh({data:e}){let t=e.gpus||[];return t.length?(0,w.jsxs)(w.Fragment,{children:[(0,w.jsx)(Ch,{}),t.map((e,t)=>{let n=hh(e.linkStatus);return(0,w.jsxs)(yh,{title:`显卡 #${t+1} · ${e.pciAddress}`,cmd:`lspci -vvv -s ${e.pciAddress}`,children:[(0,w.jsx)(Q,{k:`设备`,v:e.model}),(0,w.jsx)(Q,{k:`设备类`,v:e.class}),(0,w.jsx)(Q,{k:`驱动`,v:e.driver,warn:e.driver===`nouveau`}),(0,w.jsx)(Q,{k:`PCIe 能力`,v:`${dh(e.linkGenCap)} ${e.linkWidCap}`}),(0,w.jsx)(Q,{k:`PCIe 协商`,v:(0,w.jsxs)(`span`,{children:[dh(e.linkGenCur),` `,e.linkWidCur,e.linkStatus&&e.linkStatus!==`ok`&&(0,w.jsxs)(`span`,{style:{marginLeft:8,fontSize:11,padding:`1px 6px`,borderRadius:4,color:n.color,background:n.bg,border:`1px solid ${n.color}22`},children:[n.marker,` `,n.label]})]}),warn:e.linkStatus===`downgrade`}),e.linkStatus===`idle`&&(0,w.jsx)(Q,{k:`说明`,mono:!1,v:`宽度打满、代降低 —— 典型 ASPM 省电空闲。实际有 CUDA/图形负载时会自动升到 Gen 上限。`}),e.driver===`nouveau`&&(0,w.jsx)(Q,{k:`建议`,warn:!0,mono:!1,v:`当前使用 nouveau 开源驱动,缺失 CUDA/NVENC 支持。生产用途请安装 NVIDIA 官方驱动 + CUDA 工具链。`})]},e.pciAddress)}),(0,w.jsx)(Th,{pciAddress:t[0].pciAddress})]}):(0,w.jsx)(`div`,{style:{color:S.ink3},children:`未检测到独立显卡。`})}function Dh(){let{data:e}=Zd(),t=e?.cpu;return t?(0,w.jsxs)(yh,{title:`当前状态`,action:(0,w.jsx)(`span`,{style:{fontSize:11,color:S.ink3},children:`每 3 秒刷新`}),children:[(0,w.jsxs)(`div`,{style:{display:`grid`,gridTemplateColumns:`1fr 1fr`,gap:20},children:[(0,w.jsxs)(`div`,{children:[(0,w.jsx)(`div`,{style:{fontSize:11,color:S.ink3,marginBottom:6},children:`包温度`}),(0,w.jsx)(oh,{tempC:t.packageTempC,maxC:t.maxTempC,critC:t.critTempC}),(0,w.jsxs)(`div`,{style:{fontSize:10.5,color:S.ink3,marginTop:4,...ch},children:[`阈值: max `,t.maxTempC,`°C · crit `,t.critTempC,`°C`]})]}),(0,w.jsxs)(`div`,{children:[(0,w.jsx)(sh,{label:`包功耗 (Intel RAPL)`,value:t.powerAvailable?t.packagePowerW.toFixed(1):`—`,unit:t.powerAvailable?`W`:``,color:t.packagePowerW>100?`#dc2626`:S.blueDeep}),!t.powerAvailable&&(0,w.jsx)(`div`,{style:{fontSize:10.5,color:S.ink3,marginTop:4},children:t.powerReason})]})]}),t.coreTemps?.length>0&&(0,w.jsxs)(`div`,{style:{marginTop:14},children:[(0,w.jsx)(`div`,{style:{fontSize:11,color:S.ink3,marginBottom:6},children:`每核温度`}),(0,w.jsx)(`div`,{style:{display:`grid`,gridTemplateColumns:`repeat(auto-fill, minmax(180px, 1fr))`,gap:8},children:t.coreTemps.map(e=>(0,w.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,gap:8},children:[(0,w.jsx)(`div`,{style:{...ch,fontSize:11,color:S.ink3,minWidth:55},children:e.label}),(0,w.jsx)(`div`,{style:{flex:1},children:(0,w.jsx)(oh,{tempC:e.tempC,maxC:e.maxC,critC:e.critC,w:90})})]},e.label))})]})]}):null}function Oh({data:e}){let t=e.cpu;return(0,w.jsxs)(w.Fragment,{children:[(0,w.jsx)(Dh,{}),(0,w.jsxs)(yh,{title:`CPU`,cmd:`lscpu`,children:[(0,w.jsx)(Q,{k:`型号`,v:t.model}),(0,w.jsx)(Q,{k:`厂商`,v:t.vendor}),(0,w.jsx)(Q,{k:`架构`,v:t.arch}),(0,w.jsx)(Q,{k:`槽位数`,v:t.sockets}),(0,w.jsx)(Q,{k:`物理核心`,v:t.cores}),(0,w.jsx)(Q,{k:`逻辑线程`,v:t.threads}),(0,w.jsx)(Q,{k:`频率`,v:t.maxMHz?`${t.minMHz?.toFixed(0)||`?`} - ${t.maxMHz.toFixed(0)} MHz`:`—`}),(0,w.jsx)(Q,{k:`虚拟化`,v:t.virt}),(0,w.jsx)(Q,{k:`指令集`,v:(t.flagsHint||[]).join(` `)}),(t.caches||[]).map(e=>(0,w.jsx)(Q,{k:e.split(`:`)[0],v:e.split(`:`).slice(1).join(`:`).trim()},e))]})]})}function kh({data:e}){let t=e.memory,n=(t.dimms||[]).filter(e=>e.populated);return(0,w.jsxs)(w.Fragment,{children:[(0,w.jsxs)(yh,{title:`内存总览`,children:[(0,w.jsx)(Q,{k:`总容量`,v:lh(t.totalBytes)}),(0,w.jsx)(Q,{k:`可用`,v:lh(t.availableBytes)}),(0,w.jsx)(Q,{k:`DIMM 插槽`,v:t.dimms?`${n.length} / ${t.dimms.length} 已插`:t.dimmsReason})]}),t.dimmsAvailable&&(0,w.jsxs)(yh,{title:`DIMM 详情`,cmd:`dmidecode -t memory`,action:(0,w.jsx)(`span`,{style:{fontSize:11,color:S.ink3},children:`仅显示已插入槽位`}),children:[n.length===0&&(0,w.jsx)(`div`,{style:{color:S.ink3},children:`无已插入的 DIMM。`}),n.length>0&&(0,w.jsxs)(`table`,{style:{width:`100%`,fontSize:12.5,...ch,borderCollapse:`collapse`},children:[(0,w.jsx)(`thead`,{children:(0,w.jsxs)(`tr`,{style:{color:S.ink3,textAlign:`left`,borderBottom:`1px solid ${S.border}`},children:[(0,w.jsx)(`th`,{style:{padding:`6px 4px`},children:`槽位`}),(0,w.jsx)(`th`,{children:`容量`}),(0,w.jsx)(`th`,{children:`类型`}),(0,w.jsx)(`th`,{children:`频率`}),(0,w.jsx)(`th`,{children:`厂商`}),(0,w.jsx)(`th`,{children:`Part No.`})]})}),(0,w.jsx)(`tbody`,{children:n.map((e,t)=>(0,w.jsxs)(`tr`,{style:{borderBottom:`1px dashed ${S.borderSoft||`#f1f5f9`}`},children:[(0,w.jsx)(`td`,{style:{padding:`6px 4px`,color:S.ink2},children:e.slot}),(0,w.jsx)(`td`,{children:lh(e.sizeBytes)}),(0,w.jsx)(`td`,{children:e.type||`—`}),(0,w.jsx)(`td`,{children:e.speedMTs?e.speedMTs+` MT/s`:`—`}),(0,w.jsx)(`td`,{children:e.manufacturer||`—`}),(0,w.jsx)(`td`,{children:e.partNumber||`—`})]},t))})]})]})]})}function Ah({data:e}){return(0,w.jsx)(yh,{title:`块设备`,cmd:`lsblk -O`,children:(0,w.jsxs)(`table`,{style:{width:`100%`,fontSize:12.5,...ch,borderCollapse:`collapse`},children:[(0,w.jsx)(`thead`,{children:(0,w.jsxs)(`tr`,{style:{color:S.ink3,textAlign:`left`,borderBottom:`1px solid ${S.border}`},children:[(0,w.jsx)(`th`,{style:{padding:`6px 4px`},children:`路径`}),(0,w.jsx)(`th`,{children:`型号`}),(0,w.jsx)(`th`,{children:`容量`}),(0,w.jsx)(`th`,{children:`介质`}),(0,w.jsx)(`th`,{children:`总线`}),(0,w.jsx)(`th`,{children:`挂载`})]})}),(0,w.jsx)(`tbody`,{children:(e.storage||[]).map(e=>(0,w.jsxs)(`tr`,{style:{borderBottom:`1px dashed ${S.borderSoft||`#f1f5f9`}`},children:[(0,w.jsx)(`td`,{style:{padding:`6px 4px`,color:S.ink2},children:e.path}),(0,w.jsx)(`td`,{children:e.model||e.vendor||`—`}),(0,w.jsx)(`td`,{children:lh(e.sizeBytes)}),(0,w.jsx)(`td`,{children:e.rotational?`HDD`:`SSD`}),(0,w.jsx)(`td`,{children:(e.transport||``).toUpperCase()}),(0,w.jsx)(`td`,{children:e.mountpoint||`—`})]},e.path))})]})})}function jh({data:e}){let t=(e.network||[]).filter(e=>!e.isVirtual),n=(e.network||[]).filter(e=>e.isVirtual);return(0,w.jsxs)(w.Fragment,{children:[(0,w.jsxs)(yh,{title:`物理网卡 · ${t.length} 个`,cmd:`ethtool `,children:[t.length===0&&(0,w.jsx)(`div`,{style:{color:S.ink3},children:`未识别到物理网卡。`}),t.map(e=>(0,w.jsxs)(`div`,{style:{marginBottom:12,paddingBottom:12,borderBottom:`1px dashed ${S.borderSoft||`#f1f5f9`}`},children:[(0,w.jsxs)(`div`,{style:{fontWeight:600,marginBottom:4,...ch},children:[e.name,(0,w.jsx)(`span`,{style:{marginLeft:8,fontSize:11,color:e.state===`UP`?`#059669`:S.ink3},children:e.state})]}),(0,w.jsx)(Q,{k:`驱动 / 固件`,v:`${e.driver||`—`} · ${e.fwVersion||`—`}`}),(0,w.jsx)(Q,{k:`链路`,v:`${e.linkSpeed||`—`}${e.linkDuplex?` · `+e.linkDuplex:``}`}),(0,w.jsx)(Q,{k:`MAC`,v:e.mac}),(0,w.jsx)(Q,{k:`MTU`,v:e.mtu}),(0,w.jsx)(Q,{k:`IPv4`,v:(e.ipv4||[]).join(`, `)||`—`})]},e.name))]}),(0,w.jsx)(yh,{title:`虚拟接口 · ${n.length} 个`,action:(0,w.jsx)(`span`,{style:{fontSize:11,color:S.ink3},children:`docker / bridge / veth / tun 等`}),children:(0,w.jsx)(`div`,{style:{...ch,fontSize:12,color:S.ink2,columnCount:3,columnGap:24},children:n.map(e=>(0,w.jsxs)(`div`,{style:{padding:`2px 0`},children:[e.name,` `,(0,w.jsxs)(`span`,{style:{color:S.ink3},children:[`(`,e.virtualKind,`)`]})]},e.name))})})]})}function Mh({data:e}){let t=e.pcie||[],n={downgrade:0,idle:0,empty:0,ok:0};for(let e of t)n[e.linkStatus||`ok`]++;let[r,i]=(0,b.useState)(`all`),a=r===`all`?t:t.filter(e=>(e.linkStatus||`ok`)===r),o=[{id:`all`,label:`全部`,n:t.length,color:S.ink3},{id:`downgrade`,label:`真降级`,n:n.downgrade,color:`#b45309`},{id:`idle`,label:`省电空闲`,n:n.idle,color:`#94a3b8`},{id:`empty`,label:`空槽`,n:n.empty,color:`#94a3b8`},{id:`ok`,label:`正常`,n:n.ok,color:`#059669`}];return(0,w.jsxs)(yh,{title:`PCIe 设备总览 · ${t.length} 个`,cmd:`lspci -vvv -nn`,action:(0,w.jsx)(`div`,{style:{display:`flex`,gap:4},children:o.map(e=>(0,w.jsxs)(`button`,{onClick:()=>i(e.id),style:{padding:`2px 8px`,fontSize:11,borderRadius:10,background:r===e.id?e.color+`18`:`white`,border:`1px solid ${r===e.id?e.color:S.border}`,color:r===e.id?e.color:S.ink3,fontWeight:r===e.id?700:500,cursor:`pointer`},children:[e.label,` `,(0,w.jsx)(`span`,{style:{opacity:.7},children:e.n})]},e.id))}),children:[(0,w.jsxs)(`table`,{style:{width:`100%`,fontSize:11.5,...ch,borderCollapse:`collapse`,tableLayout:`fixed`},children:[(0,w.jsxs)(`colgroup`,{children:[(0,w.jsx)(`col`,{style:{width:72}}),(0,w.jsx)(`col`,{style:{width:72}}),(0,w.jsx)(`col`,{}),(0,w.jsx)(`col`,{style:{width:110}}),(0,w.jsx)(`col`,{style:{width:90}}),(0,w.jsx)(`col`,{style:{width:130}})]}),(0,w.jsx)(`thead`,{children:(0,w.jsxs)(`tr`,{style:{color:S.ink3,textAlign:`left`,borderBottom:`1px solid ${S.border}`},children:[(0,w.jsx)(`th`,{style:{padding:`4px 4px`},children:`地址`}),(0,w.jsx)(`th`,{children:`类别`}),(0,w.jsx)(`th`,{children:`厂商 / 设备`}),(0,w.jsx)(`th`,{children:`驱动`}),(0,w.jsx)(`th`,{children:`PCIe 能力`}),(0,w.jsx)(`th`,{children:`PCIe 协商`})]})}),(0,w.jsx)(`tbody`,{children:a.map(e=>{let t=fh(e),n=hh(e.linkStatus);return(0,w.jsxs)(`tr`,{style:{borderBottom:`1px dashed ${S.borderSoft||`#f1f5f9`}`,background:n.bg,opacity:e.linkStatus===`empty`?.55:1},children:[(0,w.jsx)(`td`,{style:{padding:`4px 4px`,color:S.ink2},children:e.address}),(0,w.jsx)(`td`,{children:(0,w.jsx)(`span`,{style:{color:t.color,fontWeight:600},children:t.label})}),(0,w.jsx)(`td`,{style:{whiteSpace:`nowrap`,overflow:`hidden`,textOverflow:`ellipsis`},children:e.device}),(0,w.jsx)(`td`,{children:e.driver||(0,w.jsx)(`span`,{style:{color:S.ink3},children:`—`})}),(0,w.jsxs)(`td`,{children:[dh(e.linkGenCap),` `,e.linkWidCap]}),(0,w.jsxs)(`td`,{style:{color:n.color,fontWeight:e.linkStatus===`downgrade`?700:400},children:[n.marker&&(0,w.jsx)(`span`,{style:{marginRight:4},children:n.marker}),dh(e.linkGenCur),` `,e.linkWidCur,n.label&&(0,w.jsxs)(`span`,{style:{marginLeft:6,fontSize:10,opacity:.85},children:[`(`,n.label,`)`]})]})]},e.address)})})]}),(0,w.jsxs)(`div`,{style:{marginTop:12,fontSize:11,color:S.ink3,lineHeight:1.7},children:[(0,w.jsxs)(`div`,{children:[(0,w.jsx)(`b`,{children:`空槽`}),` = 桥/根端口的 downlink 报 x0,表示这个 PCIe 插槽没插东西。`]}),(0,w.jsxs)(`div`,{children:[(0,w.jsx)(`b`,{children:`省电空闲`}),` = 宽度打满、速率降级,是 ASPM 电源管理机制,有负载时自动升速。`]}),(0,w.jsxs)(`div`,{children:[(0,w.jsx)(`b`,{children:`真降级`}),` = 宽度实际低于设备能力,通常是主板槽位规格限制或物理接触问题。`]})]})]})}function Nh({data:e}){let{data:t}=Zd();if(!t)return(0,w.jsx)(`div`,{style:{color:S.ink3},children:`正在读取传感器…`});let n=t.cpu||{},r=t.gpus||[],i=t.fans||[];return(0,w.jsxs)(w.Fragment,{children:[(0,w.jsxs)(yh,{title:`CPU 温度 / 功耗`,action:(0,w.jsx)(`span`,{style:{fontSize:11,color:S.ink3},children:`每 3 秒刷新 · 采样 200ms`}),children:[(0,w.jsxs)(`div`,{style:{display:`grid`,gridTemplateColumns:`1fr 1fr 1fr`,gap:20,marginBottom:14},children:[(0,w.jsxs)(`div`,{children:[(0,w.jsx)(`div`,{style:{fontSize:11,color:S.ink3,marginBottom:6},children:`包温度`}),(0,w.jsx)(oh,{tempC:n.packageTempC,maxC:n.maxTempC,critC:n.critTempC})]}),(0,w.jsx)(sh,{label:`包功耗 (Intel RAPL)`,value:n.powerAvailable?n.packagePowerW.toFixed(1):`—`,unit:n.powerAvailable?`W`:``,color:S.blueDeep}),(0,w.jsx)(sh,{label:`最高核温`,value:n.coreTemps?.length?Math.max(...n.coreTemps.map(e=>e.tempC)).toFixed(0):`—`,unit:`°C`})]}),n.coreTemps?.length>0&&(0,w.jsxs)(`div`,{style:{marginTop:8},children:[(0,w.jsx)(`div`,{style:{fontSize:11,color:S.ink3,marginBottom:6},children:`每核温度`}),(0,w.jsx)(`div`,{style:{display:`grid`,gridTemplateColumns:`repeat(auto-fill, minmax(200px, 1fr))`,gap:8},children:n.coreTemps.map(e=>(0,w.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,gap:8},children:[(0,w.jsx)(`div`,{style:{...ch,fontSize:11,color:S.ink3,minWidth:55},children:e.label}),(0,w.jsx)(`div`,{style:{flex:1},children:(0,w.jsx)(oh,{tempC:e.tempC,maxC:e.maxC,critC:e.critC,w:100})})]},e.label))})]})]}),(0,w.jsxs)(yh,{title:`GPU · ${r.length} 个`,action:r[0]?.source&&(0,w.jsxs)(`span`,{style:{fontSize:11,color:S.ink3},children:[`数据来源 `,r[0].source]}),children:[r.length===0&&(0,w.jsx)(`div`,{style:{color:S.ink3},children:`未检测到独立显卡传感器。`}),r.map((e,t)=>{let n=Sh(e);return(0,w.jsxs)(`div`,{style:{padding:`10px 0`,borderBottom:te.powerLimitW*.9?`#dc2626`:S.blueDeep}),e.powerKnown&&(0,w.jsx)(sh,{label:`Util`,value:e.utilPct,unit:`%`,color:e.utilPct>=80?`#059669`:S.ink}),!e.powerKnown&&(0,w.jsx)(sh,{label:`功耗`,value:`—`,unit:``,color:S.ink3})]}),e.powerKnown&&(0,w.jsxs)(`div`,{style:{display:`grid`,gridTemplateColumns:`repeat(3, 1fr)`,gap:20},children:[(0,w.jsxs)(`div`,{children:[(0,w.jsx)(`div`,{style:{fontSize:11,color:S.ink3,marginBottom:4},children:`显存`}),(0,w.jsxs)(`div`,{style:{...ch,fontSize:13,fontWeight:700},children:[e.memUsedMiB,` / `,e.memTotalMiB,` `,(0,w.jsx)(`span`,{style:{fontSize:11,color:S.ink3},children:`MiB`})]}),(0,w.jsx)(`div`,{style:{width:`100%`,height:5,background:`#e2e8f0`,borderRadius:3,marginTop:4,overflow:`hidden`},children:(0,w.jsx)(`div`,{style:{width:`${e.memUsedMiB/e.memTotalMiB*100}%`,height:`100%`,background:S.blueDeep,transition:`width 400ms ease`}})})]}),(0,w.jsxs)(`div`,{children:[(0,w.jsx)(`div`,{style:{fontSize:11,color:S.ink3,marginBottom:4},children:`P-State`}),(0,w.jsx)(`div`,{style:{...ch,fontSize:13,fontWeight:700},children:e.pState||`—`})]}),(0,w.jsxs)(`div`,{children:[(0,w.jsx)(`div`,{style:{fontSize:11,color:S.ink3,marginBottom:4},children:`PCIe 地址`}),(0,w.jsx)(`div`,{style:{...ch,fontSize:13,fontWeight:700},children:e.pciAddress})]})]})]},t)}),r[0]?.source===`hwmon`&&(0,w.jsx)(`div`,{style:{marginTop:10,fontSize:10.5,color:S.ink3},children:`当前是 sysfs hwmon 数据源 (nouveau/amdgpu)。装 NVIDIA 官方驱动后自动切到 nvidia-smi,多出 功耗 / util / 显存 / P-State 四项。`})]}),i.length>0&&(0,w.jsx)(yh,{title:`机箱风扇 · ${i.length} 个`,children:(0,w.jsxs)(`table`,{style:{width:`100%`,fontSize:12,...ch},children:[(0,w.jsx)(`thead`,{children:(0,w.jsxs)(`tr`,{style:{color:S.ink3,textAlign:`left`},children:[(0,w.jsx)(`th`,{style:{padding:`4px 0`},children:`来源`}),(0,w.jsx)(`th`,{style:{textAlign:`right`},children:`转速`})]})}),(0,w.jsx)(`tbody`,{children:i.map((e,t)=>(0,w.jsxs)(`tr`,{children:[(0,w.jsx)(`td`,{children:e.source}),(0,w.jsxs)(`td`,{style:{textAlign:`right`,color:e.rpm>0?S.ink:S.ink3},children:[e.rpm,` RPM`]})]},t))})]})}),(0,w.jsx)(yh,{title:`能读到什么 / 读不到什么`,children:(0,w.jsxs)(`div`,{style:{fontSize:12,color:S.ink2,lineHeight:1.75},children:[(0,w.jsxs)(`div`,{children:[`✓ CPU 温度:`,(0,w.jsx)(`code`,{children:`/sys/class/hwmon/coretemp`}),` · 每核独立`]}),(0,w.jsxs)(`div`,{children:[`✓ CPU 功耗:`,(0,w.jsx)(`code`,{children:`/sys/class/powercap/intel-rapl`}),` · 采样 200ms 差分 (仅 Intel/较新 AMD)`]}),(0,w.jsxs)(`div`,{children:[`✓ GPU 温度/风扇/功耗/util/显存/P-State:`,(0,w.jsx)(`code`,{children:`nvidia-smi`}),` 优先,回退 `,(0,w.jsx)(`code`,{children:`/sys/class/hwmon/nouveau|amdgpu`})]}),(0,w.jsxs)(`div`,{style:{marginTop:6,color:S.ink3},children:[`✗ 磁盘温度需 `,(0,w.jsx)(`code`,{children:`smartctl`}),`(未安装),装了就能出现在存储页`,(0,w.jsx)(`br`,{}),`✗ 机箱主板温度/电压需 `,(0,w.jsx)(`code`,{children:`lm-sensors`}),`(未配置)`]})]})})]})}function Ph({data:e}){return(0,w.jsxs)(w.Fragment,{children:[(0,w.jsxs)(yh,{title:`BIOS`,cmd:`dmidecode -t bios`,children:[(0,w.jsx)(Q,{k:`厂商`,v:e.bios.vendor}),(0,w.jsx)(Q,{k:`版本`,v:e.bios.version}),(0,w.jsx)(Q,{k:`发布日期`,v:e.bios.date})]}),(0,w.jsxs)(yh,{title:`主板`,cmd:`dmidecode -t baseboard`,children:[(0,w.jsx)(Q,{k:`厂商`,v:e.board.manufacturer}),(0,w.jsx)(Q,{k:`产品`,v:e.board.product}),(0,w.jsx)(Q,{k:`系列`,v:e.board.systemName}),(0,w.jsx)(Q,{k:`序列号`,v:e.board.serial})]})]})}var Fh={fontFamily:`"JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, monospace`},Ih={ok:{bg:`#dcfce7`,fg:`#166534`,border:`#86efac`},warn:{bg:`#fef3c7`,fg:`#78350f`,border:`#fcd34d`},err:{bg:`#fee2e2`,fg:`#991b1b`,border:`#fca5a5`},muted:{bg:`#f1f5f9`,fg:`#475569`,border:`#cbd5e1`}},Lh={RUNNING:{text:`RUNNING`,kind:`ok`},STARTING:{text:`STARTING`,kind:`warn`},BACKOFF:{text:`BACKOFF`,kind:`warn`},STOPPED:{text:`STOPPED`,kind:`muted`},EXITED:{text:`EXITED`,kind:`err`},FATAL:{text:`FATAL`,kind:`err`},UNKNOWN:{text:`UNKNOWN`,kind:`muted`}};function Rh({text:e,kind:t}){if(!e)return null;let n=Ih[t]||Ih.muted;return(0,w.jsx)(`span`,{style:{display:`inline-block`,padding:`2px 8px`,borderRadius:999,fontSize:10.5,fontWeight:700,letterSpacing:.3,color:n.fg,background:n.bg,border:`1px solid ${n.border}`,...Fh},children:e})}function zh(e){return Lh[e.badge]?Lh[e.badge]:{text:e.badge,kind:e.badgeKind||`muted`}}function Bh({item:e,isSupervisor:t}){let n=zh(e),r=!!e.url;return(0,w.jsxs)(`tr`,{style:{borderBottom:`1px dashed ${S.borderSoft||`#f1f5f9`}`},children:[(0,w.jsxs)(`td`,{style:{padding:`10px 8px`,width:`30%`,minWidth:240},children:[(0,w.jsx)(`div`,{style:{fontSize:13.5,fontWeight:700,color:S.ink},children:e.name}),e.project&&(0,w.jsx)(`div`,{style:{fontSize:11,color:S.ink3,marginTop:2},children:e.project})]}),(0,w.jsxs)(`td`,{style:{padding:`10px 8px`},children:[r?(0,w.jsx)(`a`,{href:e.url,target:`_blank`,rel:`noreferrer`,style:{...Fh,fontSize:12.5,color:S.blueDeep,textDecoration:`none`,wordBreak:`break-all`},className:`edge-link-hover`,children:e.url}):(0,w.jsx)(`span`,{style:{...Fh,fontSize:12.5,color:S.ink3},children:`—`}),e.note&&(0,w.jsx)(`div`,{style:{fontSize:11,color:S.ink3,marginTop:3},children:e.note})]}),(0,w.jsx)(`td`,{style:{padding:`10px 8px`,width:130,...Fh},children:e.supervisor&&(0,w.jsx)(`span`,{style:{fontSize:11.5,color:S.ink3},children:e.supervisor})}),(0,w.jsx)(`td`,{style:{padding:`10px 8px`,width:100,textAlign:`right`},children:(0,w.jsx)(Rh,{text:n.text,kind:n.kind})})]})}function Vh({section:e}){let t=e.kind===`supervisor`;return(0,w.jsxs)(`div`,{style:{background:`white`,border:`1px solid ${S.border}`,borderRadius:10,marginBottom:16,overflow:`hidden`},children:[(0,w.jsxs)(`div`,{style:{padding:`12px 16px`,borderBottom:`1px solid ${S.borderSoft||`#f1f5f9`}`},children:[(0,w.jsxs)(`div`,{style:{fontSize:14.5,fontWeight:700,color:S.ink},children:[e.title,t&&(0,w.jsx)(`span`,{style:{marginLeft:8,fontSize:10.5,fontWeight:600,color:S.blueDeep,padding:`1px 6px`,borderRadius:4,background:S.blueSoft},children:`实时状态`})]}),e.description&&(0,w.jsx)(`div`,{style:{fontSize:12,color:S.ink3,marginTop:4,lineHeight:1.55},children:e.description})]}),e.items?.length>0?(0,w.jsxs)(`table`,{style:{width:`100%`,borderCollapse:`collapse`},children:[(0,w.jsx)(`thead`,{children:(0,w.jsxs)(`tr`,{style:{background:`#f8fafc`},children:[(0,w.jsx)(`th`,{style:Hh,children:`名称`}),(0,w.jsx)(`th`,{style:Hh,children:`地址`}),(0,w.jsx)(`th`,{style:{...Hh,width:130},children:t?`Supervisor 名`:``}),(0,w.jsx)(`th`,{style:{...Hh,width:100,textAlign:`right`},children:`状态`})]})}),(0,w.jsx)(`tbody`,{children:e.items.map((e,n)=>(0,w.jsx)(Bh,{item:e,isSupervisor:t},n))})]}):(0,w.jsx)(`div`,{style:{padding:16,fontSize:12,color:S.ink3},children:`(无条目)`})]})}var Hh={padding:`8px 8px`,fontSize:10.5,fontWeight:700,textTransform:`uppercase`,letterSpacing:`0.06em`,color:S.ink3,textAlign:`left`,borderBottom:`1px solid ${S.border}`};function Uh(){let{data:e,loading:t}=Qd();if(t&&!e)return(0,w.jsx)(`div`,{style:{padding:40,color:S.ink3},children:`加载中…`});let n=e?.sections||[],r=e?.error;return(0,w.jsxs)(`div`,{style:{display:`flex`,flexDirection:`column`,height:`100%`,width:`100%`,background:`#f8fafc`,overflow:`hidden`},children:[(0,w.jsx)(`div`,{style:{padding:`12px 20px`,background:`white`,borderBottom:`1px solid ${S.border}`},children:(0,w.jsxs)(`div`,{style:{display:`flex`,alignItems:`baseline`,gap:10},children:[(0,w.jsx)(`div`,{style:{fontSize:16,fontWeight:700,color:S.ink},children:`服务导航`}),(0,w.jsxs)(`div`,{style:{fontSize:11.5,color:S.ink3},children:[`Edge 与 Global 两条主线的文档、控制台和 API 地址清单`,e?.path&&(0,w.jsxs)(w.Fragment,{children:[` · 数据源 `,(0,w.jsx)(`code`,{style:Fh,children:e.path})]})]})]})}),(0,w.jsxs)(`div`,{style:{flex:1,overflow:`auto`,padding:20},children:[r&&(0,w.jsxs)(`div`,{style:{padding:`10px 14px`,marginBottom:14,borderRadius:8,background:`#fef3c7`,border:`1px solid #fcd34d`,color:`#78350f`,fontSize:12.5},children:[`⚠ 清单加载出问题:`,r]}),n.length===0&&!r&&(0,w.jsxs)(`div`,{style:{padding:40,textAlign:`center`,color:S.ink3,fontSize:13},children:[`清单为空。检查 `,e?.path||`/etc/devbox/links.yaml`,` 是否存在。`]}),n.map((e,t)=>(0,w.jsx)(Vh,{section:e},t))]})]})}function Wh(){let[e,t]=(0,b.useState)(`interfaces`),[n,r]=(0,b.useState)(null);(0,b.useEffect)(()=>{X(`/api/v1/network`).then(e=>e.ok?e.json():null).then(e=>{e&&r(e)}).catch(()=>{})},[]);let i=n?n.interfaces.filter(e=>e.state===`up`):[];return(0,w.jsxs)(`div`,{style:{background:S.surface,border:`1px solid ${S.border}`,borderRadius:10,boxShadow:`0 1px 2px rgba(15,23,42,0.04)`,overflow:`hidden`,marginTop:4},children:[(0,w.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,padding:`12px 16px 0`,borderBottom:`1px solid ${S.borderSoft}`},children:[(0,w.jsx)(D,{name:`network`,size:15,stroke:1.8,style:{color:S.blueDeep,marginRight:8}}),(0,w.jsx)(`span`,{style:{fontSize:13.5,fontWeight:700,color:S.ink},children:`网络管理`}),(0,w.jsxs)(J,{tone:`green`,style:{marginLeft:10},children:[(0,w.jsx)(q,{tone:`green`,size:6}),`在线`]}),(0,w.jsx)(`div`,{style:{flex:1}}),(0,w.jsxs)(`span`,{style:{fontSize:11,color:S.ink3},children:[`本机 IP `,(0,w.jsx)(`span`,{className:`mono`,style:{color:S.ink2,fontWeight:600},children:n?.ip||`...`}),(0,w.jsx)(`span`,{style:{color:`#cbd5e1`,margin:`0 6px`},children:`·`}),`默认网关 `,(0,w.jsx)(`span`,{className:`mono`,style:{color:S.ink2,fontWeight:600},children:n?.gateway||`...`})]})]}),(0,w.jsx)(Zf,{tabs:[{id:`interfaces`,label:`网络配置`,icon:`network`,count:i.length}],active:e,onChange:t,style:{padding:`4px 16px 0`,gap:2,marginTop:8},itemStyle:{padding:`8px 12px 10px`,fontSize:12.5,marginBottom:-1},renderLabel:(e,t)=>(0,w.jsxs)(w.Fragment,{children:[(0,w.jsx)(D,{name:e.icon,size:13,stroke:1.8}),e.label,(0,w.jsx)(`span`,{className:`mono tnum`,style:{fontSize:10,color:t?S.blueDeep:S.ink4,background:t?`#dbeafe`:S.surfaceAlt,padding:`0 5px`,borderRadius:999,lineHeight:`16px`,marginLeft:2},children:e.count})]})}),(0,w.jsxs)(`div`,{style:{padding:16},children:[(0,w.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,gap:8,marginBottom:10},children:[(0,w.jsxs)(`span`,{style:{fontSize:11.5,color:S.ink3},children:[`DNS:`,(0,w.jsx)(`span`,{className:`mono`,style:{color:S.ink2,fontWeight:600},children:(n?.dns||[]).join(` `)}),(0,w.jsx)(`span`,{style:{color:`#cbd5e1`,margin:`0 4px`},children:`·`}),(0,w.jsx)(`span`,{className:`mono`,style:{color:S.ink2,fontWeight:600},children:`8.8.8.8`}),(0,w.jsx)(`span`,{style:{color:`#cbd5e1`,margin:`0 6px`},children:`·`}),`MTU 默认 `,(0,w.jsx)(`span`,{className:`mono tnum`,style:{color:S.ink2,fontWeight:600},children:`1500`})]}),(0,w.jsx)(`div`,{style:{flex:1}}),(0,w.jsxs)(`button`,{className:`edge-press edge-btn-secondary`,style:{...gd,height:28,padding:`0 10px`,fontSize:11.5},children:[(0,w.jsx)(D,{name:`refresh`,size:12,stroke:1.8}),`重新扫描`]}),(0,w.jsxs)(`button`,{className:`edge-press edge-btn-primary`,style:{..._d,height:28,padding:`0 10px`,fontSize:11.5},children:[(0,w.jsx)(D,{name:`plus`,size:12,stroke:2}),`新增接口`]})]}),(0,w.jsxs)(`div`,{style:{border:`1px solid ${S.borderSoft}`,borderRadius:8,overflow:`hidden`},children:[(0,w.jsxs)(`div`,{style:{display:`grid`,gridTemplateColumns:`140px 80px 200px 130px 160px 90px 1fr 80px`,padding:`8px 12px`,background:S.surfaceAlt,fontSize:10.5,color:S.ink3,fontWeight:600,letterSpacing:`0.04em`,textTransform:`uppercase`,borderBottom:`1px solid ${S.borderSoft}`},children:[(0,w.jsx)(`span`,{children:`接口`}),(0,w.jsx)(`span`,{children:`状态`}),(0,w.jsx)(`span`,{children:`IP / 掩码`}),(0,w.jsx)(`span`,{children:`网关`}),(0,w.jsx)(`span`,{children:`MAC`}),(0,w.jsx)(`span`,{children:`模式`}),(0,w.jsx)(`span`,{children:`RX / TX`}),(0,w.jsx)(`span`,{style:{textAlign:`right`},children:`操作`})]}),(n?.interfaces||[]).map((e,t)=>(0,w.jsxs)(`div`,{style:{display:`grid`,gridTemplateColumns:`140px 80px 200px 160px 90px 1fr`,padding:`11px 12px`,alignItems:`center`,fontSize:12,borderTop:t?`1px solid ${S.borderSoft}`:`none`},children:[(0,w.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,gap:8},children:[(0,w.jsx)(D,{name:e.type===`本地`?`dot`:e.type===`无线`?`globe`:`network`,size:14,stroke:1.8,style:{color:e.state===`up`?S.blueDeep:S.ink4}}),(0,w.jsxs)(`div`,{children:[(0,w.jsx)(`div`,{style:{fontWeight:600,color:S.ink},className:`mono`,children:e.name}),(0,w.jsx)(`div`,{style:{fontSize:10.5,color:S.ink4,marginTop:1},children:e.type})]})]}),(0,w.jsx)(`div`,{children:e.state===`up`?(0,w.jsxs)(J,{tone:`green`,style:{padding:`1px 6px`},children:[(0,w.jsx)(q,{tone:`green`,size:5}),`UP`]}):(0,w.jsxs)(J,{tone:`gray`,style:{padding:`1px 6px`},children:[(0,w.jsx)(q,{tone:`gray`,size:5}),`DOWN`]})}),(0,w.jsx)(`div`,{className:`mono`,style:{color:S.ink2},children:e.ip||`—`}),(0,w.jsx)(`div`,{className:`mono`,style:{color:S.ink3,fontSize:11},children:e.mac||`—`}),(0,w.jsxs)(`div`,{className:`mono`,style:{color:S.ink3,fontSize:11},children:[`MTU `,e.mtu]}),(0,w.jsx)(`div`,{})]},e.name))]}),(0,w.jsxs)(`div`,{style:{padding:`10px 12px`,background:S.surfaceAlt,border:`1px solid ${S.borderSoft}`,borderRadius:8,marginTop:12},children:[(0,w.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,gap:6,marginBottom:6},children:[(0,w.jsx)(D,{name:`globe`,size:13,stroke:1.8,style:{color:S.ink2}}),(0,w.jsx)(`span`,{style:{fontSize:12,fontWeight:600,color:S.ink},children:`DNS`})]}),(0,w.jsx)(`div`,{style:{fontSize:11.5,color:S.ink3,lineHeight:1.7},children:(n?.dns||[]).map((e,t)=>(0,w.jsxs)(`span`,{children:[t>0&&(0,w.jsx)(`br`,{}),`DNS `,t+1,`:`,(0,w.jsx)(`span`,{className:`mono`,style:{color:S.ink2},children:e})]},t))})]})]})]})}function Gh(){let[e,t]=(0,b.useState)(null),[n,r]=(0,b.useState)({});(0,b.useEffect)(()=>{X(`/api/v1/device`).then(e=>e.ok?e.json():null).then(e=>{e&&r({name:e.hostname,sn:e.hostname,os:e.platform||e.os,agent:`Edge Platform `+(e.agentVersion||``),model:e.cpuModel,site:e.ip,dept:``,uptime:e.uptimeHuman})}).catch(()=>{})},[]);let i=[{id:`ping`,icon:`network`,name:`网络连通性`,desc:`ping 云端 · 网关 · DNS`,color:S.blue},{id:`bandwidth`,icon:`arrowUp`,name:`带宽测试`,desc:`上行 / 下行 · 抖动 · 丢包`,color:S.indigo},{id:`syslog`,icon:`terminal`,name:`系统日志`,desc:`journalctl · dmesg · syslog`,color:S.violet},{id:`health`,icon:`shield`,name:`一键体检`,desc:`硬件 · 驱动 · 模型完整性`,color:S.green},{id:`bundle`,icon:`download`,name:`一键诊断包`,desc:`日志 + 配置 + 指标 · 离线上报`,color:S.amber},{id:`reboot`,icon:`power`,name:`远程重启`,desc:`需管理员权限`,color:S.red}];return(0,w.jsxs)(`div`,{style:{flex:1,padding:24,overflow:`auto`,background:S.surfaceAlt},children:[(0,w.jsxs)(`div`,{style:{marginBottom:14},children:[(0,w.jsx)(`div`,{style:{...S.type.heading,color:S.ink},children:`系统设置`}),(0,w.jsx)(`div`,{style:{fontSize:12,color:S.ink3,marginTop:3},children:`诊断工具 · 网络管理 · 设备信息`})]}),(0,w.jsx)(`div`,{style:{display:`grid`,gridTemplateColumns:`repeat(3, 1fr)`,gap:12,marginBottom:16},children:i.map(n=>(0,w.jsxs)(`div`,{onClick:()=>t(n.id),style:{background:S.surface,border:`1px solid ${S.border}`,borderRadius:10,padding:16,cursor:`pointer`,display:`flex`,gap:12,...e===n.id?{boxShadow:`0 0 0 2px ${n.color}33`,borderColor:n.color}:{}},children:[(0,w.jsx)(`div`,{style:{width:38,height:38,borderRadius:9,background:`${n.color}15`,color:n.color,display:`flex`,alignItems:`center`,justifyContent:`center`,flexShrink:0},children:(0,w.jsx)(D,{name:n.icon,size:18,stroke:1.8})}),(0,w.jsxs)(`div`,{style:{minWidth:0},children:[(0,w.jsx)(`div`,{style:{fontSize:13.5,fontWeight:600,color:S.ink},children:n.name}),(0,w.jsx)(`div`,{style:{fontSize:11.5,color:S.ink3,marginTop:4},children:n.desc}),e===n.id&&(0,w.jsxs)(`div`,{style:{fontSize:11.5,color:n.color,marginTop:8,fontWeight:600,display:`flex`,alignItems:`center`,gap:5},children:[(0,w.jsx)(q,{tone:n.color===S.green?`green`:`blue`,size:6,pulse:!0}),`正在执行…`]})]})]},n.id))}),(0,w.jsx)(Wh,{}),(0,w.jsx)(Yu,{title:`设备信息`,padding:0,style:{marginTop:16},children:(0,w.jsx)(`table`,{style:{width:`100%`,borderCollapse:`collapse`,fontSize:12.5},children:(0,w.jsx)(`tbody`,{children:[[`设备名称`,n.name],[`IP 地址`,(0,w.jsx)(`span`,{className:`mono`,children:n.site})],[`运行时间`,n.uptime],[`操作系统`,n.os],[`Agent 版本`,(0,w.jsx)(`span`,{className:`mono`,children:n.agent})],[`硬件平台`,n.model]].map(([e,t],n)=>(0,w.jsxs)(`tr`,{style:{borderTop:n?`1px solid ${S.borderSoft}`:`none`},children:[(0,w.jsx)(`td`,{style:{width:120,padding:`10px 16px`,color:S.ink3},children:e}),(0,w.jsx)(`td`,{style:{padding:`10px 16px`,color:S.ink},children:t})]},e))})})})]})}var Kh={display:`inline-flex`,alignItems:`center`,gap:5,borderRadius:7,border:`1px solid ${S.border}`,background:`white`,color:S.ink2,cursor:`pointer`,fontSize:12.5,fontWeight:500},qh={display:`inline-flex`,alignItems:`center`,gap:5,borderRadius:7,border:`none`,background:S.blue,color:`white`,cursor:`pointer`,fontSize:12.5,fontWeight:600,height:32,padding:`0 14px`},Jh={padding:`8px 14px`,fontSize:10.5,fontWeight:600,color:S.ink3,letterSpacing:`0.04em`,textTransform:`uppercase`},Yh=new Set([`png`,`jpg`,`jpeg`,`gif`,`webp`,`svg`,`bmp`,`ico`,`avif`]);function Xh(e){return e&&Yh.has(e.toLowerCase())}async function Zh(e){try{if(navigator.clipboard&&window.isSecureContext)return await navigator.clipboard.writeText(e),!0}catch{}try{let t=document.createElement(`textarea`);t.value=e,t.style.position=`fixed`,t.style.opacity=`0`,document.body.appendChild(t),t.select();let n=document.execCommand(`copy`);return document.body.removeChild(t),n}catch{return!1}}function Qh(e){return e>=0xe8d4a51000?(e/0xe8d4a51000).toFixed(1)+` TB`:e>=1e9?(e/1e9).toFixed(1)+` GB`:e>=1e6?(e/1e6).toFixed(1)+` MB`:e>=1e3?(e/1e3).toFixed(1)+` KB`:e+` B`}function $h(e){if(!e)return``;let t=e=>String(e).padStart(2,`0`);return`${e.getFullYear()}-${t(e.getMonth()+1)}-${t(e.getDate())} ${t(e.getHours())}:${t(e.getMinutes())}:${t(e.getSeconds())}`}var eg={dir:`文件夹`,png:`PNG 图像`,jpg:`JPEG 图像`,jpeg:`JPEG 图像`,gif:`GIF 图像`,webp:`WebP 图像`,svg:`SVG 矢量图`,bmp:`BMP 图像`,ico:`图标`,avif:`AVIF 图像`,txt:`纯文本`,md:`Markdown 文档`,json:`JSON 数据`,yaml:`YAML 配置`,yml:`YAML 配置`,toml:`TOML 配置`,xml:`XML 文档`,csv:`CSV 表格`,log:`日志文件`,pdf:`PDF 文档`,zip:`ZIP 压缩包`,tar:`TAR 归档`,gz:`GZIP 压缩`,go:`Go 源码`,py:`Python 源码`,js:`JavaScript 源码`,jsx:`React 源码`,ts:`TypeScript 源码`,tsx:`TSX 源码`,sh:`Shell 脚本`,ipynb:`Jupyter Notebook`};function tg(e){return e?eg[e.toLowerCase()]||e.toUpperCase()+` 文件`:`文件`}function ng({label:e,value:t}){return(0,w.jsxs)(`div`,{style:{display:`flex`,gap:10,padding:`6px 0`,fontSize:11.5,borderBottom:`1px dashed ${S.borderSoft}`},children:[(0,w.jsx)(`div`,{style:{width:68,flexShrink:0,color:S.ink4,fontWeight:500},children:e}),(0,w.jsx)(`div`,{style:{flex:1,color:S.ink2,minWidth:0},children:t})]})}function rg(){let[e,t]=(0,b.useState)([]),[n,r]=(0,b.useState)(``),[i,a]=(0,b.useState)(null),[o,s]=(0,b.useState)(null),c=Sp(),[l,u]=(0,b.useState)(null),[d,f]=(0,b.useState)(!0),[p,m]=(0,b.useState)(!1),h=(0,b.useRef)(null),g=(0,b.useRef)(null),{data:_}=Rd(1e4),v=_?.metrics?.dsk,y=v?.pct||0,x=v?.used||0,C=v?.total||0,T=n?n.split(`/`).filter(Boolean):[],E=(0,b.useCallback)(e=>{s(null);let n=!1,i=null;return X(`/api/v1/files?path=`+encodeURIComponent(e)).then(async e=>{if(n)return null;if(e.ok)return e.json();let t=null;try{t=await e.json()}catch{}return e.status===403&&t?.code===`PATH_FORBIDDEN`?(s({code:`PATH_FORBIDDEN`,message:`无权访问该路径(工作区外)`}),i=setTimeout(()=>{n||r(``)},1500)):e.status===404&&t?.code===`PATH_NOT_FOUND`&&s({code:`PATH_NOT_FOUND`,message:`路径不存在`}),null}).then(e=>{n||e&&Array.isArray(e)&&t(e.map(e=>{let t=e.modified?new Date(e.modified):null;return{name:e.name,type:e.isDir?`dir`:e.type,size:e.isDir?``:Qh(e.size),sizeBytes:e.isDir?null:e.size,count:e.count,absPath:e.absPath,modified:t?t.toLocaleDateString(`zh-CN`):``,modifiedFull:t?$h(t):``}}))}).catch(()=>{}),()=>{n=!0,i!==null&&clearTimeout(i)}},[]);(0,b.useEffect)(()=>E(n),[n,E]),(0,b.useEffect)(()=>{h.current?.focus()},[]);let O=(0,b.useCallback)(async e=>{let t=Array.from(e||[]).filter(Boolean);if(t.length===0||p)return;m(!0);let r=0,i=``;try{for(let e of t){let t=new FormData;t.append(`path`,n),t.append(`name`,e.name),t.append(`file`,e,e.name);let a=await X(`/api/v1/files/upload`,{method:`POST`,body:t});if(!a.ok){let e=`上传失败 (${a.status})`;a.status===403?e=`目标目录无写入权限`:a.status===413?e=`文件超过 20MB 上限`:a.status===400&&(e=`文件名或目标路径无效`),c.err(e);return}i=(await a.json().catch(()=>({}))).name||e.name,r+=1}c.ok(r===1?`已上传 ${i}`:`已上传 ${r} 个文件`),i&&a(i),E(n)}catch{c.err(`上传失败`)}finally{m(!1),g.current&&(g.current.value=``)}},[n,E,c,p]);return(0,b.useEffect)(()=>{if(!i){u(null);return}let e=i.lastIndexOf(`.`);if(!Xh(e>0?i.slice(e+1):``)){u(null);return}let t=!1,r=null;return u({name:i,url:null,status:`loading`}),X(`/api/v1/files/content?path=`+encodeURIComponent(n)+`&name=`+encodeURIComponent(i)).then(async e=>{if(t)return;if(!e.ok){console.error(`[Files] preview fetch HTTP`,e.status,`name=`,i,`path=`,n),u({name:i,url:null,status:`err`});return}let a=await e.blob();t||(r=URL.createObjectURL(a),u({name:i,url:r,status:`ok`}))}).catch(e=>{console.error(`[Files] preview fetch failed`,e),t||u({name:i,url:null,status:`err`})}),()=>{t=!0,r&&URL.revokeObjectURL(r)}},[i,n]),(0,b.useEffect)(()=>{async function e(e){let t=e.target;if(t&&(t.tagName===`INPUT`||t.tagName===`TEXTAREA`||t.isContentEditable))return;let r=e.clipboardData?.items||[],i=Array.from(r).find(e=>e.type&&e.type.startsWith(`image/`));if(!i)return;e.preventDefault();let o=i.getAsFile();if(!o)return;let s=(o.type.split(`/`)[1]||`png`).split(`;`)[0],l=new Date,u=e=>String(e).padStart(2,`0`),d=`screenshot-${`${l.getFullYear()}${u(l.getMonth()+1)}${u(l.getDate())}-${u(l.getHours())}${u(l.getMinutes())}${u(l.getSeconds())}`}.${s}`,f=new FormData;f.append(`path`,n),f.append(`name`,d),f.append(`file`,o,d);try{let e=await X(`/api/v1/files/upload`,{method:`POST`,body:f});if(e.ok){let t=(await e.json().catch(()=>({}))).name||d;c.ok(`已粘贴 ${t}`),a(t),E(n)}else e.status===409?c.warn(`同名文件已存在`):e.status===403?c.err(`目标目录无写入权限`):e.status===413?c.err(`图片超过 20MB 上限`):c.err(`粘贴失败 (${e.status})`)}catch{c.err(`粘贴失败`)}}return window.addEventListener(`paste`,e),()=>window.removeEventListener(`paste`,e)},[n,E,c]),(0,w.jsxs)(`div`,{ref:h,tabIndex:0,style:{flex:1,display:`flex`,flexDirection:`column`,background:S.surface,overflow:`hidden`,outline:`none`},children:[(0,w.jsxs)(`div`,{style:{padding:`10px 18px`,borderBottom:`1px solid ${S.border}`,display:`flex`,alignItems:`center`,gap:10,flexShrink:0},children:[(0,w.jsx)(`button`,{disabled:T.length===0,onClick:()=>{let e=n.split(`/`).filter(Boolean);e.pop(),r(e.join(`/`))},className:`edge-press edge-btn-secondary`,style:{...Kh,height:30,padding:`0 10px`,opacity:T.length===0?.4:1,cursor:T.length===0?`not-allowed`:`pointer`},children:(0,w.jsx)(D,{name:`chevLeft`,size:12,stroke:2})}),(0,w.jsx)(`button`,{className:`edge-press edge-btn-secondary`,style:{...Kh,height:30,padding:`0 10px`},children:(0,w.jsx)(D,{name:`chevRight`,size:12,stroke:2})}),(0,w.jsx)(`button`,{onClick:()=>r(e=>e),className:`edge-press edge-btn-secondary`,style:{...Kh,height:30,padding:`0 10px`},children:(0,w.jsx)(D,{name:`refresh`,size:12,stroke:1.8})}),(0,w.jsxs)(`div`,{style:{flex:1,display:`flex`,alignItems:`center`,gap:4,padding:`0 12px`,height:30,borderRadius:6,background:S.surfaceAlt,border:`1px solid ${S.border}`,fontFamily:`ui-monospace, monospace`,fontSize:12,color:S.ink},children:[(0,w.jsx)(D,{name:`folder`,size:12,stroke:1.8,style:{color:S.ink4}}),(0,w.jsx)(`span`,{onClick:()=>r(``),style:{cursor:`pointer`,color:T.length===0?S.blueDeep:S.ink,fontWeight:T.length===0?600:500},children:`工作区`}),T.map((e,t)=>{let n=t===T.length-1,i=T.slice(0,t+1).join(`/`);return(0,w.jsxs)(`span`,{style:{display:`inline-flex`,alignItems:`center`,gap:4},children:[(0,w.jsx)(`span`,{style:{color:S.ink4},children:`/`}),(0,w.jsx)(`span`,{onClick:()=>r(i),style:{cursor:`pointer`,color:n?S.blueDeep:S.ink,fontWeight:n?600:500},children:e})]},t)})]}),(0,w.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,gap:6,padding:`0 10px`,height:30,borderRadius:6,background:S.surfaceAlt,border:`1px solid ${S.border}`,fontSize:12,color:S.ink,width:240},children:[(0,w.jsx)(D,{name:`search`,size:12,stroke:1.8,style:{color:S.ink4}}),(0,w.jsx)(`input`,{placeholder:`搜索文件…`,style:{flex:1,border:`none`,outline:`none`,fontSize:12,background:`transparent`}})]}),(0,w.jsx)(`input`,{ref:g,type:`file`,multiple:!0,onChange:e=>O(e.target.files),style:{display:`none`}}),(0,w.jsxs)(`button`,{disabled:p,onClick:()=>g.current?.click(),className:`edge-press edge-btn-primary`,style:{...qh,height:30,padding:`0 12px`,opacity:p?.65:1,cursor:p?`wait`:`pointer`},children:[(0,w.jsx)(D,{name:`download`,size:12,stroke:2}),p?`上传中`:`上传`]}),(0,w.jsx)(`button`,{title:d?`隐藏详情`:`显示详情`,onClick:()=>f(e=>!e),className:`edge-press edge-btn-secondary`,style:{...Kh,height:30,padding:`0 10px`,background:d?S.blueSoft:`white`,color:d?S.blueDeep:S.ink2,borderColor:d?S.blueDeep:S.border},children:(0,w.jsx)(D,{name:`sidebar`,size:12,stroke:1.8})})]}),(0,w.jsxs)(`div`,{style:{padding:`10px 18px`,background:S.surfaceAlt,borderBottom:`1px solid ${S.borderSoft}`,flexShrink:0,display:`flex`,alignItems:`center`,gap:14,fontSize:11.5},children:[(0,w.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,gap:6},children:[(0,w.jsx)(D,{name:`hardDrive`,size:13,stroke:1.8,style:{color:S.amber}}),(0,w.jsx)(`span`,{style:{color:S.ink2,fontWeight:600},children:n?`工作区 / ${n}`:`工作区`})]}),(0,w.jsx)(`div`,{style:{flex:1,height:6,background:`#fef3c7`,borderRadius:3,overflow:`hidden`,position:`relative`},children:(0,w.jsx)(`div`,{style:{width:y+`%`,height:`100%`,background:S.amber}})}),(0,w.jsxs)(`span`,{className:`mono tnum`,style:{color:S.ink,fontWeight:600},children:[x,` GB / `,C,` GB`]}),(0,w.jsxs)(`span`,{style:{color:S.ink3},children:[`(`,y,`% 已用)`]}),(0,w.jsxs)(`button`,{className:`edge-press edge-btn-secondary`,style:{...Kh,height:24,padding:`0 8px`,fontSize:11},children:[(0,w.jsx)(D,{name:`sparkle`,size:11,stroke:1.8}),`分析占用`]})]}),(0,w.jsxs)(`div`,{style:{flex:1,display:`flex`,overflow:`hidden`},children:[(0,w.jsxs)(`div`,{style:{width:200,flexShrink:0,borderRight:`1px solid ${S.borderSoft}`,background:S.surfaceAlt,padding:`12px 8px`},children:[(0,w.jsx)(`div`,{style:{fontSize:10.5,color:S.ink3,fontWeight:600,letterSpacing:`0.06em`,textTransform:`uppercase`,padding:`4px 10px 6px`},children:`快速访问`}),(0,w.jsxs)(`div`,{onClick:()=>r(``),className:n===``?void 0:`edge-row-hover`,style:{display:`flex`,alignItems:`center`,gap:8,padding:`6px 10px`,borderRadius:6,fontSize:12.5,color:n===``?S.blueDeep:S.ink,cursor:`pointer`,background:n===``?S.blueSoft:`transparent`,fontWeight:n===``?600:500,"--edge-row-hover-bg":S.surface},children:[(0,w.jsx)(D,{name:`folder`,size:13,stroke:1.8,style:{color:n===``?S.blueDeep:S.ink3}}),`工作区`]})]}),o&&(0,w.jsxs)(`div`,{style:{position:`absolute`,top:10,right:16,zIndex:10,padding:`8px 14px`,borderRadius:6,background:o.code===`PATH_FORBIDDEN`?`#fef2f2`:`#fffbeb`,border:`1px solid ${o.code===`PATH_FORBIDDEN`?`#fecaca`:`#fde68a`}`,color:o.code===`PATH_FORBIDDEN`?`#991b1b`:`#92400e`,fontSize:12,fontWeight:500,boxShadow:`0 4px 12px rgba(0,0,0,0.08)`},children:[o.message,o.code===`PATH_FORBIDDEN`&&(0,w.jsx)(`span`,{style:{marginLeft:6,fontWeight:400,opacity:.7},children:`(自动回到工作区)`})]}),(0,w.jsx)(`div`,{style:{flex:1,overflow:`auto`},children:(0,w.jsxs)(`table`,{style:{width:`100%`,borderCollapse:`collapse`,fontSize:12.5},children:[(0,w.jsx)(`thead`,{children:(0,w.jsxs)(`tr`,{style:{background:S.surfaceAlt,borderBottom:`1px solid ${S.border}`},children:[(0,w.jsx)(`th`,{style:{...Jh,width:36},children:(0,w.jsx)(`input`,{type:`checkbox`,disabled:!0})}),(0,w.jsx)(`th`,{style:{...Jh,textAlign:`left`},children:`名称`}),(0,w.jsx)(`th`,{style:{...Jh,textAlign:`right`},children:`大小`}),(0,w.jsx)(`th`,{style:{...Jh,textAlign:`right`},children:`修改时间`}),(0,w.jsx)(`th`,{style:{...Jh,textAlign:`right`}})]})}),(0,w.jsx)(`tbody`,{children:e.map((e,t)=>{let o=i===e.name;return(0,w.jsxs)(`tr`,{onClick:()=>a(e.name),onDoubleClick:()=>{e.type===`dir`&&r(n?`${n}/${e.name}`:e.name)},style:{background:o?`#eff4ff`:`transparent`,borderTop:`1px solid ${S.borderSoft}`,cursor:`pointer`},children:[(0,w.jsx)(`td`,{style:{padding:`8px 14px`},children:(0,w.jsx)(`input`,{type:`checkbox`,disabled:!0,checked:o})}),(0,w.jsx)(`td`,{style:{padding:`8px 14px`},children:(0,w.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,gap:8},children:[(0,w.jsx)(Z_,{type:e.type,size:14}),(0,w.jsx)(`span`,{style:{color:S.ink,fontWeight:e.type===`dir`?600:500},children:e.name}),e.type===`dir`&&(0,w.jsxs)(`span`,{style:{fontSize:11,color:S.ink4},children:[`· `,e.count,` 项`]})]})}),(0,w.jsx)(`td`,{style:{padding:`8px 14px`,textAlign:`right`,color:S.ink3},className:`mono`,children:e.size}),(0,w.jsx)(`td`,{style:{padding:`8px 14px`,textAlign:`right`,color:S.ink3},className:`mono`,children:e.modified||``}),(0,w.jsx)(`td`,{style:{padding:`8px 14px`,textAlign:`right`},children:e.absPath&&(0,w.jsx)(`button`,{title:`复制路径: ${e.absPath}`,onClick:async t=>{t.stopPropagation(),await Zh(e.absPath)?c.ok(`已复制路径 ${e.absPath}`):c.err(`复制失败`)},style:{border:`none`,background:`transparent`,cursor:`pointer`,color:S.ink4,padding:2,display:`inline-flex`},children:(0,w.jsx)(D,{name:`copy`,size:13,stroke:1.8})})})]},e.name)})})]})}),d&&i&&(()=>{let t=e.find(e=>e.name===i);if(!t)return null;let n=t.type!==`dir`&&Xh(t.type);return(0,w.jsxs)(`div`,{style:{width:320,flexShrink:0,borderLeft:`1px solid ${S.borderSoft}`,background:S.surfaceAlt,display:`flex`,flexDirection:`column`,overflow:`hidden`},children:[(0,w.jsxs)(`div`,{style:{padding:`10px 14px`,borderBottom:`1px solid ${S.borderSoft}`,fontSize:11.5,fontWeight:600,color:S.ink2,display:`flex`,alignItems:`center`,gap:6},children:[(0,w.jsx)(D,{name:`info`,size:13,stroke:1.8,style:{color:S.ink3}}),(0,w.jsx)(`span`,{style:{flex:1},children:`简介`}),(0,w.jsx)(`button`,{title:`关闭详情`,onClick:()=>f(!1),style:{border:`none`,background:`transparent`,cursor:`pointer`,color:S.ink3,padding:2,display:`inline-flex`},children:(0,w.jsx)(D,{name:`x`,size:13,stroke:1.8})})]}),(0,w.jsx)(`div`,{style:{flexShrink:0,height:200,display:`flex`,alignItems:`center`,justifyContent:`center`,padding:14,overflow:`hidden`,background:n?`repeating-conic-gradient(#f1f5f9 0% 25%, #ffffff 0% 50%) 50% / 16px 16px`:S.surface,borderBottom:`1px solid ${S.borderSoft}`},children:n?(0,w.jsxs)(w.Fragment,{children:[(!l||l.name!==i||l.status===`loading`)&&(0,w.jsx)(`div`,{style:{fontSize:12,color:S.ink3},children:`加载中…`}),l?.name===i&&l.status===`err`&&(0,w.jsx)(`div`,{style:{fontSize:12,color:`#991b1b`},children:`预览加载失败`}),l?.name===i&&l.status===`ok`&&l.url&&(0,w.jsx)(`img`,{src:l.url,alt:i,style:{maxWidth:`100%`,maxHeight:`100%`,objectFit:`contain`,boxShadow:`0 2px 8px rgba(0,0,0,0.08)`,borderRadius:4}})]}):(0,w.jsxs)(`div`,{style:{display:`flex`,flexDirection:`column`,alignItems:`center`,gap:8},children:[(0,w.jsx)(Z_,{type:t.type,size:72}),(0,w.jsx)(`div`,{style:{fontSize:11,color:S.ink4},children:`无预览`})]})}),(0,w.jsxs)(`div`,{style:{padding:`12px 14px 8px`,borderBottom:`1px solid ${S.borderSoft}`},children:[(0,w.jsx)(`div`,{style:{fontSize:13,fontWeight:600,color:S.ink,overflowWrap:`anywhere`,lineHeight:1.35},title:t.name,children:t.name}),(0,w.jsxs)(`div`,{style:{marginTop:4,fontSize:11.5,color:S.ink3},children:[tg(t.type),t.sizeBytes!=null&&(0,w.jsxs)(w.Fragment,{children:[` · `,(0,w.jsx)(`span`,{className:`mono`,children:t.size})]}),t.type===`dir`&&t.count!=null&&(0,w.jsxs)(w.Fragment,{children:[` · `,t.count,` 项`]})]})]}),(0,w.jsxs)(`div`,{style:{flex:1,overflow:`auto`,padding:`10px 14px`},children:[(0,w.jsx)(ng,{label:`种类`,value:tg(t.type)}),t.sizeBytes!=null&&(0,w.jsx)(ng,{label:`大小`,value:(0,w.jsxs)(`span`,{className:`mono`,children:[t.size,t.sizeBytes>=1e3&&(0,w.jsxs)(`span`,{style:{color:S.ink4},children:[` (`,t.sizeBytes.toLocaleString(),` 字节)`]})]})}),t.type===`dir`&&t.count!=null&&(0,w.jsx)(ng,{label:`项目数`,value:(0,w.jsx)(`span`,{className:`mono`,children:t.count})}),t.modifiedFull&&(0,w.jsx)(ng,{label:`修改时间`,value:(0,w.jsx)(`span`,{className:`mono`,children:t.modifiedFull})}),t.absPath&&(0,w.jsx)(ng,{label:`位置`,value:(0,w.jsxs)(`div`,{style:{display:`flex`,alignItems:`flex-start`,gap:4},children:[(0,w.jsx)(`span`,{className:`mono`,style:{flex:1,overflowWrap:`anywhere`,lineHeight:1.4},children:t.absPath}),(0,w.jsx)(`button`,{title:`复制路径: ${t.absPath}`,onClick:async()=>{await Zh(t.absPath)?c.ok(`已复制路径 ${t.absPath}`):c.err(`复制失败`)},style:{border:`none`,background:`transparent`,cursor:`pointer`,color:S.ink3,padding:2,display:`inline-flex`,flexShrink:0},children:(0,w.jsx)(D,{name:`copy`,size:12,stroke:1.8})})]})})]})]})})(),d&&!i&&(0,w.jsx)(`div`,{style:{width:320,flexShrink:0,borderLeft:`1px solid ${S.borderSoft}`,background:S.surfaceAlt,display:`flex`,alignItems:`center`,justifyContent:`center`,padding:20,textAlign:`center`},children:(0,w.jsxs)(`div`,{style:{fontSize:12,color:S.ink4},children:[(0,w.jsx)(D,{name:`info`,size:24,stroke:1.5,style:{color:S.ink4,display:`block`,margin:`0 auto 8px`}}),`选中文件后`,(0,w.jsx)(`br`,{}),`此处显示详细信息`]})})]})]})}`${S.border}`,S.ink2,S.blue,S.ink3,`${S.border}`,S.surface,S.ink3;var ig={display:`inline-flex`,alignItems:`center`,gap:5,borderRadius:7,border:`1px solid ${S.border}`,background:`white`,color:S.ink2,cursor:`pointer`,fontSize:12.5,fontWeight:500,height:32,padding:`0 14px`},ag={display:`inline-flex`,alignItems:`center`,gap:5,borderRadius:7,border:`none`,background:S.blue,color:`white`,cursor:`pointer`,fontSize:12.5,fontWeight:600,height:32,padding:`0 14px`},og={padding:`8px 14px`,fontSize:10.5,fontWeight:600,color:S.ink3,letterSpacing:`0.04em`,textTransform:`uppercase`},sg={width:26,height:26,borderRadius:5,border:`1px solid ${S.border}`,background:S.surface,color:S.ink3,cursor:`pointer`,display:`flex`,alignItems:`center`,justifyContent:`center`},cg=({title:e,action:t,padding:n=16,children:r})=>(0,w.jsxs)(`div`,{style:{background:S.surface,border:`1px solid ${S.border}`,borderRadius:10},children:[e&&(0,w.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,padding:`10px 16px`,borderBottom:`1px solid ${S.borderSoft}`},children:[(0,w.jsx)(`div`,{style:{fontSize:12.5,fontWeight:600,color:S.ink},children:e}),(0,w.jsx)(`div`,{style:{flex:1}}),t]}),(0,w.jsx)(`div`,{style:{padding:n},children:r})]});function lg(){let[e,t]=(0,b.useState)(`all`),[n,r]=(0,b.useState)([]);(0,b.useEffect)(()=>{fetch(`/api/v1/models`).then(e=>e.ok?e.json():null).then(e=>{e&&Array.isArray(e)&&e.length>0&&r(e)}).catch(()=>{})},[]);let i=n.filter(t=>e===`all`||(t.family||``).toLowerCase()===e);return(0,w.jsxs)(`div`,{style:{flex:1,display:`flex`,flexDirection:`column`,background:S.surfaceAlt,overflow:`hidden`},children:[(0,w.jsxs)(`div`,{style:{padding:`14px 24px`,background:S.surface,borderBottom:`1px solid ${S.border}`,flexShrink:0,display:`flex`,alignItems:`center`,gap:14},children:[(0,w.jsxs)(`div`,{children:[(0,w.jsx)(`div`,{style:{fontSize:17,fontWeight:700,color:S.ink,letterSpacing:`-0.01em`},children:`模型仓库`}),(0,w.jsxs)(`div`,{style:{fontSize:11.5,color:S.ink3,marginTop:3},children:[`本地已下载 `,(0,w.jsx)(`strong`,{className:`mono`,style:{color:S.ink2},children:n.length}),` 个 · 共计 `,(0,w.jsx)(`strong`,{className:`mono`,style:{color:S.ink2},children:`326 GB`}),` · 存储于 `,(0,w.jsx)(`span`,{className:`mono`,children:`/workspace/models`})]})]}),(0,w.jsx)(`div`,{style:{flex:1}}),(0,w.jsxs)(`button`,{className:`edge-press edge-btn-secondary`,style:ig,children:[(0,w.jsx)(D,{name:`cloud`,size:13,stroke:1.8}),`从 HuggingFace 同步`]}),(0,w.jsxs)(`button`,{className:`edge-press edge-btn-primary`,style:ag,children:[(0,w.jsx)(D,{name:`download`,size:13,stroke:2}),`拉取新模型`]})]}),(0,w.jsxs)(`div`,{style:{flex:1,overflow:`auto`,padding:24},children:[(0,w.jsx)(`div`,{style:{display:`flex`,gap:6,marginBottom:14,flexWrap:`wrap`},children:[`all`,`Llama`,`Qwen`,`DeepSeek`,`GLM`,`BGE`,`SD`,`Flux`,`Whisper`].map(r=>{let i=e===(r===`all`?`all`:r.toLowerCase()),a=r===`all`?n.length:n.filter(e=>e.family===r).length;return(0,w.jsxs)(`button`,{onClick:()=>t(r===`all`?`all`:r.toLowerCase()),disabled:a===0&&r!==`all`,style:{display:`flex`,alignItems:`center`,gap:4,padding:`5px 10px`,borderRadius:999,background:i?S.blue:S.surface,color:i?`white`:S.ink2,border:`1px solid ${i?S.blueDeep:S.border}`,fontSize:11.5,fontWeight:i?600:500,cursor:a===0&&r!==`all`?`not-allowed`:`pointer`,opacity:a===0&&r!==`all`?.5:1},children:[r===`all`?`全部`:r,` · `,a]},r)})}),(0,w.jsx)(cg,{padding:0,children:(0,w.jsxs)(`table`,{style:{width:`100%`,borderCollapse:`collapse`,fontSize:12.5},children:[(0,w.jsx)(`thead`,{children:(0,w.jsxs)(`tr`,{style:{background:`#fafbfc`,borderBottom:`1px solid ${S.borderSoft}`},children:[(0,w.jsx)(`th`,{style:{...og,textAlign:`left`},children:`模型`}),(0,w.jsx)(`th`,{style:{...og,textAlign:`left`},children:`家族`}),(0,w.jsx)(`th`,{style:{...og,textAlign:`right`},children:`体积`}),(0,w.jsx)(`th`,{style:{...og,textAlign:`left`},children:`格式`}),(0,w.jsx)(`th`,{style:{...og,textAlign:`left`},children:`可用引擎`}),(0,w.jsx)(`th`,{style:{...og,textAlign:`left`},children:`标签`}),(0,w.jsx)(`th`,{style:{...og,textAlign:`right`},children:`添加于`}),(0,w.jsx)(`th`,{style:{...og,textAlign:`right`}})]})}),(0,w.jsx)(`tbody`,{children:i.map((e,t)=>(0,w.jsxs)(`tr`,{style:{borderTop:`1px solid ${S.borderSoft}`},children:[(0,w.jsx)(`td`,{style:{padding:`10px 14px`},children:(0,w.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,gap:8},children:[(0,w.jsx)(D,{name:`brain`,size:14,stroke:1.8,style:{color:S.violet}}),(0,w.jsx)(`span`,{style:{fontSize:12.5,color:S.ink,fontWeight:600},className:`mono`,children:e.name}),e.pinned&&(0,w.jsx)(`span`,{title:`常驻`,style:{color:S.amber},children:`★`})]})}),(0,w.jsx)(`td`,{style:{padding:`10px 14px`,color:S.ink2},children:e.family}),(0,w.jsx)(`td`,{style:{padding:`10px 14px`,textAlign:`right`,color:S.ink2},className:`mono tnum`,children:e.size}),(0,w.jsx)(`td`,{style:{padding:`10px 14px`},className:`mono`,children:(0,w.jsx)(`span`,{style:{background:S.surfaceAlt,padding:`1px 6px`,borderRadius:3,fontSize:11,color:S.ink3},children:e.format})}),(0,w.jsx)(`td`,{style:{padding:`10px 14px`,fontSize:11.5,color:S.ink2},children:e.engine}),(0,w.jsx)(`td`,{style:{padding:`10px 14px`},children:(0,w.jsx)(`div`,{style:{display:`flex`,gap:4,flexWrap:`wrap`},children:e.tags.map(e=>(0,w.jsx)(`span`,{style:{fontSize:10,padding:`1px 5px`,borderRadius:3,background:e===`新`?`#fef2f2`:e===`Chat`?`#eff4ff`:e===`Image`?`#fdf2f8`:e===`Embedding`?`#f5f3ff`:S.surfaceAlt,color:e===`新`?S.red:e===`Chat`?S.blueDeep:e===`Image`?`#9d174d`:e===`Embedding`?`#5b21b6`:S.ink3,fontWeight:600},children:e},e))})}),(0,w.jsx)(`td`,{style:{padding:`10px 14px`,textAlign:`right`,color:S.ink3,fontSize:11.5},className:`mono`,children:e.added}),(0,w.jsx)(`td`,{style:{padding:`10px 14px`,textAlign:`right`},children:(0,w.jsxs)(`div`,{style:{display:`flex`,justifyContent:`flex-end`,gap:4},children:[(0,w.jsx)(`button`,{style:sg,title:`复制路径`,children:(0,w.jsx)(D,{name:`copy`,size:12,stroke:1.8})}),(0,w.jsx)(`button`,{style:sg,title:`加载到 vLLM`,children:(0,w.jsx)(D,{name:`play`,size:12,stroke:1.8})})]})})]},e.name))})]})})]})]})}var ug={padding:`8px 14px`,fontSize:10.5,fontWeight:600,color:S.ink3,letterSpacing:`0.04em`,textTransform:`uppercase`},dg={padding:`10px 14px`,fontSize:12.5,color:S.ink},fg={height:32,padding:`0 10px`,borderRadius:6,border:`1px solid ${S.border}`,background:S.surface,fontSize:12.5,color:S.ink,outline:`none`};function pg(e){let t={R:{bg:`#dcfce7`,fg:`#047857`},S:{bg:`#e0f2fe`,fg:`#0369a1`},D:{bg:`#fef3c7`,fg:`#a16207`},Z:{bg:`#fee2e2`,fg:`#991b1b`},T:{bg:`#f3e8ff`,fg:`#7c2d12`},I:{bg:`#e0e7ff`,fg:`#3730a3`},X:{bg:`#fecaca`,fg:`#7f1d1d`},t:{bg:`#f3e8ff`,fg:`#7c2d12`},P:{bg:`#fef3c7`,fg:`#a16207`}}[(e||``).charAt(0)]||{bg:S.surfaceAlt,fg:S.ink3};return{display:`inline-block`,padding:`1px 6px`,borderRadius:3,fontSize:10.5,fontWeight:600,color:t.fg,background:t.bg}}function mg(e){return!e||e<0?`-`:e>=1024*1024*1024?(e/(1024*1024*1024)).toFixed(1)+` GB`:e>=1024*1024?(e/(1024*1024)).toFixed(1)+` MB`:e>=1024?(e/1024).toFixed(0)+` KB`:e+` B`}function hg(){let[e,t]=(0,b.useState)([]),[n,r]=(0,b.useState)(!0),[i,a]=(0,b.useState)(null),[o,s]=(0,b.useState)({state:``,pid:``,name:``,user:``});(0,b.useEffect)(()=>{let e=!1;function n(){X(`/api/v1/processes`).then(e=>e.ok?e.json():null).then(n=>{!e&&Array.isArray(n)&&t(n)}).catch(()=>{}).finally(()=>{e||r(!1)})}n();let i=setInterval(n,1e4);return()=>{e=!0,clearInterval(i)}},[]);let c=e.filter(e=>!(o.state&&!e.state?.toLowerCase().includes(o.state.toLowerCase())||o.pid&&!String(e.pid).includes(o.pid)||o.name&&!(e.name||``).toLowerCase().includes(o.name.toLowerCase())||o.user&&!(e.user||``).toLowerCase().includes(o.user.toLowerCase())));return(0,w.jsxs)(`div`,{style:{flex:1,display:`flex`,flexDirection:`column`,background:S.surfaceAlt,overflow:`hidden`,position:`relative`},children:[(0,w.jsxs)(`div`,{style:{padding:`14px 24px`,background:S.surface,borderBottom:`1px solid ${S.border}`,flexShrink:0},children:[(0,w.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,gap:12},children:[(0,w.jsxs)(`div`,{children:[(0,w.jsx)(`div`,{style:{fontSize:17,fontWeight:700,color:S.ink,letterSpacing:`-0.01em`},children:`进程管理`}),(0,w.jsx)(`div`,{style:{fontSize:11.5,color:S.ink3,marginTop:3},children:`宿主进程列表 · 只读 · 离线可用 · 不可结束进程`})]}),(0,w.jsx)(`div`,{style:{flex:1}}),(0,w.jsxs)(`div`,{style:{fontSize:11.5,color:S.ink3},children:[`共 `,(0,w.jsx)(`span`,{className:`mono tnum`,style:{color:S.ink,fontWeight:700},children:c.length}),c.length!==e.length&&(0,w.jsxs)(`span`,{children:[` / `,e.length]}),(0,w.jsx)(`span`,{children:` 个`})]})]}),(0,w.jsxs)(`div`,{style:{display:`flex`,gap:8,marginTop:12},children:[(0,w.jsx)(`input`,{style:{...fg,width:110},placeholder:`状态 (R/S/D/Z/T)`,value:o.state,onChange:e=>s({...o,state:e.target.value})}),(0,w.jsx)(`input`,{style:{...fg,width:100},placeholder:`PID`,value:o.pid,onChange:e=>s({...o,pid:e.target.value})}),(0,w.jsx)(`input`,{style:{...fg,width:200},placeholder:`进程名`,value:o.name,onChange:e=>s({...o,name:e.target.value})}),(0,w.jsx)(`input`,{style:{...fg,width:130},placeholder:`用户`,value:o.user,onChange:e=>s({...o,user:e.target.value})})]})]}),(0,w.jsx)(`div`,{style:{flex:1,overflow:`auto`,padding:16},children:(0,w.jsx)(`div`,{style:{background:S.surface,border:`1px solid ${S.border}`,borderRadius:8},children:(0,w.jsxs)(`table`,{style:{width:`100%`,borderCollapse:`collapse`,fontSize:12.5},children:[(0,w.jsx)(`thead`,{children:(0,w.jsxs)(`tr`,{style:{background:`#fafbfc`},children:[(0,w.jsx)(`th`,{style:{...ug,textAlign:`right`,width:80},children:`PID`}),(0,w.jsx)(`th`,{style:{...ug,textAlign:`left`},children:`进程`}),(0,w.jsx)(`th`,{style:{...ug,textAlign:`center`,width:70},children:`状态`}),(0,w.jsx)(`th`,{style:{...ug,textAlign:`left`,width:100},children:`用户`}),(0,w.jsx)(`th`,{style:{...ug,textAlign:`right`,width:100},children:`内存`}),(0,w.jsx)(`th`,{style:{...ug,textAlign:`left`},children:`命令行`})]})}),(0,w.jsxs)(`tbody`,{children:[n&&(0,w.jsx)(`tr`,{children:(0,w.jsx)(`td`,{colSpan:6,style:{padding:24,textAlign:`center`,color:S.ink3},children:`加载中...`})}),!n&&c.length===0&&(0,w.jsx)(`tr`,{children:(0,w.jsx)(`td`,{colSpan:6,style:{padding:24,textAlign:`center`,color:S.ink3},children:`无匹配进程`})}),!n&&c.map((e,t)=>(0,w.jsxs)(`tr`,{"data-action":`view-detail`,onClick:()=>a(e.pid),className:i===e.pid?void 0:`edge-row-hover`,style:{borderTop:t?`1px solid ${S.borderSoft}`:`none`,cursor:`pointer`,background:i===e.pid?S.blueSoft:`transparent`,"--edge-row-hover-bg":S.surfaceAlt},children:[(0,w.jsx)(`td`,{style:{...dg,textAlign:`right`,fontFamily:`ui-monospace, monospace`},children:e.pid}),(0,w.jsxs)(`td`,{style:dg,children:[(0,w.jsx)(`div`,{style:{fontWeight:600},children:e.name||`-`}),e.ppid>0&&(0,w.jsxs)(`div`,{style:{fontSize:10.5,color:S.ink4,marginTop:1},children:[`PPID `,e.ppid]})]}),(0,w.jsx)(`td`,{style:{...dg,textAlign:`center`},children:(0,w.jsx)(`span`,{style:pg(e.state),children:(e.state||`?`).charAt(0)})}),(0,w.jsx)(`td`,{style:{...dg,fontFamily:`ui-monospace, monospace`,fontSize:11.5},children:e.user||`-`}),(0,w.jsx)(`td`,{style:{...dg,textAlign:`right`,fontFamily:`ui-monospace, monospace`},children:mg(e.memBytes)}),(0,w.jsx)(`td`,{style:{...dg,fontFamily:`ui-monospace, monospace`,fontSize:11.5,color:S.ink2,maxWidth:400,overflow:`hidden`,textOverflow:`ellipsis`,whiteSpace:`nowrap`},children:e.cmdline||`-`})]},e.pid))]})]})})}),i&&(0,w.jsx)(_g,{pid:i,onClose:()=>a(null)})]})}var gg=[{id:`basic`,label:`基础`},{id:`memory`,label:`内存`},{id:`fdList`,label:`FD`},{id:`env`,label:`Env`},{id:`netConns`,label:`网络`}];function _g({pid:e,onClose:t}){let[n,r]=(0,b.useState)(null),[i,a]=(0,b.useState)(`basic`),[o,s]=(0,b.useState)(null);return(0,b.useEffect)(()=>{r(null),s(null);let t=new AbortController;return X(`/api/v1/processes/`+e,{signal:t.signal}).then(async e=>e.ok?e.json():e.status===404?(s(`进程已退出`),null):(s(`获取详情失败`),null)).then(e=>{e&&r(e)}).catch(e=>{e.name!==`AbortError`&&s(`网络错误`)}),()=>t.abort()},[e]),(0,w.jsxs)(w.Fragment,{children:[(0,w.jsx)(`div`,{"data-action":`close-drawer`,onClick:t,style:{position:`absolute`,inset:0,background:`rgba(15,23,42,0.2)`,zIndex:5}}),(0,w.jsxs)(`div`,{style:{position:`absolute`,top:0,right:0,bottom:0,width:560,background:S.surface,borderLeft:`1px solid ${S.border}`,boxShadow:`-8px 0 24px rgba(15,23,42,0.06)`,zIndex:6,display:`flex`,flexDirection:`column`,overflow:`hidden`},children:[(0,w.jsxs)(`div`,{style:{padding:`14px 20px`,borderBottom:`1px solid ${S.border}`,display:`flex`,alignItems:`center`,gap:10},children:[(0,w.jsxs)(`div`,{style:{flex:1},children:[(0,w.jsxs)(`div`,{style:{fontSize:15,fontWeight:700,color:S.ink},children:[`进程 #`,e,n?.basic?.name&&(0,w.jsx)(`span`,{style:{marginLeft:8,fontSize:12,fontWeight:500,color:S.ink3},children:n.basic.name})]}),(0,w.jsx)(`div`,{style:{fontSize:10.5,color:S.ink4,marginTop:2},children:`只读视图 · 不可结束`})]}),(0,w.jsx)(`button`,{"data-action":`close-drawer`,onClick:t,style:{width:28,height:28,borderRadius:5,border:`1px solid ${S.border}`,background:S.surface,cursor:`pointer`,display:`flex`,alignItems:`center`,justifyContent:`center`},children:(0,w.jsx)(D,{name:`x`,size:14,stroke:2})})]}),(0,w.jsx)(Zf,{tabs:gg,active:i,onChange:a,itemAs:`button`,inactiveTextColor:S.ink2,style:{borderBottom:`1px solid ${S.border}`,background:S.surfaceAlt},itemStyle:{padding:`10px 16px`,fontSize:12},getItemProps:()=>({"data-action":`switch-tab`})}),(0,w.jsxs)(`div`,{style:{flex:1,overflow:`auto`,padding:16},children:[o&&(0,w.jsx)(`div`,{style:{color:S.red,fontSize:12},children:o}),!n&&!o&&(0,w.jsx)(`div`,{style:{color:S.ink3,fontSize:12},children:`加载中...`}),n&&i===`basic`&&(0,w.jsx)(vg,{basic:n.basic}),n&&i===`memory`&&(0,w.jsx)(bg,{data:n.memory}),n&&i===`fdList`&&(0,w.jsx)(xg,{list:n.fdList}),n&&i===`env`&&(0,w.jsx)(Sg,{list:n.env}),n&&i===`netConns`&&(0,w.jsx)(Cg,{list:n.netConns})]})]})]})}function vg({basic:e}){return(0,w.jsx)(yg,{rows:[[`PID`,e.pid],[`进程名`,e.name],[`PPID`,e.ppid],[`线程数`,e.threads],[`用户`,e.user],[`状态`,e.state],[`内存 (VmRSS)`,mg(e.memBytes)],[`启动时间`,e.startTime||`-`],[`命令行`,e.cmdline||`-`]]})}function yg({rows:e}){return(0,w.jsx)(`table`,{style:{width:`100%`,fontSize:12,borderCollapse:`collapse`},children:(0,w.jsx)(`tbody`,{children:e.map(([e,t])=>(0,w.jsxs)(`tr`,{style:{borderBottom:`1px solid ${S.borderSoft}`},children:[(0,w.jsx)(`td`,{style:{padding:`8px 0`,color:S.ink3,fontSize:11.5,width:120},children:e}),(0,w.jsx)(`td`,{style:{padding:`8px 0`,color:S.ink,fontFamily:`ui-monospace, monospace`,wordBreak:`break-all`},children:t??`-`})]},e))})})}function bg({data:e}){let t=Object.entries(e||{});return t.length===0?(0,w.jsx)(`div`,{style:{color:S.ink3,fontSize:12},children:`无数据(权限不足 / 字段缺失)`}):(0,w.jsx)(`table`,{style:{width:`100%`,fontSize:12,borderCollapse:`collapse`},children:(0,w.jsx)(`tbody`,{children:t.map(([e,t])=>(0,w.jsxs)(`tr`,{style:{borderBottom:`1px solid ${S.borderSoft}`},children:[(0,w.jsx)(`td`,{style:{padding:`6px 0`,color:S.ink3,fontSize:11.5,width:140},children:e}),(0,w.jsx)(`td`,{style:{padding:`6px 0`,color:S.ink,fontFamily:`ui-monospace, monospace`},children:t})]},e))})})}function xg({list:e}){return!e||e.length===0?(0,w.jsx)(`div`,{style:{color:S.ink3,fontSize:12},children:`无 FD(权限不足或进程无打开文件)`}):(0,w.jsxs)(`table`,{style:{width:`100%`,fontSize:11.5,borderCollapse:`collapse`,fontFamily:`ui-monospace, monospace`},children:[(0,w.jsx)(`thead`,{children:(0,w.jsxs)(`tr`,{style:{background:S.surfaceAlt,borderBottom:`1px solid ${S.border}`},children:[(0,w.jsx)(`th`,{style:{...ug,textAlign:`right`,width:50},children:`FD`}),(0,w.jsx)(`th`,{style:{...ug,textAlign:`left`},children:`Target`})]})}),(0,w.jsx)(`tbody`,{children:e.map(e=>(0,w.jsxs)(`tr`,{style:{borderBottom:`1px solid ${S.borderSoft}`},children:[(0,w.jsx)(`td`,{style:{padding:`5px 8px`,textAlign:`right`,color:S.ink2},children:e.fd}),(0,w.jsx)(`td`,{style:{padding:`5px 8px`,color:S.ink,wordBreak:`break-all`},children:e.target})]},e.fd))})]})}function Sg({list:e}){return!e||e.length===0?(0,w.jsx)(`div`,{style:{color:S.ink3,fontSize:12},children:`无 Env(权限不足或进程无环境变量)`}):(0,w.jsxs)(`table`,{style:{width:`100%`,fontSize:11.5,borderCollapse:`collapse`},children:[(0,w.jsx)(`thead`,{children:(0,w.jsxs)(`tr`,{style:{background:S.surfaceAlt,borderBottom:`1px solid ${S.border}`},children:[(0,w.jsx)(`th`,{style:{...ug,textAlign:`left`,width:160},children:`Name`}),(0,w.jsx)(`th`,{style:{...ug,textAlign:`left`},children:`Value`})]})}),(0,w.jsx)(`tbody`,{children:e.map((e,t)=>(0,w.jsxs)(`tr`,{style:{borderBottom:`1px solid ${S.borderSoft}`},children:[(0,w.jsx)(`td`,{style:{padding:`5px 8px`,color:S.ink2,fontFamily:`ui-monospace, monospace`},children:e.name}),(0,w.jsx)(`td`,{style:{padding:`5px 8px`,color:S.ink,fontFamily:`ui-monospace, monospace`,wordBreak:`break-all`},children:e.value})]},t))})]})}function Cg({list:e}){return!e||e.length===0?(0,w.jsx)(`div`,{style:{color:S.ink3,fontSize:12},children:`无网络连接`}):(0,w.jsxs)(`table`,{style:{width:`100%`,fontSize:11.5,borderCollapse:`collapse`,fontFamily:`ui-monospace, monospace`},children:[(0,w.jsx)(`thead`,{children:(0,w.jsxs)(`tr`,{style:{background:S.surfaceAlt,borderBottom:`1px solid ${S.border}`},children:[(0,w.jsx)(`th`,{style:{...ug,textAlign:`left`,width:60},children:`类型`}),(0,w.jsx)(`th`,{style:{...ug,textAlign:`left`},children:`本地`}),(0,w.jsx)(`th`,{style:{...ug,textAlign:`left`},children:`远端`}),(0,w.jsx)(`th`,{style:{...ug,textAlign:`left`,width:100},children:`状态`})]})}),(0,w.jsx)(`tbody`,{children:e.map((e,t)=>(0,w.jsxs)(`tr`,{style:{borderBottom:`1px solid ${S.borderSoft}`},children:[(0,w.jsx)(`td`,{style:{padding:`5px 8px`,color:S.ink2},children:e.type}),(0,w.jsx)(`td`,{style:{padding:`5px 8px`,color:S.ink,wordBreak:`break-all`},children:e.local}),(0,w.jsx)(`td`,{style:{padding:`5px 8px`,color:S.ink,wordBreak:`break-all`},children:e.remote}),(0,w.jsx)(`td`,{style:{padding:`5px 8px`,color:S.ink2},children:e.state})]},t))})]})}function wg(e){return e==null||e<0?`-`:e>=1024*1024*1024*1024?(e/(1024*1024*1024*1024)).toFixed(1)+` TB`:e>=1024*1024*1024?(e/(1024*1024*1024)).toFixed(1)+` GB`:e>=1024*1024?(e/(1024*1024)).toFixed(0)+` MB`:e+` B`}function Tg(e){return e==null?`-`:e<1024?e<1?`0 B/s`:e.toFixed(0)+` B/s`:e<1024*1024?(e/1024).toFixed(1)+` KB/s`:e<1024*1024*1024?(e/(1024*1024)).toFixed(1)+` MB/s`:(e/(1024*1024*1024)).toFixed(2)+` GB/s`}function Eg(e){return e==null?{fg:S.ink4,bg:S.surfaceAlt,ind:S.ink4}:e>=90?{fg:S.red,bg:`#fef2f2`,ind:S.red}:e>=70?{fg:S.amber,bg:`#fffbeb`,ind:S.amber}:{fg:`#059669`,bg:`#dcfce7`,ind:`#10b981`}}var Dg={padding:`8px 14px`,fontSize:10.5,fontWeight:600,color:S.ink3,letterSpacing:`0.04em`,textTransform:`uppercase`},Og={padding:`10px 14px`,fontSize:12,color:S.ink};function kg(){let[e,t]=(0,b.useState)([]),[n,r]=(0,b.useState)(null),[i,a]=(0,b.useState)(!0),[o,s]=(0,b.useState)(null),[c,l]=(0,b.useState)(`avg`),[u,d]=(0,b.useState)([]);(0,b.useEffect)(()=>{let e=!1;function n(t){e||r(t)}function i(){X(`/api/v1/disks`).then(async e=>{if(e.ok)return e.json();let t=null;try{t=await e.json()}catch{}return e.status===500&&t?.code===`LSBLK_UNAVAILABLE`?n(`节点未安装 lsblk,无法读取磁盘信息`):n(`磁盘信息读取失败`),null}).then(n=>{!e&&Array.isArray(n)&&(t(n),r(null))}).catch(()=>{n(`磁盘信息读取失败(网络错误)`)}).finally(()=>{e||a(!1)})}i();let o=setInterval(i,3e4);return()=>{e=!0,clearInterval(o)}},[]),(0,b.useEffect)(()=>{let e=!1;function t(){X(`/api/v1/disks/io`).then(e=>e.ok?e.json():null).then(t=>{e||!t||(s(t),d(e=>{let n={},r=0,i=0,a=[];(t.devices||[]).forEach(e=>{let t=e.device.replace(/^\/dev\//,``);n[t]={read:e.readBps,write:e.writeBps,util:e.utilPct},e.physical&&(r+=e.readBps,i+=e.writeBps,a.push(e.utilPct))});let o=a.length||1,s={t:Date.now(),dev:n,agg:{read:r/o,write:i/o,util:a.reduce((e,t)=>e+t,0)/o}},c=[...e,s];return c.length>60?c.slice(c.length-60):c}))}).catch(()=>{})}t();let n=setInterval(t,3e3);return()=>{e=!0,clearInterval(n)}},[]);let f={};(o?.devices||[]).forEach(e=>{f[e.device.replace(/^\/dev\//,``)]=e});let p=(o?.devices||[]).filter(e=>e.physical),m=p.length||1,h={readBps:p.reduce((e,t)=>e+t.readBps,0)/m,writeBps:p.reduce((e,t)=>e+t.writeBps,0)/m,utilPct:p.reduce((e,t)=>e+t.utilPct,0)/m},g=c,_=g===`avg`?null:e.find(e=>(e.device||``).replace(/^\/dev\//,``)===g),v=u.map(e=>({t:e.t,read:g===`avg`?e.agg.read:e.dev[g]?.read??0,write:g===`avg`?e.agg.write:e.dev[g]?.write??0}));return(0,w.jsxs)(`div`,{style:{flex:1,display:`flex`,flexDirection:`column`,background:S.surfaceAlt,overflow:`hidden`},children:[(0,w.jsx)(`div`,{style:{padding:`14px 24px`,background:S.surface,borderBottom:`1px solid ${S.border}`,flexShrink:0},children:(0,w.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,gap:12},children:[(0,w.jsxs)(`div`,{children:[(0,w.jsx)(`div`,{style:{fontSize:17,fontWeight:700,color:S.ink,letterSpacing:`-0.01em`},children:`磁盘管理`}),(0,w.jsx)(`div`,{style:{fontSize:11.5,color:S.ink3,marginTop:3},children:`本地 lsblk + df + /proc/mounts · 只读 · 离线可用 · 不可分区 / 卸载 / 格式化`})]}),(0,w.jsx)(`div`,{style:{flex:1}}),e.length>0&&(0,w.jsxs)(`div`,{style:{fontSize:11.5,color:S.ink3},children:[`共 `,(0,w.jsx)(`span`,{className:`mono tnum`,style:{color:S.ink,fontWeight:700},children:e.length}),` 块磁盘`]})]})}),(0,w.jsxs)(`div`,{style:{flex:1,overflow:`auto`,padding:16},children:[i&&(0,w.jsx)(`div`,{style:{color:S.ink3,fontSize:12},children:`加载中...`}),n&&(0,w.jsx)(`div`,{style:{padding:`10px 14px`,borderRadius:6,background:`#fef2f2`,border:`1px solid #fecaca`,color:`#991b1b`,fontSize:12,marginBottom:14},children:n}),!i&&e.length===0&&!n&&(0,w.jsx)(`div`,{style:{color:S.ink3,fontSize:12},children:`未检测到磁盘`}),e.length>0&&(0,w.jsxs)(`div`,{style:{display:`flex`,gap:12,marginBottom:14},children:[(0,w.jsx)(Ag,{aggregate:!0,io:h,count:p.length,active:g===`avg`,onClick:()=>l(`avg`)}),e.map(e=>{let t=(e.device||``).replace(/^\/dev\//,``);return(0,w.jsx)(Ag,{disk:e,io:f[t],active:t===g,onClick:()=>l(t)},e.device)})]}),e.length>0&&(0,w.jsxs)(w.Fragment,{children:[(0,w.jsx)(Ng,{series:v,title:g===`avg`?`全部磁盘(平均)`:`/dev/`+g,sampleMs:o?.sampleMs}),_&&(0,w.jsx)(Lg,{disk:_,io:f[(_.device||``).replace(/^\/dev\//,``)]}),(0,w.jsx)(Fg,{io:o})]})]})]})}function Ag({disk:e,io:t,aggregate:n,count:r,active:i,onClick:a}){let o=n?`平均`:(e.device||``).replace(/^\/dev\//,``),s=n?`${r} 块物理盘`:`${e.rotational?`HDD`:`SSD`} · ${wg(e.sizeBytes)}`,c=t?.utilPct??0,l=i?{bg:`#1e2433`,border:`#1e2433`,ink:`#fff`,ink3:`rgba(255,255,255,0.55)`,barBg:`rgba(255,255,255,0.18)`,bar:`#fff`,read:`#6ee7b7`,write:`#fcd34d`}:{bg:S.surface,border:S.border,ink:S.ink,ink3:S.ink3,barBg:S.surfaceAlt,bar:c>=80?S.red:c>=40?S.amber:`#10b981`,read:`#059669`,write:`#d97706`};return(0,w.jsxs)(`div`,{onClick:a,"data-action":`view-detail`,style:{flex:1,minWidth:0,cursor:`pointer`,userSelect:`none`,background:l.bg,border:`1px solid ${l.border}`,borderRadius:8,padding:`12px 14px`,boxShadow:i?`0 2px 8px rgba(15,23,42,0.25)`:`none`,transition:`background 0.15s, box-shadow 0.15s`},children:[(0,w.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,gap:7},children:[(0,w.jsx)(D,{name:n?`zap`:`hardDrive`,size:15,stroke:1.8,style:{color:l.ink3}}),(0,w.jsx)(`span`,{className:`mono`,style:{fontSize:12.5,fontWeight:700,color:l.ink},children:o}),(0,w.jsx)(`div`,{style:{flex:1}}),(0,w.jsx)(`span`,{style:{fontSize:10.5,color:l.ink3},children:s})]}),(0,w.jsxs)(`div`,{style:{display:`flex`,alignItems:`baseline`,gap:10,marginTop:8,marginBottom:9},children:[(0,w.jsxs)(`span`,{className:`mono tnum`,style:{fontSize:16,fontWeight:700,color:l.read},children:[`↓ `,Tg(t?.readBps)]}),(0,w.jsxs)(`span`,{className:`mono tnum`,style:{fontSize:16,fontWeight:700,color:l.write},children:[`↑ `,Tg(t?.writeBps)]})]}),(0,w.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,gap:8},children:[(0,w.jsx)(`div`,{style:{flex:1,height:5,borderRadius:3,background:l.barBg,overflow:`hidden`},children:(0,w.jsx)(`div`,{style:{width:Math.min(c,100)+`%`,height:`100%`,background:l.bar,transition:`width 0.3s`}})}),(0,w.jsxs)(`span`,{className:`mono tnum`,title:`采样窗口内设备忙的时间占比 (iostat %util)`,style:{fontSize:10,color:l.ink3,minWidth:46,textAlign:`right`},children:[`util `,c.toFixed(0),`%`]})]})]})}var jg=`#10b981`,Mg=`#f59e0b`;function Ng({series:e,title:t,sampleMs:n}){let r=(e||[]).filter(Boolean),i=r.length,a=0;r.forEach(e=>{a=Math.max(a,e.read,e.write)});let o=a>0?a*1.2:1024,s=e=>i<=1?0:e/(i-1)*100,c=e=>100-e/o*100,l=e=>r.map((t,n)=>`${s(n).toFixed(2)},${c(t[e]).toFixed(2)}`).join(` `),u=e=>i===0?``:`M ${s(0).toFixed(2)},100 `+r.map((t,n)=>`L ${s(n).toFixed(2)},${c(t[e]).toFixed(2)}`).join(` `)+` L ${s(i-1).toFixed(2)},100 Z`,d=e=>new Date(e).toLocaleTimeString(`zh-CN`,{hour12:!1});return(0,w.jsxs)(`div`,{style:{background:S.surface,border:`1px solid ${S.border}`,borderRadius:8,marginBottom:14,overflow:`hidden`},children:[(0,w.jsxs)(`div`,{style:{padding:`10px 16px`,borderBottom:`1px solid ${S.borderSoft}`,display:`flex`,alignItems:`center`,gap:10},children:[(0,w.jsx)(D,{name:`zap`,size:15,stroke:1.8,style:{color:S.ink2}}),(0,w.jsx)(`span`,{style:{fontSize:12.5,fontWeight:700,color:S.ink},children:`I/O 速率曲线`}),(0,w.jsx)(`span`,{className:`mono`,style:{fontSize:11,color:S.ink3},children:t}),(0,w.jsx)(`div`,{style:{flex:1}}),(0,w.jsx)(Pg,{color:jg,label:`读`}),(0,w.jsx)(Pg,{color:Mg,label:`写`}),(0,w.jsxs)(`span`,{style:{fontSize:10.5,color:S.ink4},children:[((n||0)/1e3).toFixed(1),`s 窗口 · 3s 刷新`]})]}),i<2?(0,w.jsx)(`div`,{style:{padding:`28px 16px`,fontSize:11.5,color:S.ink4,textAlign:`center`},children:`采集中…(每 3 秒一个采样点)`}):(0,w.jsxs)(`div`,{style:{display:`flex`,padding:`12px 14px 6px`},children:[(0,w.jsxs)(`div`,{style:{width:62,flexShrink:0,height:150,position:`relative`,fontSize:10,color:S.ink4,textAlign:`right`,paddingRight:8},children:[(0,w.jsx)(`span`,{className:`mono tnum`,style:{position:`absolute`,top:-4,right:8},children:Tg(o)}),(0,w.jsx)(`span`,{className:`mono tnum`,style:{position:`absolute`,top:`50%`,right:8,transform:`translateY(-50%)`},children:Tg(o/2)}),(0,w.jsx)(`span`,{className:`mono tnum`,style:{position:`absolute`,bottom:-4,right:8},children:`0`})]}),(0,w.jsxs)(`div`,{style:{flex:1,minWidth:0},children:[(0,w.jsxs)(`svg`,{width:`100%`,height:`150`,viewBox:`0 0 100 100`,preserveAspectRatio:`none`,style:{display:`block`,overflow:`visible`},children:[[25,50,75].map(e=>(0,w.jsx)(`line`,{x1:`0`,y1:e,x2:`100`,y2:e,stroke:S.borderSoft,strokeWidth:`1`,vectorEffect:`non-scaling-stroke`},e)),(0,w.jsx)(`path`,{d:u(`write`),fill:Mg,opacity:`0.10`}),(0,w.jsx)(`path`,{d:u(`read`),fill:jg,opacity:`0.12`}),(0,w.jsx)(`polyline`,{points:l(`write`),fill:`none`,stroke:Mg,strokeWidth:`1.5`,vectorEffect:`non-scaling-stroke`,strokeLinejoin:`round`,strokeLinecap:`round`}),(0,w.jsx)(`polyline`,{points:l(`read`),fill:`none`,stroke:jg,strokeWidth:`1.5`,vectorEffect:`non-scaling-stroke`,strokeLinejoin:`round`,strokeLinecap:`round`})]}),(0,w.jsxs)(`div`,{style:{display:`flex`,justifyContent:`space-between`,fontSize:10,color:S.ink4,marginTop:4},children:[(0,w.jsx)(`span`,{className:`mono tnum`,children:d(r[0].t)}),(0,w.jsx)(`span`,{className:`mono tnum`,children:d(r[Math.floor((i-1)/2)].t)}),(0,w.jsx)(`span`,{className:`mono tnum`,children:d(r[i-1].t)})]})]})]})]})}function Pg({color:e,label:t}){return(0,w.jsxs)(`span`,{style:{display:`inline-flex`,alignItems:`center`,gap:4,fontSize:10.5,color:S.ink3},children:[(0,w.jsx)(`span`,{style:{width:10,height:3,borderRadius:2,background:e}}),t]})}function Fg({io:e}){let[t,n]=(0,b.useState)(`total`),[r,i]=(0,b.useState)(`desc`);if(!e)return null;let a=[...e.processes||[]];function o(e){e===t?i(e=>e===`desc`?`asc`:`desc`):(n(e),i(e===`name`?`asc`:`desc`))}let s=e=>t===`read`?e.readBps:t===`write`?e.writeBps:t===`name`?e.name:e.readBps+e.writeBps;a.sort((e,t)=>{let n=s(e),i=s(t),a=typeof n==`string`?n.localeCompare(i):n-i;return r===`asc`?a:-a});let c=(e,n,i)=>(0,w.jsxs)(`th`,{onClick:()=>o(n),style:{...Dg,textAlign:i,cursor:`pointer`,userSelect:`none`,width:i===`right`?100:void 0},children:[e,(0,w.jsx)(`span`,{style:{marginLeft:4,color:t===n?S.ink2:`transparent`},children:t===n?r===`asc`?`▲`:`▼`:`▾`})]});return(0,w.jsxs)(`div`,{style:{background:S.surface,border:`1px solid ${S.border}`,borderRadius:8,marginBottom:14,overflow:`hidden`},children:[(0,w.jsxs)(`div`,{style:{padding:`10px 16px`,borderBottom:`1px solid ${S.borderSoft}`,display:`flex`,alignItems:`center`,gap:8},children:[(0,w.jsx)(D,{name:`cpu`,size:15,stroke:1.8,style:{color:S.ink2}}),(0,w.jsx)(`span`,{style:{fontSize:12.5,fontWeight:700,color:S.ink},children:`进程 I/O(iotop)`}),(0,w.jsx)(`span`,{style:{fontSize:10.5,color:S.ink4},children:`/proc//io 差分 · 系统全局 · 点击表头排序`})]}),e.processesAvailable?a.length===0?(0,w.jsx)(`div`,{style:{padding:`10px 16px`,fontSize:11.5,color:S.ink4},children:`采样窗口内无进程产生磁盘 I/O`}):(0,w.jsxs)(`table`,{style:{width:`100%`,borderCollapse:`collapse`,fontSize:12,tableLayout:`fixed`},children:[(0,w.jsx)(`thead`,{children:(0,w.jsxs)(`tr`,{style:{background:`#fafbfc`},children:[c(`进程`,`name`,`left`),c(`磁盘读`,`read`,`right`),c(`磁盘写`,`write`,`right`)]})}),(0,w.jsx)(`tbody`,{children:a.map((e,t)=>(0,w.jsxs)(`tr`,{style:{borderTop:t?`1px solid ${S.borderSoft}`:`none`},children:[(0,w.jsxs)(`td`,{style:{...Og,overflow:`hidden`},title:e.cmdline,children:[(0,w.jsxs)(`div`,{style:{display:`flex`,alignItems:`baseline`,gap:6},children:[(0,w.jsx)(`span`,{style:{fontWeight:600},children:e.name}),(0,w.jsxs)(`span`,{className:`mono tnum`,style:{fontSize:10.5,color:S.ink4},children:[e.pid,e.user?` · `+e.user:``]})]}),e.cmdline&&e.cmdline!==e.name&&(0,w.jsx)(`div`,{className:`mono`,style:{fontSize:10.5,color:S.ink4,marginTop:1,whiteSpace:`nowrap`,overflow:`hidden`,textOverflow:`ellipsis`},children:e.cmdline})]}),(0,w.jsx)(`td`,{className:`mono tnum`,style:{...Og,textAlign:`right`,verticalAlign:`top`,color:e.readBps>0?`#059669`:S.ink4},children:Tg(e.readBps)}),(0,w.jsx)(`td`,{className:`mono tnum`,style:{...Og,textAlign:`right`,verticalAlign:`top`,color:e.writeBps>0?`#d97706`:S.ink4},children:Tg(e.writeBps)})]},e.pid))})]}):(0,w.jsx)(`div`,{style:{padding:`10px 16px`,fontSize:11.5,color:S.ink4},children:`进程级 I/O 需要 root 权限读取 /proc//io,当前不可用`})]})}function Ig({pct:e}){if(e==null)return null;let t=e>=80?{bg:`#fef2f2`,fg:S.red}:e>=40?{bg:`#fffbeb`,fg:S.amber}:{bg:S.surfaceAlt,fg:S.ink4};return(0,w.jsxs)(`span`,{className:`mono tnum`,title:`采样窗口内设备忙的时间占比 (iostat %util)`,style:{padding:`1px 6px`,borderRadius:3,fontSize:10,fontWeight:600,background:t.bg,color:t.fg},children:[`util `,e.toFixed(0),`%`]})}function Lg({disk:e,io:t}){return(0,w.jsxs)(`div`,{style:{background:S.surface,border:`1px solid ${S.border}`,borderRadius:8,marginBottom:14,overflow:`hidden`},children:[(0,w.jsxs)(`div`,{style:{padding:`12px 16px`,borderBottom:`1px solid ${S.borderSoft}`,display:`flex`,alignItems:`center`,gap:12},children:[(0,w.jsx)(`div`,{style:{width:36,height:36,borderRadius:6,background:S.surfaceAlt,border:`1px solid ${S.border}`,display:`flex`,alignItems:`center`,justifyContent:`center`},children:(0,w.jsx)(D,{name:`hardDrive`,size:18,stroke:1.8,style:{color:S.ink2}})}),(0,w.jsxs)(`div`,{children:[(0,w.jsx)(`div`,{style:{fontSize:14,fontWeight:700,color:S.ink,fontFamily:`ui-monospace, monospace`},children:e.device?.startsWith(`/dev/`)?e.device:`/dev/`+e.device}),(0,w.jsxs)(`div`,{style:{fontSize:11,color:S.ink3,marginTop:2},children:[(0,w.jsx)(`span`,{style:{display:`inline-block`,padding:`1px 6px`,borderRadius:3,background:S.blueSoft,color:S.blueDeep,fontWeight:600,marginRight:6},children:e.type}),(0,w.jsx)(`span`,{children:e.model||`未知型号`}),e.serial&&(0,w.jsxs)(`span`,{style:{marginLeft:8,color:S.ink4,fontFamily:`ui-monospace, monospace`},children:[`S/N: `,e.serial]})]})]}),(0,w.jsx)(`div`,{style:{flex:1}}),t&&(0,w.jsxs)(`div`,{style:{textAlign:`right`,marginRight:18},children:[(0,w.jsxs)(`div`,{style:{display:`flex`,gap:10,justifyContent:`flex-end`,alignItems:`center`},children:[(0,w.jsxs)(`span`,{className:`mono tnum`,style:{fontSize:12,fontWeight:600,color:`#059669`},children:[`↓ `,Tg(t.readBps)]}),(0,w.jsxs)(`span`,{className:`mono tnum`,style:{fontSize:12,fontWeight:600,color:`#d97706`},children:[`↑ `,Tg(t.writeBps)]}),(0,w.jsx)(Ig,{pct:t.utilPct})]}),(0,w.jsx)(`div`,{style:{fontSize:10.5,color:S.ink4,marginTop:2},children:`实时 I/O`})]}),(0,w.jsxs)(`div`,{style:{textAlign:`right`},children:[(0,w.jsx)(`div`,{className:`mono tnum`,style:{fontSize:14,fontWeight:700,color:S.ink},children:wg(e.sizeBytes)}),(0,w.jsx)(`div`,{style:{fontSize:10.5,color:S.ink4,marginTop:2},children:`容量`})]})]}),(0,w.jsxs)(`table`,{style:{width:`100%`,borderCollapse:`collapse`,fontSize:12},children:[(0,w.jsx)(`thead`,{children:(0,w.jsxs)(`tr`,{style:{background:`#fafbfc`},children:[(0,w.jsx)(`th`,{style:{...Dg,textAlign:`left`},children:`分区`}),(0,w.jsx)(`th`,{style:{...Dg,textAlign:`right`,width:90},children:`容量`}),(0,w.jsx)(`th`,{style:{...Dg,textAlign:`left`,width:250},children:`使用情况`}),(0,w.jsx)(`th`,{style:{...Dg,textAlign:`left`},children:`挂载点`}),(0,w.jsx)(`th`,{style:{...Dg,textAlign:`left`,width:80},children:`文件系统`}),(0,w.jsx)(`th`,{style:{...Dg,textAlign:`left`},children:`挂载选项`})]})}),(0,w.jsxs)(`tbody`,{children:[(e.partitions||[]).map((e,t)=>(0,w.jsx)(zg,{partition:e,idx:t},e.name)),(!e.partitions||e.partitions.length===0)&&(0,w.jsx)(`tr`,{children:(0,w.jsx)(`td`,{colSpan:6,style:{...Og,color:S.ink3,textAlign:`center`,padding:16},children:`无分区`})})]})]})]})}var Rg={LVM2_member:{label:`LVM PV`,tip:`该分区是 LVM 物理卷,承载下方逻辑卷的数据`},crypto_LUKS:{label:`LUKS`,tip:`该分区是 LUKS 加密容器,解密后挂载在下方设备上`},linux_raid_member:{label:`RAID 成员`,tip:`该分区是 mdadm RAID 阵列的成员盘,阵列在下方设备上`}};function zg({partition:e,idx:t}){let n=Eg(e.usagePct),r=!e.mountPoint&&Rg[e.fsType],i=!e.mountPoint&&!r,a=!!e.parent;return(0,w.jsxs)(`tr`,{style:{borderTop:t?`1px solid ${S.borderSoft}`:`none`},children:[(0,w.jsxs)(`td`,{style:{...Og,fontFamily:`ui-monospace, monospace`},children:[a&&(0,w.jsx)(`span`,{style:{color:S.ink4,marginRight:4},children:`└─`}),e.name]}),(0,w.jsx)(`td`,{style:{...Og,textAlign:`right`,fontFamily:`ui-monospace, monospace`},children:wg(e.sizeBytes)}),(0,w.jsx)(`td`,{style:Og,children:r?(0,w.jsx)(`span`,{title:r.tip,style:{display:`inline-block`,padding:`1px 7px`,borderRadius:3,background:`#dbeafe`,color:`#1e40af`,fontSize:11,fontWeight:600},children:r.label}):i?(0,w.jsx)(`span`,{title:`该分区未挂载到任何路径,df 不报告使用率`,style:{color:S.ink4,fontSize:11.5},children:`未挂载`}):e.usagePct==null?(0,w.jsx)(`span`,{title:`df 读取失败 / 不可用`,style:{color:S.ink4},children:`—`}):(0,w.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,gap:8},children:[(0,w.jsx)(`div`,{style:{flex:1,height:6,borderRadius:3,background:n.bg,overflow:`hidden`},children:(0,w.jsx)(`div`,{style:{width:e.usagePct+`%`,height:`100%`,background:n.ind}})}),(0,w.jsxs)(`span`,{className:`mono tnum`,style:{fontSize:11,color:n.fg,fontWeight:600,minWidth:40},children:[Number(e.usagePct).toFixed(1),`%`]})]})}),(0,w.jsxs)(`td`,{style:{...Og,fontFamily:`ui-monospace, monospace`},children:[e.mountPoint||(0,w.jsx)(`span`,{style:{color:S.ink4},children:`—`}),e.isSystemDisk&&(0,w.jsx)(`span`,{style:{marginLeft:6,padding:`1px 6px`,borderRadius:3,background:`#b45309`,color:`white`,fontSize:10,fontWeight:600},title:`系统分区,谨慎操作`,children:`系统`})]}),(0,w.jsx)(`td`,{style:{...Og,fontSize:11},children:e.fsType||`-`}),(0,w.jsx)(`td`,{style:{...Og,fontSize:11,color:S.ink2},children:e.mountOptions&&e.mountOptions.length>0?e.mountOptions.slice(0,5).join(`, `)+(e.mountOptions.length>5?`...`:``):(0,w.jsx)(`span`,{style:{color:S.ink4},children:`—`})})]})}var Bg={padding:`8px 14px`,fontSize:10.5,fontWeight:600,color:S.ink3,letterSpacing:`0.04em`,textTransform:`uppercase`},Vg={padding:`8px 14px`,fontSize:12,color:S.ink,fontFamily:`ui-monospace, monospace`},Hg={height:30,padding:`0 10px`,borderRadius:6,border:`1px solid ${S.border}`,background:S.surface,fontSize:12,color:S.ink,outline:`none`};function Ug(e){return e===`LISTEN`?{bg:`#dcfce7`,fg:`#047857`}:e===`ESTABLISHED`?{bg:`#e0f2fe`,fg:`#0369a1`}:e===`TIME_WAIT`||e===`CLOSE_WAIT`||e===`FIN_WAIT1`||e===`FIN_WAIT2`?{bg:`#fef3c7`,fg:`#a16207`}:{bg:S.surfaceAlt,fg:S.ink3}}var Wg=[`LISTEN`,`ESTABLISHED`,`TIME_WAIT`,`CLOSE_WAIT`,`FIN_WAIT1`,`FIN_WAIT2`,`SYN_SENT`,`SYN_RECV`,`CLOSE`,`CLOSING`,`LAST_ACK`];function Gg(){let[e,t]=(0,b.useState)([]),[n,r]=(0,b.useState)(!0),[i,a]=(0,b.useState)(null),[o,s]=(0,b.useState)({stateFilter:`ALL`,pid:``,name:``,port:``});(0,b.useEffect)(()=>{let e=!1;function n(){X(`/api/v1/network/connections?limit=2000`).then(e=>e.ok?e.json():null).then(n=>{e||Array.isArray(n)&&(t(n),a(null))}).catch(()=>{e||a(`网络信息读取失败`)}).finally(()=>{e||r(!1)})}n();let i=setInterval(n,1e4);return()=>{e=!0,clearInterval(i)}},[]);let c=e.filter(e=>!(o.stateFilter!==`ALL`&&e.state!==o.stateFilter||o.pid&&!String(e.pid).includes(o.pid)||o.name&&!(e.processName||``).toLowerCase().includes(o.name.toLowerCase())||o.port&&!(e.local||``).includes(`:`+o.port)&&!(e.remote||``).includes(`:`+o.port)));return(0,w.jsxs)(`div`,{style:{flex:1,display:`flex`,flexDirection:`column`,background:S.surfaceAlt,overflow:`hidden`},children:[(0,w.jsxs)(`div`,{style:{padding:`14px 24px`,background:S.surface,borderBottom:`1px solid ${S.border}`,flexShrink:0},children:[(0,w.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,gap:12},children:[(0,w.jsxs)(`div`,{children:[(0,w.jsx)(`div`,{style:{fontSize:17,fontWeight:700,color:S.ink,letterSpacing:`-0.01em`},children:`网络连接`}),(0,w.jsx)(`div`,{style:{fontSize:11.5,color:S.ink3,marginTop:3},children:`全节点 socket 视图 · 只读 · 离线可用 · 不可关闭连接`})]}),(0,w.jsx)(`div`,{style:{flex:1}}),(0,w.jsxs)(`div`,{style:{fontSize:11.5,color:S.ink3},children:[`共 `,(0,w.jsx)(`span`,{className:`mono tnum`,style:{color:S.ink,fontWeight:700},children:c.length}),c.length!==e.length&&(0,w.jsxs)(`span`,{children:[` / `,e.length]}),(0,w.jsx)(`span`,{children:` 条`})]})]}),(0,w.jsxs)(`div`,{style:{display:`flex`,gap:8,marginTop:12,alignItems:`center`},children:[(0,w.jsxs)(`select`,{value:o.stateFilter,onChange:e=>s({...o,stateFilter:e.target.value}),style:{...Hg,width:130},children:[(0,w.jsx)(`option`,{value:`ALL`,children:`全部状态`}),Wg.map(e=>(0,w.jsx)(`option`,{value:e,children:e},e))]}),(0,w.jsx)(`input`,{style:{...Hg,width:100},placeholder:`PID`,value:o.pid,onChange:e=>s({...o,pid:e.target.value})}),(0,w.jsx)(`input`,{style:{...Hg,width:160},placeholder:`进程名`,value:o.name,onChange:e=>s({...o,name:e.target.value})}),(0,w.jsx)(`input`,{style:{...Hg,width:100},placeholder:`端口`,value:o.port,onChange:e=>s({...o,port:e.target.value})})]})]}),(0,w.jsxs)(`div`,{style:{flex:1,overflow:`auto`,padding:16},children:[i&&(0,w.jsx)(`div`,{style:{padding:`10px 14px`,borderRadius:6,background:`#fef2f2`,border:`1px solid #fecaca`,color:`#991b1b`,fontSize:12,marginBottom:14},children:i}),(0,w.jsx)(`div`,{style:{background:S.surface,border:`1px solid ${S.border}`,borderRadius:8},children:(0,w.jsxs)(`table`,{style:{width:`100%`,borderCollapse:`collapse`,fontSize:12},children:[(0,w.jsx)(`thead`,{children:(0,w.jsxs)(`tr`,{style:{background:`#fafbfc`},children:[(0,w.jsx)(`th`,{style:{...Bg,textAlign:`left`,width:70},children:`类型`}),(0,w.jsx)(`th`,{style:{...Bg,textAlign:`left`,width:110},children:`状态`}),(0,w.jsx)(`th`,{style:{...Bg,textAlign:`left`},children:`本地`}),(0,w.jsx)(`th`,{style:{...Bg,textAlign:`left`},children:`远端`}),(0,w.jsx)(`th`,{style:{...Bg,textAlign:`right`,width:80},children:`PID`}),(0,w.jsx)(`th`,{style:{...Bg,textAlign:`left`,width:140},children:`进程`})]})}),(0,w.jsxs)(`tbody`,{children:[n&&(0,w.jsx)(`tr`,{children:(0,w.jsx)(`td`,{colSpan:6,style:{padding:24,textAlign:`center`,color:S.ink3},children:`加载中...`})}),!n&&c.length===0&&(0,w.jsx)(`tr`,{children:(0,w.jsx)(`td`,{colSpan:6,style:{padding:24,textAlign:`center`,color:S.ink3},children:`无匹配连接`})}),!n&&c.map((e,t)=>{let n=Ug(e.state);return(0,w.jsxs)(`tr`,{style:{borderTop:t?`1px solid ${S.borderSoft}`:`none`},children:[(0,w.jsx)(`td`,{style:Vg,children:e.type}),(0,w.jsx)(`td`,{style:Vg,children:(0,w.jsx)(`span`,{style:{display:`inline-block`,padding:`1px 6px`,borderRadius:3,fontSize:10.5,fontWeight:600,background:n.bg,color:n.fg},children:e.state})}),(0,w.jsx)(`td`,{style:{...Vg,wordBreak:`break-all`},children:e.local}),(0,w.jsx)(`td`,{style:{...Vg,wordBreak:`break-all`},children:e.remote}),(0,w.jsx)(`td`,{style:{...Vg,textAlign:`right`},children:e.pid||`-`}),(0,w.jsx)(`td`,{style:Vg,children:e.processName||`-`})]},t)})]})]})})]})]})}var Kg={percent:e=>`${Math.round(e)}%`,bytesPerSec:e=>e==null||!isFinite(e)?`—`:e>=1024*1024?(e/(1024*1024)).toFixed(1)+` MB/s`:e>=1024?(e/1024).toFixed(1)+` KB/s`:Math.round(e)+` B/s`,celsius:e=>`${Math.round(e)}°C`,watts:e=>`${Math.round(e)} W`},qg={percent:32,celsius:36,watts:36,bytesPerSec:52};function Jg(e){let t={"1h":60,"6h":360,"24h":1440}[e]||60,n=e=>e===0?`现在`:e<60?`-${e}m`:`-${Math.round(e/60)}h`;return[n(t),n(Math.round(t*2/3)),n(Math.round(t/3)),`现在`]}function Yg(e){if(e.length<2)return``;if(e.length===2)return`M${e[0][0]} ${e[0][1]} L${e[1][0]} ${e[1][1]}`;let t=[`M${e[0][0]} ${e[0][1]}`];for(let n=0;n{if(!o.current)return;let e=o.current,t=()=>u(Math.max(60,Math.floor(e.clientWidth)));t();let n=new ResizeObserver(t);return n.observe(e),()=>n.disconnect()},[]);let p=Kg[r]||(e=>String(Math.round(e))),m=t.length>0,h=m?t.reduce((e,t)=>e+t,0)/t.length:0,g=m?Math.max(...t):0,_=m&&!c.reduced&&!d,v=()=>{s.current||(s.current=!0,f(!0))},y=qg[r]||32,x=Math.max(1,l-y-4),C=m?Math.max(...t,1):1,T=a??(Math.ceil(C*1.1)||1),E=t.length>1?x/(t.length-1):0,D=t.map((e,t)=>[y+t*E,80-e/T*76]),O=D.length>0?Yg(D):``,k=D.length>0?`${O} L ${y+x} 80 L ${y} 80 Z`:``,A=[0,T*.33,T*.66,T].map(e=>({v:e,y:80-e/T*76})),j=Jg(i);return(0,w.jsxs)(`div`,{style:{background:S.surface,border:`1px solid ${S.border}`,borderRadius:10,padding:16},children:[(0,w.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,marginBottom:10},children:[(0,w.jsx)(`div`,{style:{fontSize:13,fontWeight:600,color:S.ink},children:e}),(0,w.jsx)(`div`,{style:{flex:1}}),(0,w.jsxs)(`div`,{style:{display:`flex`,gap:14,fontSize:11.5,color:S.ink3},children:[(0,w.jsxs)(`span`,{children:[`平均 `,(0,w.jsx)(`span`,{className:`mono tnum`,style:{color:S.ink,fontWeight:600},children:m?p(h):`—`})]}),(0,w.jsxs)(`span`,{children:[`峰值 `,(0,w.jsx)(`span`,{className:`mono tnum`,style:{color:S.ink,fontWeight:600},children:m?p(g):`—`})]})]})]}),(0,w.jsx)(`div`,{ref:o,style:{width:`100%`,height:84},children:m?(0,w.jsxs)(`svg`,{width:l,height:84,style:{display:`block`},children:[A.map((e,t)=>(0,w.jsx)(`line`,{x1:y,x2:y+x,y1:e.y,y2:e.y,stroke:`#e5e7eb`,strokeDasharray:`3 3`},`g-${t}`)),A.map((e,t)=>(0,w.jsx)(`text`,{x:y-4,y:e.y+3,textAnchor:`end`,fontSize:`9`,fill:`#9ca3af`,children:p(e.v)},`l-${t}`)),(0,w.jsx)(Hu.path,{d:k,fill:n,initial:_?{opacity:0}:!1,animate:{opacity:.2},transition:_?{duration:.2,delay:.6,ease:`easeOut`}:{duration:0},onAnimationComplete:v}),(0,w.jsx)(Hu.path,{d:O,fill:`none`,stroke:n,strokeWidth:`1.6`,strokeLinejoin:`round`,strokeLinecap:`round`,initial:_?{pathLength:0}:!1,animate:{pathLength:1},transition:_?{duration:.6,ease:`easeOut`}:{duration:0}})]}):(0,w.jsx)(`div`,{style:{height:84,display:`flex`,alignItems:`center`,justifyContent:`center`,fontSize:11.5,color:S.ink4},children:`暂无数据`})}),(0,w.jsx)(`div`,{style:{display:`flex`,justifyContent:`space-between`,fontSize:10.5,color:S.ink4,marginTop:4,paddingLeft:y},className:`mono`,children:j.map((e,t)=>(0,w.jsx)(`span`,{children:e},t))})]})}function Zg(e,t){if(!e||e.length<2)return[];let n=[];for(let r=1;r0&&(a=e/1e3)}n.push(Math.max(0,i/a))}return n}function Qg(e){let t=kd(),n=t?{Authorization:`Bearer `+t}:{};return fetch(e,{headers:n}).then(e=>e.ok?e.json():null).catch(()=>null)}function $g({label:e,value:t,max:n,pct:r,color:i,mono:a}){return(0,w.jsxs)(`div`,{children:[(0,w.jsxs)(`div`,{style:{display:`flex`,justifyContent:`space-between`,fontSize:11,color:S.ink3,marginBottom:4},children:[(0,w.jsx)(`span`,{children:e}),(0,w.jsx)(`span`,{className:`mono`,children:n})]}),(0,w.jsx)(`div`,{className:a?`mono tnum`:`tnum`,style:{...S.type.heading,color:S.ink,lineHeight:1,marginBottom:5},children:t}),(0,w.jsx)(`div`,{style:{height:4,borderRadius:2,background:`#f1f5f9`,overflow:`hidden`},children:(0,w.jsx)(`div`,{style:{width:`${Math.min(100,r)}%`,height:`100%`,background:i,borderRadius:2,transition:`width 0.4s ease`}})})]})}function e_({series:e,color:t}){if(!e||e.length<2)return(0,w.jsx)(`div`,{style:{height:18,fontSize:9,color:S.ink4,lineHeight:`18px`},children:`—`});let n=Math.min(...e),r=Math.max(...e)-n||1,i=e.map((t,i)=>{let a=i/(e.length-1)*140,o=17-(t-n)/r*16;return`${a.toFixed(1)},${o.toFixed(1)}`}).join(` `);return(0,w.jsx)(`svg`,{width:`100%`,height:18,viewBox:`0 0 140 18`,preserveAspectRatio:`none`,style:{display:`block`},children:(0,w.jsx)(`polyline`,{points:i,fill:`none`,stroke:t,strokeWidth:`1.4`,strokeLinejoin:`round`})})}function t_(e){return e==null||!isFinite(e)?`—`:e>=1024*1024?(e/(1024*1024)).toFixed(1)+` MB/s`:e>=1024?(e/1024).toFixed(1)+` KB/s`:Math.round(e)+` B/s`}function n_(e,t=1){return e==null||!isFinite(e)?`—`:e.toFixed(t)}function r_({disks:e}){let t=Array.isArray(e)?[...e]:[];if(!t.length)return null;t.sort((e,t)=>Number(t.rotational)-Number(e.rotational)||e.name.localeCompare(t.name));let n=({label:e,value:t,tone:n})=>(0,w.jsxs)(`div`,{style:{minHeight:52,padding:`8px 10px`,borderRadius:8,background:S.surfaceAlt,border:`1px solid ${S.borderSoft}`},children:[(0,w.jsx)(`div`,{style:{fontSize:10.5,color:S.ink3,marginBottom:5},children:e}),(0,w.jsx)(`div`,{className:`mono tnum`,style:{fontSize:14,fontWeight:700,color:n||S.ink},children:t})]});return(0,w.jsxs)(`div`,{style:{background:S.surface,border:`1px solid ${S.border}`,borderRadius:10,padding:16,marginBottom:12},children:[(0,w.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,marginBottom:12},children:[(0,w.jsx)(`div`,{style:{fontSize:13,fontWeight:600,color:S.ink},children:`物理磁盘 I/O`}),(0,w.jsx)(`div`,{style:{fontSize:11.5,color:S.ink3,marginLeft:10},children:`按块设备 · 吞吐 / IOPS / 忙碌度 / 延迟`})]}),(0,w.jsx)(`div`,{style:{display:`grid`,gridTemplateColumns:`repeat(auto-fit, minmax(360px, 1fr))`,gap:12},children:t.map(e=>{let t=Math.max(0,Math.min(100,e.utilPercent||0)),r=t>=85?S.red:t>=65?S.amber:S.green;return(0,w.jsxs)(`div`,{style:{border:`1px solid ${S.borderSoft}`,borderRadius:8,background:`#fff`,padding:12},children:[(0,w.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,gap:8,marginBottom:10},children:[(0,w.jsx)(`div`,{style:{width:30,height:30,borderRadius:7,background:e.rotational?`#fffbeb`:`#eff4ff`,color:e.rotational?S.amber:S.blue,border:`1px solid ${e.rotational?`#fde68a`:`#bfdbfe`}`,display:`flex`,alignItems:`center`,justifyContent:`center`},children:(0,w.jsx)(D,{name:`hardDrive`,size:15,stroke:1.8})}),(0,w.jsxs)(`div`,{style:{minWidth:0},children:[(0,w.jsxs)(`div`,{className:`mono`,style:{fontSize:13,fontWeight:700,color:S.ink},children:[e.path||`/dev/${e.name}`,(0,w.jsx)(`span`,{style:{marginLeft:7,padding:`1px 6px`,borderRadius:3,background:e.rotational?`#fffbeb`:`#eff4ff`,color:e.rotational?`#b45309`:S.blueDeep,border:`1px solid ${e.rotational?`#fde68a`:`#bfdbfe`}`,fontSize:10.5,fontFamily:`inherit`},children:e.kind||(e.rotational?`HDD`:`SSD`)})]}),(0,w.jsx)(`div`,{style:{fontSize:11,color:S.ink3,marginTop:2,whiteSpace:`nowrap`,overflow:`hidden`,textOverflow:`ellipsis`},children:e.model||`未知型号`})]}),(0,w.jsx)(`div`,{style:{flex:1}}),(0,w.jsxs)(`div`,{className:`mono tnum`,style:{fontSize:12,fontWeight:700,color:r},children:[n_(t,0),`%`]})]}),(0,w.jsx)(`div`,{style:{height:5,borderRadius:3,background:`#e5e7eb`,overflow:`hidden`,marginBottom:10},children:(0,w.jsx)(`div`,{style:{width:`${t}%`,height:`100%`,background:r,borderRadius:3}})}),(0,w.jsxs)(`div`,{style:{display:`grid`,gridTemplateColumns:`repeat(4, 1fr)`,gap:8},children:[(0,w.jsx)(n,{label:`读取`,value:t_(e.readBytesPerSec),tone:S.teal}),(0,w.jsx)(n,{label:`写入`,value:t_(e.writeBytesPerSec),tone:S.amber}),(0,w.jsx)(n,{label:`读 IOPS`,value:n_(e.readIops,1)}),(0,w.jsx)(n,{label:`写 IOPS`,value:n_(e.writeIops,1)}),(0,w.jsx)(n,{label:`平均等待`,value:`${n_(e.avgAwaitMs,1)} ms`,tone:e.avgAwaitMs>=50?S.red:S.ink}),(0,w.jsx)(n,{label:`读等待`,value:`${n_(e.readAwaitMs,1)} ms`}),(0,w.jsx)(n,{label:`写等待`,value:`${n_(e.writeAwaitMs,1)} ms`}),(0,w.jsx)(n,{label:`队列深度`,value:n_(e.avgQueueSize,2)})]})]},e.name)})})]})}function i_({cores:e}){let t=Array.isArray(e)?e:[];return t.length?(0,w.jsxs)(`div`,{style:{background:S.surface,border:`1px solid ${S.border}`,borderRadius:10,padding:16,marginBottom:12},children:[(0,w.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,marginBottom:12},children:[(0,w.jsx)(`div`,{style:{fontSize:13,fontWeight:600,color:S.ink},children:`CPU 每核使用率`}),(0,w.jsxs)(`div`,{style:{fontSize:11.5,color:S.ink3,marginLeft:10},children:[t.length,` 核 · 实时`]})]}),(0,w.jsx)(`div`,{style:{display:`grid`,gridTemplateColumns:`repeat(auto-fill, minmax(92px, 1fr))`,gap:8},children:t.map((e,t)=>{let n=Math.max(0,Math.min(100,Number.isFinite(e)?e:0)),r=n>=85?S.red:n>=65?S.amber:S.blue;return(0,w.jsxs)(`div`,{style:{minHeight:58,border:`1px solid ${S.borderSoft}`,borderRadius:8,background:S.surfaceAlt,padding:`9px 10px`},children:[(0,w.jsxs)(`div`,{style:{display:`flex`,justifyContent:`space-between`,alignItems:`center`,marginBottom:8},children:[(0,w.jsxs)(`span`,{className:`mono`,style:{fontSize:11,color:S.ink3},children:[`CPU `,t]}),(0,w.jsxs)(`span`,{className:`mono tnum`,style:{fontSize:12,fontWeight:700,color:r},children:[Math.round(n),`%`]})]}),(0,w.jsx)(`div`,{style:{height:5,borderRadius:3,background:`#e5e7eb`,overflow:`hidden`},children:(0,w.jsx)(`div`,{style:{width:`${n}%`,height:`100%`,background:r,borderRadius:3,transition:`width 0.4s ease`}})})]},t)})})]}):null}function a_({g:e,live:t,history:n}){let r=e.memUsed/e.memTotal*100,i=n||{};return(0,w.jsxs)(`div`,{style:{border:`1px solid ${S.borderSoft}`,borderRadius:8,padding:14,background:S.surfaceAlt},children:[(0,w.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,gap:8,marginBottom:10},children:[(0,w.jsx)(`div`,{style:{width:26,height:26,borderRadius:6,background:`linear-gradient(140deg, ${S.indigo}, #4338ca)`,color:`white`,display:`flex`,alignItems:`center`,justifyContent:`center`},children:(0,w.jsx)(D,{name:`bolt`,size:13,stroke:2})}),(0,w.jsxs)(`div`,{style:{fontSize:13,fontWeight:600,color:S.ink},children:[`GPU `,e.id,` · `,e.model]}),(0,w.jsx)(`div`,{style:{flex:1}}),(0,w.jsxs)(J,{tone:`green`,children:[(0,w.jsx)(q,{tone:`green`,size:6}),`正常`]})]}),(0,w.jsxs)(`div`,{style:{display:`grid`,gridTemplateColumns:`1fr 1fr`,gap:10,marginBottom:6},children:[(0,w.jsxs)(`div`,{children:[(0,w.jsx)($g,{label:`利用率`,value:`${t.toFixed(0)}%`,max:`100%`,pct:t,color:S.indigo}),(0,w.jsx)(e_,{series:i.util,color:S.indigo})]}),(0,w.jsxs)(`div`,{children:[(0,w.jsx)($g,{label:`显存`,value:`${e.memUsed} GB`,max:`${e.memTotal} GB`,pct:r,color:S.cyan}),(0,w.jsx)(e_,{series:i.memPercent,color:S.cyan})]}),(0,w.jsxs)(`div`,{children:[(0,w.jsx)($g,{label:`温度`,value:`${e.temp}°`,max:`85°`,pct:e.temp/85*100,color:S.amber,mono:!0}),(0,w.jsx)(e_,{series:i.temp,color:S.amber})]}),(0,w.jsxs)(`div`,{children:[(0,w.jsx)($g,{label:`功耗`,value:`${e.power} W`,max:`${e.max} W`,pct:e.power/e.max*100,color:S.green,mono:!0}),(0,w.jsx)(e_,{series:i.power,color:S.green})]})]})]})}function o_({data:e,status:t}){if(t===`no-nvidia-smi`)return null;let n={fontSize:10.5,fontWeight:600,color:S.ink3,letterSpacing:`0.06em`,textTransform:`uppercase`};return(0,w.jsxs)(`div`,{style:{background:S.surface,border:`1px solid ${S.border}`,borderRadius:10,padding:0,overflow:`hidden`,marginBottom:12},children:[(0,w.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,padding:`12px 16px`,borderBottom:`1px solid ${S.borderSoft}`},children:[(0,w.jsx)(`div`,{style:{fontSize:13,fontWeight:600,color:S.ink},children:`GPU 进程占用`}),(0,w.jsx)(`div`,{style:{flex:1}}),(0,w.jsx)(`span`,{style:{fontSize:11.5,color:S.ink3},children:t===`ok`?`${e.length} 个活跃进程`:t===`error`?`进程数据暂不可用`:`加载中…`})]}),t===`ok`&&e.length===0?(0,w.jsx)(`div`,{style:{padding:`20px 16px`,color:S.ink4,fontSize:13,textAlign:`center`},children:`当前 GPU 上无活跃进程`}):t===`ok`?(0,w.jsxs)(`table`,{style:{width:`100%`,borderCollapse:`collapse`},children:[(0,w.jsx)(`thead`,{children:(0,w.jsxs)(`tr`,{style:{background:`#fafbfc`},children:[(0,w.jsx)(`th`,{style:{...n,textAlign:`left`,padding:`10px 16px`},children:`PID`}),(0,w.jsx)(`th`,{style:{...n,textAlign:`left`,padding:`10px 12px`},children:`进程`}),(0,w.jsx)(`th`,{style:{...n,textAlign:`left`,padding:`10px 12px`},children:`容器`}),(0,w.jsx)(`th`,{style:{...n,textAlign:`left`,padding:`10px 12px`},children:`GPU UUID`}),(0,w.jsx)(`th`,{style:{...n,textAlign:`right`,padding:`10px 16px`},children:`显存 (MiB)`})]})}),(0,w.jsx)(`tbody`,{children:e.map((e,t)=>(0,w.jsxs)(`tr`,{style:{borderTop:t?`1px solid ${S.borderSoft}`:`none`},children:[(0,w.jsx)(`td`,{style:{padding:`10px 16px`,fontSize:12},className:`mono tnum`,children:e.pid}),(0,w.jsx)(`td`,{style:{padding:`10px 12px`,fontSize:12.5,color:S.ink},children:e.name}),(0,w.jsx)(`td`,{style:{padding:`10px 12px`,fontSize:12,color:S.ink2},className:`mono`,children:e.containerHint||`—`}),(0,w.jsx)(`td`,{style:{padding:`10px 12px`,fontSize:11.5,color:S.ink3},className:`mono`,children:e.gpuUuid}),(0,w.jsx)(`td`,{style:{padding:`10px 16px`,textAlign:`right`,fontSize:12,color:S.ink},className:`mono tnum`,children:e.vramMiB})]},`${e.pid}-${e.gpuUuid}`))})]}):null]})}function s_({cpu:e,gpuAvg:t,memPct:n,memUsed:r,memTotal:i,diskPct:a,diskUsed:o,diskTotal:s,hasGpu:c,gpuCount:l,gpuModel:u}){let d=({icon:e,label:t,pct:n,value:r,sub:i,color:a})=>{let o=n==null;return(0,w.jsxs)(`div`,{style:{background:S.surface,border:`1px solid ${S.border}`,borderRadius:10,padding:`14px 16px`},children:[(0,w.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,gap:6,marginBottom:8},children:[(0,w.jsx)(D,{name:e,size:13,stroke:1.8,style:{color:o?S.ink4:a}}),(0,w.jsx)(`div`,{style:{fontSize:12,fontWeight:600,color:S.ink},children:t})]}),(0,w.jsx)(`div`,{className:`mono tnum`,style:{...S.type.title,fontWeight:700,color:o?S.ink4:a,lineHeight:1,letterSpacing:`-0.02em`},children:r}),(0,w.jsx)(`div`,{style:{fontSize:11,color:S.ink3,marginTop:6},children:i})]})};return(0,w.jsxs)(`div`,{style:{display:`grid`,gridTemplateColumns:`repeat(4, 1fr)`,gap:12,marginBottom:12},children:[(0,w.jsx)(d,{icon:`cpu`,label:`CPU 使用率`,pct:e,value:e==null?`—`:`${e}%`,sub:e==null?`加载中…`:`当前负载`,color:S.blue}),(0,w.jsx)(d,{icon:`bolt`,label:`GPU 平均`,pct:c?t:0,value:c?t==null?`—`:`${t}%`:`无 GPU`,sub:c?`${l} × ${u}`:`本节点未检测到 NVIDIA GPU`,color:S.indigo}),(0,w.jsx)(d,{icon:`memory`,label:`内存`,pct:n,value:n==null?`—`:`${n}%`,sub:r!=null&&i!=null?`${r} GB / ${i} GB`:`加载中…`,color:S.teal}),(0,w.jsx)(d,{icon:`hardDrive`,label:`磁盘`,pct:a,value:a==null?`—`:`${a}%`,sub:o!=null&&s!=null?`${o} GB / ${s} GB`:`加载中…`,color:S.amber})]})}function c_(){let[e,t]=(0,b.useState)(`1h`),n=[{value:`1h`,label:`1 小时`},{value:`6h`,label:`6 小时`},{value:`24h`,label:`24 小时`}],[r,i]=(0,b.useState)({}),[a,o]=(0,b.useState)(null),[s,c]=(0,b.useState)(null),[l,u]=(0,b.useState)([]),[d,f]=(0,b.useState)(null),[p,m]=(0,b.useState)({data:[],status:`idle`});(0,b.useEffect)(()=>{let t=async()=>{try{let[t,n,r,a]=await Promise.all([Qg(`/api/v1/metrics`),Qg(`/api/v1/metrics/history?window=`+e),Qg(`/api/v1/device`),Qg(`/api/v1/metrics/history/gpu?window=`+e)]);t&&o(t),n&&c(n),a&&f(a),r&&i({model:r.cpuModel,name:r.hostname}),t&&t.gpuData&&u(t.gpuData)}catch{}};t();let n=setInterval(t,5e3);return()=>clearInterval(n)},[e]),(0,b.useEffect)(()=>{if(!(l.length>0)){m({data:[],status:`no-gpu`});return}let e=!1,t=async()=>{try{let t=await fetch(`/api/v1/gpu/processes`,{headers:{Authorization:`Bearer `+(kd()||``)}});if(e)return;if(t.status===503){m({data:[],status:`no-nvidia-smi`});return}if(!t.ok){m(e=>({...e,status:`error`}));return}let n=await t.json();m({data:Array.isArray(n)?n:[],status:`ok`})}catch{e||m(e=>({...e,status:`error`}))}};t();let n=setInterval(t,5e3);return()=>{e=!0,clearInterval(n)}},[l.length]);let h=a?Math.round(a.cpuUsedPercent):null,g=l.length>0?Math.round(l.reduce((e,t)=>e+t.gpuUtil,0)/l.length):null,_=a?Math.round(a.memoryTotal/(1024*1024*1024)):null,v=a?Math.round(a.memoryUsed/(1024*1024*1024)):null,y=a?Math.round(a.memoryUsedPercent):null,x=a&&a.diskData&&a.diskData.length>0?a.diskData.reduce((e,t)=>t.total>e.total?t:e,a.diskData[0]):null,C=x?Math.round(x.usedPercent):null,T=x?Math.round(x.used/(1024*1024*1024)):null,E=x?Math.round(x.total/(1024*1024*1024)):null,D=s&&s.cpuPercent?s.cpuPercent:[],O=s&&s.gpuUtil?s.gpuUtil:[],k=s&&s.memoryPercent?s.memoryPercent:[],A=s&&s.diskPercent?s.diskPercent:[];s&&s.gpuMemPercent&&s.gpuMemPercent;let j=Zg(s?.netBytesSent,s?.timestamps),ee=Zg(s?.netBytesRecv,s?.timestamps),M=Zg(s?.diskReadBytes,s?.timestamps),N=Zg(s?.diskWriteBytes,s?.timestamps),P=(n.find(t=>t.value===e)||n[0]).label;return(0,w.jsxs)(`div`,{style:{flex:1,padding:`20px 24px`,overflow:`auto`,background:S.surfaceAlt},children:[(0,w.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,marginBottom:14},children:[(0,w.jsxs)(`div`,{children:[(0,w.jsx)(`div`,{style:{...S.type.heading,color:S.ink},children:`监控`}),(0,w.jsxs)(`div`,{style:{fontSize:12,color:S.ink3,marginTop:3,display:`flex`,alignItems:`center`,gap:8},children:[(0,w.jsxs)(`span`,{children:[(0,w.jsx)(`span`,{className:`edge-live-dot`,style:{display:`inline-block`,width:6,height:6,borderRadius:`50%`,background:S.green,marginRight:5,verticalAlign:`middle`}}),`实时刷新中`]}),(0,w.jsx)(`span`,{style:{color:`#cbd5e1`},children:`·`}),(0,w.jsx)(`span`,{children:`采样间隔 5s`}),(0,w.jsx)(`span`,{style:{color:`#cbd5e1`},children:`·`}),(0,w.jsx)(`span`,{children:r.model||``})]})]}),(0,w.jsx)(`div`,{style:{flex:1}}),(0,w.jsx)(`div`,{style:{display:`flex`,gap:2,background:S.surfaceAlt,padding:2,borderRadius:8},children:n.map(n=>(0,w.jsx)(`button`,{onClick:()=>t(n.value),style:{padding:`6px 12px`,fontSize:12,fontWeight:500,border:`none`,background:e===n.value?S.surface:`transparent`,color:e===n.value?S.blueDeep:S.ink3,borderRadius:6,cursor:`pointer`,boxShadow:e===n.value?`0 1px 2px rgba(0,0,0,0.04)`:`none`},children:n.label},n.value))})]}),(0,w.jsx)(s_,{cpu:h,gpuAvg:g,memPct:y,memUsed:v,memTotal:_,diskPct:C,diskUsed:T,diskTotal:E,hasGpu:l.length>0,gpuCount:l.length,gpuModel:l.length>0?l[0].productName:``}),(0,w.jsx)(i_,{cores:a?.cpuPercent}),(0,w.jsx)(r_,{disks:a?.diskIO}),(0,w.jsxs)(`div`,{style:{display:`grid`,gridTemplateColumns:`1fr 1fr`,gap:12,marginBottom:12},children:[(0,w.jsx)(Xg,{title:`CPU 使用率 · 最近 ${P}`,window:e,series:D,color:S.blue,unit:`percent`,max:100}),(0,w.jsx)(Xg,{title:`GPU 使用率 · 最近 ${P}`,window:e,series:O,color:S.indigo,unit:`percent`,max:100})]}),(0,w.jsxs)(`div`,{style:{display:`grid`,gridTemplateColumns:`1fr 1fr`,gap:12,marginBottom:12},children:[(0,w.jsx)(Xg,{title:`内存使用率 · 最近 ${P}`,window:e,series:k,color:S.violet,unit:`percent`,max:100}),(0,w.jsx)(Xg,{title:`磁盘使用率 · 最近 ${P}`,window:e,series:A,color:S.cyan,unit:`percent`,max:100})]}),(0,w.jsxs)(`div`,{style:{display:`grid`,gridTemplateColumns:`1fr 1fr`,gap:12,marginBottom:12},children:[(0,w.jsx)(Xg,{title:`网络入站 · 最近 ${P}`,window:e,series:ee,color:S.green,unit:`bytesPerSec`}),(0,w.jsx)(Xg,{title:`网络出站 · 最近 ${P}`,window:e,series:j,color:S.amber,unit:`bytesPerSec`})]}),(0,w.jsxs)(`div`,{style:{display:`grid`,gridTemplateColumns:`1fr 1fr`,gap:12,marginBottom:12},children:[(0,w.jsx)(Xg,{title:`磁盘读取 · 最近 ${P}`,window:e,series:M,color:S.teal,unit:`bytesPerSec`}),(0,w.jsx)(Xg,{title:`磁盘写入 · 最近 ${P}`,window:e,series:N,color:S.red,unit:`bytesPerSec`})]}),(0,w.jsxs)(`div`,{style:{background:S.surface,border:`1px solid ${S.border}`,borderRadius:10,padding:16,marginBottom:12},children:[(0,w.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,marginBottom:12},children:[(0,w.jsx)(`div`,{style:{fontSize:13,fontWeight:600,color:S.ink},children:`GPU 卡详情`}),(0,w.jsx)(`div`,{style:{fontSize:11.5,color:S.ink3,marginLeft:10},children:l.length>0?`${l.length} 卡 · ${l[0].productName} · 时序 ${e}`:`本节点未检测到 NVIDIA GPU`})]}),(0,w.jsx)(`div`,{style:{display:`grid`,gridTemplateColumns:l.length>1?`1fr 1fr`:`1fr`,gap:12},children:l.length>0?l.map((e,t)=>{let n=d&&d.perGpu?d.perGpu.find(t=>t.id===String(e.index))||d.perGpu[t]:null;return(0,w.jsx)(a_,{g:{id:e.index,model:e.productName,util:Math.round(e.gpuUtil),memUsed:e.memUsed,memTotal:e.memTotal,temp:e.temperature,power:e.powerDraw,max:e.powerLimit},live:Math.round(e.gpuUtil),history:n},e.index)}):(0,w.jsx)(`div`,{style:{padding:`24px 0`,textAlign:`center`,color:S.ink4,fontSize:13},children:`本节点未检测到 NVIDIA GPU`})})]}),l.length>0&&(0,w.jsx)(o_,{data:p.data,status:p.status})]})}var l_={height:39,padding:`0 14px`,borderRadius:`6px 6px 0 0`,fontSize:13},u_={padding:`8px 12px`,fontSize:10.5,color:S.ink3,textTransform:`uppercase`,letterSpacing:`0.04em`,fontWeight:700,background:`#f8fafc`,borderBottom:`1px solid ${S.borderSoft}`},d_={padding:`9px 12px`,fontSize:12,color:S.ink,borderBottom:`1px solid ${S.borderSoft}`,verticalAlign:`top`};function f_(e){return!e||e<0?`-`:e<60?`${e}s`:e<3600?`${Math.floor(e/60)}m`:e<86400?`${Math.floor(e/3600)}h`:`${Math.floor(e/86400)}d ${Math.floor(e%86400/3600)}h`}function p_(e){if(!e)return`-`;let t=new Date(e);return Number.isNaN(t.getTime())?`-`:t.toLocaleString()}function m_(e){return e?e>=1024*1024?(e/1024/1024).toFixed(1)+` MB`:e>=1024?(e/1024).toFixed(0)+` KB`:e+` B`:`-`}function $({tone:e=`slate`,children:t}){let n={red:{bg:S.redSoft,fg:`#b91c1c`,bd:`#fecaca`},amber:{bg:S.amberSoft,fg:`#a16207`,bd:`#fde68a`},blue:{bg:S.blueSoft,fg:S.blueDeep,bd:`#bfdbfe`},green:{bg:S.greenSoft,fg:`#047857`,bd:`#bbf7d0`},slate:{bg:S.surfaceAlt,fg:S.ink3,bd:S.border}}[e];return(0,w.jsx)(`span`,{style:{display:`inline-flex`,alignItems:`center`,gap:4,height:20,padding:`0 7px`,borderRadius:5,fontSize:11,fontWeight:700,color:n.fg,background:n.bg,border:`1px solid ${n.bd}`},children:t})}function h_({tone:e=`slate`,icon:t,children:n,onClick:r,disabled:i,title:a}){let o={red:{bg:`#fff1f2`,fg:`#dc2626`,bd:`#fecdd3`},amber:{bg:`#fffbeb`,fg:`#b45309`,bd:`#fde68a`},blue:{bg:`#eff6ff`,fg:S.blue,bd:`#bfdbfe`},green:{bg:`#ecfdf5`,fg:`#047857`,bd:`#bbf7d0`},slate:{bg:`#f8fafc`,fg:S.ink2,bd:S.border},dark:{bg:`#1e293b`,fg:`#fff`,bd:`#1e293b`}}[e];return(0,w.jsxs)(`button`,{title:a,disabled:i,onClick:r,style:{height:32,padding:t&&n?`0 11px`:`0 10px`,borderRadius:6,border:`1px solid ${i?S.border:o.bd}`,background:i?S.surfaceAlt:o.bg,color:i?S.ink4:o.fg,display:`inline-flex`,alignItems:`center`,justifyContent:`center`,gap:7,fontSize:12,fontWeight:800,cursor:i?`default`:`pointer`,whiteSpace:`nowrap`},children:[t&&(0,w.jsx)(D,{name:t,size:13,stroke:2}),n]})}function g_({id:e,issue:t,active:n}){let r=e===`codex`?`code`:e===`hermes`?`zap`:e===`openclaw`?`openclaw`:e===`agent-browser`?`globe`:`brain`,i=t?S.red:e===`codex`?S.blue:e===`openclaw`?S.violet:e===`hermes`?S.teal:S.amber;return(0,w.jsx)(`span`,{style:{width:30,height:30,borderRadius:8,flexShrink:0,display:`inline-flex`,alignItems:`center`,justifyContent:`center`,color:`#fff`,background:i,boxShadow:n?`0 6px 14px ${i}35`:`none`},children:(0,w.jsx)(D,{name:r,size:15,stroke:2})})}function __({icon:e,label:t,value:n,tone:r=S.blue}){return(0,w.jsxs)(`div`,{style:{background:S.surface,border:`1px solid ${S.border}`,borderRadius:8,padding:`12px 14px`,minWidth:132},children:[(0,w.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,gap:6,color:S.ink3,fontSize:11.5,fontWeight:600},children:[(0,w.jsx)(D,{name:e,size:13,stroke:1.8,style:{color:r}}),t]}),(0,w.jsx)(`div`,{className:`mono tnum`,style:{marginTop:8,...S.type.title,lineHeight:1,color:S.ink,fontWeight:800},children:n??`-`})]})}function v_({title:e,right:t,children:n}){return(0,w.jsxs)(`div`,{style:{background:S.surface,border:`1px solid ${S.border}`,borderRadius:8,overflow:`hidden`,flexShrink:0},children:[(0,w.jsxs)(`div`,{style:{height:38,padding:`0 14px`,display:`flex`,alignItems:`center`,borderBottom:`1px solid ${S.borderSoft}`},children:[(0,w.jsx)(`div`,{style:{fontSize:13,fontWeight:800,color:S.ink},children:e}),(0,w.jsx)(`div`,{style:{flex:1}}),t]}),n]})}function y_({text:e=`暂无数据`}){return(0,w.jsx)(`div`,{style:{padding:18,color:S.ink3,fontSize:12},children:e})}var b_=[[`working`,`Working`],[`blocked`,`Blocked`],[`idle`,`Idle`],[`done`,`Done`],[`unknown`,`Unknown`]];function x_(e){return{working:{label:`Working`,tone:`green`,color:S.green,soft:`#ecfdf5`,border:`#bbf7d0`},blocked:{label:`Blocked`,tone:`red`,color:S.red,soft:`#fff1f2`,border:`#fecdd3`},idle:{label:`Idle`,tone:`amber`,color:S.amber,soft:`#fffbeb`,border:`#fde68a`},done:{label:`Done`,tone:`slate`,color:S.ink4,soft:`#f8fafc`,border:S.borderSoft},unknown:{label:`Unknown`,tone:`slate`,color:S.ink4,soft:`#f8fafc`,border:S.borderSoft}}[e]||{label:`Unknown`,tone:`slate`,color:S.ink4,soft:`#f8fafc`,border:S.borderSoft}}function S_(e){if(!e)return`-`;let t=String(e).split(`/`).filter(Boolean);return t.length<=2?e:t.slice(-2).join(`/`)}function C_({card:e,active:t,onClick:n}){let r=x_(e.status);return(0,w.jsxs)(`button`,{onClick:n,style:{width:`100%`,minHeight:58,textAlign:`left`,display:`grid`,gridTemplateColumns:`12px 1fr auto`,gap:10,alignItems:`center`,padding:`10px 11px`,border:`1px solid ${t?r.color:S.borderSoft}`,borderRadius:7,background:t?r.soft:S.surface,cursor:`pointer`,boxShadow:t?`0 1px 3px rgba(15,23,42,.08)`:`none`},children:[(0,w.jsx)(`span`,{style:{width:9,height:9,borderRadius:5,background:r.color}}),(0,w.jsxs)(`span`,{style:{minWidth:0},children:[(0,w.jsx)(`span`,{style:{display:`block`,fontSize:12.5,color:S.ink,fontWeight:850,whiteSpace:`nowrap`,overflow:`hidden`,textOverflow:`ellipsis`},children:e.name||e.id}),(0,w.jsxs)(`span`,{className:`mono`,style:{display:`block`,marginTop:4,fontSize:10.5,color:S.ink4,whiteSpace:`nowrap`,overflow:`hidden`,textOverflow:`ellipsis`},children:[S_(e.cwd),e.gitBranch?` · ${e.gitBranch}`:``]})]}),(0,w.jsxs)(`span`,{style:{display:`flex`,flexDirection:`column`,alignItems:`flex-end`,gap:4},children:[(0,w.jsx)($,{tone:r.tone,children:e.kind}),e.pid?(0,w.jsxs)(`span`,{className:`mono`,style:{fontSize:10,color:S.ink4},children:[`PID `,e.pid]}):null]})]})}function w_({card:e}){let t=e?.transcriptPath||``,{data:n,loading:r,error:i}=ef(t,200,3e3),a=(0,b.useRef)(null);return(0,b.useEffect)(()=>{a.current&&(a.current.scrollTop=a.current.scrollHeight)},[n?.text,t]),e?t?i?(0,w.jsxs)(`div`,{style:{padding:14,color:S.red,fontSize:12.5},children:[`transcript 读取失败:`,i.message||String(i)]}):(0,w.jsx)(`pre`,{ref:a,style:{margin:0,padding:14,minHeight:0,height:`100%`,overflow:`auto`,background:`#0f172a`,color:`#dbeafe`,fontFamily:S.mono,fontSize:11,lineHeight:1.55,whiteSpace:`pre-wrap`,wordBreak:`break-word`},children:r&&!n?`加载 transcript...`:n?.text||`transcript 暂无内容`}):(0,w.jsx)(y_,{text:`该 agent 没有可读取的 transcript 路径`}):(0,w.jsx)(y_,{text:`请选择一个 agent 查看详情`})}function T_({board:e}){let t=e?.agents||[],[n,r]=(0,b.useState)(``);(0,b.useEffect)(()=>{if(!t.length){r(``);return}t.some(e=>e.id===n)||r(t[0].id)},[t,n]);let i=t.find(e=>e.id===n)||t[0]||null,a=e?.counts||{},o=b_.map(([e,n])=>({status:e,label:n,count:a[e]||0,cards:t.filter(t=>(t.status||`unknown`)===e)})).filter(e=>e.status!==`unknown`||e.count>0||e.cards.length>0);if(!t.length)return(0,w.jsx)(y_,{text:`没有发现 agent,Board 会在检测到进程、worker 或会话后显示。`});let s=x_(i?.status);return(0,w.jsxs)(`div`,{style:{padding:12,display:`grid`,gridTemplateColumns:`360px 1fr`,gap:12,minHeight:560},children:[(0,w.jsxs)(`div`,{style:{border:`1px solid ${S.border}`,borderRadius:8,overflow:`hidden`,background:S.surface,minHeight:0},children:[(0,w.jsxs)(`div`,{style:{padding:`11px 14px`,display:`flex`,alignItems:`center`,borderBottom:`1px solid ${S.borderSoft}`},children:[(0,w.jsx)(`div`,{style:{fontSize:13,fontWeight:900,color:S.ink},children:`Agent Board`}),(0,w.jsx)(`div`,{style:{flex:1}}),(0,w.jsx)($,{tone:`slate`,children:t.length})]}),(0,w.jsx)(`div`,{style:{padding:10,display:`grid`,gap:12,maxHeight:`calc(100vh - 330px)`,overflow:`auto`},children:o.map(e=>{let t=x_(e.status),n=e.status===`blocked`&&e.count>0;return(0,w.jsxs)(`div`,{style:{border:`1px solid ${n?t.border:S.borderSoft}`,borderRadius:8,background:n?t.soft:S.surface,overflow:`hidden`},children:[(0,w.jsxs)(`div`,{style:{padding:`9px 10px`,display:`flex`,alignItems:`center`,gap:8,borderBottom:e.cards.length?`1px solid ${n?t.border:S.borderSoft}`:`none`},children:[(0,w.jsx)(`span`,{style:{width:8,height:8,borderRadius:4,background:t.color}}),(0,w.jsx)(`div`,{style:{fontSize:12.5,fontWeight:900,color:n?S.red:S.ink},children:e.label}),(0,w.jsx)(`div`,{style:{flex:1}}),(0,w.jsx)($,{tone:t.tone,children:e.count})]}),e.cards.length?(0,w.jsx)(`div`,{style:{display:`grid`,gap:7,padding:8},children:e.cards.map(e=>(0,w.jsx)(C_,{card:e,active:i?.id===e.id,onClick:()=>r(e.id)},e.id))}):(0,w.jsx)(`div`,{style:{padding:`9px 10px`,color:S.ink4,fontSize:11.5},children:`暂无`})]},e.status)})})]}),(0,w.jsxs)(`div`,{style:{minWidth:0,border:`1px solid ${S.border}`,borderRadius:8,overflow:`hidden`,background:S.surface,display:`grid`,gridTemplateRows:`auto 1fr`,minHeight:0},children:[(0,w.jsxs)(`div`,{style:{padding:`13px 15px`,borderBottom:`1px solid ${S.borderSoft}`,display:`flex`,alignItems:`center`,gap:10},children:[(0,w.jsx)(`span`,{style:{width:10,height:10,borderRadius:5,background:s.color,flexShrink:0}}),(0,w.jsxs)(`div`,{style:{minWidth:0,flex:1},children:[(0,w.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,gap:8,minWidth:0},children:[(0,w.jsx)(`div`,{style:{...S.type.heading,fontWeight:900,color:S.ink,whiteSpace:`nowrap`,overflow:`hidden`,textOverflow:`ellipsis`},children:i?.name||`Agent`}),(0,w.jsx)($,{tone:s.tone,children:s.label}),i?.model&&(0,w.jsx)($,{tone:String(i.model).includes(`fable`)?`red`:`blue`,children:i.model})]}),(0,w.jsxs)(`div`,{className:`mono`,style:{marginTop:5,color:S.ink4,fontSize:10.5,whiteSpace:`nowrap`,overflow:`hidden`,textOverflow:`ellipsis`},children:[i?.cwd||`-`,i?.gitBranch?` · ${i.gitBranch}`:``]})]}),(0,w.jsxs)(`div`,{style:{display:`flex`,gap:6,flexWrap:`wrap`,justifyContent:`flex-end`},children:[i?.lastAt&&(0,w.jsx)($,{tone:`slate`,children:p_(i.lastAt)}),i?.transcriptPath&&(0,w.jsx)($,{tone:`amber`,children:`只读 transcript`})]})]}),(0,w.jsxs)(`div`,{style:{display:`grid`,gridTemplateRows:`auto 1fr`,minHeight:0},children:[(0,w.jsxs)(`div`,{style:{padding:`10px 14px`,borderBottom:`1px solid ${S.borderSoft}`,background:`#f8fafc`},children:[(0,w.jsx)(`div`,{style:{color:S.ink3,fontSize:11.5,fontWeight:800,marginBottom:5},children:`最近事件 / Prompt`}),(0,w.jsx)(`div`,{style:{color:S.ink2,fontSize:12.5,lineHeight:1.45,wordBreak:`break-word`},children:i?.lastText||`暂无最近事件`}),i?.transcriptPath&&(0,w.jsx)(`div`,{className:`mono`,style:{marginTop:6,color:S.ink4,fontSize:10.5,wordBreak:`break-all`},children:i.transcriptPath})]}),(0,w.jsx)(w_,{card:i})]})]})]})}function E_({agent:e,active:t,onClick:n}){let r=e.issues?.some(e=>e.severity===`critical`),i=(e.processes?.length||0)+(e.sessions?.length||0)+(e.workers?.length||0);return(0,w.jsxs)(`button`,{onClick:n,style:{textAlign:`left`,background:t?`#fffaf2`:S.surface,border:`1px solid ${t?S.amber:S.borderSoft}`,borderRadius:9,padding:12,cursor:`pointer`,boxShadow:t?`0 1px 3px rgba(15,23,42,.08)`:`none`},children:[(0,w.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,gap:8},children:[(0,w.jsx)(g_,{id:e.id,issue:r,active:t}),(0,w.jsx)(`div`,{style:{fontSize:13,fontWeight:800,color:S.ink},children:e.name}),(0,w.jsx)(`div`,{style:{flex:1}}),r?(0,w.jsx)($,{tone:`red`,children:`风险`}):i>0?(0,w.jsx)($,{tone:`slate`,children:i}):null]}),(0,w.jsx)(`div`,{style:{marginTop:8,color:S.ink3,fontSize:11.5,lineHeight:1.45},children:e.description}),(0,w.jsxs)(`div`,{style:{display:`flex`,gap:6,marginTop:9,flexWrap:`wrap`},children:[(0,w.jsxs)($,{tone:`blue`,children:[`进程 `,e.processes?.length||0]}),(0,w.jsxs)($,{tone:`green`,children:[`会话 `,e.sessions?.length||0]}),(0,w.jsxs)($,{tone:`slate`,children:[`配置 `,e.configs?.filter(e=>e.exists).length||0]})]})]})}function D_({issues:e}){return e?.length?(0,w.jsx)(`div`,{style:{display:`flex`,flexDirection:`column`},children:e.slice(0,8).map((t,n)=>(0,w.jsxs)(`div`,{style:{padding:`10px 14px`,borderBottom:n===e.length-1?`none`:`1px solid ${S.borderSoft}`,display:`flex`,gap:10},children:[(0,w.jsx)(D,{name:t.severity===`critical`?`alertTri`:`info`,size:15,stroke:1.9,style:{color:t.severity===`critical`?S.red:S.amber,flexShrink:0,marginTop:1}}),(0,w.jsxs)(`div`,{style:{minWidth:0},children:[(0,w.jsx)(`div`,{style:{fontSize:12.5,fontWeight:800,color:S.ink},children:t.title}),(0,w.jsx)(`div`,{style:{fontSize:11.5,color:S.ink3,marginTop:3,lineHeight:1.45,wordBreak:`break-word`},children:t.detail}),t.ref&&(0,w.jsx)(`div`,{className:`mono`,style:{fontSize:10.5,color:S.ink4,marginTop:4},children:t.ref})]})]},n))}):(0,w.jsx)(y_,{text:`暂无限流、风险模型或配置异常`})}function O_(e){let t=`${e.state||``} ${e.model||``} ${e.cmdline||``} ${e.cwd||``}`.toLowerCase();return t.includes(`deleted`)||t.includes(`fable`)?{label:`异常`,tone:`red`,dot:S.red}:{label:`运行`,tone:`green`,dot:S.green}}function k_({rows:e}){if(!e?.length)return(0,w.jsx)(y_,{});let t=e.filter(e=>{let t=`${e.state||``} ${e.cwd||``} ${e.model||``} ${e.cmdline||``}`.toLowerCase();return t.includes(`deleted`)||t.includes(`fable`)}).length,n=e.length-t;return(0,w.jsxs)(`div`,{style:{padding:18},children:[(0,w.jsxs)(`div`,{style:{marginBottom:12,color:S.ink3,fontSize:12.5},children:[`共 `,(0,w.jsx)(`b`,{style:{color:S.ink},children:e.length}),` 个进程 · 运行 `,(0,w.jsx)(`b`,{style:{color:S.green},children:n}),` · 异常 `,(0,w.jsx)(`b`,{style:{color:S.red},children:t})]}),(0,w.jsxs)(`div`,{style:{border:`1px solid ${S.borderSoft}`,borderRadius:8,overflow:`hidden`,background:S.surface},children:[(0,w.jsxs)(`div`,{style:{display:`grid`,gridTemplateColumns:`130px 150px 120px 1fr 86px`,padding:`10px 16px`,background:S.surfaceAlt,color:S.ink4,fontSize:10.5,fontWeight:800,textTransform:`uppercase`,borderBottom:`1px solid ${S.borderSoft}`},children:[(0,w.jsx)(`div`,{children:`PID`}),(0,w.jsx)(`div`,{children:`Worker`}),(0,w.jsx)(`div`,{children:`状态`}),(0,w.jsx)(`div`,{children:`模型 / CPU / 内存`}),(0,w.jsx)(`div`,{style:{textAlign:`right`},children:`操作`})]}),e.map((t,n)=>{let r=O_(t);return(0,w.jsxs)(`div`,{style:{display:`grid`,gridTemplateColumns:`130px 150px 120px 1fr 86px`,padding:`14px 16px`,alignItems:`center`,borderBottom:n===e.length-1?`none`:`1px solid ${S.borderSoft}`},children:[(0,w.jsx)(`div`,{className:`mono tnum`,style:{fontSize:12.5,fontWeight:800,color:S.ink},children:t.pid}),(0,w.jsxs)(`div`,{children:[(0,w.jsx)(`div`,{className:`mono`,style:{fontSize:12,color:S.ink2,fontWeight:700},children:t.sessionId||t.name}),(0,w.jsx)(`div`,{className:`mono`,style:{marginTop:4,fontSize:10.5,color:S.ink4,whiteSpace:`nowrap`,overflow:`hidden`,textOverflow:`ellipsis`},children:t.name})]}),(0,w.jsx)(`div`,{children:(0,w.jsxs)($,{tone:r.tone,children:[(0,w.jsx)(`span`,{style:{width:6,height:6,borderRadius:3,background:r.dot}}),r.label]})}),(0,w.jsxs)(`div`,{style:{minWidth:0},children:[(0,w.jsx)(`div`,{className:`mono`,style:{fontSize:11.5,color:String(t.model).includes(`fable`)?S.red:S.ink2,fontWeight:700},children:t.model||`-`}),(0,w.jsxs)(`div`,{className:`mono`,style:{marginTop:4,fontSize:10.5,color:S.ink4,whiteSpace:`nowrap`,overflow:`hidden`,textOverflow:`ellipsis`},children:[t.cwd||t.cmdline||`-`,` · `,f_(t.ageSec)]})]}),(0,w.jsx)(`div`,{style:{textAlign:`right`},children:(0,w.jsx)(h_,{tone:`red`,disabled:!0,title:`暂未开放进程终止接口`,children:`终止`})})]},`${t.pid}-${t.sessionId||t.name}-${n}`)})]})]})}function A_(e){return e.lastPrompt?String(e.lastPrompt).slice(0,42):e.lastError?String(e.lastError).slice(0,42):e.id}function j_({rows:e}){let[t,n]=(0,b.useState)(``);if((0,b.useEffect)(()=>{if(!e?.length){n(``);return}if(!e.some(e=>`${e.kind}-${e.id}-${e.path}`===t)){let t=e[0];n(`${t.kind}-${t.id}-${t.path}`)}},[e,t]),!e?.length)return(0,w.jsx)(y_,{});let r=e.find(e=>`${e.kind}-${e.id}-${e.path}`===t)||e[0],i=`${r.kind}-${r.id}-${r.path}`;return(0,w.jsxs)(`div`,{style:{padding:18,display:`grid`,gridTemplateColumns:`340px 1fr`,gap:16,minHeight:430},children:[(0,w.jsxs)(`div`,{style:{border:`1px solid ${S.borderSoft}`,borderRadius:8,overflow:`hidden`,background:S.surface},children:[(0,w.jsxs)(`div`,{style:{padding:`11px 14px`,color:S.ink2,fontSize:13,fontWeight:800,borderBottom:`1px solid ${S.borderSoft}`},children:[`会话 · `,e.length]}),(0,w.jsx)(`div`,{style:{maxHeight:390,overflow:`auto`},children:e.map((t,r)=>{let a=`${t.kind}-${t.id}-${t.path}`,o=a===i;return(0,w.jsxs)(`button`,{onClick:()=>n(a),style:{width:`100%`,textAlign:`left`,padding:`13px 15px`,border:`none`,borderBottom:r===e.length-1?`none`:`1px solid ${S.borderSoft}`,borderLeft:`2px solid ${o?S.blue:`transparent`}`,background:o?`#eff6ff`:S.surface,cursor:`pointer`},children:[(0,w.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,gap:8},children:[(0,w.jsx)(`span`,{style:{width:7,height:7,borderRadius:4,background:t.rateLimited?S.red:S.teal,flexShrink:0}}),(0,w.jsx)(`div`,{style:{flex:1,minWidth:0,fontSize:12.5,fontWeight:800,color:S.ink,whiteSpace:`nowrap`,overflow:`hidden`,textOverflow:`ellipsis`},children:A_(t)}),(0,w.jsx)(`span`,{className:`mono`,style:{fontSize:10.5,color:S.ink4},children:t.sessionKind||t.kind})]}),(0,w.jsxs)(`div`,{style:{marginTop:7,display:`flex`,gap:8,alignItems:`center`},children:[t.model&&(0,w.jsx)($,{tone:String(t.model).includes(`fable`)?`red`:`blue`,children:t.model}),(0,w.jsx)(`span`,{style:{fontSize:10.5,color:S.ink4},children:p_(t.updatedAt)})]})]},a)})})]}),(0,w.jsxs)(`div`,{style:{border:`1px solid ${S.borderSoft}`,borderRadius:8,overflow:`hidden`,background:`#f8fafc`,minWidth:0},children:[(0,w.jsxs)(`div`,{style:{padding:`14px 16px`,borderBottom:`1px solid ${S.borderSoft}`,background:S.surface},children:[(0,w.jsx)(`div`,{style:{...S.type.heading,fontWeight:900,color:S.ink},children:A_(r)}),(0,w.jsx)(`div`,{className:`mono`,style:{marginTop:5,color:S.ink4,fontSize:10.5,wordBreak:`break-all`},children:r.path})]}),(0,w.jsxs)(`div`,{style:{padding:18,display:`flex`,flexDirection:`column`,gap:14},children:[r.lastPrompt&&(0,w.jsxs)(`div`,{style:{alignSelf:`flex-end`,maxWidth:`78%`},children:[(0,w.jsx)(`div`,{style:{fontSize:10.5,fontWeight:800,color:S.blue,textAlign:`right`,marginBottom:5},children:`用户`}),(0,w.jsx)(`div`,{style:{padding:`10px 13px`,borderRadius:`10px 10px 3px 10px`,background:S.blue,color:`#fff`,fontSize:13,lineHeight:1.55},children:r.lastPrompt})]}),(0,w.jsxs)(`div`,{style:{alignSelf:`flex-start`,maxWidth:`78%`},children:[(0,w.jsx)(`div`,{style:{fontSize:10.5,fontWeight:800,color:S.teal,marginBottom:5},children:`Assistant`}),(0,w.jsx)(`div`,{style:{padding:`10px 13px`,borderRadius:`10px 10px 10px 3px`,background:S.surface,border:`1px solid ${S.borderSoft}`,color:r.rateLimited?S.red:S.ink2,fontSize:13,lineHeight:1.55},children:r.lastError||r.lastPrompt||`该会话没有可展示的消息摘要。`})]}),(0,w.jsxs)(`div`,{style:{display:`flex`,gap:8,flexWrap:`wrap`,paddingTop:4},children:[r.linkedPid&&(0,w.jsxs)($,{tone:`blue`,children:[`PID `,r.linkedPid]}),r.linkedWorker&&(0,w.jsxs)($,{tone:`slate`,children:[`worker `,r.linkedWorker]}),r.cwd&&(0,w.jsx)($,{tone:`slate`,children:r.cwd})]})]})]})]})}function M_({rows:e}){return e?.length?(0,w.jsxs)(`table`,{style:{width:`100%`,borderCollapse:`collapse`},children:[(0,w.jsx)(`thead`,{children:(0,w.jsxs)(`tr`,{children:[(0,w.jsx)(`th`,{style:{...u_,textAlign:`left`},children:`Worker`}),(0,w.jsx)(`th`,{style:{...u_,textAlign:`left`},children:`模型/权限`}),(0,w.jsx)(`th`,{style:{...u_,textAlign:`left`},children:`最近事件`}),(0,w.jsx)(`th`,{style:{...u_,textAlign:`left`},children:`目录`})]})}),(0,w.jsx)(`tbody`,{children:e.map(e=>(0,w.jsxs)(`tr`,{children:[(0,w.jsxs)(`td`,{style:d_,children:[(0,w.jsx)(`div`,{className:`mono`,style:{fontWeight:800},children:e.short}),(0,w.jsxs)(`div`,{className:`mono`,style:{fontSize:10.5,color:S.ink3,marginTop:3},children:[`PID `,e.pid||`-`]})]}),(0,w.jsxs)(`td`,{style:d_,children:[(0,w.jsx)($,{tone:e.risky?`red`:`blue`,children:e.model||`-`}),(0,w.jsxs)(`div`,{style:{marginTop:6,display:`flex`,gap:5,flexWrap:`wrap`},children:[e.permission&&(0,w.jsx)($,{tone:`slate`,children:e.permission}),e.effort&&(0,w.jsxs)($,{tone:`slate`,children:[`effort `,e.effort]}),e.source&&(0,w.jsx)($,{tone:`slate`,children:e.source})]})]}),(0,w.jsxs)(`td`,{style:d_,children:[(0,w.jsx)(`div`,{style:{color:e.risky?S.red:S.ink2,lineHeight:1.45,maxWidth:460,wordBreak:`break-word`},children:e.lastTimeline||`-`}),e.lastAt&&(0,w.jsx)(`div`,{style:{fontSize:10.5,color:S.ink4,marginTop:4},children:p_(e.lastAt)})]}),(0,w.jsx)(`td`,{style:d_,children:(0,w.jsx)(`span`,{className:`mono`,style:{fontSize:10.5,color:S.ink3},children:e.cwd||`-`})})]},e.short))})]}):(0,w.jsx)(y_,{})}function N_({rows:e}){let t=e?.filter(e=>e.exists)||[],n=e?.length?e:[],[r,i]=(0,b.useState)(``),[a,o]=(0,b.useState)(``);if((0,b.useEffect)(()=>{if(!n.length){i(``),o(``);return}let e=n.some(e=>e.path===r)?n.find(e=>e.path===r):t[0]||n[0];e&&e.path!==r&&(i(e.path),o(e.preview||``))},[n,t,r]),!n.length)return(0,w.jsx)(y_,{});let s=n.find(e=>e.path===r)||t[0]||n[0],c=(s.path||``).split(`.`).pop()||`conf`;return(0,w.jsxs)(`div`,{style:{padding:18,display:`grid`,gridTemplateColumns:`300px 1fr`,gap:16,minHeight:0},children:[(0,w.jsxs)(`div`,{style:{border:`1px solid ${S.borderSoft}`,borderRadius:8,overflow:`hidden`,background:S.surface},children:[(0,w.jsxs)(`div`,{style:{padding:`11px 14px`,color:S.ink2,fontSize:13,fontWeight:800,borderBottom:`1px solid ${S.borderSoft}`},children:[`配置文件 · `,t.length]}),(0,w.jsx)(`div`,{style:{maxHeight:360,overflow:`auto`},children:n.map((e,t)=>{let r=e.path===s.path,a=e.path.split(`/`).pop(),c=(e.path.split(`.`).pop()||`conf`).slice(0,6);return(0,w.jsxs)(`button`,{onClick:()=>{i(e.path),o(e.preview||``)},style:{width:`100%`,display:`flex`,alignItems:`center`,gap:10,padding:`12px 14px`,border:`none`,borderBottom:t===n.length-1?`none`:`1px solid ${S.borderSoft}`,borderLeft:`2px solid ${r?S.amber:`transparent`}`,background:r?`#fffaf2`:S.surface,cursor:`pointer`,textAlign:`left`},children:[(0,w.jsx)(`span`,{style:{width:28,height:28,borderRadius:7,display:`inline-flex`,alignItems:`center`,justifyContent:`center`,background:e.exists?S.amberSoft:S.surfaceAlt,color:e.exists?S.amber:S.ink4,flexShrink:0},children:(0,w.jsx)(D,{name:e.exists?`file`:`alertTri`,size:13,stroke:2})}),(0,w.jsxs)(`span`,{style:{flex:1,minWidth:0},children:[(0,w.jsx)(`span`,{style:{display:`block`,fontSize:12.5,color:S.ink,fontWeight:800,whiteSpace:`nowrap`,overflow:`hidden`,textOverflow:`ellipsis`},children:a}),(0,w.jsx)(`span`,{className:`mono`,style:{display:`block`,marginTop:3,color:S.ink4,fontSize:10.5,whiteSpace:`nowrap`,overflow:`hidden`,textOverflow:`ellipsis`},children:e.path})]}),(0,w.jsx)($,{tone:e.exists?`slate`:`amber`,children:c})]},`${e.kind}-${e.path}`)})})]}),(0,w.jsxs)(`div`,{style:{border:`1px solid ${S.borderSoft}`,borderRadius:8,overflow:`hidden`,background:S.surface,minWidth:0},children:[(0,w.jsxs)(`div`,{style:{padding:`12px 16px`,display:`flex`,alignItems:`center`,gap:10,borderBottom:`1px solid ${S.borderSoft}`},children:[(0,w.jsx)(`div`,{className:`mono`,style:{flex:1,minWidth:0,color:S.ink,fontSize:12.5,fontWeight:800,whiteSpace:`nowrap`,overflow:`hidden`,textOverflow:`ellipsis`},children:s.path}),(0,w.jsx)(h_,{tone:`slate`,onClick:()=>o(s.preview||``),children:`重置`}),(0,w.jsx)(h_,{tone:`blue`,disabled:!0,title:`当前只读展示真实配置,写入接口尚未开放`,children:`保存`})]}),(0,w.jsxs)(`div`,{style:{padding:`18px 20px`,display:`grid`,gap:18,maxHeight:390,overflow:`auto`},children:[(0,w.jsxs)(`div`,{children:[(0,w.jsx)(`div`,{style:{color:S.ink3,fontSize:12.5,fontWeight:800,marginBottom:12},children:`结构化字段`}),(0,w.jsxs)(`div`,{style:{display:`grid`,gridTemplateColumns:`180px 1fr`,gap:`12px 22px`,alignItems:`center`},children:[(0,w.jsxs)(`div`,{children:[(0,w.jsx)(`div`,{style:{fontSize:12.5,color:S.ink2,fontWeight:700},children:`文件状态`}),(0,w.jsx)(`div`,{className:`mono`,style:{fontSize:10.5,color:S.ink4,marginTop:2},children:`exists`})]}),(0,w.jsx)(`div`,{children:(0,w.jsx)($,{tone:s.exists?`green`:`amber`,children:s.exists?`存在`:`未找到`})}),(0,w.jsxs)(`div`,{children:[(0,w.jsx)(`div`,{style:{fontSize:12.5,color:S.ink2,fontWeight:700},children:`文件大小`}),(0,w.jsx)(`div`,{className:`mono`,style:{fontSize:10.5,color:S.ink4,marginTop:2},children:`size`})]}),(0,w.jsx)(`div`,{children:(0,w.jsx)($,{tone:`slate`,children:s.exists?m_(s.sizeBytes):`-`})}),(0,w.jsxs)(`div`,{children:[(0,w.jsx)(`div`,{style:{fontSize:12.5,color:S.ink2,fontWeight:700},children:`更新时间`}),(0,w.jsx)(`div`,{className:`mono`,style:{fontSize:10.5,color:S.ink4,marginTop:2},children:`mtime`})]}),(0,w.jsx)(`div`,{style:{fontSize:12.5,color:S.ink2},children:s.exists?p_(s.updatedAt):`-`})]})]}),(0,w.jsxs)(`div`,{children:[(0,w.jsx)(`div`,{style:{color:S.ink3,fontSize:12.5,fontWeight:800,marginBottom:10},children:`原始配置`}),(0,w.jsx)(`textarea`,{value:a,onChange:e=>o(e.target.value),spellCheck:!1,style:{width:`100%`,minHeight:190,resize:`vertical`,border:`1px solid ${S.border}`,borderRadius:8,padding:12,outline:`none`,background:`#0f172a`,color:`#dbeafe`,fontFamily:S.mono,fontSize:11,lineHeight:1.55}})]}),(0,w.jsxs)(`div`,{style:{display:`flex`,gap:8,flexWrap:`wrap`},children:[(0,w.jsx)($,{tone:`blue`,children:c}),(0,w.jsx)($,{tone:`slate`,children:`真实文件预览`}),(0,w.jsx)($,{tone:`slate`,children:`截断预览`}),(0,w.jsx)($,{tone:`amber`,children:`只读`})]})]})]})]})}function P_({onDone:e}){let[t,n]=(0,b.useState)(!1),[r,i]=(0,b.useState)(null),[a,o]=(0,b.useState)(``);async function s(){if(window.confirm(`只会清理工作目录已 deleted 的 Codex app-server / broker 进程。确认执行?`)){n(!0),o(``);try{i(await tf()),e?.()}catch(e){o(e?.message||String(e))}finally{n(!1)}}}let c=r?.matched?.length||0,l=r?.termed?.length||0,u=r?.killed?.length||0,d=r?.failed?.length||0;return(0,w.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,gap:12,padding:`11px 13px`,background:`#fffbeb`,border:`1px solid #fde68a`,borderRadius:8},children:[(0,w.jsx)(`span`,{style:{width:30,height:30,borderRadius:8,display:`inline-flex`,alignItems:`center`,justifyContent:`center`,color:`#92400e`,background:`#fef3c7`,flexShrink:0},children:(0,w.jsx)(D,{name:`trash`,size:15,stroke:2})}),(0,w.jsxs)(`div`,{style:{minWidth:0,flex:1},children:[(0,w.jsx)(`div`,{style:{fontSize:12.5,fontWeight:800,color:S.ink},children:`清理 stale Codex app-server`}),(0,w.jsx)(`div`,{style:{fontSize:11.5,color:S.ink3,marginTop:2},children:`仅匹配 cwd 含 deleted 且命令为 Codex app-server / app-server-broker 的进程。`}),r&&(0,w.jsxs)(`div`,{style:{display:`flex`,gap:6,marginTop:7,flexWrap:`wrap`},children:[(0,w.jsxs)($,{tone:`blue`,children:[`匹配 `,c]}),(0,w.jsxs)($,{tone:`green`,children:[`TERM `,l]}),(0,w.jsxs)($,{tone:u?`amber`:`slate`,children:[`KILL `,u]}),(0,w.jsxs)($,{tone:d?`red`:`slate`,children:[`失败 `,d]})]}),a&&(0,w.jsx)(`div`,{style:{color:S.red,fontSize:11.5,marginTop:6},children:a})]}),(0,w.jsx)(h_,{tone:`amber`,icon:`trash`,onClick:s,disabled:t,children:t?`清理中...`:`清理`})]})}function F_(){let{data:e,loading:t,error:n,refresh:r}=$d(5e3),i=e?.agentTypes||[],[a,o]=(0,b.useState)(``),[s,c]=(0,b.useState)(`board`),l=(0,b.useMemo)(()=>i.length?i.find(e=>e.id===a)||i[0]:null,[i,a]),u=e?.issues||[],d=e?.summary||{},f=e?.board||{counts:{},agents:[]},p=l?.issues?.some(e=>e.severity===`critical`);return(0,w.jsxs)(`div`,{style:{flex:1,display:`flex`,flexDirection:`column`,background:S.surfaceAlt,overflow:`hidden`},children:[(0,w.jsxs)(`div`,{style:{padding:`14px 22px`,background:S.surface,borderBottom:`1px solid ${S.border}`,flexShrink:0},children:[(0,w.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,gap:12},children:[(0,w.jsx)(`span`,{style:{width:40,height:40,borderRadius:10,display:`inline-flex`,alignItems:`center`,justifyContent:`center`,color:`#fff`,background:S.violet,boxShadow:`0 8px 18px rgba(139,92,246,.28)`},children:(0,w.jsx)(D,{name:`brain`,size:20,stroke:2})}),(0,w.jsxs)(`div`,{children:[(0,w.jsx)(`div`,{style:{...S.type.title,fontWeight:900,color:S.ink},children:`Agent 活动中心`}),(0,w.jsx)(`div`,{style:{fontSize:11.5,color:S.ink3,marginTop:3},children:`Claude Code / Codex / OpenClaw / Hermes · 进程、会话、配置与限流风险`})]}),(0,w.jsx)(`div`,{style:{flex:1}}),t&&(0,w.jsx)($,{tone:`slate`,children:`刷新中`}),n&&(0,w.jsx)($,{tone:`red`,children:`接口异常`}),e?.generatedAt&&(0,w.jsxs)(`div`,{style:{fontSize:11,color:S.ink3},children:[`更新 `,p_(e.generatedAt)]}),(0,w.jsx)(h_,{tone:`slate`,icon:`refresh`,onClick:r,children:`刷新`})]}),(0,w.jsxs)(`div`,{style:{display:`flex`,gap:10,marginTop:13,flexWrap:`wrap`},children:[(0,w.jsx)(__,{icon:`brain`,label:`Agent 类型`,value:d.agentTypes||i.length,tone:S.blue}),(0,w.jsx)(__,{icon:`dashboard`,label:`Board 卡片`,value:f.agents?.length||0,tone:S.teal}),(0,w.jsx)(__,{icon:`cpu`,label:`Claude 进程`,value:d.claudeProcesses||0,tone:S.indigo}),(0,w.jsx)(__,{icon:`code`,label:`Codex 进程`,value:d.codexProcesses||0,tone:S.cyan}),(0,w.jsx)(__,{icon:`alertTri`,label:`风险 Worker`,value:d.riskyWorkers||0,tone:d.riskyWorkers?S.red:S.green}),(0,w.jsx)(__,{icon:`file`,label:`配置文件`,value:d.configFiles||0,tone:S.slate})]})]}),(0,w.jsxs)(`div`,{style:{flex:1,display:`grid`,gridTemplateColumns:`300px 1fr`,gap:12,padding:12,minHeight:0},children:[(0,w.jsxs)(`div`,{style:{display:`flex`,flexDirection:`column`,gap:10,minHeight:0,overflow:`hidden`},children:[(0,w.jsx)(v_,{title:`Agent 类型`,children:(0,w.jsx)(`div`,{style:{display:`flex`,flexDirection:`column`,gap:8,padding:10,overflowY:`auto`,maxHeight:310,minHeight:250},children:i.length?i.map(e=>(0,w.jsx)(E_,{agent:e,active:l?.id===e.id,onClick:()=>{o(e.id),c(`overview`)}},e.id)):(0,w.jsx)(y_,{text:t?`正在加载...`:`没有发现 agent 活动`})})}),(0,w.jsx)(`div`,{style:{minHeight:0,overflow:`auto`},children:(0,w.jsx)(v_,{title:`全局风险`,children:(0,w.jsx)(D_,{issues:u})})})]}),(0,w.jsx)(`div`,{style:{minWidth:0,minHeight:0,display:`flex`,flexDirection:`column`,gap:10},children:(0,w.jsxs)(`div`,{style:{background:S.surface,border:`1px solid ${S.border}`,borderRadius:8,overflow:`hidden`,minHeight:0},children:[(0,w.jsxs)(`div`,{style:{padding:`14px 18px 12px`,display:`flex`,alignItems:`center`,gap:12,borderBottom:`1px solid ${S.borderSoft}`},children:[l&&(0,w.jsx)(g_,{id:l.id,issue:p,active:!0}),(0,w.jsxs)(`div`,{style:{minWidth:0},children:[(0,w.jsx)(`div`,{style:{...S.type.heading,fontWeight:900,color:S.ink},children:l?l.name:`详情`}),l&&(0,w.jsx)(`div`,{style:{fontSize:11.5,color:S.ink3,marginTop:2},children:l.description})]}),(0,w.jsx)(`div`,{style:{flex:1}}),l&&(0,w.jsx)($,{tone:`blue`,children:l.id})]}),(0,w.jsx)(`div`,{style:{padding:`0 18px`,display:`flex`,gap:4,borderBottom:`1px solid ${S.borderSoft}`,background:S.surface},children:(0,w.jsx)(Zf,{tabs:[{id:`board`,label:`Board`,icon:`dashboard`},{id:`overview`,label:`概览`,icon:`dashboard`},{id:`processes`,label:`进程`,icon:`cpu`},{id:`sessions`,label:`会话 / Chat`,icon:`message`},{id:`configs`,label:`配置`,icon:`file`},{id:`events`,label:`事件`,icon:`clock`}],active:s,onChange:c,itemAs:`button`,activeTextColor:S.blue,activeWeight:800,inactiveWeight:600,style:{gap:4},itemStyle:l_,activeItemStyle:{background:`#eff6ff`},renderLabel:e=>(0,w.jsxs)(w.Fragment,{children:[(0,w.jsx)(D,{name:e.icon,size:13,stroke:2}),e.label]})})}),(0,w.jsxs)(`div`,{style:{overflow:`auto`,maxHeight:`calc(100vh - 260px)`},children:[s!==`board`&&!l&&(0,w.jsx)(y_,{}),s===`board`&&(0,w.jsx)(T_,{board:f}),l&&s===`overview`&&(0,w.jsxs)(`div`,{style:{padding:12,display:`grid`,gap:10},children:[l.id===`codex`&&(0,w.jsx)(P_,{}),(0,w.jsxs)(`div`,{style:{display:`grid`,gridTemplateColumns:`repeat(4, minmax(120px, 1fr))`,gap:10},children:[(0,w.jsx)(__,{icon:`cpu`,label:`进程`,value:l.processes?.length||0}),(0,w.jsx)(__,{icon:`message`,label:`会话`,value:l.sessions?.length||0}),(0,w.jsx)(__,{icon:`file`,label:`配置`,value:l.configs?.filter(e=>e.exists).length||0}),(0,w.jsx)(__,{icon:`alertTri`,label:`风险`,value:l.issues?.length||0,tone:l.issues?.length?S.red:S.green})]}),(0,w.jsx)(v_,{title:`风险与提示`,children:(0,w.jsx)(D_,{issues:l.issues})}),l.workers?.length>0&&(0,w.jsx)(v_,{title:`Claude Worker`,children:(0,w.jsx)(M_,{rows:l.workers})})]}),l&&s===`processes`&&(0,w.jsxs)(`div`,{style:{display:`grid`,gap:10,padding:l.id===`codex`?12:0},children:[l.id===`codex`&&(0,w.jsx)(P_,{}),(0,w.jsx)(`div`,{style:{overflow:`hidden`,borderRadius:l.id===`codex`?8:0},children:(0,w.jsx)(k_,{rows:l.workers?.length?l.workers.map(e=>({pid:e.pid||`-`,name:e.short,sessionId:e.short,model:e.model,cmdline:e.lastTimeline,cwd:e.cwd,ageSec:0,state:e.risky?`error`:`active`})):l.processes})})]}),l&&s===`sessions`&&(0,w.jsx)(j_,{rows:l.sessions}),l&&s===`configs`&&(0,w.jsx)(N_,{rows:l.configs}),l&&s===`events`&&(0,w.jsxs)(`div`,{style:{display:`grid`,gap:10,padding:12},children:[(0,w.jsx)(v_,{title:`风险事件`,children:(0,w.jsx)(D_,{issues:l.issues})}),l.workers?.length>0&&(0,w.jsx)(v_,{title:`Worker Timeline 摘要`,children:(0,w.jsx)(M_,{rows:l.workers})})]})]})]})})]})]})}var I_={fontFamily:`"JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, monospace`};function L_(){return crypto.randomUUID&&crypto.randomUUID()||String(Math.random()).slice(2)}function R_(e){if(!e)return`新标签页`;try{return new URL(e).host||e}catch{return e}}function z_(e){let t=(e||``).trim();return t?/^https?:\/\//i.test(t)?t:(/^(localhost|\[?[0-9a-fA-F:]+\]?|(\d{1,3}\.){3}\d{1,3})/.test(t)||t.includes(`.`)?`http://`:`https://`)+t:``}function B_(e){let t=kd();return`/api/v1/browser/proxy?url=`+encodeURIComponent(e)+(t?`&token=`+encodeURIComponent(t):``)}function V_(e=``){return{id:L_(),entries:e?[e]:[],index:e?0:-1,title:R_(e),loading:!!e,mode:`direct`,_nonce:L_()}}function H_({name:e,size:t=16,stroke:n=1.8,disabled:r,active:i,title:a,onClick:o,style:s}){return(0,w.jsx)(`button`,{title:a,onClick:o,disabled:r,className:`edge-press`,style:{width:30,height:30,borderRadius:S.radius.sm,display:`flex`,alignItems:`center`,justifyContent:`center`,border:`none`,background:i?S.blueSoft:`transparent`,cursor:r?`default`:`pointer`,flexShrink:0,color:r?S.ink4:i?S.blueDeep:S.ink2,transition:`background ${S.duration?.hover||120}ms, color ${S.duration?.hover||120}ms`,...s},children:(0,w.jsx)(D,{name:e,size:t,stroke:n})})}function U_(){let{data:e,refresh:t}=sf(),{data:n,refresh:r}=cf(),[i,a]=(0,b.useState)(()=>[V_()]),[o,s]=(0,b.useState)(()=>i[0].id),[c,l]=(0,b.useState)(``),[u,d]=(0,b.useState)(null),[f,p]=(0,b.useState)(!0),m=(0,b.useMemo)(()=>i.find(e=>e.id===o)||i[0],[i,o]),h=m&&m.index>=0?m.entries[m.index]:``;(0,b.useEffect)(()=>{l(h)},[o,h]);let g=(0,b.useCallback)((e,t)=>{a(n=>n.map(n=>n.id===e?t(n):n))},[]),_=(0,b.useCallback)(e=>{e&&(g(m.id,t=>{let n=t.entries.slice(0,t.index+1);return n.push(e),{...t,entries:n,index:n.length-1,title:R_(e),loading:!0,mode:`direct`,_nonce:L_()}}),df(e,R_(e)).then(r),d(null))},[m.id,g,r]),v=(0,b.useCallback)(()=>{let e=z_(c);e&&(l(e),_(e))},[c,_]),y=(0,b.useCallback)(()=>{g(m.id,e=>e.index>0?{...e,index:e.index-1,loading:!0,mode:`direct`,_nonce:L_()}:e)},[m.id,g]),x=(0,b.useCallback)(()=>{g(m.id,e=>e.index{g(m.id,e=>({...e,loading:!0,_nonce:L_()}))},[m.id,g]),T=(0,b.useCallback)(()=>{g(m.id,e=>({...e,entries:[],index:-1,title:`新标签页`,loading:!1})),l(``)},[m.id,g]);(0,b.useEffect)(()=>{if(!m||!h)return;let e=m.id,t=h;pf(t).then(n=>{n&&!n.direct&&g(e,e=>e.entries[e.index]===t?{...e,mode:`proxy`}:e)})},[m?.id,h]);let E=(0,b.useCallback)((e,t)=>{t&&t.stopPropagation(),a(t=>{let n=t.filter(t=>t.id!==e),r=n.length?n:[V_()];return e===o&&s(r[r.length-1].id),r})},[o]),O=(0,b.useCallback)((e=``)=>{let t=V_(e);a(e=>[...e,t]),s(t.id)},[]),k=m&&m.index>0,A=m&&m.index!!h&&(e||[]).some(e=>e.url===h),[e,h]),ee=(0,b.useCallback)(async()=>{if(!h)return;let n=(e||[]).find(e=>e.url===h);n?await uf(n.id):await lf(R_(h),h),t()},[h,e,t]),M=(0,b.useCallback)(async()=>{await ff(),r()},[r]),N=(0,w.jsxs)(w.Fragment,{children:[i.map(e=>{let t=e.id===o;return(0,w.jsxs)(`div`,{onClick:()=>s(e.id),className:`edge-press`,style:{display:`flex`,alignItems:`center`,gap:6,height:30,padding:`0 6px 0 10px`,borderRadius:S.radius.md,background:t?f?S.surfaceAlt:S.surface:`transparent`,border:`1px solid ${t?S.border:`transparent`}`,fontSize:12,color:S.ink,whiteSpace:`nowrap`,cursor:`pointer`,flexShrink:0,maxWidth:220},children:[(0,w.jsx)(D,{name:`globe`,size:12,stroke:1.8,style:{color:S.ink3,flexShrink:0}}),(0,w.jsx)(`span`,{style:{overflow:`hidden`,textOverflow:`ellipsis`},children:e.title}),(0,w.jsx)(`button`,{onClick:t=>E(e.id,t),className:`edge-press`,title:`关闭标签页`,style:{width:18,height:18,borderRadius:S.radius.xs,border:`none`,background:`transparent`,cursor:`pointer`,display:`flex`,alignItems:`center`,justifyContent:`center`,color:S.ink3,flexShrink:0},children:(0,w.jsx)(D,{name:`x`,size:11,stroke:2})})]},e.id)}),(0,w.jsx)(`button`,{onClick:()=>O(),className:`edge-press`,title:`新建标签页`,style:{width:28,height:28,borderRadius:S.radius.sm,border:`none`,background:`transparent`,cursor:`pointer`,display:`flex`,alignItems:`center`,justifyContent:`center`,color:S.ink2,flexShrink:0},children:(0,w.jsx)(D,{name:`plus`,size:15,stroke:2})})]}),P=(0,w.jsxs)(w.Fragment,{children:[(0,w.jsx)(H_,{name:`chevLeft`,title:`后退`,disabled:!k,onClick:y}),(0,w.jsx)(H_,{name:`chevRight`,title:`前进`,disabled:!A,onClick:x}),(0,w.jsx)(H_,{name:`refresh`,title:`刷新`,disabled:!h,onClick:C}),(0,w.jsx)(H_,{name:`home`,title:`主页`,onClick:T}),(0,w.jsxs)(`div`,{style:{flex:1,display:`flex`,alignItems:`center`,gap:8,background:S.surfaceAlt,border:`1px solid ${S.border}`,borderRadius:S.radius.pill,padding:`0 14px`,height:34,marginLeft:4,marginRight:4,minWidth:0},children:[(0,w.jsx)(D,{name:`lock`,size:12,style:{color:h.startsWith(`https://`)?S.green:S.ink3,flexShrink:0}}),(0,w.jsx)(`input`,{value:c,onChange:e=>l(e.target.value),onKeyDown:e=>{e.key===`Enter`&&v()},placeholder:`输入网址(如 192.168.1.10:3000 或 example.com)`,spellCheck:!1,style:{flex:1,border:`none`,background:`transparent`,outline:`none`,fontSize:12.5,color:S.ink,...I_}}),m&&m.loading&&(0,w.jsx)(`span`,{style:{width:6,height:6,borderRadius:`50%`,background:S.blue,flexShrink:0},className:`edge-pulse`})]}),(0,w.jsx)(H_,{name:`star`,title:j?`取消收藏`:`收藏当前页`,active:j,disabled:!h,onClick:ee}),(0,w.jsx)(H_,{name:`history`,title:`历史记录`,active:u===`history`,onClick:()=>d(e=>e===`history`?null:`history`)}),(0,w.jsx)(H_,{name:`sidebar`,title:f?`展开:标签与地址栏分行`:`合并:单行紧凑`,active:f,onClick:()=>p(e=>!e)})]});return(0,w.jsxs)(`div`,{style:{flex:1,display:`flex`,flexDirection:`column`,overflow:`hidden`,background:S.surfaceAlt,position:`relative`},children:[f?(0,w.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,gap:8,padding:`6px 8px`,background:S.surface,borderBottom:`1px solid ${S.borderSoft}`,flexShrink:0},children:[(0,w.jsx)(`div`,{style:{display:`flex`,alignItems:`center`,gap:4,flexShrink:0,maxWidth:`42%`,overflowX:`auto`},children:N}),(0,w.jsx)(`div`,{style:{display:`flex`,alignItems:`center`,gap:4,flex:1,minWidth:0},children:P})]}):(0,w.jsxs)(w.Fragment,{children:[(0,w.jsx)(`div`,{style:{display:`flex`,alignItems:`center`,gap:4,padding:`6px 8px`,background:S.surfaceAlt,borderBottom:`1px solid ${S.borderSoft}`,flexShrink:0,overflowX:`auto`},children:N}),(0,w.jsx)(`div`,{style:{display:`flex`,alignItems:`center`,gap:4,padding:`8px 12px`,background:S.surface,borderBottom:`1px solid ${S.borderSoft}`,flexShrink:0},children:P})]}),h?(0,w.jsx)(`iframe`,{src:m.mode===`proxy`?B_(h):h,sandbox:`allow-scripts allow-same-origin allow-forms allow-popups allow-popups-to-escape-sandbox`,allow:`clipboard-read; clipboard-write`,onLoad:()=>g(m.id,e=>({...e,loading:!1})),style:{flex:1,width:`100%`,border:`none`,background:`#fff`},title:`browser-content`},`${h}-${m.mode}-${m._nonce}`):(0,w.jsx)(W_,{bookmarks:e||[],history:n||[],onNavigate:_,onOpenBookmarks:()=>d(`bookmarks`)}),u===`bookmarks`&&(0,w.jsx)(G_,{title:`书签`,items:(e||[]).map(e=>({id:e.id,title:e.title||e.url,url:e.url})),emptyHint:`还没有书签,点地址栏右侧 ★ 收藏当前页`,onOpen:e=>_(e.url),onDelete:e=>{uf(e.id).then(t)},onClose:()=>d(null)}),u===`history`&&(0,w.jsx)(G_,{title:`历史记录`,items:(n||[]).map((e,t)=>({id:e.url+t,title:e.title||e.url,url:e.url,sub:e.visitedAt})),emptyHint:`还没有访问记录`,onOpen:e=>_(e.url),onClear:M,onClose:()=>d(null)})]})}function W_({bookmarks:e,history:t,onNavigate:n,onOpenBookmarks:r}){let[i,a]=(0,b.useState)(``),o=()=>{let e=z_(i);e&&n(e)},s=(t||[]).slice(0,8);return(0,w.jsxs)(`div`,{style:{flex:1,display:`flex`,flexDirection:`column`,alignItems:`center`,justifyContent:`flex-start`,background:S.surfaceAlt,padding:`48px 24px`,overflow:`auto`},children:[(0,w.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,gap:10,marginBottom:24},children:[(0,w.jsx)(D,{name:`globe`,size:36,stroke:1.6,style:{color:S.blue}}),(0,w.jsx)(`span`,{style:{fontSize:24,fontWeight:700,color:S.ink},children:`浏览器`})]}),(0,w.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,gap:8,width:`100%`,maxWidth:560,background:S.surface,border:`1px solid ${S.border}`,borderRadius:S.radius.pill,padding:`0 16px`,height:44,boxShadow:S.shadow.sm},children:[(0,w.jsx)(D,{name:`search`,size:16,style:{color:S.ink3}}),(0,w.jsx)(`input`,{autoFocus:!0,value:i,onChange:e=>a(e.target.value),onKeyDown:e=>{e.key===`Enter`&&o()},placeholder:`输入网址(如 192.168.1.10:3000 或 example.com)`,spellCheck:!1,style:{flex:1,border:`none`,background:`transparent`,outline:`none`,fontSize:14,color:S.ink,...I_}})]}),e&&e.length>0&&(0,w.jsxs)(`div`,{style:{width:`100%`,maxWidth:560,marginTop:32},children:[(0,w.jsx)(`div`,{style:{fontSize:11.5,fontWeight:600,color:S.ink3,marginBottom:10,letterSpacing:.3},children:`书签`}),(0,w.jsx)(`div`,{style:{display:`grid`,gridTemplateColumns:`repeat(auto-fill, minmax(120px, 1fr))`,gap:10},children:e.slice(0,8).map(e=>(0,w.jsxs)(`button`,{onClick:()=>n(e.url),className:`edge-press`,style:{display:`flex`,flexDirection:`column`,alignItems:`center`,gap:8,padding:`14px 8px`,borderRadius:S.radius.md,border:`1px solid ${S.borderSoft}`,background:S.surface,cursor:`pointer`},children:[(0,w.jsx)(`div`,{style:{width:32,height:32,borderRadius:S.radius.sm,background:S.blueSoft,display:`flex`,alignItems:`center`,justifyContent:`center`},children:(0,w.jsx)(D,{name:`globe`,size:16,style:{color:S.blueDeep}})}),(0,w.jsx)(`span`,{style:{fontSize:11.5,color:S.ink2,textAlign:`center`,overflow:`hidden`,textOverflow:`ellipsis`,whiteSpace:`nowrap`,maxWidth:`100%`},children:e.title||e.url})]},e.id))})]}),s.length>0&&(0,w.jsxs)(`div`,{style:{width:`100%`,maxWidth:560,marginTop:28},children:[(0,w.jsx)(`div`,{style:{fontSize:11.5,fontWeight:600,color:S.ink3,marginBottom:8,letterSpacing:.3},children:`最近访问`}),s.map((e,t)=>(0,w.jsxs)(`button`,{onClick:()=>n(e.url),className:`edge-press edge-row-hover`,style:{display:`flex`,alignItems:`center`,gap:10,width:`100%`,padding:`8px 10px`,borderRadius:S.radius.sm,border:`none`,background:`transparent`,cursor:`pointer`,textAlign:`left`},children:[(0,w.jsx)(D,{name:`history`,size:13,style:{color:S.ink4,flexShrink:0}}),(0,w.jsxs)(`div`,{style:{minWidth:0,flex:1},children:[(0,w.jsx)(`div`,{style:{fontSize:12.5,color:S.ink,overflow:`hidden`,textOverflow:`ellipsis`,whiteSpace:`nowrap`},children:e.title||e.url}),(0,w.jsx)(`div`,{style:{fontSize:11,color:S.ink4,overflow:`hidden`,textOverflow:`ellipsis`,whiteSpace:`nowrap`,...I_},children:e.url})]})]},t))]})]})}function G_({title:e,items:t,emptyHint:n,onOpen:r,onDelete:i,onClear:a,onClose:o}){return(0,w.jsxs)(w.Fragment,{children:[(0,w.jsx)(`div`,{onClick:o,style:{position:`fixed`,inset:0,zIndex:50}}),(0,w.jsxs)(`div`,{style:{position:`absolute`,top:76,right:12,zIndex:51,width:320,maxHeight:360,overflowY:`auto`,background:S.surface,border:`1px solid ${S.border}`,borderRadius:S.radius.md,boxShadow:S.shadow.lg,padding:6},children:[(0,w.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,padding:`6px 10px`},children:[(0,w.jsx)(`span`,{style:{fontSize:12,fontWeight:600,color:S.ink},children:e}),(0,w.jsx)(`div`,{style:{flex:1}}),a&&t.length>0&&(0,w.jsx)(`button`,{onClick:a,className:`edge-press`,style:{fontSize:11,color:S.red,background:`transparent`,border:`none`,cursor:`pointer`,padding:`2px 4px`},children:`清空`})]}),t.length===0?(0,w.jsx)(`div`,{style:{padding:`16px 12px`,fontSize:11.5,color:S.ink4,textAlign:`center`},children:n}):t.map(e=>(0,w.jsxs)(`div`,{className:`edge-row-hover`,style:{display:`flex`,alignItems:`center`,gap:8,padding:`7px 10px`,borderRadius:S.radius.sm,cursor:`pointer`},onClick:()=>r(e),children:[(0,w.jsx)(D,{name:`globe`,size:13,style:{color:S.ink4,flexShrink:0}}),(0,w.jsxs)(`div`,{style:{minWidth:0,flex:1},children:[(0,w.jsx)(`div`,{style:{fontSize:12,color:S.ink,overflow:`hidden`,textOverflow:`ellipsis`,whiteSpace:`nowrap`},children:e.title}),(0,w.jsx)(`div`,{style:{fontSize:10.5,color:S.ink4,overflow:`hidden`,textOverflow:`ellipsis`,whiteSpace:`nowrap`,...I_},children:e.url})]}),i&&(0,w.jsx)(`button`,{onClick:t=>{t.stopPropagation(),i(e)},className:`edge-press`,title:`删除`,style:{width:22,height:22,borderRadius:S.radius.xs,border:`none`,background:`transparent`,cursor:`pointer`,color:S.ink4,display:`flex`,alignItems:`center`,justifyContent:`center`,flexShrink:0},children:(0,w.jsx)(D,{name:`trash`,size:12})})]},e.id))]})]})}function K_({accent:e=S.blue,title:t,subtitle:n,version:r,kb:i,onMgmt:a,extra:o,errorMode:s}){return(0,w.jsxs)(`div`,{style:{padding:`10px 16px`,borderBottom:`1px solid ${S.borderSoft}`,background:S.surface,display:`flex`,alignItems:`center`,gap:10,flexShrink:0},children:[(0,w.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,gap:8},children:[(0,w.jsx)(q,{tone:s?`red`:`green`,size:7,pulse:s}),(0,w.jsx)(`span`,{style:{fontSize:12.5,fontWeight:600,color:S.ink},children:t}),r&&(0,w.jsx)(J,{tone:`gray`,children:(0,w.jsx)(`span`,{className:`mono`,children:r})}),i&&(0,w.jsxs)(J,{tone:`blue`,children:[(0,w.jsx)(D,{name:`book`,size:10,stroke:2}),i]}),s&&(0,w.jsx)(J,{tone:`red`,children:`运行异常`})]}),(0,w.jsx)(`div`,{style:{fontSize:11.5,color:S.ink3,marginLeft:4},children:n}),(0,w.jsx)(`div`,{style:{flex:1}}),o,(0,w.jsxs)(`button`,{onClick:a,className:`edge-press edge-btn-secondary`,style:{...gd,height:28,padding:`0 10px`,fontSize:11.5},children:[(0,w.jsx)(D,{name:`dashboard`,size:12,stroke:1.8}),`应用管理`]})]})}function q_({app:e,onMgmt:t}){let n=e?.ports?.find(e=>e.hostPort>0)?.hostPort||e?.ports?.find(e=>e.containerPort>0)?.containerPort;if(!n)return(0,w.jsxs)(`div`,{style:{flex:1,display:`flex`,flexDirection:`column`},children:[(0,w.jsx)(K_,{accent:S.blue,title:e?.name||`App`,version:e?.version,subtitle:`iframe 嵌入`,onMgmt:t}),(0,w.jsxs)(`div`,{style:{flex:1,display:`flex`,alignItems:`center`,justifyContent:`center`,color:S.ink3,fontSize:13},children:[(0,w.jsx)(D,{name:`info`,size:16,stroke:1.8,style:{marginRight:8}}),`该应用未暴露 HostPort,无法嵌入`]})]});let r=`http://${window.location.hostname}:${n}`;return(0,w.jsxs)(`div`,{style:{flex:1,display:`flex`,flexDirection:`column`},children:[(0,w.jsx)(K_,{accent:S.blue,title:e?.name||`App`,version:e?.version,subtitle:r,onMgmt:t,errorMode:e?.state===`error`}),(0,w.jsx)(`iframe`,{src:r,style:{flex:1,width:`100%`,border:`none`},allow:`clipboard-read; clipboard-write`,title:e?.name})]})}function J_({appId:e,app:t,authed:n,onRequireAuth:r,onOpenManagement:i}){return e===`vscode`?(0,w.jsx)(Y_,{onMgmt:i}):e===`jupyter`?(0,w.jsx)($_,{onMgmt:i}):e===`ollama`?(0,w.jsx)(rv,{onMgmt:i}):e===`vllm`?(0,w.jsx)(av,{authed:n,onRequireAuth:r,onMgmt:i}):e===`comfyui`?(0,w.jsx)(ov,{onMgmt:i}):e===`sdwebui`?(0,w.jsx)(uv,{onMgmt:i}):e===`openwebui`?(0,w.jsx)(dv,{onMgmt:i}):e===`training`?(0,w.jsx)(pv,{onMgmt:i}):e===`files`?(0,w.jsx)(rg,{}):e===`models`?(0,w.jsx)(lg,{}):e===`processes`?(0,w.jsx)(hg,{}):e===`disks`?(0,w.jsx)(kg,{}):e===`network-connections`?(0,w.jsx)(Gg,{}):e===`monitoring`?(0,w.jsx)(c_,{}):e===`ai-activity`?(0,w.jsx)(F_,{}):e===`browser`?(0,w.jsx)(U_,{}):t?(0,w.jsx)(q_,{app:t,onMgmt:i}):null}function Y_({onMgmt:e}){let[t,n]=(0,b.useState)(`train.py`),[r,i]=(0,b.useState)(!0);return(0,w.jsxs)(`div`,{style:{flex:1,display:`flex`,flexDirection:`column`,background:`#1e1e1e`,color:`#cccccc`,overflow:`hidden`},children:[(0,w.jsxs)(`div`,{style:{height:30,background:`#252526`,borderBottom:`1px solid #1e1e1e`,display:`flex`,alignItems:`center`,padding:`0 8px`,flexShrink:0,fontSize:12},children:[[`文件`,`编辑`,`选择`,`查看`,`转到`,`运行`,`终端`,`帮助`].map(e=>(0,w.jsx)(`div`,{className:`edge-menu-item`,style:{padding:`5px 9px`,color:`#cccccc`,cursor:`pointer`,borderRadius:3,"--edge-menu-hover-bg":`#37373d`},children:e},e)),(0,w.jsx)(`div`,{style:{flex:1,textAlign:`center`,color:`#888`,fontSize:11.5},children:`llama-finetune — VS Code Server [GB10-DEV-01]`}),(0,w.jsxs)(`button`,{onClick:e,className:`edge-press edge-menu-item`,style:{padding:`4px 9px`,borderRadius:3,fontSize:11,color:`#888`,background:`transparent`,border:`none`,cursor:`pointer`,display:`flex`,alignItems:`center`,gap:4,"--edge-menu-hover-bg":`#37373d`},children:[(0,w.jsx)(D,{name:`dashboard`,size:11,stroke:1.8}),`管理`]})]}),(0,w.jsxs)(`div`,{style:{flex:1,display:`flex`,overflow:`hidden`},children:[(0,w.jsxs)(`div`,{style:{width:48,background:`#333`,flexShrink:0,display:`flex`,flexDirection:`column`,alignItems:`center`,padding:`6px 0`},children:[[`folder`,`search`,`history`,`play`,`apps`].map((e,t)=>(0,w.jsx)(`div`,{style:{width:36,height:36,display:`flex`,alignItems:`center`,justifyContent:`center`,color:t===0?`#ffffff`:`#858585`,cursor:`pointer`,borderLeft:t===0?`2px solid #0078d4`:`2px solid transparent`,marginBottom:2},children:(0,w.jsx)(D,{name:e,size:20,stroke:1.6})},e)),(0,w.jsx)(`div`,{style:{flex:1}}),(0,w.jsx)(`div`,{style:{width:36,height:36,display:`flex`,alignItems:`center`,justifyContent:`center`,color:`#858585`},children:(0,w.jsx)(D,{name:`user`,size:18,stroke:1.6})})]}),(0,w.jsxs)(`div`,{style:{width:240,background:`#252526`,flexShrink:0,borderRight:`1px solid #1e1e1e`,display:`flex`,flexDirection:`column`},children:[(0,w.jsx)(`div`,{style:{padding:`8px 14px 6px`,fontSize:10.5,fontWeight:700,color:`#cccccc`,letterSpacing:`0.06em`,textTransform:`uppercase`},children:`资源管理器`}),(0,w.jsxs)(`div`,{style:{padding:`0 8px 6px`,fontSize:11,color:`#969696`,display:`flex`,alignItems:`center`,gap:4},children:[(0,w.jsx)(D,{name:`chevDown`,size:11,stroke:2}),`LLAMA-FINETUNE`]}),(0,w.jsx)(`div`,{style:{flex:1,overflow:`auto`,padding:`0 8px 8px`,fontSize:12,lineHeight:1.6},children:(0,w.jsx)(X_,{nodes:[{type:`dir`,name:`datasets`,open:!1},{type:`dir`,name:`models`,open:!1},{type:`dir`,name:`checkpoints`,open:!1},{type:`dir`,name:`notebooks`,open:!0,children:[{type:`ipynb`,name:`eda.ipynb`},{type:`ipynb`,name:`sft_data_prep.ipynb`}]},{type:`dir`,name:`projects`,open:!0,children:[{type:`dir`,name:`llama-finetune`,open:!0,children:[{type:`py`,name:`train.py`,active:!0},{type:`py`,name:`dataset.py`},{type:`yaml`,name:`config.yaml`}]}]},{type:`py`,name:`utils.py`},{type:`txt`,name:`requirements.txt`},{type:`md`,name:`README.md`},{type:`env`,name:`.env`}],depth:0})})]}),(0,w.jsxs)(`div`,{style:{flex:1,display:`flex`,flexDirection:`column`,minWidth:0},children:[(0,w.jsx)(Zf,{tabs:[{name:`train.py`,icon:`py`,dirty:!0},{name:`config.yaml`,icon:`yaml`,dirty:!1},{name:`README.md`,icon:`md`,dirty:!1}],active:t,onChange:n,getId:e=>e.name,activeColor:`#0078d4`,activeTextColor:`#ffffff`,inactiveTextColor:`#969696`,indicatorPosition:`top`,style:{display:`flex`,background:`#252526`,borderBottom:`1px solid #1e1e1e`,height:35,flexShrink:0,overflowX:`auto`},itemStyle:{padding:`0 14px 0 12px`,borderRight:`1px solid #1e1e1e`,fontSize:12.5},activeItemStyle:{background:`#1e1e1e`,marginTop:-2},renderLabel:e=>(0,w.jsxs)(w.Fragment,{children:[(0,w.jsx)(Z_,{type:e.icon,size:13}),e.name,e.dirty&&(0,w.jsx)(`span`,{style:{color:`#cccccc`,fontSize:16,lineHeight:0},children:`●`}),(0,w.jsx)(`span`,{style:{color:`#858585`,marginLeft:4,fontSize:14},children:`×`})]})}),(0,w.jsxs)(`div`,{style:{flex:1,display:`flex`,overflow:`hidden`,minHeight:0},children:[(0,w.jsx)(`div`,{style:{width:40,background:`#1e1e1e`,borderRight:`1px solid #1e1e1e`,fontFamily:`ui-monospace, monospace`,fontSize:12,color:`#858585`,padding:`8px 0`,textAlign:`right`,userSelect:`none`,flexShrink:0},children:Array.from({length:30}).map((e,t)=>(0,w.jsx)(`div`,{style:{padding:`0 8px`,lineHeight:`18px`,color:t===12?`#ffffff`:t===16?`#ff5555`:`#858585`},children:t+1},t))}),(0,w.jsxs)(`div`,{style:{flex:1,padding:`8px 12px`,overflow:`auto`,fontFamily:`ui-monospace, "JetBrains Mono", monospace`,fontSize:12.5,lineHeight:`18px`,color:`#d4d4d4`},children:[(0,w.jsx)(Q_,{kw:`import`,rest:` torch`}),(0,w.jsx)(Q_,{kw:`import`,rest:` torch.nn `,kw2:`as`,rest2:` nn`}),(0,w.jsx)(Q_,{kw:`from`,rest:` transformers `,kw2:`import`,rest2:` AutoTokenizer, AutoModelForCausalLM`}),(0,w.jsx)(Q_,{kw:`from`,rest:` datasets `,kw2:`import`,rest2:` load_dataset`}),(0,w.jsx)(Q_,{kw:`from`,rest:` peft `,kw2:`import`,rest2:` LoraConfig, get_peft_model`}),(0,w.jsx)(Q_,{kw:`from`,rest:` trl `,kw2:`import`,rest2:` SFTTrainer, SFTConfig`}),(0,w.jsx)(Q_,{}),(0,w.jsx)(Q_,{comment:`# Configuration`}),(0,w.jsx)(Q_,{txt:`MODEL_NAME = `,str:`"meta-llama/Llama-3.1-8B"`}),(0,w.jsx)(Q_,{txt:`DATASET = `,str:`"alpaca-cleaned"`}),(0,w.jsx)(Q_,{txt:`OUTPUT_DIR = `,str:`"/workspace/checkpoints/llama-finetune-72h"`}),(0,w.jsx)(Q_,{}),(0,w.jsx)(Q_,{kw:`def`,fn:` train`,rest:`():`}),(0,w.jsx)(Q_,{highlight:!0,indent:1,txt:`tokenizer = `,kw2:`AutoTokenizer`,rest:`.from_pretrained(MODEL_NAME)`}),(0,w.jsx)(Q_,{indent:1,txt:`model = `,kw2:`AutoModelForCausalLM`,rest:`.from_pretrained(`}),(0,w.jsx)(Q_,{indent:2,txt:`MODEL_NAME,`}),(0,w.jsx)(Q_,{error:!0,indent:2,txt:`torch_dtype=torch.bfloat16, `,comment:`# OOM: 改 fp16`}),(0,w.jsx)(Q_,{indent:2,txt:`device_map=`,str:`"auto"`}),(0,w.jsx)(Q_,{indent:1,txt:`)`}),(0,w.jsx)(Q_,{}),(0,w.jsx)(Q_,{indent:1,txt:`peft_config = `,kw2:`LoraConfig`,rest:`(`}),(0,w.jsx)(Q_,{indent:2,txt:`r=64, lora_alpha=128,`}),(0,w.jsx)(Q_,{indent:2,txt:`target_modules=[`,str:`"q_proj"`,txt2:`, `,str2:`"v_proj"`,txt2b:`],`}),(0,w.jsx)(Q_,{indent:2,txt:`lora_dropout=0.05,`}),(0,w.jsx)(Q_,{indent:1,txt:`)`}),(0,w.jsx)(Q_,{indent:1,txt:`model = `,kw2:`get_peft_model`,rest:`(model, peft_config)`}),(0,w.jsx)(Q_,{}),(0,w.jsx)(Q_,{indent:1,txt:`trainer = `,kw2:`SFTTrainer`,rest:`(...)`}),(0,w.jsx)(Q_,{indent:1,kw:`return`,rest:` trainer.train()`})]})]}),r&&(0,w.jsxs)(`div`,{style:{height:220,borderTop:`1px solid #1e1e1e`,background:`#181818`,display:`flex`,flexDirection:`column`,flexShrink:0},children:[(0,w.jsxs)(`div`,{style:{display:`flex`,padding:`4px 12px`,background:`#252526`,borderBottom:`1px solid #1e1e1e`,fontSize:11.5},children:[[`终端`,`问题 1`,`输出`,`调试控制台`].map((e,t)=>(0,w.jsx)(`div`,{style:{padding:`4px 10px`,color:t===0?`#ffffff`:`#969696`,borderBottom:t===0?`2px solid #0078d4`:`2px solid transparent`,marginBottom:-1,cursor:`pointer`},children:e},e)),(0,w.jsx)(`div`,{style:{flex:1}}),(0,w.jsx)(`button`,{onClick:()=>i(!1),style:{background:`transparent`,border:`none`,color:`#858585`,cursor:`pointer`,padding:`2px 6px`,fontSize:11},children:`×`})]}),(0,w.jsxs)(`div`,{style:{flex:1,padding:`8px 14px`,fontFamily:`ui-monospace, monospace`,fontSize:12,color:`#cccccc`,overflow:`auto`,lineHeight:1.55},children:[(0,w.jsxs)(`div`,{children:[(0,w.jsx)(`span`,{style:{color:`#23d18b`},children:`dev-zhang@gb10-dev-01`}),`:`,(0,w.jsx)(`span`,{style:{color:`#3b8eea`},children:`~/projects/llama-finetune`}),`$ python train.py --resume`]}),(0,w.jsx)(`div`,{style:{color:`#969696`},children:`[2026-05-26 14:08:01] Loading tokenizer from meta-llama/Llama-3.1-8B`}),(0,w.jsx)(`div`,{style:{color:`#969696`},children:`[2026-05-26 14:08:03] Loading model... (this may take 2-3 minutes)`}),(0,w.jsx)(`div`,{style:{color:`#23d18b`},children:`[2026-05-26 14:08:18] Model loaded · 16.0 GB GPU memory`}),(0,w.jsx)(`div`,{style:{color:`#23d18b`},children:`[2026-05-26 14:08:19] LoRA adapter attached · trainable params: 41M (0.5%)`}),(0,w.jsx)(`div`,{style:{color:`#969696`},children:`[2026-05-26 14:08:20] Resuming from step 14,300 / 30,000`}),(0,w.jsxs)(`div`,{style:{color:`#cccccc`},children:[`{`,`'loss': 1.842, 'grad_norm': 0.412, 'learning_rate': 0.0001, 'epoch': 1.43`,`}`]}),(0,w.jsxs)(`div`,{style:{color:`#cccccc`},children:[`{`,`'loss': 1.821, 'grad_norm': 0.398, 'learning_rate': 0.0001, 'epoch': 1.44`,`}`]}),(0,w.jsxs)(`div`,{style:{color:`#cccccc`},children:[`{`,`'loss': 1.835, 'grad_norm': 0.405, 'learning_rate': 0.0001, 'epoch': 1.44`,`}`]}),(0,w.jsx)(`div`,{style:{color:`#ffba2c`},children:`[2026-05-26 14:14:22] WARNING: free disk space < 400GB — checkpoints may fail`}),(0,w.jsxs)(`div`,{style:{display:`flex`},children:[(0,w.jsx)(`span`,{style:{color:`#23d18b`},children:`dev-zhang@gb10-dev-01`}),`:`,(0,w.jsx)(`span`,{style:{color:`#3b8eea`},children:`~/projects/llama-finetune`}),`$\xA0`,(0,w.jsx)(`span`,{className:`edge-cursor`,style:{color:`#cccccc`},children:`▍`})]})]})]})]})]}),(0,w.jsxs)(`div`,{style:{height:22,background:`#0078d4`,color:`white`,fontSize:11.5,display:`flex`,alignItems:`center`,padding:`0 12px`,gap:14,flexShrink:0},children:[(0,w.jsxs)(`span`,{style:{display:`inline-flex`,alignItems:`center`,gap:4},children:[(0,w.jsx)(D,{name:`history`,size:11,stroke:2}),`main`]}),(0,w.jsx)(`span`,{style:{display:`inline-flex`,alignItems:`center`,gap:4},children:`✗ 0 ⚠ 2`}),(0,w.jsx)(`div`,{style:{flex:1}}),(0,w.jsx)(`span`,{children:`UTF-8`}),(0,w.jsx)(`span`,{children:`LF`}),(0,w.jsx)(`span`,{children:`Python 3.11.7 (.venv)`}),(0,w.jsx)(`span`,{children:`行 13,列 28`}),(0,w.jsx)(`span`,{children:`空格: 4`})]})]})}function X_({nodes:e,depth:t}){return e.map((e,n)=>(0,w.jsxs)(b.Fragment,{children:[(0,w.jsxs)(`div`,{style:{paddingLeft:t*14+4,display:`flex`,alignItems:`center`,gap:4,cursor:`pointer`,padding:`2px 4px 2px `+(t*14+4)+`px`,background:e.active?`rgba(255,255,255,0.08)`:`transparent`,color:e.active?`#ffffff`:`#cccccc`},children:[e.type===`dir`?(0,w.jsx)(D,{name:`chevDown`,size:10,stroke:2,style:{color:`#858585`,transform:e.open?``:`rotate(-90deg)`}}):(0,w.jsx)(`span`,{style:{width:10}}),(0,w.jsx)(Z_,{type:e.type,size:12}),(0,w.jsx)(`span`,{children:e.name})]}),e.open&&e.children&&(0,w.jsx)(X_,{nodes:e.children,depth:t+1})]},n))}function Z_({type:e,size:t=14}){let n={dir:{color:`#dcb67a`,icon:`folder`},py:{color:`#3572a5`,icon:`code`},yaml:{color:`#fbc02d`,icon:`code`},md:{color:`#3b82f6`,icon:`book`},txt:{color:`#9e9e9e`,icon:`code`},env:{color:`#737373`,icon:`lock`},ipynb:{color:`#f37726`,icon:`jupyter`}},r=n[e]||n.txt;return(0,w.jsx)(`span`,{style:{color:r.color,display:`inline-flex`},children:(0,w.jsx)(D,{name:r.icon,size:t,stroke:1.7})})}function Q_({kw:e,kw2:t,fn:n,str:r,str2:i,comment:a,txt:o,txt2:s,txt2b:c,rest:l,rest2:u,indent:d=0,highlight:f,error:p}){return(0,w.jsxs)(`div`,{style:{paddingLeft:d*24,position:`relative`,background:f?`rgba(33,150,243,0.12)`:p?`rgba(255,85,85,0.08)`:`transparent`},children:[a&&(0,w.jsx)(`span`,{style:{color:`#6a9955`},children:a}),e&&(0,w.jsx)(`span`,{style:{color:`#c586c0`},children:e}),n&&(0,w.jsx)(`span`,{style:{color:`#dcdcaa`},children:n}),t&&(0,w.jsx)(`span`,{style:{color:`#4ec9b0`},children:t}),o&&(0,w.jsx)(`span`,{children:o}),r&&(0,w.jsx)(`span`,{style:{color:`#ce9178`},children:r}),s&&(0,w.jsx)(`span`,{children:s}),i&&(0,w.jsx)(`span`,{style:{color:`#ce9178`},children:i}),c&&(0,w.jsx)(`span`,{children:c}),l&&(0,w.jsx)(`span`,{children:l}),u&&(0,w.jsx)(`span`,{children:u}),!e&&!n&&!o&&!a&&!l&&`\xA0`]})}function $_({onMgmt:e}){return(0,w.jsxs)(`div`,{style:{flex:1,display:`flex`,flexDirection:`column`,background:`#f6f6f6`,overflow:`hidden`},children:[(0,w.jsxs)(`div`,{style:{height:30,background:`#fafafa`,borderBottom:`1px solid #d8d8d8`,display:`flex`,alignItems:`center`,padding:`0 8px`,flexShrink:0,fontSize:12.5},children:[(0,w.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,gap:5,padding:`0 10px 0 6px`,borderRight:`1px solid #d8d8d8`,height:`100%`},children:[(0,w.jsx)(`div`,{style:{width:22,height:22,borderRadius:4,background:`linear-gradient(140deg, #fb923c, #c2410c)`,color:`white`,display:`flex`,alignItems:`center`,justifyContent:`center`},children:(0,w.jsx)(D,{name:`jupyter`,size:13,stroke:1.6})}),(0,w.jsx)(`span`,{style:{fontSize:12,fontWeight:600,color:S.ink},children:`JupyterLab`})]}),[`文件`,`编辑`,`查看`,`运行`,`内核`,`选项卡`,`设置`,`帮助`].map(e=>(0,w.jsx)(`div`,{style:{padding:`5px 10px`,color:`#333`,cursor:`pointer`},children:e},e)),(0,w.jsx)(`div`,{style:{flex:1}}),(0,w.jsxs)(`button`,{onClick:e,className:`edge-press edge-btn-secondary`,style:{...gd,height:22,padding:`0 8px`,fontSize:11},children:[(0,w.jsx)(D,{name:`dashboard`,size:11,stroke:1.8}),`管理`]})]}),(0,w.jsxs)(`div`,{style:{flex:1,display:`flex`,overflow:`hidden`},children:[(0,w.jsx)(`div`,{style:{width:40,background:`#f0f0f0`,borderRight:`1px solid #d8d8d8`,display:`flex`,flexDirection:`column`,alignItems:`center`,padding:`8px 0`,flexShrink:0},children:[{ic:`folder`,on:!0},{ic:`play`,on:!1},{ic:`sparkle`,on:!1},{ic:`apps`,on:!1},{ic:`gear`,on:!1}].map((e,t)=>(0,w.jsx)(`div`,{style:{width:32,height:32,display:`flex`,alignItems:`center`,justifyContent:`center`,color:e.on?`#0078d4`:`#666`,cursor:`pointer`,marginBottom:4,borderLeft:e.on?`2px solid #0078d4`:`2px solid transparent`},children:(0,w.jsx)(D,{name:e.ic,size:17,stroke:1.7})},t))}),(0,w.jsxs)(`div`,{style:{width:220,background:`white`,borderRight:`1px solid #d8d8d8`,display:`flex`,flexDirection:`column`,flexShrink:0},children:[(0,w.jsxs)(`div`,{style:{padding:`8px 12px`,borderBottom:`1px solid #ececec`,display:`flex`,alignItems:`center`,gap:6,fontSize:11.5},children:[(0,w.jsx)(D,{name:`plus`,size:13,stroke:1.8,style:{color:`#666`}}),(0,w.jsx)(D,{name:`folder`,size:13,stroke:1.8,style:{color:`#666`}}),(0,w.jsx)(D,{name:`refresh`,size:13,stroke:1.8,style:{color:`#666`}}),(0,w.jsx)(`div`,{style:{flex:1}}),(0,w.jsx)(`span`,{style:{color:S.ink3},children:`/workspace`})]}),(0,w.jsx)(`div`,{style:{flex:1,overflow:`auto`,padding:`4px 0`,fontSize:12},children:[[`.`,`dir`,`..`],[`notebooks`,`dir`,`23 项`],[`datasets`,`dir`,`12 项`],[`exploration.ipynb`,`ipynb`,`14 分钟前`],[`sft_data_prep.ipynb`,`ipynb`,`昨天`],[`loss_curves.ipynb`,`ipynb`,`昨天`],[`model_eval.ipynb`,`ipynb`,`5/24`],[`eda_alpaca.ipynb`,`ipynb`,`5/22`]].map(([e,t,n],r)=>(0,w.jsxs)(`div`,{style:{padding:`4px 12px 4px 18px`,display:`flex`,alignItems:`center`,gap:6,background:r===3?`#e8f0fe`:`transparent`,cursor:`pointer`},children:[(0,w.jsx)(Z_,{type:t,size:13}),(0,w.jsx)(`span`,{style:{color:`#333`,fontSize:12,fontWeight:r===3?600:400},children:e}),(0,w.jsx)(`div`,{style:{flex:1}}),(0,w.jsx)(`span`,{style:{color:S.ink4,fontSize:10.5},children:n})]},r))})]}),(0,w.jsxs)(`div`,{style:{flex:1,display:`flex`,flexDirection:`column`,minWidth:0},children:[(0,w.jsx)(`div`,{style:{display:`flex`,background:`#fafafa`,borderBottom:`1px solid #d8d8d8`,flexShrink:0},children:(0,w.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,gap:6,padding:`8px 14px`,background:`white`,borderBottom:`2px solid #0078d4`,fontSize:12.5,color:S.ink,marginBottom:-1},children:[(0,w.jsx)(Z_,{type:`ipynb`,size:13}),`exploration.ipynb`,(0,w.jsx)(`span`,{style:{marginLeft:4,color:`#858585`},children:`×`})]})}),(0,w.jsxs)(`div`,{style:{padding:`6px 14px`,background:`white`,borderBottom:`1px solid #ececec`,display:`flex`,alignItems:`center`,gap:6,flexShrink:0},children:[[`plus`,`stop`,`play`,`refresh`,`download`].map(e=>(0,w.jsx)(`button`,{className:`edge-press edge-menu-item`,style:{width:26,height:26,borderRadius:4,border:`1px solid transparent`,background:`transparent`,cursor:`pointer`,color:S.ink3,display:`flex`,alignItems:`center`,justifyContent:`center`,"--edge-menu-hover-bg":`#f0f0f0`},children:(0,w.jsx)(D,{name:e,size:13,stroke:1.7})},e)),(0,w.jsx)(`div`,{style:{width:1,height:18,background:`#d8d8d8`,margin:`0 4px`}}),(0,w.jsxs)(`select`,{style:{fontSize:12,padding:`2px 6px`,borderRadius:4,border:`1px solid #d8d8d8`,background:`white`},children:[(0,w.jsx)(`option`,{children:`代码`}),(0,w.jsx)(`option`,{children:`Markdown`})]}),(0,w.jsx)(`div`,{style:{flex:1}}),(0,w.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,gap:6,fontSize:11.5,color:S.ink3},children:[(0,w.jsx)(q,{tone:`green`,size:6}),(0,w.jsx)(`span`,{className:`mono`,children:`Python 3.11 (CUDA)`})]})]}),(0,w.jsxs)(`div`,{style:{flex:1,overflow:`auto`,padding:`14px 28px`,background:`white`},children:[(0,w.jsxs)(ev,{n:1,kind:`md`,children:[(0,w.jsx)(`h2`,{style:{margin:`0 0 8px`,fontSize:18,color:S.ink},children:`Alpaca 数据集 EDA`}),(0,w.jsx)(`p`,{style:{margin:0,fontSize:13,lineHeight:1.7,color:S.ink2},children:`探索 alpaca-cleaned 数据集的指令长度分布、主题聚类,并为 SFT 微调做数据准备。`})]}),(0,w.jsxs)(ev,{n:2,kind:`code`,children:[(0,w.jsxs)(`div`,{style:{fontFamily:`ui-monospace, monospace`,fontSize:12.5,lineHeight:1.65},children:[(0,w.jsxs)(`div`,{children:[(0,w.jsx)(`span`,{style:{color:`#c586c0`},children:`import`}),` pandas `,(0,w.jsx)(`span`,{style:{color:`#c586c0`},children:`as`}),` pd`]}),(0,w.jsxs)(`div`,{children:[(0,w.jsx)(`span`,{style:{color:`#c586c0`},children:`import`}),` matplotlib.pyplot `,(0,w.jsx)(`span`,{style:{color:`#c586c0`},children:`as`}),` plt`]}),(0,w.jsxs)(`div`,{children:[(0,w.jsx)(`span`,{style:{color:`#c586c0`},children:`from`}),` datasets `,(0,w.jsx)(`span`,{style:{color:`#c586c0`},children:`import`}),` load_dataset`]}),(0,w.jsx)(`div`,{children:`\xA0`}),(0,w.jsxs)(`div`,{children:[`ds = `,(0,w.jsx)(`span`,{style:{color:`#4ec9b0`},children:`load_dataset`}),`(`,(0,w.jsx)(`span`,{style:{color:`#ce9178`},children:`"yahma/alpaca-cleaned"`}),`)`]}),(0,w.jsxs)(`div`,{children:[`df = ds[`,(0,w.jsx)(`span`,{style:{color:`#ce9178`},children:`"train"`}),`].to_pandas()`]}),(0,w.jsx)(`div`,{children:`df.shape, df.columns.tolist()`})]}),(0,w.jsx)(tv,{children:(0,w.jsx)(`div`,{className:`mono`,style:{fontSize:12},children:`(51760, 3), ['instruction', 'input', 'output']`})})]}),(0,w.jsxs)(ev,{n:3,kind:`code`,children:[(0,w.jsxs)(`div`,{style:{fontFamily:`ui-monospace, monospace`,fontSize:12.5,lineHeight:1.65},children:[(0,w.jsxs)(`div`,{children:[`df[`,(0,w.jsx)(`span`,{style:{color:`#ce9178`},children:`"len"`}),`] = df[`,(0,w.jsx)(`span`,{style:{color:`#ce9178`},children:`"output"`}),`].str.`,(0,w.jsx)(`span`,{style:{color:`#4ec9b0`},children:`split`}),`().str.`,(0,w.jsx)(`span`,{style:{color:`#4ec9b0`},children:`len`}),`()`]}),(0,w.jsxs)(`div`,{children:[`df[`,(0,w.jsx)(`span`,{style:{color:`#ce9178`},children:`"len"`}),`].`,(0,w.jsx)(`span`,{style:{color:`#4ec9b0`},children:`hist`}),`(bins=`,(0,w.jsx)(`span`,{style:{color:`#b5cea8`},children:`50`}),`, figsize=(`,(0,w.jsx)(`span`,{style:{color:`#b5cea8`},children:`10`}),`, `,(0,w.jsx)(`span`,{style:{color:`#b5cea8`},children:`4`}),`))`]}),(0,w.jsxs)(`div`,{children:[`plt.`,(0,w.jsx)(`span`,{style:{color:`#4ec9b0`},children:`title`}),`(`,(0,w.jsx)(`span`,{style:{color:`#ce9178`},children:`"Token length distribution"`}),`)`]}),(0,w.jsxs)(`div`,{children:[`plt.`,(0,w.jsx)(`span`,{style:{color:`#4ec9b0`},children:`show`}),`()`]})]}),(0,w.jsx)(tv,{children:(0,w.jsx)(nv,{})})]}),(0,w.jsx)(ev,{n:4,kind:`code`,running:!0,children:(0,w.jsxs)(`div`,{style:{fontFamily:`ui-monospace, monospace`,fontSize:12.5,lineHeight:1.65},children:[(0,w.jsx)(`div`,{children:(0,w.jsx)(`span`,{style:{color:`#6a9955`},children:`# 长尾样本:超过 512 tokens 的样本占比`})}),(0,w.jsxs)(`div`,{children:[`(df[`,(0,w.jsx)(`span`,{style:{color:`#ce9178`},children:`"len"`}),`] `,`>`,` `,(0,w.jsx)(`span`,{style:{color:`#b5cea8`},children:`512`}),`).`,(0,w.jsx)(`span`,{style:{color:`#4ec9b0`},children:`mean`}),`()`]})]})}),(0,w.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,gap:8,padding:`8px 50px`,fontSize:12,color:S.ink3,cursor:`pointer`},children:[(0,w.jsx)(D,{name:`plus`,size:13,stroke:1.8}),`新增单元格`]})]}),(0,w.jsxs)(`div`,{style:{padding:`4px 14px`,background:`#fafafa`,borderTop:`1px solid #ececec`,display:`flex`,alignItems:`center`,gap:14,fontSize:11.5,color:S.ink3,flexShrink:0},children:[(0,w.jsxs)(`span`,{style:{display:`inline-flex`,alignItems:`center`,gap:4},children:[(0,w.jsx)(q,{tone:`green`,size:6}),`已保存`]}),(0,w.jsx)(`span`,{children:`3 / 4 单元格`}),(0,w.jsx)(`div`,{style:{flex:1}}),(0,w.jsx)(`span`,{className:`mono`,children:`PyTorch 2.5.1 · CUDA 12.4`}),(0,w.jsxs)(`span`,{style:{display:`inline-flex`,alignItems:`center`,gap:4},children:[(0,w.jsx)(D,{name:`bolt`,size:11,stroke:1.8}),(0,w.jsx)(`span`,{className:`mono`,children:`12% GPU`})]}),(0,w.jsx)(`span`,{className:`mono`,children:`RAM 3.8 GB`})]})]})]})]})}function ev({n:e,kind:t,running:n,children:r}){let i=t===`code`;return(0,w.jsxs)(`div`,{style:{display:`flex`,gap:8,marginBottom:10},children:[(0,w.jsx)(`div`,{style:{width:50,fontFamily:`ui-monospace, monospace`,fontSize:11.5,color:S.ink4,paddingTop:8,textAlign:`right`,flexShrink:0},children:n?(0,w.jsx)(`span`,{style:{color:S.amber},children:`[*]:`}):i?`[${e}]:`:``}),(0,w.jsx)(`div`,{style:{flex:1,padding:i?`8px 12px`:`4px 12px`,background:i?`#f8f8f8`:`transparent`,border:i?`1px solid #ececec`:`none`,borderLeft:i?`3px solid #0078d4`:`none`,borderRadius:4,minWidth:0},children:r})]})}function tv({children:e}){return(0,w.jsx)(`div`,{style:{marginTop:8,paddingTop:8,borderTop:`1px dashed #ececec`,color:S.ink2,fontSize:12},children:e})}function nv(){let e=[12,28,65,92,110,95,78,54,38,24,16,12,8,5,3],t=Math.max(...e);return(0,w.jsxs)(`svg`,{width:540,height:160,style:{display:`block`},children:[(0,w.jsx)(`line`,{x1:`40`,x2:530,y1:138,y2:138,stroke:`#999`,strokeWidth:`1`}),(0,w.jsx)(`line`,{x1:`40`,x2:`40`,y1:`10`,y2:138,stroke:`#999`,strokeWidth:`1`}),e.map((n,r)=>{let i=480/e.length,a=n/t*120;return(0,w.jsx)(`rect`,{x:42+r*i,y:138-a,width:i-2,height:a,fill:`#3b82f6`,opacity:`0.85`},r)}),(0,w.jsx)(`text`,{x:540/2,y:12,textAnchor:`middle`,fontSize:`11`,fill:`#333`,children:`Token length distribution`}),[0,200,400,600,800,1e3,1200].map((e,t)=>(0,w.jsx)(`text`,{x:42+480/6*t,y:154,fontSize:`10`,fill:`#666`,textAnchor:`middle`,children:e},t))]})}function rv({onMgmt:e}){let[t,n]=(0,b.useState)(`llama-3.1-8b-instruct`),[r,i]=(0,b.useState)(`帮我把 RAG 系统的查询流程画一个简单的时序图(用 mermaid 语法):`),[a,o]=(0,b.useState)(.7),[s,c]=(0,b.useState)(1024),[l,u]=(0,b.useState)(!1),[d,f]=(0,b.useState)(`\`\`\`mermaid -sequenceDiagram - participant U as 用户 - participant W as Open WebUI - participant O as Ollama - participant V as Qdrant - - U->>W: 提问 - W->>V: 1. 检索相关文档 - V-->>W: top-k 片段 - W->>O: 2. 拼接 Prompt + 检索结果 - O-->>W: 流式生成回答 - W-->>U: 渲染答案 + 引用 -\`\`\` - -这个流程图展示了 RAG 系统的核心五步:用户提问 → 向量库检索 → 提示词组装 → LLM 生成 → 流式返回。`),p=[{name:`llama-3.1-8b-instruct`,size:`4.7 GB`,params:`8B`,family:`Llama`,loaded:!0,ctx:`128K`},{name:`qwen2.5-14b`,size:`8.7 GB`,params:`14.7B`,family:`Qwen`,loaded:!0,ctx:`128K`},{name:`qwen2.5-coder-32b`,size:`19.0 GB`,params:`32.5B`,family:`Qwen`,loaded:!1,ctx:`128K`},{name:`deepseek-r1-distill-32b`,size:`18.4 GB`,params:`32.5B`,family:`DeepSeek`,loaded:!1,ctx:`64K`},{name:`glm5-9b`,size:`5.4 GB`,params:`9.4B`,family:`GLM`,loaded:!1,ctx:`128K`},{name:`bge-m3`,size:`1.2 GB`,params:`568M`,family:`BGE`,loaded:!0,ctx:`8K`,embedding:!0}];return(0,w.jsxs)(`div`,{style:{flex:1,display:`flex`,flexDirection:`column`,overflow:`hidden`,background:S.surfaceAlt},children:[(0,w.jsx)(K_,{title:`Ollama · 本地模型推理`,subtitle:`OpenAI 兼容 API`,version:`v0.4.7`,onMgmt:e,extra:(0,w.jsxs)(`div`,{style:{display:`inline-flex`,alignItems:`center`,gap:6,padding:`3px 9px`,borderRadius:999,background:`#0f172a`,color:`#e2e8f0`,fontSize:11,fontFamily:`ui-monospace, monospace`},children:[(0,w.jsx)(D,{name:`globe`,size:11,stroke:1.8}),`http://localhost:11434/v1`]})}),(0,w.jsxs)(`div`,{style:{flex:1,display:`flex`,overflow:`hidden`},children:[(0,w.jsxs)(`div`,{style:{width:280,flexShrink:0,borderRight:`1px solid ${S.borderSoft}`,background:S.surface,overflowY:`auto`,padding:`14px 12px`},children:[(0,w.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,marginBottom:10},children:[(0,w.jsx)(`div`,{style:{fontSize:12,fontWeight:700,color:S.ink},children:`已安装模型`}),(0,w.jsx)(`div`,{style:{flex:1}}),(0,w.jsxs)(`span`,{style:{fontSize:11,color:S.ink3},children:[p.filter(e=>e.loaded).length,` / `,p.length,` 加载`]})]}),(0,w.jsxs)(`button`,{style:{width:`100%`,height:32,marginBottom:10,borderRadius:7,background:`white`,border:`1px dashed ${S.border}`,color:S.ink2,fontSize:12,fontWeight:500,cursor:`pointer`,display:`flex`,alignItems:`center`,justifyContent:`center`,gap:5},children:[(0,w.jsx)(D,{name:`download`,size:12,stroke:1.8}),`从 ollama.ai 拉取`]}),(0,w.jsx)(`div`,{style:{display:`flex`,flexDirection:`column`,gap:4},children:p.map(e=>{let r=t===e.name;return(0,w.jsxs)(`div`,{onClick:()=>n(e.name),style:{padding:`10px`,borderRadius:8,cursor:`pointer`,background:r?`#eff4ff`:`transparent`,border:`1px solid ${r?`#bfdbfe`:`transparent`}`},children:[(0,w.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,gap:6},children:[(0,w.jsx)(D,{name:`sparkle`,size:12,stroke:1.8,style:{color:r?S.blueDeep:S.ink3}}),(0,w.jsx)(`span`,{style:{fontSize:12.5,fontWeight:600,color:r?S.blueDeep:S.ink},className:`mono`,children:e.name}),(0,w.jsx)(`div`,{style:{flex:1}}),e.loaded?(0,w.jsx)(`span`,{style:{fontSize:9.5,padding:`1px 5px`,borderRadius:3,background:`#ecfdf5`,color:`#047857`,fontWeight:600,border:`1px solid #a7f3d0`},children:`常驻`}):(0,w.jsx)(`span`,{style:{fontSize:9.5,color:S.ink4},children:`未加载`})]}),(0,w.jsxs)(`div`,{style:{display:`flex`,gap:8,marginTop:5,fontSize:10.5,color:S.ink3},className:`mono tnum`,children:[(0,w.jsx)(`span`,{children:e.params}),(0,w.jsx)(`span`,{style:{color:`#cbd5e1`},children:`·`}),(0,w.jsx)(`span`,{children:e.size}),(0,w.jsx)(`span`,{style:{color:`#cbd5e1`},children:`·`}),(0,w.jsx)(`span`,{children:e.ctx}),e.embedding&&(0,w.jsx)(J,{tone:`violet`,style:{fontSize:9,padding:`0 4px`,marginLeft:2},children:`EMB`})]})]},e.name)})})]}),(0,w.jsxs)(`div`,{style:{flex:1,display:`flex`,overflow:`hidden`,minWidth:0},children:[(0,w.jsxs)(`div`,{style:{flex:1,padding:18,display:`flex`,flexDirection:`column`,gap:12,overflow:`auto`,minWidth:0},children:[(0,w.jsxs)(`div`,{children:[(0,w.jsx)(`div`,{style:{fontSize:11.5,color:S.ink3,fontWeight:600,letterSpacing:`0.04em`,textTransform:`uppercase`,marginBottom:6},children:`提示词`}),(0,w.jsx)(`textarea`,{value:r,onChange:e=>i(e.target.value),style:{width:`100%`,height:86,padding:`10px 12px`,border:`1px solid ${S.border}`,borderRadius:8,fontSize:12.5,lineHeight:1.6,color:S.ink,background:`white`,outline:`none`,resize:`vertical`,fontFamily:`inherit`}})]}),(0,w.jsxs)(`div`,{children:[(0,w.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,marginBottom:6},children:[(0,w.jsx)(`span`,{style:{fontSize:11.5,color:S.ink3,fontWeight:600,letterSpacing:`0.04em`,textTransform:`uppercase`},children:`输出`}),(0,w.jsx)(`div`,{style:{flex:1}}),l&&(0,w.jsxs)(J,{tone:`blue`,children:[(0,w.jsx)(q,{tone:`blue`,size:6,pulse:!0}),`生成中 · 28 tok/s`]})]}),(0,w.jsxs)(`div`,{style:{background:`#0b1020`,color:`#e2e8f0`,borderRadius:8,padding:`14px 16px`,minHeight:220,fontSize:12.5,lineHeight:1.75,fontFamily:`ui-monospace, monospace`,whiteSpace:`pre-wrap`},children:[d.split(/(`{3}[\s\S]*?`{3}|`[^`]+`)/g).map((e,t)=>e.startsWith("```")?(0,w.jsx)(`div`,{style:{background:`rgba(255,255,255,0.04)`,borderLeft:`2px solid ${S.green}`,padding:`8px 10px`,borderRadius:4,margin:`6px 0`,fontSize:11.5,color:`#7dd3fc`},children:e.replace(/^```\w*\n?|```$/g,``)},t):e.startsWith("`")?(0,w.jsx)(`span`,{style:{background:`rgba(255,255,255,0.06)`,padding:`1px 5px`,borderRadius:3,color:`#fbbf24`},children:e.slice(1,-1)},t):e),l&&(0,w.jsx)(`span`,{className:`edge-cursor`,style:{color:`#34d399`},children:`▍`})]})]}),(0,w.jsxs)(`button`,{onClick:()=>{u(!0),f(``);let e=0,n="正在调用模型 `"+t+"`(temperature="+a+`, max_tokens=`+s+`)… 演示模式,模拟流式输出 …`,r=setInterval(()=>{if(e>=n.length){clearInterval(r),u(!1);return}f(t=>t+n[e]),e++},18)},disabled:l,style:{height:38,borderRadius:8,background:l?`#94a3b8`:S.blue,color:`white`,border:`none`,fontSize:13,fontWeight:600,cursor:l?`wait`:`pointer`,display:`flex`,alignItems:`center`,justifyContent:`center`,gap:6},children:[(0,w.jsx)(D,{name:`play`,size:13,stroke:2}),l?`生成中…`:`运行推理`]})]}),(0,w.jsxs)(`div`,{style:{width:240,flexShrink:0,padding:16,background:S.surface,borderLeft:`1px solid ${S.borderSoft}`,overflowY:`auto`},children:[(0,w.jsx)(`div`,{style:{fontSize:12,fontWeight:700,color:S.ink,marginBottom:12},children:`推理参数`}),(0,w.jsx)(iv,{label:`Temperature`,value:a,min:0,max:2,step:.1,onChange:o}),(0,w.jsx)(iv,{label:`Max tokens`,value:s,min:64,max:4096,step:64,onChange:c}),(0,w.jsx)(iv,{label:`Top-P`,value:.95,min:0,max:1,step:.05,onChange:()=>{}}),(0,w.jsx)(iv,{label:`Frequency`,value:0,min:-2,max:2,step:.1,onChange:()=>{}}),(0,w.jsxs)(`div`,{style:{marginTop:16,paddingTop:12,borderTop:`1px solid ${S.borderSoft}`},children:[(0,w.jsx)(`div`,{style:{fontSize:11.5,fontWeight:600,color:S.ink3,marginBottom:8,letterSpacing:`0.04em`,textTransform:`uppercase`},children:`API 示例`}),(0,w.jsx)(`pre`,{style:{margin:0,padding:10,background:`#0b1020`,color:`#cbd5e1`,borderRadius:6,fontSize:10.5,lineHeight:1.55,whiteSpace:`pre-wrap`,overflow:`auto`},children:`curl localhost:11434/v1/chat/completions \\ - -H "Content-Type: application/json" \\ - -d '{"model":"${t}","messages":[...]}'`})]})]})]})]})]})}function iv({label:e,value:t,min:n,max:r,step:i,onChange:a}){return(0,w.jsxs)(`div`,{style:{marginBottom:14},children:[(0,w.jsxs)(`div`,{style:{display:`flex`,alignItems:`baseline`,marginBottom:6},children:[(0,w.jsx)(`span`,{style:{fontSize:11.5,color:S.ink2,fontWeight:500},children:e}),(0,w.jsx)(`div`,{style:{flex:1}}),(0,w.jsx)(`span`,{className:`mono tnum`,style:{fontSize:12,color:S.ink,fontWeight:600},children:t})]}),(0,w.jsx)(`input`,{type:`range`,min:n,max:r,step:i,value:t,onChange:e=>a(Number(e.target.value)),style:{width:`100%`,accentColor:S.blue}})]})}function av({authed:e,onRequireAuth:t,onMgmt:n}){return(0,w.jsxs)(`div`,{style:{flex:1,display:`flex`,flexDirection:`column`,overflow:`hidden`,background:S.surfaceAlt},children:[(0,w.jsx)(K_,{title:`vLLM · LLM 推理服务`,subtitle:`3 次自动重启失败,需人工介入`,version:`v0.6.4`,onMgmt:n,errorMode:!0}),(0,w.jsx)(`div`,{style:{flex:1,overflowY:`auto`,padding:`24px 28px`},children:(0,w.jsxs)(`div`,{style:{maxWidth:880,margin:`0 auto`},children:[(0,w.jsxs)(`div`,{style:{background:`linear-gradient(180deg, #fef2f2 0%, white 100%)`,border:`1px solid #fecaca`,borderRadius:14,padding:24,display:`flex`,gap:18,alignItems:`flex-start`,marginBottom:14},children:[(0,w.jsx)(`div`,{className:`edge-pulse`,style:{width:60,height:60,borderRadius:16,background:`linear-gradient(140deg, #fb7185, #be123c)`,color:`white`,display:`flex`,alignItems:`center`,justifyContent:`center`,flexShrink:0,boxShadow:`0 8px 22px -4px rgba(239,68,68,0.4)`},children:(0,w.jsx)(D,{name:`alertTri`,size:28,stroke:1.7})}),(0,w.jsxs)(`div`,{style:{flex:1,minWidth:0},children:[(0,w.jsx)(`div`,{style:{fontSize:10.5,color:S.red,fontWeight:700,letterSpacing:`0.06em`,textTransform:`uppercase`,marginBottom:4},children:`CUDA OOM · 启动阶段`}),(0,w.jsx)(`div`,{style:{fontSize:19,fontWeight:700,color:S.ink,letterSpacing:`-0.01em`,lineHeight:1.3},children:`vLLM 无法加载 Llama-3.1-70B-Instruct`}),(0,w.jsxs)(`div`,{style:{fontSize:12.5,color:S.ink2,marginTop:8,lineHeight:1.7},children:[`加载 `,(0,w.jsx)(`span`,{className:`mono`,style:{background:S.surface,padding:`1px 5px`,borderRadius:3,border:`1px solid ${S.border}`},children:`llama-3.1-70b-instruct`}),` 时, GPU 显存峰值达 `,(0,w.jsx)(`strong`,{children:`124.6 GB`}),`(含 KV cache 预分配),超出 128 GB 上限。`]}),(0,w.jsxs)(`div`,{style:{display:`flex`,gap:8,marginTop:14,flexWrap:`wrap`},children:[(0,w.jsxs)(`button`,{onClick:()=>!e&&t(`强制重启 vLLM`),className:`edge-press edge-btn-primary`,style:{..._d,background:S.red,border:`none`,height:34,padding:`0 14px`,fontSize:12.5},children:[(0,w.jsx)(D,{name:`refresh`,size:13,stroke:2}),e?`强制重启`:`需验证后强制重启`]}),(0,w.jsxs)(`button`,{className:`edge-press edge-btn-secondary`,style:{...gd,height:34,padding:`0 14px`,fontSize:12.5},children:[(0,w.jsx)(D,{name:`history`,size:13,stroke:1.8}),`切换到 70B-AWQ 量化版`]}),(0,w.jsxs)(`button`,{className:`edge-press edge-btn-secondary`,style:{...gd,height:34,padding:`0 14px`,fontSize:12.5},children:[(0,w.jsx)(D,{name:`terminal`,size:13,stroke:1.8}),`查看完整 stderr`]}),(0,w.jsxs)(`button`,{onClick:n,className:`edge-press edge-btn-secondary`,style:{...gd,height:34,padding:`0 14px`,fontSize:12.5},children:[(0,w.jsx)(D,{name:`download`,size:13,stroke:1.8}),`导出诊断包`]})]})]})]}),(0,w.jsxs)(`div`,{style:{background:S.surface,border:`1px solid ${S.border}`,borderRadius:10,padding:18,marginBottom:14},children:[(0,w.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,gap:8,marginBottom:10},children:[(0,w.jsx)(D,{name:`sparkle`,size:14,stroke:1.8,style:{color:S.blueDeep}}),(0,w.jsx)(`div`,{style:{fontSize:13,fontWeight:700,color:S.ink},children:`建议处置(按推荐顺序)`}),(0,w.jsx)(`div`,{style:{flex:1}}),(0,w.jsx)(J,{tone:`blue`,children:`来自社区最佳实践库`})]}),[{step:`1`,title:`使用 AWQ / GPTQ 量化版本`,detail:"70B 全精度需 ~140GB 显存,AWQ INT4 量化后仅需 ~38GB,质量损失 <2%。推荐 `casperhansen/llama-3.1-70b-instruct-awq`。",action:`一键切换模型`,risky:!1},{step:`2`,title:`降低 max_model_len 至 4096`,detail:`KV cache 预分配按 max_model_len 计算,从 16K 降到 4K 可节约约 28GB 显存,但牺牲长上下文能力。`,action:`编辑启动参数`,risky:!0},{step:`3`,title:`启用 chunked-prefill`,detail:`vLLM 0.6.5 引入的分块预填充可降低峰值显存约 20%,对吞吐量影响很小。需升级到 0.6.5+。`,action:`升级 vLLM 镜像`,risky:!0},{step:`4`,title:`改用 8B 版本`,detail:`Llama-3.1-8B-Instruct 仅需 16GB 显存,已在 Ollama 中常驻。仅作为兜底方案。`,action:`切换到 8B`,risky:!1}].map(e=>(0,w.jsxs)(`div`,{style:{display:`flex`,gap:12,padding:`12px 0`,borderTop:`1px solid ${S.borderSoft}`},children:[(0,w.jsx)(`div`,{style:{width:24,height:24,borderRadius:6,flexShrink:0,background:S.blueSoft,color:S.blueDeep,display:`flex`,alignItems:`center`,justifyContent:`center`,fontSize:12,fontWeight:700},className:`mono`,children:e.step}),(0,w.jsxs)(`div`,{style:{flex:1},children:[(0,w.jsx)(`div`,{style:{fontSize:13,fontWeight:600,color:S.ink},children:e.title}),(0,w.jsx)(`div`,{style:{fontSize:12,color:S.ink3,lineHeight:1.65,marginTop:4},children:e.detail.split(/(`[^`]+`)/g).map((e,t)=>e.startsWith("`")?(0,w.jsx)(`span`,{className:`mono`,style:{background:S.surfaceAlt,padding:`1px 5px`,borderRadius:3,fontSize:11.5},children:e.slice(1,-1)},t):e)})]}),(0,w.jsxs)(`button`,{className:`edge-press ${e.risky?`edge-btn-danger`:`edge-btn-secondary`}`,style:{...e.risky?vd:gd,height:28,padding:`0 12px`,fontSize:11.5,alignSelf:`flex-start`},children:[e.action,(0,w.jsx)(D,{name:`chevRight`,size:11,stroke:2})]})]},e.step))]}),(0,w.jsxs)(`div`,{style:{display:`grid`,gridTemplateColumns:`1.5fr 1fr`,gap:12},children:[(0,w.jsxs)(`div`,{style:{background:S.surface,border:`1px solid ${S.border}`,borderRadius:10,padding:18},children:[(0,w.jsx)(`div`,{style:{fontSize:13,fontWeight:700,color:S.ink,marginBottom:12},children:`故障时间线`}),[{t:`10:22:48`,tone:`gray`,title:`收到启动指令`,desc:`docker exec start vllm · 触发模型加载`},{t:`10:23:09`,tone:`amber`,title:`权重加载中`,desc:`safetensors → GPU memory · 已加载 87GB`},{t:`10:23:12`,tone:`red`,title:`CUDA OOM`,desc:`KV cache 预分配失败,显存超 124.6 GB`},{t:`10:23:13`,tone:`amber`,title:`自动重启 #1`,desc:`Supervisor 触发重启,10s 后失败`},{t:`10:23:24`,tone:`amber`,title:`自动重启 #2`,desc:`退避策略升至 20s,仍失败`},{t:`10:23:48`,tone:`amber`,title:`自动重启 #3`,desc:`退避至 40s,仍失败`},{t:`10:24:08`,tone:`red`,title:`进入恢复模式`,desc:`需人工介入;告警已推送`},{t:`现在`,tone:`gray`,title:`等待操作`,desc:`运维:dev-zhang · 当前未验证`}].map((e,t,n)=>(0,w.jsxs)(`div`,{style:{display:`flex`,gap:12,paddingBottom:t===n.length-1?0:12},children:[(0,w.jsxs)(`div`,{style:{width:16,display:`flex`,flexDirection:`column`,alignItems:`center`,flexShrink:0},children:[(0,w.jsx)(q,{tone:e.tone,size:8,pulse:t===n.length-1}),t(0,w.jsx)(`div`,{style:{position:`absolute`,left:e[0],top:e[1],width:e[2],height:e[3],background:e[4],borderRadius:2,opacity:.7}},t))})]})]}),(0,w.jsxs)(`div`,{style:{width:280,background:`#1a1a1a`,flexShrink:0,borderLeft:`1px solid #333`,display:`flex`,flexDirection:`column`},children:[(0,w.jsxs)(`div`,{style:{padding:14,borderBottom:`1px solid #333`},children:[(0,w.jsxs)(`button`,{style:{width:`100%`,height:38,borderRadius:8,background:`linear-gradient(140deg, #7c3aed, #4338ca)`,color:`white`,border:`none`,fontSize:13,fontWeight:700,cursor:`pointer`,display:`flex`,alignItems:`center`,justifyContent:`center`,gap:6},children:[(0,w.jsx)(D,{name:`play`,size:13,stroke:2.2}),`Queue Prompt`]}),(0,w.jsxs)(`div`,{style:{display:`flex`,gap:6,marginTop:8},children:[(0,w.jsx)(`button`,{style:sv,children:`Save`}),(0,w.jsx)(`button`,{style:sv,children:`Load`}),(0,w.jsx)(`button`,{style:sv,children:`Clear`})]})]}),(0,w.jsx)(`div`,{style:{padding:`12px 14px 6px`,fontSize:10.5,fontWeight:700,color:`#999`,letterSpacing:`0.06em`,textTransform:`uppercase`},children:`队列 · 1 运行 / 2 等待`}),(0,w.jsxs)(`div`,{style:{padding:`0 14px`},children:[(0,w.jsx)(lv,{state:`running`,prompt:`edge AI device, neon, 8k`,progress:68}),(0,w.jsx)(lv,{state:`pending`,prompt:`cyberpunk robot dog`}),(0,w.jsx)(lv,{state:`pending`,prompt:`datacenter at night, fog`})]}),(0,w.jsx)(`div`,{style:{padding:`12px 14px 6px`,fontSize:10.5,fontWeight:700,color:`#999`,letterSpacing:`0.06em`,textTransform:`uppercase`},children:`历史`}),(0,w.jsx)(`div`,{style:{flex:1,overflowY:`auto`,padding:`0 14px 14px`,display:`grid`,gridTemplateColumns:`1fr 1fr`,gap:6},children:Array.from({length:12}).map((e,t)=>(0,w.jsx)(`div`,{style:{aspectRatio:`1`,borderRadius:6,background:`linear-gradient(${135+t*17}deg, hsl(${t*31}, 60%, 40%), hsl(${t*31+60}, 60%, 25%))`,position:`relative`,overflow:`hidden`},children:(0,w.jsxs)(`div`,{style:{position:`absolute`,bottom:2,right:4,fontSize:8.5,color:`rgba(255,255,255,0.7)`},className:`mono`,children:[`#`,4280-t]})},t))})]})]})]})}var sv={flex:1,height:26,borderRadius:5,background:`#2a2a2a`,color:`#cccccc`,border:`1px solid #3a3a3a`,fontSize:11,cursor:`pointer`};function cv({x:e,y:t,title:n,color:r,rows:i,outputs:a,highlight:o}){return(0,w.jsxs)(`div`,{style:{position:`absolute`,left:e,top:t,width:212,background:`#2a2a2a`,border:`1px solid ${o?r:`#3a3a3a`}`,borderRadius:6,overflow:`hidden`,userSelect:`none`,boxShadow:o?`0 0 0 1px ${r}66, 0 4px 12px -4px ${r}66`:`0 2px 8px -2px rgba(0,0,0,0.4)`},children:[(0,w.jsxs)(`div`,{style:{padding:`6px 10px`,background:r,color:`white`,fontSize:11,fontWeight:700,display:`flex`,alignItems:`center`,gap:4},children:[(0,w.jsx)(`div`,{style:{width:6,height:6,borderRadius:`50%`,background:`rgba(255,255,255,0.6)`}}),n]}),(0,w.jsx)(`div`,{style:{padding:`6px 10px`},children:i.map(([e,t],n)=>(0,w.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,gap:6,marginBottom:3},children:[(0,w.jsx)(`span`,{style:{fontSize:10,color:`#999`},children:e}),(0,w.jsx)(`div`,{style:{flex:1,padding:`2px 6px`,borderRadius:3,background:`#1a1a1a`,border:`1px solid #333`,fontSize:10.5,color:`#e5e5e5`,fontFamily:`ui-monospace, monospace`,overflow:`hidden`,textOverflow:`ellipsis`,whiteSpace:`nowrap`},children:t})]},n))}),(0,w.jsx)(`div`,{style:{padding:`4px 10px 8px`,display:`flex`,gap:4,flexWrap:`wrap`},children:a.map(e=>(0,w.jsx)(`span`,{style:{fontSize:9,padding:`1px 5px`,borderRadius:2,background:`#1a1a1a`,color:r,border:`1px solid ${r}44`,fontFamily:`ui-monospace, monospace`},children:e},e))})]})}function lv({state:e,prompt:t,progress:n}){return(0,w.jsxs)(`div`,{style:{padding:8,borderRadius:6,background:`#2a2a2a`,border:`1px solid #333`,marginBottom:6},children:[(0,w.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,gap:6,marginBottom:5},children:[(0,w.jsx)(q,{tone:e===`running`?`blue`:`gray`,size:6,pulse:e===`running`}),(0,w.jsx)(`span`,{style:{fontSize:11,color:e===`running`?`#7dd3fc`:`#888`,fontWeight:600},children:e===`running`?`生成中`:`等待中`}),n!=null&&(0,w.jsxs)(`span`,{style:{fontSize:10.5,color:`#888`},className:`mono tnum`,children:[n,`%`]})]}),(0,w.jsx)(`div`,{style:{fontSize:11,color:`#cccccc`,overflow:`hidden`,textOverflow:`ellipsis`,whiteSpace:`nowrap`},children:t}),n!=null&&(0,w.jsx)(`div`,{style:{height:3,background:`#1a1a1a`,borderRadius:2,marginTop:6,overflow:`hidden`},children:(0,w.jsx)(`div`,{style:{width:`${n}%`,height:`100%`,background:`#7c3aed`}})})]})}function uv({onMgmt:e}){let[t,n]=(0,b.useState)(`txt2img`),[r,i]=(0,b.useState)(`a serene mountain lake at dawn, photorealistic, 8k, golden hour lighting`),[a,o]=(0,b.useState)(`low quality, blurry, text, watermark`);return(0,w.jsxs)(`div`,{style:{flex:1,display:`flex`,flexDirection:`column`,background:S.surfaceAlt,overflow:`hidden`},children:[(0,w.jsx)(K_,{title:`Stable Diffusion WebUI`,subtitle:`AUTOMATIC1111`,version:`v1.10.1`,onMgmt:e}),(0,w.jsx)(Zf,{tabs:[`txt2img`,`img2img`,`extras`,`PNG Info`,`LoRA`,`设置`].map(e=>({id:e,label:e})),active:t,onChange:n,activeColor:`#ec4899`,activeTextColor:S.ink,style:{background:S.surface,borderBottom:`1px solid ${S.border}`,padding:`0 16px`,flexShrink:0},itemStyle:{padding:`10px 14px 12px`,fontSize:12.5,marginBottom:-1}}),(0,w.jsxs)(`div`,{style:{padding:`10px 16px`,background:S.surface,borderBottom:`1px solid ${S.borderSoft}`,display:`flex`,alignItems:`center`,gap:10,flexShrink:0},children:[(0,w.jsx)(`span`,{style:{fontSize:11.5,color:S.ink3},children:`Checkpoint`}),(0,w.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,gap:5,padding:`5px 10px`,background:S.surfaceAlt,border:`1px solid ${S.border}`,borderRadius:6,fontSize:12},children:[(0,w.jsx)(`span`,{className:`mono`,style:{color:S.ink,fontWeight:600},children:`sd_xl_base_1.0.safetensors`}),(0,w.jsx)(D,{name:`chevDown`,size:11,stroke:2,style:{color:S.ink4}})]}),(0,w.jsx)(`span`,{style:{fontSize:11.5,color:S.ink3},children:`VAE`}),(0,w.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,gap:5,padding:`5px 10px`,background:S.surfaceAlt,border:`1px solid ${S.border}`,borderRadius:6,fontSize:12},children:[(0,w.jsx)(`span`,{className:`mono`,style:{color:S.ink,fontWeight:600},children:`Automatic`}),(0,w.jsx)(D,{name:`chevDown`,size:11,stroke:2,style:{color:S.ink4}})]}),(0,w.jsx)(`div`,{style:{flex:1}}),(0,w.jsxs)(`span`,{style:{fontSize:11,color:S.ink3,display:`inline-flex`,alignItems:`center`,gap:4},children:[(0,w.jsx)(q,{tone:`green`,size:6}),`已加载 · 显存 6.8 GB`]})]}),(0,w.jsxs)(`div`,{style:{flex:1,display:`grid`,gridTemplateColumns:`1fr 1fr`,overflow:`hidden`},children:[(0,w.jsxs)(`div`,{style:{padding:16,overflowY:`auto`,display:`flex`,flexDirection:`column`,gap:12},children:[(0,w.jsxs)(`div`,{children:[(0,w.jsx)(`div`,{style:{fontSize:11.5,color:S.ink3,fontWeight:600,letterSpacing:`0.04em`,textTransform:`uppercase`,marginBottom:6},children:`提示词`}),(0,w.jsx)(`textarea`,{value:r,onChange:e=>i(e.target.value),style:{width:`100%`,height:80,padding:`10px 12px`,border:`1px solid ${S.border}`,borderRadius:8,fontSize:12.5,lineHeight:1.6,color:S.ink,background:`white`,outline:`none`,resize:`vertical`,fontFamily:`inherit`}}),(0,w.jsx)(`div`,{style:{display:`flex`,gap:4,marginTop:6,flexWrap:`wrap`},children:[`masterpiece`,`8k`,`photorealistic`,`cinematic`].map(e=>(0,w.jsxs)(`span`,{style:{fontSize:10.5,padding:`2px 7px`,borderRadius:999,background:`#fdf2f8`,color:`#9d174d`,border:`1px solid #fbcfe8`},children:[`+ `,e]},e))})]}),(0,w.jsxs)(`div`,{children:[(0,w.jsx)(`div`,{style:{fontSize:11.5,color:S.ink3,fontWeight:600,letterSpacing:`0.04em`,textTransform:`uppercase`,marginBottom:6},children:`负面提示词`}),(0,w.jsx)(`textarea`,{value:a,onChange:e=>o(e.target.value),style:{width:`100%`,height:60,padding:`10px 12px`,border:`1px solid ${S.border}`,borderRadius:8,fontSize:12.5,color:S.ink,background:`white`,outline:`none`,resize:`vertical`,fontFamily:`inherit`}})]}),(0,w.jsx)(`div`,{style:{display:`grid`,gridTemplateColumns:`1fr 1fr`,gap:10},children:[{label:`采样方法`,val:`DPM++ 2M Karras`},{label:`采样步数`,val:`32`},{label:`CFG Scale`,val:`7.5`},{label:`Seed`,val:`8421337`},{label:`宽度`,val:`1024`},{label:`高度`,val:`1024`}].map(e=>(0,w.jsxs)(`div`,{style:{padding:10,borderRadius:7,background:S.surface,border:`1px solid ${S.border}`},children:[(0,w.jsx)(`div`,{style:{fontSize:10.5,color:S.ink3},children:e.label}),(0,w.jsx)(`div`,{className:`mono`,style:{fontSize:13,color:S.ink,fontWeight:600,marginTop:3},children:e.val})]},e.label))}),(0,w.jsxs)(`button`,{style:{height:44,borderRadius:8,background:`linear-gradient(140deg, #ec4899, #9d174d)`,color:`white`,border:`none`,fontSize:14,fontWeight:700,cursor:`pointer`,display:`flex`,alignItems:`center`,justifyContent:`center`,gap:6,boxShadow:`0 4px 12px -3px rgba(236, 72, 153, 0.5)`},children:[(0,w.jsx)(D,{name:`sparkle`,size:15,stroke:2.2}),`Generate · 4 张图`]})]}),(0,w.jsxs)(`div`,{style:{background:S.surface,borderLeft:`1px solid ${S.border}`,padding:16,overflowY:`auto`},children:[(0,w.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,marginBottom:10},children:[(0,w.jsx)(`span`,{style:{fontSize:12,fontWeight:600,color:S.ink},children:`预览`}),(0,w.jsxs)(J,{tone:`green`,style:{marginLeft:8},children:[(0,w.jsx)(q,{tone:`green`,size:6,pulse:!0}),`生成中 · 步骤 24 / 32`]}),(0,w.jsx)(`div`,{style:{flex:1}}),(0,w.jsx)(`span`,{className:`mono`,style:{fontSize:11,color:S.ink3},children:`seed 8421337`})]}),(0,w.jsxs)(`div`,{style:{aspectRatio:`1`,borderRadius:10,background:`linear-gradient(135deg, #fb7185 0%, #ec4899 30%, #8b5cf6 60%, #3b82f6 100%)`,position:`relative`,overflow:`hidden`,marginBottom:10,boxShadow:`0 8px 30px -10px rgba(15,23,42,0.3)`},children:[(0,w.jsx)(`div`,{style:{position:`absolute`,bottom:0,left:0,right:0,height:`40%`,background:`linear-gradient(180deg, rgba(15,23,42,0) 0%, rgba(15,23,42,0.5) 100%)`}}),(0,w.jsx)(`div`,{style:{position:`absolute`,top:`40%`,left:0,right:0,height:`20%`,background:`radial-gradient(ellipse at center, rgba(251,191,36,0.7), transparent 70%)`}}),(0,w.jsx)(`div`,{style:{position:`absolute`,top:8,left:10,padding:`3px 8px`,borderRadius:4,background:`rgba(0,0,0,0.45)`,fontSize:10,color:`rgba(255,255,255,0.85)`,fontFamily:`ui-monospace, monospace`},children:`1024×1024 · 24/32 步`})]}),(0,w.jsx)(`div`,{style:{display:`grid`,gridTemplateColumns:`repeat(4, 1fr)`,gap:6,marginBottom:14},children:[0,1,2,3].map(e=>(0,w.jsx)(`div`,{style:{aspectRatio:`1`,borderRadius:6,cursor:`pointer`,background:`linear-gradient(${130+e*15}deg, hsl(${320-e*8},70%,60%), hsl(${260-e*12},60%,40%))`,border:e===0?`2px solid #ec4899`:`2px solid transparent`}},e))}),(0,w.jsxs)(`div`,{style:{padding:10,borderRadius:7,background:S.surfaceAlt,border:`1px solid ${S.borderSoft}`,display:`flex`,alignItems:`center`,gap:8},children:[(0,w.jsx)(`span`,{style:{fontSize:11,color:S.ink3},children:`输出`}),(0,w.jsx)(`span`,{className:`mono`,style:{fontSize:11,color:S.ink,flex:1,overflow:`hidden`,textOverflow:`ellipsis`,whiteSpace:`nowrap`},children:`/workspace/outputs/2026-05-26/00037-8421337.png`}),(0,w.jsxs)(`button`,{className:`edge-press edge-btn-secondary`,style:{...gd,height:24,padding:`0 8px`,fontSize:11},children:[(0,w.jsx)(D,{name:`folder`,size:11,stroke:1.8}),`打开`]}),(0,w.jsxs)(`button`,{className:`edge-press edge-btn-secondary`,style:{...gd,height:24,padding:`0 8px`,fontSize:11},children:[(0,w.jsx)(D,{name:`download`,size:11,stroke:1.8}),`下载`]})]})]})]})]})}function dv({onMgmt:e}){let[t,n]=(0,b.useState)(`llama-3.1-8b-instruct`);return(0,w.jsxs)(`div`,{style:{flex:1,display:`flex`,flexDirection:`column`,overflow:`hidden`,background:`#fafbfc`},children:[(0,w.jsx)(K_,{title:`Open WebUI`,subtitle:`多模型聊天前端`,version:`v0.4.7`,onMgmt:e}),(0,w.jsxs)(`div`,{style:{flex:1,display:`flex`,overflow:`hidden`},children:[(0,w.jsxs)(`div`,{style:{width:200,flexShrink:0,borderRight:`1px solid ${S.borderSoft}`,background:S.surface,padding:12,display:`flex`,flexDirection:`column`},children:[(0,w.jsxs)(`button`,{style:{height:34,borderRadius:8,marginBottom:10,background:`#0f172a`,color:`white`,border:`none`,fontSize:12.5,fontWeight:600,cursor:`pointer`,display:`flex`,alignItems:`center`,justifyContent:`center`,gap:5},children:[(0,w.jsx)(D,{name:`plus`,size:13,stroke:2.2}),`新建聊天`]}),(0,w.jsx)(`div`,{style:{fontSize:10.5,color:S.ink3,fontWeight:600,letterSpacing:`0.06em`,textTransform:`uppercase`,padding:`6px 8px`},children:`今天`}),[`LoRA 训练 vs 全参微调`,`vLLM 显存调优`].map(e=>(0,w.jsx)(`div`,{style:{padding:`7px 10px`,borderRadius:6,fontSize:12,color:S.ink2,cursor:`pointer`,marginBottom:2},children:e},e)),(0,w.jsx)(`div`,{style:{fontSize:10.5,color:S.ink3,fontWeight:600,letterSpacing:`0.06em`,textTransform:`uppercase`,padding:`10px 8px 6px`},children:`昨天`}),[`SDXL ControlNet 用法`,`RAG 数据清洗 pipeline`].map(e=>(0,w.jsx)(`div`,{style:{padding:`7px 10px`,borderRadius:6,fontSize:12,color:S.ink2,cursor:`pointer`,marginBottom:2},children:e},e)),(0,w.jsx)(`div`,{style:{flex:1}}),(0,w.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,gap:8,padding:8,borderRadius:7,background:S.surfaceAlt},children:[(0,w.jsx)(`div`,{style:{width:28,height:28,borderRadius:`50%`,background:S.blueSoft,color:S.blueDeep,display:`flex`,alignItems:`center`,justifyContent:`center`,fontSize:11,fontWeight:700},children:`张`}),(0,w.jsxs)(`div`,{style:{minWidth:0},children:[(0,w.jsx)(`div`,{style:{fontSize:12,color:S.ink,fontWeight:600},children:`dev-zhang`}),(0,w.jsx)(`div`,{style:{fontSize:10.5,color:S.ink3},children:`模型研发组`})]})]})]}),(0,w.jsxs)(`div`,{style:{flex:1,display:`flex`,flexDirection:`column`},children:[(0,w.jsx)(`div`,{style:{display:`flex`,alignItems:`center`,justifyContent:`center`,padding:`12px 18px`,borderBottom:`1px solid ${S.borderSoft}`},children:(0,w.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,gap:6,padding:`5px 12px`,borderRadius:999,background:`white`,border:`1px solid ${S.border}`,boxShadow:`0 1px 2px rgba(15,23,42,0.04)`,cursor:`pointer`},children:[(0,w.jsx)(D,{name:`sparkle`,size:13,stroke:1.8,style:{color:S.cyan}}),(0,w.jsx)(`span`,{style:{fontSize:12.5,color:S.ink,fontWeight:600},className:`mono`,children:t}),(0,w.jsx)(D,{name:`chevDown`,size:11,stroke:2,style:{color:S.ink4}})]})}),(0,w.jsxs)(`div`,{style:{flex:1,display:`flex`,flexDirection:`column`,alignItems:`center`,justifyContent:`center`,padding:32},children:[(0,w.jsx)(`div`,{style:{width:56,height:56,borderRadius:16,background:`linear-gradient(140deg, #22d3ee, #0891b2)`,color:`white`,display:`flex`,alignItems:`center`,justifyContent:`center`,marginBottom:16,boxShadow:`0 8px 22px -6px rgba(34,211,238,0.5), inset 0 1px 0 rgba(255,255,255,0.3)`},children:(0,w.jsx)(D,{name:`openwebui`,size:28,stroke:1.6})}),(0,w.jsx)(`div`,{style:{fontSize:18,fontWeight:700,color:S.ink,letterSpacing:`-0.01em`},children:`你好,dev-zhang`}),(0,w.jsx)(`div`,{style:{fontSize:12.5,color:S.ink3,marginTop:6},children:`选一个开始,或直接在下方输入你的问题`}),(0,w.jsx)(`div`,{style:{display:`grid`,gridTemplateColumns:`repeat(2, 1fr)`,gap:10,marginTop:24,maxWidth:560},children:[{icon:`sparkle`,label:`总结这周的训练日志`,desc:`从 TensorBoard 抽取 loss / 评估指标`},{icon:`wrench`,label:`排查 vLLM OOM`,desc:`基于当前 GPU 占用给出建议`},{icon:`code`,label:`写一个 LoRA 微调脚本`,desc:`Llama-3.1-8B + alpaca 数据集`},{icon:`book`,label:`解释 PagedAttention`,desc:`通俗讲讲 vLLM 的核心机制`}].map((e,t)=>(0,w.jsxs)(`div`,{style:{padding:14,borderRadius:10,background:S.surface,border:`1px solid ${S.border}`,cursor:`pointer`,display:`flex`,gap:10,alignItems:`flex-start`},children:[(0,w.jsx)(`div`,{style:{width:30,height:30,borderRadius:8,flexShrink:0,background:S.surfaceAlt,color:S.blueDeep,display:`flex`,alignItems:`center`,justifyContent:`center`},children:(0,w.jsx)(D,{name:e.icon,size:15,stroke:1.8})}),(0,w.jsxs)(`div`,{children:[(0,w.jsx)(`div`,{style:{fontSize:12.5,color:S.ink,fontWeight:600},children:e.label}),(0,w.jsx)(`div`,{style:{fontSize:11,color:S.ink3,marginTop:3},children:e.desc})]})]},t))})]}),(0,w.jsx)(`div`,{style:{padding:18},children:(0,w.jsxs)(`div`,{style:{maxWidth:720,margin:`0 auto`,border:`1.5px solid ${S.border}`,borderRadius:14,background:`white`,boxShadow:`0 4px 14px -4px rgba(15,23,42,0.08)`,padding:`4px 4px 4px 14px`,display:`flex`,alignItems:`center`,gap:8},children:[(0,w.jsx)(`input`,{placeholder:`给 Open WebUI 发送消息…`,style:{flex:1,height:40,border:`none`,outline:`none`,fontSize:13,color:S.ink,background:`transparent`}}),(0,w.jsx)(`button`,{style:fv,children:(0,w.jsx)(D,{name:`attach`,size:15,stroke:1.8})}),(0,w.jsx)(`button`,{style:fv,children:(0,w.jsx)(D,{name:`mic`,size:15,stroke:1.8})}),(0,w.jsx)(`button`,{style:{...fv,background:S.cyan,color:`white`},children:(0,w.jsx)(D,{name:`send`,size:14,stroke:2.2})})]})})]})]})]})}var fv={width:32,height:32,borderRadius:8,border:`none`,background:`transparent`,color:S.ink3,cursor:`pointer`,display:`flex`,alignItems:`center`,justifyContent:`center`};function pv({onMgmt:e}){let t=Array.from({length:60}).map((e,t)=>2.4-.022*t+Math.sin(t*.7)*.08+Math.cos(t*.3)*.04),n=Array.from({length:60}).map((e,t)=>78+Math.sin(t*.4)*8+Math.cos(t*.7)*5);return(0,w.jsxs)(`div`,{style:{flex:1,display:`flex`,flexDirection:`column`,overflow:`hidden`,background:S.surfaceAlt},children:[(0,w.jsx)(K_,{title:`train-72h · Llama-3.1-8B LoRA 微调`,subtitle:`Unsloth + Axolotl · 数据集 alpaca-cleaned`,version:`Step 14,300 / 30,000`,onMgmt:e}),(0,w.jsx)(`div`,{style:{flex:1,overflowY:`auto`,padding:24},children:(0,w.jsxs)(`div`,{style:{maxWidth:1100,margin:`0 auto`},children:[(0,w.jsx)(`div`,{style:{display:`grid`,gridTemplateColumns:`repeat(4, 1fr)`,gap:12,marginBottom:14},children:[{label:`进度`,val:`47.7`,unit:`%`,tone:S.blue,hint:`14,300 / 30,000 step`},{label:`Loss`,val:`1.82`,unit:``,tone:S.green,hint:`↓ -0.06 (近 1h)`},{label:`吞吐量`,val:`8.4`,unit:`tok/s/GPU`,tone:S.indigo,hint:`每 step 平均 1.6s`},{label:`预计剩余`,val:`37`,unit:`小时`,tone:S.amber,hint:`完成于 2026-05-28 03:14`}].map((e,t)=>(0,w.jsxs)(`div`,{style:{background:S.surface,border:`1px solid ${S.border}`,borderRadius:10,padding:16},children:[(0,w.jsx)(`div`,{style:{fontSize:10.5,color:S.ink3,fontWeight:600,letterSpacing:`0.04em`,textTransform:`uppercase`},children:e.label}),(0,w.jsxs)(`div`,{style:{display:`flex`,alignItems:`baseline`,gap:4,marginTop:6},children:[(0,w.jsx)(`span`,{className:`mono tnum`,style:{fontSize:24,fontWeight:700,color:e.tone,letterSpacing:`-0.02em`},children:e.val}),(0,w.jsx)(`span`,{style:{fontSize:12,color:S.ink3},children:e.unit})]}),(0,w.jsx)(`div`,{style:{fontSize:11,color:S.ink3,marginTop:4},children:e.hint})]},t))}),(0,w.jsxs)(`div`,{style:{display:`grid`,gridTemplateColumns:`1fr 1fr`,gap:12,marginBottom:14},children:[(0,w.jsxs)(Yu,{title:`Training Loss`,action:(0,w.jsx)(`span`,{style:{fontSize:11.5,color:S.ink3},children:`最近 60 步`}),children:[(0,w.jsx)(Ju,{data:t,color:S.green,width:460,height:140,fill:!0,showAxis:!0,max:2.5}),(0,w.jsxs)(`div`,{style:{display:`flex`,gap:16,fontSize:11.5,marginTop:8,color:S.ink3},children:[(0,w.jsxs)(`span`,{children:[`当前 `,(0,w.jsx)(`span`,{className:`mono tnum`,style:{color:S.ink,fontWeight:600},children:t[t.length-1].toFixed(3)})]}),(0,w.jsxs)(`span`,{children:[`开始时 `,(0,w.jsx)(`span`,{className:`mono tnum`,style:{color:S.ink2},children:`2.412`})]}),(0,w.jsx)(`span`,{style:{marginLeft:`auto`,color:S.green,fontWeight:600},children:`下降 24.5%`})]})]}),(0,w.jsxs)(Yu,{title:`GPU 利用率`,action:(0,w.jsx)(`span`,{style:{fontSize:11.5,color:S.ink3},children:`平均 78%`}),children:[(0,w.jsx)(Ju,{data:n,color:S.indigo,width:460,height:140,fill:!0,showAxis:!0,max:100}),(0,w.jsxs)(`div`,{style:{display:`flex`,gap:16,fontSize:11.5,marginTop:8,color:S.ink3},children:[(0,w.jsxs)(`span`,{children:[`当前 `,(0,w.jsxs)(`span`,{className:`mono tnum`,style:{color:S.ink,fontWeight:600},children:[n[n.length-1].toFixed(0),`%`]})]}),(0,w.jsxs)(`span`,{children:[`峰值 `,(0,w.jsxs)(`span`,{className:`mono tnum`,style:{color:S.ink2},children:[Math.max(...n).toFixed(0),`%`]})]}),(0,w.jsxs)(`span`,{style:{marginLeft:`auto`},children:[`显存 `,(0,w.jsx)(`span`,{className:`mono tnum`,style:{color:S.ink,fontWeight:600},children:`38.2 / 128 GB`})]})]})]})]}),(0,w.jsxs)(`div`,{style:{display:`grid`,gridTemplateColumns:`1fr 1fr`,gap:12},children:[(0,w.jsx)(Yu,{title:`配置`,padding:0,children:(0,w.jsx)(`table`,{style:{width:`100%`,borderCollapse:`collapse`,fontSize:12.5},children:(0,w.jsx)(`tbody`,{children:[[`基础模型`,`meta-llama/Llama-3.1-8B`],[`数据集`,`yahma/alpaca-cleaned (51,760 条)`],[`方法`,`LoRA · r=64, alpha=128`],[`优化器`,`AdamW (β=0.9, 0.95)`],[`学习率`,`1e-4 · cosine + warmup 100`],[`Batch`,`8 (per device) × 4 (grad accum) = 32`],[`序列长度`,`2048`],[`精度`,`bf16`]].map(([e,t],n)=>(0,w.jsxs)(`tr`,{style:{borderTop:n?`1px solid ${S.borderSoft}`:`none`},children:[(0,w.jsx)(`td`,{style:{width:90,padding:`10px 16px`,color:S.ink3,fontSize:12},children:e}),(0,w.jsx)(`td`,{style:{padding:`10px 16px`,color:S.ink},className:`mono`,children:t})]},e))})})}),(0,w.jsx)(Yu,{title:`最近 checkpoint`,padding:0,children:(0,w.jsx)(`div`,{style:{padding:`4px 0`},children:[[`step-14000`,`52 分钟前`,`16 GB`,`loss 1.834`],[`step-13500`,`1 小时前`,`16 GB`,`loss 1.871`],[`step-13000`,`2 小时前`,`16 GB`,`loss 1.892`],[`step-12500`,`3 小时前`,`16 GB`,`loss 1.928`],[`step-12000`,`4 小时前`,`16 GB`,`loss 1.953`]].map(([e,t,n,r],i)=>(0,w.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,gap:10,padding:`10px 16px`,borderTop:i?`1px solid ${S.borderSoft}`:`none`},children:[(0,w.jsx)(D,{name:`brain`,size:14,stroke:1.8,style:{color:S.violet}}),(0,w.jsx)(`span`,{className:`mono`,style:{fontSize:12.5,color:S.ink,fontWeight:600},children:e}),(0,w.jsx)(`span`,{className:`mono`,style:{fontSize:11,color:S.ink3},children:r}),(0,w.jsx)(`div`,{style:{flex:1}}),(0,w.jsx)(`span`,{style:{fontSize:11,color:S.ink3},children:t}),(0,w.jsx)(`span`,{className:`mono`,style:{fontSize:11,color:S.ink3},children:n})]},e))})})]})]})})]})}var mv={padding:14},hv={background:S.surfaceAlt,border:`1px solid ${S.borderSoft}`,borderRadius:8,padding:12};function gv({app:e}){let t=e.observed?.phase||`unknown`,n=e.observed?.conditions||[],r=e.observed?.endpoints||[];return(0,w.jsxs)(`div`,{style:mv,children:[(0,w.jsxs)(`div`,{style:{display:`grid`,gridTemplateColumns:`repeat(auto-fit,minmax(150px,1fr))`,gap:8},children:[(0,w.jsx)(wv,{label:`状态`,value:dp[t]||t,tone:fp[t]}),(0,w.jsx)(wv,{label:`运行时`,value:`Docker Compose`}),(0,w.jsx)(wv,{label:`配置 revision`,value:`r${e.revision||0}`}),(0,w.jsx)(wv,{label:`服务数`,value:(e.observed?.services||[]).length})]}),e.observed?.message&&(0,w.jsx)(Dv,{tone:`amber`,children:e.observed.message}),(0,w.jsx)(Tv,{title:`入口`,children:r.length?r.map((e,t)=>(0,w.jsxs)(`a`,{href:e.url,target:`_blank`,rel:`noreferrer`,style:{display:`block`,color:S.blueDeep,marginBottom:5},children:[e.name||e.url,` · `,e.url]},t)):(0,w.jsx)(Ev,{text:`该应用没有公开入口`})}),(0,w.jsx)(Tv,{title:`运行条件`,children:n.length?n.map((e,t)=>(0,w.jsxs)(`div`,{style:{...hv,marginBottom:6},children:[(0,w.jsx)(`strong`,{children:e.type||`Condition`}),(0,w.jsx)(`span`,{style:{marginLeft:8,color:S.ink3},children:e.status}),e.message&&(0,w.jsx)(`div`,{style:{marginTop:4,color:S.ink3},children:e.message})]},t)):(0,w.jsx)(Ev,{text:`暂无异常条件`})})]})}function _v({app:e}){let t=e.observed?.services||[];return(0,w.jsx)(`div`,{style:mv,children:t.length?t.map(e=>(0,w.jsxs)(`div`,{style:{...hv,marginBottom:8},children:[(0,w.jsxs)(`div`,{style:{display:`flex`,gap:8,alignItems:`center`,flexWrap:`wrap`},children:[(0,w.jsx)(q,{tone:e.health===`unhealthy`?`red`:e.state===`running`?`green`:`gray`,size:7}),(0,w.jsx)(`strong`,{children:e.name}),(0,w.jsx)(J,{tone:e.health===`healthy`?`green`:e.health===`unhealthy`?`red`:`gray`,children:e.health||`无健康检查`}),(0,w.jsx)(`span`,{style:{marginLeft:`auto`,color:S.ink3},children:e.state||`unknown`})]}),(0,w.jsx)(`div`,{className:`mono`,style:{marginTop:7,color:S.ink3,wordBreak:`break-all`},children:e.image||`—`}),!!e.ports?.length&&(0,w.jsx)(`div`,{style:{marginTop:7},children:e.ports.map((e,t)=>(0,w.jsx)(J,{tone:`blue`,children:Ov(e)},t))}),e.containerId&&(0,w.jsxs)(`div`,{className:`mono`,style:{marginTop:7,fontSize:11,color:S.ink4},children:[`container `,e.containerId.slice(0,12)]})]},e.name)):(0,w.jsx)(Ev,{text:`尚未观察到 service/container;部署任务可能仍在执行`})})}function vv({app:e}){let t=e.observed?.services||[],[n,r]=(0,b.useState)(()=>t[0]?.name||``),{lines:i,loading:a}=Ud(e.id,3e3,300,n),o=(0,b.useRef)(null);return(0,b.useEffect)(()=>{o.current&&(o.current.scrollTop=o.current.scrollHeight)},[i]),(0,w.jsxs)(`div`,{style:mv,children:[(0,w.jsxs)(`div`,{style:{display:`flex`,gap:8,marginBottom:8,alignItems:`center`},children:[(0,w.jsxs)(J,{tone:`green`,children:[(0,w.jsx)(q,{tone:`green`,size:6,pulse:!0}),`Service 日志`]}),t.length>0&&(0,w.jsxs)(`select`,{"aria-label":`选择 service`,value:n,onChange:e=>r(e.target.value),style:{height:30,borderRadius:7,border:`1px solid ${S.border}`,padding:`0 8px`,background:S.surface},children:[(0,w.jsx)(`option`,{value:``,children:`第一个 service`}),t.map(e=>(0,w.jsx)(`option`,{value:e.name,children:e.name},e.name))]}),(0,w.jsx)(`span`,{style:{color:S.ink4,fontSize:11},children:`3 秒刷新 · 最近 300 行`})]}),(0,w.jsxs)(`div`,{ref:o,style:{background:`#0b1020`,color:`#e2e8f0`,borderRadius:8,padding:12,minHeight:320,maxHeight:`calc(100vh - 290px)`,overflow:`auto`,font:`11px/1.6 ui-monospace,monospace`},children:[!i.length&&(0,w.jsx)(`div`,{style:{color:`#64748b`},children:a?`加载日志中…`:`暂无日志`}),i.map((e,t)=>(0,w.jsx)(`div`,{style:{whiteSpace:`pre-wrap`,wordBreak:`break-all`},children:e},t))]})]})}function yv({app:e}){let{data:t,loading:n,error:r,refresh:i}=Tf(e.id),[a,o]=(0,b.useState)(null),[s,c]=(0,b.useState)(null),[l,u]=(0,b.useState)(!1),[d,f]=(0,b.useState)(!1),[p,m]=(0,b.useState)(!1),[h,g]=(0,b.useState)(null),[_,v]=(0,b.useState)(``),{task:y}=hf(h),x=Sp(),C=a??t?.compose??``,T=ap(s?.risks),E=s?.ok&&T.blocked.length===0&&(!T.confirmation.length||l)&&!d;async function D(){c(null),u(!1),m(!1);try{c(await yf({name:e.name,compose:C,appId:e.id,retainEnvironment:!0,secrets:ep(_)}))}catch(e){x.err(`预检失败:${e.message}`)}}async function O(){f(!0),m(!1);try{g((await Of({id:e.id,name:e.name,compose:C,expectedRevision:t.revision,source:e.source,confirmRisky:l,retainEnvironment:!0,secrets:ep(_)})).id),x.ok(`配置更新任务已提交`)}catch(e){e.status===409||e.reason===`revision_mismatch`?m(!0):x.err(`保存失败:${e.message}`)}finally{f(!1)}}return(0,w.jsxs)(`div`,{style:mv,children:[(0,w.jsx)(Dv,{children:"保存前必须通过后端 `docker compose config` 与风险预检;使用 expectedRevision,绝不静默覆盖并发修改。"}),n&&(0,w.jsx)(Ev,{text:`加载 Compose 事实源…`}),r&&(0,w.jsxs)(Dv,{tone:`red`,children:[`无法读取 Compose:`,String(r.message||r)]}),(0,w.jsx)(`textarea`,{"aria-label":`Compose YAML`,spellCheck:!1,value:C,onChange:e=>{o(e.target.value),c(null)},style:{width:`100%`,minHeight:360,resize:`vertical`,boxSizing:`border-box`,border:`1px solid ${S.border}`,borderRadius:8,padding:12,background:`#0b1020`,color:`#e2e8f0`,font:`12px/1.55 ui-monospace,monospace`}}),(0,w.jsx)(`label`,{style:{display:`block`,marginTop:10,marginBottom:5,fontWeight:700},children:`轮换 Secret(可选)`}),(0,w.jsx)(`textarea`,{"aria-label":`轮换 Secret`,value:_,onChange:e=>{v(e.target.value),c(null)},rows:3,spellCheck:!1,placeholder:`DB_PASSWORD=new-value`,style:{width:`100%`,resize:`vertical`,boxSizing:`border-box`,border:`1px solid ${S.border}`,borderRadius:8,padding:10,font:`12px/1.5 ui-monospace,monospace`}}),(0,w.jsx)(`div`,{style:{color:S.ink4,fontSize:11,marginTop:4},children:`只提交要新增或轮换的键;未填写的现有 Secret 由后端保留,原值不会回传浏览器。`}),(0,w.jsxs)(`div`,{style:{display:`flex`,gap:8,alignItems:`center`,marginTop:10,flexWrap:`wrap`},children:[(0,w.jsx)(`button`,{onClick:D,style:gd,children:`预检`}),(0,w.jsx)(`button`,{onClick:O,disabled:!E,style:{..._d,opacity:E?1:.55},children:`保存并重新部署`}),(0,w.jsxs)(`span`,{style:{color:S.ink4},children:[`当前 r`,t?.revision||e.revision||0]})]}),s&&(0,w.jsx)(kv,{risks:T,confirm:l,setConfirm:u}),p&&(0,w.jsxs)(Dv,{tone:`red`,children:[`配置已被其他操作更新。请重新加载最新 revision 后再修改。 `,(0,w.jsx)(`button`,{onClick:()=>{o(null),c(null),m(!1),i()},style:Av,children:`重新加载`})]}),y&&(0,w.jsxs)(Dv,{tone:y.status===`failed`?`red`:`blue`,children:[`任务 `,y.status,` · `,y.phase||`queued`,y.message?` · ${y.message}`:``]})]})}function bv({app:e}){let{data:t,loading:n,error:r}=Ef(e.id),i=t?.vars||[];return(0,w.jsxs)(`div`,{style:mv,children:[(0,w.jsx)(Dv,{children:`环境变量接口只返回 key、类型和 configured 状态。Secret 原值不会回显;要轮换 Secret,请编辑 Compose 引用并在重新部署时提交新值。`}),n&&(0,w.jsx)(Ev,{text:`加载环境变量元信息…`}),r&&(0,w.jsx)(Dv,{tone:`red`,children:`无法读取环境变量元信息`}),i.length?i.map(e=>{let t=cp(e);return(0,w.jsxs)(`div`,{style:{...hv,display:`flex`,gap:8,alignItems:`center`,marginBottom:6},children:[(0,w.jsx)(`code`,{children:e.key}),(0,w.jsx)(J,{tone:t.secret?`amber`:`gray`,children:t.typeLabel}),e.required&&(0,w.jsx)(J,{tone:`red`,children:`必填`}),(0,w.jsx)(`span`,{style:{marginLeft:`auto`,color:e.configured?`#166534`:S.ink4},children:e.configured?`已配置`:`未配置`})]},e.key)}):!n&&(0,w.jsx)(Ev,{text:`Compose 未声明可展示的环境变量`})]})}function xv({app:e}){let{data:t,loading:n,error:r}=Df(e.id),i=t?.volumes||[];return(0,w.jsxs)(`div`,{style:mv,children:[(0,w.jsx)(Dv,{children:`只有 managed 卷在 purge 时可删除;external、bind 与 socket 生命周期不属于应用,devbox 永不自动删除。`}),n&&(0,w.jsx)(Ev,{text:`分析存储资源…`}),r&&(0,w.jsx)(Dv,{tone:`red`,children:`无法读取存储清单`}),i.length?i.map((e,t)=>{let n=sp(e);return(0,w.jsxs)(`div`,{style:{...hv,marginBottom:7},children:[(0,w.jsxs)(`div`,{style:{display:`flex`,gap:8,alignItems:`center`},children:[(0,w.jsx)(J,{tone:n.tone,children:n.label}),(0,w.jsx)(`code`,{style:{wordBreak:`break-all`},children:e.source||`anonymous`}),(0,w.jsx)(`span`,{style:{marginLeft:`auto`,color:e.deletable?`#b91c1c`:S.ink4},children:e.deletable?`purge 可删`:`永不自动删除`})]}),(0,w.jsxs)(`div`,{style:{marginTop:6,color:S.ink3},children:[`挂载到 `,(0,w.jsx)(`code`,{children:e.target||`—`}),` · `,n.hint]})]},`${e.source}-${e.target}-${t}`)}):!n&&(0,w.jsx)(Ev,{text:`没有声明卷或宿主挂载`}),t?.managedDataDir&&(0,w.jsxs)(`div`,{style:{...hv,marginTop:8},children:[(0,w.jsx)(`strong`,{children:`受管数据目录`}),(0,w.jsx)(`div`,{className:`mono`,style:{marginTop:5,wordBreak:`break-all`,color:S.ink3},children:t.managedDataDir})]})]})}function Sv({app:e}){let{data:t,loading:n,error:r,refresh:i}=_f(e.id),a=Array.isArray(t)?t:t?.revisions||[],[o,s]=(0,b.useState)(null),[c,l]=(0,b.useState)(null),{task:u}=hf(c),d=Sp();async function f(t){if(window.confirm(`恢复 revision ${t.number}?\n\n回退配置不会自动恢复应用数据;数据库 schema 也不保证可逆。`)){s(t.number);try{l((await Cf(e.id,t.number)).id),d.ok(`已提交 revision ${t.number} 配置回退任务`),i()}catch(e){d.err(`回退失败:${e.message}`)}finally{s(null)}}}return(0,w.jsxs)(`div`,{style:mv,children:[(0,w.jsxs)(Dv,{tone:`amber`,children:[(0,w.jsx)(`strong`,{children:`定义回退,不是数据恢复。`}),` 回退配置不会自动恢复应用数据,数据库 schema 可能不可逆。`]}),u&&(0,w.jsxs)(Dv,{tone:u.status===`failed`?`red`:`blue`,children:[`回退任务 `,u.status,` · `,u.phase||`queued`,u.message?` · ${u.message}`:``]}),n&&(0,w.jsx)(Ev,{text:`加载 revision…`}),r&&(0,w.jsx)(Dv,{tone:`red`,children:`无法读取 revision`}),a.map(t=>(0,w.jsxs)(`div`,{style:{...hv,marginBottom:7,display:`flex`,alignItems:`center`,gap:10},children:[(0,w.jsxs)(`strong`,{children:[`r`,t.number]}),(0,w.jsx)(`span`,{style:{color:S.ink3},children:up(t.createdAt)}),(0,w.jsx)(J,{tone:`gray`,children:t.source?.kind||`inline`}),(0,w.jsx)(`span`,{className:`mono`,style:{color:S.ink4},children:t.composeHash?.slice(0,10)}),(0,w.jsx)(`button`,{onClick:()=>f(t),disabled:o!=null||t.number===e.revision,style:{...gd,marginLeft:`auto`,opacity:t.number===e.revision?.55:1},children:t.number===e.revision?`当前`:o===t.number?`提交中…`:`回退配置`})]},t.number)),!n&&!a.length&&(0,w.jsx)(Ev,{text:`暂无 revision 记录`})]})}function Cv({app:e}){let{data:t,loading:n,error:r}=gf(e.id,4e3),i=Array.isArray(t)?t:t?.operations||[];return(0,w.jsxs)(`div`,{style:mv,children:[n&&(0,w.jsx)(Ev,{text:`加载操作记录…`}),r&&(0,w.jsx)(Dv,{tone:`red`,children:`无法读取操作记录`}),i.map(e=>(0,w.jsxs)(`div`,{style:{...hv,marginBottom:7},children:[(0,w.jsxs)(`div`,{style:{display:`flex`,gap:8,alignItems:`center`},children:[(0,w.jsx)(q,{tone:e.status===`succeeded`?`green`:e.status===`failed`?`red`:`blue`,size:7}),(0,w.jsxs)(`strong`,{children:[e.type,e.action?` · ${e.action}`:``]}),(0,w.jsx)(J,{tone:e.status===`failed`?`red`:e.status===`succeeded`?`green`:`blue`,children:e.status}),(0,w.jsx)(`span`,{style:{marginLeft:`auto`,color:S.ink4},children:up(e.createdAt)})]}),(0,w.jsxs)(`div`,{style:{marginTop:5,color:S.ink3},children:[e.phase||`queued`,e.message?` · ${e.message}`:``,e.revision?` · r${e.revision}`:``]})]},e.id)),!n&&!i.length&&(0,w.jsx)(Ev,{text:`暂无操作记录`})]})}function wv({label:e,value:t,tone:n=`gray`}){return(0,w.jsxs)(`div`,{style:hv,children:[(0,w.jsx)(`div`,{style:{color:S.ink4,fontSize:11},children:e}),(0,w.jsx)(`div`,{style:{marginTop:5,fontWeight:700,color:n===`red`?`#b91c1c`:n===`green`?`#166534`:S.ink},children:t})]})}function Tv({title:e,children:t}){return(0,w.jsxs)(`div`,{style:{marginTop:14},children:[(0,w.jsx)(`div`,{style:{fontSize:12,fontWeight:700,marginBottom:7},children:e}),t]})}function Ev({text:e}){return(0,w.jsx)(`div`,{style:{...hv,color:S.ink4,textAlign:`center`,padding:20},children:e})}function Dv({tone:e=`blue`,children:t}){let n=e===`red`?[`#fef2f2`,`#fecaca`,`#b91c1c`]:e===`amber`?[`#fffbeb`,`#fde68a`,`#92400e`]:[`#eff6ff`,`#bfdbfe`,`#1e40af`];return(0,w.jsx)(`div`,{style:{marginBottom:10,padding:10,borderRadius:8,background:n[0],border:`1px solid ${n[1]}`,color:n[2],lineHeight:1.55},children:t})}function Ov(e){return typeof e==`string`?e:`${e.hostPort||e.containerPort||``}${e.hostPort?`→${e.containerPort||``}`:``}/${e.protocol||`tcp`}`}function kv({risks:e,confirm:t,setConfirm:n}){return(0,w.jsxs)(`div`,{style:{marginTop:10},children:[(0,b.useMemo)(()=>[[`blocked`,`阻断`,e.blocked,`#b91c1c`],[`confirmation`,`需确认`,e.confirmation,`#92400e`],[`warning`,`警告`,e.warning,`#92400e`]],[e]).map(([e,t,n,r])=>n.length?(0,w.jsxs)(`div`,{style:{...hv,marginBottom:6,color:r},children:[(0,w.jsx)(`strong`,{children:t}),n.map((e,t)=>(0,w.jsxs)(`div`,{style:{marginTop:4},children:[e.service?`${e.service}: `:``,e.message]},t))]},e):null),e.confirmation.length>0&&e.blocked.length===0&&(0,w.jsxs)(`label`,{style:{display:`flex`,gap:8,alignItems:`flex-start`,...hv},children:[(0,w.jsx)(`input`,{type:`checkbox`,checked:t,onChange:e=>n(e.target.checked)}),(0,w.jsx)(`span`,{children:`我已了解 confirmation 级风险并显式确认。blocked 风险不可绕过。`})]}),!e.blocked.length&&!e.confirmation.length&&!e.warning.length&&(0,w.jsx)(Dv,{children:`预检通过,没有风险项。`})]})}var Av={border:0,background:`transparent`,color:`inherit`,textDecoration:`underline`,cursor:`pointer`,fontWeight:700},jv=s(((e,t)=>{(function(n,r){if(typeof e==`object`&&typeof t==`object`)t.exports=r();else if(typeof define==`function`&&define.amd)define([],r);else{var i=r();for(var a in i)(typeof e==`object`?e:n)[a]=i[a]}})(globalThis,(()=>(()=>{var e={4567:function(e,t,n){var r=this&&this.__decorate||function(e,t,n,r){var i,a=arguments.length,o=a<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,n):r;if(typeof Reflect==`object`&&typeof Reflect.decorate==`function`)o=Reflect.decorate(e,t,n,r);else for(var s=e.length-1;s>=0;s--)(i=e[s])&&(o=(a<3?i(o):a>3?i(t,n,o):i(t,n))||o);return a>3&&o&&Object.defineProperty(t,n,o),o},i=this&&this.__param||function(e,t){return function(n,r){t(n,r,e)}};Object.defineProperty(t,"__esModule",{value:!0}),t.AccessibilityManager=void 0;let a=n(9042),o=n(9924),s=n(844),c=n(4725),l=n(2585),u=n(3656),d=t.AccessibilityManager=class extends s.Disposable{constructor(e,t,n,r){super(),this._terminal=e,this._coreBrowserService=n,this._renderService=r,this._rowColumns=new WeakMap,this._liveRegionLineCount=0,this._charsToConsume=[],this._charsToAnnounce=``,this._accessibilityContainer=this._coreBrowserService.mainDocument.createElement(`div`),this._accessibilityContainer.classList.add(`xterm-accessibility`),this._rowContainer=this._coreBrowserService.mainDocument.createElement(`div`),this._rowContainer.setAttribute(`role`,`list`),this._rowContainer.classList.add(`xterm-accessibility-tree`),this._rowElements=[];for(let e=0;ethis._handleBoundaryFocus(e,0),this._bottomBoundaryFocusListener=e=>this._handleBoundaryFocus(e,1),this._rowElements[0].addEventListener(`focus`,this._topBoundaryFocusListener),this._rowElements[this._rowElements.length-1].addEventListener(`focus`,this._bottomBoundaryFocusListener),this._refreshRowsDimensions(),this._accessibilityContainer.appendChild(this._rowContainer),this._liveRegion=this._coreBrowserService.mainDocument.createElement(`div`),this._liveRegion.classList.add(`live-region`),this._liveRegion.setAttribute(`aria-live`,`assertive`),this._accessibilityContainer.appendChild(this._liveRegion),this._liveRegionDebouncer=this.register(new o.TimeBasedDebouncer(this._renderRows.bind(this))),!this._terminal.element)throw Error(`Cannot enable accessibility before Terminal.open`);this._terminal.element.insertAdjacentElement(`afterbegin`,this._accessibilityContainer),this.register(this._terminal.onResize((e=>this._handleResize(e.rows)))),this.register(this._terminal.onRender((e=>this._refreshRows(e.start,e.end)))),this.register(this._terminal.onScroll((()=>this._refreshRows()))),this.register(this._terminal.onA11yChar((e=>this._handleChar(e)))),this.register(this._terminal.onLineFeed((()=>this._handleChar(` -`)))),this.register(this._terminal.onA11yTab((e=>this._handleTab(e)))),this.register(this._terminal.onKey((e=>this._handleKey(e.key)))),this.register(this._terminal.onBlur((()=>this._clearLiveRegion()))),this.register(this._renderService.onDimensionsChange((()=>this._refreshRowsDimensions()))),this.register((0,u.addDisposableDomListener)(document,`selectionchange`,(()=>this._handleSelectionChange()))),this.register(this._coreBrowserService.onDprChange((()=>this._refreshRowsDimensions()))),this._refreshRows(),this.register((0,s.toDisposable)((()=>{this._accessibilityContainer.remove(),this._rowElements.length=0})))}_handleTab(e){for(let t=0;t0?this._charsToConsume.shift()!==e&&(this._charsToAnnounce+=e):this._charsToAnnounce+=e,e===` -`&&(this._liveRegionLineCount++,this._liveRegionLineCount===21&&(this._liveRegion.textContent+=a.tooMuchOutput)))}_clearLiveRegion(){this._liveRegion.textContent=``,this._liveRegionLineCount=0}_handleKey(e){this._clearLiveRegion(),/\p{Control}/u.test(e)||this._charsToConsume.push(e)}_refreshRows(e,t){this._liveRegionDebouncer.refresh(e,t,this._terminal.rows)}_renderRows(e,t){let n=this._terminal.buffer,r=n.lines.length.toString();for(let i=e;i<=t;i++){let e=n.lines.get(n.ydisp+i),t=[],a=e?.translateToString(!0,void 0,void 0,t)||``,o=(n.ydisp+i+1).toString(),s=this._rowElements[i];s&&(a.length===0?(s.innerText=`\xA0`,this._rowColumns.set(s,[0,1])):(s.textContent=a,this._rowColumns.set(s,t)),s.setAttribute(`aria-posinset`,o),s.setAttribute(`aria-setsize`,r))}this._announceCharacters()}_announceCharacters(){this._charsToAnnounce.length!==0&&(this._liveRegion.textContent+=this._charsToAnnounce,this._charsToAnnounce=``)}_handleBoundaryFocus(e,t){let n=e.target,r=this._rowElements[t===0?1:this._rowElements.length-2];if(n.getAttribute(`aria-posinset`)===(t===0?`1`:`${this._terminal.buffer.lines.length}`)||e.relatedTarget!==r)return;let i,a;if(t===0?(i=n,a=this._rowElements.pop(),this._rowContainer.removeChild(a)):(i=this._rowElements.shift(),a=n,this._rowContainer.removeChild(i)),i.removeEventListener(`focus`,this._topBoundaryFocusListener),a.removeEventListener(`focus`,this._bottomBoundaryFocusListener),t===0){let e=this._createAccessibilityTreeNode();this._rowElements.unshift(e),this._rowContainer.insertAdjacentElement(`afterbegin`,e)}else{let e=this._createAccessibilityTreeNode();this._rowElements.push(e),this._rowContainer.appendChild(e)}this._rowElements[0].addEventListener(`focus`,this._topBoundaryFocusListener),this._rowElements[this._rowElements.length-1].addEventListener(`focus`,this._bottomBoundaryFocusListener),this._terminal.scrollLines(t===0?-1:1),this._rowElements[t===0?1:this._rowElements.length-2].focus(),e.preventDefault(),e.stopImmediatePropagation()}_handleSelectionChange(){if(this._rowElements.length===0)return;let e=document.getSelection();if(!e)return;if(e.isCollapsed)return void(this._rowContainer.contains(e.anchorNode)&&this._terminal.clearSelection());if(!e.anchorNode||!e.focusNode)return void console.error(`anchorNode and/or focusNode are null`);let t={node:e.anchorNode,offset:e.anchorOffset},n={node:e.focusNode,offset:e.focusOffset};if((t.node.compareDocumentPosition(n.node)&Node.DOCUMENT_POSITION_PRECEDING||t.node===n.node&&t.offset>n.offset)&&([t,n]=[n,t]),t.node.compareDocumentPosition(this._rowElements[0])&(Node.DOCUMENT_POSITION_CONTAINED_BY|Node.DOCUMENT_POSITION_FOLLOWING)&&(t={node:this._rowElements[0].childNodes[0],offset:0}),!this._rowContainer.contains(t.node))return;let r=this._rowElements.slice(-1)[0];if(n.node.compareDocumentPosition(r)&(Node.DOCUMENT_POSITION_CONTAINED_BY|Node.DOCUMENT_POSITION_PRECEDING)&&(n={node:r,offset:r.textContent?.length??0}),!this._rowContainer.contains(n.node))return;let i=({node:e,offset:t})=>{let n=e instanceof Text?e.parentNode:e,r=parseInt(n?.getAttribute(`aria-posinset`),10)-1;if(isNaN(r))return console.warn(`row is invalid. Race condition?`),null;let i=this._rowColumns.get(n);if(!i)return console.warn(`columns is null. Race condition?`),null;let a=t=this._terminal.cols&&(++r,a=0),{row:r,column:a}},a=i(t),o=i(n);if(a&&o){if(a.row>o.row||a.row===o.row&&a.column>=o.column)throw Error(`invalid range`);this._terminal.select(a.column,a.row,(o.row-a.row)*this._terminal.cols-a.column+o.column)}}_handleResize(e){this._rowElements[this._rowElements.length-1].removeEventListener(`focus`,this._bottomBoundaryFocusListener);for(let e=this._rowContainer.children.length;ee;)this._rowContainer.removeChild(this._rowElements.pop());this._rowElements[this._rowElements.length-1].addEventListener(`focus`,this._bottomBoundaryFocusListener),this._refreshRowsDimensions()}_createAccessibilityTreeNode(){let e=this._coreBrowserService.mainDocument.createElement(`div`);return e.setAttribute(`role`,`listitem`),e.tabIndex=-1,this._refreshRowDimensions(e),e}_refreshRowsDimensions(){if(this._renderService.dimensions.css.cell.height){this._accessibilityContainer.style.width=`${this._renderService.dimensions.css.canvas.width}px`,this._rowElements.length!==this._terminal.rows&&this._handleResize(this._terminal.rows);for(let e=0;e{function n(e){return e.replace(/\r?\n/g,`\r`)}function r(e,t){return t?`\x1B[200~`+e+`\x1B[201~`:e}function i(e,t,i,a){e=r(e=n(e),i.decPrivateModes.bracketedPasteMode&&!0!==a.rawOptions.ignoreBracketedPasteMode),i.triggerDataEvent(e,!0),t.value=``}function a(e,t,n){let r=n.getBoundingClientRect(),i=e.clientX-r.left-10,a=e.clientY-r.top-10;t.style.width=`20px`,t.style.height=`20px`,t.style.left=`${i}px`,t.style.top=`${a}px`,t.style.zIndex=`1000`,t.focus()}Object.defineProperty(t,"__esModule",{value:!0}),t.rightClickHandler=t.moveTextAreaUnderMouseCursor=t.paste=t.handlePasteEvent=t.copyHandler=t.bracketTextForPaste=t.prepareTextForTerminal=void 0,t.prepareTextForTerminal=n,t.bracketTextForPaste=r,t.copyHandler=function(e,t){e.clipboardData&&e.clipboardData.setData(`text/plain`,t.selectionText),e.preventDefault()},t.handlePasteEvent=function(e,t,n,r){e.stopPropagation(),e.clipboardData&&i(e.clipboardData.getData(`text/plain`),t,n,r)},t.paste=i,t.moveTextAreaUnderMouseCursor=a,t.rightClickHandler=function(e,t,n,r,i){a(e,t,n),i&&r.rightClickSelect(e),t.value=r.selectionText,t.select()}},7239:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.ColorContrastCache=void 0;let r=n(1505);t.ColorContrastCache=class{constructor(){this._color=new r.TwoKeyMap,this._css=new r.TwoKeyMap}setCss(e,t,n){this._css.set(e,t,n)}getCss(e,t){return this._css.get(e,t)}setColor(e,t,n){this._color.set(e,t,n)}getColor(e,t){return this._color.get(e,t)}clear(){this._color.clear(),this._css.clear()}}},3656:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.addDisposableDomListener=void 0,t.addDisposableDomListener=function(e,t,n,r){e.addEventListener(t,n,r);let i=!1;return{dispose:()=>{i||(i=!0,e.removeEventListener(t,n,r))}}}},3551:function(e,t,n){var r=this&&this.__decorate||function(e,t,n,r){var i,a=arguments.length,o=a<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,n):r;if(typeof Reflect==`object`&&typeof Reflect.decorate==`function`)o=Reflect.decorate(e,t,n,r);else for(var s=e.length-1;s>=0;s--)(i=e[s])&&(o=(a<3?i(o):a>3?i(t,n,o):i(t,n))||o);return a>3&&o&&Object.defineProperty(t,n,o),o},i=this&&this.__param||function(e,t){return function(n,r){t(n,r,e)}};Object.defineProperty(t,"__esModule",{value:!0}),t.Linkifier=void 0;let a=n(3656),o=n(8460),s=n(844),c=n(2585),l=n(4725),u=t.Linkifier=class extends s.Disposable{get currentLink(){return this._currentLink}constructor(e,t,n,r,i){super(),this._element=e,this._mouseService=t,this._renderService=n,this._bufferService=r,this._linkProviderService=i,this._linkCacheDisposables=[],this._isMouseOut=!0,this._wasResized=!1,this._activeLine=-1,this._onShowLinkUnderline=this.register(new o.EventEmitter),this.onShowLinkUnderline=this._onShowLinkUnderline.event,this._onHideLinkUnderline=this.register(new o.EventEmitter),this.onHideLinkUnderline=this._onHideLinkUnderline.event,this.register((0,s.getDisposeArrayDisposable)(this._linkCacheDisposables)),this.register((0,s.toDisposable)((()=>{this._lastMouseEvent=void 0,this._activeProviderReplies?.clear()}))),this.register(this._bufferService.onResize((()=>{this._clearCurrentLink(),this._wasResized=!0}))),this.register((0,a.addDisposableDomListener)(this._element,`mouseleave`,(()=>{this._isMouseOut=!0,this._clearCurrentLink()}))),this.register((0,a.addDisposableDomListener)(this._element,`mousemove`,this._handleMouseMove.bind(this))),this.register((0,a.addDisposableDomListener)(this._element,`mousedown`,this._handleMouseDown.bind(this))),this.register((0,a.addDisposableDomListener)(this._element,`mouseup`,this._handleMouseUp.bind(this)))}_handleMouseMove(e){this._lastMouseEvent=e;let t=this._positionFromMouseEvent(e,this._element,this._mouseService);if(!t)return;this._isMouseOut=!1;let n=e.composedPath();for(let e=0;e{e?.forEach((e=>{e.link.dispose&&e.link.dispose()}))})),this._activeProviderReplies=new Map,this._activeLine=e.y);let n=!1;for(let[r,i]of this._linkProviderService.linkProviders.entries())t?this._activeProviderReplies?.get(r)&&(n=this._checkLinkProviderResult(r,e,n)):i.provideLinks(e.y,(t=>{if(this._isMouseOut)return;let i=t?.map((e=>({link:e})));this._activeProviderReplies?.set(r,i),n=this._checkLinkProviderResult(r,e,n),this._activeProviderReplies?.size===this._linkProviderService.linkProviders.length&&this._removeIntersectingLinks(e.y,this._activeProviderReplies)}))}_removeIntersectingLinks(e,t){let n=new Set;for(let r=0;re?this._bufferService.cols:r.link.range.end.x;for(let e=a;e<=o;e++){if(n.has(e)){i.splice(t--,1);break}n.add(e)}}}}_checkLinkProviderResult(e,t,n){if(!this._activeProviderReplies)return n;let r=this._activeProviderReplies.get(e),i=!1;for(let t=0;tthis._linkAtPosition(e.link,t)));e&&(n=!0,this._handleNewLink(e))}if(this._activeProviderReplies.size===this._linkProviderService.linkProviders.length&&!n)for(let e=0;ethis._linkAtPosition(e.link,t)));if(r){n=!0,this._handleNewLink(r);break}}return n}_handleMouseDown(){this._mouseDownLink=this._currentLink}_handleMouseUp(e){if(!this._currentLink)return;let t=this._positionFromMouseEvent(e,this._element,this._mouseService);t&&this._mouseDownLink===this._currentLink&&this._linkAtPosition(this._currentLink.link,t)&&this._currentLink.link.activate(e,this._currentLink.link.text)}_clearCurrentLink(e,t){this._currentLink&&this._lastMouseEvent&&(!e||!t||this._currentLink.link.range.start.y>=e&&this._currentLink.link.range.end.y<=t)&&(this._linkLeave(this._element,this._currentLink.link,this._lastMouseEvent),this._currentLink=void 0,(0,s.disposeArray)(this._linkCacheDisposables))}_handleNewLink(e){if(!this._lastMouseEvent)return;let t=this._positionFromMouseEvent(this._lastMouseEvent,this._element,this._mouseService);t&&this._linkAtPosition(e.link,t)&&(this._currentLink=e,this._currentLink.state={decorations:{underline:e.link.decorations===void 0||e.link.decorations.underline,pointerCursor:e.link.decorations===void 0||e.link.decorations.pointerCursor},isHovered:!0},this._linkHover(this._element,e.link,this._lastMouseEvent),e.link.decorations={},Object.defineProperties(e.link.decorations,{pointerCursor:{get:()=>this._currentLink?.state?.decorations.pointerCursor,set:e=>{this._currentLink?.state&&this._currentLink.state.decorations.pointerCursor!==e&&(this._currentLink.state.decorations.pointerCursor=e,this._currentLink.state.isHovered&&this._element.classList.toggle(`xterm-cursor-pointer`,e))}},underline:{get:()=>this._currentLink?.state?.decorations.underline,set:t=>{this._currentLink?.state&&this._currentLink?.state?.decorations.underline!==t&&(this._currentLink.state.decorations.underline=t,this._currentLink.state.isHovered&&this._fireUnderlineEvent(e.link,t))}}}),this._linkCacheDisposables.push(this._renderService.onRenderedViewportChange((e=>{if(!this._currentLink)return;let t=e.start===0?0:e.start+1+this._bufferService.buffer.ydisp,n=this._bufferService.buffer.ydisp+1+e.end;if(this._currentLink.link.range.start.y>=t&&this._currentLink.link.range.end.y<=n&&(this._clearCurrentLink(t,n),this._lastMouseEvent)){let e=this._positionFromMouseEvent(this._lastMouseEvent,this._element,this._mouseService);e&&this._askForLink(e,!1)}}))))}_linkHover(e,t,n){this._currentLink?.state&&(this._currentLink.state.isHovered=!0,this._currentLink.state.decorations.underline&&this._fireUnderlineEvent(t,!0),this._currentLink.state.decorations.pointerCursor&&e.classList.add(`xterm-cursor-pointer`)),t.hover&&t.hover(n,t.text)}_fireUnderlineEvent(e,t){let n=e.range,r=this._bufferService.buffer.ydisp,i=this._createLinkUnderlineEvent(n.start.x-1,n.start.y-r-1,n.end.x,n.end.y-r-1,void 0);(t?this._onShowLinkUnderline:this._onHideLinkUnderline).fire(i)}_linkLeave(e,t,n){this._currentLink?.state&&(this._currentLink.state.isHovered=!1,this._currentLink.state.decorations.underline&&this._fireUnderlineEvent(t,!1),this._currentLink.state.decorations.pointerCursor&&e.classList.remove(`xterm-cursor-pointer`)),t.leave&&t.leave(n,t.text)}_linkAtPosition(e,t){let n=e.range.start.y*this._bufferService.cols+e.range.start.x,r=e.range.end.y*this._bufferService.cols+e.range.end.x,i=t.y*this._bufferService.cols+t.x;return n<=i&&i<=r}_positionFromMouseEvent(e,t,n){let r=n.getCoords(e,t,this._bufferService.cols,this._bufferService.rows);if(r)return{x:r[0],y:r[1]+this._bufferService.buffer.ydisp}}_createLinkUnderlineEvent(e,t,n,r,i){return{x1:e,y1:t,x2:n,y2:r,cols:this._bufferService.cols,fg:i}}};t.Linkifier=u=r([i(1,l.IMouseService),i(2,l.IRenderService),i(3,c.IBufferService),i(4,l.ILinkProviderService)],u)},9042:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.tooMuchOutput=t.promptLabel=void 0,t.promptLabel=`Terminal input`,t.tooMuchOutput=`Too much output to announce, navigate to rows manually to read`},3730:function(e,t,n){var r=this&&this.__decorate||function(e,t,n,r){var i,a=arguments.length,o=a<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,n):r;if(typeof Reflect==`object`&&typeof Reflect.decorate==`function`)o=Reflect.decorate(e,t,n,r);else for(var s=e.length-1;s>=0;s--)(i=e[s])&&(o=(a<3?i(o):a>3?i(t,n,o):i(t,n))||o);return a>3&&o&&Object.defineProperty(t,n,o),o},i=this&&this.__param||function(e,t){return function(n,r){t(n,r,e)}};Object.defineProperty(t,"__esModule",{value:!0}),t.OscLinkProvider=void 0;let a=n(511),o=n(2585),s=t.OscLinkProvider=class{constructor(e,t,n){this._bufferService=e,this._optionsService=t,this._oscLinkService=n}provideLinks(e,t){let n=this._bufferService.buffer.lines.get(e-1);if(!n)return void t(void 0);let r=[],i=this._optionsService.rawOptions.linkHandler,o=new a.CellData,s=n.getTrimmedLength(),l=-1,u=-1,d=!1;for(let t=0;ti?i.activate(e,t,a):c(0,t),hover:(e,t)=>i?.hover?.(e,t,a),leave:(e,t)=>i?.leave?.(e,t,a)})}d=!1,o.hasExtendedAttrs()&&o.extended.urlId?(u=t,l=o.extended.urlId):(u=-1,l=-1)}}t(r)}};function c(e,t){if(confirm(`Do you want to navigate to ${t}?\n\nWARNING: This link could potentially be dangerous`)){let e=window.open();if(e){try{e.opener=null}catch{}e.location.href=t}else console.warn(`Opening link blocked as opener could not be cleared`)}}t.OscLinkProvider=s=r([i(0,o.IBufferService),i(1,o.IOptionsService),i(2,o.IOscLinkService)],s)},6193:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.RenderDebouncer=void 0,t.RenderDebouncer=class{constructor(e,t){this._renderCallback=e,this._coreBrowserService=t,this._refreshCallbacks=[]}dispose(){this._animationFrame&&=(this._coreBrowserService.window.cancelAnimationFrame(this._animationFrame),void 0)}addRefreshCallback(e){return this._refreshCallbacks.push(e),this._animationFrame||=this._coreBrowserService.window.requestAnimationFrame((()=>this._innerRefresh())),this._animationFrame}refresh(e,t,n){this._rowCount=n,e=e===void 0?0:e,t=t===void 0?this._rowCount-1:t,this._rowStart=this._rowStart===void 0?e:Math.min(this._rowStart,e),this._rowEnd=this._rowEnd===void 0?t:Math.max(this._rowEnd,t),this._animationFrame||=this._coreBrowserService.window.requestAnimationFrame((()=>this._innerRefresh()))}_innerRefresh(){if(this._animationFrame=void 0,this._rowStart===void 0||this._rowEnd===void 0||this._rowCount===void 0)return void this._runRefreshCallbacks();let e=Math.max(this._rowStart,0),t=Math.min(this._rowEnd,this._rowCount-1);this._rowStart=void 0,this._rowEnd=void 0,this._renderCallback(e,t),this._runRefreshCallbacks()}_runRefreshCallbacks(){for(let e of this._refreshCallbacks)e(0);this._refreshCallbacks=[]}}},3236:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.Terminal=void 0;let r=n(3614),i=n(3656),a=n(3551),o=n(9042),s=n(3730),c=n(1680),l=n(3107),u=n(5744),d=n(2950),f=n(1296),p=n(428),m=n(4269),h=n(5114),g=n(8934),_=n(3230),v=n(9312),y=n(4725),b=n(6731),x=n(8055),S=n(8969),C=n(8460),w=n(844),T=n(6114),E=n(8437),D=n(2584),O=n(7399),k=n(5941),A=n(9074),j=n(2585),ee=n(5435),M=n(4567),N=n(779);class P extends S.CoreTerminal{get onFocus(){return this._onFocus.event}get onBlur(){return this._onBlur.event}get onA11yChar(){return this._onA11yCharEmitter.event}get onA11yTab(){return this._onA11yTabEmitter.event}get onWillOpen(){return this._onWillOpen.event}constructor(e={}){super(e),this.browser=T,this._keyDownHandled=!1,this._keyDownSeen=!1,this._keyPressHandled=!1,this._unprocessedDeadKey=!1,this._accessibilityManager=this.register(new w.MutableDisposable),this._onCursorMove=this.register(new C.EventEmitter),this.onCursorMove=this._onCursorMove.event,this._onKey=this.register(new C.EventEmitter),this.onKey=this._onKey.event,this._onRender=this.register(new C.EventEmitter),this.onRender=this._onRender.event,this._onSelectionChange=this.register(new C.EventEmitter),this.onSelectionChange=this._onSelectionChange.event,this._onTitleChange=this.register(new C.EventEmitter),this.onTitleChange=this._onTitleChange.event,this._onBell=this.register(new C.EventEmitter),this.onBell=this._onBell.event,this._onFocus=this.register(new C.EventEmitter),this._onBlur=this.register(new C.EventEmitter),this._onA11yCharEmitter=this.register(new C.EventEmitter),this._onA11yTabEmitter=this.register(new C.EventEmitter),this._onWillOpen=this.register(new C.EventEmitter),this._setup(),this._decorationService=this._instantiationService.createInstance(A.DecorationService),this._instantiationService.setService(j.IDecorationService,this._decorationService),this._linkProviderService=this._instantiationService.createInstance(N.LinkProviderService),this._instantiationService.setService(y.ILinkProviderService,this._linkProviderService),this._linkProviderService.registerLinkProvider(this._instantiationService.createInstance(s.OscLinkProvider)),this.register(this._inputHandler.onRequestBell((()=>this._onBell.fire()))),this.register(this._inputHandler.onRequestRefreshRows(((e,t)=>this.refresh(e,t)))),this.register(this._inputHandler.onRequestSendFocus((()=>this._reportFocus()))),this.register(this._inputHandler.onRequestReset((()=>this.reset()))),this.register(this._inputHandler.onRequestWindowsOptionsReport((e=>this._reportWindowsOptions(e)))),this.register(this._inputHandler.onColor((e=>this._handleColorEvent(e)))),this.register((0,C.forwardEvent)(this._inputHandler.onCursorMove,this._onCursorMove)),this.register((0,C.forwardEvent)(this._inputHandler.onTitleChange,this._onTitleChange)),this.register((0,C.forwardEvent)(this._inputHandler.onA11yChar,this._onA11yCharEmitter)),this.register((0,C.forwardEvent)(this._inputHandler.onA11yTab,this._onA11yTabEmitter)),this.register(this._bufferService.onResize((e=>this._afterResize(e.cols,e.rows)))),this.register((0,w.toDisposable)((()=>{this._customKeyEventHandler=void 0,this.element?.parentNode?.removeChild(this.element)})))}_handleColorEvent(e){if(this._themeService)for(let t of e){let e,n=``;switch(t.index){case 256:e=`foreground`,n=`10`;break;case 257:e=`background`,n=`11`;break;case 258:e=`cursor`,n=`12`;break;default:e=`ansi`,n=`4;`+t.index}switch(t.type){case 0:let r=x.color.toColorRGB(e===`ansi`?this._themeService.colors.ansi[t.index]:this._themeService.colors[e]);this.coreService.triggerDataEvent(`${D.C0.ESC}]${n};${(0,k.toRgbString)(r)}${D.C1_ESCAPED.ST}`);break;case 1:if(e===`ansi`)this._themeService.modifyColors((e=>e.ansi[t.index]=x.channels.toColor(...t.color)));else{let n=e;this._themeService.modifyColors((e=>e[n]=x.channels.toColor(...t.color)))}break;case 2:this._themeService.restoreColor(t.index)}}}_setup(){super._setup(),this._customKeyEventHandler=void 0}get buffer(){return this.buffers.active}focus(){this.textarea&&this.textarea.focus({preventScroll:!0})}_handleScreenReaderModeOptionChange(e){e?!this._accessibilityManager.value&&this._renderService&&(this._accessibilityManager.value=this._instantiationService.createInstance(M.AccessibilityManager,this)):this._accessibilityManager.clear()}_handleTextAreaFocus(e){this.coreService.decPrivateModes.sendFocus&&this.coreService.triggerDataEvent(D.C0.ESC+`[I`),this.element.classList.add(`focus`),this._showCursor(),this._onFocus.fire()}blur(){return this.textarea?.blur()}_handleTextAreaBlur(){this.textarea.value=``,this.refresh(this.buffer.y,this.buffer.y),this.coreService.decPrivateModes.sendFocus&&this.coreService.triggerDataEvent(D.C0.ESC+`[O`),this.element.classList.remove(`focus`),this._onBlur.fire()}_syncTextArea(){if(!this.textarea||!this.buffer.isCursorInViewport||this._compositionHelper.isComposing||!this._renderService)return;let e=this.buffer.ybase+this.buffer.y,t=this.buffer.lines.get(e);if(!t)return;let n=Math.min(this.buffer.x,this.cols-1),r=this._renderService.dimensions.css.cell.height,i=t.getWidth(n),a=this._renderService.dimensions.css.cell.width*i,o=this.buffer.y*this._renderService.dimensions.css.cell.height,s=n*this._renderService.dimensions.css.cell.width;this.textarea.style.left=s+`px`,this.textarea.style.top=o+`px`,this.textarea.style.width=a+`px`,this.textarea.style.height=r+`px`,this.textarea.style.lineHeight=r+`px`,this.textarea.style.zIndex=`-5`}_initGlobal(){this._bindKeys(),this.register((0,i.addDisposableDomListener)(this.element,`copy`,(e=>{this.hasSelection()&&(0,r.copyHandler)(e,this._selectionService)})));let e=e=>(0,r.handlePasteEvent)(e,this.textarea,this.coreService,this.optionsService);this.register((0,i.addDisposableDomListener)(this.textarea,`paste`,e)),this.register((0,i.addDisposableDomListener)(this.element,`paste`,e)),T.isFirefox?this.register((0,i.addDisposableDomListener)(this.element,`mousedown`,(e=>{e.button===2&&(0,r.rightClickHandler)(e,this.textarea,this.screenElement,this._selectionService,this.options.rightClickSelectsWord)}))):this.register((0,i.addDisposableDomListener)(this.element,`contextmenu`,(e=>{(0,r.rightClickHandler)(e,this.textarea,this.screenElement,this._selectionService,this.options.rightClickSelectsWord)}))),T.isLinux&&this.register((0,i.addDisposableDomListener)(this.element,`auxclick`,(e=>{e.button===1&&(0,r.moveTextAreaUnderMouseCursor)(e,this.textarea,this.screenElement)})))}_bindKeys(){this.register((0,i.addDisposableDomListener)(this.textarea,`keyup`,(e=>this._keyUp(e)),!0)),this.register((0,i.addDisposableDomListener)(this.textarea,`keydown`,(e=>this._keyDown(e)),!0)),this.register((0,i.addDisposableDomListener)(this.textarea,`keypress`,(e=>this._keyPress(e)),!0)),this.register((0,i.addDisposableDomListener)(this.textarea,`compositionstart`,(()=>this._compositionHelper.compositionstart()))),this.register((0,i.addDisposableDomListener)(this.textarea,`compositionupdate`,(e=>this._compositionHelper.compositionupdate(e)))),this.register((0,i.addDisposableDomListener)(this.textarea,`compositionend`,(()=>this._compositionHelper.compositionend()))),this.register((0,i.addDisposableDomListener)(this.textarea,`input`,(e=>this._inputEvent(e)),!0)),this.register(this.onRender((()=>this._compositionHelper.updateCompositionElements())))}open(e){if(!e)throw Error(`Terminal requires a parent element.`);if(e.isConnected||this._logService.debug(`Terminal.open was called on an element that was not attached to the DOM`),this.element?.ownerDocument.defaultView&&this._coreBrowserService)return void(this.element.ownerDocument.defaultView!==this._coreBrowserService.window&&(this._coreBrowserService.window=this.element.ownerDocument.defaultView));this._document=e.ownerDocument,this.options.documentOverride&&this.options.documentOverride instanceof Document&&(this._document=this.optionsService.rawOptions.documentOverride),this.element=this._document.createElement(`div`),this.element.dir=`ltr`,this.element.classList.add(`terminal`),this.element.classList.add(`xterm`),e.appendChild(this.element);let t=this._document.createDocumentFragment();this._viewportElement=this._document.createElement(`div`),this._viewportElement.classList.add(`xterm-viewport`),t.appendChild(this._viewportElement),this._viewportScrollArea=this._document.createElement(`div`),this._viewportScrollArea.classList.add(`xterm-scroll-area`),this._viewportElement.appendChild(this._viewportScrollArea),this.screenElement=this._document.createElement(`div`),this.screenElement.classList.add(`xterm-screen`),this.register((0,i.addDisposableDomListener)(this.screenElement,`mousemove`,(e=>this.updateCursorStyle(e)))),this._helperContainer=this._document.createElement(`div`),this._helperContainer.classList.add(`xterm-helpers`),this.screenElement.appendChild(this._helperContainer),t.appendChild(this.screenElement),this.textarea=this._document.createElement(`textarea`),this.textarea.classList.add(`xterm-helper-textarea`),this.textarea.setAttribute(`aria-label`,o.promptLabel),T.isChromeOS||this.textarea.setAttribute(`aria-multiline`,`false`),this.textarea.setAttribute(`autocorrect`,`off`),this.textarea.setAttribute(`autocapitalize`,`off`),this.textarea.setAttribute(`spellcheck`,`false`),this.textarea.tabIndex=0,this._coreBrowserService=this.register(this._instantiationService.createInstance(h.CoreBrowserService,this.textarea,e.ownerDocument.defaultView??window,this._document??typeof window<`u`?window.document:null)),this._instantiationService.setService(y.ICoreBrowserService,this._coreBrowserService),this.register((0,i.addDisposableDomListener)(this.textarea,`focus`,(e=>this._handleTextAreaFocus(e)))),this.register((0,i.addDisposableDomListener)(this.textarea,`blur`,(()=>this._handleTextAreaBlur()))),this._helperContainer.appendChild(this.textarea),this._charSizeService=this._instantiationService.createInstance(p.CharSizeService,this._document,this._helperContainer),this._instantiationService.setService(y.ICharSizeService,this._charSizeService),this._themeService=this._instantiationService.createInstance(b.ThemeService),this._instantiationService.setService(y.IThemeService,this._themeService),this._characterJoinerService=this._instantiationService.createInstance(m.CharacterJoinerService),this._instantiationService.setService(y.ICharacterJoinerService,this._characterJoinerService),this._renderService=this.register(this._instantiationService.createInstance(_.RenderService,this.rows,this.screenElement)),this._instantiationService.setService(y.IRenderService,this._renderService),this.register(this._renderService.onRenderedViewportChange((e=>this._onRender.fire(e)))),this.onResize((e=>this._renderService.resize(e.cols,e.rows))),this._compositionView=this._document.createElement(`div`),this._compositionView.classList.add(`composition-view`),this._compositionHelper=this._instantiationService.createInstance(d.CompositionHelper,this.textarea,this._compositionView),this._helperContainer.appendChild(this._compositionView),this._mouseService=this._instantiationService.createInstance(g.MouseService),this._instantiationService.setService(y.IMouseService,this._mouseService),this.linkifier=this.register(this._instantiationService.createInstance(a.Linkifier,this.screenElement)),this.element.appendChild(t);try{this._onWillOpen.fire(this.element)}catch{}this._renderService.hasRenderer()||this._renderService.setRenderer(this._createRenderer()),this.viewport=this._instantiationService.createInstance(c.Viewport,this._viewportElement,this._viewportScrollArea),this.viewport.onRequestScrollLines((e=>this.scrollLines(e.amount,e.suppressScrollEvent,1))),this.register(this._inputHandler.onRequestSyncScrollBar((()=>this.viewport.syncScrollArea()))),this.register(this.viewport),this.register(this.onCursorMove((()=>{this._renderService.handleCursorMove(),this._syncTextArea()}))),this.register(this.onResize((()=>this._renderService.handleResize(this.cols,this.rows)))),this.register(this.onBlur((()=>this._renderService.handleBlur()))),this.register(this.onFocus((()=>this._renderService.handleFocus()))),this.register(this._renderService.onDimensionsChange((()=>this.viewport.syncScrollArea()))),this._selectionService=this.register(this._instantiationService.createInstance(v.SelectionService,this.element,this.screenElement,this.linkifier)),this._instantiationService.setService(y.ISelectionService,this._selectionService),this.register(this._selectionService.onRequestScrollLines((e=>this.scrollLines(e.amount,e.suppressScrollEvent)))),this.register(this._selectionService.onSelectionChange((()=>this._onSelectionChange.fire()))),this.register(this._selectionService.onRequestRedraw((e=>this._renderService.handleSelectionChanged(e.start,e.end,e.columnSelectMode)))),this.register(this._selectionService.onLinuxMouseSelection((e=>{this.textarea.value=e,this.textarea.focus(),this.textarea.select()}))),this.register(this._onScroll.event((e=>{this.viewport.syncScrollArea(),this._selectionService.refresh()}))),this.register((0,i.addDisposableDomListener)(this._viewportElement,`scroll`,(()=>this._selectionService.refresh()))),this.register(this._instantiationService.createInstance(l.BufferDecorationRenderer,this.screenElement)),this.register((0,i.addDisposableDomListener)(this.element,`mousedown`,(e=>this._selectionService.handleMouseDown(e)))),this.coreMouseService.areMouseEventsActive?(this._selectionService.disable(),this.element.classList.add(`enable-mouse-events`)):this._selectionService.enable(),this.options.screenReaderMode&&(this._accessibilityManager.value=this._instantiationService.createInstance(M.AccessibilityManager,this)),this.register(this.optionsService.onSpecificOptionChange(`screenReaderMode`,(e=>this._handleScreenReaderModeOptionChange(e)))),this.options.overviewRulerWidth&&(this._overviewRulerRenderer=this.register(this._instantiationService.createInstance(u.OverviewRulerRenderer,this._viewportElement,this.screenElement))),this.optionsService.onSpecificOptionChange(`overviewRulerWidth`,(e=>{!this._overviewRulerRenderer&&e&&this._viewportElement&&this.screenElement&&(this._overviewRulerRenderer=this.register(this._instantiationService.createInstance(u.OverviewRulerRenderer,this._viewportElement,this.screenElement)))})),this._charSizeService.measure(),this.refresh(0,this.rows-1),this._initGlobal(),this.bindMouse()}_createRenderer(){return this._instantiationService.createInstance(f.DomRenderer,this,this._document,this.element,this.screenElement,this._viewportElement,this._helperContainer,this.linkifier)}bindMouse(){let e=this,t=this.element;function n(t){let n=e._mouseService.getMouseReportCoords(t,e.screenElement);if(!n)return!1;let r,i;switch(t.overrideType||t.type){case`mousemove`:i=32,t.buttons===void 0?(r=3,t.button!==void 0&&(r=t.button<3?t.button:3)):r=1&t.buttons?0:4&t.buttons?1:2&t.buttons?2:3;break;case`mouseup`:i=0,r=t.button<3?t.button:3;break;case`mousedown`:i=1,r=t.button<3?t.button:3;break;case`wheel`:if(e._customWheelEventHandler&&!1===e._customWheelEventHandler(t)||e.viewport.getLinesScrolled(t)===0)return!1;i=t.deltaY<0?0:1,r=4;break;default:return!1}return!(i===void 0||r===void 0||r>4)&&e.coreMouseService.triggerMouseEvent({col:n.col,row:n.row,x:n.x,y:n.y,button:r,action:i,ctrl:t.ctrlKey,alt:t.altKey,shift:t.shiftKey})}let r={mouseup:null,wheel:null,mousedrag:null,mousemove:null},a={mouseup:e=>(n(e),e.buttons||(this._document.removeEventListener(`mouseup`,r.mouseup),r.mousedrag&&this._document.removeEventListener(`mousemove`,r.mousedrag)),this.cancel(e)),wheel:e=>(n(e),this.cancel(e,!0)),mousedrag:e=>{e.buttons&&n(e)},mousemove:e=>{e.buttons||n(e)}};this.register(this.coreMouseService.onProtocolChange((e=>{e?(this.optionsService.rawOptions.logLevel===`debug`&&this._logService.debug(`Binding to mouse events:`,this.coreMouseService.explainEvents(e)),this.element.classList.add(`enable-mouse-events`),this._selectionService.disable()):(this._logService.debug(`Unbinding from mouse events.`),this.element.classList.remove(`enable-mouse-events`),this._selectionService.enable()),8&e?r.mousemove||=(t.addEventListener(`mousemove`,a.mousemove),a.mousemove):(t.removeEventListener(`mousemove`,r.mousemove),r.mousemove=null),16&e?r.wheel||=(t.addEventListener(`wheel`,a.wheel,{passive:!1}),a.wheel):(t.removeEventListener(`wheel`,r.wheel),r.wheel=null),2&e?r.mouseup||=a.mouseup:(this._document.removeEventListener(`mouseup`,r.mouseup),r.mouseup=null),4&e?r.mousedrag||=a.mousedrag:(this._document.removeEventListener(`mousemove`,r.mousedrag),r.mousedrag=null)}))),this.coreMouseService.activeProtocol=this.coreMouseService.activeProtocol,this.register((0,i.addDisposableDomListener)(t,`mousedown`,(e=>{if(e.preventDefault(),this.focus(),this.coreMouseService.areMouseEventsActive&&!this._selectionService.shouldForceSelection(e))return n(e),r.mouseup&&this._document.addEventListener(`mouseup`,r.mouseup),r.mousedrag&&this._document.addEventListener(`mousemove`,r.mousedrag),this.cancel(e)}))),this.register((0,i.addDisposableDomListener)(t,`wheel`,(e=>{if(!r.wheel){if(this._customWheelEventHandler&&!1===this._customWheelEventHandler(e))return!1;if(!this.buffer.hasScrollback){let t=this.viewport.getLinesScrolled(e);if(t===0)return;let n=D.C0.ESC+(this.coreService.decPrivateModes.applicationCursorKeys?`O`:`[`)+(e.deltaY<0?`A`:`B`),r=``;for(let e=0;e{if(!this.coreMouseService.areMouseEventsActive)return this.viewport.handleTouchStart(e),this.cancel(e)}),{passive:!0})),this.register((0,i.addDisposableDomListener)(t,`touchmove`,(e=>{if(!this.coreMouseService.areMouseEventsActive)return this.viewport.handleTouchMove(e)?void 0:this.cancel(e)}),{passive:!1}))}refresh(e,t){this._renderService?.refreshRows(e,t)}updateCursorStyle(e){this._selectionService?.shouldColumnSelect(e)?this.element.classList.add(`column-select`):this.element.classList.remove(`column-select`)}_showCursor(){this.coreService.isCursorInitialized||(this.coreService.isCursorInitialized=!0,this.refresh(this.buffer.y,this.buffer.y))}scrollLines(e,t,n=0){n===1?(super.scrollLines(e,t,n),this.refresh(0,this.rows-1)):this.viewport?.scrollLines(e)}paste(e){(0,r.paste)(e,this.textarea,this.coreService,this.optionsService)}attachCustomKeyEventHandler(e){this._customKeyEventHandler=e}attachCustomWheelEventHandler(e){this._customWheelEventHandler=e}registerLinkProvider(e){return this._linkProviderService.registerLinkProvider(e)}registerCharacterJoiner(e){if(!this._characterJoinerService)throw Error(`Terminal must be opened first`);let t=this._characterJoinerService.register(e);return this.refresh(0,this.rows-1),t}deregisterCharacterJoiner(e){if(!this._characterJoinerService)throw Error(`Terminal must be opened first`);this._characterJoinerService.deregister(e)&&this.refresh(0,this.rows-1)}get markers(){return this.buffer.markers}registerMarker(e){return this.buffer.addMarker(this.buffer.ybase+this.buffer.y+e)}registerDecoration(e){return this._decorationService.registerDecoration(e)}hasSelection(){return!!this._selectionService&&this._selectionService.hasSelection}select(e,t,n){this._selectionService.setSelection(e,t,n)}getSelection(){return this._selectionService?this._selectionService.selectionText:``}getSelectionPosition(){if(this._selectionService&&this._selectionService.hasSelection)return{start:{x:this._selectionService.selectionStart[0],y:this._selectionService.selectionStart[1]},end:{x:this._selectionService.selectionEnd[0],y:this._selectionService.selectionEnd[1]}}}clearSelection(){this._selectionService?.clearSelection()}selectAll(){this._selectionService?.selectAll()}selectLines(e,t){this._selectionService?.selectLines(e,t)}_keyDown(e){if(this._keyDownHandled=!1,this._keyDownSeen=!0,this._customKeyEventHandler&&!1===this._customKeyEventHandler(e))return!1;let t=this.browser.isMac&&this.options.macOptionIsMeta&&e.altKey;if(!t&&!this._compositionHelper.keydown(e))return this.options.scrollOnUserInput&&this.buffer.ybase!==this.buffer.ydisp&&this.scrollToBottom(),!1;t||e.key!==`Dead`&&e.key!==`AltGraph`||(this._unprocessedDeadKey=!0);let n=(0,O.evaluateKeyboardEvent)(e,this.coreService.decPrivateModes.applicationCursorKeys,this.browser.isMac,this.options.macOptionIsMeta);if(this.updateCursorStyle(e),n.type===3||n.type===2){let t=this.rows-1;return this.scrollLines(n.type===2?-t:t),this.cancel(e,!0)}return n.type===1&&this.selectAll(),!!this._isThirdLevelShift(this.browser,e)||(n.cancel&&this.cancel(e,!0),!n.key||!!(e.key&&!e.ctrlKey&&!e.altKey&&!e.metaKey&&e.key.length===1&&e.key.charCodeAt(0)>=65&&e.key.charCodeAt(0)<=90)||(this._unprocessedDeadKey?(this._unprocessedDeadKey=!1,!0):(n.key!==D.C0.ETX&&n.key!==D.C0.CR||(this.textarea.value=``),this._onKey.fire({key:n.key,domEvent:e}),this._showCursor(),this.coreService.triggerDataEvent(n.key,!0),!this.optionsService.rawOptions.screenReaderMode||e.altKey||e.ctrlKey?this.cancel(e,!0):void(this._keyDownHandled=!0))))}_isThirdLevelShift(e,t){let n=e.isMac&&!this.options.macOptionIsMeta&&t.altKey&&!t.ctrlKey&&!t.metaKey||e.isWindows&&t.altKey&&t.ctrlKey&&!t.metaKey||e.isWindows&&t.getModifierState(`AltGraph`);return t.type===`keypress`?n:n&&(!t.keyCode||t.keyCode>47)}_keyUp(e){this._keyDownSeen=!1,this._customKeyEventHandler&&!1===this._customKeyEventHandler(e)||(function(e){return e.keyCode===16||e.keyCode===17||e.keyCode===18}(e)||this.focus(),this.updateCursorStyle(e),this._keyPressHandled=!1)}_keyPress(e){let t;if(this._keyPressHandled=!1,this._keyDownHandled||this._customKeyEventHandler&&!1===this._customKeyEventHandler(e))return!1;if(this.cancel(e),e.charCode)t=e.charCode;else if(e.which===null||e.which===void 0)t=e.keyCode;else{if(e.which===0||e.charCode===0)return!1;t=e.which}return!(!t||(e.altKey||e.ctrlKey||e.metaKey)&&!this._isThirdLevelShift(this.browser,e)||(t=String.fromCharCode(t),this._onKey.fire({key:t,domEvent:e}),this._showCursor(),this.coreService.triggerDataEvent(t,!0),this._keyPressHandled=!0,this._unprocessedDeadKey=!1,0))}_inputEvent(e){if(e.data&&e.inputType===`insertText`&&(!e.composed||!this._keyDownSeen)&&!this.optionsService.rawOptions.screenReaderMode){if(this._keyPressHandled)return!1;this._unprocessedDeadKey=!1;let t=e.data;return this.coreService.triggerDataEvent(t,!0),this.cancel(e),!0}return!1}resize(e,t){e!==this.cols||t!==this.rows?super.resize(e,t):this._charSizeService&&!this._charSizeService.hasValidSize&&this._charSizeService.measure()}_afterResize(e,t){this._charSizeService?.measure(),this.viewport?.syncScrollArea(!0)}clear(){if(this.buffer.ybase!==0||this.buffer.y!==0){this.buffer.clearAllMarkers(),this.buffer.lines.set(0,this.buffer.lines.get(this.buffer.ybase+this.buffer.y)),this.buffer.lines.length=1,this.buffer.ydisp=0,this.buffer.ybase=0,this.buffer.y=0;for(let e=1;e{Object.defineProperty(t,"__esModule",{value:!0}),t.TimeBasedDebouncer=void 0,t.TimeBasedDebouncer=class{constructor(e,t=1e3){this._renderCallback=e,this._debounceThresholdMS=t,this._lastRefreshMs=0,this._additionalRefreshRequested=!1}dispose(){this._refreshTimeoutID&&clearTimeout(this._refreshTimeoutID)}refresh(e,t,n){this._rowCount=n,e=e===void 0?0:e,t=t===void 0?this._rowCount-1:t,this._rowStart=this._rowStart===void 0?e:Math.min(this._rowStart,e),this._rowEnd=this._rowEnd===void 0?t:Math.max(this._rowEnd,t);let r=Date.now();if(r-this._lastRefreshMs>=this._debounceThresholdMS)this._lastRefreshMs=r,this._innerRefresh();else if(!this._additionalRefreshRequested){let e=r-this._lastRefreshMs,t=this._debounceThresholdMS-e;this._additionalRefreshRequested=!0,this._refreshTimeoutID=window.setTimeout((()=>{this._lastRefreshMs=Date.now(),this._innerRefresh(),this._additionalRefreshRequested=!1,this._refreshTimeoutID=void 0}),t)}}_innerRefresh(){if(this._rowStart===void 0||this._rowEnd===void 0||this._rowCount===void 0)return;let e=Math.max(this._rowStart,0),t=Math.min(this._rowEnd,this._rowCount-1);this._rowStart=void 0,this._rowEnd=void 0,this._renderCallback(e,t)}}},1680:function(e,t,n){var r=this&&this.__decorate||function(e,t,n,r){var i,a=arguments.length,o=a<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,n):r;if(typeof Reflect==`object`&&typeof Reflect.decorate==`function`)o=Reflect.decorate(e,t,n,r);else for(var s=e.length-1;s>=0;s--)(i=e[s])&&(o=(a<3?i(o):a>3?i(t,n,o):i(t,n))||o);return a>3&&o&&Object.defineProperty(t,n,o),o},i=this&&this.__param||function(e,t){return function(n,r){t(n,r,e)}};Object.defineProperty(t,"__esModule",{value:!0}),t.Viewport=void 0;let a=n(3656),o=n(4725),s=n(8460),c=n(844),l=n(2585),u=t.Viewport=class extends c.Disposable{constructor(e,t,n,r,i,o,c,l){super(),this._viewportElement=e,this._scrollArea=t,this._bufferService=n,this._optionsService=r,this._charSizeService=i,this._renderService=o,this._coreBrowserService=c,this.scrollBarWidth=0,this._currentRowHeight=0,this._currentDeviceCellHeight=0,this._lastRecordedBufferLength=0,this._lastRecordedViewportHeight=0,this._lastRecordedBufferHeight=0,this._lastTouchY=0,this._lastScrollTop=0,this._wheelPartialScroll=0,this._refreshAnimationFrame=null,this._ignoreNextScrollEvent=!1,this._smoothScrollState={startTime:0,origin:-1,target:-1},this._onRequestScrollLines=this.register(new s.EventEmitter),this.onRequestScrollLines=this._onRequestScrollLines.event,this.scrollBarWidth=this._viewportElement.offsetWidth-this._scrollArea.offsetWidth||15,this.register((0,a.addDisposableDomListener)(this._viewportElement,`scroll`,this._handleScroll.bind(this))),this._activeBuffer=this._bufferService.buffer,this.register(this._bufferService.buffers.onBufferActivate((e=>this._activeBuffer=e.activeBuffer))),this._renderDimensions=this._renderService.dimensions,this.register(this._renderService.onDimensionsChange((e=>this._renderDimensions=e))),this._handleThemeChange(l.colors),this.register(l.onChangeColors((e=>this._handleThemeChange(e)))),this.register(this._optionsService.onSpecificOptionChange(`scrollback`,(()=>this.syncScrollArea()))),setTimeout((()=>this.syncScrollArea()))}_handleThemeChange(e){this._viewportElement.style.backgroundColor=e.background.css}reset(){this._currentRowHeight=0,this._currentDeviceCellHeight=0,this._lastRecordedBufferLength=0,this._lastRecordedViewportHeight=0,this._lastRecordedBufferHeight=0,this._lastTouchY=0,this._lastScrollTop=0,this._coreBrowserService.window.requestAnimationFrame((()=>this.syncScrollArea()))}_refresh(e){if(e)return this._innerRefresh(),void(this._refreshAnimationFrame!==null&&this._coreBrowserService.window.cancelAnimationFrame(this._refreshAnimationFrame));this._refreshAnimationFrame===null&&(this._refreshAnimationFrame=this._coreBrowserService.window.requestAnimationFrame((()=>this._innerRefresh())))}_innerRefresh(){if(this._charSizeService.height>0){this._currentRowHeight=this._renderDimensions.device.cell.height/this._coreBrowserService.dpr,this._currentDeviceCellHeight=this._renderDimensions.device.cell.height,this._lastRecordedViewportHeight=this._viewportElement.offsetHeight;let e=Math.round(this._currentRowHeight*this._lastRecordedBufferLength)+(this._lastRecordedViewportHeight-this._renderDimensions.css.canvas.height);this._lastRecordedBufferHeight!==e&&(this._lastRecordedBufferHeight=e,this._scrollArea.style.height=this._lastRecordedBufferHeight+`px`)}let e=this._bufferService.buffer.ydisp*this._currentRowHeight;this._viewportElement.scrollTop!==e&&(this._ignoreNextScrollEvent=!0,this._viewportElement.scrollTop=e),this._refreshAnimationFrame=null}syncScrollArea(e=!1){if(this._lastRecordedBufferLength!==this._bufferService.buffer.lines.length)return this._lastRecordedBufferLength=this._bufferService.buffer.lines.length,void this._refresh(e);this._lastRecordedViewportHeight===this._renderService.dimensions.css.canvas.height&&this._lastScrollTop===this._activeBuffer.ydisp*this._currentRowHeight&&this._renderDimensions.device.cell.height===this._currentDeviceCellHeight||this._refresh(e)}_handleScroll(e){if(this._lastScrollTop=this._viewportElement.scrollTop,!this._viewportElement.offsetParent)return;if(this._ignoreNextScrollEvent)return this._ignoreNextScrollEvent=!1,void this._onRequestScrollLines.fire({amount:0,suppressScrollEvent:!0});let t=Math.round(this._lastScrollTop/this._currentRowHeight)-this._bufferService.buffer.ydisp;this._onRequestScrollLines.fire({amount:t,suppressScrollEvent:!0})}_smoothScroll(){if(this._isDisposed||this._smoothScrollState.origin===-1||this._smoothScrollState.target===-1)return;let e=this._smoothScrollPercent();this._viewportElement.scrollTop=this._smoothScrollState.origin+Math.round(e*(this._smoothScrollState.target-this._smoothScrollState.origin)),e<1?this._coreBrowserService.window.requestAnimationFrame((()=>this._smoothScroll())):this._clearSmoothScrollState()}_smoothScrollPercent(){return this._optionsService.rawOptions.smoothScrollDuration&&this._smoothScrollState.startTime?Math.max(Math.min((Date.now()-this._smoothScrollState.startTime)/this._optionsService.rawOptions.smoothScrollDuration,1),0):1}_clearSmoothScrollState(){this._smoothScrollState.startTime=0,this._smoothScrollState.origin=-1,this._smoothScrollState.target=-1}_bubbleScroll(e,t){let n=this._viewportElement.scrollTop+this._lastRecordedViewportHeight;return!(t<0&&this._viewportElement.scrollTop!==0||t>0&&n0&&(n=e),r=``}}return{bufferElements:i,cursorElement:n}}getLinesScrolled(e){if(e.deltaY===0||e.shiftKey)return 0;let t=this._applyScrollModifier(e.deltaY,e);return e.deltaMode===WheelEvent.DOM_DELTA_PIXEL?(t/=this._currentRowHeight+0,this._wheelPartialScroll+=t,t=Math.floor(Math.abs(this._wheelPartialScroll))*(this._wheelPartialScroll>0?1:-1),this._wheelPartialScroll%=1):e.deltaMode===WheelEvent.DOM_DELTA_PAGE&&(t*=this._bufferService.rows),t}_applyScrollModifier(e,t){let n=this._optionsService.rawOptions.fastScrollModifier;return n===`alt`&&t.altKey||n===`ctrl`&&t.ctrlKey||n===`shift`&&t.shiftKey?e*this._optionsService.rawOptions.fastScrollSensitivity*this._optionsService.rawOptions.scrollSensitivity:e*this._optionsService.rawOptions.scrollSensitivity}handleTouchStart(e){this._lastTouchY=e.touches[0].pageY}handleTouchMove(e){let t=this._lastTouchY-e.touches[0].pageY;return this._lastTouchY=e.touches[0].pageY,t!==0&&(this._viewportElement.scrollTop+=t,this._bubbleScroll(e,t))}};t.Viewport=u=r([i(2,l.IBufferService),i(3,l.IOptionsService),i(4,o.ICharSizeService),i(5,o.IRenderService),i(6,o.ICoreBrowserService),i(7,o.IThemeService)],u)},3107:function(e,t,n){var r=this&&this.__decorate||function(e,t,n,r){var i,a=arguments.length,o=a<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,n):r;if(typeof Reflect==`object`&&typeof Reflect.decorate==`function`)o=Reflect.decorate(e,t,n,r);else for(var s=e.length-1;s>=0;s--)(i=e[s])&&(o=(a<3?i(o):a>3?i(t,n,o):i(t,n))||o);return a>3&&o&&Object.defineProperty(t,n,o),o},i=this&&this.__param||function(e,t){return function(n,r){t(n,r,e)}};Object.defineProperty(t,"__esModule",{value:!0}),t.BufferDecorationRenderer=void 0;let a=n(4725),o=n(844),s=n(2585),c=t.BufferDecorationRenderer=class extends o.Disposable{constructor(e,t,n,r,i){super(),this._screenElement=e,this._bufferService=t,this._coreBrowserService=n,this._decorationService=r,this._renderService=i,this._decorationElements=new Map,this._altBufferIsActive=!1,this._dimensionsChanged=!1,this._container=document.createElement(`div`),this._container.classList.add(`xterm-decoration-container`),this._screenElement.appendChild(this._container),this.register(this._renderService.onRenderedViewportChange((()=>this._doRefreshDecorations()))),this.register(this._renderService.onDimensionsChange((()=>{this._dimensionsChanged=!0,this._queueRefresh()}))),this.register(this._coreBrowserService.onDprChange((()=>this._queueRefresh()))),this.register(this._bufferService.buffers.onBufferActivate((()=>{this._altBufferIsActive=this._bufferService.buffer===this._bufferService.buffers.alt}))),this.register(this._decorationService.onDecorationRegistered((()=>this._queueRefresh()))),this.register(this._decorationService.onDecorationRemoved((e=>this._removeDecoration(e)))),this.register((0,o.toDisposable)((()=>{this._container.remove(),this._decorationElements.clear()})))}_queueRefresh(){this._animationFrame===void 0&&(this._animationFrame=this._renderService.addRefreshCallback((()=>{this._doRefreshDecorations(),this._animationFrame=void 0})))}_doRefreshDecorations(){for(let e of this._decorationService.decorations)this._renderDecoration(e);this._dimensionsChanged=!1}_renderDecoration(e){this._refreshStyle(e),this._dimensionsChanged&&this._refreshXPosition(e)}_createElement(e){let t=this._coreBrowserService.mainDocument.createElement(`div`);t.classList.add(`xterm-decoration`),t.classList.toggle(`xterm-decoration-top-layer`,e?.options?.layer===`top`),t.style.width=`${Math.round((e.options.width||1)*this._renderService.dimensions.css.cell.width)}px`,t.style.height=(e.options.height||1)*this._renderService.dimensions.css.cell.height+`px`,t.style.top=(e.marker.line-this._bufferService.buffers.active.ydisp)*this._renderService.dimensions.css.cell.height+`px`,t.style.lineHeight=`${this._renderService.dimensions.css.cell.height}px`;let n=e.options.x??0;return n&&n>this._bufferService.cols&&(t.style.display=`none`),this._refreshXPosition(e,t),t}_refreshStyle(e){let t=e.marker.line-this._bufferService.buffers.active.ydisp;if(t<0||t>=this._bufferService.rows)e.element&&(e.element.style.display=`none`,e.onRenderEmitter.fire(e.element));else{let n=this._decorationElements.get(e);n||(n=this._createElement(e),e.element=n,this._decorationElements.set(e,n),this._container.appendChild(n),e.onDispose((()=>{this._decorationElements.delete(e),n.remove()}))),n.style.top=t*this._renderService.dimensions.css.cell.height+`px`,n.style.display=this._altBufferIsActive?`none`:`block`,e.onRenderEmitter.fire(n)}}_refreshXPosition(e,t=e.element){if(!t)return;let n=e.options.x??0;(e.options.anchor||`left`)===`right`?t.style.right=n?n*this._renderService.dimensions.css.cell.width+`px`:``:t.style.left=n?n*this._renderService.dimensions.css.cell.width+`px`:``}_removeDecoration(e){this._decorationElements.get(e)?.remove(),this._decorationElements.delete(e),e.dispose()}};t.BufferDecorationRenderer=c=r([i(1,s.IBufferService),i(2,a.ICoreBrowserService),i(3,s.IDecorationService),i(4,a.IRenderService)],c)},5871:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.ColorZoneStore=void 0,t.ColorZoneStore=class{constructor(){this._zones=[],this._zonePool=[],this._zonePoolIndex=0,this._linePadding={full:0,left:0,center:0,right:0}}get zones(){return this._zonePool.length=Math.min(this._zonePool.length,this._zones.length),this._zones}clear(){this._zones.length=0,this._zonePoolIndex=0}addDecoration(e){if(e.options.overviewRulerOptions){for(let t of this._zones)if(t.color===e.options.overviewRulerOptions.color&&t.position===e.options.overviewRulerOptions.position){if(this._lineIntersectsZone(t,e.marker.line))return;if(this._lineAdjacentToZone(t,e.marker.line,e.options.overviewRulerOptions.position))return void this._addLineToZone(t,e.marker.line)}if(this._zonePoolIndex=e.startBufferLine&&t<=e.endBufferLine}_lineAdjacentToZone(e,t,n){return t>=e.startBufferLine-this._linePadding[n||`full`]&&t<=e.endBufferLine+this._linePadding[n||`full`]}_addLineToZone(e,t){e.startBufferLine=Math.min(e.startBufferLine,t),e.endBufferLine=Math.max(e.endBufferLine,t)}}},5744:function(e,t,n){var r=this&&this.__decorate||function(e,t,n,r){var i,a=arguments.length,o=a<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,n):r;if(typeof Reflect==`object`&&typeof Reflect.decorate==`function`)o=Reflect.decorate(e,t,n,r);else for(var s=e.length-1;s>=0;s--)(i=e[s])&&(o=(a<3?i(o):a>3?i(t,n,o):i(t,n))||o);return a>3&&o&&Object.defineProperty(t,n,o),o},i=this&&this.__param||function(e,t){return function(n,r){t(n,r,e)}};Object.defineProperty(t,"__esModule",{value:!0}),t.OverviewRulerRenderer=void 0;let a=n(5871),o=n(4725),s=n(844),c=n(2585),l={full:0,left:0,center:0,right:0},u={full:0,left:0,center:0,right:0},d={full:0,left:0,center:0,right:0},f=t.OverviewRulerRenderer=class extends s.Disposable{get _width(){return this._optionsService.options.overviewRulerWidth||0}constructor(e,t,n,r,i,o,c){super(),this._viewportElement=e,this._screenElement=t,this._bufferService=n,this._decorationService=r,this._renderService=i,this._optionsService=o,this._coreBrowserService=c,this._colorZoneStore=new a.ColorZoneStore,this._shouldUpdateDimensions=!0,this._shouldUpdateAnchor=!0,this._lastKnownBufferLength=0,this._canvas=this._coreBrowserService.mainDocument.createElement(`canvas`),this._canvas.classList.add(`xterm-decoration-overview-ruler`),this._refreshCanvasDimensions(),this._viewportElement.parentElement?.insertBefore(this._canvas,this._viewportElement);let l=this._canvas.getContext(`2d`);if(!l)throw Error(`Ctx cannot be null`);this._ctx=l,this._registerDecorationListeners(),this._registerBufferChangeListeners(),this._registerDimensionChangeListeners(),this.register((0,s.toDisposable)((()=>{this._canvas?.remove()})))}_registerDecorationListeners(){this.register(this._decorationService.onDecorationRegistered((()=>this._queueRefresh(void 0,!0)))),this.register(this._decorationService.onDecorationRemoved((()=>this._queueRefresh(void 0,!0))))}_registerBufferChangeListeners(){this.register(this._renderService.onRenderedViewportChange((()=>this._queueRefresh()))),this.register(this._bufferService.buffers.onBufferActivate((()=>{this._canvas.style.display=this._bufferService.buffer===this._bufferService.buffers.alt?`none`:`block`}))),this.register(this._bufferService.onScroll((()=>{this._lastKnownBufferLength!==this._bufferService.buffers.normal.lines.length&&(this._refreshDrawHeightConstants(),this._refreshColorZonePadding())})))}_registerDimensionChangeListeners(){this.register(this._renderService.onRender((()=>{this._containerHeight&&this._containerHeight===this._screenElement.clientHeight||(this._queueRefresh(!0),this._containerHeight=this._screenElement.clientHeight)}))),this.register(this._optionsService.onSpecificOptionChange(`overviewRulerWidth`,(()=>this._queueRefresh(!0)))),this.register(this._coreBrowserService.onDprChange((()=>this._queueRefresh(!0)))),this._queueRefresh(!0)}_refreshDrawConstants(){let e=Math.floor(this._canvas.width/3),t=Math.ceil(this._canvas.width/3);u.full=this._canvas.width,u.left=e,u.center=t,u.right=e,this._refreshDrawHeightConstants(),d.full=0,d.left=0,d.center=u.left,d.right=u.left+u.center}_refreshDrawHeightConstants(){l.full=Math.round(2*this._coreBrowserService.dpr);let e=this._canvas.height/this._bufferService.buffer.lines.length,t=Math.round(Math.max(Math.min(e,12),6)*this._coreBrowserService.dpr);l.left=t,l.center=t,l.right=t}_refreshColorZonePadding(){this._colorZoneStore.setPadding({full:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*l.full),left:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*l.left),center:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*l.center),right:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*l.right)}),this._lastKnownBufferLength=this._bufferService.buffers.normal.lines.length}_refreshCanvasDimensions(){this._canvas.style.width=`${this._width}px`,this._canvas.width=Math.round(this._width*this._coreBrowserService.dpr),this._canvas.style.height=`${this._screenElement.clientHeight}px`,this._canvas.height=Math.round(this._screenElement.clientHeight*this._coreBrowserService.dpr),this._refreshDrawConstants(),this._refreshColorZonePadding()}_refreshDecorations(){this._shouldUpdateDimensions&&this._refreshCanvasDimensions(),this._ctx.clearRect(0,0,this._canvas.width,this._canvas.height),this._colorZoneStore.clear();for(let e of this._decorationService.decorations)this._colorZoneStore.addDecoration(e);this._ctx.lineWidth=1;let e=this._colorZoneStore.zones;for(let t of e)t.position!==`full`&&this._renderColorZone(t);for(let t of e)t.position===`full`&&this._renderColorZone(t);this._shouldUpdateDimensions=!1,this._shouldUpdateAnchor=!1}_renderColorZone(e){this._ctx.fillStyle=e.color,this._ctx.fillRect(d[e.position||`full`],Math.round((this._canvas.height-1)*(e.startBufferLine/this._bufferService.buffers.active.lines.length)-l[e.position||`full`]/2),u[e.position||`full`],Math.round((this._canvas.height-1)*((e.endBufferLine-e.startBufferLine)/this._bufferService.buffers.active.lines.length)+l[e.position||`full`]))}_queueRefresh(e,t){this._shouldUpdateDimensions=e||this._shouldUpdateDimensions,this._shouldUpdateAnchor=t||this._shouldUpdateAnchor,this._animationFrame===void 0&&(this._animationFrame=this._coreBrowserService.window.requestAnimationFrame((()=>{this._refreshDecorations(),this._animationFrame=void 0})))}};t.OverviewRulerRenderer=f=r([i(2,c.IBufferService),i(3,c.IDecorationService),i(4,o.IRenderService),i(5,c.IOptionsService),i(6,o.ICoreBrowserService)],f)},2950:function(e,t,n){var r=this&&this.__decorate||function(e,t,n,r){var i,a=arguments.length,o=a<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,n):r;if(typeof Reflect==`object`&&typeof Reflect.decorate==`function`)o=Reflect.decorate(e,t,n,r);else for(var s=e.length-1;s>=0;s--)(i=e[s])&&(o=(a<3?i(o):a>3?i(t,n,o):i(t,n))||o);return a>3&&o&&Object.defineProperty(t,n,o),o},i=this&&this.__param||function(e,t){return function(n,r){t(n,r,e)}};Object.defineProperty(t,"__esModule",{value:!0}),t.CompositionHelper=void 0;let a=n(4725),o=n(2585),s=n(2584),c=t.CompositionHelper=class{get isComposing(){return this._isComposing}constructor(e,t,n,r,i,a){this._textarea=e,this._compositionView=t,this._bufferService=n,this._optionsService=r,this._coreService=i,this._renderService=a,this._isComposing=!1,this._isSendingComposition=!1,this._compositionPosition={start:0,end:0},this._dataAlreadySent=``}compositionstart(){this._isComposing=!0,this._compositionPosition.start=this._textarea.value.length,this._compositionView.textContent=``,this._dataAlreadySent=``,this._compositionView.classList.add(`active`)}compositionupdate(e){this._compositionView.textContent=e.data,this.updateCompositionElements(),setTimeout((()=>{this._compositionPosition.end=this._textarea.value.length}),0)}compositionend(){this._finalizeComposition(!0)}keydown(e){if(this._isComposing||this._isSendingComposition){if(e.keyCode===229||e.keyCode===16||e.keyCode===17||e.keyCode===18)return!1;this._finalizeComposition(!1)}return e.keyCode!==229||(this._handleAnyTextareaChanges(),!1)}_finalizeComposition(e){if(this._compositionView.classList.remove(`active`),this._isComposing=!1,e){let e={start:this._compositionPosition.start,end:this._compositionPosition.end};this._isSendingComposition=!0,setTimeout((()=>{if(this._isSendingComposition){let t;this._isSendingComposition=!1,e.start+=this._dataAlreadySent.length,t=this._isComposing?this._textarea.value.substring(e.start,e.end):this._textarea.value.substring(e.start),t.length>0&&this._coreService.triggerDataEvent(t,!0)}}),0)}else{this._isSendingComposition=!1;let e=this._textarea.value.substring(this._compositionPosition.start,this._compositionPosition.end);this._coreService.triggerDataEvent(e,!0)}}_handleAnyTextareaChanges(){let e=this._textarea.value;setTimeout((()=>{if(!this._isComposing){let t=this._textarea.value,n=t.replace(e,``);this._dataAlreadySent=n,t.length>e.length?this._coreService.triggerDataEvent(n,!0):t.lengththis.updateCompositionElements(!0)),0)}}};t.CompositionHelper=c=r([i(2,o.IBufferService),i(3,o.IOptionsService),i(4,o.ICoreService),i(5,a.IRenderService)],c)},9806:(e,t)=>{function n(e,t,n){let r=n.getBoundingClientRect(),i=e.getComputedStyle(n),a=parseInt(i.getPropertyValue(`padding-left`)),o=parseInt(i.getPropertyValue(`padding-top`));return[t.clientX-r.left-a,t.clientY-r.top-o]}Object.defineProperty(t,"__esModule",{value:!0}),t.getCoords=t.getCoordsRelativeToElement=void 0,t.getCoordsRelativeToElement=n,t.getCoords=function(e,t,r,i,a,o,s,c,l){if(!o)return;let u=n(e,t,r);return u?(u[0]=Math.ceil((u[0]+(l?s/2:0))/s),u[1]=Math.ceil(u[1]/c),u[0]=Math.min(Math.max(u[0],1),i+ +!!l),u[1]=Math.min(Math.max(u[1],1),a),u):void 0}},9504:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.moveToCellSequence=void 0;let r=n(2584);function i(e,t,n,r){let i=e-a(e,n),s=t-a(t,n);return l(Math.abs(i-s)-function(e,t,n){let r=0,i=e-a(e,n),s=t-a(t,n);for(let a=0;a=0&&et?`A`:`B`}function s(e,t,n,r,i,a){let o=e,s=t,c=``;for(;o!==n||s!==r;)o+=i?1:-1,i&&o>a.cols-1?(c+=a.buffer.translateBufferLineToString(s,!1,e,o),o=0,e=0,s++):!i&&o<0&&(c+=a.buffer.translateBufferLineToString(s,!1,0,e+1),o=a.cols-1,e=o,s--);return c+a.buffer.translateBufferLineToString(s,!1,e,o)}function c(e,t){let n=t?`O`:`[`;return r.C0.ESC+n+e}function l(e,t){e=Math.floor(e);let n=``;for(let r=0;r0?r-a(r,o):t;let f=r,p=function(e,t,n,r,o,s){let c;return c=i(n,r,o,s).length>0?r-a(r,o):t,e=n&&ce?`D`:`C`,l(Math.abs(o-e),c(d,r));d=u>t?`D`:`C`;let f=Math.abs(u-t);return l(function(e,t){return t.cols-e}(u>t?e:o,n)+(f-1)*n.cols+1+((u>t?o:e)-1),c(d,r))}},1296:function(e,t,n){var r=this&&this.__decorate||function(e,t,n,r){var i,a=arguments.length,o=a<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,n):r;if(typeof Reflect==`object`&&typeof Reflect.decorate==`function`)o=Reflect.decorate(e,t,n,r);else for(var s=e.length-1;s>=0;s--)(i=e[s])&&(o=(a<3?i(o):a>3?i(t,n,o):i(t,n))||o);return a>3&&o&&Object.defineProperty(t,n,o),o},i=this&&this.__param||function(e,t){return function(n,r){t(n,r,e)}};Object.defineProperty(t,"__esModule",{value:!0}),t.DomRenderer=void 0;let a=n(3787),o=n(2550),s=n(2223),c=n(6171),l=n(6052),u=n(4725),d=n(8055),f=n(8460),p=n(844),m=n(2585),h=`xterm-dom-renderer-owner-`,g=`xterm-rows`,_=`xterm-fg-`,v=`xterm-bg-`,y=`xterm-focus`,b=`xterm-selection`,x=1,S=t.DomRenderer=class extends p.Disposable{constructor(e,t,n,r,i,s,u,d,m,_,v,y,S){super(),this._terminal=e,this._document=t,this._element=n,this._screenElement=r,this._viewportElement=i,this._helperContainer=s,this._linkifier2=u,this._charSizeService=m,this._optionsService=_,this._bufferService=v,this._coreBrowserService=y,this._themeService=S,this._terminalClass=x++,this._rowElements=[],this._selectionRenderModel=(0,l.createSelectionRenderModel)(),this.onRequestRedraw=this.register(new f.EventEmitter).event,this._rowContainer=this._document.createElement(`div`),this._rowContainer.classList.add(g),this._rowContainer.style.lineHeight=`normal`,this._rowContainer.setAttribute(`aria-hidden`,`true`),this._refreshRowElements(this._bufferService.cols,this._bufferService.rows),this._selectionContainer=this._document.createElement(`div`),this._selectionContainer.classList.add(b),this._selectionContainer.setAttribute(`aria-hidden`,`true`),this.dimensions=(0,c.createRenderDimensions)(),this._updateDimensions(),this.register(this._optionsService.onOptionChange((()=>this._handleOptionsChanged()))),this.register(this._themeService.onChangeColors((e=>this._injectCss(e)))),this._injectCss(this._themeService.colors),this._rowFactory=d.createInstance(a.DomRendererRowFactory,document),this._element.classList.add(h+this._terminalClass),this._screenElement.appendChild(this._rowContainer),this._screenElement.appendChild(this._selectionContainer),this.register(this._linkifier2.onShowLinkUnderline((e=>this._handleLinkHover(e)))),this.register(this._linkifier2.onHideLinkUnderline((e=>this._handleLinkLeave(e)))),this.register((0,p.toDisposable)((()=>{this._element.classList.remove(h+this._terminalClass),this._rowContainer.remove(),this._selectionContainer.remove(),this._widthCache.dispose(),this._themeStyleElement.remove(),this._dimensionsStyleElement.remove()}))),this._widthCache=new o.WidthCache(this._document,this._helperContainer),this._widthCache.setFont(this._optionsService.rawOptions.fontFamily,this._optionsService.rawOptions.fontSize,this._optionsService.rawOptions.fontWeight,this._optionsService.rawOptions.fontWeightBold),this._setDefaultSpacing()}_updateDimensions(){let e=this._coreBrowserService.dpr;this.dimensions.device.char.width=this._charSizeService.width*e,this.dimensions.device.char.height=Math.ceil(this._charSizeService.height*e),this.dimensions.device.cell.width=this.dimensions.device.char.width+Math.round(this._optionsService.rawOptions.letterSpacing),this.dimensions.device.cell.height=Math.floor(this.dimensions.device.char.height*this._optionsService.rawOptions.lineHeight),this.dimensions.device.char.left=0,this.dimensions.device.char.top=0,this.dimensions.device.canvas.width=this.dimensions.device.cell.width*this._bufferService.cols,this.dimensions.device.canvas.height=this.dimensions.device.cell.height*this._bufferService.rows,this.dimensions.css.canvas.width=Math.round(this.dimensions.device.canvas.width/e),this.dimensions.css.canvas.height=Math.round(this.dimensions.device.canvas.height/e),this.dimensions.css.cell.width=this.dimensions.css.canvas.width/this._bufferService.cols,this.dimensions.css.cell.height=this.dimensions.css.canvas.height/this._bufferService.rows;for(let e of this._rowElements)e.style.width=`${this.dimensions.css.canvas.width}px`,e.style.height=`${this.dimensions.css.cell.height}px`,e.style.lineHeight=`${this.dimensions.css.cell.height}px`,e.style.overflow=`hidden`;this._dimensionsStyleElement||(this._dimensionsStyleElement=this._document.createElement(`style`),this._screenElement.appendChild(this._dimensionsStyleElement));let t=`${this._terminalSelector} .${g} span { display: inline-block; height: 100%; vertical-align: top;}`;this._dimensionsStyleElement.textContent=t,this._selectionContainer.style.height=this._viewportElement.style.height,this._screenElement.style.width=`${this.dimensions.css.canvas.width}px`,this._screenElement.style.height=`${this.dimensions.css.canvas.height}px`}_injectCss(e){this._themeStyleElement||(this._themeStyleElement=this._document.createElement(`style`),this._screenElement.appendChild(this._themeStyleElement));let t=`${this._terminalSelector} .${g} { color: ${e.foreground.css}; font-family: ${this._optionsService.rawOptions.fontFamily}; font-size: ${this._optionsService.rawOptions.fontSize}px; font-kerning: none; white-space: pre}`;t+=`${this._terminalSelector} .${g} .xterm-dim { color: ${d.color.multiplyOpacity(e.foreground,.5).css};}`,t+=`${this._terminalSelector} span:not(.xterm-bold) { font-weight: ${this._optionsService.rawOptions.fontWeight};}${this._terminalSelector} span.xterm-bold { font-weight: ${this._optionsService.rawOptions.fontWeightBold};}${this._terminalSelector} span.xterm-italic { font-style: italic;}`;let n=`blink_underline_${this._terminalClass}`,r=`blink_bar_${this._terminalClass}`,i=`blink_block_${this._terminalClass}`;t+=`@keyframes ${n} { 50% { border-bottom-style: hidden; }}`,t+=`@keyframes ${r} { 50% { box-shadow: none; }}`,t+=`@keyframes ${i} { 0% { background-color: ${e.cursor.css}; color: ${e.cursorAccent.css}; } 50% { background-color: inherit; color: ${e.cursor.css}; }}`,t+=`${this._terminalSelector} .${g}.${y} .xterm-cursor.xterm-cursor-blink.xterm-cursor-underline { animation: ${n} 1s step-end infinite;}${this._terminalSelector} .${g}.${y} .xterm-cursor.xterm-cursor-blink.xterm-cursor-bar { animation: ${r} 1s step-end infinite;}${this._terminalSelector} .${g}.${y} .xterm-cursor.xterm-cursor-blink.xterm-cursor-block { animation: ${i} 1s step-end infinite;}${this._terminalSelector} .${g} .xterm-cursor.xterm-cursor-block { background-color: ${e.cursor.css}; color: ${e.cursorAccent.css};}${this._terminalSelector} .${g} .xterm-cursor.xterm-cursor-block:not(.xterm-cursor-blink) { background-color: ${e.cursor.css} !important; color: ${e.cursorAccent.css} !important;}${this._terminalSelector} .${g} .xterm-cursor.xterm-cursor-outline { outline: 1px solid ${e.cursor.css}; outline-offset: -1px;}${this._terminalSelector} .${g} .xterm-cursor.xterm-cursor-bar { box-shadow: ${this._optionsService.rawOptions.cursorWidth}px 0 0 ${e.cursor.css} inset;}${this._terminalSelector} .${g} .xterm-cursor.xterm-cursor-underline { border-bottom: 1px ${e.cursor.css}; border-bottom-style: solid; height: calc(100% - 1px);}`,t+=`${this._terminalSelector} .${b} { position: absolute; top: 0; left: 0; z-index: 1; pointer-events: none;}${this._terminalSelector}.focus .${b} div { position: absolute; background-color: ${e.selectionBackgroundOpaque.css};}${this._terminalSelector} .${b} div { position: absolute; background-color: ${e.selectionInactiveBackgroundOpaque.css};}`;for(let[n,r]of e.ansi.entries())t+=`${this._terminalSelector} .${_}${n} { color: ${r.css}; }${this._terminalSelector} .${_}${n}.xterm-dim { color: ${d.color.multiplyOpacity(r,.5).css}; }${this._terminalSelector} .${v}${n} { background-color: ${r.css}; }`;t+=`${this._terminalSelector} .${_}${s.INVERTED_DEFAULT_COLOR} { color: ${d.color.opaque(e.background).css}; }${this._terminalSelector} .${_}${s.INVERTED_DEFAULT_COLOR}.xterm-dim { color: ${d.color.multiplyOpacity(d.color.opaque(e.background),.5).css}; }${this._terminalSelector} .${v}${s.INVERTED_DEFAULT_COLOR} { background-color: ${e.foreground.css}; }`,this._themeStyleElement.textContent=t}_setDefaultSpacing(){let e=this.dimensions.css.cell.width-this._widthCache.get(`W`,!1,!1);this._rowContainer.style.letterSpacing=`${e}px`,this._rowFactory.defaultSpacing=e}handleDevicePixelRatioChange(){this._updateDimensions(),this._widthCache.clear(),this._setDefaultSpacing()}_refreshRowElements(e,t){for(let e=this._rowElements.length;e<=t;e++){let e=this._document.createElement(`div`);this._rowContainer.appendChild(e),this._rowElements.push(e)}for(;this._rowElements.length>t;)this._rowContainer.removeChild(this._rowElements.pop())}handleResize(e,t){this._refreshRowElements(e,t),this._updateDimensions(),this.handleSelectionChanged(this._selectionRenderModel.selectionStart,this._selectionRenderModel.selectionEnd,this._selectionRenderModel.columnSelectMode)}handleCharSizeChanged(){this._updateDimensions(),this._widthCache.clear(),this._setDefaultSpacing()}handleBlur(){this._rowContainer.classList.remove(y),this.renderRows(0,this._bufferService.rows-1)}handleFocus(){this._rowContainer.classList.add(y),this.renderRows(this._bufferService.buffer.y,this._bufferService.buffer.y)}handleSelectionChanged(e,t,n){if(this._selectionContainer.replaceChildren(),this._rowFactory.handleSelectionChanged(e,t,n),this.renderRows(0,this._bufferService.rows-1),!e||!t)return;this._selectionRenderModel.update(this._terminal,e,t,n);let r=this._selectionRenderModel.viewportStartRow,i=this._selectionRenderModel.viewportEndRow,a=this._selectionRenderModel.viewportCappedStartRow,o=this._selectionRenderModel.viewportCappedEndRow;if(a>=this._bufferService.rows||o<0)return;let s=this._document.createDocumentFragment();if(n){let n=e[0]>t[0];s.appendChild(this._createSelectionElement(a,n?t[0]:e[0],n?e[0]:t[0],o-a+1))}else{let n=r===a?e[0]:0,c=a===i?t[0]:this._bufferService.cols;s.appendChild(this._createSelectionElement(a,n,c));let l=o-a-1;if(s.appendChild(this._createSelectionElement(a+1,0,this._bufferService.cols,l)),a!==o){let e=i===o?t[0]:this._bufferService.cols;s.appendChild(this._createSelectionElement(o,0,e))}}this._selectionContainer.appendChild(s)}_createSelectionElement(e,t,n,r=1){let i=this._document.createElement(`div`),a=t*this.dimensions.css.cell.width,o=this.dimensions.css.cell.width*(n-t);return a+o>this.dimensions.css.canvas.width&&(o=this.dimensions.css.canvas.width-a),i.style.height=r*this.dimensions.css.cell.height+`px`,i.style.top=e*this.dimensions.css.cell.height+`px`,i.style.left=`${a}px`,i.style.width=`${o}px`,i}handleCursorMove(){}_handleOptionsChanged(){this._updateDimensions(),this._injectCss(this._themeService.colors),this._widthCache.setFont(this._optionsService.rawOptions.fontFamily,this._optionsService.rawOptions.fontSize,this._optionsService.rawOptions.fontWeight,this._optionsService.rawOptions.fontWeightBold),this._setDefaultSpacing()}clear(){for(let e of this._rowElements)e.replaceChildren()}renderRows(e,t){let n=this._bufferService.buffer,r=n.ybase+n.y,i=Math.min(n.x,this._bufferService.cols-1),a=this._optionsService.rawOptions.cursorBlink,o=this._optionsService.rawOptions.cursorStyle,s=this._optionsService.rawOptions.cursorInactiveStyle;for(let c=e;c<=t;c++){let e=c+n.ydisp,t=this._rowElements[c],l=n.lines.get(e);if(!t||!l)break;t.replaceChildren(...this._rowFactory.createRow(l,e,e===r,o,s,i,a,this.dimensions.css.cell.width,this._widthCache,-1,-1))}}get _terminalSelector(){return`.${h}${this._terminalClass}`}_handleLinkHover(e){this._setCellUnderline(e.x1,e.x2,e.y1,e.y2,e.cols,!0)}_handleLinkLeave(e){this._setCellUnderline(e.x1,e.x2,e.y1,e.y2,e.cols,!1)}_setCellUnderline(e,t,n,r,i,a){n<0&&(e=0),r<0&&(t=0);let o=this._bufferService.rows-1;n=Math.max(Math.min(n,o),0),r=Math.max(Math.min(r,o),0),i=Math.min(i,this._bufferService.cols);let s=this._bufferService.buffer,c=s.ybase+s.y,l=Math.min(s.x,i-1),u=this._optionsService.rawOptions.cursorBlink,d=this._optionsService.rawOptions.cursorStyle,f=this._optionsService.rawOptions.cursorInactiveStyle;for(let o=n;o<=r;++o){let p=o+s.ydisp,m=this._rowElements[o],h=s.lines.get(p);if(!m||!h)break;m.replaceChildren(...this._rowFactory.createRow(h,p,p===c,d,f,l,u,this.dimensions.css.cell.width,this._widthCache,a?o===n?e:0:-1,a?(o===r?t:i)-1:-1))}}};t.DomRenderer=S=r([i(7,m.IInstantiationService),i(8,u.ICharSizeService),i(9,m.IOptionsService),i(10,m.IBufferService),i(11,u.ICoreBrowserService),i(12,u.IThemeService)],S)},3787:function(e,t,n){var r=this&&this.__decorate||function(e,t,n,r){var i,a=arguments.length,o=a<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,n):r;if(typeof Reflect==`object`&&typeof Reflect.decorate==`function`)o=Reflect.decorate(e,t,n,r);else for(var s=e.length-1;s>=0;s--)(i=e[s])&&(o=(a<3?i(o):a>3?i(t,n,o):i(t,n))||o);return a>3&&o&&Object.defineProperty(t,n,o),o},i=this&&this.__param||function(e,t){return function(n,r){t(n,r,e)}};Object.defineProperty(t,"__esModule",{value:!0}),t.DomRendererRowFactory=void 0;let a=n(2223),o=n(643),s=n(511),c=n(2585),l=n(8055),u=n(4725),d=n(4269),f=n(6171),p=n(3734),m=t.DomRendererRowFactory=class{constructor(e,t,n,r,i,a,o){this._document=e,this._characterJoinerService=t,this._optionsService=n,this._coreBrowserService=r,this._coreService=i,this._decorationService=a,this._themeService=o,this._workCell=new s.CellData,this._columnSelectMode=!1,this.defaultSpacing=0}handleSelectionChanged(e,t,n){this._selectionStart=e,this._selectionEnd=t,this._columnSelectMode=n}createRow(e,t,n,r,i,s,c,u,f,m,g){let _=[],v=this._characterJoinerService.getJoinedCharacters(t),y=this._themeService.colors,b,x=e.getNoBgTrimmedLength();n&&x0&&M===v[0][0]){N=!0;let t=v.shift();F=new d.JoinedCellData(this._workCell,e.translateToString(!0,t[0],t[1]),t[1]-t[0]),P=t[1]-1,x=F.getWidth()}let I=this._isCellInSelection(M,t),te=n&&M===s,ne=ee&&M>=m&&M<=g,L=!1;this._decorationService.forEachDecorationAtCell(M,t,void 0,(e=>{L=!0}));let re=F.getChars()||o.WHITESPACE_CELL_CHAR;if(re===` `&&(F.isUnderline()||F.isOverline())&&(re=`\xA0`),A=x*u-f.get(re,F.isBold(),F.isItalic()),b){if(S&&(I&&k||!I&&!k&&F.bg===w)&&(I&&k&&y.selectionForeground||F.fg===T)&&F.extended.ext===E&&ne===D&&A===O&&!te&&!N&&!L){F.isInvisible()?C+=o.WHITESPACE_CELL_CHAR:C+=re,S++;continue}S&&(b.textContent=C),b=this._document.createElement(`span`),S=0,C=``}else b=this._document.createElement(`span`);if(w=F.bg,T=F.fg,E=F.extended.ext,D=ne,O=A,k=I,N&&s>=M&&s<=P&&(s=M),!this._coreService.isCursorHidden&&te&&this._coreService.isCursorInitialized){if(j.push(`xterm-cursor`),this._coreBrowserService.isFocused)c&&j.push(`xterm-cursor-blink`),j.push(r===`bar`?`xterm-cursor-bar`:r===`underline`?`xterm-cursor-underline`:`xterm-cursor-block`);else if(i)switch(i){case`outline`:j.push(`xterm-cursor-outline`);break;case`block`:j.push(`xterm-cursor-block`);break;case`bar`:j.push(`xterm-cursor-bar`);break;case`underline`:j.push(`xterm-cursor-underline`)}}if(F.isBold()&&j.push(`xterm-bold`),F.isItalic()&&j.push(`xterm-italic`),F.isDim()&&j.push(`xterm-dim`),C=F.isInvisible()?o.WHITESPACE_CELL_CHAR:F.getChars()||o.WHITESPACE_CELL_CHAR,F.isUnderline()&&(j.push(`xterm-underline-${F.extended.underlineStyle}`),C===` `&&(C=`\xA0`),!F.isUnderlineColorDefault()))if(F.isUnderlineColorRGB())b.style.textDecorationColor=`rgb(${p.AttributeData.toColorRGB(F.getUnderlineColor()).join(`,`)})`;else{let e=F.getUnderlineColor();this._optionsService.rawOptions.drawBoldTextInBrightColors&&F.isBold()&&e<8&&(e+=8),b.style.textDecorationColor=y.ansi[e].css}F.isOverline()&&(j.push(`xterm-overline`),C===` `&&(C=`\xA0`)),F.isStrikethrough()&&j.push(`xterm-strikethrough`),ne&&(b.style.textDecoration=`underline`);let R=F.getFgColor(),z=F.getFgColorMode(),B=F.getBgColor(),ie=F.getBgColorMode(),ae=!!F.isInverse();if(ae){let e=R;R=B,B=e;let t=z;z=ie,ie=t}let oe,se,ce,le=!1;switch(this._decorationService.forEachDecorationAtCell(M,t,void 0,(e=>{e.options.layer!==`top`&&le||(e.backgroundColorRGB&&(ie=50331648,B=e.backgroundColorRGB.rgba>>8&16777215,oe=e.backgroundColorRGB),e.foregroundColorRGB&&(z=50331648,R=e.foregroundColorRGB.rgba>>8&16777215,se=e.foregroundColorRGB),le=e.options.layer===`top`)})),!le&&I&&(oe=this._coreBrowserService.isFocused?y.selectionBackgroundOpaque:y.selectionInactiveBackgroundOpaque,B=oe.rgba>>8&16777215,ie=50331648,le=!0,y.selectionForeground&&(z=50331648,R=y.selectionForeground.rgba>>8&16777215,se=y.selectionForeground)),le&&j.push(`xterm-decoration-top`),ie){case 16777216:case 33554432:ce=y.ansi[B],j.push(`xterm-bg-${B}`);break;case 50331648:ce=l.channels.toColor(B>>16,B>>8&255,255&B),this._addStyle(b,`background-color:#${h((B>>>0).toString(16),`0`,6)}`);break;default:ae?(ce=y.foreground,j.push(`xterm-bg-${a.INVERTED_DEFAULT_COLOR}`)):ce=y.background}switch(oe||F.isDim()&&(oe=l.color.multiplyOpacity(ce,.5)),z){case 16777216:case 33554432:F.isBold()&&R<8&&this._optionsService.rawOptions.drawBoldTextInBrightColors&&(R+=8),this._applyMinimumContrast(b,ce,y.ansi[R],F,oe,void 0)||j.push(`xterm-fg-${R}`);break;case 50331648:let e=l.channels.toColor(R>>16&255,R>>8&255,255&R);this._applyMinimumContrast(b,ce,e,F,oe,se)||this._addStyle(b,`color:#${h(R.toString(16),`0`,6)}`);break;default:this._applyMinimumContrast(b,ce,y.foreground,F,oe,se)||ae&&j.push(`xterm-fg-${a.INVERTED_DEFAULT_COLOR}`)}j.length&&=(b.className=j.join(` `),0),te||N||L?b.textContent=C:S++,A!==this.defaultSpacing&&(b.style.letterSpacing=`${A}px`),_.push(b),M=P}return b&&S&&(b.textContent=C),_}_applyMinimumContrast(e,t,n,r,i,a){if(this._optionsService.rawOptions.minimumContrastRatio===1||(0,f.treatGlyphAsBackgroundColor)(r.getCode()))return!1;let o=this._getContrastCache(r),s;if(i||a||(s=o.getColor(t.rgba,n.rgba)),s===void 0){let e=this._optionsService.rawOptions.minimumContrastRatio/(r.isDim()?2:1);s=l.color.ensureContrastRatio(i||t,a||n,e),o.setColor((i||t).rgba,(a||n).rgba,s??null)}return!!s&&(this._addStyle(e,`color:${s.css}`),!0)}_getContrastCache(e){return e.isDim()?this._themeService.colors.halfContrastCache:this._themeService.colors.contrastCache}_addStyle(e,t){e.setAttribute(`style`,`${e.getAttribute(`style`)||``}${t};`)}_isCellInSelection(e,t){let n=this._selectionStart,r=this._selectionEnd;return!(!n||!r)&&(this._columnSelectMode?n[0]<=r[0]?e>=n[0]&&t>=n[1]&&e=n[1]&&e>=r[0]&&t<=r[1]:t>n[1]&&t=n[0]&&e=n[0])}};function h(e,t,n){for(;e.length{Object.defineProperty(t,"__esModule",{value:!0}),t.WidthCache=void 0,t.WidthCache=class{constructor(e,t){this._flat=new Float32Array(256),this._font=``,this._fontSize=0,this._weight=`normal`,this._weightBold=`bold`,this._measureElements=[],this._container=e.createElement(`div`),this._container.classList.add(`xterm-width-cache-measure-container`),this._container.setAttribute(`aria-hidden`,`true`),this._container.style.whiteSpace=`pre`,this._container.style.fontKerning=`none`;let n=e.createElement(`span`);n.classList.add(`xterm-char-measure-element`);let r=e.createElement(`span`);r.classList.add(`xterm-char-measure-element`),r.style.fontWeight=`bold`;let i=e.createElement(`span`);i.classList.add(`xterm-char-measure-element`),i.style.fontStyle=`italic`;let a=e.createElement(`span`);a.classList.add(`xterm-char-measure-element`),a.style.fontWeight=`bold`,a.style.fontStyle=`italic`,this._measureElements=[n,r,i,a],this._container.appendChild(n),this._container.appendChild(r),this._container.appendChild(i),this._container.appendChild(a),t.appendChild(this._container),this.clear()}dispose(){this._container.remove(),this._measureElements.length=0,this._holey=void 0}clear(){this._flat.fill(-9999),this._holey=new Map}setFont(e,t,n,r){e===this._font&&t===this._fontSize&&n===this._weight&&r===this._weightBold||(this._font=e,this._fontSize=t,this._weight=n,this._weightBold=r,this._container.style.fontFamily=this._font,this._container.style.fontSize=`${this._fontSize}px`,this._measureElements[0].style.fontWeight=`${n}`,this._measureElements[1].style.fontWeight=`${r}`,this._measureElements[2].style.fontWeight=`${n}`,this._measureElements[3].style.fontWeight=`${r}`,this.clear())}get(e,t,n){let r=0;if(!t&&!n&&e.length===1&&(r=e.charCodeAt(0))<256){if(this._flat[r]!==-9999)return this._flat[r];let t=this._measure(e,0);return t>0&&(this._flat[r]=t),t}let i=e;t&&(i+=`B`),n&&(i+=`I`);let a=this._holey.get(i);if(a===void 0){let r=0;t&&(r|=1),n&&(r|=2),a=this._measure(e,r),a>0&&this._holey.set(i,a)}return a}_measure(e,t){let n=this._measureElements[t];return n.textContent=e.repeat(32),n.offsetWidth/32}}},2223:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.TEXT_BASELINE=t.DIM_OPACITY=t.INVERTED_DEFAULT_COLOR=void 0;let r=n(6114);t.INVERTED_DEFAULT_COLOR=257,t.DIM_OPACITY=.5,t.TEXT_BASELINE=r.isFirefox||r.isLegacyEdge?`bottom`:`ideographic`},6171:(e,t)=>{function n(e){return 57508<=e&&e<=57558}function r(e){return e>=128512&&e<=128591||e>=127744&&e<=128511||e>=128640&&e<=128767||e>=9728&&e<=9983||e>=9984&&e<=10175||e>=65024&&e<=65039||e>=129280&&e<=129535||e>=127462&&e<=127487}Object.defineProperty(t,"__esModule",{value:!0}),t.computeNextVariantOffset=t.createRenderDimensions=t.treatGlyphAsBackgroundColor=t.allowRescaling=t.isEmoji=t.isRestrictedPowerlineGlyph=t.isPowerlineGlyph=t.throwIfFalsy=void 0,t.throwIfFalsy=function(e){if(!e)throw Error(`value must not be falsy`);return e},t.isPowerlineGlyph=n,t.isRestrictedPowerlineGlyph=function(e){return 57520<=e&&e<=57527},t.isEmoji=r,t.allowRescaling=function(e,t,i,a){return t===1&&i>Math.ceil(1.5*a)&&e!==void 0&&e>255&&!r(e)&&!n(e)&&!function(e){return 57344<=e&&e<=63743}(e)},t.treatGlyphAsBackgroundColor=function(e){return n(e)||function(e){return 9472<=e&&e<=9631}(e)},t.createRenderDimensions=function(){return{css:{canvas:{width:0,height:0},cell:{width:0,height:0}},device:{canvas:{width:0,height:0},cell:{width:0,height:0},char:{width:0,height:0,left:0,top:0}}}},t.computeNextVariantOffset=function(e,t,n=0){return(e-(2*Math.round(t)-n))%(2*Math.round(t))}},6052:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.createSelectionRenderModel=void 0;class n{constructor(){this.clear()}clear(){this.hasSelection=!1,this.columnSelectMode=!1,this.viewportStartRow=0,this.viewportEndRow=0,this.viewportCappedStartRow=0,this.viewportCappedEndRow=0,this.startCol=0,this.endCol=0,this.selectionStart=void 0,this.selectionEnd=void 0}update(e,t,n,r=!1){if(this.selectionStart=t,this.selectionEnd=n,!t||!n||t[0]===n[0]&&t[1]===n[1])return void this.clear();let i=e.buffers.active.ydisp,a=t[1]-i,o=n[1]-i,s=Math.max(a,0),c=Math.min(o,e.rows-1);s>=e.rows||c<0?this.clear():(this.hasSelection=!0,this.columnSelectMode=r,this.viewportStartRow=a,this.viewportEndRow=o,this.viewportCappedStartRow=s,this.viewportCappedEndRow=c,this.startCol=t[0],this.endCol=n[0])}isCellSelected(e,t,n){return!!this.hasSelection&&(n-=e.buffer.active.viewportY,this.columnSelectMode?this.startCol<=this.endCol?t>=this.startCol&&n>=this.viewportCappedStartRow&&t=this.viewportCappedStartRow&&t>=this.endCol&&n<=this.viewportCappedEndRow:n>this.viewportStartRow&&n=this.startCol&&t=this.startCol)}}t.createSelectionRenderModel=function(){return new n}},456:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.SelectionModel=void 0,t.SelectionModel=class{constructor(e){this._bufferService=e,this.isSelectAllActive=!1,this.selectionStartLength=0}clearSelection(){this.selectionStart=void 0,this.selectionEnd=void 0,this.isSelectAllActive=!1,this.selectionStartLength=0}get finalSelectionStart(){return this.isSelectAllActive?[0,0]:this.selectionEnd&&this.selectionStart&&this.areSelectionValuesReversed()?this.selectionEnd:this.selectionStart}get finalSelectionEnd(){if(this.isSelectAllActive)return[this._bufferService.cols,this._bufferService.buffer.ybase+this._bufferService.rows-1];if(this.selectionStart){if(!this.selectionEnd||this.areSelectionValuesReversed()){let e=this.selectionStart[0]+this.selectionStartLength;return e>this._bufferService.cols?e%this._bufferService.cols==0?[this._bufferService.cols,this.selectionStart[1]+Math.floor(e/this._bufferService.cols)-1]:[e%this._bufferService.cols,this.selectionStart[1]+Math.floor(e/this._bufferService.cols)]:[e,this.selectionStart[1]]}if(this.selectionStartLength&&this.selectionEnd[1]===this.selectionStart[1]){let e=this.selectionStart[0]+this.selectionStartLength;return e>this._bufferService.cols?[e%this._bufferService.cols,this.selectionStart[1]+Math.floor(e/this._bufferService.cols)]:[Math.max(e,this.selectionEnd[0]),this.selectionEnd[1]]}return this.selectionEnd}}areSelectionValuesReversed(){let e=this.selectionStart,t=this.selectionEnd;return!(!e||!t)&&(e[1]>t[1]||e[1]===t[1]&&e[0]>t[0])}handleTrim(e){return this.selectionStart&&(this.selectionStart[1]-=e),this.selectionEnd&&(this.selectionEnd[1]-=e),this.selectionEnd&&this.selectionEnd[1]<0?(this.clearSelection(),!0):(this.selectionStart&&this.selectionStart[1]<0&&(this.selectionStart[1]=0),!1)}}},428:function(e,t,n){var r=this&&this.__decorate||function(e,t,n,r){var i,a=arguments.length,o=a<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,n):r;if(typeof Reflect==`object`&&typeof Reflect.decorate==`function`)o=Reflect.decorate(e,t,n,r);else for(var s=e.length-1;s>=0;s--)(i=e[s])&&(o=(a<3?i(o):a>3?i(t,n,o):i(t,n))||o);return a>3&&o&&Object.defineProperty(t,n,o),o},i=this&&this.__param||function(e,t){return function(n,r){t(n,r,e)}};Object.defineProperty(t,"__esModule",{value:!0}),t.CharSizeService=void 0;let a=n(2585),o=n(8460),s=n(844),c=t.CharSizeService=class extends s.Disposable{get hasValidSize(){return this.width>0&&this.height>0}constructor(e,t,n){super(),this._optionsService=n,this.width=0,this.height=0,this._onCharSizeChange=this.register(new o.EventEmitter),this.onCharSizeChange=this._onCharSizeChange.event;try{this._measureStrategy=this.register(new d(this._optionsService))}catch{this._measureStrategy=this.register(new u(e,t,this._optionsService))}this.register(this._optionsService.onMultipleOptionChange([`fontFamily`,`fontSize`],(()=>this.measure())))}measure(){let e=this._measureStrategy.measure();e.width===this.width&&e.height===this.height||(this.width=e.width,this.height=e.height,this._onCharSizeChange.fire())}};t.CharSizeService=c=r([i(2,a.IOptionsService)],c);class l extends s.Disposable{constructor(){super(...arguments),this._result={width:0,height:0}}_validateAndSet(e,t){e!==void 0&&e>0&&t!==void 0&&t>0&&(this._result.width=e,this._result.height=t)}}class u extends l{constructor(e,t,n){super(),this._document=e,this._parentElement=t,this._optionsService=n,this._measureElement=this._document.createElement(`span`),this._measureElement.classList.add(`xterm-char-measure-element`),this._measureElement.textContent=`W`.repeat(32),this._measureElement.setAttribute(`aria-hidden`,`true`),this._measureElement.style.whiteSpace=`pre`,this._measureElement.style.fontKerning=`none`,this._parentElement.appendChild(this._measureElement)}measure(){return this._measureElement.style.fontFamily=this._optionsService.rawOptions.fontFamily,this._measureElement.style.fontSize=`${this._optionsService.rawOptions.fontSize}px`,this._validateAndSet(Number(this._measureElement.offsetWidth)/32,Number(this._measureElement.offsetHeight)),this._result}}class d extends l{constructor(e){super(),this._optionsService=e,this._canvas=new OffscreenCanvas(100,100),this._ctx=this._canvas.getContext(`2d`);let t=this._ctx.measureText(`W`);if(!(`width`in t&&`fontBoundingBoxAscent`in t&&`fontBoundingBoxDescent`in t))throw Error(`Required font metrics not supported`)}measure(){this._ctx.font=`${this._optionsService.rawOptions.fontSize}px ${this._optionsService.rawOptions.fontFamily}`;let e=this._ctx.measureText(`W`);return this._validateAndSet(e.width,e.fontBoundingBoxAscent+e.fontBoundingBoxDescent),this._result}}},4269:function(e,t,n){var r=this&&this.__decorate||function(e,t,n,r){var i,a=arguments.length,o=a<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,n):r;if(typeof Reflect==`object`&&typeof Reflect.decorate==`function`)o=Reflect.decorate(e,t,n,r);else for(var s=e.length-1;s>=0;s--)(i=e[s])&&(o=(a<3?i(o):a>3?i(t,n,o):i(t,n))||o);return a>3&&o&&Object.defineProperty(t,n,o),o},i=this&&this.__param||function(e,t){return function(n,r){t(n,r,e)}};Object.defineProperty(t,"__esModule",{value:!0}),t.CharacterJoinerService=t.JoinedCellData=void 0;let a=n(3734),o=n(643),s=n(511),c=n(2585);class l extends a.AttributeData{constructor(e,t,n){super(),this.content=0,this.combinedData=``,this.fg=e.fg,this.bg=e.bg,this.combinedData=t,this._width=n}isCombined(){return 2097152}getWidth(){return this._width}getChars(){return this.combinedData}getCode(){return 2097151}setFromCharData(e){throw Error(`not implemented`)}getAsCharData(){return[this.fg,this.getChars(),this.getWidth(),this.getCode()]}}t.JoinedCellData=l;let u=t.CharacterJoinerService=class e{constructor(e){this._bufferService=e,this._characterJoiners=[],this._nextCharacterJoinerId=0,this._workCell=new s.CellData}register(e){let t={id:this._nextCharacterJoinerId++,handler:e};return this._characterJoiners.push(t),t.id}deregister(e){for(let t=0;t1){let e=this._getJoinedRanges(r,s,a,t,i);for(let t=0;t1){let e=this._getJoinedRanges(r,s,a,t,i);for(let t=0;t{Object.defineProperty(t,"__esModule",{value:!0}),t.CoreBrowserService=void 0;let r=n(844),i=n(8460),a=n(3656);class o extends r.Disposable{constructor(e,t,n){super(),this._textarea=e,this._window=t,this.mainDocument=n,this._isFocused=!1,this._cachedIsFocused=void 0,this._screenDprMonitor=new s(this._window),this._onDprChange=this.register(new i.EventEmitter),this.onDprChange=this._onDprChange.event,this._onWindowChange=this.register(new i.EventEmitter),this.onWindowChange=this._onWindowChange.event,this.register(this.onWindowChange((e=>this._screenDprMonitor.setWindow(e)))),this.register((0,i.forwardEvent)(this._screenDprMonitor.onDprChange,this._onDprChange)),this._textarea.addEventListener(`focus`,(()=>this._isFocused=!0)),this._textarea.addEventListener(`blur`,(()=>this._isFocused=!1))}get window(){return this._window}set window(e){this._window!==e&&(this._window=e,this._onWindowChange.fire(this._window))}get dpr(){return this.window.devicePixelRatio}get isFocused(){return this._cachedIsFocused===void 0&&(this._cachedIsFocused=this._isFocused&&this._textarea.ownerDocument.hasFocus(),queueMicrotask((()=>this._cachedIsFocused=void 0))),this._cachedIsFocused}}t.CoreBrowserService=o;class s extends r.Disposable{constructor(e){super(),this._parentWindow=e,this._windowResizeListener=this.register(new r.MutableDisposable),this._onDprChange=this.register(new i.EventEmitter),this.onDprChange=this._onDprChange.event,this._outerListener=()=>this._setDprAndFireIfDiffers(),this._currentDevicePixelRatio=this._parentWindow.devicePixelRatio,this._updateDpr(),this._setWindowResizeListener(),this.register((0,r.toDisposable)((()=>this.clearListener())))}setWindow(e){this._parentWindow=e,this._setWindowResizeListener(),this._setDprAndFireIfDiffers()}_setWindowResizeListener(){this._windowResizeListener.value=(0,a.addDisposableDomListener)(this._parentWindow,`resize`,(()=>this._setDprAndFireIfDiffers()))}_setDprAndFireIfDiffers(){this._parentWindow.devicePixelRatio!==this._currentDevicePixelRatio&&this._onDprChange.fire(this._parentWindow.devicePixelRatio),this._updateDpr()}_updateDpr(){this._outerListener&&(this._resolutionMediaMatchList?.removeListener(this._outerListener),this._currentDevicePixelRatio=this._parentWindow.devicePixelRatio,this._resolutionMediaMatchList=this._parentWindow.matchMedia(`screen and (resolution: ${this._parentWindow.devicePixelRatio}dppx)`),this._resolutionMediaMatchList.addListener(this._outerListener))}clearListener(){this._resolutionMediaMatchList&&this._outerListener&&(this._resolutionMediaMatchList.removeListener(this._outerListener),this._resolutionMediaMatchList=void 0,this._outerListener=void 0)}}},779:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.LinkProviderService=void 0;let r=n(844);class i extends r.Disposable{constructor(){super(),this.linkProviders=[],this.register((0,r.toDisposable)((()=>this.linkProviders.length=0)))}registerLinkProvider(e){return this.linkProviders.push(e),{dispose:()=>{let t=this.linkProviders.indexOf(e);t!==-1&&this.linkProviders.splice(t,1)}}}}t.LinkProviderService=i},8934:function(e,t,n){var r=this&&this.__decorate||function(e,t,n,r){var i,a=arguments.length,o=a<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,n):r;if(typeof Reflect==`object`&&typeof Reflect.decorate==`function`)o=Reflect.decorate(e,t,n,r);else for(var s=e.length-1;s>=0;s--)(i=e[s])&&(o=(a<3?i(o):a>3?i(t,n,o):i(t,n))||o);return a>3&&o&&Object.defineProperty(t,n,o),o},i=this&&this.__param||function(e,t){return function(n,r){t(n,r,e)}};Object.defineProperty(t,"__esModule",{value:!0}),t.MouseService=void 0;let a=n(4725),o=n(9806),s=t.MouseService=class{constructor(e,t){this._renderService=e,this._charSizeService=t}getCoords(e,t,n,r,i){return(0,o.getCoords)(window,e,t,n,r,this._charSizeService.hasValidSize,this._renderService.dimensions.css.cell.width,this._renderService.dimensions.css.cell.height,i)}getMouseReportCoords(e,t){let n=(0,o.getCoordsRelativeToElement)(window,e,t);if(this._charSizeService.hasValidSize)return n[0]=Math.min(Math.max(n[0],0),this._renderService.dimensions.css.canvas.width-1),n[1]=Math.min(Math.max(n[1],0),this._renderService.dimensions.css.canvas.height-1),{col:Math.floor(n[0]/this._renderService.dimensions.css.cell.width),row:Math.floor(n[1]/this._renderService.dimensions.css.cell.height),x:Math.floor(n[0]),y:Math.floor(n[1])}}};t.MouseService=s=r([i(0,a.IRenderService),i(1,a.ICharSizeService)],s)},3230:function(e,t,n){var r=this&&this.__decorate||function(e,t,n,r){var i,a=arguments.length,o=a<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,n):r;if(typeof Reflect==`object`&&typeof Reflect.decorate==`function`)o=Reflect.decorate(e,t,n,r);else for(var s=e.length-1;s>=0;s--)(i=e[s])&&(o=(a<3?i(o):a>3?i(t,n,o):i(t,n))||o);return a>3&&o&&Object.defineProperty(t,n,o),o},i=this&&this.__param||function(e,t){return function(n,r){t(n,r,e)}};Object.defineProperty(t,"__esModule",{value:!0}),t.RenderService=void 0;let a=n(6193),o=n(4725),s=n(8460),c=n(844),l=n(7226),u=n(2585),d=t.RenderService=class extends c.Disposable{get dimensions(){return this._renderer.value.dimensions}constructor(e,t,n,r,i,o,u,d){super(),this._rowCount=e,this._charSizeService=r,this._renderer=this.register(new c.MutableDisposable),this._pausedResizeTask=new l.DebouncedIdleTask,this._observerDisposable=this.register(new c.MutableDisposable),this._isPaused=!1,this._needsFullRefresh=!1,this._isNextRenderRedrawOnly=!0,this._needsSelectionRefresh=!1,this._canvasWidth=0,this._canvasHeight=0,this._selectionState={start:void 0,end:void 0,columnSelectMode:!1},this._onDimensionsChange=this.register(new s.EventEmitter),this.onDimensionsChange=this._onDimensionsChange.event,this._onRenderedViewportChange=this.register(new s.EventEmitter),this.onRenderedViewportChange=this._onRenderedViewportChange.event,this._onRender=this.register(new s.EventEmitter),this.onRender=this._onRender.event,this._onRefreshRequest=this.register(new s.EventEmitter),this.onRefreshRequest=this._onRefreshRequest.event,this._renderDebouncer=new a.RenderDebouncer(((e,t)=>this._renderRows(e,t)),u),this.register(this._renderDebouncer),this.register(u.onDprChange((()=>this.handleDevicePixelRatioChange()))),this.register(o.onResize((()=>this._fullRefresh()))),this.register(o.buffers.onBufferActivate((()=>this._renderer.value?.clear()))),this.register(n.onOptionChange((()=>this._handleOptionsChanged()))),this.register(this._charSizeService.onCharSizeChange((()=>this.handleCharSizeChanged()))),this.register(i.onDecorationRegistered((()=>this._fullRefresh()))),this.register(i.onDecorationRemoved((()=>this._fullRefresh()))),this.register(n.onMultipleOptionChange([`customGlyphs`,`drawBoldTextInBrightColors`,`letterSpacing`,`lineHeight`,`fontFamily`,`fontSize`,`fontWeight`,`fontWeightBold`,`minimumContrastRatio`,`rescaleOverlappingGlyphs`],(()=>{this.clear(),this.handleResize(o.cols,o.rows),this._fullRefresh()}))),this.register(n.onMultipleOptionChange([`cursorBlink`,`cursorStyle`],(()=>this.refreshRows(o.buffer.y,o.buffer.y,!0)))),this.register(d.onChangeColors((()=>this._fullRefresh()))),this._registerIntersectionObserver(u.window,t),this.register(u.onWindowChange((e=>this._registerIntersectionObserver(e,t))))}_registerIntersectionObserver(e,t){if(`IntersectionObserver`in e){let n=new e.IntersectionObserver((e=>this._handleIntersectionChange(e[e.length-1])),{threshold:0});n.observe(t),this._observerDisposable.value=(0,c.toDisposable)((()=>n.disconnect()))}}_handleIntersectionChange(e){this._isPaused=e.isIntersecting===void 0?e.intersectionRatio===0:!e.isIntersecting,this._isPaused||this._charSizeService.hasValidSize||this._charSizeService.measure(),!this._isPaused&&this._needsFullRefresh&&(this._pausedResizeTask.flush(),this.refreshRows(0,this._rowCount-1),this._needsFullRefresh=!1)}refreshRows(e,t,n=!1){this._isPaused?this._needsFullRefresh=!0:(n||(this._isNextRenderRedrawOnly=!1),this._renderDebouncer.refresh(e,t,this._rowCount))}_renderRows(e,t){this._renderer.value&&(e=Math.min(e,this._rowCount-1),t=Math.min(t,this._rowCount-1),this._renderer.value.renderRows(e,t),this._needsSelectionRefresh&&=(this._renderer.value.handleSelectionChanged(this._selectionState.start,this._selectionState.end,this._selectionState.columnSelectMode),!1),this._isNextRenderRedrawOnly||this._onRenderedViewportChange.fire({start:e,end:t}),this._onRender.fire({start:e,end:t}),this._isNextRenderRedrawOnly=!0)}resize(e,t){this._rowCount=t,this._fireOnCanvasResize()}_handleOptionsChanged(){this._renderer.value&&(this.refreshRows(0,this._rowCount-1),this._fireOnCanvasResize())}_fireOnCanvasResize(){this._renderer.value&&(this._renderer.value.dimensions.css.canvas.width===this._canvasWidth&&this._renderer.value.dimensions.css.canvas.height===this._canvasHeight||this._onDimensionsChange.fire(this._renderer.value.dimensions))}hasRenderer(){return!!this._renderer.value}setRenderer(e){this._renderer.value=e,this._renderer.value&&(this._renderer.value.onRequestRedraw((e=>this.refreshRows(e.start,e.end,!0))),this._needsSelectionRefresh=!0,this._fullRefresh())}addRefreshCallback(e){return this._renderDebouncer.addRefreshCallback(e)}_fullRefresh(){this._isPaused?this._needsFullRefresh=!0:this.refreshRows(0,this._rowCount-1)}clearTextureAtlas(){this._renderer.value&&(this._renderer.value.clearTextureAtlas?.(),this._fullRefresh())}handleDevicePixelRatioChange(){this._charSizeService.measure(),this._renderer.value&&(this._renderer.value.handleDevicePixelRatioChange(),this.refreshRows(0,this._rowCount-1))}handleResize(e,t){this._renderer.value&&(this._isPaused?this._pausedResizeTask.set((()=>this._renderer.value?.handleResize(e,t))):this._renderer.value.handleResize(e,t),this._fullRefresh())}handleCharSizeChanged(){this._renderer.value?.handleCharSizeChanged()}handleBlur(){this._renderer.value?.handleBlur()}handleFocus(){this._renderer.value?.handleFocus()}handleSelectionChanged(e,t,n){this._selectionState.start=e,this._selectionState.end=t,this._selectionState.columnSelectMode=n,this._renderer.value?.handleSelectionChanged(e,t,n)}handleCursorMove(){this._renderer.value?.handleCursorMove()}clear(){this._renderer.value?.clear()}};t.RenderService=d=r([i(2,u.IOptionsService),i(3,o.ICharSizeService),i(4,u.IDecorationService),i(5,u.IBufferService),i(6,o.ICoreBrowserService),i(7,o.IThemeService)],d)},9312:function(e,t,n){var r=this&&this.__decorate||function(e,t,n,r){var i,a=arguments.length,o=a<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,n):r;if(typeof Reflect==`object`&&typeof Reflect.decorate==`function`)o=Reflect.decorate(e,t,n,r);else for(var s=e.length-1;s>=0;s--)(i=e[s])&&(o=(a<3?i(o):a>3?i(t,n,o):i(t,n))||o);return a>3&&o&&Object.defineProperty(t,n,o),o},i=this&&this.__param||function(e,t){return function(n,r){t(n,r,e)}};Object.defineProperty(t,"__esModule",{value:!0}),t.SelectionService=void 0;let a=n(9806),o=n(9504),s=n(456),c=n(4725),l=n(8460),u=n(844),d=n(6114),f=n(4841),p=n(511),m=n(2585),h=RegExp(`\xA0`,`g`),g=t.SelectionService=class extends u.Disposable{constructor(e,t,n,r,i,a,o,c,d){super(),this._element=e,this._screenElement=t,this._linkifier=n,this._bufferService=r,this._coreService=i,this._mouseService=a,this._optionsService=o,this._renderService=c,this._coreBrowserService=d,this._dragScrollAmount=0,this._enabled=!0,this._workCell=new p.CellData,this._mouseDownTimeStamp=0,this._oldHasSelection=!1,this._oldSelectionStart=void 0,this._oldSelectionEnd=void 0,this._onLinuxMouseSelection=this.register(new l.EventEmitter),this.onLinuxMouseSelection=this._onLinuxMouseSelection.event,this._onRedrawRequest=this.register(new l.EventEmitter),this.onRequestRedraw=this._onRedrawRequest.event,this._onSelectionChange=this.register(new l.EventEmitter),this.onSelectionChange=this._onSelectionChange.event,this._onRequestScrollLines=this.register(new l.EventEmitter),this.onRequestScrollLines=this._onRequestScrollLines.event,this._mouseMoveListener=e=>this._handleMouseMove(e),this._mouseUpListener=e=>this._handleMouseUp(e),this._coreService.onUserInput((()=>{this.hasSelection&&this.clearSelection()})),this._trimListener=this._bufferService.buffer.lines.onTrim((e=>this._handleTrim(e))),this.register(this._bufferService.buffers.onBufferActivate((e=>this._handleBufferActivate(e)))),this.enable(),this._model=new s.SelectionModel(this._bufferService),this._activeSelectionMode=0,this.register((0,u.toDisposable)((()=>{this._removeMouseDownListeners()})))}reset(){this.clearSelection()}disable(){this.clearSelection(),this._enabled=!1}enable(){this._enabled=!0}get selectionStart(){return this._model.finalSelectionStart}get selectionEnd(){return this._model.finalSelectionEnd}get hasSelection(){let e=this._model.finalSelectionStart,t=this._model.finalSelectionEnd;return!(!e||!t||e[0]===t[0]&&e[1]===t[1])}get selectionText(){let e=this._model.finalSelectionStart,t=this._model.finalSelectionEnd;if(!e||!t)return``;let n=this._bufferService.buffer,r=[];if(this._activeSelectionMode===3){if(e[0]===t[0])return``;let i=e[0]e.replace(h,` `))).join(d.isWindows?`\r -`:` -`)}clearSelection(){this._model.clearSelection(),this._removeMouseDownListeners(),this.refresh(),this._onSelectionChange.fire()}refresh(e){this._refreshAnimationFrame||=this._coreBrowserService.window.requestAnimationFrame((()=>this._refresh())),d.isLinux&&e&&this.selectionText.length&&this._onLinuxMouseSelection.fire(this.selectionText)}_refresh(){this._refreshAnimationFrame=void 0,this._onRedrawRequest.fire({start:this._model.finalSelectionStart,end:this._model.finalSelectionEnd,columnSelectMode:this._activeSelectionMode===3})}_isClickInSelection(e){let t=this._getMouseBufferCoords(e),n=this._model.finalSelectionStart,r=this._model.finalSelectionEnd;return!!(n&&r&&t)&&this._areCoordsInSelection(t,n,r)}isCellInSelection(e,t){let n=this._model.finalSelectionStart,r=this._model.finalSelectionEnd;return!(!n||!r)&&this._areCoordsInSelection([e,t],n,r)}_areCoordsInSelection(e,t,n){return e[1]>t[1]&&e[1]=t[0]&&e[0]=t[0]}_selectWordAtCursor(e,t){let n=this._linkifier.currentLink?.link?.range;if(n)return this._model.selectionStart=[n.start.x-1,n.start.y-1],this._model.selectionStartLength=(0,f.getRangeLength)(n,this._bufferService.cols),this._model.selectionEnd=void 0,!0;let r=this._getMouseBufferCoords(e);return!!r&&(this._selectWordAt(r,t),this._model.selectionEnd=void 0,!0)}selectAll(){this._model.isSelectAllActive=!0,this.refresh(),this._onSelectionChange.fire()}selectLines(e,t){this._model.clearSelection(),e=Math.max(e,0),t=Math.min(t,this._bufferService.buffer.lines.length-1),this._model.selectionStart=[0,e],this._model.selectionEnd=[this._bufferService.cols,t],this.refresh(),this._onSelectionChange.fire()}_handleTrim(e){this._model.handleTrim(e)&&this.refresh()}_getMouseBufferCoords(e){let t=this._mouseService.getCoords(e,this._screenElement,this._bufferService.cols,this._bufferService.rows,!0);if(t)return t[0]--,t[1]--,t[1]+=this._bufferService.buffer.ydisp,t}_getMouseEventScrollAmount(e){let t=(0,a.getCoordsRelativeToElement)(this._coreBrowserService.window,e,this._screenElement)[1],n=this._renderService.dimensions.css.canvas.height;return t>=0&&t<=n?0:(t>n&&(t-=n),t=Math.min(Math.max(t,-50),50),t/=50,t/Math.abs(t)+Math.round(14*t))}shouldForceSelection(e){return d.isMac?e.altKey&&this._optionsService.rawOptions.macOptionClickForcesSelection:e.shiftKey}handleMouseDown(e){if(this._mouseDownTimeStamp=e.timeStamp,(e.button!==2||!this.hasSelection)&&e.button===0){if(!this._enabled){if(!this.shouldForceSelection(e))return;e.stopPropagation()}e.preventDefault(),this._dragScrollAmount=0,this._enabled&&e.shiftKey?this._handleIncrementalClick(e):e.detail===1?this._handleSingleClick(e):e.detail===2?this._handleDoubleClick(e):e.detail===3&&this._handleTripleClick(e),this._addMouseDownListeners(),this.refresh(!0)}}_addMouseDownListeners(){this._screenElement.ownerDocument&&(this._screenElement.ownerDocument.addEventListener(`mousemove`,this._mouseMoveListener),this._screenElement.ownerDocument.addEventListener(`mouseup`,this._mouseUpListener)),this._dragScrollIntervalTimer=this._coreBrowserService.window.setInterval((()=>this._dragScroll()),50)}_removeMouseDownListeners(){this._screenElement.ownerDocument&&(this._screenElement.ownerDocument.removeEventListener(`mousemove`,this._mouseMoveListener),this._screenElement.ownerDocument.removeEventListener(`mouseup`,this._mouseUpListener)),this._coreBrowserService.window.clearInterval(this._dragScrollIntervalTimer),this._dragScrollIntervalTimer=void 0}_handleIncrementalClick(e){this._model.selectionStart&&(this._model.selectionEnd=this._getMouseBufferCoords(e))}_handleSingleClick(e){if(this._model.selectionStartLength=0,this._model.isSelectAllActive=!1,this._activeSelectionMode=this.shouldColumnSelect(e)?3:0,this._model.selectionStart=this._getMouseBufferCoords(e),!this._model.selectionStart)return;this._model.selectionEnd=void 0;let t=this._bufferService.buffer.lines.get(this._model.selectionStart[1]);t&&t.length!==this._model.selectionStart[0]&&t.hasWidth(this._model.selectionStart[0])===0&&this._model.selectionStart[0]++}_handleDoubleClick(e){this._selectWordAtCursor(e,!0)&&(this._activeSelectionMode=1)}_handleTripleClick(e){let t=this._getMouseBufferCoords(e);t&&(this._activeSelectionMode=2,this._selectLineAt(t[1]))}shouldColumnSelect(e){return e.altKey&&!(d.isMac&&this._optionsService.rawOptions.macOptionClickForcesSelection)}_handleMouseMove(e){if(e.stopImmediatePropagation(),!this._model.selectionStart)return;let t=this._model.selectionEnd?[this._model.selectionEnd[0],this._model.selectionEnd[1]]:null;if(this._model.selectionEnd=this._getMouseBufferCoords(e),!this._model.selectionEnd)return void this.refresh(!0);this._activeSelectionMode===2?this._model.selectionEnd[1]0?this._model.selectionEnd[0]=this._bufferService.cols:this._dragScrollAmount<0&&(this._model.selectionEnd[0]=0));let n=this._bufferService.buffer;if(this._model.selectionEnd[1]0?(this._activeSelectionMode!==3&&(this._model.selectionEnd[0]=this._bufferService.cols),this._model.selectionEnd[1]=Math.min(e.ydisp+this._bufferService.rows,e.lines.length-1)):(this._activeSelectionMode!==3&&(this._model.selectionEnd[0]=0),this._model.selectionEnd[1]=e.ydisp),this.refresh()}}_handleMouseUp(e){let t=e.timeStamp-this._mouseDownTimeStamp;if(this._removeMouseDownListeners(),this.selectionText.length<=1&&t<500&&e.altKey&&this._optionsService.rawOptions.altClickMovesCursor){if(this._bufferService.buffer.ybase===this._bufferService.buffer.ydisp){let t=this._mouseService.getCoords(e,this._element,this._bufferService.cols,this._bufferService.rows,!1);if(t&&t[0]!==void 0&&t[1]!==void 0){let e=(0,o.moveToCellSequence)(t[0]-1,t[1]-1,this._bufferService,this._coreService.decPrivateModes.applicationCursorKeys);this._coreService.triggerDataEvent(e,!0)}}}else this._fireEventIfSelectionChanged()}_fireEventIfSelectionChanged(){let e=this._model.finalSelectionStart,t=this._model.finalSelectionEnd,n=!(!e||!t||e[0]===t[0]&&e[1]===t[1]);n?e&&t&&(this._oldSelectionStart&&this._oldSelectionEnd&&e[0]===this._oldSelectionStart[0]&&e[1]===this._oldSelectionStart[1]&&t[0]===this._oldSelectionEnd[0]&&t[1]===this._oldSelectionEnd[1]||this._fireOnSelectionChange(e,t,n)):this._oldHasSelection&&this._fireOnSelectionChange(e,t,n)}_fireOnSelectionChange(e,t,n){this._oldSelectionStart=e,this._oldSelectionEnd=t,this._oldHasSelection=n,this._onSelectionChange.fire()}_handleBufferActivate(e){this.clearSelection(),this._trimListener.dispose(),this._trimListener=e.activeBuffer.lines.onTrim((e=>this._handleTrim(e)))}_convertViewportColToCharacterIndex(e,t){let n=t;for(let r=0;t>=r;r++){let i=e.loadCell(r,this._workCell).getChars().length;this._workCell.getWidth()===0?n--:i>1&&t!==r&&(n+=i-1)}return n}setSelection(e,t,n){this._model.clearSelection(),this._removeMouseDownListeners(),this._model.selectionStart=[e,t],this._model.selectionStartLength=n,this.refresh(),this._fireEventIfSelectionChanged()}rightClickSelect(e){this._isClickInSelection(e)||(this._selectWordAtCursor(e,!1)&&this.refresh(!0),this._fireEventIfSelectionChanged())}_getWordAt(e,t,n=!0,r=!0){if(e[0]>=this._bufferService.cols)return;let i=this._bufferService.buffer,a=i.lines.get(e[1]);if(!a)return;let o=i.translateBufferLineToString(e[1],!1),s=this._convertViewportColToCharacterIndex(a,e[0]),c=s,l=e[0]-s,u=0,d=0,f=0,p=0;if(o.charAt(s)===` `){for(;s>0&&o.charAt(s-1)===` `;)s--;for(;c1&&(p+=r-1,c+=r-1);t>0&&s>0&&!this._isCharWordSeparator(a.loadCell(t-1,this._workCell));){a.loadCell(t-1,this._workCell);let e=this._workCell.getChars().length;this._workCell.getWidth()===0?(u++,t--):e>1&&(f+=e-1,s-=e-1),s--,t--}for(;n1&&(p+=e-1,c+=e-1),c++,n++}}c++;let m=s+l-u+f,h=Math.min(this._bufferService.cols,c-s+u+d-f-p);if(t||o.slice(s,c).trim()!==``){if(n&&m===0&&a.getCodePoint(0)!==32){let t=i.lines.get(e[1]-1);if(t&&a.isWrapped&&t.getCodePoint(this._bufferService.cols-1)!==32){let t=this._getWordAt([this._bufferService.cols-1,e[1]-1],!1,!0,!1);if(t){let e=this._bufferService.cols-t.start;m-=e,h+=e}}}if(r&&m+h===this._bufferService.cols&&a.getCodePoint(this._bufferService.cols-1)!==32){let t=i.lines.get(e[1]+1);if(t?.isWrapped&&t.getCodePoint(0)!==32){let t=this._getWordAt([0,e[1]+1],!1,!1,!0);t&&(h+=t.length)}}return{start:m,length:h}}}_selectWordAt(e,t){let n=this._getWordAt(e,t);if(n){for(;n.start<0;)n.start+=this._bufferService.cols,e[1]--;this._model.selectionStart=[n.start,e[1]],this._model.selectionStartLength=n.length}}_selectToWordAt(e){let t=this._getWordAt(e,!0);if(t){let n=e[1];for(;t.start<0;)t.start+=this._bufferService.cols,n--;if(!this._model.areSelectionValuesReversed())for(;t.start+t.length>this._bufferService.cols;)t.length-=this._bufferService.cols,n++;this._model.selectionEnd=[this._model.areSelectionValuesReversed()?t.start:t.start+t.length,n]}}_isCharWordSeparator(e){return e.getWidth()!==0&&this._optionsService.rawOptions.wordSeparator.indexOf(e.getChars())>=0}_selectLineAt(e){let t=this._bufferService.buffer.getWrappedRangeForLine(e),n={start:{x:0,y:t.first},end:{x:this._bufferService.cols-1,y:t.last}};this._model.selectionStart=[0,t.first],this._model.selectionEnd=void 0,this._model.selectionStartLength=(0,f.getRangeLength)(n,this._bufferService.cols)}};t.SelectionService=g=r([i(3,m.IBufferService),i(4,m.ICoreService),i(5,c.IMouseService),i(6,m.IOptionsService),i(7,c.IRenderService),i(8,c.ICoreBrowserService)],g)},4725:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.ILinkProviderService=t.IThemeService=t.ICharacterJoinerService=t.ISelectionService=t.IRenderService=t.IMouseService=t.ICoreBrowserService=t.ICharSizeService=void 0;let r=n(8343);t.ICharSizeService=(0,r.createDecorator)(`CharSizeService`),t.ICoreBrowserService=(0,r.createDecorator)(`CoreBrowserService`),t.IMouseService=(0,r.createDecorator)(`MouseService`),t.IRenderService=(0,r.createDecorator)(`RenderService`),t.ISelectionService=(0,r.createDecorator)(`SelectionService`),t.ICharacterJoinerService=(0,r.createDecorator)(`CharacterJoinerService`),t.IThemeService=(0,r.createDecorator)(`ThemeService`),t.ILinkProviderService=(0,r.createDecorator)(`LinkProviderService`)},6731:function(e,t,n){var r=this&&this.__decorate||function(e,t,n,r){var i,a=arguments.length,o=a<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,n):r;if(typeof Reflect==`object`&&typeof Reflect.decorate==`function`)o=Reflect.decorate(e,t,n,r);else for(var s=e.length-1;s>=0;s--)(i=e[s])&&(o=(a<3?i(o):a>3?i(t,n,o):i(t,n))||o);return a>3&&o&&Object.defineProperty(t,n,o),o},i=this&&this.__param||function(e,t){return function(n,r){t(n,r,e)}};Object.defineProperty(t,"__esModule",{value:!0}),t.ThemeService=t.DEFAULT_ANSI_COLORS=void 0;let a=n(7239),o=n(8055),s=n(8460),c=n(844),l=n(2585),u=o.css.toColor(`#ffffff`),d=o.css.toColor(`#000000`),f=o.css.toColor(`#ffffff`),p=o.css.toColor(`#000000`),m={css:`rgba(255, 255, 255, 0.3)`,rgba:4294967117};t.DEFAULT_ANSI_COLORS=Object.freeze((()=>{let e=[o.css.toColor(`#2e3436`),o.css.toColor(`#cc0000`),o.css.toColor(`#4e9a06`),o.css.toColor(`#c4a000`),o.css.toColor(`#3465a4`),o.css.toColor(`#75507b`),o.css.toColor(`#06989a`),o.css.toColor(`#d3d7cf`),o.css.toColor(`#555753`),o.css.toColor(`#ef2929`),o.css.toColor(`#8ae234`),o.css.toColor(`#fce94f`),o.css.toColor(`#729fcf`),o.css.toColor(`#ad7fa8`),o.css.toColor(`#34e2e2`),o.css.toColor(`#eeeeec`)],t=[0,95,135,175,215,255];for(let n=0;n<216;n++){let r=t[n/36%6|0],i=t[n/6%6|0],a=t[n%6];e.push({css:o.channels.toCss(r,i,a),rgba:o.channels.toRgba(r,i,a)})}for(let t=0;t<24;t++){let n=8+10*t;e.push({css:o.channels.toCss(n,n,n),rgba:o.channels.toRgba(n,n,n)})}return e})());let h=t.ThemeService=class extends c.Disposable{get colors(){return this._colors}constructor(e){super(),this._optionsService=e,this._contrastCache=new a.ColorContrastCache,this._halfContrastCache=new a.ColorContrastCache,this._onChangeColors=this.register(new s.EventEmitter),this.onChangeColors=this._onChangeColors.event,this._colors={foreground:u,background:d,cursor:f,cursorAccent:p,selectionForeground:void 0,selectionBackgroundTransparent:m,selectionBackgroundOpaque:o.color.blend(d,m),selectionInactiveBackgroundTransparent:m,selectionInactiveBackgroundOpaque:o.color.blend(d,m),ansi:t.DEFAULT_ANSI_COLORS.slice(),contrastCache:this._contrastCache,halfContrastCache:this._halfContrastCache},this._updateRestoreColors(),this._setTheme(this._optionsService.rawOptions.theme),this.register(this._optionsService.onSpecificOptionChange(`minimumContrastRatio`,(()=>this._contrastCache.clear()))),this.register(this._optionsService.onSpecificOptionChange(`theme`,(()=>this._setTheme(this._optionsService.rawOptions.theme))))}_setTheme(e={}){let n=this._colors;if(n.foreground=g(e.foreground,u),n.background=g(e.background,d),n.cursor=g(e.cursor,f),n.cursorAccent=g(e.cursorAccent,p),n.selectionBackgroundTransparent=g(e.selectionBackground,m),n.selectionBackgroundOpaque=o.color.blend(n.background,n.selectionBackgroundTransparent),n.selectionInactiveBackgroundTransparent=g(e.selectionInactiveBackground,n.selectionBackgroundTransparent),n.selectionInactiveBackgroundOpaque=o.color.blend(n.background,n.selectionInactiveBackgroundTransparent),n.selectionForeground=e.selectionForeground?g(e.selectionForeground,o.NULL_COLOR):void 0,n.selectionForeground===o.NULL_COLOR&&(n.selectionForeground=void 0),o.color.isOpaque(n.selectionBackgroundTransparent)&&(n.selectionBackgroundTransparent=o.color.opacity(n.selectionBackgroundTransparent,.3)),o.color.isOpaque(n.selectionInactiveBackgroundTransparent)&&(n.selectionInactiveBackgroundTransparent=o.color.opacity(n.selectionInactiveBackgroundTransparent,.3)),n.ansi=t.DEFAULT_ANSI_COLORS.slice(),n.ansi[0]=g(e.black,t.DEFAULT_ANSI_COLORS[0]),n.ansi[1]=g(e.red,t.DEFAULT_ANSI_COLORS[1]),n.ansi[2]=g(e.green,t.DEFAULT_ANSI_COLORS[2]),n.ansi[3]=g(e.yellow,t.DEFAULT_ANSI_COLORS[3]),n.ansi[4]=g(e.blue,t.DEFAULT_ANSI_COLORS[4]),n.ansi[5]=g(e.magenta,t.DEFAULT_ANSI_COLORS[5]),n.ansi[6]=g(e.cyan,t.DEFAULT_ANSI_COLORS[6]),n.ansi[7]=g(e.white,t.DEFAULT_ANSI_COLORS[7]),n.ansi[8]=g(e.brightBlack,t.DEFAULT_ANSI_COLORS[8]),n.ansi[9]=g(e.brightRed,t.DEFAULT_ANSI_COLORS[9]),n.ansi[10]=g(e.brightGreen,t.DEFAULT_ANSI_COLORS[10]),n.ansi[11]=g(e.brightYellow,t.DEFAULT_ANSI_COLORS[11]),n.ansi[12]=g(e.brightBlue,t.DEFAULT_ANSI_COLORS[12]),n.ansi[13]=g(e.brightMagenta,t.DEFAULT_ANSI_COLORS[13]),n.ansi[14]=g(e.brightCyan,t.DEFAULT_ANSI_COLORS[14]),n.ansi[15]=g(e.brightWhite,t.DEFAULT_ANSI_COLORS[15]),e.extendedAnsi){let r=Math.min(n.ansi.length-16,e.extendedAnsi.length);for(let i=0;i{Object.defineProperty(t,"__esModule",{value:!0}),t.CircularList=void 0;let r=n(8460),i=n(844);class a extends i.Disposable{constructor(e){super(),this._maxLength=e,this.onDeleteEmitter=this.register(new r.EventEmitter),this.onDelete=this.onDeleteEmitter.event,this.onInsertEmitter=this.register(new r.EventEmitter),this.onInsert=this.onInsertEmitter.event,this.onTrimEmitter=this.register(new r.EventEmitter),this.onTrim=this.onTrimEmitter.event,this._array=Array(this._maxLength),this._startIndex=0,this._length=0}get maxLength(){return this._maxLength}set maxLength(e){if(this._maxLength===e)return;let t=Array(e);for(let n=0;nthis._length)for(let t=this._length;t=e;t--)this._array[this._getCyclicIndex(t+n.length)]=this._array[this._getCyclicIndex(t)];for(let t=0;tthis._maxLength){let e=this._length+n.length-this._maxLength;this._startIndex+=e,this._length=this._maxLength,this.onTrimEmitter.fire(e)}else this._length+=n.length}trimStart(e){e>this._length&&(e=this._length),this._startIndex+=e,this._length-=e,this.onTrimEmitter.fire(e)}shiftElements(e,t,n){if(!(t<=0)){if(e<0||e>=this._length)throw Error(`start argument out of range`);if(e+n<0)throw Error(`Cannot shift elements in list beyond index 0`);if(n>0){for(let r=t-1;r>=0;r--)this.set(e+r+n,this.get(e+r));let r=e+t+n-this._length;if(r>0)for(this._length+=r;this._length>this._maxLength;)this._length--,this._startIndex++,this.onTrimEmitter.fire(1)}else for(let r=0;r{Object.defineProperty(t,"__esModule",{value:!0}),t.clone=void 0,t.clone=function e(t,n=5){if(typeof t!=`object`)return t;let r=Array.isArray(t)?[]:{};for(let i in t)r[i]=n<=1?t[i]:t[i]&&e(t[i],n-1);return r}},8055:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.contrastRatio=t.toPaddedHex=t.rgba=t.rgb=t.css=t.color=t.channels=t.NULL_COLOR=void 0;let n=0,r=0,i=0,a=0;var o,s,c,l,u;function d(e){let t=e.toString(16);return t.length<2?`0`+t:t}function f(e,t){return e>>0},e.toColor=function(t,n,r,i){return{css:e.toCss(t,n,r,i),rgba:e.toRgba(t,n,r,i)}}}(o||(t.channels=o={})),function(e){function t(e,t){return a=Math.round(255*t),[n,r,i]=u.toChannels(e.rgba),{css:o.toCss(n,r,i,a),rgba:o.toRgba(n,r,i,a)}}e.blend=function(e,t){if(a=(255&t.rgba)/255,a===1)return{css:t.css,rgba:t.rgba};let s=t.rgba>>24&255,c=t.rgba>>16&255,l=t.rgba>>8&255,u=e.rgba>>24&255,d=e.rgba>>16&255,f=e.rgba>>8&255;return n=u+Math.round((s-u)*a),r=d+Math.round((c-d)*a),i=f+Math.round((l-f)*a),{css:o.toCss(n,r,i),rgba:o.toRgba(n,r,i)}},e.isOpaque=function(e){return(255&e.rgba)==255},e.ensureContrastRatio=function(e,t,n){let r=u.ensureContrastRatio(e.rgba,t.rgba,n);if(r)return o.toColor(r>>24&255,r>>16&255,r>>8&255)},e.opaque=function(e){let t=(255|e.rgba)>>>0;return[n,r,i]=u.toChannels(t),{css:o.toCss(n,r,i),rgba:t}},e.opacity=t,e.multiplyOpacity=function(e,n){return a=255&e.rgba,t(e,a*n/255)},e.toColorRGB=function(e){return[e.rgba>>24&255,e.rgba>>16&255,e.rgba>>8&255]}}(s||(t.color=s={})),function(e){let t,s;try{let e=document.createElement(`canvas`);e.width=1,e.height=1;let n=e.getContext(`2d`,{willReadFrequently:!0});n&&(t=n,t.globalCompositeOperation=`copy`,s=t.createLinearGradient(0,0,1,1))}catch{}e.toColor=function(e){if(e.match(/#[\da-f]{3,8}/i))switch(e.length){case 4:return n=parseInt(e.slice(1,2).repeat(2),16),r=parseInt(e.slice(2,3).repeat(2),16),i=parseInt(e.slice(3,4).repeat(2),16),o.toColor(n,r,i);case 5:return n=parseInt(e.slice(1,2).repeat(2),16),r=parseInt(e.slice(2,3).repeat(2),16),i=parseInt(e.slice(3,4).repeat(2),16),a=parseInt(e.slice(4,5).repeat(2),16),o.toColor(n,r,i,a);case 7:return{css:e,rgba:(parseInt(e.slice(1),16)<<8|255)>>>0};case 9:return{css:e,rgba:parseInt(e.slice(1),16)>>>0}}let c=e.match(/rgba?\(\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(\d{1,3})\s*(,\s*(0|1|\d?\.(\d+))\s*)?\)/);if(c)return n=parseInt(c[1]),r=parseInt(c[2]),i=parseInt(c[3]),a=Math.round(255*(c[5]===void 0?1:parseFloat(c[5]))),o.toColor(n,r,i,a);if(!t||!s||(t.fillStyle=s,t.fillStyle=e,typeof t.fillStyle!=`string`)||(t.fillRect(0,0,1,1),[n,r,i,a]=t.getImageData(0,0,1,1).data,a!==255))throw Error(`css.toColor: Unsupported css format`);return{rgba:o.toRgba(n,r,i,a),css:e}}}(c||(t.css=c={})),function(e){function t(e,t,n){let r=e/255,i=t/255,a=n/255;return .2126*(r<=.03928?r/12.92:((r+.055)/1.055)**2.4)+.7152*(i<=.03928?i/12.92:((i+.055)/1.055)**2.4)+.0722*(a<=.03928?a/12.92:((a+.055)/1.055)**2.4)}e.relativeLuminance=function(e){return t(e>>16&255,e>>8&255,255&e)},e.relativeLuminance2=t}(l||(t.rgb=l={})),function(e){function t(e,t,n){let r=e>>24&255,i=e>>16&255,a=e>>8&255,o=t>>24&255,s=t>>16&255,c=t>>8&255,u=f(l.relativeLuminance2(o,s,c),l.relativeLuminance2(r,i,a));for(;u0||s>0||c>0);)o-=Math.max(0,Math.ceil(.1*o)),s-=Math.max(0,Math.ceil(.1*s)),c-=Math.max(0,Math.ceil(.1*c)),u=f(l.relativeLuminance2(o,s,c),l.relativeLuminance2(r,i,a));return(o<<24|s<<16|c<<8|255)>>>0}function s(e,t,n){let r=e>>24&255,i=e>>16&255,a=e>>8&255,o=t>>24&255,s=t>>16&255,c=t>>8&255,u=f(l.relativeLuminance2(o,s,c),l.relativeLuminance2(r,i,a));for(;u>>0}e.blend=function(e,t){if(a=(255&t)/255,a===1)return t;let s=t>>24&255,c=t>>16&255,l=t>>8&255,u=e>>24&255,d=e>>16&255,f=e>>8&255;return n=u+Math.round((s-u)*a),r=d+Math.round((c-d)*a),i=f+Math.round((l-f)*a),o.toRgba(n,r,i)},e.ensureContrastRatio=function(e,n,r){let i=l.relativeLuminance(e>>8),a=l.relativeLuminance(n>>8);if(f(i,a)>8));if(of(i,l.relativeLuminance(t>>8))?a:t}return a}let o=s(e,n,r),c=f(i,l.relativeLuminance(o>>8));if(cf(i,l.relativeLuminance(a>>8))?o:a}return o}},e.reduceLuminance=t,e.increaseLuminance=s,e.toChannels=function(e){return[e>>24&255,e>>16&255,e>>8&255,255&e]}}(u||(t.rgba=u={})),t.toPaddedHex=d,t.contrastRatio=f},8969:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.CoreTerminal=void 0;let r=n(844),i=n(2585),a=n(4348),o=n(7866),s=n(744),c=n(7302),l=n(6975),u=n(8460),d=n(1753),f=n(1480),p=n(7994),m=n(9282),h=n(5435),g=n(5981),_=n(2660),v=!1;class y extends r.Disposable{get onScroll(){return this._onScrollApi||(this._onScrollApi=this.register(new u.EventEmitter),this._onScroll.event((e=>{this._onScrollApi?.fire(e.position)}))),this._onScrollApi.event}get cols(){return this._bufferService.cols}get rows(){return this._bufferService.rows}get buffers(){return this._bufferService.buffers}get options(){return this.optionsService.options}set options(e){for(let t in e)this.optionsService.options[t]=e[t]}constructor(e){super(),this._windowsWrappingHeuristics=this.register(new r.MutableDisposable),this._onBinary=this.register(new u.EventEmitter),this.onBinary=this._onBinary.event,this._onData=this.register(new u.EventEmitter),this.onData=this._onData.event,this._onLineFeed=this.register(new u.EventEmitter),this.onLineFeed=this._onLineFeed.event,this._onResize=this.register(new u.EventEmitter),this.onResize=this._onResize.event,this._onWriteParsed=this.register(new u.EventEmitter),this.onWriteParsed=this._onWriteParsed.event,this._onScroll=this.register(new u.EventEmitter),this._instantiationService=new a.InstantiationService,this.optionsService=this.register(new c.OptionsService(e)),this._instantiationService.setService(i.IOptionsService,this.optionsService),this._bufferService=this.register(this._instantiationService.createInstance(s.BufferService)),this._instantiationService.setService(i.IBufferService,this._bufferService),this._logService=this.register(this._instantiationService.createInstance(o.LogService)),this._instantiationService.setService(i.ILogService,this._logService),this.coreService=this.register(this._instantiationService.createInstance(l.CoreService)),this._instantiationService.setService(i.ICoreService,this.coreService),this.coreMouseService=this.register(this._instantiationService.createInstance(d.CoreMouseService)),this._instantiationService.setService(i.ICoreMouseService,this.coreMouseService),this.unicodeService=this.register(this._instantiationService.createInstance(f.UnicodeService)),this._instantiationService.setService(i.IUnicodeService,this.unicodeService),this._charsetService=this._instantiationService.createInstance(p.CharsetService),this._instantiationService.setService(i.ICharsetService,this._charsetService),this._oscLinkService=this._instantiationService.createInstance(_.OscLinkService),this._instantiationService.setService(i.IOscLinkService,this._oscLinkService),this._inputHandler=this.register(new h.InputHandler(this._bufferService,this._charsetService,this.coreService,this._logService,this.optionsService,this._oscLinkService,this.coreMouseService,this.unicodeService)),this.register((0,u.forwardEvent)(this._inputHandler.onLineFeed,this._onLineFeed)),this.register(this._inputHandler),this.register((0,u.forwardEvent)(this._bufferService.onResize,this._onResize)),this.register((0,u.forwardEvent)(this.coreService.onData,this._onData)),this.register((0,u.forwardEvent)(this.coreService.onBinary,this._onBinary)),this.register(this.coreService.onRequestScrollToBottom((()=>this.scrollToBottom()))),this.register(this.coreService.onUserInput((()=>this._writeBuffer.handleUserInput()))),this.register(this.optionsService.onMultipleOptionChange([`windowsMode`,`windowsPty`],(()=>this._handleWindowsPtyOptionChange()))),this.register(this._bufferService.onScroll((e=>{this._onScroll.fire({position:this._bufferService.buffer.ydisp,source:0}),this._inputHandler.markRangeDirty(this._bufferService.buffer.scrollTop,this._bufferService.buffer.scrollBottom)}))),this.register(this._inputHandler.onScroll((e=>{this._onScroll.fire({position:this._bufferService.buffer.ydisp,source:0}),this._inputHandler.markRangeDirty(this._bufferService.buffer.scrollTop,this._bufferService.buffer.scrollBottom)}))),this._writeBuffer=this.register(new g.WriteBuffer(((e,t)=>this._inputHandler.parse(e,t)))),this.register((0,u.forwardEvent)(this._writeBuffer.onWriteParsed,this._onWriteParsed))}write(e,t){this._writeBuffer.write(e,t)}writeSync(e,t){this._logService.logLevel<=i.LogLevelEnum.WARN&&!v&&(this._logService.warn(`writeSync is unreliable and will be removed soon.`),v=!0),this._writeBuffer.writeSync(e,t)}input(e,t=!0){this.coreService.triggerDataEvent(e,t)}resize(e,t){isNaN(e)||isNaN(t)||(e=Math.max(e,s.MINIMUM_COLS),t=Math.max(t,s.MINIMUM_ROWS),this._bufferService.resize(e,t))}scroll(e,t=!1){this._bufferService.scroll(e,t)}scrollLines(e,t,n){this._bufferService.scrollLines(e,t,n)}scrollPages(e){this.scrollLines(e*(this.rows-1))}scrollToTop(){this.scrollLines(-this._bufferService.buffer.ydisp)}scrollToBottom(){this.scrollLines(this._bufferService.buffer.ybase-this._bufferService.buffer.ydisp)}scrollToLine(e){let t=e-this._bufferService.buffer.ydisp;t!==0&&this.scrollLines(t)}registerEscHandler(e,t){return this._inputHandler.registerEscHandler(e,t)}registerDcsHandler(e,t){return this._inputHandler.registerDcsHandler(e,t)}registerCsiHandler(e,t){return this._inputHandler.registerCsiHandler(e,t)}registerOscHandler(e,t){return this._inputHandler.registerOscHandler(e,t)}_setup(){this._handleWindowsPtyOptionChange()}reset(){this._inputHandler.reset(),this._bufferService.reset(),this._charsetService.reset(),this.coreService.reset(),this.coreMouseService.reset()}_handleWindowsPtyOptionChange(){let e=!1,t=this.optionsService.rawOptions.windowsPty;t&&t.buildNumber!==void 0&&t.buildNumber!==void 0?e=t.backend===`conpty`&&t.buildNumber<21376:this.optionsService.rawOptions.windowsMode&&(e=!0),e?this._enableWindowsWrappingHeuristics():this._windowsWrappingHeuristics.clear()}_enableWindowsWrappingHeuristics(){if(!this._windowsWrappingHeuristics.value){let e=[];e.push(this.onLineFeed(m.updateWindowsModeWrappedState.bind(null,this._bufferService))),e.push(this.registerCsiHandler({final:`H`},(()=>((0,m.updateWindowsModeWrappedState)(this._bufferService),!1)))),this._windowsWrappingHeuristics.value=(0,r.toDisposable)((()=>{for(let t of e)t.dispose()}))}}}t.CoreTerminal=y},8460:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.runAndSubscribe=t.forwardEvent=t.EventEmitter=void 0,t.EventEmitter=class{constructor(){this._listeners=[],this._disposed=!1}get event(){return this._event||=e=>(this._listeners.push(e),{dispose:()=>{if(!this._disposed){for(let t=0;tt.fire(e)))},t.runAndSubscribe=function(e,t){return t(void 0),e((e=>t(e)))}},5435:function(e,t,n){var r=this&&this.__decorate||function(e,t,n,r){var i,a=arguments.length,o=a<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,n):r;if(typeof Reflect==`object`&&typeof Reflect.decorate==`function`)o=Reflect.decorate(e,t,n,r);else for(var s=e.length-1;s>=0;s--)(i=e[s])&&(o=(a<3?i(o):a>3?i(t,n,o):i(t,n))||o);return a>3&&o&&Object.defineProperty(t,n,o),o},i=this&&this.__param||function(e,t){return function(n,r){t(n,r,e)}};Object.defineProperty(t,"__esModule",{value:!0}),t.InputHandler=t.WindowsOptionsReportType=void 0;let a=n(2584),o=n(7116),s=n(2015),c=n(844),l=n(482),u=n(8437),d=n(8460),f=n(643),p=n(511),m=n(3734),h=n(2585),g=n(1480),_=n(6242),v=n(6351),y=n(5941),b={"(":0,")":1,"*":2,"+":3,"-":1,".":2},x=131072;function S(e,t){if(e>24)return t.setWinLines||!1;switch(e){case 1:return!!t.restoreWin;case 2:return!!t.minimizeWin;case 3:return!!t.setWinPosition;case 4:return!!t.setWinSizePixels;case 5:return!!t.raiseWin;case 6:return!!t.lowerWin;case 7:return!!t.refreshWin;case 8:return!!t.setWinSizeChars;case 9:return!!t.maximizeWin;case 10:return!!t.fullscreenWin;case 11:return!!t.getWinState;case 13:return!!t.getWinPosition;case 14:return!!t.getWinSizePixels;case 15:return!!t.getScreenSizePixels;case 16:return!!t.getCellSizePixels;case 18:return!!t.getWinSizeChars;case 19:return!!t.getScreenSizeChars;case 20:return!!t.getIconTitle;case 21:return!!t.getWinTitle;case 22:return!!t.pushTitle;case 23:return!!t.popTitle;case 24:return!!t.setWinLines}return!1}var C;(function(e){e[e.GET_WIN_SIZE_PIXELS=0]=`GET_WIN_SIZE_PIXELS`,e[e.GET_CELL_SIZE_PIXELS=1]=`GET_CELL_SIZE_PIXELS`})(C||(t.WindowsOptionsReportType=C={}));let w=0;class T extends c.Disposable{getAttrData(){return this._curAttrData}constructor(e,t,n,r,i,c,f,m,h=new s.EscapeSequenceParser){super(),this._bufferService=e,this._charsetService=t,this._coreService=n,this._logService=r,this._optionsService=i,this._oscLinkService=c,this._coreMouseService=f,this._unicodeService=m,this._parser=h,this._parseBuffer=new Uint32Array(4096),this._stringDecoder=new l.StringToUtf32,this._utf8Decoder=new l.Utf8ToUtf32,this._workCell=new p.CellData,this._windowTitle=``,this._iconName=``,this._windowTitleStack=[],this._iconNameStack=[],this._curAttrData=u.DEFAULT_ATTR_DATA.clone(),this._eraseAttrDataInternal=u.DEFAULT_ATTR_DATA.clone(),this._onRequestBell=this.register(new d.EventEmitter),this.onRequestBell=this._onRequestBell.event,this._onRequestRefreshRows=this.register(new d.EventEmitter),this.onRequestRefreshRows=this._onRequestRefreshRows.event,this._onRequestReset=this.register(new d.EventEmitter),this.onRequestReset=this._onRequestReset.event,this._onRequestSendFocus=this.register(new d.EventEmitter),this.onRequestSendFocus=this._onRequestSendFocus.event,this._onRequestSyncScrollBar=this.register(new d.EventEmitter),this.onRequestSyncScrollBar=this._onRequestSyncScrollBar.event,this._onRequestWindowsOptionsReport=this.register(new d.EventEmitter),this.onRequestWindowsOptionsReport=this._onRequestWindowsOptionsReport.event,this._onA11yChar=this.register(new d.EventEmitter),this.onA11yChar=this._onA11yChar.event,this._onA11yTab=this.register(new d.EventEmitter),this.onA11yTab=this._onA11yTab.event,this._onCursorMove=this.register(new d.EventEmitter),this.onCursorMove=this._onCursorMove.event,this._onLineFeed=this.register(new d.EventEmitter),this.onLineFeed=this._onLineFeed.event,this._onScroll=this.register(new d.EventEmitter),this.onScroll=this._onScroll.event,this._onTitleChange=this.register(new d.EventEmitter),this.onTitleChange=this._onTitleChange.event,this._onColor=this.register(new d.EventEmitter),this.onColor=this._onColor.event,this._parseStack={paused:!1,cursorStartX:0,cursorStartY:0,decodedLength:0,position:0},this._specialColors=[256,257,258],this.register(this._parser),this._dirtyRowTracker=new E(this._bufferService),this._activeBuffer=this._bufferService.buffer,this.register(this._bufferService.buffers.onBufferActivate((e=>this._activeBuffer=e.activeBuffer))),this._parser.setCsiHandlerFallback(((e,t)=>{this._logService.debug(`Unknown CSI code: `,{identifier:this._parser.identToString(e),params:t.toArray()})})),this._parser.setEscHandlerFallback((e=>{this._logService.debug(`Unknown ESC code: `,{identifier:this._parser.identToString(e)})})),this._parser.setExecuteHandlerFallback((e=>{this._logService.debug(`Unknown EXECUTE code: `,{code:e})})),this._parser.setOscHandlerFallback(((e,t,n)=>{this._logService.debug(`Unknown OSC code: `,{identifier:e,action:t,data:n})})),this._parser.setDcsHandlerFallback(((e,t,n)=>{t===`HOOK`&&(n=n.toArray()),this._logService.debug(`Unknown DCS code: `,{identifier:this._parser.identToString(e),action:t,payload:n})})),this._parser.setPrintHandler(((e,t,n)=>this.print(e,t,n))),this._parser.registerCsiHandler({final:`@`},(e=>this.insertChars(e))),this._parser.registerCsiHandler({intermediates:` `,final:`@`},(e=>this.scrollLeft(e))),this._parser.registerCsiHandler({final:`A`},(e=>this.cursorUp(e))),this._parser.registerCsiHandler({intermediates:` `,final:`A`},(e=>this.scrollRight(e))),this._parser.registerCsiHandler({final:`B`},(e=>this.cursorDown(e))),this._parser.registerCsiHandler({final:`C`},(e=>this.cursorForward(e))),this._parser.registerCsiHandler({final:`D`},(e=>this.cursorBackward(e))),this._parser.registerCsiHandler({final:`E`},(e=>this.cursorNextLine(e))),this._parser.registerCsiHandler({final:`F`},(e=>this.cursorPrecedingLine(e))),this._parser.registerCsiHandler({final:`G`},(e=>this.cursorCharAbsolute(e))),this._parser.registerCsiHandler({final:`H`},(e=>this.cursorPosition(e))),this._parser.registerCsiHandler({final:`I`},(e=>this.cursorForwardTab(e))),this._parser.registerCsiHandler({final:`J`},(e=>this.eraseInDisplay(e,!1))),this._parser.registerCsiHandler({prefix:`?`,final:`J`},(e=>this.eraseInDisplay(e,!0))),this._parser.registerCsiHandler({final:`K`},(e=>this.eraseInLine(e,!1))),this._parser.registerCsiHandler({prefix:`?`,final:`K`},(e=>this.eraseInLine(e,!0))),this._parser.registerCsiHandler({final:`L`},(e=>this.insertLines(e))),this._parser.registerCsiHandler({final:`M`},(e=>this.deleteLines(e))),this._parser.registerCsiHandler({final:`P`},(e=>this.deleteChars(e))),this._parser.registerCsiHandler({final:`S`},(e=>this.scrollUp(e))),this._parser.registerCsiHandler({final:`T`},(e=>this.scrollDown(e))),this._parser.registerCsiHandler({final:`X`},(e=>this.eraseChars(e))),this._parser.registerCsiHandler({final:`Z`},(e=>this.cursorBackwardTab(e))),this._parser.registerCsiHandler({final:"`"},(e=>this.charPosAbsolute(e))),this._parser.registerCsiHandler({final:`a`},(e=>this.hPositionRelative(e))),this._parser.registerCsiHandler({final:`b`},(e=>this.repeatPrecedingCharacter(e))),this._parser.registerCsiHandler({final:`c`},(e=>this.sendDeviceAttributesPrimary(e))),this._parser.registerCsiHandler({prefix:`>`,final:`c`},(e=>this.sendDeviceAttributesSecondary(e))),this._parser.registerCsiHandler({final:`d`},(e=>this.linePosAbsolute(e))),this._parser.registerCsiHandler({final:`e`},(e=>this.vPositionRelative(e))),this._parser.registerCsiHandler({final:`f`},(e=>this.hVPosition(e))),this._parser.registerCsiHandler({final:`g`},(e=>this.tabClear(e))),this._parser.registerCsiHandler({final:`h`},(e=>this.setMode(e))),this._parser.registerCsiHandler({prefix:`?`,final:`h`},(e=>this.setModePrivate(e))),this._parser.registerCsiHandler({final:`l`},(e=>this.resetMode(e))),this._parser.registerCsiHandler({prefix:`?`,final:`l`},(e=>this.resetModePrivate(e))),this._parser.registerCsiHandler({final:`m`},(e=>this.charAttributes(e))),this._parser.registerCsiHandler({final:`n`},(e=>this.deviceStatus(e))),this._parser.registerCsiHandler({prefix:`?`,final:`n`},(e=>this.deviceStatusPrivate(e))),this._parser.registerCsiHandler({intermediates:`!`,final:`p`},(e=>this.softReset(e))),this._parser.registerCsiHandler({intermediates:` `,final:`q`},(e=>this.setCursorStyle(e))),this._parser.registerCsiHandler({final:`r`},(e=>this.setScrollRegion(e))),this._parser.registerCsiHandler({final:`s`},(e=>this.saveCursor(e))),this._parser.registerCsiHandler({final:`t`},(e=>this.windowOptions(e))),this._parser.registerCsiHandler({final:`u`},(e=>this.restoreCursor(e))),this._parser.registerCsiHandler({intermediates:`'`,final:`}`},(e=>this.insertColumns(e))),this._parser.registerCsiHandler({intermediates:`'`,final:`~`},(e=>this.deleteColumns(e))),this._parser.registerCsiHandler({intermediates:`"`,final:`q`},(e=>this.selectProtected(e))),this._parser.registerCsiHandler({intermediates:`$`,final:`p`},(e=>this.requestMode(e,!0))),this._parser.registerCsiHandler({prefix:`?`,intermediates:`$`,final:`p`},(e=>this.requestMode(e,!1))),this._parser.setExecuteHandler(a.C0.BEL,(()=>this.bell())),this._parser.setExecuteHandler(a.C0.LF,(()=>this.lineFeed())),this._parser.setExecuteHandler(a.C0.VT,(()=>this.lineFeed())),this._parser.setExecuteHandler(a.C0.FF,(()=>this.lineFeed())),this._parser.setExecuteHandler(a.C0.CR,(()=>this.carriageReturn())),this._parser.setExecuteHandler(a.C0.BS,(()=>this.backspace())),this._parser.setExecuteHandler(a.C0.HT,(()=>this.tab())),this._parser.setExecuteHandler(a.C0.SO,(()=>this.shiftOut())),this._parser.setExecuteHandler(a.C0.SI,(()=>this.shiftIn())),this._parser.setExecuteHandler(a.C1.IND,(()=>this.index())),this._parser.setExecuteHandler(a.C1.NEL,(()=>this.nextLine())),this._parser.setExecuteHandler(a.C1.HTS,(()=>this.tabSet())),this._parser.registerOscHandler(0,new _.OscHandler((e=>(this.setTitle(e),this.setIconName(e),!0)))),this._parser.registerOscHandler(1,new _.OscHandler((e=>this.setIconName(e)))),this._parser.registerOscHandler(2,new _.OscHandler((e=>this.setTitle(e)))),this._parser.registerOscHandler(4,new _.OscHandler((e=>this.setOrReportIndexedColor(e)))),this._parser.registerOscHandler(8,new _.OscHandler((e=>this.setHyperlink(e)))),this._parser.registerOscHandler(10,new _.OscHandler((e=>this.setOrReportFgColor(e)))),this._parser.registerOscHandler(11,new _.OscHandler((e=>this.setOrReportBgColor(e)))),this._parser.registerOscHandler(12,new _.OscHandler((e=>this.setOrReportCursorColor(e)))),this._parser.registerOscHandler(104,new _.OscHandler((e=>this.restoreIndexedColor(e)))),this._parser.registerOscHandler(110,new _.OscHandler((e=>this.restoreFgColor(e)))),this._parser.registerOscHandler(111,new _.OscHandler((e=>this.restoreBgColor(e)))),this._parser.registerOscHandler(112,new _.OscHandler((e=>this.restoreCursorColor(e)))),this._parser.registerEscHandler({final:`7`},(()=>this.saveCursor())),this._parser.registerEscHandler({final:`8`},(()=>this.restoreCursor())),this._parser.registerEscHandler({final:`D`},(()=>this.index())),this._parser.registerEscHandler({final:`E`},(()=>this.nextLine())),this._parser.registerEscHandler({final:`H`},(()=>this.tabSet())),this._parser.registerEscHandler({final:`M`},(()=>this.reverseIndex())),this._parser.registerEscHandler({final:`=`},(()=>this.keypadApplicationMode())),this._parser.registerEscHandler({final:`>`},(()=>this.keypadNumericMode())),this._parser.registerEscHandler({final:`c`},(()=>this.fullReset())),this._parser.registerEscHandler({final:`n`},(()=>this.setgLevel(2))),this._parser.registerEscHandler({final:`o`},(()=>this.setgLevel(3))),this._parser.registerEscHandler({final:`|`},(()=>this.setgLevel(3))),this._parser.registerEscHandler({final:`}`},(()=>this.setgLevel(2))),this._parser.registerEscHandler({final:`~`},(()=>this.setgLevel(1))),this._parser.registerEscHandler({intermediates:`%`,final:`@`},(()=>this.selectDefaultCharset())),this._parser.registerEscHandler({intermediates:`%`,final:`G`},(()=>this.selectDefaultCharset()));for(let e in o.CHARSETS)this._parser.registerEscHandler({intermediates:`(`,final:e},(()=>this.selectCharset(`(`+e))),this._parser.registerEscHandler({intermediates:`)`,final:e},(()=>this.selectCharset(`)`+e))),this._parser.registerEscHandler({intermediates:`*`,final:e},(()=>this.selectCharset(`*`+e))),this._parser.registerEscHandler({intermediates:`+`,final:e},(()=>this.selectCharset(`+`+e))),this._parser.registerEscHandler({intermediates:`-`,final:e},(()=>this.selectCharset(`-`+e))),this._parser.registerEscHandler({intermediates:`.`,final:e},(()=>this.selectCharset(`.`+e))),this._parser.registerEscHandler({intermediates:`/`,final:e},(()=>this.selectCharset(`/`+e)));this._parser.registerEscHandler({intermediates:`#`,final:`8`},(()=>this.screenAlignmentPattern())),this._parser.setErrorHandler((e=>(this._logService.error(`Parsing error: `,e),e))),this._parser.registerDcsHandler({intermediates:`$`,final:`q`},new v.DcsHandler(((e,t)=>this.requestStatusString(e,t))))}_preserveStack(e,t,n,r){this._parseStack.paused=!0,this._parseStack.cursorStartX=e,this._parseStack.cursorStartY=t,this._parseStack.decodedLength=n,this._parseStack.position=r}_logSlowResolvingAsync(e){this._logService.logLevel<=h.LogLevelEnum.WARN&&Promise.race([e,new Promise(((e,t)=>setTimeout((()=>t(`#SLOW_TIMEOUT`)),5e3)))]).catch((e=>{if(e!==`#SLOW_TIMEOUT`)throw e;console.warn(`async parser handler taking longer than 5000 ms`)}))}_getCurrentLinkId(){return this._curAttrData.extended.urlId}parse(e,t){let n,r=this._activeBuffer.x,i=this._activeBuffer.y,a=0,o=this._parseStack.paused;if(o){if(n=this._parser.parse(this._parseBuffer,this._parseStack.decodedLength,t))return this._logSlowResolvingAsync(n),n;r=this._parseStack.cursorStartX,i=this._parseStack.cursorStartY,this._parseStack.paused=!1,e.length>x&&(a=this._parseStack.position+x)}if(this._logService.logLevel<=h.LogLevelEnum.DEBUG&&this._logService.debug(`parsing data`+(typeof e==`string`?` "${e}"`:` "${Array.prototype.map.call(e,(e=>String.fromCharCode(e))).join(``)}"`),typeof e==`string`?e.split(``).map((e=>e.charCodeAt(0))):e),this._parseBuffer.lengthx)for(let t=a;t0&&m.getWidth(this._activeBuffer.x-1)===2&&m.setCellFromCodepoint(this._activeBuffer.x-1,0,1,p);let h=this._parser.precedingJoinState;for(let _=t;_s){if(c){let e=m,t=this._activeBuffer.x-v;for(this._activeBuffer.x=v,this._activeBuffer.y++,this._activeBuffer.y===this._activeBuffer.scrollBottom+1?(this._activeBuffer.y--,this._bufferService.scroll(this._eraseAttrData(),!0)):(this._activeBuffer.y>=this._bufferService.rows&&(this._activeBuffer.y=this._bufferService.rows-1),this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y).isWrapped=!0),m=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y),v>0&&m instanceof u.BufferLine&&m.copyCellsFrom(e,t,0,v,!1);t=0;)m.setCellFromCodepoint(this._activeBuffer.x++,0,0,p)}else if(d&&(m.insertCells(this._activeBuffer.x,i-v,this._activeBuffer.getNullCell(p)),m.getWidth(s-1)===2&&m.setCellFromCodepoint(s-1,f.NULL_CELL_CODE,f.NULL_CELL_WIDTH,p)),m.setCellFromCodepoint(this._activeBuffer.x++,r,i,p),i>0)for(;--i;)m.setCellFromCodepoint(this._activeBuffer.x++,0,0,p)}this._parser.precedingJoinState=h,this._activeBuffer.x0&&m.getWidth(this._activeBuffer.x)===0&&!m.hasContent(this._activeBuffer.x)&&m.setCellFromCodepoint(this._activeBuffer.x,0,1,p),this._dirtyRowTracker.markDirty(this._activeBuffer.y)}registerCsiHandler(e,t){return e.final!==`t`||e.prefix||e.intermediates?this._parser.registerCsiHandler(e,t):this._parser.registerCsiHandler(e,(e=>!S(e.params[0],this._optionsService.rawOptions.windowOptions)||t(e)))}registerDcsHandler(e,t){return this._parser.registerDcsHandler(e,new v.DcsHandler(t))}registerEscHandler(e,t){return this._parser.registerEscHandler(e,t)}registerOscHandler(e,t){return this._parser.registerOscHandler(e,new _.OscHandler(t))}bell(){return this._onRequestBell.fire(),!0}lineFeed(){return this._dirtyRowTracker.markDirty(this._activeBuffer.y),this._optionsService.rawOptions.convertEol&&(this._activeBuffer.x=0),this._activeBuffer.y++,this._activeBuffer.y===this._activeBuffer.scrollBottom+1?(this._activeBuffer.y--,this._bufferService.scroll(this._eraseAttrData())):this._activeBuffer.y>=this._bufferService.rows?this._activeBuffer.y=this._bufferService.rows-1:this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y).isWrapped=!1,this._activeBuffer.x>=this._bufferService.cols&&this._activeBuffer.x--,this._dirtyRowTracker.markDirty(this._activeBuffer.y),this._onLineFeed.fire(),!0}carriageReturn(){return this._activeBuffer.x=0,!0}backspace(){if(!this._coreService.decPrivateModes.reverseWraparound)return this._restrictCursor(),this._activeBuffer.x>0&&this._activeBuffer.x--,!0;if(this._restrictCursor(this._bufferService.cols),this._activeBuffer.x>0)this._activeBuffer.x--;else if(this._activeBuffer.x===0&&this._activeBuffer.y>this._activeBuffer.scrollTop&&this._activeBuffer.y<=this._activeBuffer.scrollBottom&&this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y)?.isWrapped){this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y).isWrapped=!1,this._activeBuffer.y--,this._activeBuffer.x=this._bufferService.cols-1;let e=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);e.hasWidth(this._activeBuffer.x)&&!e.hasContent(this._activeBuffer.x)&&this._activeBuffer.x--}return this._restrictCursor(),!0}tab(){if(this._activeBuffer.x>=this._bufferService.cols)return!0;let e=this._activeBuffer.x;return this._activeBuffer.x=this._activeBuffer.nextStop(),this._optionsService.rawOptions.screenReaderMode&&this._onA11yTab.fire(this._activeBuffer.x-e),!0}shiftOut(){return this._charsetService.setgLevel(1),!0}shiftIn(){return this._charsetService.setgLevel(0),!0}_restrictCursor(e=this._bufferService.cols-1){this._activeBuffer.x=Math.min(e,Math.max(0,this._activeBuffer.x)),this._activeBuffer.y=this._coreService.decPrivateModes.origin?Math.min(this._activeBuffer.scrollBottom,Math.max(this._activeBuffer.scrollTop,this._activeBuffer.y)):Math.min(this._bufferService.rows-1,Math.max(0,this._activeBuffer.y)),this._dirtyRowTracker.markDirty(this._activeBuffer.y)}_setCursor(e,t){this._dirtyRowTracker.markDirty(this._activeBuffer.y),this._coreService.decPrivateModes.origin?(this._activeBuffer.x=e,this._activeBuffer.y=this._activeBuffer.scrollTop+t):(this._activeBuffer.x=e,this._activeBuffer.y=t),this._restrictCursor(),this._dirtyRowTracker.markDirty(this._activeBuffer.y)}_moveCursor(e,t){this._restrictCursor(),this._setCursor(this._activeBuffer.x+e,this._activeBuffer.y+t)}cursorUp(e){let t=this._activeBuffer.y-this._activeBuffer.scrollTop;return t>=0?this._moveCursor(0,-Math.min(t,e.params[0]||1)):this._moveCursor(0,-(e.params[0]||1)),!0}cursorDown(e){let t=this._activeBuffer.scrollBottom-this._activeBuffer.y;return t>=0?this._moveCursor(0,Math.min(t,e.params[0]||1)):this._moveCursor(0,e.params[0]||1),!0}cursorForward(e){return this._moveCursor(e.params[0]||1,0),!0}cursorBackward(e){return this._moveCursor(-(e.params[0]||1),0),!0}cursorNextLine(e){return this.cursorDown(e),this._activeBuffer.x=0,!0}cursorPrecedingLine(e){return this.cursorUp(e),this._activeBuffer.x=0,!0}cursorCharAbsolute(e){return this._setCursor((e.params[0]||1)-1,this._activeBuffer.y),!0}cursorPosition(e){return this._setCursor(e.length>=2?(e.params[1]||1)-1:0,(e.params[0]||1)-1),!0}charPosAbsolute(e){return this._setCursor((e.params[0]||1)-1,this._activeBuffer.y),!0}hPositionRelative(e){return this._moveCursor(e.params[0]||1,0),!0}linePosAbsolute(e){return this._setCursor(this._activeBuffer.x,(e.params[0]||1)-1),!0}vPositionRelative(e){return this._moveCursor(0,e.params[0]||1),!0}hVPosition(e){return this.cursorPosition(e),!0}tabClear(e){let t=e.params[0];return t===0?delete this._activeBuffer.tabs[this._activeBuffer.x]:t===3&&(this._activeBuffer.tabs={}),!0}cursorForwardTab(e){if(this._activeBuffer.x>=this._bufferService.cols)return!0;let t=e.params[0]||1;for(;t--;)this._activeBuffer.x=this._activeBuffer.nextStop();return!0}cursorBackwardTab(e){if(this._activeBuffer.x>=this._bufferService.cols)return!0;let t=e.params[0]||1;for(;t--;)this._activeBuffer.x=this._activeBuffer.prevStop();return!0}selectProtected(e){let t=e.params[0];return t===1&&(this._curAttrData.bg|=536870912),t!==2&&t!==0||(this._curAttrData.bg&=-536870913),!0}_eraseInBufferLine(e,t,n,r=!1,i=!1){let a=this._activeBuffer.lines.get(this._activeBuffer.ybase+e);a.replaceCells(t,n,this._activeBuffer.getNullCell(this._eraseAttrData()),i),r&&(a.isWrapped=!1)}_resetBufferLine(e,t=!1){let n=this._activeBuffer.lines.get(this._activeBuffer.ybase+e);n&&(n.fill(this._activeBuffer.getNullCell(this._eraseAttrData()),t),this._bufferService.buffer.clearMarkers(this._activeBuffer.ybase+e),n.isWrapped=!1)}eraseInDisplay(e,t=!1){let n;switch(this._restrictCursor(this._bufferService.cols),e.params[0]){case 0:for(n=this._activeBuffer.y,this._dirtyRowTracker.markDirty(n),this._eraseInBufferLine(n++,this._activeBuffer.x,this._bufferService.cols,this._activeBuffer.x===0,t);n=this._bufferService.cols&&(this._activeBuffer.lines.get(n+1).isWrapped=!1);n--;)this._resetBufferLine(n,t);this._dirtyRowTracker.markDirty(0);break;case 2:for(n=this._bufferService.rows,this._dirtyRowTracker.markDirty(n-1);n--;)this._resetBufferLine(n,t);this._dirtyRowTracker.markDirty(0);break;case 3:let e=this._activeBuffer.lines.length-this._bufferService.rows;e>0&&(this._activeBuffer.lines.trimStart(e),this._activeBuffer.ybase=Math.max(this._activeBuffer.ybase-e,0),this._activeBuffer.ydisp=Math.max(this._activeBuffer.ydisp-e,0),this._onScroll.fire(0))}return!0}eraseInLine(e,t=!1){switch(this._restrictCursor(this._bufferService.cols),e.params[0]){case 0:this._eraseInBufferLine(this._activeBuffer.y,this._activeBuffer.x,this._bufferService.cols,this._activeBuffer.x===0,t);break;case 1:this._eraseInBufferLine(this._activeBuffer.y,0,this._activeBuffer.x+1,!1,t);break;case 2:this._eraseInBufferLine(this._activeBuffer.y,0,this._bufferService.cols,!0,t)}return this._dirtyRowTracker.markDirty(this._activeBuffer.y),!0}insertLines(e){this._restrictCursor();let t=e.params[0]||1;if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.ythis._activeBuffer.scrollBottom||this._activeBuffer.ythis._activeBuffer.scrollBottom||this._activeBuffer.ythis._activeBuffer.scrollBottom||this._activeBuffer.ythis._activeBuffer.scrollBottom||this._activeBuffer.ythis._activeBuffer.scrollBottom||this._activeBuffer.y65535?2:1}let c=s;for(let e=1;e0||(this._is(`xterm`)||this._is(`rxvt-unicode`)||this._is(`screen`)?this._coreService.triggerDataEvent(a.C0.ESC+`[?1;2c`):this._is(`linux`)&&this._coreService.triggerDataEvent(a.C0.ESC+`[?6c`)),!0}sendDeviceAttributesSecondary(e){return e.params[0]>0||(this._is(`xterm`)?this._coreService.triggerDataEvent(a.C0.ESC+`[>0;276;0c`):this._is(`rxvt-unicode`)?this._coreService.triggerDataEvent(a.C0.ESC+`[>85;95;0c`):this._is(`linux`)?this._coreService.triggerDataEvent(e.params[0]+`c`):this._is(`screen`)&&this._coreService.triggerDataEvent(a.C0.ESC+`[>83;40003;0c`)),!0}_is(e){return(this._optionsService.rawOptions.termName+``).indexOf(e)===0}setMode(e){for(let t=0;te?1:2,p=e.params[0];return m=p,h=t?p===2?4:p===4?f(o.modes.insertMode):p===12?3:p===20?f(d.convertEol):0:p===1?f(n.applicationCursorKeys):p===3?d.windowOptions.setWinLines?c===80?2:+(c===132):0:p===6?f(n.origin):p===7?f(n.wraparound):p===8?3:p===9?f(r===`X10`):p===12?f(d.cursorBlink):p===25?f(!o.isCursorHidden):p===45?f(n.reverseWraparound):p===66?f(n.applicationKeypad):p===67?4:p===1e3?f(r===`VT200`):p===1002?f(r===`DRAG`):p===1003?f(r===`ANY`):p===1004?f(n.sendFocus):p===1005?4:p===1006?f(i===`SGR`):p===1015?4:p===1016?f(i===`SGR_PIXELS`):p===1048?1:p===47||p===1047||p===1049?f(l===u):p===2004?f(n.bracketedPasteMode):0,o.triggerDataEvent(`${a.C0.ESC}[${t?``:`?`}${m};${h}$y`),!0;var m,h}_updateAttrColor(e,t,n,r,i){return t===2?(e|=50331648,e&=-16777216,e|=m.AttributeData.fromColorRGB([n,r,i])):t===5&&(e&=-50331904,e|=33554432|255&n),e}_extractColor(e,t,n){let r=[0,0,-1,0,0,0],i=0,a=0;do{if(r[a+i]=e.params[t+a],e.hasSubParams(t+a)){let n=e.getSubParams(t+a),o=0;do r[1]===5&&(i=1),r[a+o+1+i]=n[o];while(++o=2||r[1]===2&&a+i>=5)break;r[1]&&(i=1)}while(++a+t5)&&(e=1),t.extended.underlineStyle=e,t.fg|=268435456,e===0&&(t.fg&=-268435457),t.updateExtended()}_processSGR0(e){e.fg=u.DEFAULT_ATTR_DATA.fg,e.bg=u.DEFAULT_ATTR_DATA.bg,e.extended=e.extended.clone(),e.extended.underlineStyle=0,e.extended.underlineColor&=-67108864,e.updateExtended()}charAttributes(e){if(e.length===1&&e.params[0]===0)return this._processSGR0(this._curAttrData),!0;let t=e.length,n,r=this._curAttrData;for(let i=0;i=30&&n<=37?(r.fg&=-50331904,r.fg|=16777216|n-30):n>=40&&n<=47?(r.bg&=-50331904,r.bg|=16777216|n-40):n>=90&&n<=97?(r.fg&=-50331904,r.fg|=16777224|n-90):n>=100&&n<=107?(r.bg&=-50331904,r.bg|=16777224|n-100):n===0?this._processSGR0(r):n===1?r.fg|=134217728:n===3?r.bg|=67108864:n===4?(r.fg|=268435456,this._processUnderline(e.hasSubParams(i)?e.getSubParams(i)[0]:1,r)):n===5?r.fg|=536870912:n===7?r.fg|=67108864:n===8?r.fg|=1073741824:n===9?r.fg|=2147483648:n===2?r.bg|=134217728:n===21?this._processUnderline(2,r):n===22?(r.fg&=-134217729,r.bg&=-134217729):n===23?r.bg&=-67108865:n===24?(r.fg&=-268435457,this._processUnderline(0,r)):n===25?r.fg&=-536870913:n===27?r.fg&=-67108865:n===28?r.fg&=-1073741825:n===29?r.fg&=2147483647:n===39?(r.fg&=-67108864,r.fg|=16777215&u.DEFAULT_ATTR_DATA.fg):n===49?(r.bg&=-67108864,r.bg|=16777215&u.DEFAULT_ATTR_DATA.bg):n===38||n===48||n===58?i+=this._extractColor(e,i,r):n===53?r.bg|=1073741824:n===55?r.bg&=-1073741825:n===59?(r.extended=r.extended.clone(),r.extended.underlineColor=-1,r.updateExtended()):n===100?(r.fg&=-67108864,r.fg|=16777215&u.DEFAULT_ATTR_DATA.fg,r.bg&=-67108864,r.bg|=16777215&u.DEFAULT_ATTR_DATA.bg):this._logService.debug(`Unknown SGR attribute: %d.`,n);return!0}deviceStatus(e){switch(e.params[0]){case 5:this._coreService.triggerDataEvent(`${a.C0.ESC}[0n`);break;case 6:let e=this._activeBuffer.y+1,t=this._activeBuffer.x+1;this._coreService.triggerDataEvent(`${a.C0.ESC}[${e};${t}R`)}return!0}deviceStatusPrivate(e){if(e.params[0]===6){let e=this._activeBuffer.y+1,t=this._activeBuffer.x+1;this._coreService.triggerDataEvent(`${a.C0.ESC}[?${e};${t}R`)}return!0}softReset(e){return this._coreService.isCursorHidden=!1,this._onRequestSyncScrollBar.fire(),this._activeBuffer.scrollTop=0,this._activeBuffer.scrollBottom=this._bufferService.rows-1,this._curAttrData=u.DEFAULT_ATTR_DATA.clone(),this._coreService.reset(),this._charsetService.reset(),this._activeBuffer.savedX=0,this._activeBuffer.savedY=this._activeBuffer.ybase,this._activeBuffer.savedCurAttrData.fg=this._curAttrData.fg,this._activeBuffer.savedCurAttrData.bg=this._curAttrData.bg,this._activeBuffer.savedCharset=this._charsetService.charset,this._coreService.decPrivateModes.origin=!1,!0}setCursorStyle(e){let t=e.params[0]||1;switch(t){case 1:case 2:this._optionsService.options.cursorStyle=`block`;break;case 3:case 4:this._optionsService.options.cursorStyle=`underline`;break;case 5:case 6:this._optionsService.options.cursorStyle=`bar`}let n=t%2==1;return this._optionsService.options.cursorBlink=n,!0}setScrollRegion(e){let t=e.params[0]||1,n;return(e.length<2||(n=e.params[1])>this._bufferService.rows||n===0)&&(n=this._bufferService.rows),n>t&&(this._activeBuffer.scrollTop=t-1,this._activeBuffer.scrollBottom=n-1,this._setCursor(0,0)),!0}windowOptions(e){if(!S(e.params[0],this._optionsService.rawOptions.windowOptions))return!0;let t=e.length>1?e.params[1]:0;switch(e.params[0]){case 14:t!==2&&this._onRequestWindowsOptionsReport.fire(C.GET_WIN_SIZE_PIXELS);break;case 16:this._onRequestWindowsOptionsReport.fire(C.GET_CELL_SIZE_PIXELS);break;case 18:this._bufferService&&this._coreService.triggerDataEvent(`${a.C0.ESC}[8;${this._bufferService.rows};${this._bufferService.cols}t`);break;case 22:t!==0&&t!==2||(this._windowTitleStack.push(this._windowTitle),this._windowTitleStack.length>10&&this._windowTitleStack.shift()),t!==0&&t!==1||(this._iconNameStack.push(this._iconName),this._iconNameStack.length>10&&this._iconNameStack.shift());break;case 23:t!==0&&t!==2||this._windowTitleStack.length&&this.setTitle(this._windowTitleStack.pop()),t!==0&&t!==1||this._iconNameStack.length&&this.setIconName(this._iconNameStack.pop())}return!0}saveCursor(e){return this._activeBuffer.savedX=this._activeBuffer.x,this._activeBuffer.savedY=this._activeBuffer.ybase+this._activeBuffer.y,this._activeBuffer.savedCurAttrData.fg=this._curAttrData.fg,this._activeBuffer.savedCurAttrData.bg=this._curAttrData.bg,this._activeBuffer.savedCharset=this._charsetService.charset,!0}restoreCursor(e){return this._activeBuffer.x=this._activeBuffer.savedX||0,this._activeBuffer.y=Math.max(this._activeBuffer.savedY-this._activeBuffer.ybase,0),this._curAttrData.fg=this._activeBuffer.savedCurAttrData.fg,this._curAttrData.bg=this._activeBuffer.savedCurAttrData.bg,this._charsetService.charset=this._savedCharset,this._activeBuffer.savedCharset&&(this._charsetService.charset=this._activeBuffer.savedCharset),this._restrictCursor(),!0}setTitle(e){return this._windowTitle=e,this._onTitleChange.fire(e),!0}setIconName(e){return this._iconName=e,!0}setOrReportIndexedColor(e){let t=[],n=e.split(`;`);for(;n.length>1;){let e=n.shift(),r=n.shift();if(/^\d+$/.exec(e)){let n=parseInt(e);if(D(n))if(r===`?`)t.push({type:0,index:n});else{let e=(0,y.parseColor)(r);e&&t.push({type:1,index:n,color:e})}}}return t.length&&this._onColor.fire(t),!0}setHyperlink(e){let t=e.split(`;`);return!(t.length<2)&&(t[1]?this._createHyperlink(t[0],t[1]):!t[0]&&this._finishHyperlink())}_createHyperlink(e,t){this._getCurrentLinkId()&&this._finishHyperlink();let n=e.split(`:`),r,i=n.findIndex((e=>e.startsWith(`id=`)));return i!==-1&&(r=n[i].slice(3)||void 0),this._curAttrData.extended=this._curAttrData.extended.clone(),this._curAttrData.extended.urlId=this._oscLinkService.registerLink({id:r,uri:t}),this._curAttrData.updateExtended(),!0}_finishHyperlink(){return this._curAttrData.extended=this._curAttrData.extended.clone(),this._curAttrData.extended.urlId=0,this._curAttrData.updateExtended(),!0}_setOrReportSpecialColor(e,t){let n=e.split(`;`);for(let e=0;e=this._specialColors.length);++e,++t)if(n[e]===`?`)this._onColor.fire([{type:0,index:this._specialColors[t]}]);else{let r=(0,y.parseColor)(n[e]);r&&this._onColor.fire([{type:1,index:this._specialColors[t],color:r}])}return!0}setOrReportFgColor(e){return this._setOrReportSpecialColor(e,0)}setOrReportBgColor(e){return this._setOrReportSpecialColor(e,1)}setOrReportCursorColor(e){return this._setOrReportSpecialColor(e,2)}restoreIndexedColor(e){if(!e)return this._onColor.fire([{type:2}]),!0;let t=[],n=e.split(`;`);for(let e=0;e=this._bufferService.rows&&(this._activeBuffer.y=this._bufferService.rows-1),this._restrictCursor(),!0}tabSet(){return this._activeBuffer.tabs[this._activeBuffer.x]=!0,!0}reverseIndex(){if(this._restrictCursor(),this._activeBuffer.y===this._activeBuffer.scrollTop){let e=this._activeBuffer.scrollBottom-this._activeBuffer.scrollTop;this._activeBuffer.lines.shiftElements(this._activeBuffer.ybase+this._activeBuffer.y,e,1),this._activeBuffer.lines.set(this._activeBuffer.ybase+this._activeBuffer.y,this._activeBuffer.getBlankLine(this._eraseAttrData())),this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom)}else this._activeBuffer.y--,this._restrictCursor();return!0}fullReset(){return this._parser.reset(),this._onRequestReset.fire(),!0}reset(){this._curAttrData=u.DEFAULT_ATTR_DATA.clone(),this._eraseAttrDataInternal=u.DEFAULT_ATTR_DATA.clone()}_eraseAttrData(){return this._eraseAttrDataInternal.bg&=-67108864,this._eraseAttrDataInternal.bg|=67108863&this._curAttrData.bg,this._eraseAttrDataInternal}setgLevel(e){return this._charsetService.setgLevel(e),!0}screenAlignmentPattern(){let e=new p.CellData;e.content=4194373,e.fg=this._curAttrData.fg,e.bg=this._curAttrData.bg,this._setCursor(0,0);for(let t=0;t(this._coreService.triggerDataEvent(`${a.C0.ESC}${e}${a.C0.ESC}\\`),!0))(e===`"q`?`P1$r${+!!this._curAttrData.isProtected()}"q`:e===`"p`?`P1$r61;1"p`:e===`r`?`P1$r${n.scrollTop+1};${n.scrollBottom+1}r`:e===`m`?`P1$r0m`:e===` q`?`P1$r${{block:2,underline:4,bar:6}[r.cursorStyle]-+!!r.cursorBlink} q`:`P0$r`)}markRangeDirty(e,t){this._dirtyRowTracker.markRangeDirty(e,t)}}t.InputHandler=T;let E=class{constructor(e){this._bufferService=e,this.clearRange()}clearRange(){this.start=this._bufferService.buffer.y,this.end=this._bufferService.buffer.y}markDirty(e){ethis.end&&(this.end=e)}markRangeDirty(e,t){e>t&&(w=e,e=t,t=w),ethis.end&&(this.end=t)}markAllDirty(){this.markRangeDirty(0,this._bufferService.rows-1)}};function D(e){return 0<=e&&e<256}E=r([i(0,h.IBufferService)],E)},844:(e,t)=>{function n(e){for(let t of e)t.dispose();e.length=0}Object.defineProperty(t,"__esModule",{value:!0}),t.getDisposeArrayDisposable=t.disposeArray=t.toDisposable=t.MutableDisposable=t.Disposable=void 0,t.Disposable=class{constructor(){this._disposables=[],this._isDisposed=!1}dispose(){this._isDisposed=!0;for(let e of this._disposables)e.dispose();this._disposables.length=0}register(e){return this._disposables.push(e),e}unregister(e){let t=this._disposables.indexOf(e);t!==-1&&this._disposables.splice(t,1)}},t.MutableDisposable=class{constructor(){this._isDisposed=!1}get value(){return this._isDisposed?void 0:this._value}set value(e){this._isDisposed||e===this._value||(this._value?.dispose(),this._value=e)}clear(){this.value=void 0}dispose(){this._isDisposed=!0,this._value?.dispose(),this._value=void 0}},t.toDisposable=function(e){return{dispose:e}},t.disposeArray=n,t.getDisposeArrayDisposable=function(e){return{dispose:()=>n(e)}}},1505:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.FourKeyMap=t.TwoKeyMap=void 0;class n{constructor(){this._data={}}set(e,t,n){this._data[e]||(this._data[e]={}),this._data[e][t]=n}get(e,t){return this._data[e]?this._data[e][t]:void 0}clear(){this._data={}}}t.TwoKeyMap=n,t.FourKeyMap=class{constructor(){this._data=new n}set(e,t,r,i,a){this._data.get(e,t)||this._data.set(e,t,new n),this._data.get(e,t).set(r,i,a)}get(e,t,n,r){return this._data.get(e,t)?.get(n,r)}clear(){this._data.clear()}}},6114:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.isChromeOS=t.isLinux=t.isWindows=t.isIphone=t.isIpad=t.isMac=t.getSafariVersion=t.isSafari=t.isLegacyEdge=t.isFirefox=t.isNode=void 0,t.isNode=typeof process<`u`&&`title`in process;let n=t.isNode?`node`:navigator.userAgent,r=t.isNode?`node`:navigator.platform;t.isFirefox=n.includes(`Firefox`),t.isLegacyEdge=n.includes(`Edge`),t.isSafari=/^((?!chrome|android).)*safari/i.test(n),t.getSafariVersion=function(){if(!t.isSafari)return 0;let e=n.match(/Version\/(\d+)/);return e===null||e.length<2?0:parseInt(e[1])},t.isMac=[`Macintosh`,`MacIntel`,`MacPPC`,`Mac68K`].includes(r),t.isIpad=r===`iPad`,t.isIphone=r===`iPhone`,t.isWindows=[`Windows`,`Win16`,`Win32`,`WinCE`].includes(r),t.isLinux=r.indexOf(`Linux`)>=0,t.isChromeOS=/\bCrOS\b/.test(n)},6106:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.SortedList=void 0;let n=0;t.SortedList=class{constructor(e){this._getKey=e,this._array=[]}clear(){this._array.length=0}insert(e){this._array.length===0?this._array.push(e):(n=this._search(this._getKey(e)),this._array.splice(n,0,e))}delete(e){if(this._array.length===0)return!1;let t=this._getKey(e);if(t===void 0||(n=this._search(t),n===-1)||this._getKey(this._array[n])!==t)return!1;do if(this._array[n]===e)return this._array.splice(n,1),!0;while(++n=this._array.length)&&this._getKey(this._array[n])===e))do yield this._array[n];while(++n=this._array.length)&&this._getKey(this._array[n])===e))do t(this._array[n]);while(++n=t;){let r=t+n>>1,i=this._getKey(this._array[r]);if(i>e)n=r-1;else{if(!(i0&&this._getKey(this._array[r-1])===e;)r--;return r}t=r+1}}return t}}},7226:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.DebouncedIdleTask=t.IdleTaskQueue=t.PriorityTaskQueue=void 0;let r=n(6114);class i{constructor(){this._tasks=[],this._i=0}enqueue(e){this._tasks.push(e),this._start()}flush(){for(;this._ii)return r-t<-20&&console.warn(`task queue exceeded allotted deadline by ${Math.abs(Math.round(r-t))}ms`),void this._start();r=i}this.clear()}}class a extends i{_requestCallback(e){return setTimeout((()=>e(this._createDeadline(16))))}_cancelCallback(e){clearTimeout(e)}_createDeadline(e){let t=Date.now()+e;return{timeRemaining:()=>Math.max(0,t-Date.now())}}}t.PriorityTaskQueue=a,t.IdleTaskQueue=!r.isNode&&`requestIdleCallback`in window?class extends i{_requestCallback(e){return requestIdleCallback(e)}_cancelCallback(e){cancelIdleCallback(e)}}:a,t.DebouncedIdleTask=class{constructor(){this._queue=new t.IdleTaskQueue}set(e){this._queue.clear(),this._queue.enqueue(e)}flush(){this._queue.flush()}}},9282:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.updateWindowsModeWrappedState=void 0;let r=n(643);t.updateWindowsModeWrappedState=function(e){let t=e.buffer.lines.get(e.buffer.ybase+e.buffer.y-1)?.get(e.cols-1),n=e.buffer.lines.get(e.buffer.ybase+e.buffer.y);n&&t&&(n.isWrapped=t[r.CHAR_DATA_CODE_INDEX]!==r.NULL_CELL_CODE&&t[r.CHAR_DATA_CODE_INDEX]!==r.WHITESPACE_CELL_CODE)}},3734:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.ExtendedAttrs=t.AttributeData=void 0;class n{constructor(){this.fg=0,this.bg=0,this.extended=new r}static toColorRGB(e){return[e>>>16&255,e>>>8&255,255&e]}static fromColorRGB(e){return(255&e[0])<<16|(255&e[1])<<8|255&e[2]}clone(){let e=new n;return e.fg=this.fg,e.bg=this.bg,e.extended=this.extended.clone(),e}isInverse(){return 67108864&this.fg}isBold(){return 134217728&this.fg}isUnderline(){return this.hasExtendedAttrs()&&this.extended.underlineStyle!==0?1:268435456&this.fg}isBlink(){return 536870912&this.fg}isInvisible(){return 1073741824&this.fg}isItalic(){return 67108864&this.bg}isDim(){return 134217728&this.bg}isStrikethrough(){return 2147483648&this.fg}isProtected(){return 536870912&this.bg}isOverline(){return 1073741824&this.bg}getFgColorMode(){return 50331648&this.fg}getBgColorMode(){return 50331648&this.bg}isFgRGB(){return(50331648&this.fg)==50331648}isBgRGB(){return(50331648&this.bg)==50331648}isFgPalette(){return(50331648&this.fg)==16777216||(50331648&this.fg)==33554432}isBgPalette(){return(50331648&this.bg)==16777216||(50331648&this.bg)==33554432}isFgDefault(){return(50331648&this.fg)==0}isBgDefault(){return(50331648&this.bg)==0}isAttributeDefault(){return this.fg===0&&this.bg===0}getFgColor(){switch(50331648&this.fg){case 16777216:case 33554432:return 255&this.fg;case 50331648:return 16777215&this.fg;default:return-1}}getBgColor(){switch(50331648&this.bg){case 16777216:case 33554432:return 255&this.bg;case 50331648:return 16777215&this.bg;default:return-1}}hasExtendedAttrs(){return 268435456&this.bg}updateExtended(){this.extended.isEmpty()?this.bg&=-268435457:this.bg|=268435456}getUnderlineColor(){if(268435456&this.bg&&~this.extended.underlineColor)switch(50331648&this.extended.underlineColor){case 16777216:case 33554432:return 255&this.extended.underlineColor;case 50331648:return 16777215&this.extended.underlineColor;default:return this.getFgColor()}return this.getFgColor()}getUnderlineColorMode(){return 268435456&this.bg&&~this.extended.underlineColor?50331648&this.extended.underlineColor:this.getFgColorMode()}isUnderlineColorRGB(){return 268435456&this.bg&&~this.extended.underlineColor?(50331648&this.extended.underlineColor)==50331648:this.isFgRGB()}isUnderlineColorPalette(){return 268435456&this.bg&&~this.extended.underlineColor?(50331648&this.extended.underlineColor)==16777216||(50331648&this.extended.underlineColor)==33554432:this.isFgPalette()}isUnderlineColorDefault(){return 268435456&this.bg&&~this.extended.underlineColor?(50331648&this.extended.underlineColor)==0:this.isFgDefault()}getUnderlineStyle(){return 268435456&this.fg?268435456&this.bg?this.extended.underlineStyle:1:0}getUnderlineVariantOffset(){return this.extended.underlineVariantOffset}}t.AttributeData=n;class r{get ext(){return this._urlId?-469762049&this._ext|this.underlineStyle<<26:this._ext}set ext(e){this._ext=e}get underlineStyle(){return this._urlId?5:(469762048&this._ext)>>26}set underlineStyle(e){this._ext&=-469762049,this._ext|=e<<26&469762048}get underlineColor(){return 67108863&this._ext}set underlineColor(e){this._ext&=-67108864,this._ext|=67108863&e}get urlId(){return this._urlId}set urlId(e){this._urlId=e}get underlineVariantOffset(){let e=(3758096384&this._ext)>>29;return e<0?4294967288^e:e}set underlineVariantOffset(e){this._ext&=536870911,this._ext|=e<<29&3758096384}constructor(e=0,t=0){this._ext=0,this._urlId=0,this._ext=e,this._urlId=t}clone(){return new r(this._ext,this._urlId)}isEmpty(){return this.underlineStyle===0&&this._urlId===0}}t.ExtendedAttrs=r},9092:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.Buffer=t.MAX_BUFFER_SIZE=void 0;let r=n(6349),i=n(7226),a=n(3734),o=n(8437),s=n(4634),c=n(511),l=n(643),u=n(4863),d=n(7116);t.MAX_BUFFER_SIZE=4294967295,t.Buffer=class{constructor(e,t,n){this._hasScrollback=e,this._optionsService=t,this._bufferService=n,this.ydisp=0,this.ybase=0,this.y=0,this.x=0,this.tabs={},this.savedY=0,this.savedX=0,this.savedCurAttrData=o.DEFAULT_ATTR_DATA.clone(),this.savedCharset=d.DEFAULT_CHARSET,this.markers=[],this._nullCell=c.CellData.fromCharData([0,l.NULL_CELL_CHAR,l.NULL_CELL_WIDTH,l.NULL_CELL_CODE]),this._whitespaceCell=c.CellData.fromCharData([0,l.WHITESPACE_CELL_CHAR,l.WHITESPACE_CELL_WIDTH,l.WHITESPACE_CELL_CODE]),this._isClearing=!1,this._memoryCleanupQueue=new i.IdleTaskQueue,this._memoryCleanupPosition=0,this._cols=this._bufferService.cols,this._rows=this._bufferService.rows,this.lines=new r.CircularList(this._getCorrectBufferLength(this._rows)),this.scrollTop=0,this.scrollBottom=this._rows-1,this.setupTabStops()}getNullCell(e){return e?(this._nullCell.fg=e.fg,this._nullCell.bg=e.bg,this._nullCell.extended=e.extended):(this._nullCell.fg=0,this._nullCell.bg=0,this._nullCell.extended=new a.ExtendedAttrs),this._nullCell}getWhitespaceCell(e){return e?(this._whitespaceCell.fg=e.fg,this._whitespaceCell.bg=e.bg,this._whitespaceCell.extended=e.extended):(this._whitespaceCell.fg=0,this._whitespaceCell.bg=0,this._whitespaceCell.extended=new a.ExtendedAttrs),this._whitespaceCell}getBlankLine(e,t){return new o.BufferLine(this._bufferService.cols,this.getNullCell(e),t)}get hasScrollback(){return this._hasScrollback&&this.lines.maxLength>this._rows}get isCursorInViewport(){let e=this.ybase+this.y-this.ydisp;return e>=0&&et.MAX_BUFFER_SIZE?t.MAX_BUFFER_SIZE:n}fillViewportRows(e){if(this.lines.length===0){e===void 0&&(e=o.DEFAULT_ATTR_DATA);let t=this._rows;for(;t--;)this.lines.push(this.getBlankLine(e))}}clear(){this.ydisp=0,this.ybase=0,this.y=0,this.x=0,this.lines=new r.CircularList(this._getCorrectBufferLength(this._rows)),this.scrollTop=0,this.scrollBottom=this._rows-1,this.setupTabStops()}resize(e,t){let n=this.getNullCell(o.DEFAULT_ATTR_DATA),r=0,i=this._getCorrectBufferLength(t);if(i>this.lines.maxLength&&(this.lines.maxLength=i),this.lines.length>0){if(this._cols0&&this.lines.length<=this.ybase+this.y+a+1?(this.ybase--,a++,this.ydisp>0&&this.ydisp--):this.lines.push(new o.BufferLine(e,n)));else for(let e=this._rows;e>t;e--)this.lines.length>t+this.ybase&&(this.lines.length>this.ybase+this.y+1?this.lines.pop():(this.ybase++,this.ydisp++));if(i0&&(this.lines.trimStart(e),this.ybase=Math.max(this.ybase-e,0),this.ydisp=Math.max(this.ydisp-e,0),this.savedY=Math.max(this.savedY-e,0)),this.lines.maxLength=i}this.x=Math.min(this.x,e-1),this.y=Math.min(this.y,t-1),a&&(this.y+=a),this.savedX=Math.min(this.savedX,e-1),this.scrollTop=0}if(this.scrollBottom=t-1,this._isReflowEnabled&&(this._reflow(e,t),this._cols>e))for(let t=0;t.1*this.lines.length&&(this._memoryCleanupPosition=0,this._memoryCleanupQueue.enqueue((()=>this._batchedMemoryCleanup())))}_batchedMemoryCleanup(){let e=!0;this._memoryCleanupPosition>=this.lines.length&&(this._memoryCleanupPosition=0,e=!1);let t=0;for(;this._memoryCleanupPosition100)return!0;return e}get _isReflowEnabled(){let e=this._optionsService.rawOptions.windowsPty;return e&&e.buildNumber?this._hasScrollback&&e.backend===`conpty`&&e.buildNumber>=21376:this._hasScrollback&&!this._optionsService.rawOptions.windowsMode}_reflow(e,t){this._cols!==e&&(e>this._cols?this._reflowLarger(e,t):this._reflowSmaller(e,t))}_reflowLarger(e,t){let n=(0,s.reflowLargerGetLinesToRemove)(this.lines,this._cols,e,this.ybase+this.y,this.getNullCell(o.DEFAULT_ATTR_DATA));if(n.length>0){let r=(0,s.reflowLargerCreateNewLayout)(this.lines,n);(0,s.reflowLargerApplyNewLayout)(this.lines,r.layout),this._reflowLargerAdjustViewport(e,t,r.countRemoved)}}_reflowLargerAdjustViewport(e,t,n){let r=this.getNullCell(o.DEFAULT_ATTR_DATA),i=n;for(;i-- >0;)this.ybase===0?(this.y>0&&this.y--,this.lines.length=0;a--){let c=this.lines.get(a);if(!c||!c.isWrapped&&c.getTrimmedLength()<=e)continue;let l=[c];for(;c.isWrapped&&a>0;)c=this.lines.get(--a),l.unshift(c);let u=this.ybase+this.y;if(u>=a&&u0&&(r.push({start:a+l.length+i,newLines:h}),i+=h.length),l.push(...h);let g=f.length-1,_=f[g];_===0&&(g--,_=f[g]);let v=l.length-p-1,y=d;for(;v>=0;){let e=Math.min(y,_);if(l[g]===void 0)break;if(l[g].copyCellsFrom(l[v],y-e,_-e,e,!0),_-=e,_===0&&(g--,_=f[g]),y-=e,y===0){v--;let e=Math.max(v,0);y=(0,s.getWrappedLineTrimmedLength)(l,e,this._cols)}}for(let t=0;t0;)this.ybase===0?this.y0){let e=[],t=[];for(let e=0;e=0;l--)if(s&&s.start>a+c){for(let e=s.newLines.length-1;e>=0;e--)this.lines.set(l--,s.newLines[e]);l++,e.push({index:a+1,amount:s.newLines.length}),c+=s.newLines.length,s=r[++o]}else this.lines.set(l,t[a--]);let l=0;for(let t=e.length-1;t>=0;t--)e[t].index+=l,this.lines.onInsertEmitter.fire(e[t]),l+=e[t].amount;let u=Math.max(0,n+i-this.lines.maxLength);u>0&&this.lines.onTrimEmitter.fire(u)}}translateBufferLineToString(e,t,n=0,r){let i=this.lines.get(e);return i?i.translateToString(t,n,r):``}getWrappedRangeForLine(e){let t=e,n=e;for(;t>0&&this.lines.get(t).isWrapped;)t--;for(;n+10;);return e>=this._cols?this._cols-1:e<0?0:e}nextStop(e){for(e??=this.x;!this.tabs[++e]&&e=this._cols?this._cols-1:e<0?0:e}clearMarkers(e){this._isClearing=!0;for(let t=0;t{t.line-=e,t.line<0&&t.dispose()}))),t.register(this.lines.onInsert((e=>{t.line>=e.index&&(t.line+=e.amount)}))),t.register(this.lines.onDelete((e=>{t.line>=e.index&&t.linee.index&&(t.line-=e.amount)}))),t.register(t.onDispose((()=>this._removeMarker(t)))),t}_removeMarker(e){this._isClearing||this.markers.splice(this.markers.indexOf(e),1)}}},8437:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.BufferLine=t.DEFAULT_ATTR_DATA=void 0;let r=n(3734),i=n(511),a=n(643),o=n(482);t.DEFAULT_ATTR_DATA=Object.freeze(new r.AttributeData);let s=0;class c{constructor(e,t,n=!1){this.isWrapped=n,this._combined={},this._extendedAttrs={},this._data=new Uint32Array(3*e);let r=t||i.CellData.fromCharData([0,a.NULL_CELL_CHAR,a.NULL_CELL_WIDTH,a.NULL_CELL_CODE]);for(let t=0;t>22,2097152&t?this._combined[e].charCodeAt(this._combined[e].length-1):n]}set(e,t){this._data[3*e+1]=t[a.CHAR_DATA_ATTR_INDEX],t[a.CHAR_DATA_CHAR_INDEX].length>1?(this._combined[e]=t[1],this._data[3*e+0]=2097152|e|t[a.CHAR_DATA_WIDTH_INDEX]<<22):this._data[3*e+0]=t[a.CHAR_DATA_CHAR_INDEX].charCodeAt(0)|t[a.CHAR_DATA_WIDTH_INDEX]<<22}getWidth(e){return this._data[3*e+0]>>22}hasWidth(e){return 12582912&this._data[3*e+0]}getFg(e){return this._data[3*e+1]}getBg(e){return this._data[3*e+2]}hasContent(e){return 4194303&this._data[3*e+0]}getCodePoint(e){let t=this._data[3*e+0];return 2097152&t?this._combined[e].charCodeAt(this._combined[e].length-1):2097151&t}isCombined(e){return 2097152&this._data[3*e+0]}getString(e){let t=this._data[3*e+0];return 2097152&t?this._combined[e]:2097151&t?(0,o.stringFromCodePoint)(2097151&t):``}isProtected(e){return 536870912&this._data[3*e+2]}loadCell(e,t){return s=3*e,t.content=this._data[s+0],t.fg=this._data[s+1],t.bg=this._data[s+2],2097152&t.content&&(t.combinedData=this._combined[e]),268435456&t.bg&&(t.extended=this._extendedAttrs[e]),t}setCell(e,t){2097152&t.content&&(this._combined[e]=t.combinedData),268435456&t.bg&&(this._extendedAttrs[e]=t.extended),this._data[3*e+0]=t.content,this._data[3*e+1]=t.fg,this._data[3*e+2]=t.bg}setCellFromCodepoint(e,t,n,r){268435456&r.bg&&(this._extendedAttrs[e]=r.extended),this._data[3*e+0]=t|n<<22,this._data[3*e+1]=r.fg,this._data[3*e+2]=r.bg}addCodepointToCell(e,t,n){let r=this._data[3*e+0];2097152&r?this._combined[e]+=(0,o.stringFromCodePoint)(t):2097151&r?(this._combined[e]=(0,o.stringFromCodePoint)(2097151&r)+(0,o.stringFromCodePoint)(t),r&=-2097152,r|=2097152):r=t|1<<22,n&&(r&=-12582913,r|=n<<22),this._data[3*e+0]=r}insertCells(e,t,n){if((e%=this.length)&&this.getWidth(e-1)===2&&this.setCellFromCodepoint(e-1,0,1,n),t=0;--n)this.setCell(e+t+n,this.loadCell(e+n,r));for(let r=0;rthis.length){if(this._data.buffer.byteLength>=4*n)this._data=new Uint32Array(this._data.buffer,0,n);else{let e=new Uint32Array(n);e.set(this._data),this._data=e}for(let n=this.length;n=e&&delete this._combined[r]}let r=Object.keys(this._extendedAttrs);for(let t=0;t=e&&delete this._extendedAttrs[n]}}return this.length=e,4*n*2=0;--e)if(4194303&this._data[3*e+0])return e+(this._data[3*e+0]>>22);return 0}getNoBgTrimmedLength(){for(let e=this.length-1;e>=0;--e)if(4194303&this._data[3*e+0]||50331648&this._data[3*e+2])return e+(this._data[3*e+0]>>22);return 0}copyCellsFrom(e,t,n,r,i){let a=e._data;if(i)for(let i=r-1;i>=0;i--){for(let e=0;e<3;e++)this._data[3*(n+i)+e]=a[3*(t+i)+e];268435456&a[3*(t+i)+2]&&(this._extendedAttrs[n+i]=e._extendedAttrs[t+i])}else for(let i=0;i=t&&(this._combined[i-t+n]=e._combined[i])}}translateToString(e,t,n,r){t??=0,n??=this.length,e&&(n=Math.min(n,this.getTrimmedLength())),r&&(r.length=0);let i=``;for(;t>22||1}return r&&r.push(t),i}}t.BufferLine=c},4841:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.getRangeLength=void 0,t.getRangeLength=function(e,t){if(e.start.y>e.end.y)throw Error(`Buffer range end (${e.end.x}, ${e.end.y}) cannot be before start (${e.start.x}, ${e.start.y})`);return t*(e.end.y-e.start.y)+(e.end.x-e.start.x+1)}},4634:(e,t)=>{function n(e,t,n){if(t===e.length-1)return e[t].getTrimmedLength();let r=!e[t].hasContent(n-1)&&e[t].getWidth(n-1)===1,i=e[t+1].getWidth(0)===2;return r&&i?n-1:n}Object.defineProperty(t,"__esModule",{value:!0}),t.getWrappedLineTrimmedLength=t.reflowSmallerGetNewLineLengths=t.reflowLargerApplyNewLayout=t.reflowLargerCreateNewLayout=t.reflowLargerGetLinesToRemove=void 0,t.reflowLargerGetLinesToRemove=function(e,t,r,i,a){let o=[];for(let s=0;s=s&&i0&&(e>d||u[e].getTrimmedLength()===0);e--)h++;h>0&&(o.push(s+u.length-h),o.push(h)),s+=u.length-1}return o},t.reflowLargerCreateNewLayout=function(e,t){let n=[],r=0,i=t[r],a=0;for(let o=0;on(e,i,t))).reduce(((e,t)=>e+t)),o=0,s=0,c=0;for(;cl&&(o-=l,s++);let u=e[s].getWidth(o-1)===2;u&&o--;let d=u?r-1:r;i.push(d),c+=d}return i},t.getWrappedLineTrimmedLength=n},5295:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.BufferSet=void 0;let r=n(8460),i=n(844),a=n(9092);class o extends i.Disposable{constructor(e,t){super(),this._optionsService=e,this._bufferService=t,this._onBufferActivate=this.register(new r.EventEmitter),this.onBufferActivate=this._onBufferActivate.event,this.reset(),this.register(this._optionsService.onSpecificOptionChange(`scrollback`,(()=>this.resize(this._bufferService.cols,this._bufferService.rows)))),this.register(this._optionsService.onSpecificOptionChange(`tabStopWidth`,(()=>this.setupTabStops())))}reset(){this._normal=new a.Buffer(!0,this._optionsService,this._bufferService),this._normal.fillViewportRows(),this._alt=new a.Buffer(!1,this._optionsService,this._bufferService),this._activeBuffer=this._normal,this._onBufferActivate.fire({activeBuffer:this._normal,inactiveBuffer:this._alt}),this.setupTabStops()}get alt(){return this._alt}get active(){return this._activeBuffer}get normal(){return this._normal}activateNormalBuffer(){this._activeBuffer!==this._normal&&(this._normal.x=this._alt.x,this._normal.y=this._alt.y,this._alt.clearAllMarkers(),this._alt.clear(),this._activeBuffer=this._normal,this._onBufferActivate.fire({activeBuffer:this._normal,inactiveBuffer:this._alt}))}activateAltBuffer(e){this._activeBuffer!==this._alt&&(this._alt.fillViewportRows(e),this._alt.x=this._normal.x,this._alt.y=this._normal.y,this._activeBuffer=this._alt,this._onBufferActivate.fire({activeBuffer:this._alt,inactiveBuffer:this._normal}))}resize(e,t){this._normal.resize(e,t),this._alt.resize(e,t),this.setupTabStops(e)}setupTabStops(e){this._normal.setupTabStops(e),this._alt.setupTabStops(e)}}t.BufferSet=o},511:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.CellData=void 0;let r=n(482),i=n(643),a=n(3734);class o extends a.AttributeData{constructor(){super(...arguments),this.content=0,this.fg=0,this.bg=0,this.extended=new a.ExtendedAttrs,this.combinedData=``}static fromCharData(e){let t=new o;return t.setFromCharData(e),t}isCombined(){return 2097152&this.content}getWidth(){return this.content>>22}getChars(){return 2097152&this.content?this.combinedData:2097151&this.content?(0,r.stringFromCodePoint)(2097151&this.content):``}getCode(){return this.isCombined()?this.combinedData.charCodeAt(this.combinedData.length-1):2097151&this.content}setFromCharData(e){this.fg=e[i.CHAR_DATA_ATTR_INDEX],this.bg=0;let t=!1;if(e[i.CHAR_DATA_CHAR_INDEX].length>2)t=!0;else if(e[i.CHAR_DATA_CHAR_INDEX].length===2){let n=e[i.CHAR_DATA_CHAR_INDEX].charCodeAt(0);if(55296<=n&&n<=56319){let r=e[i.CHAR_DATA_CHAR_INDEX].charCodeAt(1);56320<=r&&r<=57343?this.content=1024*(n-55296)+r-56320+65536|e[i.CHAR_DATA_WIDTH_INDEX]<<22:t=!0}else t=!0}else this.content=e[i.CHAR_DATA_CHAR_INDEX].charCodeAt(0)|e[i.CHAR_DATA_WIDTH_INDEX]<<22;t&&(this.combinedData=e[i.CHAR_DATA_CHAR_INDEX],this.content=2097152|e[i.CHAR_DATA_WIDTH_INDEX]<<22)}getAsCharData(){return[this.fg,this.getChars(),this.getWidth(),this.getCode()]}}t.CellData=o},643:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.WHITESPACE_CELL_CODE=t.WHITESPACE_CELL_WIDTH=t.WHITESPACE_CELL_CHAR=t.NULL_CELL_CODE=t.NULL_CELL_WIDTH=t.NULL_CELL_CHAR=t.CHAR_DATA_CODE_INDEX=t.CHAR_DATA_WIDTH_INDEX=t.CHAR_DATA_CHAR_INDEX=t.CHAR_DATA_ATTR_INDEX=t.DEFAULT_EXT=t.DEFAULT_ATTR=t.DEFAULT_COLOR=void 0,t.DEFAULT_COLOR=0,t.DEFAULT_ATTR=256|t.DEFAULT_COLOR<<9,t.DEFAULT_EXT=0,t.CHAR_DATA_ATTR_INDEX=0,t.CHAR_DATA_CHAR_INDEX=1,t.CHAR_DATA_WIDTH_INDEX=2,t.CHAR_DATA_CODE_INDEX=3,t.NULL_CELL_CHAR=``,t.NULL_CELL_WIDTH=1,t.NULL_CELL_CODE=0,t.WHITESPACE_CELL_CHAR=` `,t.WHITESPACE_CELL_WIDTH=1,t.WHITESPACE_CELL_CODE=32},4863:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.Marker=void 0;let r=n(8460),i=n(844);class a{get id(){return this._id}constructor(e){this.line=e,this.isDisposed=!1,this._disposables=[],this._id=a._nextId++,this._onDispose=this.register(new r.EventEmitter),this.onDispose=this._onDispose.event}dispose(){this.isDisposed||(this.isDisposed=!0,this.line=-1,this._onDispose.fire(),(0,i.disposeArray)(this._disposables),this._disposables.length=0)}register(e){return this._disposables.push(e),e}}t.Marker=a,a._nextId=1},7116:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.DEFAULT_CHARSET=t.CHARSETS=void 0,t.CHARSETS={},t.DEFAULT_CHARSET=t.CHARSETS.B,t.CHARSETS[0]={"`":`◆`,a:`▒`,b:`␉`,c:`␌`,d:`␍`,e:`␊`,f:`°`,g:`±`,h:`␤`,i:`␋`,j:`┘`,k:`┐`,l:`┌`,m:`└`,n:`┼`,o:`⎺`,p:`⎻`,q:`─`,r:`⎼`,s:`⎽`,t:`├`,u:`┤`,v:`┴`,w:`┬`,x:`│`,y:`≤`,z:`≥`,"{":`π`,"|":`≠`,"}":`£`,"~":`·`},t.CHARSETS.A={"#":`£`},t.CHARSETS.B=void 0,t.CHARSETS[4]={"#":`£`,"@":`¾`,"[":`ij`,"\\":`½`,"]":`|`,"{":`¨`,"|":`f`,"}":`¼`,"~":`´`},t.CHARSETS.C=t.CHARSETS[5]={"[":`Ä`,"\\":`Ö`,"]":`Å`,"^":`Ü`,"`":`é`,"{":`ä`,"|":`ö`,"}":`å`,"~":`ü`},t.CHARSETS.R={"#":`£`,"@":`à`,"[":`°`,"\\":`ç`,"]":`§`,"{":`é`,"|":`ù`,"}":`è`,"~":`¨`},t.CHARSETS.Q={"@":`à`,"[":`â`,"\\":`ç`,"]":`ê`,"^":`î`,"`":`ô`,"{":`é`,"|":`ù`,"}":`è`,"~":`û`},t.CHARSETS.K={"@":`§`,"[":`Ä`,"\\":`Ö`,"]":`Ü`,"{":`ä`,"|":`ö`,"}":`ü`,"~":`ß`},t.CHARSETS.Y={"#":`£`,"@":`§`,"[":`°`,"\\":`ç`,"]":`é`,"`":`ù`,"{":`à`,"|":`ò`,"}":`è`,"~":`ì`},t.CHARSETS.E=t.CHARSETS[6]={"@":`Ä`,"[":`Æ`,"\\":`Ø`,"]":`Å`,"^":`Ü`,"`":`ä`,"{":`æ`,"|":`ø`,"}":`å`,"~":`ü`},t.CHARSETS.Z={"#":`£`,"@":`§`,"[":`¡`,"\\":`Ñ`,"]":`¿`,"{":`°`,"|":`ñ`,"}":`ç`},t.CHARSETS.H=t.CHARSETS[7]={"@":`É`,"[":`Ä`,"\\":`Ö`,"]":`Å`,"^":`Ü`,"`":`é`,"{":`ä`,"|":`ö`,"}":`å`,"~":`ü`},t.CHARSETS[`=`]={"#":`ù`,"@":`à`,"[":`é`,"\\":`ç`,"]":`ê`,"^":`î`,_:`è`,"`":`ô`,"{":`ä`,"|":`ö`,"}":`ü`,"~":`û`}},2584:(e,t)=>{var n,r,i;Object.defineProperty(t,"__esModule",{value:!0}),t.C1_ESCAPED=t.C1=t.C0=void 0,function(e){e.NUL=`\0`,e.SOH=``,e.STX=``,e.ETX=``,e.EOT=``,e.ENQ=``,e.ACK=``,e.BEL=`\x07`,e.BS=`\b`,e.HT=` `,e.LF=` -`,e.VT=`\v`,e.FF=`\f`,e.CR=`\r`,e.SO=``,e.SI=``,e.DLE=``,e.DC1=``,e.DC2=``,e.DC3=``,e.DC4=``,e.NAK=``,e.SYN=``,e.ETB=``,e.CAN=``,e.EM=``,e.SUB=``,e.ESC=`\x1B`,e.FS=``,e.GS=``,e.RS=``,e.US=``,e.SP=` `,e.DEL=``}(n||(t.C0=n={})),function(e){e.PAD=`€`,e.HOP=``,e.BPH=`‚`,e.NBH=`ƒ`,e.IND=`„`,e.NEL=`…`,e.SSA=`†`,e.ESA=`‡`,e.HTS=`ˆ`,e.HTJ=`‰`,e.VTS=`Š`,e.PLD=`‹`,e.PLU=`Œ`,e.RI=``,e.SS2=`Ž`,e.SS3=``,e.DCS=``,e.PU1=`‘`,e.PU2=`’`,e.STS=`“`,e.CCH=`”`,e.MW=`•`,e.SPA=`–`,e.EPA=`—`,e.SOS=`˜`,e.SGCI=`™`,e.SCI=`š`,e.CSI=`›`,e.ST=`œ`,e.OSC=``,e.PM=`ž`,e.APC=`Ÿ`}(r||(t.C1=r={})),function(e){e.ST=`${n.ESC}\\`}(i||(t.C1_ESCAPED=i={}))},7399:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.evaluateKeyboardEvent=void 0;let r=n(2584),i={48:[`0`,`)`],49:[`1`,`!`],50:[`2`,`@`],51:[`3`,`#`],52:[`4`,`$`],53:[`5`,`%`],54:[`6`,`^`],55:[`7`,`&`],56:[`8`,`*`],57:[`9`,`(`],186:[`;`,`:`],187:[`=`,`+`],188:[`,`,`<`],189:[`-`,`_`],190:[`.`,`>`],191:[`/`,`?`],192:["`",`~`],219:[`[`,`{`],220:[`\\`,`|`],221:[`]`,`}`],222:[`'`,`"`]};t.evaluateKeyboardEvent=function(e,t,n,a){let o={type:0,cancel:!1,key:void 0},s=!!e.shiftKey|(e.altKey?2:0)|(e.ctrlKey?4:0)|(e.metaKey?8:0);switch(e.keyCode){case 0:e.key===`UIKeyInputUpArrow`?o.key=t?r.C0.ESC+`OA`:r.C0.ESC+`[A`:e.key===`UIKeyInputLeftArrow`?o.key=t?r.C0.ESC+`OD`:r.C0.ESC+`[D`:e.key===`UIKeyInputRightArrow`?o.key=t?r.C0.ESC+`OC`:r.C0.ESC+`[C`:e.key===`UIKeyInputDownArrow`&&(o.key=t?r.C0.ESC+`OB`:r.C0.ESC+`[B`);break;case 8:o.key=e.ctrlKey?`\b`:r.C0.DEL,e.altKey&&(o.key=r.C0.ESC+o.key);break;case 9:if(e.shiftKey){o.key=r.C0.ESC+`[Z`;break}o.key=r.C0.HT,o.cancel=!0;break;case 13:o.key=e.altKey?r.C0.ESC+r.C0.CR:r.C0.CR,o.cancel=!0;break;case 27:o.key=r.C0.ESC,e.altKey&&(o.key=r.C0.ESC+r.C0.ESC),o.cancel=!0;break;case 37:if(e.metaKey)break;s?(o.key=r.C0.ESC+`[1;`+(s+1)+`D`,o.key===r.C0.ESC+`[1;3D`&&(o.key=r.C0.ESC+(n?`b`:`[1;5D`))):o.key=t?r.C0.ESC+`OD`:r.C0.ESC+`[D`;break;case 39:if(e.metaKey)break;s?(o.key=r.C0.ESC+`[1;`+(s+1)+`C`,o.key===r.C0.ESC+`[1;3C`&&(o.key=r.C0.ESC+(n?`f`:`[1;5C`))):o.key=t?r.C0.ESC+`OC`:r.C0.ESC+`[C`;break;case 38:if(e.metaKey)break;s?(o.key=r.C0.ESC+`[1;`+(s+1)+`A`,n||o.key!==r.C0.ESC+`[1;3A`||(o.key=r.C0.ESC+`[1;5A`)):o.key=t?r.C0.ESC+`OA`:r.C0.ESC+`[A`;break;case 40:if(e.metaKey)break;s?(o.key=r.C0.ESC+`[1;`+(s+1)+`B`,n||o.key!==r.C0.ESC+`[1;3B`||(o.key=r.C0.ESC+`[1;5B`)):o.key=t?r.C0.ESC+`OB`:r.C0.ESC+`[B`;break;case 45:e.shiftKey||e.ctrlKey||(o.key=r.C0.ESC+`[2~`);break;case 46:o.key=s?r.C0.ESC+`[3;`+(s+1)+`~`:r.C0.ESC+`[3~`;break;case 36:o.key=s?r.C0.ESC+`[1;`+(s+1)+`H`:t?r.C0.ESC+`OH`:r.C0.ESC+`[H`;break;case 35:o.key=s?r.C0.ESC+`[1;`+(s+1)+`F`:t?r.C0.ESC+`OF`:r.C0.ESC+`[F`;break;case 33:e.shiftKey?o.type=2:e.ctrlKey?o.key=r.C0.ESC+`[5;`+(s+1)+`~`:o.key=r.C0.ESC+`[5~`;break;case 34:e.shiftKey?o.type=3:e.ctrlKey?o.key=r.C0.ESC+`[6;`+(s+1)+`~`:o.key=r.C0.ESC+`[6~`;break;case 112:o.key=s?r.C0.ESC+`[1;`+(s+1)+`P`:r.C0.ESC+`OP`;break;case 113:o.key=s?r.C0.ESC+`[1;`+(s+1)+`Q`:r.C0.ESC+`OQ`;break;case 114:o.key=s?r.C0.ESC+`[1;`+(s+1)+`R`:r.C0.ESC+`OR`;break;case 115:o.key=s?r.C0.ESC+`[1;`+(s+1)+`S`:r.C0.ESC+`OS`;break;case 116:o.key=s?r.C0.ESC+`[15;`+(s+1)+`~`:r.C0.ESC+`[15~`;break;case 117:o.key=s?r.C0.ESC+`[17;`+(s+1)+`~`:r.C0.ESC+`[17~`;break;case 118:o.key=s?r.C0.ESC+`[18;`+(s+1)+`~`:r.C0.ESC+`[18~`;break;case 119:o.key=s?r.C0.ESC+`[19;`+(s+1)+`~`:r.C0.ESC+`[19~`;break;case 120:o.key=s?r.C0.ESC+`[20;`+(s+1)+`~`:r.C0.ESC+`[20~`;break;case 121:o.key=s?r.C0.ESC+`[21;`+(s+1)+`~`:r.C0.ESC+`[21~`;break;case 122:o.key=s?r.C0.ESC+`[23;`+(s+1)+`~`:r.C0.ESC+`[23~`;break;case 123:o.key=s?r.C0.ESC+`[24;`+(s+1)+`~`:r.C0.ESC+`[24~`;break;default:if(!e.ctrlKey||e.shiftKey||e.altKey||e.metaKey)if(n&&!a||!e.altKey||e.metaKey)!n||e.altKey||e.ctrlKey||e.shiftKey||!e.metaKey?e.key&&!e.ctrlKey&&!e.altKey&&!e.metaKey&&e.keyCode>=48&&e.key.length===1?o.key=e.key:e.key&&e.ctrlKey&&(e.key===`_`&&(o.key=r.C0.US),e.key===`@`&&(o.key=r.C0.NUL)):e.keyCode===65&&(o.type=1);else{let t=i[e.keyCode]?.[+!!e.shiftKey];if(t)o.key=r.C0.ESC+t;else if(e.keyCode>=65&&e.keyCode<=90){let t=e.ctrlKey?e.keyCode-64:e.keyCode+32,n=String.fromCharCode(t);e.shiftKey&&(n=n.toUpperCase()),o.key=r.C0.ESC+n}else if(e.keyCode===32)o.key=r.C0.ESC+(e.ctrlKey?r.C0.NUL:` `);else if(e.key===`Dead`&&e.code.startsWith(`Key`)){let t=e.code.slice(3,4);e.shiftKey||(t=t.toLowerCase()),o.key=r.C0.ESC+t,o.cancel=!0}}else e.keyCode>=65&&e.keyCode<=90?o.key=String.fromCharCode(e.keyCode-64):e.keyCode===32?o.key=r.C0.NUL:e.keyCode>=51&&e.keyCode<=55?o.key=String.fromCharCode(e.keyCode-51+27):e.keyCode===56?o.key=r.C0.DEL:e.keyCode===219?o.key=r.C0.ESC:e.keyCode===220?o.key=r.C0.FS:e.keyCode===221&&(o.key=r.C0.GS)}return o}},482:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.Utf8ToUtf32=t.StringToUtf32=t.utf32ToString=t.stringFromCodePoint=void 0,t.stringFromCodePoint=function(e){return e>65535?(e-=65536,String.fromCharCode(55296+(e>>10))+String.fromCharCode(e%1024+56320)):String.fromCharCode(e)},t.utf32ToString=function(e,t=0,n=e.length){let r=``;for(let i=t;i65535?(t-=65536,r+=String.fromCharCode(55296+(t>>10))+String.fromCharCode(t%1024+56320)):r+=String.fromCharCode(t)}return r},t.StringToUtf32=class{constructor(){this._interim=0}clear(){this._interim=0}decode(e,t){let n=e.length;if(!n)return 0;let r=0,i=0;if(this._interim){let n=e.charCodeAt(i++);56320<=n&&n<=57343?t[r++]=1024*(this._interim-55296)+n-56320+65536:(t[r++]=this._interim,t[r++]=n),this._interim=0}for(let a=i;a=n)return this._interim=i,r;let o=e.charCodeAt(a);56320<=o&&o<=57343?t[r++]=1024*(i-55296)+o-56320+65536:(t[r++]=i,t[r++]=o)}else i!==65279&&(t[r++]=i)}return r}},t.Utf8ToUtf32=class{constructor(){this.interim=new Uint8Array(3)}clear(){this.interim.fill(0)}decode(e,t){let n=e.length;if(!n)return 0;let r,i,a,o,s=0,c=0,l=0;if(this.interim[0]){let r=!1,i=this.interim[0];i&=(224&i)==192?31:(240&i)==224?15:7;let a,o=0;for(;(a=63&this.interim[++o])&&o<4;)i<<=6,i|=a;let c=(224&this.interim[0])==192?2:(240&this.interim[0])==224?3:4,u=c-o;for(;l=n)return 0;if(a=e[l++],(192&a)!=128){l--,r=!0;break}this.interim[o++]=a,i<<=6,i|=63&a}r||(c===2?i<128?l--:t[s++]=i:c===3?i<2048||i>=55296&&i<=57343||i===65279||(t[s++]=i):i<65536||i>1114111||(t[s++]=i)),this.interim.fill(0)}let u=n-4,d=l;for(;d=n)return this.interim[0]=r,s;if(i=e[d++],(192&i)!=128){d--;continue}if(c=(31&r)<<6|63&i,c<128){d--;continue}t[s++]=c}else if((240&r)==224){if(d>=n)return this.interim[0]=r,s;if(i=e[d++],(192&i)!=128){d--;continue}if(d>=n)return this.interim[0]=r,this.interim[1]=i,s;if(a=e[d++],(192&a)!=128){d--;continue}if(c=(15&r)<<12|(63&i)<<6|63&a,c<2048||c>=55296&&c<=57343||c===65279)continue;t[s++]=c}else if((248&r)==240){if(d>=n)return this.interim[0]=r,s;if(i=e[d++],(192&i)!=128){d--;continue}if(d>=n)return this.interim[0]=r,this.interim[1]=i,s;if(a=e[d++],(192&a)!=128){d--;continue}if(d>=n)return this.interim[0]=r,this.interim[1]=i,this.interim[2]=a,s;if(o=e[d++],(192&o)!=128){d--;continue}if(c=(7&r)<<18|(63&i)<<12|(63&a)<<6|63&o,c<65536||c>1114111)continue;t[s++]=c}}return s}}},225:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.UnicodeV6=void 0;let r=n(1480),i=[[768,879],[1155,1158],[1160,1161],[1425,1469],[1471,1471],[1473,1474],[1476,1477],[1479,1479],[1536,1539],[1552,1557],[1611,1630],[1648,1648],[1750,1764],[1767,1768],[1770,1773],[1807,1807],[1809,1809],[1840,1866],[1958,1968],[2027,2035],[2305,2306],[2364,2364],[2369,2376],[2381,2381],[2385,2388],[2402,2403],[2433,2433],[2492,2492],[2497,2500],[2509,2509],[2530,2531],[2561,2562],[2620,2620],[2625,2626],[2631,2632],[2635,2637],[2672,2673],[2689,2690],[2748,2748],[2753,2757],[2759,2760],[2765,2765],[2786,2787],[2817,2817],[2876,2876],[2879,2879],[2881,2883],[2893,2893],[2902,2902],[2946,2946],[3008,3008],[3021,3021],[3134,3136],[3142,3144],[3146,3149],[3157,3158],[3260,3260],[3263,3263],[3270,3270],[3276,3277],[3298,3299],[3393,3395],[3405,3405],[3530,3530],[3538,3540],[3542,3542],[3633,3633],[3636,3642],[3655,3662],[3761,3761],[3764,3769],[3771,3772],[3784,3789],[3864,3865],[3893,3893],[3895,3895],[3897,3897],[3953,3966],[3968,3972],[3974,3975],[3984,3991],[3993,4028],[4038,4038],[4141,4144],[4146,4146],[4150,4151],[4153,4153],[4184,4185],[4448,4607],[4959,4959],[5906,5908],[5938,5940],[5970,5971],[6002,6003],[6068,6069],[6071,6077],[6086,6086],[6089,6099],[6109,6109],[6155,6157],[6313,6313],[6432,6434],[6439,6440],[6450,6450],[6457,6459],[6679,6680],[6912,6915],[6964,6964],[6966,6970],[6972,6972],[6978,6978],[7019,7027],[7616,7626],[7678,7679],[8203,8207],[8234,8238],[8288,8291],[8298,8303],[8400,8431],[12330,12335],[12441,12442],[43014,43014],[43019,43019],[43045,43046],[64286,64286],[65024,65039],[65056,65059],[65279,65279],[65529,65531]],a=[[68097,68099],[68101,68102],[68108,68111],[68152,68154],[68159,68159],[119143,119145],[119155,119170],[119173,119179],[119210,119213],[119362,119364],[917505,917505],[917536,917631],[917760,917999]],o;t.UnicodeV6=class{constructor(){if(this.version=`6`,!o){o=new Uint8Array(65536),o.fill(1),o[0]=0,o.fill(0,1,32),o.fill(0,127,160),o.fill(2,4352,4448),o[9001]=2,o[9002]=2,o.fill(2,11904,42192),o[12351]=1,o.fill(2,44032,55204),o.fill(2,63744,64256),o.fill(2,65040,65050),o.fill(2,65072,65136),o.fill(2,65280,65377),o.fill(2,65504,65511);for(let e=0;et[i][1])return!1;for(;i>=r;)if(n=r+i>>1,e>t[n][1])r=n+1;else{if(!(e=131072&&e<=196605||e>=196608&&e<=262141?2:1}charProperties(e,t){let n=this.wcwidth(e),i=n===0&&t!==0;if(i){let e=r.UnicodeService.extractWidth(t);e===0?i=!1:e>n&&(n=e)}return r.UnicodeService.createPropertyValue(0,n,i)}}},5981:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.WriteBuffer=void 0;let r=n(8460),i=n(844);class a extends i.Disposable{constructor(e){super(),this._action=e,this._writeBuffer=[],this._callbacks=[],this._pendingData=0,this._bufferOffset=0,this._isSyncWriting=!1,this._syncCalls=0,this._didUserInput=!1,this._onWriteParsed=this.register(new r.EventEmitter),this.onWriteParsed=this._onWriteParsed.event}handleUserInput(){this._didUserInput=!0}writeSync(e,t){if(t!==void 0&&this._syncCalls>t)return void(this._syncCalls=0);if(this._pendingData+=e.length,this._writeBuffer.push(e),this._callbacks.push(void 0),this._syncCalls++,this._isSyncWriting)return;let n;for(this._isSyncWriting=!0;n=this._writeBuffer.shift();){this._action(n);let e=this._callbacks.shift();e&&e()}this._pendingData=0,this._bufferOffset=2147483647,this._isSyncWriting=!1,this._syncCalls=0}write(e,t){if(this._pendingData>5e7)throw Error(`write data discarded, use flow control to avoid losing data`);if(!this._writeBuffer.length){if(this._bufferOffset=0,this._didUserInput)return this._didUserInput=!1,this._pendingData+=e.length,this._writeBuffer.push(e),this._callbacks.push(t),void this._innerWrite();setTimeout((()=>this._innerWrite()))}this._pendingData+=e.length,this._writeBuffer.push(e),this._callbacks.push(t)}_innerWrite(e=0,t=!0){let n=e||Date.now();for(;this._writeBuffer.length>this._bufferOffset;){let e=this._writeBuffer[this._bufferOffset],r=this._action(e,t);if(r){r.catch((e=>(queueMicrotask((()=>{throw e})),Promise.resolve(!1)))).then(e=>Date.now()-n>=12?setTimeout((()=>this._innerWrite(0,e))):this._innerWrite(n,e));return}let i=this._callbacks[this._bufferOffset];if(i&&i(),this._bufferOffset++,this._pendingData-=e.length,Date.now()-n>=12)break}this._writeBuffer.length>this._bufferOffset?(this._bufferOffset>50&&(this._writeBuffer=this._writeBuffer.slice(this._bufferOffset),this._callbacks=this._callbacks.slice(this._bufferOffset),this._bufferOffset=0),setTimeout((()=>this._innerWrite()))):(this._writeBuffer.length=0,this._callbacks.length=0,this._pendingData=0,this._bufferOffset=0),this._onWriteParsed.fire()}}t.WriteBuffer=a},5941:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.toRgbString=t.parseColor=void 0;let n=/^([\da-f])\/([\da-f])\/([\da-f])$|^([\da-f]{2})\/([\da-f]{2})\/([\da-f]{2})$|^([\da-f]{3})\/([\da-f]{3})\/([\da-f]{3})$|^([\da-f]{4})\/([\da-f]{4})\/([\da-f]{4})$/,r=/^[\da-f]+$/;function i(e,t){let n=e.toString(16),r=n.length<2?`0`+n:n;switch(t){case 4:return n[0];case 8:return r;case 12:return(r+r).slice(0,3);default:return r+r}}t.parseColor=function(e){if(!e)return;let t=e.toLowerCase();if(t.indexOf(`rgb:`)===0){t=t.slice(4);let e=n.exec(t);if(e){let t=e[1]?15:e[4]?255:e[7]?4095:65535;return[Math.round(parseInt(e[1]||e[4]||e[7]||e[10],16)/t*255),Math.round(parseInt(e[2]||e[5]||e[8]||e[11],16)/t*255),Math.round(parseInt(e[3]||e[6]||e[9]||e[12],16)/t*255)]}}else if(t.indexOf(`#`)===0&&(t=t.slice(1),r.exec(t)&&[3,6,9,12].includes(t.length))){let e=t.length/3,n=[0,0,0];for(let r=0;r<3;++r){let i=parseInt(t.slice(e*r,e*r+e),16);n[r]=e===1?i<<4:e===2?i:e===3?i>>4:i>>8}return n}},t.toRgbString=function(e,t=16){let[n,r,a]=e;return`rgb:${i(n,t)}/${i(r,t)}/${i(a,t)}`}},5770:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.PAYLOAD_LIMIT=void 0,t.PAYLOAD_LIMIT=1e7},6351:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.DcsHandler=t.DcsParser=void 0;let r=n(482),i=n(8742),a=n(5770),o=[];t.DcsParser=class{constructor(){this._handlers=Object.create(null),this._active=o,this._ident=0,this._handlerFb=()=>{},this._stack={paused:!1,loopPosition:0,fallThrough:!1}}dispose(){this._handlers=Object.create(null),this._handlerFb=()=>{},this._active=o}registerHandler(e,t){this._handlers[e]===void 0&&(this._handlers[e]=[]);let n=this._handlers[e];return n.push(t),{dispose:()=>{let e=n.indexOf(t);e!==-1&&n.splice(e,1)}}}clearHandler(e){this._handlers[e]&&delete this._handlers[e]}setHandlerFallback(e){this._handlerFb=e}reset(){if(this._active.length)for(let e=this._stack.paused?this._stack.loopPosition-1:this._active.length-1;e>=0;--e)this._active[e].unhook(!1);this._stack.paused=!1,this._active=o,this._ident=0}hook(e,t){if(this.reset(),this._ident=e,this._active=this._handlers[e]||o,this._active.length)for(let e=this._active.length-1;e>=0;e--)this._active[e].hook(t);else this._handlerFb(this._ident,`HOOK`,t)}put(e,t,n){if(this._active.length)for(let r=this._active.length-1;r>=0;r--)this._active[r].put(e,t,n);else this._handlerFb(this._ident,`PUT`,(0,r.utf32ToString)(e,t,n))}unhook(e,t=!0){if(this._active.length){let n=!1,r=this._active.length-1,i=!1;if(this._stack.paused&&(r=this._stack.loopPosition-1,n=t,i=this._stack.fallThrough,this._stack.paused=!1),!i&&!1===n){for(;r>=0&&(n=this._active[r].unhook(e),!0!==n);r--)if(n instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=r,this._stack.fallThrough=!1,n;r--}for(;r>=0;r--)if(n=this._active[r].unhook(!1),n instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=r,this._stack.fallThrough=!0,n}else this._handlerFb(this._ident,`UNHOOK`,e);this._active=o,this._ident=0}};let s=new i.Params;s.addParam(0),t.DcsHandler=class{constructor(e){this._handler=e,this._data=``,this._params=s,this._hitLimit=!1}hook(e){this._params=e.length>1||e.params[0]?e.clone():s,this._data=``,this._hitLimit=!1}put(e,t,n){this._hitLimit||(this._data+=(0,r.utf32ToString)(e,t,n),this._data.length>a.PAYLOAD_LIMIT&&(this._data=``,this._hitLimit=!0))}unhook(e){let t=!1;if(this._hitLimit)t=!1;else if(e&&(t=this._handler(this._data,this._params),t instanceof Promise))return t.then((e=>(this._params=s,this._data=``,this._hitLimit=!1,e)));return this._params=s,this._data=``,this._hitLimit=!1,t}}},2015:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.EscapeSequenceParser=t.VT500_TRANSITION_TABLE=t.TransitionTable=void 0;let r=n(844),i=n(8742),a=n(6242),o=n(6351);class s{constructor(e){this.table=new Uint8Array(e)}setDefault(e,t){this.table.fill(e<<4|t)}add(e,t,n,r){this.table[t<<8|e]=n<<4|r}addMany(e,t,n,r){for(let i=0;it)),n=(e,n)=>t.slice(e,n),r=n(32,127),i=n(0,24);i.push(25),i.push.apply(i,n(28,32));let a=n(0,14),o;for(o in e.setDefault(1,0),e.addMany(r,0,2,0),a)e.addMany([24,26,153,154],o,3,0),e.addMany(n(128,144),o,3,0),e.addMany(n(144,152),o,3,0),e.add(156,o,0,0),e.add(27,o,11,1),e.add(157,o,4,8),e.addMany([152,158,159],o,0,7),e.add(155,o,11,3),e.add(144,o,11,9);return e.addMany(i,0,3,0),e.addMany(i,1,3,1),e.add(127,1,0,1),e.addMany(i,8,0,8),e.addMany(i,3,3,3),e.add(127,3,0,3),e.addMany(i,4,3,4),e.add(127,4,0,4),e.addMany(i,6,3,6),e.addMany(i,5,3,5),e.add(127,5,0,5),e.addMany(i,2,3,2),e.add(127,2,0,2),e.add(93,1,4,8),e.addMany(r,8,5,8),e.add(127,8,5,8),e.addMany([156,27,24,26,7],8,6,0),e.addMany(n(28,32),8,0,8),e.addMany([88,94,95],1,0,7),e.addMany(r,7,0,7),e.addMany(i,7,0,7),e.add(156,7,0,0),e.add(127,7,0,7),e.add(91,1,11,3),e.addMany(n(64,127),3,7,0),e.addMany(n(48,60),3,8,4),e.addMany([60,61,62,63],3,9,4),e.addMany(n(48,60),4,8,4),e.addMany(n(64,127),4,7,0),e.addMany([60,61,62,63],4,0,6),e.addMany(n(32,64),6,0,6),e.add(127,6,0,6),e.addMany(n(64,127),6,0,0),e.addMany(n(32,48),3,9,5),e.addMany(n(32,48),5,9,5),e.addMany(n(48,64),5,0,6),e.addMany(n(64,127),5,7,0),e.addMany(n(32,48),4,9,5),e.addMany(n(32,48),1,9,2),e.addMany(n(32,48),2,9,2),e.addMany(n(48,127),2,10,0),e.addMany(n(48,80),1,10,0),e.addMany(n(81,88),1,10,0),e.addMany([89,90,92],1,10,0),e.addMany(n(96,127),1,10,0),e.add(80,1,11,9),e.addMany(i,9,0,9),e.add(127,9,0,9),e.addMany(n(28,32),9,0,9),e.addMany(n(32,48),9,9,12),e.addMany(n(48,60),9,8,10),e.addMany([60,61,62,63],9,9,10),e.addMany(i,11,0,11),e.addMany(n(32,128),11,0,11),e.addMany(n(28,32),11,0,11),e.addMany(i,10,0,10),e.add(127,10,0,10),e.addMany(n(28,32),10,0,10),e.addMany(n(48,60),10,8,10),e.addMany([60,61,62,63],10,0,11),e.addMany(n(32,48),10,9,12),e.addMany(i,12,0,12),e.add(127,12,0,12),e.addMany(n(28,32),12,0,12),e.addMany(n(32,48),12,9,12),e.addMany(n(48,64),12,0,11),e.addMany(n(64,127),12,12,13),e.addMany(n(64,127),10,12,13),e.addMany(n(64,127),9,12,13),e.addMany(i,13,13,13),e.addMany(r,13,13,13),e.add(127,13,0,13),e.addMany([27,156,24,26],13,14,0),e.add(160,0,2,0),e.add(160,8,5,8),e.add(160,6,0,6),e.add(160,11,0,11),e.add(160,13,13,13),e}();class c extends r.Disposable{constructor(e=t.VT500_TRANSITION_TABLE){super(),this._transitions=e,this._parseStack={state:0,handlers:[],handlerPos:0,transition:0,chunkPos:0},this.initialState=0,this.currentState=this.initialState,this._params=new i.Params,this._params.addParam(0),this._collect=0,this.precedingJoinState=0,this._printHandlerFb=(e,t,n)=>{},this._executeHandlerFb=e=>{},this._csiHandlerFb=(e,t)=>{},this._escHandlerFb=e=>{},this._errorHandlerFb=e=>e,this._printHandler=this._printHandlerFb,this._executeHandlers=Object.create(null),this._csiHandlers=Object.create(null),this._escHandlers=Object.create(null),this.register((0,r.toDisposable)((()=>{this._csiHandlers=Object.create(null),this._executeHandlers=Object.create(null),this._escHandlers=Object.create(null)}))),this._oscParser=this.register(new a.OscParser),this._dcsParser=this.register(new o.DcsParser),this._errorHandler=this._errorHandlerFb,this.registerEscHandler({final:`\\`},(()=>!0))}_identifier(e,t=[64,126]){let n=0;if(e.prefix){if(e.prefix.length>1)throw Error(`only one byte as prefix supported`);if(n=e.prefix.charCodeAt(0),n&&60>n||n>63)throw Error(`prefix must be in range 0x3c .. 0x3f`)}if(e.intermediates){if(e.intermediates.length>2)throw Error(`only two bytes as intermediates are supported`);for(let t=0;tr||r>47)throw Error(`intermediate must be in range 0x20 .. 0x2f`);n<<=8,n|=r}}if(e.final.length!==1)throw Error(`final must be a single byte`);let r=e.final.charCodeAt(0);if(t[0]>r||r>t[1])throw Error(`final must be in range ${t[0]} .. ${t[1]}`);return n<<=8,n|=r,n}identToString(e){let t=[];for(;e;)t.push(String.fromCharCode(255&e)),e>>=8;return t.reverse().join(``)}setPrintHandler(e){this._printHandler=e}clearPrintHandler(){this._printHandler=this._printHandlerFb}registerEscHandler(e,t){let n=this._identifier(e,[48,126]);this._escHandlers[n]===void 0&&(this._escHandlers[n]=[]);let r=this._escHandlers[n];return r.push(t),{dispose:()=>{let e=r.indexOf(t);e!==-1&&r.splice(e,1)}}}clearEscHandler(e){this._escHandlers[this._identifier(e,[48,126])]&&delete this._escHandlers[this._identifier(e,[48,126])]}setEscHandlerFallback(e){this._escHandlerFb=e}setExecuteHandler(e,t){this._executeHandlers[e.charCodeAt(0)]=t}clearExecuteHandler(e){this._executeHandlers[e.charCodeAt(0)]&&delete this._executeHandlers[e.charCodeAt(0)]}setExecuteHandlerFallback(e){this._executeHandlerFb=e}registerCsiHandler(e,t){let n=this._identifier(e);this._csiHandlers[n]===void 0&&(this._csiHandlers[n]=[]);let r=this._csiHandlers[n];return r.push(t),{dispose:()=>{let e=r.indexOf(t);e!==-1&&r.splice(e,1)}}}clearCsiHandler(e){this._csiHandlers[this._identifier(e)]&&delete this._csiHandlers[this._identifier(e)]}setCsiHandlerFallback(e){this._csiHandlerFb=e}registerDcsHandler(e,t){return this._dcsParser.registerHandler(this._identifier(e),t)}clearDcsHandler(e){this._dcsParser.clearHandler(this._identifier(e))}setDcsHandlerFallback(e){this._dcsParser.setHandlerFallback(e)}registerOscHandler(e,t){return this._oscParser.registerHandler(e,t)}clearOscHandler(e){this._oscParser.clearHandler(e)}setOscHandlerFallback(e){this._oscParser.setHandlerFallback(e)}setErrorHandler(e){this._errorHandler=e}clearErrorHandler(){this._errorHandler=this._errorHandlerFb}reset(){this.currentState=this.initialState,this._oscParser.reset(),this._dcsParser.reset(),this._params.reset(),this._params.addParam(0),this._collect=0,this.precedingJoinState=0,this._parseStack.state!==0&&(this._parseStack.state=2,this._parseStack.handlers=[])}_preserveStack(e,t,n,r,i){this._parseStack.state=e,this._parseStack.handlers=t,this._parseStack.handlerPos=n,this._parseStack.transition=r,this._parseStack.chunkPos=i}parse(e,t,n){let r,i=0,a=0,o=0;if(this._parseStack.state)if(this._parseStack.state===2)this._parseStack.state=0,o=this._parseStack.chunkPos+1;else{if(n===void 0||this._parseStack.state===1)throw this._parseStack.state=1,Error(`improper continuation due to previous async handler, giving up parsing`);let t=this._parseStack.handlers,a=this._parseStack.handlerPos-1;switch(this._parseStack.state){case 3:if(!1===n&&a>-1){for(;a>=0&&(r=t[a](this._params),!0!==r);a--)if(r instanceof Promise)return this._parseStack.handlerPos=a,r}this._parseStack.handlers=[];break;case 4:if(!1===n&&a>-1){for(;a>=0&&(r=t[a](),!0!==r);a--)if(r instanceof Promise)return this._parseStack.handlerPos=a,r}this._parseStack.handlers=[];break;case 6:if(i=e[this._parseStack.chunkPos],r=this._dcsParser.unhook(i!==24&&i!==26,n),r)return r;i===27&&(this._parseStack.transition|=1),this._params.reset(),this._params.addParam(0),this._collect=0;break;case 5:if(i=e[this._parseStack.chunkPos],r=this._oscParser.end(i!==24&&i!==26,n),r)return r;i===27&&(this._parseStack.transition|=1),this._params.reset(),this._params.addParam(0),this._collect=0}this._parseStack.state=0,o=this._parseStack.chunkPos+1,this.precedingJoinState=0,this.currentState=15&this._parseStack.transition}for(let n=o;n>4){case 2:for(let r=n+1;;++r){if(r>=t||(i=e[r])<32||i>126&&i<160){this._printHandler(e,n,r),n=r-1;break}if(++r>=t||(i=e[r])<32||i>126&&i<160){this._printHandler(e,n,r),n=r-1;break}if(++r>=t||(i=e[r])<32||i>126&&i<160){this._printHandler(e,n,r),n=r-1;break}if(++r>=t||(i=e[r])<32||i>126&&i<160){this._printHandler(e,n,r),n=r-1;break}}break;case 3:this._executeHandlers[i]?this._executeHandlers[i]():this._executeHandlerFb(i),this.precedingJoinState=0;break;case 0:break;case 1:if(this._errorHandler({position:n,code:i,currentState:this.currentState,collect:this._collect,params:this._params,abort:!1}).abort)return;break;case 7:let o=this._csiHandlers[this._collect<<8|i],s=o?o.length-1:-1;for(;s>=0&&(r=o[s](this._params),!0!==r);s--)if(r instanceof Promise)return this._preserveStack(3,o,s,a,n),r;s<0&&this._csiHandlerFb(this._collect<<8|i,this._params),this.precedingJoinState=0;break;case 8:do switch(i){case 59:this._params.addParam(0);break;case 58:this._params.addSubParam(-1);break;default:this._params.addDigit(i-48)}while(++n47&&i<60);n--;break;case 9:this._collect<<=8,this._collect|=i;break;case 10:let c=this._escHandlers[this._collect<<8|i],l=c?c.length-1:-1;for(;l>=0&&(r=c[l](),!0!==r);l--)if(r instanceof Promise)return this._preserveStack(4,c,l,a,n),r;l<0&&this._escHandlerFb(this._collect<<8|i),this.precedingJoinState=0;break;case 11:this._params.reset(),this._params.addParam(0),this._collect=0;break;case 12:this._dcsParser.hook(this._collect<<8|i,this._params);break;case 13:for(let r=n+1;;++r)if(r>=t||(i=e[r])===24||i===26||i===27||i>127&&i<160){this._dcsParser.put(e,n,r),n=r-1;break}break;case 14:if(r=this._dcsParser.unhook(i!==24&&i!==26),r)return this._preserveStack(6,[],0,a,n),r;i===27&&(a|=1),this._params.reset(),this._params.addParam(0),this._collect=0,this.precedingJoinState=0;break;case 4:this._oscParser.start();break;case 5:for(let r=n+1;;r++)if(r>=t||(i=e[r])<32||i>127&&i<160){this._oscParser.put(e,n,r),n=r-1;break}break;case 6:if(r=this._oscParser.end(i!==24&&i!==26),r)return this._preserveStack(5,[],0,a,n),r;i===27&&(a|=1),this._params.reset(),this._params.addParam(0),this._collect=0,this.precedingJoinState=0}this.currentState=15&a}}}t.EscapeSequenceParser=c},6242:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.OscHandler=t.OscParser=void 0;let r=n(5770),i=n(482),a=[];t.OscParser=class{constructor(){this._state=0,this._active=a,this._id=-1,this._handlers=Object.create(null),this._handlerFb=()=>{},this._stack={paused:!1,loopPosition:0,fallThrough:!1}}registerHandler(e,t){this._handlers[e]===void 0&&(this._handlers[e]=[]);let n=this._handlers[e];return n.push(t),{dispose:()=>{let e=n.indexOf(t);e!==-1&&n.splice(e,1)}}}clearHandler(e){this._handlers[e]&&delete this._handlers[e]}setHandlerFallback(e){this._handlerFb=e}dispose(){this._handlers=Object.create(null),this._handlerFb=()=>{},this._active=a}reset(){if(this._state===2)for(let e=this._stack.paused?this._stack.loopPosition-1:this._active.length-1;e>=0;--e)this._active[e].end(!1);this._stack.paused=!1,this._active=a,this._id=-1,this._state=0}_start(){if(this._active=this._handlers[this._id]||a,this._active.length)for(let e=this._active.length-1;e>=0;e--)this._active[e].start();else this._handlerFb(this._id,`START`)}_put(e,t,n){if(this._active.length)for(let r=this._active.length-1;r>=0;r--)this._active[r].put(e,t,n);else this._handlerFb(this._id,`PUT`,(0,i.utf32ToString)(e,t,n))}start(){this.reset(),this._state=1}put(e,t,n){if(this._state!==3){if(this._state===1)for(;t0&&this._put(e,t,n)}}end(e,t=!0){if(this._state!==0){if(this._state!==3)if(this._state===1&&this._start(),this._active.length){let n=!1,r=this._active.length-1,i=!1;if(this._stack.paused&&(r=this._stack.loopPosition-1,n=t,i=this._stack.fallThrough,this._stack.paused=!1),!i&&!1===n){for(;r>=0&&(n=this._active[r].end(e),!0!==n);r--)if(n instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=r,this._stack.fallThrough=!1,n;r--}for(;r>=0;r--)if(n=this._active[r].end(!1),n instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=r,this._stack.fallThrough=!0,n}else this._handlerFb(this._id,`END`,e);this._active=a,this._id=-1,this._state=0}}},t.OscHandler=class{constructor(e){this._handler=e,this._data=``,this._hitLimit=!1}start(){this._data=``,this._hitLimit=!1}put(e,t,n){this._hitLimit||(this._data+=(0,i.utf32ToString)(e,t,n),this._data.length>r.PAYLOAD_LIMIT&&(this._data=``,this._hitLimit=!0))}end(e){let t=!1;if(this._hitLimit)t=!1;else if(e&&(t=this._handler(this._data),t instanceof Promise))return t.then((e=>(this._data=``,this._hitLimit=!1,e)));return this._data=``,this._hitLimit=!1,t}}},8742:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.Params=void 0;let n=2147483647;class r{static fromArray(e){let t=new r;if(!e.length)return t;for(let n=+!!Array.isArray(e[0]);n256)throw Error(`maxSubParamsLength must not be greater than 256`);this.params=new Int32Array(e),this.length=0,this._subParams=new Int32Array(t),this._subParamsLength=0,this._subParamsIdx=new Uint16Array(e),this._rejectDigits=!1,this._rejectSubDigits=!1,this._digitIsSub=!1}clone(){let e=new r(this.maxLength,this.maxSubParamsLength);return e.params.set(this.params),e.length=this.length,e._subParams.set(this._subParams),e._subParamsLength=this._subParamsLength,e._subParamsIdx.set(this._subParamsIdx),e._rejectDigits=this._rejectDigits,e._rejectSubDigits=this._rejectSubDigits,e._digitIsSub=this._digitIsSub,e}toArray(){let e=[];for(let t=0;t>8,r=255&this._subParamsIdx[t];r-n>0&&e.push(Array.prototype.slice.call(this._subParams,n,r))}return e}reset(){this.length=0,this._subParamsLength=0,this._rejectDigits=!1,this._rejectSubDigits=!1,this._digitIsSub=!1}addParam(e){if(this._digitIsSub=!1,this.length>=this.maxLength)this._rejectDigits=!0;else{if(e<-1)throw Error(`values lesser than -1 are not allowed`);this._subParamsIdx[this.length]=this._subParamsLength<<8|this._subParamsLength,this.params[this.length++]=e>n?n:e}}addSubParam(e){if(this._digitIsSub=!0,this.length)if(this._rejectDigits||this._subParamsLength>=this.maxSubParamsLength)this._rejectSubDigits=!0;else{if(e<-1)throw Error(`values lesser than -1 are not allowed`);this._subParams[this._subParamsLength++]=e>n?n:e,this._subParamsIdx[this.length-1]++}}hasSubParams(e){return(255&this._subParamsIdx[e])-(this._subParamsIdx[e]>>8)>0}getSubParams(e){let t=this._subParamsIdx[e]>>8,n=255&this._subParamsIdx[e];return n-t>0?this._subParams.subarray(t,n):null}getSubParamsAll(){let e={};for(let t=0;t>8,r=255&this._subParamsIdx[t];r-n>0&&(e[t]=this._subParams.slice(n,r))}return e}addDigit(e){let t;if(this._rejectDigits||!(t=this._digitIsSub?this._subParamsLength:this.length)||this._digitIsSub&&this._rejectSubDigits)return;let r=this._digitIsSub?this._subParams:this.params,i=r[t-1];r[t-1]=~i?Math.min(10*i+e,n):e}}t.Params=r},5741:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.AddonManager=void 0,t.AddonManager=class{constructor(){this._addons=[]}dispose(){for(let e=this._addons.length-1;e>=0;e--)this._addons[e].instance.dispose()}loadAddon(e,t){let n={instance:t,dispose:t.dispose,isDisposed:!1};this._addons.push(n),t.dispose=()=>this._wrappedAddonDispose(n),t.activate(e)}_wrappedAddonDispose(e){if(e.isDisposed)return;let t=-1;for(let n=0;n{Object.defineProperty(t,"__esModule",{value:!0}),t.BufferApiView=void 0;let r=n(3785),i=n(511);t.BufferApiView=class{constructor(e,t){this._buffer=e,this.type=t}init(e){return this._buffer=e,this}get cursorY(){return this._buffer.y}get cursorX(){return this._buffer.x}get viewportY(){return this._buffer.ydisp}get baseY(){return this._buffer.ybase}get length(){return this._buffer.lines.length}getLine(e){let t=this._buffer.lines.get(e);if(t)return new r.BufferLineApiView(t)}getNullCell(){return new i.CellData}}},3785:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.BufferLineApiView=void 0;let r=n(511);t.BufferLineApiView=class{constructor(e){this._line=e}get isWrapped(){return this._line.isWrapped}get length(){return this._line.length}getCell(e,t){if(!(e<0||e>=this._line.length))return t?(this._line.loadCell(e,t),t):this._line.loadCell(e,new r.CellData)}translateToString(e,t,n){return this._line.translateToString(e,t,n)}}},8285:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.BufferNamespaceApi=void 0;let r=n(8771),i=n(8460),a=n(844);class o extends a.Disposable{constructor(e){super(),this._core=e,this._onBufferChange=this.register(new i.EventEmitter),this.onBufferChange=this._onBufferChange.event,this._normal=new r.BufferApiView(this._core.buffers.normal,`normal`),this._alternate=new r.BufferApiView(this._core.buffers.alt,`alternate`),this._core.buffers.onBufferActivate((()=>this._onBufferChange.fire(this.active)))}get active(){if(this._core.buffers.active===this._core.buffers.normal)return this.normal;if(this._core.buffers.active===this._core.buffers.alt)return this.alternate;throw Error(`Active buffer is neither normal nor alternate`)}get normal(){return this._normal.init(this._core.buffers.normal)}get alternate(){return this._alternate.init(this._core.buffers.alt)}}t.BufferNamespaceApi=o},7975:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.ParserApi=void 0,t.ParserApi=class{constructor(e){this._core=e}registerCsiHandler(e,t){return this._core.registerCsiHandler(e,(e=>t(e.toArray())))}addCsiHandler(e,t){return this.registerCsiHandler(e,t)}registerDcsHandler(e,t){return this._core.registerDcsHandler(e,((e,n)=>t(e,n.toArray())))}addDcsHandler(e,t){return this.registerDcsHandler(e,t)}registerEscHandler(e,t){return this._core.registerEscHandler(e,t)}addEscHandler(e,t){return this.registerEscHandler(e,t)}registerOscHandler(e,t){return this._core.registerOscHandler(e,t)}addOscHandler(e,t){return this.registerOscHandler(e,t)}}},7090:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.UnicodeApi=void 0,t.UnicodeApi=class{constructor(e){this._core=e}register(e){this._core.unicodeService.register(e)}get versions(){return this._core.unicodeService.versions}get activeVersion(){return this._core.unicodeService.activeVersion}set activeVersion(e){this._core.unicodeService.activeVersion=e}}},744:function(e,t,n){var r=this&&this.__decorate||function(e,t,n,r){var i,a=arguments.length,o=a<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,n):r;if(typeof Reflect==`object`&&typeof Reflect.decorate==`function`)o=Reflect.decorate(e,t,n,r);else for(var s=e.length-1;s>=0;s--)(i=e[s])&&(o=(a<3?i(o):a>3?i(t,n,o):i(t,n))||o);return a>3&&o&&Object.defineProperty(t,n,o),o},i=this&&this.__param||function(e,t){return function(n,r){t(n,r,e)}};Object.defineProperty(t,"__esModule",{value:!0}),t.BufferService=t.MINIMUM_ROWS=t.MINIMUM_COLS=void 0;let a=n(8460),o=n(844),s=n(5295),c=n(2585);t.MINIMUM_COLS=2,t.MINIMUM_ROWS=1;let l=t.BufferService=class extends o.Disposable{get buffer(){return this.buffers.active}constructor(e){super(),this.isUserScrolling=!1,this._onResize=this.register(new a.EventEmitter),this.onResize=this._onResize.event,this._onScroll=this.register(new a.EventEmitter),this.onScroll=this._onScroll.event,this.cols=Math.max(e.rawOptions.cols||0,t.MINIMUM_COLS),this.rows=Math.max(e.rawOptions.rows||0,t.MINIMUM_ROWS),this.buffers=this.register(new s.BufferSet(e,this))}resize(e,t){this.cols=e,this.rows=t,this.buffers.resize(e,t),this._onResize.fire({cols:e,rows:t})}reset(){this.buffers.reset(),this.isUserScrolling=!1}scroll(e,t=!1){let n=this.buffer,r;r=this._cachedBlankLine,r&&r.length===this.cols&&r.getFg(0)===e.fg&&r.getBg(0)===e.bg||(r=n.getBlankLine(e,t),this._cachedBlankLine=r),r.isWrapped=t;let i=n.ybase+n.scrollTop,a=n.ybase+n.scrollBottom;if(n.scrollTop===0){let e=n.lines.isFull;a===n.lines.length-1?e?n.lines.recycle().copyFrom(r):n.lines.push(r.clone()):n.lines.splice(a+1,0,r.clone()),e?this.isUserScrolling&&(n.ydisp=Math.max(n.ydisp-1,0)):(n.ybase++,this.isUserScrolling||n.ydisp++)}else{let e=a-i+1;n.lines.shiftElements(i+1,e-1,-1),n.lines.set(a,r.clone())}this.isUserScrolling||(n.ydisp=n.ybase),this._onScroll.fire(n.ydisp)}scrollLines(e,t,n){let r=this.buffer;if(e<0){if(r.ydisp===0)return;this.isUserScrolling=!0}else e+r.ydisp>=r.ybase&&(this.isUserScrolling=!1);let i=r.ydisp;r.ydisp=Math.max(Math.min(r.ydisp+e,r.ybase),0),i!==r.ydisp&&(t||this._onScroll.fire(r.ydisp))}};t.BufferService=l=r([i(0,c.IOptionsService)],l)},7994:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.CharsetService=void 0,t.CharsetService=class{constructor(){this.glevel=0,this._charsets=[]}reset(){this.charset=void 0,this._charsets=[],this.glevel=0}setgLevel(e){this.glevel=e,this.charset=this._charsets[e]}setgCharset(e,t){this._charsets[e]=t,this.glevel===e&&(this.charset=t)}}},1753:function(e,t,n){var r=this&&this.__decorate||function(e,t,n,r){var i,a=arguments.length,o=a<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,n):r;if(typeof Reflect==`object`&&typeof Reflect.decorate==`function`)o=Reflect.decorate(e,t,n,r);else for(var s=e.length-1;s>=0;s--)(i=e[s])&&(o=(a<3?i(o):a>3?i(t,n,o):i(t,n))||o);return a>3&&o&&Object.defineProperty(t,n,o),o},i=this&&this.__param||function(e,t){return function(n,r){t(n,r,e)}};Object.defineProperty(t,"__esModule",{value:!0}),t.CoreMouseService=void 0;let a=n(2585),o=n(8460),s=n(844),c={NONE:{events:0,restrict:()=>!1},X10:{events:1,restrict:e=>e.button!==4&&e.action===1&&(e.ctrl=!1,e.alt=!1,e.shift=!1,!0)},VT200:{events:19,restrict:e=>e.action!==32},DRAG:{events:23,restrict:e=>e.action!==32||e.button!==3},ANY:{events:31,restrict:e=>!0}};function l(e,t){let n=(e.ctrl?16:0)|(e.shift?4:0)|(e.alt?8:0);return e.button===4?(n|=64,n|=e.action):(n|=3&e.button,4&e.button&&(n|=64),8&e.button&&(n|=128),e.action===32?n|=32:e.action!==0||t||(n|=3)),n}let u=String.fromCharCode,d={DEFAULT:e=>{let t=[l(e,!1)+32,e.col+32,e.row+32];return t[0]>255||t[1]>255||t[2]>255?``:`${u(t[0])}${u(t[1])}${u(t[2])}`},SGR:e=>{let t=e.action===0&&e.button!==4?`m`:`M`;return`[<${l(e,!0)};${e.col};${e.row}${t}`},SGR_PIXELS:e=>{let t=e.action===0&&e.button!==4?`m`:`M`;return`[<${l(e,!0)};${e.x};${e.y}${t}`}},f=t.CoreMouseService=class extends s.Disposable{constructor(e,t){super(),this._bufferService=e,this._coreService=t,this._protocols={},this._encodings={},this._activeProtocol=``,this._activeEncoding=``,this._lastEvent=null,this._onProtocolChange=this.register(new o.EventEmitter),this.onProtocolChange=this._onProtocolChange.event;for(let e of Object.keys(c))this.addProtocol(e,c[e]);for(let e of Object.keys(d))this.addEncoding(e,d[e]);this.reset()}addProtocol(e,t){this._protocols[e]=t}addEncoding(e,t){this._encodings[e]=t}get activeProtocol(){return this._activeProtocol}get areMouseEventsActive(){return this._protocols[this._activeProtocol].events!==0}set activeProtocol(e){if(!this._protocols[e])throw Error(`unknown protocol "${e}"`);this._activeProtocol=e,this._onProtocolChange.fire(this._protocols[e].events)}get activeEncoding(){return this._activeEncoding}set activeEncoding(e){if(!this._encodings[e])throw Error(`unknown encoding "${e}"`);this._activeEncoding=e}reset(){this.activeProtocol=`NONE`,this.activeEncoding=`DEFAULT`,this._lastEvent=null}triggerMouseEvent(e){if(e.col<0||e.col>=this._bufferService.cols||e.row<0||e.row>=this._bufferService.rows||e.button===4&&e.action===32||e.button===3&&e.action!==32||e.button!==4&&(e.action===2||e.action===3)||(e.col++,e.row++,e.action===32&&this._lastEvent&&this._equalEvents(this._lastEvent,e,this._activeEncoding===`SGR_PIXELS`))||!this._protocols[this._activeProtocol].restrict(e))return!1;let t=this._encodings[this._activeEncoding](e);return t&&(this._activeEncoding===`DEFAULT`?this._coreService.triggerBinaryEvent(t):this._coreService.triggerDataEvent(t,!0)),this._lastEvent=e,!0}explainEvents(e){return{down:!!(1&e),up:!!(2&e),drag:!!(4&e),move:!!(8&e),wheel:!!(16&e)}}_equalEvents(e,t,n){if(n){if(e.x!==t.x||e.y!==t.y)return!1}else if(e.col!==t.col||e.row!==t.row)return!1;return e.button===t.button&&e.action===t.action&&e.ctrl===t.ctrl&&e.alt===t.alt&&e.shift===t.shift}};t.CoreMouseService=f=r([i(0,a.IBufferService),i(1,a.ICoreService)],f)},6975:function(e,t,n){var r=this&&this.__decorate||function(e,t,n,r){var i,a=arguments.length,o=a<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,n):r;if(typeof Reflect==`object`&&typeof Reflect.decorate==`function`)o=Reflect.decorate(e,t,n,r);else for(var s=e.length-1;s>=0;s--)(i=e[s])&&(o=(a<3?i(o):a>3?i(t,n,o):i(t,n))||o);return a>3&&o&&Object.defineProperty(t,n,o),o},i=this&&this.__param||function(e,t){return function(n,r){t(n,r,e)}};Object.defineProperty(t,"__esModule",{value:!0}),t.CoreService=void 0;let a=n(1439),o=n(8460),s=n(844),c=n(2585),l=Object.freeze({insertMode:!1}),u=Object.freeze({applicationCursorKeys:!1,applicationKeypad:!1,bracketedPasteMode:!1,origin:!1,reverseWraparound:!1,sendFocus:!1,wraparound:!0}),d=t.CoreService=class extends s.Disposable{constructor(e,t,n){super(),this._bufferService=e,this._logService=t,this._optionsService=n,this.isCursorInitialized=!1,this.isCursorHidden=!1,this._onData=this.register(new o.EventEmitter),this.onData=this._onData.event,this._onUserInput=this.register(new o.EventEmitter),this.onUserInput=this._onUserInput.event,this._onBinary=this.register(new o.EventEmitter),this.onBinary=this._onBinary.event,this._onRequestScrollToBottom=this.register(new o.EventEmitter),this.onRequestScrollToBottom=this._onRequestScrollToBottom.event,this.modes=(0,a.clone)(l),this.decPrivateModes=(0,a.clone)(u)}reset(){this.modes=(0,a.clone)(l),this.decPrivateModes=(0,a.clone)(u)}triggerDataEvent(e,t=!1){if(this._optionsService.rawOptions.disableStdin)return;let n=this._bufferService.buffer;t&&this._optionsService.rawOptions.scrollOnUserInput&&n.ybase!==n.ydisp&&this._onRequestScrollToBottom.fire(),t&&this._onUserInput.fire(),this._logService.debug(`sending data "${e}"`,(()=>e.split(``).map((e=>e.charCodeAt(0))))),this._onData.fire(e)}triggerBinaryEvent(e){this._optionsService.rawOptions.disableStdin||(this._logService.debug(`sending binary "${e}"`,(()=>e.split(``).map((e=>e.charCodeAt(0))))),this._onBinary.fire(e))}};t.CoreService=d=r([i(0,c.IBufferService),i(1,c.ILogService),i(2,c.IOptionsService)],d)},9074:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.DecorationService=void 0;let r=n(8055),i=n(8460),a=n(844),o=n(6106),s=0,c=0;class l extends a.Disposable{get decorations(){return this._decorations.values()}constructor(){super(),this._decorations=new o.SortedList((e=>e?.marker.line)),this._onDecorationRegistered=this.register(new i.EventEmitter),this.onDecorationRegistered=this._onDecorationRegistered.event,this._onDecorationRemoved=this.register(new i.EventEmitter),this.onDecorationRemoved=this._onDecorationRemoved.event,this.register((0,a.toDisposable)((()=>this.reset())))}registerDecoration(e){if(e.marker.isDisposed)return;let t=new u(e);if(t){let e=t.marker.onDispose((()=>t.dispose()));t.onDispose((()=>{t&&(this._decorations.delete(t)&&this._onDecorationRemoved.fire(t),e.dispose())})),this._decorations.insert(t),this._onDecorationRegistered.fire(t)}return t}reset(){for(let e of this._decorations.values())e.dispose();this._decorations.clear()}*getDecorationsAtCell(e,t,n){let r=0,i=0;for(let a of this._decorations.getKeyIterator(t))r=a.options.x??0,i=r+(a.options.width??1),e>=r&&e{s=t.options.x??0,c=s+(t.options.width??1),e>=s&&e{Object.defineProperty(t,"__esModule",{value:!0}),t.InstantiationService=t.ServiceCollection=void 0;let r=n(2585),i=n(8343);class a{constructor(...e){this._entries=new Map;for(let[t,n]of e)this.set(t,n)}set(e,t){let n=this._entries.get(e);return this._entries.set(e,t),n}forEach(e){for(let[t,n]of this._entries.entries())e(t,n)}has(e){return this._entries.has(e)}get(e){return this._entries.get(e)}}t.ServiceCollection=a,t.InstantiationService=class{constructor(){this._services=new a,this._services.set(r.IInstantiationService,this)}setService(e,t){this._services.set(e,t)}getService(e){return this._services.get(e)}createInstance(e,...t){let n=(0,i.getServiceDependencies)(e).sort(((e,t)=>e.index-t.index)),r=[];for(let t of n){let n=this._services.get(t.id);if(!n)throw Error(`[createInstance] ${e.name} depends on UNKNOWN service ${t.id}.`);r.push(n)}let a=n.length>0?n[0].index:t.length;if(t.length!==a)throw Error(`[createInstance] First service dependency of ${e.name} at position ${a+1} conflicts with ${t.length} static arguments`);return new e(...t,...r)}}},7866:function(e,t,n){var r=this&&this.__decorate||function(e,t,n,r){var i,a=arguments.length,o=a<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,n):r;if(typeof Reflect==`object`&&typeof Reflect.decorate==`function`)o=Reflect.decorate(e,t,n,r);else for(var s=e.length-1;s>=0;s--)(i=e[s])&&(o=(a<3?i(o):a>3?i(t,n,o):i(t,n))||o);return a>3&&o&&Object.defineProperty(t,n,o),o},i=this&&this.__param||function(e,t){return function(n,r){t(n,r,e)}};Object.defineProperty(t,"__esModule",{value:!0}),t.traceCall=t.setTraceLogger=t.LogService=void 0;let a=n(844),o=n(2585),s={trace:o.LogLevelEnum.TRACE,debug:o.LogLevelEnum.DEBUG,info:o.LogLevelEnum.INFO,warn:o.LogLevelEnum.WARN,error:o.LogLevelEnum.ERROR,off:o.LogLevelEnum.OFF},c,l=t.LogService=class extends a.Disposable{get logLevel(){return this._logLevel}constructor(e){super(),this._optionsService=e,this._logLevel=o.LogLevelEnum.OFF,this._updateLogLevel(),this.register(this._optionsService.onSpecificOptionChange(`logLevel`,(()=>this._updateLogLevel()))),c=this}_updateLogLevel(){this._logLevel=s[this._optionsService.rawOptions.logLevel]}_evalLazyOptionalParams(e){for(let t=0;tJSON.stringify(e))).join(`, `)})`);let t=r.apply(this,e);return c.trace(`GlyphRenderer#${r.name} return`,t),t}}},7302:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.OptionsService=t.DEFAULT_OPTIONS=void 0;let r=n(8460),i=n(844);t.DEFAULT_OPTIONS={cols:80,rows:24,cursorBlink:!1,cursorStyle:`block`,cursorWidth:1,cursorInactiveStyle:`outline`,customGlyphs:!0,drawBoldTextInBrightColors:!0,documentOverride:null,fastScrollModifier:`alt`,fastScrollSensitivity:5,fontFamily:`courier-new, courier, monospace`,fontSize:15,fontWeight:`normal`,fontWeightBold:`bold`,ignoreBracketedPasteMode:!1,lineHeight:1,letterSpacing:0,linkHandler:null,logLevel:`info`,logger:null,scrollback:1e3,scrollOnUserInput:!0,scrollSensitivity:1,screenReaderMode:!1,smoothScrollDuration:0,macOptionIsMeta:!1,macOptionClickForcesSelection:!1,minimumContrastRatio:1,disableStdin:!1,allowProposedApi:!1,allowTransparency:!1,tabStopWidth:8,theme:{},rescaleOverlappingGlyphs:!1,rightClickSelectsWord:n(6114).isMac,windowOptions:{},windowsMode:!1,windowsPty:{},wordSeparator:` ()[]{}',"\``,altClickMovesCursor:!0,convertEol:!1,termName:`xterm`,cancelEvents:!1,overviewRulerWidth:0};let a=[`normal`,`bold`,`100`,`200`,`300`,`400`,`500`,`600`,`700`,`800`,`900`];class o extends i.Disposable{constructor(e){super(),this._onOptionChange=this.register(new r.EventEmitter),this.onOptionChange=this._onOptionChange.event;let n={...t.DEFAULT_OPTIONS};for(let t in e)if(t in n)try{let r=e[t];n[t]=this._sanitizeAndValidateOption(t,r)}catch(e){console.error(e)}this.rawOptions=n,this.options={...n},this._setupOptions(),this.register((0,i.toDisposable)((()=>{this.rawOptions.linkHandler=null,this.rawOptions.documentOverride=null})))}onSpecificOptionChange(e,t){return this.onOptionChange((n=>{n===e&&t(this.rawOptions[e])}))}onMultipleOptionChange(e,t){return this.onOptionChange((n=>{e.indexOf(n)!==-1&&t()}))}_setupOptions(){let e=e=>{if(!(e in t.DEFAULT_OPTIONS))throw Error(`No option with key "${e}"`);return this.rawOptions[e]},n=(e,n)=>{if(!(e in t.DEFAULT_OPTIONS))throw Error(`No option with key "${e}"`);n=this._sanitizeAndValidateOption(e,n),this.rawOptions[e]!==n&&(this.rawOptions[e]=n,this._onOptionChange.fire(e))};for(let t in this.rawOptions){let r={get:e.bind(this,t),set:n.bind(this,t)};Object.defineProperty(this.options,t,r)}}_sanitizeAndValidateOption(e,n){switch(e){case`cursorStyle`:if(n||=t.DEFAULT_OPTIONS[e],!function(e){return e===`block`||e===`underline`||e===`bar`}(n))throw Error(`"${n}" is not a valid value for ${e}`);break;case`wordSeparator`:n||=t.DEFAULT_OPTIONS[e];break;case`fontWeight`:case`fontWeightBold`:if(typeof n==`number`&&1<=n&&n<=1e3)break;n=a.includes(n)?n:t.DEFAULT_OPTIONS[e];break;case`cursorWidth`:n=Math.floor(n);case`lineHeight`:case`tabStopWidth`:if(n<1)throw Error(`${e} cannot be less than 1, value: ${n}`);break;case`minimumContrastRatio`:n=Math.max(1,Math.min(21,Math.round(10*n)/10));break;case`scrollback`:if((n=Math.min(n,4294967295))<0)throw Error(`${e} cannot be less than 0, value: ${n}`);break;case`fastScrollSensitivity`:case`scrollSensitivity`:if(n<=0)throw Error(`${e} cannot be less than or equal to 0, value: ${n}`);break;case`rows`:case`cols`:if(!n&&n!==0)throw Error(`${e} must be numeric, value: ${n}`);break;case`windowsPty`:n??={}}return n}}t.OptionsService=o},2660:function(e,t,n){var r=this&&this.__decorate||function(e,t,n,r){var i,a=arguments.length,o=a<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,n):r;if(typeof Reflect==`object`&&typeof Reflect.decorate==`function`)o=Reflect.decorate(e,t,n,r);else for(var s=e.length-1;s>=0;s--)(i=e[s])&&(o=(a<3?i(o):a>3?i(t,n,o):i(t,n))||o);return a>3&&o&&Object.defineProperty(t,n,o),o},i=this&&this.__param||function(e,t){return function(n,r){t(n,r,e)}};Object.defineProperty(t,"__esModule",{value:!0}),t.OscLinkService=void 0;let a=n(2585),o=t.OscLinkService=class{constructor(e){this._bufferService=e,this._nextId=1,this._entriesWithId=new Map,this._dataByLinkId=new Map}registerLink(e){let t=this._bufferService.buffer;if(e.id===void 0){let n=t.addMarker(t.ybase+t.y),r={data:e,id:this._nextId++,lines:[n]};return n.onDispose((()=>this._removeMarkerFromLink(r,n))),this._dataByLinkId.set(r.id,r),r.id}let n=e,r=this._getEntryIdKey(n),i=this._entriesWithId.get(r);if(i)return this.addLineToLink(i.id,t.ybase+t.y),i.id;let a=t.addMarker(t.ybase+t.y),o={id:this._nextId++,key:this._getEntryIdKey(n),data:n,lines:[a]};return a.onDispose((()=>this._removeMarkerFromLink(o,a))),this._entriesWithId.set(o.key,o),this._dataByLinkId.set(o.id,o),o.id}addLineToLink(e,t){let n=this._dataByLinkId.get(e);if(n&&n.lines.every((e=>e.line!==t))){let e=this._bufferService.buffer.addMarker(t);n.lines.push(e),e.onDispose((()=>this._removeMarkerFromLink(n,e)))}}getLinkData(e){return this._dataByLinkId.get(e)?.data}_getEntryIdKey(e){return`${e.id};;${e.uri}`}_removeMarkerFromLink(e,t){let n=e.lines.indexOf(t);n!==-1&&(e.lines.splice(n,1),e.lines.length===0&&(e.data.id!==void 0&&this._entriesWithId.delete(e.key),this._dataByLinkId.delete(e.id)))}};t.OscLinkService=o=r([i(0,a.IBufferService)],o)},8343:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.createDecorator=t.getServiceDependencies=t.serviceRegistry=void 0;let n=`di$target`,r=`di$dependencies`;t.serviceRegistry=new Map,t.getServiceDependencies=function(e){return e[r]||[]},t.createDecorator=function(e){if(t.serviceRegistry.has(e))return t.serviceRegistry.get(e);let i=function(e,t,a){if(arguments.length!==3)throw Error(`@IServiceName-decorator can only be used to decorate a parameter`);(function(e,t,i){t[n]===t?t[r].push({id:e,index:i}):(t[r]=[{id:e,index:i}],t[n]=t)})(i,e,a)};return i.toString=()=>e,t.serviceRegistry.set(e,i),i}},2585:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.IDecorationService=t.IUnicodeService=t.IOscLinkService=t.IOptionsService=t.ILogService=t.LogLevelEnum=t.IInstantiationService=t.ICharsetService=t.ICoreService=t.ICoreMouseService=t.IBufferService=void 0;let r=n(8343);var i;t.IBufferService=(0,r.createDecorator)(`BufferService`),t.ICoreMouseService=(0,r.createDecorator)(`CoreMouseService`),t.ICoreService=(0,r.createDecorator)(`CoreService`),t.ICharsetService=(0,r.createDecorator)(`CharsetService`),t.IInstantiationService=(0,r.createDecorator)(`InstantiationService`),function(e){e[e.TRACE=0]=`TRACE`,e[e.DEBUG=1]=`DEBUG`,e[e.INFO=2]=`INFO`,e[e.WARN=3]=`WARN`,e[e.ERROR=4]=`ERROR`,e[e.OFF=5]=`OFF`}(i||(t.LogLevelEnum=i={})),t.ILogService=(0,r.createDecorator)(`LogService`),t.IOptionsService=(0,r.createDecorator)(`OptionsService`),t.IOscLinkService=(0,r.createDecorator)(`OscLinkService`),t.IUnicodeService=(0,r.createDecorator)(`UnicodeService`),t.IDecorationService=(0,r.createDecorator)(`DecorationService`)},1480:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.UnicodeService=void 0;let r=n(8460),i=n(225);class a{static extractShouldJoin(e){return(1&e)!=0}static extractWidth(e){return e>>1&3}static extractCharKind(e){return e>>3}static createPropertyValue(e,t,n=!1){return(16777215&e)<<3|(3&t)<<1|!!n}constructor(){this._providers=Object.create(null),this._active=``,this._onChange=new r.EventEmitter,this.onChange=this._onChange.event;let e=new i.UnicodeV6;this.register(e),this._active=e.version,this._activeProvider=e}dispose(){this._onChange.dispose()}get versions(){return Object.keys(this._providers)}get activeVersion(){return this._active}set activeVersion(e){if(!this._providers[e])throw Error(`unknown Unicode version "${e}"`);this._active=e,this._activeProvider=this._providers[e],this._onChange.fire(e)}register(e){this._providers[e.version]=e}wcwidth(e){return this._activeProvider.wcwidth(e)}getStringCellWidth(e){let t=0,n=0,r=e.length;for(let i=0;i=r)return t+this.wcwidth(o);let n=e.charCodeAt(i);56320<=n&&n<=57343?o=1024*(o-55296)+n-56320+65536:t+=this.wcwidth(n)}let s=this.charProperties(o,n),c=a.extractWidth(s);a.extractShouldJoin(s)&&(c-=a.extractWidth(n)),t+=c,n=s}return t}charProperties(e,t){return this._activeProvider.charProperties(e,t)}}t.UnicodeService=a}},t={};function n(r){var i=t[r];if(i!==void 0)return i.exports;var a=t[r]={exports:{}};return e[r].call(a.exports,a,a.exports,n),a.exports}var r={};return(()=>{var e=r;Object.defineProperty(e,"__esModule",{value:!0}),e.Terminal=void 0;let t=n(9042),i=n(3236),a=n(844),o=n(5741),s=n(8285),c=n(7975),l=n(7090),u=[`cols`,`rows`];class d extends a.Disposable{constructor(e){super(),this._core=this.register(new i.Terminal(e)),this._addonManager=this.register(new o.AddonManager),this._publicOptions={...this._core.options};let t=e=>this._core.options[e],n=(e,t)=>{this._checkReadonlyOptions(e),this._core.options[e]=t};for(let e in this._core.options){let r={get:t.bind(this,e),set:n.bind(this,e)};Object.defineProperty(this._publicOptions,e,r)}}_checkReadonlyOptions(e){if(u.includes(e))throw Error(`Option "${e}" can only be set in the constructor`)}_checkProposedApi(){if(!this._core.optionsService.rawOptions.allowProposedApi)throw Error(`You must set the allowProposedApi option to true to use proposed API`)}get onBell(){return this._core.onBell}get onBinary(){return this._core.onBinary}get onCursorMove(){return this._core.onCursorMove}get onData(){return this._core.onData}get onKey(){return this._core.onKey}get onLineFeed(){return this._core.onLineFeed}get onRender(){return this._core.onRender}get onResize(){return this._core.onResize}get onScroll(){return this._core.onScroll}get onSelectionChange(){return this._core.onSelectionChange}get onTitleChange(){return this._core.onTitleChange}get onWriteParsed(){return this._core.onWriteParsed}get element(){return this._core.element}get parser(){return this._parser||=new c.ParserApi(this._core),this._parser}get unicode(){return this._checkProposedApi(),new l.UnicodeApi(this._core)}get textarea(){return this._core.textarea}get rows(){return this._core.rows}get cols(){return this._core.cols}get buffer(){return this._buffer||=this.register(new s.BufferNamespaceApi(this._core)),this._buffer}get markers(){return this._checkProposedApi(),this._core.markers}get modes(){let e=this._core.coreService.decPrivateModes,t=`none`;switch(this._core.coreMouseService.activeProtocol){case`X10`:t=`x10`;break;case`VT200`:t=`vt200`;break;case`DRAG`:t=`drag`;break;case`ANY`:t=`any`}return{applicationCursorKeysMode:e.applicationCursorKeys,applicationKeypadMode:e.applicationKeypad,bracketedPasteMode:e.bracketedPasteMode,insertMode:this._core.coreService.modes.insertMode,mouseTrackingMode:t,originMode:e.origin,reverseWraparoundMode:e.reverseWraparound,sendFocusMode:e.sendFocus,wraparoundMode:e.wraparound}}get options(){return this._publicOptions}set options(e){for(let t in e)this._publicOptions[t]=e[t]}blur(){this._core.blur()}focus(){this._core.focus()}input(e,t=!0){this._core.input(e,t)}resize(e,t){this._verifyIntegers(e,t),this._core.resize(e,t)}open(e){this._core.open(e)}attachCustomKeyEventHandler(e){this._core.attachCustomKeyEventHandler(e)}attachCustomWheelEventHandler(e){this._core.attachCustomWheelEventHandler(e)}registerLinkProvider(e){return this._core.registerLinkProvider(e)}registerCharacterJoiner(e){return this._checkProposedApi(),this._core.registerCharacterJoiner(e)}deregisterCharacterJoiner(e){this._checkProposedApi(),this._core.deregisterCharacterJoiner(e)}registerMarker(e=0){return this._verifyIntegers(e),this._core.registerMarker(e)}registerDecoration(e){return this._checkProposedApi(),this._verifyPositiveIntegers(e.x??0,e.width??0,e.height??0),this._core.registerDecoration(e)}hasSelection(){return this._core.hasSelection()}select(e,t,n){this._verifyIntegers(e,t,n),this._core.select(e,t,n)}getSelection(){return this._core.getSelection()}getSelectionPosition(){return this._core.getSelectionPosition()}clearSelection(){this._core.clearSelection()}selectAll(){this._core.selectAll()}selectLines(e,t){this._verifyIntegers(e,t),this._core.selectLines(e,t)}dispose(){super.dispose()}scrollLines(e){this._verifyIntegers(e),this._core.scrollLines(e)}scrollPages(e){this._verifyIntegers(e),this._core.scrollPages(e)}scrollToTop(){this._core.scrollToTop()}scrollToBottom(){this._core.scrollToBottom()}scrollToLine(e){this._verifyIntegers(e),this._core.scrollToLine(e)}clear(){this._core.clear()}write(e,t){this._core.write(e,t)}writeln(e,t){this._core.write(e),this._core.write(`\r -`,t)}paste(e){this._core.paste(e)}refresh(e,t){this._verifyIntegers(e,t),this._core.refresh(e,t)}reset(){this._core.reset()}clearTextureAtlas(){this._core.clearTextureAtlas()}loadAddon(e){this._addonManager.loadAddon(this,e)}static get strings(){return t}_verifyIntegers(...e){for(let t of e)if(t===1/0||isNaN(t)||t%1!=0)throw Error(`This API only accepts integers`)}_verifyPositiveIntegers(...e){for(let t of e)if(t&&(t===1/0||isNaN(t)||t%1!=0||t<0))throw Error(`This API only accepts positive integers`)}}e.Terminal=d})(),r})()))})),Mv=s(((e,t)=>{(function(n,r){typeof e==`object`&&typeof t==`object`?t.exports=r():typeof define==`function`&&define.amd?define([],r):typeof e==`object`?e.FitAddon=r():n.FitAddon=r()})(self,(()=>(()=>{var e={};return(()=>{var t=e;Object.defineProperty(t,"__esModule",{value:!0}),t.FitAddon=void 0,t.FitAddon=class{activate(e){this._terminal=e}dispose(){}fit(){let e=this.proposeDimensions();if(!e||!this._terminal||isNaN(e.cols)||isNaN(e.rows))return;let t=this._terminal._core;this._terminal.rows===e.rows&&this._terminal.cols===e.cols||(t._renderService.clear(),this._terminal.resize(e.cols,e.rows))}proposeDimensions(){if(!this._terminal||!this._terminal.element||!this._terminal.element.parentElement)return;let e=this._terminal._core,t=e._renderService.dimensions;if(t.css.cell.width===0||t.css.cell.height===0)return;let n=this._terminal.options.scrollback===0?0:e.viewport.scrollBarWidth,r=window.getComputedStyle(this._terminal.element.parentElement),i=parseInt(r.getPropertyValue(`height`)),a=Math.max(0,parseInt(r.getPropertyValue(`width`))),o=window.getComputedStyle(this._terminal.element),s=i-(parseInt(o.getPropertyValue(`padding-top`))+parseInt(o.getPropertyValue(`padding-bottom`))),c=a-(parseInt(o.getPropertyValue(`padding-right`))+parseInt(o.getPropertyValue(`padding-left`)))-n;return{cols:Math.max(2,Math.floor(c/t.css.cell.width)),rows:Math.max(1,Math.floor(s/t.css.cell.height))}}}})(),e})()))})),Nv=jv(),Pv=Mv();function Fv(){try{return localStorage.getItem(`edge_token`)||sessionStorage.getItem(`edge_token`)||``}catch{return``}}function Iv({appId:e,app:t}){let[n,r]=(0,b.useState)(`connecting`),[i,a]=(0,b.useState)(``),o=(0,b.useRef)(null),s=(0,b.useRef)(null),c=(0,b.useRef)(null),l=(0,b.useRef)(null),u=t?.state===`running`||t?.status===`Running`;return(0,b.useEffect)(()=>{if(!e||!u){r(`disabled`);return}let t=Fv();if(!t){r(`error`),a(`未登录或 token 缺失`);return}let n=new Nv.Terminal({cursorBlink:!0,fontFamily:`ui-monospace, "SF Mono", Menlo, Consolas, monospace`,fontSize:13,theme:{background:`#0b1220`,foreground:`#e2e8f0`,cursor:`#60a5fa`,selectionBackground:`rgba(96,165,250,0.32)`},scrollback:5e3,convertEol:!1}),i=new Pv.FitAddon;n.loadAddon(i),s.current=n,c.current=i,o.current&&(n.open(o.current),requestAnimationFrame(()=>{try{i.fit()}catch{}}));let d=`${window.location.protocol===`https:`?`wss:`:`ws:`}//${window.location.host}/api/v1/pod-shell/${encodeURIComponent(e)}?access_token=${encodeURIComponent(t)}`,f=new WebSocket(d);f.binaryType=`arraybuffer`,l.current=f,f.onopen=()=>{r(`open`),n.focus(),m()},f.onclose=()=>{r(`closed`),n.write(`\r -\x1B[33m[连接已断开]\x1B[0m\r -`)},f.onerror=()=>{r(`error`),a(`WebSocket 连接错误`)},f.onmessage=e=>{if(typeof e.data==`string`){try{let t=JSON.parse(e.data);if(t&&t.error){n.write(`\r\n\x1b[31m[错误] ${t.error}\x1b[0m\r\n`);return}}catch{}n.write(e.data)}else e.data instanceof ArrayBuffer&&n.write(new Uint8Array(e.data))};let p=n.onData(e=>{f.readyState===WebSocket.OPEN&&f.send(new TextEncoder().encode(e))});function m(){if(f.readyState!==WebSocket.OPEN)return;let e=JSON.stringify({type:`resize`,cols:n.cols,rows:n.rows});f.send(e)}let h=n.onResize(()=>m()),g=()=>{try{i.fit()}catch{}};window.addEventListener(`resize`,g);let _=null;return typeof ResizeObserver<`u`&&o.current&&(_=new ResizeObserver(()=>{try{i.fit()}catch{}}),_.observe(o.current)),()=>{try{p.dispose()}catch{}try{h.dispose()}catch{}window.removeEventListener(`resize`,g),_&&_.disconnect();try{f.close()}catch{}try{n.dispose()}catch{}l.current=null,s.current=null,c.current=null}},[e,u]),(0,w.jsxs)(`div`,{style:{display:`flex`,flexDirection:`column`,height:`100%`,background:`#0b1220`,overflow:`hidden`},children:[(0,w.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,gap:8,padding:`8px 12px`,borderBottom:`1px solid ${S.ink2}`,background:`#0f172a`,flexShrink:0},children:[(0,w.jsx)(D,{name:`terminal`,size:14,stroke:1.8,style:{color:`#60a5fa`}}),(0,w.jsxs)(`span`,{style:{fontSize:11,color:`#94a3b8`,fontFamily:`ui-monospace, monospace`},children:[`容器 Shell · `,e]}),(0,w.jsx)(`span`,{style:{flex:1}}),(0,w.jsx)(`span`,{style:{padding:`1px 6px`,borderRadius:3,fontSize:10,background:n===`open`?`#065f46`:n===`connecting`?`#854d0e`:n===`disabled`?`#374151`:`#7f1d1d`,color:`#f8fafc`},children:n===`open`?`已连接`:n===`connecting`?`连接中...`:n===`closed`?`已断开`:n===`disabled`?`应用未运行`:`错误`})]}),(0,w.jsxs)(`div`,{style:{flex:1,position:`relative`,overflow:`hidden`,padding:8},children:[n===`disabled`&&(0,w.jsx)(`div`,{style:{color:`#94a3b8`,fontSize:12.5,padding:12,fontFamily:`ui-monospace, monospace`},children:`应用未运行,无法打开容器 Shell(应用 status = Running 时启用)`}),i&&(0,w.jsx)(`div`,{style:{color:`#fca5a5`,fontSize:12.5,padding:12,fontFamily:`ui-monospace, monospace`},children:i}),(0,w.jsx)(`div`,{ref:o,style:{width:`100%`,height:`100%`,display:n===`disabled`||i?`none`:`block`}})]})]})}function Lv({label:e,value:t,tone:n,mono:r}){return(0,w.jsxs)(`div`,{style:{padding:`8px 10px`,borderRadius:7,background:S.surfaceAlt,border:`1px solid ${S.borderSoft}`},children:[(0,w.jsx)(`div`,{style:{...S.type.label,color:S.ink3},children:e}),(0,w.jsx)(`div`,{className:r===!1?``:`mono tnum`,style:{marginTop:4,...S.type.heading,color:n},children:t})]})}function Rv(e){if(!e)return`—`;let t=Date.now(),n=new Date(e).getTime();if(isNaN(n))return`—`;let r=Math.max(0,t-n),i=Math.floor(r/864e5),a=Math.floor(r%864e5/36e5),o=Math.floor(r%36e5/6e4);return i>0?`${i}天 ${a}h`:a>0?`${a}h ${o}m`:`${o}m`}function zv(e){if(!e)return`—`;let t=e.replace(/^(docker|containerd):\/\//,``);return t.length>12?t.slice(0,12):t}function Bv({app:e,cpu:t,gpu:n}){let r=e.state===`error`,i=e.startedAt||e.createdAt,a=r?`已停止`:Rv(i),o=e.ports&&e.ports.length>0?e.ports.map(e=>e.hostPort?`${e.hostPort}→${e.containerPort}`:`${e.containerPort}`).join(`, `):`—`,s=e.volumeMounts&&e.volumeMounts.length>0?e.volumeMounts.map(e=>e.hostPath?`${e.hostPath} → ${e.mountPath}`:e.mountPath).join(`; `):`—`;return(0,w.jsxs)(`div`,{style:{padding:`14px 18px 18px`},children:[(0,w.jsxs)(`div`,{style:{display:`grid`,gridTemplateColumns:`1fr 1fr`,gap:8,marginBottom:14},children:[(0,w.jsx)(Lv,{label:`CPU`,value:`${t.toFixed(0)}%`,tone:S.blue}),(0,w.jsx)(Lv,{label:`GPU`,value:r?`—`:`${n.toFixed(0)}%`,tone:r?S.ink4:S.indigo}),(0,w.jsx)(Lv,{label:`运行时长`,value:a,tone:r?S.red:S.green,mono:!r}),(0,w.jsx)(Lv,{label:`重启次数`,value:`${e.restartCount||0}`,tone:e.restartCount>0?S.amber:S.green})]}),(0,w.jsx)(`div`,{style:{background:S.surfaceAlt,border:`1px solid ${S.borderSoft}`,borderRadius:8,overflow:`hidden`},children:[[`镜像`,(0,w.jsx)(`span`,{className:`mono`,style:{fontSize:11},children:e.image||e.desc||`—`})],[`容器 ID`,(0,w.jsx)(`span`,{className:`mono`,style:{fontSize:11},children:zv(e.containerID)})],[`GPU`,e.gpu||`CPU`],[`部署时间`,(0,w.jsx)(`span`,{className:`mono`,style:{fontSize:11},children:e.deployedAt||`—`})],[`端口`,(0,w.jsx)(`span`,{className:`mono`,style:{fontSize:11},children:o})],[`挂载`,(0,w.jsx)(`span`,{className:`mono`,style:{fontSize:11,wordBreak:`break-all`},children:s})],[`重启策略`,e.restartPolicy||`—`]].map(([e,t],n)=>(0,w.jsxs)(`div`,{style:{display:`flex`,padding:`8px 12px`,borderTop:n?`1px solid ${S.borderSoft}`:`none`,fontSize:12},children:[(0,w.jsx)(`span`,{style:{width:80,color:S.ink3,flexShrink:0},children:e}),(0,w.jsx)(`span`,{style:{color:S.ink,fontWeight:500,flex:1},children:t})]},e))}),(e.cpuLimit||e.memLimit)&&(0,w.jsxs)(`div`,{style:{marginTop:14},children:[(0,w.jsx)(`div`,{style:{...S.type.label,color:S.ink3,marginBottom:6},children:`资源配额`}),(0,w.jsx)(`div`,{style:{background:S.surfaceAlt,border:`1px solid ${S.borderSoft}`,borderRadius:8,overflow:`hidden`},children:[e.cpuRequest||e.cpuLimit?[`CPU`,`${e.cpuRequest||`—`} / ${e.cpuLimit||`—`}`]:null,e.memRequest||e.memLimit?[`内存`,`${e.memRequest||`—`} / ${e.memLimit||`—`}`]:null].filter(Boolean).map(([e,t],n)=>(0,w.jsxs)(`div`,{style:{display:`flex`,padding:`8px 12px`,borderTop:n?`1px solid ${S.borderSoft}`:`none`,fontSize:12},children:[(0,w.jsx)(`span`,{style:{width:80,color:S.ink3,flexShrink:0},children:e}),(0,w.jsx)(`span`,{className:`mono`,style:{color:S.ink,fontWeight:500,flex:1,fontSize:11},children:t})]},e))})]}),(0,w.jsxs)(`div`,{style:{marginTop:14},children:[(0,w.jsx)(`div`,{style:{fontSize:10.5,color:S.ink3,fontWeight:600,letterSpacing:`0.04em`,textTransform:`uppercase`,marginBottom:6},children:`当前状态`}),(0,w.jsxs)(`div`,{style:{padding:`8px 12px`,borderRadius:7,background:r?`#fef2f2`:`#f0fdf4`,border:`1px solid ${r?`#fecaca`:`#bbf7d0`}`,fontSize:12,fontWeight:500,color:r?`#b91c1c`:`#166534`,display:`flex`,alignItems:`center`,gap:6},children:[(0,w.jsx)(q,{tone:r?`red`:`green`,size:7,pulse:r}),r?`运行异常`:`运行正常`,` · `,e.ready||0,`/`,e.replicas||1,` Pod 就绪`]})]})]})}function Vv({open:e,onToggle:t,icon:n,title:r,valueLabel:i,series:a,max:o,timeLabels:s,color:c,avg:l,peak:u,emptyHint:d}){let f=`mgrad-`+(0,b.useId)().replaceAll(`:`,``),p=(0,b.useRef)(null),[m,h]=(0,b.useState)(358);(0,b.useEffect)(()=>{if(!e||!p.current)return;let t=p.current,n=()=>{h(Math.max(120,Math.floor(t.clientWidth)))};n();let r=new ResizeObserver(n);return r.observe(t),()=>r.disconnect()},[e]);let g=m-32-6,_=a||[],v=g/Math.max(1,_.length-1),y=_.map((e,t)=>[32+t*v,78-Math.min(o,e)/o*70]),x=y.map((e,t)=>`${t?`L`:`M`}${e[0].toFixed(1)} ${e[1].toFixed(1)}`).join(` `),C=y.length?`${x} L ${y[y.length-1][0].toFixed(1)} 78 L ${y[0][0].toFixed(1)} 78 Z`:``,T=[0,.25,.5,.75,1].map(e=>e*o),E=e=>o<=1||o<=10?e.toFixed(2):e.toFixed(0);return(0,w.jsxs)(`div`,{style:{marginBottom:8,background:`white`,border:`1px solid ${S.border}`,borderRadius:7,overflow:`hidden`},children:[(0,w.jsxs)(`div`,{onClick:t,style:{display:`flex`,alignItems:`center`,gap:6,padding:`7px 10px 7px 8px`,cursor:`pointer`,background:e?`#fcfdfe`:S.surfaceAlt,borderBottom:e?`1px solid ${S.borderSoft}`:`none`},children:[(0,w.jsx)(D,{name:`chevDown`,size:11,stroke:2.2,style:{color:S.ink3,transform:e?`none`:`rotate(-90deg)`,transition:`transform 0.15s ease`}}),(0,w.jsx)(D,{name:n,size:12,stroke:1.8,style:{color:S.ink2}}),(0,w.jsx)(`span`,{style:{fontSize:11.5,color:S.ink,fontWeight:600},children:r}),(0,w.jsx)(`div`,{style:{flex:1}}),(0,w.jsx)(`span`,{style:{fontSize:11,color:S.ink2},children:i})]}),e&&(0,w.jsxs)(`div`,{ref:p,style:{padding:`4px 4px 0`},children:[(0,w.jsxs)(`svg`,{width:m,height:96,style:{display:`block`},children:[T.map((e,t)=>{let n=78-e/o*70;return(0,w.jsxs)(`g`,{children:[(0,w.jsx)(`line`,{x1:32,x2:m-6,y1:n,y2:n,stroke:`#eef1f5`,strokeWidth:`1`,strokeDasharray:t===0||t===T.length-1?`0`:`2 3`}),(0,w.jsx)(`text`,{x:28,y:n+3,fontSize:`9`,fill:S.ink4,textAnchor:`end`,className:`mono`,children:E(e)})]},t)}),(0,w.jsx)(`line`,{x1:32,x2:m-6,y1:78,y2:78,stroke:`#e2e8f0`,strokeWidth:`1`}),y.length>0&&(0,w.jsxs)(w.Fragment,{children:[(0,w.jsx)(`defs`,{children:(0,w.jsxs)(`linearGradient`,{id:f,x1:`0`,x2:`0`,y1:`0`,y2:`1`,children:[(0,w.jsx)(`stop`,{offset:`0%`,stopColor:c,stopOpacity:`0.18`}),(0,w.jsx)(`stop`,{offset:`100%`,stopColor:c,stopOpacity:`0.02`})]})}),(0,w.jsx)(`path`,{d:C,fill:`url(#${f})`}),(0,w.jsx)(`path`,{d:x,fill:`none`,stroke:c,strokeWidth:`1.4`,strokeLinejoin:`round`,strokeLinecap:`round`})]}),s.map((e,t)=>(0,w.jsx)(`text`,{x:32+t/(s.length-1)*g,y:92,fontSize:`9`,fill:S.ink4,textAnchor:`middle`,className:`mono`,children:e},t)),d&&(0,w.jsx)(`text`,{x:m/2,y:46,fontSize:`10`,fill:S.ink4,textAnchor:`middle`,children:d})]}),(0,w.jsxs)(`div`,{style:{display:`flex`,gap:14,padding:`4px 10px 8px 32px`,fontSize:10,color:S.ink3},children:[(0,w.jsxs)(`span`,{children:[`平均 `,(0,w.jsx)(`span`,{className:`mono tnum`,style:{color:S.ink2,fontWeight:600},children:l})]}),(0,w.jsxs)(`span`,{children:[`峰值 `,(0,w.jsx)(`span`,{className:`mono tnum`,style:{color:S.ink2,fontWeight:600},children:u})]})]})]})]})}function Hv({app:e,metricsData:t,historyData:n}){let r=e.state===`error`,i=(t.metrics?.gpu?.used||0)>0||n.gpuUtil&&n.gpuUtil.some(e=>e>0),[a,o]=(0,b.useState)({cpu:!0,mem:!0,netRx:!0,netTx:!0,gpuCompute:!0,gpuMem:!0}),s=e=>o(t=>({...t,[e]:!t[e]})),c=n.cpuPercent||[],l=n.memoryPercent||[],u=n.gpuUtil||[],d=n.gpuMemPercent||[],f=(0,b.useMemo)(()=>{let e=n.netBytesSent||[],t=n.timestamps||[];if(e.length<2)return[];let r=[];for(let n=1;n0?Math.round((e[n]-e[n-1])/i/1024):0)}return r},[n.netBytesSent,n.timestamps]),p=(0,b.useMemo)(()=>{let e=n.netBytesRecv||[],t=n.timestamps||[];if(e.length<2)return[];let r=[];for(let n=1;n0?Math.round((e[n]-e[n-1])/i/1024):0)}return r},[n.netBytesRecv,n.timestamps]),m=(0,b.useMemo)(()=>{let e=n.timestamps||[];if(!e.length)return[``,``,``,``,``];let t=Math.max(1,Math.floor((e.length-1)/5)),r=[];for(let n=0;ne&&e.length>0?e:[0],g=e=>{let t=h(e);return t[t.length-1]},_=e=>{let t=h(e);return t.reduce((e,t)=>e+t,0)/t.length};return(0,w.jsxs)(`div`,{style:{padding:`12px 14px 18px`},children:[(0,w.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,gap:6,marginBottom:10},children:[(0,w.jsx)(D,{name:`history`,size:12,stroke:1.8,style:{color:S.ink3}}),(0,w.jsx)(`span`,{style:{fontSize:11.5,color:S.ink2,fontWeight:600},children:`系统监控指标`}),(0,w.jsx)(`span`,{style:{fontSize:10,color:S.ink4},children:`· 5s 刷新`}),(0,w.jsx)(`div`,{style:{flex:1}})]}),(0,w.jsx)(Vv,{open:a.cpu,onToggle:()=>s(`cpu`),icon:`cpu`,title:`CPU 用量 (%)`,valueLabel:(0,w.jsxs)(w.Fragment,{children:[`当前: `,(0,w.jsxs)(`span`,{className:`mono tnum`,children:[g(c).toFixed(1),`%`]})]}),series:c,max:100,unit:`%`,timeLabels:m,color:S.green,avg:_(c).toFixed(1)+`%`,peak:Math.max(...h(c)).toFixed(1)+`%`}),(0,w.jsx)(Vv,{open:a.mem,onToggle:()=>s(`mem`),icon:`memory`,title:`内存用量 (%)`,valueLabel:(0,w.jsxs)(w.Fragment,{children:[`当前: `,(0,w.jsxs)(`span`,{className:`mono tnum`,children:[g(l).toFixed(0),`%`]})]}),series:l,max:100,unit:`%`,timeLabels:m,color:S.green,avg:_(l).toFixed(0)+`%`,peak:Math.max(...h(l)).toFixed(0)+`%`}),(0,w.jsx)(Vv,{open:a.netRx,onToggle:()=>s(`netRx`),icon:`arrowDown`,title:`网络接收 (KB/s)`,valueLabel:(0,w.jsxs)(w.Fragment,{children:[`当前: `,(0,w.jsx)(`span`,{className:`mono tnum`,children:g(p).toFixed(0)}),` KB/s`]}),series:p,max:Math.max(8,Math.max(...h(p))*1.15),unit:``,timeLabels:m,color:S.green,avg:_(p).toFixed(0),peak:Math.max(...h(p)).toFixed(0)}),(0,w.jsx)(Vv,{open:a.netTx,onToggle:()=>s(`netTx`),icon:`arrowUp`,title:`网络发送 (KB/s)`,valueLabel:(0,w.jsxs)(w.Fragment,{children:[`当前: `,(0,w.jsx)(`span`,{className:`mono tnum`,children:g(f).toFixed(0)}),` KB/s`]}),series:f,max:Math.max(8,Math.max(...h(f))*1.15),unit:``,timeLabels:m,color:S.green,avg:_(f).toFixed(0),peak:Math.max(...h(f)).toFixed(0)}),i&&(0,w.jsx)(Vv,{open:a.gpuCompute,onToggle:()=>s(`gpuCompute`),icon:`bolt`,title:`GPU 算力 (%)`,valueLabel:r?(0,w.jsx)(`span`,{style:{color:S.ink4},children:`当前: 无数据`}):(0,w.jsxs)(w.Fragment,{children:[`当前: `,(0,w.jsxs)(`span`,{className:`mono tnum`,children:[g(u).toFixed(1),`%`]})]}),series:u,max:100,unit:`%`,timeLabels:m,color:r?S.ink4:S.green,avg:r?`—`:_(u).toFixed(1)+`%`,peak:r?`—`:Math.max(...h(u)).toFixed(1)+`%`,emptyHint:r?`进程已退出 · 暂无 GPU 采集`:null}),i&&(0,w.jsx)(Vv,{open:a.gpuMem,onToggle:()=>s(`gpuMem`),icon:`memory`,title:`GPU 显存 (%)`,valueLabel:r?(0,w.jsx)(`span`,{style:{color:S.ink4},children:`当前: 无数据`}):(0,w.jsxs)(w.Fragment,{children:[`当前: `,(0,w.jsxs)(`span`,{className:`mono tnum`,children:[g(d).toFixed(0),`%`]})]}),series:d,max:100,unit:`%`,timeLabels:m,color:r?S.ink4:S.green,avg:r?`—`:_(d).toFixed(0)+`%`,peak:r?`—`:Math.max(...h(d)).toFixed(0)+`%`,emptyHint:r?`进程已退出 · 显存已释放`:null})]})}function Uv({app:e}){let{lines:t,loading:n}=Ud(e.name,3e3,200),r=(0,b.useRef)(null),[i,a]=(0,b.useState)(!0);return(0,b.useEffect)(()=>{i&&r.current&&(r.current.scrollTop=r.current.scrollHeight)},[t,i]),(0,w.jsxs)(`div`,{style:{padding:14},children:[(0,w.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,gap:8,marginBottom:8},children:[(0,w.jsxs)(J,{tone:`green`,children:[(0,w.jsx)(q,{tone:`green`,size:6,pulse:!0}),`实时日志`]}),(0,w.jsx)(`span`,{style:{fontSize:10,color:S.ink4},children:`3s 刷新 · 最近 200 行`}),(0,w.jsx)(`div`,{style:{flex:1}})]}),(0,w.jsxs)(`div`,{ref:r,onScroll:()=>{if(!r.current)return;let{scrollTop:e,scrollHeight:t,clientHeight:n}=r.current;a(t-e-n<40)},style:{background:`#0b1020`,borderRadius:7,padding:`10px 12px`,height:`calc(100vh - 360px)`,minHeight:280,overflowY:`auto`,fontFamily:`ui-monospace, monospace`,fontSize:11,lineHeight:1.55,color:`#cbd5e1`,border:`1px solid #0f1729`},children:[n&&t.length===0&&(0,w.jsx)(`div`,{style:{color:`#64748b`,padding:`20px 0`,textAlign:`center`},children:`加载日志中…`}),!n&&t.length===0&&(0,w.jsx)(`div`,{style:{color:`#64748b`,padding:`20px 0`,textAlign:`center`},children:`暂无日志`}),t.map((e,t)=>(0,w.jsx)(`div`,{style:{whiteSpace:`pre-wrap`,wordBreak:`break-all`,color:`#e2e8f0`},children:e},t)),(0,w.jsx)(`span`,{className:`edge-cursor`,style:{color:`#34d399`},children:`▍`})]})]})}function Wv({app:e,onUninstallClick:t}){let n=e.state===`error`,r={name:e.name||e.id,image:e.image||e.desc||`—`,version:e.version||`latest`,namespace:e.namespace||`—`,nodeName:e.nodeName||`—`,podName:e.podName||`—`,restartPolicy:e.restartPolicy||`—`,ports:(e.ports||[]).map(e=>`${e.containerPort}/${e.protocol||`TCP`}${e.hostPort?` → `+e.hostPort:``}`).join(` - `)||`none`,mounts:(e.volumeMounts||[]).map(e=>`${e.mountPath}${e.hostPath?` ← `+e.hostPath:``}${e.readOnly?` (ro)`:``}`).join(` - `)||`none`,resources:[e.cpuRequest||e.cpuLimit?`cpu: ${e.cpuRequest||`—`}/${e.cpuLimit||`—`}`:null,e.memRequest||e.memLimit?`memory: ${e.memRequest||`—`}/${e.memLimit||`—`}`:null].filter(Boolean).join(`, `)||`—`},i=`name: ${r.name} -image: ${r.image} -version: ${r.version} -namespace: ${r.namespace} -node: ${r.nodeName} -pod: ${r.podName} -restartPolicy: ${r.restartPolicy} -ports: - ${r.ports} -volumeMounts: - ${r.mounts} -resources: ${r.resources}`;return(0,w.jsxs)(`div`,{style:{padding:14},children:[(0,w.jsxs)(`div`,{style:{background:S.surfaceAlt,border:`1px solid ${S.borderSoft}`,borderRadius:8,padding:12,marginBottom:12},children:[(0,w.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,gap:6,marginBottom:10},children:[(0,w.jsx)(D,{name:`apps`,size:13,stroke:1.8,style:{color:S.indigo}}),(0,w.jsx)(`span`,{style:{fontSize:12,fontWeight:700,color:S.ink},children:`Pod 调度状态`}),(0,w.jsx)(`div`,{style:{flex:1}}),(0,w.jsxs)(J,{tone:n?`red`:`green`,children:[(0,w.jsx)(q,{tone:n?`red`:`green`,size:6,pulse:n}),n?`Error`:`Running`]})]}),(0,w.jsx)(`div`,{style:{display:`flex`,flexDirection:`column`,gap:5,fontSize:11.5},children:[[`Pod 名称`,(0,w.jsx)(`span`,{className:`mono`,children:e.podName||`—`})],[`命名空间`,(0,w.jsx)(`span`,{className:`mono`,children:e.namespace||`—`})],[`节点`,(0,w.jsx)(`span`,{className:`mono`,children:e.nodeName||`—`})],[`部署时间`,(0,w.jsx)(`span`,{className:`mono`,children:e.deployedAt||`—`})],[`重启次数`,(0,w.jsx)(`span`,{className:`mono tnum`,children:e.restartCount||0})]].map(([e,t])=>(0,w.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,gap:8},children:[(0,w.jsx)(`span`,{style:{color:S.ink3,width:64,flexShrink:0},children:e}),(0,w.jsx)(`span`,{style:{color:S.ink,fontWeight:500,flex:1},children:t})]},e))})]}),(0,w.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,gap:8,marginBottom:6},children:[(0,w.jsx)(`span`,{style:{fontSize:11.5,color:S.ink3},children:`应用配置摘要`}),(0,w.jsx)(`div`,{style:{flex:1}}),(0,w.jsxs)(`button`,{onClick:()=>navigator.clipboard.writeText(i),className:`edge-press edge-btn-secondary`,style:{...gd,height:24,padding:`0 8px`,fontSize:11},children:[(0,w.jsx)(D,{name:`copy`,size:11,stroke:1.8}),`复制`]})]}),(0,w.jsx)(`pre`,{style:{margin:0,background:`#0b1020`,color:`#cbd5e1`,borderRadius:7,padding:`12px 14px`,border:`1px solid #0f1729`,fontFamily:`ui-monospace, "JetBrains Mono", monospace`,fontSize:11,lineHeight:1.65,whiteSpace:`pre`,overflow:`auto`,maxHeight:360},children:i.split(` -`).map((e,t)=>{let n=e.match(/^(\s*)([\w./-]+)(:.*)$/);return n?(0,w.jsxs)(`div`,{children:[(0,w.jsx)(`span`,{children:n[1]}),(0,w.jsx)(`span`,{style:{color:`#7dd3fc`},children:n[2]}),(0,w.jsx)(`span`,{children:n[3]})]},t):(0,w.jsx)(`div`,{children:e},t)})}),(0,w.jsx)(Yv,{values:e.deployValues}),(0,w.jsx)(Jv,{env:e.env}),(0,w.jsxs)(`div`,{style:{marginTop:10,padding:10,background:S.blueSoft,border:`1px solid #bfdbfe`,borderRadius:7,fontSize:11.5,color:S.ink2,lineHeight:1.55,display:`flex`,gap:8,alignItems:`flex-start`},children:[(0,w.jsx)(D,{name:`info`,size:13,stroke:1.8,style:{color:S.blueDeep,marginTop:1,flexShrink:0}}),(0,w.jsxs)(`div`,{children:[`本机 Pod 由 `,(0,w.jsx)(`strong`,{children:`云端调度器`}),` 下发,本地无法直接修改。 如需调整资源/端口/挂载,请在云端「应用编排」中重新部署。`]})]}),(0,w.jsxs)(`div`,{style:{marginTop:14,borderRadius:8,border:`1px solid #fecaca`,overflow:`hidden`},children:[(0,w.jsxs)(`div`,{style:{padding:`8px 12px`,background:`#fef2f2`,borderBottom:`1px solid #fecaca`,fontSize:11.5,fontWeight:700,color:`#b91c1c`,letterSpacing:`0.02em`,display:`flex`,alignItems:`center`,gap:6},children:[(0,w.jsx)(D,{name:`alertTri`,size:12,stroke:2}),`危险操作区`]}),(0,w.jsxs)(`div`,{style:{padding:12,background:`white`,display:`flex`,alignItems:`center`,gap:12},children:[(0,w.jsxs)(`div`,{style:{flex:1},children:[(0,w.jsx)(`div`,{style:{fontSize:12.5,color:S.ink,fontWeight:600},children:`卸载应用`}),(0,w.jsxs)(`div`,{style:{fontSize:11,color:S.ink3,marginTop:3,lineHeight:1.5},children:[`立即终止 Pod,释放 GPU 与端口;保留 `,(0,w.jsx)(`span`,{className:`mono`,children:`/workspace`}),` 数据`]})]}),(0,w.jsxs)(`button`,{onClick:t,className:`edge-press edge-btn-danger`,style:{...vd,height:30,padding:`0 12px`,fontSize:11.5,flexShrink:0},children:[(0,w.jsx)(D,{name:`x`,size:12,stroke:2}),`卸载`]})]})]})]})}var Gv=/password|pass(?!port)|pwd|token|secret|apikey|api_key|auth/i;function Kv(e){return e?Gv.test(String(e)):!1}function qv({name:e,value:t,source:n,error:r}){let i=Kv(e),[a,o]=(0,b.useState)(!i),s=r?``:i&&!a?`••••••••`:String(t??``);return(0,w.jsxs)(`div`,{style:{display:`grid`,gridTemplateColumns:`160px 1fr auto`,gap:8,padding:`6px 0`,alignItems:`center`,borderTop:`1px solid ${S.borderSoft}`},children:[(0,w.jsxs)(`div`,{style:{fontSize:11.5,color:S.ink2,fontWeight:500,wordBreak:`break-all`},children:[e,n&&(0,w.jsx)(`div`,{style:{display:`inline-block`,marginLeft:6,padding:`0 5px`,borderRadius:3,background:`#dbeafe`,color:`#1e40af`,fontSize:10,fontWeight:500,verticalAlign:`middle`},title:`来自 ${n}`,children:n.split(`:`)[0]})]}),(0,w.jsx)(`div`,{style:{fontFamily:`ui-monospace, "JetBrains Mono", monospace`,fontSize:11.5,color:r?S.red:S.ink,wordBreak:`break-all`,minWidth:0},children:r?(0,w.jsxs)(`span`,{title:r,children:[`⚠ `,r.length>60?r.slice(0,60)+`…`:r]}):s}),(0,w.jsxs)(`div`,{style:{display:`flex`,gap:4,alignItems:`center`},children:[i&&!r&&(0,w.jsx)(`button`,{onClick:()=>o(e=>!e),title:a?`隐藏`:`显示`,style:{border:`none`,background:`transparent`,cursor:`pointer`,padding:3,color:a?S.blue:S.ink4,display:`flex`},children:(0,w.jsx)(D,{name:`eye`,size:13,stroke:1.8})}),!r&&t!=null&&t!==``&&(0,w.jsx)(`button`,{onClick:()=>navigator.clipboard?.writeText(String(t)),title:`复制明文`,style:{border:`none`,background:`transparent`,cursor:`pointer`,padding:3,color:S.ink4,display:`flex`},children:(0,w.jsx)(D,{name:`copy`,size:13,stroke:1.8})})]})]})}function Jv({env:e}){return e==null?null:e.length===0?(0,w.jsxs)(`div`,{style:{marginTop:14},children:[(0,w.jsxs)(`div`,{style:{fontSize:11.5,color:S.ink3,marginBottom:6,display:`flex`,alignItems:`center`,gap:6},children:[(0,w.jsx)(D,{name:`key`,size:12,stroke:1.8}),`环境变量 (env)`]}),(0,w.jsx)(`div`,{style:{padding:`10px 12px`,background:S.surfaceAlt,border:`1px solid ${S.borderSoft}`,borderRadius:7,fontSize:11.5,color:S.ink3},children:`该容器未声明任何环境变量`})]}):(0,w.jsxs)(`div`,{style:{marginTop:14},children:[(0,w.jsxs)(`div`,{style:{fontSize:11.5,color:S.ink3,marginBottom:6,display:`flex`,alignItems:`center`,gap:6},children:[(0,w.jsx)(D,{name:`key`,size:12,stroke:1.8}),`环境变量 (env) · `,e.length,` 项`]}),(0,w.jsx)(`div`,{style:{background:S.surface,border:`1px solid ${S.borderSoft}`,borderRadius:7,padding:`0 12px`},children:e.map((e,t)=>(0,w.jsx)(qv,{name:e.name,value:e.value,source:e.source,error:e.error},t))})]})}function Yv({values:e}){if(e==null)return null;let t=Object.entries(e);return t.length===0?null:(0,w.jsxs)(`div`,{style:{marginTop:14},children:[(0,w.jsxs)(`div`,{style:{fontSize:11.5,color:S.ink3,marginBottom:6,display:`flex`,alignItems:`center`,gap:6},children:[(0,w.jsx)(D,{name:`edit`,size:12,stroke:1.8}),`部署参数 (Helm values) · `,t.length,` 项`]}),(0,w.jsx)(`div`,{style:{background:S.surface,border:`1px solid ${S.borderSoft}`,borderRadius:7,padding:`0 12px`},children:t.map(([e,t])=>(0,w.jsx)(qv,{name:e,value:typeof t==`object`&&t?JSON.stringify(t):t},e))})]})}function Xv({app:e}){let{data:t,loading:n,error:r}=Wd(e.name),[i,a]=(0,b.useState)(null),[o,s]=(0,b.useState)(null),[c,l]=(0,b.useState)(null),u=async t=>{a(t),s(null),l(null);try{await Gd(e.name,t),l(t)}catch(e){s(e.message||`切换失败`)}finally{a(null)}};if(n)return(0,w.jsx)(`div`,{style:{padding:14,textAlign:`center`,color:S.ink3,fontSize:12},children:`加载版本信息…`});if(r||!t)return(0,w.jsx)(`div`,{style:{padding:14},children:(0,w.jsxs)(`div`,{style:{padding:12,borderRadius:7,background:`#fffbeb`,border:`1px solid #fde68a`,fontSize:12,color:`#92400e`,display:`flex`,alignItems:`center`,gap:6},children:[(0,w.jsx)(D,{name:`alertTri`,size:13,stroke:1.8}),r?`无法获取版本信息`:`暂无版本数据`]})});let d=t.versions||[];return(0,w.jsxs)(`div`,{style:{padding:14},children:[(0,w.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,gap:8,marginBottom:10},children:[(0,w.jsxs)(J,{tone:`blue`,children:[(0,w.jsx)(D,{name:`gear`,size:10,stroke:1.8}),`当前版本: `,t.currentVersion]}),(0,w.jsxs)(`span`,{style:{fontSize:10,color:S.ink4},children:[`共 `,d.length,` 个版本`]})]}),c&&(0,w.jsxs)(`div`,{style:{padding:`8px 12px`,borderRadius:7,marginBottom:10,background:`#f0fdf4`,border:`1px solid #bbf7d0`,fontSize:12,color:`#166534`,display:`flex`,alignItems:`center`,gap:6},children:[(0,w.jsx)(q,{tone:`green`,size:6}),`已切换到版本 `,c,`,正在滚动更新…`]}),o&&(0,w.jsxs)(`div`,{style:{padding:`8px 12px`,borderRadius:7,marginBottom:10,background:`#fef2f2`,border:`1px solid #fecaca`,fontSize:12,color:`#b91c1c`,display:`flex`,alignItems:`center`,gap:6},children:[(0,w.jsx)(D,{name:`alertTri`,size:12,stroke:1.8}),o]}),(0,w.jsxs)(`div`,{style:{background:S.surfaceAlt,border:`1px solid ${S.borderSoft}`,borderRadius:8,overflow:`hidden`},children:[(0,w.jsxs)(`div`,{style:{display:`grid`,gridTemplateColumns:`1fr 80px 120px 70px`,padding:`8px 12px`,fontSize:10.5,color:S.ink3,fontWeight:600,letterSpacing:`0.04em`,textTransform:`uppercase`,borderBottom:`1px solid ${S.borderSoft}`},children:[(0,w.jsx)(`span`,{children:`版本号`}),(0,w.jsx)(`span`,{children:`状态`}),(0,w.jsx)(`span`,{children:`创建时间`}),(0,w.jsx)(`span`,{style:{textAlign:`right`},children:`操作`})]}),d.length===0&&(0,w.jsx)(`div`,{style:{padding:`20px 12px`,textAlign:`center`,color:S.ink4,fontSize:12},children:`暂无版本记录`}),d.map((e,t)=>{let n=e.isCurrent?S.green:e.status===`Approved`?S.blue:S.ink4,r=e.isCurrent?`当前版本`:e.status===`Approved`?`已审核`:e.status,a=e.createdAt?new Date(e.createdAt).toLocaleString(`zh-CN`,{year:`numeric`,month:`2-digit`,day:`2-digit`,hour:`2-digit`,minute:`2-digit`}):`—`;return(0,w.jsxs)(`div`,{style:{display:`grid`,gridTemplateColumns:`1fr 80px 120px 70px`,padding:`10px 12px`,fontSize:12,alignItems:`center`,borderTop:t>0?`1px solid ${S.borderSoft}`:`none`,background:e.isCurrent?`#f0fdf4`:`transparent`},children:[(0,w.jsx)(`span`,{className:`mono`,style:{fontWeight:e.isCurrent?700:500,color:S.ink},children:e.version}),(0,w.jsxs)(`span`,{style:{fontSize:11,color:n,fontWeight:600,display:`inline-flex`,alignItems:`center`,gap:4},children:[(0,w.jsx)(q,{tone:e.isCurrent?`green`:e.status===`Approved`?`blue`:`grey`,size:5}),r]}),(0,w.jsx)(`span`,{className:`mono`,style:{fontSize:11,color:S.ink3},children:a}),(0,w.jsx)(`div`,{style:{textAlign:`right`},children:e.isCurrent?(0,w.jsx)(`span`,{style:{fontSize:11,color:S.ink4},children:`当前运行中`}):e.status===`Approved`?(0,w.jsx)(`button`,{onClick:()=>u(e.version),disabled:!!i,className:`edge-press edge-btn-primary`,style:{..._d,height:26,padding:`0 10px`,fontSize:11,opacity:i?.6:1,cursor:i?`not-allowed`:`pointer`},children:i===e.version?`切换中…`:`切换`}):(0,w.jsx)(`span`,{style:{fontSize:11,color:S.ink4},children:`未审核`})})]},e.version)})]}),(0,w.jsxs)(`div`,{style:{marginTop:10,padding:10,background:S.blueSoft,border:`1px solid #bfdbfe`,borderRadius:7,fontSize:11.5,color:S.ink2,lineHeight:1.55,display:`flex`,gap:8,alignItems:`flex-start`},children:[(0,w.jsx)(D,{name:`info`,size:13,stroke:1.8,style:{color:S.blueDeep,marginTop:1,flexShrink:0}}),(0,w.jsxs)(`div`,{children:[`版本切换会触发`,(0,w.jsx)(`strong`,{children:`滚动更新`}),`,新版本 Pod 就绪后旧 Pod 自动回收。只能切换到已审核的版本。`]})]})]})}function Zv({app:e,onCancel:t,onConfirm:n}){let[r,i]=(0,b.useState)(``),a=r===e.name;return(0,w.jsx)(`div`,{className:`edge-backdrop-in`,onClick:t,style:{position:`fixed`,inset:0,zIndex:250,background:`rgba(15,23,41,0.5)`,display:`flex`,alignItems:`center`,justifyContent:`center`,backdropFilter:`blur(4px)`,WebkitBackdropFilter:`blur(4px)`},children:(0,w.jsxs)(`div`,{onClick:e=>e.stopPropagation(),className:`edge-fade-in`,style:{width:460,background:`white`,borderRadius:12,boxShadow:`0 28px 64px -12px rgba(15,23,42,0.45)`,overflow:`hidden`},children:[(0,w.jsxs)(`div`,{style:{padding:`14px 20px`,display:`flex`,alignItems:`center`,gap:10,background:`#fef2f2`,borderBottom:`1px solid #fecaca`},children:[(0,w.jsx)(`div`,{style:{width:30,height:30,borderRadius:8,background:S.red,color:`white`,display:`flex`,alignItems:`center`,justifyContent:`center`},children:(0,w.jsx)(D,{name:`alertTri`,size:16,stroke:2})}),(0,w.jsxs)(`div`,{style:{flex:1},children:[(0,w.jsx)(`div`,{style:{fontSize:14,fontWeight:700,color:S.ink},children:`卸载应用`}),(0,w.jsx)(`div`,{style:{fontSize:11.5,color:`#b91c1c`,marginTop:2},children:`此操作不可撤销`})]}),(0,w.jsx)(`div`,{onClick:t,style:{width:28,height:28,borderRadius:7,cursor:`pointer`,display:`flex`,alignItems:`center`,justifyContent:`center`,color:S.ink3},children:(0,w.jsx)(D,{name:`x`,size:15,stroke:2})})]}),(0,w.jsxs)(`div`,{style:{padding:`18px 20px 20px`},children:[(0,w.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,gap:12,marginBottom:14},children:[(0,w.jsx)(`div`,{style:{width:44,height:44,borderRadius:11,background:e.bg,color:`white`,display:`flex`,alignItems:`center`,justifyContent:`center`,boxShadow:`inset 0 1px 0 rgba(255,255,255,0.3)`,flexShrink:0},children:(0,w.jsx)(D,{name:e.icon,size:22,stroke:1.6})}),(0,w.jsxs)(`div`,{children:[(0,w.jsx)(`div`,{style:{...S.type.heading,color:S.ink},children:e.name}),(0,w.jsxs)(`div`,{style:{fontSize:11.5,color:S.ink3,marginTop:2},className:`mono`,children:[e.version,` · `,e.category]})]})]}),(0,w.jsx)(`div`,{style:{padding:12,borderRadius:8,marginBottom:14,background:S.surfaceAlt,border:`1px solid ${S.borderSoft}`},children:(0,w.jsxs)(`div`,{style:{fontSize:12,color:S.ink2,lineHeight:1.65},children:[(0,w.jsx)(`strong`,{style:{color:S.ink},children:`将会发生什么`}),(0,w.jsxs)(`ul`,{style:{margin:`6px 0 0`,paddingLeft:20,fontSize:11.5,color:S.ink3},children:[(0,w.jsx)(`li`,{children:`立即终止该 Pod,释放占用的 GPU / 内存 / 端口`}),(0,w.jsx)(`li`,{children:`删除容器镜像与配置(保留模型权重和数据集)`}),(0,w.jsxs)(`li`,{children:[`云端「应用编排」状态同步为 `,(0,w.jsx)(`span`,{className:`mono`,children:`Uninstalled`})]}),(0,w.jsxs)(`li`,{children:[`本机暴露的公网链接 `,(0,w.jsx)(`span`,{className:`mono`,children:`share.edgex.cloud/...`}),` 将失效`]})]})]})}),(0,w.jsxs)(`div`,{style:{marginBottom:14},children:[(0,w.jsxs)(`div`,{style:{fontSize:12,color:S.ink2,marginBottom:6},children:[`请输入应用名称 `,(0,w.jsx)(`span`,{className:`mono`,style:{background:S.surfaceAlt,padding:`1px 6px`,borderRadius:3,color:S.ink,fontWeight:600,border:`1px solid ${S.border}`},children:e.name}),` 确认:`]}),(0,w.jsx)(`input`,{value:r,onChange:e=>i(e.target.value),autoFocus:!0,placeholder:e.name,style:{width:`100%`,height:38,padding:`0 12px`,border:`1px solid ${a?S.red:S.border}`,borderRadius:7,fontSize:13,color:S.ink,background:`white`,outline:`none`,boxShadow:a?`0 0 0 3px ${S.red}22`:`none`},className:`mono`})]}),(0,w.jsxs)(`div`,{style:{display:`flex`,gap:8},children:[(0,w.jsx)(`button`,{onClick:t,style:{flex:1,height:38,borderRadius:8,background:`white`,border:`1px solid ${S.border}`,fontSize:13,fontWeight:500,color:S.ink2,cursor:`pointer`},children:`取消`}),(0,w.jsxs)(`button`,{onClick:a?n:null,disabled:!a,style:{flex:1.4,height:38,borderRadius:8,background:a?S.red:`#fca5a5`,color:`white`,border:`none`,fontSize:13,fontWeight:600,cursor:a?`pointer`:`not-allowed`,display:`flex`,alignItems:`center`,justifyContent:`center`,gap:6,opacity:a?1:.7},children:[(0,w.jsx)(D,{name:`x`,size:13,stroke:2}),`我已了解,卸载`]})]})]})]})})}function Qv({app:e}){return(0,w.jsx)(`div`,{className:`edge-backdrop-in`,style:{position:`fixed`,inset:0,zIndex:250,background:`rgba(15,23,41,0.5)`,display:`flex`,alignItems:`center`,justifyContent:`center`,backdropFilter:`blur(4px)`,WebkitBackdropFilter:`blur(4px)`},children:(0,w.jsxs)(`div`,{className:`edge-fade-in`,style:{width:360,background:`white`,borderRadius:12,boxShadow:`0 28px 64px -12px rgba(15,23,42,0.45)`,padding:`20px 24px 22px`,textAlign:`center`},children:[(0,w.jsx)(`div`,{style:{width:44,height:44,borderRadius:11,margin:`0 auto 12px`,background:e.bg,color:`white`,display:`flex`,alignItems:`center`,justifyContent:`center`,opacity:.7},children:(0,w.jsx)(D,{name:e.icon,size:22,stroke:1.6})}),(0,w.jsxs)(`div`,{style:{fontSize:14,fontWeight:700,color:S.ink,marginBottom:4},children:[`正在卸载 `,e.name,`…`]}),(0,w.jsx)(`div`,{style:{fontSize:11.5,color:S.ink3,marginBottom:14},children:`释放资源 · 删除容器 · 通知云端`}),(0,w.jsx)(`div`,{style:{height:4,borderRadius:2,background:S.surfaceAlt,overflow:`hidden`},children:(0,w.jsx)(`div`,{style:{width:`60%`,height:`100%`,background:S.red,animation:`edgeProgress 2s ease-out forwards`}})}),(0,w.jsx)(`style`,{children:` - @keyframes edgeProgress { - from { width: 0%; } - to { width: 100%; } - } - `})]})})}function $v({app:e,open:t,onClose:n,onUninstall:r,metricsData:i,historyData:a}){let[o,s]=(0,b.useState)(`overview`),[c,l]=(0,b.useState)(null),[u,d]=(0,b.useState)(null),{task:f}=hf(u),p=Wu(),m=(0,b.useRef)(null),h=(0,b.useRef)(980),g=(0,b.useRef)(0),_=Vu(),v=Ru(),y=Du(t?0:1e3),[x,C]=(0,b.useState)(980),T=Au(y,[0,x||1],[.18,0]),E=(0,b.useCallback)(()=>m.current?.getBoundingClientRect().width||h.current,[]);(0,b.useLayoutEffect)(()=>{let e=E();h.current=e,p.reduced?y.set(0):t||y.set(e)},[t,p.reduced,y,E]),(0,b.useEffect)(()=>{let e=E();if(h.current=e,p.reduced){y.set(0),v.start({opacity:+!!t,transition:{duration:.2}});return}let n=g.current;g.current=0,v.start({x:t?0:e,opacity:1,transition:n?{...Uu.momentum,velocity:n}:Uu.default})},[t,p.reduced,v,y,E]),(0,b.useEffect)(()=>{if(!m.current)return;let e=new ResizeObserver(()=>{let e=E();h.current=e,C(e),!t&&!p.reduced&&y.set(e)});return e.observe(m.current),()=>e.disconnect()},[t,p.reduced,y,E]);let{data:O}=Vd(t&&e?.id?e.id:null),k=(0,b.useMemo)(()=>e?O?{...e,env:O.env,deployValues:O.deployValues}:e:null,[e,O]),A=i||{metrics:{},gpus:[]},j=a||{},ee=A.metrics?.cpu?.used||0,M=A.metrics?.gpu?.used||0;if(!e)return null;let N=e.runtime===`compose`,P=N?e.observed?.phase||`unknown`:e.state===`error`?`failed`:`running`,F=P===`failed`||P===`degraded`,I={running:{tone:`green`,label:`运行中`,dot:`green`,pulse:!1},degraded:{tone:`amber`,label:`运行降级`,dot:`yellow`,pulse:!0},failed:{tone:`red`,label:`运行异常`,dot:`red`,pulse:!0},stopped:{tone:`gray`,label:`已停止`,dot:`gray`,pulse:!1},pending:{tone:`blue`,label:`等待中`,dot:`blue`,pulse:!0},deploying:{tone:`blue`,label:`部署中`,dot:`blue`,pulse:!0},removing:{tone:`amber`,label:`卸载中`,dot:`yellow`,pulse:!0},unknown:{tone:`gray`,label:`未知`,dot:`gray`,pulse:!1}},te=N?I[P]||I.unknown:F?{tone:`red`,label:`运行异常`,dot:`red`,pulse:!0}:{tone:`green`,label:`运行中`,dot:`green`,pulse:!1},ne=N?[{id:`overview`,label:`概览`,icon:`info`},{id:`services`,label:`服务`,icon:`apps`},{id:`logs`,label:`日志`,icon:`terminal`},{id:`compose`,label:`Compose`,icon:`code`},{id:`env`,label:`环境变量`,icon:`gear`},{id:`storage`,label:`存储`,icon:`database`},{id:`revisions`,label:`版本`,icon:`refresh`},{id:`operations`,label:`操作记录`,icon:`clock`}]:[{id:`overview`,label:`概览`,icon:`info`},{id:`metrics`,label:`指标`,icon:`dashboard`},{id:`logs`,label:`日志`,icon:`terminal`},{id:`shell`,label:`容器 Shell`,icon:`terminal`},{id:`versions`,label:`版本`,icon:`refresh`},{id:`config`,label:`配置`,icon:`gear`}],L=ne.some(e=>e.id===o)?o:`overview`;return(0,w.jsxs)(w.Fragment,{children:[(0,w.jsx)(Hu.div,{onClick:n,animate:p.reduced?{opacity:t?.18:0}:void 0,transition:{duration:.2},style:{position:`absolute`,inset:0,zIndex:40,background:`rgb(15,23,42)`,opacity:p.reduced?0:T,pointerEvents:t?`auto`:`none`}}),(0,w.jsxs)(Hu.div,{ref:m,drag:p.reduced?!1:`x`,dragControls:_,dragListener:!1,dragMomentum:!1,dragConstraints:{left:0,right:x},dragElastic:{left:.08,right:0},animate:v,onDragEnd:(e,t)=>{let r=E();if(h.current=r,C(r),t.offset.x+Ku(t.velocity.x)>r/2||t.velocity.x>500){g.current=t.velocity.x,n();return}v.start({x:0,transition:{...Uu.momentum,velocity:t.velocity.x}})},style:{position:`absolute`,top:0,right:0,bottom:0,width:`clamp(640px, 65%, 980px)`,background:S.surface,zIndex:41,borderLeft:`1px solid ${S.border}`,boxShadow:`-10px 0 30px -8px rgba(15,23,42,0.22)`,x:p.reduced?0:y,opacity:+!p.reduced,pointerEvents:t?`auto`:`none`,display:`flex`,flexDirection:`column`,overflow:`hidden`},children:[(0,w.jsxs)(`div`,{style:{padding:`14px 18px 0`,flexShrink:0,borderBottom:`1px solid ${S.borderSoft}`,background:`linear-gradient(180deg, #fafbfc, white)`},children:[(0,w.jsxs)(`div`,{onPointerDown:e=>{p.reduced||_.start(e)},style:{display:`flex`,alignItems:`center`,gap:12,marginBottom:14,cursor:p.reduced?`default`:`grab`,touchAction:`none`},children:[(0,w.jsx)(`div`,{style:{width:44,height:44,borderRadius:11,background:e.bg,color:`white`,display:`flex`,alignItems:`center`,justifyContent:`center`,boxShadow:`0 4px 12px -2px ${e.color}55, inset 0 1px 0 rgba(255,255,255,0.4)`,flexShrink:0},children:(0,w.jsx)(D,{name:e.icon,size:22,stroke:1.6})}),(0,w.jsxs)(`div`,{style:{flex:1,minWidth:0},children:[(0,w.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,gap:6},children:[(0,w.jsx)(`div`,{style:{...S.type.heading,color:S.ink},children:e.name}),(0,w.jsxs)(J,{tone:te.tone,children:[(0,w.jsx)(q,{tone:te.dot,size:6,pulse:te.pulse}),te.label]})]}),(0,w.jsxs)(`div`,{style:{fontSize:11.5,color:S.ink3,marginTop:3,display:`flex`,alignItems:`center`,gap:6},children:[(0,w.jsx)(`span`,{className:`mono`,children:N?`Docker Compose · r${e.revision||0}`:e.version}),(0,w.jsx)(`span`,{style:{color:`#cbd5e1`},children:`·`}),(0,w.jsx)(`span`,{children:e.category||`应用`}),(0,w.jsx)(`span`,{style:{color:`#cbd5e1`},children:`·`}),(0,w.jsx)(`span`,{children:e.gpu||`CPU`})]})]}),(0,w.jsx)(`button`,{onPointerDown:e=>e.stopPropagation(),onClick:n,className:`edge-press edge-menu-item`,style:{width:28,height:28,borderRadius:7,cursor:`pointer`,display:`flex`,alignItems:`center`,justifyContent:`center`,color:S.ink3,background:`transparent`,border:`none`},children:(0,w.jsx)(D,{name:`x`,size:15,stroke:2})})]}),(0,w.jsx)(Zf,{tabs:ne,active:L,onChange:s,style:{gap:2,overflowX:`auto`,scrollbarWidth:`thin`},itemStyle:{padding:`8px 12px 10px`,fontSize:12.5,marginBottom:-1,gap:5,flexShrink:0},renderLabel:e=>(0,w.jsxs)(w.Fragment,{children:[(0,w.jsx)(D,{name:e.icon,size:12,stroke:1.8}),e.label]})})]}),(0,w.jsxs)(`div`,{style:{flex:1,overflowY:`auto`},children:[N&&f&&(0,w.jsxs)(`div`,{style:{margin:`10px 14px 0`,padding:`8px 10px`,borderRadius:7,background:f.status===`failed`?`#fef2f2`:`#eff6ff`,border:`1px solid ${f.status===`failed`?`#fecaca`:`#bfdbfe`}`,color:f.status===`failed`?`#b91c1c`:`#1e40af`,fontSize:11.5},children:[`操作任务 `,f.status||`queued`,` · `,f.phase||`queued`,f.message?` · ${f.message}`:``]}),N?(0,w.jsxs)(w.Fragment,{children:[L===`overview`&&(0,w.jsx)(gv,{app:e}),L===`services`&&(0,w.jsx)(_v,{app:e}),L===`logs`&&(0,w.jsx)(vv,{app:e}),L===`compose`&&(0,w.jsx)(yv,{app:e}),L===`env`&&(0,w.jsx)(bv,{app:e}),L===`storage`&&(0,w.jsx)(xv,{app:e}),L===`revisions`&&(0,w.jsx)(Sv,{app:e}),L===`operations`&&(0,w.jsx)(Cv,{app:e})]}):(0,w.jsxs)(w.Fragment,{children:[L===`overview`&&(0,w.jsx)(Bv,{app:e,cpu:ee,gpu:M}),L===`metrics`&&(0,w.jsx)(Hv,{app:e,metricsData:A,historyData:j}),L===`logs`&&(0,w.jsx)(Uv,{app:e}),L===`shell`&&(0,w.jsx)(Iv,{appId:e.id,app:e}),L===`versions`&&(0,w.jsx)(Xv,{app:e}),L===`config`&&(0,w.jsx)(Wv,{app:k,onUninstallClick:()=>l(`confirm`)})]})]}),(0,w.jsxs)(`div`,{style:{padding:`10px 16px`,background:S.surfaceAlt,borderTop:`1px solid ${S.borderSoft}`,flexShrink:0,display:`flex`,gap:6,alignItems:`center`},children:[(0,w.jsx)(`div`,{style:{flex:1}}),N&&(0,w.jsxs)(`button`,{className:`edge-press edge-btn-danger`,style:{...vd,height:30,padding:`0 10px`,fontSize:11.5},onClick:()=>l(`confirm`),children:[(0,w.jsx)(D,{name:`trash`,size:12,stroke:1.8}),`卸载`]}),N&&P===`stopped`?(0,w.jsxs)(`button`,{className:`edge-press edge-btn-primary`,style:{..._d,height:30,padding:`0 12px`,fontSize:11.5},onClick:()=>xf(e.id,`start`).then(e=>d(e.id)).catch(e=>console.error(`Start failed:`,e)),children:[(0,w.jsx)(D,{name:`play`,size:12,stroke:2}),`启动`]}):F?(0,w.jsxs)(`button`,{className:`edge-press edge-btn-primary`,style:{..._d,background:S.red,border:`none`,height:30,padding:`0 12px`,fontSize:11.5},onClick:()=>Kd(e.id,`restart`).catch(e=>console.error(`Restart failed:`,e)),children:[(0,w.jsx)(D,{name:`refresh`,size:12,stroke:2}),`强制重启`]}):(0,w.jsxs)(w.Fragment,{children:[(0,w.jsxs)(`button`,{className:`edge-press edge-btn-secondary`,style:{...gd,height:30,padding:`0 10px`,fontSize:11.5},onClick:()=>xf(e.id,`restart`).then(e=>d(e.id)).catch(e=>console.error(`Restart failed:`,e)),children:[(0,w.jsx)(D,{name:`refresh`,size:12,stroke:1.8}),`重启`]}),(0,w.jsxs)(`button`,{className:`edge-press edge-btn-danger`,style:{...vd,height:30,padding:`0 10px`,fontSize:11.5},onClick:()=>xf(e.id,`stop`).then(e=>d(e.id)).catch(e=>console.error(`Stop failed:`,e)),children:[(0,w.jsx)(D,{name:`stop`,size:12,stroke:1.8}),`停止`]})]})]})]}),c===`confirm`&&N&&(0,w.jsx)(Fp,{app:e,trackTask:!0,onClose:()=>l(null),onDone:()=>{l(null),n(),r&&r(e)}}),c===`confirm`&&!N&&(0,w.jsx)(Zv,{app:e,onCancel:()=>l(null),onConfirm:async()=>{l(`running`);try{await qd(e.id)}catch(e){console.error(`Uninstall failed:`,e)}l(null),n(),r&&r(e)}}),c===`running`&&(0,w.jsx)(Qv,{app:e})]})}function ey({onLogin:e,deviceName:t}){let[n,r]=(0,b.useState)(``),[i,a]=(0,b.useState)(``),[o,s]=(0,b.useState)(!1),[c,l]=(0,b.useState)(`idle`),[u,d]=(0,b.useState)(``),[f,p]=(0,b.useState)(null),[m,h]=(0,b.useState)(null),g=ly();(0,b.useEffect)(()=>{let e=!1;return fetch(`/api/v1/device`).then(e=>e.ok?e.json():null).then(t=>{e||!t||h({deviceName:t.hostname||``,alias:t.ip||``,model:t.cpuModel||``,computePower:t.cpuCores?`${t.cpuCores} 核 CPU`:``,memoryTotal:t.memoryTotal||0,uptime:t.uptime||0,uptimeHuman:t.uptimeHuman||``,agentVersion:t.agentVersion||``,osVersion:t.platform||``})}).catch(()=>{}),()=>{e=!0}},[]);let _=async t=>{if(t&&t.preventDefault(),c!==`idle`)return;let r=i.trim();if(!n||!r){d(`请输入账号与密码`);return}d(``),l(`verifying`);try{let t=await fetch(`/api/v1/auth/verify`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({password:r})}),i=await t.json().catch(()=>({}));if(!t.ok||!i.authenticated){d(i.message||`密码错误`),l(`idle`);return}l(`success`),setTimeout(()=>e(i.token||``,n,`local`),1100)}catch{d(`无法连接到服务器`),l(`idle`)}},v=t||m?.deviceName||`本地节点`,y=m?.alias||``,x=m?.model||``;return(0,w.jsxs)(`div`,{style:{display:`flex`,width:`100vw`,height:`100vh`,overflow:`hidden`,background:`#fff`,fontFamily:`"PingFang SC", "Noto Sans SC", -apple-system, BlinkMacSystemFont, "Microsoft YaHei", "Segoe UI", Arial, sans-serif`,WebkitFontSmoothing:`antialiased`},children:[(0,w.jsx)(`style`,{children:ry}),(0,w.jsxs)(`div`,{className:`login-brand`,style:{position:`relative`,width:`52%`,flexShrink:0,overflow:`hidden`,display:`flex`,flexDirection:`column`,padding:`46px 52px`,color:`#e2e8f0`,background:`#0b1220`,backgroundImage:`radial-gradient(ellipse 70% 50% at 25% 8%, rgba(37,99,235,0.30), transparent 60%),radial-gradient(ellipse 60% 45% at 92% 100%, rgba(16,185,129,0.16), transparent 60%),linear-gradient(to right, rgba(148,163,184,0.07) 1px, transparent 1px),linear-gradient(to bottom, rgba(148,163,184,0.07) 1px, transparent 1px)`,backgroundSize:`auto, auto, 54px 54px, 54px 54px`},children:[(0,w.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,gap:12},children:[(0,w.jsx)(`div`,{style:{width:40,height:40,borderRadius:11,background:`linear-gradient(150deg,#3b82f6,#1d4ed8)`,display:`flex`,alignItems:`center`,justifyContent:`center`,boxShadow:`0 6px 18px -4px rgba(37,99,235,0.6), inset 0 1px 0 rgba(255,255,255,0.4)`},children:(0,w.jsx)(D,{name:`cpu`,size:21,stroke:1.8,style:{color:`#fff`}})}),(0,w.jsxs)(`div`,{children:[(0,w.jsx)(`div`,{style:{fontSize:17,fontWeight:700,color:`#fff`,letterSpacing:`-0.01em`},children:`EDGE-X`}),(0,w.jsx)(`div`,{style:{fontSize:11.5,color:`rgba(226,232,240,0.5)`},children:`GPU开发桌面`})]})]}),(0,w.jsxs)(`div`,{style:{flex:1,display:`flex`,flexDirection:`column`,justifyContent:`center`,maxWidth:520},children:[(0,w.jsx)(iy,{online:f}),(0,w.jsx)(`h1`,{className:`login-mono`,style:{fontSize:38,fontWeight:700,color:`#fff`,margin:`20px 0 0`,letterSpacing:`-0.02em`,lineHeight:1.05,wordBreak:`break-all`},children:v}),y&&(0,w.jsx)(`div`,{style:{fontSize:15,color:`rgba(226,232,240,0.7)`,marginTop:10},children:y}),x&&(0,w.jsx)(`div`,{style:{fontSize:12.5,color:`rgba(226,232,240,0.45)`,marginTop:14,lineHeight:1.6},children:x}),(0,w.jsx)(ay,{about:m})]}),(0,w.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,gap:14,fontSize:11.5,color:`rgba(226,232,240,0.4)`,flexWrap:`wrap`},children:[m?.agentVersion&&(0,w.jsxs)(`span`,{className:`login-mono`,children:[`Edge Platform `,m.agentVersion]}),m?.agentVersion&&m?.osVersion&&(0,w.jsx)(`span`,{children:`·`}),m?.osVersion&&(0,w.jsx)(`span`,{children:m.osVersion}),(0,w.jsx)(`div`,{style:{flex:1,minWidth:8}}),(0,w.jsx)(`span`,{className:`login-mono login-tnum`,children:g})]})]}),(0,w.jsx)(`div`,{style:{flex:1,minWidth:0,display:`flex`,alignItems:`center`,justifyContent:`center`,padding:`32px 40px`,background:`#fff`},children:(0,w.jsx)(`div`,{style:{width:`100%`,maxWidth:360},children:c===`success`?(0,w.jsx)(sy,{username:n}):(0,w.jsxs)(w.Fragment,{children:[(0,w.jsx)(`div`,{style:{fontSize:23,fontWeight:700,color:ty.ink,letterSpacing:`-0.01em`},children:`欢迎回来`}),(0,w.jsx)(`div`,{style:{fontSize:13.5,color:ty.ink3,marginTop:7},children:`登录以进入本地控制台`}),(0,w.jsxs)(`form`,{onSubmit:_,style:{marginTop:26,display:`flex`,flexDirection:`column`,gap:12},children:[(0,w.jsxs)(`div`,{children:[(0,w.jsx)(`label`,{style:ny,children:`账号`}),(0,w.jsx)(oy,{icon:`user`,value:n,onChange:r,placeholder:`本地账号`,type:`text`,autoFocus:!0,autoComplete:`username`})]}),(0,w.jsxs)(`div`,{children:[(0,w.jsx)(`label`,{style:ny,children:`密码`}),(0,w.jsx)(oy,{icon:`lock`,type:o?`text`:`password`,value:i,onChange:a,placeholder:`登录密码`,autoComplete:`current-password`,trailing:(0,w.jsx)(`button`,{type:`button`,onClick:()=>s(e=>!e),style:{border:`none`,background:`transparent`,cursor:`pointer`,color:o?ty.blue:ty.ink4,padding:4,display:`flex`},"aria-label":o?`隐藏密码`:`显示密码`,children:(0,w.jsx)(D,{name:`eye`,size:16,stroke:1.8})})})]}),u&&(0,w.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,gap:6,color:ty.red,fontSize:12},children:[(0,w.jsx)(D,{name:`alertTri`,size:13,stroke:1.9}),u]}),(0,w.jsx)(`button`,{type:`submit`,disabled:c===`verifying`||!n||!i,style:{height:46,marginTop:6,borderRadius:10,border:`none`,cursor:c===`verifying`||!n||!i?`default`:`pointer`,background:c===`verifying`||!n||!i?`#cbd5e1`:`linear-gradient(150deg,#3b82f6,#1d4ed8)`,color:`#fff`,fontSize:14.5,fontWeight:600,display:`flex`,alignItems:`center`,justifyContent:`center`,gap:9,boxShadow:c===`verifying`||!n||!i?`none`:`0 8px 20px -8px rgba(37,99,235,0.6)`,transition:`background .15s, box-shadow .15s`},children:c===`verifying`?(0,w.jsxs)(w.Fragment,{children:[(0,w.jsx)(cy,{}),`验证中…`]}):(0,w.jsxs)(w.Fragment,{children:[`登录控制台`,(0,w.jsx)(D,{name:`chevRight`,size:17,stroke:2.2})]})})]}),(0,w.jsxs)(`div`,{style:{marginTop:26,paddingTop:16,borderTop:`1px solid ${ty.borderSoft}`,display:`flex`,alignItems:`center`,gap:7,fontSize:11,color:ty.ink3,lineHeight:1.5},children:[(0,w.jsx)(D,{name:`shield`,size:13,stroke:1.8,style:{color:ty.ink4,flexShrink:0}}),`登录受云端审计中心保护,所有访问将被记录。`]})]})})})]})}var ty={ink:`#0f172a`,ink2:`#334155`,ink3:`#64748b`,ink4:`#94a3b8`,border:`#e2e8f0`,borderSoft:`#eef1f5`,surfaceAlt:`#f8fafc`,blue:`#2563eb`,blueDeep:`#1d4ed8`,red:`#ef4444`,green:`#10b981`},ny={display:`block`,fontSize:11.5,fontWeight:600,color:ty.ink2,marginBottom:6},ry=` - .login-mono { font-family: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, monospace; font-feature-settings: "tnum"; } - .login-tnum { font-variant-numeric: tabular-nums; } - @keyframes login-spin { to { transform: rotate(360deg); } } - @media (max-width: 880px) { - .login-brand { display: none !important; } - } -`;function iy({online:e}){let t=e===null?{bg:`rgba(148,163,184,0.12)`,fg:`#cbd5e1`,border:`rgba(148,163,184,0.3)`,dot:`#94a3b8`}:e?{bg:`rgba(16,185,129,0.14)`,fg:`#6ee7b7`,border:`rgba(16,185,129,0.3)`,dot:`#34d399`}:{bg:`rgba(245,158,11,0.14)`,fg:`#fcd34d`,border:`rgba(245,158,11,0.32)`,dot:`#fbbf24`},n=e===null?`检测云端连接…`:e?`设备在线 · 已连接云端`:`云端离线 · 将使用本地缓存凭据`;return(0,w.jsxs)(`div`,{style:{display:`inline-flex`,alignItems:`center`,gap:6,alignSelf:`flex-start`,padding:`5px 10px`,borderRadius:999,background:t.bg,color:t.fg,border:`1px solid ${t.border}`,fontSize:11.5,fontWeight:600},children:[(0,w.jsx)(`span`,{style:{width:6,height:6,borderRadius:`50%`,background:t.dot,boxShadow:e?`0 0 6px ${t.dot}`:`none`}}),n]})}function ay({about:e}){let t=[];if(e?.computePower&&t.push({icon:`bolt`,label:`算力`,value:e.computePower}),e?.memoryTotal>0){let n=Math.round(e.memoryTotal/(1024*1024*1024)),r=e?.model?.includes(`统一内存`)?`统一内存`:`内存`;t.push({icon:`memory`,label:r,value:`${n} GB`})}return e?.uptimeHuman&&t.push({icon:`history`,label:`在线`,value:e.uptimeHuman}),t.length===0?null:(0,w.jsx)(`div`,{style:{display:`flex`,gap:10,marginTop:28,flexWrap:`wrap`},children:t.map((e,t)=>(0,w.jsxs)(`div`,{style:{flex:`1 1 140px`,minWidth:140,padding:`12px 14px`,borderRadius:11,background:`rgba(255,255,255,0.04)`,border:`1px solid rgba(255,255,255,0.08)`},children:[(0,w.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,gap:6,color:`rgba(226,232,240,0.55)`},children:[(0,w.jsx)(D,{name:e.icon,size:13,stroke:1.7}),(0,w.jsx)(`span`,{style:{fontSize:11},children:e.label})]}),(0,w.jsx)(`div`,{className:`login-mono login-tnum`,style:{fontSize:16,fontWeight:700,color:`#f1f5f9`,marginTop:6,letterSpacing:`-0.01em`},children:e.value})]},t))})}function oy({icon:e,type:t=`text`,value:n,onChange:r,placeholder:i,trailing:a,autoFocus:o,autoComplete:s}){let[c,l]=(0,b.useState)(!1);return(0,w.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,gap:10,height:46,padding:`0 12px`,borderRadius:10,background:c?`#ffffff`:ty.surfaceAlt,border:`1.5px solid ${c?ty.blue:ty.border}`,boxShadow:c?`0 0 0 3px rgba(37,99,235,0.12)`:`none`,transition:`border-color .15s, box-shadow .15s, background .15s`},children:[(0,w.jsx)(D,{name:e,size:17,stroke:1.8,style:{color:c?ty.blue:ty.ink4,flexShrink:0}}),(0,w.jsx)(`input`,{type:t,value:n,placeholder:i,autoFocus:o,autoComplete:s,onChange:e=>r(e.target.value),onFocus:()=>l(!0),onBlur:()=>l(!1),style:{flex:1,minWidth:0,border:`none`,outline:`none`,background:`transparent`,fontSize:14,color:ty.ink,letterSpacing:t===`password`?`0.18em`:0,fontFamily:`inherit`}}),a]})}function sy({username:e}){return(0,w.jsxs)(`div`,{style:{textAlign:`center`},children:[(0,w.jsx)(`div`,{style:{width:60,height:60,borderRadius:`50%`,margin:`0 auto 16px`,background:`#ecfdf5`,color:ty.green,display:`flex`,alignItems:`center`,justifyContent:`center`,boxShadow:`0 0 0 7px #d1fae5`},children:(0,w.jsx)(D,{name:`check`,size:30,stroke:2.4})}),(0,w.jsx)(`div`,{style:{fontSize:18,fontWeight:700,color:ty.ink},children:`登录成功`}),(0,w.jsxs)(`div`,{style:{fontSize:13,color:ty.ink3,marginTop:8,lineHeight:1.6},children:[`欢迎回来,`,(0,w.jsx)(`span`,{className:`login-mono`,style:{color:ty.ink2,fontWeight:600},children:e}),(0,w.jsx)(`br`,{}),`正在进入控制台…`]}),(0,w.jsx)(`div`,{style:{display:`flex`,alignItems:`center`,justifyContent:`center`,marginTop:18},children:(0,w.jsx)(cy,{color:ty.blue,size:20})})]})}function cy({color:e=`#fff`,size:t=16}){return(0,w.jsxs)(`svg`,{width:t,height:t,viewBox:`0 0 24 24`,style:{animation:`login-spin 0.9s linear infinite`},children:[(0,w.jsx)(`circle`,{cx:`12`,cy:`12`,r:`9`,stroke:e,strokeOpacity:`0.28`,strokeWidth:`2.6`,fill:`none`}),(0,w.jsx)(`path`,{d:`M12 3a9 9 0 0 1 9 9`,stroke:e,strokeWidth:`2.6`,strokeLinecap:`round`,fill:`none`})]})}function ly(){let[e,t]=(0,b.useState)(``);return(0,b.useEffect)(()=>{let e=e=>String(e).padStart(2,`0`),n=()=>{let n=new Date;t(`${n.getFullYear()}/${e(n.getMonth()+1)}/${e(n.getDate())} ${e(n.getHours())}:${e(n.getMinutes())}:${e(n.getSeconds())}`)};n();let r=setInterval(n,1e3);return()=>clearInterval(r)},[]),e}var uy={ok:{bg:`#f0fdf4`,border:`#bbf7d0`,text:`#166534`,dot:`#22c55e`},warn:{bg:`#fffbeb`,border:`#fde68a`,text:`#92400e`,dot:`#f59e0b`},err:{bg:`#fef2f2`,border:`#fecaca`,text:`#991b1b`,dot:`#ef4444`}};function dy({children:e}){let[t,n]=(0,b.useState)([]),r=(0,b.useRef)(new Map),i=(0,b.useRef)(0),a=(0,b.useRef)(!0),o=(0,b.useCallback)(e=>{if(!a.current)return;let t=r.current.get(e);t&&clearTimeout(t),r.current.delete(e),n(t=>t.filter(t=>t.id!==e))},[]),s=(0,b.useCallback)((e,t)=>{if(!a.current)return;let s=uy[e]?e:`ok`,c=`${Date.now()}-${i.current++}`;return n(e=>[...e,{id:c,kind:s,text:t}]),r.current.set(c,setTimeout(()=>o(c),3e3)),c},[o]);(0,b.useEffect)(()=>{let e=r.current;return a.current=!0,()=>{a.current=!1,e.forEach(e=>clearTimeout(e)),e.clear()}},[]);let c=(0,b.useMemo)(()=>({ok:e=>s(`ok`,e),warn:e=>s(`warn`,e),err:e=>s(`err`,e),dismiss:o}),[s,o]);return(0,w.jsxs)(xp.Provider,{value:c,children:[e,(0,w.jsx)(fy,{items:t})]})}function fy({items:e}){let t=Wu();return(0,w.jsx)(`div`,{style:{position:`fixed`,left:`50%`,bottom:28,zIndex:2e3,transform:`translateX(-50%)`,display:`flex`,flexDirection:`column`,alignItems:`center`,gap:8,width:`min(440px, calc(100vw - 32px))`,pointerEvents:`none`},children:(0,w.jsx)(Mc,{mode:`popLayout`,children:e.map(e=>{let n=uy[e.kind];return(0,w.jsxs)(Hu.div,{layout:!0,initial:t.reduced?{opacity:0}:{opacity:0,y:16,scale:.95},animate:t.reduced?{opacity:1}:{opacity:1,y:0,scale:1},exit:t.reduced?{opacity:0}:{opacity:0,y:16,scale:.95},transition:t.reduced?t.fadeTransition:Uu.default,className:`edge-material-surface`,role:`status`,style:{width:`100%`,border:`1px solid ${n.border}`,borderRadius:8,boxShadow:`0 12px 28px -12px rgba(15,23,42,0.28), 0 1px 0 rgba(255,255,255,0.72) inset`,color:n.text,padding:`10px 14px`,fontSize:12.5,fontWeight:600,display:`flex`,alignItems:`center`,gap:9},children:[(0,w.jsx)(`span`,{style:{width:8,height:8,borderRadius:`50%`,background:n.dot,flexShrink:0,boxShadow:`0 0 0 3px ${n.bg}`}}),(0,w.jsx)(`span`,{style:{flex:1,minWidth:0,overflowWrap:`anywhere`,lineHeight:1.4},children:e.text})]},e.id)})})})}var py=` - .twk-panel{position:fixed;right:16px;bottom:16px;z-index:2147483646;width:280px; - max-height:calc(100vh - 32px);display:flex;flex-direction:column; - transform:scale(var(--dc-inv-zoom,1));transform-origin:bottom right; - background:rgba(250,249,247,.78);color:#29261b; - -webkit-backdrop-filter:blur(24px) saturate(160%);backdrop-filter:blur(24px) saturate(160%); - border:.5px solid rgba(255,255,255,.6);border-radius:14px; - box-shadow:0 1px 0 rgba(255,255,255,.5) inset,0 12px 40px rgba(0,0,0,.18); - font:11.5px/1.4 ui-sans-serif,system-ui,-apple-system,sans-serif;overflow:hidden} - .twk-hd{display:flex;align-items:center;justify-content:space-between; - padding:10px 8px 10px 14px;cursor:move;user-select:none} - .twk-hd b{font-size:12px;font-weight:600;letter-spacing:.01em} - .twk-x{appearance:none;border:0;background:transparent;color:rgba(41,38,27,.55); - width:22px;height:22px;border-radius:6px;cursor:default;font-size:13px;line-height:1} - .twk-x:hover{background:rgba(0,0,0,.06);color:#29261b} - .twk-body{padding:2px 14px 14px;display:flex;flex-direction:column;gap:10px; - overflow-y:auto;overflow-x:hidden;min-height:0; - scrollbar-width:thin;scrollbar-color:rgba(0,0,0,.15) transparent} - .twk-body::-webkit-scrollbar{width:8px} - .twk-body::-webkit-scrollbar-track{background:transparent;margin:2px} - .twk-body::-webkit-scrollbar-thumb{background:rgba(0,0,0,.15);border-radius:4px; - border:2px solid transparent;background-clip:content-box} - .twk-body::-webkit-scrollbar-thumb:hover{background:rgba(0,0,0,.25); - border:2px solid transparent;background-clip:content-box} - .twk-row{display:flex;flex-direction:column;gap:5px} - .twk-row-h{flex-direction:row;align-items:center;justify-content:space-between;gap:10px} - .twk-lbl{display:flex;justify-content:space-between;align-items:baseline; - color:rgba(41,38,27,.72)} - .twk-lbl>span:first-child{font-weight:500} - .twk-val{color:rgba(41,38,27,.5);font-variant-numeric:tabular-nums} - - .twk-sect{font-size:10px;font-weight:600;letter-spacing:.06em;text-transform:uppercase; - color:rgba(41,38,27,.45);padding:10px 0 0} - .twk-sect:first-child{padding-top:0} - - .twk-field{appearance:none;box-sizing:border-box;width:100%;min-width:0;height:26px;padding:0 8px; - border:.5px solid rgba(0,0,0,.1);border-radius:7px; - background:rgba(255,255,255,.6);color:inherit;font:inherit;outline:none} - .twk-field:focus{border-color:rgba(0,0,0,.25);background:rgba(255,255,255,.85)} - select.twk-field{padding-right:22px; - background-image:url("data:image/svg+xml;utf8,"); - background-repeat:no-repeat;background-position:right 8px center} - - .twk-slider{appearance:none;-webkit-appearance:none;width:100%;height:4px;margin:6px 0; - border-radius:999px;background:rgba(0,0,0,.12);outline:none} - .twk-slider::-webkit-slider-thumb{-webkit-appearance:none;appearance:none; - width:14px;height:14px;border-radius:50%;background:#fff; - border:.5px solid rgba(0,0,0,.12);box-shadow:0 1px 3px rgba(0,0,0,.2);cursor:default} - .twk-slider::-moz-range-thumb{width:14px;height:14px;border-radius:50%; - background:#fff;border:.5px solid rgba(0,0,0,.12);box-shadow:0 1px 3px rgba(0,0,0,.2);cursor:default} - - .twk-seg{position:relative;display:flex;padding:2px;border-radius:8px; - background:rgba(0,0,0,.06);user-select:none} - .twk-seg-thumb{position:absolute;top:2px;bottom:2px;border-radius:6px; - background:rgba(255,255,255,.9);box-shadow:0 1px 2px rgba(0,0,0,.12); - transition:left .18s cubic-bezier(.2,1.4,.25,1),width .18s cubic-bezier(.2,1.4,.25,1)} - .twk-seg.dragging .twk-seg-thumb{transition:none} - .twk-seg button{appearance:none;position:relative;z-index:1;flex:1;border:0; - background:transparent;color:inherit;font:inherit;font-weight:500;min-height:22px; - border-radius:6px;cursor:default;padding:4px 6px;line-height:1.2; - overflow-wrap:anywhere} - - .twk-toggle{position:relative;width:32px;height:18px;border:0;border-radius:999px; - background:rgba(0,0,0,.15);transition:background .18s cubic-bezier(.2,1.4,.25,1);cursor:default;padding:0} - .twk-toggle[data-on="1"]{background:#34c759} - .twk-toggle i{position:absolute;top:2px;left:2px;width:14px;height:14px;border-radius:50%; - background:#fff;box-shadow:0 1px 2px rgba(0,0,0,.25);transition:transform .18s cubic-bezier(.2,1.4,.25,1)} - .twk-toggle[data-on="1"] i{transform:translateX(14px)} - - .twk-num{display:flex;align-items:center;box-sizing:border-box;min-width:0;height:26px;padding:0 0 0 8px; - border:.5px solid rgba(0,0,0,.1);border-radius:7px;background:rgba(255,255,255,.6)} - .twk-num-lbl{font-weight:500;color:rgba(41,38,27,.6);cursor:ew-resize; - user-select:none;padding-right:8px} - .twk-num input{flex:1;min-width:0;height:100%;border:0;background:transparent; - font:inherit;font-variant-numeric:tabular-nums;text-align:right;padding:0 8px 0 0; - outline:none;color:inherit;-moz-appearance:textfield} - .twk-num input::-webkit-inner-spin-button,.twk-num input::-webkit-outer-spin-button{ - -webkit-appearance:none;margin:0} - .twk-num-unit{padding-right:8px;color:rgba(41,38,27,.45)} - - .twk-btn{appearance:none;height:26px;padding:0 12px;border:0;border-radius:7px; - background:rgba(0,0,0,.78);color:#fff;font:inherit;font-weight:500;cursor:default} - .twk-btn:hover{background:rgba(0,0,0,.88)} - .twk-btn.secondary{background:rgba(0,0,0,.06);color:inherit} - .twk-btn.secondary:hover{background:rgba(0,0,0,.1)} - - .twk-swatch{appearance:none;-webkit-appearance:none;width:56px;height:22px; - border:.5px solid rgba(0,0,0,.1);border-radius:6px;padding:0;cursor:default; - background:transparent;flex-shrink:0} - .twk-swatch::-webkit-color-swatch-wrapper{padding:0} - .twk-swatch::-webkit-color-swatch{border:0;border-radius:5.5px} - .twk-swatch::-moz-color-swatch{border:0;border-radius:5.5px} - - .twk-chips{display:flex;gap:6px} - .twk-chip{position:relative;appearance:none;flex:1;min-width:0;height:46px; - padding:0;border:0;border-radius:6px;overflow:hidden;cursor:default; - box-shadow:0 0 0 .5px rgba(0,0,0,.12),0 1px 2px rgba(0,0,0,.06); - transition:transform .12s cubic-bezier(.3,.7,.4,1),box-shadow .12s} - .twk-chip:hover{transform:translateY(-1px); - box-shadow:0 0 0 .5px rgba(0,0,0,.18),0 4px 10px rgba(0,0,0,.12)} - .twk-chip[data-on="1"]{box-shadow:0 0 0 1.5px rgba(0,0,0,.85), - 0 2px 6px rgba(0,0,0,.15)} - .twk-chip>span{position:absolute;top:0;bottom:0;right:0;width:34%; - display:flex;flex-direction:column;box-shadow:-1px 0 0 rgba(0,0,0,.1)} - .twk-chip>span>i{flex:1;box-shadow:0 -1px 0 rgba(0,0,0,.1)} - .twk-chip>span>i:first-child{box-shadow:none} - .twk-chip svg{position:absolute;top:6px;left:6px;width:13px;height:13px; - filter:drop-shadow(0 1px 1px rgba(0,0,0,.3))} -`,my=`edgex-user-prefs`;function hy(e){try{let t=localStorage.getItem(my);if(!t)return e;let n=JSON.parse(t);return{...e,...n}}catch{return e}}function gy(e){try{localStorage.setItem(my,JSON.stringify(e))}catch{}}function _y(e){let[t,n]=(0,b.useState)(()=>hy(e));return[t,(0,b.useCallback)((e,t)=>{let r=typeof e==`object`&&e?e:{[e]:t};n(e=>{let t={...e,...r};return gy(t),t}),window.parent.postMessage({type:`__edit_mode_set_keys`,edits:r},`*`),window.dispatchEvent(new CustomEvent(`tweakchange`,{detail:r}))},[])]}function vy({title:e=`Tweaks`,children:t}){let[n,r]=(0,b.useState)(!1),i=(0,b.useRef)(null),a=(0,b.useRef)({x:16,y:16}),o=(0,b.useCallback)(()=>{let e=i.current;if(!e)return;let t=e.offsetWidth,n=e.offsetHeight,r=Math.max(16,window.innerWidth-t-16),o=Math.max(16,window.innerHeight-n-16);a.current={x:Math.min(r,Math.max(16,a.current.x)),y:Math.min(o,Math.max(16,a.current.y))},e.style.right=a.current.x+`px`,e.style.bottom=a.current.y+`px`},[]);return(0,b.useEffect)(()=>{if(!n)return;if(o(),typeof ResizeObserver>`u`)return window.addEventListener(`resize`,o),()=>window.removeEventListener(`resize`,o);let e=new ResizeObserver(o);return e.observe(document.documentElement),()=>e.disconnect()},[n,o]),(0,b.useEffect)(()=>{let e=e=>{let t=e?.data?.type;t===`__activate_edit_mode`?r(!0):t===`__deactivate_edit_mode`&&r(!1)};return window.addEventListener(`message`,e),window.parent.postMessage({type:`__edit_mode_available`},`*`),()=>window.removeEventListener(`message`,e)},[]),n?(0,w.jsxs)(w.Fragment,{children:[(0,w.jsx)(`style`,{children:py}),(0,w.jsxs)(`div`,{ref:i,className:`twk-panel`,"data-omelette-chrome":``,style:{right:a.current.x,bottom:a.current.y},children:[(0,w.jsxs)(`div`,{className:`twk-hd`,onMouseDown:e=>{let t=i.current;if(!t)return;let n=t.getBoundingClientRect(),r=e.clientX,s=e.clientY,c=window.innerWidth-n.right,l=window.innerHeight-n.bottom,u=e=>{a.current={x:c-(e.clientX-r),y:l-(e.clientY-s)},o()},d=()=>{window.removeEventListener(`mousemove`,u),window.removeEventListener(`mouseup`,d)};window.addEventListener(`mousemove`,u),window.addEventListener(`mouseup`,d)},children:[(0,w.jsx)(`b`,{children:e}),(0,w.jsx)(`button`,{className:`twk-x`,"aria-label":`Close tweaks`,onMouseDown:e=>e.stopPropagation(),onClick:()=>{r(!1),window.parent.postMessage({type:`__edit_mode_dismissed`},`*`)},children:`✕`})]}),(0,w.jsx)(`div`,{className:`twk-body`,children:t})]})]}):null}function yy({label:e,children:t}){return(0,w.jsxs)(w.Fragment,{children:[(0,w.jsx)(`div`,{className:`twk-sect`,children:e}),t]})}function by({label:e,value:t,children:n,inline:r=!1}){return(0,w.jsxs)(`div`,{className:r?`twk-row twk-row-h`:`twk-row`,children:[(0,w.jsxs)(`div`,{className:`twk-lbl`,children:[(0,w.jsx)(`span`,{children:e}),t!=null&&(0,w.jsx)(`span`,{className:`twk-val`,children:t})]}),n]})}function xy({label:e,value:t,onChange:n}){return(0,w.jsxs)(`div`,{className:`twk-row twk-row-h`,children:[(0,w.jsx)(`div`,{className:`twk-lbl`,children:(0,w.jsx)(`span`,{children:e})}),(0,w.jsx)(`button`,{type:`button`,className:`twk-toggle`,"data-on":t?`1`:`0`,role:`switch`,"aria-checked":!!t,onClick:()=>n(!t),children:(0,w.jsx)(`i`,{})})]})}function Sy({label:e,value:t,options:n,onChange:r}){return(0,w.jsx)(by,{label:e,children:(0,w.jsx)(`select`,{className:`twk-field`,value:t,onChange:e=>r(e.target.value),children:n.map(e=>{let t=typeof e==`object`?e.value:e;return(0,w.jsx)(`option`,{value:t,children:typeof e==`object`?e.label:e},t)})})})}function Cy({label:e,value:t,options:n,onChange:r}){let i=(0,b.useRef)(null),[a,o]=(0,b.useState)(!1),s=(0,b.useRef)(t);s.current=t;let c=e=>String(typeof e==`object`?e.label:e).length;if(!(n.reduce((e,t)=>Math.max(e,c(t)),0)<=({2:16,3:10}[n.length]??0))){let i=e=>{let t=n.find(t=>String(typeof t==`object`?t.value:t)===e);return t===void 0?e:typeof t==`object`?t.value:t};return(0,w.jsx)(Sy,{label:e,value:t,options:n,onChange:e=>r(i(e))})}let l=n.map(e=>typeof e==`object`?e:{value:e,label:e}),u=Math.max(0,l.findIndex(e=>e.value===t)),d=l.length,f=e=>{let t=i.current.getBoundingClientRect(),n=t.width-4,r=Math.floor((e-t.left-2)/n*d);return l[Math.max(0,Math.min(d-1,r))].value};return(0,w.jsx)(by,{label:e,children:(0,w.jsxs)(`div`,{ref:i,role:`radiogroup`,onPointerDown:e=>{o(!0);let t=f(e.clientX);t!==s.current&&r(t);let n=e=>{if(!i.current)return;let t=f(e.clientX);t!==s.current&&r(t)},a=()=>{o(!1),window.removeEventListener(`pointermove`,n),window.removeEventListener(`pointerup`,a)};window.addEventListener(`pointermove`,n),window.addEventListener(`pointerup`,a)},className:a?`twk-seg dragging`:`twk-seg`,children:[(0,w.jsx)(`div`,{className:`twk-seg-thumb`,style:{left:`calc(2px + ${u} * (100% - 4px) / ${d})`,width:`calc((100% - 4px) / ${d})`}}),l.map(e=>(0,w.jsx)(`button`,{type:`button`,role:`radio`,"aria-checked":e.value===t,children:e.label},e.value))]})})}function wy(e){let t=String(e).replace(`#`,``),n=t.length===3?t.replace(/./g,e=>e+e):t.padEnd(6,`0`),r=parseInt(n.slice(0,6),16);if(Number.isNaN(r))return!0;let i=r>>16&255,a=r>>8&255,o=r&255;return i*299+a*587+o*114>148e3}var Ty=({light:e})=>(0,w.jsx)(`svg`,{viewBox:`0 0 14 14`,"aria-hidden":`true`,children:(0,w.jsx)(`path`,{d:`M3 7.2 5.8 10 11 4.2`,fill:`none`,strokeWidth:`2.2`,strokeLinecap:`round`,strokeLinejoin:`round`,stroke:e?`rgba(0,0,0,.78)`:`#fff`})});function Ey({label:e,value:t,options:n,onChange:r}){if(!n||!n.length)return(0,w.jsxs)(`div`,{className:`twk-row twk-row-h`,children:[(0,w.jsx)(`div`,{className:`twk-lbl`,children:(0,w.jsx)(`span`,{children:e})}),(0,w.jsx)(`input`,{type:`color`,className:`twk-swatch`,value:t,onChange:e=>r(e.target.value)})]});let i=e=>String(JSON.stringify(e)).toLowerCase(),a=i(t);return(0,w.jsx)(by,{label:e,children:(0,w.jsx)(`div`,{className:`twk-chips`,role:`radiogroup`,children:n.map((e,t)=>{let n=Array.isArray(e)?e:[e],[o,...s]=n,c=s.slice(0,4),l=i(e)===a;return(0,w.jsxs)(`button`,{type:`button`,className:`twk-chip`,role:`radio`,"aria-checked":l,"data-on":l?`1`:`0`,"aria-label":n.join(`, `),title:n.join(` · `),style:{background:o},onClick:()=>r(e),children:[c.length>0&&(0,w.jsx)(`span`,{children:c.map((e,t)=>(0,w.jsx)(`i`,{style:{background:e}},t))}),l&&(0,w.jsx)(Ty,{light:wy(o)})]},t)})})})}function Dy({text:e}){let t=(0,b.useRef)(null),n=(0,b.useCallback)(()=>{let n=t.current;if(!n)return;let r=new Date,i=`${e} ${`${String(r.getHours()).padStart(2,`0`)}:${String(r.getMinutes()).padStart(2,`0`)}`}`,a=document.createElement(`canvas`),o=window.devicePixelRatio||1;a.width=280*o,a.height=160*o;let s=a.getContext(`2d`);s.scale(o,o),s.rotate(-22*Math.PI/180),s.font=`13px -apple-system, BlinkMacSystemFont, sans-serif`,s.fillStyle=`rgba(0,0,0,0.06)`,s.fillText(i,20,120),n.style.backgroundImage=`url(${a.toDataURL()})`,n.style.backgroundSize=`280px 160px`},[e]);return(0,b.useEffect)(()=>{n();let e=setInterval(n,6e4);return()=>clearInterval(e)},[n]),(0,w.jsx)(`div`,{ref:t,style:{position:`fixed`,inset:0,zIndex:9999,pointerEvents:`none`}})}var Oy={preset:`platform-dark`,wallpaper:`grid`,iconStyle:`gradient`,topbar:`dark`,accent:`#2563eb`,layout:`workstation`,iconSize:`md`,showRecent:!0,online:!0},ky={"platform-dark":{label:`云端同款`,desc:`深色顶栏 · 与管理平台一致`,set:{topbar:`dark`,iconStyle:`gradient`,accent:`#2563eb`,wallpaper:`grid`}},"aurora-light":{label:`极光浅色`,desc:`浅色玻璃顶栏 · 渐变图标`,set:{topbar:`light`,iconStyle:`gradient`,accent:`#2563eb`,wallpaper:`grid`}},"field-cyan":{label:`现场青绿`,desc:`工业青色调 · 拓扑背景`,set:{topbar:`dark`,iconStyle:`gradient`,accent:`#06b6d4`,wallpaper:`topo`}},"minimal-flat":{label:`极简扁平`,desc:`扁平图标 · 灰底无渐变`,set:{topbar:`light`,iconStyle:`flat`,accent:`#0f172a`,wallpaper:`plain`}},sunrise:{label:`晨曦渐变`,desc:`暖色调 · 紫橙光晕`,set:{topbar:`light`,iconStyle:`gradient`,accent:`#8b5cf6`,wallpaper:`topo`}},"mono-dev":{label:`研发暗调`,desc:`深色顶栏 + 灰底 + 扁平`,set:{topbar:`dark`,iconStyle:`flat`,accent:`#10b981`,wallpaper:`plain`}}};function Ay(e,t,n){return Math.max(t,Math.min(n,e))}var jy=420,My=300,Ny=44,Py=28,Fy=6;function Iy(e,t,n){let r=Math.min(1280,Math.round(t*.72)),i=Math.min(820,Math.round(n*.74)),a=e%Fy;return{x:Ay(60+a*Py,0,Math.max(0,t-r)),y:Ay(40+a*Py,0,Math.max(0,n-i-Ny)),w:r,h:i}}function Ly(e,t){return{x:0,y:0,w:e,h:t}}function Ry(e,t,n){let r=Ay(e.w,jy,Math.max(jy,t)),i=Ay(e.h,My,Math.max(My,n)),a=-(r-80),o=t-80;return{x:Ay(e.x,Math.min(a,o),Math.max(a,o)),y:Ay(e.y,0,Math.max(0,n-Ny)),w:r,h:i}}function zy(){let[e,t]=(0,b.useState)(()=>!!kd()),[n,r]=(0,b.useState)(``),i=(e,n)=>{Od(e),r(n),t(!0)},a=()=>{Ad(),t(!1),r(``)};(0,b.useEffect)(()=>{Nd(()=>{t(!1),r(``)})},[]);let[o,s]=_y(Oy),c=e=>{let t=ky[e];t&&s({preset:e,...t.set})},l=(0,b.useMemo)(()=>({topbar:o.topbar,iconStyle:o.iconStyle,accent:o.accent,wallpaper:o.wallpaper}),[o.topbar,o.iconStyle,o.accent,o.wallpaper]),[u,d]=(0,b.useState)([]),[f,p]=(0,b.useState)(null),[m,h]=(0,b.useState)(()=>new Set),[g,_]=(0,b.useState)({}),v=(0,b.useRef)(new Map),y=(0,b.useCallback)((e,t)=>{e&&(t?v.current.set(e,t):v.current.delete(e))},[]),x=(0,b.useCallback)(e=>v.current.get(e)?.getBoundingClientRect(),[]),[C,T]=(0,b.useState)({}),[E,O]=(0,b.useState)({}),k=(0,b.useRef)(10),[A,j]=(0,b.useState)(null),ee=(0,b.useRef)(null),[M,N]=(0,b.useState)(()=>({vw:window.innerWidth,vh:window.innerHeight}));(0,b.useEffect)(()=>{let e=()=>{let e=ee.current?.getBoundingClientRect?.();e&&e.width>0&&N({vw:e.width,vh:e.height})};return e(),window.addEventListener(`resize`,e),()=>window.removeEventListener(`resize`,e)},[]);let P=(0,b.useCallback)(e=>{e&&(p(e),k.current+=1,O(t=>({...t,[e]:k.current})))},[]),F=(0,b.useCallback)((e,t)=>{T(n=>{let r=n[e];return r?{...n,[e]:Ry({...r,...t},M.vw,M.vh)}:n})},[M.vw,M.vh]),I=f?g[f]??!0:!0,[te,ne]=(0,b.useState)(!1),[L,re]=(0,b.useState)(!1),[R,z]=(0,b.useState)(null),[B,ie]=(0,b.useState)(null),[ae,oe]=(0,b.useState)(()=>new Set),se=e=>{!e||!e.id||(d(t=>t.includes(e.id)?t:[...t,e.id]),h(t=>{if(!t.has(e.id))return t;let n=new Set(t);return n.delete(e.id),n}),_(t=>e.id in t?t:{...t,[e.id]:!0}),T(t=>e.id in t?t:{...t,[e.id]:Iy(u.length,M.vw,M.vh)}),P(e.id),ne(!1))},ce=e=>{if(u.includes(e)){if(f===e){h(t=>{let n=new Set(t);return n.add(e),n}),p(null),ne(!1);return}h(t=>{if(!t.has(e))return t;let n=new Set(t);return n.delete(e),n}),P(e),ne(!1)}},le=e=>{h(t=>{let n=new Set(t);return n.add(e),n}),f===e&&(p(null),ne(!1))},ue=e=>{d(t=>t.filter(t=>t!==e)),h(t=>{let n=new Set(t);return n.delete(e),n}),_(t=>{if(!(e in t))return t;let n={...t};return delete n[e],n}),T(t=>{if(!(e in t))return t;let n={...t};return delete n[e],n}),O(t=>{if(!(e in t))return t;let n={...t};return delete n[e],n}),f===e&&(p(null),ne(!1))},de=()=>{f&&h(e=>{let t=new Set(e);return t.add(f),t}),p(null),ne(!1)},fe=Rd(),{data:pe}=zd(),{data:me}=Bd(),{data:he}=Hd(),{data:ge}=Ld(),_e=(0,b.useMemo)(()=>me?Object.fromEntries(me.map(e=>[e.id,e])):{},[me]),ve=(0,b.useMemo)(()=>({...Object.fromEntries(Ip.map(e=>[e.id,e])),..._e||{}}),[_e]),ye=fe?.data?.metrics,[be,xe]=(0,b.useState)(0),[Se,Ce]=(0,b.useState)(0),[we,Te]=(0,b.useState)(0);(0,b.useEffect)(()=>{ye&&(xe(ye.cpu?.used||0),Ce(ye.gpu?.used||0),Te(ye.mem?.pct||0))},[ye]);let Ee=e=>{re(!0)},De=ge||{};if(!e)return(0,w.jsx)(dy,{children:(0,w.jsx)(ey,{onLogin:i,deviceName:De.deviceName||De.hostname})});let Oe=Array.isArray(me)?me.filter(e=>e.kind===`app`):[],ke=[...Ip,...Oe],Ae=he||[],je=f?ve[f]:null,V=Ip,Me=Oe.filter(e=>!ae.has(e.id)),Ne=Array.isArray(Ae)?Ae.filter(e=>e.state===`active`).length:0,Pe=o.wallpaper===`grid`?`edge-bg`:``,Fe=o.wallpaper===`topo`?{background:`#eef3fa`,backgroundImage:`radial-gradient(circle at 20% 20%, rgba(59,130,246,0.15), transparent 40%), radial-gradient(circle at 80% 70%, rgba(20,184,166,0.12), transparent 45%), radial-gradient(circle at 50% 100%, rgba(99,102,241,0.10), transparent 50%)`}:o.wallpaper===`plain`?{background:`#f1f5f9`}:{},Ie=u.map(e=>ve[e]).filter(Boolean).map(e=>({...e,isActive:f===e.id,isMinimized:m.has(e.id)})),Le=!!je&&!m.has(je.id);return(0,w.jsx)(dy,{children:(0,w.jsxs)(`div`,{style:{width:`100vw`,height:`100vh`,overflow:`hidden`,position:`relative`,display:`flex`,flexDirection:`column`},className:Pe,children:[(0,w.jsx)(`div`,{style:{position:`absolute`,inset:0,...Fe,zIndex:0},className:Pe}),(0,w.jsx)(Dy,{text:De.deviceName||De.hostname||``}),(0,w.jsx)(`div`,{style:{position:`relative`,zIndex:30},children:(0,w.jsx)(Zu,{theme:l.topbar,deviceLabel:De.deviceName||De.hostname||o.deviceLabel,DEVICE:De,cpu:Math.round(be),gpu:Math.round(Se),mem:Math.round(we),alertCount:Ne,online:o.online,lastSync:`5 分钟前`,onOpenAlerts:()=>se({id:`alerts`}),loginUser:n,onLogout:a})}),(0,w.jsxs)(`div`,{ref:ee,style:{position:`relative`,flex:1,overflow:`hidden`},children:[(0,w.jsx)(`div`,{style:{position:`absolute`,inset:0,display:`flex`,flexDirection:`column`},children:(0,w.jsx)(fd,{onOpenApp:e=>{if(e.locked){Ee(`打开「${e.name}」`);return}se(e)},sysApps:V,deployedApps:Me,APPS:ke,RECENT_IDS:[],DEVICE:De,showRecent:o.showRecent,iconStyle:l.iconStyle,accent:l.accent,layout:o.layout,iconSize:o.iconSize})}),(0,w.jsx)(Mc,{children:u.map(e=>{let t=ve[e];if(!t)return null;let n=!m.has(e),r=g[e]??!0,i=(r?Ly(M.vw,M.vh):C[e])||Iy(0,M.vw,M.vh);return(0,w.jsxs)(Td,{app:t,active:f===e,visible:n,minimized:m.has(e),maximized:r,geo:i,zIndex:E[e]??10,interacting:A===e,stageSize:M,getDockIconRect:x,onMaximize:()=>{P(e),_(t=>({...t,[e]:!(t[e]??!0)}))},onMinimize:()=>le(e),onClose:()=>ue(e),onBringToFront:()=>P(e),onChangeGeo:t=>F(e,t),onInteractStart:()=>j(e),onInteractEnd:()=>j(null),canManage:t.kind===`app`,mgmtOpen:f===e&&te,onToggleMgmt:()=>ne(e=>!e),children:[e===`dashboard`&&(0,w.jsx)(Jf,{onOpenApp:se}),e===`store`&&(0,w.jsx)(Mp,{onOpenApp:se,authed:L,onRequireAuth:Ee}),e===`compose-manager`&&(0,w.jsx)(Lp,{authed:L,onRequireAuth:Ee,onOpenStore:()=>se({id:`store`}),onOpenApp:se}),e===`alerts`&&(0,w.jsx)(ym,{authed:L,onRequireAuth:Ee}),e===`audit`&&(0,w.jsx)(wm,{}),e===`supervisor`&&(0,w.jsx)(Hm,{}),e===`virtual-machines`&&(0,w.jsx)(ih,{}),e===`hardware`&&(0,w.jsx)(gh,{}),e===`links`&&(0,w.jsx)(Uh,{}),(e===`diag`||e===`settings`)&&(0,w.jsx)(Gh,{}),![`dashboard`,`store`,`compose-manager`,`alerts`,`audit`,`supervisor`,`virtual-machines`,`hardware`,`links`,`diag`,`settings`].includes(e)&&(0,w.jsx)(J_,{appId:e,app:t,authed:L,onRequireAuth:Ee,onOpenManagement:()=>ne(!0)}),t.kind===`app`&&(0,w.jsx)($v,{app:t,open:f===e&&te,onClose:()=>ne(!1),authed:L,onRequireAuth:Ee,onUninstall:e=>{oe(t=>new Set([...t,e.id])),ue(e.id)},metricsData:fe?.data,historyData:pe})]},e)})}),(0,w.jsx)(md,{apps:Ie,registerDockIconRect:y,onShowDesktop:de,onFocusApp:ce,onCloseApp:ue,anyVisible:Le,hidden:Le&&I,authed:L,alertBadge:Ne})]}),(0,w.jsxs)(vy,{title:`Tweaks`,children:[(0,w.jsx)(yy,{label:`主题预设`}),(0,w.jsx)(`div`,{style:{display:`flex`,flexDirection:`column`,gap:6,padding:`0 0 6px`},children:Object.entries(ky).map(([e,t])=>(0,w.jsxs)(`button`,{onClick:()=>c(e),style:{display:`flex`,alignItems:`center`,gap:10,padding:`8px 10px`,borderRadius:8,textAlign:`left`,background:o.preset===e?S.blueSoft:`white`,border:`1px solid ${o.preset===e?`#bfdbfe`:S.border}`,cursor:`pointer`},children:[(0,w.jsxs)(`div`,{style:{width:28,height:28,borderRadius:6,flexShrink:0,background:t.set.topbar===`dark`?`#0b1220`:`#f1f5f9`,border:`1px solid ${S.borderSoft}`,position:`relative`,overflow:`hidden`},children:[(0,w.jsx)(`div`,{style:{position:`absolute`,top:0,left:0,right:0,height:8,background:t.set.topbar===`dark`?`#0b1220`:`rgba(255,255,255,0.9)`,borderBottom:`1px solid ${t.set.topbar===`dark`?`rgba(255,255,255,0.1)`:`#e2e8f0`}`}}),(0,w.jsx)(`div`,{style:{position:`absolute`,left:5,top:12,width:6,height:6,borderRadius:t.set.iconStyle===`flat`?1.5:2,background:t.set.accent}}),(0,w.jsx)(`div`,{style:{position:`absolute`,left:14,top:12,width:6,height:6,borderRadius:t.set.iconStyle===`flat`?1.5:2,background:`#fb7185`}})]}),(0,w.jsxs)(`div`,{style:{minWidth:0,flex:1},children:[(0,w.jsx)(`div`,{style:{fontSize:12.5,fontWeight:600,color:o.preset===e?S.blueDeep:S.ink},children:t.label}),(0,w.jsx)(`div`,{style:{fontSize:10.5,color:S.ink3,marginTop:2},children:t.desc})]}),o.preset===e&&(0,w.jsx)(D,{name:`check`,size:13,stroke:2.4,style:{color:S.blueDeep,flexShrink:0}})]},e))}),(0,w.jsx)(yy,{label:`桌面布局`}),(0,w.jsx)(Cy,{label:`排列`,value:o.layout,options:[{value:`workstation`,label:`工作站`},{value:`launcher`,label:`启动器`},{value:`compact`,label:`紧凑`}],onChange:e=>s(`layout`,e)}),(0,w.jsx)(Cy,{label:`图标尺寸`,value:o.iconSize,options:[{value:`sm`,label:`小`},{value:`md`,label:`中`},{value:`lg`,label:`大`}],onChange:e=>s(`iconSize`,e)}),(0,w.jsx)(yy,{label:`单项覆盖`}),(0,w.jsx)(Cy,{label:`顶栏`,value:o.topbar,options:[{value:`dark`,label:`深色`},{value:`light`,label:`浅色`}],onChange:e=>s(`topbar`,e)}),(0,w.jsx)(Cy,{label:`图标`,value:o.iconStyle,options:[{value:`gradient`,label:`渐变`},{value:`flat`,label:`扁平`}],onChange:e=>s(`iconStyle`,e)}),(0,w.jsx)(Cy,{label:`背景`,value:o.wallpaper,options:[{value:`grid`,label:`网格`},{value:`topo`,label:`光晕`},{value:`plain`,label:`纯色`}],onChange:e=>s(`wallpaper`,e)}),(0,w.jsx)(Ey,{label:`主色`,value:o.accent,options:[`#2563eb`,`#06b6d4`,`#10b981`,`#8b5cf6`,`#0f172a`],onChange:e=>s(`accent`,e)}),(0,w.jsx)(xy,{label:`显示最近使用`,value:o.showRecent,onChange:e=>s(`showRecent`,e)}),(0,w.jsx)(yy,{label:`状态`}),(0,w.jsx)(xy,{label:`云端在线`,value:o.online,onChange:e=>s(`online`,e)}),(0,w.jsxs)(`button`,{onClick:a,style:{width:`100%`,height:32,borderRadius:7,marginTop:4,background:`white`,color:`#dc2626`,border:`1px solid #fecaca`,fontSize:12,fontWeight:600,cursor:`pointer`},children:[`退出登录 (`,n||`user`,`)`]}),(0,w.jsx)(yy,{label:`演示快捷`}),[[`dashboard`,`仪表盘`],[`ai-activity`,`AI 活动`],[`store`,`应用商店`],[`vscode`,`VS Code Server`],[`jupyter`,`JupyterLab`],[`vllm`,`vLLM (异常)`],[`comfyui`,`ComfyUI`],[`sdwebui`,`SD WebUI`],[`training`,`训练任务`],[`terminal`,`终端`],[`files`,`文件浏览器`],[`ports`,`端口与公网`],[`models`,`模型仓库`],[`alerts`,`告警中心`]].map(([e,t])=>(0,w.jsxs)(`button`,{onClick:()=>se({id:e}),style:{width:`100%`,height:30,borderRadius:6,marginBottom:4,background:f===e?S.blueSoft:u.includes(e)?`#f1f5f9`:`white`,color:f===e?S.blueDeep:S.ink2,border:`1px solid ${f===e?`#bfdbfe`:S.border}`,fontSize:12,fontWeight:500,textAlign:`left`,paddingLeft:10,cursor:`pointer`,display:`flex`,alignItems:`center`,gap:6},children:[u.includes(e)&&(0,w.jsx)(`span`,{style:{width:5,height:5,borderRadius:`50%`,background:f===e?S.blueDeep:S.ink3}}),t]},e)),u.length>0&&(0,w.jsxs)(`button`,{onClick:()=>{u.forEach(e=>ue(e))},style:{width:`100%`,height:30,borderRadius:6,marginTop:4,background:`white`,color:S.ink3,border:`1px solid ${S.border}`,fontSize:12,fontWeight:500,textAlign:`left`,paddingLeft:10,cursor:`pointer`},children:[`退出全部 (`,u.length,`) 个运行中应用`]})]})]})})}var By=class extends b.Component{constructor(e){super(e),this.state={error:null}}static getDerivedStateFromError(e){return{error:e}}render(){return this.state.error?b.createElement(`pre`,{style:{position:`fixed`,inset:0,background:`#2a1215`,color:`#ff8a80`,font:`13px monospace`,padding:20,overflow:`auto`,zIndex:99999,whiteSpace:`pre-wrap`}},`[React Error] - -`+this.state.error.message+` - -`+(this.state.error.stack||``)):this.props.children}};x.createRoot(document.getElementById(`root`)).render((0,w.jsx)(By,{children:(0,w.jsx)(zy,{})})); \ No newline at end of file diff --git a/pkg/console/dist/assets/index-Cj4g1dDX.js b/pkg/console/dist/assets/index-Cj4g1dDX.js new file mode 100644 index 0000000..26e2344 --- /dev/null +++ b/pkg/console/dist/assets/index-Cj4g1dDX.js @@ -0,0 +1,186 @@ +var e=Object.create,t=Object.defineProperty,n=Object.getOwnPropertyDescriptor,r=Object.getOwnPropertyNames,i=Object.getPrototypeOf,a=Object.prototype.hasOwnProperty,o=(e,t)=>()=>(e&&(t=e(e=0)),t),s=(e,t)=>()=>(t||(e((t={exports:{}}).exports,t),e=null),t.exports),c=(e,n)=>{let r={};for(var i in e)t(r,i,{get:e[i],enumerable:!0});return n||t(r,Symbol.toStringTag,{value:`Module`}),r},l=(e,i,o,s)=>{if(i&&typeof i==`object`||typeof i==`function`)for(var c=r(i),l=0,u=c.length,d;li[e]).bind(null,d),enumerable:!(s=n(i,d))||s.enumerable});return e},u=(n,r,a)=>(a=n==null?{}:e(i(n)),l(r||!n||!n.__esModule?t(a,`default`,{value:n,enumerable:!0}):a,n)),d=e=>a.call(e,`module.exports`)?e[`module.exports`]:l(t({},`__esModule`,{value:!0}),e);(function(){let e=document.createElement(`link`).relList;if(e&&e.supports&&e.supports(`modulepreload`))return;for(let e of document.querySelectorAll(`link[rel="modulepreload"]`))n(e);new MutationObserver(e=>{for(let t of e)if(t.type===`childList`)for(let e of t.addedNodes)e.tagName===`LINK`&&e.rel===`modulepreload`&&n(e)}).observe(document,{childList:!0,subtree:!0});function t(e){let t={};return e.integrity&&(t.integrity=e.integrity),e.referrerPolicy&&(t.referrerPolicy=e.referrerPolicy),e.crossOrigin===`use-credentials`?t.credentials=`include`:e.crossOrigin===`anonymous`?t.credentials=`omit`:t.credentials=`same-origin`,t}function n(e){if(e.ep)return;e.ep=!0;let n=t(e);fetch(e.href,n)}})();var f=s((e=>{var t=Symbol.for(`react.transitional.element`),n=Symbol.for(`react.portal`),r=Symbol.for(`react.fragment`),i=Symbol.for(`react.strict_mode`),a=Symbol.for(`react.profiler`),o=Symbol.for(`react.consumer`),s=Symbol.for(`react.context`),c=Symbol.for(`react.forward_ref`),l=Symbol.for(`react.suspense`),u=Symbol.for(`react.memo`),d=Symbol.for(`react.lazy`),f=Symbol.for(`react.activity`),p=Symbol.iterator;function m(e){return typeof e!=`object`||!e?null:(e=p&&e[p]||e[`@@iterator`],typeof e==`function`?e:null)}var h={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},g=Object.assign,_={};function v(e,t,n){this.props=e,this.context=t,this.refs=_,this.updater=n||h}v.prototype.isReactComponent={},v.prototype.setState=function(e,t){if(typeof e!=`object`&&typeof e!=`function`&&e!=null)throw Error(`takes an object of state variables to update or a function which returns an object of state variables.`);this.updater.enqueueSetState(this,e,t,`setState`)},v.prototype.forceUpdate=function(e){this.updater.enqueueForceUpdate(this,e,`forceUpdate`)};function y(){}y.prototype=v.prototype;function b(e,t,n){this.props=e,this.context=t,this.refs=_,this.updater=n||h}var x=b.prototype=new y;x.constructor=b,g(x,v.prototype),x.isPureReactComponent=!0;var S=Array.isArray;function C(){}var w={H:null,A:null,T:null,S:null},T=Object.prototype.hasOwnProperty;function E(e,n,r){var i=r.ref;return{$$typeof:t,type:e,key:n,ref:i===void 0?null:i,props:r}}function D(e,t){return E(e.type,t,e.props)}function O(e){return typeof e==`object`&&!!e&&e.$$typeof===t}function k(e){var t={"=":`=0`,":":`=2`};return`$`+e.replace(/[=:]/g,function(e){return t[e]})}var A=/\/+/g;function j(e,t){return typeof e==`object`&&e&&e.key!=null?k(``+e.key):t.toString(36)}function ee(e){switch(e.status){case`fulfilled`:return e.value;case`rejected`:throw e.reason;default:switch(typeof e.status==`string`?e.then(C,C):(e.status=`pending`,e.then(function(t){e.status===`pending`&&(e.status=`fulfilled`,e.value=t)},function(t){e.status===`pending`&&(e.status=`rejected`,e.reason=t)})),e.status){case`fulfilled`:return e.value;case`rejected`:throw e.reason}}throw e}function M(e,r,i,a,o){var s=typeof e;(s===`undefined`||s===`boolean`)&&(e=null);var c=!1;if(e===null)c=!0;else switch(s){case`bigint`:case`string`:case`number`:c=!0;break;case`object`:switch(e.$$typeof){case t:case n:c=!0;break;case d:return c=e._init,M(c(e._payload),r,i,a,o)}}if(c)return o=o(e),c=a===``?`.`+j(e,0):a,S(o)?(i=``,c!=null&&(i=c.replace(A,`$&/`)+`/`),M(o,r,i,``,function(e){return e})):o!=null&&(O(o)&&(o=D(o,i+(o.key==null||e&&e.key===o.key?``:(``+o.key).replace(A,`$&/`)+`/`)+c)),r.push(o)),1;c=0;var l=a===``?`.`:a+`:`;if(S(e))for(var u=0;u{t.exports=f()})),m=s((e=>{function t(e,t){var n=e.length;e.push(t);a:for(;0>>1,a=e[r];if(0>>1;ri(c,n))li(u,c)?(e[r]=u,e[l]=n,r=l):(e[r]=c,e[s]=n,r=s);else if(li(u,n))e[r]=u,e[l]=n,r=l;else break a}}return t}function i(e,t){var n=e.sortIndex-t.sortIndex;return n===0?e.id-t.id:n}if(e.unstable_now=void 0,typeof performance==`object`&&typeof performance.now==`function`){var a=performance;e.unstable_now=function(){return a.now()}}else{var o=Date,s=o.now();e.unstable_now=function(){return o.now()-s}}var c=[],l=[],u=1,d=null,f=3,p=!1,m=!1,h=!1,g=!1,_=typeof setTimeout==`function`?setTimeout:null,v=typeof clearTimeout==`function`?clearTimeout:null,y=typeof setImmediate<`u`?setImmediate:null;function b(e){for(var i=n(l);i!==null;){if(i.callback===null)r(l);else if(i.startTime<=e)r(l),i.sortIndex=i.expirationTime,t(c,i);else break;i=n(l)}}function x(e){if(h=!1,b(e),!m)if(n(c)!==null)m=!0,S||(S=!0,O());else{var t=n(l);t!==null&&j(x,t.startTime-e)}}var S=!1,C=-1,w=5,T=-1;function E(){return g?!0:!(e.unstable_now()-Tt&&E());){var o=d.callback;if(typeof o==`function`){d.callback=null,f=d.priorityLevel;var s=o(d.expirationTime<=t);if(t=e.unstable_now(),typeof s==`function`){d.callback=s,b(t),i=!0;break b}d===n(c)&&r(c),b(t)}else r(c);d=n(c)}if(d!==null)i=!0;else{var u=n(l);u!==null&&j(x,u.startTime-t),i=!1}}break a}finally{d=null,f=a,p=!1}i=void 0}}finally{i?O():S=!1}}}var O;if(typeof y==`function`)O=function(){y(D)};else if(typeof MessageChannel<`u`){var k=new MessageChannel,A=k.port2;k.port1.onmessage=D,O=function(){A.postMessage(null)}}else O=function(){_(D,0)};function j(t,n){C=_(function(){t(e.unstable_now())},n)}e.unstable_IdlePriority=5,e.unstable_ImmediatePriority=1,e.unstable_LowPriority=4,e.unstable_NormalPriority=3,e.unstable_Profiling=null,e.unstable_UserBlockingPriority=2,e.unstable_cancelCallback=function(e){e.callback=null},e.unstable_forceFrameRate=function(e){0>e||125o?(r.sortIndex=a,t(l,r),n(c)===null&&r===n(l)&&(h?(v(C),C=-1):h=!0,j(x,a-o))):(r.sortIndex=s,t(c,r),m||p||(m=!0,S||(S=!0,O()))),r},e.unstable_shouldYield=E,e.unstable_wrapCallback=function(e){var t=f;return function(){var n=f;f=t;try{return e.apply(this,arguments)}finally{f=n}}}})),h=s(((e,t)=>{t.exports=m()})),g=s((e=>{var t=p();function n(e){var t=`https://react.dev/errors/`+e;if(1{function n(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>`u`||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!=`function`))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(n)}catch(e){console.error(e)}}n(),t.exports=g()})),v=s((e=>{var t=h(),n=p(),r=_();function i(e){var t=`https://react.dev/errors/`+e;if(1re||(e.current=ne[re],ne[re]=null,re--)}function z(e,t){re++,ne[re]=e.current,e.current=t}var B=L(null),ie=L(null),ae=L(null),oe=L(null);function se(e,t){switch(z(ae,t),z(ie,e),z(B,null),t.nodeType){case 9:case 11:e=(e=t.documentElement)&&(e=e.namespaceURI)?Ud(e):0;break;default:if(e=t.tagName,t=t.namespaceURI)t=Ud(t),e=Wd(t,e);else switch(e){case`svg`:e=1;break;case`math`:e=2;break;default:e=0}}R(B),z(B,e)}function ce(){R(B),R(ie),R(ae)}function le(e){e.memoizedState!==null&&z(oe,e);var t=B.current,n=Wd(t,e.type);t!==n&&(z(ie,e),z(B,n))}function ue(e){ie.current===e&&(R(B),R(ie)),oe.current===e&&(R(oe),ep._currentValue=te)}var de,fe;function pe(e){if(de===void 0)try{throw Error()}catch(e){var t=e.stack.trim().match(/\n( *(at )?)/);de=t&&t[1]||``,fe=-1)`:-1i||c[r]!==l[i]){var u=` +`+c[r].replace(` at new `,` at `);return e.displayName&&u.includes(``)&&(u=u.replace(``,e.displayName)),u}while(1<=r&&0<=i);break}}}finally{me=!1,Error.prepareStackTrace=n}return(n=e?e.displayName||e.name:``)?pe(n):``}function ge(e,t){switch(e.tag){case 26:case 27:case 5:return pe(e.type);case 16:return pe(`Lazy`);case 13:return e.child!==t&&t!==null?pe(`Suspense Fallback`):pe(`Suspense`);case 19:return pe(`SuspenseList`);case 0:case 15:return he(e.type,!1);case 11:return he(e.type.render,!1);case 1:return he(e.type,!0);case 31:return pe(`Activity`);default:return``}}function _e(e){try{var t=``,n=null;do t+=ge(e,n),n=e,e=e.return;while(e);return t}catch(e){return` +Error generating stack: `+e.message+` +`+e.stack}}var ve=Object.prototype.hasOwnProperty,ye=t.unstable_scheduleCallback,be=t.unstable_cancelCallback,xe=t.unstable_shouldYield,Se=t.unstable_requestPaint,Ce=t.unstable_now,we=t.unstable_getCurrentPriorityLevel,Te=t.unstable_ImmediatePriority,Ee=t.unstable_UserBlockingPriority,De=t.unstable_NormalPriority,Oe=t.unstable_LowPriority,ke=t.unstable_IdlePriority,Ae=t.log,je=t.unstable_setDisableYieldValue,V=null,Me=null;function Ne(e){if(typeof Ae==`function`&&je(e),Me&&typeof Me.setStrictMode==`function`)try{Me.setStrictMode(V,e)}catch{}}var Pe=Math.clz32?Math.clz32:Le,Fe=Math.log,Ie=Math.LN2;function Le(e){return e>>>=0,e===0?32:31-(Fe(e)/Ie|0)|0}var Re=256,ze=262144,Be=4194304;function Ve(e){var t=e&42;if(t!==0)return t;switch(e&-e){case 1:return 1;case 2:return 2;case 4:return 4;case 8:return 8;case 16:return 16;case 32:return 32;case 64:return 64;case 128:return 128;case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:return e&261888;case 262144:case 524288:case 1048576:case 2097152:return e&3932160;case 4194304:case 8388608:case 16777216:case 33554432:return e&62914560;case 67108864:return 67108864;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 0;default:return e}}function He(e,t,n){var r=e.pendingLanes;if(r===0)return 0;var i=0,a=e.suspendedLanes,o=e.pingedLanes;e=e.warmLanes;var s=r&134217727;return s===0?(s=r&~a,s===0?o===0?n||(n=r&~e,n!==0&&(i=Ve(n))):i=Ve(o):i=Ve(s)):(r=s&~a,r===0?(o&=s,o===0?n||(n=s&~e,n!==0&&(i=Ve(n))):i=Ve(o)):i=Ve(r)),i===0?0:t!==0&&t!==i&&(t&a)===0&&(a=i&-i,n=t&-t,a>=n||a===32&&n&4194048)?t:i}function Ue(e,t){return(e.pendingLanes&~(e.suspendedLanes&~e.pingedLanes)&t)===0}function We(e,t){switch(e){case 1:case 2:case 4:case 8:case 64:return t+250;case 16:case 32:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return t+5e3;case 4194304:case 8388608:case 16777216:case 33554432:return-1;case 67108864:case 134217728:case 268435456:case 536870912:case 1073741824:return-1;default:return-1}}function Ge(){var e=Be;return Be<<=1,!(Be&62914560)&&(Be=4194304),e}function Ke(e){for(var t=[],n=0;31>n;n++)t.push(e);return t}function qe(e,t){e.pendingLanes|=t,t!==268435456&&(e.suspendedLanes=0,e.pingedLanes=0,e.warmLanes=0)}function Je(e,t,n,r,i,a){var o=e.pendingLanes;e.pendingLanes=n,e.suspendedLanes=0,e.pingedLanes=0,e.warmLanes=0,e.expiredLanes&=n,e.entangledLanes&=n,e.errorRecoveryDisabledLanes&=n,e.shellSuspendCounter=0;var s=e.entanglements,c=e.expirationTimes,l=e.hiddenUpdates;for(n=o&~n;0`u`||window.document===void 0||window.document.createElement===void 0),on=!1;if(an)try{var sn={};Object.defineProperty(sn,"passive",{get:function(){on=!0}}),window.addEventListener(`test`,sn,sn),window.removeEventListener(`test`,sn,sn)}catch{on=!1}var cn=null,ln=null,un=null;function dn(){if(un)return un;var e,t=ln,n=t.length,r,i=`value`in cn?cn.value:cn.textContent,a=i.length;for(e=0;e=Un),Kn=` `,qn=!1;function Jn(e,t){switch(e){case`keyup`:return Vn.indexOf(t.keyCode)!==-1;case`keydown`:return t.keyCode!==229;case`keypress`:case`mousedown`:case`focusout`:return!0;default:return!1}}function Yn(e){return e=e.detail,typeof e==`object`&&`data`in e?e.data:null}var Xn=!1;function Zn(e,t){switch(e){case`compositionend`:return Yn(t);case`keypress`:return t.which===32?(qn=!0,Kn):null;case`textInput`:return e=t.data,e===Kn&&qn?null:e;default:return null}}function Qn(e,t){if(Xn)return e===`compositionend`||!Hn&&Jn(e,t)?(e=dn(),un=ln=cn=null,Xn=!1,e):null;switch(e){case`paste`:return null;case`keypress`:if(!(t.ctrlKey||t.altKey||t.metaKey)||t.ctrlKey&&t.altKey){if(t.char&&1=t)return{node:n,offset:t-e};e=r}a:{for(;n;){if(n.nextSibling){n=n.nextSibling;break a}n=n.parentNode}n=void 0}n=br(n)}}function Sr(e,t){return e&&t?e===t?!0:e&&e.nodeType===3?!1:t&&t.nodeType===3?Sr(e,t.parentNode):`contains`in e?e.contains(t):e.compareDocumentPosition?!!(e.compareDocumentPosition(t)&16):!1:!1}function Cr(e){e=e!=null&&e.ownerDocument!=null&&e.ownerDocument.defaultView!=null?e.ownerDocument.defaultView:window;for(var t=Mt(e.document);t instanceof e.HTMLIFrameElement;){try{var n=typeof t.contentWindow.location.href==`string`}catch{n=!1}if(n)e=t.contentWindow;else break;t=Mt(e.document)}return t}function wr(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return t&&(t===`input`&&(e.type===`text`||e.type===`search`||e.type===`tel`||e.type===`url`||e.type===`password`)||t===`textarea`||e.contentEditable===`true`)}var Tr=an&&`documentMode`in document&&11>=document.documentMode,Er=null,Dr=null,Or=null,kr=!1;function Ar(e,t,n){var r=n.window===n?n.document:n.nodeType===9?n:n.ownerDocument;kr||Er==null||Er!==Mt(r)||(r=Er,`selectionStart`in r&&wr(r)?r={start:r.selectionStart,end:r.selectionEnd}:(r=(r.ownerDocument&&r.ownerDocument.defaultView||window).getSelection(),r={anchorNode:r.anchorNode,anchorOffset:r.anchorOffset,focusNode:r.focusNode,focusOffset:r.focusOffset}),Or&&yr(Or,r)||(Or=r,r=kd(Dr,`onSelect`),0>=o,i-=o,Si=1<<32-Pe(t)+i|n<h?(g=d,d=null):g=d.sibling;var _=p(i,d,s[h],c);if(_===null){d===null&&(d=g);break}e&&d&&_.alternate===null&&t(i,d),a=o(_,a,h),u===null?l=_:u.sibling=_,u=_,d=g}if(h===s.length)return n(i,d),U&&wi(i,h),l;if(d===null){for(;hg?(_=h,h=null):_=h.sibling;var y=p(a,h,v.value,l);if(y===null){h===null&&(h=_);break}e&&h&&y.alternate===null&&t(a,h),s=o(y,s,g),d===null?u=y:d.sibling=y,d=y,h=_}if(v.done)return n(a,h),U&&wi(a,g),u;if(h===null){for(;!v.done;g++,v=c.next())v=f(a,v.value,l),v!==null&&(s=o(v,s,g),d===null?u=v:d.sibling=v,d=v);return U&&wi(a,g),u}for(h=r(h);!v.done;g++,v=c.next())v=m(h,a,g,v.value,l),v!==null&&(e&&v.alternate!==null&&h.delete(v.key===null?g:v.key),s=o(v,s,g),d===null?u=v:d.sibling=v,d=v);return e&&h.forEach(function(e){return t(a,e)}),U&&wi(a,g),u}function b(e,r,o,c){if(typeof o==`object`&&o&&o.type===y&&o.key===null&&(o=o.props.children),typeof o==`object`&&o){switch(o.$$typeof){case g:a:{for(var l=o.key;r!==null;){if(r.key===l){if(l=o.type,l===y){if(r.tag===7){n(e,r.sibling),c=a(r,o.props.children),c.return=e,e=c;break a}}else if(r.elementType===l||typeof l==`object`&&l&&l.$$typeof===O&&wa(l)===r.type){n(e,r.sibling),c=a(r,o.props),ja(c,o),c.return=e,e=c;break a}n(e,r);break}else t(e,r);r=r.sibling}o.type===y?(c=li(o.props.children,e.mode,c,o.key),c.return=e,e=c):(c=ci(o.type,o.key,o.props,null,e.mode,c),ja(c,o),c.return=e,e=c)}return s(e);case v:a:{for(l=o.key;r!==null;){if(r.key===l)if(r.tag===4&&r.stateNode.containerInfo===o.containerInfo&&r.stateNode.implementation===o.implementation){n(e,r.sibling),c=a(r,o.children||[]),c.return=e,e=c;break a}else{n(e,r);break}else t(e,r);r=r.sibling}c=fi(o,e.mode,c),c.return=e,e=c}return s(e);case O:return o=wa(o),b(e,r,o,c)}if(P(o))return h(e,r,o,c);if(ee(o)){if(l=ee(o),typeof l!=`function`)throw Error(i(150));return o=l.call(o),_(e,r,o,c)}if(typeof o.then==`function`)return b(e,r,Aa(o),c);if(o.$$typeof===C)return b(e,r,Qi(e,o),c);Ma(e,o)}return typeof o==`string`&&o!==``||typeof o==`number`||typeof o==`bigint`?(o=``+o,r!==null&&r.tag===6?(n(e,r.sibling),c=a(r,o),c.return=e,e=c):(n(e,r),c=ui(o,e.mode,c),c.return=e,e=c),s(e)):n(e,r)}return function(e,t,n,r){try{ka=0;var i=b(e,t,n,r);return Oa=null,i}catch(t){if(t===va||t===ba)throw t;var a=ii(29,t,null,e.mode);return a.lanes=r,a.return=e,a}}}var Pa=Na(!0),Fa=Na(!1),Ia=!1;function La(e){e.updateQueue={baseState:e.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,lanes:0,hiddenCallbacks:null},callbacks:null}}function Ra(e,t){e=e.updateQueue,t.updateQueue===e&&(t.updateQueue={baseState:e.baseState,firstBaseUpdate:e.firstBaseUpdate,lastBaseUpdate:e.lastBaseUpdate,shared:e.shared,callbacks:null})}function za(e){return{lane:e,tag:0,payload:null,callback:null,next:null}}function Ba(e,t,n){var r=e.updateQueue;if(r===null)return null;if(r=r.shared,Bl&2){var i=r.pending;return i===null?t.next=t:(t.next=i.next,i.next=t),r.pending=t,t=ti(e),ei(e,null,n),t}return Zr(e,r,t,n),ti(e)}function Va(e,t,n){if(t=t.updateQueue,t!==null&&(t=t.shared,n&4194048)){var r=t.lanes;r&=e.pendingLanes,n|=r,t.lanes=n,Xe(e,n)}}function Ha(e,t){var n=e.updateQueue,r=e.alternate;if(r!==null&&(r=r.updateQueue,n===r)){var i=null,a=null;if(n=n.firstBaseUpdate,n!==null){do{var o={lane:n.lane,tag:n.tag,payload:n.payload,callback:null,next:null};a===null?i=a=o:a=a.next=o,n=n.next}while(n!==null);a===null?i=a=t:a=a.next=t}else i=a=t;n={baseState:r.baseState,firstBaseUpdate:i,lastBaseUpdate:a,shared:r.shared,callbacks:r.callbacks},e.updateQueue=n;return}e=n.lastBaseUpdate,e===null?n.firstBaseUpdate=t:e.next=t,n.lastBaseUpdate=t}var Ua=!1;function Wa(){if(Ua){var e=la;if(e!==null)throw e}}function Ga(e,t,n,r){Ua=!1;var i=e.updateQueue;Ia=!1;var a=i.firstBaseUpdate,o=i.lastBaseUpdate,s=i.shared.pending;if(s!==null){i.shared.pending=null;var c=s,l=c.next;c.next=null,o===null?a=l:o.next=l,o=c;var u=e.alternate;u!==null&&(u=u.updateQueue,s=u.lastBaseUpdate,s!==o&&(s===null?u.firstBaseUpdate=l:s.next=l,u.lastBaseUpdate=c))}if(a!==null){var d=i.baseState;o=0,u=l=c=null,s=a;do{var p=s.lane&-536870913,m=p!==s.lane;if(m?(K&p)===p:(r&p)===p){p!==0&&p===ca&&(Ua=!0),u!==null&&(u=u.next={lane:0,tag:s.tag,payload:s.payload,callback:null,next:null});a:{var h=e,g=s;p=t;var _=n;switch(g.tag){case 1:if(h=g.payload,typeof h==`function`){d=h.call(_,d,p);break a}d=h;break a;case 3:h.flags=h.flags&-65537|128;case 0:if(h=g.payload,p=typeof h==`function`?h.call(_,d,p):h,p==null)break a;d=f({},d,p);break a;case 2:Ia=!0}}p=s.callback,p!==null&&(e.flags|=64,m&&(e.flags|=8192),m=i.callbacks,m===null?i.callbacks=[p]:m.push(p))}else m={lane:p,tag:s.tag,payload:s.payload,callback:s.callback,next:null},u===null?(l=u=m,c=d):u=u.next=m,o|=p;if(s=s.next,s===null){if(s=i.shared.pending,s===null)break;m=s,s=m.next,m.next=null,i.lastBaseUpdate=m,i.shared.pending=null}}while(1);u===null&&(c=d),i.baseState=c,i.firstBaseUpdate=l,i.lastBaseUpdate=u,a===null&&(i.shared.lanes=0),Yl|=o,e.lanes=o,e.memoizedState=d}}function Ka(e,t){if(typeof e!=`function`)throw Error(i(191,e));e.call(t)}function qa(e,t){var n=e.callbacks;if(n!==null)for(e.callbacks=null,e=0;ea?a:8;var o=F.T,s={};F.T=s,Ns(e,!1,t,n);try{var c=i(),l=F.S;l!==null&&l(s,c),typeof c==`object`&&c&&typeof c.then==`function`?Ms(e,t,fa(c,r),_u(e)):Ms(e,t,r,_u(e))}catch(n){Ms(e,t,{then:function(){},status:`rejected`,reason:n},_u())}finally{I.p=a,o!==null&&s.types!==null&&(o.types=s.types),F.T=o}}function Ss(){}function Cs(e,t,n,r){if(e.tag!==5)throw Error(i(476));var a=ws(e).queue;xs(e,a,t,te,n===null?Ss:function(){return Ts(e),n(r)})}function ws(e){var t=e.memoizedState;if(t!==null)return t;t={memoizedState:te,baseState:te,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:Po,lastRenderedState:te},next:null};var n={};return t.next={memoizedState:n,baseState:n,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:Po,lastRenderedState:n},next:null},e.memoizedState=t,e=e.alternate,e!==null&&(e.memoizedState=t),t}function Ts(e){var t=ws(e);t.next===null&&(t=e.alternate.memoizedState),Ms(e,t.next.queue,{},_u())}function Es(){return Zi(ep)}function Ds(){return ko().memoizedState}function Os(){return ko().memoizedState}function ks(e){for(var t=e.return;t!==null;){switch(t.tag){case 24:case 3:var n=_u();e=za(n);var r=Ba(t,e,n);r!==null&&(yu(r,t,n),Va(r,t,n)),t={cache:ia()},e.payload=t;return}t=t.return}}function As(e,t,n){var r=_u();n={lane:r,revertLane:0,gesture:null,action:n,hasEagerState:!1,eagerState:null,next:null},Ps(e)?Fs(t,n):(n=Qr(e,t,n,r),n!==null&&(yu(n,e,r),Is(n,t,r)))}function js(e,t,n){Ms(e,t,n,_u())}function Ms(e,t,n,r){var i={lane:r,revertLane:0,gesture:null,action:n,hasEagerState:!1,eagerState:null,next:null};if(Ps(e))Fs(t,i);else{var a=e.alternate;if(e.lanes===0&&(a===null||a.lanes===0)&&(a=t.lastRenderedReducer,a!==null))try{var o=t.lastRenderedState,s=a(o,n);if(i.hasEagerState=!0,i.eagerState=s,vr(s,o))return Zr(e,t,i,0),Vl===null&&Xr(),!1}catch{}if(n=Qr(e,t,i,r),n!==null)return yu(n,e,r),Is(n,t,r),!0}return!1}function Ns(e,t,n,r){if(r={lane:2,revertLane:md(),gesture:null,action:r,hasEagerState:!1,eagerState:null,next:null},Ps(e)){if(t)throw Error(i(479))}else t=Qr(e,n,r,2),t!==null&&yu(t,e,2)}function Ps(e){var t=e.alternate;return e===W||t!==null&&t===W}function Fs(e,t){po=fo=!0;var n=e.pending;n===null?t.next=t:(t.next=n.next,n.next=t),e.pending=t}function Is(e,t,n){if(n&4194048){var r=t.lanes;r&=e.pendingLanes,n|=r,t.lanes=n,Xe(e,n)}}var Ls={readContext:Zi,use:Mo,useCallback:yo,useContext:yo,useEffect:yo,useImperativeHandle:yo,useLayoutEffect:yo,useInsertionEffect:yo,useMemo:yo,useReducer:yo,useRef:yo,useState:yo,useDebugValue:yo,useDeferredValue:yo,useTransition:yo,useSyncExternalStore:yo,useId:yo,useHostTransitionStatus:yo,useFormState:yo,useActionState:yo,useOptimistic:yo,useMemoCache:yo,useCacheRefresh:yo};Ls.useEffectEvent=yo;var Rs={readContext:Zi,use:Mo,useCallback:function(e,t){return Oo().memoizedState=[e,t===void 0?null:t],e},useContext:Zi,useEffect:cs,useImperativeHandle:function(e,t,n){n=n==null?null:n.concat([e]),os(4194308,4,ms.bind(null,t,e),n)},useLayoutEffect:function(e,t){return os(4194308,4,e,t)},useInsertionEffect:function(e,t){os(4,2,e,t)},useMemo:function(e,t){var n=Oo();t=t===void 0?null:t;var r=e();if(mo){Ne(!0);try{e()}finally{Ne(!1)}}return n.memoizedState=[r,t],r},useReducer:function(e,t,n){var r=Oo();if(n!==void 0){var i=n(t);if(mo){Ne(!0);try{n(t)}finally{Ne(!1)}}}else i=t;return r.memoizedState=r.baseState=i,e={pending:null,lanes:0,dispatch:null,lastRenderedReducer:e,lastRenderedState:i},r.queue=e,e=e.dispatch=As.bind(null,W,e),[r.memoizedState,e]},useRef:function(e){var t=Oo();return e={current:e},t.memoizedState=e},useState:function(e){e=Wo(e);var t=e.queue,n=js.bind(null,W,t);return t.dispatch=n,[e.memoizedState,n]},useDebugValue:gs,useDeferredValue:function(e,t){return ys(Oo(),e,t)},useTransition:function(){var e=Wo(!1);return e=xs.bind(null,W,e.queue,!0,!1),Oo().memoizedState=e,[!1,e]},useSyncExternalStore:function(e,t,n){var r=W,a=Oo();if(U){if(n===void 0)throw Error(i(407));n=n()}else{if(n=t(),Vl===null)throw Error(i(349));K&127||zo(r,t,n)}a.memoizedState=n;var o={value:n,getSnapshot:t};return a.queue=o,cs(Vo.bind(null,r,o,e),[e]),r.flags|=2048,is(9,{destroy:void 0},Bo.bind(null,r,o,n,t),null),n},useId:function(){var e=Oo(),t=Vl.identifierPrefix;if(U){var n=Ci,r=Si;n=(r&~(1<<32-Pe(r)-1)).toString(32)+n,t=`_`+t+`R_`+n,n=ho++,0<\/script>`,o=o.removeChild(o.firstChild);break;case`select`:o=typeof r.is==`string`?s.createElement(`select`,{is:r.is}):s.createElement(`select`),r.multiple?o.multiple=!0:r.size&&(o.size=r.size);break;default:o=typeof r.is==`string`?s.createElement(a,{is:r.is}):s.createElement(a)}}o[rt]=t,o[it]=r;a:for(s=t.child;s!==null;){if(s.tag===5||s.tag===6)o.appendChild(s.stateNode);else if(s.tag!==4&&s.tag!==27&&s.child!==null){s.child.return=s,s=s.child;continue}if(s===t)break a;for(;s.sibling===null;){if(s.return===null||s.return===t)break a;s=s.return}s.sibling.return=s.return,s=s.sibling}t.stateNode=o;a:switch(Z(o,a,r),a){case`button`:case`input`:case`select`:case`textarea`:r=!!r.autoFocus;break a;case`img`:r=!0;break a;default:r=!1}r&&Mc(t)}}return Lc(t),Nc(t,t.type,e===null?null:e.memoizedProps,t.pendingProps,n),null;case 6:if(e&&t.stateNode!=null)e.memoizedProps!==r&&Mc(t);else{if(typeof r!=`string`&&t.stateNode===null)throw Error(i(166));if(e=ae.current,Li(t)){if(e=t.stateNode,n=t.memoizedProps,r=null,a=ki,a!==null)switch(a.tag){case 27:case 5:r=a.memoizedProps}e[rt]=t,e=!!(e.nodeValue===n||r!==null&&!0===r.suppressHydrationWarning||Fd(e.nodeValue,n)),e||Pi(t,!0)}else e=Hd(e).createTextNode(r),e[rt]=t,t.stateNode=e}return Lc(t),null;case 31:if(n=t.memoizedState,e===null||e.memoizedState!==null){if(r=Li(t),n!==null){if(e===null){if(!r)throw Error(i(318));if(e=t.memoizedState,e=e===null?null:e.dehydrated,!e)throw Error(i(557));e[rt]=t}else Ri(),!(t.flags&128)&&(t.memoizedState=null),t.flags|=4;Lc(t),e=!1}else n=zi(),e!==null&&e.memoizedState!==null&&(e.memoizedState.hydrationErrors=n),e=!0;if(!e)return t.flags&256?(ao(t),t):(ao(t),null);if(t.flags&128)throw Error(i(558))}return Lc(t),null;case 13:if(r=t.memoizedState,e===null||e.memoizedState!==null&&e.memoizedState.dehydrated!==null){if(a=Li(t),r!==null&&r.dehydrated!==null){if(e===null){if(!a)throw Error(i(318));if(a=t.memoizedState,a=a===null?null:a.dehydrated,!a)throw Error(i(317));a[rt]=t}else Ri(),!(t.flags&128)&&(t.memoizedState=null),t.flags|=4;Lc(t),a=!1}else a=zi(),e!==null&&e.memoizedState!==null&&(e.memoizedState.hydrationErrors=a),a=!0;if(!a)return t.flags&256?(ao(t),t):(ao(t),null)}return ao(t),t.flags&128?(t.lanes=n,t):(n=r!==null,e=e!==null&&e.memoizedState!==null,n&&(r=t.child,a=null,r.alternate!==null&&r.alternate.memoizedState!==null&&r.alternate.memoizedState.cachePool!==null&&(a=r.alternate.memoizedState.cachePool.pool),o=null,r.memoizedState!==null&&r.memoizedState.cachePool!==null&&(o=r.memoizedState.cachePool.pool),o!==a&&(r.flags|=2048)),n!==e&&n&&(t.child.flags|=8192),Fc(t,t.updateQueue),Lc(t),null);case 4:return ce(),e===null&&Td(t.stateNode.containerInfo),Lc(t),null;case 10:return Gi(t.type),Lc(t),null;case 19:if(R(oo),r=t.memoizedState,r===null)return Lc(t),null;if(a=(t.flags&128)!=0,o=r.rendering,o===null)if(a)Ic(r,!1);else{if(Jl!==0||e!==null&&e.flags&128)for(e=t.child;e!==null;){if(o=so(e),o!==null){for(t.flags|=128,Ic(r,!1),e=o.updateQueue,t.updateQueue=e,Fc(t,e),t.subtreeFlags=0,e=n,n=t.child;n!==null;)si(n,e),n=n.sibling;return z(oo,oo.current&1|2),U&&wi(t,r.treeForkCount),t.child}e=e.sibling}r.tail!==null&&Ce()>au&&(t.flags|=128,a=!0,Ic(r,!1),t.lanes=4194304)}else{if(!a)if(e=so(o),e!==null){if(t.flags|=128,a=!0,e=e.updateQueue,t.updateQueue=e,Fc(t,e),Ic(r,!0),r.tail===null&&r.tailMode===`hidden`&&!o.alternate&&!U)return Lc(t),null}else 2*Ce()-r.renderingStartTime>au&&n!==536870912&&(t.flags|=128,a=!0,Ic(r,!1),t.lanes=4194304);r.isBackwards?(o.sibling=t.child,t.child=o):(e=r.last,e===null?t.child=o:e.sibling=o,r.last=o)}return r.tail===null?(Lc(t),null):(e=r.tail,r.rendering=e,r.tail=e.sibling,r.renderingStartTime=Ce(),e.sibling=null,n=oo.current,z(oo,a?n&1|2:n&1),U&&wi(t,r.treeForkCount),e);case 22:case 23:return ao(t),Qa(),r=t.memoizedState!==null,e===null?r&&(t.flags|=8192):e.memoizedState!==null!==r&&(t.flags|=8192),r?n&536870912&&!(t.flags&128)&&(Lc(t),t.subtreeFlags&6&&(t.flags|=8192)):Lc(t),n=t.updateQueue,n!==null&&Fc(t,n.retryQueue),n=null,e!==null&&e.memoizedState!==null&&e.memoizedState.cachePool!==null&&(n=e.memoizedState.cachePool.pool),r=null,t.memoizedState!==null&&t.memoizedState.cachePool!==null&&(r=t.memoizedState.cachePool.pool),r!==n&&(t.flags|=2048),e!==null&&R(ma),null;case 24:return n=null,e!==null&&(n=e.memoizedState.cache),t.memoizedState.cache!==n&&(t.flags|=2048),Gi(ra),Lc(t),null;case 25:return null;case 30:return null}throw Error(i(156,t.tag))}function zc(e,t){switch(Di(t),t.tag){case 1:return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 3:return Gi(ra),ce(),e=t.flags,e&65536&&!(e&128)?(t.flags=e&-65537|128,t):null;case 26:case 27:case 5:return ue(t),null;case 31:if(t.memoizedState!==null){if(ao(t),t.alternate===null)throw Error(i(340));Ri()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 13:if(ao(t),e=t.memoizedState,e!==null&&e.dehydrated!==null){if(t.alternate===null)throw Error(i(340));Ri()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 19:return R(oo),null;case 4:return ce(),null;case 10:return Gi(t.type),null;case 22:case 23:return ao(t),Qa(),e!==null&&R(ma),e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 24:return Gi(ra),null;case 25:return null;default:return null}}function Bc(e,t){switch(Di(t),t.tag){case 3:Gi(ra),ce();break;case 26:case 27:case 5:ue(t);break;case 4:ce();break;case 31:t.memoizedState!==null&&ao(t);break;case 13:ao(t);break;case 19:R(oo);break;case 10:Gi(t.type);break;case 22:case 23:ao(t),Qa(),e!==null&&R(ma);break;case 24:Gi(ra)}}function Vc(e,t){try{var n=t.updateQueue,r=n===null?null:n.lastEffect;if(r!==null){var i=r.next;n=i;do{if((n.tag&e)===e){r=void 0;var a=n.create,o=n.inst;r=a(),o.destroy=r}n=n.next}while(n!==i)}}catch(e){qu(t,t.return,e)}}function Hc(e,t,n){try{var r=t.updateQueue,i=r===null?null:r.lastEffect;if(i!==null){var a=i.next;r=a;do{if((r.tag&e)===e){var o=r.inst,s=o.destroy;if(s!==void 0){o.destroy=void 0,i=t;var c=n,l=s;try{l()}catch(e){qu(i,c,e)}}}r=r.next}while(r!==a)}}catch(e){qu(t,t.return,e)}}function Uc(e){var t=e.updateQueue;if(t!==null){var n=e.stateNode;try{qa(t,n)}catch(t){qu(e,e.return,t)}}}function Wc(e,t,n){n.props=Gs(e.type,e.memoizedProps),n.state=e.memoizedState;try{n.componentWillUnmount()}catch(n){qu(e,t,n)}}function Gc(e,t){try{var n=e.ref;if(n!==null){switch(e.tag){case 26:case 27:case 5:var r=e.stateNode;break;case 30:r=e.stateNode;break;default:r=e.stateNode}typeof n==`function`?e.refCleanup=n(r):n.current=r}}catch(n){qu(e,t,n)}}function Kc(e,t){var n=e.ref,r=e.refCleanup;if(n!==null)if(typeof r==`function`)try{r()}catch(n){qu(e,t,n)}finally{e.refCleanup=null,e=e.alternate,e!=null&&(e.refCleanup=null)}else if(typeof n==`function`)try{n(null)}catch(n){qu(e,t,n)}else n.current=null}function qc(e){var t=e.type,n=e.memoizedProps,r=e.stateNode;try{a:switch(t){case`button`:case`input`:case`select`:case`textarea`:n.autoFocus&&r.focus();break a;case`img`:n.src?r.src=n.src:n.srcSet&&(r.srcset=n.srcSet)}}catch(t){qu(e,e.return,t)}}function Jc(e,t,n){try{var r=e.stateNode;Ld(r,e.type,n,t),r[it]=t}catch(t){qu(e,e.return,t)}}function Yc(e){return e.tag===5||e.tag===3||e.tag===26||e.tag===27&&$d(e.type)||e.tag===4}function Xc(e){a:for(;;){for(;e.sibling===null;){if(e.return===null||Yc(e.return))return null;e=e.return}for(e.sibling.return=e.return,e=e.sibling;e.tag!==5&&e.tag!==6&&e.tag!==18;){if(e.tag===27&&$d(e.type)||e.flags&2||e.child===null||e.tag===4)continue a;e.child.return=e,e=e.child}if(!(e.flags&2))return e.stateNode}}function Zc(e,t,n){var r=e.tag;if(r===5||r===6)e=e.stateNode,t?(n.nodeType===9?n.body:n.nodeName===`HTML`?n.ownerDocument.body:n).insertBefore(e,t):(t=n.nodeType===9?n.body:n.nodeName===`HTML`?n.ownerDocument.body:n,t.appendChild(e),n=n._reactRootContainer,n!=null||t.onclick!==null||(t.onclick=Yt));else if(r!==4&&(r===27&&$d(e.type)&&(n=e.stateNode,t=null),e=e.child,e!==null))for(Zc(e,t,n),e=e.sibling;e!==null;)Zc(e,t,n),e=e.sibling}function Qc(e,t,n){var r=e.tag;if(r===5||r===6)e=e.stateNode,t?n.insertBefore(e,t):n.appendChild(e);else if(r!==4&&(r===27&&$d(e.type)&&(n=e.stateNode),e=e.child,e!==null))for(Qc(e,t,n),e=e.sibling;e!==null;)Qc(e,t,n),e=e.sibling}function $c(e){var t=e.stateNode,n=e.memoizedProps;try{for(var r=e.type,i=t.attributes;i.length;)t.removeAttributeNode(i[0]);Z(t,r,n),t[rt]=e,t[it]=n}catch(t){qu(e,e.return,t)}}var el=!1,tl=!1,nl=!1,rl=typeof WeakSet==`function`?WeakSet:Set,il=null;function al(e,t){if(e=e.containerInfo,Bd=lp,e=Cr(e),wr(e)){if(`selectionStart`in e)var n={start:e.selectionStart,end:e.selectionEnd};else a:{n=(n=e.ownerDocument)&&n.defaultView||window;var r=n.getSelection&&n.getSelection();if(r&&r.rangeCount!==0){n=r.anchorNode;var a=r.anchorOffset,o=r.focusNode;r=r.focusOffset;try{n.nodeType,o.nodeType}catch{n=null;break a}var s=0,c=-1,l=-1,u=0,d=0,f=e,p=null;b:for(;;){for(var m;f!==n||a!==0&&f.nodeType!==3||(c=s+a),f!==o||r!==0&&f.nodeType!==3||(l=s+r),f.nodeType===3&&(s+=f.nodeValue.length),(m=f.firstChild)!==null;)p=f,f=m;for(;;){if(f===e)break b;if(p===n&&++u===a&&(c=s),p===o&&++d===r&&(l=s),(m=f.nextSibling)!==null)break;f=p,p=f.parentNode}f=m}n=c===-1||l===-1?null:{start:c,end:l}}else n=null}n||={start:0,end:0}}else n=null;for(Vd={focusedElem:e,selectionRange:n},lp=!1,il=t;il!==null;)if(t=il,e=t.child,t.subtreeFlags&1028&&e!==null)e.return=t,il=e;else for(;il!==null;){switch(t=il,o=t.alternate,e=t.flags,t.tag){case 0:if(e&4&&(e=t.updateQueue,e=e===null?null:e.events,e!==null))for(n=0;n title`))),Z(o,r,n),o[rt]=e,ht(o),r=o;break a;case`link`:var s=Uf(`link`,`href`,a).get(r+(n.href||``));if(s){for(var c=0;cg&&(o=g,g=h,h=o);var _=xr(s,h),v=xr(s,g);if(_&&v&&(p.rangeCount!==1||p.anchorNode!==_.node||p.anchorOffset!==_.offset||p.focusNode!==v.node||p.focusOffset!==v.offset)){var y=d.createRange();y.setStart(_.node,_.offset),p.removeAllRanges(),h>g?(p.addRange(y),p.extend(v.node,v.offset)):(y.setEnd(v.node,v.offset),p.addRange(y))}}}}for(d=[],p=s;p=p.parentNode;)p.nodeType===1&&d.push({element:p,left:p.scrollLeft,top:p.scrollTop});for(typeof s.focus==`function`&&s.focus(),s=0;sn?32:n,F.T=null,n=pu,pu=null;var o=lu,s=du;if(cu=0,uu=lu=null,du=0,Bl&6)throw Error(i(331));var c=Bl;if(Bl|=4,Fl(o.current),Dl(o,o.current,s,n),Bl=c,sd(0,!1),Me&&typeof Me.onPostCommitFiberRoot==`function`)try{Me.onPostCommitFiberRoot(V,o)}catch{}return!0}finally{I.p=a,F.T=r,Gu(e,t)}}function J(e,t,n){t=mi(n,t),t=Zs(e.stateNode,t,2),e=Ba(e,t,2),e!==null&&(qe(e,2),od(e))}function qu(e,t,n){if(e.tag===3)J(e,e,n);else for(;t!==null;){if(t.tag===3){J(t,e,n);break}else if(t.tag===1){var r=t.stateNode;if(typeof t.type.getDerivedStateFromError==`function`||typeof r.componentDidCatch==`function`&&(su===null||!su.has(r))){e=mi(n,e),n=Qs(2),r=Ba(t,n,2),r!==null&&($s(n,r,t,e),qe(r,2),od(r));break}}t=t.return}}function Ju(e,t,n){var r=e.pingCache;if(r===null){r=e.pingCache=new zl;var i=new Set;r.set(t,i)}else i=r.get(t),i===void 0&&(i=new Set,r.set(t,i));i.has(n)||(Kl=!0,i.add(n),e=Yu.bind(null,e,t,n),t.then(e,e))}function Yu(e,t,n){var r=e.pingCache;r!==null&&r.delete(t),e.pingedLanes|=e.suspendedLanes&n,e.warmLanes&=~n,Vl===e&&(K&n)===n&&(Jl===4||Jl===3&&(K&62914560)===K&&300>Ce()-ru?!(Bl&2)&&Eu(e,0):Zl|=n,$l===K&&($l=0)),od(e)}function Xu(e,t){t===0&&(t=Ge()),e=$r(e,t),e!==null&&(qe(e,t),od(e))}function Zu(e){var t=e.memoizedState,n=0;t!==null&&(n=t.retryLane),Xu(e,n)}function Qu(e,t){var n=0;switch(e.tag){case 31:case 13:var r=e.stateNode,a=e.memoizedState;a!==null&&(n=a.retryLane);break;case 19:r=e.stateNode;break;case 22:r=e.stateNode._retryCache;break;default:throw Error(i(314))}r!==null&&r.delete(t),Xu(e,n)}function $u(e,t){return ye(e,t)}var ed=null,td=null,nd=!1,rd=!1,id=!1,ad=0;function od(e){e!==td&&e.next===null&&(td===null?ed=td=e:td=td.next=e),rd=!0,nd||(nd=!0,pd())}function sd(e,t){if(!id&&rd){id=!0;do for(var n=!1,r=ed;r!==null;){if(!t)if(e!==0){var i=r.pendingLanes;if(i===0)var a=0;else{var o=r.suspendedLanes,s=r.pingedLanes;a=(1<<31-Pe(42|e)+1)-1,a&=i&~(o&~s),a=a&201326741?a&201326741|1:a?a|2:0}a!==0&&(n=!0,fd(r,a))}else a=K,a=He(r,r===Vl?a:0,r.cancelPendingCommit!==null||r.timeoutHandle!==-1),!(a&3)||Ue(r,a)||(n=!0,fd(r,a));r=r.next}while(n);id=!1}}function cd(){ld()}function ld(){rd=nd=!1;var e=0;ad!==0&&qd()&&(e=ad);for(var t=Ce(),n=null,r=ed;r!==null;){var i=r.next,a=ud(r,t);a===0?(r.next=null,n===null?ed=i:n.next=i,i===null&&(td=n)):(n=r,(e!==0||a&3)&&(rd=!0)),r=i}cu!==0&&cu!==5||sd(e,!1),ad!==0&&(ad=0)}function ud(e,t){for(var n=e.suspendedLanes,r=e.pingedLanes,i=e.expirationTimes,a=e.pendingLanes&-62914561;0s)break;var u=c.transferSize,d=c.initiatorType;u&&Rd(d)&&(c=c.responseEnd,o+=u*(c`u`?null:document;function Cf(e,t,n){var r=Sf;if(r&&typeof t==`string`&&t){var i=Pt(t);i=`link[rel="`+e+`"][href="`+i+`"]`,typeof n==`string`&&(i+=`[crossorigin="`+n+`"]`),_f.has(i)||(_f.add(i),e={rel:e,crossOrigin:n,href:t},r.querySelector(i)===null&&(t=r.createElement(`link`),Z(t,`link`,e),ht(t),r.head.appendChild(t)))}}function wf(e){yf.D(e),Cf(`dns-prefetch`,e,null)}function Tf(e,t){yf.C(e,t),Cf(`preconnect`,e,t)}function Ef(e,t,n){yf.L(e,t,n);var r=Sf;if(r&&e&&t){var i=`link[rel="preload"][as="`+Pt(t)+`"]`;t===`image`&&n&&n.imageSrcSet?(i+=`[imagesrcset="`+Pt(n.imageSrcSet)+`"]`,typeof n.imageSizes==`string`&&(i+=`[imagesizes="`+Pt(n.imageSizes)+`"]`)):i+=`[href="`+Pt(e)+`"]`;var a=i;switch(t){case`style`:a=Mf(e);break;case`script`:a=If(e)}gf.has(a)||(e=f({rel:`preload`,href:t===`image`&&n&&n.imageSrcSet?void 0:e,as:t},n),gf.set(a,e),r.querySelector(i)!==null||t===`style`&&r.querySelector(Nf(a))||t===`script`&&r.querySelector(Lf(a))||(t=r.createElement(`link`),Z(t,`link`,e),ht(t),r.head.appendChild(t)))}}function Df(e,t){yf.m(e,t);var n=Sf;if(n&&e){var r=t&&typeof t.as==`string`?t.as:`script`,i=`link[rel="modulepreload"][as="`+Pt(r)+`"][href="`+Pt(e)+`"]`,a=i;switch(r){case`audioworklet`:case`paintworklet`:case`serviceworker`:case`sharedworker`:case`worker`:case`script`:a=If(e)}if(!gf.has(a)&&(e=f({rel:`modulepreload`,href:e},t),gf.set(a,e),n.querySelector(i)===null)){switch(r){case`audioworklet`:case`paintworklet`:case`serviceworker`:case`sharedworker`:case`worker`:case`script`:if(n.querySelector(Lf(a)))return}r=n.createElement(`link`),Z(r,`link`,e),ht(r),n.head.appendChild(r)}}}function Of(e,t,n){yf.S(e,t,n);var r=Sf;if(r&&e){var i=mt(r).hoistableStyles,a=Mf(e);t||=`default`;var o=i.get(a);if(!o){var s={loading:0,preload:null};if(o=r.querySelector(Nf(a)))s.loading=5;else{e=f({rel:`stylesheet`,href:e,"data-precedence":t},n),(n=gf.get(a))&&Bf(e,n);var c=o=r.createElement(`link`);ht(c),Z(c,`link`,e),c._p=new Promise(function(e,t){c.onload=e,c.onerror=t}),c.addEventListener(`load`,function(){s.loading|=1}),c.addEventListener(`error`,function(){s.loading|=2}),s.loading|=4,zf(o,t,r)}o={type:`stylesheet`,instance:o,count:1,state:s},i.set(a,o)}}}function kf(e,t){yf.X(e,t);var n=Sf;if(n&&e){var r=mt(n).hoistableScripts,i=If(e),a=r.get(i);a||(a=n.querySelector(Lf(i)),a||(e=f({src:e,async:!0},t),(t=gf.get(i))&&Vf(e,t),a=n.createElement(`script`),ht(a),Z(a,`link`,e),n.head.appendChild(a)),a={type:`script`,instance:a,count:1,state:null},r.set(i,a))}}function Af(e,t){yf.M(e,t);var n=Sf;if(n&&e){var r=mt(n).hoistableScripts,i=If(e),a=r.get(i);a||(a=n.querySelector(Lf(i)),a||(e=f({src:e,async:!0,type:`module`},t),(t=gf.get(i))&&Vf(e,t),a=n.createElement(`script`),ht(a),Z(a,`link`,e),n.head.appendChild(a)),a={type:`script`,instance:a,count:1,state:null},r.set(i,a))}}function jf(e,t,n,r){var a=(a=ae.current)?vf(a):null;if(!a)throw Error(i(446));switch(e){case`meta`:case`title`:return null;case`style`:return typeof n.precedence==`string`&&typeof n.href==`string`?(t=Mf(n.href),n=mt(a).hoistableStyles,r=n.get(t),r||(r={type:`style`,instance:null,count:0,state:null},n.set(t,r)),r):{type:`void`,instance:null,count:0,state:null};case`link`:if(n.rel===`stylesheet`&&typeof n.href==`string`&&typeof n.precedence==`string`){e=Mf(n.href);var o=mt(a).hoistableStyles,s=o.get(e);if(s||(a=a.ownerDocument||a,s={type:`stylesheet`,instance:null,count:0,state:{loading:0,preload:null}},o.set(e,s),(o=a.querySelector(Nf(e)))&&!o._p&&(s.instance=o,s.state.loading=5),gf.has(e)||(n={rel:`preload`,as:`style`,href:n.href,crossOrigin:n.crossOrigin,integrity:n.integrity,media:n.media,hrefLang:n.hrefLang,referrerPolicy:n.referrerPolicy},gf.set(e,n),o||Ff(a,e,n,s.state))),t&&r===null)throw Error(i(528,``));return s}if(t&&r!==null)throw Error(i(529,``));return null;case`script`:return t=n.async,n=n.src,typeof n==`string`&&t&&typeof t!=`function`&&typeof t!=`symbol`?(t=If(n),n=mt(a).hoistableScripts,r=n.get(t),r||(r={type:`script`,instance:null,count:0,state:null},n.set(t,r)),r):{type:`void`,instance:null,count:0,state:null};default:throw Error(i(444,e))}}function Mf(e){return`href="`+Pt(e)+`"`}function Nf(e){return`link[rel="stylesheet"][`+e+`]`}function Pf(e){return f({},e,{"data-precedence":e.precedence,precedence:null})}function Ff(e,t,n,r){e.querySelector(`link[rel="preload"][as="style"][`+t+`]`)?r.loading=1:(t=e.createElement(`link`),r.preload=t,t.addEventListener(`load`,function(){return r.loading|=1}),t.addEventListener(`error`,function(){return r.loading|=2}),Z(t,`link`,n),ht(t),e.head.appendChild(t))}function If(e){return`[src="`+Pt(e)+`"]`}function Lf(e){return`script[async]`+e}function Rf(e,t,n){if(t.count++,t.instance===null)switch(t.type){case`style`:var r=e.querySelector(`style[data-href~="`+Pt(n.href)+`"]`);if(r)return t.instance=r,ht(r),r;var a=f({},n,{"data-href":n.href,"data-precedence":n.precedence,href:null,precedence:null});return r=(e.ownerDocument||e).createElement(`style`),ht(r),Z(r,`style`,a),zf(r,n.precedence,e),t.instance=r;case`stylesheet`:a=Mf(n.href);var o=e.querySelector(Nf(a));if(o)return t.state.loading|=4,t.instance=o,ht(o),o;r=Pf(n),(a=gf.get(a))&&Bf(r,a),o=(e.ownerDocument||e).createElement(`link`),ht(o);var s=o;return s._p=new Promise(function(e,t){s.onload=e,s.onerror=t}),Z(o,`link`,r),t.state.loading|=4,zf(o,n.precedence,e),t.instance=o;case`script`:return o=If(n.src),(a=e.querySelector(Lf(o)))?(t.instance=a,ht(a),a):(r=n,(a=gf.get(o))&&(r=f({},n),Vf(r,a)),e=e.ownerDocument||e,a=e.createElement(`script`),ht(a),Z(a,`link`,r),e.head.appendChild(a),t.instance=a);case`void`:return null;default:throw Error(i(443,t.type))}else t.type===`stylesheet`&&!(t.state.loading&4)&&(r=t.instance,t.state.loading|=4,zf(r,n.precedence,e));return t.instance}function zf(e,t,n){for(var r=n.querySelectorAll(`link[rel="stylesheet"][data-precedence],style[data-precedence]`),i=r.length?r[r.length-1]:null,a=i,o=0;o title`):null)}function Gf(e,t,n){if(n===1||t.itemProp!=null)return!1;switch(e){case`meta`:case`title`:return!0;case`style`:if(typeof t.precedence!=`string`||typeof t.href!=`string`||t.href===``)break;return!0;case`link`:if(typeof t.rel!=`string`||typeof t.href!=`string`||t.href===``||t.onLoad||t.onError)break;switch(t.rel){case`stylesheet`:return e=t.disabled,typeof t.precedence==`string`&&e==null;default:return!0}case`script`:if(t.async&&typeof t.async!=`function`&&typeof t.async!=`symbol`&&!t.onLoad&&!t.onError&&t.src&&typeof t.src==`string`)return!0}return!1}function Kf(e){return!(e.type===`stylesheet`&&!(e.state.loading&3))}function qf(e,t,n,r){if(n.type===`stylesheet`&&(typeof r.media!=`string`||!1!==matchMedia(r.media).matches)&&!(n.state.loading&4)){if(n.instance===null){var i=Mf(r.href),a=t.querySelector(Nf(i));if(a){t=a._p,typeof t==`object`&&t&&typeof t.then==`function`&&(e.count++,e=Xf.bind(e),t.then(e,e)),n.state.loading|=4,n.instance=a,ht(a);return}a=t.ownerDocument||t,r=Pf(r),(i=gf.get(i))&&Bf(r,i),a=a.createElement(`link`),ht(a);var o=a;o._p=new Promise(function(e,t){o.onload=e,o.onerror=t}),Z(a,`link`,r),n.instance=a}e.stylesheets===null&&(e.stylesheets=new Map),e.stylesheets.set(n,t),(t=n.state.preload)&&!(n.state.loading&3)&&(e.count++,n=Xf.bind(e),t.addEventListener(`load`,n),t.addEventListener(`error`,n))}}var Jf=0;function Yf(e,t){return e.stylesheets&&e.count===0&&Qf(e,e.stylesheets),0Jf?50:800)+t);return e.unsuspend=n,function(){e.unsuspend=null,clearTimeout(r),clearTimeout(i)}}:null}function Xf(){if(this.count--,this.count===0&&(this.imgCount===0||!this.waitingForImages)){if(this.stylesheets)Qf(this,this.stylesheets);else if(this.unsuspend){var e=this.unsuspend;this.unsuspend=null,e()}}}var Zf=null;function Qf(e,t){e.stylesheets=null,e.unsuspend!==null&&(e.count++,Zf=new Map,t.forEach($f,e),Zf=null,Xf.call(e))}function $f(e,t){if(!(t.state.loading&4)){var n=Zf.get(e);if(n)var r=n.get(null);else{n=new Map,Zf.set(e,n);for(var i=e.querySelectorAll(`link[data-precedence],style[data-precedence]`),a=0;a{function n(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>`u`||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!=`function`))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(n)}catch(e){console.error(e)}}n(),t.exports=v()})),b=u(p(),1),x=u(y(),1),S={mono:`'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, monospace`,bg:`#eef3fa`,surface:`#ffffff`,surfaceAlt:`#f8fafc`,border:`#e2e8f0`,borderSoft:`#eef1f5`,ink:`#0f172a`,ink2:`#334155`,ink3:`#64748b`,ink4:`#94a3b8`,blue:`#2563eb`,blueDeep:`#1d4ed8`,blueSoft:`#eff4ff`,cyan:`#06b6d4`,indigo:`#6366f1`,teal:`#14b8a6`,violet:`#8b5cf6`,green:`#10b981`,greenSoft:`#ecfdf5`,amber:`#f59e0b`,amberSoft:`#fffbeb`,red:`#ef4444`,redSoft:`#fef2f2`,slate:`#475569`,windowBg:`#ffffff`,titleBar:`#f8fafc`,space:[0,4,8,12,16,20,24,32,40,48],radius:{xs:4,sm:6,md:8,lg:10,xl:14,pill:999},shadow:{sm:`0 1px 2px rgba(15,23,42,0.08), 0 0 0 1px rgba(15,23,42,0.04)`,md:`0 8px 24px -12px rgba(15,23,42,0.22), 0 0 0 1px rgba(15,23,42,0.06)`,lg:`0 16px 42px -18px rgba(15,23,42,0.28), 0 0 0 1px rgba(15,23,42,0.07)`,xl:`0 24px 60px -12px rgba(15,23,42,0.32), 0 0 0 1px rgba(15,23,42,0.08)`},type:{display:{fontSize:28,lineHeight:1.12,fontWeight:800,letterSpacing:`-0.015em`},title:{fontSize:22,lineHeight:1.18,fontWeight:750,letterSpacing:`-0.015em`},heading:{fontSize:17,lineHeight:1.25,fontWeight:700,letterSpacing:`-0.01em`},body:{fontSize:13,lineHeight:1.5,fontWeight:400,letterSpacing:0},caption:{fontSize:11.5,lineHeight:1.35,fontWeight:500,letterSpacing:0},label:{fontSize:10.5,lineHeight:1.25,fontWeight:700,letterSpacing:`0.06em`,textTransform:`uppercase`}},ease:`cubic-bezier(0.2,0.7,0.2,1)`,duration:{press:`0.1s`,hover:`0.15s`,fade:`0.2s`}},C=s((e=>{var t=Symbol.for(`react.transitional.element`),n=Symbol.for(`react.fragment`);function r(e,n,r){var i=null;if(r!==void 0&&(i=``+r),n.key!==void 0&&(i=``+n.key),`key`in n)for(var a in r={},n)a!==`key`&&(r[a]=n[a]);else r=n;return n=r.ref,{$$typeof:t,type:e,key:i,ref:n===void 0?null:n,props:r}}e.Fragment=n,e.jsx=r,e.jsxs=r})),w=s(((e,t)=>{t.exports=C()}))(),T=({children:e,size:t=18,stroke:n=1.7,style:r,fill:i=`none`})=>(0,w.jsx)(`svg`,{width:t,height:t,viewBox:`0 0 24 24`,fill:i,stroke:`currentColor`,strokeWidth:n,strokeLinecap:`round`,strokeLinejoin:`round`,style:r,children:e}),E={dashboard:e=>(0,w.jsxs)(T,{...e,children:[(0,w.jsx)(`rect`,{x:`3`,y:`3`,width:`7`,height:`9`,rx:`1.5`}),(0,w.jsx)(`rect`,{x:`14`,y:`3`,width:`7`,height:`5`,rx:`1.5`}),(0,w.jsx)(`rect`,{x:`14`,y:`12`,width:`7`,height:`9`,rx:`1.5`}),(0,w.jsx)(`rect`,{x:`3`,y:`16`,width:`7`,height:`5`,rx:`1.5`})]}),bell:e=>(0,w.jsxs)(T,{...e,children:[(0,w.jsx)(`path`,{d:`M6 8a6 6 0 0 1 12 0c0 7 3 9 3 9H3s3-2 3-9`}),(0,w.jsx)(`path`,{d:`M10 21a2 2 0 0 0 4 0`})]}),wrench:e=>(0,w.jsxs)(T,{...e,children:[(0,w.jsx)(`path`,{d:`M14.7 6.3a4 4 0 0 0 5 5L21 13l-8 8a3 3 0 0 1-4.2-4.2l8-8z`}),(0,w.jsx)(`path`,{d:`m6 14-3 3a2 2 0 1 0 2.8 2.8L9 17`})]}),gear:e=>(0,w.jsxs)(T,{...e,children:[(0,w.jsx)(`circle`,{cx:`12`,cy:`12`,r:`3`}),(0,w.jsx)(`path`,{d:`M19.4 15a1.7 1.7 0 0 0 .3 1.8l.1.1a2 2 0 1 1-2.8 2.8l-.1-.1a1.7 1.7 0 0 0-1.8-.3 1.7 1.7 0 0 0-1 1.5V21a2 2 0 1 1-4 0v-.1a1.7 1.7 0 0 0-1.1-1.5 1.7 1.7 0 0 0-1.8.3l-.1.1a2 2 0 1 1-2.8-2.8l.1-.1a1.7 1.7 0 0 0 .3-1.8 1.7 1.7 0 0 0-1.5-1H3a2 2 0 1 1 0-4h.1A1.7 1.7 0 0 0 4.6 9a1.7 1.7 0 0 0-.3-1.8l-.1-.1a2 2 0 1 1 2.8-2.8l.1.1a1.7 1.7 0 0 0 1.8.3H9a1.7 1.7 0 0 0 1-1.5V3a2 2 0 1 1 4 0v.1a1.7 1.7 0 0 0 1 1.5 1.7 1.7 0 0 0 1.8-.3l.1-.1a2 2 0 1 1 2.8 2.8l-.1.1a1.7 1.7 0 0 0-.3 1.8V9c.3.6.9 1 1.5 1H21a2 2 0 1 1 0 4h-.1a1.7 1.7 0 0 0-1.5 1Z`})]}),lock:e=>(0,w.jsxs)(T,{...e,children:[(0,w.jsx)(`rect`,{x:`4`,y:`11`,width:`16`,height:`10`,rx:`2`}),(0,w.jsx)(`path`,{d:`M8 11V7a4 4 0 0 1 8 0v4`})]}),shield:e=>(0,w.jsx)(T,{...e,children:(0,w.jsx)(`path`,{d:`M12 22s8-4 8-10V5l-8-3-8 3v7c0 6 8 10 8 10Z`})}),apps:e=>(0,w.jsxs)(T,{...e,children:[(0,w.jsx)(`rect`,{x:`3`,y:`3`,width:`7`,height:`7`,rx:`1.5`}),(0,w.jsx)(`rect`,{x:`14`,y:`3`,width:`7`,height:`7`,rx:`1.5`}),(0,w.jsx)(`rect`,{x:`3`,y:`14`,width:`7`,height:`7`,rx:`1.5`}),(0,w.jsx)(`rect`,{x:`14`,y:`14`,width:`7`,height:`7`,rx:`1.5`})]}),home:e=>(0,w.jsx)(T,{...e,children:(0,w.jsx)(`path`,{d:`m3 11 9-8 9 8v9a2 2 0 0 1-2 2h-4v-7h-6v7H5a2 2 0 0 1-2-2Z`})}),eye:e=>(0,w.jsxs)(T,{...e,children:[(0,w.jsx)(`path`,{d:`M2 12s4-7 10-7 10 7 10 7-4 7-10 7S2 12 2 12Z`}),(0,w.jsx)(`circle`,{cx:`12`,cy:`12`,r:`3`})]}),ruler:e=>(0,w.jsxs)(T,{...e,children:[(0,w.jsx)(`path`,{d:`M21.3 7.9 16.1 2.7a1.4 1.4 0 0 0-2 0L2.7 14.1a1.4 1.4 0 0 0 0 2l5.2 5.2a1.4 1.4 0 0 0 2 0L21.3 9.9a1.4 1.4 0 0 0 0-2Z`}),(0,w.jsx)(`path`,{d:`m7.5 10.5 2 2`}),(0,w.jsx)(`path`,{d:`m10.5 7.5 2 2`}),(0,w.jsx)(`path`,{d:`m13.5 4.5 2 2`}),(0,w.jsx)(`path`,{d:`m4.5 13.5 2 2`})]}),database:e=>(0,w.jsxs)(T,{...e,children:[(0,w.jsx)(`ellipse`,{cx:`12`,cy:`5`,rx:`9`,ry:`3`}),(0,w.jsx)(`path`,{d:`M3 5v6c0 1.7 4 3 9 3s9-1.3 9-3V5`}),(0,w.jsx)(`path`,{d:`M3 11v6c0 1.7 4 3 9 3s9-1.3 9-3v-6`})]}),zap:e=>(0,w.jsx)(T,{...e,children:(0,w.jsx)(`path`,{d:`M13 2 3 14h7l-1 8 10-12h-7l1-8Z`})}),code:e=>(0,w.jsxs)(T,{...e,children:[(0,w.jsx)(`path`,{d:`m8 6-6 6 6 6`}),(0,w.jsx)(`path`,{d:`m16 6 6 6-6 6`}),(0,w.jsx)(`path`,{d:`m14 4-4 16`})]}),jupyter:e=>(0,w.jsxs)(T,{...e,children:[(0,w.jsx)(`circle`,{cx:`8`,cy:`6`,r:`1.4`,fill:`currentColor`}),(0,w.jsx)(`circle`,{cx:`16`,cy:`18`,r:`1.4`,fill:`currentColor`}),(0,w.jsx)(`path`,{d:`M5 9c2 4 6 7 11 7`}),(0,w.jsx)(`path`,{d:`M19 15c-2-4-6-7-11-7`})]}),vllm:e=>(0,w.jsxs)(T,{...e,children:[(0,w.jsx)(`path`,{d:`M5 4v8a7 7 0 1 0 14 0V4`}),(0,w.jsx)(`path`,{d:`M9 4v6a3 3 0 0 0 6 0V4`})]}),comfy:e=>(0,w.jsxs)(T,{...e,children:[(0,w.jsx)(`rect`,{x:`3`,y:`3`,width:`6`,height:`5`,rx:`1`}),(0,w.jsx)(`rect`,{x:`15`,y:`3`,width:`6`,height:`5`,rx:`1`}),(0,w.jsx)(`rect`,{x:`9`,y:`16`,width:`6`,height:`5`,rx:`1`}),(0,w.jsx)(`path`,{d:`M9 5.5h6`}),(0,w.jsx)(`path`,{d:`M6 8v5l6 3`}),(0,w.jsx)(`path`,{d:`M18 8v5l-6 3`})]}),palette:e=>(0,w.jsxs)(T,{...e,children:[(0,w.jsx)(`circle`,{cx:`12`,cy:`12`,r:`9`}),(0,w.jsx)(`circle`,{cx:`7`,cy:`11`,r:`1.2`,fill:`currentColor`}),(0,w.jsx)(`circle`,{cx:`11`,cy:`7`,r:`1.2`,fill:`currentColor`}),(0,w.jsx)(`circle`,{cx:`16`,cy:`9`,r:`1.2`,fill:`currentColor`}),(0,w.jsx)(`path`,{d:`M12 21a3 3 0 0 1 0-6 2 2 0 0 0 2-2 3 3 0 0 1 3-3`})]}),folder:e=>(0,w.jsx)(T,{...e,children:(0,w.jsx)(`path`,{d:`M3 7a2 2 0 0 1 2-2h4l2 2h8a2 2 0 0 1 2 2v9a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2Z`})}),port:e=>(0,w.jsxs)(T,{...e,children:[(0,w.jsx)(`rect`,{x:`3`,y:`9`,width:`18`,height:`10`,rx:`2`}),(0,w.jsx)(`circle`,{cx:`7`,cy:`14`,r:`0.8`,fill:`currentColor`}),(0,w.jsx)(`circle`,{cx:`11`,cy:`14`,r:`0.8`,fill:`currentColor`}),(0,w.jsx)(`circle`,{cx:`15`,cy:`14`,r:`0.8`,fill:`currentColor`}),(0,w.jsx)(`path`,{d:`M8 9V5h8v4`})]}),brain:e=>(0,w.jsxs)(T,{...e,children:[(0,w.jsx)(`path`,{d:`M8 4a3 3 0 0 0-3 3 3 3 0 0 0-2 3 3 3 0 0 0 1 2 3 3 0 0 0 1 4 3 3 0 0 0 5 2c1 0 2-1 2-2`}),(0,w.jsx)(`path`,{d:`M16 4a3 3 0 0 1 3 3 3 3 0 0 1 2 3 3 3 0 0 1-1 2 3 3 0 0 1-1 4 3 3 0 0 1-5 2c-1 0-2-1-2-2`}),(0,w.jsx)(`path`,{d:`M12 4v14`})]}),maxkb:e=>(0,w.jsxs)(T,{...e,children:[(0,w.jsx)(`path`,{d:`M4 4v15a2 2 0 0 0 2 2h13`}),(0,w.jsx)(`path`,{d:`M8 7h10`}),(0,w.jsx)(`path`,{d:`M8 11h6`}),(0,w.jsx)(`rect`,{x:`13`,y:`13`,width:`8`,height:`6`,rx:`1.5`}),(0,w.jsx)(`path`,{d:`m15.5 15.5 1.5 1.5 2-2`})]}),ollama:e=>(0,w.jsxs)(T,{...e,children:[(0,w.jsx)(`path`,{d:`M12 3a6 6 0 0 0-6 6c0 2 1 3 1 5v3a2 2 0 0 0 2 2h6a2 2 0 0 0 2-2v-3c0-2 1-3 1-5a6 6 0 0 0-6-6Z`}),(0,w.jsx)(`circle`,{cx:`10`,cy:`10`,r:`0.6`,fill:`currentColor`}),(0,w.jsx)(`circle`,{cx:`14`,cy:`10`,r:`0.6`,fill:`currentColor`}),(0,w.jsx)(`path`,{d:`M10 16h4`})]}),openclaw:e=>(0,w.jsxs)(T,{...e,children:[(0,w.jsx)(`circle`,{cx:`12`,cy:`9`,r:`4`}),(0,w.jsx)(`path`,{d:`M8 9c-2 0-4 1.5-4 4M16 9c2 0 4 1.5 4 4`}),(0,w.jsx)(`path`,{d:`M9 13v3a3 3 0 0 0 6 0v-3`}),(0,w.jsx)(`path`,{d:`m9 6 1 1M14 7l1-1`})]}),openwebui:e=>(0,w.jsxs)(T,{...e,children:[(0,w.jsx)(`rect`,{x:`3`,y:`4`,width:`18`,height:`13`,rx:`2`}),(0,w.jsx)(`path`,{d:`M8 11h2M14 11h2`}),(0,w.jsx)(`path`,{d:`m12 17-3 4h6Z`})]}),hermes:e=>(0,w.jsxs)(T,{...e,children:[(0,w.jsx)(`path`,{d:`M12 3 4 19h16Z`}),(0,w.jsx)(`circle`,{cx:`12`,cy:`13`,r:`2.5`})]}),sparkle:e=>(0,w.jsx)(T,{...e,children:(0,w.jsx)(`path`,{d:`M12 3v4M12 17v4M3 12h4M17 12h4M6 6l2.5 2.5M15.5 15.5 18 18M6 18l2.5-2.5M15.5 8.5 18 6`})}),store:e=>(0,w.jsxs)(T,{...e,children:[(0,w.jsx)(`path`,{d:`M3 8 5 4h14l2 4`}),(0,w.jsx)(`path`,{d:`M3 8v11a1 1 0 0 0 1 1h16a1 1 0 0 0 1-1V8`}),(0,w.jsx)(`path`,{d:`M3 8c0 2 1.5 3 3 3s3-1 3-3c0 2 1.5 3 3 3s3-1 3-3c0 2 1.5 3 3 3s3-1 3-3`}),(0,w.jsx)(`path`,{d:`M9 20v-6h6v6`})]}),tag:e=>(0,w.jsxs)(T,{...e,children:[(0,w.jsx)(`path`,{d:`M20 12 12 20l-9-9V3h8Z`}),(0,w.jsx)(`circle`,{cx:`7.5`,cy:`7.5`,r:`1.2`,fill:`currentColor`})]}),rocket:e=>(0,w.jsxs)(T,{...e,children:[(0,w.jsx)(`path`,{d:`M14 4.5C18 5 19 9 19 13l-4 1-4 4-3-3 4-4 1-4c0-2 1-2 2-2.5Z`}),(0,w.jsx)(`path`,{d:`m12 14-3 3a3 3 0 1 0 4 3`}),(0,w.jsx)(`path`,{d:`M9 11 5 9l2-2 4 1`})]}),filter:e=>(0,w.jsx)(T,{...e,children:(0,w.jsx)(`path`,{d:`M3 5h18l-7 9v6l-4-2v-4Z`})}),send:e=>(0,w.jsx)(T,{...e,children:(0,w.jsx)(`path`,{d:`m3 11 18-8-8 18-2-8Z`})}),plus:e=>(0,w.jsx)(T,{...e,children:(0,w.jsx)(`path`,{d:`M12 5v14M5 12h14`})}),copy:e=>(0,w.jsxs)(T,{...e,children:[(0,w.jsx)(`rect`,{x:`9`,y:`9`,width:`12`,height:`12`,rx:`2`}),(0,w.jsx)(`path`,{d:`M5 15V5a1 1 0 0 1 1-1h10`})]}),book:e=>(0,w.jsxs)(T,{...e,children:[(0,w.jsx)(`path`,{d:`M4 4v15a2 2 0 0 0 2 2h13V3H6a2 2 0 0 0-2 2Z`}),(0,w.jsx)(`path`,{d:`M19 17H6a2 2 0 0 0-2 2`})]}),message:e=>(0,w.jsx)(T,{...e,children:(0,w.jsx)(`path`,{d:`M21 12a8 8 0 0 1-13 6.3L3 20l1.7-5A8 8 0 1 1 21 12Z`})}),mic:e=>(0,w.jsxs)(T,{...e,children:[(0,w.jsx)(`rect`,{x:`9`,y:`3`,width:`6`,height:`13`,rx:`3`}),(0,w.jsx)(`path`,{d:`M5 11a7 7 0 0 0 14 0`}),(0,w.jsx)(`path`,{d:`M12 18v3`})]}),attach:e=>(0,w.jsx)(T,{...e,children:(0,w.jsx)(`path`,{d:`m21 11-9 9a5 5 0 0 1-7-7l9-9a3.5 3.5 0 0 1 5 5l-9 9a2 2 0 0 1-3-3l8-8`})}),chevLeft:e=>(0,w.jsx)(T,{...e,children:(0,w.jsx)(`path`,{d:`m15 6-6 6 6 6`})}),star:e=>(0,w.jsx)(T,{...e,children:(0,w.jsx)(`path`,{d:`M12 2 15 9l7 .6-5.3 4.6 1.6 6.8L12 17.3 5.7 21l1.6-6.8L2 9.6 9 9z`})}),external:e=>(0,w.jsxs)(T,{...e,children:[(0,w.jsx)(`path`,{d:`M15 3h6v6`}),(0,w.jsx)(`path`,{d:`M21 3 10 14`}),(0,w.jsx)(`path`,{d:`M21 14v6a1 1 0 0 1-1 1H4a1 1 0 0 1-1-1V4a1 1 0 0 1 1-1h6`})]}),thumbs:e=>(0,w.jsxs)(T,{...e,children:[(0,w.jsx)(`path`,{d:`M7 22V10l5-7a2 2 0 0 1 2 2v6h6a2 2 0 0 1 2 2l-2 7a2 2 0 0 1-2 1H7Z`}),(0,w.jsx)(`path`,{d:`M7 22H3V10h4`})]}),globe:e=>(0,w.jsxs)(T,{...e,children:[(0,w.jsx)(`circle`,{cx:`12`,cy:`12`,r:`9`}),(0,w.jsx)(`path`,{d:`M3 12h18`}),(0,w.jsx)(`path`,{d:`M12 3a14 14 0 0 1 0 18M12 3a14 14 0 0 0 0 18`})]}),flame:e=>(0,w.jsx)(T,{...e,children:(0,w.jsx)(`path`,{d:`M14 4c0 4-4 5-4 9a2 2 0 1 0 4 0 4 4 0 0 1 4-4c0 4-4 6-4 9a5 5 0 1 1-10 0c0-6 6-7 4-14 4 0 6 4 6 0Z`})}),x:e=>(0,w.jsx)(T,{...e,children:(0,w.jsx)(`path`,{d:`M18 6 6 18M6 6l12 12`})}),minus:e=>(0,w.jsx)(T,{...e,children:(0,w.jsx)(`path`,{d:`M5 12h14`})}),maximize:e=>(0,w.jsx)(T,{...e,children:(0,w.jsx)(`rect`,{x:`4`,y:`4`,width:`16`,height:`16`,rx:`2`})}),restore:e=>(0,w.jsxs)(T,{...e,children:[(0,w.jsx)(`rect`,{x:`7`,y:`7`,width:`13`,height:`13`,rx:`2`}),(0,w.jsx)(`path`,{d:`M4 16V5a1 1 0 0 1 1-1h11`})]}),cpu:e=>(0,w.jsxs)(T,{...e,children:[(0,w.jsx)(`rect`,{x:`5`,y:`5`,width:`14`,height:`14`,rx:`2`}),(0,w.jsx)(`rect`,{x:`9`,y:`9`,width:`6`,height:`6`}),(0,w.jsx)(`path`,{d:`M9 1v3M15 1v3M9 20v3M15 20v3M1 9h3M1 15h3M20 9h3M20 15h3`})]}),hardDrive:e=>(0,w.jsxs)(T,{...e,children:[(0,w.jsx)(`rect`,{x:`3`,y:`13`,width:`18`,height:`8`,rx:`2`}),(0,w.jsx)(`path`,{d:`M3 13 6 4a2 2 0 0 1 2-1h8a2 2 0 0 1 2 1l3 9`}),(0,w.jsx)(`circle`,{cx:`7`,cy:`17`,r:`0.6`,fill:`currentColor`})]}),memory:e=>(0,w.jsxs)(T,{...e,children:[(0,w.jsx)(`rect`,{x:`2`,y:`7`,width:`20`,height:`10`,rx:`2`}),(0,w.jsx)(`path`,{d:`M6 11v2M10 11v2M14 11v2M18 11v2`}),(0,w.jsx)(`path`,{d:`M2 17v2M22 17v2`})]}),thermo:e=>(0,w.jsx)(T,{...e,children:(0,w.jsx)(`path`,{d:`M14 14.8V4a2 2 0 1 0-4 0v10.8a4 4 0 1 0 4 0Z`})}),bolt:e=>(0,w.jsx)(T,{...e,children:(0,w.jsx)(`path`,{d:`M13 2 3 14h7l-1 8 10-12h-7l1-8Z`})}),refresh:e=>(0,w.jsxs)(T,{...e,children:[(0,w.jsx)(`path`,{d:`M3 12a9 9 0 0 1 15-6.7L21 8`}),(0,w.jsx)(`path`,{d:`M21 3v5h-5`}),(0,w.jsx)(`path`,{d:`M21 12a9 9 0 0 1-15 6.7L3 16`}),(0,w.jsx)(`path`,{d:`M3 21v-5h5`})]}),stop:e=>(0,w.jsx)(T,{...e,children:(0,w.jsx)(`rect`,{x:`6`,y:`6`,width:`12`,height:`12`,rx:`1.5`})}),play:e=>(0,w.jsx)(T,{...e,children:(0,w.jsx)(`path`,{d:`M6 4v16l14-8Z`})}),chevDown:e=>(0,w.jsx)(T,{...e,children:(0,w.jsx)(`path`,{d:`m6 9 6 6 6-6`})}),chevRight:e=>(0,w.jsx)(T,{...e,children:(0,w.jsx)(`path`,{d:`m9 6 6 6-6 6`})}),cloud:e=>(0,w.jsx)(T,{...e,children:(0,w.jsx)(`path`,{d:`M17.5 19a4.5 4.5 0 0 0 .5-9 6 6 0 0 0-11.6 1.4A4 4 0 0 0 6.5 19Z`})}),cloudOff:e=>(0,w.jsxs)(T,{...e,children:[(0,w.jsx)(`path`,{d:`M2 2 22 22`}),(0,w.jsx)(`path`,{d:`M17.5 19a4.5 4.5 0 0 0 .5-9 6 6 0 0 0-9.6-2.4`}),(0,w.jsx)(`path`,{d:`M6.5 19a4 4 0 0 1-.6-7.6`})]}),check:e=>(0,w.jsx)(T,{...e,children:(0,w.jsx)(`path`,{d:`m5 12 5 5 9-11`})}),alertTri:e=>(0,w.jsxs)(T,{...e,children:[(0,w.jsx)(`path`,{d:`m10.3 3.9-8 14a2 2 0 0 0 1.7 3h16a2 2 0 0 0 1.7-3l-8-14a2 2 0 0 0-3.4 0Z`}),(0,w.jsx)(`path`,{d:`M12 9v4`}),(0,w.jsx)(`circle`,{cx:`12`,cy:`17`,r:`0.6`,fill:`currentColor`})]}),info:e=>(0,w.jsxs)(T,{...e,children:[(0,w.jsx)(`circle`,{cx:`12`,cy:`12`,r:`9`}),(0,w.jsx)(`path`,{d:`M12 16v-4`}),(0,w.jsx)(`circle`,{cx:`12`,cy:`8.5`,r:`0.6`,fill:`currentColor`})]}),search:e=>(0,w.jsxs)(T,{...e,children:[(0,w.jsx)(`circle`,{cx:`11`,cy:`11`,r:`7`}),(0,w.jsx)(`path`,{d:`m20 20-3.5-3.5`})]}),user:e=>(0,w.jsxs)(T,{...e,children:[(0,w.jsx)(`circle`,{cx:`12`,cy:`8`,r:`4`}),(0,w.jsx)(`path`,{d:`M4 21a8 8 0 0 1 16 0`})]}),terminal:e=>(0,w.jsxs)(T,{...e,children:[(0,w.jsx)(`path`,{d:`m4 7 5 5-5 5`}),(0,w.jsx)(`path`,{d:`M12 19h8`})]}),network:e=>(0,w.jsxs)(T,{...e,children:[(0,w.jsx)(`circle`,{cx:`12`,cy:`12`,r:`9`}),(0,w.jsx)(`path`,{d:`M3 12h18`}),(0,w.jsx)(`path`,{d:`M12 3a14 14 0 0 1 0 18M12 3a14 14 0 0 0 0 18`})]}),download:e=>(0,w.jsxs)(T,{...e,children:[(0,w.jsx)(`path`,{d:`M12 3v12`}),(0,w.jsx)(`path`,{d:`m7 10 5 5 5-5`}),(0,w.jsx)(`path`,{d:`M5 21h14`})]}),expand:e=>(0,w.jsx)(T,{...e,children:(0,w.jsx)(`path`,{d:`M3 9V3h6M21 9V3h-6M3 15v6h6M21 15v6h-6`})}),dot:e=>(0,w.jsx)(T,{...e,children:(0,w.jsx)(`circle`,{cx:`12`,cy:`12`,r:`4`,fill:`currentColor`})}),arrowUp:e=>(0,w.jsx)(T,{...e,children:(0,w.jsx)(`path`,{d:`M12 19V5M5 12l7-7 7 7`})}),arrowDown:e=>(0,w.jsx)(T,{...e,children:(0,w.jsx)(`path`,{d:`M12 5v14M19 12l-7 7-7-7`})}),badge:e=>(0,w.jsx)(T,{...e,children:(0,w.jsx)(`path`,{d:`M12 2 4 6v6c0 5 3.5 8.5 8 10 4.5-1.5 8-5 8-10V6Z`})}),history:e=>(0,w.jsxs)(T,{...e,children:[(0,w.jsx)(`path`,{d:`M3 12a9 9 0 1 0 3-6.7L3 8`}),(0,w.jsx)(`path`,{d:`M3 3v5h5`}),(0,w.jsx)(`path`,{d:`M12 7v5l3 2`})]}),power:e=>(0,w.jsxs)(T,{...e,children:[(0,w.jsx)(`path`,{d:`M12 3v9`}),(0,w.jsx)(`path`,{d:`M18.4 6.6a9 9 0 1 1-12.8 0`})]}),qrcode:e=>(0,w.jsxs)(T,{...e,children:[(0,w.jsx)(`rect`,{x:`3`,y:`3`,width:`7`,height:`7`,rx:`1`}),(0,w.jsx)(`rect`,{x:`14`,y:`3`,width:`7`,height:`7`,rx:`1`}),(0,w.jsx)(`rect`,{x:`3`,y:`14`,width:`7`,height:`7`,rx:`1`}),(0,w.jsx)(`path`,{d:`M14 14h3v3M20 14v3M14 20h3M20 20h1`})]}),calendar:e=>(0,w.jsxs)(T,{...e,children:[(0,w.jsx)(`rect`,{x:`3`,y:`4`,width:`18`,height:`17`,rx:`2`}),(0,w.jsx)(`path`,{d:`M16 2v4M8 2v4M3 9h18`})]}),clock:e=>(0,w.jsxs)(T,{...e,children:[(0,w.jsx)(`circle`,{cx:`12`,cy:`12`,r:`9`}),(0,w.jsx)(`path`,{d:`M12 6v6l4 2`})]}),upload:e=>(0,w.jsxs)(T,{...e,children:[(0,w.jsx)(`path`,{d:`M12 15V3`}),(0,w.jsx)(`path`,{d:`m7 8 5-5 5 5`}),(0,w.jsx)(`path`,{d:`M5 21h14`})]}),trash:e=>(0,w.jsxs)(T,{...e,children:[(0,w.jsx)(`path`,{d:`M4 7h16`}),(0,w.jsx)(`path`,{d:`M6 7v12a2 2 0 0 0 2 2h8a2 2 0 0 0 2-2V7`}),(0,w.jsx)(`path`,{d:`M9 7V4a1 1 0 0 1 1-1h4a1 1 0 0 1 1 1v3`})]}),edit:e=>(0,w.jsx)(T,{...e,children:(0,w.jsx)(`path`,{d:`M17 3a2.8 2.8 0 1 1 4 4L8 20l-5 1 1-5Z`})}),file:e=>(0,w.jsxs)(T,{...e,children:[(0,w.jsx)(`path`,{d:`M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8Z`}),(0,w.jsx)(`path`,{d:`M14 2v6h6`})]}),image:e=>(0,w.jsxs)(T,{...e,children:[(0,w.jsx)(`rect`,{x:`3`,y:`3`,width:`18`,height:`18`,rx:`2`}),(0,w.jsx)(`circle`,{cx:`8.5`,cy:`8.5`,r:`1.5`}),(0,w.jsx)(`path`,{d:`m21 15-5-5L5 21`})]}),wifi:e=>(0,w.jsxs)(T,{...e,children:[(0,w.jsx)(`path`,{d:`M5 12.6a14 14 0 0 1 14 0`}),(0,w.jsx)(`path`,{d:`M8.5 16.1a7 7 0 0 1 7 0`}),(0,w.jsx)(`circle`,{cx:`12`,cy:`20`,r:`0.6`,fill:`currentColor`})]}),log:e=>(0,w.jsx)(T,{...e,children:(0,w.jsx)(`path`,{d:`M4 6h16M4 10h16M4 14h10M4 18h6`})}),key:e=>(0,w.jsxs)(T,{...e,children:[(0,w.jsx)(`circle`,{cx:`8`,cy:`15`,r:`4`}),(0,w.jsx)(`path`,{d:`m14.7 7.3 4-4 2 2-4 4M14.7 7.3l-3.4 3.4`})]}),chart:e=>(0,w.jsx)(T,{...e,children:(0,w.jsx)(`path`,{d:`M3 21 9 9l4 6 4-8 4 6`})}),gpu:e=>(0,w.jsxs)(T,{...e,children:[(0,w.jsx)(`rect`,{x:`2`,y:`6`,width:`20`,height:`12`,rx:`2`}),(0,w.jsx)(`path`,{d:`M6 10h2v4H6zM10 10h2v4h-2zM14 10h2v4h-2z`}),(0,w.jsx)(`path`,{d:`M6 6V4M10 6V4M14 6V4M18 6V4M6 18v2M10 18v2M14 18v2M18 18v2`})]}),layers:e=>(0,w.jsxs)(T,{...e,children:[(0,w.jsx)(`path`,{d:`m12 2-9 5 9 5 9-5Z`}),(0,w.jsx)(`path`,{d:`m3 12 9 5 9-5`}),(0,w.jsx)(`path`,{d:`m3 17 9 5 9-5`})]}),server:e=>(0,w.jsxs)(T,{...e,children:[(0,w.jsx)(`rect`,{x:`3`,y:`3`,width:`18`,height:`6`,rx:`2`}),(0,w.jsx)(`rect`,{x:`3`,y:`15`,width:`18`,height:`6`,rx:`2`}),(0,w.jsx)(`circle`,{cx:`7`,cy:`6`,r:`0.6`,fill:`currentColor`}),(0,w.jsx)(`circle`,{cx:`7`,cy:`18`,r:`0.6`,fill:`currentColor`})]}),link:e=>(0,w.jsxs)(T,{...e,children:[(0,w.jsx)(`path`,{d:`M10 14a3.5 3.5 0 0 0 5 0l3-3a3.5 3.5 0 0 0-5-5l-1 1`}),(0,w.jsx)(`path`,{d:`M14 10a3.5 3.5 0 0 0-5 0l-3 3a3.5 3.5 0 0 0 5 5l1-1`})]}),pin:e=>(0,w.jsxs)(T,{...e,children:[(0,w.jsx)(`path`,{d:`m15 4.5-4 7.5-1 1L4.5 9.5l1-1L13 4.5a2 2 0 0 1 2 0Z`}),(0,w.jsx)(`path`,{d:`M9 15 4 20`})]}),minio:e=>(0,w.jsxs)(T,{...e,children:[(0,w.jsx)(`ellipse`,{cx:`12`,cy:`6`,rx:`8`,ry:`3`}),(0,w.jsx)(`path`,{d:`M4 6v6c0 1.7 3.6 3 8 3s8-1.3 8-3V6`}),(0,w.jsx)(`path`,{d:`M4 12v6c0 1.7 3.6 3 8 3s8-1.3 8-3v-6`})]}),swap:e=>(0,w.jsxs)(T,{...e,children:[(0,w.jsx)(`path`,{d:`m7 3-4 4 4 4`}),(0,w.jsx)(`path`,{d:`M3 7h14M17 21l4-4-4-4`}),(0,w.jsx)(`path`,{d:`M21 17H7`})]}),trendUp:e=>(0,w.jsxs)(T,{...e,children:[(0,w.jsx)(`path`,{d:`m23 6-9.5 9.5-5-5L1 18`}),(0,w.jsx)(`path`,{d:`M17 6h6v6`})]}),logout:e=>(0,w.jsxs)(T,{...e,children:[(0,w.jsx)(`path`,{d:`M9 21H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h4`}),(0,w.jsx)(`path`,{d:`m16 17 5-5-5-5`}),(0,w.jsx)(`path`,{d:`M21 12H9`})]}),sidebar:e=>(0,w.jsxs)(T,{...e,children:[(0,w.jsx)(`rect`,{x:`3`,y:`3`,width:`18`,height:`18`,rx:`2`}),(0,w.jsx)(`path`,{d:`M9 3v18`})]})},D=({name:e,size:t=16,stroke:n=1.7,style:r})=>{let i=E[e];return i?(0,w.jsx)(i,{size:t,stroke:n,style:r}):null},O=(0,b.createContext)({});function k(e){let t=(0,b.useRef)(null);return t.current===null&&(t.current=e()),t.current}var A=typeof window<`u`?b.useLayoutEffect:b.useEffect,j=(0,b.createContext)(null);function ee(e,t){e.indexOf(t)===-1&&e.push(t)}function M(e,t){let n=e.indexOf(t);n>-1&&e.splice(n,1)}var N=(e,t,n)=>n>t?t:n/^-?(?:\d+(?:\.\d+)?|\.\d+)$/u.test(e),I=e=>typeof e==`object`&&!!e,te=e=>/^0[^.\s]+$/u.test(e);function ne(e){let t;return()=>(t===void 0&&(t=e()),t)}var re=e=>e,L=(...e)=>e.reduce((e,t)=>n=>t(e(n))),R=(e,t,n)=>{let r=t-e;return r?(n-e)/r:1},z=class{constructor(){this.subscriptions=[]}add(e){return ee(this.subscriptions,e),()=>M(this.subscriptions,e)}notify(e,t,n){let r=this.subscriptions.length;if(r)if(r===1)this.subscriptions[0](e,t,n);else for(let i=0;ie*1e3,ie=e=>e/1e3,ae=(e,t)=>t?1e3/t*e:0,oe=(e,t,n)=>(((1-3*n+3*t)*e+(3*n-6*t))*e+3*t)*e,se=1e-7,ce=12;function le(e,t,n,r,i){let a,o,s=0;do o=t+(n-t)/2,a=oe(o,r,i)-e,a>0?n=o:t=o;while(Math.abs(a)>se&&++sle(t,0,1,e,n);return e=>e===0||e===1?e:oe(i(e),t,r)}var de=e=>t=>t<=.5?e(2*t)/2:(2-e(2*(1-t)))/2,fe=e=>t=>1-e(1-t),pe=ue(.33,1.53,.69,.99),me=fe(pe),he=de(me),ge=e=>e>=1?1:(e*=2)<1?.5*me(e):.5*(2-2**(-10*(e-1))),_e=e=>1-Math.sin(Math.acos(e)),ve=fe(_e),ye=de(_e),be=ue(.42,0,1,1),xe=ue(0,0,.58,1),Se=ue(.42,0,.58,1),Ce=e=>Array.isArray(e)&&typeof e[0]!=`number`,we=e=>Array.isArray(e)&&typeof e[0]==`number`,Te={linear:re,easeIn:be,easeInOut:Se,easeOut:xe,circIn:_e,circInOut:ye,circOut:ve,backIn:me,backInOut:he,backOut:pe,anticipate:ge},Ee=e=>typeof e==`string`,De=e=>{if(we(e)){e.length;let[t,n,r,i]=e;return ue(t,n,r,i)}else if(Ee(e))return Te[e],`${e}`,Te[e];return e},Oe=[`setup`,`read`,`resolveKeyframes`,`preUpdate`,`update`,`preRender`,`render`,`postRender`];function ke(e){let t=new Set,n=new Set,r=!1,i=!1,a=new WeakSet,o={delta:0,timestamp:0,isProcessing:!1};function s(t){a.has(t)&&(c.schedule(t),e()),t(o)}let c={schedule:(e,i=!1,o=!1)=>{let s=o&&r?t:n;return i&&a.add(e),s.add(e),e},cancel:e=>{n.delete(e),a.delete(e)},process:e=>{if(o=e,r){i=!0;return}r=!0;let a=t;t=n,n=a,t.forEach(s),t.clear(),r=!1,i&&(i=!1,c.process(e))}};return c}var Ae=40;function je(e,t){let n=!1,r=!0,i={delta:0,timestamp:0,isProcessing:!1},a=()=>n=!0,o=Oe.reduce((e,t)=>(e[t]=ke(a),e),{}),{setup:s,read:c,resolveKeyframes:l,preUpdate:u,update:d,preRender:f,render:p,postRender:m}=o,h=()=>{let a=P.useManualTiming,o=a?i.timestamp:performance.now();n=!1,a||(i.delta=r?1e3/60:Math.max(Math.min(o-i.timestamp,Ae),1)),i.timestamp=o,i.isProcessing=!0,s.process(i),c.process(i),l.process(i),u.process(i),d.process(i),f.process(i),p.process(i),m.process(i),i.isProcessing=!1,n&&t&&(r=!1,e(h))},g=()=>{n=!0,r=!0,i.isProcessing||e(h)};return{schedule:Oe.reduce((e,t)=>{let r=o[t];return e[t]=(e,t=!1,i=!1)=>(n||g(),r.schedule(e,t,i)),e},{}),cancel:e=>{for(let t=0;t(Fe===void 0&&Le.set(Ne.isProcessing||P.useManualTiming?Ne.timestamp:performance.now()),Fe),set:e=>{Fe=e,queueMicrotask(Ie)}},Re=e=>t=>typeof t==`string`&&t.startsWith(e),ze=Re(`--`),Be=Re(`var(--`),Ve=e=>Be(e)?He.test(e.split(`/*`)[0].trim()):!1,He=/var\(--(?:[\w-]+\s*|[\w-]+\s*,(?:\s*[^)(\s]|\s*\((?:[^)(]|\([^)(]*\))*\))+\s*)\)$/iu;function Ue(e){return typeof e==`string`?e.split(`/*`)[0].includes(`var(--`):!1}var We={test:e=>typeof e==`number`,parse:parseFloat,transform:e=>e},Ge={...We,transform:e=>N(0,1,e)},Ke={...We,default:1},qe=e=>Math.round(e*1e5)/1e5,Je=/-?(?:\d+(?:\.\d+)?|\.\d+)/gu;function Ye(e){return e==null}var Xe=/^(?:#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\))$/iu,Ze=(e,t)=>n=>!!(typeof n==`string`&&Xe.test(n)&&n.startsWith(e)||t&&!Ye(n)&&Object.prototype.hasOwnProperty.call(n,t)),Qe=(e,t,n)=>r=>{if(typeof r!=`string`)return r;let[i,a,o,s]=r.match(Je);return{[e]:parseFloat(i),[t]:parseFloat(a),[n]:parseFloat(o),alpha:s===void 0?1:parseFloat(s)}},$e=e=>N(0,255,e),et={...We,transform:e=>Math.round($e(e))},tt={test:Ze(`rgb`,`red`),parse:Qe(`red`,`green`,`blue`),transform:({red:e,green:t,blue:n,alpha:r=1})=>`rgba(`+et.transform(e)+`, `+et.transform(t)+`, `+et.transform(n)+`, `+qe(Ge.transform(r))+`)`};function nt(e){let t=``,n=``,r=``,i=``;return e.length>5?(t=e.substring(1,3),n=e.substring(3,5),r=e.substring(5,7),i=e.substring(7,9)):(t=e.substring(1,2),n=e.substring(2,3),r=e.substring(3,4),i=e.substring(4,5),t+=t,n+=n,r+=r,i+=i),{red:parseInt(t,16),green:parseInt(n,16),blue:parseInt(r,16),alpha:i?parseInt(i,16)/255:1}}var rt={test:Ze(`#`),parse:nt,transform:tt.transform},it=e=>({test:t=>typeof t==`string`&&t.endsWith(e)&&t.split(` `).length===1,parse:parseFloat,transform:t=>`${t}${e}`}),at=it(`deg`),ot=it(`%`),H=it(`px`),st=it(`vh`),ct=it(`vw`),lt={...ot,parse:e=>ot.parse(e)/100,transform:e=>ot.transform(e*100)},ut={test:Ze(`hsl`,`hue`),parse:Qe(`hue`,`saturation`,`lightness`),transform:({hue:e,saturation:t,lightness:n,alpha:r=1})=>`hsla(`+Math.round(e)+`, `+ot.transform(qe(t))+`, `+ot.transform(qe(n))+`, `+qe(Ge.transform(r))+`)`},dt={test:e=>tt.test(e)||rt.test(e)||ut.test(e),parse:e=>tt.test(e)?tt.parse(e):ut.test(e)?ut.parse(e):rt.parse(e),transform:e=>typeof e==`string`?e:e.hasOwnProperty(`red`)?tt.transform(e):ut.transform(e),getAnimatableNone:e=>{let t=dt.parse(e);return t.alpha=0,dt.transform(t)}},ft=/(?:#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\))/giu;function pt(e){return isNaN(e)&&typeof e==`string`&&(e.match(Je)?.length||0)+(e.match(ft)?.length||0)>0}var mt=`number`,ht=`color`,gt=`var`,_t=`var(`,vt="${}",yt=/var\s*\(\s*--(?:[\w-]+\s*|[\w-]+\s*,(?:\s*[^)(\s]|\s*\((?:[^)(]|\([^)(]*\))*\))+\s*)\)|#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\)|-?(?:\d+(?:\.\d+)?|\.\d+)/giu;function bt(e){let t=e.toString(),n=[],r={color:[],number:[],var:[]},i=[],a=0;return{values:n,split:t.replace(yt,e=>(dt.test(e)?(r.color.push(a),i.push(ht),n.push(dt.parse(e))):e.startsWith(_t)?(r.var.push(a),i.push(gt),n.push(e)):(r.number.push(a),i.push(mt),n.push(parseFloat(e))),++a,vt)).split(vt),indexes:r,types:i}}function xt(e){return bt(e).values}function St({split:e,types:t}){let n=e.length;return r=>{let i=``;for(let a=0;atypeof e==`number`?0:dt.test(e)?dt.getAnimatableNone(e):e,Tt=(e,t)=>typeof e==`number`?t?.trim().endsWith(`/`)?e:0:wt(e);function Et(e){let t=bt(e);return St(t)(t.values.map((e,n)=>Tt(e,t.split[n])))}var Dt={test:pt,parse:xt,createTransformer:Ct,getAnimatableNone:Et};function Ot(e,t,n){return n<0&&(n+=1),n>1&&--n,n<1/6?e+(t-e)*6*n:n<1/2?t:n<2/3?e+(t-e)*(2/3-n)*6:e}function kt({hue:e,saturation:t,lightness:n,alpha:r}){e/=360,t/=100,n/=100;let i=0,a=0,o=0;if(!t)i=a=o=n;else{let r=n<.5?n*(1+t):n+t-n*t,s=2*n-r;i=Ot(s,r,e+1/3),a=Ot(s,r,e),o=Ot(s,r,e-1/3)}return{red:Math.round(i*255),green:Math.round(a*255),blue:Math.round(o*255),alpha:r}}function At(e,t){return n=>n>0?t:e}var jt=(e,t,n)=>e+(t-e)*n,Mt=(e,t,n)=>{let r=e*e,i=n*(t*t-r)+r;return i<0?0:Math.sqrt(i)},Nt=[rt,tt,ut],Pt=e=>Nt.find(t=>t.test(e));function Ft(e){let t=Pt(e);if(`${e}`,!t)return!1;let n=t.parse(e);return t===ut&&(n=kt(n)),n}var It=(e,t)=>{let n=Ft(e),r=Ft(t);if(!n||!r)return At(e,t);let i={...n};return e=>(i.red=Mt(n.red,r.red,e),i.green=Mt(n.green,r.green,e),i.blue=Mt(n.blue,r.blue,e),i.alpha=jt(n.alpha,r.alpha,e),tt.transform(i))},Lt=new Set([`none`,`hidden`]);function Rt(e,t){return Lt.has(e)?n=>n<=0?e:t:n=>n>=1?t:e}function zt(e,t){return n=>jt(e,t,n)}function Bt(e){return typeof e==`number`?zt:typeof e==`string`?Ve(e)?At:dt.test(e)?It:Wt:Array.isArray(e)?Vt:typeof e==`object`?dt.test(e)?It:Ht:At}function Vt(e,t){let n=[...e],r=n.length,i=e.map((e,n)=>Bt(e)(e,t[n]));return e=>{for(let t=0;t{for(let t in r)n[t]=r[t](e);return n}}function Ut(e,t){let n=[],r={color:0,var:0,number:0};for(let i=0;i{let n=Dt.createTransformer(t),r=bt(e),i=bt(t);return r.indexes.var.length===i.indexes.var.length&&r.indexes.color.length===i.indexes.color.length&&r.indexes.number.length>=i.indexes.number.length?Lt.has(e)&&!i.values.length||Lt.has(t)&&!r.values.length?Rt(e,t):L(Vt(Ut(r,i),i.values),n):(`${e}${t}`,At(e,t))};function Gt(e,t,n){return typeof e==`number`&&typeof t==`number`&&typeof n==`number`?jt(e,t,n):Bt(e)(e,t)}var Kt=e=>{let t=({timestamp:t})=>e(t);return{start:(e=!0)=>V.update(t,e),stop:()=>Me(t),now:()=>Ne.isProcessing?Ne.timestamp:Le.now()}},qt=(e,t,n=10)=>{let r=``,i=Math.max(Math.round(t/n),2);for(let t=0;t=2e4?1/0:t}function Xt(e,t=100,n){let r=n({...e,keyframes:[0,t]}),i=Math.min(Yt(r),Jt);return{type:`keyframes`,ease:e=>r.next(i*e).value/t,duration:ie(i)}}var Zt={stiffness:100,damping:10,mass:1,velocity:0,duration:800,bounce:.3,visualDuration:.3,restSpeed:{granular:.01,default:2},restDelta:{granular:.005,default:.5},minDuration:.01,maxDuration:10,minDamping:.05,maxDamping:1};function Qt(e,t){return e*Math.sqrt(1-t*t)}var $t=12;function en(e,t,n){let r=n;for(let n=1;n<$t;n++)r-=e(r)/t(r);return r}var tn=.001;function nn({duration:e=Zt.duration,bounce:t=Zt.bounce,velocity:n=Zt.velocity,mass:r=Zt.mass}){let i,a;Zt.maxDuration;let o=1-t;o=N(Zt.minDamping,Zt.maxDamping,o),e=N(Zt.minDuration,Zt.maxDuration,ie(e)),o<1?(i=t=>{let r=t*o,i=r*e,a=r-n,s=Qt(t,o),c=Math.exp(-i);return tn-a/s*c},a=t=>{let r=t*o*e,a=r*n+n,s=o**2*t**2*e,c=Math.exp(-r),l=Qt(t**2,o);return(-i(t)+tn>0?-1:1)*((a-s)*c)/l}):(i=t=>-.001+Math.exp(-t*e)*((t-n)*e+1),a=t=>Math.exp(-t*e)*((n-t)*(e*e)));let s=5/e,c=en(i,a,s);if(e=B(e),isNaN(c))return{stiffness:Zt.stiffness,damping:Zt.damping,duration:e};{let t=c**2*r;return{stiffness:t,damping:o*2*Math.sqrt(r*t),duration:e}}}var rn=[`duration`,`bounce`],an=[`stiffness`,`damping`,`mass`];function on(e,t){return t.some(t=>e[t]!==void 0)}function sn(e){let t={velocity:Zt.velocity,stiffness:Zt.stiffness,damping:Zt.damping,mass:Zt.mass,isResolvedFromDuration:!1,...e};if(!on(e,an)&&on(e,rn))if(t.velocity=0,e.visualDuration){let n=e.visualDuration,r=2*Math.PI/(n*1.2),i=r*r,a=2*N(.05,1,1-(e.bounce||0))*Math.sqrt(i);t={...t,mass:Zt.mass,stiffness:i,damping:a}}else{let n=nn({...e,velocity:0});t={...t,...n,mass:Zt.mass},t.isResolvedFromDuration=!0}return t}function cn(e=Zt.visualDuration,t=Zt.bounce){let n=typeof e==`object`?e:{visualDuration:e,keyframes:[0,1],bounce:t},{restSpeed:r,restDelta:i}=n,a=n.keyframes[0],o=n.keyframes[n.keyframes.length-1],s={done:!1,value:a},{stiffness:c,damping:l,mass:u,duration:d,velocity:f,isResolvedFromDuration:p}=sn({...n,velocity:-ie(n.velocity||0)}),m=f||0,h=l/(2*Math.sqrt(c*u)),g=o-a,_=ie(Math.sqrt(c/u)),v=Math.abs(g)<5;r||=v?Zt.restSpeed.granular:Zt.restSpeed.default,i||=v?Zt.restDelta.granular:Zt.restDelta.default;let y,b,x,S,C,w;if(h<1)x=Qt(_,h),S=(m+h*_*g)/x,y=e=>o-Math.exp(-h*_*e)*(S*Math.sin(x*e)+g*Math.cos(x*e)),C=h*_*S+g*x,w=h*_*g-S*x,b=e=>Math.exp(-h*_*e)*(C*Math.sin(x*e)+w*Math.cos(x*e));else if(h===1){y=e=>o-Math.exp(-_*e)*(g+(m+_*g)*e);let e=m+_*g;b=t=>Math.exp(-_*t)*(_*e*t-m)}else{let e=_*Math.sqrt(h*h-1);y=t=>{let n=Math.exp(-h*_*t),r=Math.min(e*t,300);return o-n*((m+h*_*g)*Math.sinh(r)+e*g*Math.cosh(r))/e};let t=(m+h*_*g)/e,n=h*_*t-g*e,r=h*_*g-t*e;b=t=>{let i=Math.exp(-h*_*t),a=Math.min(e*t,300);return i*(n*Math.sinh(a)+r*Math.cosh(a))}}let T={calculatedDuration:p&&d||null,velocity:e=>B(b(e)),next:e=>{if(!p&&h<1){let t=Math.exp(-h*_*e),n=Math.sin(x*e),a=Math.cos(x*e),c=o-t*(S*n+g*a),l=B(t*(C*n+w*a));return s.done=Math.abs(l)<=r&&Math.abs(o-c)<=i,s.value=s.done?o:c,s}let t=y(e);if(p)s.done=e>=d;else{let n=B(b(e));s.done=Math.abs(n)<=r&&Math.abs(o-t)<=i}return s.value=s.done?o:t,s},toString:()=>{let e=Math.min(Yt(T),Jt),t=qt(t=>T.next(e*t).value,e,30);return e+`ms `+t},toTransition:()=>{}};return T}cn.applyToOptions=e=>{let t=Xt(e,100,cn);return e.ease=t.ease,e.duration=B(t.duration),e.type=`keyframes`,e};var ln=5;function un(e,t,n){let r=Math.max(t-ln,0);return ae(n-e(r),t-r)}function dn({keyframes:e,velocity:t=0,power:n=.8,timeConstant:r=325,bounceDamping:i=10,bounceStiffness:a=500,modifyTarget:o,min:s,max:c,restDelta:l=.5,restSpeed:u}){let d=e[0],f={done:!1,value:d},p=e=>s!==void 0&&ec,m=e=>s===void 0?c:c===void 0||Math.abs(s-e)-h*Math.exp(-e/r),y=e=>_+v(e),b=e=>{let t=v(e),n=y(e);f.done=Math.abs(t)<=l,f.value=f.done?_:n},x,S,C=e=>{p(f.value)&&(x=e,S=cn({keyframes:[f.value,m(f.value)],velocity:un(y,e,f.value),damping:i,stiffness:a,restDelta:l,restSpeed:u}))};return C(0),{calculatedDuration:null,next:e=>{let t=!1;return!S&&x===void 0&&(t=!0,b(e),C(e)),x!==void 0&&e>=x?S.next(e-x):(!t&&b(e),f)}}}function fn(e,t,n){let r=[],i=n||P.mix||Gt,a=e.length-1;for(let n=0;nt[0];if(a===2&&t[0]===t[1])return()=>t[1];let o=e[0]===e[1];e[0]>e[a-1]&&(e=[...e].reverse(),t=[...t].reverse());let s=fn(t,r,i),c=s.length,l=n=>{if(o&&n1)for(;rl(N(e[0],e[a-1],t)):l}function mn(e,t){let n=e[e.length-1];for(let r=1;r<=t;r++){let i=R(0,t,r);e.push(jt(n,1,i))}}function hn(e){let t=[0];return mn(t,e.length-1),t}function gn(e,t){return e.map(e=>e*t)}function _n(e,t){return e.map(()=>t||Se).splice(0,e.length-1)}function vn({duration:e=300,keyframes:t,times:n,ease:r=`easeInOut`}){let i=Ce(r)?r.map(De):De(r),a={done:!1,value:t[0]},o=pn(gn(n&&n.length===t.length?n:hn(t),e),t,{ease:Array.isArray(i)?i:_n(t,i)});return{calculatedDuration:e,next:t=>(a.value=o(t),a.done=t>=e,a)}}var yn=e=>e!==null;function bn(e,{repeat:t,repeatType:n=`loop`},r,i=1){let a=e.filter(yn),o=i<0||t&&n!==`loop`&&t%2==1?0:a.length-1;return!o||r===void 0?a[o]:r}var xn={decay:dn,inertia:dn,tween:vn,keyframes:vn,spring:cn};function Sn(e){typeof e.type==`string`&&(e.type=xn[e.type])}var Cn=class{constructor(){this.updateFinished()}get finished(){return this._finished}updateFinished(){this._finished=new Promise(e=>{this.resolve=e})}notifyFinished(){this.resolve()}then(e,t){return this.finished.then(e,t)}},wn=e=>e/100,Tn=class extends Cn{constructor(e){super(),this.state=`idle`,this.startTime=null,this.isStopped=!1,this.currentTime=0,this.holdTime=null,this.playbackSpeed=1,this.delayState={done:!1,value:void 0},this.stop=()=>{let{motionValue:e}=this.options;e&&e.updatedAt!==Le.now()&&this.tick(Le.now()),this.isStopped=!0,this.state!==`idle`&&(this.teardown(),this.options.onStop?.())},this.options=e,this.initAnimation(),this.play(),e.autoplay===!1&&this.pause()}initAnimation(){let{options:e}=this;Sn(e);let{type:t=vn,repeat:n=0,repeatDelay:r=0,repeatType:i,velocity:a=0}=e,{keyframes:o}=e,s=t||vn;s!==vn&&typeof o[0]!=`number`&&(this.mixKeyframes=L(wn,Gt(o[0],o[1])),o=[0,100]);let c=s({...e,keyframes:o});i===`mirror`&&(this.mirroredGenerator=s({...e,keyframes:[...o].reverse(),velocity:-a})),c.calculatedDuration===null&&(c.calculatedDuration=Yt(c));let{calculatedDuration:l}=c;this.calculatedDuration=l,this.resolvedDuration=l+r,this.totalDuration=this.resolvedDuration*(n+1)-r,this.generator=c}updateTime(e){let t=Math.round(e-this.startTime)*this.playbackSpeed;this.holdTime===null?this.currentTime=t:this.currentTime=this.holdTime}tick(e,t=!1){let{generator:n,totalDuration:r,mixKeyframes:i,mirroredGenerator:a,resolvedDuration:o,calculatedDuration:s}=this;if(this.startTime===null)return n.next(0);let{delay:c=0,keyframes:l,repeat:u,repeatType:d,repeatDelay:f,type:p,onUpdate:m,finalKeyframe:h}=this.options;this.speed>0?this.startTime=Math.min(this.startTime,e):this.speed<0&&(this.startTime=Math.min(e-r/this.speed,this.startTime)),t?this.currentTime=e:this.updateTime(e);let g=this.currentTime-c*(this.playbackSpeed>=0?1:-1),_=this.playbackSpeed>=0?g<0:g>r;this.currentTime=Math.max(g,0),this.state===`finished`&&this.holdTime===null&&(this.currentTime=r);let v=this.currentTime,y=n;if(u){let e=Math.min(this.currentTime,r)/o,t=Math.floor(e),n=e%1;!n&&e>=1&&(n=1),n===1&&t--,t=Math.min(t,u+1),t%2&&(d===`reverse`?(n=1-n,f&&(n-=f/o)):d===`mirror`&&(y=a)),v=N(0,1,n)*o}let b;_?(this.delayState.value=l[0],b=this.delayState):b=y.next(v),i&&!_&&(b.value=i(b.value));let{done:x}=b;!_&&s!==null&&(x=this.playbackSpeed>=0?this.currentTime>=r:this.currentTime<=0);let S=this.holdTime===null&&(this.state===`finished`||this.state===`running`&&x);return S&&p!==dn&&(b.value=bn(l,this.options,h,this.speed)),m&&m(b.value),S&&this.finish(),b}then(e,t){return this.finished.then(e,t)}get duration(){return ie(this.calculatedDuration)}get iterationDuration(){let{delay:e=0}=this.options||{};return this.duration+ie(e)}get time(){return ie(this.currentTime)}set time(e){e=B(e),this.currentTime=e,this.startTime===null||this.holdTime!==null||this.playbackSpeed===0?this.holdTime=e:this.driver&&(this.startTime=this.driver.now()-e/this.playbackSpeed),this.driver?this.driver.start(!1):(this.startTime=0,this.state=`paused`,this.holdTime=e,this.tick(e))}getGeneratorVelocity(){let e=this.currentTime;if(e<=0)return this.options.velocity||0;if(this.generator.velocity)return this.generator.velocity(e);let t=this.generator.next(e).value;return un(e=>this.generator.next(e).value,e,t)}get speed(){return this.playbackSpeed}set speed(e){let t=this.playbackSpeed!==e;t&&this.driver&&this.updateTime(Le.now()),this.playbackSpeed=e,t&&this.driver&&(this.time=ie(this.currentTime))}play(){if(this.isStopped)return;let{driver:e=Kt,startTime:t}=this.options;this.driver||=e(e=>this.tick(e)),this.options.onPlay?.();let n=this.driver.now();this.state===`finished`?(this.updateFinished(),this.startTime=n):this.holdTime===null?this.startTime||=t??n:this.startTime=n-this.holdTime,this.state===`finished`&&this.speed<0&&(this.startTime+=this.calculatedDuration),this.holdTime=null,this.state=`running`,this.driver.start()}pause(){this.state=`paused`,this.updateTime(Le.now()),this.holdTime=this.currentTime}complete(){this.state!==`running`&&this.play(),this.state=`finished`,this.holdTime=null}finish(){this.notifyFinished(),this.teardown(),this.state=`finished`,this.options.onComplete?.()}cancel(){this.holdTime=null,this.startTime=0,this.tick(0),this.teardown(),this.options.onCancel?.()}teardown(){this.state=`idle`,this.stopDriver(),this.startTime=this.holdTime=null}stopDriver(){this.driver&&=(this.driver.stop(),void 0)}sample(e){return this.startTime=0,this.tick(e,!0)}attachTimeline(e){return this.options.allowFlatten&&(this.options.type=`keyframes`,this.options.ease=`linear`,this.initAnimation()),this.driver?.stop(),e.observe(this)}};function En(e){for(let t=1;te*180/Math.PI,On=e=>An(Dn(Math.atan2(e[1],e[0]))),kn={x:4,y:5,translateX:4,translateY:5,scaleX:0,scaleY:3,scale:e=>(Math.abs(e[0])+Math.abs(e[3]))/2,rotate:On,rotateZ:On,skewX:e=>Dn(Math.atan(e[1])),skewY:e=>Dn(Math.atan(e[2])),skew:e=>(Math.abs(e[1])+Math.abs(e[2]))/2},An=e=>(e%=360,e<0&&(e+=360),e),jn=On,Mn=e=>Math.sqrt(e[0]*e[0]+e[1]*e[1]),Nn=e=>Math.sqrt(e[4]*e[4]+e[5]*e[5]),Pn={x:12,y:13,z:14,translateX:12,translateY:13,translateZ:14,scaleX:Mn,scaleY:Nn,scale:e=>(Mn(e)+Nn(e))/2,rotateX:e=>An(Dn(Math.atan2(e[6],e[5]))),rotateY:e=>An(Dn(Math.atan2(-e[2],e[0]))),rotateZ:jn,rotate:jn,skewX:e=>Dn(Math.atan(e[4])),skewY:e=>Dn(Math.atan(e[1])),skew:e=>(Math.abs(e[1])+Math.abs(e[4]))/2};function Fn(e){return+!!e.includes(`scale`)}function In(e,t){if(!e||e===`none`)return Fn(t);let n=e.match(/^matrix3d\(([-\d.e\s,]+)\)$/u),r,i;if(n)r=Pn,i=n;else{let t=e.match(/^matrix\(([-\d.e\s,]+)\)$/u);r=kn,i=t}if(!i)return Fn(t);let a=r[t],o=i[1].split(`,`).map(Rn);return typeof a==`function`?a(o):o[a]}var Ln=(e,t)=>{let{transform:n=`none`}=getComputedStyle(e);return In(n,t)};function Rn(e){return parseFloat(e.trim())}var zn=[`transformPerspective`,`x`,`y`,`z`,`translateX`,`translateY`,`translateZ`,`scale`,`scaleX`,`scaleY`,`rotate`,`rotateX`,`rotateY`,`rotateZ`,`skew`,`skewX`,`skewY`],Bn=new Set([...zn,`pathRotation`]),Vn=e=>e===We||e===H,Hn=new Set([`x`,`y`,`z`]),Un=zn.filter(e=>!Hn.has(e));function Wn(e){let t=[];return Un.forEach(n=>{let r=e.getValue(n);r!==void 0&&(t.push([n,r.get()]),r.set(+!!n.startsWith(`scale`)))}),t}var Gn={width:({x:e},{paddingLeft:t=`0`,paddingRight:n=`0`,boxSizing:r})=>{let i=e.max-e.min;return r===`border-box`?i:i-parseFloat(t)-parseFloat(n)},height:({y:e},{paddingTop:t=`0`,paddingBottom:n=`0`,boxSizing:r})=>{let i=e.max-e.min;return r===`border-box`?i:i-parseFloat(t)-parseFloat(n)},top:(e,{top:t})=>parseFloat(t),left:(e,{left:t})=>parseFloat(t),bottom:({y:e},{top:t})=>parseFloat(t)+(e.max-e.min),right:({x:e},{left:t})=>parseFloat(t)+(e.max-e.min),x:(e,{transform:t})=>In(t,`x`),y:(e,{transform:t})=>In(t,`y`)};Gn.translateX=Gn.x,Gn.translateY=Gn.y;var Kn=new Set,qn=!1,Jn=!1,Yn=!1;function Xn(){if(Jn){let e=Array.from(Kn).filter(e=>e.needsMeasurement),t=new Set(e.map(e=>e.element)),n=new Map;t.forEach(e=>{let t=Wn(e);t.length&&(n.set(e,t),e.render())}),e.forEach(e=>e.measureInitialState()),t.forEach(e=>{e.render();let t=n.get(e);t&&t.forEach(([t,n])=>{e.getValue(t)?.set(n)})}),e.forEach(e=>e.measureEndState()),e.forEach(e=>{e.suspendedScrollY!==void 0&&window.scrollTo(0,e.suspendedScrollY)})}Jn=!1,qn=!1,Kn.forEach(e=>e.complete(Yn)),Kn.clear()}function Zn(){Kn.forEach(e=>{e.readKeyframes(),e.needsMeasurement&&(Jn=!0)})}function Qn(){Yn=!0,Zn(),Xn(),Yn=!1}var $n=class{constructor(e,t,n,r,i,a=!1){this.state=`pending`,this.isAsync=!1,this.needsMeasurement=!1,this.unresolvedKeyframes=[...e],this.onComplete=t,this.name=n,this.motionValue=r,this.element=i,this.isAsync=a}scheduleResolve(){this.state=`scheduled`,this.isAsync?(Kn.add(this),qn||(qn=!0,V.read(Zn),V.resolveKeyframes(Xn))):(this.readKeyframes(),this.complete())}readKeyframes(){let{unresolvedKeyframes:e,name:t,element:n,motionValue:r}=this;if(e[0]===null){let i=r?.get(),a=e[e.length-1];if(i!==void 0)e[0]=i;else if(n&&t){let r=n.readValue(t,a);r!=null&&(e[0]=r)}e[0]===void 0&&(e[0]=a),r&&i===void 0&&r.set(e[0])}En(e)}setFinalKeyframe(){}measureInitialState(){}renderEndStyles(){}measureEndState(){}complete(e=!1){this.state=`complete`,this.onComplete(this.unresolvedKeyframes,this.finalKeyframe,e),Kn.delete(this)}cancel(){this.state===`scheduled`&&(Kn.delete(this),this.state=`pending`)}resume(){this.state===`pending`&&this.scheduleResolve()}},er=e=>e.startsWith(`--`);function tr(e,t,n){er(t)?e.style.setProperty(t,n):e.style[t]=n}var nr={};function rr(e,t){let n=ne(e);return()=>nr[t]??n()}var ir=rr(()=>window.ScrollTimeline!==void 0,`scrollTimeline`),ar=rr(()=>{try{document.createElement(`div`).animate({opacity:0},{easing:`linear(0, 1)`})}catch{return!1}return!0},`linearEasing`),or=([e,t,n,r])=>`cubic-bezier(${e}, ${t}, ${n}, ${r})`,sr={linear:`linear`,ease:`ease`,easeIn:`ease-in`,easeOut:`ease-out`,easeInOut:`ease-in-out`,circIn:or([0,.65,.55,1]),circOut:or([.55,0,1,.45]),backIn:or([.31,.01,.66,-.59]),backOut:or([.33,1.53,.69,.99])};function cr(e,t){if(e)return typeof e==`function`?ar()?qt(e,t):`ease-out`:we(e)?or(e):Array.isArray(e)?e.map(e=>cr(e,t)||sr.easeOut):sr[e]}function lr(e,t,n,{delay:r=0,duration:i=300,repeat:a=0,repeatType:o=`loop`,ease:s=`easeOut`,times:c}={},l=void 0){let u={[t]:n};c&&(u.offset=c);let d=cr(s,i);Array.isArray(d)&&(u.easing=d);let f={delay:r,duration:i,easing:Array.isArray(d)?`linear`:d,fill:`both`,iterations:a+1,direction:o===`reverse`?`alternate`:`normal`};return l&&(f.pseudoElement=l),e.animate(u,f)}function ur(e){return typeof e==`function`&&`applyToOptions`in e}function dr({type:e,...t}){return ur(e)&&ar()?e.applyToOptions(t):(t.duration??=300,t.ease??=`easeOut`,t)}var fr=class extends Cn{constructor(e){if(super(),this.finishedTime=null,this.isStopped=!1,this.manualStartTime=null,!e)return;let{element:t,name:n,keyframes:r,pseudoElement:i,allowFlatten:a=!1,finalKeyframe:o,onComplete:s}=e;this.isPseudoElement=!!i,this.allowFlatten=a,this.options=e,e.type;let c=dr(e);this.animation=lr(t,n,r,c,i),c.autoplay===!1&&this.animation.pause(),this.animation.onfinish=()=>{if(this.finishedTime=this.time,!i){let e=bn(r,this.options,o,this.speed);this.updateMotionValue&&this.updateMotionValue(e),tr(t,n,e),this.animation.cancel()}s?.(),this.notifyFinished()}}play(){this.isStopped||(this.manualStartTime=null,this.animation.play(),this.state===`finished`&&this.updateFinished())}pause(){this.animation.pause()}complete(){this.animation.finish?.()}cancel(){try{this.animation.cancel()}catch{}}stop(){if(this.isStopped)return;this.isStopped=!0;let{state:e}=this;e===`idle`||e===`finished`||(this.updateMotionValue?this.updateMotionValue():this.commitStyles(),this.isPseudoElement||this.cancel())}commitStyles(){let e=this.options?.element;!this.isPseudoElement&&e?.isConnected&&this.animation.commitStyles?.()}get duration(){let e=this.animation.effect?.getComputedTiming?.().duration||0;return ie(Number(e))}get iterationDuration(){let{delay:e=0}=this.options||{};return this.duration+ie(e)}get time(){return ie(Number(this.animation.currentTime)||0)}set time(e){let t=this.finishedTime!==null;this.manualStartTime=null,this.finishedTime=null,this.animation.currentTime=B(e),t&&this.animation.pause()}get speed(){return this.animation.playbackRate}set speed(e){e<0&&(this.finishedTime=null),this.animation.playbackRate=e}get state(){return this.finishedTime===null?this.animation.playState:`finished`}get startTime(){return this.manualStartTime??Number(this.animation.startTime)}set startTime(e){this.manualStartTime=this.animation.startTime=e}attachTimeline({timeline:e,rangeStart:t,rangeEnd:n,observe:r}){return this.allowFlatten&&this.animation.effect?.updateTiming({easing:`linear`}),this.animation.onfinish=null,e&&ir()?(this.animation.timeline=e,t&&(this.animation.rangeStart=t),n&&(this.animation.rangeEnd=n),re):r(this)}},pr={anticipate:ge,backInOut:he,circInOut:ye};function mr(e){return e in pr}function hr(e){typeof e.ease==`string`&&mr(e.ease)&&(e.ease=pr[e.ease])}var gr=10,_r=class extends fr{constructor(e){hr(e),Sn(e),super(e),e.startTime!==void 0&&e.autoplay!==!1&&(this.startTime=e.startTime),this.options=e}updateMotionValue(e){let{motionValue:t,onUpdate:n,onComplete:r,element:i,...a}=this.options;if(!t)return;if(e!==void 0){t.set(e);return}let o=new Tn({...a,autoplay:!1}),s=Math.max(gr,Le.now()-this.startTime),c=N(0,gr,s-gr),l=o.sample(s).value,{name:u}=this.options;i&&u&&tr(i,u,l),t.setWithVelocity(o.sample(Math.max(0,s-c)).value,l,c),o.stop()}},vr=(e,t)=>t===`zIndex`?!1:!!(typeof e==`number`||Array.isArray(e)||typeof e==`string`&&(Dt.test(e)||e===`0`)&&!e.startsWith(`url(`));function yr(e){let t=e[0];if(e.length===1)return!0;for(let n=0;nObject.hasOwnProperty.call(Element.prototype,`animate`));function Dr(e){let{motionValue:t,name:n,repeatDelay:r,repeatType:i,damping:a,type:o,keyframes:s}=e;if(!(t?.owner?.current instanceof HTMLElement))return!1;let{onUpdate:c,transformTemplate:l}=t.owner.getProps();return Er()&&n&&(Sr.has(n)||Tr.has(n)&&wr(s))&&(n!==`transform`||!l)&&!c&&!r&&i!==`mirror`&&a!==0&&o!==`inertia`}var Or=40,kr=class extends Cn{constructor({autoplay:e=!0,delay:t=0,type:n=`keyframes`,repeat:r=0,repeatDelay:i=0,repeatType:a=`loop`,keyframes:o,name:s,motionValue:c,element:l,...u}){super(),this.stop=()=>{this._animation&&(this._animation.stop(),this.stopTimeline?.()),this.keyframeResolver?.cancel()},this.createdAt=Le.now();let d={autoplay:e,delay:t,type:n,repeat:r,repeatDelay:i,repeatType:a,name:s,motionValue:c,element:l,...u},f=l?.KeyframeResolver||$n;this.keyframeResolver=new f(o,(e,t,n)=>this.onKeyframesResolved(e,t,d,!n),s,c,l),this.keyframeResolver?.scheduleResolve()}onKeyframesResolved(e,t,n,r){this.keyframeResolver=void 0;let{name:i,type:a,velocity:o,delay:s,isHandoff:c,onUpdate:l}=n;this.resolvedAt=Le.now();let u=!0;br(e,i,a,o)||(u=!1,(P.instantAnimations||!s)&&l?.(bn(e,n,t)),e[0]=e[e.length-1],xr(n),n.repeat=0);let d={startTime:r?this.resolvedAt&&this.resolvedAt-this.createdAt>Or?this.resolvedAt:this.createdAt:void 0,finalKeyframe:t,...n,keyframes:e},f=u&&!c&&Dr(d),p=d.motionValue?.owner?.current,m;if(f)try{m=new _r({...d,element:p})}catch{m=new Tn(d)}else m=new Tn(d);m.finished.then(()=>{this.notifyFinished()}).catch(re),this.pendingTimeline&&=(this.stopTimeline=m.attachTimeline(this.pendingTimeline),void 0),this._animation=m}get finished(){return this._animation?this.animation.finished:this._finished}then(e,t){return this.finished.finally(e).then(()=>{})}get animation(){return this._animation||(this.keyframeResolver?.resume(),Qn()),this._animation}get duration(){return this.animation.duration}get iterationDuration(){return this.animation.iterationDuration}get time(){return this.animation.time}set time(e){this.animation.time=e}get speed(){return this.animation.speed}get state(){return this.animation.state}set speed(e){this.animation.speed=e}get startTime(){return this.animation.startTime}attachTimeline(e){return this._animation?this.stopTimeline=this.animation.attachTimeline(e):this.pendingTimeline=e,()=>this.stop()}play(){this.animation.play()}pause(){this.animation.pause()}complete(){this.animation.complete()}cancel(){this._animation&&this.animation.cancel(),this.keyframeResolver?.cancel()}};function Ar(e,t,n,r=0,i=1){let a=Array.from(e).sort((e,t)=>e.sortNodePosition(t)).indexOf(t),o=e.size,s=(o-1)*r;return typeof n==`function`?n(a,o):i===1?a*r:s-a*r}var jr=30,Mr=e=>!isNaN(parseFloat(e)),Nr={current:void 0},Pr=class{constructor(e,t={}){this.canTrackVelocity=null,this.events={},this.updateAndNotify=e=>{let t=Le.now();if(this.updatedAt!==t&&this.setPrevFrameValue(),this.prev=this.current,this.setCurrent(e),this.current!==this.prev&&(this.events.change?.notify(this.current),this.dependents))for(let e of this.dependents)e.dirty()},this.hasAnimated=!1,this.setCurrent(e),this.owner=t.owner}setCurrent(e){this.current=e,this.updatedAt=Le.now(),this.canTrackVelocity===null&&e!==void 0&&(this.canTrackVelocity=Mr(this.current))}setPrevFrameValue(e=this.current){this.prevFrameValue=e,this.prevUpdatedAt=this.updatedAt}onChange(e){return this.on(`change`,e)}on(e,t){this.events[e]||(this.events[e]=new z);let n=this.events[e].add(t);return e===`change`?()=>{n(),V.read(()=>{this.events.change.getSize()||this.stop()})}:n}clearListeners(){for(let e in this.events)this.events[e].clear()}attach(e,t){this.passiveEffect=e,this.stopPassiveEffect=t}set(e){this.passiveEffect?this.passiveEffect(e,this.updateAndNotify):this.updateAndNotify(e)}setWithVelocity(e,t,n){this.set(t),this.prev=void 0,this.prevFrameValue=e,this.prevUpdatedAt=this.updatedAt-n}jump(e,t=!0){this.updateAndNotify(e),this.prev=e,this.prevUpdatedAt=this.prevFrameValue=void 0,t&&this.stop(),this.stopPassiveEffect&&this.stopPassiveEffect()}dirty(){this.events.change?.notify(this.current)}addDependent(e){this.dependents||=new Set,this.dependents.add(e)}removeDependent(e){this.dependents&&this.dependents.delete(e)}get(){return Nr.current&&Nr.current.push(this),this.current}getPrevious(){return this.prev}getVelocity(){let e=Le.now();if(!this.canTrackVelocity||this.prevFrameValue===void 0||e-this.updatedAt>jr)return 0;let t=Math.min(this.updatedAt-this.prevUpdatedAt,jr);return ae(parseFloat(this.current)-parseFloat(this.prevFrameValue),t)}start(e){return this.stop(),new Promise(t=>{this.hasAnimated=!0,this.animation=e(t),this.events.animationStart&&this.events.animationStart.notify()}).then(()=>{this.events.animationComplete&&this.events.animationComplete.notify(),this.clearAnimation()})}stop(){this.animation&&(this.animation.stop(),this.events.animationCancel&&this.events.animationCancel.notify()),this.clearAnimation()}isAnimating(){return!!this.animation}clearAnimation(){delete this.animation}destroy(){this.dependents?.clear(),this.events.destroy?.notify(),this.clearListeners(),this.stop(),this.stopPassiveEffect&&this.stopPassiveEffect()}};function Fr(e,t){return new Pr(e,t)}function Ir(e,t){if(e?.inherit&&t){let{inherit:n,...r}=e;return{...t,...r}}return e}function Lr(e,t){let n=e?.[t]??e?.default??e;return n===e?n:Ir(n,e)}var Rr={type:`spring`,stiffness:500,damping:25,restSpeed:10},zr=e=>({type:`spring`,stiffness:550,damping:e===0?2*Math.sqrt(550):30,restSpeed:10}),Br={type:`keyframes`,duration:.8},Vr={type:`keyframes`,ease:[.25,.1,.35,1],duration:.3},Hr=(e,{keyframes:t})=>t.length>2?Br:Bn.has(e)?e.startsWith(`scale`)?zr(t[1]):Rr:Vr,Ur=new Set([`when`,`delay`,`delayChildren`,`staggerChildren`,`staggerDirection`,`repeat`,`repeatType`,`repeatDelay`,`from`,`elapsed`]);function Wr(e){for(let t in e)if(!Ur.has(t))return!0;return!1}var Gr=(e,t,n,r={},i,a)=>o=>{let s=Lr(r,e)||{},c=s.delay||r.delay||0,{elapsed:l=0}=r;l-=B(c);let u={keyframes:Array.isArray(n)?n:[null,n],ease:`easeOut`,velocity:t.getVelocity(),...s,delay:-l,onUpdate:e=>{t.set(e),s.onUpdate&&s.onUpdate(e)},onComplete:()=>{o(),s.onComplete&&s.onComplete()},name:e,motionValue:t,element:a?void 0:i};Wr(s)||Object.assign(u,Hr(e,u)),u.duration&&=B(u.duration),u.repeatDelay&&=B(u.repeatDelay),u.from!==void 0&&(u.keyframes[0]=u.from);let d=!1;if((u.type===!1||u.duration===0&&!u.repeatDelay)&&(xr(u),u.delay===0&&(d=!0)),(P.instantAnimations||P.skipAnimations||i?.shouldSkipAnimations||s.skipAnimations)&&(d=!0,xr(u),u.delay=0),u.allowFlatten=!s.type&&!s.ease,d&&!a&&t.get()!==void 0){let e=bn(u.keyframes,s);if(e!==void 0){V.update(()=>{u.onUpdate(e),u.onComplete()});return}}return s.isSync?new Tn(u):new kr(u)},Kr=/^var\(--(?:([\w-]+)|([\w-]+), ?([a-zA-Z\d ()%#.,-]+))\)/u;function qr(e){let t=Kr.exec(e);if(!t)return[,];let[,n,r,i]=t;return[`--${n??r}`,i]}function Jr(e,t,n=1){`${e}`;let[r,i]=qr(e);if(!r)return;let a=window.getComputedStyle(t).getPropertyValue(r);if(a){let e=a.trim();return F(e)?parseFloat(e):e}return Ve(i)?Jr(i,t,n+1):i}function Yr(e){let t=[{},{}];return e?.values.forEach((e,n)=>{t[0][n]=e.get(),t[1][n]=e.getVelocity()}),t}function Xr(e,t,n,r){if(typeof t==`function`){let[i,a]=Yr(r);t=t(n===void 0?e.custom:n,i,a)}if(typeof t==`string`&&(t=e.variants&&e.variants[t]),typeof t==`function`){let[i,a]=Yr(r);t=t(n===void 0?e.custom:n,i,a)}return t}function Zr(e,t,n){let r=e.getProps();return Xr(r,t,n===void 0?r.custom:n,e)}var Qr=new Set([`width`,`height`,`top`,`left`,`right`,`bottom`,...zn]),$r=e=>Array.isArray(e);function ei(e,t,n){e.hasValue(t)?e.getValue(t).set(n):e.addValue(t,Fr(n))}function ti(e){return $r(e)?e[e.length-1]||0:e}function ni(e,t){let{transitionEnd:n={},transition:r={},...i}=Zr(e,t)||{};i={...i,...n};for(let t in i)ei(e,t,ti(i[t]))}var ri=e=>!!(e&&e.getVelocity);function ii(e){return!!(ri(e)&&e.add)}function ai(e,t){let n=e.getValue(`willChange`);if(ii(n))return n.add(t);if(!n&&P.WillChange){let n=new P.WillChange(`auto`);e.addValue(`willChange`,n),n.add(t)}}function oi(e){return e.replace(/([A-Z])/g,e=>`-${e.toLowerCase()}`)}var si=`data-`+oi(`framerAppearId`);function ci(e){return e.props[si]}function li({protectedKeys:e,needsAnimating:t},n){let r=e.hasOwnProperty(n)&&t[n]!==!0;return t[n]=!1,r}function ui(e,t,{delay:n=0,transitionOverride:r,type:i}={}){let{transition:a,transitionEnd:o,...s}=t,c=e.getDefaultTransition();a=a?Ir(a,c):c;let l=a?.reduceMotion,u=a?.skipAnimations;r&&(a=r);let d=[],f=i&&e.animationState&&e.animationState.getState()[i],p=a?.path;p&&p.animateVisualElement(e,s,a,n,d);for(let t in s){let r=e.getValue(t,e.latestValues[t]??null),i=s[t];if(i===void 0||f&&li(f,t))continue;let o={delay:n,...Lr(a||{},t)};u&&(o.skipAnimations=!0);let c=r.get();if(c!==void 0&&!r.isAnimating()&&!Array.isArray(i)&&i===c&&!o.velocity){V.update(()=>r.set(i));continue}let p=!1;if(window.MotionHandoffAnimation){let n=ci(e);if(n){let e=window.MotionHandoffAnimation(n,t,V);e!==null&&(o.startTime=e,p=!0)}}ai(e,t);let m=l??e.shouldReduceMotion;r.start(Gr(t,r,i,m&&Qr.has(t)?{type:!1}:o,e,p));let h=r.animation;h&&d.push(h)}if(o){let t=()=>V.update(()=>{o&&ni(e,o)});d.length?Promise.all(d).then(t):t()}return d}function di(e,t,n={}){let r=Zr(e,t,n.type===`exit`?e.presenceContext?.custom:void 0),{transition:i=e.getDefaultTransition()||{}}=r||{};n.transitionOverride&&(i=n.transitionOverride);let a=r?()=>Promise.all(ui(e,r,n)):()=>Promise.resolve(),o=e.variantChildren&&e.variantChildren.size?(r=0)=>{let{delayChildren:a=0,staggerChildren:o,staggerDirection:s}=i;return fi(e,t,r,a,o,s,n)}:()=>Promise.resolve(),{when:s}=i;if(s){let[e,t]=s===`beforeChildren`?[a,o]:[o,a];return e().then(()=>t())}else return Promise.all([a(),o(n.delay)])}function fi(e,t,n=0,r=0,i=0,a=1,o){let s=[];for(let c of e.variantChildren)c.notify(`AnimationStart`,t),s.push(di(c,t,{...o,delay:n+(typeof r==`function`?0:r)+Ar(e.variantChildren,c,r,i,a)}).then(()=>c.notify(`AnimationComplete`,t)));return Promise.all(s)}function pi(e,t,n={}){e.notify(`AnimationStart`,t);let r;if(Array.isArray(t)){let i=t.map(t=>di(e,t,n));r=Promise.all(i)}else if(typeof t==`string`)r=di(e,t,n);else{let i=typeof t==`function`?Zr(e,t,n.custom):t;r=Promise.all(ui(e,i,n))}return r.then(()=>{e.notify(`AnimationComplete`,t)})}var mi={test:e=>e===`auto`,parse:e=>e},hi=e=>t=>t.test(e),gi=[We,H,ot,at,ct,st,mi],_i=e=>gi.find(hi(e));function vi(e){return typeof e==`number`?e===0:e===null?!0:e===`none`||e===`0`||te(e)}var yi=new Set([`brightness`,`contrast`,`saturate`,`opacity`]);function bi(e){let[t,n]=e.slice(0,-1).split(`(`);if(t===`drop-shadow`)return e;let[r]=n.match(Je)||[];if(!r)return e;let i=n.replace(r,``),a=+!!yi.has(t);return r!==n&&(a*=100),t+`(`+a+i+`)`}var xi=/\b([a-z-]*)\(.*?\)/gu,Si={...Dt,getAnimatableNone:e=>{let t=e.match(xi);return t?t.map(bi).join(` `):e}},Ci={...Dt,getAnimatableNone:e=>{let t=Dt.parse(e);return Dt.createTransformer(e)(t.map(e=>typeof e==`number`?0:typeof e==`object`?{...e,alpha:1}:e))}},wi={...We,transform:Math.round},Ti={borderWidth:H,borderTopWidth:H,borderRightWidth:H,borderBottomWidth:H,borderLeftWidth:H,borderRadius:H,borderTopLeftRadius:H,borderTopRightRadius:H,borderBottomRightRadius:H,borderBottomLeftRadius:H,width:H,maxWidth:H,height:H,maxHeight:H,top:H,right:H,bottom:H,left:H,inset:H,insetBlock:H,insetBlockStart:H,insetBlockEnd:H,insetInline:H,insetInlineStart:H,insetInlineEnd:H,padding:H,paddingTop:H,paddingRight:H,paddingBottom:H,paddingLeft:H,paddingBlock:H,paddingBlockStart:H,paddingBlockEnd:H,paddingInline:H,paddingInlineStart:H,paddingInlineEnd:H,margin:H,marginTop:H,marginRight:H,marginBottom:H,marginLeft:H,marginBlock:H,marginBlockStart:H,marginBlockEnd:H,marginInline:H,marginInlineStart:H,marginInlineEnd:H,fontSize:H,backgroundPositionX:H,backgroundPositionY:H,rotate:at,pathRotation:at,rotateX:at,rotateY:at,rotateZ:at,scale:Ke,scaleX:Ke,scaleY:Ke,scaleZ:Ke,skew:at,skewX:at,skewY:at,distance:H,translateX:H,translateY:H,translateZ:H,x:H,y:H,z:H,perspective:H,transformPerspective:H,opacity:Ge,originX:lt,originY:lt,originZ:H,zIndex:wi,fillOpacity:Ge,strokeOpacity:Ge,numOctaves:wi},Ei={...Ti,color:dt,backgroundColor:dt,outlineColor:dt,fill:dt,stroke:dt,borderColor:dt,borderTopColor:dt,borderRightColor:dt,borderBottomColor:dt,borderLeftColor:dt,filter:Si,WebkitFilter:Si,mask:Ci,WebkitMask:Ci},Di=e=>Ei[e],Oi=new Set([Si,Ci]);function ki(e,t){let n=Di(e);return Oi.has(n)||(n=Dt),n.getAnimatableNone?n.getAnimatableNone(t):void 0}var Ai=new Set([`auto`,`none`,`0`]);function U(e,t,n){let r=0,i;for(;r{e.getValue(t).set(n)}),this.resolveNoneKeyframes()}},Mi=[`borderTopLeftRadius`,`borderTopRightRadius`,`borderBottomRightRadius`,`borderBottomLeftRadius`];function Ni(e,t,n){if(e==null)return[];if(e instanceof EventTarget)return[e];if(typeof e==`string`){let r=document;t&&(r=t.current);let i=n?.[e]??r.querySelectorAll(e);return i?Array.from(i):[]}return Array.from(e).filter(e=>e!=null)}var Pi=(e,t)=>t&&typeof e==`number`?t.transform(e):e;function Fi(e){return I(e)&&`offsetHeight`in e&&!(`ownerSVGElement`in e)}var{schedule:Ii,cancel:Li}=je(queueMicrotask,!1),Ri={x:!1,y:!1};function zi(){return Ri.x||Ri.y}function Bi(e){return e===`x`||e===`y`?Ri[e]?null:(Ri[e]=!0,()=>{Ri[e]=!1}):Ri.x||Ri.y?null:(Ri.x=Ri.y=!0,()=>{Ri.x=Ri.y=!1})}function Vi(e,t){let n=Ni(e),r=new AbortController;return[n,{passive:!0,...t,signal:r.signal},()=>r.abort()]}function Hi(e){return!(e.pointerType===`touch`||zi())}function Ui(e,t,n={}){let[r,i,a]=Vi(e,n);return r.forEach(e=>{let n=!1,r=!1,a,o=()=>{e.removeEventListener(`pointerleave`,u)},s=e=>{a&&=(a(e),void 0),o()},c=e=>{n=!1,window.removeEventListener(`pointerup`,c),window.removeEventListener(`pointercancel`,c),r&&(r=!1,s(e))},l=()=>{n=!0,window.addEventListener(`pointerup`,c,i),window.addEventListener(`pointercancel`,c,i)},u=e=>{if(e.pointerType!==`touch`){if(n){r=!0;return}s(e)}};e.addEventListener(`pointerenter`,n=>{if(!Hi(n))return;r=!1;let o=t(e,n);typeof o==`function`&&(a=o,e.addEventListener(`pointerleave`,u,i))},i),e.addEventListener(`pointerdown`,l,i)}),a}var Wi=(e,t)=>t?e===t?!0:Wi(e,t.parentElement):!1,Gi=e=>e.pointerType===`mouse`?typeof e.button!=`number`||e.button<=0:e.isPrimary!==!1,Ki=new Set([`BUTTON`,`INPUT`,`SELECT`,`TEXTAREA`,`A`]);function qi(e){return Ki.has(e.tagName)||e.isContentEditable===!0}var Ji=new Set([`INPUT`,`SELECT`,`TEXTAREA`]);function Yi(e){return Ji.has(e.tagName)||e.isContentEditable===!0}var Xi=new WeakSet;function Zi(e){return t=>{t.key===`Enter`&&e(t)}}function Qi(e,t){e.dispatchEvent(new PointerEvent(`pointer`+t,{isPrimary:!0,bubbles:!0}))}var $i=(e,t)=>{let n=e.currentTarget;if(!n)return;let r=Zi(()=>{if(Xi.has(n))return;Qi(n,`down`);let e=Zi(()=>{Qi(n,`up`)});n.addEventListener(`keyup`,e,t),n.addEventListener(`blur`,()=>Qi(n,`cancel`),t)});n.addEventListener(`keydown`,r,t),n.addEventListener(`blur`,()=>n.removeEventListener(`keydown`,r),t)};function ea(e){return Gi(e)&&!zi()}var ta=new WeakSet;function na(e,t,n={}){let[r,i,a]=Vi(e,n),o=e=>{let r=e.currentTarget;if(!ea(e)||ta.has(e))return;Xi.add(r),n.stopPropagation&&ta.add(e);let a=t(r,e),o={...i,capture:!0},s=(e,t)=>{window.removeEventListener(`pointerup`,c,o),window.removeEventListener(`pointercancel`,l,o),Xi.has(r)&&Xi.delete(r),ea(e)&&typeof a==`function`&&a(e,{success:t})},c=e=>{s(e,r===window||r===document||n.useGlobalTarget||Wi(r,e.target))},l=e=>{s(e,!1)};window.addEventListener(`pointerup`,c,o),window.addEventListener(`pointercancel`,l,o)};return r.forEach(e=>{(n.useGlobalTarget?window:e).addEventListener(`pointerdown`,o,i),Fi(e)&&(e.addEventListener(`focus`,e=>$i(e,i)),!qi(e)&&!e.hasAttribute(`tabindex`)&&(e.tabIndex=0))}),a}function ra(e){return I(e)&&`ownerSVGElement`in e}var ia=new WeakMap,aa,oa=(e,t,n)=>(r,i)=>i&&i[0]?i[0][e+`Size`]:ra(r)&&`getBBox`in r?r.getBBox()[t]:r[n],sa=oa(`inline`,`width`,`offsetWidth`),ca=oa(`block`,`height`,`offsetHeight`);function la({target:e,borderBoxSize:t}){ia.get(e)?.forEach(n=>{n(e,{get width(){return sa(e,t)},get height(){return ca(e,t)}})})}function ua(e){e.forEach(la)}function da(){typeof ResizeObserver>`u`||(aa=new ResizeObserver(ua))}function fa(e,t){aa||da();let n=Ni(e);return n.forEach(e=>{let n=ia.get(e);n||(n=new Set,ia.set(e,n)),n.add(t),aa?.observe(e)}),()=>{n.forEach(e=>{let n=ia.get(e);n?.delete(t),n?.size||aa?.unobserve(e)})}}var pa=new Set,ma;function ha(){ma=()=>{let e={get width(){return window.innerWidth},get height(){return window.innerHeight}};pa.forEach(t=>t(e))},window.addEventListener(`resize`,ma)}function ga(e){return pa.add(e),ma||ha(),()=>{pa.delete(e),!pa.size&&typeof ma==`function`&&(window.removeEventListener(`resize`,ma),ma=void 0)}}function _a(e,t){return typeof e==`function`?ga(e):fa(e,t)}var va={value:null,addProjectionMetrics:null};function ya(e){return ra(e)&&e.tagName===`svg`}function ba(...e){let t=!Array.isArray(e[0]),n=t?0:-1,r=e[0+n],i=e[1+n],a=e[2+n],o=e[3+n],s=pn(i,a,o);return t?s(r):s}var xa=[...gi,dt,Dt],Sa=e=>xa.find(hi(e)),Ca=()=>({translate:0,scale:1,origin:0,originPoint:0}),wa=()=>({x:Ca(),y:Ca()}),Ta=()=>({min:0,max:0}),Ea=()=>({x:Ta(),y:Ta()}),Da=new WeakMap;function Oa(e){return typeof e==`object`&&!!e&&typeof e.start==`function`}function ka(e){return typeof e==`string`||Array.isArray(e)}var Aa=[`animate`,`whileInView`,`whileFocus`,`whileHover`,`whileTap`,`whileDrag`,`exit`],ja=[`initial`,...Aa];function Ma(e){return Oa(e.animate)||ja.some(t=>ka(e[t]))}function Na(e){return!!(Ma(e)||e.variants)}function Pa(e,t,n){for(let r in t){let i=t[r],a=n[r];if(ri(i))e.addValue(r,i);else if(ri(a))e.addValue(r,Fr(i,{owner:e}));else if(a!==i)if(e.hasValue(r)){let t=e.getValue(r);t.liveStyle===!0?t.jump(i):t.hasAnimated||t.set(i)}else{let t=e.getStaticValue(r);e.addValue(r,Fr(t===void 0?i:t,{owner:e}))}}for(let r in n)t[r]===void 0&&e.removeValue(r);return t}var Fa={current:null},Ia={current:!1},La=typeof window<`u`;function Ra(){if(Ia.current=!0,La)if(window.matchMedia){let e=window.matchMedia(`(prefers-reduced-motion)`),t=()=>Fa.current=e.matches;e.addEventListener(`change`,t),t()}else Fa.current=!1}var za=[`AnimationStart`,`AnimationComplete`,`Update`,`BeforeLayoutMeasure`,`LayoutMeasure`,`LayoutAnimationStart`,`LayoutAnimationComplete`],Ba={};function Va(e){Ba=e}function Ha(){return Ba}var Ua=class{scrapeMotionValuesFromProps(e,t,n){return{}}constructor({parent:e,props:t,presenceContext:n,reducedMotionConfig:r,skipAnimations:i,blockInitialAnimation:a,visualState:o},s={}){this.current=null,this.children=new Set,this.isVariantNode=!1,this.isControllingVariants=!1,this.shouldReduceMotion=null,this.shouldSkipAnimations=!1,this.values=new Map,this.KeyframeResolver=$n,this.features={},this.valueSubscriptions=new Map,this.prevMotionValues={},this.hasBeenMounted=!1,this.events={},this.propEventSubscriptions={},this.notifyUpdate=()=>this.notify(`Update`,this.latestValues),this.render=()=>{this.current&&(this.triggerBuild(),this.renderInstance(this.current,this.renderState,this.props.style,this.projection))},this.renderScheduledAt=0,this.scheduleRender=()=>{let e=Le.now();this.renderScheduledAtthis.bindToMotionValue(t,e)),this.reducedMotionConfig===`never`?this.shouldReduceMotion=!1:this.reducedMotionConfig===`always`?this.shouldReduceMotion=!0:(Ia.current||Ra(),this.shouldReduceMotion=Fa.current),this.shouldSkipAnimations=this.skipAnimationsConfig??!1,this.parent?.addChild(this),this.update(this.props,this.presenceContext),this.hasBeenMounted=!0}unmount(){this.projection&&this.projection.unmount(),Me(this.notifyUpdate),Me(this.render),this.valueSubscriptions.forEach(e=>e()),this.valueSubscriptions.clear(),this.removeFromVariantTree&&this.removeFromVariantTree(),this.parent?.removeChild(this);for(let e in this.events)this.events[e].clear();for(let e in this.features){let t=this.features[e];t&&(t.unmount(),t.isMounted=!1)}this.current=null}addChild(e){this.children.add(e),this.enteringChildren??=new Set,this.enteringChildren.add(e)}removeChild(e){this.children.delete(e),this.enteringChildren&&this.enteringChildren.delete(e)}bindToMotionValue(e,t){if(this.valueSubscriptions.has(e)&&this.valueSubscriptions.get(e)(),t.accelerate&&Sr.has(e)&&this.current instanceof HTMLElement){let{factory:n,keyframes:r,times:i,ease:a,duration:o}=t.accelerate,s=new fr({element:this.current,name:e,keyframes:r,times:i,ease:a,duration:B(o)}),c=n(s);this.valueSubscriptions.set(e,()=>{c(),s.cancel()});return}let n=Bn.has(e);n&&this.onBindTransform&&this.onBindTransform();let r=t.on(`change`,t=>{this.latestValues[e]=t,this.props.onUpdate&&V.preRender(this.notifyUpdate),n&&this.projection&&(this.projection.isTransformDirty=!0),this.scheduleRender()}),i;typeof window<`u`&&window.MotionCheckAppearSync&&(i=window.MotionCheckAppearSync(this,e,t)),this.valueSubscriptions.set(e,()=>{r(),i&&i()})}sortNodePosition(e){return!this.current||!this.sortInstanceNodePosition||this.type!==e.type?0:this.sortInstanceNodePosition(this.current,e.current)}updateFeatures(){let e=`animation`;for(e in Ba){let t=Ba[e];if(!t)continue;let{isEnabled:n,Feature:r}=t;if(!this.features[e]&&r&&n(this.props)&&(this.features[e]=new r(this)),this.features[e]){let t=this.features[e];t.isMounted?t.update():(t.mount(),t.isMounted=!0)}}}triggerBuild(){this.build(this.renderState,this.latestValues,this.props)}measureViewportBox(){return this.current?this.measureInstanceViewportBox(this.current,this.props):Ea()}getStaticValue(e){return this.latestValues[e]}setStaticValue(e,t){this.latestValues[e]=t}update(e,t){(e.transformTemplate||this.props.transformTemplate)&&this.scheduleRender(),this.prevProps=this.props,this.props=e,this.prevPresenceContext=this.presenceContext,this.presenceContext=t;for(let t=0;tt.variantChildren.delete(e)}addValue(e,t){let n=this.values.get(e);t!==n&&(n&&this.removeValue(e),this.bindToMotionValue(e,t),this.values.set(e,t),this.latestValues[e]=t.get())}removeValue(e){this.values.delete(e);let t=this.valueSubscriptions.get(e);t&&(t(),this.valueSubscriptions.delete(e)),delete this.latestValues[e],this.removeValueFromRenderState(e,this.renderState)}hasValue(e){return this.values.has(e)}getValue(e,t){if(this.props.values&&this.props.values[e])return this.props.values[e];let n=this.values.get(e);return n===void 0&&t!==void 0&&(n=Fr(t===null?void 0:t,{owner:this}),this.addValue(e,n)),n}readValue(e,t){let n=this.latestValues[e]!==void 0||!this.current?this.latestValues[e]:this.getBaseTargetFromProps(this.props,e)??this.readValueFromInstance(this.current,e,this.options);return n!=null&&(typeof n==`string`&&(F(n)||te(n))?n=parseFloat(n):!Sa(n)&&Dt.test(t)&&(n=ki(e,t)),this.setBaseTarget(e,ri(n)?n.get():n)),ri(n)?n.get():n}setBaseTarget(e,t){this.baseTarget[e]=t}getBaseTarget(e){let{initial:t}=this.props,n;if(typeof t==`string`||typeof t==`object`){let r=Xr(this.props,t,this.presenceContext?.custom);r&&(n=r[e])}if(t&&n!==void 0)return n;let r=this.getBaseTargetFromProps(this.props,e);return r!==void 0&&!ri(r)?r:this.initialValues[e]!==void 0&&n===void 0?void 0:this.baseTarget[e]}on(e,t){return this.events[e]||(this.events[e]=new z),this.events[e].add(t)}notify(e,...t){this.events[e]&&this.events[e].notify(...t)}scheduleRenderMicrotask(){Ii.render(this.render)}},Wa=class extends Ua{constructor(){super(...arguments),this.KeyframeResolver=ji}sortInstanceNodePosition(e,t){return e.compareDocumentPosition(t)&2?1:-1}getBaseTargetFromProps(e,t){let n=e.style;return n?n[t]:void 0}removeValueFromRenderState(e,{vars:t,style:n}){delete t[e],delete n[e]}handleChildMotionValue(){this.childSubscription&&(this.childSubscription(),delete this.childSubscription);let{children:e}=this.props;ri(e)&&(this.childSubscription=e.on(`change`,e=>{this.current&&(this.current.textContent=`${e}`)}))}},Ga=class{constructor(e){this.isMounted=!1,this.node=e}update(){}};function Ka({top:e,left:t,right:n,bottom:r}){return{x:{min:t,max:n},y:{min:e,max:r}}}function qa({x:e,y:t}){return{top:t.min,right:e.max,bottom:t.max,left:e.min}}function Ja(e,t){if(!t)return e;let n=t({x:e.left,y:e.top}),r=t({x:e.right,y:e.bottom});return{top:n.y,left:n.x,bottom:r.y,right:r.x}}function Ya(e){return e===void 0||e===1}function Xa({scale:e,scaleX:t,scaleY:n}){return!Ya(e)||!Ya(t)||!Ya(n)}function Za(e){return Xa(e)||Qa(e)||e.z||e.rotate||e.rotateX||e.rotateY||e.skewX||e.skewY}function Qa(e){return $a(e.x)||$a(e.y)}function $a(e){return e&&e!==`0%`}function eo(e,t,n){return n+t*(e-n)}function to(e,t,n,r,i){return i!==void 0&&(e=eo(e,i,r)),eo(e,n,r)+t}function no(e,t=0,n=1,r,i){e.min=to(e.min,t,n,r,i),e.max=to(e.max,t,n,r,i)}function ro(e,{x:t,y:n}){no(e.x,t.translate,t.scale,t.originPoint),no(e.y,n.translate,n.scale,n.originPoint)}var io=.999999999999,ao=1.0000000000001;function oo(e,t,n,r=!1){let i=n.length;if(!i)return;t.x=t.y=1;let a,o;for(let s=0;sio&&(t.x=1),t.yio&&(t.y=1)}function so(e,t){e.min+=t,e.max+=t}function co(e,t,n,r,i=.5){no(e,t,n,jt(e.min,e.max,i),r)}function W(e,t){return typeof e==`string`?parseFloat(e)/100*(t.max-t.min):e}function lo(e,t,n){let r=n??e;co(e.x,W(t.x,r.x),t.scaleX,t.scale,t.originX),co(e.y,W(t.y,r.y),t.scaleY,t.scale,t.originY)}function uo(e,t){return Ka(Ja(e.getBoundingClientRect(),t))}function fo(e,t,n){let r=uo(e,n),{scroll:i}=t;return i&&(so(r.x,i.offset.x),so(r.y,i.offset.y)),r}var po={x:`translateX`,y:`translateY`,z:`translateZ`,transformPerspective:`perspective`},mo=zn.length;function ho(e,t,n){let r=``,i=!0;for(let a=0;a{if(!t.target)return e;if(typeof e==`string`)if(H.test(e))e=parseFloat(e);else return e;return`${vo(e,t.target.x)}% ${vo(e,t.target.y)}%`}},bo={correct:(e,{treeScale:t,projectionDelta:n})=>{let r=e,i=Dt.parse(e);if(i.length>5)return r;let a=Dt.createTransformer(e),o=typeof i[0]==`number`?0:1,s=n.x.scale*t.x,c=n.y.scale*t.y;i[0+o]/=s,i[1+o]/=c;let l=jt(s,c,.5);return typeof i[2+o]==`number`&&(i[2+o]/=l),typeof i[3+o]==`number`&&(i[3+o]/=l),a(i)}},xo={borderRadius:{...yo,applyTo:[...Mi]},borderTopLeftRadius:yo,borderTopRightRadius:yo,borderBottomLeftRadius:yo,borderBottomRightRadius:yo,boxShadow:bo};function So(e,{layout:t,layoutId:n}){return Bn.has(e)||e.startsWith(`origin`)||(t||n!==void 0)&&(!!xo[e]||e===`opacity`)}function Co(e,t,n){let r=e.style,i=t?.style,a={};if(!r)return a;for(let t in r)(ri(r[t])||i&&ri(i[t])||So(t,e)||n?.getValue(t)?.liveStyle!==void 0)&&(a[t]=r[t]);return a}function wo(e){return window.getComputedStyle(e)}var To=class extends Wa{constructor(){super(...arguments),this.type=`html`,this.renderInstance=_o}readValueFromInstance(e,t){if(Bn.has(t))return this.projection?.isProjecting?Fn(t):Ln(e,t);{let n=wo(e),r=(ze(t)?n.getPropertyValue(t):n[t])||0;return typeof r==`string`?r.trim():r}}measureInstanceViewportBox(e,{transformPagePoint:t}){return uo(e,t)}build(e,t,n){go(e,t,n.transformTemplate)}scrapeMotionValuesFromProps(e,t,n){return Co(e,t,n)}},Eo={offset:`stroke-dashoffset`,array:`stroke-dasharray`},Do={offset:`strokeDashoffset`,array:`strokeDasharray`};function Oo(e,t,n=1,r=0,i=!0){e.pathLength=1;let a=i?Eo:Do;e[a.offset]=`${-r}`,e[a.array]=`${t} ${n}`}var ko=[`offsetDistance`,`offsetPath`,`offsetRotate`,`offsetAnchor`];function Ao(e,{attrX:t,attrY:n,attrScale:r,pathLength:i,pathSpacing:a=1,pathOffset:o=0,...s},c,l,u){if(go(e,s,l),c){e.style.viewBox&&(e.attrs.viewBox=e.style.viewBox);return}e.attrs=e.style,e.style={};let{attrs:d,style:f}=e;d.transform&&(f.transform=d.transform,delete d.transform),(f.transform||d.transformOrigin)&&(f.transformOrigin=d.transformOrigin??`50% 50%`,delete d.transformOrigin),f.transform&&(f.transformBox=u?.transformBox??`fill-box`,delete d.transformBox);for(let e of ko)d[e]!==void 0&&(f[e]=d[e],delete d[e]);t!==void 0&&(d.x=t),n!==void 0&&(d.y=n),r!==void 0&&(d.scale=r),i!==void 0&&Oo(d,i,a,o,!1)}var jo=new Set([`baseFrequency`,`diffuseConstant`,`kernelMatrix`,`kernelUnitLength`,`keySplines`,`keyTimes`,`limitingConeAngle`,`markerHeight`,`markerWidth`,`numOctaves`,`targetX`,`targetY`,`surfaceScale`,`specularConstant`,`specularExponent`,`stdDeviation`,`tableValues`,`viewBox`,`gradientTransform`,`pathLength`,`startOffset`,`textLength`,`lengthAdjust`]),Mo=e=>typeof e==`string`&&e.toLowerCase()===`svg`;function No(e,t,n,r){_o(e,t,void 0,r);for(let n in t.attrs)e.setAttribute(jo.has(n)?n:oi(n),t.attrs[n])}function Po(e,t,n){let r=Co(e,t,n);for(let n in e)if(ri(e[n])||ri(t[n])){let t=zn.indexOf(n)===-1?n:`attr`+n.charAt(0).toUpperCase()+n.substring(1);r[t]=e[n]}return r}var Fo=class extends Wa{constructor(){super(...arguments),this.type=`svg`,this.isSVGTag=!1,this.measureInstanceViewportBox=Ea}getBaseTargetFromProps(e,t){return e[t]}readValueFromInstance(e,t){if(Bn.has(t)){let e=Di(t);return e&&e.default||0}return t=jo.has(t)?t:oi(t),e.getAttribute(t)}scrapeMotionValuesFromProps(e,t,n){return Po(e,t,n)}build(e,t,n){Ao(e,t,this.isSVGTag,n.transformTemplate,n.style)}renderInstance(e,t,n,r){No(e,t,n,r)}mount(e){this.isSVGTag=Mo(e.tagName),super.mount(e)}},Io=ja.length;function Lo(e){if(!e)return;if(!e.isControllingVariants){let t=e.parent&&Lo(e.parent)||{};return e.props.initial!==void 0&&(t.initial=e.props.initial),t}let t={};for(let n=0;nPromise.all(t.map(({animation:t,options:n})=>pi(e,t,n)))}function Ho(e){let t=Vo(e),n=Go(),r=!0,i=!1,a=t=>(n,r)=>{let i=Zr(e,r,t===`exit`?e.presenceContext?.custom:void 0);if(i){let{transition:e,transitionEnd:t,...r}=i;n={...n,...r,...t}}return n};function o(n){t=n(e)}function s(o){let{props:s}=e,c=Lo(e.parent)||{},l=[],u=new Set,d={},f=1/0;for(let t=0;tf&&g,x=!1,S=Array.isArray(h)?h:[h],C=S.reduce(a(p),{});_===!1&&(C={});let{prevResolvedValues:w={}}=m,T={...w,...C},E=t=>{b=!0,u.has(t)&&(x=!0,u.delete(t)),m.needsAnimating[t]=!0;let n=e.getValue(t);n&&(n.liveStyle=!1)};for(let e in T){let t=C[e],n=w[e];if(d.hasOwnProperty(e))continue;let r=!1;r=$r(t)&&$r(n)?!Ro(t,n)||y:t!==n,r?t==null?u.add(e):E(e):t!==void 0&&u.has(e)?E(e):m.protectedKeys[e]=!0}m.prevProp=h,m.prevResolvedValues=C,m.isActive&&(d={...d,...C}),(r||i)&&e.blockInitialAnimation&&(b=!1);let D=v&&y;b&&(!D||x)&&l.push(...S.map(t=>{let n={type:p};if(typeof t==`string`&&(r||i)&&!D&&e.manuallyAnimateOnMount&&e.parent){let{parent:r}=e,i=Zr(r,t);if(r.enteringChildren&&i){let{delayChildren:t}=i.transition||{};n.delay=Ar(r.enteringChildren,e,t)}}return{animation:t,options:n}}))}if(u.size){let t={};if(typeof s.initial!=`boolean`){let n=Zr(e,Array.isArray(s.initial)?s.initial[0]:s.initial);n&&n.transition&&(t.transition=n.transition)}u.forEach(n=>{let r=e.getBaseTarget(n),i=e.getValue(n);i&&(i.liveStyle=!0),t[n]=r??null}),l.push({animation:t})}let p=!!l.length;return r&&(s.initial===!1||s.initial===s.animate)&&!e.manuallyAnimateOnMount&&(p=!1),r=!1,i=!1,p?t(l):Promise.resolve()}function c(t,r){if(n[t].isActive===r)return Promise.resolve();e.variantChildren?.forEach(e=>e.animationState?.setActive(t,r)),n[t].isActive=r;let i=s(t);for(let e in n)n[e].protectedKeys={};return i}return{animateChanges:s,setActive:c,setAnimateFunction:o,getState:()=>n,reset:()=>{n=Go(),i=!0}}}function Uo(e,t){return typeof t==`string`?t!==e:Array.isArray(t)?!Ro(t,e):!1}function Wo(e=!1){return{isActive:e,protectedKeys:{},needsAnimating:{},prevResolvedValues:{}}}function Go(){return{animate:Wo(!0),whileInView:Wo(),whileHover:Wo(),whileTap:Wo(),whileDrag:Wo(),whileFocus:Wo(),exit:Wo()}}function Ko(e,t){e.min=t.min,e.max=t.max}function qo(e,t){Ko(e.x,t.x),Ko(e.y,t.y)}function Jo(e,t){e.translate=t.translate,e.scale=t.scale,e.originPoint=t.originPoint,e.origin=t.origin}var Yo=.9999,Xo=1.0001,Zo=-.01,Qo=.01;function $o(e){return e.max-e.min}function es(e,t,n){return Math.abs(e-t)<=n}function ts(e,t,n,r=.5){e.origin=r,e.originPoint=jt(t.min,t.max,e.origin),e.scale=$o(n)/$o(t),e.translate=jt(n.min,n.max,e.origin)-e.originPoint,(e.scale>=Yo&&e.scale<=Xo||isNaN(e.scale))&&(e.scale=1),(e.translate>=Zo&&e.translate<=Qo||isNaN(e.translate))&&(e.translate=0)}function ns(e,t,n,r){ts(e.x,t.x,n.x,r?r.originX:void 0),ts(e.y,t.y,n.y,r?r.originY:void 0)}function rs(e,t,n,r=0){e.min=(r?jt(n.min,n.max,r):n.min)+t.min,e.max=e.min+$o(t)}function is(e,t,n,r){rs(e.x,t.x,n.x,r?.x),rs(e.y,t.y,n.y,r?.y)}function as(e,t,n,r=0){let i=r?jt(n.min,n.max,r):n.min;e.min=t.min-i,e.max=e.min+$o(t)}function os(e,t,n,r){as(e.x,t.x,n.x,r?.x),as(e.y,t.y,n.y,r?.y)}function ss(e,t,n,r,i){return e-=t,e=eo(e,1/n,r),i!==void 0&&(e=eo(e,1/i,r)),e}function cs(e,t=0,n=1,r=.5,i,a=e,o=e){if(ot.test(t)&&(t=parseFloat(t),t=jt(o.min,o.max,t/100)-o.min),typeof t!=`number`)return;let s=jt(a.min,a.max,r);e===a&&(s-=t),e.min=ss(e.min,t,n,s,i),e.max=ss(e.max,t,n,s,i)}function ls(e,t,[n,r,i],a,o){cs(e,t[n],t[r],t[i],t.scale,a,o)}var us=[`x`,`scaleX`,`originX`],ds=[`y`,`scaleY`,`originY`];function fs(e,t,n,r){ls(e.x,t,us,n?n.x:void 0,r?r.x:void 0),ls(e.y,t,ds,n?n.y:void 0,r?r.y:void 0)}function ps(e){return e.translate===0&&e.scale===1}function ms(e){return ps(e.x)&&ps(e.y)}function hs(e,t){return e.min===t.min&&e.max===t.max}function gs(e,t){return hs(e.x,t.x)&&hs(e.y,t.y)}function _s(e,t){return Math.round(e.min)===Math.round(t.min)&&Math.round(e.max)===Math.round(t.max)}function vs(e,t){return _s(e.x,t.x)&&_s(e.y,t.y)}function ys(e){return $o(e.x)/$o(e.y)}function bs(e,t){return e.translate===t.translate&&e.scale===t.scale&&e.originPoint===t.originPoint}function xs(e){return[e(`x`),e(`y`)]}function Ss(e,t,n){let r=``,i=e.x.translate/t.x,a=e.y.translate/t.y,o=n?.z||0;if((i||a||o)&&(r=`translate3d(${i}px, ${a}px, ${o}px) `),(t.x!==1||t.y!==1)&&(r+=`scale(${1/t.x}, ${1/t.y}) `),n){let{transformPerspective:e,rotate:t,pathRotation:i,rotateX:a,rotateY:o,skewX:s,skewY:c}=n;e&&(r=`perspective(${e}px) ${r}`),t&&(r+=`rotate(${t}deg) `),i&&(r+=`rotate(${i}deg) `),a&&(r+=`rotateX(${a}deg) `),o&&(r+=`rotateY(${o}deg) `),s&&(r+=`skewX(${s}deg) `),c&&(r+=`skewY(${c}deg) `)}let s=e.x.scale*t.x,c=e.y.scale*t.y;return(s!==1||c!==1)&&(r+=`scale(${s}, ${c})`),r||`none`}var Cs=Mi.length,ws=e=>typeof e==`string`?parseFloat(e):e,Ts=e=>typeof e==`number`||H.test(e);function Es(e,t,n,r,i,a){i?(e.opacity=jt(0,n.opacity??1,Os(r)),e.opacityExit=jt(t.opacity??1,0,ks(r))):a&&(e.opacity=jt(t.opacity??1,n.opacity??1,r));for(let i=0;irt?1:n(R(e,t,r))}function js(e,t,n){let r=ri(e)?e:Fr(e);return r.start(Gr(``,r,t,n)),r.animation}function Ms(e,t,n,r={passive:!0}){return e.addEventListener(t,n,r),()=>e.removeEventListener(t,n,r)}var Ns=(e,t)=>e.depth-t.depth,Ps=class{constructor(){this.children=[],this.isDirty=!1}add(e){ee(this.children,e),this.isDirty=!0}remove(e){M(this.children,e),this.isDirty=!0}forEach(e){this.isDirty&&this.children.sort(Ns),this.isDirty=!1,this.children.forEach(e)}};function Fs(e,t){let n=Le.now(),r=({timestamp:i})=>{let a=i-n;a>=t&&(Me(r),e(a-t))};return V.setup(r,!0),()=>Me(r)}function Is(e){return ri(e)?e.get():e}var Ls=class{constructor(){this.members=[]}add(e){ee(this.members,e);for(let t=this.members.length-1;t>=0;t--){let n=this.members[t];if(n===e||n===this.lead||n===this.prevLead)continue;let r=n.instance;(!r||r.isConnected===!1)&&!n.snapshot&&(M(this.members,n),n.unmount())}e.scheduleRender()}remove(e){if(M(this.members,e),e===this.prevLead&&(this.prevLead=void 0),e===this.lead){let e=this.members[this.members.length-1];e&&this.promote(e)}}relegate(e){for(let t=this.members.indexOf(e)-1;t>=0;t--){let e=this.members[t];if(e.isPresent!==!1&&e.instance?.isConnected!==!1)return this.promote(e),!0}return!1}promote(e,t){let n=this.lead;if(e!==n&&(this.prevLead=n,this.lead=e,e.show(),n)){n.updateSnapshot(),e.scheduleRender();let{layoutDependency:r}=n.options,{layoutDependency:i}=e.options;(r===void 0||r!==i)&&(e.resumeFrom=n,t&&(n.preserveOpacity=!0),n.snapshot&&(e.snapshot=n.snapshot,e.snapshot.latestValues=n.animationValues||n.latestValues),e.root?.isUpdating&&(e.isLayoutDirty=!0)),e.options.crossfade===!1&&n.hide()}}exitAnimationComplete(){this.members.forEach(e=>{e.options.onExitComplete?.(),e.resumingFrom?.options.onExitComplete?.()})}scheduleRender(){this.members.forEach(e=>e.instance&&e.scheduleRender(!1))}removeLeadSnapshot(){this.lead?.snapshot&&(this.lead.snapshot=void 0)}},Rs={hasAnimatedSinceResize:!0,hasEverUpdated:!1},zs={nodes:0,calculatedTargetDeltas:0,calculatedProjections:0},Bs=[``,`X`,`Y`,`Z`],Vs=1e3,Hs=0;function Us(e,t,n,r){let{latestValues:i}=t;i[e]&&(n[e]=i[e],t.setStaticValue(e,0),r&&(r[e]=0))}function Ws(e){if(e.hasCheckedOptimisedAppear=!0,e.root===e)return;let{visualElement:t}=e.options;if(!t)return;let n=ci(t);if(window.MotionHasOptimisedAnimation(n,`transform`)){let{layout:t,layoutId:r}=e.options;window.MotionCancelOptimisedAnimation(n,`transform`,V,!(t||r))}let{parent:r}=e;r&&!r.hasCheckedOptimisedAppear&&Ws(r)}function Gs({attachResizeListener:e,defaultParent:t,measureScroll:n,checkIsScrollRoot:r,resetTransform:i}){return class{constructor(e={},n=t?.()){this.id=Hs++,this.animationId=0,this.animationCommitId=0,this.children=new Set,this.options={},this.isTreeAnimating=!1,this.isAnimationBlocked=!1,this.isLayoutDirty=!1,this.isProjectionDirty=!1,this.isSharedProjectionDirty=!1,this.isTransformDirty=!1,this.updateManuallyBlocked=!1,this.updateBlockedByResize=!1,this.isUpdating=!1,this.isSVG=!1,this.needsReset=!1,this.shouldResetTransform=!1,this.hasCheckedOptimisedAppear=!1,this.treeScale={x:1,y:1},this.eventHandlers=new Map,this.hasTreeAnimated=!1,this.layoutVersion=0,this.updateScheduled=!1,this.scheduleUpdate=()=>this.update(),this.projectionUpdateScheduled=!1,this.checkUpdateFailed=()=>{this.isUpdating&&(this.isUpdating=!1,this.clearAllSnapshots())},this.updateProjection=()=>{this.projectionUpdateScheduled=!1,va.value&&(zs.nodes=zs.calculatedTargetDeltas=zs.calculatedProjections=0),this.nodes.forEach(Js),this.nodes.forEach(rc),this.nodes.forEach(ic),this.nodes.forEach(Ys),va.addProjectionMetrics&&va.addProjectionMetrics(zs)},this.resolvedRelativeTargetAt=0,this.linkedParentVersion=0,this.hasProjected=!1,this.isVisible=!0,this.animationProgress=0,this.sharedNodes=new Map,this.latestValues=e,this.root=n?n.root||n:this,this.path=n?[...n.path,n]:[],this.parent=n,this.depth=n?n.depth+1:0;for(let e=0;ethis.root.updateBlockedByResize=!1;V.read(()=>{r=window.innerWidth}),e(t,()=>{let e=window.innerWidth;e!==r&&(r=e,this.root.updateBlockedByResize=!0,n&&n(),n=Fs(i,250),Rs.hasAnimatedSinceResize&&(Rs.hasAnimatedSinceResize=!1,this.nodes.forEach(nc)))})}n&&this.root.registerSharedNode(n,this),this.options.animate!==!1&&i&&(n||r)&&this.addEventListener(`didUpdate`,({delta:e,hasLayoutChanged:t,hasRelativeLayoutChanged:n,layout:r})=>{if(this.isTreeAnimationBlocked()){this.target=void 0,this.relativeTarget=void 0;return}let a=this.options.transition||i.getDefaultTransition()||dc,{onLayoutAnimationStart:o,onLayoutAnimationComplete:s}=i.getProps(),c=!this.targetLayout||!vs(this.targetLayout,r),l=!t&&n;if(this.options.layoutRoot||this.resumeFrom||l||t&&(c||!this.currentAnimation)){this.resumeFrom&&(this.resumingFrom=this.resumeFrom,this.resumingFrom.resumingFrom=void 0);let t={...Lr(a,`layout`),onPlay:o,onComplete:s};(i.shouldReduceMotion||this.options.layoutRoot)&&(t.delay=0,t.type=!1),this.startAnimation(t),this.setAnimationOrigin(e,l,t.path)}else t||nc(this),this.isLead()&&this.options.onExitComplete&&this.options.onExitComplete();this.targetLayout=r})}unmount(){this.options.layoutId&&this.willUpdate(),this.root.nodes.remove(this);let e=this.getStack();e&&e.remove(this),this.parent&&this.parent.children.delete(this),this.instance=void 0,this.eventHandlers.clear(),Me(this.updateProjection)}blockUpdate(){this.updateManuallyBlocked=!0}unblockUpdate(){this.updateManuallyBlocked=!1}isUpdateBlocked(){return this.updateManuallyBlocked||this.updateBlockedByResize}isTreeAnimationBlocked(){return this.isAnimationBlocked||this.parent&&this.parent.isTreeAnimationBlocked()||!1}startUpdate(){this.isUpdateBlocked()||(this.isUpdating=!0,this.nodes&&this.nodes.forEach(ac),this.animationId++)}getTransformTemplate(){let{visualElement:e}=this.options;return e&&e.getProps().transformTemplate}willUpdate(e=!0){if(this.root.hasTreeAnimated=!0,this.root.isUpdateBlocked()){this.options.onExitComplete&&this.options.onExitComplete();return}if(window.MotionCancelOptimisedAnimation&&!this.hasCheckedOptimisedAppear&&Ws(this),!this.root.isUpdating&&this.root.startUpdate(),this.isLayoutDirty)return;this.isLayoutDirty=!0;for(let e=0;e{this.isLayoutDirty?this.root.didUpdate():this.root.checkUpdateFailed()})}updateSnapshot(){this.snapshot||!this.instance||(this.snapshot=this.measure(),this.snapshot&&!$o(this.snapshot.measuredBox.x)&&!$o(this.snapshot.measuredBox.y)&&(this.snapshot=void 0))}updateLayout(){if(!this.instance||(this.updateScroll(),!(this.options.alwaysMeasureLayout&&this.isLead())&&!this.isLayoutDirty))return;if(this.resumeFrom&&!this.resumeFrom.instance)for(let e=0;e{let n=t/1e3,r=p?.(n);r?(o.x.translate=r.x,o.x.scale=jt(e.x.scale,1,n),o.x.origin=e.x.origin,o.x.originPoint=e.x.originPoint,o.y.translate=r.y,o.y.scale=jt(e.y.scale,1,n),o.y.origin=e.y.origin,o.y.originPoint=e.y.originPoint):(sc(o.x,e.x,n),sc(o.y,e.y,n)),this.setTargetDelta(o),this.relativeTarget&&this.relativeTargetOrigin&&this.layout&&this.relativeParent&&this.relativeParent.layout&&(os(s,this.layout.layoutBox,this.relativeParent.layout.layoutBox,this.options.layoutAnchor||void 0),lc(this.relativeTarget,this.relativeTargetOrigin,s,n),f&&gs(this.relativeTarget,f)&&(this.isProjectionDirty=!1),f||=Ea(),qo(f,this.relativeTarget)),c&&(this.animationValues=a,Es(a,i,this.latestValues,n,d,u)),r&&r.rotate!==void 0&&(this.animationValues||=a,this.animationValues.pathRotation=r.rotate),this.root.scheduleUpdateProjection(),this.scheduleRender(),this.animationProgress=n},this.mixTargetDelta(this.options.layoutRoot?1e3:0)}startAnimation(e){this.notifyListeners(`animationStart`),this.currentAnimation?.stop(),this.resumingFrom?.currentAnimation?.stop(),this.pendingAnimation&&=(Me(this.pendingAnimation),void 0),this.pendingAnimation=V.update(()=>{Rs.hasAnimatedSinceResize=!0,this.motionValue||=Fr(0),this.motionValue.jump(0,!1),this.currentAnimation=js(this.motionValue,[0,1e3],{...e,velocity:0,isSync:!0,onUpdate:t=>{this.mixTargetDelta(t),e.onUpdate&&e.onUpdate(t)},onComplete:()=>{e.onComplete&&e.onComplete(),this.completeAnimation()}}),this.resumingFrom&&(this.resumingFrom.currentAnimation=this.currentAnimation),this.pendingAnimation=void 0})}completeAnimation(){this.resumingFrom&&(this.resumingFrom.currentAnimation=void 0,this.resumingFrom.preserveOpacity=void 0);let e=this.getStack();e&&e.exitAnimationComplete(),this.resumingFrom=this.currentAnimation=this.animationValues=void 0,this.notifyListeners(`animationComplete`)}finishAnimation(){this.currentAnimation&&(this.mixTargetDelta&&this.mixTargetDelta(Vs),this.currentAnimation.stop()),this.completeAnimation()}applyTransformsToTarget(){let e=this.getLead(),{targetWithTransforms:t,target:n,layout:r,latestValues:i}=e;if(!(!t||!n||!r)){if(this!==e&&this.layout&&r&&gc(this.options.animationType,this.layout.layoutBox,r.layoutBox)){n=this.target||Ea();let t=$o(this.layout.layoutBox.x);n.x.min=e.target.x.min,n.x.max=n.x.min+t;let r=$o(this.layout.layoutBox.y);n.y.min=e.target.y.min,n.y.max=n.y.min+r}qo(t,n),lo(t,i),ns(this.projectionDeltaWithTransform,this.layoutCorrected,t,i)}}registerSharedNode(e,t){this.sharedNodes.has(e)||this.sharedNodes.set(e,new Ls),this.sharedNodes.get(e).add(t);let n=t.options.initialPromotionConfig;t.promote({transition:n?n.transition:void 0,preserveFollowOpacity:n&&n.shouldPreserveFollowOpacity?n.shouldPreserveFollowOpacity(t):void 0})}isLead(){let e=this.getStack();return e?e.lead===this:!0}getLead(){let{layoutId:e}=this.options;return e&&this.getStack()?.lead||this}getPrevLead(){let{layoutId:e}=this.options;return e?this.getStack()?.prevLead:void 0}getStack(){let{layoutId:e}=this.options;if(e)return this.root.sharedNodes.get(e)}promote({needsReset:e,transition:t,preserveFollowOpacity:n}={}){let r=this.getStack();r&&r.promote(this,n),e&&(this.projectionDelta=void 0,this.needsReset=!0),t&&this.setOptions({transition:t})}relegate(){let e=this.getStack();return e?e.relegate(this):!1}resetSkewAndRotation(){let{visualElement:e}=this.options;if(!e)return;let t=!1,{latestValues:n}=e;if((n.z||n.rotate||n.rotateX||n.rotateY||n.rotateZ||n.skewX||n.skewY)&&(t=!0),!t)return;let r={};n.z&&Us(`z`,e,r,this.animationValues);for(let t=0;te.currentAnimation?.stop()),this.root.nodes.forEach(Zs),this.root.sharedNodes.clear()}}}function Ks(e){e.updateLayout()}function qs(e){let t=e.resumeFrom?.snapshot||e.snapshot;if(e.isLead()&&e.layout&&t&&e.hasListeners(`didUpdate`)){let{layoutBox:n,measuredBox:r}=e.layout,{animationType:i}=e.options,a=t.source!==e.layout.source;if(i===`size`)xs(e=>{let r=a?t.measuredBox[e]:t.layoutBox[e],i=$o(r);r.min=n[e].min,r.max=r.min+i});else if(i===`x`||i===`y`){let e=i===`x`?`y`:`x`;Ko(a?t.measuredBox[e]:t.layoutBox[e],n[e])}else gc(i,t.layoutBox,n)&&xs(r=>{let i=a?t.measuredBox[r]:t.layoutBox[r],o=$o(n[r]);i.max=i.min+o,e.relativeTarget&&!e.currentAnimation&&(e.isProjectionDirty=!0,e.relativeTarget[r].max=e.relativeTarget[r].min+o)});let o=wa();ns(o,n,t.layoutBox);let s=wa();a?ns(s,e.applyTransform(r,!0),t.measuredBox):ns(s,n,t.layoutBox);let c=!ms(o),l=!1;if(!e.resumeFrom){let r=e.getClosestProjectingParent();if(r&&!r.resumeFrom){let{snapshot:i,layout:a}=r;if(i&&a){let o=e.options.layoutAnchor||void 0,s=Ea();os(s,t.layoutBox,i.layoutBox,o);let c=Ea();os(c,n,a.layoutBox,o),vs(s,c)||(l=!0),r.options.layoutRoot&&(e.relativeTarget=c,e.relativeTargetOrigin=s,e.relativeParent=r)}}}e.notifyListeners(`didUpdate`,{layout:n,snapshot:t,delta:s,layoutDelta:o,hasLayoutChanged:c,hasRelativeLayoutChanged:l})}else if(e.isLead()){let{onExitComplete:t}=e.options;t&&t()}e.options.transition=void 0}function Js(e){va.value&&zs.nodes++,e.parent&&(e.isProjecting()||(e.isProjectionDirty=e.parent.isProjectionDirty),e.isSharedProjectionDirty||=!!(e.isProjectionDirty||e.parent.isProjectionDirty||e.parent.isSharedProjectionDirty),e.isTransformDirty||=e.parent.isTransformDirty)}function Ys(e){e.isProjectionDirty=e.isSharedProjectionDirty=e.isTransformDirty=!1}function Xs(e){e.clearSnapshot()}function Zs(e){e.clearMeasurements()}function Qs(e){e.isLayoutDirty=!0,e.updateLayout()}function $s(e){e.isLayoutDirty=!1}function ec(e){e.isAnimationBlocked&&e.layout&&!e.isLayoutDirty&&(e.snapshot=e.layout,e.isLayoutDirty=!0)}function tc(e){let{visualElement:t}=e.options;t&&t.getProps().onBeforeLayoutMeasure&&t.notify(`BeforeLayoutMeasure`),e.resetTransform()}function nc(e){e.finishAnimation(),e.targetDelta=e.relativeTarget=e.target=void 0,e.isProjectionDirty=!0}function rc(e){e.resolveTargetDelta()}function ic(e){e.calcProjection()}function ac(e){e.resetSkewAndRotation()}function oc(e){e.removeLeadSnapshot()}function sc(e,t,n){e.translate=jt(t.translate,0,n),e.scale=jt(t.scale,1,n),e.origin=t.origin,e.originPoint=t.originPoint}function cc(e,t,n,r){e.min=jt(t.min,n.min,r),e.max=jt(t.max,n.max,r)}function lc(e,t,n,r){cc(e.x,t.x,n.x,r),cc(e.y,t.y,n.y,r)}function uc(e){return e.animationValues&&e.animationValues.opacityExit!==void 0}var dc={duration:.45,ease:[.4,0,.1,1]},fc=e=>typeof navigator<`u`&&navigator.userAgent&&navigator.userAgent.toLowerCase().includes(e),pc=fc(`applewebkit/`)&&!fc(`chrome/`)?Math.round:re;function mc(e){e.min=pc(e.min),e.max=pc(e.max)}function hc(e){mc(e.x),mc(e.y)}function gc(e,t,n){return e===`position`||e===`preserve-aspect`&&!es(ys(t),ys(n),.2)}function _c(e){return e!==e.root&&e.scroll?.wasRoot}var vc=Gs({attachResizeListener:(e,t)=>Ms(e,`resize`,t),measureScroll:()=>({x:document.documentElement.scrollLeft||document.body?.scrollLeft||0,y:document.documentElement.scrollTop||document.body?.scrollTop||0}),checkIsScrollRoot:()=>!0}),yc={current:void 0},bc=Gs({measureScroll:e=>({x:e.scrollLeft,y:e.scrollTop}),defaultParent:()=>{if(!yc.current){let e=new vc({});e.mount(window),e.setOptions({layoutScroll:!0}),yc.current=e}return yc.current},resetTransform:(e,t)=>{e.style.transform=t===void 0?`none`:t},checkIsScrollRoot:e=>window.getComputedStyle(e).position===`fixed`}),xc=(0,b.createContext)({transformPagePoint:e=>e,isStatic:!1,reducedMotion:`never`});function Sc(e,t){if(typeof e==`function`)return e(t);e!=null&&(e.current=t)}function Cc(...e){return t=>{let n=!1,r=e.map(e=>{let r=Sc(e,t);return!n&&typeof r==`function`&&(n=!0),r});if(n)return()=>{for(let t=0;t{let{width:e,height:u,top:d,left:f,right:p,bottom:m,direction:h}=c.current;if(t||a===!1||!s.current||!e||!u)return;let g=h===`rtl`,_=n===`left`?g?`right: ${p}`:`left: ${f}`:g?`left: ${f}`:`right: ${p}`,v=r===`bottom`?`bottom: ${m}`:`top: ${d}`;s.current.dataset.motionPopId=o;let y=document.createElement(`style`);l&&(y.nonce=l);let b=i??document.head;return b.appendChild(y),y.sheet&&y.sheet.insertRule(` + [data-motion-pop-id="${o}"] { + position: absolute !important; + width: ${e}px !important; + height: ${u}px !important; + ${_}px !important; + ${v}px !important; + } + `),()=>{s.current?.removeAttribute(`data-motion-pop-id`),b.contains(y)&&b.removeChild(y)}},[t]),(0,w.jsx)(Tc,{isPresent:t,childRef:s,sizeRef:c,pop:a,children:a===!1?e:b.cloneElement(e,{ref:u})})}var Dc=({children:e,initial:t,isPresent:n,onExitComplete:r,custom:i,presenceAffectsLayout:a,mode:o,anchorX:s,anchorY:c,root:l})=>{let u=k(Oc),d=(0,b.useId)(),f=(0,b.useRef)(n),p=(0,b.useRef)(r);A(()=>{f.current=n,p.current=r});let m=!0,h=(0,b.useMemo)(()=>(m=!1,{id:d,initial:t,isPresent:n,custom:i,onExitComplete:e=>{u.set(e,!0);for(let e of u.values())if(!e)return;r&&r()},register:e=>(u.set(e,!1),()=>{u.delete(e),!f.current&&!u.size&&p.current?.()})}),[n,u,r]);return a&&m&&(h={...h}),(0,b.useMemo)(()=>{u.forEach((e,t)=>u.set(t,!1))},[n]),b.useEffect(()=>{!n&&!u.size&&r&&r()},[n]),e=(0,w.jsx)(Ec,{pop:o===`popLayout`,isPresent:n,anchorX:s,anchorY:c,root:l,children:e}),(0,w.jsx)(j.Provider,{value:h,children:e})};function Oc(){return new Map}function kc(e=!0){let t=(0,b.useContext)(j);if(t===null)return[!0,null];let{isPresent:n,onExitComplete:r,register:i}=t,a=(0,b.useId)();(0,b.useEffect)(()=>{if(e)return i(a)},[e]);let o=(0,b.useCallback)(()=>e&&r&&r(a),[a,r,e]);return!n&&r?[!1,o]:[!0]}var Ac=e=>e.key||``;function jc(e){let t=[];return b.Children.forEach(e,e=>{(0,b.isValidElement)(e)&&t.push(e)}),t}var Mc=({children:e,custom:t,initial:n=!0,onExitComplete:r,presenceAffectsLayout:i=!0,mode:a=`sync`,propagate:o=!1,anchorX:s=`left`,anchorY:c=`top`,root:l})=>{let[u,d]=kc(o),f=(0,b.useMemo)(()=>jc(e),[e]),p=o&&!u?[]:f.map(Ac),m=(0,b.useRef)(!0),h=(0,b.useRef)(f),g=k(()=>new Map),_=(0,b.useRef)(new Set),[v,y]=(0,b.useState)(f),[x,S]=(0,b.useState)(f);A(()=>{m.current=!1,h.current=f;for(let e=0;e{let v=Ac(e),y=o&&!u?!1:f===x||p.includes(v);return(0,w.jsx)(Dc,{isPresent:y,initial:!m.current||n?void 0:!1,custom:t,presenceAffectsLayout:i,mode:a,root:l,onExitComplete:y?void 0:()=>{if(_.current.has(v))return;if(g.has(v))_.current.add(v),g.set(v,!0);else return;let e=!0;g.forEach(t=>{t||(e=!1)}),e&&(T?.(),S(h.current),o&&d?.(),r&&r())},anchorX:s,anchorY:c,children:e},v)})})},Nc=(0,b.createContext)({strict:!1}),Pc={animation:[`animate`,`variants`,`whileHover`,`whileTap`,`exit`,`whileInView`,`whileFocus`,`whileDrag`],exit:[`exit`],drag:[`drag`,`dragControls`],focus:[`whileFocus`],hover:[`whileHover`,`onHoverStart`,`onHoverEnd`],tap:[`whileTap`,`onTap`,`onTapStart`,`onTapCancel`],pan:[`onPan`,`onPanStart`,`onPanSessionStart`,`onPanEnd`],inView:[`whileInView`,`onViewportEnter`,`onViewportLeave`],layout:[`layout`,`layoutId`]},Fc=!1;function Ic(){if(Fc)return;let e={};for(let t in Pc)e[t]={isEnabled:e=>Pc[t].some(t=>!!e[t])};Va(e),Fc=!0}function Lc(){return Ic(),Ha()}function Rc(e){let t=Lc();for(let n in e)t[n]={...t[n],...e[n]};Va(t)}var zc=new Set(`animate.exit.variants.initial.style.values.variants.transition.transformTemplate.custom.inherit.onBeforeLayoutMeasure.onAnimationStart.onAnimationComplete.onUpdate.onDragStart.onDrag.onDragEnd.onMeasureDragConstraints.onDirectionLock.onDragTransitionEnd._dragX._dragY.onHoverStart.onHoverEnd.onViewportEnter.onViewportLeave.globalTapTarget.propagate.ignoreStrict.viewport`.split(`.`));function Bc(e){return e.startsWith(`while`)||e.startsWith(`drag`)&&e!==`draggable`||e.startsWith(`layout`)||e.startsWith(`onTap`)||e.startsWith(`onPan`)||e.startsWith(`onLayout`)||zc.has(e)}var Vc=c({default:()=>Hc}),Hc,Uc=o((()=>{throw Hc={},Error(`Could not resolve "@emotion/is-prop-valid" imported by "framer-motion". Is it installed?`)})),Wc=e=>!Bc(e);function Gc(e){typeof e==`function`&&(Wc=t=>t.startsWith(`on`)?!Bc(t):e(t))}try{Gc((Uc(),d(Vc)).default)}catch{}function Kc(e,t,n){let r={};for(let i in e)i===`values`&&typeof e.values==`object`||ri(e[i])||(Wc(i)||n===!0&&Bc(i)||!t&&!Bc(i)||e.draggable&&i.startsWith(`onDrag`))&&(r[i]=e[i]);return r}var qc=(0,b.createContext)({});function Jc(e,t){if(Ma(e)){let{initial:t,animate:n}=e;return{initial:t===!1||ka(t)?t:void 0,animate:ka(n)?n:void 0}}return e.inherit===!1?{}:t}function Yc(e){let{initial:t,animate:n}=Jc(e,(0,b.useContext)(qc));return(0,b.useMemo)(()=>({initial:t,animate:n}),[Xc(t),Xc(n)])}function Xc(e){return Array.isArray(e)?e.join(` `):e}var Zc=()=>({style:{},transform:{},transformOrigin:{},vars:{}});function Qc(e,t,n){for(let r in t)!ri(t[r])&&!So(r,n)&&(e[r]=t[r])}function $c({transformTemplate:e},t){return(0,b.useMemo)(()=>{let n=Zc();return go(n,t,e),Object.assign({},n.vars,n.style)},[t])}function el(e,t){let n=e.style||{},r={};return Qc(r,n,e),Object.assign(r,$c(e,t)),r}function tl(e,t){let n={},r=el(e,t);return e.drag&&e.dragListener!==!1&&(n.draggable=!1,r.userSelect=r.WebkitUserSelect=r.WebkitTouchCallout=`none`,r.touchAction=e.drag===!0?`none`:`pan-${e.drag===`x`?`y`:`x`}`),e.tabIndex===void 0&&(e.onTap||e.onTapStart||e.whileTap)&&(n.tabIndex=0),n.style=r,n}var nl=()=>({...Zc(),attrs:{}});function rl(e,t,n,r){let i=(0,b.useMemo)(()=>{let n=nl();return Ao(n,t,Mo(r),e.transformTemplate,e.style),{...n.attrs,style:{...n.style}}},[t]);if(e.style){let t={};Qc(t,e.style,e),i.style={...t,...i.style}}return i}var il=[`animate`,`circle`,`defs`,`desc`,`ellipse`,`g`,`image`,`line`,`filter`,`marker`,`mask`,`metadata`,`path`,`pattern`,`polygon`,`polyline`,`rect`,`stop`,`switch`,`symbol`,`svg`,`text`,`tspan`,`use`,`view`];function al(e){return typeof e!=`string`||e.includes(`-`)?!1:!!(il.indexOf(e)>-1||/[A-Z]/u.test(e))}function ol(e,t,n,{latestValues:r},i,a=!1,o){let s=(o??al(e)?rl:tl)(t,r,i,e),c=Kc(t,typeof e==`string`,a),l=e===b.Fragment?{}:{...c,...s,ref:n},{children:u}=t,d=(0,b.useMemo)(()=>ri(u)?u.get():u,[u]);return(0,b.createElement)(e,{...l,children:d})}function sl({scrapeMotionValuesFromProps:e,createRenderState:t},n,r,i){return{latestValues:cl(n,r,i,e),renderState:t()}}function cl(e,t,n,r){let i={},a=r(e,{});for(let e in a)i[e]=Is(a[e]);let{initial:o,animate:s}=e,c=Ma(e),l=Na(e);t&&l&&!c&&e.inherit!==!1&&(o===void 0&&(o=t.initial),s===void 0&&(s=t.animate));let u=n?n.initial===!1:!1;u||=o===!1;let d=u?s:o;if(d&&typeof d!=`boolean`&&!Oa(d)){let t=Array.isArray(d)?d:[d];for(let n=0;n(t,n)=>{let r=(0,b.useContext)(qc),i=(0,b.useContext)(j),a=()=>sl(e,t,r,i);return n?a():k(a)},ul=ll({scrapeMotionValuesFromProps:Co,createRenderState:Zc}),dl=ll({scrapeMotionValuesFromProps:Po,createRenderState:nl}),fl=Symbol.for(`motionComponentSymbol`);function pl(e,t,n){let r=(0,b.useRef)(n);(0,b.useInsertionEffect)(()=>{r.current=n});let i=(0,b.useRef)(null);return(0,b.useCallback)(n=>{n&&e.onMount?.(n),t&&(n?t.mount(n):t.unmount());let a=r.current;if(typeof a==`function`)if(n){let e=a(n);typeof e==`function`&&(i.current=e)}else i.current?(i.current(),i.current=null):a(n);else a&&(a.current=n)},[t])}var ml=(0,b.createContext)({});function hl(e){return e&&typeof e==`object`&&Object.prototype.hasOwnProperty.call(e,`current`)}function gl(e,t,n,r,i,a){let{visualElement:o}=(0,b.useContext)(qc),s=(0,b.useContext)(Nc),c=(0,b.useContext)(j),l=(0,b.useContext)(xc),u=l.reducedMotion,d=l.skipAnimations,f=(0,b.useRef)(null),p=(0,b.useRef)(!1);r||=s.renderer,!f.current&&r&&(f.current=r(e,{visualState:t,parent:o,props:n,presenceContext:c,blockInitialAnimation:c?c.initial===!1:!1,reducedMotionConfig:u,skipAnimations:d,isSVG:a}),p.current&&f.current&&(f.current.manuallyAnimateOnMount=!0));let m=f.current,h=(0,b.useContext)(ml);m&&!m.projection&&i&&(m.type===`html`||m.type===`svg`)&&_l(f.current,n,i,h);let g=(0,b.useRef)(!1);(0,b.useInsertionEffect)(()=>{m&&g.current&&m.update(n,c)});let _=n[si],v=(0,b.useRef)(!!_&&typeof window<`u`&&!window.MotionHandoffIsComplete?.(_)&&window.MotionHasOptimisedAnimation?.(_));return A(()=>{p.current=!0,m&&(g.current=!0,window.MotionIsMounted=!0,m.updateFeatures(),m.scheduleRenderMicrotask(),v.current&&m.animationState&&m.animationState.animateChanges())}),(0,b.useEffect)(()=>{m&&(!v.current&&m.animationState&&m.animationState.animateChanges(),v.current&&=(queueMicrotask(()=>{window.MotionHandoffMarkAsComplete?.(_)}),!1),m.enteringChildren=void 0)}),m}function _l(e,t,n,r){let{layoutId:i,layout:a,drag:o,dragConstraints:s,layoutScroll:c,layoutRoot:l,layoutAnchor:u,layoutCrossfade:d}=t;e.projection=new n(e.latestValues,t[`data-framer-portal-id`]?void 0:vl(e.parent)),e.projection.setOptions({layoutId:i,layout:a,alwaysMeasureLayout:!!o||s&&hl(s),visualElement:e,animationType:typeof a==`string`?a:`both`,initialPromotionConfig:r,crossfade:d,layoutScroll:c,layoutRoot:l,layoutAnchor:u})}function vl(e){if(e)return e.options.allowProjection===!1?vl(e.parent):e.projection}function yl(e,{forwardMotionProps:t=!1,type:n}={},r,i){r&&Rc(r);let a=n?n===`svg`:al(e),o=a?dl:ul;function s(n,s){let c,l={...(0,b.useContext)(xc),...n,layoutId:bl(n)},{isStatic:u}=l,d=Yc(n),f=o(n,u);if(!u&&typeof window<`u`){xl(l,r);let t=Sl(l);c=t.MeasureLayout,d.visualElement=gl(e,f,l,i,t.ProjectionNode,a)}return(0,w.jsxs)(qc.Provider,{value:d,children:[c&&d.visualElement?(0,w.jsx)(c,{visualElement:d.visualElement,...l}):null,ol(e,n,pl(f,d.visualElement,s),f,u,t,a)]})}s.displayName=`motion.${typeof e==`string`?e:`create(${e.displayName??e.name??``})`}`;let c=(0,b.forwardRef)(s);return c[fl]=e,c}function bl({layoutId:e}){let t=(0,b.useContext)(O).id;return t&&e!==void 0?t+`-`+e:e}function xl(e,t){(0,b.useContext)(Nc).strict}function Sl(e){let{drag:t,layout:n}=Lc();if(!t&&!n)return{};let r={...t,...n};return{MeasureLayout:t?.isEnabled(e)||n?.isEnabled(e)?r.MeasureLayout:void 0,ProjectionNode:r.ProjectionNode}}function Cl(e,t){if(typeof Proxy>`u`)return yl;let n=new Map,r=(n,r)=>yl(n,r,e,t);return new Proxy((e,t)=>r(e,t),{get:(i,a)=>a===`create`?r:(n.has(a)||n.set(a,yl(a,void 0,e,t)),n.get(a))})}var wl=(e,t)=>t.isSVG??al(e)?new Fo(t):new To(t,{allowProjection:e!==b.Fragment}),Tl=class extends Ga{constructor(e){super(e),e.animationState||=Ho(e)}updateAnimationControlsSubscription(){let{animate:e}=this.node.getProps();Oa(e)&&(this.unmountControls=e.subscribe(this.node))}mount(){this.updateAnimationControlsSubscription()}update(){let{animate:e}=this.node.getProps(),{animate:t}=this.node.prevProps||{};e!==t&&this.updateAnimationControlsSubscription()}unmount(){this.node.animationState.reset(),this.unmountControls?.()}},El=0,Dl={animation:{Feature:Tl},exit:{Feature:class extends Ga{constructor(){super(...arguments),this.id=El++,this.isExitComplete=!1}update(){if(!this.node.presenceContext)return;let{isPresent:e,onExitComplete:t}=this.node.presenceContext,{isPresent:n}=this.node.prevPresenceContext||{};if(!this.node.animationState||e===n)return;if(e&&n===!1){if(this.isExitComplete){let{initial:e,custom:t}=this.node.getProps();if(typeof e==`string`||typeof e==`object`&&e&&!Array.isArray(e)){let n=Zr(this.node,e,t);if(n){let{transition:e,transitionEnd:t,...r}=n;for(let e in r)this.node.getValue(e)?.jump(r[e])}}this.node.animationState.reset(),this.node.animationState.animateChanges()}else this.node.animationState.setActive(`exit`,!1);this.isExitComplete=!1;return}let r=this.node.animationState.setActive(`exit`,!e);t&&!e&&r.then(()=>{this.isExitComplete=!0,t(this.id)})}mount(){let{register:e,onExitComplete:t}=this.node.presenceContext||{};t&&t(this.id),e&&(this.unmount=e(this.id))}unmount(){}}}};function Ol(e){return{point:{x:e.pageX,y:e.pageY}}}var kl=e=>t=>Gi(t)&&e(t,Ol(t));function Al(e,t,n,r){return Ms(e,t,kl(n),r)}var jl=({current:e})=>e?e.ownerDocument.defaultView:null,Ml=(e,t)=>Math.abs(e-t);function Nl(e,t){let n=Ml(e.x,t.x),r=Ml(e.y,t.y);return Math.sqrt(n**2+r**2)}var Pl=new Set([`auto`,`scroll`]),Fl=class{constructor(e,t,{transformPagePoint:n,contextWindow:r=window,dragSnapToOrigin:i=!1,distanceThreshold:a=3,element:o}={}){if(this.startEvent=null,this.lastMoveEvent=null,this.lastMoveEventInfo=null,this.lastRawMoveEventInfo=null,this.handlers={},this.contextWindow=window,this.scrollPositions=new Map,this.removeScrollListeners=null,this.onElementScroll=e=>{this.handleScroll(e.target)},this.onWindowScroll=()=>{this.handleScroll(window)},this.updatePoint=()=>{if(!(this.lastMoveEvent&&this.lastMoveEventInfo))return;this.lastRawMoveEventInfo&&(this.lastMoveEventInfo=Il(this.lastRawMoveEventInfo,this.transformPagePoint));let e=Rl(this.lastMoveEventInfo,this.history),t=this.startEvent!==null,n=Nl(e.offset,{x:0,y:0})>=this.distanceThreshold;if(!t&&!n)return;let{point:r}=e,{timestamp:i}=Ne;this.history.push({...r,timestamp:i});let{onStart:a,onMove:o}=this.handlers;t||(a&&a(this.lastMoveEvent,e),this.startEvent=this.lastMoveEvent),o&&o(this.lastMoveEvent,e)},this.handlePointerMove=(e,t)=>{this.lastMoveEvent=e,this.lastRawMoveEventInfo=t,this.lastMoveEventInfo=Il(t,this.transformPagePoint),V.update(this.updatePoint,!0)},this.handlePointerUp=(e,t)=>{this.end();let{onEnd:n,onSessionEnd:r,resumeAnimation:i}=this.handlers;if((this.dragSnapToOrigin||!this.startEvent)&&i&&i(),!(this.lastMoveEvent&&this.lastMoveEventInfo))return;let a=Rl(e.type===`pointercancel`?this.lastMoveEventInfo:Il(t,this.transformPagePoint),this.history);this.startEvent&&n&&n(e,a),r&&r(e,a)},!Gi(e))return;this.dragSnapToOrigin=i,this.handlers=t,this.transformPagePoint=n,this.distanceThreshold=a,this.contextWindow=r||window;let s=Il(Ol(e),this.transformPagePoint),{point:c}=s,{timestamp:l}=Ne;this.history=[{...c,timestamp:l}];let{onSessionStart:u}=t;u&&u(e,Rl(s,this.history));let d={passive:!0,capture:!0};this.removeListeners=L(Al(this.contextWindow,`pointermove`,this.handlePointerMove,d),Al(this.contextWindow,`pointerup`,this.handlePointerUp,d),Al(this.contextWindow,`pointercancel`,this.handlePointerUp,d)),o&&this.startScrollTracking(o)}startScrollTracking(e){let t=e.parentElement;for(;t;){let e=getComputedStyle(t);(Pl.has(e.overflowX)||Pl.has(e.overflowY))&&this.scrollPositions.set(t,{x:t.scrollLeft,y:t.scrollTop}),t=t.parentElement}this.scrollPositions.set(window,{x:window.scrollX,y:window.scrollY}),window.addEventListener(`scroll`,this.onElementScroll,{capture:!0}),window.addEventListener(`scroll`,this.onWindowScroll),this.removeScrollListeners=()=>{window.removeEventListener(`scroll`,this.onElementScroll,{capture:!0}),window.removeEventListener(`scroll`,this.onWindowScroll)}}handleScroll(e){let t=this.scrollPositions.get(e);if(!t)return;let n=e===window,r=n?{x:window.scrollX,y:window.scrollY}:{x:e.scrollLeft,y:e.scrollTop},i={x:r.x-t.x,y:r.y-t.y};i.x===0&&i.y===0||(n?this.lastMoveEventInfo&&(this.lastMoveEventInfo.point.x+=i.x,this.lastMoveEventInfo.point.y+=i.y):this.history.length>0&&(this.history[0].x-=i.x,this.history[0].y-=i.y),this.scrollPositions.set(e,r),V.update(this.updatePoint,!0))}updateHandlers(e){this.handlers=e}end(){this.removeListeners&&this.removeListeners(),this.removeScrollListeners&&this.removeScrollListeners(),this.scrollPositions.clear(),Me(this.updatePoint)}};function Il(e,t){return t?{point:t(e.point)}:e}function Ll(e,t){return{x:e.x-t.x,y:e.y-t.y}}function Rl({point:e},t){return{point:e,delta:Ll(e,Bl(t)),offset:Ll(e,zl(t)),velocity:Vl(t,.1)}}function zl(e){return e[0]}function Bl(e){return e[e.length-1]}function Vl(e,t){if(e.length<2)return{x:0,y:0};let n=e.length-1,r=null,i=Bl(e);for(;n>=0&&(r=e[n],!(i.timestamp-r.timestamp>B(t)));)n--;if(!r)return{x:0,y:0};r===e[0]&&e.length>2&&i.timestamp-r.timestamp>B(t)*2&&(r=e[1]);let a=ie(i.timestamp-r.timestamp);if(a===0)return{x:0,y:0};let o={x:(i.x-r.x)/a,y:(i.y-r.y)/a};return o.x===1/0&&(o.x=0),o.y===1/0&&(o.y=0),o}function G(e,{min:t,max:n},r){return t!==void 0&&en&&(e=r?jt(n,e,r.max):Math.min(e,n)),e}function K(e,t,n){return{min:t===void 0?void 0:e.min+t,max:n===void 0?void 0:e.max+n-(e.max-e.min)}}function Hl(e,{top:t,left:n,bottom:r,right:i}){return{x:K(e.x,n,i),y:K(e.y,t,r)}}function Ul(e,t){let n=t.min-e.min,r=t.max-e.max;return t.max-t.minr?n=R(t.min,t.max-r,e.min):r>i&&(n=R(e.min,e.max-i,t.min)),N(0,1,n)}function Kl(e,t){let n={};return t.min!==void 0&&(n.min=t.min-e.min),t.max!==void 0&&(n.max=t.max-e.min),n}var ql=.35;function Jl(e=ql){return e===!1?e=0:e===!0&&(e=ql),{x:Yl(e,`left`,`right`),y:Yl(e,`top`,`bottom`)}}function Yl(e,t,n){return{min:Xl(e,t),max:Xl(e,n)}}function Xl(e,t){return typeof e==`number`?e:e[t]||0}var Zl=new WeakMap,Ql=class{constructor(e){this.openDragLock=null,this.isDragging=!1,this.currentDirection=null,this.originPoint={x:0,y:0},this.constraints=!1,this.hasMutatedConstraints=!1,this.elastic=Ea(),this.latestPointerEvent=null,this.latestPanInfo=null,this.visualElement=e}start(e,{snapToCursor:t=!1,distanceThreshold:n}={}){let{presenceContext:r}=this.visualElement;if(r&&r.isPresent===!1)return;let i=e=>{t&&this.snapToCursor(Ol(e).point),this.stopAnimation()},a=(e,t)=>{let{drag:n,dragPropagation:r,onDragStart:i}=this.getProps();if(n&&!r&&(this.openDragLock&&this.openDragLock(),this.openDragLock=Bi(n),!this.openDragLock))return;this.latestPointerEvent=e,this.latestPanInfo=t,this.isDragging=!0,this.currentDirection=null,this.resolveConstraints(),this.visualElement.projection&&(this.visualElement.projection.isAnimationBlocked=!0,this.visualElement.projection.target=void 0),xs(e=>{let t=this.getAxisMotionValue(e).get()||0;if(ot.test(t)){let{projection:n}=this.visualElement;if(n&&n.layout){let r=n.layout.layoutBox[e];r&&(t=$o(r)*(parseFloat(t)/100))}}this.originPoint[e]=t}),i&&V.update(()=>i(e,t),!1,!0),ai(this.visualElement,`transform`);let{animationState:a}=this.visualElement;a&&a.setActive(`whileDrag`,!0)},o=(e,t)=>{this.latestPointerEvent=e,this.latestPanInfo=t;let{dragPropagation:n,dragDirectionLock:r,onDirectionLock:i,onDrag:a}=this.getProps();if(!n&&!this.openDragLock)return;let{offset:o}=t;if(r&&this.currentDirection===null){this.currentDirection=nu(o),this.currentDirection!==null&&i&&i(this.currentDirection);return}this.updateAxis(`x`,t.point,o),this.updateAxis(`y`,t.point,o),this.visualElement.render(),a&&V.update(()=>a(e,t),!1,!0)},s=(e,t)=>{this.latestPointerEvent=e,this.latestPanInfo=t,this.stop(e,t),this.latestPointerEvent=null,this.latestPanInfo=null},c=()=>{let{dragSnapToOrigin:e}=this.getProps();(e||this.constraints)&&this.startAnimation({x:0,y:0})},{dragSnapToOrigin:l}=this.getProps();this.panSession=new Fl(e,{onSessionStart:i,onStart:a,onMove:o,onSessionEnd:s,resumeAnimation:c},{transformPagePoint:this.visualElement.getTransformPagePoint(),dragSnapToOrigin:l,distanceThreshold:n,contextWindow:jl(this.visualElement),element:this.visualElement.current})}stop(e,t){let n=e||this.latestPointerEvent,r=t||this.latestPanInfo,i=this.isDragging;if(this.cancel(),!i||!r||!n)return;let{velocity:a}=r;this.startAnimation(a);let{onDragEnd:o}=this.getProps();o&&V.postRender(()=>o(n,r))}cancel(){this.isDragging=!1;let{projection:e,animationState:t}=this.visualElement;e&&(e.isAnimationBlocked=!1),this.endPanSession();let{dragPropagation:n}=this.getProps();!n&&this.openDragLock&&(this.openDragLock(),this.openDragLock=null),t&&t.setActive(`whileDrag`,!1)}endPanSession(){this.panSession&&this.panSession.end(),this.panSession=void 0}updateAxis(e,t,n){let{drag:r}=this.getProps();if(!n||!tu(e,r,this.currentDirection))return;let i=this.getAxisMotionValue(e),a=this.originPoint[e]+n[e];this.constraints&&this.constraints[e]&&(a=G(a,this.constraints[e],this.elastic[e])),i.set(a)}resolveConstraints(){let{dragConstraints:e,dragElastic:t}=this.getProps(),n=this.visualElement.projection&&!this.visualElement.projection.layout?this.visualElement.projection.measure(!1):this.visualElement.projection?.layout,r=this.constraints;e&&hl(e)?this.constraints||=this.resolveRefConstraints():e&&n?this.constraints=Hl(n.layoutBox,e):this.constraints=!1,this.elastic=Jl(t),r!==this.constraints&&!hl(e)&&n&&this.constraints&&!this.hasMutatedConstraints&&xs(e=>{this.constraints!==!1&&this.getAxisMotionValue(e)&&(this.constraints[e]=Kl(n.layoutBox[e],this.constraints[e]))})}resolveRefConstraints(){let{dragConstraints:e,onMeasureDragConstraints:t}=this.getProps();if(!e||!hl(e))return!1;let n=e.current,{projection:r}=this.visualElement;if(!r||!r.layout)return!1;r.root&&(r.root.scroll=void 0,r.root.updateScroll());let i=fo(n,r.root,this.visualElement.getTransformPagePoint()),a=Wl(r.layout.layoutBox,i);if(t){let e=t(qa(a));this.hasMutatedConstraints=!!e,e&&(a=Ka(e))}return a}startAnimation(e){let{drag:t,dragMomentum:n,dragElastic:r,dragTransition:i,dragSnapToOrigin:a,onDragTransitionEnd:o}=this.getProps(),s=this.constraints||{},c=xs(o=>{if(!tu(o,t,this.currentDirection))return;let c=s&&s[o]||{};(a===!0||a===o)&&(c={min:0,max:0});let l=r?200:1e6,u=r?40:1e7,d={type:`inertia`,velocity:n?e[o]:0,bounceStiffness:l,bounceDamping:u,timeConstant:750,restDelta:1,restSpeed:10,...i,...c};return this.startAxisValueAnimation(o,d)});return Promise.all(c).then(o)}startAxisValueAnimation(e,t){let n=this.getAxisMotionValue(e);return ai(this.visualElement,e),n.start(Gr(e,n,0,t,this.visualElement,!1))}stopAnimation(){xs(e=>this.getAxisMotionValue(e).stop())}getAxisMotionValue(e){let t=`_drag${e.toUpperCase()}`;return this.visualElement.getProps()[t]||this.visualElement.getValue(e,this.visualElement.latestValues[e]??0)}snapToCursor(e){xs(t=>{let{drag:n}=this.getProps();if(!tu(t,n,this.currentDirection))return;let{projection:r}=this.visualElement,i=this.getAxisMotionValue(t);if(r&&r.layout){let{min:n,max:a}=r.layout.layoutBox[t],o=i.get()||0;i.set(e[t]-jt(n,a,.5)+o)}})}scalePositionWithinConstraints(){if(!this.visualElement.current)return;let{drag:e,dragConstraints:t}=this.getProps(),{projection:n}=this.visualElement;if(!hl(t)||!n||!this.constraints)return;this.stopAnimation();let r={x:0,y:0};xs(e=>{let t=this.getAxisMotionValue(e);if(t&&this.constraints!==!1){let n=t.get();r[e]=Gl({min:n,max:n},this.constraints[e])}});let{transformTemplate:i}=this.visualElement.getProps();this.visualElement.current.style.transform=i?i({},``):`none`,n.root&&n.root.updateScroll(),n.updateLayout(),this.constraints=!1,this.resolveConstraints(),xs(t=>{if(!tu(t,e,null))return;let n=this.getAxisMotionValue(t),{min:i,max:a}=this.constraints[t];n.set(jt(i,a,r[t]))}),this.visualElement.render()}addListeners(){if(!this.visualElement.current)return;Zl.set(this.visualElement,this);let e=this.visualElement.current,t=Al(e,`pointerdown`,t=>{let{drag:n,dragListener:r=!0}=this.getProps(),i=t.target,a=i!==e&&Yi(i);n&&r&&!a&&this.start(t)}),n,r=()=>{let{dragConstraints:t}=this.getProps();hl(t)&&t.current&&(this.constraints=this.resolveRefConstraints(),n||=eu(e,t.current,()=>this.scalePositionWithinConstraints()))},{projection:i}=this.visualElement,a=i.addEventListener(`measure`,r);i&&!i.layout&&(i.root&&i.root.updateScroll(),i.updateLayout()),V.read(r);let o=Ms(window,`resize`,()=>this.scalePositionWithinConstraints()),s=i.addEventListener(`didUpdate`,(({delta:e,hasLayoutChanged:t})=>{this.isDragging&&t&&(xs(t=>{let n=this.getAxisMotionValue(t);n&&(this.originPoint[t]+=e[t].translate,n.set(n.get()+e[t].translate))}),this.visualElement.render())}));return()=>{o(),t(),a(),s&&s(),n&&n()}}getProps(){let e=this.visualElement.getProps(),{drag:t=!1,dragDirectionLock:n=!1,dragPropagation:r=!1,dragConstraints:i=!1,dragElastic:a=ql,dragMomentum:o=!0}=e;return{...e,drag:t,dragDirectionLock:n,dragPropagation:r,dragConstraints:i,dragElastic:a,dragMomentum:o}}};function $l(e){let t=!0;return()=>{if(t){t=!1;return}e()}}function eu(e,t,n){let r=_a(e,$l(n)),i=_a(t,$l(n));return()=>{r(),i()}}function tu(e,t,n){return(t===!0||t===e)&&(n===null||n===e)}function nu(e,t=10){let n=null;return Math.abs(e.y)>t?n=`y`:Math.abs(e.x)>t&&(n=`x`),n}var ru=class extends Ga{constructor(e){super(e),this.removeGroupControls=re,this.removeListeners=re,this.controls=new Ql(e)}mount(){let{dragControls:e}=this.node.getProps();e&&(this.removeGroupControls=e.subscribe(this.controls)),this.removeListeners=this.controls.addListeners()||re}update(){let{dragControls:e}=this.node.getProps(),{dragControls:t}=this.node.prevProps||{};e!==t&&(this.removeGroupControls(),e&&(this.removeGroupControls=e.subscribe(this.controls)))}unmount(){this.removeGroupControls(),this.removeListeners(),this.controls.isDragging||this.controls.endPanSession()}},iu=e=>(t,n)=>{e&&V.update(()=>e(t,n),!1,!0)},au=class extends Ga{constructor(){super(...arguments),this.removePointerDownListener=re}onPointerDown(e){this.session=new Fl(e,this.createPanHandlers(),{transformPagePoint:this.node.getTransformPagePoint(),contextWindow:jl(this.node)})}createPanHandlers(){let{onPanSessionStart:e,onPanStart:t,onPan:n,onPanEnd:r}=this.node.getProps();return{onSessionStart:iu(e),onStart:iu(t),onMove:iu(n),onEnd:(e,t)=>{delete this.session,r&&V.postRender(()=>r(e,t))}}}mount(){this.removePointerDownListener=Al(this.node.current,`pointerdown`,e=>this.onPointerDown(e))}update(){this.session&&this.session.updateHandlers(this.createPanHandlers())}unmount(){this.removePointerDownListener(),this.session&&this.session.end()}},ou=!1,su=class extends b.Component{componentDidMount(){let{visualElement:e,layoutGroup:t,switchLayoutGroup:n,layoutId:r}=this.props,{projection:i}=e;i&&(t.group&&t.group.add(i),n&&n.register&&r&&n.register(i),ou&&i.root.didUpdate(),i.addEventListener(`animationComplete`,()=>{this.safeToRemove()}),i.setOptions({...i.options,layoutDependency:this.props.layoutDependency,onExitComplete:()=>this.safeToRemove()})),Rs.hasEverUpdated=!0}getSnapshotBeforeUpdate(e){let{layoutDependency:t,visualElement:n,drag:r,isPresent:i}=this.props,{projection:a}=n;return a?(a.isPresent=i,e.layoutDependency!==t&&a.setOptions({...a.options,layoutDependency:t}),ou=!0,r||e.layoutDependency!==t||t===void 0||e.isPresent!==i?a.willUpdate():this.safeToRemove(),e.isPresent!==i&&(i?a.promote():a.relegate()||V.postRender(()=>{let e=a.getStack();(!e||!e.members.length)&&this.safeToRemove()})),null):null}componentDidUpdate(){let{visualElement:e,layoutAnchor:t}=this.props,{projection:n}=e;n&&(n.options.layoutAnchor=t,n.root.didUpdate(),Ii.postRender(()=>{!n.currentAnimation&&n.isLead()&&this.safeToRemove()}))}componentWillUnmount(){let{visualElement:e,layoutGroup:t,switchLayoutGroup:n}=this.props,{projection:r}=e;ou=!0,r&&(r.scheduleCheckAfterUnmount(),t&&t.group&&t.group.remove(r),n&&n.deregister&&n.deregister(r))}safeToRemove(){let{safeToRemove:e}=this.props;e&&e()}render(){return null}};function cu(e){let[t,n]=kc(),r=(0,b.useContext)(O);return(0,w.jsx)(su,{...e,layoutGroup:r,switchLayoutGroup:(0,b.useContext)(ml),isPresent:t,safeToRemove:n})}var lu={pan:{Feature:au},drag:{Feature:ru,ProjectionNode:bc,MeasureLayout:cu}};function uu(e,t,n){let{props:r}=e;e.animationState&&r.whileHover&&e.animationState.setActive(`whileHover`,n===`Start`);let i=r[`onHover`+n];i&&V.postRender(()=>i(t,Ol(t)))}var du=class extends Ga{mount(){let{current:e}=this.node;e&&(this.unmount=Ui(e,(e,t)=>(uu(this.node,t,`Start`),e=>uu(this.node,e,`End`))))}unmount(){}},fu=class extends Ga{constructor(){super(...arguments),this.isActive=!1}onFocus(){let e=!1;try{e=this.node.current.matches(`:focus-visible`)}catch{e=!0}!e||!this.node.animationState||(this.node.animationState.setActive(`whileFocus`,!0),this.isActive=!0)}onBlur(){!this.isActive||!this.node.animationState||(this.node.animationState.setActive(`whileFocus`,!1),this.isActive=!1)}mount(){this.unmount=L(Ms(this.node.current,`focus`,()=>this.onFocus()),Ms(this.node.current,`blur`,()=>this.onBlur()))}unmount(){}};function pu(e,t,n){let{props:r}=e;if(e.current instanceof HTMLButtonElement&&e.current.disabled)return;e.animationState&&r.whileTap&&e.animationState.setActive(`whileTap`,n===`Start`);let i=r[`onTap`+(n===`End`?``:n)];i&&V.postRender(()=>i(t,Ol(t)))}var mu=class extends Ga{mount(){let{current:e}=this.node;if(!e)return;let{globalTapTarget:t,propagate:n}=this.node.props;this.unmount=na(e,(e,t)=>(pu(this.node,t,`Start`),(e,{success:t})=>pu(this.node,e,t?`End`:`Cancel`)),{useGlobalTarget:t,stopPropagation:n?.tap===!1})}unmount(){}},hu=new WeakMap,gu=new WeakMap,_u=e=>{let t=hu.get(e.target);t&&t(e)},vu=e=>{e.forEach(_u)};function yu({root:e,...t}){let n=e||document;gu.has(n)||gu.set(n,{});let r=gu.get(n),i=JSON.stringify(t);return r[i]||(r[i]=new IntersectionObserver(vu,{root:e,...t})),r[i]}function bu(e,t,n){let r=yu(t);return hu.set(e,n),r.observe(e),()=>{hu.delete(e),r.unobserve(e)}}var xu={some:0,all:1},Su=class extends Ga{constructor(){super(...arguments),this.hasEnteredView=!1,this.isInView=!1}startObserver(){this.stopObserver?.();let{viewport:e={}}=this.node.getProps(),{root:t,margin:n,amount:r=`some`,once:i}=e,a={root:t?t.current:void 0,rootMargin:n,threshold:typeof r==`number`?r:xu[r]},o=e=>{let{isIntersecting:t}=e;if(this.isInView===t||(this.isInView=t,i&&!t&&this.hasEnteredView))return;t&&(this.hasEnteredView=!0),this.node.animationState&&this.node.animationState.setActive(`whileInView`,t);let{onViewportEnter:n,onViewportLeave:r}=this.node.getProps(),a=t?n:r;a&&a(e)};this.stopObserver=bu(this.node.current,a,o)}mount(){this.startObserver()}update(){if(typeof IntersectionObserver>`u`)return;let{props:e,prevProps:t}=this.node;[`amount`,`margin`,`root`].some(Cu(e,t))&&this.startObserver()}unmount(){this.stopObserver?.(),this.hasEnteredView=!1,this.isInView=!1}};function Cu({viewport:e={}},{viewport:t={}}={}){return n=>e[n]!==t[n]}var wu={inView:{Feature:Su},tap:{Feature:mu},focus:{Feature:fu},hover:{Feature:du}},Tu={layout:{ProjectionNode:bc,MeasureLayout:cu}},Eu=Cl({...Dl,...wu,...lu,...Tu},wl);function Du(e){let t=k(()=>Fr(e)),{isStatic:n}=(0,b.useContext)(xc);if(n){let[,n]=(0,b.useState)(e);(0,b.useEffect)(()=>t.on(`change`,n),[])}return t}function Ou(e,t){let n=Du(t()),r=()=>n.set(t());return r(),A(()=>{let t=()=>V.preRender(r,!1,!0),n=e.map(e=>e.on(`change`,t));return()=>{n.forEach(e=>e()),Me(r)}}),n}function ku(e){Nr.current=[],e();let t=Ou(Nr.current,e);return Nr.current=void 0,t}function Au(e,t,n,r){if(typeof e==`function`)return ku(e);if(n!==void 0&&!Array.isArray(n)&&typeof t!=`function`)return Mu(e,t,n,r);let i=typeof t==`function`?t:ba(t,n,r),a=Array.isArray(e)?ju(e,i):ju([e],([e])=>i(e)),o=Array.isArray(e)?void 0:e.accelerate;return o&&!o.isTransformed&&typeof t!=`function`&&Array.isArray(n)&&r?.clamp!==!1&&(a.accelerate={...o,times:t,keyframes:n,isTransformed:!0,...r?.ease?{ease:r.ease}:{}}),a}function ju(e,t){let n=k(()=>[]);return Ou(e,()=>{n.length=0;let r=e.length;for(let t=0;tObject.keys(n)),a=k(()=>({}));for(let o of i)a[o]=Au(e,t,n[o],r);return a}function Nu(){!Ia.current&&Ra();let[e]=(0,b.useState)(Fa.current);return e}function Pu(e){e.values.forEach(e=>e.stop())}function Fu(e,t){[...t].reverse().forEach(n=>{let r=e.getVariant(n);r&&ni(e,r),e.variantChildren&&e.variantChildren.forEach(e=>{Fu(e,t)})})}function Iu(e,t){if(Array.isArray(t))return Fu(e,t);if(typeof t==`string`)return Fu(e,[t]);ni(e,t)}function Lu(){let e=new Set,t={subscribe(t){return e.add(t),()=>void e.delete(t)},start(t,n){let r=[];return e.forEach(e=>{r.push(pi(e,t,{transitionOverride:n}))}),Promise.all(r)},set(t){return e.forEach(e=>{Iu(e,t)})},stop(){e.forEach(e=>{Pu(e)})},mount(){return()=>{t.stop()}}};return t}function Ru(){let e=k(Lu);return A(e.mount,[]),e}var zu=class{constructor(){this.componentControls=new Set}subscribe(e){return this.componentControls.add(e),()=>this.componentControls.delete(e)}start(e,t){this.componentControls.forEach(n=>{n.start(e.nativeEvent||e,t)})}cancel(){this.componentControls.forEach(e=>{e.cancel()})}stop(){this.componentControls.forEach(e=>{e.stop()})}},Bu=()=>new zu;function Vu(){return k(Bu)}var Hu=Eu,Uu={default:{type:`spring`,bounce:0,duration:.35},gentle:{type:`spring`,bounce:0,duration:.45},momentum:{type:`spring`,bounce:.2,duration:.4},snappy:{type:`spring`,bounce:0,duration:.25}};function Wu(){let e=Nu();return{reduced:e,fadeTransition:{duration:.2},spring:(t=`default`)=>e?{duration:.2}:Uu[t],transform:t=>e?{}:t}}function Gu({children:e,origin:t=`top right`,...n}){let r=Wu();return(0,b.createElement)(Hu.div,{...n,initial:r.reduced?{opacity:0}:{opacity:0,scale:.9},animate:r.reduced?{opacity:1}:{opacity:1,scale:1},exit:r.reduced?{opacity:0}:{opacity:0,scale:.9},transition:r.reduced?r.fadeTransition:Uu.snappy,style:{transformOrigin:t,...n.style}},e)}function Ku(e,t=.998){return Number.isFinite(e)?e/1e3*t/(1-t):0}var q=({tone:e=`green`,size:t=8,pulse:n=!1})=>{let r={green:S.green,amber:S.amber,red:S.red,gray:S.ink4,blue:S.blue};return(0,w.jsx)(`span`,{style:{display:`inline-block`,width:t,height:t,borderRadius:`50%`,background:r[e],flexShrink:0,boxShadow:n?`0 0 0 0 ${r[e]}55`:`none`},className:n?`edge-live-dot`:``})},J=({tone:e=`gray`,children:t,style:n})=>{let r={green:{bg:`#ecfdf5`,fg:`#047857`,bd:`#a7f3d0`},amber:{bg:`#fffbeb`,fg:`#b45309`,bd:`#fde68a`},red:{bg:`#fef2f2`,fg:`#b91c1c`,bd:`#fecaca`},blue:{bg:`#eff6ff`,fg:`#1d4ed8`,bd:`#bfdbfe`},gray:{bg:`#f1f5f9`,fg:`#475569`,bd:`#e2e8f0`},violet:{bg:`#f5f3ff`,fg:`#6d28d9`,bd:`#ddd6fe`}},i=r[e]||r.gray;return(0,w.jsx)(`span`,{style:{display:`inline-flex`,alignItems:`center`,gap:4,padding:`2px 7px`,borderRadius:4,background:i.bg,color:i.fg,border:`1px solid ${i.bd}`,fontSize:11,fontWeight:600,letterSpacing:.2,...n},children:t})};function qu(e){if(e.length<2)return``;if(e.length===2)return`M${e[0][0]} ${e[0][1]} L${e[1][0]} ${e[1][1]}`;let t=[`M${e[0][0]} ${e[0][1]}`];for(let n=0;n{let u=Wu(),d=(0,b.useRef)(!1),[f,p]=(0,b.useState)(!1),m=!!e?.length&&!u.reduced&&!f,h=()=>{d.current||(d.current=!0,p(!0))};if(!e||e.length===0)return null;let g=Math.max(...e,1),_=o??Math.ceil(g*1.1),v=a?32:0,y=n-v-4,x=r-4-4,C=y/(e.length-1),T=qu(e.map((e,t)=>[v+t*C,4+x-(e-0)/(_-0)*x])),E=`${T} L ${v+y} ${4+x} L ${v} ${4+x} Z`,D=[0,_*.33,_*.66,_].map(e=>({v:e,y:4+x-(e-0)/(_-0)*x}));return(0,w.jsxs)(`svg`,{...l,viewBox:`0 0 ${n} ${r}`,preserveAspectRatio:`none`,style:{display:`block`,width:`100%`,height:r,...c},children:[a&&D.map((e,t)=>(0,w.jsx)(`line`,{x1:v,x2:v+y,y1:e.y,y2:e.y,stroke:`#e5e7eb`,strokeDasharray:`3 3`,vectorEffect:`non-scaling-stroke`},t)),a&&D.map((e,t)=>(0,w.jsxs)(`text`,{x:v-4,y:e.y+3,textAnchor:`end`,fontSize:`9`,fill:`#9ca3af`,children:[Math.round(e.v),s]},`l-${t}`)),i&&(0,w.jsx)(Hu.path,{d:E,fill:t,initial:m?{opacity:0}:!1,animate:{opacity:.2},transition:m?{duration:.2,delay:.6,ease:`easeOut`}:{duration:0},onAnimationComplete:h}),(0,w.jsx)(Hu.path,{d:T,fill:`none`,stroke:t,strokeWidth:`1.6`,strokeLinejoin:`round`,strokeLinecap:`round`,vectorEffect:`non-scaling-stroke`,initial:m?{pathLength:0}:!1,animate:{pathLength:1},transition:m?{duration:.6,ease:`easeOut`}:{duration:0},onAnimationComplete:i?void 0:h})]})},Yu=({children:e,style:t,padding:n=16,title:r,action:i})=>(0,w.jsxs)(`div`,{style:{background:S.surface,border:`1px solid ${S.border}`,borderRadius:10,boxShadow:`0 1px 2px rgba(15,23,42,0.04)`,...t},children:[r&&(0,w.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,padding:`12px 16px`,borderBottom:`1px solid ${S.borderSoft}`},children:[(0,w.jsx)(`div`,{style:{fontSize:13,fontWeight:600,color:S.ink},children:r}),(0,w.jsx)(`div`,{style:{flex:1}}),i]}),(0,w.jsx)(`div`,{style:{padding:n},children:e})]});function Xu(){let[e,t]=(0,b.useState)(()=>new Date);return(0,b.useEffect)(()=>{let e=setInterval(()=>t(new Date),1e3);return()=>clearInterval(e)},[]),e}function Zu({cpu:e,gpu:t,mem:n,alertCount:r,online:i,lastSync:a,onOpenAlerts:o,onOpenShortcutHelp:s,theme:c=`light`,deviceLabel:l,DEVICE:u,loginUser:d,onLogout:f}){let p=Xu(),m=String(p.getHours()).padStart(2,`0`),h=String(p.getMinutes()).padStart(2,`0`),g=String(p.getSeconds()).padStart(2,`0`),_=`${p.getFullYear()}-${String(p.getMonth()+1).padStart(2,`0`)}-${String(p.getDate()).padStart(2,`0`)}`,v=[`周日`,`周一`,`周二`,`周三`,`周四`,`周五`,`周六`][p.getDay()],y=c===`dark`,b=y?{bar:`#0b1220`,barBd:`rgba(255,255,255,0.06)`,text:`#f1f5f9`,text2:`rgba(241,245,249,0.65)`,text3:`rgba(241,245,249,0.45)`,pillBg:`rgba(255,255,255,0.06)`,pillBdNone:`transparent`,timeBg:`rgba(255,255,255,0.06)`,sep:`rgba(255,255,255,0.18)`,logoBg:`linear-gradient(140deg, ${S.blue}, ${S.blueDeep})`,chevron:`rgba(241,245,249,0.55)`,alertBg:`rgba(245,158,11,0.18)`,alertFg:`#fbbf24`,alertBd:`rgba(245,158,11,0.45)`,cloudOnBg:`rgba(16,185,129,0.16)`,cloudOnFg:`#34d399`,cloudOnBd:`rgba(16,185,129,0.4)`,cloudOffBg:`rgba(239,68,68,0.16)`,cloudOffFg:`#fca5a5`,cloudOffBd:`rgba(239,68,68,0.4)`,cloudSyncFg:`rgba(241,245,249,0.55)`}:{bar:`rgba(255,255,255,0.85)`,barBd:`rgba(226,232,240,0.7)`,text:S.ink,text2:S.ink2,text3:S.ink3,pillBg:`rgba(15,23,42,0.04)`,pillBdNone:`transparent`,timeBg:`rgba(15,23,42,0.04)`,sep:`#cbd5e1`,logoBg:`linear-gradient(140deg, ${S.blue}, ${S.blueDeep})`,chevron:S.ink4,alertBg:`#fef3c7`,alertFg:`#b45309`,alertBd:`#fde68a`,cloudOnBg:`#ecfdf5`,cloudOnFg:`#047857`,cloudOnBd:`#a7f3d0`,cloudOffBg:`#fef2f2`,cloudOffFg:`#b91c1c`,cloudOffBd:`#fecaca`,cloudSyncFg:S.ink3},x=({tone:e,label:t,value:n})=>(0,w.jsxs)(`div`,{style:{display:`inline-flex`,alignItems:`center`,gap:6,padding:`3px 9px 3px 8px`,borderRadius:999,background:b.pillBg,fontSize:12,color:b.text2,whiteSpace:`nowrap`,flexShrink:0},children:[(0,w.jsx)(q,{tone:e,size:7}),(0,w.jsx)(`span`,{style:{color:b.text3},children:t}),(0,w.jsx)(`span`,{className:`mono tnum`,style:{color:b.text,fontWeight:600},children:n})]});return(0,w.jsxs)(`div`,{style:{height:48,paddingLeft:16,paddingRight:14,display:`flex`,alignItems:`center`,gap:12,background:b.bar,backdropFilter:y?`none`:`saturate(180%) blur(14px)`,WebkitBackdropFilter:y?`none`:`saturate(180%) blur(14px)`,borderBottom:`1px solid ${b.barBd}`,position:`relative`,zIndex:30,flexShrink:0},children:[(0,w.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,gap:10,minWidth:0,flexShrink:0},children:[(0,w.jsx)(`div`,{style:{width:28,height:28,borderRadius:8,background:b.logoBg,color:`white`,display:`flex`,alignItems:`center`,justifyContent:`center`,fontSize:11,fontWeight:700,letterSpacing:.5,boxShadow:`0 2px 4px rgba(37,99,235,0.3)`},children:`E`}),(0,w.jsxs)(`div`,{style:{minWidth:0,lineHeight:1.15},children:[(0,w.jsxs)(`div`,{style:{fontSize:13,fontWeight:600,color:b.text,display:`flex`,alignItems:`center`,gap:6},children:[l||u.name,(0,w.jsx)(`span`,{style:{fontSize:9.5,padding:`1px 5px`,borderRadius:3,background:y?`rgba(255,255,255,0.08)`:`rgba(15,23,42,0.06)`,color:b.text3,fontWeight:600,letterSpacing:`0.04em`},children:u.dept})]}),(0,w.jsxs)(`div`,{style:{fontSize:10.5,color:b.text3,marginTop:1,display:`flex`,alignItems:`center`,gap:6},children:[(0,w.jsx)(`span`,{children:u.site}),(0,w.jsx)(`span`,{style:{color:b.sep},children:`·`}),(0,w.jsx)(`span`,{className:`mono`,children:u.sn})]})]})]}),(0,w.jsxs)(`div`,{style:{flex:1,display:`flex`,justifyContent:`center`,gap:6,flexWrap:`nowrap`,overflow:`hidden`},children:[(0,w.jsx)(x,{tone:e<70?`green`:`amber`,label:`CPU`,value:`${e}%`}),(0,w.jsx)(x,{tone:t<80?`green`:`amber`,label:`GPU`,value:`${t}%`}),(0,w.jsx)(x,{tone:n<80?`green`:`amber`,label:`内存`,value:`${n}%`}),(0,w.jsxs)(`div`,{onClick:o,style:{display:`inline-flex`,alignItems:`center`,gap:6,padding:`3px 9px 3px 8px`,borderRadius:999,background:r>0?b.alertBg:b.pillBg,border:r>0?`1px solid ${b.alertBd}`:`1px solid transparent`,color:r>0?b.alertFg:b.text2,fontSize:12,cursor:`pointer`,whiteSpace:`nowrap`,flexShrink:0},children:[(0,w.jsx)(D,{name:`alertTri`,size:12,stroke:2}),(0,w.jsx)(`span`,{className:`tnum`,style:{fontWeight:600},children:r}),(0,w.jsx)(`span`,{children:`条告警`})]})]}),(0,w.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,gap:12,flexShrink:0},children:[(0,w.jsx)(`button`,{type:`button`,onClick:s,title:`键盘快捷键 (?)`,"aria-label":`打开键盘快捷键帮助`,style:{width:28,height:28,borderRadius:8,border:`none`,background:b.pillBg,color:b.text2,cursor:`pointer`,display:`inline-flex`,alignItems:`center`,justifyContent:`center`,fontSize:14,fontWeight:700},children:`?`}),(0,w.jsxs)(`div`,{style:{display:`inline-flex`,alignItems:`center`,gap:6,padding:`4px 10px`,borderRadius:999,background:i?b.cloudOnBg:b.cloudOffBg,color:i?b.cloudOnFg:b.cloudOffFg,fontSize:11.5,fontWeight:500,border:`1px solid ${i?b.cloudOnBd:b.cloudOffBd}`,whiteSpace:`nowrap`},children:[(0,w.jsx)(D,{name:i?`cloud`:`cloudOff`,size:13,stroke:1.8}),(0,w.jsx)(`span`,{style:{fontWeight:600},children:i?`云端在线`:`云端离线`}),(0,w.jsx)(`span`,{style:{opacity:.6},children:`·`}),(0,w.jsxs)(`span`,{style:{color:b.cloudSyncFg},children:[`同步 `,a]})]}),(0,w.jsxs)(`div`,{style:{display:`inline-flex`,alignItems:`center`,gap:8,padding:`4px 10px`,borderRadius:8,background:b.timeBg,whiteSpace:`nowrap`},children:[(0,w.jsxs)(`div`,{className:`mono tnum`,style:{fontSize:13.5,fontWeight:600,color:b.text,letterSpacing:.5},children:[m,`:`,h,(0,w.jsxs)(`span`,{style:{color:b.text3,fontWeight:500},children:[`:`,g]})]}),(0,w.jsxs)(`div`,{style:{fontSize:10.5,color:b.text3,lineHeight:1.15,whiteSpace:`nowrap`},children:[(0,w.jsx)(`div`,{children:_}),(0,w.jsx)(`div`,{children:v})]})]}),(d||f)&&(0,w.jsx)(Qu,{user:d||`user`,theme:c,onLogout:f})]})]})}function Qu({user:e,theme:t,onLogout:n}){let[r,i]=(0,b.useState)(!1),a=(0,b.useRef)(null);(0,b.useEffect)(()=>{if(!r)return;function e(e){a.current&&!a.current.contains(e.target)&&i(!1)}return document.addEventListener(`mousedown`,e),()=>document.removeEventListener(`mousedown`,e)},[r]);let o=t===`dark`,s=(e||`?`).charAt(0).toUpperCase();return(0,w.jsxs)(`div`,{ref:a,style:{position:`relative`},children:[(0,w.jsxs)(`button`,{onClick:()=>i(e=>!e),title:e,style:{display:`inline-flex`,alignItems:`center`,gap:6,height:28,padding:`0 4px 0 4px`,border:`none`,background:o?`rgba(255,255,255,0.06)`:`rgba(15,23,42,0.04)`,borderRadius:999,cursor:`pointer`},children:[(0,w.jsx)(`span`,{style:{width:22,height:22,borderRadius:`50%`,background:`linear-gradient(135deg, #3b82f6, #1d4ed8)`,color:`white`,fontSize:11.5,fontWeight:600,display:`flex`,alignItems:`center`,justifyContent:`center`},children:s}),(0,w.jsx)(D,{name:`chevDown`,size:11,stroke:2,style:{color:o?`rgba(255,255,255,0.6)`:`#64748b`}})]}),(0,w.jsx)(Mc,{children:r&&(0,w.jsxs)(Gu,{origin:`top right`,style:{position:`absolute`,top:34,right:0,zIndex:1e3,minWidth:180,background:`white`,borderRadius:10,boxShadow:`0 12px 32px -4px rgba(15,23,42,0.18), 0 0 0 1px rgba(15,23,42,0.06)`,padding:6,color:`#0f172a`},children:[(0,w.jsxs)(`div`,{style:{padding:`8px 12px 10px`,borderBottom:`1px solid #f1f5f9`},children:[(0,w.jsx)(`div`,{style:{fontSize:12.5,fontWeight:600,color:`#0f172a`},children:e}),(0,w.jsx)(`div`,{style:{fontSize:10.5,color:`#64748b`,marginTop:2},children:`已登录`})]}),(0,w.jsxs)(`button`,{className:`edge-menu-item`,onClick:()=>{i(!1),n&&n()},style:{width:`100%`,textAlign:`left`,padding:`8px 12px`,border:`none`,background:`transparent`,cursor:`pointer`,fontSize:13,color:`#dc2626`,fontWeight:500,borderRadius:6,display:`flex`,alignItems:`center`,gap:8},children:[(0,w.jsx)(D,{name:`lock`,size:13,stroke:1.8}),`退出登录`]})]})})]})}function $u({app:e,onOpen:t,size:n=76,dense:r=!1,iconStyle:i=`gradient`,accent:a=`#2563eb`,labelSize:o=12.5}){let s=e.state===`error`,c={running:S.green,error:S.red,warn:S.amber,stopped:S.ink4}[e.state]||null,l=e.bg,u=`0 4px 10px -2px ${e.color}33, 0 0 0 1px rgba(15,23,42,0.04), inset 0 1px 0 rgba(255,255,255,0.4)`,d=!0;return i===`flat`&&(l=e.color,u=`0 0 0 1px rgba(15,23,42,0.08)`,d=!1),(0,w.jsxs)(`div`,{onClick:()=>t(e),draggable:!e.locked,onDragStart:t=>{if(e.locked){t.preventDefault();return}t.dataTransfer.setData(`application/x-edgex-app`,e.id),t.dataTransfer.effectAllowed=`copy`},className:`edge-row-hover`,style:{display:`flex`,flexDirection:`column`,alignItems:`center`,gap:8,cursor:`pointer`,userSelect:`none`,padding:`8px 4px`,borderRadius:14,background:`transparent`,transition:`background 0.15s ease`,width:n+28,"--edge-row-hover-bg":`rgba(255,255,255,0.55)`},children:[(0,w.jsxs)(`div`,{className:`edge-icon-hover ${s?`edge-pulse`:``}`,style:{position:`relative`,width:n,height:n,borderRadius:i===`flat`?14:18,background:l,color:`white`,display:`flex`,alignItems:`center`,justifyContent:`center`,boxShadow:u,"--edge-icon-hover-shadow":`0 10px 22px -6px ${e.color}55, 0 0 0 1px rgba(15,23,42,0.06)${d?`, inset 0 1px 0 rgba(255,255,255,0.4)`:``}`},children:[(0,w.jsx)(D,{name:e.icon,size:n*.46,stroke:1.6}),d&&(0,w.jsx)(`div`,{style:{position:`absolute`,inset:1,borderRadius:17,pointerEvents:`none`,background:`radial-gradient(ellipse at 30% 0%, rgba(255,255,255,0.35), transparent 60%)`}}),e.kind===`app`&&c&&(0,w.jsx)(`div`,{style:{position:`absolute`,right:-3,bottom:-3,width:18,height:18,borderRadius:`50%`,background:`white`,display:`flex`,alignItems:`center`,justifyContent:`center`,boxShadow:`0 1px 3px rgba(15,23,42,0.18)`},children:(0,w.jsx)(`span`,{style:{width:10,height:10,borderRadius:`50%`,background:c,boxShadow:s?`0 0 0 0 ${c}`:`none`},className:s?`edge-live-dot`:``})}),e.badge&&(0,w.jsx)(`div`,{style:{position:`absolute`,top:-5,right:-5,minWidth:20,height:20,padding:`0 6px`,borderRadius:10,background:S.red,color:`white`,fontSize:11.5,fontWeight:700,display:`flex`,alignItems:`center`,justifyContent:`center`,boxShadow:`0 2px 6px rgba(239,68,68,0.4), 0 0 0 2px white`,fontFamily:`inherit`},children:e.badge}),e.locked&&(0,w.jsx)(`div`,{style:{position:`absolute`,top:-4,right:-4,width:20,height:20,borderRadius:6,background:`white`,color:S.slate,display:`flex`,alignItems:`center`,justifyContent:`center`,boxShadow:`0 2px 4px rgba(15,23,42,0.18)`},children:(0,w.jsx)(D,{name:`lock`,size:12,stroke:2})})]}),(0,w.jsx)(`div`,{style:{fontSize:o,color:S.ink,lineHeight:1.3,textAlign:`center`,fontWeight:500,maxWidth:n+24,whiteSpace:`nowrap`,overflow:`hidden`,textOverflow:`ellipsis`},children:e.name}),e.kind===`app`&&(0,w.jsxs)(`div`,{style:{marginTop:-4,fontSize:10.5,color:S.ink3,display:`flex`,alignItems:`center`,gap:4},className:`tnum`,children:[e.state===`running`&&e.gpuPct>0&&(0,w.jsxs)(`span`,{className:`mono`,children:[`GPU `,e.gpuPct,`%`]}),e.state===`running`&&e.gpuPct===0&&(0,w.jsx)(`span`,{children:`仅 CPU`}),e.state===`error`&&(0,w.jsxs)(`span`,{style:{color:S.red,fontWeight:600},children:[`异常 · `,e.lastOk]})]})]})}var ed=`edge-console.memo`,td=1e3;function nd(){try{return localStorage.getItem(ed)??``}catch{return``}}function rd(e){try{localStorage.setItem(ed,e)}catch{}}function id(){try{localStorage.removeItem(ed)}catch{}}function ad(){let[e,t]=(0,b.useState)(nd),n=(0,b.useRef)(null),r=(0,b.useRef)(e);return r.current=e,(0,b.useEffect)(()=>()=>{n.current!=null&&(clearTimeout(n.current),n.current=null,rd(r.current))},[]),(0,w.jsxs)(`div`,{style:{padding:16,background:`rgba(255,255,255,0.7)`,backdropFilter:`blur(12px)`,WebkitBackdropFilter:`blur(12px)`,border:`1px solid rgba(255,255,255,0.9)`,borderRadius:14,boxShadow:`0 6px 20px -6px rgba(15,23,42,0.10)`},children:[(0,w.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,gap:8,marginBottom:10},children:[(0,w.jsx)(D,{name:`edit`,size:14,stroke:1.8,style:{color:S.blueDeep}}),(0,w.jsx)(`div`,{style:{fontSize:12,fontWeight:700,color:S.ink,letterSpacing:`0.02em`},children:`备忘录`}),(0,w.jsx)(`div`,{style:{flex:1}}),e.length>0&&(0,w.jsx)(`button`,{type:`button`,onClick:()=>{window.confirm(`清空备忘录内容?`)&&(n.current!=null&&(clearTimeout(n.current),n.current=null),t(``),id())},title:`清空备忘录`,"aria-label":`清空备忘录`,className:`edge-press edge-btn-danger`,style:{display:`inline-flex`,alignItems:`center`,justifyContent:`center`,width:22,height:22,borderRadius:6,background:`transparent`,color:S.ink3,border:`1px solid transparent`,cursor:`pointer`,padding:0},children:(0,w.jsx)(D,{name:`trash`,size:13,stroke:1.8})}),(0,w.jsxs)(`span`,{className:`tnum`,style:{fontSize:10.5,color:S.ink3,fontWeight:600,fontFamily:S.mono},children:[e.length,` 字`]})]}),(0,w.jsx)(`textarea`,{value:e,onChange:e=>{let r=e.target.value;t(r),n.current!=null&&clearTimeout(n.current),n.current=setTimeout(()=>{n.current=null,rd(r)},td)},placeholder:`临时笔记 · 仅本地保存`,spellCheck:!1,style:{width:`100%`,height:200,boxSizing:`border-box`,resize:`none`,background:`transparent`,color:S.ink,border:`1px solid ${S.borderSoft}`,borderRadius:8,padding:10,fontFamily:S.mono,fontSize:12,lineHeight:1.55,outline:`none`},onFocus:e=>{e.currentTarget.style.borderColor=S.blue},onBlur:e=>{e.currentTarget.style.borderColor=S.borderSoft}})]})}function od(){let e=Xu(),t=String(e.getHours()).padStart(2,`0`),n=String(e.getMinutes()).padStart(2,`0`),r=String(e.getSeconds()).padStart(2,`0`),i=e.getFullYear(),a=e.getMonth(),o=e.getDate(),s=[`星期日`,`星期一`,`星期二`,`星期三`,`星期四`,`星期五`,`星期六`][e.getDay()],c=new Date(i,a,1).getDay(),l=new Date(i,a+1,0).getDate(),u=[];for(let e=0;e(0,w.jsx)(`div`,{style:{textAlign:`center`,fontSize:10,color:t===0||t===6?S.red:S.ink3,fontWeight:600,padding:`3px 0`},children:e},e))}),(0,w.jsx)(`div`,{style:{display:`grid`,gridTemplateColumns:`repeat(7, 1fr)`,gap:2},children:u.map((e,t)=>{if(e==null)return(0,w.jsx)(`div`,{},t);let n=e===o,r=(c+e-1)%7;return(0,w.jsx)(`div`,{style:{aspectRatio:`1`,display:`flex`,alignItems:`center`,justifyContent:`center`,fontSize:11.5,color:n?`white`:r===0||r===6?S.red:S.ink2,fontWeight:n?700:500,background:n?S.blue:`transparent`,borderRadius:6,fontFamily:`ui-monospace, SFMono-Regular, Menlo, monospace`,boxShadow:n?`0 2px 6px -1px ${S.blue}55`:`none`},className:`tnum`,children:e},t)})})]})}function sd({apps:e,onOpen:t,variant:n=`compact`}){return n===`row`?(0,w.jsx)(`div`,{style:{display:`flex`,gap:8,flexWrap:`wrap`},children:e.map(e=>(0,w.jsxs)(`div`,{onClick:()=>t(e),style:{display:`inline-flex`,alignItems:`center`,gap:8,padding:`6px 12px 6px 6px`,borderRadius:999,background:`rgba(255,255,255,0.7)`,border:`1px solid rgba(226,232,240,0.85)`,cursor:`pointer`,boxShadow:`0 1px 2px rgba(15,23,42,0.04)`},children:[(0,w.jsx)(`div`,{style:{width:26,height:26,borderRadius:7,background:e.bg,color:`white`,display:`flex`,alignItems:`center`,justifyContent:`center`,flexShrink:0},children:(0,w.jsx)(D,{name:e.icon,size:14,stroke:1.8})}),(0,w.jsx)(`span`,{style:{fontSize:12,color:S.ink,fontWeight:500},children:e.name})]},e.id))}):(0,w.jsxs)(`div`,{style:{width:188,padding:12,background:`rgba(255,255,255,0.55)`,backdropFilter:`blur(10px)`,WebkitBackdropFilter:`blur(10px)`,border:`1px solid rgba(255,255,255,0.8)`,borderRadius:14,boxShadow:`0 4px 14px -4px rgba(15,23,42,0.10)`},children:[(0,w.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,gap:6,marginBottom:10,fontSize:10.5,color:S.ink3,fontWeight:600,letterSpacing:`0.06em`,textTransform:`uppercase`},children:[(0,w.jsx)(D,{name:`history`,size:11,stroke:2}),`最近使用`]}),(0,w.jsx)(`div`,{style:{display:`grid`,gridTemplateColumns:`repeat(2, 1fr)`,gap:6},children:e.map(e=>(0,w.jsxs)(`div`,{onClick:()=>t(e),style:{display:`flex`,alignItems:`center`,gap:8,padding:6,borderRadius:8,background:`rgba(255,255,255,0.7)`,border:`1px solid rgba(226,232,240,0.7)`,cursor:`pointer`},children:[(0,w.jsx)(`div`,{style:{width:26,height:26,borderRadius:7,background:e.bg,color:`white`,display:`flex`,alignItems:`center`,justifyContent:`center`,flexShrink:0},children:(0,w.jsx)(D,{name:e.icon,size:14,stroke:1.8})}),(0,w.jsx)(`div`,{style:{minWidth:0,fontSize:10.5,color:S.ink,fontWeight:500,whiteSpace:`nowrap`,overflow:`hidden`,textOverflow:`ellipsis`},children:e.name})]},e.id))})]})}function cd({DEVICE:e}){return(0,w.jsxs)(`div`,{style:{padding:16,background:`rgba(255,255,255,0.7)`,backdropFilter:`blur(12px)`,WebkitBackdropFilter:`blur(12px)`,border:`1px solid rgba(255,255,255,0.9)`,borderRadius:14,boxShadow:`0 6px 20px -6px rgba(15,23,42,0.10)`},children:[(0,w.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,gap:8,marginBottom:12},children:[(0,w.jsx)(D,{name:`cpu`,size:14,stroke:1.8,style:{color:S.blueDeep}}),(0,w.jsx)(`div`,{style:{fontSize:12,fontWeight:700,color:S.ink,letterSpacing:`0.02em`},children:`设备信息`}),(0,w.jsx)(`div`,{style:{flex:1}}),(0,w.jsx)(`span`,{style:{fontSize:10,fontWeight:600,padding:`2px 6px`,borderRadius:999,background:`#ecfdf5`,color:`#047857`,border:`1px solid #a7f3d0`},children:`在线`})]}),(0,w.jsx)(`div`,{style:{display:`flex`,flexDirection:`column`,gap:7},children:[[`硬件`,e.model],[`系统`,e.os],[`Agent`,e.agent],[`持续在线`,e.uptime]].map(([e,t])=>(0,w.jsxs)(`div`,{style:{display:`flex`,alignItems:`baseline`,gap:10,fontSize:11.5},children:[(0,w.jsx)(`span`,{style:{color:S.ink3,width:56,flexShrink:0},children:e}),(0,w.jsx)(`span`,{style:{color:S.ink,flex:1,fontWeight:500,overflow:`hidden`,textOverflow:`ellipsis`,whiteSpace:`nowrap`},children:t})]},e))})]})}function ld({running:e,error:t}){return t>0?(0,w.jsxs)(`span`,{style:{display:`inline-flex`,alignItems:`center`,gap:5,fontSize:11,fontWeight:600,color:`#b91c1c`,padding:`2px 8px`,borderRadius:999,background:`#fef2f2`,border:`1px solid #fecaca`,whiteSpace:`nowrap`,flexShrink:0},children:[(0,w.jsx)(q,{tone:`red`,size:6,pulse:!0}),(0,w.jsx)(`span`,{className:`tnum`,children:t}),(0,w.jsx)(`span`,{children:`个应用异常`})]}):(0,w.jsxs)(`span`,{style:{display:`inline-flex`,alignItems:`center`,gap:5,fontSize:11,color:`#047857`,whiteSpace:`nowrap`,flexShrink:0},children:[(0,w.jsx)(q,{tone:`green`,size:6}),(0,w.jsx)(`span`,{style:{fontWeight:600},children:`全部运行中`})]})}function ud({label:e,meta:t,right:n,children:r}){return(0,w.jsxs)(`div`,{children:[(0,w.jsxs)(`div`,{style:{display:`flex`,alignItems:`baseline`,gap:10,marginBottom:14},children:[(0,w.jsx)(`div`,{style:{fontSize:12,fontWeight:700,color:S.ink,letterSpacing:`0.04em`},children:e}),(0,w.jsx)(`div`,{style:{fontSize:11.5,color:S.ink3},children:t}),(0,w.jsx)(`div`,{style:{flex:1}}),n]}),r]})}function dd({apps:e,onOpen:t,iconStyle:n,accent:r,iconPx:i=76,tilePx:a=104,labelSize:o=12.5}){return(0,w.jsx)(`div`,{style:{display:`grid`,gridTemplateColumns:`repeat(auto-fill, minmax(${a+8}px, ${a+8}px))`,gap:8},children:e.map(e=>(0,w.jsx)($u,{app:e,onOpen:t,iconStyle:n,accent:r,size:i,labelSize:o},e.id))})}function fd({onOpenApp:e,sysApps:t,deployedApps:n,showRecent:r=!0,iconStyle:i=`gradient`,accent:a=`#2563eb`,layout:o=`workstation`,iconSize:s=`md`,APPS:c,RECENT_IDS:l,DEVICE:u}){let d=n.filter(e=>e.state===`running`).length,f=n.filter(e=>e.state===`error`).length,p={sm:60,md:76,lg:96}[s]||76,m=p+(s===`sm`?22:s===`lg`?36:28),h=s===`sm`?11.5:s===`lg`?13.5:12.5;return o===`launcher`?(0,w.jsxs)(`div`,{style:{flex:1,padding:`40px 56px 110px`,display:`flex`,flexDirection:`column`,gap:32,overflow:`auto`,alignContent:`start`},children:[(0,w.jsx)(ud,{label:`系统工具`,meta:`本地固定`,children:(0,w.jsx)(dd,{apps:t,onOpen:e,iconStyle:i,accent:a,iconPx:Math.max(p,88),tilePx:m+12,labelSize:h})}),(0,w.jsx)(ud,{label:`已部署应用`,meta:`云端下发`,right:(0,w.jsx)(ld,{running:d,error:f}),children:(0,w.jsx)(dd,{apps:n,onOpen:e,iconStyle:i,accent:a,iconPx:Math.max(p,88),tilePx:m+12,labelSize:h})}),r&&(0,w.jsx)(ud,{label:`最近使用`,meta:`按访问时间`,children:(0,w.jsx)(sd,{apps:l.map(e=>c.find(t=>t.id===e)).filter(Boolean),onOpen:e,variant:`row`})})]}):o===`compact`?(0,w.jsxs)(`div`,{style:{flex:1,padding:`20px 36px 110px`,display:`grid`,gridTemplateColumns:`1fr 280px`,gap:22,overflow:`auto`,alignContent:`start`},children:[(0,w.jsxs)(`div`,{style:{display:`flex`,flexDirection:`column`,gap:18,minWidth:0},children:[(0,w.jsx)(ud,{label:`系统工具`,meta:`本地固定`,children:(0,w.jsx)(dd,{apps:t,onOpen:e,iconStyle:i,accent:a,iconPx:Math.min(p,64),tilePx:Math.min(m,94),labelSize:11})}),(0,w.jsx)(ud,{label:`已部署应用`,meta:`云端下发`,right:(0,w.jsx)(ld,{running:d,error:f}),children:(0,w.jsx)(dd,{apps:n,onOpen:e,iconStyle:i,accent:a,iconPx:Math.min(p,64),tilePx:Math.min(m,94),labelSize:11})}),r&&(0,w.jsx)(ud,{label:`最近使用`,meta:`按访问时间`,children:(0,w.jsx)(sd,{apps:l.map(e=>c.find(t=>t.id===e)).filter(Boolean),onOpen:e,variant:`row`})})]}),(0,w.jsxs)(`div`,{style:{display:`flex`,flexDirection:`column`,gap:10},children:[(0,w.jsx)(od,{}),(0,w.jsx)(cd,{DEVICE:u}),(0,w.jsx)(ad,{})]})]}):(0,w.jsxs)(`div`,{style:{flex:1,position:`relative`,padding:`28px 48px 110px`,display:`grid`,gridTemplateColumns:`1fr 340px`,gap:32,overflow:`auto`,alignContent:`start`},children:[(0,w.jsxs)(`div`,{style:{display:`flex`,flexDirection:`column`,gap:26,minWidth:0},children:[(0,w.jsx)(ud,{label:`系统工具`,meta:`本地固定 · 始终可用`,children:(0,w.jsx)(dd,{apps:t,onOpen:e,iconStyle:i,accent:a,iconPx:p,tilePx:m,labelSize:h})}),(0,w.jsx)(ud,{label:`已部署应用`,meta:`云端下发`,right:(0,w.jsx)(ld,{running:d,error:f}),children:(0,w.jsx)(dd,{apps:n,onOpen:e,iconStyle:i,accent:a,iconPx:p,tilePx:m,labelSize:h})}),r&&(0,w.jsx)(ud,{label:`最近使用`,meta:`按访问时间`,children:(0,w.jsx)(sd,{apps:l.map(e=>c.find(t=>t.id===e)).filter(Boolean),onOpen:e,variant:`row`})})]}),(0,w.jsxs)(`div`,{style:{display:`flex`,flexDirection:`column`,gap:14},children:[(0,w.jsx)(od,{}),(0,w.jsx)(cd,{DEVICE:u}),(0,w.jsx)(ad,{})]})]})}function pd({label:e}){let t=Wu();return(0,w.jsx)(`div`,{style:{position:`absolute`,bottom:`calc(100% + 10px)`,left:`50%`,transform:`translateX(-50%)`,pointerEvents:`none`},children:(0,w.jsx)(Hu.div,{initial:t.reduced?{opacity:0}:{opacity:0,y:4},animate:t.reduced?{opacity:1}:{opacity:1,y:0},exit:t.reduced?{opacity:0}:{opacity:0,y:4},transition:t.reduced?t.fadeTransition:Uu.snappy,children:(0,w.jsx)(Gu,{origin:`bottom center`,style:{background:`rgba(15,23,42,0.92)`,color:`white`,fontSize:11.5,fontWeight:500,padding:`4px 9px`,borderRadius:6,whiteSpace:`nowrap`,boxShadow:`0 4px 12px -2px rgba(15,23,42,0.3)`},children:e})})})}function md({apps:e,registerDockIconRect:t,onShowDesktop:n,onFocusApp:r,onCloseApp:i,anyVisible:a,hidden:o=!1,authed:s,authBadge:c,onToggleAuth:l,alertBadge:u,loginUser:d,onLogout:f}){let[p,m]=(0,b.useState)(null),h=Wu(),g=h.reduced?{}:{whileHover:{y:-4,scale:1.1},whileTap:{scale:.95}},_=!a;return(0,b.useEffect)(()=>{if(!o)return;let e=requestAnimationFrame(()=>m(null));return()=>cancelAnimationFrame(e)},[o]),(0,w.jsx)(`div`,{"aria-hidden":o,inert:o?!0:void 0,style:{position:`absolute`,bottom:18,left:`50%`,transform:`translateX(-50%)`,zIndex:25,opacity:+!o,visibility:o?`hidden`:`visible`,pointerEvents:o?`none`:`auto`},children:(0,w.jsxs)(`div`,{className:`edge-material-chrome`,style:{display:`flex`,alignItems:`center`,gap:6,padding:`8px 12px`,borderRadius:20,border:`1px solid rgba(255,255,255,0.9)`,boxShadow:`0 12px 32px -8px rgba(15,23,42,0.18), 0 0 0 1px rgba(15,23,42,0.04)`,transition:`border-color 0.15s ease, box-shadow 0.15s ease`},children:[(0,w.jsxs)(Hu.div,{onClick:n,onMouseEnter:()=>m(`__home`),onMouseLeave:()=>m(null),title:`显示桌面`,transition:h.spring(`snappy`),...g,style:{position:`relative`,width:44,height:44,borderRadius:12,background:_?`#1f2937`:`rgba(15,23,42,0.04)`,color:_?`white`:S.ink2,display:`flex`,alignItems:`center`,justifyContent:`center`,cursor:`pointer`,boxShadow:_?`0 4px 10px -2px rgba(31,41,55,0.45)`:`none`},children:[(0,w.jsx)(D,{name:`home`,size:20,stroke:1.7}),_&&(0,w.jsx)(`div`,{style:{position:`absolute`,bottom:-6,left:`50%`,transform:`translateX(-50%)`,width:5,height:5,borderRadius:`50%`,background:S.ink2}}),(0,w.jsx)(Mc,{children:p===`__home`&&(0,w.jsx)(pd,{label:`显示桌面`})})]}),(0,w.jsx)(`div`,{style:{width:1,height:28,background:`rgba(15,23,42,0.08)`,margin:`0 4px`}}),e.length===0?(0,w.jsxs)(`div`,{style:{height:44,padding:`0 14px`,display:`flex`,alignItems:`center`,gap:8,color:S.ink3,fontSize:12},children:[(0,w.jsx)(D,{name:`apps`,size:14,stroke:1.7}),(0,w.jsx)(`span`,{children:`从桌面单击应用以启动`})]}):e.map(e=>{let n={running:S.green,error:S.red,warn:S.amber,stopped:S.ink4}[e.state]||null,a=e.state===`error`,o=p===e.id,s=n=>t?.(e.id,n);return(0,w.jsxs)(Hu.div,{ref:s,onClick:t=>{s(t.currentTarget),r(e.id)},onMouseEnter:t=>{s(t.currentTarget),m(e.id)},onMouseLeave:()=>m(null),onContextMenu:t=>{t.preventDefault(),i(e.id)},title:e.name,transition:h.spring(`snappy`),...g,style:{position:`relative`,width:44,height:44,borderRadius:12,background:e.isActive?e.bg:`rgba(15,23,42,0.04)`,color:e.isActive?`white`:S.ink2,display:`flex`,alignItems:`center`,justifyContent:`center`,cursor:`pointer`,boxShadow:e.isActive?`0 4px 10px -2px ${e.color}55, inset 0 1px 0 rgba(255,255,255,0.3)`:`none`,opacity:e.isMinimized?.92:1},children:[!e.isActive&&(0,w.jsx)(`div`,{style:{position:`absolute`,inset:6,borderRadius:8,background:e.bg,color:`white`,display:`flex`,alignItems:`center`,justifyContent:`center`,boxShadow:`0 1px 2px rgba(15,23,42,0.12), inset 0 1px 0 rgba(255,255,255,0.25)`},children:(0,w.jsx)(D,{name:e.icon,size:18,stroke:1.7})}),e.isActive&&(0,w.jsx)(D,{name:e.icon,size:20,stroke:1.7}),e.kind===`app`&&n&&(0,w.jsx)(`div`,{style:{position:`absolute`,right:1,top:1,width:10,height:10,borderRadius:`50%`,background:`white`,display:`flex`,alignItems:`center`,justifyContent:`center`,boxShadow:`0 1px 2px rgba(15,23,42,0.18)`},children:(0,w.jsx)(`span`,{className:a?`edge-live-dot`:``,style:{width:6,height:6,borderRadius:`50%`,background:n}})}),e.id===`alerts`&&u>0&&(0,w.jsx)(`div`,{style:{position:`absolute`,top:0,right:0,minWidth:18,height:18,padding:`0 5px`,borderRadius:9,background:S.red,color:`white`,fontSize:10.5,fontWeight:700,display:`flex`,alignItems:`center`,justifyContent:`center`,boxShadow:`0 0 0 2px white`,transform:`translate(25%, -25%)`},children:u}),o&&(0,w.jsx)(`button`,{onClick:t=>{t.stopPropagation(),i(e.id)},title:`退出应用`,style:{position:`absolute`,top:-5,left:-5,width:18,height:18,borderRadius:`50%`,background:`#0f172a`,color:`white`,border:`none`,display:`flex`,alignItems:`center`,justifyContent:`center`,cursor:`pointer`,boxShadow:`0 1px 4px rgba(15,23,42,0.3), 0 0 0 2px white`,padding:0,zIndex:2},children:(0,w.jsx)(D,{name:`x`,size:11,stroke:2.4})}),(0,w.jsx)(`div`,{style:{position:`absolute`,bottom:-6,left:`50%`,transform:`translateX(-50%)`,width:e.isActive?5:4,height:e.isActive?5:4,borderRadius:`50%`,background:e.isActive?S.ink2:S.ink3,opacity:e.isMinimized?.6:1}}),(0,w.jsx)(Mc,{children:o&&(0,w.jsx)(pd,{label:`${e.name}${e.isMinimized?` · 已最小化`:``}`})})]},e.id)})]})})}var hd=_(),gd={display:`inline-flex`,alignItems:`center`,gap:6,height:32,padding:`0 12px`,borderRadius:7,background:S.surface,border:`1px solid ${S.border}`,fontSize:12.5,fontWeight:500,color:S.ink2,cursor:`pointer`},_d={...gd,background:S.blue,color:`white`,border:`1px solid ${S.blueDeep}`,fontWeight:600},vd={...gd,background:`white`,color:S.red,border:`1px solid #fecaca`},yd=`0 24px 60px -12px rgba(15,23,42,0.32), 0 0 0 1px rgba(15,23,42,0.08)`,bd=`0 10px 28px -14px rgba(15,23,42,0.20), 0 0 0 1px rgba(15,23,42,0.05)`,xd=`0 24px 60px -12px rgba(15,23,42,0), 0 0 0 1px rgba(15,23,42,0)`,Sd=420,Y=300,Cd=[{dir:`n`,css:{top:0,left:10,right:10,height:6},cursor:`ns-resize`},{dir:`s`,css:{bottom:0,left:10,right:10,height:6},cursor:`ns-resize`},{dir:`e`,css:{right:0,top:10,bottom:10,width:6},cursor:`ew-resize`},{dir:`w`,css:{left:0,top:10,bottom:10,width:6},cursor:`ew-resize`},{dir:`ne`,css:{top:0,right:0,width:12,height:12},cursor:`nesw-resize`},{dir:`nw`,css:{top:0,left:0,width:12,height:12},cursor:`nwse-resize`},{dir:`se`,css:{bottom:0,right:0,width:12,height:12},cursor:`nwse-resize`},{dir:`sw`,css:{bottom:0,left:0,width:12,height:12},cursor:`nesw-resize`}];function wd(e,t,n){if(!t)return{x:0,y:0};let r=n?.(e),i=t.offsetParent?.getBoundingClientRect?.(),a=(i?.left||0)+t.offsetLeft+t.offsetWidth/2,o=(i?.top||0)+t.offsetTop+t.offsetHeight/2,s=r?r.left+r.width/2:window.innerWidth/2,c=r?r.top+r.height/2:window.innerHeight-42;return{x:s-a,y:c-o}}function Td({app:e,active:t=!1,visible:n=!0,minimized:r=!1,maximized:i,geo:a,zIndex:o=10,interacting:s,getDockIconRect:c,onMaximize:l,onMinimize:u,onClose:d,onBringToFront:f,onChangeGeo:p,onInteractStart:m,onInteractEnd:h,children:g,headerActions:_,breadcrumb:v,mgmtOpen:y,onToggleMgmt:x,canManage:C}){let T=Wu(),[E,O]=(0,b.useState)(null),[k,A]=(0,b.useState)(`default`),j=a||{x:40,y:40,w:820,h:560},ee=(e,t,n,r=`edge-btn-secondary`)=>(0,w.jsx)(`div`,{onClick:t,onPointerDown:e=>e.stopPropagation(),className:`edge-press ${r}`,style:{width:22,height:22,borderRadius:6,cursor:`pointer`,display:`flex`,alignItems:`center`,justifyContent:`center`,color:e,transition:`background 0.15s, color 0.15s`},children:n}),M=r?wd(e.id,E,c):{x:0,y:0},N={left:j.x,top:j.y,width:j.w,height:j.h,opacity:+!!n,visibility:`visible`,transitionEnd:n?{visibility:`visible`}:{visibility:`hidden`},...T.reduced?{}:{x:r?M.x:0,y:r?M.y:0,scale:n?1:r?.35:.98}},P=s?{left:{duration:0},top:{duration:0},width:{duration:0},height:{duration:0}}:{left:Uu.gentle,top:Uu.gentle,width:Uu.gentle,height:Uu.gentle},F=T.reduced?{opacity:T.fadeTransition,left:{duration:0},top:{duration:0},width:{duration:0},height:{duration:0},borderRadius:{duration:0},boxShadow:{duration:0}}:{...P,x:Uu.default,y:Uu.default,scale:Uu.default,opacity:{duration:.2}},I=e=>{if(i||e.button!==0)return;f?.(),m?.(),A(`grabbing`);let t=e.clientX,n=e.clientY,r={x:j.x,y:j.y},a=e=>{p?.({x:r.x+(e.clientX-t),y:r.y+(e.clientY-n)})},o=()=>{window.removeEventListener(`pointermove`,a),window.removeEventListener(`pointerup`,o),A(`default`),h?.(),window.dispatchEvent(new Event(`resize`))};window.addEventListener(`pointermove`,a),window.addEventListener(`pointerup`,o)},te=(e,t)=>n=>{if(i||n.button!==0)return;f?.(),m?.(),A(t);let r=n.clientX,a=n.clientY,o={x:j.x,y:j.y,w:j.w,h:j.h},s=t=>{let n=t.clientX-r,i=t.clientY-a,s={x:o.x,y:o.y,w:o.w,h:o.h};if(e.includes(`e`)&&(s.w=Math.max(Sd,o.w+n)),e.includes(`s`)&&(s.h=Math.max(Y,o.h+i)),e.includes(`w`)){let e=Math.max(Sd,o.w-n);s.x=o.x+(o.w-e),s.w=e}if(e.includes(`n`)){let e=Math.max(Y,o.h-i);s.y=o.y+(o.h-e),s.h=e}p?.(s)},c=()=>{window.removeEventListener(`pointermove`,s),window.removeEventListener(`pointerup`,c),A(`default`),h?.(),window.dispatchEvent(new Event(`resize`))};window.addEventListener(`pointermove`,s),window.addEventListener(`pointerup`,c)};return(0,w.jsxs)(Hu.div,{ref:O,initial:T.reduced?{opacity:0}:{opacity:0,scale:.96},animate:N,exit:T.reduced?{opacity:0}:{opacity:0,scale:.97,x:0,y:0},transition:F,onPointerDown:()=>f?.(),onAnimationComplete:()=>{n&&window.dispatchEvent(new Event(`resize`))},style:{position:`absolute`,left:j.x,top:j.y,width:j.w,height:j.h,borderRadius:i?0:14,boxShadow:i?xd:t?yd:bd,background:S.windowBg,display:`flex`,flexDirection:`column`,overflow:`hidden`,zIndex:o,pointerEvents:n?`auto`:`none`},children:[s&&(0,hd.createPortal)((0,w.jsx)(`div`,{style:{position:`fixed`,inset:0,zIndex:9998,cursor:k}}),document.body),(0,w.jsxs)(`div`,{onPointerDown:I,onDoubleClick:l,style:{height:44,display:`flex`,alignItems:`center`,paddingLeft:14,paddingRight:8,gap:10,background:S.titleBar,borderBottom:`1px solid ${S.borderSoft}`,flexShrink:0,touchAction:`none`,userSelect:`none`,cursor:i?`default`:`grab`},children:[(0,w.jsx)(`div`,{style:{width:22,height:22,borderRadius:6,color:`white`,background:e.bg,display:`flex`,alignItems:`center`,justifyContent:`center`},children:(0,w.jsx)(D,{name:e.icon,size:13,stroke:1.8})}),(0,w.jsx)(`div`,{style:{...S.type.body,fontWeight:600,color:S.ink},children:e.name}),v&&(0,w.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,gap:6,color:S.ink3,fontSize:12.5},children:[(0,w.jsx)(D,{name:`chevRight`,size:12,stroke:2}),v]}),(0,w.jsx)(`div`,{style:{flex:1}}),_,C&&(0,w.jsxs)(`button`,{onPointerDown:e=>e.stopPropagation(),onClick:x,title:`应用运维信息`,className:`edge-press edge-btn-secondary`,style:{display:`flex`,alignItems:`center`,gap:5,height:26,padding:`0 10px`,borderRadius:6,appearance:`none`,background:y?S.blueSoft:void 0,border:`1px solid ${y?`#bfdbfe`:`transparent`}`,color:y?S.blueDeep:S.ink3,cursor:`pointer`,fontSize:11.5,fontWeight:600,marginRight:4},children:[(0,w.jsx)(D,{name:`info`,size:12,stroke:2}),`运维信息`]}),(0,w.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,gap:2,marginLeft:4},children:[ee(S.ink3,u,(0,w.jsx)(D,{name:`minus`,size:14,stroke:2})),ee(S.ink3,l,(0,w.jsx)(D,{name:i?`restore`:`maximize`,size:12,stroke:2})),ee(S.red,d,(0,w.jsx)(D,{name:`x`,size:14,stroke:2}),`edge-btn-danger`)]})]}),!i&&Cd.map(e=>(0,w.jsx)(`div`,{onPointerDown:te(e.dir,e.cursor),style:{position:`absolute`,zIndex:50,cursor:e.cursor,...e.css}},e.dir)),(0,w.jsx)(`div`,{style:{flex:1,overflow:`hidden`,display:`flex`,position:`relative`},children:g})]})}var Ed=`/api/v1`,Dd=localStorage.getItem(`edge_token`)||``;function Od(e){Dd=e||``,e?localStorage.setItem(`edge_token`,e):localStorage.removeItem(`edge_token`)}function kd(){return Dd}function Ad(){Dd=``,localStorage.removeItem(`edge_token`)}function jd(){return Dd?{Authorization:`Bearer `+Dd}:{}}var Md=null;function Nd(e){Md=e}var Pd=3,Fd=0;async function X(e,t={}){if(!Dd)return new Response(null,{status:401,statusText:`no token (pre-login)`});let n=await fetch(e,{...t,headers:{...jd(),...t.headers}});return n.status===401&&Dd?(Fd+=1,Fd>=Pd&&(Fd=0,Ad(),Md&&Md())):n.ok&&(Fd=0),n}function Id(e){let t=e.toLowerCase();return t.includes(`code`)||t.includes(`vscode`)?`code`:t.includes(`jupyter`)?`jupyter`:t.includes(`ollama`)?`ollama`:t.includes(`vllm`)?`vllm`:t.includes(`comfy`)?`comfy`:t.includes(`webui`)||t.includes(`sd`)?`palette`:t.includes(`open-webui`)||t.includes(`openwebui`)?`openwebui`:t.includes(`train`)?`flame`:`apps`}function Z(e,{interval:t=0,fallback:n=null,transform:r}={}){let[i,a]=(0,b.useState)(n),[o,s]=(0,b.useState)(()=>!!e),[c,l]=(0,b.useState)(null),[u,d]=(0,b.useState)(0),f=(0,b.useRef)(!0),p=(0,b.useCallback)(()=>{s(!0),d(e=>e+1)},[]);return(0,b.useEffect)(()=>{f.current=!0;let n=null;if(!e)return()=>{f.current=!1};async function i(){try{let t=await X(Ed+e);if(!t.ok)throw Error(`HTTP ${t.status}`);let n=await t.json();if(!f.current)return;a(r?r(n):n),l(null)}catch(e){if(!f.current)return;l(e)}finally{f.current&&s(!1)}}return i(),t>0&&(n=setInterval(i,t)),()=>{f.current=!1,n&&clearInterval(n)}},[e,t,u]),{data:i,loading:o,error:c,refresh:p}}function Ld(){return Z(`/device`,{fallback:null,transform:e=>({deviceName:e.deviceName,hostname:e.hostname,name:e.deviceName||e.hostname,alias:e.deviceName||e.hostname,os:e.platform||e.os,model:e.cpuModel,uptime:e.uptimeHuman,agent:`Edge Platform `+(e.agentVersion||``),sn:e.hostname,site:``,dept:``,username:``})})}function Rd(e=5e3){let[t,n]=(0,b.useState)({metrics:null,gpus:[]}),[r,i]=(0,b.useState)(!0),[a,o]=(0,b.useState)(null),s=(0,b.useRef)(!0);return(0,b.useEffect)(()=>{s.current=!0;async function r(){try{let e=await X(`/api/v1/metrics`);if(!e.ok)throw Error(`HTTP ${e.status}`);let r=await e.json();if(!s.current)return;let i=t.metrics||{},a={cpu:{used:Math.round(r.cpuUsedPercent),total:100,series:i.cpu?.series||[]},gpu:{used:r.gpuData&&r.gpuData.length>0?Math.round(r.gpuData[0].gpuUtil):0,total:100,series:i.gpu?.series||[]},mem:{used:Math.round(r.memoryUsed/(1024*1024*1024)),total:Math.round(r.memoryTotal/(1024*1024*1024)),pct:Math.round(r.memoryUsedPercent),series:i.mem?.series||[]},dsk:i.dsk||{used:0,total:0,pct:0,series:[]}};if(r.diskData&&r.diskData.length>0){let e=r.diskData[0];a.dsk={used:Math.round(e.used/(1024*1024*1024)),total:Math.round(e.total/(1024*1024*1024)),pct:Math.round(e.usedPercent),series:i.dsk?.series||[]}}let c=t.gpus;r.gpuData&&r.gpuData.length>0&&(c=r.gpuData.map(e=>({id:e.index,model:e.productName,util:Math.round(e.gpuUtil),memUsed:e.memUsed,memTotal:e.memTotal,temp:e.temperature,power:e.powerDraw,max:e.powerLimit,tasks:[]}))),n({metrics:a,gpus:c}),o(null)}catch(e){if(!s.current)return;o(e)}finally{s.current&&i(!1)}}r();let a=setInterval(r,e);return()=>{s.current=!1,clearInterval(a)}},[e]),{data:t,loading:r,error:a}}function zd(e=5e3){let[t,n]=(0,b.useState)({cpuPercent:[],memoryPercent:[],diskPercent:[],gpuUtil:[]}),[r,i]=(0,b.useState)(!0),[a,o]=(0,b.useState)(null),s=(0,b.useRef)(!0);return(0,b.useEffect)(()=>{s.current=!0;async function t(){try{let e=await X(`/api/v1/metrics/history`);if(!e.ok)throw Error(`HTTP ${e.status}`);let t=await e.json();if(!s.current)return;n(e=>({cpuPercent:t.cpuPercent||e.cpuPercent,memoryPercent:t.memoryPercent||e.memoryPercent,diskPercent:t.diskPercent||e.diskPercent,gpuUtil:t.gpuUtil||e.gpuUtil,gpuMemPercent:t.gpuMemPercent||e.gpuMemPercent,netBytesSent:t.netBytesSent||e.netBytesSent,netBytesRecv:t.netBytesRecv||e.netBytesRecv,timestamps:t.timestamps||e.timestamps})),o(null)}catch(e){if(!s.current)return;o(e)}finally{s.current&&i(!1)}}t();let r=setInterval(t,e);return()=>{s.current=!1,clearInterval(r)}},[e]),{data:t,loading:r,error:a}}function Bd(e=1e4){return Z(`/apps`,{interval:e,fallback:[],transform:e=>Array.isArray(e)?e.map(e=>({id:e.id,kind:`app`,runtime:e.runtime||`kubernetes`,name:e.name,icon:Id(e.name),color:`#3b82f6`,bg:`linear-gradient(160deg,#3b82f6,#1d4ed8)`,state:e.state,version:e.version||`latest`,category:``,gpu:`CPU`,gpuPct:0,desc:e.image,ports:e.ports||[],deployedAt:e.createdAt?new Date(e.createdAt).toLocaleString(`zh-CN`):``,image:e.image,namespace:e.namespace,replicas:e.replicas,ready:e.ready,createdAt:e.createdAt,containerID:e.containerID||``,restartCount:e.restartCount||0,restartPolicy:e.restartPolicy||``,volumeMounts:e.volumeMounts||[],podName:e.podName||``,nodeName:e.nodeName||``,startedAt:e.startedAt,cpuRequest:e.cpuRequest||``,cpuLimit:e.cpuLimit||``,memRequest:e.memRequest||``,memLimit:e.memLimit||``,observed:e.observed||null,source:e.source||null,revision:e.revision||0,lastTask:e.lastTask||null,ownership:e.ownership||``,discovered:e.discovered||null})):[]})}function Vd(e){return Z(e?`/apps/${encodeURIComponent(e)}`:null,{interval:0,fallback:null})}function Hd(e=3e4){return Z(`/alerts`,{interval:e,fallback:[],transform:e=>Array.isArray(e)?e:[]})}function Ud(e,t=3e3,n=200,r=``){let[i,a]=(0,b.useState)([]),[o,s]=(0,b.useState)(()=>!!e),c=(0,b.useRef)(!0);return(0,b.useEffect)(()=>{if(c.current=!0,!e)return()=>{c.current=!1};async function i(){try{let t=new URLSearchParams({tail:String(n)});r&&t.set(`service`,r);let i=await X(`${Ed}/apps/${encodeURIComponent(e)}/logs?${t}`);if(!i.ok)return;let o=await i.json();if(!c.current)return;let s=o&&o.logs||``;a(s?s.split(` +`).filter(Boolean):[])}catch{}finally{c.current&&s(!1)}}i();let o=setInterval(i,t);return()=>{c.current=!1,clearInterval(o)}},[e,t,n,r]),{lines:i,loading:o}}function Wd(e){return Z(e?`/apps/${e}/versions`:null,{fallback:null})}async function Gd(e,t){let n=await X(`${Ed}/apps/${e}/versions/switch`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({version:t})});if(!n.ok){let e=await n.text();throw Error(e||`HTTP ${n.status}`)}return n.json().catch(()=>null)}async function Kd(e,t){let n=await X(`${Ed}/apps/${e}/${t}`,{method:`POST`});if(!n.ok)throw Error(`HTTP ${n.status}`);return n.json().catch(()=>null)}async function qd(e){let t=await X(`${Ed}/apps/${e}`,{method:`DELETE`});if(!t.ok)throw Error(`HTTP ${t.status}`);return t.json().catch(()=>null)}function Jd(e=5e3){return Z(`/supervisor/status`,{interval:e,fallback:null})}function Yd(e=5e3){return Z(`/vms`,{interval:e,fallback:[]})}function Xd(e=3e4){return Z(`/hardware`,{interval:e,fallback:null})}function Zd(e=3e3){return Z(`/hardware/sensors`,{interval:e,fallback:null})}function Qd(e=5e3){return Z(`/links`,{interval:e,fallback:null})}function $d(e=5e3){return Z(`/ai/activity`,{interval:e,fallback:null})}function ef(e,t=200,n=3e3){let r=Math.max(1,Math.min(Number(t)||200,1e3));return Z(e?`/ai/transcript?path=${encodeURIComponent(e)}&tail=${r}`:null,{interval:n,fallback:null})}async function tf(){let e=await X(`${Ed}/ai/codex/cleanup-stale`,{method:`POST`});if(!e.ok)throw Error(`HTTP ${e.status}`);return e.json().catch(()=>null)}async function nf(e,t){let n=await X(`${Ed}/supervisor/services/${e}/control`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({action:t})});if(!n.ok)throw Error(`HTTP ${n.status}`);return n.json().catch(()=>null)}async function rf(e,t){let n=await X(`${Ed}/vms/${encodeURIComponent(e)}/control`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({action:t})});if(!n.ok){let e=await n.text();throw Error(e||`HTTP ${n.status}`)}return n.json().catch(()=>null)}async function af(e,t){let n=await X(`${Ed}/vms/${encodeURIComponent(e)}/config`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify(t)});if(!n.ok){let e=await n.text();throw Error(e||`HTTP ${n.status}`)}return n.json().catch(()=>null)}async function of(e){try{let t=await X(`${Ed}/supervisor/services/${e}/logs`);return t.ok?await t.json():{name:e,log:``}}catch{return{name:e,log:``}}}function sf(){return Z(`/browser/bookmarks`,{fallback:[]})}function cf(){return Z(`/browser/history`,{fallback:[]})}async function lf(e,t){let n=await X(`${Ed}/browser/bookmarks`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({title:e,url:t})});if(!n.ok)throw Error(`HTTP ${n.status}`);return n.json().catch(()=>null)}async function uf(e){let t=await X(`${Ed}/browser/bookmarks/${encodeURIComponent(e)}`,{method:`DELETE`});if(!t.ok)throw Error(`HTTP ${t.status}`);return t.json().catch(()=>null)}async function df(e,t){try{await X(`${Ed}/browser/history`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({url:e,title:t})})}catch{}}async function ff(){let e=await X(`${Ed}/browser/history`,{method:`DELETE`});if(!e.ok)throw Error(`HTTP ${e.status}`);return e.json().catch(()=>null)}async function pf(e){try{let t=await X(`${Ed}/browser/probe?url=${encodeURIComponent(e)}`);if(!t.ok)return{direct:!0,reason:`probe-failed`};let n=await t.json();return n&&typeof n.direct==`boolean`?n:{direct:!0,reason:`unknown`}}catch{return{direct:!0,reason:`error`}}}function mf(e=15e3){return Z(`/apps/capability`,{interval:e,fallback:null})}function hf(e,t=1500){let[n,r]=(0,b.useState)(null),[i,a]=(0,b.useState)(!0),o=(0,b.useRef)(!0);return(0,b.useEffect)(()=>{if(o.current=!0,!e)return()=>{o.current=!1};let n=null;async function i(){let t=!1;try{let i=await X(`${Ed}/tasks/${encodeURIComponent(e)}`);if(!i.ok)return;let s=await i.json();if(!o.current)return;if(r(s),s.status&&[`succeeded`,`failed`,`canceled`,`superseded`].includes(s.status)){t=!0,n&&clearInterval(n),a(!1);return}}catch{}finally{o.current&&a(!1)}return t}return i().then(e=>{!e&&o.current&&(n=setInterval(i,t))}),()=>{o.current=!1,n&&clearInterval(n)}},[e,t]),{task:e&&n?.id===e?n:null,loading:e?i:!1}}function gf(e,t=4e3){return Z(e?`/apps/${encodeURIComponent(e)}/operations`:null,{interval:t,fallback:[]})}function _f(e){return Z(e?`/apps/${encodeURIComponent(e)}/revisions`:null,{interval:0,fallback:[]})}async function vf(e){let t=await e.text().catch(()=>``),n=Error(`HTTP ${e.status}`);if(n.status=e.status,n.reason=``,n.findings=null,t){try{let e=JSON.parse(t);if(e&&typeof e.error==`string`)return n.message=e.error,typeof e.reason==`string`&&(n.reason=e.reason),e.detail&&(n.detail=e.detail),Array.isArray(e.findings)&&(n.findings=e.findings),n}catch{}return n.message=t.length>500?t.slice(0,500)+`…`:t,n}return n}async function yf(e){let t=await X(`${Ed}/apps/validate`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify(e)});if(!t.ok)throw await vf(t);return t.json()}async function bf(e,t){let n={"Content-Type":`application/json`};t&&(n[`Idempotency-Key`]=t);let r=!!e.id,i=await X(`${Ed}/apps${r?`/`+encodeURIComponent(e.id):``}`,{method:r?`PUT`:`POST`,headers:n,body:JSON.stringify(e)});if(!i.ok)throw await vf(i);return i.json()}async function xf(e,t){let n=await X(`${Ed}/apps/${encodeURIComponent(e)}/actions/${t}`,{method:`POST`});if(!n.ok)throw await vf(n);return n.json()}async function Sf(e,t=!1){let n=await X(`${Ed}/apps/${encodeURIComponent(e)}${t?`?purge=true`:``}`,{method:`DELETE`});if(!n.ok)throw await vf(n);return n.json()}async function Cf(e,t){let n=await X(`${Ed}/apps/${encodeURIComponent(e)}/revisions/${t}/restore`,{method:`POST`});if(!n.ok)throw await vf(n);return n.json()}async function wf(e,t=!1,n){let r={"Content-Type":`application/json`};n&&(r[`Idempotency-Key`]=n);let i=await X(`${Ed}/apps/${encodeURIComponent(e)}/takeover`,{method:`POST`,headers:r,body:JSON.stringify({confirmRisky:!!t})});if(!i.ok)throw await vf(i);return i.json()}function Tf(e){return Z(e?`/apps/${encodeURIComponent(e)}/compose`:null,{interval:0,fallback:null})}function Ef(e){return Z(e?`/apps/${encodeURIComponent(e)}/env`:null,{interval:0,fallback:null})}function Df(e){return Z(e?`/apps/${encodeURIComponent(e)}/storage`:null,{interval:0,fallback:null})}async function Of(e,t){let n={"Content-Type":`application/json`};t&&(n[`Idempotency-Key`]=t);let r=await X(`${Ed}/apps/${encodeURIComponent(e.id)}`,{method:`PUT`,headers:n,body:JSON.stringify(e)});if(!r.ok)throw await vf(r);return r.json()}async function kf(e,t=!1){let n=await X(`${Ed}/apps/${encodeURIComponent(e)}/remove-preview${t?`?purge=true`:`?purge=false`}`);if(!n.ok)throw await vf(n);return n.json()}function Af(){return Z(`/store/apps`,{interval:0,fallback:null})}async function jf(e,t=``){let n=await X(`${Ed}/store/version${`?appId=${encodeURIComponent(e)}&v=${encodeURIComponent(t||``)}`}`);if(!n.ok)throw await vf(n);return n.json()}async function Mf({appId:e,version:t,values:n,idempotencyKey:r,confirmRisky:i=!1}){let a={"Content-Type":`application/json`};r&&(a[`Idempotency-Key`]=r);let o=await X(`${Ed}/store/install`,{method:`POST`,headers:a,body:JSON.stringify({appId:e,version:t,values:n,idempotencyKey:r,confirmRisky:i})});if(!o.ok)throw await vf(o);return o.json()}function Nf(e=3e4){return Z(`/catalogs`,{interval:e,fallback:[]})}function Pf(e=3e4){return Z(`/catalogs/sources`,{interval:e,fallback:[]})}async function Ff(e,t,n){let r=await X(`${Ed}/catalogs/sources${e}`,{method:t,headers:n?{"Content-Type":`application/json`}:void 0,body:n?JSON.stringify(n):void 0});if(!r.ok)throw await vf(r);return r.status===204?null:r.json()}function If(e){return Ff(`/test`,`POST`,e)}function Lf(e){return Ff(``,`POST`,e)}function Rf(e,t){return Ff(`/${encodeURIComponent(e)}`,`PUT`,t)}function zf(e){return Ff(`/${encodeURIComponent(e)}`,`DELETE`)}function Bf(e){return Ff(`/${encodeURIComponent(e)}/refresh`,`POST`)}function Vf(e=3e4){return Z(`/catalogs/apps`,{interval:e,fallback:[]})}async function Hf(){let e=await X(`${Ed}/catalogs`,{method:`POST`});if(!e.ok)throw await vf(e);return e.json()}async function Uf(e,t,n=``){let r=await X(`${Ed}/catalogs/version${`?sourceId=${encodeURIComponent(e)}&appId=${encodeURIComponent(t)}&v=${encodeURIComponent(n||``)}`}`);if(!r.ok)throw await vf(r);return r.json()}async function Wf({sourceId:e,appId:t,version:n,values:r,idempotencyKey:i,confirmRisky:a=!1}){let o={"Content-Type":`application/json`};i&&(o[`Idempotency-Key`]=i);let s=await X(`${Ed}/catalogs/install`,{method:`POST`,headers:o,body:JSON.stringify({sourceId:e,appId:t,version:n,values:r,idempotencyKey:i,confirmRisky:a})});if(!s.ok)throw await vf(s);return s.json()}function Gf({icon:e,label:t,value:n,sub:r,color:i}){let a=n==null||n===``;return(0,w.jsxs)(`div`,{style:{background:S.surface,border:`1px solid ${S.border}`,borderRadius:10,padding:`16px 18px`},children:[(0,w.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,gap:6,marginBottom:10},children:[(0,w.jsx)(D,{name:e,size:14,stroke:1.8,style:{color:a?S.ink4:i}}),(0,w.jsx)(`div`,{style:{fontSize:12.5,fontWeight:600,color:S.ink,letterSpacing:`0.02em`},children:t})]}),(0,w.jsx)(`div`,{className:`mono tnum`,style:{fontSize:30,fontWeight:700,color:a?S.ink4:i,lineHeight:1,letterSpacing:`-0.02em`},children:a?`—`:n}),(0,w.jsx)(`div`,{style:{fontSize:11.5,color:S.ink3,marginTop:8},children:r||`—`})]})}function Kf(e){let t=kd(),n=t?{Authorization:`Bearer `+t}:{};return fetch(e,{headers:n}).then(e=>e.ok?e.json():null).catch(()=>null)}function qf(){let{data:e}=Bd(),t=(e||[]).filter(e=>e.kind===`app`),n={fontSize:10.5,fontWeight:600,color:S.ink3,letterSpacing:`0.06em`,textTransform:`uppercase`};return(0,w.jsxs)(`table`,{style:{width:`100%`,borderCollapse:`collapse`},children:[(0,w.jsx)(`thead`,{children:(0,w.jsxs)(`tr`,{style:{background:`#fafbfc`},children:[(0,w.jsx)(`th`,{style:{...n,textAlign:`left`,padding:`10px 16px`},children:`服务`}),(0,w.jsx)(`th`,{style:{...n,textAlign:`left`,padding:`10px 12px`},children:`状态`}),(0,w.jsx)(`th`,{style:{...n,textAlign:`left`,padding:`10px 12px`},children:`版本`}),(0,w.jsx)(`th`,{style:{...n,textAlign:`left`,padding:`10px 12px`},children:`关联资源`}),(0,w.jsx)(`th`,{style:{...n,textAlign:`right`,padding:`10px 12px`},children:`QPS`}),(0,w.jsx)(`th`,{style:{...n,textAlign:`right`,padding:`10px 12px`},children:`延迟 P99`}),(0,w.jsx)(`th`,{style:{...n,textAlign:`right`,padding:`10px 16px`},children:`占用`})]})}),(0,w.jsx)(`tbody`,{children:t.map((e,t)=>{let n=e.state===`running`;return(0,w.jsxs)(`tr`,{style:{borderTop:t?`1px solid ${S.borderSoft}`:`none`},children:[(0,w.jsx)(`td`,{style:{padding:`10px 16px`},children:(0,w.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,gap:8},children:[(0,w.jsx)(`div`,{style:{width:22,height:22,borderRadius:6,background:e.bg,color:`white`,display:`flex`,alignItems:`center`,justifyContent:`center`},children:(0,w.jsx)(D,{name:e.icon,size:12,stroke:1.8})}),(0,w.jsx)(`span`,{style:{fontSize:12.5,color:S.ink,fontWeight:500},children:e.name})]})}),(0,w.jsx)(`td`,{style:{padding:`10px 12px`},children:n?(0,w.jsxs)(J,{tone:`green`,children:[(0,w.jsx)(q,{tone:`green`,size:6}),`运行中`]}):(0,w.jsxs)(J,{tone:`red`,children:[(0,w.jsx)(q,{tone:`red`,size:6,pulse:!0}),`异常`]})}),(0,w.jsx)(`td`,{style:{padding:`10px 12px`,fontSize:12},className:`mono`,children:e.version}),(0,w.jsx)(`td`,{style:{padding:`10px 12px`,fontSize:12,color:S.ink2},children:e.gpu}),(0,w.jsx)(`td`,{style:{padding:`10px 12px`,textAlign:`right`,fontSize:12,color:S.ink},className:`mono tnum`,children:n?e.qps:`—`}),(0,w.jsx)(`td`,{style:{padding:`10px 12px`,textAlign:`right`,fontSize:12,color:S.ink},className:`mono tnum`,children:n?`${e.p99} ms`:`—`}),(0,w.jsx)(`td`,{style:{padding:`10px 16px`,textAlign:`right`,fontSize:12,color:S.ink2},className:`mono tnum`,children:n&&e.gpuPct?`${e.gpuPct}%`:`—`})]},e.id)})})]})}function Jf({onOpenApp:e}){let[t,n]=(0,b.useState)({}),[r,i]=(0,b.useState)(null),[a,o]=(0,b.useState)([]),[s,c]=(0,b.useState)([]);(0,b.useEffect)(()=>{let e=async()=>{try{let[e,t,r]=await Promise.all([Kf(`/api/v1/metrics`),Kf(`/api/v1/device`),Kf(`/api/v1/apps`)]);if(e&&i(e),t&&n({model:t.cpuModel,name:t.hostname}),e&&e.gpuData&&o(e.gpuData),r&&Array.isArray(r)&&r.length>0){let e=s.filter(e=>e.kind===`system`),t=r.map(e=>({id:e.id,kind:`app`,name:e.name,state:e.state,version:e.version||`latest`,icon:`apps`,color:`#3b82f6`,bg:`linear-gradient(160deg,#3b82f6,#1d4ed8)`,category:``,desc:e.image}));c([...e,...t])}}catch{}};e();let t=setInterval(e,5e3);return()=>clearInterval(t)},[]);let l=r?Math.round(r.cpuUsedPercent):null,u=a.length>0?Math.round(a.reduce((e,t)=>e+t.gpuUtil,0)/a.length):null,d=r?Math.round(r.memoryTotal/(1024*1024*1024)):null,f=r?Math.round(r.memoryUsed/(1024*1024*1024)):null,p=r?Math.round(r.memoryUsedPercent):null,m=r&&r.diskData&&r.diskData.length>0?r.diskData.reduce((e,t)=>t.total>e.total?t:e,r.diskData[0]):null,h=m?Math.round(m.usedPercent):null,g=m?Math.round(m.used/(1024*1024*1024)):null,_=m?Math.round(m.total/(1024*1024*1024)):null,v=r&&r.cpuPercent?r.cpuPercent.length:null;return(0,w.jsxs)(`div`,{style:{flex:1,padding:`20px 24px`,overflow:`auto`,background:S.surfaceAlt},children:[(0,w.jsx)(`div`,{style:{display:`flex`,alignItems:`center`,marginBottom:14},children:(0,w.jsxs)(`div`,{children:[(0,w.jsx)(`div`,{style:{...S.type.heading,color:S.ink},children:`仪表盘 · 总览`}),(0,w.jsxs)(`div`,{style:{fontSize:12,color:S.ink3,marginTop:3,display:`flex`,alignItems:`center`,gap:8},children:[(0,w.jsxs)(`span`,{children:[(0,w.jsx)(`span`,{className:`edge-live-dot`,style:{display:`inline-block`,width:6,height:6,borderRadius:`50%`,background:S.green,marginRight:5,verticalAlign:`middle`}}),`实时刷新中`]}),(0,w.jsx)(`span`,{style:{color:`#cbd5e1`},children:`·`}),(0,w.jsx)(`span`,{children:`采样间隔 5s`}),(0,w.jsx)(`span`,{style:{color:`#cbd5e1`},children:`·`}),(0,w.jsx)(`span`,{children:t.model||``})]})]})}),(0,w.jsxs)(`div`,{style:{display:`grid`,gridTemplateColumns:`repeat(4, 1fr)`,gap:12,marginBottom:14},children:[(0,w.jsx)(Gf,{icon:`cpu`,label:`CPU 使用率`,color:S.blue,value:l==null?null:`${l}%`,sub:v==null?`加载中…`:`${v}C 当前负载`}),(0,w.jsx)(Gf,{icon:`bolt`,label:`GPU 平均`,color:S.indigo,value:a.length>0?u==null?null:`${u}%`:`无 GPU`,sub:a.length>0?`${a.length} × ${a[0].productName}`:`本节点未检测到 NVIDIA GPU`}),(0,w.jsx)(Gf,{icon:`memory`,label:`内存`,color:S.teal,value:p==null?null:`${p}%`,sub:f!=null&&d!=null?`${f} GB / ${d} GB`:`加载中…`}),(0,w.jsx)(Gf,{icon:`hardDrive`,label:`磁盘`,color:S.amber,value:h==null?null:`${h}%`,sub:g!=null&&_!=null?`${g} GB / ${_} GB`:`加载中…`})]}),(0,w.jsx)(`div`,{style:{display:`flex`,justifyContent:`flex-end`,marginBottom:14},children:(0,w.jsxs)(`button`,{onClick:()=>{e?e({id:`monitoring`,kind:`system`,name:`监控`}):window.alert(`监控 App 尚未就绪`)},className:`edge-press edge-btn-primary`,style:{..._d,height:32,padding:`0 14px`,fontSize:12.5},children:[(0,w.jsx)(D,{name:`sparkle`,size:13,stroke:1.8}),`进入监控查看详细曲线 →`]})}),(0,w.jsxs)(`div`,{style:{background:S.surface,border:`1px solid ${S.border}`,borderRadius:10,padding:0,overflow:`hidden`},children:[(0,w.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,padding:`12px 16px`,borderBottom:`1px solid ${S.borderSoft}`},children:[(0,w.jsx)(`div`,{style:{fontSize:13,fontWeight:600,color:S.ink},children:`应用摘要`}),(0,w.jsx)(`div`,{style:{flex:1}}),(0,w.jsxs)(`span`,{style:{fontSize:11.5,color:S.ink3},children:[`共 `,s.filter(e=>e.kind===`app`).length,` 个 · `,s.filter(e=>e.kind===`app`&&e.state===`running`).length,` 运行中 · `,s.filter(e=>e.kind===`app`&&e.state===`error`).length,` 异常`]})]}),(0,w.jsx)(qf,{})]})]})}var Yf={position:`relative`,border:`none`,background:`transparent`,cursor:`pointer`,display:`flex`,alignItems:`center`,gap:6,boxSizing:`border-box`,whiteSpace:`nowrap`,fontFamily:`inherit`};function Xf(e,t,n){return typeof e==`function`?e(t,n):e}function Zf({tabs:e,active:t,onChange:n,getId:r=e=>e.id,renderLabel:i,itemAs:a=`div`,style:o,itemStyle:s,activeItemStyle:c,inactiveItemStyle:l,activeColor:u=S.blue,activeTextColor:d=S.blueDeep,inactiveTextColor:f=S.ink3,activeWeight:p=600,inactiveWeight:m=500,indicatorPosition:h=`bottom`,indicatorInset:g=0,indicatorRadius:_=0,reserveIndicatorSpace:v=!0,getItemProps:y}){let x=`tabbar-${(0,b.useId)()}-indicator`,C=Wu();return(0,w.jsx)(`div`,{style:{display:`flex`,gap:2,...o},children:e.map(e=>{let o=r(e),S=t===o,T=y?y(e,S):null,E={position:`absolute`,left:g,right:g,height:2,background:u,borderRadius:_,pointerEvents:`none`,[h]:0};return(0,b.createElement)(a,{key:o,onClick:()=>n(o,e),type:a===`button`?`button`:void 0,...T,style:{...Yf,...v?{[h===`top`?`borderTop`:`borderBottom`]:`2px solid transparent`}:null,color:S?d:f,fontWeight:S?p:m,...Xf(s,e,S),...Xf(S?c:l,e,S),...T?.style}},i?i(e,S):e.label,S&&(0,w.jsx)(Hu.div,{layoutId:x,style:E,transition:C.reduced?{duration:0}:Uu.snappy}))})})}function Qf(e,t){if(!e&&!t)return 0;if(!e)return-1;if(!t)return 1;let n=e=>String(e).replace(/^v/i,``).split(/[.\-+]/),r=n(e),i=n(t),a=Math.max(r.length,i.length);for(let e=0;e0&&(t[e.slice(0,r).trim()]=e.slice(r+1))}return t}function tp(e){return e&&typeof e==`object`&&`raw`in e?String(e.raw):e==null?``:String(e)}function np(e){if(!e)return``;if(e.label){if(e.label.zh)return e.label.zh;if(e.label.en)return e.label.en}return e.key||``}function rp(e,t){if(!e)return t;if(e.type===`number`&&t!==``&&t!=null){let e=Number(t);return Number.isNaN(e)?t:e}return e.type===`boolean`?t===!0||t===`true`:t}function ip(e,t){return Array.isArray(e)?e.filter(e=>e.required&&(t[e.key]==null||t[e.key]===``)).map(e=>np(e)):[]}function ap(e){let t={blocked:[],confirmation:[],warning:[]};if(!Array.isArray(e))return t;for(let n of e){let e=n&&n.level;e===`blocked`||e===`confirmation`||e===`warning`?t[e].push(n):t.warning.push(n)}return t}function op(e,t){return e.blocked.length>0?{deployable:!1,reason:`blocked`}:e.confirmation.length>0&&!t?{deployable:!1,reason:`confirmation`}:{deployable:!0,reason:`ok`}}function sp(e){if(!e)return{label:`未知`,tone:`gray`,hint:``};switch(e.kind){case`managed`:return{label:`受管卷`,tone:`blue`,hint:e.deletable?`卸载并清除数据(purge)时会删除`:`由 devbox 托管`};case`external`:return{label:`外部卷`,tone:`amber`,hint:`external:true 外部数据,卸载时永不删除`};case`bind`:return{label:`宿主挂载`,tone:`amber`,hint:`绑定宿主路径,生命周期由宿主管,卸载时不删除`};case`socket`:return{label:`Socket`,tone:`red`,hint:`特权 socket 挂载(安装期已阻断,仅防御性标识)`};default:return{label:e.kind||`卷`,tone:`gray`,hint:``}}}function cp(e){if(!e)return{typeLabel:`—`,secret:!1};let t=e.type===`password`;return{typeLabel:t?`Secret`:e.type===`text`?`文本`:e.type||`—`,secret:t}}function lp(e,t=Date.now()){if(!e)return`—`;let n=new Date(e).getTime();if(Number.isNaN(n))return`—`;let r=Math.max(0,t-n),i=Math.floor(r/6e4);if(i<1)return`刚刚`;if(i<60)return`${i} 分钟前`;let a=Math.floor(i/60);if(a<24)return`${a} 小时前`;let o=Math.floor(a/24);if(o===1)return`昨天`;if(o<7)return`${o} 天前`;try{return new Date(e).toLocaleString(`zh-CN`,{year:`numeric`,month:`2-digit`,day:`2-digit`,hour:`2-digit`,minute:`2-digit`})}catch{return`—`}}function up(e){if(!e)return`—`;let t=new Date(e).getTime();if(Number.isNaN(t))return`—`;try{return new Date(e).toLocaleString(`zh-CN`,{year:`numeric`,month:`2-digit`,day:`2-digit`,hour:`2-digit`,minute:`2-digit`})}catch{return`—`}}var dp={running:`运行中`,stopped:`已停止`,degraded:`降级`,deploying:`部署中`,failed:`失败`,pending:`等待`,removing:`卸载中`,unknown:`未知`},fp={running:`green`,stopped:`gray`,degraded:`amber`,deploying:`blue`,failed:`red`,pending:`blue`,removing:`violet`,unknown:`gray`};function pp(e){return e?.observed?.phase||e?.state||`unknown`}function mp(e){return e===`compose`?`Docker Compose`:e===`kubernetes`?`Kubernetes`:`未知`}function hp(e){if(!e)return``;let t=String(e.protocol||`tcp`).toLowerCase();return e.hostPort&&e.hostPort>0?`${e.hostPort}:${e.containerPort}/${t}`:e.containerPort?`${e.containerPort}/${t}`:``}function gp(e,t=4){let n=(e&&e.observed&&e.observed.services||[]).map(e=>({name:e.name||`—`,state:e.state||``,health:e.health||``,ports:(e.ports||[]).map(hp).filter(Boolean)})),r=n.length,i=r>t;return{rows:n.slice(0,t),total:r,truncated:i}}var _p={healthy:`健康`,unhealthy:`不健康`,starting:`启动中`,none:`—`};function vp(e){let t=e?.source?.kind;return t===`store`?{label:`平台商店`,tone:`blue`,kind:`store`}:t===`catalog`?{label:`第三方 Catalog`,tone:`violet`,kind:`catalog`}:t===`inline`?{label:`自定义`,tone:`gray`,kind:`inline`}:{label:e?.runtime===`compose`?`本地`:`K8s`,tone:`gray`,kind:`local`}}function yp(e,t,n){let r=e?.source?.kind,i=e?.source?.storeId;return i?r===`store`&&Array.isArray(t)?t.find(e=>e&&e.id===i)||null:r===`catalog`&&Array.isArray(n)&&n.find(t=>t&&t.catalogId===e.source.catalogId&&t.id===i)||null:null}function bp(e,t,n){let r=yp(e,t,n),i=e?.source?.version||e?.version||``;if(!r)return{upgradable:!1,latestVersion:``,installedVersion:i,installable:!1};let a=r.version||``;return{upgradable:!!i&&!!a&&Qf(i,a)<0,latestVersion:a,installedVersion:i,installable:!!r.installable}}var xp=(0,b.createContext)(null);function Sp(){let e=(0,b.useContext)(xp);if(!e)throw Error(`useToast must be used inside ToastProvider`);return e}function Cp(e,t,n){let r=(e+` `+t).toLowerCase();for(let[e,t]of Object.entries({code:{icon:`code`,bg:`linear-gradient(160deg,#3b82f6,#1e40af)`},vscode:{icon:`code`,bg:`linear-gradient(160deg,#3b82f6,#1e40af)`},jupyter:{icon:`jupyter`,bg:`linear-gradient(160deg,#fb923c,#c2410c)`},ollama:{icon:`ollama`,bg:`linear-gradient(160deg,#475569,#0f172a)`},vllm:{icon:`vllm`,bg:`linear-gradient(160deg,#fb7185,#be123c)`},qwen:{icon:`sparkle`,bg:`linear-gradient(160deg,#818cf8,#4338ca)`},deepseek:{icon:`sparkle`,bg:`linear-gradient(160deg,#1e293b,#020617)`},lobe:{icon:`openwebui`,bg:`linear-gradient(160deg,#a78bfa,#7c3aed)`},webui:{icon:`openwebui`,bg:`linear-gradient(160deg,#22d3ee,#0891b2)`},mysql:{icon:`database`,bg:`linear-gradient(160deg,#22d3ee,#0891b2)`},postgres:{icon:`database`,bg:`linear-gradient(160deg,#60a5fa,#2563eb)`},redis:{icon:`database`,bg:`linear-gradient(160deg,#fb7185,#e11d48)`},comfy:{icon:`palette`,bg:`linear-gradient(160deg,#a78bfa,#6d28d9)`}}))if(r.includes(e))return t;return{"ai-inference":{icon:`sparkle`,bg:`linear-gradient(160deg,#818cf8,#4338ca)`},"ai-tools":{icon:`wrench`,bg:`linear-gradient(160deg,#34d399,#059669)`},"dev-environment":{icon:`code`,bg:`linear-gradient(160deg,#3b82f6,#1d4ed8)`},database:{icon:`database`,bg:`linear-gradient(160deg,#22d3ee,#0891b2)`}}[n]||{icon:`apps`,bg:`linear-gradient(160deg,#64748b,#334155)`}}var wp={"ai-inference":`AI 推理`,"ai-tools":`AI 工具`,"dev-environment":`开发环境`,database:`存储`},Tp={"ai-inference":`sparkle`,"ai-tools":`wrench`,"dev-environment":`code`,database:`database`};function Ep({app:e,onClose:t,onSuccess:n}){let[r,i]=(0,b.useState)(!0),[a,o]=(0,b.useState)(null),[s,c]=(0,b.useState)({}),[l,u]=(0,b.useState)(!1),[d,f]=(0,b.useState)(null),[p,m]=(0,b.useState)([]),[h,g]=(0,b.useState)(!1),[_,v]=(0,b.useState)({}),y=e.origin===`catalog`;(0,b.useEffect)(()=>{let t=!1;return(y?Uf(e.sourceId,e.id,e.ver||``):jf(e.id,e.ver||``)).then(e=>{if(t)return;let n=e.valuesSchema,r=e.defaultValues||{};o(n);let i={};n&&n.fields&&n.fields.forEach(e=>{i[e.key]=tp(r[e.key])}),c(i),e.installable===!1&&f(e.notInstallableReason||`该应用不可在本机安装`)}).catch(e=>{t||f(e.message||`获取版本信息失败`)}).finally(()=>{t||i(!1)}),()=>{t=!0}},[e.id,e.ver,e.sourceId,y]);let x=(e,t)=>{c(n=>({...n,[e]:t})),m([]),g(!1),f(null)};async function C(){let t=a?.fields||[],r=ip(t,s);if(r.length>0){f(`请填写必填项: ${r.join(`, `)}`);return}u(!0),f(null);try{let r={};t.forEach(e=>{r[e.key]=rp(e,s[e.key])});let i=y?{sourceId:e.sourceId,appId:e.id,version:e.ver||``,values:r,confirmRisky:h}:{appId:e.id,version:e.ver||``,values:r,confirmRisky:h};n(y?await Wf(i):await Mf(i))}catch(e){e.reason===`risk_blocked`&&Array.isArray(e.findings)&&(m(e.findings),g(!1)),f(e.message||`部署失败`)}finally{u(!1)}}let T=a?.fields||[],E=p.some(e=>e.level===`blocked`),O=p.some(e=>e.level===`confirmation`),k=d&&/不可|installable|Kubernetes/i.test(d)&&!T.length,A={width:`100%`,height:34,padding:`0 10px`,borderRadius:7,border:`1px solid ${S.border}`,fontSize:13,background:S.surface,color:S.ink,outline:`none`,boxSizing:`border-box`};return(0,w.jsx)(`div`,{style:{position:`fixed`,inset:0,zIndex:999,display:`flex`,alignItems:`center`,justifyContent:`center`,background:`rgba(15,23,42,0.5)`,backdropFilter:`blur(4px)`},onClick:t,children:(0,w.jsxs)(`div`,{onClick:e=>e.stopPropagation(),style:{width:480,maxWidth:`94vw`,maxHeight:`84vh`,borderRadius:14,background:S.surface,border:`1px solid ${S.border}`,boxShadow:`0 24px 48px -12px rgba(0,0,0,0.2)`,display:`flex`,flexDirection:`column`,overflow:`hidden`},children:[(0,w.jsxs)(`div`,{style:{padding:`16px 20px`,borderBottom:`1px solid ${S.border}`,display:`flex`,alignItems:`center`,gap:10},children:[(0,w.jsx)(`div`,{style:{width:32,height:32,borderRadius:8,background:e.iconUrl?S.surfaceAlt:e.bg,color:`white`,display:`flex`,alignItems:`center`,justifyContent:`center`,flexShrink:0,overflow:`hidden`},children:e.iconUrl?(0,w.jsx)(`img`,{src:e.iconUrl,alt:``,style:{width:32,height:32,objectFit:`cover`}}):(0,w.jsx)(D,{name:e.icon,size:18,stroke:1.7})}),(0,w.jsxs)(`div`,{style:{flex:1,minWidth:0},children:[(0,w.jsxs)(`div`,{style:{...S.type.heading,color:S.ink},children:[`部署 `,e.name]}),(0,w.jsxs)(`div`,{style:{fontSize:11,color:S.ink3},className:`mono`,children:[e.ver,` · `,y?e.sourceName||`第三方 Catalog`:`平台商店`]})]}),(0,w.jsx)(`button`,{onClick:t,"aria-label":`关闭`,style:{background:`none`,border:`none`,cursor:`pointer`,padding:4,color:S.ink3},children:(0,w.jsx)(D,{name:`x`,size:16,stroke:2})})]}),(0,w.jsxs)(`div`,{style:{flex:1,overflow:`auto`,padding:`16px 20px`},children:[r&&(0,w.jsx)(`div`,{style:{textAlign:`center`,padding:40,color:S.ink3},children:`加载配置中…`}),!r&&k&&(0,w.jsx)(`div`,{style:{padding:20,textAlign:`center`,color:`#b45309`,fontSize:12.5},children:d}),!r&&!k&&T.length===0&&!d&&(0,w.jsx)(`div`,{style:{textAlign:`center`,padding:40,color:S.ink3},children:`此应用无需配置参数`}),!r&&T.length>0&&(0,w.jsx)(`div`,{style:{display:`flex`,flexDirection:`column`,gap:14},children:T.map(e=>{let t=np(e);return(0,w.jsxs)(`div`,{children:[(0,w.jsxs)(`label`,{style:{fontSize:12,color:S.ink2,fontWeight:600,marginBottom:5,display:`block`},htmlFor:`fld-${e.key}`,children:[t,e.required&&(0,w.jsx)(`span`,{style:{color:`#ef4444`,marginLeft:2},children:`*`})]}),e.type===`select`?(0,w.jsx)(`select`,{id:`fld-${e.key}`,value:s[e.key]||``,onChange:t=>x(e.key,t.target.value),style:{...A,cursor:`pointer`},children:(e.options||[]).map(e=>(0,w.jsx)(`option`,{value:e.value,children:e.label},e.value))}):e.type===`password`?(0,w.jsxs)(`div`,{style:{position:`relative`},children:[(0,w.jsx)(`input`,{id:`fld-${e.key}`,type:_[e.key]?`text`:`password`,value:s[e.key]||``,onChange:t=>x(e.key,t.target.value),placeholder:t,autoComplete:`new-password`,style:{...A,paddingRight:36}}),(0,w.jsx)(`button`,{type:`button`,onClick:()=>v(t=>({...t,[e.key]:!t[e.key]})),"aria-label":_[e.key]?`隐藏`:`显示`,style:{position:`absolute`,right:6,top:7,background:`none`,border:`none`,cursor:`pointer`,color:S.ink4,padding:2},children:(0,w.jsx)(D,{name:`eye`,size:14,stroke:1.8})})]}):e.type===`boolean`?(0,w.jsxs)(`label`,{style:{display:`flex`,alignItems:`center`,gap:8,cursor:`pointer`},children:[(0,w.jsx)(`input`,{id:`fld-${e.key}`,type:`checkbox`,checked:s[e.key]===!0||s[e.key]===`true`,onChange:t=>x(e.key,t.target.checked)}),(0,w.jsx)(`span`,{style:{fontSize:12.5,color:S.ink2},children:t})]}):(0,w.jsx)(`input`,{id:`fld-${e.key}`,type:e.type===`number`?`number`:`text`,value:s[e.key]??``,onChange:t=>x(e.key,t.target.value),placeholder:t,style:A})]},e.key)})}),d&&!k&&(0,w.jsx)(`div`,{style:{fontSize:12,color:`#ef4444`,marginTop:10,padding:`8px 10px`,background:`#fef2f2`,borderRadius:6},children:d}),p.length>0&&(0,w.jsxs)(`div`,{style:{marginTop:10,padding:`10px 12px`,borderRadius:7,background:`#fffbeb`,border:`1px solid #fde68a`},children:[(0,w.jsx)(`div`,{style:{fontSize:12,fontWeight:700,color:`#92400e`,marginBottom:6},children:`运行权限风险`}),p.map((e,t)=>(0,w.jsxs)(`div`,{style:{fontSize:11.5,color:e.level===`blocked`?`#b91c1c`:`#92400e`,marginTop:3},children:[e.level===`blocked`?`已阻断`:e.level===`confirmation`?`需确认`:`警告`,`:`,e.message]},`${e.field||`risk`}-${t}`)),O&&!E&&(0,w.jsxs)(`label`,{style:{display:`flex`,alignItems:`flex-start`,gap:7,marginTop:9,cursor:`pointer`,fontSize:11.5,color:`#78350f`},children:[(0,w.jsx)(`input`,{type:`checkbox`,checked:h,onChange:e=>g(e.target.checked)}),(0,w.jsx)(`span`,{children:`我了解该应用将获得列出的宿主权限,并确认继续部署`})]})]})]}),(0,w.jsxs)(`div`,{style:{padding:`12px 20px`,borderTop:`1px solid ${S.border}`,display:`flex`,justifyContent:`flex-end`,gap:8},children:[(0,w.jsx)(`button`,{onClick:t,className:`edge-press edge-btn-secondary`,style:{...gd,height:34,padding:`0 16px`},children:`取消`}),(0,w.jsxs)(`button`,{onClick:C,disabled:l||r||k||E||O&&!h,className:`edge-press edge-btn-primary`,style:{..._d,height:34,padding:`0 20px`,opacity:l||r||k||E||O&&!h?.6:1},children:[(0,w.jsx)(D,{name:`download`,size:13,stroke:2}),l?`部署中...`:h?`确认风险并部署`:`确认部署`]})]})]})})}function Dp({taskId:e}){let{task:t}=hf(e,1500),n=!t||!t.status?`Pending`:t.status===`succeeded`?`Running`:t.status===`failed`?`Failed`:`Pending`,r={Pending:`部署中`,Running:`已部署`,Failed:`部署失败`}[n],i=t?.message||``,a={Pending:`#f59e0b`,Running:`#10b981`,Failed:`#ef4444`}[n]||S.ink3;return(0,w.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,gap:8,padding:`8px 12px`,borderRadius:8,background:S.surfaceAlt,border:`1px solid ${S.borderSoft}`},children:[(0,w.jsx)(q,{tone:n===`Running`?`green`:n===`Failed`?`red`:`amber`,size:8}),(0,w.jsx)(`span`,{style:{fontSize:12.5,fontWeight:600,color:a},children:r}),i&&(0,w.jsxs)(`span`,{style:{fontSize:11,color:S.ink3},children:[`— `,i]})]})}function Op({app:e,onBack:t,onOpenApp:n}){let[r,i]=(0,b.useState)(!1),[a,o]=(0,b.useState)(null);return(0,w.jsxs)(`div`,{style:{flex:1,display:`flex`,flexDirection:`column`,background:S.surfaceAlt,overflow:`auto`},children:[(0,w.jsxs)(`div`,{style:{padding:`12px 24px`,borderBottom:`1px solid ${S.border}`,background:S.surface,display:`flex`,alignItems:`center`,gap:10},children:[(0,w.jsxs)(`button`,{onClick:t,className:`edge-press edge-btn-secondary`,style:{...gd,height:28,padding:`0 10px`},children:[(0,w.jsx)(D,{name:`chevDown`,size:12,stroke:2,style:{transform:`rotate(90deg)`}}),`返回应用列表`]}),(0,w.jsxs)(`span`,{style:{fontSize:11.5,color:S.ink3},children:[`应用列表 `,(0,w.jsx)(`span`,{style:{color:S.ink4},children:`/`}),` `,(0,w.jsx)(`span`,{style:{color:S.ink,fontWeight:600},children:e.name})]})]}),(0,w.jsxs)(`div`,{style:{padding:24},children:[(0,w.jsxs)(`div`,{style:{background:S.surface,border:`1px solid ${S.border}`,borderRadius:12,padding:24,marginBottom:16,display:`flex`,alignItems:`flex-start`,gap:18},children:[(0,w.jsx)(`div`,{style:{width:64,height:64,borderRadius:14,background:e.iconUrl?S.surfaceAlt:e.bg,color:`white`,display:`flex`,alignItems:`center`,justifyContent:`center`,flexShrink:0,overflow:`hidden`},children:e.iconUrl?(0,w.jsx)(`img`,{src:e.iconUrl,alt:``,style:{width:64,height:64,objectFit:`cover`}}):(0,w.jsx)(D,{name:e.icon,size:30,stroke:1.6})}),(0,w.jsxs)(`div`,{style:{flex:1,minWidth:0},children:[(0,w.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,gap:8,flexWrap:`wrap`},children:[(0,w.jsx)(`div`,{style:{...S.type.title,fontWeight:700,color:S.ink},children:e.name}),(0,w.jsx)(J,{tone:e.runtime===`compose`?`blue`:`gray`,children:e.runtime===`compose`?`Docker Compose`:`Kubernetes`}),(0,w.jsx)(J,{tone:`gray`,children:(0,w.jsx)(`span`,{className:`mono`,children:e.ver})}),e.cat&&(0,w.jsx)(J,{tone:`blue`,children:e.cat}),(0,w.jsx)(J,{tone:e.origin===`catalog`?`violet`:`blue`,children:e.origin===`catalog`?e.sourceName||`第三方 Catalog`:`平台商店`}),(e.installed||a)&&(0,w.jsxs)(J,{tone:`green`,children:[(0,w.jsx)(q,{tone:`green`,size:6}),a?`已部署`:`已安装`]})]}),(0,w.jsxs)(`div`,{style:{fontSize:12,color:S.ink3,marginTop:6,display:`flex`,gap:10,flexWrap:`wrap`},children:[e.provider&&(0,w.jsxs)(w.Fragment,{children:[(0,w.jsxs)(`span`,{children:[`提供方 `,(0,w.jsx)(`span`,{style:{color:S.ink2,fontWeight:600},children:e.provider})]}),(0,w.jsx)(`span`,{style:{color:`#cbd5e1`},children:`·`})]}),e.date&&(0,w.jsxs)(`span`,{children:[`更新于 `,(0,w.jsx)(`span`,{className:`mono`,children:e.date})]})]}),(0,w.jsx)(`div`,{style:{fontSize:13,color:S.ink2,marginTop:12,lineHeight:1.7},children:e.desc})]}),(0,w.jsxs)(`div`,{style:{display:`flex`,flexDirection:`column`,gap:8,flexShrink:0,alignItems:`flex-end`},children:[e.installable?(0,w.jsxs)(`button`,{onClick:()=>i(!0),className:`edge-press edge-btn-primary`,style:{..._d,height:36,padding:`0 18px`},children:[(0,w.jsx)(D,{name:`download`,size:13,stroke:2}),e.upgradable?`升级到 ${e.ver}`:e.installed?`重新部署`:`部署`]}):(0,w.jsx)(`div`,{title:e.notInstallableReason||``,style:{fontSize:11.5,color:S.ink3,padding:`8px 12px`,borderRadius:8,background:S.surfaceAlt,border:`1px solid ${S.borderSoft}`,maxWidth:180,textAlign:`center`},children:e.notInstallableReason||`仅 Kubernetes 环境支持`}),e.installed&&e.installable&&(0,w.jsxs)(`button`,{onClick:()=>n&&n({id:e.devboxId||e.id}),className:`edge-press edge-btn-secondary`,style:{...gd,height:30,padding:`0 14px`},children:[(0,w.jsx)(D,{name:`play`,size:12,stroke:2}),`打开应用`]})]})]}),a&&(0,w.jsx)(Yu,{title:`部署状态`,padding:16,style:{marginBottom:12},children:(0,w.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,gap:12},children:[(0,w.jsx)(Dp,{taskId:a.taskId}),(0,w.jsx)(`span`,{style:{fontSize:12,color:S.ink3},className:`mono`,children:a.appId||a.name})]})}),(0,w.jsx)(Yu,{title:`README · 简介`,padding:20,children:(0,w.jsx)(`div`,{style:{fontSize:13,color:S.ink2,lineHeight:1.75},children:(0,w.jsxs)(`p`,{style:{margin:`0 0 10px`},children:[(0,w.jsx)(`strong`,{style:{color:S.ink},children:e.name}),` — `,e.desc]})})})]}),r&&(0,w.jsx)(Ep,{app:e,onClose:()=>i(!1),onSuccess:e=>{i(!1),o(e)}})]})}function kp({app:e,onOpen:t,onOpenApp:n}){return(0,w.jsxs)(`div`,{onClick:t,className:`edge-row-hover`,role:`button`,tabIndex:0,onKeyDown:e=>{e.key===`Enter`&&t()},style:{background:S.surface,border:`1px solid ${S.border}`,borderRadius:10,padding:14,cursor:`pointer`,transition:`all 0.15s ease`,display:`flex`,flexDirection:`column`,gap:10,"--edge-row-hover-bg":S.surface,"--edge-row-hover-border-color":`#bfdbfe`,"--edge-row-hover-box-shadow":`0 6px 14px -6px rgba(15,23,42,0.12)`},children:[(0,w.jsxs)(`div`,{style:{display:`flex`,alignItems:`flex-start`,gap:10},children:[(0,w.jsx)(`div`,{style:{width:40,height:40,borderRadius:10,background:e.iconUrl?S.surfaceAlt:e.bg,color:`white`,display:`flex`,alignItems:`center`,justifyContent:`center`,flexShrink:0,overflow:`hidden`,boxShadow:e.iconUrl?`0 1px 3px rgba(0,0,0,0.08)`:`inset 0 1px 0 rgba(255,255,255,0.3)`},children:e.iconUrl?(0,w.jsx)(`img`,{src:e.iconUrl,alt:``,style:{width:40,height:40,objectFit:`cover`}}):(0,w.jsx)(D,{name:e.icon,size:20,stroke:1.7})}),(0,w.jsxs)(`div`,{style:{minWidth:0,flex:1},children:[(0,w.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,gap:5},children:[(0,w.jsx)(`div`,{style:{fontSize:14,fontWeight:600,color:S.ink,whiteSpace:`nowrap`,overflow:`hidden`,textOverflow:`ellipsis`},children:e.name}),e.installed&&!e.upgradable&&(0,w.jsx)(`span`,{style:{fontSize:9.5,padding:`1px 5px`,borderRadius:3,background:`#ecfdf5`,color:`#047857`,border:`1px solid #a7f3d0`,fontWeight:600,flexShrink:0},children:`已安装`}),e.upgradable&&(0,w.jsx)(`span`,{title:`已装 ${e.installedVersion} → ${e.ver}`,style:{fontSize:9.5,padding:`1px 5px`,borderRadius:3,background:`#fffbeb`,color:`#b45309`,border:`1px solid #fde68a`,fontWeight:600,flexShrink:0},children:`可升级`})]}),(0,w.jsxs)(`div`,{style:{fontSize:11,color:S.ink3,marginTop:3,display:`flex`,gap:6,alignItems:`center`},children:[(0,w.jsx)(`span`,{className:`mono`,children:e.ver}),(0,w.jsx)(`span`,{style:{color:`#cbd5e1`},children:`·`}),(0,w.jsx)(`span`,{children:e.origin===`catalog`?e.sourceName||`Catalog`:`平台`})]})]})]}),(0,w.jsx)(`div`,{style:{fontSize:12,color:S.ink2,lineHeight:1.55,display:`-webkit-box`,WebkitLineClamp:2,WebkitBoxOrient:`vertical`,overflow:`hidden`,minHeight:38},children:e.desc}),(0,w.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,gap:6,paddingTop:10,borderTop:`1px dashed ${S.border}`},children:[e.cat&&(0,w.jsx)(`span`,{style:{fontSize:10.5,padding:`2px 6px`,borderRadius:3,background:S.surfaceAlt,color:S.ink3,border:`1px solid ${S.borderSoft}`},children:e.cat}),(0,w.jsx)(`span`,{style:{fontSize:9.5,padding:`1px 5px`,borderRadius:3,fontWeight:600,flexShrink:0,background:e.runtime===`compose`?`#eff6ff`:S.surfaceAlt,color:e.runtime===`compose`?`#1d4ed8`:S.ink3,border:`1px solid ${e.runtime===`compose`?`#bfdbfe`:S.borderSoft}`},children:e.runtime===`compose`?`Compose`:`K8s`}),(0,w.jsx)(`div`,{style:{flex:1}}),e.installable?e.installed?(0,w.jsxs)(`button`,{onClick:t=>{t.stopPropagation(),n&&n({id:e.devboxId||e.id})},className:`edge-press edge-btn-secondary`,style:{...gd,height:26,padding:`0 10px`,fontSize:11.5},children:[(0,w.jsx)(D,{name:`play`,size:11,stroke:2}),`打开`]}):(0,w.jsxs)(`button`,{onClick:e=>{e.stopPropagation(),t()},className:`edge-press edge-btn-primary`,style:{..._d,height:26,padding:`0 10px`,fontSize:11.5},children:[(0,w.jsx)(D,{name:`download`,size:11,stroke:2}),`部署`]}):(0,w.jsx)(`span`,{title:e.notInstallableReason||``,style:{fontSize:10.5,color:`#b45309`,fontWeight:600,flexShrink:0},children:e.runtime===`compose`?`暂不可安装`:`仅 Kubernetes`})]})]})}function Ap({source:e,onClose:t,onSaved:n}){let r=!!e,[i,a]=(0,b.useState)({id:e?.id||``,name:e?.name||``,kind:e?.kind||`auto`,url:e?.url||`https://github.com/1Panel-dev/appstore`,ref:e?.ref||``,token:``}),[o,s]=(0,b.useState)(``),[c,l]=(0,b.useState)(null),[u,d]=(0,b.useState)(``),f=(e,t)=>a(n=>({...n,[e]:t}));(0,b.useEffect)(()=>{let e=e=>{e.key===`Escape`&&t()};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},[t]);async function p(){s(`test`),d(``),l(null);try{l(await If(i))}catch(e){d(e.message)}finally{s(``)}}async function m(){s(`save`),d(``);try{n(r?await Rf(e.id,i):await Lf(i))}catch(e){d(e.message)}finally{s(``)}}let h={width:`100%`,boxSizing:`border-box`,height:36,padding:`0 10px`,borderRadius:7,border:`1px solid ${S.border}`,background:S.surface,color:S.ink,fontSize:12.5,outline:`none`};return(0,w.jsx)(`div`,{role:`dialog`,"aria-modal":`true`,"aria-label":r?`编辑应用市场`:`添加应用市场`,style:{position:`fixed`,inset:0,zIndex:1100,display:`flex`,alignItems:`center`,justifyContent:`center`,padding:20,background:`rgba(15,23,42,0.42)`,backdropFilter:`blur(3px)`},onMouseDown:e=>{e.target===e.currentTarget&&t()},children:(0,w.jsxs)(`div`,{style:{width:520,maxWidth:`100%`,borderRadius:13,background:S.surface,boxShadow:`0 24px 70px rgba(15,23,42,0.24), 0 2px 10px rgba(15,23,42,0.08)`,overflow:`hidden`},children:[(0,w.jsxs)(`div`,{style:{padding:`18px 20px 14px`,borderBottom:`1px solid ${S.borderSoft}`,display:`flex`,alignItems:`center`,gap:10},children:[(0,w.jsx)(`div`,{style:{width:34,height:34,borderRadius:9,display:`flex`,alignItems:`center`,justifyContent:`center`,background:S.blueSoft,color:S.blueDeep},children:(0,w.jsx)(D,{name:`store`,size:17})}),(0,w.jsxs)(`div`,{children:[(0,w.jsx)(`div`,{style:{fontSize:15,fontWeight:700,color:S.ink},children:r?`编辑应用市场`:`添加 1Panel 应用市场`}),(0,w.jsx)(`div`,{style:{fontSize:11.5,color:S.ink4,marginTop:2},children:`直接填写官方或兼容的开源 Git 仓库地址`})]}),(0,w.jsx)(`div`,{style:{flex:1}}),(0,w.jsx)(`button`,{onClick:t,"aria-label":`关闭`,className:`edge-press`,style:{width:40,height:40,border:0,background:`transparent`,color:S.ink3,cursor:`pointer`},children:(0,w.jsx)(D,{name:`x`,size:16})})]}),(0,w.jsxs)(`div`,{style:{padding:20,display:`grid`,gap:13},children:[(0,w.jsxs)(`label`,{style:{display:`grid`,gap:6,fontSize:11.5,color:S.ink2},children:[`名称`,(0,w.jsx)(`input`,{autoFocus:!0,value:i.name,onChange:e=>f(`name`,e.target.value),placeholder:`例如:1Panel 官方商店`,style:h})]}),!r&&(0,w.jsxs)(`label`,{style:{display:`grid`,gap:6,fontSize:11.5,color:S.ink2},children:[`来源 ID(可留空自动生成)`,(0,w.jsx)(`input`,{value:i.id,onChange:e=>f(`id`,e.target.value),placeholder:`onepanel-official`,style:h})]}),(0,w.jsxs)(`label`,{style:{display:`grid`,gap:6,fontSize:11.5,color:S.ink2},children:[`Git 仓库地址`,(0,w.jsx)(`input`,{value:i.url,onChange:e=>f(`url`,e.target.value),spellCheck:!1,style:{...h,fontFamily:S.type?.mono}})]}),(0,w.jsxs)(`div`,{style:{display:`grid`,gridTemplateColumns:`140px 1fr`,gap:10},children:[(0,w.jsxs)(`label`,{style:{display:`grid`,gap:6,fontSize:11.5,color:S.ink2},children:[`格式`,(0,w.jsxs)(`select`,{value:i.kind,onChange:e=>f(`kind`,e.target.value),style:h,children:[(0,w.jsx)(`option`,{value:`auto`,children:`自动识别`}),(0,w.jsx)(`option`,{value:`1panel`,children:`1Panel`})]})]}),(0,w.jsxs)(`label`,{style:{display:`grid`,gap:6,fontSize:11.5,color:S.ink2},children:[`分支 / Tag(留空使用远端默认)`,(0,w.jsx)(`input`,{value:i.ref,onChange:e=>f(`ref`,e.target.value),placeholder:`官方源默认 dev`,style:h})]})]}),(0,w.jsxs)(`label`,{style:{display:`grid`,gap:6,fontSize:11.5,color:S.ink2},children:[`只读 Token(可选,仅写不回显)`,(0,w.jsx)(`input`,{type:`password`,value:i.token,onChange:e=>f(`token`,e.target.value),placeholder:e?.tokenConfigured?`已配置;留空保持不变`:`公开仓库无需填写`,autoComplete:`new-password`,style:h})]}),c&&(0,w.jsxs)(`div`,{style:{padding:`9px 11px`,borderRadius:7,background:`#ecfdf5`,color:`#047857`,fontSize:11.5},children:[(0,w.jsx)(`b`,{children:`连接成功`}),` · 已识别 `,c.kind,`,发现 `,c.appCount,` 个应用`]}),u&&(0,w.jsx)(`div`,{style:{padding:`9px 11px`,borderRadius:7,background:`#fff7ed`,color:`#c2410c`,fontSize:11.5},children:u})]}),(0,w.jsxs)(`div`,{style:{padding:`13px 20px 17px`,display:`flex`,justifyContent:`flex-end`,gap:8,borderTop:`1px solid ${S.borderSoft}`},children:[(0,w.jsx)(`button`,{onClick:p,disabled:!!o||!i.url,className:`edge-press edge-btn-secondary`,style:{...gd,minHeight:40},children:o===`test`?`检测中…`:`测试连接`}),(0,w.jsx)(`button`,{onClick:m,disabled:!!o||!i.url,className:`edge-press edge-btn-primary`,style:{..._d,minHeight:40},children:o===`save`?`保存中…`:`保存来源`})]})]})})}function jp({configs:e,onRefresh:t,onConfigsChanged:n,refreshing:r}){let[i,a]=(0,b.useState)(null),o=Sp(),s={ok:{tone:`green`,label:`正常`},error:{tone:`red`,label:`异常`},syncing:{tone:`amber`,label:`同步中`},unconfigured:{tone:`gray`,label:`未配置`}};return(0,w.jsxs)(`div`,{style:{padding:10,borderRadius:8,background:S.surface,border:`1px solid ${S.borderSoft}`},children:[(0,w.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,gap:6,marginBottom:8},children:[(0,w.jsx)(D,{name:`layers`,size:13,stroke:1.8,style:{color:S.violet}}),(0,w.jsx)(`span`,{style:{fontSize:12,fontWeight:700,color:S.ink},children:`Catalog 数据源`}),(0,w.jsx)(`div`,{style:{flex:1}}),(0,w.jsx)(`button`,{onClick:()=>a({}),title:`添加来源`,"aria-label":`添加应用市场来源`,className:`edge-press edge-btn-secondary`,style:{...gd,minWidth:40,height:32,padding:`0 8px`,fontSize:11},children:(0,w.jsx)(D,{name:`plus`,size:12})}),(0,w.jsxs)(`button`,{onClick:t,disabled:r,className:`edge-press edge-btn-secondary`,style:{...gd,height:32,padding:`0 8px`,fontSize:11},children:[(0,w.jsx)(D,{name:`refresh`,size:11,stroke:2}),r?`刷新中`:`刷新`]})]}),(0,w.jsxs)(`div`,{style:{display:`flex`,flexDirection:`column`,gap:6},children:[(e||[]).map(e=>{let t=s[e.status?.state]||s.unconfigured;return(0,w.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,gap:7,fontSize:11.5},children:[(0,w.jsx)(q,{tone:t.tone,size:7,pulse:e.status?.state===`error`}),(0,w.jsx)(`span`,{title:e.url,style:{color:S.ink2,fontWeight:600,flex:1,overflow:`hidden`,textOverflow:`ellipsis`,whiteSpace:`nowrap`},children:e.name||e.id}),(0,w.jsxs)(`span`,{style:{fontSize:10,color:S.ink4},children:[e.status?.appCount??0,` 个应用`]}),(0,w.jsx)(`span`,{style:{fontSize:10,color:t.tone===`red`?`#dc2626`:S.ink4},children:t.label}),!e.readOnly&&(0,w.jsx)(`button`,{title:`刷新`,"aria-label":`刷新来源 ${e.name||e.id}`,disabled:!e.enabled,onClick:async()=>{try{await Bf(e.id),n(),o.ok(`来源已刷新`)}catch(e){o.err(e.message)}},className:`edge-press`,style:{width:40,height:40,border:0,background:`transparent`,color:S.ink3,cursor:e.enabled?`pointer`:`default`},children:(0,w.jsx)(D,{name:`refresh`,size:12})}),!e.readOnly&&(0,w.jsx)(`button`,{title:`编辑`,"aria-label":`编辑来源 ${e.name||e.id}`,onClick:()=>a(e),className:`edge-press`,style:{width:40,height:40,border:0,background:`transparent`,color:S.ink3,cursor:`pointer`},children:(0,w.jsx)(D,{name:`edit`,size:12})}),!e.readOnly&&(0,w.jsx)(`button`,{title:e.enabled?`停用`:`启用`,"aria-label":`${e.enabled?`停用`:`启用`}来源 ${e.name||e.id}`,onClick:async()=>{try{await Rf(e.id,{enabled:!e.enabled}),n()}catch(e){o.err(e.message)}},className:`edge-press`,style:{width:40,height:40,border:0,background:`transparent`,color:e.enabled?`#16a34a`:S.ink4,cursor:`pointer`},children:(0,w.jsx)(D,{name:e.enabled?`stop`:`play`,size:12})}),!e.readOnly&&(0,w.jsx)(`button`,{title:`删除`,"aria-label":`删除来源 ${e.name||e.id}`,onClick:async()=>{if(window.confirm(`删除来源「${e.name||e.id}」?已安装应用不会被删除。`))try{await zf(e.id),n()}catch(e){o.err(e.message)}},className:`edge-press`,style:{width:40,height:40,border:0,background:`transparent`,color:`#dc2626`,cursor:`pointer`},children:(0,w.jsx)(D,{name:`trash`,size:12})})]},e.id)}),(!e||e.length===0)&&(0,w.jsx)(`div`,{style:{color:S.ink4,fontSize:11,lineHeight:1.5},children:`尚未添加市场来源。可直接添加 1Panel 官方或兼容仓库。`})]}),i&&(0,w.jsx)(Ap,{source:i.id?i:null,onClose:()=>a(null),onSaved:()=>{a(null),n(),o.ok(`应用市场来源已保存`)}})]})}function Mp({onOpenApp:e,authed:t,onRequireAuth:n}){let[r,i]=(0,b.useState)(`all`),[a,o]=(0,b.useState)(`all`),[s,c]=(0,b.useState)(`all`),[l,u]=(0,b.useState)(``),[d,f]=(0,b.useState)(null),[p,m]=(0,b.useState)(!1),h=Sp(),{data:g}=Bd(1e4),{data:_,error:v,refresh:y}=Af(),{data:x,error:C,refresh:T}=Vf(),{data:E,refresh:O}=Nf(),{data:k,refresh:A}=Pf(),j=Array.isArray(_)?_:null,ee=Array.isArray(x)?x:null,M=Array.isArray(E)?E:[],N=(0,b.useMemo)(()=>{let e={};return(g||[]).forEach(t=>{!t.source||(t.runtime||`kubernetes`)!==`compose`||(t.source.kind===`store`&&(e[`store:${t.source.storeId}`]={version:t.source.version||t.version,devboxId:t.id}),t.source.kind===`catalog`&&(e[`catalog:${t.source.catalogId}:${t.source.storeId}`]={version:t.source.version||t.version,devboxId:t.id}))}),e},[g]),P=(0,b.useMemo)(()=>{let e=[];return(j||[]).forEach(t=>{let n=N[`store:${t.id}`],r=n?.version||null,i=r!=null&&t.version!=null&&Qf(r,t.version)<0,{bg:a,icon:o}=Cp(t.id,t.name,t.category);e.push({id:t.id,name:t.name,cat:wp[t.category]||t.category,ver:t.version,desc:t.description||``,iconUrl:t.icon,icon:o,bg:a,provider:t.provider,runtime:t.runtime||`kubernetes`,installable:t.installable===!0,notInstallableReason:t.notInstallableReason||``,origin:`platform`,sourceId:``,sourceName:`平台商店`,installed:r!=null,installedVersion:r,upgradable:i,devboxId:n?.devboxId,pinned:t.pinned,date:``})}),(ee||[]).forEach(t=>{let n=N[`catalog:${t.catalogId}:${t.id}`],r=n?.version||null,i=r!=null&&t.version!=null&&Qf(r,t.version)<0,{bg:a,icon:o}=Cp(t.id,t.name,t.category);e.push({id:t.id,name:t.name,cat:wp[t.category]||t.category,ver:t.version,desc:t.description||``,iconUrl:t.icon,icon:o,bg:a,provider:t.provider,runtime:t.runtime||`compose`,installable:t.installable===!0,notInstallableReason:t.notInstallableReason||``,origin:`catalog`,sourceId:t.catalogId,sourceName:t.catalogName,installed:r!=null,installedVersion:r,upgradable:i,devboxId:n?.devboxId,pinned:t.pinned,date:``})}),e},[j,ee,N]),F=P.length>0?(()=>{let e={};P.forEach(t=>{t.cat&&(e[t.cat]=(e[t.cat]||0)+1)});let t=[{id:`all`,name:`全部`,icon:`apps`,count:P.length}];return Object.entries(e).forEach(([e,n])=>t.push({id:e,name:e,icon:`apps`,count:n})),t})():[{id:`all`,name:`全部`,icon:`apps`,count:0}],I=P.length,te=P.filter(e=>e.installed).length,ne=P.filter(e=>e.upgradable).length,re=P.filter(e=>!(a===`installed`&&!e.installed||a===`upgradable`&&!e.upgradable||s===`platform`&&e.origin!==`platform`||s!==`all`&&s!==`platform`&&e.sourceId!==s||r!==`all`&&e.cat!==r||l&&!e.name.toLowerCase().includes(l.toLowerCase())&&!(e.desc||``).includes(l))),L=!j&&!ee&&M.length===0&&!v&&!C,R=_===null&&x===null;async function z(){if(!t){n?.();return}m(!0);try{await Hf(),O(),A(),T(),y(),h.ok(`已刷新应用清单`)}catch(e){h.err(`刷新失败:${e.message}`)}finally{m(!1)}}if(d)return(0,w.jsx)(Op,{app:d,onBack:()=>f(null),onOpenApp:e});let B=[{id:`all`,label:`全部来源`}];return j&&j.length>0&&B.push({id:`platform`,label:`平台商店`}),M.forEach(e=>B.push({id:e.sourceId,label:e.sourceName||e.sourceId})),(0,w.jsxs)(`div`,{style:{flex:1,display:`flex`,background:S.surfaceAlt,overflow:`hidden`},children:[(0,w.jsxs)(`div`,{style:{width:208,flexShrink:0,padding:`20px 12px`,background:S.surface,borderRight:`1px solid ${S.border}`,overflow:`auto`},children:[(0,w.jsx)(`div`,{style:{fontSize:10.5,fontWeight:600,color:S.ink3,letterSpacing:`0.06em`,textTransform:`uppercase`,padding:`0 8px 6px`},children:`发现`}),(0,w.jsx)(`div`,{style:{fontSize:10.5,color:S.ink4,padding:`0 8px 8px`},children:`应用分类`}),(0,w.jsx)(`div`,{style:{display:`flex`,flexDirection:`column`,gap:1},children:F.map(e=>{let t=r===e.id;return(0,w.jsxs)(`div`,{onClick:()=>i(e.id),role:`button`,tabIndex:0,onKeyDown:t=>{t.key===`Enter`&&i(e.id)},style:{display:`flex`,alignItems:`center`,gap:8,padding:`8px 10px`,borderRadius:7,cursor:`pointer`,background:t?S.blueSoft:`transparent`,color:t?S.blueDeep:S.ink2,fontSize:12.5,fontWeight:t?600:500},children:[(0,w.jsx)(D,{name:Tp[e.id]||e.icon||`apps`,size:14,stroke:1.8}),(0,w.jsx)(`span`,{style:{flex:1},children:e.name}),(0,w.jsx)(`span`,{className:`mono tnum`,style:{fontSize:10.5,color:t?S.blueDeep:S.ink4,background:t?`#dbeafe`:S.surfaceAlt,padding:`0 6px`,borderRadius:999,lineHeight:`17px`},children:e.count})]},e.id)})}),(0,w.jsx)(`div`,{style:{height:1,background:S.borderSoft,margin:`16px 8px`}}),(0,w.jsx)(jp,{configs:Array.isArray(k)&&k.length>0?k:M.map(e=>({id:e.sourceId,name:e.sourceName,kind:e.kind,url:``,enabled:!0,managedBy:`config`,readOnly:!0,status:e.status})),onRefresh:z,onConfigsChanged:()=>{A(),O(),T()},refreshing:p}),M.some(e=>e.status?.state===`error`)&&(0,w.jsx)(`div`,{style:{marginTop:10,padding:`8px 10px`,borderRadius:7,background:`#fffbeb`,border:`1px solid #fde68a`,fontSize:11,color:`#92400e`,lineHeight:1.5},children:`部分 catalog 数据源同步异常,已使用上次缓存的应用清单。`})]}),(0,w.jsxs)(`div`,{style:{flex:1,overflow:`auto`,padding:`20px 24px`},children:[(0,w.jsx)(Zf,{tabs:[{id:`all`,label:`全部`,count:I},{id:`installed`,label:`已安装`,count:te},{id:`upgradable`,label:`可升级`,count:ne}],active:a,onChange:o,style:{gap:4,marginBottom:16,borderBottom:`1px solid ${S.borderSoft}`},itemStyle:{padding:`10px 16px 12px`,fontSize:13,marginBottom:-1},renderLabel:(e,t)=>(0,w.jsxs)(w.Fragment,{children:[e.label,(0,w.jsx)(`span`,{style:{fontSize:11,color:S.ink4,fontWeight:500,padding:`1px 6px`,borderRadius:3,background:t?S.blueSoft:S.surfaceAlt},className:`mono tnum`,children:e.count})]})}),(0,w.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,gap:10,marginBottom:12,flexWrap:`wrap`},children:[(0,w.jsx)(`div`,{style:{fontSize:14,fontWeight:700,color:S.ink},children:F.find(e=>e.id===r)?.name}),(0,w.jsxs)(`div`,{style:{fontSize:11.5,padding:`2px 8px`,borderRadius:999,background:S.surface,border:`1px solid ${S.border}`,color:S.ink3},children:[`共 `,re.length,` 个应用`]}),(0,w.jsx)(`div`,{style:{flex:1}}),B.length>1&&(0,w.jsx)(`div`,{style:{display:`flex`,gap:4},children:B.map(e=>(0,w.jsx)(`button`,{onClick:()=>c(e.id),title:e.label,style:s===e.id?Pp:Np,children:e.label},e.id))}),(0,w.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,gap:8,height:30,padding:`0 10px`,borderRadius:7,background:S.surface,border:`1px solid ${S.border}`,width:200},children:[(0,w.jsx)(D,{name:`search`,size:13,stroke:1.8,style:{color:S.ink4}}),(0,w.jsx)(`input`,{value:l,onChange:e=>u(e.target.value),placeholder:`按名称搜索`,"aria-label":`搜索`,style:{flex:1,border:`none`,outline:`none`,fontSize:12.5,background:`transparent`}})]}),(0,w.jsxs)(`button`,{onClick:z,disabled:p,className:`edge-press edge-btn-secondary`,style:{...gd,height:30},children:[(0,w.jsx)(D,{name:`refresh`,size:13,stroke:1.8}),p?`同步中`:`同步`]})]}),a===`all`&&s!==`platform`&&P.filter(e=>e.pinned).length>0&&(0,w.jsx)(`div`,{style:{display:`grid`,gridTemplateColumns:`1fr 1fr`,gap:12,marginBottom:18},children:P.filter(e=>e.pinned).slice(0,4).map((e,t)=>(0,w.jsxs)(`div`,{style:{padding:`20px 22px`,borderRadius:12,background:e.bg,color:`white`,position:`relative`,overflow:`hidden`,minHeight:140,display:`flex`,flexDirection:`column`,justifyContent:`space-between`,boxShadow:`0 4px 14px -4px rgba(15,23,42,0.18)`},children:[(0,w.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,gap:10},children:[(0,w.jsx)(`div`,{style:{width:36,height:36,borderRadius:9,background:`rgba(255,255,255,0.18)`,display:`flex`,alignItems:`center`,justifyContent:`center`,backdropFilter:`blur(8px)`},children:e.iconUrl?(0,w.jsx)(`img`,{src:e.iconUrl,alt:``,style:{width:20,height:20}}):(0,w.jsx)(D,{name:e.icon,size:20,stroke:1.7})}),(0,w.jsxs)(`div`,{children:[(0,w.jsx)(`div`,{style:{...S.type.heading},children:e.name}),(0,w.jsx)(`div`,{style:{fontSize:11.5,opacity:.85,marginTop:2},children:e.cat||e.origin})]})]}),(0,w.jsx)(`div`,{style:{fontSize:12.5,opacity:.95,lineHeight:1.55,marginBottom:10},children:e.desc}),(0,w.jsx)(`div`,{style:{position:`absolute`,top:-20,right:-20,width:140,height:140,background:`radial-gradient(circle, rgba(255,255,255,0.18), transparent 70%)`,pointerEvents:`none`}})]},t))}),(0,w.jsx)(`div`,{style:{display:`grid`,gridTemplateColumns:`repeat(auto-fill, minmax(290px, 1fr))`,gap:12},children:re.map(t=>(0,w.jsx)(kp,{app:t,onOpen:()=>f(t),onOpenApp:e},(t.origin===`catalog`?`c:`:`p:`)+t.sourceId+`:`+t.id))}),re.length===0&&(0,w.jsx)(`div`,{style:{textAlign:`center`,padding:`60px 20px`,color:S.ink3,fontSize:13},children:R?(0,w.jsxs)(w.Fragment,{children:[(0,w.jsx)(D,{name:`refresh`,size:28,stroke:1.5,style:{color:S.ink4,marginBottom:8}}),(0,w.jsx)(`div`,{children:`正在加载应用商店…`})]}):L?(0,w.jsxs)(w.Fragment,{children:[(0,w.jsx)(D,{name:`store`,size:28,stroke:1.5,style:{color:S.ink4,marginBottom:8}}),(0,w.jsx)(`div`,{children:`未配置应用市场与 Catalog`}),(0,w.jsx)(`div`,{style:{fontSize:11.5,color:S.ink4,marginTop:6},children:`本机未配置平台应用商店或第三方 Catalog 数据源`})]}):v&&!ee?(0,w.jsxs)(w.Fragment,{children:[(0,w.jsx)(D,{name:`cloudOff`,size:28,stroke:1.5,style:{color:S.ink4,marginBottom:8}}),(0,w.jsx)(`div`,{children:`无法访问平台应用商店`}),(0,w.jsx)(`div`,{style:{fontSize:11.5,color:S.ink4,marginTop:6},children:v.message})]}):(0,w.jsxs)(w.Fragment,{children:[(0,w.jsx)(D,{name:a===`upgradable`?`check`:a===`installed`?`apps`:`search`,size:28,stroke:1.5,style:{color:S.ink4,marginBottom:8}}),(0,w.jsx)(`div`,{children:a===`upgradable`?`所有已安装应用都是最新版本`:a===`installed`?`本节点尚未安装任何应用`:`没有匹配的应用`})]})}),(0,w.jsxs)(`div`,{style:{textAlign:`center`,margin:`24px 0 8px`,fontSize:11.5,color:S.ink4,display:`flex`,alignItems:`center`,gap:12,justifyContent:`center`},children:[(0,w.jsx)(`span`,{style:{height:1,width:60,background:S.border}}),`已加载全部`,(0,w.jsx)(`span`,{style:{height:1,width:60,background:S.border}})]})]})]})}var Np={padding:`4px 10px`,fontSize:11.5,borderRadius:999,border:`1px solid ${S.border}`,background:S.surface,color:S.ink2,cursor:`pointer`},Pp={...Np,background:S.blue,color:`#fff`,borderColor:S.blue};function Fp({app:e,onClose:t,onDone:n,trackTask:r=!1}){let i=(e?.runtime||`kubernetes`)===`compose`,[a,o]=(0,b.useState)(!1),[s,c]=(0,b.useState)(null),[l,u]=(0,b.useState)(i),[d,f]=(0,b.useState)(!1),[p,m]=(0,b.useState)(``),[h,g]=(0,b.useState)(null),[_,v]=(0,b.useState)(null),{task:y}=hf(_),x=Sp(),C=(0,b.useRef)(!0),T=(0,b.useRef)(null);(0,b.useEffect)(()=>()=>{C.current=!1},[]),(0,b.useEffect)(()=>{!r||!_||!y||y.status===`succeeded`&&T.current!==_&&(T.current=_,x.ok(`已卸载「${e.name}」`),n?.(_,a))},[r,_,y,e.name,n,a,x]),(0,b.useEffect)(()=>{if(!i)return;let t=!1;return kf(e.id,a).then(e=>{!t&&C.current&&(c(e),u(!1))}).catch(e=>{t||!C.current||(g(e?.message||`无法获取删除预览`),c(null),u(!1))}),()=>{t=!0}},[e.id,a,i]);let E=r&&y&&[`failed`,`canceled`,`superseded`].includes(y.status)?y.message||`卸载任务 ${y.status}`:null,O=d&&!E,k=p.trim()===e.name,A=!O&&(i?a?k:!0:k);async function j(){if(A){T.current=null,v(null),f(!0),g(null);try{let t=await Sf(e.id,i?a:!1),o=t?.taskId||t?.id||null;x.ok(`已提交卸载「${e.name}」`),r&&o?C.current&&v(o):(C.current&&f(!1),n?.(o,a))}catch(e){C.current&&(f(!1),g(e?.message||`卸载失败`))}}}let ee=h||E,M=Array.isArray(s?.willDelete)?s.willDelete:[],N=Array.isArray(s?.willKeep)?s.willKeep:[];return(0,w.jsx)(`div`,{className:`edge-backdrop-in`,onClick:O?void 0:t,style:{position:`fixed`,inset:0,zIndex:250,background:`rgba(15,23,41,0.5)`,display:`flex`,alignItems:`center`,justifyContent:`center`,backdropFilter:`blur(4px)`,WebkitBackdropFilter:`blur(4px)`},children:(0,w.jsxs)(`div`,{onClick:e=>e.stopPropagation(),className:`edge-fade-in`,style:{width:480,maxWidth:`92vw`,maxHeight:`88vh`,overflow:`auto`,background:`white`,borderRadius:12,boxShadow:`0 28px 64px -12px rgba(15,23,42,0.45)`},children:[(0,w.jsxs)(`div`,{style:{padding:`14px 20px`,display:`flex`,alignItems:`center`,gap:10,background:a?`#fef2f2`:`#fff7ed`,borderBottom:`1px solid ${a?`#fecaca`:`#fed7aa`}`},children:[(0,w.jsx)(`div`,{style:{width:30,height:30,borderRadius:8,background:S.red,color:`white`,display:`flex`,alignItems:`center`,justifyContent:`center`,flexShrink:0},children:(0,w.jsx)(D,{name:`trash`,size:15,stroke:2})}),(0,w.jsxs)(`div`,{style:{flex:1,minWidth:0},children:[(0,w.jsx)(`div`,{style:{fontSize:14,fontWeight:700,color:S.ink},children:a?`卸载并删除受管数据`:`卸载应用`}),(0,w.jsx)(`div`,{style:{fontSize:11.5,color:a?`#b91c1c`:`#9a3412`,marginTop:2},children:a?`受管数据将被永久删除 · 此操作不可恢复`:`默认保留受管数据`})]}),!O&&(0,w.jsx)(`button`,{onClick:t,"aria-label":`关闭`,style:{width:28,height:28,borderRadius:7,cursor:`pointer`,border:`none`,background:`transparent`,display:`flex`,alignItems:`center`,justifyContent:`center`,color:S.ink3},children:(0,w.jsx)(D,{name:`x`,size:15,stroke:2})})]}),(0,w.jsxs)(`div`,{style:{padding:`16px 20px 20px`},children:[(0,w.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,gap:12,marginBottom:14},children:[(0,w.jsx)(`div`,{style:{width:44,height:44,borderRadius:11,background:e.bg||S.slate,color:`white`,display:`flex`,alignItems:`center`,justifyContent:`center`,flexShrink:0,boxShadow:`inset 0 1px 0 rgba(255,255,255,0.3)`},children:(0,w.jsx)(D,{name:e.icon||`apps`,size:22,stroke:1.6})}),(0,w.jsxs)(`div`,{style:{minWidth:0},children:[(0,w.jsx)(`div`,{style:{...S.type.heading,color:S.ink},children:e.name}),(0,w.jsxs)(`div`,{style:{fontSize:11.5,color:S.ink3,marginTop:2},className:`mono`,children:[e.version||`—`,` · `,(e.runtime||`kubernetes`)===`compose`?`Docker Compose`:`Kubernetes`]})]})]}),i&&(0,w.jsxs)(w.Fragment,{children:[(0,w.jsxs)(`div`,{style:{padding:12,borderRadius:8,marginBottom:12,background:S.surfaceAlt,border:`1px solid ${S.borderSoft}`},children:[(0,w.jsx)(`div`,{style:{fontSize:12,fontWeight:700,color:S.ink,marginBottom:8},children:a?`将被删除`:`将被删除(仅容器/网络)`}),l?(0,w.jsx)(`div`,{style:{fontSize:11.5,color:S.ink3},children:`正在加载删除预览…`}):M.length>0?(0,w.jsx)(`ul`,{style:{margin:0,paddingLeft:18,fontSize:11.5,color:S.ink2,lineHeight:1.7},children:M.map((e,t)=>(0,w.jsx)(`li`,{className:`mono`,style:{wordBreak:`break-all`},children:e},t))}):(0,w.jsx)(`div`,{style:{fontSize:11.5,color:S.ink3},children:`容器与网络资源`}),(0,w.jsx)(`div`,{style:{fontSize:12,fontWeight:700,color:S.ink,margin:`10px 0 6px`},children:`将被保留(卸载不影响)`}),N.length>0?(0,w.jsx)(`ul`,{style:{margin:0,paddingLeft:18,fontSize:11.5,color:S.ink3,lineHeight:1.7},children:N.map((e,t)=>(0,w.jsx)(`li`,{className:`mono`,style:{wordBreak:`break-all`},children:e},t))}):(0,w.jsx)(`div`,{style:{fontSize:11.5,color:S.ink3},children:`无`}),s?.note&&(0,w.jsx)(`div`,{style:{fontSize:11,color:S.ink4,marginTop:8,lineHeight:1.5},children:s.note})]}),(0,w.jsxs)(`label`,{style:{display:`flex`,alignItems:`flex-start`,gap:10,marginBottom:12,cursor:`pointer`,padding:10,borderRadius:8,background:a?`#fef2f2`:S.surfaceAlt,border:`1px solid ${a?`#fecaca`:S.borderSoft}`},children:[(0,w.jsx)(`input`,{type:`checkbox`,checked:a,disabled:O,onChange:e=>{u(!0),g(null),o(e.target.checked)},style:{marginTop:2,width:15,height:15}}),(0,w.jsxs)(`div`,{children:[(0,w.jsx)(`div`,{style:{fontSize:12.5,fontWeight:600,color:a?`#b91c1c`:S.ink},children:`同时删除受管数据(purge)`}),(0,w.jsxs)(`div`,{style:{fontSize:11,color:S.ink3,marginTop:3,lineHeight:1.5},children:[`删除受管命名卷与受管数据目录。`,(0,w.jsx)(`strong`,{children:`外部卷(external)、宿主挂载(bind)、socket 永远不会被删除。`})]})]})]})]}),!i&&(0,w.jsxs)(`div`,{style:{padding:12,borderRadius:8,marginBottom:12,background:S.surfaceAlt,border:`1px solid ${S.borderSoft}`,fontSize:12,color:S.ink2,lineHeight:1.65},children:[(0,w.jsx)(`strong`,{style:{color:S.ink},children:`将会发生什么`}),(0,w.jsxs)(`ul`,{style:{margin:`6px 0 0`,paddingLeft:20,fontSize:11.5,color:S.ink3},children:[(0,w.jsx)(`li`,{children:`立即终止该 Pod,释放占用的 GPU / 内存 / 端口`}),(0,w.jsx)(`li`,{children:`删除容器与配置`})]})]}),(i?a:!0)&&(0,w.jsxs)(`div`,{style:{marginBottom:12},children:[(0,w.jsxs)(`div`,{style:{fontSize:12,color:S.ink2,marginBottom:6},children:[`请输入应用名称 `,(0,w.jsx)(`span`,{className:`mono`,style:{background:S.surfaceAlt,padding:`1px 6px`,borderRadius:3,color:S.ink,fontWeight:600,border:`1px solid ${S.border}`},children:e.name}),` 确认:`]}),(0,w.jsx)(`input`,{value:p,disabled:O,autoFocus:!0,onChange:e=>m(e.target.value),placeholder:e.name,"aria-label":`输入应用名称以确认`,style:{width:`100%`,height:38,padding:`0 12px`,border:`1px solid ${k?S.red:S.border}`,borderRadius:7,fontSize:13,color:S.ink,background:`white`,outline:`none`,boxShadow:k?`0 0 0 3px ${S.red}22`:`none`,boxSizing:`border-box`},className:`mono`})]}),i&&a&&(0,w.jsxs)(`div`,{style:{padding:`8px 10px`,marginBottom:12,borderRadius:7,background:`#fffbeb`,border:`1px solid #fde68a`,fontSize:11.5,color:`#92400e`,lineHeight:1.5,display:`flex`,gap:8,alignItems:`flex-start`},children:[(0,w.jsx)(D,{name:`alertTri`,size:13,stroke:1.8,style:{color:`#b45309`,marginTop:1,flexShrink:0}}),(0,w.jsx)(`div`,{children:`删除受管数据不可恢复。若该应用持有数据库等内容,删除后无法找回。`})]}),ee&&(0,w.jsx)(`div`,{style:{padding:`8px 10px`,marginBottom:12,borderRadius:7,background:`#fef2f2`,border:`1px solid #fecaca`,fontSize:11.5,color:`#b91c1c`},children:ee}),r&&_&&!ee&&(0,w.jsxs)(`div`,{style:{padding:`8px 10px`,marginBottom:12,borderRadius:7,background:`#eff6ff`,border:`1px solid #bfdbfe`,fontSize:11.5,color:`#1e40af`},children:[`卸载任务 `,y?.status||`queued`,` · `,y?.phase||`queued`,y?.message?` · ${y.message}`:``]}),(0,w.jsxs)(`div`,{style:{display:`flex`,gap:8},children:[(0,w.jsx)(`button`,{onClick:t,disabled:O,style:{flex:1,height:38,borderRadius:8,background:`white`,border:`1px solid ${S.border}`,fontSize:13,fontWeight:500,color:S.ink2,cursor:O?`not-allowed`:`pointer`},children:`取消`}),(0,w.jsxs)(`button`,{onClick:j,disabled:!A,style:{flex:1.4,height:38,borderRadius:8,background:A?S.red:`#fca5a5`,color:`white`,border:`none`,fontSize:13,fontWeight:600,cursor:A?`pointer`:`not-allowed`,display:`flex`,alignItems:`center`,justifyContent:`center`,gap:6,opacity:A?1:.7},children:[(0,w.jsx)(D,{name:`trash`,size:13,stroke:2}),O?`卸载中…`:a?`确认删除数据并卸载`:`我已了解,卸载`]})]})]})]})})}var Ip=[{id:`dashboard`,kind:`system`,name:`仪表盘`,icon:`dashboard`,color:S.blue,bg:`linear-gradient(160deg,#3b82f6,#1d4ed8)`},{id:`monitoring`,kind:`system`,name:`监控`,icon:`sparkle`,color:S.indigo,bg:`linear-gradient(160deg,#6366f1,#4f46e5)`},{id:`ai-activity`,kind:`system`,name:`AI 活动`,icon:`brain`,color:S.violet,bg:`linear-gradient(160deg,#a855f7,#6d28d9)`},{id:`store`,kind:`system`,name:`应用商店`,icon:`store`,color:S.green,bg:`linear-gradient(160deg,#34d399,#059669)`},{id:`compose-manager`,kind:`system`,name:`Compose 应用`,icon:`apps`,color:`#0891b2`,bg:`linear-gradient(160deg,#22d3ee,#0891b2)`},{id:`files`,kind:`system`,name:`文件`,icon:`folder`,color:`#0891b2`,bg:`linear-gradient(160deg,#22d3ee,#0891b2)`},{id:`processes`,kind:`system`,name:`进程`,icon:`cpu`,color:`#475569`,bg:`linear-gradient(160deg,#64748b,#1e293b)`},{id:`supervisor`,kind:`system`,name:`进程守护`,icon:`shield`,color:`#0d9488`,bg:`linear-gradient(160deg,#14b8a6,#0f766e)`},{id:`virtual-machines`,kind:`system`,name:`虚拟机`,icon:`server`,color:`#155e75`,bg:`linear-gradient(160deg,#22d3ee,#155e75)`},{id:`hardware`,kind:`system`,name:`硬件中心`,icon:`cpu`,color:`#7c3aed`,bg:`linear-gradient(160deg,#a855f7,#6d28d9)`},{id:`links`,kind:`system`,name:`服务导航`,icon:`network`,color:`#0369a1`,bg:`linear-gradient(160deg,#38bdf8,#0369a1)`},{id:`disks`,kind:`system`,name:`磁盘`,icon:`hardDrive`,color:`#1e40af`,bg:`linear-gradient(160deg,#3b82f6,#1e3a8a)`},{id:`network-connections`,kind:`system`,name:`网络连接`,icon:`network`,color:`#0e7490`,bg:`linear-gradient(160deg,#06b6d4,#0e7490)`},{id:`alerts`,kind:`system`,name:`告警中心`,icon:`bell`,color:S.amber,bg:`linear-gradient(160deg,#fbbf24,#d97706)`},{id:`audit`,kind:`system`,name:`操作日志`,icon:`shield`,color:`#7c3aed`,bg:`linear-gradient(160deg,#a78bfa,#5b21b6)`},{id:`settings`,kind:`system`,name:`系统设置`,icon:`gear`,color:S.slate,bg:`linear-gradient(160deg,#64748b,#334155)`},{id:`browser`,kind:`system`,name:`浏览器`,icon:`globe`,color:S.blue,bg:`linear-gradient(160deg,#3b82f6,#1d4ed8)`}];function Lp({authed:e,onRequireAuth:t,onOpenStore:n,onOpenApp:r}){let{data:i,refresh:a}=Bd(5e3),{data:o}=mf(),{data:s}=Af(),{data:c}=Vf(),[l,u]=(0,b.useState)(`all`),[d,f]=(0,b.useState)(!1),[p,m]=(0,b.useState)(null),[h,g]=(0,b.useState)(null),[_,v]=(0,b.useState)(null),y=Sp(),{task:x}=hf(p?.id);(0,b.useEffect)(()=>{if(!(!x||!p)&&[`succeeded`,`failed`,`canceled`,`superseded`].includes(x.status)){x.status===`succeeded`?y.ok(`${p.label}完成`):y.err(`${p.label}失败:${x.message||x.status}`);let e=setTimeout(()=>m(null),1500);return a(),()=>clearTimeout(e)}},[x,p,y,a]);let C=o?.compose,T=C&&C.available===!1,E=(0,b.useMemo)(()=>Array.isArray(i)?i:[],[i]),D={all:E.length,compose:E.filter(e=>(e.runtime||`kubernetes`)===`compose`).length,kubernetes:E.filter(e=>(e.runtime||`kubernetes`)===`kubernetes`).length,system:Ip.length},O=(0,b.useMemo)(()=>l===`system`?[]:l===`all`?E:E.filter(e=>(e.runtime||`kubernetes`)===l),[E,l]);function k(n){return(...r)=>{if(!e){t?.();return}return n(...r)}}async function A(e,t,n){try{m({id:(await xf(e,t)).id,label:n,appId:e}),y.ok(`${n}已提交`)}catch(e){y.err(`${n}失败:${e.message}`)}}return(0,w.jsxs)(`div`,{style:{padding:24,height:`100%`,overflow:`auto`,background:S.bg},children:[(0,w.jsx)(Rp,{composeCap:C,filter:l,setFilter:u,counts:D,authed:e,onRequireAuth:t,onCreate:()=>f(!0)}),p&&x&&(0,w.jsx)(zp,{task:x,label:p.label}),T&&(0,w.jsxs)(`div`,{style:om,children:[`Docker Compose 运行时不可用:`,C.reason||``,`。已部署的 Compose 应用仍可观测;K8s 应用与系统工具不受影响。`]}),(0,w.jsxs)(`div`,{style:{display:`grid`,gap:10,marginTop:14},children:[l===`system`&&(0,w.jsx)(`div`,{style:{display:`grid`,gridTemplateColumns:`repeat(auto-fill, minmax(260px, 1fr))`,gap:10},children:Ip.map(e=>(0,w.jsx)(Vp,{app:e,onOpen:()=>r?r(e):null},e.id))}),l!==`system`&&O.length===0&&(0,w.jsx)(Hp,{composeDown:T,hasCap:!!o,onCreate:()=>e?f(!0):t?.()}),l!==`system`&&O.map(n=>n.ownership===`discovered`?(0,w.jsx)(Qp,{app:n,disabled:!!p,onTakeover:()=>e?v(n):t?.()},n.id):(0,w.jsx)(Bp,{app:n,storeApps:s,catalogApps:c,disabled:!!p,onAction:(e,t)=>k(A)(n.id,e,t),onUninstall:()=>g(n),onOpenApp:r},n.id))]}),d&&(0,w.jsx)(qp,{composeCap:C,onClose:()=>f(!1),onOpenStore:()=>{f(!1),n?.()},onDeployed:e=>{f(!1),m({id:e.id,label:`部署`,appId:e.appId}),a()}}),h&&(0,w.jsx)(Fp,{app:h,onClose:()=>g(null),onDone:e=>{g(null),e?m({id:e,label:`卸载`,appId:h.id}):(y.ok(`已卸载`),a())}}),_&&(0,w.jsx)(em,{app:_,onClose:()=>v(null),onDone:e=>{v(null),e&&(y.ok(`已接管,现在可以编辑与部署`),a())}})]})}function Rp({composeCap:e,filter:t,setFilter:n,counts:r,authed:i,onRequireAuth:a,onCreate:o}){let s=[{id:`all`,label:`全部`,count:r.all},{id:`compose`,label:`Docker Compose`,count:r.compose},{id:`kubernetes`,label:`Kubernetes`,count:r.kubernetes},{id:`system`,label:`系统工具`,count:r.system}];return(0,w.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,gap:12,flexWrap:`wrap`},children:[(0,w.jsx)(`div`,{style:{fontSize:20,fontWeight:700,color:S.ink},children:`应用管理`}),(0,w.jsx)(`div`,{style:{fontSize:12,color:S.ink3},children:e?.available?`Compose ${e.version||`可用`}`:e?`Compose 未就绪`:`检测运行时中…`}),(0,w.jsx)(`div`,{style:{flex:1}}),(0,w.jsx)(`div`,{style:{display:`flex`,gap:6,flexWrap:`wrap`},children:s.map(e=>(0,w.jsxs)(`button`,{onClick:()=>n(e.id),title:e.label,style:t===e.id?rm:nm,children:[e.label,(0,w.jsx)(`span`,{className:`mono tnum`,style:{marginLeft:5,opacity:.8},children:e.count})]},e.id))}),(0,w.jsxs)(`button`,{onClick:()=>i?o():a?.(),className:`edge-press`,style:im,children:[(0,w.jsx)(D,{name:`plus`,size:13,stroke:2}),`新建 Compose`]})]})}function zp({task:e,label:t}){let n=e.status===`failed`?`#dc2626`:e.status===`succeeded`?`#16a34a`:`#2563eb`;return(0,w.jsxs)(`div`,{style:{marginTop:12,padding:`10px 14px`,borderRadius:10,background:`#fff`,border:`1px solid ${n}33`},children:[(0,w.jsx)(`span`,{style:{color:n,fontWeight:600},children:t}),(0,w.jsxs)(`span`,{style:{color:S.ink3,marginLeft:8,fontSize:13},children:[e.status,` · `,e.phase||``,` `,e.message?`· ${e.message}`:``]})]})}function Bp({app:e,storeApps:t,catalogApps:n,disabled:r,onAction:i,onUninstall:a,onOpenApp:o}){let s=pp(e),c=(e.runtime||`kubernetes`)===`compose`,l=s===`running`,u=vp(e),d=bp(e,t,n),f=e.observed?.services||[],p=e.observed?.endpoints||[],m=e.lastTask;return(0,w.jsxs)(`div`,{style:tm,children:[(0,w.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,gap:10,flexWrap:`wrap`},children:[(0,w.jsx)(q,{tone:fp[s]||`gray`,size:9,pulse:s===`failed`||s===`degraded`}),(0,w.jsx)(`strong`,{style:{color:S.ink,fontSize:14},children:e.name}),(0,w.jsx)(`span`,{style:hm(c),title:mp(e.runtime),children:c?`Compose`:`K8s`}),(0,w.jsx)(`span`,{style:{fontSize:12,color:S.ink3,fontWeight:600},children:dp[s]||s}),(0,w.jsx)(J,{tone:u.tone,children:u.label}),e.version&&(0,w.jsx)(`span`,{style:{fontSize:11,color:S.ink4},className:`mono`,children:e.version}),(0,w.jsx)(`span`,{style:{flex:1}}),(0,w.jsx)(`span`,{style:{fontSize:11.5,color:S.ink3},children:f.length>0?`${f.length} 服务 · ${e.ready||0}/${e.replicas||f.length} 就绪`:c?`0 服务`:`${e.ready||0}/${e.replicas||0} Pod`})]}),(0,w.jsxs)(`div`,{style:{fontSize:12,color:S.ink3,marginTop:6,display:`flex`,alignItems:`center`,gap:8,flexWrap:`wrap`},children:[(0,w.jsx)(`span`,{className:`mono`,style:{color:S.ink4},children:e.image||`—`}),p.length>0&&p.map((e,t)=>(0,w.jsxs)(`a`,{href:e.url,target:`_blank`,rel:`noreferrer`,title:e.name||e.url,style:{display:`inline-flex`,alignItems:`center`,gap:3,color:S.blue,textDecoration:`none`,fontSize:11.5,padding:`1px 7px`,borderRadius:4,background:S.blueSoft,border:`1px solid #bfdbfe`},children:[(0,w.jsx)(D,{name:`external`,size:10,stroke:2}),e.name||Gp(e.url)]},t)),d.upgradable&&(0,w.jsxs)(`span`,{title:`已装 ${d.installedVersion||`—`} → 可用 ${d.latestVersion}`,style:{fontSize:10.5,padding:`1px 6px`,borderRadius:3,fontWeight:600,background:`#fffbeb`,color:`#b45309`,border:`1px solid #fde68a`},children:[`可升级 → `,d.latestVersion]})]}),m&&(0,w.jsxs)(`div`,{style:{fontSize:11,color:S.ink4,marginTop:5},children:[`最近:`,Wp(m),` · `,m.status||`—`,` · `,lp(m.createdAt||m.finishedAt)]}),(0,w.jsxs)(`div`,{style:{display:`flex`,gap:8,marginTop:10,flexWrap:`wrap`},children:[(0,w.jsx)(Up,{disabled:r||l,onClick:()=>i(`start`,`启动`),title:`启动`,children:`启动`}),(0,w.jsx)(Up,{disabled:r||!l,onClick:()=>i(`stop`,`停止`),title:`停止`,children:`停止`}),(0,w.jsx)(Up,{disabled:r,onClick:()=>i(`restart`,`重启`),title:`重启`,children:`重启`}),c&&(0,w.jsx)(Up,{disabled:r,onClick:()=>i(`redeploy`,`重部署`),title:`重新部署`,children:`重部署`}),(0,w.jsx)(`div`,{style:{flex:1}}),o&&(0,w.jsx)(Up,{onClick:()=>o(e),title:`打开详情`,children:`详情`}),(0,w.jsxs)(`button`,{onClick:a,disabled:r,className:`edge-press edge-btn-danger`,style:{...vd,height:28,padding:`0 10px`,fontSize:12},children:[(0,w.jsx)(D,{name:`trash`,size:11,stroke:2}),`卸载`]})]})]})}function Vp({app:e,onOpen:t}){return(0,w.jsxs)(`button`,{onClick:t,className:`edge-press`,style:{textAlign:`left`,cursor:`pointer`,padding:`12px 14px`,borderRadius:10,background:`#fff`,border:`1px solid ${S.border}`,display:`flex`,alignItems:`center`,gap:10},children:[(0,w.jsx)(`div`,{style:{width:36,height:36,borderRadius:9,background:e.bg,color:`white`,display:`flex`,alignItems:`center`,justifyContent:`center`,flexShrink:0},children:(0,w.jsx)(D,{name:e.icon,size:18,stroke:1.7})}),(0,w.jsxs)(`div`,{style:{minWidth:0,flex:1},children:[(0,w.jsx)(`div`,{style:{fontSize:13,fontWeight:600,color:S.ink},children:e.name}),(0,w.jsx)(`div`,{style:{fontSize:11,color:S.ink3},children:`系统工具 · 本地内置`})]}),(0,w.jsx)(D,{name:`chevRight`,size:14,stroke:2,style:{color:S.ink4}})]})}function Hp({composeDown:e,hasCap:t,onCreate:n}){return(0,w.jsxs)(`div`,{style:sm,children:[(0,w.jsx)(D,{name:`apps`,size:30,stroke:1.5,style:{color:S.ink4,marginBottom:8}}),(0,w.jsx)(`div`,{style:{fontSize:14,fontWeight:600,color:S.ink2},children:`暂无已部署应用`}),(0,w.jsx)(`div`,{style:{fontSize:12,color:S.ink3,marginTop:6,maxWidth:420},children:e?`Docker Compose 运行时不可用,无法新建 Compose 应用;K8s 应用将由云端下发后显示在此。`:`点击右上角「新建 Compose」粘贴或上传一个 compose.yaml,或从应用商店安装。`}),!e&&(0,w.jsxs)(`button`,{onClick:n,className:`edge-press`,style:{...im,marginTop:12},children:[(0,w.jsx)(D,{name:`plus`,size:13,stroke:2}),`新建 Compose`]}),!t&&(0,w.jsx)(`div`,{style:{fontSize:11,color:S.ink4,marginTop:8},children:`正在检测本机运行时能力…`})]})}function Up({children:e,onClick:t,disabled:n,danger:r,title:i}){return(0,w.jsx)(`button`,{onClick:t,disabled:n,title:i,className:`edge-press ${r?`edge-btn-danger`:`edge-btn-secondary`}`,style:r?{...vd,height:28,padding:`0 10px`,fontSize:12}:{...gd,height:28,padding:`0 10px`,fontSize:12},children:e})}function Wp(e){let t={apply:`部署/更新`,operate:`操作`,remove:`卸载`,restore:`回滚`}[e?.type]||e?.type||`操作`;return e?.action?`${t}·${e.action}`:t}function Gp(e){try{return new URL(e).host||e}catch{return e}}var Kp=`services: + web: + image: nginx:1.27 + ports: ["8080:80"] +`;function qp({composeCap:e,onClose:t,onOpenStore:n,onDeployed:r}){let[i,a]=(0,b.useState)(`paste`),[o,s]=(0,b.useState)(``),[c,l]=(0,b.useState)(Kp),[u,d]=(0,b.useState)(``),[f,p]=(0,b.useState)(null),[m,h]=(0,b.useState)(!1),[g,_]=(0,b.useState)(!1),[v,y]=(0,b.useState)(``),[x,C]=(0,b.useState)(``),[T,E]=(0,b.useState)(``),[O,k]=(0,b.useState)(`/data`),[A,j]=(0,b.useState)(``),[ee,M]=(0,b.useState)(``),[N,P]=(0,b.useState)(!0),[F,I]=(0,b.useState)(!1),[te,ne]=(0,b.useState)(null),re=(0,b.useRef)(null),L=Sp(),R=!e||e.available!==!1,z=()=>{p(null),I(!1)},B={dataPath:T,dataTarget:O,cpuLimit:A,memoryLimit:ee,autoStart:N};async function ie(e){let t=e.target.files?.[0];if(t){if(t.size>1*1024*1024){L.err(`文件过大(>1MB),请粘贴或拆分`);return}try{let e=await t.text();l(e),d(t.name),a(`upload`),p(null),I(!1),L.ok(`已读取 ${t.name}(${e.length} 字符)`)}catch(e){L.err(`读取失败:${e.message}`)}finally{re.current&&(re.current.value=``)}}}async function ae(){p(null),I(!1),ne(null),h(!0);try{let e=await yf({compose:c,name:o,parameters:ep(x),secrets:ep(v),settings:B});p(e),e.ok?L.ok(`预检通过`):L.warn(`预检发现阻断 / 错误`)}catch(e){ne(e.message||`预检失败`),L.err(`预检失败:${e.message}`)}finally{h(!1)}}let oe=f?ap(f.risks):{blocked:[],confirmation:[],warning:[]},se=op(oe,F),ce=se.reason===`blocked`,le=se.reason===`confirmation`,ue=!!$f(o),de=R&&ue&&!!f&&se.deployable&&!g;async function fe(){if(de){_(!0),ne(null);try{let e=ep(v),t=await bf({name:o.trim(),source:{kind:`inline`},compose:c,parameters:ep(x),secrets:e,confirmRisky:F,settings:B});L.ok(`已提交部署任务`),r(t)}catch(e){ne(e.message||`部署失败`),L.err(`部署失败:${e.message}`),_(!1)}}}return(0,w.jsx)(`div`,{style:cm,onClick:t,children:(0,w.jsxs)(`div`,{style:lm,onClick:e=>e.stopPropagation(),children:[(0,w.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,gap:8},children:[(0,w.jsx)(D,{name:`plus`,size:16,stroke:2,style:{color:S.blue}}),(0,w.jsx)(`strong`,{style:{fontSize:16,color:S.ink},children:`新建 Compose 应用`}),(0,w.jsx)(`span`,{style:{flex:1}}),(0,w.jsx)(`button`,{onClick:t,"aria-label":`关闭`,style:am,children:(0,w.jsx)(D,{name:`x`,size:15,stroke:2})})]}),(0,w.jsx)(`div`,{style:um,children:`来源`}),(0,w.jsxs)(`div`,{style:{display:`flex`,gap:8,flexWrap:`wrap`},children:[(0,w.jsx)(Jp,{active:i===`paste`,onClick:()=>{a(`paste`),p(null),I(!1)},icon:`edit`,label:`粘贴 YAML`}),(0,w.jsx)(Jp,{active:i===`upload`,onClick:()=>re.current?.click(),icon:`upload`,label:u||`上传 YAML 文件`}),(0,w.jsx)(`input`,{ref:re,type:`file`,accept:`.yaml,.yml,text/yaml,text/plain,application/yaml`,onChange:ie,style:{display:`none`}}),(0,w.jsxs)(`button`,{onClick:n,className:`edge-press edge-btn-secondary`,style:{...gd,height:32,padding:`0 12px`,fontSize:12.5},children:[(0,w.jsx)(D,{name:`store`,size:12,stroke:2}),`从应用商店安装`]})]}),(0,w.jsx)(`label`,{style:um,children:`应用名称(生成 ID:小写 / 数字 / 连字符)`}),(0,w.jsx)(`input`,{value:o,onChange:e=>{s(e.target.value),z()},placeholder:`my-app`,"aria-label":`应用名称`,style:dm}),(0,w.jsx)(`div`,{style:{fontSize:11,color:S.ink4,marginTop:3},children:o?`ID: ${$f(o)||`(需含字母或数字)`}`:`应用名称为必填项,用于生成稳定的应用 ID`}),(0,w.jsxs)(`label`,{style:um,children:[`Compose YAML `,i===`upload`&&u?`· ${u}`:``]}),(0,w.jsx)(`textarea`,{value:c,onChange:e=>{l(e.target.value),a(`paste`),p(null),I(!1)},"aria-label":`Compose YAML`,spellCheck:!1,style:fm,rows:9}),(0,w.jsxs)(`label`,{style:um,children:[`Secret(KEY=VALUE 每行;Compose 中请用 $`,`{`,`KEY`,`}`,` 引用;仅写入 .env,不回传 / 不入 revision)`]}),(0,w.jsx)(`textarea`,{value:v,onChange:e=>{y(e.target.value),z()},spellCheck:!1,style:fm,rows:3,placeholder:`DB_PASSWORD=change-me`}),(0,w.jsx)(`div`,{style:um,children:`配置(应用到第一个 service;复杂多服务配置请直接编辑 YAML)`}),(0,w.jsx)(`label`,{style:{...um,marginTop:6},children:`非敏感环境变量(KEY=VALUE,每行;写入 .env 并记录到 revision)`}),(0,w.jsx)(`textarea`,{value:x,onChange:e=>{C(e.target.value),z()},spellCheck:!1,style:fm,rows:2,placeholder:`HTTP_PORT=8080`}),(0,w.jsxs)(`div`,{style:{display:`grid`,gridTemplateColumns:`1fr 1fr`,gap:8},children:[(0,w.jsxs)(`div`,{children:[(0,w.jsx)(`label`,{style:um,children:`宿主数据路径`}),(0,w.jsx)(`input`,{value:T,onChange:e=>{E(e.target.value),z()},placeholder:`/srv/my-app`,style:dm})]}),(0,w.jsxs)(`div`,{children:[(0,w.jsx)(`label`,{style:um,children:`容器挂载点`}),(0,w.jsx)(`input`,{value:O,onChange:e=>{k(e.target.value),z()},placeholder:`/data`,style:dm})]}),(0,w.jsxs)(`div`,{children:[(0,w.jsx)(`label`,{style:um,children:`CPU 限制`}),(0,w.jsx)(`input`,{value:A,onChange:e=>{j(e.target.value),z()},placeholder:`1.5`,style:dm})]}),(0,w.jsxs)(`div`,{children:[(0,w.jsx)(`label`,{style:um,children:`内存限制`}),(0,w.jsx)(`input`,{value:ee,onChange:e=>{M(e.target.value),z()},placeholder:`512M`,style:dm})]})]}),(0,w.jsxs)(`label`,{style:{display:`flex`,alignItems:`center`,gap:8,marginTop:10,fontSize:12,color:S.ink2,cursor:`pointer`},children:[(0,w.jsx)(`input`,{type:`checkbox`,checked:N,onChange:e=>{P(e.target.checked),z()}}),(0,w.jsx)(`span`,{children:`Docker 启动后自动恢复应用(restart: unless-stopped)`})]}),T&&(0,w.jsx)(`div`,{style:{fontSize:11,color:S.ink4,marginTop:4},children:`绝对宿主路径会在预检中标为 confirmation,需明确确认数据与权限边界。`}),(0,w.jsxs)(`div`,{style:{display:`flex`,gap:8,marginTop:10,alignItems:`center`,flexWrap:`wrap`},children:[(0,w.jsxs)(`button`,{onClick:ae,disabled:m||!R||!c.trim(),className:`edge-press edge-btn-secondary`,style:{...am,opacity:m||!R?.6:1},children:[(0,w.jsx)(D,{name:`check`,size:12,stroke:2}),m?`预检中…`:`预检`]}),(0,w.jsxs)(`button`,{onClick:fe,disabled:!de,className:`edge-press edge-btn-primary`,style:{...im,opacity:de?1:.6},children:[(0,w.jsx)(D,{name:`download`,size:12,stroke:2}),g?`部署中…`:`部署`]}),ce&&(0,w.jsx)(`span`,{style:{color:`#dc2626`,fontSize:12},children:`存在阻断级风险,无法部署`}),!ue&&(0,w.jsx)(`span`,{style:{color:`#dc2626`,fontSize:12},children:`请填写有效的应用名称`}),!R&&(0,w.jsx)(`span`,{style:{color:`#dc2626`,fontSize:12},children:`Compose 运行时不可用`})]}),te&&(0,w.jsx)(`div`,{style:mm,children:te}),f&&(0,w.jsx)(Yp,{result:f,grouped:oe,needConfirm:le,confirmed:F,setConfirmed:I})]})})}function Jp({active:e,onClick:t,icon:n,label:r}){return(0,w.jsxs)(`button`,{onClick:t,className:`edge-press ${e?`edge-btn-primary`:`edge-btn-secondary`}`,style:e?{...im,height:32,padding:`0 12px`,fontSize:12.5}:{...gd,height:32,padding:`0 12px`,fontSize:12.5},children:[(0,w.jsx)(D,{name:n,size:12,stroke:2}),r]})}function Yp({result:e,grouped:t,needConfirm:n,confirmed:r,setConfirmed:i}){let a=(e.services||[]).flatMap(e=>e.ports||[]),o=(e.services||[]).flatMap(e=>e.volumes||[]);return(0,w.jsxs)(`div`,{style:{marginTop:12,fontSize:12.5,color:S.ink2},children:[(0,w.jsxs)(`div`,{style:{display:`flex`,gap:6,flexWrap:`wrap`,marginBottom:8},children:[(0,w.jsx)(Xp,{icon:`apps`,label:`服务`,value:(e.services||[]).length,tone:`blue`}),(0,w.jsx)(Xp,{icon:`download`,label:`镜像`,value:(e.services||[]).length,tone:`gray`}),(0,w.jsx)(Xp,{icon:`port`,label:`端口`,value:a.length,tone:`blue`}),(0,w.jsx)(Xp,{icon:`database`,label:`卷`,value:o.length,tone:`gray`}),(0,w.jsx)(Xp,{icon:`network`,label:`网络`,value:(e.networks||[]).length,tone:`gray`}),(0,w.jsx)(Xp,{icon:`lock`,label:`Secret`,value:(e.secrets||[]).length,tone:`gray`})]}),e.services?.length>0&&(0,w.jsx)(`div`,{style:{...pm,marginBottom:8},children:(e.services||[]).map((e,t)=>(0,w.jsxs)(`div`,{style:{padding:`6px 0`,borderTop:t?`1px solid ${S.borderSoft}`:`none`},children:[(0,w.jsxs)(`div`,{style:{fontWeight:600,color:S.ink},children:[e.name,(0,w.jsx)(`span`,{className:`mono`,style:{fontWeight:400,color:S.ink3,marginLeft:8},children:e.image||`—`})]}),(e.ports?.length||e.volumes?.length)>0&&(0,w.jsxs)(`div`,{style:{fontSize:11,color:S.ink4,marginTop:2},children:[e.ports?.length?`端口 ${e.ports.join(`, `)} `:``,e.volumes?.length?`卷 ${e.volumes.join(`, `)}`:``]})]},t))}),(e.networks?.length>0||e.secrets?.length>0)&&(0,w.jsxs)(`div`,{style:{...pm,marginBottom:8,fontSize:11.5,color:S.ink3},children:[e.networks?.length>0&&(0,w.jsxs)(`div`,{children:[`网络:`,(0,w.jsx)(`span`,{className:`mono`,children:e.networks.join(`, `)})]}),e.secrets?.length>0&&(0,w.jsxs)(`div`,{style:{marginTop:3},children:[`Secret keys:`,(0,w.jsx)(`span`,{className:`mono`,children:e.secrets.join(`, `)}),`(值不回显)`]})]}),(0,w.jsx)(Zp,{tone:`#dc2626`,label:`阻断(禁止部署)`,items:t.blocked}),(0,w.jsx)(Zp,{tone:`#d97706`,label:`需确认`,items:t.confirmation}),(0,w.jsx)(Zp,{tone:`#d97706`,label:`警告`,items:t.warning}),e.ok&&t.blocked.length===0&&t.confirmation.length===0&&t.warning.length===0&&(0,w.jsxs)(`div`,{style:{...pm,color:`#166534`,background:`#f0fdf4`,border:`1px solid #bbf7d0`},children:[(0,w.jsx)(D,{name:`check`,size:12,stroke:2,style:{verticalAlign:`-2px`}}),` 无风险项(safe)— 可部署`]}),e.errors?.length>0&&(0,w.jsxs)(`div`,{style:{color:`#dc2626`,marginTop:6},children:[`错误:`,e.errors.join(`;`)]}),e.warnings?.length>0&&(0,w.jsx)(`div`,{style:{marginTop:6,fontSize:11.5,color:`#92400e`},children:e.warnings.map((e,t)=>(0,w.jsxs)(`div`,{children:[`⚠ `,e]},t))}),n&&(0,w.jsxs)(`label`,{style:{display:`flex`,alignItems:`flex-start`,gap:8,marginTop:10,cursor:`pointer`,padding:10,borderRadius:8,background:`#fffbeb`,border:`1px solid #fde68a`},children:[(0,w.jsx)(`input`,{type:`checkbox`,checked:r,onChange:e=>i(e.target.checked),style:{marginTop:2}}),(0,w.jsx)(`span`,{style:{fontSize:12,color:`#92400e`},children:`我已知晓上述「需确认」级风险(敏感 capability / IPC 共享等),确认以此配置部署。阻断级风险不可 override。`})]})]})}function Xp({icon:e,label:t,value:n,tone:r}){return(0,w.jsxs)(`span`,{style:{display:`inline-flex`,alignItems:`center`,gap:4,fontSize:11,padding:`2px 8px`,borderRadius:999,background:r===`blue`?`#eff6ff`:S.surfaceAlt,color:r===`blue`?`#1d4ed8`:S.ink3,border:`1px solid ${r===`blue`?`#bfdbfe`:S.borderSoft}`},children:[(0,w.jsx)(D,{name:e,size:11,stroke:2}),t,` `,(0,w.jsx)(`strong`,{className:`mono tnum`,style:{color:S.ink},children:n})]})}function Zp({tone:e,label:t,items:n}){return!n||n.length===0?null:(0,w.jsxs)(`div`,{style:{marginTop:6},children:[(0,w.jsxs)(`div`,{style:{fontSize:11.5,fontWeight:700,color:e,marginBottom:3},children:[t,` · `,n.length]}),n.map((t,n)=>(0,w.jsxs)(`div`,{style:{color:e,fontSize:11.5,paddingLeft:10,borderLeft:`2px solid ${e}55`,marginBottom:2},children:[t.service?(0,w.jsxs)(`strong`,{children:[t.service,`:`]}):null,t.message,t.field&&(0,w.jsxs)(`span`,{style:{color:S.ink4},children:[`(`,t.field,`)`]})]},n))]})}function Qp({app:e,disabled:t,onTakeover:n}){let r=pp(e),i=e.discovered||{},a=e.observed?.services||[],o=e.observed?.endpoints||[],s=!!i.takeoverAvailable,c=Array.isArray(i.configFiles)?i.configFiles.length:0;return(0,w.jsxs)(`div`,{style:{...tm,border:`1px dashed ${S.border}`,background:`#fcfcfd`},children:[(0,w.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,gap:10,flexWrap:`wrap`},children:[(0,w.jsxs)(`span`,{style:gm,title:`由 Docker Compose 创建、尚未由 devbox 接管的外部 project`,children:[(0,w.jsx)(D,{name:`eye`,size:11,stroke:2}),`已发现 · 只读`]}),(0,w.jsx)(`strong`,{style:{color:S.ink,fontSize:14},children:e.name}),(0,w.jsx)(`span`,{style:hm(!0),title:mp(`compose`),children:`Compose`}),(0,w.jsx)(`span`,{style:{fontSize:12,color:S.ink3,fontWeight:600},children:dp[r]||r}),(0,w.jsx)(`span`,{style:{flex:1}}),(0,w.jsx)(`span`,{className:`tnum`,style:{fontSize:11.5,color:S.ink3},children:a.length>0?`${a.length} 服务 · ${e.ready||0}/${e.replicas||a.length} 就绪`:`0 服务`})]}),(0,w.jsxs)(`div`,{style:{fontSize:12,color:S.ink3,marginTop:6,display:`flex`,flexDirection:`column`,gap:3},children:[i.workingDir&&(0,w.jsxs)(`div`,{style:_m,title:`工作目录:${i.workingDir}`,children:[(0,w.jsx)(`span`,{style:{color:S.ink4},children:`工作目录`}),(0,w.jsx)(`span`,{className:`mono`,style:vm,children:i.workingDir})]}),c>0&&(0,w.jsxs)(`div`,{style:_m,title:`配置文件(${c}):${(i.configFiles||[]).join(`, `)}`,children:[(0,w.jsx)(`span`,{style:{color:S.ink4},children:`配置文件`}),(0,w.jsxs)(`span`,{className:`mono`,style:vm,children:[c,` 个`]})]}),o.length>0&&(0,w.jsx)(`div`,{style:{display:`flex`,alignItems:`center`,gap:6,flexWrap:`wrap`},children:o.map((e,t)=>(0,w.jsxs)(`a`,{href:e.url,target:`_blank`,rel:`noreferrer`,title:e.name||e.url,style:{display:`inline-flex`,alignItems:`center`,gap:3,color:S.blue,textDecoration:`none`,fontSize:11.5,padding:`1px 7px`,borderRadius:4,background:S.blueSoft,border:`1px solid #bfdbfe`},children:[(0,w.jsx)(D,{name:`external`,size:10,stroke:2}),e.name||Gp(e.url)]},t))})]}),(0,w.jsx)($p,{app:e}),!s&&i.reason&&(0,w.jsxs)(`div`,{style:{fontSize:11.5,color:`#92400e`,marginTop:8,padding:`6px 9px`,background:`#fffbeb`,border:`1px solid #fde68a`,borderRadius:7},children:[`暂不可接管:`,i.reason]}),(0,w.jsxs)(`div`,{style:{fontSize:11,color:S.ink4,marginTop:8},children:[`列表仅显示仍有容器记录的 project;若已 `,(0,w.jsx)(`span`,{className:`mono`,children:`compose down`}),` 且容器记录被删除,则无法自动发现,可改用「新建 Compose」粘贴/上传导入。`]}),(0,w.jsxs)(`div`,{style:{display:`flex`,gap:8,marginTop:10,alignItems:`center`},children:[(0,w.jsxs)(`button`,{onClick:n,disabled:t||!s,className:`edge-press edge-btn-primary`,"aria-label":`接管并编辑 ${e.name}`,style:{...im,minHeight:40,opacity:t||!s?.6:1},children:[(0,w.jsx)(D,{name:`download`,size:13,stroke:2}),`接管并编辑`]}),!s&&(0,w.jsx)(`span`,{style:{fontSize:11.5,color:S.ink4},children:`解决上述问题后即可接管`})]})]})}function $p({app:e}){let{rows:t,total:n,truncated:r}=gp(e);return n===0?(0,w.jsx)(`div`,{style:{fontSize:11.5,color:S.ink4,marginTop:6},children:`0 服务`}):(0,w.jsxs)(`div`,{style:{marginTop:6,display:`flex`,flexDirection:`column`,gap:3},children:[t.map((e,t)=>(0,w.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,gap:8,fontSize:11.5,minWidth:0},children:[(0,w.jsx)(`span`,{style:{color:S.ink2,fontWeight:600,minWidth:0,overflow:`hidden`,textOverflow:`ellipsis`,whiteSpace:`nowrap`,maxWidth:160},title:e.name,children:e.name}),e.state&&(0,w.jsx)(`span`,{className:`tnum`,style:{color:S.ink4},children:e.state}),e.health&&e.health!==`none`&&(0,w.jsx)(`span`,{style:{fontSize:10.5,padding:`0 6px`,borderRadius:999,background:e.health===`healthy`?`#ecfdf5`:e.health===`unhealthy`?`#fef2f2`:`#fffbeb`,color:e.health===`healthy`?`#047857`:e.health===`unhealthy`?`#b91c1c`:`#92400e`,border:`1px solid ${e.health===`healthy`?`#a7f3d0`:e.health===`unhealthy`?`#fecaca`:`#fde68a`}`},children:_p[e.health]||e.health}),e.ports.length>0&&(0,w.jsx)(`span`,{className:`mono tnum`,style:{color:S.ink3,minWidth:0,overflow:`hidden`,textOverflow:`ellipsis`,whiteSpace:`nowrap`},title:e.ports.join(`, `),children:e.ports.join(`, `)})]},t)),r&&(0,w.jsxs)(`div`,{className:`tnum`,style:{fontSize:11,color:S.ink4},children:[`还有 `,n-t.length,` 个服务…`]})]})}function em({app:e,onClose:t,onDone:n}){let[r,i]=(0,b.useState)(!1),[a,o]=(0,b.useState)(null),[s,c]=(0,b.useState)(null),[l,u]=(0,b.useState)(!1),d=(0,b.useRef)(null),f=e.discovered||{},p=s?ap(s):{blocked:[],confirmation:[],warning:[]},m=p.confirmation.length>0&&!l,h=p.blocked.length>0,g=!r&&!h&&!m,_=(0,b.useRef)(!1);(0,b.useEffect)(()=>{_.current=r},[r]);let v=()=>{_.current||t()};(0,b.useEffect)(()=>{let e=document.activeElement;return d.current?.focus(),()=>{if(e&&typeof e.focus==`function`)try{e.focus()}catch{}}},[]);let y=(0,b.useRef)(null);(0,b.useEffect)(()=>{let e=e=>{if(e.key===`Escape`){_.current||t();return}if(e.key!==`Tab`)return;let n=y.current;if(!n)return;let r=n.querySelectorAll(`button:not([disabled]), input:not([disabled]), a[href], [tabindex]:not([tabindex="-1"])`);if(r.length===0)return;let i=r[0],a=r[r.length-1];e.shiftKey&&document.activeElement===i?(e.preventDefault(),a.focus()):!e.shiftKey&&document.activeElement===a&&(e.preventDefault(),i.focus())};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},[t]);async function x(){if(g){i(!0),o(null),c(null);try{await wf(e.id,l,`takeover-${e.id}`),n(!0)}catch(e){c(e.findings||null),o(e.message||`接管失败`),i(!1)}}}return(0,w.jsx)(`div`,{style:cm,onClick:v,children:(0,w.jsxs)(`div`,{ref:y,style:lm,role:`dialog`,"aria-modal":`true`,"aria-label":`接管 Compose project ${e.name}`,onClick:e=>e.stopPropagation(),children:[(0,w.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,gap:8},children:[(0,w.jsx)(D,{name:`download`,size:16,stroke:2,style:{color:S.blue}}),(0,w.jsxs)(`strong`,{style:{fontSize:16,color:S.ink},children:[`接管并编辑「`,e.name,`」`]}),(0,w.jsx)(`span`,{style:{flex:1}}),(0,w.jsx)(`button`,{ref:d,onClick:v,disabled:r,"aria-disabled":r,"aria-label":`关闭接管对话框`,style:am,children:(0,w.jsx)(D,{name:`x`,size:15,stroke:2})})]}),(0,w.jsxs)(`div`,{style:{fontSize:12.5,color:S.ink2,marginTop:12,lineHeight:1.6},children:[`接管会把该外部 Compose project 转为 devbox 受管:`,(0,w.jsxs)(`ul`,{style:{margin:`6px 0 0 18px`,padding:0},children:[(0,w.jsxs)(`li`,{children:[`保留原 project name `,(0,w.jsx)(`span`,{className:`mono`,children:f.project||e.name}),` 原地管理,容器/网络/named volume 不改名(数据不变)。`]}),(0,w.jsx)(`li`,{children:`源目录只读:把归一化后的 compose 写入 devbox 托管副本,不修改你的原始文件。`}),(0,w.jsx)(`li`,{children:`接管后进入编辑 / 版本 / 日志 / 生命周期 / 卸载边界。`})]})]}),f.workingDir&&(0,w.jsxs)(`div`,{style:_m,title:f.workingDir,children:[(0,w.jsx)(`span`,{style:{color:S.ink4,fontSize:12},children:`来源`}),(0,w.jsx)(`span`,{className:`mono`,style:vm,children:f.workingDir})]}),a&&(0,w.jsx)(`div`,{style:mm,children:a}),s&&(0,w.jsxs)(w.Fragment,{children:[(0,w.jsx)(Zp,{tone:`#dc2626`,label:`阻断(不可接管)`,items:p.blocked}),(0,w.jsx)(Zp,{tone:`#d97706`,label:`需确认`,items:p.confirmation}),(0,w.jsx)(Zp,{tone:`#d97706`,label:`警告`,items:p.warning})]}),m&&(0,w.jsxs)(`label`,{style:{display:`flex`,alignItems:`flex-start`,gap:8,marginTop:10,cursor:`pointer`,padding:10,borderRadius:8,background:`#fffbeb`,border:`1px solid #fde68a`},children:[(0,w.jsx)(`input`,{type:`checkbox`,checked:l,onChange:e=>u(e.target.checked),style:{marginTop:2}}),(0,w.jsx)(`span`,{style:{fontSize:12,color:`#92400e`},children:`我已知晓上述「需确认」级风险,确认接管。阻断级风险不可 override。`})]}),(0,w.jsxs)(`div`,{style:{display:`flex`,gap:8,marginTop:14,alignItems:`center`},children:[(0,w.jsxs)(`button`,{onClick:x,disabled:!g,className:`edge-press edge-btn-primary`,"aria-label":`确认接管`,style:{...im,minHeight:40,opacity:g?1:.6},children:[(0,w.jsx)(D,{name:`check`,size:13,stroke:2}),r?`接管中…`:`确认接管`]}),(0,w.jsx)(`button`,{onClick:v,className:`edge-press edge-btn-secondary`,style:{...gd,minHeight:40,padding:`0 14px`},children:`取消`})]})]})})}var tm={padding:`13px 16px`,borderRadius:12,background:`#fff`,border:`1px solid ${S.border}`,boxShadow:`0 1px 2px rgba(15,23,42,0.04)`},nm={padding:`5px 11px`,fontSize:12.5,borderRadius:999,border:`1px solid ${S.border}`,background:`#fff`,color:S.ink2,cursor:`pointer`},rm={...nm,background:S.blue,color:`#fff`,borderColor:S.blue},im={display:`inline-flex`,alignItems:`center`,gap:6,padding:`7px 14px`,fontSize:13,fontWeight:600,borderRadius:8,cursor:`pointer`,border:`1px solid ${S.blueDeep}`,background:S.blue,color:`#fff`},am={display:`inline-flex`,alignItems:`center`,justifyContent:`center`,padding:`6px 10px`,fontSize:12.5,borderRadius:8,cursor:`pointer`,border:`1px solid ${S.border}`,background:`#fff`,color:S.ink2},om={marginTop:12,padding:`10px 14px`,borderRadius:10,background:`#fffbeb`,border:`1px solid #fde68a`,color:`#92400e`,fontSize:13},sm={padding:36,textAlign:`center`,color:S.ink3,fontSize:13,border:`1px dashed ${S.border}`,borderRadius:12,background:`#fff`},cm={position:`fixed`,inset:0,background:`rgba(15,23,42,0.5)`,zIndex:100,display:`flex`,alignItems:`center`,justifyContent:`center`,backdropFilter:`blur(2px)`},lm={width:`min(760px, 94vw)`,maxHeight:`90vh`,overflow:`auto`,background:`#fff`,borderRadius:14,padding:22,boxShadow:`0 12px 40px rgba(15,23,42,0.25)`},um={display:`block`,fontSize:12,fontWeight:600,color:S.ink3,marginTop:12,marginBottom:5},dm={width:`100%`,padding:`8px 10px`,borderRadius:8,border:`1px solid ${S.border}`,fontSize:13,boxSizing:`border-box`},fm={...dm,fontFamily:`ui-monospace, monospace`,resize:`vertical`},pm={padding:`8px 10px`,borderRadius:7,background:S.surfaceAlt,border:`1px solid ${S.borderSoft}`},mm={marginTop:10,padding:`8px 10px`,borderRadius:7,background:`#fef2f2`,border:`1px solid #fecaca`,fontSize:12,color:`#b91c1c`};function hm(e){return{fontSize:11,padding:`2px 8px`,borderRadius:999,fontWeight:600,background:e?`#ecfeff`:`#eef2ff`,color:e?`#0e7490`:`#3730a3`,border:`1px solid ${e?`#a5f3fc`:`#c7d2fe`}`}}var gm={display:`inline-flex`,alignItems:`center`,gap:4,fontSize:11,padding:`2px 9px`,borderRadius:999,fontWeight:700,background:`#fff7ed`,color:`#9a3412`,border:`1px solid #fed7aa`},_m={display:`flex`,alignItems:`center`,gap:8,minWidth:0,fontSize:11.5,marginTop:4},vm={color:S.ink3,minWidth:0,overflow:`hidden`,textOverflow:`ellipsis`,whiteSpace:`nowrap`};function ym({authed:e,onRequireAuth:t}){let[n,r]=(0,b.useState)(`active`),[i,a]=(0,b.useState)(null),[o,s]=(0,b.useState)([]);(0,b.useEffect)(()=>{let e=()=>X(`/api/v1/alerts`).then(e=>e.ok?e.json():null).then(e=>{Array.isArray(e)&&s(e)}).catch(()=>{});e();let t=setInterval(e,3e4);return()=>clearInterval(t)},[]);let c=o.filter(e=>n===`active`?e.state===`active`:n===`history`?e.state===`recovered`:!0),l={critical:{tone:`red`,icon:`alertTri`,label:`紧急`,color:S.red},warning:{tone:`amber`,icon:`alertTri`,label:`警告`,color:S.amber},info:{tone:`blue`,icon:`info`,label:`信息`,color:S.blue},recovered:{tone:`green`,icon:`check`,label:`已恢复`,color:S.green}};return(0,w.jsxs)(`div`,{style:{flex:1,display:`flex`,flexDirection:`column`,background:S.surfaceAlt},children:[(0,w.jsxs)(`div`,{style:{padding:`18px 24px 0`,background:S.surface,borderBottom:`1px solid ${S.border}`},children:[(0,w.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,gap:12,marginBottom:14},children:[(0,w.jsxs)(`div`,{children:[(0,w.jsx)(`div`,{style:{fontSize:17,fontWeight:700,color:S.ink,letterSpacing:`-0.01em`},children:`告警中心`}),(0,w.jsxs)(`div`,{style:{fontSize:11.5,color:S.ink3,marginTop:4},children:[`共 `,o.length,` 条 · `,(0,w.jsxs)(`span`,{style:{color:S.red,fontWeight:600},children:[o.filter(e=>e.state===`active`).length,` 活跃`]}),` · `,o.filter(e=>e.state!==`active`).length,` 已恢复`]})]}),(0,w.jsx)(`div`,{style:{flex:1}}),(0,w.jsxs)(`div`,{style:{display:`flex`,gap:8},children:[(0,w.jsxs)(`button`,{className:`edge-press edge-btn-secondary`,style:gd,children:[(0,w.jsx)(D,{name:`download`,size:13,stroke:1.8}),`导出`]}),(0,w.jsxs)(`button`,{className:`edge-press ${e?`edge-btn-primary`:`edge-btn-secondary`}`,style:e?_d:{...gd,color:S.ink3},onClick:()=>!e&&t(`全部确认告警`),children:[(0,w.jsx)(D,{name:`check`,size:13,stroke:2}),e?`全部确认`:`需验证后确认`]})]})]}),(0,w.jsx)(Zf,{tabs:(()=>{let e=o.filter(e=>e.state===`active`).length,t=o.filter(e=>e.state===`recovered`).length,n=o.length;return[{id:`active`,label:`活跃`,count:e},{id:`history`,label:`已恢复`,count:t},{id:`all`,label:`全部`,count:n}]})(),active:n,onChange:r,style:{gap:4},itemStyle:{padding:`8px 14px 10px`,fontSize:13,marginBottom:-1},renderLabel:e=>(0,w.jsxs)(w.Fragment,{children:[e.label,` `,(0,w.jsxs)(`span`,{style:{color:S.ink4,fontWeight:500},children:[`· `,e.count]})]})})]}),(0,w.jsx)(`div`,{style:{flex:1,overflow:`auto`,padding:24},children:c.length===0?(0,w.jsxs)(`div`,{style:{display:`flex`,flexDirection:`column`,alignItems:`center`,justifyContent:`center`,padding:`60px 20px`,color:S.ink3},children:[(0,w.jsx)(`div`,{style:{width:56,height:56,borderRadius:`50%`,background:`#ecfdf5`,display:`flex`,alignItems:`center`,justifyContent:`center`,color:S.green,marginBottom:16},children:(0,w.jsx)(D,{name:`check`,size:26,stroke:2})}),(0,w.jsx)(`div`,{style:{fontSize:14,fontWeight:600,color:S.ink2},children:n===`active`?`当前无活跃告警`:n===`history`?`暂无已恢复告警`:`暂无告警记录`}),(0,w.jsx)(`div`,{style:{fontSize:12,color:S.ink4,marginTop:6},children:`系统运行正常,alert engine 未触发任何规则`})]}):(0,w.jsx)(`div`,{style:{display:`flex`,flexDirection:`column`,gap:10},children:c.map(n=>{let r=l[n.severity||n.sev],o=i===n.id;return(0,w.jsxs)(`div`,{style:{background:S.surface,borderRadius:10,border:`1px solid ${S.border}`,borderLeft:`3px solid ${r.color}`,overflow:`hidden`},children:[(0,w.jsxs)(`div`,{onClick:()=>a(o?null:n.id),style:{padding:`14px 16px`,display:`flex`,alignItems:`center`,gap:12,cursor:`pointer`},children:[(0,w.jsx)(`div`,{style:{width:30,height:30,borderRadius:8,flexShrink:0,background:`${r.color}15`,color:r.color,display:`flex`,alignItems:`center`,justifyContent:`center`},children:(0,w.jsx)(D,{name:r.icon,size:15,stroke:1.8})}),(0,w.jsxs)(`div`,{style:{minWidth:0,flex:1},children:[(0,w.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,gap:8},children:[(0,w.jsx)(`span`,{style:{fontSize:13.5,fontWeight:600,color:S.ink},children:n.title}),(0,w.jsx)(J,{tone:r.tone,children:r.label}),n.state===`active`&&(0,w.jsxs)(J,{tone:`red`,children:[(0,w.jsx)(q,{tone:`red`,size:6,pulse:!0}),`活跃`]}),n.state===`recovered`&&(0,w.jsx)(J,{tone:`gray`,children:`已恢复`})]}),(0,w.jsxs)(`div`,{style:{fontSize:11.5,color:S.ink3,marginTop:4,display:`flex`,gap:8},children:[(0,w.jsx)(`span`,{className:`mono`,children:n.time}),(0,w.jsx)(`span`,{style:{color:`#cbd5e1`},children:`·`}),(0,w.jsx)(`span`,{children:n.target})]})]}),n.state===`active`&&(0,w.jsxs)(`button`,{onClick:r=>{if(r.stopPropagation(),!e){t(`确认告警 `+n.id);return}X(`/api/v1/alerts/`+n.id+`/ack`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({id:n.id})}).then(()=>{s(e=>e.map(e=>e.id===n.id?{...e,state:`recovered`}:e))}).catch(()=>{})},className:`edge-press ${e?`edge-btn-primary`:`edge-btn-secondary`}`,style:e?_d:gd,children:[(0,w.jsx)(D,{name:`check`,size:13,stroke:2}),e?`确认`:`需验证`]}),(0,w.jsx)(D,{name:`chevDown`,size:14,stroke:2,style:{color:S.ink4,transform:`rotate(${o?180:0}deg)`,transition:`transform 0.2s`}})]}),o&&(0,w.jsxs)(`div`,{className:`edge-fade-in`,style:{padding:`12px 16px 16px`,background:S.surfaceAlt,borderTop:`1px solid ${S.borderSoft}`},children:[(0,w.jsx)(`div`,{style:{fontSize:12.5,color:S.ink2,lineHeight:1.7},children:n.detail}),n.suggest&&(0,w.jsxs)(`div`,{style:{marginTop:12},children:[(0,w.jsx)(`div`,{style:{fontSize:10.5,color:S.ink3,fontWeight:600,letterSpacing:`0.04em`,textTransform:`uppercase`,marginBottom:6},children:`建议操作`}),(0,w.jsx)(`div`,{style:{display:`flex`,flexDirection:`column`,gap:6},children:n.suggest.map((e,t)=>(0,w.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,gap:8,padding:`8px 10px`,background:S.surface,border:`1px solid ${S.borderSoft}`,borderRadius:6,fontSize:12,color:S.ink2},children:[(0,w.jsx)(`span`,{style:{width:18,height:18,borderRadius:`50%`,background:S.blueSoft,color:S.blueDeep,display:`inline-flex`,alignItems:`center`,justifyContent:`center`,fontSize:10.5,fontWeight:700,flexShrink:0},className:`mono`,children:t+1}),(0,w.jsx)(`span`,{style:{flex:1},children:e}),(0,w.jsx)(D,{name:`chevRight`,size:12,stroke:2,style:{color:S.ink4}})]},t))})]})]})]},n.id)})})})]})}var bm=(0,b.createContext)(null),xm=0,Sm=``;function Cm(){return xm===0&&(Sm=document.body.style.overflow,document.body.style.overflow=`hidden`),xm+=1,()=>{xm=Math.max(0,xm-1),xm===0&&(document.body.style.overflow=Sm)}}var wm=[`a[href]`,`button:not([disabled])`,`input:not([disabled])`,`select:not([disabled])`,`textarea:not([disabled])`,`[tabindex]:not([tabindex="-1"])`].join(`,`);function Tm({children:e}){let t=(0,b.useRef)([]),[n,r]=(0,b.useState)(0),i=(0,b.useCallback)(e=>(t.current.push(e),r(t.current.length),()=>{t.current=t.current.filter(t=>t.token!==e.token),r(t.current.length)}),[]),a=(0,b.useCallback)(e=>t.current.at(-1)?.token===e,[]),o=n>0;(0,b.useEffect)(()=>{function e(e){if(e.code!==`Escape`&&e.key!==`Escape`)return;let n=t.current.at(-1);!n?.dismissible||typeof n.onDismiss!=`function`||(e.preventDefault(),e.stopPropagation(),n.onDismiss())}return window.addEventListener(`keydown`,e,!0),()=>window.removeEventListener(`keydown`,e,!0)},[]);let s=(0,b.useMemo)(()=>({register:i,isTop:a,hasLayers:o}),[i,a,o]);return(0,w.jsx)(bm.Provider,{value:s,children:e})}function Em(){let e=(0,b.useContext)(bm);if(!e)throw Error(`useOverlayStack must be used inside OverlayProvider`);return e}function Dm(e){let t=[],n=e;for(;n?.parentElement;){let e=n.parentElement,r=n.previousElementSibling;for(;r;){let e=r,n=e.hasAttribute(`inert`),i=e.getAttribute(`aria-hidden`);e.setAttribute(`inert`,``),e.setAttribute(`aria-hidden`,`true`),t.push(()=>{n||e.removeAttribute(`inert`),i==null?e.removeAttribute(`aria-hidden`):e.setAttribute(`aria-hidden`,i)}),r=e.previousElementSibling}if(e===document.body)break;n=e}return()=>t.reverse().forEach(e=>e())}function Om({id:e,onDismiss:t,layerRef:n,initialFocusRef:r,modal:i=!1,dismissible:a=!0,active:o=!0}){let s=(0,b.useContext)(bm);if(!s)throw Error(`useOverlayLayer must be used inside OverlayProvider`);let{register:c,isTop:l}=s,u=(0,b.useRef)(Symbol(e||`overlay`)),d=(0,b.useRef)(t),f=(0,b.useRef)(null);(0,b.useLayoutEffect)(()=>{d.current=t},[t]),(0,b.useLayoutEffect)(()=>{if(!o)return;let e=u.current,t=c({token:e,dismissible:a,onDismiss:()=>d.current?.()});return()=>{t();let e=f.current;e?.isConnected&&e.focus({preventScroll:!0})}},[o,a,c]),(0,b.useLayoutEffect)(()=>{if(!o)return;let e=n.current;if(!e)return;f.current=document.activeElement instanceof HTMLElement?document.activeElement:null,(r?.current||e.querySelector(`[autofocus], [data-initial-focus]`)||e.querySelector(wm)||e).focus({preventScroll:!0});let t=i?Dm(e):()=>{},a=i?Cm():()=>{};return()=>{t(),a()}},[o,r,n,i]);let p=(0,b.useCallback)(e=>{if(e.code!==`Tab`||!l(u.current))return;let t=n.current;if(!t)return;let r=[...t.querySelectorAll(wm)].filter(e=>!e.hasAttribute(`disabled`)&&e.getAttribute(`aria-hidden`)!==`true`);if(r.length===0){e.preventDefault(),t.focus();return}let i=r[0],a=r.at(-1);e.shiftKey&&(document.activeElement===i||!t.contains(document.activeElement))?(e.preventDefault(),a.focus()):!e.shiftKey&&(document.activeElement===a||!t.contains(document.activeElement))&&(e.preventDefault(),i.focus())},[l,n]),m=(0,b.useCallback)(e=>{e.target!==e.currentTarget||!a||!l(u.current)||t?.()},[a,l,t]);return{isTopLayer:()=>l(u.current),layerProps:{onKeyDown:p},backdropProps:{onClick:m}}}function km(e,t={}){let n=kd(),r={...t.headers||{}};return n&&(r.Authorization=`Bearer `+n),fetch(e,{...t,headers:r})}var Am=[{value:`LOGIN_SUCCESS`,label:`登录成功`,tone:`green`},{value:`LOGIN_FAILED`,label:`登录失败`,tone:`red`},{value:`APP_INSTALL`,label:`应用安装`,tone:`blue`,notImpl:!0},{value:`APP_UNINSTALL`,label:`应用卸载`,tone:`amber`},{value:`APP_START`,label:`应用启动`,tone:`blue`},{value:`APP_STOP`,label:`应用停止`,tone:`slate`},{value:`APP_RESTART`,label:`应用重启`,tone:`blue`},{value:`SHELL_OPEN`,label:`打开 Shell`,tone:`violet`},{value:`SHELL_CLOSE`,label:`关闭 Shell`,tone:`slate`},{value:`FILE_LIST`,label:`浏览文件`,tone:`slate`},{value:`FILE_DOWNLOAD`,label:`下载文件`,tone:`amber`,notImpl:!0},{value:`MEMO_EDIT`,label:`备忘录编辑`,tone:`slate`,notImpl:!0},{value:`SETTING_CHANGE`,label:`系统设置变更`,tone:`slate`,notImpl:!0}],jm={green:`#059669`,red:`#dc2626`,blue:`#2563eb`,amber:`#d97706`,violet:`#7c3aed`,slate:`#475569`},Mm=50;function Nm(){let[e,t]=(0,b.useState)(`24h`),[n,r]=(0,b.useState)([]),[i,a]=(0,b.useState)(``),[o,s]=(0,b.useState)(`all`),[c,l]=(0,b.useState)(0),[u,d]=(0,b.useState)([]),[f,p]=(0,b.useState)(0),[m,h]=(0,b.useState)(!1),[g,_]=(0,b.useState)(``),[v,y]=(0,b.useState)(null),[x,C]=(0,b.useState)(null);(0,b.useEffect)(()=>{let e=!1;function t(){fetch(`/api/v1/cloud/status`).then(e=>e.ok?e.json():{cloudOnline:!1}).then(t=>{e||y(!!t.cloudOnline)}).catch(()=>{e||y(!1)})}t();let n=setInterval(t,3e4);return()=>{e=!0,clearInterval(n)}},[]);let T=(0,b.useMemo)(()=>{let t=new Date,n={"1h":1,"6h":6,"24h":24,"7d":168,"30d":720}[e]??24;return new Date(t.getTime()-n*3600*1e3).toISOString()},[e]),E=(0,b.useMemo)(()=>{let e=new URLSearchParams;return e.set(`limit`,String(Mm)),e.set(`offset`,String(c*Mm)),e.set(`since`,T),i&&e.set(`user`,i),o!==`all`&&e.append(`outcome`,o),n.forEach(t=>e.append(`type`,t)),`/api/v1/audit/events?`+e.toString()},[c,T,i,o,n]);(0,b.useEffect)(()=>{let e=!1,t=null;function n(){h(!0),_(``),km(E).then(async t=>{if(!t.ok){e||_(`查询失败 (${t.status})`);return}let n=await t.json();e||(d(Array.isArray(n.events)?n.events:[]),p(n.total||0))}).catch(t=>{e||_(`网络错误:`+String(t))}).finally(()=>{e||h(!1)})}function r(){t??=(n(),setInterval(n,3e4))}function i(){t!=null&&(clearInterval(t),t=null)}function a(){document.hidden?i():r()}return document.hidden||r(),document.addEventListener(`visibilitychange`,a),()=>{e=!0,i(),document.removeEventListener(`visibilitychange`,a)}},[E]);let O=Math.max(1,Math.ceil(f/Mm)),k=e=>Am.find(t=>t.value===e)||{label:e,tone:`slate`};return(0,w.jsxs)(`div`,{style:{flex:1,display:`flex`,flexDirection:`column`,background:S.surfaceAlt},children:[(0,w.jsxs)(`div`,{style:{padding:`18px 24px 14px`,background:S.surface,borderBottom:`1px solid ${S.border}`},children:[(0,w.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,gap:12,marginBottom:12},children:[(0,w.jsxs)(`div`,{children:[(0,w.jsx)(`div`,{style:{fontSize:17,fontWeight:700,color:S.ink,letterSpacing:`-0.01em`},children:`操作日志`}),(0,w.jsxs)(`div`,{style:{fontSize:11.5,color:S.ink3,marginTop:4},children:[`共 `,f,` 条 · 当前页 `,c+1,`/`,O,v===!1&&(0,w.jsx)(`span`,{style:{color:`#a16207`,marginLeft:8},children:`· 云端聚合不可用(仅本节点)`})]})]}),(0,w.jsx)(`div`,{style:{flex:1}}),m&&(0,w.jsx)(`span`,{style:{fontSize:11,color:S.ink4},children:`加载中…`})]}),(0,w.jsxs)(`div`,{style:{display:`flex`,gap:10,flexWrap:`wrap`,alignItems:`center`},children:[(0,w.jsx)(`div`,{style:{display:`flex`,gap:2,background:S.surfaceAlt,padding:2,borderRadius:8},children:[`1h`,`6h`,`24h`,`7d`,`30d`].map(n=>(0,w.jsx)(`button`,{onClick:()=>{t(n),l(0)},style:{padding:`5px 10px`,fontSize:12,fontWeight:500,border:`none`,background:e===n?S.surface:`transparent`,color:e===n?S.blueDeep:S.ink3,borderRadius:6,cursor:`pointer`,boxShadow:e===n?`0 1px 2px rgba(0,0,0,0.04)`:`none`},children:n},n))}),(0,w.jsx)(`input`,{placeholder:`用户名(模糊)`,value:i,onChange:e=>{a(e.target.value),l(0)},style:{height:30,border:`1px solid ${S.border}`,borderRadius:6,padding:`0 10px`,fontSize:12.5,color:S.ink,outline:`none`,width:160}}),(0,w.jsx)(`div`,{style:{display:`flex`,gap:2,background:S.surfaceAlt,padding:2,borderRadius:8},children:[[`all`,`全部`],[`success`,`成功`],[`failure`,`失败`]].map(([e,t])=>(0,w.jsx)(`button`,{onClick:()=>{s(e),l(0)},style:{padding:`5px 10px`,fontSize:12,fontWeight:500,border:`none`,background:o===e?S.surface:`transparent`,color:o===e?S.blueDeep:S.ink3,borderRadius:6,cursor:`pointer`},children:t},e))}),(0,w.jsx)(Lm,{value:n,onChange:e=>{r(e),l(0)}}),(n.length>0||i||o!==`all`||e!==`24h`)&&(0,w.jsxs)(`button`,{className:`edge-press edge-btn-secondary`,style:{...gd,height:30,padding:`0 10px`},onClick:()=>{r([]),a(``),s(`all`),t(`24h`),l(0)},children:[(0,w.jsx)(D,{name:`x`,size:12,stroke:2}),`重置`]})]})]}),(0,w.jsxs)(`div`,{style:{flex:1,overflow:`auto`,padding:16},children:[g&&(0,w.jsx)(`div`,{style:{padding:12,background:`#fef2f2`,border:`1px solid #fecaca`,borderRadius:8,color:`#dc2626`,fontSize:13,marginBottom:12},children:g}),(0,w.jsx)(`div`,{style:{background:S.surface,borderRadius:10,border:`1px solid ${S.border}`,overflow:`hidden`},children:(0,w.jsxs)(`table`,{style:{width:`100%`,borderCollapse:`collapse`,fontSize:12.5},children:[(0,w.jsx)(`thead`,{children:(0,w.jsxs)(`tr`,{style:{background:S.surfaceAlt,color:S.ink3,fontWeight:600,fontSize:11.5},children:[(0,w.jsx)(`th`,{style:Rm,children:`时间`}),(0,w.jsx)(`th`,{style:Rm,children:`用户`}),(0,w.jsx)(`th`,{style:Rm,children:`事件`}),(0,w.jsx)(`th`,{style:Rm,children:`资源`}),(0,w.jsx)(`th`,{style:Rm,children:`源 IP`}),(0,w.jsx)(`th`,{style:Rm,children:`结果`})]})}),(0,w.jsxs)(`tbody`,{children:[u.length===0&&!m&&(0,w.jsx)(`tr`,{children:(0,w.jsx)(`td`,{colSpan:6,style:{...zm,textAlign:`center`,padding:32,color:S.ink4},children:`没有匹配的事件`})}),u.map(e=>(0,w.jsx)(Pm,{ev:e,meta:k(e.event_type),onClick:()=>C(e)},e.id))]})]})}),O>1&&(0,w.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,justifyContent:`center`,gap:8,marginTop:16},children:[(0,w.jsx)(`button`,{onClick:()=>l(e=>Math.max(0,e-1)),disabled:c===0,style:Bm(c===0),children:`← 上一页`}),(0,w.jsxs)(`span`,{style:{fontSize:12.5,color:S.ink2},children:[`第 `,c+1,` / `,O,` 页`]}),(0,w.jsx)(`button`,{onClick:()=>l(e=>Math.min(O-1,e+1)),disabled:c>=O-1,style:Bm(c>=O-1),children:`下一页 →`})]})]}),x&&(0,w.jsx)(Fm,{ev:x,meta:k(x.event_type),onClose:()=>C(null)})]})}function Pm({ev:e,meta:t,onClick:n}){let r=jm[t.tone]||jm.slate;return(0,w.jsxs)(`tr`,{onClick:n,style:{cursor:`pointer`,borderTop:`1px solid ${S.border}`},children:[(0,w.jsxs)(`td`,{style:zm,children:[(0,w.jsx)(`div`,{style:{fontWeight:500,color:S.ink},children:Vm(e.ts)}),(0,w.jsx)(`div`,{style:{fontSize:10.5,color:S.ink4},title:e.ts,children:Hm(e.ts)})]}),(0,w.jsx)(`td`,{style:zm,children:e.username||`-`}),(0,w.jsx)(`td`,{style:zm,children:(0,w.jsx)(`span`,{style:{padding:`2px 8px`,borderRadius:6,fontSize:11.5,fontWeight:600,background:r+`18`,color:r},children:t.label})}),(0,w.jsx)(`td`,{style:zm,children:e.resource_id?(0,w.jsxs)(`span`,{style:{color:S.ink2,fontFamily:`ui-monospace,SFMono-Regular,Menlo,monospace`,fontSize:11.5},children:[e.resource_kind&&(0,w.jsxs)(`span`,{style:{color:S.ink4},children:[e.resource_kind,`:`]}),e.resource_id]}):(0,w.jsx)(`span`,{style:{color:S.ink4},children:`-`})}),(0,w.jsx)(`td`,{style:zm,children:e.source_ip||`-`}),(0,w.jsx)(`td`,{style:zm,children:e.outcome===`success`?(0,w.jsx)(`span`,{style:{color:`#059669`,fontWeight:600},children:`● 成功`}):(0,w.jsx)(`span`,{style:{color:`#dc2626`,fontWeight:600},children:`● 失败`})})]})}function Fm({ev:e,meta:t,onClose:n}){let r=jm[t.tone]||jm.slate,i=(0,b.useRef)(null),a=(0,b.useRef)(null),{backdropProps:o,layerProps:s}=Om({id:`audit-detail`,onDismiss:n,layerRef:i,initialFocusRef:a});return(0,w.jsxs)(w.Fragment,{children:[(0,w.jsx)(`div`,{...o,style:{position:`absolute`,inset:0,background:`rgba(15,23,42,0.32)`,zIndex:50}}),(0,w.jsxs)(`div`,{ref:i,role:`dialog`,"aria-modal":`true`,"aria-labelledby":`audit-detail-title`,tabIndex:-1,...s,style:{position:`absolute`,top:0,right:0,bottom:0,width:440,zIndex:51,background:S.surface,boxShadow:`-12px 0 32px -4px rgba(0,0,0,0.12)`,display:`flex`,flexDirection:`column`},children:[(0,w.jsxs)(`div`,{style:{padding:`16px 20px`,borderBottom:`1px solid ${S.border}`,display:`flex`,alignItems:`center`,gap:12},children:[(0,w.jsx)(`span`,{id:`audit-detail-title`,style:{padding:`3px 10px`,borderRadius:6,fontSize:12,fontWeight:600,background:r+`18`,color:r},children:t.label}),(0,w.jsxs)(`div`,{style:{flex:1,fontSize:11.5,color:S.ink3},children:[`事件 #`,e.id]}),(0,w.jsx)(`button`,{ref:a,onClick:n,"aria-label":`关闭审计详情`,style:{border:`none`,background:`transparent`,cursor:`pointer`,color:S.ink3,padding:4,display:`flex`},children:(0,w.jsx)(D,{name:`x`,size:16,stroke:2})})]}),(0,w.jsxs)(`div`,{style:{flex:1,overflow:`auto`,padding:20,fontSize:12.5,color:S.ink2},children:[(0,w.jsx)(Im,{label:`时间`,value:Hm(e.ts),mono:!0}),(0,w.jsx)(Im,{label:`UTC`,value:e.ts,mono:!0}),(0,w.jsx)(Im,{label:`用户`,value:e.username||`-`}),(0,w.jsx)(Im,{label:`资源`,value:e.resource_id?`${e.resource_kind||`?`}:${e.resource_id}`:`-`,mono:!0}),(0,w.jsx)(Im,{label:`源 IP`,value:e.source_ip||`-`,mono:!0}),(0,w.jsx)(Im,{label:`结果`,value:e.outcome,valueStyle:{color:e.outcome===`success`?`#059669`:`#dc2626`,fontWeight:600}}),(0,w.jsx)(Im,{label:`User Agent`,value:e.user_agent||`-`,small:!0}),(0,w.jsx)(`div`,{style:{marginTop:16,fontSize:11,fontWeight:600,color:S.ink4},children:`PAYLOAD`}),(0,w.jsx)(`pre`,{style:{margin:`6px 0 0`,padding:12,background:S.surfaceAlt,border:`1px solid ${S.border}`,borderRadius:6,fontSize:11.5,color:S.ink2,overflow:`auto`,maxHeight:280},children:e.payload?JSON.stringify(e.payload,null,2):`(无)`})]})]})]})}function Im({label:e,value:t,mono:n,small:r,valueStyle:i}){return(0,w.jsxs)(`div`,{style:{display:`grid`,gridTemplateColumns:`90px 1fr`,gap:10,padding:`8px 0`,borderBottom:`1px solid ${S.borderSoft}`},children:[(0,w.jsx)(`div`,{style:{color:S.ink4,fontSize:11.5},children:e}),(0,w.jsx)(`div`,{style:{...n&&{fontFamily:`ui-monospace,SFMono-Regular,Menlo,monospace`},...r&&{fontSize:11},wordBreak:`break-all`,...i||{}},children:t})]})}function Lm({value:e,onChange:t}){let[n,r]=(0,b.useState)(!1),i=n=>{e.includes(n)?t(e.filter(e=>e!==n)):t([...e,n])};return(0,w.jsxs)(`div`,{style:{position:`relative`},children:[(0,w.jsxs)(`button`,{onClick:()=>r(e=>!e),style:{height:30,padding:`0 10px`,border:`1px solid ${S.border}`,borderRadius:6,background:S.surface,fontSize:12.5,color:S.ink,cursor:`pointer`,display:`flex`,alignItems:`center`,gap:6},children:[`事件类型`,e.length>0?` (${e.length})`:``,(0,w.jsx)(D,{name:`chevDown`,size:12,stroke:2})]}),(0,w.jsx)(Mc,{children:n&&(0,w.jsxs)(Gu,{origin:`top left`,className:`edge-material-surface`,style:{position:`absolute`,top:34,left:0,zIndex:100,border:`1px solid ${S.border}`,borderRadius:8,boxShadow:`0 8px 32px -4px rgba(0,0,0,0.12)`,minWidth:200,padding:6,maxHeight:320,overflow:`auto`},children:[Am.map(t=>(0,w.jsxs)(`label`,{className:`edge-menu-item`,title:t.notImpl?`NOT_IMPL:当前 sprint 未触发,保留枚举常量`:``,style:{display:`flex`,alignItems:`center`,gap:8,padding:`6px 8px`,cursor:t.notImpl?`not-allowed`:`pointer`,borderRadius:4,fontSize:12.5,opacity:t.notImpl?.42:1},onMouseDown:e=>e.preventDefault(),children:[(0,w.jsx)(`input`,{type:`checkbox`,disabled:t.notImpl,checked:e.includes(t.value),onChange:()=>!t.notImpl&&i(t.value)}),(0,w.jsx)(`span`,{style:{color:S.ink2},children:t.label}),(0,w.jsx)(`span`,{style:{marginLeft:`auto`,fontSize:10,color:S.ink4,fontFamily:`ui-monospace`},children:t.value})]},t.value)),(0,w.jsx)(`div`,{style:{borderTop:`1px solid ${S.border}`,marginTop:4,padding:6,textAlign:`right`},children:(0,w.jsx)(`button`,{onClick:()=>{r(!1)},className:`edge-press edge-btn-secondary`,style:{...gd,height:26,padding:`0 10px`,fontSize:11.5},children:`完成`})})]})})]})}var Rm={padding:`10px 14px`,textAlign:`left`,borderBottom:`1px solid ${S.border}`},zm={padding:`10px 14px`,verticalAlign:`top`},Bm=e=>({padding:`6px 14px`,border:`1px solid ${S.border}`,borderRadius:6,background:e?S.surfaceAlt:S.surface,fontSize:12.5,color:e?S.ink4:S.ink2,cursor:e?`default`:`pointer`});function Vm(e){if(!e)return`-`;let t=new Date(e).getTime();if(isNaN(t))return e;let n=Date.now()-t;return n<6e4?`刚刚`:n<36e5?`${Math.floor(n/6e4)} 分钟前`:n<864e5?`${Math.floor(n/36e5)} 小时前`:`${Math.floor(n/864e5)} 天前`}function Hm(e){if(!e)return``;let t=new Date(e);return isNaN(t.getTime())?e:t.toLocaleString(`zh-CN`,{hour12:!1})}var Um={RUNNING:`#22c55e`,STOPPED:`#94a3b8`,FATAL:`#ef4444`,STARTING:`#f59e0b`,BACKOFF:`#f59e0b`,EXITED:`#94a3b8`,UNKNOWN:`#94a3b8`},Wm=[`ALL`,`RUNNING`,`STOPPED`,`FATAL`],Gm=typeof window<`u`?window.location.hostname:`localhost`;function Km(e,t){if(!e||!t||e<=0)return``;let n=t-e;return n<60?`${n}s`:n<3600?`${Math.floor(n/60)}m`:n<86400?`${Math.floor(n/3600)}h ${Math.floor(n%3600/60)}m`:`${Math.floor(n/86400)}d ${Math.floor(n%86400/3600)}h`}function qm({label:e,count:t,color:n,active:r,onClick:i}){return(0,w.jsxs)(`button`,{onClick:i,style:{display:`inline-flex`,alignItems:`center`,gap:5,padding:`4px 10px`,borderRadius:12,background:r?n+`18`:`white`,border:`1px solid ${r?n:S.border}`,fontSize:12,fontWeight:r?600:400,color:r?n:S.ink2,cursor:`pointer`},children:[e,(0,w.jsx)(`span`,{style:{fontSize:11,fontWeight:700,color:`white`,background:n,borderRadius:8,padding:`1px 6px`,minWidth:18,textAlign:`center`},children:t})]})}function Jm({proc:e,onViewLog:t,onControl:n}){let r=Um[e.statename]||`#94a3b8`,i=e.statename===`RUNNING`,a=e.port?`http://${Gm}:${e.port}`:null,o=i&&a;return(0,w.jsxs)(`div`,{style:{background:`white`,borderRadius:8,border:`1px solid ${S.border}`,padding:`10px 14px`,display:`flex`,alignItems:`center`,gap:10},children:[(0,w.jsx)(`div`,{style:{width:8,height:8,borderRadius:`50%`,background:r,flexShrink:0,boxShadow:i?`0 0 6px ${r}60`:`none`}}),(0,w.jsxs)(`div`,{style:{flex:1,minWidth:0},children:[(0,w.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,gap:6},children:[(0,w.jsx)(`span`,{style:{fontSize:13,fontWeight:600,color:S.ink},children:e.name}),(0,w.jsx)(`span`,{style:{fontSize:10,padding:`1px 6px`,borderRadius:4,background:S.blueSoft,color:S.blueDeep},children:e.group})]}),(0,w.jsxs)(`div`,{style:{fontSize:11,color:S.ink3,marginTop:2,display:`flex`,alignItems:`center`,gap:5,flexWrap:`wrap`},children:[i&&e.pid>0&&(0,w.jsxs)(`span`,{children:[`PID `,e.pid]}),e.port&&(o?(0,w.jsxs)(`a`,{href:a,target:`_blank`,rel:`noreferrer`,onClick:e=>e.stopPropagation(),title:`打开 ${a}`,style:{display:`inline-flex`,alignItems:`center`,gap:2,color:S.blueDeep,fontWeight:600,textDecoration:`none`},children:[`:`,e.port,(0,w.jsx)(D,{name:`external`,size:10,stroke:2})]}):(0,w.jsxs)(`span`,{children:[`:`,e.port]})),i&&(0,w.jsx)(`span`,{children:Km(e.start,e.now)}),!i&&(0,w.jsx)(`span`,{children:e.statename})]}),e.directory&&(0,w.jsxs)(`div`,{title:e.directory,style:{fontSize:10.5,color:S.ink3,marginTop:2,display:`flex`,alignItems:`center`,gap:4,whiteSpace:`nowrap`,overflow:`hidden`,textOverflow:`ellipsis`},children:[(0,w.jsx)(D,{name:`folder`,size:11,stroke:1.6,style:{flexShrink:0,opacity:.7}}),(0,w.jsx)(`span`,{style:{overflow:`hidden`,textOverflow:`ellipsis`},children:e.directory})]})]}),(0,w.jsxs)(`div`,{style:{display:`flex`,gap:4,flexShrink:0},children:[o&&(0,w.jsx)(`a`,{href:a,target:`_blank`,rel:`noreferrer`,title:`打开服务`,style:{...Ym,color:S.blueDeep,textDecoration:`none`},children:(0,w.jsx)(D,{name:`external`,size:13,stroke:1.8})}),(0,w.jsx)(`button`,{onClick:()=>t(e.name),title:`查看日志`,style:Ym,children:(0,w.jsx)(D,{name:`terminal`,size:13,stroke:1.8})}),i?(0,w.jsx)(`button`,{onClick:()=>n(e.name,`restart`),title:`重启`,style:Ym,children:(0,w.jsx)(D,{name:`refresh`,size:13,stroke:1.8})}):(0,w.jsx)(`button`,{onClick:()=>n(e.name,`start`),title:`启动`,style:{...Ym,color:`#22c55e`},children:(0,w.jsx)(D,{name:`play`,size:13,stroke:2})}),i&&(0,w.jsx)(`button`,{onClick:()=>n(e.name,`stop`),title:`停止`,style:{...Ym,color:`#ef4444`},children:(0,w.jsx)(D,{name:`stop`,size:13,stroke:2})})]})]})}var Ym={display:`inline-flex`,alignItems:`center`,justifyContent:`center`,width:28,height:28,borderRadius:6,background:`#f8fafc`,border:`1px solid ${S.border}`,color:S.ink2,cursor:`pointer`};function Xm({name:e,onClose:t}){let[n,r]=(0,b.useState)(``),[i,a]=(0,b.useState)(!0),o=(0,b.useRef)(null);return(0,b.useEffect)(()=>{a(!0),of(e).then(e=>{r(e.log||``),a(!1)}).catch(()=>{r(`Failed to fetch logs`),a(!1)})},[e]),(0,b.useEffect)(()=>{o.current&&(o.current.scrollTop=o.current.scrollHeight)},[n]),(0,w.jsx)(`div`,{style:{position:`fixed`,inset:0,background:`rgba(0,0,0,0.4)`,display:`flex`,alignItems:`center`,justifyContent:`center`,zIndex:1e3},onClick:t,children:(0,w.jsxs)(`div`,{onClick:e=>e.stopPropagation(),style:{width:`80%`,maxWidth:900,height:`70vh`,background:`#1e293b`,borderRadius:12,display:`flex`,flexDirection:`column`,boxShadow:`0 20px 60px rgba(0,0,0,0.3)`},children:[(0,w.jsxs)(`div`,{style:{padding:`10px 16px`,borderBottom:`1px solid #334155`,display:`flex`,alignItems:`center`,justifyContent:`space-between`},children:[(0,w.jsxs)(`span`,{style:{fontSize:13,fontWeight:600,color:`#e2e8f0`},children:[e,` — stdout`]}),(0,w.jsx)(`button`,{onClick:t,style:{background:`none`,border:`none`,color:`#94a3b8`,cursor:`pointer`,fontSize:18,lineHeight:1},children:`×`})]}),(0,w.jsx)(`pre`,{ref:o,style:{flex:1,margin:0,padding:14,overflow:`auto`,fontSize:12,lineHeight:1.6,color:`#cbd5e1`,fontFamily:`ui-monospace, "Cascadia Code", Menlo, monospace`,whiteSpace:`pre-wrap`,wordBreak:`break-all`},children:i?`Loading...`:n||`(empty)`})]})})}function Zm(){let{data:e,loading:t}=Jd(5e3),[n,r]=(0,b.useState)(`ALL`),[i,a]=(0,b.useState)(null),[o,s]=(0,b.useState)(null),c=e?.processes||[],l={ALL:c.length,RUNNING:c.filter(e=>e.statename===`RUNNING`).length,STOPPED:c.filter(e=>e.statename===`STOPPED`||e.statename===`EXITED`).length,FATAL:c.filter(e=>e.statename===`FATAL`).length},u=n===`ALL`?c:c.filter(e=>n===`STOPPED`?e.statename===`STOPPED`||e.statename===`EXITED`:e.statename===n),d={};u.forEach(e=>{d[e.group]||(d[e.group]={order:e.groupOrder,procs:[]}),d[e.group].procs.push(e)});let f=Object.entries(d).sort((e,t)=>e[1].order-t[1].order),p=(0,b.useCallback)(async(e,t)=>{s(e);try{await nf(e,t)}catch(e){console.error(`Control failed:`,e)}s(null)},[]);return(0,w.jsxs)(`div`,{style:{height:`100%`,display:`flex`,flexDirection:`column`,background:`#f8fafc`},children:[(0,w.jsxs)(`div`,{style:{padding:`10px 16px`,borderBottom:`1px solid ${S.borderSoft}`,background:S.surface,display:`flex`,alignItems:`center`,gap:12,flexShrink:0},children:[(0,w.jsx)(D,{name:`gear`,size:16,stroke:1.8,style:{color:S.ink2}}),(0,w.jsx)(`span`,{style:{fontSize:13,fontWeight:600,color:S.ink},children:`Supervisor`}),e?.hostname&&(0,w.jsxs)(`span`,{style:{fontSize:11.5,color:S.ink3},children:[e.hostname,` · `,e.ip]}),(0,w.jsx)(`div`,{style:{flex:1}}),(0,w.jsx)(`div`,{style:{display:`flex`,gap:6},children:Wm.map(e=>(0,w.jsx)(qm,{label:e,count:l[e],color:e===`RUNNING`?`#22c55e`:e===`STOPPED`?`#94a3b8`:e===`FATAL`?`#ef4444`:S.blueDeep,active:n===e,onClick:()=>r(e)},e))})]}),(0,w.jsx)(`div`,{style:{flex:1,overflow:`auto`,padding:16},children:t&&c.length===0?(0,w.jsx)(`div`,{style:{textAlign:`center`,padding:40,color:S.ink3,fontSize:13},children:`Loading...`}):f.length===0?(0,w.jsx)(`div`,{style:{textAlign:`center`,padding:40,color:S.ink3,fontSize:13},children:n===`ALL`?`没有找到 Supervisor 进程`:`没有 ${n} 状态的进程`}):f.map(([e,{procs:t}])=>(0,w.jsxs)(`div`,{style:{marginBottom:20},children:[(0,w.jsxs)(`div`,{style:{fontSize:12,fontWeight:600,color:S.ink2,marginBottom:8,paddingLeft:2},children:[e,(0,w.jsxs)(`span`,{style:{fontWeight:400,color:S.ink3,marginLeft:6},children:[`(`,t.length,`)`]})]}),(0,w.jsx)(`div`,{style:{display:`flex`,flexDirection:`column`,gap:6},children:t.map(e=>(0,w.jsx)(Jm,{proc:e,onViewLog:a,onControl:p},e.name))})]},e))}),i&&(0,w.jsx)(Xm,{name:i,onClose:()=>a(null)})]})}var Qm={running:{bg:`#dcfce7`,fg:`#047857`,dot:`#22c55e`},"shut off":{bg:`#f1f5f9`,fg:`#475569`,dot:`#94a3b8`},paused:{bg:`#fef3c7`,fg:`#a16207`,dot:`#f59e0b`},crashed:{bg:`#fee2e2`,fg:`#991b1b`,dot:`#ef4444`},unknown:{bg:`#f1f5f9`,fg:`#64748b`,dot:`#94a3b8`}};function $m(e){return Qm[(e||``).toLowerCase()]||Qm.unknown}function eh(e){let t=Number(e)||0;return t>=1024**4?`${(t/1024**4).toFixed(1)} TB`:t>=1024**3?`${(t/1024**3).toFixed(1)} GB`:t>=1024**2?`${(t/1024**2).toFixed(1)} MB`:t>=1024?`${(t/1024).toFixed(0)} KB`:`${t} B`}function th(e){return eh((Number(e)||0)*1024)}function nh(e,t){return t?Math.max(0,Math.min(100,Math.round(e/t*100))):0}function rh({state:e}){let t=$m(e);return(0,w.jsxs)(`span`,{style:{display:`inline-flex`,alignItems:`center`,gap:6,height:24,padding:`0 9px`,borderRadius:12,background:t.bg,color:t.fg,fontSize:11.5,fontWeight:700},children:[(0,w.jsx)(`span`,{style:{width:7,height:7,borderRadius:`50%`,background:t.dot}}),e||`unknown`]})}function ih({label:e,value:t,sub:n}){return(0,w.jsxs)(`div`,{style:{minHeight:76,padding:12,border:`1px solid ${S.border}`,borderRadius:8,background:S.surface},children:[(0,w.jsx)(`div`,{style:{fontSize:11,color:S.ink3,marginBottom:7},children:e}),(0,w.jsx)(`div`,{className:`tnum`,style:{fontSize:20,lineHeight:1,fontWeight:750,color:S.ink},children:t}),n&&(0,w.jsx)(`div`,{style:{fontSize:11,color:S.ink3,marginTop:7},children:n})]})}function ah({icon:e,label:t,tone:n=`neutral`,disabled:r,onClick:i}){let a=n===`danger`?`#dc2626`:n===`ok`?`#047857`:S.ink2,o=n===`danger`?`#fecaca`:n===`ok`?`#bbf7d0`:S.border,s=n===`danger`?`#fff7f7`:n===`ok`?`#f0fdf4`:S.surface;return(0,w.jsxs)(`button`,{disabled:r,onClick:i,title:t,style:{height:32,padding:`0 11px`,borderRadius:7,display:`inline-flex`,alignItems:`center`,gap:7,background:r?`#f8fafc`:s,border:`1px solid ${r?S.borderSoft:o}`,color:r?S.ink4:a,fontSize:12,fontWeight:650,cursor:r?`not-allowed`:`pointer`},children:[(0,w.jsx)(D,{name:e,size:13,stroke:2}),t]})}function oh({label:e,children:t,hint:n}){return(0,w.jsxs)(`label`,{style:{display:`flex`,flexDirection:`column`,gap:6,minWidth:0},children:[(0,w.jsx)(`span`,{style:{fontSize:11.5,color:S.ink3,fontWeight:650},children:e}),t,n&&(0,w.jsx)(`span`,{style:{fontSize:10.5,color:S.ink4},children:n})]})}var sh={height:34,borderRadius:7,border:`1px solid ${S.border}`,background:S.surface,color:S.ink,padding:`0 10px`,fontSize:12.5,outline:`none`,minWidth:0};function ch({vm:e,active:t,onClick:n}){let r=nh(e.memory?.usedKiB||e.memory?.actualKiB||0,e.memory?.maxKiB||0),i=(e.disks?.length||0)+(e.filesystems?.length||0);return(0,w.jsxs)(`button`,{onClick:n,style:{width:`100%`,padding:12,borderRadius:8,textAlign:`left`,border:`1px solid ${t?`#bfdbfe`:S.border}`,background:t?S.blueSoft:S.surface,cursor:`pointer`,display:`grid`,gridTemplateColumns:`1fr auto`,gap:8},children:[(0,w.jsxs)(`div`,{style:{minWidth:0},children:[(0,w.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,gap:8,minWidth:0},children:[(0,w.jsx)(D,{name:`server`,size:15,stroke:1.8,style:{color:t?S.blueDeep:S.ink2,flexShrink:0}}),(0,w.jsx)(`span`,{style:{fontSize:13,fontWeight:750,color:S.ink,whiteSpace:`nowrap`,overflow:`hidden`,textOverflow:`ellipsis`},children:e.name})]}),(0,w.jsxs)(`div`,{style:{fontSize:11,color:S.ink3,marginTop:6},children:[e.vcpus||0,` vCPU · `,th(e.memory?.maxKiB),` · `,i,` 设备`]}),(0,w.jsx)(`div`,{style:{marginTop:8,height:5,borderRadius:3,background:`#e2e8f0`,overflow:`hidden`},children:(0,w.jsx)(`div`,{style:{width:`${r}%`,height:`100%`,background:t?S.blue:`#64748b`}})})]}),(0,w.jsx)(rh,{state:e.state})]})}function lh(e,t){let n=e?.target||``;return(t||[]).find(e=>e.source===n||e.target===n)?.target||n||`-`}function uh({disks:e}){let t=(e||[]).filter(e=>e.device!==`cdrom`);return t.length?(0,w.jsxs)(`table`,{style:{width:`100%`,borderCollapse:`collapse`},children:[(0,w.jsx)(`thead`,{children:(0,w.jsx)(`tr`,{style:{background:`#f8fafc`},children:[`目标`,`容量`,`已分配`,`读写`,`路径`].map(e=>(0,w.jsx)(`th`,{style:{padding:`8px 10px`,textAlign:e===`路径`?`left`:`right`,fontSize:10.5,color:S.ink3,fontWeight:700,borderBottom:`1px solid ${S.borderSoft}`},children:e},e))})}),(0,w.jsx)(`tbody`,{children:t.map(e=>(0,w.jsxs)(`tr`,{style:{borderTop:`1px solid ${S.borderSoft}`},children:[(0,w.jsx)(`td`,{style:{padding:`9px 10px`,fontSize:12,fontWeight:700,color:S.ink},children:e.target}),(0,w.jsx)(`td`,{className:`tnum`,style:fh,children:eh(e.capacityBytes)}),(0,w.jsx)(`td`,{className:`tnum`,style:fh,children:eh(e.physicalBytes||e.allocationBytes)}),(0,w.jsxs)(`td`,{className:`tnum`,style:fh,children:[eh(e.readBytes),` / `,eh(e.writeBytes)]}),(0,w.jsx)(`td`,{title:e.source,style:{padding:`9px 10px`,fontSize:11.5,color:S.ink2,fontFamily:`ui-monospace, monospace`,maxWidth:360,whiteSpace:`nowrap`,overflow:`hidden`,textOverflow:`ellipsis`},children:e.source||`-`})]},e.target))})]}):(0,w.jsx)(`div`,{style:{padding:14,color:S.ink3,fontSize:12},children:`暂无块设备`})}function dh({filesystems:e,mounts:t}){let n=e||[];return n.length?(0,w.jsxs)(`table`,{style:{width:`100%`,borderCollapse:`collapse`},children:[(0,w.jsx)(`thead`,{children:(0,w.jsx)(`tr`,{style:{background:`#f8fafc`},children:[`类型`,`Host 路径`,`Guest 挂载点`,`模式`].map(e=>(0,w.jsx)(`th`,{style:{padding:`8px 10px`,textAlign:e===`Host 路径`?`left`:`right`,fontSize:10.5,color:S.ink3,fontWeight:700,borderBottom:`1px solid ${S.borderSoft}`},children:e},e))})}),(0,w.jsx)(`tbody`,{children:n.map(e=>{let n=lh(e,t);return(0,w.jsxs)(`tr`,{style:{borderTop:`1px solid ${S.borderSoft}`},children:[(0,w.jsx)(`td`,{style:{padding:`9px 10px`,fontSize:12,fontWeight:700,color:S.ink,textAlign:`right`},children:e.driver||e.type||`-`}),(0,w.jsx)(`td`,{title:e.source,style:{padding:`9px 10px`,fontSize:11.5,color:S.ink2,fontFamily:`ui-monospace, monospace`,maxWidth:520,whiteSpace:`nowrap`,overflow:`hidden`,textOverflow:`ellipsis`},children:e.source||`-`}),(0,w.jsx)(`td`,{title:n,style:{padding:`9px 10px`,fontSize:11.5,color:S.ink2,textAlign:`right`,fontFamily:`ui-monospace, monospace`,whiteSpace:`nowrap`},children:n}),(0,w.jsx)(`td`,{style:fh,children:e.accessMode||`-`})]},`${e.source}-${e.target}`)})})]}):(0,w.jsx)(`div`,{style:{padding:14,color:S.ink3,fontSize:12},children:`暂无共享挂载`})}var fh={padding:`9px 10px`,textAlign:`right`,fontSize:12,color:S.ink2,fontFamily:`ui-monospace, monospace`,whiteSpace:`nowrap`};function ph(){let{data:e,loading:t,error:n,refresh:r}=Yd(5e3),[i,a]=(0,b.useState)(``),[o,s]=(0,b.useState)(``),[c,l]=(0,b.useState)(``),[u,d]=(0,b.useState)({vcpus:``,memoryMiB:``,autostart:!1}),f=Array.isArray(e)?e:[];(0,b.useEffect)(()=>{!i&&f.length&&a(f[0].name),i&&f.length&&!f.some(e=>e.name===i)&&a(f[0].name)},[i,f]);let p=(0,b.useMemo)(()=>f.find(e=>e.name===i)||f[0]||null,[f,i]);(0,b.useEffect)(()=>{p&&d({vcpus:String(p.vcpus||``),memoryMiB:String(Math.round((p.memory?.maxKiB||0)/1024)),autostart:!!p.autostart})},[p?.name,p?.vcpus,p?.memory?.maxKiB,p?.autostart]);let m=f.filter(e=>(e.state||``).toLowerCase()===`running`).length,h=f.filter(e=>(e.state||``).toLowerCase()===`shut off`).length,g=p?.guest?.memory,_=g?g.usedBytes:(p?.memory?.usedKiB||p?.memory?.actualKiB||0)*1024,v=g?g.totalBytes:(p?.memory?.maxKiB||0)*1024,y=g?g.availableBytes:(p?.memory?.usableKiB||p?.memory?.availableKiB||0)*1024,x=p?.guest?.loadAverage||[],C=p?.interfaces?.map(e=>e.address).filter(Boolean)||[],T=(p?.state||``).toLowerCase()===`running`,E=(p?.state||``).toLowerCase()===`shut off`,O=async e=>{if(!(!p||o)){s(e),l(``);try{await rf(p.name,e),l(`${p.name}: ${e} 已提交`),r()}catch(e){l(e.message||`操作失败`)}finally{s(``)}}},k=async()=>{if(!p||o)return;let e=Number(u.vcpus),t=Number(u.memoryMiB);if(!Number.isInteger(e)||e<1||e>128){l(`vCPU 必须是 1 到 128 的整数`);return}if(!Number.isInteger(t)||t<512){l(`内存必须是不小于 512 的 MiB 整数`);return}s(`config`),l(``);try{await af(p.name,{vcpus:e,memoryMiB:t,autostart:!!u.autostart}),l(T?`配置已保存;运行中 VM 需要重启后完全生效`:`配置已保存`),r()}catch(e){l(e.message||`保存配置失败`)}finally{s(``)}};return(0,w.jsxs)(`div`,{style:{flex:1,width:`100%`,minWidth:0,height:`100%`,display:`flex`,flexDirection:`column`,background:S.surfaceAlt,overflow:`hidden`},children:[(0,w.jsxs)(`div`,{style:{height:62,padding:`0 18px`,borderBottom:`1px solid ${S.border}`,background:S.surface,display:`flex`,alignItems:`center`,gap:14,flexShrink:0},children:[(0,w.jsx)(D,{name:`server`,size:18,stroke:1.8,style:{color:S.ink2}}),(0,w.jsxs)(`div`,{children:[(0,w.jsx)(`div`,{style:{fontSize:16,fontWeight:780,color:S.ink},children:`虚拟机管理`}),(0,w.jsxs)(`div`,{style:{fontSize:11.5,color:S.ink3,marginTop:2},children:[`libvirt 本机实例 · `,m,` 运行 · `,h,` 关机`]})]}),(0,w.jsx)(`div`,{style:{flex:1}}),c&&(0,w.jsx)(`div`,{style:{fontSize:12,color:c.includes(`失败`)||c.includes(`error`)?`#dc2626`:S.ink3},children:c}),(0,w.jsx)(ah,{icon:`refresh`,label:`刷新`,disabled:t,onClick:r})]}),(0,w.jsxs)(`div`,{style:{flex:1,minHeight:0,width:`100%`,minWidth:0,display:`grid`,gridTemplateColumns:`320px minmax(0, 1fr)`},children:[(0,w.jsxs)(`aside`,{style:{borderRight:`1px solid ${S.border}`,background:`#f8fafc`,padding:14,overflow:`auto`},children:[t&&!f.length&&(0,w.jsx)(`div`,{style:{padding:20,color:S.ink3,fontSize:12},children:`加载虚拟机...`}),n&&!f.length&&(0,w.jsx)(`div`,{style:{padding:20,color:`#dc2626`,fontSize:12},children:`无法读取虚拟机列表`}),!t&&!f.length&&(0,w.jsx)(`div`,{style:{padding:20,color:S.ink3,fontSize:12},children:`没有发现 libvirt 虚拟机`}),(0,w.jsx)(`div`,{style:{display:`flex`,flexDirection:`column`,gap:8},children:f.map(e=>(0,w.jsx)(ch,{vm:e,active:p?.name===e.name,onClick:()=>a(e.name)},e.name))})]}),(0,w.jsx)(`main`,{style:{minWidth:0,overflow:`auto`,padding:18},children:p?(0,w.jsxs)(`div`,{style:{display:`flex`,flexDirection:`column`,gap:14},children:[(0,w.jsxs)(`section`,{style:{border:`1px solid ${S.border}`,borderRadius:8,background:S.surface,padding:16,display:`grid`,gridTemplateColumns:`1fr auto`,gap:16},children:[(0,w.jsxs)(`div`,{style:{minWidth:0},children:[(0,w.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,gap:10},children:[(0,w.jsx)(`h2`,{style:{margin:0,fontSize:20,color:S.ink,letterSpacing:0},children:p.name}),(0,w.jsx)(rh,{state:p.state})]}),(0,w.jsxs)(`div`,{style:{marginTop:8,fontSize:12,color:S.ink3,display:`flex`,gap:14,flexWrap:`wrap`},children:[(0,w.jsxs)(`span`,{children:[`UUID `,(0,w.jsx)(`span`,{className:`mono`,children:p.uuid||`-`})]}),(0,w.jsxs)(`span`,{children:[p.vcpus||0,` vCPU`]}),(0,w.jsxs)(`span`,{children:[`Autostart `,p.autostart?`enable`:`disable`]}),C.length>0&&(0,w.jsxs)(`span`,{children:[`IP `,C.join(`, `)]})]})]}),(0,w.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,gap:8,flexWrap:`wrap`,justifyContent:`flex-end`},children:[E&&(0,w.jsx)(ah,{icon:`play`,label:`启动`,tone:`ok`,disabled:!!o,onClick:()=>O(`start`)}),T&&(0,w.jsx)(ah,{icon:`refresh`,label:`重启`,disabled:!!o,onClick:()=>O(`reboot`)}),T&&(0,w.jsx)(ah,{icon:`power`,label:`关机`,disabled:!!o,onClick:()=>O(`shutdown`)}),T&&(0,w.jsx)(ah,{icon:`stop`,label:`强制断电`,tone:`danger`,disabled:!!o,onClick:()=>O(`destroy`)})]})]}),(0,w.jsxs)(`section`,{style:{display:`grid`,gridTemplateColumns:`repeat(4, minmax(140px, 1fr))`,gap:10},children:[(0,w.jsx)(ih,{label:`CPU 时间`,value:`${Math.round(p.cpuTimeSec||0)}s`,sub:`${p.vcpus||0} 个 vCPU`}),(0,w.jsx)(ih,{label:`内存`,value:`${nh(_,v)}%`,sub:`${eh(_)} / ${eh(v)}`}),(0,w.jsx)(ih,{label:`可用内存`,value:eh(y),sub:p.guest?.agentOK?`guest agent`:`libvirt balloon`}),(0,w.jsx)(ih,{label:`Load`,value:x.length?x.map(e=>e.toFixed(2)).join(` / `):`-`,sub:p.guest?.agentOK?`1 / 5 / 15 min`:`guest agent 不可用`})]}),(0,w.jsxs)(`section`,{style:{border:`1px solid ${S.border}`,borderRadius:8,background:S.surface,padding:14,display:`flex`,flexDirection:`column`,gap:12},children:[(0,w.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,gap:8},children:[(0,w.jsx)(D,{name:`gear`,size:15,stroke:1.8,style:{color:S.ink2}}),(0,w.jsx)(`span`,{style:{fontSize:13,fontWeight:720,color:S.ink},children:`持久配置`}),(0,w.jsx)(`span`,{style:{fontSize:11.5,color:S.ink3},children:`写入 libvirt 配置`})]}),(0,w.jsxs)(`div`,{style:{display:`grid`,gridTemplateColumns:`repeat(auto-fit, minmax(150px, 1fr))`,gap:10,alignItems:`end`},children:[(0,w.jsx)(oh,{label:`vCPU`,children:(0,w.jsx)(`input`,{type:`number`,min:`1`,max:`128`,step:`1`,value:u.vcpus,onChange:e=>d(t=>({...t,vcpus:e.target.value})),style:{...sh,width:`100%`}})}),(0,w.jsx)(oh,{label:`内存`,children:(0,w.jsxs)(`div`,{style:{position:`relative`},children:[(0,w.jsx)(`input`,{type:`number`,min:`512`,step:`512`,value:u.memoryMiB,onChange:e=>d(t=>({...t,memoryMiB:e.target.value})),style:{...sh,width:`100%`,paddingRight:42}}),(0,w.jsx)(`span`,{style:{position:`absolute`,right:10,top:`50%`,transform:`translateY(-50%)`,fontSize:11.5,color:S.ink3,pointerEvents:`none`},children:`MiB`})]})}),(0,w.jsx)(oh,{label:`开机自启`,children:(0,w.jsxs)(`button`,{onClick:()=>d(e=>({...e,autostart:!e.autostart})),style:{height:34,width:`100%`,borderRadius:7,border:`1px solid ${u.autostart?`#bbf7d0`:S.border}`,background:u.autostart?`#f0fdf4`:S.surface,color:u.autostart?`#047857`:S.ink2,display:`inline-flex`,alignItems:`center`,justifyContent:`center`,gap:7,fontSize:12.5,fontWeight:700,cursor:`pointer`},children:[(0,w.jsx)(D,{name:u.autostart?`check`:`minus`,size:13,stroke:2}),u.autostart?`已启用`:`未启用`]})}),(0,w.jsx)(ah,{icon:`check`,label:o===`config`?`保存中`:`保存配置`,tone:`ok`,disabled:!!o,onClick:k})]}),T&&(0,w.jsxs)(`div`,{style:{paddingTop:2,fontSize:11.5,color:S.ink3,display:`flex`,alignItems:`center`,gap:6,flexWrap:`wrap`},children:[(0,w.jsx)(D,{name:`info`,size:12,stroke:1.8,style:{color:S.ink4}}),(0,w.jsx)(`span`,{children:`运行中 VM 的 vCPU/内存变更需重启后完整生效;开机自启立即生效。`})]})]}),(0,w.jsxs)(`section`,{style:{border:`1px solid ${S.border}`,borderRadius:8,background:S.surface,overflow:`hidden`},children:[(0,w.jsxs)(`div`,{style:{height:42,padding:`0 14px`,display:`flex`,alignItems:`center`,borderBottom:`1px solid ${S.borderSoft}`,gap:8},children:[(0,w.jsx)(D,{name:`hardDrive`,size:15,stroke:1.8,style:{color:S.ink2}}),(0,w.jsx)(`span`,{style:{fontSize:13,fontWeight:720,color:S.ink},children:`块设备`})]}),(0,w.jsx)(uh,{disks:p.disks})]}),(0,w.jsxs)(`section`,{style:{border:`1px solid ${S.border}`,borderRadius:8,background:S.surface,overflow:`hidden`},children:[(0,w.jsxs)(`div`,{style:{height:42,padding:`0 14px`,display:`flex`,alignItems:`center`,borderBottom:`1px solid ${S.borderSoft}`,gap:8},children:[(0,w.jsx)(D,{name:`folder`,size:15,stroke:1.8,style:{color:S.ink2}}),(0,w.jsx)(`span`,{style:{fontSize:13,fontWeight:720,color:S.ink},children:`共享挂载`})]}),(0,w.jsx)(dh,{filesystems:p.filesystems,mounts:p.guest?.mounts})]}),(0,w.jsxs)(`section`,{style:{display:`grid`,gridTemplateColumns:`1fr 1fr`,gap:12},children:[(0,w.jsxs)(`div`,{style:{border:`1px solid ${S.border}`,borderRadius:8,background:S.surface,padding:14},children:[(0,w.jsx)(`div`,{style:{fontSize:13,fontWeight:720,color:S.ink,marginBottom:10},children:`网络`}),(p.interfaces||[]).length?p.interfaces.map(e=>(0,w.jsxs)(`div`,{style:{display:`grid`,gridTemplateColumns:`90px 1fr`,gap:8,padding:`7px 0`,borderTop:`1px solid ${S.borderSoft}`,fontSize:12,color:S.ink2},children:[(0,w.jsx)(`span`,{style:{fontWeight:700,color:S.ink},children:e.name}),(0,w.jsx)(`span`,{className:`mono`,children:e.address})]},`${e.name}-${e.address}`)):(0,w.jsx)(`div`,{style:{fontSize:12,color:S.ink3},children:`暂无租约地址`})]}),(0,w.jsxs)(`div`,{style:{border:`1px solid ${S.border}`,borderRadius:8,background:S.surface,padding:14},children:[(0,w.jsx)(`div`,{style:{fontSize:13,fontWeight:720,color:S.ink,marginBottom:10},children:`Memory Pressure`}),(p.guest?.memoryPressure||[]).length?p.guest.memoryPressure.map(e=>(0,w.jsxs)(`div`,{style:{display:`grid`,gridTemplateColumns:`70px repeat(3, 1fr)`,gap:8,padding:`7px 0`,borderTop:`1px solid ${S.borderSoft}`,fontSize:12,color:S.ink2},children:[(0,w.jsx)(`span`,{style:{fontWeight:700,color:S.ink},children:e.kind}),(0,w.jsxs)(`span`,{className:`tnum`,children:[`10s `,e.avg10.toFixed(2)]}),(0,w.jsxs)(`span`,{className:`tnum`,children:[`60s `,e.avg60.toFixed(2)]}),(0,w.jsxs)(`span`,{className:`tnum`,children:[`300s `,e.avg300.toFixed(2)]})]},e.kind)):(0,w.jsx)(`div`,{style:{fontSize:12,color:S.ink3},children:`guest agent 未返回压力数据`})]})]})]}):(0,w.jsx)(`div`,{style:{color:S.ink3,fontSize:13},children:`请选择虚拟机`})})]})]})}function mh(e,t,n){return e?n&&e>=n-5?`#dc2626`:t&&e>=t-5?`#b45309`:e>=70?`#f59e0b`:`#059669`:S.ink3}function hh({tempC:e,maxC:t,critC:n,w:r=220}){let i=n||t||100,a=Math.max(0,Math.min(100,e/i*100)),o=mh(e,t,n),s=t?t/i*100:null;return(0,w.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,gap:8},children:[(0,w.jsxs)(`div`,{style:{width:r,height:8,borderRadius:4,background:`#e2e8f0`,position:`relative`,overflow:`hidden`},children:[(0,w.jsx)(`div`,{style:{position:`absolute`,left:0,top:0,bottom:0,width:`${a}%`,background:o,transition:`width 400ms ease`}}),s!=null&&s<100&&(0,w.jsx)(`div`,{style:{position:`absolute`,top:0,bottom:0,left:`${s}%`,width:2,background:`#94a3b8`}})]}),(0,w.jsxs)(`div`,{style:{minWidth:60,fontSize:12,fontWeight:700,color:o,fontFamily:`"JetBrains Mono", ui-monospace, monospace`},children:[e?.toFixed(0),` °C`]})]})}function gh({label:e,value:t,unit:n,color:r=S.ink}){return(0,w.jsxs)(`div`,{children:[(0,w.jsx)(`div`,{style:{...S.type.caption,color:S.ink3,marginBottom:2},children:e}),(0,w.jsxs)(`div`,{className:`tnum`,style:{...S.type.title,fontWeight:700,color:r,fontFamily:`"JetBrains Mono", ui-monospace, monospace`,lineHeight:1.1},children:[t,n&&(0,w.jsx)(`span`,{style:{fontSize:11,marginLeft:4,color:S.ink3,fontWeight:500},children:n})]})]})}var _h={fontFamily:`"JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, monospace`};function vh(e){return e?e>=1024**4?(e/1024**4).toFixed(2)+` TiB`:e>=1024**3?(e/1024**3).toFixed(2)+` GiB`:e>=1024**2?(e/1024**2).toFixed(2)+` MiB`:e>=1024?(e/1024).toFixed(2)+` KiB`:e+` B`:`—`}function yh(e){if(!e)return`—`;let t=Math.floor(e/86400),n=Math.floor(e%86400/3600),r=Math.floor(e%3600/60),i=[];return t&&i.push(`${t} 天`),n&&i.push(`${n} 小时`),i.push(`${r} 分`),i.join(` `)}function bh(e){return e?{"2.5GT/s":`Gen1`,"5GT/s":`Gen2`,"8GT/s":`Gen3`,"16GT/s":`Gen4`,"32GT/s":`Gen5`,"64GT/s":`Gen6`}[e]||e:``}function xh(e){let t=e.classCode;return t===`0300`||t===`0302`||t===`0301`||t===`0380`?{kind:`gpu`,label:`显卡`,color:`#7c3aed`}:t===`0106`||t===`0101`||t===`0108`?{kind:`storage`,label:`存储`,color:`#0891b2`}:t===`0200`||t===`0280`?{kind:`net`,label:`网络`,color:`#0e7490`}:t===`0403`||t===`0401`?{kind:`audio`,label:`音频`,color:`#0d9488`}:t===`0c03`||t===`0c05`?{kind:`usb`,label:`USB`,color:`#64748b`}:t===`0604`||t===`0600`?{kind:`bridge`,label:`桥/根`,color:`#94a3b8`}:{kind:`other`,label:e.class||`其它`,color:`#94a3b8`}}function Sh(e){try{navigator.clipboard.writeText(e)}catch{}}var Ch={ok:{label:``,color:S.ink,bg:`transparent`,marker:``},empty:{label:`空槽`,color:`#94a3b8`,bg:`transparent`,marker:`·`},idle:{label:`省电`,color:`#94a3b8`,bg:`#f8fafc`,marker:`⚡`},downgrade:{label:`降级`,color:`#b45309`,bg:`#fef3c7`,marker:`⚠`}};function wh(e){return Ch[e]||Ch.ok}function Th(){let{data:e,loading:t}=Xd();return t&&!e?(0,w.jsx)(`div`,{style:{padding:40,color:S.ink3},children:`正在采集硬件清单…`}):e?(0,w.jsxs)(`div`,{style:{flex:1,width:`100%`,display:`flex`,flexDirection:`column`,height:`100%`,background:S.canvas||`#f8fafc`},children:[(0,w.jsx)(Eh,{data:e}),(0,w.jsx)(`div`,{style:{flex:1,overflow:`hidden`},children:(0,w.jsx)(Dh,{data:e})})]}):(0,w.jsx)(`div`,{style:{padding:40,color:S.ink3},children:`硬件采集失败。`})}function Eh({data:e}){return(0,w.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,gap:10,padding:`10px 20px`,borderBottom:`1px solid ${S.border}`,background:`white`,flexShrink:0},children:[(0,w.jsx)(`div`,{style:{...S.type.heading,color:S.ink},children:`硬件中心`}),(0,w.jsxs)(`div`,{style:{color:S.ink3,fontSize:12},children:[`· `,e.os?.hostname,` · 采集于 `,new Date(e.collectedAt).toLocaleTimeString()]})]})}function Dh({data:e}){let t=[{id:`overview`,name:`概览`,icon:`dashboard`},{id:`sensors`,name:`传感器`,icon:`bell`},{id:`gpu`,name:`显卡`,icon:`sparkle`},{id:`cpu`,name:`CPU`,icon:`cpu`},{id:`memory`,name:`内存`,icon:`cpu`},{id:`storage`,name:`存储`,icon:`hardDrive`},{id:`network`,name:`网络`,icon:`network`},{id:`pcie`,name:`PCIe`,icon:`cpu`},{id:`system`,name:`BIOS/主板`,icon:`gear`}],[n,r]=(0,b.useState)(`overview`);return(0,w.jsxs)(`div`,{style:{display:`flex`,height:`100%`,width:`100%`},children:[(0,w.jsx)(`aside`,{style:{width:180,flexShrink:0,borderRight:`1px solid ${S.border}`,background:`white`,overflow:`auto`,padding:`10px 0`},children:t.map(e=>(0,w.jsxs)(`button`,{onClick:()=>r(e.id),style:{display:`flex`,alignItems:`center`,gap:8,width:`100%`,padding:`9px 16px`,border:`none`,background:n===e.id?S.blueSoft:`transparent`,color:n===e.id?S.blueDeep:S.ink2,fontSize:13,fontWeight:n===e.id?600:500,cursor:`pointer`,textAlign:`left`,borderLeft:`3px solid ${n===e.id?S.blueDeep:`transparent`}`},children:[(0,w.jsx)(D,{name:e.icon,size:15}),e.name]},e.id))}),(0,w.jsxs)(`main`,{style:{flex:1,minWidth:0,overflow:`auto`,padding:20},children:[n===`overview`&&(0,w.jsx)(Ah,{data:e}),n===`sensors`&&(0,w.jsx)(Hh,{data:e}),n===`gpu`&&(0,w.jsx)(Fh,{data:e}),n===`cpu`&&(0,w.jsx)(Lh,{data:e}),n===`memory`&&(0,w.jsx)(Rh,{data:e}),n===`storage`&&(0,w.jsx)(zh,{data:e}),n===`network`&&(0,w.jsx)(Bh,{data:e}),n===`pcie`&&(0,w.jsx)(Vh,{data:e}),n===`system`&&(0,w.jsx)(Uh,{data:e})]})]})}function Oh({title:e,cmd:t,children:n,action:r}){return(0,w.jsxs)(`div`,{style:{background:`white`,border:`1px solid ${S.border}`,borderRadius:10,marginBottom:16},children:[(0,w.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,gap:10,padding:`10px 14px`,borderBottom:`1px solid ${S.borderSoft||`#f1f5f9`}`},children:[(0,w.jsx)(`div`,{style:{fontSize:13.5,fontWeight:700,color:S.ink},children:e}),t&&(0,w.jsxs)(`button`,{onClick:()=>Sh(t),style:{padding:`2px 8px`,fontSize:10.5,borderRadius:4,background:`#f1f5f9`,color:S.ink3,border:`1px solid ${S.border}`,cursor:`pointer`,..._h},children:[`复制 `,t]}),(0,w.jsx)(`div`,{style:{flex:1}}),r]}),(0,w.jsx)(`div`,{style:{padding:14},children:n})]})}function Q({k:e,v:t,warn:n,mono:r=!0}){return(0,w.jsxs)(`div`,{style:{display:`flex`,gap:16,padding:`5px 0`,borderBottom:`1px dashed ${S.borderSoft||`#f1f5f9`}`,alignItems:`baseline`},children:[(0,w.jsx)(`div`,{style:{width:150,color:S.ink3,fontSize:12.5,flexShrink:0},children:e}),(0,w.jsxs)(`div`,{style:{flex:1,fontSize:12.5,color:n?`#b45309`:S.ink,fontWeight:n?600:400,wordBreak:`break-word`,...r?_h:{}},children:[n&&(0,w.jsx)(`span`,{style:{marginRight:6},children:`⚠`}),t!=null&&t!==``?t:(0,w.jsx)(`span`,{style:{color:S.ink3},children:`—`})]})]})}function kh(){let{data:e}=Zd();if(!e)return null;let t=e.cpu||{},n=(e.gpus||[])[0];return(0,w.jsx)(Oh,{title:`当前状态`,action:(0,w.jsx)(`span`,{style:{fontSize:11,color:S.ink3},children:`每 3 秒刷新`}),children:(0,w.jsxs)(`div`,{style:{display:`grid`,gridTemplateColumns:`repeat(3, 1fr)`,gap:20},children:[(0,w.jsxs)(`div`,{children:[(0,w.jsx)(`div`,{style:{fontSize:11,color:S.ink3,marginBottom:6},children:`CPU 包温度`}),(0,w.jsx)(hh,{tempC:t.packageTempC,maxC:t.maxTempC,critC:t.critTempC,w:180})]}),(0,w.jsx)(gh,{label:`CPU 包功耗 (RAPL)`,value:t.powerAvailable?t.packagePowerW.toFixed(1):`—`,unit:t.powerAvailable?`W`:``,color:S.blueDeep}),n&&(0,w.jsxs)(`div`,{children:[(0,w.jsxs)(`div`,{style:{fontSize:11,color:S.ink3,marginBottom:6},children:[`GPU 温度 · `,n.hwmon]}),(0,w.jsx)(hh,{tempC:n.tempC,maxC:n.maxTempC,critC:n.critTempC,w:180})]})]})})}function Ah({data:e}){let t=(e.memory.dimms||[]).filter(e=>e.populated),n=(e.network||[]).filter(e=>!e.isVirtual),r=e.storage||[],i=e.gpus||[],a=e.pcie||[],o=a.filter(e=>e.linkStatus===`downgrade`),s=a.filter(e=>e.linkStatus===`idle`),c=a.filter(e=>e.linkStatus===`empty`),l=i.filter(e=>e.driver===`nouveau`),u=o.length>0||l.length>0;return(0,w.jsxs)(`div`,{children:[(0,w.jsxs)(Oh,{title:`系统身份`,children:[(0,w.jsx)(Q,{k:`主机名`,v:e.os.hostname}),(0,w.jsx)(Q,{k:`发行版`,v:e.os.distro}),(0,w.jsx)(Q,{k:`内核 / 架构`,v:`${e.os.kernel} · ${e.os.arch}`}),(0,w.jsx)(Q,{k:`运行时长`,v:yh(e.os.uptimeSeconds),mono:!1})]}),(0,w.jsxs)(Oh,{title:`硬件摘要`,children:[(0,w.jsx)(Q,{k:`主板`,v:e.board.available?`${e.board.manufacturer} ${e.board.product}`:`—`}),(0,w.jsx)(Q,{k:`BIOS`,v:e.bios.available?`${e.bios.vendor} · ${e.bios.version} · ${e.bios.date}`:`—`}),(0,w.jsx)(Q,{k:`CPU`,v:`${e.cpu.model||`—`} · ${e.cpu.cores||`?`} 核 / ${e.cpu.threads||`?`} 线程`}),(0,w.jsx)(Q,{k:`内存`,v:`${vh(e.memory.totalBytes)} · ${t.length} / ${e.memory.dimms?.length||`?`} DIMM 已插`}),(0,w.jsx)(Q,{k:`GPU`,v:i.length?i.map(e=>e.model).join(` · `):`未检测到独立显卡`}),(0,w.jsx)(Q,{k:`存储`,v:`${r.length} 块磁盘 · 合计 ${vh(r.reduce((e,t)=>e+(t.sizeBytes||0),0))}`}),(0,w.jsx)(Q,{k:`物理网卡`,v:`${n.length} 个 · 虚拟接口 ${(e.network||[]).length-n.length} 个`}),(0,w.jsx)(Q,{k:`PCIe`,v:`${a.length} 个设备 · 空槽 ${c.length} · 省电空闲 ${s.length} · 真降级 ${o.length}`,mono:!1})]}),(0,w.jsx)(kh,{}),u&&(0,w.jsxs)(Oh,{title:`⚠ 检查异常`,children:[l.map(e=>(0,w.jsx)(Q,{k:`GPU 驱动`,warn:!0,mono:!1,v:`${e.pciAddress} 使用 nouveau 开源驱动 (无 CUDA),AI 场景应改用 NVIDIA 官方驱动`},e.pciAddress)),o.map(e=>(0,w.jsx)(Q,{k:`PCIe 真降级`,warn:!0,mono:!1,v:`${e.address} ${e.device} · 能力 ${bh(e.linkGenCap)} ${e.linkWidCap},当前 ${bh(e.linkGenCur)} ${e.linkWidCur}`},e.address))]}),!u&&(0,w.jsxs)(Oh,{title:`检查结果`,children:[(0,w.jsx)(`div`,{style:{color:`#059669`,fontWeight:600,fontSize:13},children:`无异常。`}),s.length>0&&(0,w.jsxs)(`div`,{style:{color:S.ink3,fontSize:12,marginTop:6},children:[`有 `,s.length,` 个设备处于 PCIe ASPM 省电空闲,实际使用时会自动升速,非故障。`]})]})]})}function jh(e){return e.fanKnown?e.source===`nvidia-smi`?{value:e.fanPct??0,unit:`%`}:{value:e.fanRpm??0,unit:`RPM`}:{value:`—`,unit:``}}function Mh(){let{data:e}=Zd(),t=e?.gpus||[];return t.length?(0,w.jsx)(Oh,{title:`当前状态`,cmd:t[0].source===`nvidia-smi`?`nvidia-smi -q -d TEMPERATURE,POWER,UTILIZATION`:void 0,action:(0,w.jsxs)(`span`,{style:{fontSize:11,color:S.ink3},children:[`每 3 秒刷新 · 来源 `,t[0].source]}),children:t.map((e,n)=>{let r=jh(e);return(0,w.jsxs)(`div`,{style:{marginBottom:ne.powerLimitW*.9?`#dc2626`:S.blueDeep}),e.powerKnown&&(0,w.jsx)(gh,{label:`Util`,value:e.utilPct,unit:`%`,color:e.utilPct>=80?`#059669`:S.ink}),!e.powerKnown&&(0,w.jsx)(gh,{label:`功耗`,value:`—`,unit:``,color:S.ink3})]}),e.powerKnown&&(0,w.jsxs)(`div`,{style:{display:`grid`,gridTemplateColumns:`1fr 1fr 1fr`,gap:20,marginTop:12},children:[(0,w.jsxs)(`div`,{children:[(0,w.jsx)(`div`,{style:{fontSize:11,color:S.ink3,marginBottom:4},children:`显存`}),(0,w.jsxs)(`div`,{style:{fontSize:13,fontWeight:700,..._h,color:e.memUsedMiB/e.memTotalMiB>.9?`#dc2626`:S.ink},children:[e.memUsedMiB,` / `,e.memTotalMiB,` `,(0,w.jsx)(`span`,{style:{fontSize:11,color:S.ink3},children:`MiB`})]}),(0,w.jsx)(`div`,{style:{width:`100%`,height:5,background:`#e2e8f0`,borderRadius:3,marginTop:4,overflow:`hidden`},children:(0,w.jsx)(`div`,{style:{width:`${e.memUsedMiB/e.memTotalMiB*100}%`,height:`100%`,background:S.blueDeep,transition:`width 400ms ease`}})})]}),(0,w.jsxs)(`div`,{children:[(0,w.jsx)(`div`,{style:{fontSize:11,color:S.ink3,marginBottom:4},children:`P-State`}),(0,w.jsx)(`div`,{style:{fontSize:13,fontWeight:700,..._h,color:S.ink},children:e.pState||`—`}),(0,w.jsx)(`div`,{style:{fontSize:10.5,color:S.ink3,marginTop:2},children:`P0 = 满速, P8/12 = 深度省电`})]}),(0,w.jsxs)(`div`,{children:[(0,w.jsx)(`div`,{style:{fontSize:11,color:S.ink3,marginBottom:4},children:`PCIe 地址`}),(0,w.jsx)(`div`,{style:{fontSize:13,fontWeight:700,..._h,color:S.ink},children:e.pciAddress})]})]}),!e.powerKnown&&(0,w.jsx)(`div`,{style:{marginTop:10,fontSize:10.5,color:S.ink3},children:`当前从 sysfs hwmon 读取。装了 NVIDIA 官方驱动 (nvidia-smi) 后可拿到功耗 / util / 显存 / P-State。`})]},n)})}):null}var Nh=[{group:`PCIe / 硬件`,desc:`完整 PCIe 配置和链路信息`,cmd:e=>`lspci -vvv -s ${e}`},{group:`PCIe / 硬件`,desc:`拓扑树,看 GPU 挂在哪根总线`,cmd:()=>`lspci -tvnnmm`},{group:`PCIe / 硬件`,desc:`当前 PCIe 链路速率/宽度`,cmd:e=>`lspci -vv -s ${e} | grep -E 'LnkCap|LnkSta'`},{group:`内核模块`,desc:`看当前用的是哪个驱动`,cmd:()=>`lsmod | grep -iE "nvidia|nouveau|amdgpu"`},{group:`内核模块`,desc:`nouveau/nvidia 冲突排查`,cmd:()=>`dmesg | grep -iE "nvidia|nouveau|drm" | tail -30`},{group:`NVIDIA (需官方驱动)`,desc:`完整状态 (温度/功耗/进程)`,cmd:()=>`nvidia-smi -q`},{group:`NVIDIA (需官方驱动)`,desc:`紧凑指标 CSV,方便脚本采集`,cmd:()=>`nvidia-smi --query-gpu=name,driver_version,utilization.gpu,memory.used,memory.total,temperature.gpu,power.draw --format=csv`},{group:`NVIDIA (需官方驱动)`,desc:`多卡拓扑 (NVLink / PCIe / SYS)`,cmd:()=>`nvidia-smi topo -m`},{group:`NVIDIA (需官方驱动)`,desc:`看 CUDA / driver 版本`,cmd:()=>`nvidia-smi --query-gpu=driver_version --format=csv,noheader && nvcc --version`},{group:`nouveau (当前驱动)`,desc:`看当前功率/频率状态`,cmd:()=>`cat /sys/kernel/debug/dri/*/pstate 2>/dev/null || echo "需 root 且加载 debugfs"`},{group:`OpenGL / 图形栈`,desc:`OpenGL 后端和 renderer`,cmd:()=>`glxinfo -B | head -20`},{group:`OpenGL / 图形栈`,desc:`VA-API 硬解能力`,cmd:()=>`vainfo`}];function Ph({pciAddress:e}){let t={};for(let e of Nh)t[e.group]||(t[e.group]=[]),t[e.group].push(e);return(0,w.jsx)(Oh,{title:`常用诊断命令`,action:(0,w.jsx)(`span`,{style:{fontSize:11,color:S.ink3},children:`点复制到剪贴板`}),children:Object.entries(t).map(([t,n])=>(0,w.jsxs)(`div`,{style:{marginBottom:12},children:[(0,w.jsx)(`div`,{style:{fontSize:11.5,color:S.ink3,fontWeight:600,marginBottom:4},children:t}),n.map((t,n)=>{let r=t.cmd(e);return(0,w.jsxs)(`button`,{onClick:()=>Sh(r),className:`edge-press edge-row-hover`,style:{display:`flex`,gap:10,alignItems:`baseline`,width:`100%`,textAlign:`left`,border:`none`,background:`transparent`,cursor:`pointer`,padding:`5px 6px`,borderRadius:6,borderBottom:`1px dashed ${S.borderSoft||`#f1f5f9`}`},children:[(0,w.jsx)(`span`,{style:{fontSize:11.5,color:S.ink3,minWidth:200,flexShrink:0},children:t.desc}),(0,w.jsx)(`span`,{style:{..._h,fontSize:12,color:S.ink,flex:1,wordBreak:`break-all`},children:r}),(0,w.jsx)(`span`,{style:{fontSize:10,color:S.blueDeep,fontWeight:600,padding:`1px 6px`,borderRadius:4,background:S.blueSoft,flexShrink:0},children:`复制`})]},n)})]},t))})}function Fh({data:e}){let t=e.gpus||[];return t.length?(0,w.jsxs)(w.Fragment,{children:[(0,w.jsx)(Mh,{}),t.map((e,t)=>{let n=wh(e.linkStatus);return(0,w.jsxs)(Oh,{title:`显卡 #${t+1} · ${e.pciAddress}`,cmd:`lspci -vvv -s ${e.pciAddress}`,children:[(0,w.jsx)(Q,{k:`设备`,v:e.model}),(0,w.jsx)(Q,{k:`设备类`,v:e.class}),(0,w.jsx)(Q,{k:`驱动`,v:e.driver,warn:e.driver===`nouveau`}),(0,w.jsx)(Q,{k:`PCIe 能力`,v:`${bh(e.linkGenCap)} ${e.linkWidCap}`}),(0,w.jsx)(Q,{k:`PCIe 协商`,v:(0,w.jsxs)(`span`,{children:[bh(e.linkGenCur),` `,e.linkWidCur,e.linkStatus&&e.linkStatus!==`ok`&&(0,w.jsxs)(`span`,{style:{marginLeft:8,fontSize:11,padding:`1px 6px`,borderRadius:4,color:n.color,background:n.bg,border:`1px solid ${n.color}22`},children:[n.marker,` `,n.label]})]}),warn:e.linkStatus===`downgrade`}),e.linkStatus===`idle`&&(0,w.jsx)(Q,{k:`说明`,mono:!1,v:`宽度打满、代降低 —— 典型 ASPM 省电空闲。实际有 CUDA/图形负载时会自动升到 Gen 上限。`}),e.driver===`nouveau`&&(0,w.jsx)(Q,{k:`建议`,warn:!0,mono:!1,v:`当前使用 nouveau 开源驱动,缺失 CUDA/NVENC 支持。生产用途请安装 NVIDIA 官方驱动 + CUDA 工具链。`})]},e.pciAddress)}),(0,w.jsx)(Ph,{pciAddress:t[0].pciAddress})]}):(0,w.jsx)(`div`,{style:{color:S.ink3},children:`未检测到独立显卡。`})}function Ih(){let{data:e}=Zd(),t=e?.cpu;return t?(0,w.jsxs)(Oh,{title:`当前状态`,action:(0,w.jsx)(`span`,{style:{fontSize:11,color:S.ink3},children:`每 3 秒刷新`}),children:[(0,w.jsxs)(`div`,{style:{display:`grid`,gridTemplateColumns:`1fr 1fr`,gap:20},children:[(0,w.jsxs)(`div`,{children:[(0,w.jsx)(`div`,{style:{fontSize:11,color:S.ink3,marginBottom:6},children:`包温度`}),(0,w.jsx)(hh,{tempC:t.packageTempC,maxC:t.maxTempC,critC:t.critTempC}),(0,w.jsxs)(`div`,{style:{fontSize:10.5,color:S.ink3,marginTop:4,..._h},children:[`阈值: max `,t.maxTempC,`°C · crit `,t.critTempC,`°C`]})]}),(0,w.jsxs)(`div`,{children:[(0,w.jsx)(gh,{label:`包功耗 (Intel RAPL)`,value:t.powerAvailable?t.packagePowerW.toFixed(1):`—`,unit:t.powerAvailable?`W`:``,color:t.packagePowerW>100?`#dc2626`:S.blueDeep}),!t.powerAvailable&&(0,w.jsx)(`div`,{style:{fontSize:10.5,color:S.ink3,marginTop:4},children:t.powerReason})]})]}),t.coreTemps?.length>0&&(0,w.jsxs)(`div`,{style:{marginTop:14},children:[(0,w.jsx)(`div`,{style:{fontSize:11,color:S.ink3,marginBottom:6},children:`每核温度`}),(0,w.jsx)(`div`,{style:{display:`grid`,gridTemplateColumns:`repeat(auto-fill, minmax(180px, 1fr))`,gap:8},children:t.coreTemps.map(e=>(0,w.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,gap:8},children:[(0,w.jsx)(`div`,{style:{..._h,fontSize:11,color:S.ink3,minWidth:55},children:e.label}),(0,w.jsx)(`div`,{style:{flex:1},children:(0,w.jsx)(hh,{tempC:e.tempC,maxC:e.maxC,critC:e.critC,w:90})})]},e.label))})]})]}):null}function Lh({data:e}){let t=e.cpu;return(0,w.jsxs)(w.Fragment,{children:[(0,w.jsx)(Ih,{}),(0,w.jsxs)(Oh,{title:`CPU`,cmd:`lscpu`,children:[(0,w.jsx)(Q,{k:`型号`,v:t.model}),(0,w.jsx)(Q,{k:`厂商`,v:t.vendor}),(0,w.jsx)(Q,{k:`架构`,v:t.arch}),(0,w.jsx)(Q,{k:`槽位数`,v:t.sockets}),(0,w.jsx)(Q,{k:`物理核心`,v:t.cores}),(0,w.jsx)(Q,{k:`逻辑线程`,v:t.threads}),(0,w.jsx)(Q,{k:`频率`,v:t.maxMHz?`${t.minMHz?.toFixed(0)||`?`} - ${t.maxMHz.toFixed(0)} MHz`:`—`}),(0,w.jsx)(Q,{k:`虚拟化`,v:t.virt}),(0,w.jsx)(Q,{k:`指令集`,v:(t.flagsHint||[]).join(` `)}),(t.caches||[]).map(e=>(0,w.jsx)(Q,{k:e.split(`:`)[0],v:e.split(`:`).slice(1).join(`:`).trim()},e))]})]})}function Rh({data:e}){let t=e.memory,n=(t.dimms||[]).filter(e=>e.populated);return(0,w.jsxs)(w.Fragment,{children:[(0,w.jsxs)(Oh,{title:`内存总览`,children:[(0,w.jsx)(Q,{k:`总容量`,v:vh(t.totalBytes)}),(0,w.jsx)(Q,{k:`可用`,v:vh(t.availableBytes)}),(0,w.jsx)(Q,{k:`DIMM 插槽`,v:t.dimms?`${n.length} / ${t.dimms.length} 已插`:t.dimmsReason})]}),t.dimmsAvailable&&(0,w.jsxs)(Oh,{title:`DIMM 详情`,cmd:`dmidecode -t memory`,action:(0,w.jsx)(`span`,{style:{fontSize:11,color:S.ink3},children:`仅显示已插入槽位`}),children:[n.length===0&&(0,w.jsx)(`div`,{style:{color:S.ink3},children:`无已插入的 DIMM。`}),n.length>0&&(0,w.jsxs)(`table`,{style:{width:`100%`,fontSize:12.5,..._h,borderCollapse:`collapse`},children:[(0,w.jsx)(`thead`,{children:(0,w.jsxs)(`tr`,{style:{color:S.ink3,textAlign:`left`,borderBottom:`1px solid ${S.border}`},children:[(0,w.jsx)(`th`,{style:{padding:`6px 4px`},children:`槽位`}),(0,w.jsx)(`th`,{children:`容量`}),(0,w.jsx)(`th`,{children:`类型`}),(0,w.jsx)(`th`,{children:`频率`}),(0,w.jsx)(`th`,{children:`厂商`}),(0,w.jsx)(`th`,{children:`Part No.`})]})}),(0,w.jsx)(`tbody`,{children:n.map((e,t)=>(0,w.jsxs)(`tr`,{style:{borderBottom:`1px dashed ${S.borderSoft||`#f1f5f9`}`},children:[(0,w.jsx)(`td`,{style:{padding:`6px 4px`,color:S.ink2},children:e.slot}),(0,w.jsx)(`td`,{children:vh(e.sizeBytes)}),(0,w.jsx)(`td`,{children:e.type||`—`}),(0,w.jsx)(`td`,{children:e.speedMTs?e.speedMTs+` MT/s`:`—`}),(0,w.jsx)(`td`,{children:e.manufacturer||`—`}),(0,w.jsx)(`td`,{children:e.partNumber||`—`})]},t))})]})]})]})}function zh({data:e}){return(0,w.jsx)(Oh,{title:`块设备`,cmd:`lsblk -O`,children:(0,w.jsxs)(`table`,{style:{width:`100%`,fontSize:12.5,..._h,borderCollapse:`collapse`},children:[(0,w.jsx)(`thead`,{children:(0,w.jsxs)(`tr`,{style:{color:S.ink3,textAlign:`left`,borderBottom:`1px solid ${S.border}`},children:[(0,w.jsx)(`th`,{style:{padding:`6px 4px`},children:`路径`}),(0,w.jsx)(`th`,{children:`型号`}),(0,w.jsx)(`th`,{children:`容量`}),(0,w.jsx)(`th`,{children:`介质`}),(0,w.jsx)(`th`,{children:`总线`}),(0,w.jsx)(`th`,{children:`挂载`})]})}),(0,w.jsx)(`tbody`,{children:(e.storage||[]).map(e=>(0,w.jsxs)(`tr`,{style:{borderBottom:`1px dashed ${S.borderSoft||`#f1f5f9`}`},children:[(0,w.jsx)(`td`,{style:{padding:`6px 4px`,color:S.ink2},children:e.path}),(0,w.jsx)(`td`,{children:e.model||e.vendor||`—`}),(0,w.jsx)(`td`,{children:vh(e.sizeBytes)}),(0,w.jsx)(`td`,{children:e.rotational?`HDD`:`SSD`}),(0,w.jsx)(`td`,{children:(e.transport||``).toUpperCase()}),(0,w.jsx)(`td`,{children:e.mountpoint||`—`})]},e.path))})]})})}function Bh({data:e}){let t=(e.network||[]).filter(e=>!e.isVirtual),n=(e.network||[]).filter(e=>e.isVirtual);return(0,w.jsxs)(w.Fragment,{children:[(0,w.jsxs)(Oh,{title:`物理网卡 · ${t.length} 个`,cmd:`ethtool `,children:[t.length===0&&(0,w.jsx)(`div`,{style:{color:S.ink3},children:`未识别到物理网卡。`}),t.map(e=>(0,w.jsxs)(`div`,{style:{marginBottom:12,paddingBottom:12,borderBottom:`1px dashed ${S.borderSoft||`#f1f5f9`}`},children:[(0,w.jsxs)(`div`,{style:{fontWeight:600,marginBottom:4,..._h},children:[e.name,(0,w.jsx)(`span`,{style:{marginLeft:8,fontSize:11,color:e.state===`UP`?`#059669`:S.ink3},children:e.state})]}),(0,w.jsx)(Q,{k:`驱动 / 固件`,v:`${e.driver||`—`} · ${e.fwVersion||`—`}`}),(0,w.jsx)(Q,{k:`链路`,v:`${e.linkSpeed||`—`}${e.linkDuplex?` · `+e.linkDuplex:``}`}),(0,w.jsx)(Q,{k:`MAC`,v:e.mac}),(0,w.jsx)(Q,{k:`MTU`,v:e.mtu}),(0,w.jsx)(Q,{k:`IPv4`,v:(e.ipv4||[]).join(`, `)||`—`})]},e.name))]}),(0,w.jsx)(Oh,{title:`虚拟接口 · ${n.length} 个`,action:(0,w.jsx)(`span`,{style:{fontSize:11,color:S.ink3},children:`docker / bridge / veth / tun 等`}),children:(0,w.jsx)(`div`,{style:{..._h,fontSize:12,color:S.ink2,columnCount:3,columnGap:24},children:n.map(e=>(0,w.jsxs)(`div`,{style:{padding:`2px 0`},children:[e.name,` `,(0,w.jsxs)(`span`,{style:{color:S.ink3},children:[`(`,e.virtualKind,`)`]})]},e.name))})})]})}function Vh({data:e}){let t=e.pcie||[],n={downgrade:0,idle:0,empty:0,ok:0};for(let e of t)n[e.linkStatus||`ok`]++;let[r,i]=(0,b.useState)(`all`),a=r===`all`?t:t.filter(e=>(e.linkStatus||`ok`)===r),o=[{id:`all`,label:`全部`,n:t.length,color:S.ink3},{id:`downgrade`,label:`真降级`,n:n.downgrade,color:`#b45309`},{id:`idle`,label:`省电空闲`,n:n.idle,color:`#94a3b8`},{id:`empty`,label:`空槽`,n:n.empty,color:`#94a3b8`},{id:`ok`,label:`正常`,n:n.ok,color:`#059669`}];return(0,w.jsxs)(Oh,{title:`PCIe 设备总览 · ${t.length} 个`,cmd:`lspci -vvv -nn`,action:(0,w.jsx)(`div`,{style:{display:`flex`,gap:4},children:o.map(e=>(0,w.jsxs)(`button`,{onClick:()=>i(e.id),style:{padding:`2px 8px`,fontSize:11,borderRadius:10,background:r===e.id?e.color+`18`:`white`,border:`1px solid ${r===e.id?e.color:S.border}`,color:r===e.id?e.color:S.ink3,fontWeight:r===e.id?700:500,cursor:`pointer`},children:[e.label,` `,(0,w.jsx)(`span`,{style:{opacity:.7},children:e.n})]},e.id))}),children:[(0,w.jsxs)(`table`,{style:{width:`100%`,fontSize:11.5,..._h,borderCollapse:`collapse`,tableLayout:`fixed`},children:[(0,w.jsxs)(`colgroup`,{children:[(0,w.jsx)(`col`,{style:{width:72}}),(0,w.jsx)(`col`,{style:{width:72}}),(0,w.jsx)(`col`,{}),(0,w.jsx)(`col`,{style:{width:110}}),(0,w.jsx)(`col`,{style:{width:90}}),(0,w.jsx)(`col`,{style:{width:130}})]}),(0,w.jsx)(`thead`,{children:(0,w.jsxs)(`tr`,{style:{color:S.ink3,textAlign:`left`,borderBottom:`1px solid ${S.border}`},children:[(0,w.jsx)(`th`,{style:{padding:`4px 4px`},children:`地址`}),(0,w.jsx)(`th`,{children:`类别`}),(0,w.jsx)(`th`,{children:`厂商 / 设备`}),(0,w.jsx)(`th`,{children:`驱动`}),(0,w.jsx)(`th`,{children:`PCIe 能力`}),(0,w.jsx)(`th`,{children:`PCIe 协商`})]})}),(0,w.jsx)(`tbody`,{children:a.map(e=>{let t=xh(e),n=wh(e.linkStatus);return(0,w.jsxs)(`tr`,{style:{borderBottom:`1px dashed ${S.borderSoft||`#f1f5f9`}`,background:n.bg,opacity:e.linkStatus===`empty`?.55:1},children:[(0,w.jsx)(`td`,{style:{padding:`4px 4px`,color:S.ink2},children:e.address}),(0,w.jsx)(`td`,{children:(0,w.jsx)(`span`,{style:{color:t.color,fontWeight:600},children:t.label})}),(0,w.jsx)(`td`,{style:{whiteSpace:`nowrap`,overflow:`hidden`,textOverflow:`ellipsis`},children:e.device}),(0,w.jsx)(`td`,{children:e.driver||(0,w.jsx)(`span`,{style:{color:S.ink3},children:`—`})}),(0,w.jsxs)(`td`,{children:[bh(e.linkGenCap),` `,e.linkWidCap]}),(0,w.jsxs)(`td`,{style:{color:n.color,fontWeight:e.linkStatus===`downgrade`?700:400},children:[n.marker&&(0,w.jsx)(`span`,{style:{marginRight:4},children:n.marker}),bh(e.linkGenCur),` `,e.linkWidCur,n.label&&(0,w.jsxs)(`span`,{style:{marginLeft:6,fontSize:10,opacity:.85},children:[`(`,n.label,`)`]})]})]},e.address)})})]}),(0,w.jsxs)(`div`,{style:{marginTop:12,fontSize:11,color:S.ink3,lineHeight:1.7},children:[(0,w.jsxs)(`div`,{children:[(0,w.jsx)(`b`,{children:`空槽`}),` = 桥/根端口的 downlink 报 x0,表示这个 PCIe 插槽没插东西。`]}),(0,w.jsxs)(`div`,{children:[(0,w.jsx)(`b`,{children:`省电空闲`}),` = 宽度打满、速率降级,是 ASPM 电源管理机制,有负载时自动升速。`]}),(0,w.jsxs)(`div`,{children:[(0,w.jsx)(`b`,{children:`真降级`}),` = 宽度实际低于设备能力,通常是主板槽位规格限制或物理接触问题。`]})]})]})}function Hh({data:e}){let{data:t}=Zd();if(!t)return(0,w.jsx)(`div`,{style:{color:S.ink3},children:`正在读取传感器…`});let n=t.cpu||{},r=t.gpus||[],i=t.fans||[];return(0,w.jsxs)(w.Fragment,{children:[(0,w.jsxs)(Oh,{title:`CPU 温度 / 功耗`,action:(0,w.jsx)(`span`,{style:{fontSize:11,color:S.ink3},children:`每 3 秒刷新 · 采样 200ms`}),children:[(0,w.jsxs)(`div`,{style:{display:`grid`,gridTemplateColumns:`1fr 1fr 1fr`,gap:20,marginBottom:14},children:[(0,w.jsxs)(`div`,{children:[(0,w.jsx)(`div`,{style:{fontSize:11,color:S.ink3,marginBottom:6},children:`包温度`}),(0,w.jsx)(hh,{tempC:n.packageTempC,maxC:n.maxTempC,critC:n.critTempC})]}),(0,w.jsx)(gh,{label:`包功耗 (Intel RAPL)`,value:n.powerAvailable?n.packagePowerW.toFixed(1):`—`,unit:n.powerAvailable?`W`:``,color:S.blueDeep}),(0,w.jsx)(gh,{label:`最高核温`,value:n.coreTemps?.length?Math.max(...n.coreTemps.map(e=>e.tempC)).toFixed(0):`—`,unit:`°C`})]}),n.coreTemps?.length>0&&(0,w.jsxs)(`div`,{style:{marginTop:8},children:[(0,w.jsx)(`div`,{style:{fontSize:11,color:S.ink3,marginBottom:6},children:`每核温度`}),(0,w.jsx)(`div`,{style:{display:`grid`,gridTemplateColumns:`repeat(auto-fill, minmax(200px, 1fr))`,gap:8},children:n.coreTemps.map(e=>(0,w.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,gap:8},children:[(0,w.jsx)(`div`,{style:{..._h,fontSize:11,color:S.ink3,minWidth:55},children:e.label}),(0,w.jsx)(`div`,{style:{flex:1},children:(0,w.jsx)(hh,{tempC:e.tempC,maxC:e.maxC,critC:e.critC,w:100})})]},e.label))})]})]}),(0,w.jsxs)(Oh,{title:`GPU · ${r.length} 个`,action:r[0]?.source&&(0,w.jsxs)(`span`,{style:{fontSize:11,color:S.ink3},children:[`数据来源 `,r[0].source]}),children:[r.length===0&&(0,w.jsx)(`div`,{style:{color:S.ink3},children:`未检测到独立显卡传感器。`}),r.map((e,t)=>{let n=jh(e);return(0,w.jsxs)(`div`,{style:{padding:`10px 0`,borderBottom:te.powerLimitW*.9?`#dc2626`:S.blueDeep}),e.powerKnown&&(0,w.jsx)(gh,{label:`Util`,value:e.utilPct,unit:`%`,color:e.utilPct>=80?`#059669`:S.ink}),!e.powerKnown&&(0,w.jsx)(gh,{label:`功耗`,value:`—`,unit:``,color:S.ink3})]}),e.powerKnown&&(0,w.jsxs)(`div`,{style:{display:`grid`,gridTemplateColumns:`repeat(3, 1fr)`,gap:20},children:[(0,w.jsxs)(`div`,{children:[(0,w.jsx)(`div`,{style:{fontSize:11,color:S.ink3,marginBottom:4},children:`显存`}),(0,w.jsxs)(`div`,{style:{..._h,fontSize:13,fontWeight:700},children:[e.memUsedMiB,` / `,e.memTotalMiB,` `,(0,w.jsx)(`span`,{style:{fontSize:11,color:S.ink3},children:`MiB`})]}),(0,w.jsx)(`div`,{style:{width:`100%`,height:5,background:`#e2e8f0`,borderRadius:3,marginTop:4,overflow:`hidden`},children:(0,w.jsx)(`div`,{style:{width:`${e.memUsedMiB/e.memTotalMiB*100}%`,height:`100%`,background:S.blueDeep,transition:`width 400ms ease`}})})]}),(0,w.jsxs)(`div`,{children:[(0,w.jsx)(`div`,{style:{fontSize:11,color:S.ink3,marginBottom:4},children:`P-State`}),(0,w.jsx)(`div`,{style:{..._h,fontSize:13,fontWeight:700},children:e.pState||`—`})]}),(0,w.jsxs)(`div`,{children:[(0,w.jsx)(`div`,{style:{fontSize:11,color:S.ink3,marginBottom:4},children:`PCIe 地址`}),(0,w.jsx)(`div`,{style:{..._h,fontSize:13,fontWeight:700},children:e.pciAddress})]})]})]},t)}),r[0]?.source===`hwmon`&&(0,w.jsx)(`div`,{style:{marginTop:10,fontSize:10.5,color:S.ink3},children:`当前是 sysfs hwmon 数据源 (nouveau/amdgpu)。装 NVIDIA 官方驱动后自动切到 nvidia-smi,多出 功耗 / util / 显存 / P-State 四项。`})]}),i.length>0&&(0,w.jsx)(Oh,{title:`机箱风扇 · ${i.length} 个`,children:(0,w.jsxs)(`table`,{style:{width:`100%`,fontSize:12,..._h},children:[(0,w.jsx)(`thead`,{children:(0,w.jsxs)(`tr`,{style:{color:S.ink3,textAlign:`left`},children:[(0,w.jsx)(`th`,{style:{padding:`4px 0`},children:`来源`}),(0,w.jsx)(`th`,{style:{textAlign:`right`},children:`转速`})]})}),(0,w.jsx)(`tbody`,{children:i.map((e,t)=>(0,w.jsxs)(`tr`,{children:[(0,w.jsx)(`td`,{children:e.source}),(0,w.jsxs)(`td`,{style:{textAlign:`right`,color:e.rpm>0?S.ink:S.ink3},children:[e.rpm,` RPM`]})]},t))})]})}),(0,w.jsx)(Oh,{title:`能读到什么 / 读不到什么`,children:(0,w.jsxs)(`div`,{style:{fontSize:12,color:S.ink2,lineHeight:1.75},children:[(0,w.jsxs)(`div`,{children:[`✓ CPU 温度:`,(0,w.jsx)(`code`,{children:`/sys/class/hwmon/coretemp`}),` · 每核独立`]}),(0,w.jsxs)(`div`,{children:[`✓ CPU 功耗:`,(0,w.jsx)(`code`,{children:`/sys/class/powercap/intel-rapl`}),` · 采样 200ms 差分 (仅 Intel/较新 AMD)`]}),(0,w.jsxs)(`div`,{children:[`✓ GPU 温度/风扇/功耗/util/显存/P-State:`,(0,w.jsx)(`code`,{children:`nvidia-smi`}),` 优先,回退 `,(0,w.jsx)(`code`,{children:`/sys/class/hwmon/nouveau|amdgpu`})]}),(0,w.jsxs)(`div`,{style:{marginTop:6,color:S.ink3},children:[`✗ 磁盘温度需 `,(0,w.jsx)(`code`,{children:`smartctl`}),`(未安装),装了就能出现在存储页`,(0,w.jsx)(`br`,{}),`✗ 机箱主板温度/电压需 `,(0,w.jsx)(`code`,{children:`lm-sensors`}),`(未配置)`]})]})})]})}function Uh({data:e}){return(0,w.jsxs)(w.Fragment,{children:[(0,w.jsxs)(Oh,{title:`BIOS`,cmd:`dmidecode -t bios`,children:[(0,w.jsx)(Q,{k:`厂商`,v:e.bios.vendor}),(0,w.jsx)(Q,{k:`版本`,v:e.bios.version}),(0,w.jsx)(Q,{k:`发布日期`,v:e.bios.date})]}),(0,w.jsxs)(Oh,{title:`主板`,cmd:`dmidecode -t baseboard`,children:[(0,w.jsx)(Q,{k:`厂商`,v:e.board.manufacturer}),(0,w.jsx)(Q,{k:`产品`,v:e.board.product}),(0,w.jsx)(Q,{k:`系列`,v:e.board.systemName}),(0,w.jsx)(Q,{k:`序列号`,v:e.board.serial})]})]})}var Wh={fontFamily:`"JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, monospace`},Gh={ok:{bg:`#dcfce7`,fg:`#166534`,border:`#86efac`},warn:{bg:`#fef3c7`,fg:`#78350f`,border:`#fcd34d`},err:{bg:`#fee2e2`,fg:`#991b1b`,border:`#fca5a5`},muted:{bg:`#f1f5f9`,fg:`#475569`,border:`#cbd5e1`}},Kh={RUNNING:{text:`RUNNING`,kind:`ok`},STARTING:{text:`STARTING`,kind:`warn`},BACKOFF:{text:`BACKOFF`,kind:`warn`},STOPPED:{text:`STOPPED`,kind:`muted`},EXITED:{text:`EXITED`,kind:`err`},FATAL:{text:`FATAL`,kind:`err`},UNKNOWN:{text:`UNKNOWN`,kind:`muted`}};function qh({text:e,kind:t}){if(!e)return null;let n=Gh[t]||Gh.muted;return(0,w.jsx)(`span`,{style:{display:`inline-block`,padding:`2px 8px`,borderRadius:999,fontSize:10.5,fontWeight:700,letterSpacing:.3,color:n.fg,background:n.bg,border:`1px solid ${n.border}`,...Wh},children:e})}function Jh(e){return Kh[e.badge]?Kh[e.badge]:{text:e.badge,kind:e.badgeKind||`muted`}}function Yh({item:e,isSupervisor:t}){let n=Jh(e),r=!!e.url;return(0,w.jsxs)(`tr`,{style:{borderBottom:`1px dashed ${S.borderSoft||`#f1f5f9`}`},children:[(0,w.jsxs)(`td`,{style:{padding:`10px 8px`,width:`30%`,minWidth:240},children:[(0,w.jsx)(`div`,{style:{fontSize:13.5,fontWeight:700,color:S.ink},children:e.name}),e.project&&(0,w.jsx)(`div`,{style:{fontSize:11,color:S.ink3,marginTop:2},children:e.project})]}),(0,w.jsxs)(`td`,{style:{padding:`10px 8px`},children:[r?(0,w.jsx)(`a`,{href:e.url,target:`_blank`,rel:`noreferrer`,style:{...Wh,fontSize:12.5,color:S.blueDeep,textDecoration:`none`,wordBreak:`break-all`},className:`edge-link-hover`,children:e.url}):(0,w.jsx)(`span`,{style:{...Wh,fontSize:12.5,color:S.ink3},children:`—`}),e.note&&(0,w.jsx)(`div`,{style:{fontSize:11,color:S.ink3,marginTop:3},children:e.note})]}),(0,w.jsx)(`td`,{style:{padding:`10px 8px`,width:130,...Wh},children:e.supervisor&&(0,w.jsx)(`span`,{style:{fontSize:11.5,color:S.ink3},children:e.supervisor})}),(0,w.jsx)(`td`,{style:{padding:`10px 8px`,width:100,textAlign:`right`},children:(0,w.jsx)(qh,{text:n.text,kind:n.kind})})]})}function Xh({section:e}){let t=e.kind===`supervisor`;return(0,w.jsxs)(`div`,{style:{background:`white`,border:`1px solid ${S.border}`,borderRadius:10,marginBottom:16,overflow:`hidden`},children:[(0,w.jsxs)(`div`,{style:{padding:`12px 16px`,borderBottom:`1px solid ${S.borderSoft||`#f1f5f9`}`},children:[(0,w.jsxs)(`div`,{style:{fontSize:14.5,fontWeight:700,color:S.ink},children:[e.title,t&&(0,w.jsx)(`span`,{style:{marginLeft:8,fontSize:10.5,fontWeight:600,color:S.blueDeep,padding:`1px 6px`,borderRadius:4,background:S.blueSoft},children:`实时状态`})]}),e.description&&(0,w.jsx)(`div`,{style:{fontSize:12,color:S.ink3,marginTop:4,lineHeight:1.55},children:e.description})]}),e.items?.length>0?(0,w.jsxs)(`table`,{style:{width:`100%`,borderCollapse:`collapse`},children:[(0,w.jsx)(`thead`,{children:(0,w.jsxs)(`tr`,{style:{background:`#f8fafc`},children:[(0,w.jsx)(`th`,{style:Zh,children:`名称`}),(0,w.jsx)(`th`,{style:Zh,children:`地址`}),(0,w.jsx)(`th`,{style:{...Zh,width:130},children:t?`Supervisor 名`:``}),(0,w.jsx)(`th`,{style:{...Zh,width:100,textAlign:`right`},children:`状态`})]})}),(0,w.jsx)(`tbody`,{children:e.items.map((e,n)=>(0,w.jsx)(Yh,{item:e,isSupervisor:t},n))})]}):(0,w.jsx)(`div`,{style:{padding:16,fontSize:12,color:S.ink3},children:`(无条目)`})]})}var Zh={padding:`8px 8px`,fontSize:10.5,fontWeight:700,textTransform:`uppercase`,letterSpacing:`0.06em`,color:S.ink3,textAlign:`left`,borderBottom:`1px solid ${S.border}`};function Qh(){let{data:e,loading:t}=Qd();if(t&&!e)return(0,w.jsx)(`div`,{style:{padding:40,color:S.ink3},children:`加载中…`});let n=e?.sections||[],r=e?.error;return(0,w.jsxs)(`div`,{style:{display:`flex`,flexDirection:`column`,height:`100%`,width:`100%`,background:`#f8fafc`,overflow:`hidden`},children:[(0,w.jsx)(`div`,{style:{padding:`12px 20px`,background:`white`,borderBottom:`1px solid ${S.border}`},children:(0,w.jsxs)(`div`,{style:{display:`flex`,alignItems:`baseline`,gap:10},children:[(0,w.jsx)(`div`,{style:{fontSize:16,fontWeight:700,color:S.ink},children:`服务导航`}),(0,w.jsxs)(`div`,{style:{fontSize:11.5,color:S.ink3},children:[`Edge 与 Global 两条主线的文档、控制台和 API 地址清单`,e?.path&&(0,w.jsxs)(w.Fragment,{children:[` · 数据源 `,(0,w.jsx)(`code`,{style:Wh,children:e.path})]})]})]})}),(0,w.jsxs)(`div`,{style:{flex:1,overflow:`auto`,padding:20},children:[r&&(0,w.jsxs)(`div`,{style:{padding:`10px 14px`,marginBottom:14,borderRadius:8,background:`#fef3c7`,border:`1px solid #fcd34d`,color:`#78350f`,fontSize:12.5},children:[`⚠ 清单加载出问题:`,r]}),n.length===0&&!r&&(0,w.jsxs)(`div`,{style:{padding:40,textAlign:`center`,color:S.ink3,fontSize:13},children:[`清单为空。检查 `,e?.path||`/etc/devbox/links.yaml`,` 是否存在。`]}),n.map((e,t)=>(0,w.jsx)(Xh,{section:e},t))]})]})}function $h(){let[e,t]=(0,b.useState)(`interfaces`),[n,r]=(0,b.useState)(null);(0,b.useEffect)(()=>{X(`/api/v1/network`).then(e=>e.ok?e.json():null).then(e=>{e&&r(e)}).catch(()=>{})},[]);let i=n?n.interfaces.filter(e=>e.state===`up`):[];return(0,w.jsxs)(`div`,{style:{background:S.surface,border:`1px solid ${S.border}`,borderRadius:10,boxShadow:`0 1px 2px rgba(15,23,42,0.04)`,overflow:`hidden`,marginTop:4},children:[(0,w.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,padding:`12px 16px 0`,borderBottom:`1px solid ${S.borderSoft}`},children:[(0,w.jsx)(D,{name:`network`,size:15,stroke:1.8,style:{color:S.blueDeep,marginRight:8}}),(0,w.jsx)(`span`,{style:{fontSize:13.5,fontWeight:700,color:S.ink},children:`网络管理`}),(0,w.jsxs)(J,{tone:`green`,style:{marginLeft:10},children:[(0,w.jsx)(q,{tone:`green`,size:6}),`在线`]}),(0,w.jsx)(`div`,{style:{flex:1}}),(0,w.jsxs)(`span`,{style:{fontSize:11,color:S.ink3},children:[`本机 IP `,(0,w.jsx)(`span`,{className:`mono`,style:{color:S.ink2,fontWeight:600},children:n?.ip||`...`}),(0,w.jsx)(`span`,{style:{color:`#cbd5e1`,margin:`0 6px`},children:`·`}),`默认网关 `,(0,w.jsx)(`span`,{className:`mono`,style:{color:S.ink2,fontWeight:600},children:n?.gateway||`...`})]})]}),(0,w.jsx)(Zf,{tabs:[{id:`interfaces`,label:`网络配置`,icon:`network`,count:i.length}],active:e,onChange:t,style:{padding:`4px 16px 0`,gap:2,marginTop:8},itemStyle:{padding:`8px 12px 10px`,fontSize:12.5,marginBottom:-1},renderLabel:(e,t)=>(0,w.jsxs)(w.Fragment,{children:[(0,w.jsx)(D,{name:e.icon,size:13,stroke:1.8}),e.label,(0,w.jsx)(`span`,{className:`mono tnum`,style:{fontSize:10,color:t?S.blueDeep:S.ink4,background:t?`#dbeafe`:S.surfaceAlt,padding:`0 5px`,borderRadius:999,lineHeight:`16px`,marginLeft:2},children:e.count})]})}),(0,w.jsxs)(`div`,{style:{padding:16},children:[(0,w.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,gap:8,marginBottom:10},children:[(0,w.jsxs)(`span`,{style:{fontSize:11.5,color:S.ink3},children:[`DNS:`,(0,w.jsx)(`span`,{className:`mono`,style:{color:S.ink2,fontWeight:600},children:(n?.dns||[]).join(` `)}),(0,w.jsx)(`span`,{style:{color:`#cbd5e1`,margin:`0 4px`},children:`·`}),(0,w.jsx)(`span`,{className:`mono`,style:{color:S.ink2,fontWeight:600},children:`8.8.8.8`}),(0,w.jsx)(`span`,{style:{color:`#cbd5e1`,margin:`0 6px`},children:`·`}),`MTU 默认 `,(0,w.jsx)(`span`,{className:`mono tnum`,style:{color:S.ink2,fontWeight:600},children:`1500`})]}),(0,w.jsx)(`div`,{style:{flex:1}}),(0,w.jsxs)(`button`,{className:`edge-press edge-btn-secondary`,style:{...gd,height:28,padding:`0 10px`,fontSize:11.5},children:[(0,w.jsx)(D,{name:`refresh`,size:12,stroke:1.8}),`重新扫描`]}),(0,w.jsxs)(`button`,{className:`edge-press edge-btn-primary`,style:{..._d,height:28,padding:`0 10px`,fontSize:11.5},children:[(0,w.jsx)(D,{name:`plus`,size:12,stroke:2}),`新增接口`]})]}),(0,w.jsxs)(`div`,{style:{border:`1px solid ${S.borderSoft}`,borderRadius:8,overflow:`hidden`},children:[(0,w.jsxs)(`div`,{style:{display:`grid`,gridTemplateColumns:`140px 80px 200px 130px 160px 90px 1fr 80px`,padding:`8px 12px`,background:S.surfaceAlt,fontSize:10.5,color:S.ink3,fontWeight:600,letterSpacing:`0.04em`,textTransform:`uppercase`,borderBottom:`1px solid ${S.borderSoft}`},children:[(0,w.jsx)(`span`,{children:`接口`}),(0,w.jsx)(`span`,{children:`状态`}),(0,w.jsx)(`span`,{children:`IP / 掩码`}),(0,w.jsx)(`span`,{children:`网关`}),(0,w.jsx)(`span`,{children:`MAC`}),(0,w.jsx)(`span`,{children:`模式`}),(0,w.jsx)(`span`,{children:`RX / TX`}),(0,w.jsx)(`span`,{style:{textAlign:`right`},children:`操作`})]}),(n?.interfaces||[]).map((e,t)=>(0,w.jsxs)(`div`,{style:{display:`grid`,gridTemplateColumns:`140px 80px 200px 160px 90px 1fr`,padding:`11px 12px`,alignItems:`center`,fontSize:12,borderTop:t?`1px solid ${S.borderSoft}`:`none`},children:[(0,w.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,gap:8},children:[(0,w.jsx)(D,{name:e.type===`本地`?`dot`:e.type===`无线`?`globe`:`network`,size:14,stroke:1.8,style:{color:e.state===`up`?S.blueDeep:S.ink4}}),(0,w.jsxs)(`div`,{children:[(0,w.jsx)(`div`,{style:{fontWeight:600,color:S.ink},className:`mono`,children:e.name}),(0,w.jsx)(`div`,{style:{fontSize:10.5,color:S.ink4,marginTop:1},children:e.type})]})]}),(0,w.jsx)(`div`,{children:e.state===`up`?(0,w.jsxs)(J,{tone:`green`,style:{padding:`1px 6px`},children:[(0,w.jsx)(q,{tone:`green`,size:5}),`UP`]}):(0,w.jsxs)(J,{tone:`gray`,style:{padding:`1px 6px`},children:[(0,w.jsx)(q,{tone:`gray`,size:5}),`DOWN`]})}),(0,w.jsx)(`div`,{className:`mono`,style:{color:S.ink2},children:e.ip||`—`}),(0,w.jsx)(`div`,{className:`mono`,style:{color:S.ink3,fontSize:11},children:e.mac||`—`}),(0,w.jsxs)(`div`,{className:`mono`,style:{color:S.ink3,fontSize:11},children:[`MTU `,e.mtu]}),(0,w.jsx)(`div`,{})]},e.name))]}),(0,w.jsxs)(`div`,{style:{padding:`10px 12px`,background:S.surfaceAlt,border:`1px solid ${S.borderSoft}`,borderRadius:8,marginTop:12},children:[(0,w.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,gap:6,marginBottom:6},children:[(0,w.jsx)(D,{name:`globe`,size:13,stroke:1.8,style:{color:S.ink2}}),(0,w.jsx)(`span`,{style:{fontSize:12,fontWeight:600,color:S.ink},children:`DNS`})]}),(0,w.jsx)(`div`,{style:{fontSize:11.5,color:S.ink3,lineHeight:1.7},children:(n?.dns||[]).map((e,t)=>(0,w.jsxs)(`span`,{children:[t>0&&(0,w.jsx)(`br`,{}),`DNS `,t+1,`:`,(0,w.jsx)(`span`,{className:`mono`,style:{color:S.ink2},children:e})]},t))})]})]})]})}function eg(){let[e,t]=(0,b.useState)(null),[n,r]=(0,b.useState)({});(0,b.useEffect)(()=>{X(`/api/v1/device`).then(e=>e.ok?e.json():null).then(e=>{e&&r({name:e.hostname,sn:e.hostname,os:e.platform||e.os,agent:`Edge Platform `+(e.agentVersion||``),model:e.cpuModel,site:e.ip,dept:``,uptime:e.uptimeHuman})}).catch(()=>{})},[]);let i=[{id:`ping`,icon:`network`,name:`网络连通性`,desc:`ping 云端 · 网关 · DNS`,color:S.blue},{id:`bandwidth`,icon:`arrowUp`,name:`带宽测试`,desc:`上行 / 下行 · 抖动 · 丢包`,color:S.indigo},{id:`syslog`,icon:`terminal`,name:`系统日志`,desc:`journalctl · dmesg · syslog`,color:S.violet},{id:`health`,icon:`shield`,name:`一键体检`,desc:`硬件 · 驱动 · 模型完整性`,color:S.green},{id:`bundle`,icon:`download`,name:`一键诊断包`,desc:`日志 + 配置 + 指标 · 离线上报`,color:S.amber},{id:`reboot`,icon:`power`,name:`远程重启`,desc:`需管理员权限`,color:S.red}];return(0,w.jsxs)(`div`,{style:{flex:1,padding:24,overflow:`auto`,background:S.surfaceAlt},children:[(0,w.jsxs)(`div`,{style:{marginBottom:14},children:[(0,w.jsx)(`div`,{style:{...S.type.heading,color:S.ink},children:`系统设置`}),(0,w.jsx)(`div`,{style:{fontSize:12,color:S.ink3,marginTop:3},children:`诊断工具 · 网络管理 · 设备信息`})]}),(0,w.jsx)(`div`,{style:{display:`grid`,gridTemplateColumns:`repeat(3, 1fr)`,gap:12,marginBottom:16},children:i.map(n=>(0,w.jsxs)(`div`,{onClick:()=>t(n.id),style:{background:S.surface,border:`1px solid ${S.border}`,borderRadius:10,padding:16,cursor:`pointer`,display:`flex`,gap:12,...e===n.id?{boxShadow:`0 0 0 2px ${n.color}33`,borderColor:n.color}:{}},children:[(0,w.jsx)(`div`,{style:{width:38,height:38,borderRadius:9,background:`${n.color}15`,color:n.color,display:`flex`,alignItems:`center`,justifyContent:`center`,flexShrink:0},children:(0,w.jsx)(D,{name:n.icon,size:18,stroke:1.8})}),(0,w.jsxs)(`div`,{style:{minWidth:0},children:[(0,w.jsx)(`div`,{style:{fontSize:13.5,fontWeight:600,color:S.ink},children:n.name}),(0,w.jsx)(`div`,{style:{fontSize:11.5,color:S.ink3,marginTop:4},children:n.desc}),e===n.id&&(0,w.jsxs)(`div`,{style:{fontSize:11.5,color:n.color,marginTop:8,fontWeight:600,display:`flex`,alignItems:`center`,gap:5},children:[(0,w.jsx)(q,{tone:n.color===S.green?`green`:`blue`,size:6,pulse:!0}),`正在执行…`]})]})]},n.id))}),(0,w.jsx)($h,{}),(0,w.jsx)(Yu,{title:`设备信息`,padding:0,style:{marginTop:16},children:(0,w.jsx)(`table`,{style:{width:`100%`,borderCollapse:`collapse`,fontSize:12.5},children:(0,w.jsx)(`tbody`,{children:[[`设备名称`,n.name],[`IP 地址`,(0,w.jsx)(`span`,{className:`mono`,children:n.site})],[`运行时间`,n.uptime],[`操作系统`,n.os],[`Agent 版本`,(0,w.jsx)(`span`,{className:`mono`,children:n.agent})],[`硬件平台`,n.model]].map(([e,t],n)=>(0,w.jsxs)(`tr`,{style:{borderTop:n?`1px solid ${S.borderSoft}`:`none`},children:[(0,w.jsx)(`td`,{style:{width:120,padding:`10px 16px`,color:S.ink3},children:e}),(0,w.jsx)(`td`,{style:{padding:`10px 16px`,color:S.ink},children:t})]},e))})})})]})}var tg={display:`inline-flex`,alignItems:`center`,gap:5,borderRadius:7,border:`1px solid ${S.border}`,background:`white`,color:S.ink2,cursor:`pointer`,fontSize:12.5,fontWeight:500},ng={display:`inline-flex`,alignItems:`center`,gap:5,borderRadius:7,border:`none`,background:S.blue,color:`white`,cursor:`pointer`,fontSize:12.5,fontWeight:600,height:32,padding:`0 14px`},rg={padding:`8px 14px`,fontSize:10.5,fontWeight:600,color:S.ink3,letterSpacing:`0.04em`,textTransform:`uppercase`},ig=new Set([`png`,`jpg`,`jpeg`,`gif`,`webp`,`svg`,`bmp`,`ico`,`avif`]);function ag(e){return e&&ig.has(e.toLowerCase())}async function og(e){try{if(navigator.clipboard&&window.isSecureContext)return await navigator.clipboard.writeText(e),!0}catch{}try{let t=document.createElement(`textarea`);t.value=e,t.style.position=`fixed`,t.style.opacity=`0`,document.body.appendChild(t),t.select();let n=document.execCommand(`copy`);return document.body.removeChild(t),n}catch{return!1}}function sg(e){return e>=0xe8d4a51000?(e/0xe8d4a51000).toFixed(1)+` TB`:e>=1e9?(e/1e9).toFixed(1)+` GB`:e>=1e6?(e/1e6).toFixed(1)+` MB`:e>=1e3?(e/1e3).toFixed(1)+` KB`:e+` B`}function cg(e){if(!e)return``;let t=e=>String(e).padStart(2,`0`);return`${e.getFullYear()}-${t(e.getMonth()+1)}-${t(e.getDate())} ${t(e.getHours())}:${t(e.getMinutes())}:${t(e.getSeconds())}`}var lg={dir:`文件夹`,png:`PNG 图像`,jpg:`JPEG 图像`,jpeg:`JPEG 图像`,gif:`GIF 图像`,webp:`WebP 图像`,svg:`SVG 矢量图`,bmp:`BMP 图像`,ico:`图标`,avif:`AVIF 图像`,txt:`纯文本`,md:`Markdown 文档`,json:`JSON 数据`,yaml:`YAML 配置`,yml:`YAML 配置`,toml:`TOML 配置`,xml:`XML 文档`,csv:`CSV 表格`,log:`日志文件`,pdf:`PDF 文档`,zip:`ZIP 压缩包`,tar:`TAR 归档`,gz:`GZIP 压缩`,go:`Go 源码`,py:`Python 源码`,js:`JavaScript 源码`,jsx:`React 源码`,ts:`TypeScript 源码`,tsx:`TSX 源码`,sh:`Shell 脚本`,ipynb:`Jupyter Notebook`};function ug(e){return e?lg[e.toLowerCase()]||e.toUpperCase()+` 文件`:`文件`}function dg({label:e,value:t}){return(0,w.jsxs)(`div`,{style:{display:`flex`,gap:10,padding:`6px 0`,fontSize:11.5,borderBottom:`1px dashed ${S.borderSoft}`},children:[(0,w.jsx)(`div`,{style:{width:68,flexShrink:0,color:S.ink4,fontWeight:500},children:e}),(0,w.jsx)(`div`,{style:{flex:1,color:S.ink2,minWidth:0},children:t})]})}function fg(){let[e,t]=(0,b.useState)([]),[n,r]=(0,b.useState)(``),[i,a]=(0,b.useState)(null),[o,s]=(0,b.useState)(null),c=Sp(),[l,u]=(0,b.useState)(null),[d,f]=(0,b.useState)(!0),[p,m]=(0,b.useState)(!1),h=(0,b.useRef)(null),g=(0,b.useRef)(null),{data:_}=Rd(1e4),v=_?.metrics?.dsk,y=v?.pct||0,x=v?.used||0,C=v?.total||0,T=n?n.split(`/`).filter(Boolean):[],E=(0,b.useCallback)(e=>{s(null);let n=!1,i=null;return X(`/api/v1/files?path=`+encodeURIComponent(e)).then(async e=>{if(n)return null;if(e.ok)return e.json();let t=null;try{t=await e.json()}catch{}return e.status===403&&t?.code===`PATH_FORBIDDEN`?(s({code:`PATH_FORBIDDEN`,message:`无权访问该路径(工作区外)`}),i=setTimeout(()=>{n||r(``)},1500)):e.status===404&&t?.code===`PATH_NOT_FOUND`&&s({code:`PATH_NOT_FOUND`,message:`路径不存在`}),null}).then(e=>{n||e&&Array.isArray(e)&&t(e.map(e=>{let t=e.modified?new Date(e.modified):null;return{name:e.name,type:e.isDir?`dir`:e.type,size:e.isDir?``:sg(e.size),sizeBytes:e.isDir?null:e.size,count:e.count,absPath:e.absPath,modified:t?t.toLocaleDateString(`zh-CN`):``,modifiedFull:t?cg(t):``}}))}).catch(()=>{}),()=>{n=!0,i!==null&&clearTimeout(i)}},[]);(0,b.useEffect)(()=>E(n),[n,E]),(0,b.useEffect)(()=>{h.current?.focus()},[]);let O=(0,b.useCallback)(async e=>{let t=Array.from(e||[]).filter(Boolean);if(t.length===0||p)return;m(!0);let r=0,i=``;try{for(let e of t){let t=new FormData;t.append(`path`,n),t.append(`name`,e.name),t.append(`file`,e,e.name);let a=await X(`/api/v1/files/upload`,{method:`POST`,body:t});if(!a.ok){let e=`上传失败 (${a.status})`;a.status===403?e=`目标目录无写入权限`:a.status===413?e=`文件超过 20MB 上限`:a.status===400&&(e=`文件名或目标路径无效`),c.err(e);return}i=(await a.json().catch(()=>({}))).name||e.name,r+=1}c.ok(r===1?`已上传 ${i}`:`已上传 ${r} 个文件`),i&&a(i),E(n)}catch{c.err(`上传失败`)}finally{m(!1),g.current&&(g.current.value=``)}},[n,E,c,p]);return(0,b.useEffect)(()=>{if(!i){u(null);return}let e=i.lastIndexOf(`.`);if(!ag(e>0?i.slice(e+1):``)){u(null);return}let t=!1,r=null;return u({name:i,url:null,status:`loading`}),X(`/api/v1/files/content?path=`+encodeURIComponent(n)+`&name=`+encodeURIComponent(i)).then(async e=>{if(t)return;if(!e.ok){console.error(`[Files] preview fetch HTTP`,e.status,`name=`,i,`path=`,n),u({name:i,url:null,status:`err`});return}let a=await e.blob();t||(r=URL.createObjectURL(a),u({name:i,url:r,status:`ok`}))}).catch(e=>{console.error(`[Files] preview fetch failed`,e),t||u({name:i,url:null,status:`err`})}),()=>{t=!0,r&&URL.revokeObjectURL(r)}},[i,n]),(0,b.useEffect)(()=>{async function e(e){let t=e.target;if(t&&(t.tagName===`INPUT`||t.tagName===`TEXTAREA`||t.isContentEditable))return;let r=e.clipboardData?.items||[],i=Array.from(r).find(e=>e.type&&e.type.startsWith(`image/`));if(!i)return;e.preventDefault();let o=i.getAsFile();if(!o)return;let s=(o.type.split(`/`)[1]||`png`).split(`;`)[0],l=new Date,u=e=>String(e).padStart(2,`0`),d=`screenshot-${`${l.getFullYear()}${u(l.getMonth()+1)}${u(l.getDate())}-${u(l.getHours())}${u(l.getMinutes())}${u(l.getSeconds())}`}.${s}`,f=new FormData;f.append(`path`,n),f.append(`name`,d),f.append(`file`,o,d);try{let e=await X(`/api/v1/files/upload`,{method:`POST`,body:f});if(e.ok){let t=(await e.json().catch(()=>({}))).name||d;c.ok(`已粘贴 ${t}`),a(t),E(n)}else e.status===409?c.warn(`同名文件已存在`):e.status===403?c.err(`目标目录无写入权限`):e.status===413?c.err(`图片超过 20MB 上限`):c.err(`粘贴失败 (${e.status})`)}catch{c.err(`粘贴失败`)}}return window.addEventListener(`paste`,e),()=>window.removeEventListener(`paste`,e)},[n,E,c]),(0,w.jsxs)(`div`,{ref:h,tabIndex:0,style:{flex:1,display:`flex`,flexDirection:`column`,background:S.surface,overflow:`hidden`,outline:`none`},children:[(0,w.jsxs)(`div`,{style:{padding:`10px 18px`,borderBottom:`1px solid ${S.border}`,display:`flex`,alignItems:`center`,gap:10,flexShrink:0},children:[(0,w.jsx)(`button`,{disabled:T.length===0,onClick:()=>{let e=n.split(`/`).filter(Boolean);e.pop(),r(e.join(`/`))},className:`edge-press edge-btn-secondary`,style:{...tg,height:30,padding:`0 10px`,opacity:T.length===0?.4:1,cursor:T.length===0?`not-allowed`:`pointer`},children:(0,w.jsx)(D,{name:`chevLeft`,size:12,stroke:2})}),(0,w.jsx)(`button`,{className:`edge-press edge-btn-secondary`,style:{...tg,height:30,padding:`0 10px`},children:(0,w.jsx)(D,{name:`chevRight`,size:12,stroke:2})}),(0,w.jsx)(`button`,{onClick:()=>r(e=>e),className:`edge-press edge-btn-secondary`,style:{...tg,height:30,padding:`0 10px`},children:(0,w.jsx)(D,{name:`refresh`,size:12,stroke:1.8})}),(0,w.jsxs)(`div`,{style:{flex:1,display:`flex`,alignItems:`center`,gap:4,padding:`0 12px`,height:30,borderRadius:6,background:S.surfaceAlt,border:`1px solid ${S.border}`,fontFamily:`ui-monospace, monospace`,fontSize:12,color:S.ink},children:[(0,w.jsx)(D,{name:`folder`,size:12,stroke:1.8,style:{color:S.ink4}}),(0,w.jsx)(`span`,{onClick:()=>r(``),style:{cursor:`pointer`,color:T.length===0?S.blueDeep:S.ink,fontWeight:T.length===0?600:500},children:`工作区`}),T.map((e,t)=>{let n=t===T.length-1,i=T.slice(0,t+1).join(`/`);return(0,w.jsxs)(`span`,{style:{display:`inline-flex`,alignItems:`center`,gap:4},children:[(0,w.jsx)(`span`,{style:{color:S.ink4},children:`/`}),(0,w.jsx)(`span`,{onClick:()=>r(i),style:{cursor:`pointer`,color:n?S.blueDeep:S.ink,fontWeight:n?600:500},children:e})]},t)})]}),(0,w.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,gap:6,padding:`0 10px`,height:30,borderRadius:6,background:S.surfaceAlt,border:`1px solid ${S.border}`,fontSize:12,color:S.ink,width:240},children:[(0,w.jsx)(D,{name:`search`,size:12,stroke:1.8,style:{color:S.ink4}}),(0,w.jsx)(`input`,{placeholder:`搜索文件…`,style:{flex:1,border:`none`,outline:`none`,fontSize:12,background:`transparent`}})]}),(0,w.jsx)(`input`,{ref:g,type:`file`,multiple:!0,onChange:e=>O(e.target.files),style:{display:`none`}}),(0,w.jsxs)(`button`,{disabled:p,onClick:()=>g.current?.click(),className:`edge-press edge-btn-primary`,style:{...ng,height:30,padding:`0 12px`,opacity:p?.65:1,cursor:p?`wait`:`pointer`},children:[(0,w.jsx)(D,{name:`download`,size:12,stroke:2}),p?`上传中`:`上传`]}),(0,w.jsx)(`button`,{title:d?`隐藏详情`:`显示详情`,onClick:()=>f(e=>!e),className:`edge-press edge-btn-secondary`,style:{...tg,height:30,padding:`0 10px`,background:d?S.blueSoft:`white`,color:d?S.blueDeep:S.ink2,borderColor:d?S.blueDeep:S.border},children:(0,w.jsx)(D,{name:`sidebar`,size:12,stroke:1.8})})]}),(0,w.jsxs)(`div`,{style:{padding:`10px 18px`,background:S.surfaceAlt,borderBottom:`1px solid ${S.borderSoft}`,flexShrink:0,display:`flex`,alignItems:`center`,gap:14,fontSize:11.5},children:[(0,w.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,gap:6},children:[(0,w.jsx)(D,{name:`hardDrive`,size:13,stroke:1.8,style:{color:S.amber}}),(0,w.jsx)(`span`,{style:{color:S.ink2,fontWeight:600},children:n?`工作区 / ${n}`:`工作区`})]}),(0,w.jsx)(`div`,{style:{flex:1,height:6,background:`#fef3c7`,borderRadius:3,overflow:`hidden`,position:`relative`},children:(0,w.jsx)(`div`,{style:{width:y+`%`,height:`100%`,background:S.amber}})}),(0,w.jsxs)(`span`,{className:`mono tnum`,style:{color:S.ink,fontWeight:600},children:[x,` GB / `,C,` GB`]}),(0,w.jsxs)(`span`,{style:{color:S.ink3},children:[`(`,y,`% 已用)`]}),(0,w.jsxs)(`button`,{className:`edge-press edge-btn-secondary`,style:{...tg,height:24,padding:`0 8px`,fontSize:11},children:[(0,w.jsx)(D,{name:`sparkle`,size:11,stroke:1.8}),`分析占用`]})]}),(0,w.jsxs)(`div`,{style:{flex:1,display:`flex`,overflow:`hidden`},children:[(0,w.jsxs)(`div`,{style:{width:200,flexShrink:0,borderRight:`1px solid ${S.borderSoft}`,background:S.surfaceAlt,padding:`12px 8px`},children:[(0,w.jsx)(`div`,{style:{fontSize:10.5,color:S.ink3,fontWeight:600,letterSpacing:`0.06em`,textTransform:`uppercase`,padding:`4px 10px 6px`},children:`快速访问`}),(0,w.jsxs)(`div`,{onClick:()=>r(``),className:n===``?void 0:`edge-row-hover`,style:{display:`flex`,alignItems:`center`,gap:8,padding:`6px 10px`,borderRadius:6,fontSize:12.5,color:n===``?S.blueDeep:S.ink,cursor:`pointer`,background:n===``?S.blueSoft:`transparent`,fontWeight:n===``?600:500,"--edge-row-hover-bg":S.surface},children:[(0,w.jsx)(D,{name:`folder`,size:13,stroke:1.8,style:{color:n===``?S.blueDeep:S.ink3}}),`工作区`]})]}),o&&(0,w.jsxs)(`div`,{style:{position:`absolute`,top:10,right:16,zIndex:10,padding:`8px 14px`,borderRadius:6,background:o.code===`PATH_FORBIDDEN`?`#fef2f2`:`#fffbeb`,border:`1px solid ${o.code===`PATH_FORBIDDEN`?`#fecaca`:`#fde68a`}`,color:o.code===`PATH_FORBIDDEN`?`#991b1b`:`#92400e`,fontSize:12,fontWeight:500,boxShadow:`0 4px 12px rgba(0,0,0,0.08)`},children:[o.message,o.code===`PATH_FORBIDDEN`&&(0,w.jsx)(`span`,{style:{marginLeft:6,fontWeight:400,opacity:.7},children:`(自动回到工作区)`})]}),(0,w.jsx)(`div`,{style:{flex:1,overflow:`auto`},children:(0,w.jsxs)(`table`,{style:{width:`100%`,borderCollapse:`collapse`,fontSize:12.5},children:[(0,w.jsx)(`thead`,{children:(0,w.jsxs)(`tr`,{style:{background:S.surfaceAlt,borderBottom:`1px solid ${S.border}`},children:[(0,w.jsx)(`th`,{style:{...rg,width:36},children:(0,w.jsx)(`input`,{type:`checkbox`,disabled:!0})}),(0,w.jsx)(`th`,{style:{...rg,textAlign:`left`},children:`名称`}),(0,w.jsx)(`th`,{style:{...rg,textAlign:`right`},children:`大小`}),(0,w.jsx)(`th`,{style:{...rg,textAlign:`right`},children:`修改时间`}),(0,w.jsx)(`th`,{style:{...rg,textAlign:`right`}})]})}),(0,w.jsx)(`tbody`,{children:e.map((e,t)=>{let o=i===e.name;return(0,w.jsxs)(`tr`,{onClick:()=>a(e.name),onDoubleClick:()=>{e.type===`dir`&&r(n?`${n}/${e.name}`:e.name)},style:{background:o?`#eff4ff`:`transparent`,borderTop:`1px solid ${S.borderSoft}`,cursor:`pointer`},children:[(0,w.jsx)(`td`,{style:{padding:`8px 14px`},children:(0,w.jsx)(`input`,{type:`checkbox`,disabled:!0,checked:o})}),(0,w.jsx)(`td`,{style:{padding:`8px 14px`},children:(0,w.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,gap:8},children:[(0,w.jsx)(sv,{type:e.type,size:14}),(0,w.jsx)(`span`,{style:{color:S.ink,fontWeight:e.type===`dir`?600:500},children:e.name}),e.type===`dir`&&(0,w.jsxs)(`span`,{style:{fontSize:11,color:S.ink4},children:[`· `,e.count,` 项`]})]})}),(0,w.jsx)(`td`,{style:{padding:`8px 14px`,textAlign:`right`,color:S.ink3},className:`mono`,children:e.size}),(0,w.jsx)(`td`,{style:{padding:`8px 14px`,textAlign:`right`,color:S.ink3},className:`mono`,children:e.modified||``}),(0,w.jsx)(`td`,{style:{padding:`8px 14px`,textAlign:`right`},children:e.absPath&&(0,w.jsx)(`button`,{title:`复制路径: ${e.absPath}`,onClick:async t=>{t.stopPropagation(),await og(e.absPath)?c.ok(`已复制路径 ${e.absPath}`):c.err(`复制失败`)},style:{border:`none`,background:`transparent`,cursor:`pointer`,color:S.ink4,padding:2,display:`inline-flex`},children:(0,w.jsx)(D,{name:`copy`,size:13,stroke:1.8})})})]},e.name)})})]})}),d&&i&&(()=>{let t=e.find(e=>e.name===i);if(!t)return null;let n=t.type!==`dir`&&ag(t.type);return(0,w.jsxs)(`div`,{style:{width:320,flexShrink:0,borderLeft:`1px solid ${S.borderSoft}`,background:S.surfaceAlt,display:`flex`,flexDirection:`column`,overflow:`hidden`},children:[(0,w.jsxs)(`div`,{style:{padding:`10px 14px`,borderBottom:`1px solid ${S.borderSoft}`,fontSize:11.5,fontWeight:600,color:S.ink2,display:`flex`,alignItems:`center`,gap:6},children:[(0,w.jsx)(D,{name:`info`,size:13,stroke:1.8,style:{color:S.ink3}}),(0,w.jsx)(`span`,{style:{flex:1},children:`简介`}),(0,w.jsx)(`button`,{title:`关闭详情`,onClick:()=>f(!1),style:{border:`none`,background:`transparent`,cursor:`pointer`,color:S.ink3,padding:2,display:`inline-flex`},children:(0,w.jsx)(D,{name:`x`,size:13,stroke:1.8})})]}),(0,w.jsx)(`div`,{style:{flexShrink:0,height:200,display:`flex`,alignItems:`center`,justifyContent:`center`,padding:14,overflow:`hidden`,background:n?`repeating-conic-gradient(#f1f5f9 0% 25%, #ffffff 0% 50%) 50% / 16px 16px`:S.surface,borderBottom:`1px solid ${S.borderSoft}`},children:n?(0,w.jsxs)(w.Fragment,{children:[(!l||l.name!==i||l.status===`loading`)&&(0,w.jsx)(`div`,{style:{fontSize:12,color:S.ink3},children:`加载中…`}),l?.name===i&&l.status===`err`&&(0,w.jsx)(`div`,{style:{fontSize:12,color:`#991b1b`},children:`预览加载失败`}),l?.name===i&&l.status===`ok`&&l.url&&(0,w.jsx)(`img`,{src:l.url,alt:i,style:{maxWidth:`100%`,maxHeight:`100%`,objectFit:`contain`,boxShadow:`0 2px 8px rgba(0,0,0,0.08)`,borderRadius:4}})]}):(0,w.jsxs)(`div`,{style:{display:`flex`,flexDirection:`column`,alignItems:`center`,gap:8},children:[(0,w.jsx)(sv,{type:t.type,size:72}),(0,w.jsx)(`div`,{style:{fontSize:11,color:S.ink4},children:`无预览`})]})}),(0,w.jsxs)(`div`,{style:{padding:`12px 14px 8px`,borderBottom:`1px solid ${S.borderSoft}`},children:[(0,w.jsx)(`div`,{style:{fontSize:13,fontWeight:600,color:S.ink,overflowWrap:`anywhere`,lineHeight:1.35},title:t.name,children:t.name}),(0,w.jsxs)(`div`,{style:{marginTop:4,fontSize:11.5,color:S.ink3},children:[ug(t.type),t.sizeBytes!=null&&(0,w.jsxs)(w.Fragment,{children:[` · `,(0,w.jsx)(`span`,{className:`mono`,children:t.size})]}),t.type===`dir`&&t.count!=null&&(0,w.jsxs)(w.Fragment,{children:[` · `,t.count,` 项`]})]})]}),(0,w.jsxs)(`div`,{style:{flex:1,overflow:`auto`,padding:`10px 14px`},children:[(0,w.jsx)(dg,{label:`种类`,value:ug(t.type)}),t.sizeBytes!=null&&(0,w.jsx)(dg,{label:`大小`,value:(0,w.jsxs)(`span`,{className:`mono`,children:[t.size,t.sizeBytes>=1e3&&(0,w.jsxs)(`span`,{style:{color:S.ink4},children:[` (`,t.sizeBytes.toLocaleString(),` 字节)`]})]})}),t.type===`dir`&&t.count!=null&&(0,w.jsx)(dg,{label:`项目数`,value:(0,w.jsx)(`span`,{className:`mono`,children:t.count})}),t.modifiedFull&&(0,w.jsx)(dg,{label:`修改时间`,value:(0,w.jsx)(`span`,{className:`mono`,children:t.modifiedFull})}),t.absPath&&(0,w.jsx)(dg,{label:`位置`,value:(0,w.jsxs)(`div`,{style:{display:`flex`,alignItems:`flex-start`,gap:4},children:[(0,w.jsx)(`span`,{className:`mono`,style:{flex:1,overflowWrap:`anywhere`,lineHeight:1.4},children:t.absPath}),(0,w.jsx)(`button`,{title:`复制路径: ${t.absPath}`,onClick:async()=>{await og(t.absPath)?c.ok(`已复制路径 ${t.absPath}`):c.err(`复制失败`)},style:{border:`none`,background:`transparent`,cursor:`pointer`,color:S.ink3,padding:2,display:`inline-flex`,flexShrink:0},children:(0,w.jsx)(D,{name:`copy`,size:12,stroke:1.8})})]})})]})]})})(),d&&!i&&(0,w.jsx)(`div`,{style:{width:320,flexShrink:0,borderLeft:`1px solid ${S.borderSoft}`,background:S.surfaceAlt,display:`flex`,alignItems:`center`,justifyContent:`center`,padding:20,textAlign:`center`},children:(0,w.jsxs)(`div`,{style:{fontSize:12,color:S.ink4},children:[(0,w.jsx)(D,{name:`info`,size:24,stroke:1.5,style:{color:S.ink4,display:`block`,margin:`0 auto 8px`}}),`选中文件后`,(0,w.jsx)(`br`,{}),`此处显示详细信息`]})})]})]})}`${S.border}`,S.ink2,S.blue,S.ink3,`${S.border}`,S.surface,S.ink3;var pg={display:`inline-flex`,alignItems:`center`,gap:5,borderRadius:7,border:`1px solid ${S.border}`,background:`white`,color:S.ink2,cursor:`pointer`,fontSize:12.5,fontWeight:500,height:32,padding:`0 14px`},mg={display:`inline-flex`,alignItems:`center`,gap:5,borderRadius:7,border:`none`,background:S.blue,color:`white`,cursor:`pointer`,fontSize:12.5,fontWeight:600,height:32,padding:`0 14px`},hg={padding:`8px 14px`,fontSize:10.5,fontWeight:600,color:S.ink3,letterSpacing:`0.04em`,textTransform:`uppercase`},gg={width:26,height:26,borderRadius:5,border:`1px solid ${S.border}`,background:S.surface,color:S.ink3,cursor:`pointer`,display:`flex`,alignItems:`center`,justifyContent:`center`},_g=({title:e,action:t,padding:n=16,children:r})=>(0,w.jsxs)(`div`,{style:{background:S.surface,border:`1px solid ${S.border}`,borderRadius:10},children:[e&&(0,w.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,padding:`10px 16px`,borderBottom:`1px solid ${S.borderSoft}`},children:[(0,w.jsx)(`div`,{style:{fontSize:12.5,fontWeight:600,color:S.ink},children:e}),(0,w.jsx)(`div`,{style:{flex:1}}),t]}),(0,w.jsx)(`div`,{style:{padding:n},children:r})]});function vg(){let[e,t]=(0,b.useState)(`all`),[n,r]=(0,b.useState)([]);(0,b.useEffect)(()=>{fetch(`/api/v1/models`).then(e=>e.ok?e.json():null).then(e=>{e&&Array.isArray(e)&&e.length>0&&r(e)}).catch(()=>{})},[]);let i=n.filter(t=>e===`all`||(t.family||``).toLowerCase()===e);return(0,w.jsxs)(`div`,{style:{flex:1,display:`flex`,flexDirection:`column`,background:S.surfaceAlt,overflow:`hidden`},children:[(0,w.jsxs)(`div`,{style:{padding:`14px 24px`,background:S.surface,borderBottom:`1px solid ${S.border}`,flexShrink:0,display:`flex`,alignItems:`center`,gap:14},children:[(0,w.jsxs)(`div`,{children:[(0,w.jsx)(`div`,{style:{fontSize:17,fontWeight:700,color:S.ink,letterSpacing:`-0.01em`},children:`模型仓库`}),(0,w.jsxs)(`div`,{style:{fontSize:11.5,color:S.ink3,marginTop:3},children:[`本地已下载 `,(0,w.jsx)(`strong`,{className:`mono`,style:{color:S.ink2},children:n.length}),` 个 · 共计 `,(0,w.jsx)(`strong`,{className:`mono`,style:{color:S.ink2},children:`326 GB`}),` · 存储于 `,(0,w.jsx)(`span`,{className:`mono`,children:`/workspace/models`})]})]}),(0,w.jsx)(`div`,{style:{flex:1}}),(0,w.jsxs)(`button`,{className:`edge-press edge-btn-secondary`,style:pg,children:[(0,w.jsx)(D,{name:`cloud`,size:13,stroke:1.8}),`从 HuggingFace 同步`]}),(0,w.jsxs)(`button`,{className:`edge-press edge-btn-primary`,style:mg,children:[(0,w.jsx)(D,{name:`download`,size:13,stroke:2}),`拉取新模型`]})]}),(0,w.jsxs)(`div`,{style:{flex:1,overflow:`auto`,padding:24},children:[(0,w.jsx)(`div`,{style:{display:`flex`,gap:6,marginBottom:14,flexWrap:`wrap`},children:[`all`,`Llama`,`Qwen`,`DeepSeek`,`GLM`,`BGE`,`SD`,`Flux`,`Whisper`].map(r=>{let i=e===(r===`all`?`all`:r.toLowerCase()),a=r===`all`?n.length:n.filter(e=>e.family===r).length;return(0,w.jsxs)(`button`,{onClick:()=>t(r===`all`?`all`:r.toLowerCase()),disabled:a===0&&r!==`all`,style:{display:`flex`,alignItems:`center`,gap:4,padding:`5px 10px`,borderRadius:999,background:i?S.blue:S.surface,color:i?`white`:S.ink2,border:`1px solid ${i?S.blueDeep:S.border}`,fontSize:11.5,fontWeight:i?600:500,cursor:a===0&&r!==`all`?`not-allowed`:`pointer`,opacity:a===0&&r!==`all`?.5:1},children:[r===`all`?`全部`:r,` · `,a]},r)})}),(0,w.jsx)(_g,{padding:0,children:(0,w.jsxs)(`table`,{style:{width:`100%`,borderCollapse:`collapse`,fontSize:12.5},children:[(0,w.jsx)(`thead`,{children:(0,w.jsxs)(`tr`,{style:{background:`#fafbfc`,borderBottom:`1px solid ${S.borderSoft}`},children:[(0,w.jsx)(`th`,{style:{...hg,textAlign:`left`},children:`模型`}),(0,w.jsx)(`th`,{style:{...hg,textAlign:`left`},children:`家族`}),(0,w.jsx)(`th`,{style:{...hg,textAlign:`right`},children:`体积`}),(0,w.jsx)(`th`,{style:{...hg,textAlign:`left`},children:`格式`}),(0,w.jsx)(`th`,{style:{...hg,textAlign:`left`},children:`可用引擎`}),(0,w.jsx)(`th`,{style:{...hg,textAlign:`left`},children:`标签`}),(0,w.jsx)(`th`,{style:{...hg,textAlign:`right`},children:`添加于`}),(0,w.jsx)(`th`,{style:{...hg,textAlign:`right`}})]})}),(0,w.jsx)(`tbody`,{children:i.map((e,t)=>(0,w.jsxs)(`tr`,{style:{borderTop:`1px solid ${S.borderSoft}`},children:[(0,w.jsx)(`td`,{style:{padding:`10px 14px`},children:(0,w.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,gap:8},children:[(0,w.jsx)(D,{name:`brain`,size:14,stroke:1.8,style:{color:S.violet}}),(0,w.jsx)(`span`,{style:{fontSize:12.5,color:S.ink,fontWeight:600},className:`mono`,children:e.name}),e.pinned&&(0,w.jsx)(`span`,{title:`常驻`,style:{color:S.amber},children:`★`})]})}),(0,w.jsx)(`td`,{style:{padding:`10px 14px`,color:S.ink2},children:e.family}),(0,w.jsx)(`td`,{style:{padding:`10px 14px`,textAlign:`right`,color:S.ink2},className:`mono tnum`,children:e.size}),(0,w.jsx)(`td`,{style:{padding:`10px 14px`},className:`mono`,children:(0,w.jsx)(`span`,{style:{background:S.surfaceAlt,padding:`1px 6px`,borderRadius:3,fontSize:11,color:S.ink3},children:e.format})}),(0,w.jsx)(`td`,{style:{padding:`10px 14px`,fontSize:11.5,color:S.ink2},children:e.engine}),(0,w.jsx)(`td`,{style:{padding:`10px 14px`},children:(0,w.jsx)(`div`,{style:{display:`flex`,gap:4,flexWrap:`wrap`},children:e.tags.map(e=>(0,w.jsx)(`span`,{style:{fontSize:10,padding:`1px 5px`,borderRadius:3,background:e===`新`?`#fef2f2`:e===`Chat`?`#eff4ff`:e===`Image`?`#fdf2f8`:e===`Embedding`?`#f5f3ff`:S.surfaceAlt,color:e===`新`?S.red:e===`Chat`?S.blueDeep:e===`Image`?`#9d174d`:e===`Embedding`?`#5b21b6`:S.ink3,fontWeight:600},children:e},e))})}),(0,w.jsx)(`td`,{style:{padding:`10px 14px`,textAlign:`right`,color:S.ink3,fontSize:11.5},className:`mono`,children:e.added}),(0,w.jsx)(`td`,{style:{padding:`10px 14px`,textAlign:`right`},children:(0,w.jsxs)(`div`,{style:{display:`flex`,justifyContent:`flex-end`,gap:4},children:[(0,w.jsx)(`button`,{style:gg,title:`复制路径`,children:(0,w.jsx)(D,{name:`copy`,size:12,stroke:1.8})}),(0,w.jsx)(`button`,{style:gg,title:`加载到 vLLM`,children:(0,w.jsx)(D,{name:`play`,size:12,stroke:1.8})})]})})]},e.name))})]})})]})]})}var yg={padding:`8px 14px`,fontSize:10.5,fontWeight:600,color:S.ink3,letterSpacing:`0.04em`,textTransform:`uppercase`},bg={padding:`10px 14px`,fontSize:12.5,color:S.ink},xg={height:32,padding:`0 10px`,borderRadius:6,border:`1px solid ${S.border}`,background:S.surface,fontSize:12.5,color:S.ink,outline:`none`};function Sg(e){let t={R:{bg:`#dcfce7`,fg:`#047857`},S:{bg:`#e0f2fe`,fg:`#0369a1`},D:{bg:`#fef3c7`,fg:`#a16207`},Z:{bg:`#fee2e2`,fg:`#991b1b`},T:{bg:`#f3e8ff`,fg:`#7c2d12`},I:{bg:`#e0e7ff`,fg:`#3730a3`},X:{bg:`#fecaca`,fg:`#7f1d1d`},t:{bg:`#f3e8ff`,fg:`#7c2d12`},P:{bg:`#fef3c7`,fg:`#a16207`}}[(e||``).charAt(0)]||{bg:S.surfaceAlt,fg:S.ink3};return{display:`inline-block`,padding:`1px 6px`,borderRadius:3,fontSize:10.5,fontWeight:600,color:t.fg,background:t.bg}}function Cg(e){return!e||e<0?`-`:e>=1024*1024*1024?(e/(1024*1024*1024)).toFixed(1)+` GB`:e>=1024*1024?(e/(1024*1024)).toFixed(1)+` MB`:e>=1024?(e/1024).toFixed(0)+` KB`:e+` B`}function wg(){let[e,t]=(0,b.useState)([]),[n,r]=(0,b.useState)(!0),[i,a]=(0,b.useState)(null),[o,s]=(0,b.useState)({state:``,pid:``,name:``,user:``});(0,b.useEffect)(()=>{let e=!1;function n(){X(`/api/v1/processes`).then(e=>e.ok?e.json():null).then(n=>{!e&&Array.isArray(n)&&t(n)}).catch(()=>{}).finally(()=>{e||r(!1)})}n();let i=setInterval(n,1e4);return()=>{e=!0,clearInterval(i)}},[]);let c=e.filter(e=>!(o.state&&!e.state?.toLowerCase().includes(o.state.toLowerCase())||o.pid&&!String(e.pid).includes(o.pid)||o.name&&!(e.name||``).toLowerCase().includes(o.name.toLowerCase())||o.user&&!(e.user||``).toLowerCase().includes(o.user.toLowerCase())));return(0,w.jsxs)(`div`,{style:{flex:1,display:`flex`,flexDirection:`column`,background:S.surfaceAlt,overflow:`hidden`,position:`relative`},children:[(0,w.jsxs)(`div`,{style:{padding:`14px 24px`,background:S.surface,borderBottom:`1px solid ${S.border}`,flexShrink:0},children:[(0,w.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,gap:12},children:[(0,w.jsxs)(`div`,{children:[(0,w.jsx)(`div`,{style:{fontSize:17,fontWeight:700,color:S.ink,letterSpacing:`-0.01em`},children:`进程管理`}),(0,w.jsx)(`div`,{style:{fontSize:11.5,color:S.ink3,marginTop:3},children:`宿主进程列表 · 只读 · 离线可用 · 不可结束进程`})]}),(0,w.jsx)(`div`,{style:{flex:1}}),(0,w.jsxs)(`div`,{style:{fontSize:11.5,color:S.ink3},children:[`共 `,(0,w.jsx)(`span`,{className:`mono tnum`,style:{color:S.ink,fontWeight:700},children:c.length}),c.length!==e.length&&(0,w.jsxs)(`span`,{children:[` / `,e.length]}),(0,w.jsx)(`span`,{children:` 个`})]})]}),(0,w.jsxs)(`div`,{style:{display:`flex`,gap:8,marginTop:12},children:[(0,w.jsx)(`input`,{style:{...xg,width:110},placeholder:`状态 (R/S/D/Z/T)`,value:o.state,onChange:e=>s({...o,state:e.target.value})}),(0,w.jsx)(`input`,{style:{...xg,width:100},placeholder:`PID`,value:o.pid,onChange:e=>s({...o,pid:e.target.value})}),(0,w.jsx)(`input`,{style:{...xg,width:200},placeholder:`进程名`,value:o.name,onChange:e=>s({...o,name:e.target.value})}),(0,w.jsx)(`input`,{style:{...xg,width:130},placeholder:`用户`,value:o.user,onChange:e=>s({...o,user:e.target.value})})]})]}),(0,w.jsx)(`div`,{style:{flex:1,overflow:`auto`,padding:16},children:(0,w.jsx)(`div`,{style:{background:S.surface,border:`1px solid ${S.border}`,borderRadius:8},children:(0,w.jsxs)(`table`,{style:{width:`100%`,borderCollapse:`collapse`,fontSize:12.5},children:[(0,w.jsx)(`thead`,{children:(0,w.jsxs)(`tr`,{style:{background:`#fafbfc`},children:[(0,w.jsx)(`th`,{style:{...yg,textAlign:`right`,width:80},children:`PID`}),(0,w.jsx)(`th`,{style:{...yg,textAlign:`left`},children:`进程`}),(0,w.jsx)(`th`,{style:{...yg,textAlign:`center`,width:70},children:`状态`}),(0,w.jsx)(`th`,{style:{...yg,textAlign:`left`,width:100},children:`用户`}),(0,w.jsx)(`th`,{style:{...yg,textAlign:`right`,width:100},children:`内存`}),(0,w.jsx)(`th`,{style:{...yg,textAlign:`left`},children:`命令行`})]})}),(0,w.jsxs)(`tbody`,{children:[n&&(0,w.jsx)(`tr`,{children:(0,w.jsx)(`td`,{colSpan:6,style:{padding:24,textAlign:`center`,color:S.ink3},children:`加载中...`})}),!n&&c.length===0&&(0,w.jsx)(`tr`,{children:(0,w.jsx)(`td`,{colSpan:6,style:{padding:24,textAlign:`center`,color:S.ink3},children:`无匹配进程`})}),!n&&c.map((e,t)=>(0,w.jsxs)(`tr`,{"data-action":`view-detail`,onClick:()=>a(e.pid),className:i===e.pid?void 0:`edge-row-hover`,style:{borderTop:t?`1px solid ${S.borderSoft}`:`none`,cursor:`pointer`,background:i===e.pid?S.blueSoft:`transparent`,"--edge-row-hover-bg":S.surfaceAlt},children:[(0,w.jsx)(`td`,{style:{...bg,textAlign:`right`,fontFamily:`ui-monospace, monospace`},children:e.pid}),(0,w.jsxs)(`td`,{style:bg,children:[(0,w.jsx)(`div`,{style:{fontWeight:600},children:e.name||`-`}),e.ppid>0&&(0,w.jsxs)(`div`,{style:{fontSize:10.5,color:S.ink4,marginTop:1},children:[`PPID `,e.ppid]})]}),(0,w.jsx)(`td`,{style:{...bg,textAlign:`center`},children:(0,w.jsx)(`span`,{style:Sg(e.state),children:(e.state||`?`).charAt(0)})}),(0,w.jsx)(`td`,{style:{...bg,fontFamily:`ui-monospace, monospace`,fontSize:11.5},children:e.user||`-`}),(0,w.jsx)(`td`,{style:{...bg,textAlign:`right`,fontFamily:`ui-monospace, monospace`},children:Cg(e.memBytes)}),(0,w.jsx)(`td`,{style:{...bg,fontFamily:`ui-monospace, monospace`,fontSize:11.5,color:S.ink2,maxWidth:400,overflow:`hidden`,textOverflow:`ellipsis`,whiteSpace:`nowrap`},children:e.cmdline||`-`})]},e.pid))]})]})})}),i&&(0,w.jsx)(Eg,{pid:i,onClose:()=>a(null)})]})}var Tg=[{id:`basic`,label:`基础`},{id:`memory`,label:`内存`},{id:`fdList`,label:`FD`},{id:`env`,label:`Env`},{id:`netConns`,label:`网络`}];function Eg({pid:e,onClose:t}){let[n,r]=(0,b.useState)(null),[i,a]=(0,b.useState)(`basic`),[o,s]=(0,b.useState)(null);return(0,b.useEffect)(()=>{r(null),s(null);let t=new AbortController;return X(`/api/v1/processes/`+e,{signal:t.signal}).then(async e=>e.ok?e.json():e.status===404?(s(`进程已退出`),null):(s(`获取详情失败`),null)).then(e=>{e&&r(e)}).catch(e=>{e.name!==`AbortError`&&s(`网络错误`)}),()=>t.abort()},[e]),(0,w.jsxs)(w.Fragment,{children:[(0,w.jsx)(`div`,{"data-action":`close-drawer`,onClick:t,style:{position:`absolute`,inset:0,background:`rgba(15,23,42,0.2)`,zIndex:5}}),(0,w.jsxs)(`div`,{style:{position:`absolute`,top:0,right:0,bottom:0,width:560,background:S.surface,borderLeft:`1px solid ${S.border}`,boxShadow:`-8px 0 24px rgba(15,23,42,0.06)`,zIndex:6,display:`flex`,flexDirection:`column`,overflow:`hidden`},children:[(0,w.jsxs)(`div`,{style:{padding:`14px 20px`,borderBottom:`1px solid ${S.border}`,display:`flex`,alignItems:`center`,gap:10},children:[(0,w.jsxs)(`div`,{style:{flex:1},children:[(0,w.jsxs)(`div`,{style:{fontSize:15,fontWeight:700,color:S.ink},children:[`进程 #`,e,n?.basic?.name&&(0,w.jsx)(`span`,{style:{marginLeft:8,fontSize:12,fontWeight:500,color:S.ink3},children:n.basic.name})]}),(0,w.jsx)(`div`,{style:{fontSize:10.5,color:S.ink4,marginTop:2},children:`只读视图 · 不可结束`})]}),(0,w.jsx)(`button`,{"data-action":`close-drawer`,onClick:t,style:{width:28,height:28,borderRadius:5,border:`1px solid ${S.border}`,background:S.surface,cursor:`pointer`,display:`flex`,alignItems:`center`,justifyContent:`center`},children:(0,w.jsx)(D,{name:`x`,size:14,stroke:2})})]}),(0,w.jsx)(Zf,{tabs:Tg,active:i,onChange:a,itemAs:`button`,inactiveTextColor:S.ink2,style:{borderBottom:`1px solid ${S.border}`,background:S.surfaceAlt},itemStyle:{padding:`10px 16px`,fontSize:12},getItemProps:()=>({"data-action":`switch-tab`})}),(0,w.jsxs)(`div`,{style:{flex:1,overflow:`auto`,padding:16},children:[o&&(0,w.jsx)(`div`,{style:{color:S.red,fontSize:12},children:o}),!n&&!o&&(0,w.jsx)(`div`,{style:{color:S.ink3,fontSize:12},children:`加载中...`}),n&&i===`basic`&&(0,w.jsx)(Dg,{basic:n.basic}),n&&i===`memory`&&(0,w.jsx)(kg,{data:n.memory}),n&&i===`fdList`&&(0,w.jsx)(Ag,{list:n.fdList}),n&&i===`env`&&(0,w.jsx)(jg,{list:n.env}),n&&i===`netConns`&&(0,w.jsx)(Mg,{list:n.netConns})]})]})]})}function Dg({basic:e}){return(0,w.jsx)(Og,{rows:[[`PID`,e.pid],[`进程名`,e.name],[`PPID`,e.ppid],[`线程数`,e.threads],[`用户`,e.user],[`状态`,e.state],[`内存 (VmRSS)`,Cg(e.memBytes)],[`启动时间`,e.startTime||`-`],[`命令行`,e.cmdline||`-`]]})}function Og({rows:e}){return(0,w.jsx)(`table`,{style:{width:`100%`,fontSize:12,borderCollapse:`collapse`},children:(0,w.jsx)(`tbody`,{children:e.map(([e,t])=>(0,w.jsxs)(`tr`,{style:{borderBottom:`1px solid ${S.borderSoft}`},children:[(0,w.jsx)(`td`,{style:{padding:`8px 0`,color:S.ink3,fontSize:11.5,width:120},children:e}),(0,w.jsx)(`td`,{style:{padding:`8px 0`,color:S.ink,fontFamily:`ui-monospace, monospace`,wordBreak:`break-all`},children:t??`-`})]},e))})})}function kg({data:e}){let t=Object.entries(e||{});return t.length===0?(0,w.jsx)(`div`,{style:{color:S.ink3,fontSize:12},children:`无数据(权限不足 / 字段缺失)`}):(0,w.jsx)(`table`,{style:{width:`100%`,fontSize:12,borderCollapse:`collapse`},children:(0,w.jsx)(`tbody`,{children:t.map(([e,t])=>(0,w.jsxs)(`tr`,{style:{borderBottom:`1px solid ${S.borderSoft}`},children:[(0,w.jsx)(`td`,{style:{padding:`6px 0`,color:S.ink3,fontSize:11.5,width:140},children:e}),(0,w.jsx)(`td`,{style:{padding:`6px 0`,color:S.ink,fontFamily:`ui-monospace, monospace`},children:t})]},e))})})}function Ag({list:e}){return!e||e.length===0?(0,w.jsx)(`div`,{style:{color:S.ink3,fontSize:12},children:`无 FD(权限不足或进程无打开文件)`}):(0,w.jsxs)(`table`,{style:{width:`100%`,fontSize:11.5,borderCollapse:`collapse`,fontFamily:`ui-monospace, monospace`},children:[(0,w.jsx)(`thead`,{children:(0,w.jsxs)(`tr`,{style:{background:S.surfaceAlt,borderBottom:`1px solid ${S.border}`},children:[(0,w.jsx)(`th`,{style:{...yg,textAlign:`right`,width:50},children:`FD`}),(0,w.jsx)(`th`,{style:{...yg,textAlign:`left`},children:`Target`})]})}),(0,w.jsx)(`tbody`,{children:e.map(e=>(0,w.jsxs)(`tr`,{style:{borderBottom:`1px solid ${S.borderSoft}`},children:[(0,w.jsx)(`td`,{style:{padding:`5px 8px`,textAlign:`right`,color:S.ink2},children:e.fd}),(0,w.jsx)(`td`,{style:{padding:`5px 8px`,color:S.ink,wordBreak:`break-all`},children:e.target})]},e.fd))})]})}function jg({list:e}){return!e||e.length===0?(0,w.jsx)(`div`,{style:{color:S.ink3,fontSize:12},children:`无 Env(权限不足或进程无环境变量)`}):(0,w.jsxs)(`table`,{style:{width:`100%`,fontSize:11.5,borderCollapse:`collapse`},children:[(0,w.jsx)(`thead`,{children:(0,w.jsxs)(`tr`,{style:{background:S.surfaceAlt,borderBottom:`1px solid ${S.border}`},children:[(0,w.jsx)(`th`,{style:{...yg,textAlign:`left`,width:160},children:`Name`}),(0,w.jsx)(`th`,{style:{...yg,textAlign:`left`},children:`Value`})]})}),(0,w.jsx)(`tbody`,{children:e.map((e,t)=>(0,w.jsxs)(`tr`,{style:{borderBottom:`1px solid ${S.borderSoft}`},children:[(0,w.jsx)(`td`,{style:{padding:`5px 8px`,color:S.ink2,fontFamily:`ui-monospace, monospace`},children:e.name}),(0,w.jsx)(`td`,{style:{padding:`5px 8px`,color:S.ink,fontFamily:`ui-monospace, monospace`,wordBreak:`break-all`},children:e.value})]},t))})]})}function Mg({list:e}){return!e||e.length===0?(0,w.jsx)(`div`,{style:{color:S.ink3,fontSize:12},children:`无网络连接`}):(0,w.jsxs)(`table`,{style:{width:`100%`,fontSize:11.5,borderCollapse:`collapse`,fontFamily:`ui-monospace, monospace`},children:[(0,w.jsx)(`thead`,{children:(0,w.jsxs)(`tr`,{style:{background:S.surfaceAlt,borderBottom:`1px solid ${S.border}`},children:[(0,w.jsx)(`th`,{style:{...yg,textAlign:`left`,width:60},children:`类型`}),(0,w.jsx)(`th`,{style:{...yg,textAlign:`left`},children:`本地`}),(0,w.jsx)(`th`,{style:{...yg,textAlign:`left`},children:`远端`}),(0,w.jsx)(`th`,{style:{...yg,textAlign:`left`,width:100},children:`状态`})]})}),(0,w.jsx)(`tbody`,{children:e.map((e,t)=>(0,w.jsxs)(`tr`,{style:{borderBottom:`1px solid ${S.borderSoft}`},children:[(0,w.jsx)(`td`,{style:{padding:`5px 8px`,color:S.ink2},children:e.type}),(0,w.jsx)(`td`,{style:{padding:`5px 8px`,color:S.ink,wordBreak:`break-all`},children:e.local}),(0,w.jsx)(`td`,{style:{padding:`5px 8px`,color:S.ink,wordBreak:`break-all`},children:e.remote}),(0,w.jsx)(`td`,{style:{padding:`5px 8px`,color:S.ink2},children:e.state})]},t))})]})}function Ng(e){return e==null||e<0?`-`:e>=1024*1024*1024*1024?(e/(1024*1024*1024*1024)).toFixed(1)+` TB`:e>=1024*1024*1024?(e/(1024*1024*1024)).toFixed(1)+` GB`:e>=1024*1024?(e/(1024*1024)).toFixed(0)+` MB`:e+` B`}function Pg(e){return e==null?`-`:e<1024?e<1?`0 B/s`:e.toFixed(0)+` B/s`:e<1024*1024?(e/1024).toFixed(1)+` KB/s`:e<1024*1024*1024?(e/(1024*1024)).toFixed(1)+` MB/s`:(e/(1024*1024*1024)).toFixed(2)+` GB/s`}function Fg(e){return e==null?{fg:S.ink4,bg:S.surfaceAlt,ind:S.ink4}:e>=90?{fg:S.red,bg:`#fef2f2`,ind:S.red}:e>=70?{fg:S.amber,bg:`#fffbeb`,ind:S.amber}:{fg:`#059669`,bg:`#dcfce7`,ind:`#10b981`}}var Ig={padding:`8px 14px`,fontSize:10.5,fontWeight:600,color:S.ink3,letterSpacing:`0.04em`,textTransform:`uppercase`},Lg={padding:`10px 14px`,fontSize:12,color:S.ink};function Rg(){let[e,t]=(0,b.useState)([]),[n,r]=(0,b.useState)(null),[i,a]=(0,b.useState)(!0),[o,s]=(0,b.useState)(null),[c,l]=(0,b.useState)(`avg`),[u,d]=(0,b.useState)([]);(0,b.useEffect)(()=>{let e=!1;function n(t){e||r(t)}function i(){X(`/api/v1/disks`).then(async e=>{if(e.ok)return e.json();let t=null;try{t=await e.json()}catch{}return e.status===500&&t?.code===`LSBLK_UNAVAILABLE`?n(`节点未安装 lsblk,无法读取磁盘信息`):n(`磁盘信息读取失败`),null}).then(n=>{!e&&Array.isArray(n)&&(t(n),r(null))}).catch(()=>{n(`磁盘信息读取失败(网络错误)`)}).finally(()=>{e||a(!1)})}i();let o=setInterval(i,3e4);return()=>{e=!0,clearInterval(o)}},[]),(0,b.useEffect)(()=>{let e=!1;function t(){X(`/api/v1/disks/io`).then(e=>e.ok?e.json():null).then(t=>{e||!t||(s(t),d(e=>{let n={},r=0,i=0,a=[];(t.devices||[]).forEach(e=>{let t=e.device.replace(/^\/dev\//,``);n[t]={read:e.readBps,write:e.writeBps,util:e.utilPct},e.physical&&(r+=e.readBps,i+=e.writeBps,a.push(e.utilPct))});let o=a.length||1,s={t:Date.now(),dev:n,agg:{read:r/o,write:i/o,util:a.reduce((e,t)=>e+t,0)/o}},c=[...e,s];return c.length>60?c.slice(c.length-60):c}))}).catch(()=>{})}t();let n=setInterval(t,3e3);return()=>{e=!0,clearInterval(n)}},[]);let f={};(o?.devices||[]).forEach(e=>{f[e.device.replace(/^\/dev\//,``)]=e});let p=(o?.devices||[]).filter(e=>e.physical),m=p.length||1,h={readBps:p.reduce((e,t)=>e+t.readBps,0)/m,writeBps:p.reduce((e,t)=>e+t.writeBps,0)/m,utilPct:p.reduce((e,t)=>e+t.utilPct,0)/m},g=c,_=g===`avg`?null:e.find(e=>(e.device||``).replace(/^\/dev\//,``)===g),v=u.map(e=>({t:e.t,read:g===`avg`?e.agg.read:e.dev[g]?.read??0,write:g===`avg`?e.agg.write:e.dev[g]?.write??0}));return(0,w.jsxs)(`div`,{style:{flex:1,display:`flex`,flexDirection:`column`,background:S.surfaceAlt,overflow:`hidden`},children:[(0,w.jsx)(`div`,{style:{padding:`14px 24px`,background:S.surface,borderBottom:`1px solid ${S.border}`,flexShrink:0},children:(0,w.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,gap:12},children:[(0,w.jsxs)(`div`,{children:[(0,w.jsx)(`div`,{style:{fontSize:17,fontWeight:700,color:S.ink,letterSpacing:`-0.01em`},children:`磁盘管理`}),(0,w.jsx)(`div`,{style:{fontSize:11.5,color:S.ink3,marginTop:3},children:`本地 lsblk + df + /proc/mounts · 只读 · 离线可用 · 不可分区 / 卸载 / 格式化`})]}),(0,w.jsx)(`div`,{style:{flex:1}}),e.length>0&&(0,w.jsxs)(`div`,{style:{fontSize:11.5,color:S.ink3},children:[`共 `,(0,w.jsx)(`span`,{className:`mono tnum`,style:{color:S.ink,fontWeight:700},children:e.length}),` 块磁盘`]})]})}),(0,w.jsxs)(`div`,{style:{flex:1,overflow:`auto`,padding:16},children:[i&&(0,w.jsx)(`div`,{style:{color:S.ink3,fontSize:12},children:`加载中...`}),n&&(0,w.jsx)(`div`,{style:{padding:`10px 14px`,borderRadius:6,background:`#fef2f2`,border:`1px solid #fecaca`,color:`#991b1b`,fontSize:12,marginBottom:14},children:n}),!i&&e.length===0&&!n&&(0,w.jsx)(`div`,{style:{color:S.ink3,fontSize:12},children:`未检测到磁盘`}),e.length>0&&(0,w.jsxs)(`div`,{style:{display:`flex`,gap:12,marginBottom:14},children:[(0,w.jsx)(zg,{aggregate:!0,io:h,count:p.length,active:g===`avg`,onClick:()=>l(`avg`)}),e.map(e=>{let t=(e.device||``).replace(/^\/dev\//,``);return(0,w.jsx)(zg,{disk:e,io:f[t],active:t===g,onClick:()=>l(t)},e.device)})]}),e.length>0&&(0,w.jsxs)(w.Fragment,{children:[(0,w.jsx)(Hg,{series:v,title:g===`avg`?`全部磁盘(平均)`:`/dev/`+g,sampleMs:o?.sampleMs}),_&&(0,w.jsx)(Kg,{disk:_,io:f[(_.device||``).replace(/^\/dev\//,``)]}),(0,w.jsx)(Wg,{io:o})]})]})]})}function zg({disk:e,io:t,aggregate:n,count:r,active:i,onClick:a}){let o=n?`平均`:(e.device||``).replace(/^\/dev\//,``),s=n?`${r} 块物理盘`:`${e.rotational?`HDD`:`SSD`} · ${Ng(e.sizeBytes)}`,c=t?.utilPct??0,l=i?{bg:`#1e2433`,border:`#1e2433`,ink:`#fff`,ink3:`rgba(255,255,255,0.55)`,barBg:`rgba(255,255,255,0.18)`,bar:`#fff`,read:`#6ee7b7`,write:`#fcd34d`}:{bg:S.surface,border:S.border,ink:S.ink,ink3:S.ink3,barBg:S.surfaceAlt,bar:c>=80?S.red:c>=40?S.amber:`#10b981`,read:`#059669`,write:`#d97706`};return(0,w.jsxs)(`div`,{onClick:a,"data-action":`view-detail`,style:{flex:1,minWidth:0,cursor:`pointer`,userSelect:`none`,background:l.bg,border:`1px solid ${l.border}`,borderRadius:8,padding:`12px 14px`,boxShadow:i?`0 2px 8px rgba(15,23,42,0.25)`:`none`,transition:`background 0.15s, box-shadow 0.15s`},children:[(0,w.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,gap:7},children:[(0,w.jsx)(D,{name:n?`zap`:`hardDrive`,size:15,stroke:1.8,style:{color:l.ink3}}),(0,w.jsx)(`span`,{className:`mono`,style:{fontSize:12.5,fontWeight:700,color:l.ink},children:o}),(0,w.jsx)(`div`,{style:{flex:1}}),(0,w.jsx)(`span`,{style:{fontSize:10.5,color:l.ink3},children:s})]}),(0,w.jsxs)(`div`,{style:{display:`flex`,alignItems:`baseline`,gap:10,marginTop:8,marginBottom:9},children:[(0,w.jsxs)(`span`,{className:`mono tnum`,style:{fontSize:16,fontWeight:700,color:l.read},children:[`↓ `,Pg(t?.readBps)]}),(0,w.jsxs)(`span`,{className:`mono tnum`,style:{fontSize:16,fontWeight:700,color:l.write},children:[`↑ `,Pg(t?.writeBps)]})]}),(0,w.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,gap:8},children:[(0,w.jsx)(`div`,{style:{flex:1,height:5,borderRadius:3,background:l.barBg,overflow:`hidden`},children:(0,w.jsx)(`div`,{style:{width:Math.min(c,100)+`%`,height:`100%`,background:l.bar,transition:`width 0.3s`}})}),(0,w.jsxs)(`span`,{className:`mono tnum`,title:`采样窗口内设备忙的时间占比 (iostat %util)`,style:{fontSize:10,color:l.ink3,minWidth:46,textAlign:`right`},children:[`util `,c.toFixed(0),`%`]})]})]})}var Bg=`#10b981`,Vg=`#f59e0b`;function Hg({series:e,title:t,sampleMs:n}){let r=(e||[]).filter(Boolean),i=r.length,a=0;r.forEach(e=>{a=Math.max(a,e.read,e.write)});let o=a>0?a*1.2:1024,s=e=>i<=1?0:e/(i-1)*100,c=e=>100-e/o*100,l=e=>r.map((t,n)=>`${s(n).toFixed(2)},${c(t[e]).toFixed(2)}`).join(` `),u=e=>i===0?``:`M ${s(0).toFixed(2)},100 `+r.map((t,n)=>`L ${s(n).toFixed(2)},${c(t[e]).toFixed(2)}`).join(` `)+` L ${s(i-1).toFixed(2)},100 Z`,d=e=>new Date(e).toLocaleTimeString(`zh-CN`,{hour12:!1});return(0,w.jsxs)(`div`,{style:{background:S.surface,border:`1px solid ${S.border}`,borderRadius:8,marginBottom:14,overflow:`hidden`},children:[(0,w.jsxs)(`div`,{style:{padding:`10px 16px`,borderBottom:`1px solid ${S.borderSoft}`,display:`flex`,alignItems:`center`,gap:10},children:[(0,w.jsx)(D,{name:`zap`,size:15,stroke:1.8,style:{color:S.ink2}}),(0,w.jsx)(`span`,{style:{fontSize:12.5,fontWeight:700,color:S.ink},children:`I/O 速率曲线`}),(0,w.jsx)(`span`,{className:`mono`,style:{fontSize:11,color:S.ink3},children:t}),(0,w.jsx)(`div`,{style:{flex:1}}),(0,w.jsx)(Ug,{color:Bg,label:`读`}),(0,w.jsx)(Ug,{color:Vg,label:`写`}),(0,w.jsxs)(`span`,{style:{fontSize:10.5,color:S.ink4},children:[((n||0)/1e3).toFixed(1),`s 窗口 · 3s 刷新`]})]}),i<2?(0,w.jsx)(`div`,{style:{padding:`28px 16px`,fontSize:11.5,color:S.ink4,textAlign:`center`},children:`采集中…(每 3 秒一个采样点)`}):(0,w.jsxs)(`div`,{style:{display:`flex`,padding:`12px 14px 6px`},children:[(0,w.jsxs)(`div`,{style:{width:62,flexShrink:0,height:150,position:`relative`,fontSize:10,color:S.ink4,textAlign:`right`,paddingRight:8},children:[(0,w.jsx)(`span`,{className:`mono tnum`,style:{position:`absolute`,top:-4,right:8},children:Pg(o)}),(0,w.jsx)(`span`,{className:`mono tnum`,style:{position:`absolute`,top:`50%`,right:8,transform:`translateY(-50%)`},children:Pg(o/2)}),(0,w.jsx)(`span`,{className:`mono tnum`,style:{position:`absolute`,bottom:-4,right:8},children:`0`})]}),(0,w.jsxs)(`div`,{style:{flex:1,minWidth:0},children:[(0,w.jsxs)(`svg`,{width:`100%`,height:`150`,viewBox:`0 0 100 100`,preserveAspectRatio:`none`,style:{display:`block`,overflow:`visible`},children:[[25,50,75].map(e=>(0,w.jsx)(`line`,{x1:`0`,y1:e,x2:`100`,y2:e,stroke:S.borderSoft,strokeWidth:`1`,vectorEffect:`non-scaling-stroke`},e)),(0,w.jsx)(`path`,{d:u(`write`),fill:Vg,opacity:`0.10`}),(0,w.jsx)(`path`,{d:u(`read`),fill:Bg,opacity:`0.12`}),(0,w.jsx)(`polyline`,{points:l(`write`),fill:`none`,stroke:Vg,strokeWidth:`1.5`,vectorEffect:`non-scaling-stroke`,strokeLinejoin:`round`,strokeLinecap:`round`}),(0,w.jsx)(`polyline`,{points:l(`read`),fill:`none`,stroke:Bg,strokeWidth:`1.5`,vectorEffect:`non-scaling-stroke`,strokeLinejoin:`round`,strokeLinecap:`round`})]}),(0,w.jsxs)(`div`,{style:{display:`flex`,justifyContent:`space-between`,fontSize:10,color:S.ink4,marginTop:4},children:[(0,w.jsx)(`span`,{className:`mono tnum`,children:d(r[0].t)}),(0,w.jsx)(`span`,{className:`mono tnum`,children:d(r[Math.floor((i-1)/2)].t)}),(0,w.jsx)(`span`,{className:`mono tnum`,children:d(r[i-1].t)})]})]})]})]})}function Ug({color:e,label:t}){return(0,w.jsxs)(`span`,{style:{display:`inline-flex`,alignItems:`center`,gap:4,fontSize:10.5,color:S.ink3},children:[(0,w.jsx)(`span`,{style:{width:10,height:3,borderRadius:2,background:e}}),t]})}function Wg({io:e}){let[t,n]=(0,b.useState)(`total`),[r,i]=(0,b.useState)(`desc`);if(!e)return null;let a=[...e.processes||[]];function o(e){e===t?i(e=>e===`desc`?`asc`:`desc`):(n(e),i(e===`name`?`asc`:`desc`))}let s=e=>t===`read`?e.readBps:t===`write`?e.writeBps:t===`name`?e.name:e.readBps+e.writeBps;a.sort((e,t)=>{let n=s(e),i=s(t),a=typeof n==`string`?n.localeCompare(i):n-i;return r===`asc`?a:-a});let c=(e,n,i)=>(0,w.jsxs)(`th`,{onClick:()=>o(n),style:{...Ig,textAlign:i,cursor:`pointer`,userSelect:`none`,width:i===`right`?100:void 0},children:[e,(0,w.jsx)(`span`,{style:{marginLeft:4,color:t===n?S.ink2:`transparent`},children:t===n?r===`asc`?`▲`:`▼`:`▾`})]});return(0,w.jsxs)(`div`,{style:{background:S.surface,border:`1px solid ${S.border}`,borderRadius:8,marginBottom:14,overflow:`hidden`},children:[(0,w.jsxs)(`div`,{style:{padding:`10px 16px`,borderBottom:`1px solid ${S.borderSoft}`,display:`flex`,alignItems:`center`,gap:8},children:[(0,w.jsx)(D,{name:`cpu`,size:15,stroke:1.8,style:{color:S.ink2}}),(0,w.jsx)(`span`,{style:{fontSize:12.5,fontWeight:700,color:S.ink},children:`进程 I/O(iotop)`}),(0,w.jsx)(`span`,{style:{fontSize:10.5,color:S.ink4},children:`/proc//io 差分 · 系统全局 · 点击表头排序`})]}),e.processesAvailable?a.length===0?(0,w.jsx)(`div`,{style:{padding:`10px 16px`,fontSize:11.5,color:S.ink4},children:`采样窗口内无进程产生磁盘 I/O`}):(0,w.jsxs)(`table`,{style:{width:`100%`,borderCollapse:`collapse`,fontSize:12,tableLayout:`fixed`},children:[(0,w.jsx)(`thead`,{children:(0,w.jsxs)(`tr`,{style:{background:`#fafbfc`},children:[c(`进程`,`name`,`left`),c(`磁盘读`,`read`,`right`),c(`磁盘写`,`write`,`right`)]})}),(0,w.jsx)(`tbody`,{children:a.map((e,t)=>(0,w.jsxs)(`tr`,{style:{borderTop:t?`1px solid ${S.borderSoft}`:`none`},children:[(0,w.jsxs)(`td`,{style:{...Lg,overflow:`hidden`},title:e.cmdline,children:[(0,w.jsxs)(`div`,{style:{display:`flex`,alignItems:`baseline`,gap:6},children:[(0,w.jsx)(`span`,{style:{fontWeight:600},children:e.name}),(0,w.jsxs)(`span`,{className:`mono tnum`,style:{fontSize:10.5,color:S.ink4},children:[e.pid,e.user?` · `+e.user:``]})]}),e.cmdline&&e.cmdline!==e.name&&(0,w.jsx)(`div`,{className:`mono`,style:{fontSize:10.5,color:S.ink4,marginTop:1,whiteSpace:`nowrap`,overflow:`hidden`,textOverflow:`ellipsis`},children:e.cmdline})]}),(0,w.jsx)(`td`,{className:`mono tnum`,style:{...Lg,textAlign:`right`,verticalAlign:`top`,color:e.readBps>0?`#059669`:S.ink4},children:Pg(e.readBps)}),(0,w.jsx)(`td`,{className:`mono tnum`,style:{...Lg,textAlign:`right`,verticalAlign:`top`,color:e.writeBps>0?`#d97706`:S.ink4},children:Pg(e.writeBps)})]},e.pid))})]}):(0,w.jsx)(`div`,{style:{padding:`10px 16px`,fontSize:11.5,color:S.ink4},children:`进程级 I/O 需要 root 权限读取 /proc//io,当前不可用`})]})}function Gg({pct:e}){if(e==null)return null;let t=e>=80?{bg:`#fef2f2`,fg:S.red}:e>=40?{bg:`#fffbeb`,fg:S.amber}:{bg:S.surfaceAlt,fg:S.ink4};return(0,w.jsxs)(`span`,{className:`mono tnum`,title:`采样窗口内设备忙的时间占比 (iostat %util)`,style:{padding:`1px 6px`,borderRadius:3,fontSize:10,fontWeight:600,background:t.bg,color:t.fg},children:[`util `,e.toFixed(0),`%`]})}function Kg({disk:e,io:t}){return(0,w.jsxs)(`div`,{style:{background:S.surface,border:`1px solid ${S.border}`,borderRadius:8,marginBottom:14,overflow:`hidden`},children:[(0,w.jsxs)(`div`,{style:{padding:`12px 16px`,borderBottom:`1px solid ${S.borderSoft}`,display:`flex`,alignItems:`center`,gap:12},children:[(0,w.jsx)(`div`,{style:{width:36,height:36,borderRadius:6,background:S.surfaceAlt,border:`1px solid ${S.border}`,display:`flex`,alignItems:`center`,justifyContent:`center`},children:(0,w.jsx)(D,{name:`hardDrive`,size:18,stroke:1.8,style:{color:S.ink2}})}),(0,w.jsxs)(`div`,{children:[(0,w.jsx)(`div`,{style:{fontSize:14,fontWeight:700,color:S.ink,fontFamily:`ui-monospace, monospace`},children:e.device?.startsWith(`/dev/`)?e.device:`/dev/`+e.device}),(0,w.jsxs)(`div`,{style:{fontSize:11,color:S.ink3,marginTop:2},children:[(0,w.jsx)(`span`,{style:{display:`inline-block`,padding:`1px 6px`,borderRadius:3,background:S.blueSoft,color:S.blueDeep,fontWeight:600,marginRight:6},children:e.type}),(0,w.jsx)(`span`,{children:e.model||`未知型号`}),e.serial&&(0,w.jsxs)(`span`,{style:{marginLeft:8,color:S.ink4,fontFamily:`ui-monospace, monospace`},children:[`S/N: `,e.serial]})]})]}),(0,w.jsx)(`div`,{style:{flex:1}}),t&&(0,w.jsxs)(`div`,{style:{textAlign:`right`,marginRight:18},children:[(0,w.jsxs)(`div`,{style:{display:`flex`,gap:10,justifyContent:`flex-end`,alignItems:`center`},children:[(0,w.jsxs)(`span`,{className:`mono tnum`,style:{fontSize:12,fontWeight:600,color:`#059669`},children:[`↓ `,Pg(t.readBps)]}),(0,w.jsxs)(`span`,{className:`mono tnum`,style:{fontSize:12,fontWeight:600,color:`#d97706`},children:[`↑ `,Pg(t.writeBps)]}),(0,w.jsx)(Gg,{pct:t.utilPct})]}),(0,w.jsx)(`div`,{style:{fontSize:10.5,color:S.ink4,marginTop:2},children:`实时 I/O`})]}),(0,w.jsxs)(`div`,{style:{textAlign:`right`},children:[(0,w.jsx)(`div`,{className:`mono tnum`,style:{fontSize:14,fontWeight:700,color:S.ink},children:Ng(e.sizeBytes)}),(0,w.jsx)(`div`,{style:{fontSize:10.5,color:S.ink4,marginTop:2},children:`容量`})]})]}),(0,w.jsxs)(`table`,{style:{width:`100%`,borderCollapse:`collapse`,fontSize:12},children:[(0,w.jsx)(`thead`,{children:(0,w.jsxs)(`tr`,{style:{background:`#fafbfc`},children:[(0,w.jsx)(`th`,{style:{...Ig,textAlign:`left`},children:`分区`}),(0,w.jsx)(`th`,{style:{...Ig,textAlign:`right`,width:90},children:`容量`}),(0,w.jsx)(`th`,{style:{...Ig,textAlign:`left`,width:250},children:`使用情况`}),(0,w.jsx)(`th`,{style:{...Ig,textAlign:`left`},children:`挂载点`}),(0,w.jsx)(`th`,{style:{...Ig,textAlign:`left`,width:80},children:`文件系统`}),(0,w.jsx)(`th`,{style:{...Ig,textAlign:`left`},children:`挂载选项`})]})}),(0,w.jsxs)(`tbody`,{children:[(e.partitions||[]).map((e,t)=>(0,w.jsx)(Jg,{partition:e,idx:t},e.name)),(!e.partitions||e.partitions.length===0)&&(0,w.jsx)(`tr`,{children:(0,w.jsx)(`td`,{colSpan:6,style:{...Lg,color:S.ink3,textAlign:`center`,padding:16},children:`无分区`})})]})]})]})}var qg={LVM2_member:{label:`LVM PV`,tip:`该分区是 LVM 物理卷,承载下方逻辑卷的数据`},crypto_LUKS:{label:`LUKS`,tip:`该分区是 LUKS 加密容器,解密后挂载在下方设备上`},linux_raid_member:{label:`RAID 成员`,tip:`该分区是 mdadm RAID 阵列的成员盘,阵列在下方设备上`}};function Jg({partition:e,idx:t}){let n=Fg(e.usagePct),r=!e.mountPoint&&qg[e.fsType],i=!e.mountPoint&&!r,a=!!e.parent;return(0,w.jsxs)(`tr`,{style:{borderTop:t?`1px solid ${S.borderSoft}`:`none`},children:[(0,w.jsxs)(`td`,{style:{...Lg,fontFamily:`ui-monospace, monospace`},children:[a&&(0,w.jsx)(`span`,{style:{color:S.ink4,marginRight:4},children:`└─`}),e.name]}),(0,w.jsx)(`td`,{style:{...Lg,textAlign:`right`,fontFamily:`ui-monospace, monospace`},children:Ng(e.sizeBytes)}),(0,w.jsx)(`td`,{style:Lg,children:r?(0,w.jsx)(`span`,{title:r.tip,style:{display:`inline-block`,padding:`1px 7px`,borderRadius:3,background:`#dbeafe`,color:`#1e40af`,fontSize:11,fontWeight:600},children:r.label}):i?(0,w.jsx)(`span`,{title:`该分区未挂载到任何路径,df 不报告使用率`,style:{color:S.ink4,fontSize:11.5},children:`未挂载`}):e.usagePct==null?(0,w.jsx)(`span`,{title:`df 读取失败 / 不可用`,style:{color:S.ink4},children:`—`}):(0,w.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,gap:8},children:[(0,w.jsx)(`div`,{style:{flex:1,height:6,borderRadius:3,background:n.bg,overflow:`hidden`},children:(0,w.jsx)(`div`,{style:{width:e.usagePct+`%`,height:`100%`,background:n.ind}})}),(0,w.jsxs)(`span`,{className:`mono tnum`,style:{fontSize:11,color:n.fg,fontWeight:600,minWidth:40},children:[Number(e.usagePct).toFixed(1),`%`]})]})}),(0,w.jsxs)(`td`,{style:{...Lg,fontFamily:`ui-monospace, monospace`},children:[e.mountPoint||(0,w.jsx)(`span`,{style:{color:S.ink4},children:`—`}),e.isSystemDisk&&(0,w.jsx)(`span`,{style:{marginLeft:6,padding:`1px 6px`,borderRadius:3,background:`#b45309`,color:`white`,fontSize:10,fontWeight:600},title:`系统分区,谨慎操作`,children:`系统`})]}),(0,w.jsx)(`td`,{style:{...Lg,fontSize:11},children:e.fsType||`-`}),(0,w.jsx)(`td`,{style:{...Lg,fontSize:11,color:S.ink2},children:e.mountOptions&&e.mountOptions.length>0?e.mountOptions.slice(0,5).join(`, `)+(e.mountOptions.length>5?`...`:``):(0,w.jsx)(`span`,{style:{color:S.ink4},children:`—`})})]})}var Yg={padding:`8px 14px`,fontSize:10.5,fontWeight:600,color:S.ink3,letterSpacing:`0.04em`,textTransform:`uppercase`},Xg={padding:`8px 14px`,fontSize:12,color:S.ink,fontFamily:`ui-monospace, monospace`},Zg={height:30,padding:`0 10px`,borderRadius:6,border:`1px solid ${S.border}`,background:S.surface,fontSize:12,color:S.ink,outline:`none`};function Qg(e){return e===`LISTEN`?{bg:`#dcfce7`,fg:`#047857`}:e===`ESTABLISHED`?{bg:`#e0f2fe`,fg:`#0369a1`}:e===`TIME_WAIT`||e===`CLOSE_WAIT`||e===`FIN_WAIT1`||e===`FIN_WAIT2`?{bg:`#fef3c7`,fg:`#a16207`}:{bg:S.surfaceAlt,fg:S.ink3}}var $g=[`LISTEN`,`ESTABLISHED`,`TIME_WAIT`,`CLOSE_WAIT`,`FIN_WAIT1`,`FIN_WAIT2`,`SYN_SENT`,`SYN_RECV`,`CLOSE`,`CLOSING`,`LAST_ACK`];function e_(){let[e,t]=(0,b.useState)([]),[n,r]=(0,b.useState)(!0),[i,a]=(0,b.useState)(null),[o,s]=(0,b.useState)({stateFilter:`ALL`,pid:``,name:``,port:``});(0,b.useEffect)(()=>{let e=!1;function n(){X(`/api/v1/network/connections?limit=2000`).then(e=>e.ok?e.json():null).then(n=>{e||Array.isArray(n)&&(t(n),a(null))}).catch(()=>{e||a(`网络信息读取失败`)}).finally(()=>{e||r(!1)})}n();let i=setInterval(n,1e4);return()=>{e=!0,clearInterval(i)}},[]);let c=e.filter(e=>!(o.stateFilter!==`ALL`&&e.state!==o.stateFilter||o.pid&&!String(e.pid).includes(o.pid)||o.name&&!(e.processName||``).toLowerCase().includes(o.name.toLowerCase())||o.port&&!(e.local||``).includes(`:`+o.port)&&!(e.remote||``).includes(`:`+o.port)));return(0,w.jsxs)(`div`,{style:{flex:1,display:`flex`,flexDirection:`column`,background:S.surfaceAlt,overflow:`hidden`},children:[(0,w.jsxs)(`div`,{style:{padding:`14px 24px`,background:S.surface,borderBottom:`1px solid ${S.border}`,flexShrink:0},children:[(0,w.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,gap:12},children:[(0,w.jsxs)(`div`,{children:[(0,w.jsx)(`div`,{style:{fontSize:17,fontWeight:700,color:S.ink,letterSpacing:`-0.01em`},children:`网络连接`}),(0,w.jsx)(`div`,{style:{fontSize:11.5,color:S.ink3,marginTop:3},children:`全节点 socket 视图 · 只读 · 离线可用 · 不可关闭连接`})]}),(0,w.jsx)(`div`,{style:{flex:1}}),(0,w.jsxs)(`div`,{style:{fontSize:11.5,color:S.ink3},children:[`共 `,(0,w.jsx)(`span`,{className:`mono tnum`,style:{color:S.ink,fontWeight:700},children:c.length}),c.length!==e.length&&(0,w.jsxs)(`span`,{children:[` / `,e.length]}),(0,w.jsx)(`span`,{children:` 条`})]})]}),(0,w.jsxs)(`div`,{style:{display:`flex`,gap:8,marginTop:12,alignItems:`center`},children:[(0,w.jsxs)(`select`,{value:o.stateFilter,onChange:e=>s({...o,stateFilter:e.target.value}),style:{...Zg,width:130},children:[(0,w.jsx)(`option`,{value:`ALL`,children:`全部状态`}),$g.map(e=>(0,w.jsx)(`option`,{value:e,children:e},e))]}),(0,w.jsx)(`input`,{style:{...Zg,width:100},placeholder:`PID`,value:o.pid,onChange:e=>s({...o,pid:e.target.value})}),(0,w.jsx)(`input`,{style:{...Zg,width:160},placeholder:`进程名`,value:o.name,onChange:e=>s({...o,name:e.target.value})}),(0,w.jsx)(`input`,{style:{...Zg,width:100},placeholder:`端口`,value:o.port,onChange:e=>s({...o,port:e.target.value})})]})]}),(0,w.jsxs)(`div`,{style:{flex:1,overflow:`auto`,padding:16},children:[i&&(0,w.jsx)(`div`,{style:{padding:`10px 14px`,borderRadius:6,background:`#fef2f2`,border:`1px solid #fecaca`,color:`#991b1b`,fontSize:12,marginBottom:14},children:i}),(0,w.jsx)(`div`,{style:{background:S.surface,border:`1px solid ${S.border}`,borderRadius:8},children:(0,w.jsxs)(`table`,{style:{width:`100%`,borderCollapse:`collapse`,fontSize:12},children:[(0,w.jsx)(`thead`,{children:(0,w.jsxs)(`tr`,{style:{background:`#fafbfc`},children:[(0,w.jsx)(`th`,{style:{...Yg,textAlign:`left`,width:70},children:`类型`}),(0,w.jsx)(`th`,{style:{...Yg,textAlign:`left`,width:110},children:`状态`}),(0,w.jsx)(`th`,{style:{...Yg,textAlign:`left`},children:`本地`}),(0,w.jsx)(`th`,{style:{...Yg,textAlign:`left`},children:`远端`}),(0,w.jsx)(`th`,{style:{...Yg,textAlign:`right`,width:80},children:`PID`}),(0,w.jsx)(`th`,{style:{...Yg,textAlign:`left`,width:140},children:`进程`})]})}),(0,w.jsxs)(`tbody`,{children:[n&&(0,w.jsx)(`tr`,{children:(0,w.jsx)(`td`,{colSpan:6,style:{padding:24,textAlign:`center`,color:S.ink3},children:`加载中...`})}),!n&&c.length===0&&(0,w.jsx)(`tr`,{children:(0,w.jsx)(`td`,{colSpan:6,style:{padding:24,textAlign:`center`,color:S.ink3},children:`无匹配连接`})}),!n&&c.map((e,t)=>{let n=Qg(e.state);return(0,w.jsxs)(`tr`,{style:{borderTop:t?`1px solid ${S.borderSoft}`:`none`},children:[(0,w.jsx)(`td`,{style:Xg,children:e.type}),(0,w.jsx)(`td`,{style:Xg,children:(0,w.jsx)(`span`,{style:{display:`inline-block`,padding:`1px 6px`,borderRadius:3,fontSize:10.5,fontWeight:600,background:n.bg,color:n.fg},children:e.state})}),(0,w.jsx)(`td`,{style:{...Xg,wordBreak:`break-all`},children:e.local}),(0,w.jsx)(`td`,{style:{...Xg,wordBreak:`break-all`},children:e.remote}),(0,w.jsx)(`td`,{style:{...Xg,textAlign:`right`},children:e.pid||`-`}),(0,w.jsx)(`td`,{style:Xg,children:e.processName||`-`})]},t)})]})]})})]})]})}var t_={percent:e=>`${Math.round(e)}%`,bytesPerSec:e=>e==null||!isFinite(e)?`—`:e>=1024*1024?(e/(1024*1024)).toFixed(1)+` MB/s`:e>=1024?(e/1024).toFixed(1)+` KB/s`:Math.round(e)+` B/s`,celsius:e=>`${Math.round(e)}°C`,watts:e=>`${Math.round(e)} W`},n_={percent:32,celsius:36,watts:36,bytesPerSec:52};function r_(e){let t={"1h":60,"6h":360,"24h":1440}[e]||60,n=e=>e===0?`现在`:e<60?`-${e}m`:`-${Math.round(e/60)}h`;return[n(t),n(Math.round(t*2/3)),n(Math.round(t/3)),`现在`]}function i_(e){if(e.length<2)return``;if(e.length===2)return`M${e[0][0]} ${e[0][1]} L${e[1][0]} ${e[1][1]}`;let t=[`M${e[0][0]} ${e[0][1]}`];for(let n=0;n{if(!o.current)return;let e=o.current,t=()=>u(Math.max(60,Math.floor(e.clientWidth)));t();let n=new ResizeObserver(t);return n.observe(e),()=>n.disconnect()},[]);let p=t_[r]||(e=>String(Math.round(e))),m=t.length>0,h=m?t.reduce((e,t)=>e+t,0)/t.length:0,g=m?Math.max(...t):0,_=m&&!c.reduced&&!d,v=()=>{s.current||(s.current=!0,f(!0))},y=n_[r]||32,x=Math.max(1,l-y-4),C=m?Math.max(...t,1):1,T=a??(Math.ceil(C*1.1)||1),E=t.length>1?x/(t.length-1):0,D=t.map((e,t)=>[y+t*E,80-e/T*76]),O=D.length>0?i_(D):``,k=D.length>0?`${O} L ${y+x} 80 L ${y} 80 Z`:``,A=[0,T*.33,T*.66,T].map(e=>({v:e,y:80-e/T*76})),j=r_(i);return(0,w.jsxs)(`div`,{style:{background:S.surface,border:`1px solid ${S.border}`,borderRadius:10,padding:16},children:[(0,w.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,marginBottom:10},children:[(0,w.jsx)(`div`,{style:{fontSize:13,fontWeight:600,color:S.ink},children:e}),(0,w.jsx)(`div`,{style:{flex:1}}),(0,w.jsxs)(`div`,{style:{display:`flex`,gap:14,fontSize:11.5,color:S.ink3},children:[(0,w.jsxs)(`span`,{children:[`平均 `,(0,w.jsx)(`span`,{className:`mono tnum`,style:{color:S.ink,fontWeight:600},children:m?p(h):`—`})]}),(0,w.jsxs)(`span`,{children:[`峰值 `,(0,w.jsx)(`span`,{className:`mono tnum`,style:{color:S.ink,fontWeight:600},children:m?p(g):`—`})]})]})]}),(0,w.jsx)(`div`,{ref:o,style:{width:`100%`,height:84},children:m?(0,w.jsxs)(`svg`,{width:l,height:84,style:{display:`block`},children:[A.map((e,t)=>(0,w.jsx)(`line`,{x1:y,x2:y+x,y1:e.y,y2:e.y,stroke:`#e5e7eb`,strokeDasharray:`3 3`},`g-${t}`)),A.map((e,t)=>(0,w.jsx)(`text`,{x:y-4,y:e.y+3,textAnchor:`end`,fontSize:`9`,fill:`#9ca3af`,children:p(e.v)},`l-${t}`)),(0,w.jsx)(Hu.path,{d:k,fill:n,initial:_?{opacity:0}:!1,animate:{opacity:.2},transition:_?{duration:.2,delay:.6,ease:`easeOut`}:{duration:0},onAnimationComplete:v}),(0,w.jsx)(Hu.path,{d:O,fill:`none`,stroke:n,strokeWidth:`1.6`,strokeLinejoin:`round`,strokeLinecap:`round`,initial:_?{pathLength:0}:!1,animate:{pathLength:1},transition:_?{duration:.6,ease:`easeOut`}:{duration:0}})]}):(0,w.jsx)(`div`,{style:{height:84,display:`flex`,alignItems:`center`,justifyContent:`center`,fontSize:11.5,color:S.ink4},children:`暂无数据`})}),(0,w.jsx)(`div`,{style:{display:`flex`,justifyContent:`space-between`,fontSize:10.5,color:S.ink4,marginTop:4,paddingLeft:y},className:`mono`,children:j.map((e,t)=>(0,w.jsx)(`span`,{children:e},t))})]})}function o_(e,t){if(!e||e.length<2)return[];let n=[];for(let r=1;r0&&(a=e/1e3)}n.push(Math.max(0,i/a))}return n}function s_(e){let t=kd(),n=t?{Authorization:`Bearer `+t}:{};return fetch(e,{headers:n}).then(e=>e.ok?e.json():null).catch(()=>null)}function c_({label:e,value:t,max:n,pct:r,color:i,mono:a}){return(0,w.jsxs)(`div`,{children:[(0,w.jsxs)(`div`,{style:{display:`flex`,justifyContent:`space-between`,fontSize:11,color:S.ink3,marginBottom:4},children:[(0,w.jsx)(`span`,{children:e}),(0,w.jsx)(`span`,{className:`mono`,children:n})]}),(0,w.jsx)(`div`,{className:a?`mono tnum`:`tnum`,style:{...S.type.heading,color:S.ink,lineHeight:1,marginBottom:5},children:t}),(0,w.jsx)(`div`,{style:{height:4,borderRadius:2,background:`#f1f5f9`,overflow:`hidden`},children:(0,w.jsx)(`div`,{style:{width:`${Math.min(100,r)}%`,height:`100%`,background:i,borderRadius:2,transition:`width 0.4s ease`}})})]})}function l_({series:e,color:t}){if(!e||e.length<2)return(0,w.jsx)(`div`,{style:{height:18,fontSize:9,color:S.ink4,lineHeight:`18px`},children:`—`});let n=Math.min(...e),r=Math.max(...e)-n||1,i=e.map((t,i)=>{let a=i/(e.length-1)*140,o=17-(t-n)/r*16;return`${a.toFixed(1)},${o.toFixed(1)}`}).join(` `);return(0,w.jsx)(`svg`,{width:`100%`,height:18,viewBox:`0 0 140 18`,preserveAspectRatio:`none`,style:{display:`block`},children:(0,w.jsx)(`polyline`,{points:i,fill:`none`,stroke:t,strokeWidth:`1.4`,strokeLinejoin:`round`})})}function u_(e){return e==null||!isFinite(e)?`—`:e>=1024*1024?(e/(1024*1024)).toFixed(1)+` MB/s`:e>=1024?(e/1024).toFixed(1)+` KB/s`:Math.round(e)+` B/s`}function d_(e,t=1){return e==null||!isFinite(e)?`—`:e.toFixed(t)}function f_({disks:e}){let t=Array.isArray(e)?[...e]:[];if(!t.length)return null;t.sort((e,t)=>Number(t.rotational)-Number(e.rotational)||e.name.localeCompare(t.name));let n=({label:e,value:t,tone:n})=>(0,w.jsxs)(`div`,{style:{minHeight:52,padding:`8px 10px`,borderRadius:8,background:S.surfaceAlt,border:`1px solid ${S.borderSoft}`},children:[(0,w.jsx)(`div`,{style:{fontSize:10.5,color:S.ink3,marginBottom:5},children:e}),(0,w.jsx)(`div`,{className:`mono tnum`,style:{fontSize:14,fontWeight:700,color:n||S.ink},children:t})]});return(0,w.jsxs)(`div`,{style:{background:S.surface,border:`1px solid ${S.border}`,borderRadius:10,padding:16,marginBottom:12},children:[(0,w.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,marginBottom:12},children:[(0,w.jsx)(`div`,{style:{fontSize:13,fontWeight:600,color:S.ink},children:`物理磁盘 I/O`}),(0,w.jsx)(`div`,{style:{fontSize:11.5,color:S.ink3,marginLeft:10},children:`按块设备 · 吞吐 / IOPS / 忙碌度 / 延迟`})]}),(0,w.jsx)(`div`,{style:{display:`grid`,gridTemplateColumns:`repeat(auto-fit, minmax(360px, 1fr))`,gap:12},children:t.map(e=>{let t=Math.max(0,Math.min(100,e.utilPercent||0)),r=t>=85?S.red:t>=65?S.amber:S.green;return(0,w.jsxs)(`div`,{style:{border:`1px solid ${S.borderSoft}`,borderRadius:8,background:`#fff`,padding:12},children:[(0,w.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,gap:8,marginBottom:10},children:[(0,w.jsx)(`div`,{style:{width:30,height:30,borderRadius:7,background:e.rotational?`#fffbeb`:`#eff4ff`,color:e.rotational?S.amber:S.blue,border:`1px solid ${e.rotational?`#fde68a`:`#bfdbfe`}`,display:`flex`,alignItems:`center`,justifyContent:`center`},children:(0,w.jsx)(D,{name:`hardDrive`,size:15,stroke:1.8})}),(0,w.jsxs)(`div`,{style:{minWidth:0},children:[(0,w.jsxs)(`div`,{className:`mono`,style:{fontSize:13,fontWeight:700,color:S.ink},children:[e.path||`/dev/${e.name}`,(0,w.jsx)(`span`,{style:{marginLeft:7,padding:`1px 6px`,borderRadius:3,background:e.rotational?`#fffbeb`:`#eff4ff`,color:e.rotational?`#b45309`:S.blueDeep,border:`1px solid ${e.rotational?`#fde68a`:`#bfdbfe`}`,fontSize:10.5,fontFamily:`inherit`},children:e.kind||(e.rotational?`HDD`:`SSD`)})]}),(0,w.jsx)(`div`,{style:{fontSize:11,color:S.ink3,marginTop:2,whiteSpace:`nowrap`,overflow:`hidden`,textOverflow:`ellipsis`},children:e.model||`未知型号`})]}),(0,w.jsx)(`div`,{style:{flex:1}}),(0,w.jsxs)(`div`,{className:`mono tnum`,style:{fontSize:12,fontWeight:700,color:r},children:[d_(t,0),`%`]})]}),(0,w.jsx)(`div`,{style:{height:5,borderRadius:3,background:`#e5e7eb`,overflow:`hidden`,marginBottom:10},children:(0,w.jsx)(`div`,{style:{width:`${t}%`,height:`100%`,background:r,borderRadius:3}})}),(0,w.jsxs)(`div`,{style:{display:`grid`,gridTemplateColumns:`repeat(4, 1fr)`,gap:8},children:[(0,w.jsx)(n,{label:`读取`,value:u_(e.readBytesPerSec),tone:S.teal}),(0,w.jsx)(n,{label:`写入`,value:u_(e.writeBytesPerSec),tone:S.amber}),(0,w.jsx)(n,{label:`读 IOPS`,value:d_(e.readIops,1)}),(0,w.jsx)(n,{label:`写 IOPS`,value:d_(e.writeIops,1)}),(0,w.jsx)(n,{label:`平均等待`,value:`${d_(e.avgAwaitMs,1)} ms`,tone:e.avgAwaitMs>=50?S.red:S.ink}),(0,w.jsx)(n,{label:`读等待`,value:`${d_(e.readAwaitMs,1)} ms`}),(0,w.jsx)(n,{label:`写等待`,value:`${d_(e.writeAwaitMs,1)} ms`}),(0,w.jsx)(n,{label:`队列深度`,value:d_(e.avgQueueSize,2)})]})]},e.name)})})]})}function p_({cores:e}){let t=Array.isArray(e)?e:[];return t.length?(0,w.jsxs)(`div`,{style:{background:S.surface,border:`1px solid ${S.border}`,borderRadius:10,padding:16,marginBottom:12},children:[(0,w.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,marginBottom:12},children:[(0,w.jsx)(`div`,{style:{fontSize:13,fontWeight:600,color:S.ink},children:`CPU 每核使用率`}),(0,w.jsxs)(`div`,{style:{fontSize:11.5,color:S.ink3,marginLeft:10},children:[t.length,` 核 · 实时`]})]}),(0,w.jsx)(`div`,{style:{display:`grid`,gridTemplateColumns:`repeat(auto-fill, minmax(92px, 1fr))`,gap:8},children:t.map((e,t)=>{let n=Math.max(0,Math.min(100,Number.isFinite(e)?e:0)),r=n>=85?S.red:n>=65?S.amber:S.blue;return(0,w.jsxs)(`div`,{style:{minHeight:58,border:`1px solid ${S.borderSoft}`,borderRadius:8,background:S.surfaceAlt,padding:`9px 10px`},children:[(0,w.jsxs)(`div`,{style:{display:`flex`,justifyContent:`space-between`,alignItems:`center`,marginBottom:8},children:[(0,w.jsxs)(`span`,{className:`mono`,style:{fontSize:11,color:S.ink3},children:[`CPU `,t]}),(0,w.jsxs)(`span`,{className:`mono tnum`,style:{fontSize:12,fontWeight:700,color:r},children:[Math.round(n),`%`]})]}),(0,w.jsx)(`div`,{style:{height:5,borderRadius:3,background:`#e5e7eb`,overflow:`hidden`},children:(0,w.jsx)(`div`,{style:{width:`${n}%`,height:`100%`,background:r,borderRadius:3,transition:`width 0.4s ease`}})})]},t)})})]}):null}function m_({g:e,live:t,history:n}){let r=e.memUsed/e.memTotal*100,i=n||{};return(0,w.jsxs)(`div`,{style:{border:`1px solid ${S.borderSoft}`,borderRadius:8,padding:14,background:S.surfaceAlt},children:[(0,w.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,gap:8,marginBottom:10},children:[(0,w.jsx)(`div`,{style:{width:26,height:26,borderRadius:6,background:`linear-gradient(140deg, ${S.indigo}, #4338ca)`,color:`white`,display:`flex`,alignItems:`center`,justifyContent:`center`},children:(0,w.jsx)(D,{name:`bolt`,size:13,stroke:2})}),(0,w.jsxs)(`div`,{style:{fontSize:13,fontWeight:600,color:S.ink},children:[`GPU `,e.id,` · `,e.model]}),(0,w.jsx)(`div`,{style:{flex:1}}),(0,w.jsxs)(J,{tone:`green`,children:[(0,w.jsx)(q,{tone:`green`,size:6}),`正常`]})]}),(0,w.jsxs)(`div`,{style:{display:`grid`,gridTemplateColumns:`1fr 1fr`,gap:10,marginBottom:6},children:[(0,w.jsxs)(`div`,{children:[(0,w.jsx)(c_,{label:`利用率`,value:`${t.toFixed(0)}%`,max:`100%`,pct:t,color:S.indigo}),(0,w.jsx)(l_,{series:i.util,color:S.indigo})]}),(0,w.jsxs)(`div`,{children:[(0,w.jsx)(c_,{label:`显存`,value:`${e.memUsed} GB`,max:`${e.memTotal} GB`,pct:r,color:S.cyan}),(0,w.jsx)(l_,{series:i.memPercent,color:S.cyan})]}),(0,w.jsxs)(`div`,{children:[(0,w.jsx)(c_,{label:`温度`,value:`${e.temp}°`,max:`85°`,pct:e.temp/85*100,color:S.amber,mono:!0}),(0,w.jsx)(l_,{series:i.temp,color:S.amber})]}),(0,w.jsxs)(`div`,{children:[(0,w.jsx)(c_,{label:`功耗`,value:`${e.power} W`,max:`${e.max} W`,pct:e.power/e.max*100,color:S.green,mono:!0}),(0,w.jsx)(l_,{series:i.power,color:S.green})]})]})]})}function h_({data:e,status:t}){if(t===`no-nvidia-smi`)return null;let n={fontSize:10.5,fontWeight:600,color:S.ink3,letterSpacing:`0.06em`,textTransform:`uppercase`};return(0,w.jsxs)(`div`,{style:{background:S.surface,border:`1px solid ${S.border}`,borderRadius:10,padding:0,overflow:`hidden`,marginBottom:12},children:[(0,w.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,padding:`12px 16px`,borderBottom:`1px solid ${S.borderSoft}`},children:[(0,w.jsx)(`div`,{style:{fontSize:13,fontWeight:600,color:S.ink},children:`GPU 进程占用`}),(0,w.jsx)(`div`,{style:{flex:1}}),(0,w.jsx)(`span`,{style:{fontSize:11.5,color:S.ink3},children:t===`ok`?`${e.length} 个活跃进程`:t===`error`?`进程数据暂不可用`:`加载中…`})]}),t===`ok`&&e.length===0?(0,w.jsx)(`div`,{style:{padding:`20px 16px`,color:S.ink4,fontSize:13,textAlign:`center`},children:`当前 GPU 上无活跃进程`}):t===`ok`?(0,w.jsxs)(`table`,{style:{width:`100%`,borderCollapse:`collapse`},children:[(0,w.jsx)(`thead`,{children:(0,w.jsxs)(`tr`,{style:{background:`#fafbfc`},children:[(0,w.jsx)(`th`,{style:{...n,textAlign:`left`,padding:`10px 16px`},children:`PID`}),(0,w.jsx)(`th`,{style:{...n,textAlign:`left`,padding:`10px 12px`},children:`进程`}),(0,w.jsx)(`th`,{style:{...n,textAlign:`left`,padding:`10px 12px`},children:`容器`}),(0,w.jsx)(`th`,{style:{...n,textAlign:`left`,padding:`10px 12px`},children:`GPU UUID`}),(0,w.jsx)(`th`,{style:{...n,textAlign:`right`,padding:`10px 16px`},children:`显存 (MiB)`})]})}),(0,w.jsx)(`tbody`,{children:e.map((e,t)=>(0,w.jsxs)(`tr`,{style:{borderTop:t?`1px solid ${S.borderSoft}`:`none`},children:[(0,w.jsx)(`td`,{style:{padding:`10px 16px`,fontSize:12},className:`mono tnum`,children:e.pid}),(0,w.jsx)(`td`,{style:{padding:`10px 12px`,fontSize:12.5,color:S.ink},children:e.name}),(0,w.jsx)(`td`,{style:{padding:`10px 12px`,fontSize:12,color:S.ink2},className:`mono`,children:e.containerHint||`—`}),(0,w.jsx)(`td`,{style:{padding:`10px 12px`,fontSize:11.5,color:S.ink3},className:`mono`,children:e.gpuUuid}),(0,w.jsx)(`td`,{style:{padding:`10px 16px`,textAlign:`right`,fontSize:12,color:S.ink},className:`mono tnum`,children:e.vramMiB})]},`${e.pid}-${e.gpuUuid}`))})]}):null]})}function g_({cpu:e,gpuAvg:t,memPct:n,memUsed:r,memTotal:i,diskPct:a,diskUsed:o,diskTotal:s,hasGpu:c,gpuCount:l,gpuModel:u}){let d=({icon:e,label:t,pct:n,value:r,sub:i,color:a})=>{let o=n==null;return(0,w.jsxs)(`div`,{style:{background:S.surface,border:`1px solid ${S.border}`,borderRadius:10,padding:`14px 16px`},children:[(0,w.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,gap:6,marginBottom:8},children:[(0,w.jsx)(D,{name:e,size:13,stroke:1.8,style:{color:o?S.ink4:a}}),(0,w.jsx)(`div`,{style:{fontSize:12,fontWeight:600,color:S.ink},children:t})]}),(0,w.jsx)(`div`,{className:`mono tnum`,style:{...S.type.title,fontWeight:700,color:o?S.ink4:a,lineHeight:1,letterSpacing:`-0.02em`},children:r}),(0,w.jsx)(`div`,{style:{fontSize:11,color:S.ink3,marginTop:6},children:i})]})};return(0,w.jsxs)(`div`,{style:{display:`grid`,gridTemplateColumns:`repeat(4, 1fr)`,gap:12,marginBottom:12},children:[(0,w.jsx)(d,{icon:`cpu`,label:`CPU 使用率`,pct:e,value:e==null?`—`:`${e}%`,sub:e==null?`加载中…`:`当前负载`,color:S.blue}),(0,w.jsx)(d,{icon:`bolt`,label:`GPU 平均`,pct:c?t:0,value:c?t==null?`—`:`${t}%`:`无 GPU`,sub:c?`${l} × ${u}`:`本节点未检测到 NVIDIA GPU`,color:S.indigo}),(0,w.jsx)(d,{icon:`memory`,label:`内存`,pct:n,value:n==null?`—`:`${n}%`,sub:r!=null&&i!=null?`${r} GB / ${i} GB`:`加载中…`,color:S.teal}),(0,w.jsx)(d,{icon:`hardDrive`,label:`磁盘`,pct:a,value:a==null?`—`:`${a}%`,sub:o!=null&&s!=null?`${o} GB / ${s} GB`:`加载中…`,color:S.amber})]})}function __(){let[e,t]=(0,b.useState)(`1h`),n=[{value:`1h`,label:`1 小时`},{value:`6h`,label:`6 小时`},{value:`24h`,label:`24 小时`}],[r,i]=(0,b.useState)({}),[a,o]=(0,b.useState)(null),[s,c]=(0,b.useState)(null),[l,u]=(0,b.useState)([]),[d,f]=(0,b.useState)(null),[p,m]=(0,b.useState)({data:[],status:`idle`});(0,b.useEffect)(()=>{let t=async()=>{try{let[t,n,r,a]=await Promise.all([s_(`/api/v1/metrics`),s_(`/api/v1/metrics/history?window=`+e),s_(`/api/v1/device`),s_(`/api/v1/metrics/history/gpu?window=`+e)]);t&&o(t),n&&c(n),a&&f(a),r&&i({model:r.cpuModel,name:r.hostname}),t&&t.gpuData&&u(t.gpuData)}catch{}};t();let n=setInterval(t,5e3);return()=>clearInterval(n)},[e]),(0,b.useEffect)(()=>{if(!(l.length>0)){m({data:[],status:`no-gpu`});return}let e=!1,t=async()=>{try{let t=await fetch(`/api/v1/gpu/processes`,{headers:{Authorization:`Bearer `+(kd()||``)}});if(e)return;if(t.status===503){m({data:[],status:`no-nvidia-smi`});return}if(!t.ok){m(e=>({...e,status:`error`}));return}let n=await t.json();m({data:Array.isArray(n)?n:[],status:`ok`})}catch{e||m(e=>({...e,status:`error`}))}};t();let n=setInterval(t,5e3);return()=>{e=!0,clearInterval(n)}},[l.length]);let h=a?Math.round(a.cpuUsedPercent):null,g=l.length>0?Math.round(l.reduce((e,t)=>e+t.gpuUtil,0)/l.length):null,_=a?Math.round(a.memoryTotal/(1024*1024*1024)):null,v=a?Math.round(a.memoryUsed/(1024*1024*1024)):null,y=a?Math.round(a.memoryUsedPercent):null,x=a&&a.diskData&&a.diskData.length>0?a.diskData.reduce((e,t)=>t.total>e.total?t:e,a.diskData[0]):null,C=x?Math.round(x.usedPercent):null,T=x?Math.round(x.used/(1024*1024*1024)):null,E=x?Math.round(x.total/(1024*1024*1024)):null,D=s&&s.cpuPercent?s.cpuPercent:[],O=s&&s.gpuUtil?s.gpuUtil:[],k=s&&s.memoryPercent?s.memoryPercent:[],A=s&&s.diskPercent?s.diskPercent:[];s&&s.gpuMemPercent&&s.gpuMemPercent;let j=o_(s?.netBytesSent,s?.timestamps),ee=o_(s?.netBytesRecv,s?.timestamps),M=o_(s?.diskReadBytes,s?.timestamps),N=o_(s?.diskWriteBytes,s?.timestamps),P=(n.find(t=>t.value===e)||n[0]).label;return(0,w.jsxs)(`div`,{style:{flex:1,padding:`20px 24px`,overflow:`auto`,background:S.surfaceAlt},children:[(0,w.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,marginBottom:14},children:[(0,w.jsxs)(`div`,{children:[(0,w.jsx)(`div`,{style:{...S.type.heading,color:S.ink},children:`监控`}),(0,w.jsxs)(`div`,{style:{fontSize:12,color:S.ink3,marginTop:3,display:`flex`,alignItems:`center`,gap:8},children:[(0,w.jsxs)(`span`,{children:[(0,w.jsx)(`span`,{className:`edge-live-dot`,style:{display:`inline-block`,width:6,height:6,borderRadius:`50%`,background:S.green,marginRight:5,verticalAlign:`middle`}}),`实时刷新中`]}),(0,w.jsx)(`span`,{style:{color:`#cbd5e1`},children:`·`}),(0,w.jsx)(`span`,{children:`采样间隔 5s`}),(0,w.jsx)(`span`,{style:{color:`#cbd5e1`},children:`·`}),(0,w.jsx)(`span`,{children:r.model||``})]})]}),(0,w.jsx)(`div`,{style:{flex:1}}),(0,w.jsx)(`div`,{style:{display:`flex`,gap:2,background:S.surfaceAlt,padding:2,borderRadius:8},children:n.map(n=>(0,w.jsx)(`button`,{onClick:()=>t(n.value),style:{padding:`6px 12px`,fontSize:12,fontWeight:500,border:`none`,background:e===n.value?S.surface:`transparent`,color:e===n.value?S.blueDeep:S.ink3,borderRadius:6,cursor:`pointer`,boxShadow:e===n.value?`0 1px 2px rgba(0,0,0,0.04)`:`none`},children:n.label},n.value))})]}),(0,w.jsx)(g_,{cpu:h,gpuAvg:g,memPct:y,memUsed:v,memTotal:_,diskPct:C,diskUsed:T,diskTotal:E,hasGpu:l.length>0,gpuCount:l.length,gpuModel:l.length>0?l[0].productName:``}),(0,w.jsx)(p_,{cores:a?.cpuPercent}),(0,w.jsx)(f_,{disks:a?.diskIO}),(0,w.jsxs)(`div`,{style:{display:`grid`,gridTemplateColumns:`1fr 1fr`,gap:12,marginBottom:12},children:[(0,w.jsx)(a_,{title:`CPU 使用率 · 最近 ${P}`,window:e,series:D,color:S.blue,unit:`percent`,max:100}),(0,w.jsx)(a_,{title:`GPU 使用率 · 最近 ${P}`,window:e,series:O,color:S.indigo,unit:`percent`,max:100})]}),(0,w.jsxs)(`div`,{style:{display:`grid`,gridTemplateColumns:`1fr 1fr`,gap:12,marginBottom:12},children:[(0,w.jsx)(a_,{title:`内存使用率 · 最近 ${P}`,window:e,series:k,color:S.violet,unit:`percent`,max:100}),(0,w.jsx)(a_,{title:`磁盘使用率 · 最近 ${P}`,window:e,series:A,color:S.cyan,unit:`percent`,max:100})]}),(0,w.jsxs)(`div`,{style:{display:`grid`,gridTemplateColumns:`1fr 1fr`,gap:12,marginBottom:12},children:[(0,w.jsx)(a_,{title:`网络入站 · 最近 ${P}`,window:e,series:ee,color:S.green,unit:`bytesPerSec`}),(0,w.jsx)(a_,{title:`网络出站 · 最近 ${P}`,window:e,series:j,color:S.amber,unit:`bytesPerSec`})]}),(0,w.jsxs)(`div`,{style:{display:`grid`,gridTemplateColumns:`1fr 1fr`,gap:12,marginBottom:12},children:[(0,w.jsx)(a_,{title:`磁盘读取 · 最近 ${P}`,window:e,series:M,color:S.teal,unit:`bytesPerSec`}),(0,w.jsx)(a_,{title:`磁盘写入 · 最近 ${P}`,window:e,series:N,color:S.red,unit:`bytesPerSec`})]}),(0,w.jsxs)(`div`,{style:{background:S.surface,border:`1px solid ${S.border}`,borderRadius:10,padding:16,marginBottom:12},children:[(0,w.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,marginBottom:12},children:[(0,w.jsx)(`div`,{style:{fontSize:13,fontWeight:600,color:S.ink},children:`GPU 卡详情`}),(0,w.jsx)(`div`,{style:{fontSize:11.5,color:S.ink3,marginLeft:10},children:l.length>0?`${l.length} 卡 · ${l[0].productName} · 时序 ${e}`:`本节点未检测到 NVIDIA GPU`})]}),(0,w.jsx)(`div`,{style:{display:`grid`,gridTemplateColumns:l.length>1?`1fr 1fr`:`1fr`,gap:12},children:l.length>0?l.map((e,t)=>{let n=d&&d.perGpu?d.perGpu.find(t=>t.id===String(e.index))||d.perGpu[t]:null;return(0,w.jsx)(m_,{g:{id:e.index,model:e.productName,util:Math.round(e.gpuUtil),memUsed:e.memUsed,memTotal:e.memTotal,temp:e.temperature,power:e.powerDraw,max:e.powerLimit},live:Math.round(e.gpuUtil),history:n},e.index)}):(0,w.jsx)(`div`,{style:{padding:`24px 0`,textAlign:`center`,color:S.ink4,fontSize:13},children:`本节点未检测到 NVIDIA GPU`})})]}),l.length>0&&(0,w.jsx)(h_,{data:p.data,status:p.status})]})}var v_={height:39,padding:`0 14px`,borderRadius:`6px 6px 0 0`,fontSize:13},y_={padding:`8px 12px`,fontSize:10.5,color:S.ink3,textTransform:`uppercase`,letterSpacing:`0.04em`,fontWeight:700,background:`#f8fafc`,borderBottom:`1px solid ${S.borderSoft}`},b_={padding:`9px 12px`,fontSize:12,color:S.ink,borderBottom:`1px solid ${S.borderSoft}`,verticalAlign:`top`};function x_(e){return!e||e<0?`-`:e<60?`${e}s`:e<3600?`${Math.floor(e/60)}m`:e<86400?`${Math.floor(e/3600)}h`:`${Math.floor(e/86400)}d ${Math.floor(e%86400/3600)}h`}function S_(e){if(!e)return`-`;let t=new Date(e);return Number.isNaN(t.getTime())?`-`:t.toLocaleString()}function C_(e){return e?e>=1024*1024?(e/1024/1024).toFixed(1)+` MB`:e>=1024?(e/1024).toFixed(0)+` KB`:e+` B`:`-`}function $({tone:e=`slate`,children:t}){let n={red:{bg:S.redSoft,fg:`#b91c1c`,bd:`#fecaca`},amber:{bg:S.amberSoft,fg:`#a16207`,bd:`#fde68a`},blue:{bg:S.blueSoft,fg:S.blueDeep,bd:`#bfdbfe`},green:{bg:S.greenSoft,fg:`#047857`,bd:`#bbf7d0`},slate:{bg:S.surfaceAlt,fg:S.ink3,bd:S.border}}[e];return(0,w.jsx)(`span`,{style:{display:`inline-flex`,alignItems:`center`,gap:4,height:20,padding:`0 7px`,borderRadius:5,fontSize:11,fontWeight:700,color:n.fg,background:n.bg,border:`1px solid ${n.bd}`},children:t})}function w_({tone:e=`slate`,icon:t,children:n,onClick:r,disabled:i,title:a}){let o={red:{bg:`#fff1f2`,fg:`#dc2626`,bd:`#fecdd3`},amber:{bg:`#fffbeb`,fg:`#b45309`,bd:`#fde68a`},blue:{bg:`#eff6ff`,fg:S.blue,bd:`#bfdbfe`},green:{bg:`#ecfdf5`,fg:`#047857`,bd:`#bbf7d0`},slate:{bg:`#f8fafc`,fg:S.ink2,bd:S.border},dark:{bg:`#1e293b`,fg:`#fff`,bd:`#1e293b`}}[e];return(0,w.jsxs)(`button`,{title:a,disabled:i,onClick:r,style:{height:32,padding:t&&n?`0 11px`:`0 10px`,borderRadius:6,border:`1px solid ${i?S.border:o.bd}`,background:i?S.surfaceAlt:o.bg,color:i?S.ink4:o.fg,display:`inline-flex`,alignItems:`center`,justifyContent:`center`,gap:7,fontSize:12,fontWeight:800,cursor:i?`default`:`pointer`,whiteSpace:`nowrap`},children:[t&&(0,w.jsx)(D,{name:t,size:13,stroke:2}),n]})}function T_({id:e,issue:t,active:n}){let r=e===`codex`?`code`:e===`hermes`?`zap`:e===`openclaw`?`openclaw`:e===`agent-browser`?`globe`:`brain`,i=t?S.red:e===`codex`?S.blue:e===`openclaw`?S.violet:e===`hermes`?S.teal:S.amber;return(0,w.jsx)(`span`,{style:{width:30,height:30,borderRadius:8,flexShrink:0,display:`inline-flex`,alignItems:`center`,justifyContent:`center`,color:`#fff`,background:i,boxShadow:n?`0 6px 14px ${i}35`:`none`},children:(0,w.jsx)(D,{name:r,size:15,stroke:2})})}function E_({icon:e,label:t,value:n,tone:r=S.blue}){return(0,w.jsxs)(`div`,{style:{background:S.surface,border:`1px solid ${S.border}`,borderRadius:8,padding:`12px 14px`,minWidth:132},children:[(0,w.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,gap:6,color:S.ink3,fontSize:11.5,fontWeight:600},children:[(0,w.jsx)(D,{name:e,size:13,stroke:1.8,style:{color:r}}),t]}),(0,w.jsx)(`div`,{className:`mono tnum`,style:{marginTop:8,...S.type.title,lineHeight:1,color:S.ink,fontWeight:800},children:n??`-`})]})}function D_({title:e,right:t,children:n}){return(0,w.jsxs)(`div`,{style:{background:S.surface,border:`1px solid ${S.border}`,borderRadius:8,overflow:`hidden`,flexShrink:0},children:[(0,w.jsxs)(`div`,{style:{height:38,padding:`0 14px`,display:`flex`,alignItems:`center`,borderBottom:`1px solid ${S.borderSoft}`},children:[(0,w.jsx)(`div`,{style:{fontSize:13,fontWeight:800,color:S.ink},children:e}),(0,w.jsx)(`div`,{style:{flex:1}}),t]}),n]})}function O_({text:e=`暂无数据`}){return(0,w.jsx)(`div`,{style:{padding:18,color:S.ink3,fontSize:12},children:e})}var k_=[[`working`,`Working`],[`blocked`,`Blocked`],[`idle`,`Idle`],[`done`,`Done`],[`unknown`,`Unknown`]];function A_(e){return{working:{label:`Working`,tone:`green`,color:S.green,soft:`#ecfdf5`,border:`#bbf7d0`},blocked:{label:`Blocked`,tone:`red`,color:S.red,soft:`#fff1f2`,border:`#fecdd3`},idle:{label:`Idle`,tone:`amber`,color:S.amber,soft:`#fffbeb`,border:`#fde68a`},done:{label:`Done`,tone:`slate`,color:S.ink4,soft:`#f8fafc`,border:S.borderSoft},unknown:{label:`Unknown`,tone:`slate`,color:S.ink4,soft:`#f8fafc`,border:S.borderSoft}}[e]||{label:`Unknown`,tone:`slate`,color:S.ink4,soft:`#f8fafc`,border:S.borderSoft}}function j_(e){if(!e)return`-`;let t=String(e).split(`/`).filter(Boolean);return t.length<=2?e:t.slice(-2).join(`/`)}function M_({card:e,active:t,onClick:n}){let r=A_(e.status);return(0,w.jsxs)(`button`,{onClick:n,style:{width:`100%`,minHeight:58,textAlign:`left`,display:`grid`,gridTemplateColumns:`12px 1fr auto`,gap:10,alignItems:`center`,padding:`10px 11px`,border:`1px solid ${t?r.color:S.borderSoft}`,borderRadius:7,background:t?r.soft:S.surface,cursor:`pointer`,boxShadow:t?`0 1px 3px rgba(15,23,42,.08)`:`none`},children:[(0,w.jsx)(`span`,{style:{width:9,height:9,borderRadius:5,background:r.color}}),(0,w.jsxs)(`span`,{style:{minWidth:0},children:[(0,w.jsx)(`span`,{style:{display:`block`,fontSize:12.5,color:S.ink,fontWeight:850,whiteSpace:`nowrap`,overflow:`hidden`,textOverflow:`ellipsis`},children:e.name||e.id}),(0,w.jsxs)(`span`,{className:`mono`,style:{display:`block`,marginTop:4,fontSize:10.5,color:S.ink4,whiteSpace:`nowrap`,overflow:`hidden`,textOverflow:`ellipsis`},children:[j_(e.cwd),e.gitBranch?` · ${e.gitBranch}`:``]})]}),(0,w.jsxs)(`span`,{style:{display:`flex`,flexDirection:`column`,alignItems:`flex-end`,gap:4},children:[(0,w.jsx)($,{tone:r.tone,children:e.kind}),e.pid?(0,w.jsxs)(`span`,{className:`mono`,style:{fontSize:10,color:S.ink4},children:[`PID `,e.pid]}):null]})]})}function N_({card:e}){let t=e?.transcriptPath||``,{data:n,loading:r,error:i}=ef(t,200,3e3),a=(0,b.useRef)(null);return(0,b.useEffect)(()=>{a.current&&(a.current.scrollTop=a.current.scrollHeight)},[n?.text,t]),e?t?i?(0,w.jsxs)(`div`,{style:{padding:14,color:S.red,fontSize:12.5},children:[`transcript 读取失败:`,i.message||String(i)]}):(0,w.jsx)(`pre`,{ref:a,style:{margin:0,padding:14,minHeight:0,height:`100%`,overflow:`auto`,background:`#0f172a`,color:`#dbeafe`,fontFamily:S.mono,fontSize:11,lineHeight:1.55,whiteSpace:`pre-wrap`,wordBreak:`break-word`},children:r&&!n?`加载 transcript...`:n?.text||`transcript 暂无内容`}):(0,w.jsx)(O_,{text:`该 agent 没有可读取的 transcript 路径`}):(0,w.jsx)(O_,{text:`请选择一个 agent 查看详情`})}function P_({board:e}){let t=e?.agents||[],[n,r]=(0,b.useState)(``);(0,b.useEffect)(()=>{if(!t.length){r(``);return}t.some(e=>e.id===n)||r(t[0].id)},[t,n]);let i=t.find(e=>e.id===n)||t[0]||null,a=e?.counts||{},o=k_.map(([e,n])=>({status:e,label:n,count:a[e]||0,cards:t.filter(t=>(t.status||`unknown`)===e)})).filter(e=>e.status!==`unknown`||e.count>0||e.cards.length>0);if(!t.length)return(0,w.jsx)(O_,{text:`没有发现 agent,Board 会在检测到进程、worker 或会话后显示。`});let s=A_(i?.status);return(0,w.jsxs)(`div`,{style:{padding:12,display:`grid`,gridTemplateColumns:`360px 1fr`,gap:12,minHeight:560},children:[(0,w.jsxs)(`div`,{style:{border:`1px solid ${S.border}`,borderRadius:8,overflow:`hidden`,background:S.surface,minHeight:0},children:[(0,w.jsxs)(`div`,{style:{padding:`11px 14px`,display:`flex`,alignItems:`center`,borderBottom:`1px solid ${S.borderSoft}`},children:[(0,w.jsx)(`div`,{style:{fontSize:13,fontWeight:900,color:S.ink},children:`Agent Board`}),(0,w.jsx)(`div`,{style:{flex:1}}),(0,w.jsx)($,{tone:`slate`,children:t.length})]}),(0,w.jsx)(`div`,{style:{padding:10,display:`grid`,gap:12,maxHeight:`calc(100vh - 330px)`,overflow:`auto`},children:o.map(e=>{let t=A_(e.status),n=e.status===`blocked`&&e.count>0;return(0,w.jsxs)(`div`,{style:{border:`1px solid ${n?t.border:S.borderSoft}`,borderRadius:8,background:n?t.soft:S.surface,overflow:`hidden`},children:[(0,w.jsxs)(`div`,{style:{padding:`9px 10px`,display:`flex`,alignItems:`center`,gap:8,borderBottom:e.cards.length?`1px solid ${n?t.border:S.borderSoft}`:`none`},children:[(0,w.jsx)(`span`,{style:{width:8,height:8,borderRadius:4,background:t.color}}),(0,w.jsx)(`div`,{style:{fontSize:12.5,fontWeight:900,color:n?S.red:S.ink},children:e.label}),(0,w.jsx)(`div`,{style:{flex:1}}),(0,w.jsx)($,{tone:t.tone,children:e.count})]}),e.cards.length?(0,w.jsx)(`div`,{style:{display:`grid`,gap:7,padding:8},children:e.cards.map(e=>(0,w.jsx)(M_,{card:e,active:i?.id===e.id,onClick:()=>r(e.id)},e.id))}):(0,w.jsx)(`div`,{style:{padding:`9px 10px`,color:S.ink4,fontSize:11.5},children:`暂无`})]},e.status)})})]}),(0,w.jsxs)(`div`,{style:{minWidth:0,border:`1px solid ${S.border}`,borderRadius:8,overflow:`hidden`,background:S.surface,display:`grid`,gridTemplateRows:`auto 1fr`,minHeight:0},children:[(0,w.jsxs)(`div`,{style:{padding:`13px 15px`,borderBottom:`1px solid ${S.borderSoft}`,display:`flex`,alignItems:`center`,gap:10},children:[(0,w.jsx)(`span`,{style:{width:10,height:10,borderRadius:5,background:s.color,flexShrink:0}}),(0,w.jsxs)(`div`,{style:{minWidth:0,flex:1},children:[(0,w.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,gap:8,minWidth:0},children:[(0,w.jsx)(`div`,{style:{...S.type.heading,fontWeight:900,color:S.ink,whiteSpace:`nowrap`,overflow:`hidden`,textOverflow:`ellipsis`},children:i?.name||`Agent`}),(0,w.jsx)($,{tone:s.tone,children:s.label}),i?.model&&(0,w.jsx)($,{tone:String(i.model).includes(`fable`)?`red`:`blue`,children:i.model})]}),(0,w.jsxs)(`div`,{className:`mono`,style:{marginTop:5,color:S.ink4,fontSize:10.5,whiteSpace:`nowrap`,overflow:`hidden`,textOverflow:`ellipsis`},children:[i?.cwd||`-`,i?.gitBranch?` · ${i.gitBranch}`:``]})]}),(0,w.jsxs)(`div`,{style:{display:`flex`,gap:6,flexWrap:`wrap`,justifyContent:`flex-end`},children:[i?.lastAt&&(0,w.jsx)($,{tone:`slate`,children:S_(i.lastAt)}),i?.transcriptPath&&(0,w.jsx)($,{tone:`amber`,children:`只读 transcript`})]})]}),(0,w.jsxs)(`div`,{style:{display:`grid`,gridTemplateRows:`auto 1fr`,minHeight:0},children:[(0,w.jsxs)(`div`,{style:{padding:`10px 14px`,borderBottom:`1px solid ${S.borderSoft}`,background:`#f8fafc`},children:[(0,w.jsx)(`div`,{style:{color:S.ink3,fontSize:11.5,fontWeight:800,marginBottom:5},children:`最近事件 / Prompt`}),(0,w.jsx)(`div`,{style:{color:S.ink2,fontSize:12.5,lineHeight:1.45,wordBreak:`break-word`},children:i?.lastText||`暂无最近事件`}),i?.transcriptPath&&(0,w.jsx)(`div`,{className:`mono`,style:{marginTop:6,color:S.ink4,fontSize:10.5,wordBreak:`break-all`},children:i.transcriptPath})]}),(0,w.jsx)(N_,{card:i})]})]})]})}function F_({agent:e,active:t,onClick:n}){let r=e.issues?.some(e=>e.severity===`critical`),i=(e.processes?.length||0)+(e.sessions?.length||0)+(e.workers?.length||0);return(0,w.jsxs)(`button`,{onClick:n,style:{textAlign:`left`,background:t?`#fffaf2`:S.surface,border:`1px solid ${t?S.amber:S.borderSoft}`,borderRadius:9,padding:12,cursor:`pointer`,boxShadow:t?`0 1px 3px rgba(15,23,42,.08)`:`none`},children:[(0,w.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,gap:8},children:[(0,w.jsx)(T_,{id:e.id,issue:r,active:t}),(0,w.jsx)(`div`,{style:{fontSize:13,fontWeight:800,color:S.ink},children:e.name}),(0,w.jsx)(`div`,{style:{flex:1}}),r?(0,w.jsx)($,{tone:`red`,children:`风险`}):i>0?(0,w.jsx)($,{tone:`slate`,children:i}):null]}),(0,w.jsx)(`div`,{style:{marginTop:8,color:S.ink3,fontSize:11.5,lineHeight:1.45},children:e.description}),(0,w.jsxs)(`div`,{style:{display:`flex`,gap:6,marginTop:9,flexWrap:`wrap`},children:[(0,w.jsxs)($,{tone:`blue`,children:[`进程 `,e.processes?.length||0]}),(0,w.jsxs)($,{tone:`green`,children:[`会话 `,e.sessions?.length||0]}),(0,w.jsxs)($,{tone:`slate`,children:[`配置 `,e.configs?.filter(e=>e.exists).length||0]})]})]})}function I_({issues:e}){return e?.length?(0,w.jsx)(`div`,{style:{display:`flex`,flexDirection:`column`},children:e.slice(0,8).map((t,n)=>(0,w.jsxs)(`div`,{style:{padding:`10px 14px`,borderBottom:n===e.length-1?`none`:`1px solid ${S.borderSoft}`,display:`flex`,gap:10},children:[(0,w.jsx)(D,{name:t.severity===`critical`?`alertTri`:`info`,size:15,stroke:1.9,style:{color:t.severity===`critical`?S.red:S.amber,flexShrink:0,marginTop:1}}),(0,w.jsxs)(`div`,{style:{minWidth:0},children:[(0,w.jsx)(`div`,{style:{fontSize:12.5,fontWeight:800,color:S.ink},children:t.title}),(0,w.jsx)(`div`,{style:{fontSize:11.5,color:S.ink3,marginTop:3,lineHeight:1.45,wordBreak:`break-word`},children:t.detail}),t.ref&&(0,w.jsx)(`div`,{className:`mono`,style:{fontSize:10.5,color:S.ink4,marginTop:4},children:t.ref})]})]},n))}):(0,w.jsx)(O_,{text:`暂无限流、风险模型或配置异常`})}function L_(e){let t=`${e.state||``} ${e.model||``} ${e.cmdline||``} ${e.cwd||``}`.toLowerCase();return t.includes(`deleted`)||t.includes(`fable`)?{label:`异常`,tone:`red`,dot:S.red}:{label:`运行`,tone:`green`,dot:S.green}}function R_({rows:e}){if(!e?.length)return(0,w.jsx)(O_,{});let t=e.filter(e=>{let t=`${e.state||``} ${e.cwd||``} ${e.model||``} ${e.cmdline||``}`.toLowerCase();return t.includes(`deleted`)||t.includes(`fable`)}).length,n=e.length-t;return(0,w.jsxs)(`div`,{style:{padding:18},children:[(0,w.jsxs)(`div`,{style:{marginBottom:12,color:S.ink3,fontSize:12.5},children:[`共 `,(0,w.jsx)(`b`,{style:{color:S.ink},children:e.length}),` 个进程 · 运行 `,(0,w.jsx)(`b`,{style:{color:S.green},children:n}),` · 异常 `,(0,w.jsx)(`b`,{style:{color:S.red},children:t})]}),(0,w.jsxs)(`div`,{style:{border:`1px solid ${S.borderSoft}`,borderRadius:8,overflow:`hidden`,background:S.surface},children:[(0,w.jsxs)(`div`,{style:{display:`grid`,gridTemplateColumns:`130px 150px 120px 1fr 86px`,padding:`10px 16px`,background:S.surfaceAlt,color:S.ink4,fontSize:10.5,fontWeight:800,textTransform:`uppercase`,borderBottom:`1px solid ${S.borderSoft}`},children:[(0,w.jsx)(`div`,{children:`PID`}),(0,w.jsx)(`div`,{children:`Worker`}),(0,w.jsx)(`div`,{children:`状态`}),(0,w.jsx)(`div`,{children:`模型 / CPU / 内存`}),(0,w.jsx)(`div`,{style:{textAlign:`right`},children:`操作`})]}),e.map((t,n)=>{let r=L_(t);return(0,w.jsxs)(`div`,{style:{display:`grid`,gridTemplateColumns:`130px 150px 120px 1fr 86px`,padding:`14px 16px`,alignItems:`center`,borderBottom:n===e.length-1?`none`:`1px solid ${S.borderSoft}`},children:[(0,w.jsx)(`div`,{className:`mono tnum`,style:{fontSize:12.5,fontWeight:800,color:S.ink},children:t.pid}),(0,w.jsxs)(`div`,{children:[(0,w.jsx)(`div`,{className:`mono`,style:{fontSize:12,color:S.ink2,fontWeight:700},children:t.sessionId||t.name}),(0,w.jsx)(`div`,{className:`mono`,style:{marginTop:4,fontSize:10.5,color:S.ink4,whiteSpace:`nowrap`,overflow:`hidden`,textOverflow:`ellipsis`},children:t.name})]}),(0,w.jsx)(`div`,{children:(0,w.jsxs)($,{tone:r.tone,children:[(0,w.jsx)(`span`,{style:{width:6,height:6,borderRadius:3,background:r.dot}}),r.label]})}),(0,w.jsxs)(`div`,{style:{minWidth:0},children:[(0,w.jsx)(`div`,{className:`mono`,style:{fontSize:11.5,color:String(t.model).includes(`fable`)?S.red:S.ink2,fontWeight:700},children:t.model||`-`}),(0,w.jsxs)(`div`,{className:`mono`,style:{marginTop:4,fontSize:10.5,color:S.ink4,whiteSpace:`nowrap`,overflow:`hidden`,textOverflow:`ellipsis`},children:[t.cwd||t.cmdline||`-`,` · `,x_(t.ageSec)]})]}),(0,w.jsx)(`div`,{style:{textAlign:`right`},children:(0,w.jsx)(w_,{tone:`red`,disabled:!0,title:`暂未开放进程终止接口`,children:`终止`})})]},`${t.pid}-${t.sessionId||t.name}-${n}`)})]})]})}function z_(e){return e.lastPrompt?String(e.lastPrompt).slice(0,42):e.lastError?String(e.lastError).slice(0,42):e.id}function B_({rows:e}){let[t,n]=(0,b.useState)(``);if((0,b.useEffect)(()=>{if(!e?.length){n(``);return}if(!e.some(e=>`${e.kind}-${e.id}-${e.path}`===t)){let t=e[0];n(`${t.kind}-${t.id}-${t.path}`)}},[e,t]),!e?.length)return(0,w.jsx)(O_,{});let r=e.find(e=>`${e.kind}-${e.id}-${e.path}`===t)||e[0],i=`${r.kind}-${r.id}-${r.path}`;return(0,w.jsxs)(`div`,{style:{padding:18,display:`grid`,gridTemplateColumns:`340px 1fr`,gap:16,minHeight:430},children:[(0,w.jsxs)(`div`,{style:{border:`1px solid ${S.borderSoft}`,borderRadius:8,overflow:`hidden`,background:S.surface},children:[(0,w.jsxs)(`div`,{style:{padding:`11px 14px`,color:S.ink2,fontSize:13,fontWeight:800,borderBottom:`1px solid ${S.borderSoft}`},children:[`会话 · `,e.length]}),(0,w.jsx)(`div`,{style:{maxHeight:390,overflow:`auto`},children:e.map((t,r)=>{let a=`${t.kind}-${t.id}-${t.path}`,o=a===i;return(0,w.jsxs)(`button`,{onClick:()=>n(a),style:{width:`100%`,textAlign:`left`,padding:`13px 15px`,border:`none`,borderBottom:r===e.length-1?`none`:`1px solid ${S.borderSoft}`,borderLeft:`2px solid ${o?S.blue:`transparent`}`,background:o?`#eff6ff`:S.surface,cursor:`pointer`},children:[(0,w.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,gap:8},children:[(0,w.jsx)(`span`,{style:{width:7,height:7,borderRadius:4,background:t.rateLimited?S.red:S.teal,flexShrink:0}}),(0,w.jsx)(`div`,{style:{flex:1,minWidth:0,fontSize:12.5,fontWeight:800,color:S.ink,whiteSpace:`nowrap`,overflow:`hidden`,textOverflow:`ellipsis`},children:z_(t)}),(0,w.jsx)(`span`,{className:`mono`,style:{fontSize:10.5,color:S.ink4},children:t.sessionKind||t.kind})]}),(0,w.jsxs)(`div`,{style:{marginTop:7,display:`flex`,gap:8,alignItems:`center`},children:[t.model&&(0,w.jsx)($,{tone:String(t.model).includes(`fable`)?`red`:`blue`,children:t.model}),(0,w.jsx)(`span`,{style:{fontSize:10.5,color:S.ink4},children:S_(t.updatedAt)})]})]},a)})})]}),(0,w.jsxs)(`div`,{style:{border:`1px solid ${S.borderSoft}`,borderRadius:8,overflow:`hidden`,background:`#f8fafc`,minWidth:0},children:[(0,w.jsxs)(`div`,{style:{padding:`14px 16px`,borderBottom:`1px solid ${S.borderSoft}`,background:S.surface},children:[(0,w.jsx)(`div`,{style:{...S.type.heading,fontWeight:900,color:S.ink},children:z_(r)}),(0,w.jsx)(`div`,{className:`mono`,style:{marginTop:5,color:S.ink4,fontSize:10.5,wordBreak:`break-all`},children:r.path})]}),(0,w.jsxs)(`div`,{style:{padding:18,display:`flex`,flexDirection:`column`,gap:14},children:[r.lastPrompt&&(0,w.jsxs)(`div`,{style:{alignSelf:`flex-end`,maxWidth:`78%`},children:[(0,w.jsx)(`div`,{style:{fontSize:10.5,fontWeight:800,color:S.blue,textAlign:`right`,marginBottom:5},children:`用户`}),(0,w.jsx)(`div`,{style:{padding:`10px 13px`,borderRadius:`10px 10px 3px 10px`,background:S.blue,color:`#fff`,fontSize:13,lineHeight:1.55},children:r.lastPrompt})]}),(0,w.jsxs)(`div`,{style:{alignSelf:`flex-start`,maxWidth:`78%`},children:[(0,w.jsx)(`div`,{style:{fontSize:10.5,fontWeight:800,color:S.teal,marginBottom:5},children:`Assistant`}),(0,w.jsx)(`div`,{style:{padding:`10px 13px`,borderRadius:`10px 10px 10px 3px`,background:S.surface,border:`1px solid ${S.borderSoft}`,color:r.rateLimited?S.red:S.ink2,fontSize:13,lineHeight:1.55},children:r.lastError||r.lastPrompt||`该会话没有可展示的消息摘要。`})]}),(0,w.jsxs)(`div`,{style:{display:`flex`,gap:8,flexWrap:`wrap`,paddingTop:4},children:[r.linkedPid&&(0,w.jsxs)($,{tone:`blue`,children:[`PID `,r.linkedPid]}),r.linkedWorker&&(0,w.jsxs)($,{tone:`slate`,children:[`worker `,r.linkedWorker]}),r.cwd&&(0,w.jsx)($,{tone:`slate`,children:r.cwd})]})]})]})]})}function V_({rows:e}){return e?.length?(0,w.jsxs)(`table`,{style:{width:`100%`,borderCollapse:`collapse`},children:[(0,w.jsx)(`thead`,{children:(0,w.jsxs)(`tr`,{children:[(0,w.jsx)(`th`,{style:{...y_,textAlign:`left`},children:`Worker`}),(0,w.jsx)(`th`,{style:{...y_,textAlign:`left`},children:`模型/权限`}),(0,w.jsx)(`th`,{style:{...y_,textAlign:`left`},children:`最近事件`}),(0,w.jsx)(`th`,{style:{...y_,textAlign:`left`},children:`目录`})]})}),(0,w.jsx)(`tbody`,{children:e.map(e=>(0,w.jsxs)(`tr`,{children:[(0,w.jsxs)(`td`,{style:b_,children:[(0,w.jsx)(`div`,{className:`mono`,style:{fontWeight:800},children:e.short}),(0,w.jsxs)(`div`,{className:`mono`,style:{fontSize:10.5,color:S.ink3,marginTop:3},children:[`PID `,e.pid||`-`]})]}),(0,w.jsxs)(`td`,{style:b_,children:[(0,w.jsx)($,{tone:e.risky?`red`:`blue`,children:e.model||`-`}),(0,w.jsxs)(`div`,{style:{marginTop:6,display:`flex`,gap:5,flexWrap:`wrap`},children:[e.permission&&(0,w.jsx)($,{tone:`slate`,children:e.permission}),e.effort&&(0,w.jsxs)($,{tone:`slate`,children:[`effort `,e.effort]}),e.source&&(0,w.jsx)($,{tone:`slate`,children:e.source})]})]}),(0,w.jsxs)(`td`,{style:b_,children:[(0,w.jsx)(`div`,{style:{color:e.risky?S.red:S.ink2,lineHeight:1.45,maxWidth:460,wordBreak:`break-word`},children:e.lastTimeline||`-`}),e.lastAt&&(0,w.jsx)(`div`,{style:{fontSize:10.5,color:S.ink4,marginTop:4},children:S_(e.lastAt)})]}),(0,w.jsx)(`td`,{style:b_,children:(0,w.jsx)(`span`,{className:`mono`,style:{fontSize:10.5,color:S.ink3},children:e.cwd||`-`})})]},e.short))})]}):(0,w.jsx)(O_,{})}function H_({rows:e}){let t=e?.filter(e=>e.exists)||[],n=e?.length?e:[],[r,i]=(0,b.useState)(``),[a,o]=(0,b.useState)(``);if((0,b.useEffect)(()=>{if(!n.length){i(``),o(``);return}let e=n.some(e=>e.path===r)?n.find(e=>e.path===r):t[0]||n[0];e&&e.path!==r&&(i(e.path),o(e.preview||``))},[n,t,r]),!n.length)return(0,w.jsx)(O_,{});let s=n.find(e=>e.path===r)||t[0]||n[0],c=(s.path||``).split(`.`).pop()||`conf`;return(0,w.jsxs)(`div`,{style:{padding:18,display:`grid`,gridTemplateColumns:`300px 1fr`,gap:16,minHeight:0},children:[(0,w.jsxs)(`div`,{style:{border:`1px solid ${S.borderSoft}`,borderRadius:8,overflow:`hidden`,background:S.surface},children:[(0,w.jsxs)(`div`,{style:{padding:`11px 14px`,color:S.ink2,fontSize:13,fontWeight:800,borderBottom:`1px solid ${S.borderSoft}`},children:[`配置文件 · `,t.length]}),(0,w.jsx)(`div`,{style:{maxHeight:360,overflow:`auto`},children:n.map((e,t)=>{let r=e.path===s.path,a=e.path.split(`/`).pop(),c=(e.path.split(`.`).pop()||`conf`).slice(0,6);return(0,w.jsxs)(`button`,{onClick:()=>{i(e.path),o(e.preview||``)},style:{width:`100%`,display:`flex`,alignItems:`center`,gap:10,padding:`12px 14px`,border:`none`,borderBottom:t===n.length-1?`none`:`1px solid ${S.borderSoft}`,borderLeft:`2px solid ${r?S.amber:`transparent`}`,background:r?`#fffaf2`:S.surface,cursor:`pointer`,textAlign:`left`},children:[(0,w.jsx)(`span`,{style:{width:28,height:28,borderRadius:7,display:`inline-flex`,alignItems:`center`,justifyContent:`center`,background:e.exists?S.amberSoft:S.surfaceAlt,color:e.exists?S.amber:S.ink4,flexShrink:0},children:(0,w.jsx)(D,{name:e.exists?`file`:`alertTri`,size:13,stroke:2})}),(0,w.jsxs)(`span`,{style:{flex:1,minWidth:0},children:[(0,w.jsx)(`span`,{style:{display:`block`,fontSize:12.5,color:S.ink,fontWeight:800,whiteSpace:`nowrap`,overflow:`hidden`,textOverflow:`ellipsis`},children:a}),(0,w.jsx)(`span`,{className:`mono`,style:{display:`block`,marginTop:3,color:S.ink4,fontSize:10.5,whiteSpace:`nowrap`,overflow:`hidden`,textOverflow:`ellipsis`},children:e.path})]}),(0,w.jsx)($,{tone:e.exists?`slate`:`amber`,children:c})]},`${e.kind}-${e.path}`)})})]}),(0,w.jsxs)(`div`,{style:{border:`1px solid ${S.borderSoft}`,borderRadius:8,overflow:`hidden`,background:S.surface,minWidth:0},children:[(0,w.jsxs)(`div`,{style:{padding:`12px 16px`,display:`flex`,alignItems:`center`,gap:10,borderBottom:`1px solid ${S.borderSoft}`},children:[(0,w.jsx)(`div`,{className:`mono`,style:{flex:1,minWidth:0,color:S.ink,fontSize:12.5,fontWeight:800,whiteSpace:`nowrap`,overflow:`hidden`,textOverflow:`ellipsis`},children:s.path}),(0,w.jsx)(w_,{tone:`slate`,onClick:()=>o(s.preview||``),children:`重置`}),(0,w.jsx)(w_,{tone:`blue`,disabled:!0,title:`当前只读展示真实配置,写入接口尚未开放`,children:`保存`})]}),(0,w.jsxs)(`div`,{style:{padding:`18px 20px`,display:`grid`,gap:18,maxHeight:390,overflow:`auto`},children:[(0,w.jsxs)(`div`,{children:[(0,w.jsx)(`div`,{style:{color:S.ink3,fontSize:12.5,fontWeight:800,marginBottom:12},children:`结构化字段`}),(0,w.jsxs)(`div`,{style:{display:`grid`,gridTemplateColumns:`180px 1fr`,gap:`12px 22px`,alignItems:`center`},children:[(0,w.jsxs)(`div`,{children:[(0,w.jsx)(`div`,{style:{fontSize:12.5,color:S.ink2,fontWeight:700},children:`文件状态`}),(0,w.jsx)(`div`,{className:`mono`,style:{fontSize:10.5,color:S.ink4,marginTop:2},children:`exists`})]}),(0,w.jsx)(`div`,{children:(0,w.jsx)($,{tone:s.exists?`green`:`amber`,children:s.exists?`存在`:`未找到`})}),(0,w.jsxs)(`div`,{children:[(0,w.jsx)(`div`,{style:{fontSize:12.5,color:S.ink2,fontWeight:700},children:`文件大小`}),(0,w.jsx)(`div`,{className:`mono`,style:{fontSize:10.5,color:S.ink4,marginTop:2},children:`size`})]}),(0,w.jsx)(`div`,{children:(0,w.jsx)($,{tone:`slate`,children:s.exists?C_(s.sizeBytes):`-`})}),(0,w.jsxs)(`div`,{children:[(0,w.jsx)(`div`,{style:{fontSize:12.5,color:S.ink2,fontWeight:700},children:`更新时间`}),(0,w.jsx)(`div`,{className:`mono`,style:{fontSize:10.5,color:S.ink4,marginTop:2},children:`mtime`})]}),(0,w.jsx)(`div`,{style:{fontSize:12.5,color:S.ink2},children:s.exists?S_(s.updatedAt):`-`})]})]}),(0,w.jsxs)(`div`,{children:[(0,w.jsx)(`div`,{style:{color:S.ink3,fontSize:12.5,fontWeight:800,marginBottom:10},children:`原始配置`}),(0,w.jsx)(`textarea`,{value:a,onChange:e=>o(e.target.value),spellCheck:!1,style:{width:`100%`,minHeight:190,resize:`vertical`,border:`1px solid ${S.border}`,borderRadius:8,padding:12,outline:`none`,background:`#0f172a`,color:`#dbeafe`,fontFamily:S.mono,fontSize:11,lineHeight:1.55}})]}),(0,w.jsxs)(`div`,{style:{display:`flex`,gap:8,flexWrap:`wrap`},children:[(0,w.jsx)($,{tone:`blue`,children:c}),(0,w.jsx)($,{tone:`slate`,children:`真实文件预览`}),(0,w.jsx)($,{tone:`slate`,children:`截断预览`}),(0,w.jsx)($,{tone:`amber`,children:`只读`})]})]})]})]})}function U_({onDone:e}){let[t,n]=(0,b.useState)(!1),[r,i]=(0,b.useState)(null),[a,o]=(0,b.useState)(``);async function s(){if(window.confirm(`只会清理工作目录已 deleted 的 Codex app-server / broker 进程。确认执行?`)){n(!0),o(``);try{i(await tf()),e?.()}catch(e){o(e?.message||String(e))}finally{n(!1)}}}let c=r?.matched?.length||0,l=r?.termed?.length||0,u=r?.killed?.length||0,d=r?.failed?.length||0;return(0,w.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,gap:12,padding:`11px 13px`,background:`#fffbeb`,border:`1px solid #fde68a`,borderRadius:8},children:[(0,w.jsx)(`span`,{style:{width:30,height:30,borderRadius:8,display:`inline-flex`,alignItems:`center`,justifyContent:`center`,color:`#92400e`,background:`#fef3c7`,flexShrink:0},children:(0,w.jsx)(D,{name:`trash`,size:15,stroke:2})}),(0,w.jsxs)(`div`,{style:{minWidth:0,flex:1},children:[(0,w.jsx)(`div`,{style:{fontSize:12.5,fontWeight:800,color:S.ink},children:`清理 stale Codex app-server`}),(0,w.jsx)(`div`,{style:{fontSize:11.5,color:S.ink3,marginTop:2},children:`仅匹配 cwd 含 deleted 且命令为 Codex app-server / app-server-broker 的进程。`}),r&&(0,w.jsxs)(`div`,{style:{display:`flex`,gap:6,marginTop:7,flexWrap:`wrap`},children:[(0,w.jsxs)($,{tone:`blue`,children:[`匹配 `,c]}),(0,w.jsxs)($,{tone:`green`,children:[`TERM `,l]}),(0,w.jsxs)($,{tone:u?`amber`:`slate`,children:[`KILL `,u]}),(0,w.jsxs)($,{tone:d?`red`:`slate`,children:[`失败 `,d]})]}),a&&(0,w.jsx)(`div`,{style:{color:S.red,fontSize:11.5,marginTop:6},children:a})]}),(0,w.jsx)(w_,{tone:`amber`,icon:`trash`,onClick:s,disabled:t,children:t?`清理中...`:`清理`})]})}function W_(){let{data:e,loading:t,error:n,refresh:r}=$d(5e3),i=e?.agentTypes||[],[a,o]=(0,b.useState)(``),[s,c]=(0,b.useState)(`board`),l=(0,b.useMemo)(()=>i.length?i.find(e=>e.id===a)||i[0]:null,[i,a]),u=e?.issues||[],d=e?.summary||{},f=e?.board||{counts:{},agents:[]},p=l?.issues?.some(e=>e.severity===`critical`);return(0,w.jsxs)(`div`,{style:{flex:1,display:`flex`,flexDirection:`column`,background:S.surfaceAlt,overflow:`hidden`},children:[(0,w.jsxs)(`div`,{style:{padding:`14px 22px`,background:S.surface,borderBottom:`1px solid ${S.border}`,flexShrink:0},children:[(0,w.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,gap:12},children:[(0,w.jsx)(`span`,{style:{width:40,height:40,borderRadius:10,display:`inline-flex`,alignItems:`center`,justifyContent:`center`,color:`#fff`,background:S.violet,boxShadow:`0 8px 18px rgba(139,92,246,.28)`},children:(0,w.jsx)(D,{name:`brain`,size:20,stroke:2})}),(0,w.jsxs)(`div`,{children:[(0,w.jsx)(`div`,{style:{...S.type.title,fontWeight:900,color:S.ink},children:`Agent 活动中心`}),(0,w.jsx)(`div`,{style:{fontSize:11.5,color:S.ink3,marginTop:3},children:`Claude Code / Codex / OpenClaw / Hermes · 进程、会话、配置与限流风险`})]}),(0,w.jsx)(`div`,{style:{flex:1}}),t&&(0,w.jsx)($,{tone:`slate`,children:`刷新中`}),n&&(0,w.jsx)($,{tone:`red`,children:`接口异常`}),e?.generatedAt&&(0,w.jsxs)(`div`,{style:{fontSize:11,color:S.ink3},children:[`更新 `,S_(e.generatedAt)]}),(0,w.jsx)(w_,{tone:`slate`,icon:`refresh`,onClick:r,children:`刷新`})]}),(0,w.jsxs)(`div`,{style:{display:`flex`,gap:10,marginTop:13,flexWrap:`wrap`},children:[(0,w.jsx)(E_,{icon:`brain`,label:`Agent 类型`,value:d.agentTypes||i.length,tone:S.blue}),(0,w.jsx)(E_,{icon:`dashboard`,label:`Board 卡片`,value:f.agents?.length||0,tone:S.teal}),(0,w.jsx)(E_,{icon:`cpu`,label:`Claude 进程`,value:d.claudeProcesses||0,tone:S.indigo}),(0,w.jsx)(E_,{icon:`code`,label:`Codex 进程`,value:d.codexProcesses||0,tone:S.cyan}),(0,w.jsx)(E_,{icon:`alertTri`,label:`风险 Worker`,value:d.riskyWorkers||0,tone:d.riskyWorkers?S.red:S.green}),(0,w.jsx)(E_,{icon:`file`,label:`配置文件`,value:d.configFiles||0,tone:S.slate})]})]}),(0,w.jsxs)(`div`,{style:{flex:1,display:`grid`,gridTemplateColumns:`300px 1fr`,gap:12,padding:12,minHeight:0},children:[(0,w.jsxs)(`div`,{style:{display:`flex`,flexDirection:`column`,gap:10,minHeight:0,overflow:`hidden`},children:[(0,w.jsx)(D_,{title:`Agent 类型`,children:(0,w.jsx)(`div`,{style:{display:`flex`,flexDirection:`column`,gap:8,padding:10,overflowY:`auto`,maxHeight:310,minHeight:250},children:i.length?i.map(e=>(0,w.jsx)(F_,{agent:e,active:l?.id===e.id,onClick:()=>{o(e.id),c(`overview`)}},e.id)):(0,w.jsx)(O_,{text:t?`正在加载...`:`没有发现 agent 活动`})})}),(0,w.jsx)(`div`,{style:{minHeight:0,overflow:`auto`},children:(0,w.jsx)(D_,{title:`全局风险`,children:(0,w.jsx)(I_,{issues:u})})})]}),(0,w.jsx)(`div`,{style:{minWidth:0,minHeight:0,display:`flex`,flexDirection:`column`,gap:10},children:(0,w.jsxs)(`div`,{style:{background:S.surface,border:`1px solid ${S.border}`,borderRadius:8,overflow:`hidden`,minHeight:0},children:[(0,w.jsxs)(`div`,{style:{padding:`14px 18px 12px`,display:`flex`,alignItems:`center`,gap:12,borderBottom:`1px solid ${S.borderSoft}`},children:[l&&(0,w.jsx)(T_,{id:l.id,issue:p,active:!0}),(0,w.jsxs)(`div`,{style:{minWidth:0},children:[(0,w.jsx)(`div`,{style:{...S.type.heading,fontWeight:900,color:S.ink},children:l?l.name:`详情`}),l&&(0,w.jsx)(`div`,{style:{fontSize:11.5,color:S.ink3,marginTop:2},children:l.description})]}),(0,w.jsx)(`div`,{style:{flex:1}}),l&&(0,w.jsx)($,{tone:`blue`,children:l.id})]}),(0,w.jsx)(`div`,{style:{padding:`0 18px`,display:`flex`,gap:4,borderBottom:`1px solid ${S.borderSoft}`,background:S.surface},children:(0,w.jsx)(Zf,{tabs:[{id:`board`,label:`Board`,icon:`dashboard`},{id:`overview`,label:`概览`,icon:`dashboard`},{id:`processes`,label:`进程`,icon:`cpu`},{id:`sessions`,label:`会话 / Chat`,icon:`message`},{id:`configs`,label:`配置`,icon:`file`},{id:`events`,label:`事件`,icon:`clock`}],active:s,onChange:c,itemAs:`button`,activeTextColor:S.blue,activeWeight:800,inactiveWeight:600,style:{gap:4},itemStyle:v_,activeItemStyle:{background:`#eff6ff`},renderLabel:e=>(0,w.jsxs)(w.Fragment,{children:[(0,w.jsx)(D,{name:e.icon,size:13,stroke:2}),e.label]})})}),(0,w.jsxs)(`div`,{style:{overflow:`auto`,maxHeight:`calc(100vh - 260px)`},children:[s!==`board`&&!l&&(0,w.jsx)(O_,{}),s===`board`&&(0,w.jsx)(P_,{board:f}),l&&s===`overview`&&(0,w.jsxs)(`div`,{style:{padding:12,display:`grid`,gap:10},children:[l.id===`codex`&&(0,w.jsx)(U_,{}),(0,w.jsxs)(`div`,{style:{display:`grid`,gridTemplateColumns:`repeat(4, minmax(120px, 1fr))`,gap:10},children:[(0,w.jsx)(E_,{icon:`cpu`,label:`进程`,value:l.processes?.length||0}),(0,w.jsx)(E_,{icon:`message`,label:`会话`,value:l.sessions?.length||0}),(0,w.jsx)(E_,{icon:`file`,label:`配置`,value:l.configs?.filter(e=>e.exists).length||0}),(0,w.jsx)(E_,{icon:`alertTri`,label:`风险`,value:l.issues?.length||0,tone:l.issues?.length?S.red:S.green})]}),(0,w.jsx)(D_,{title:`风险与提示`,children:(0,w.jsx)(I_,{issues:l.issues})}),l.workers?.length>0&&(0,w.jsx)(D_,{title:`Claude Worker`,children:(0,w.jsx)(V_,{rows:l.workers})})]}),l&&s===`processes`&&(0,w.jsxs)(`div`,{style:{display:`grid`,gap:10,padding:l.id===`codex`?12:0},children:[l.id===`codex`&&(0,w.jsx)(U_,{}),(0,w.jsx)(`div`,{style:{overflow:`hidden`,borderRadius:l.id===`codex`?8:0},children:(0,w.jsx)(R_,{rows:l.workers?.length?l.workers.map(e=>({pid:e.pid||`-`,name:e.short,sessionId:e.short,model:e.model,cmdline:e.lastTimeline,cwd:e.cwd,ageSec:0,state:e.risky?`error`:`active`})):l.processes})})]}),l&&s===`sessions`&&(0,w.jsx)(B_,{rows:l.sessions}),l&&s===`configs`&&(0,w.jsx)(H_,{rows:l.configs}),l&&s===`events`&&(0,w.jsxs)(`div`,{style:{display:`grid`,gap:10,padding:12},children:[(0,w.jsx)(D_,{title:`风险事件`,children:(0,w.jsx)(I_,{issues:l.issues})}),l.workers?.length>0&&(0,w.jsx)(D_,{title:`Worker Timeline 摘要`,children:(0,w.jsx)(V_,{rows:l.workers})})]})]})]})})]})]})}var G_={fontFamily:`"JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, monospace`};function K_(){return crypto.randomUUID&&crypto.randomUUID()||String(Math.random()).slice(2)}function q_(e){if(!e)return`新标签页`;try{return new URL(e).host||e}catch{return e}}function J_(e){let t=(e||``).trim();return t?/^https?:\/\//i.test(t)?t:(/^(localhost|\[?[0-9a-fA-F:]+\]?|(\d{1,3}\.){3}\d{1,3})/.test(t)||t.includes(`.`)?`http://`:`https://`)+t:``}function Y_(e){let t=kd();return`/api/v1/browser/proxy?url=`+encodeURIComponent(e)+(t?`&token=`+encodeURIComponent(t):``)}function X_(e=``){return{id:K_(),entries:e?[e]:[],index:e?0:-1,title:q_(e),loading:!!e,mode:`direct`,_nonce:K_()}}function Z_({name:e,size:t=16,stroke:n=1.8,disabled:r,active:i,title:a,onClick:o,style:s}){return(0,w.jsx)(`button`,{title:a,onClick:o,disabled:r,className:`edge-press`,style:{width:30,height:30,borderRadius:S.radius.sm,display:`flex`,alignItems:`center`,justifyContent:`center`,border:`none`,background:i?S.blueSoft:`transparent`,cursor:r?`default`:`pointer`,flexShrink:0,color:r?S.ink4:i?S.blueDeep:S.ink2,transition:`background ${S.duration?.hover||120}ms, color ${S.duration?.hover||120}ms`,...s},children:(0,w.jsx)(D,{name:e,size:t,stroke:n})})}function Q_(){let{data:e,refresh:t}=sf(),{data:n,refresh:r}=cf(),[i,a]=(0,b.useState)(()=>[X_()]),[o,s]=(0,b.useState)(()=>i[0].id),[c,l]=(0,b.useState)(``),[u,d]=(0,b.useState)(null),[f,p]=(0,b.useState)(!0),m=(0,b.useMemo)(()=>i.find(e=>e.id===o)||i[0],[i,o]),h=m&&m.index>=0?m.entries[m.index]:``;(0,b.useEffect)(()=>{l(h)},[o,h]);let g=(0,b.useCallback)((e,t)=>{a(n=>n.map(n=>n.id===e?t(n):n))},[]),_=(0,b.useCallback)(e=>{e&&(g(m.id,t=>{let n=t.entries.slice(0,t.index+1);return n.push(e),{...t,entries:n,index:n.length-1,title:q_(e),loading:!0,mode:`direct`,_nonce:K_()}}),df(e,q_(e)).then(r),d(null))},[m.id,g,r]),v=(0,b.useCallback)(()=>{let e=J_(c);e&&(l(e),_(e))},[c,_]),y=(0,b.useCallback)(()=>{g(m.id,e=>e.index>0?{...e,index:e.index-1,loading:!0,mode:`direct`,_nonce:K_()}:e)},[m.id,g]),x=(0,b.useCallback)(()=>{g(m.id,e=>e.index{g(m.id,e=>({...e,loading:!0,_nonce:K_()}))},[m.id,g]),T=(0,b.useCallback)(()=>{g(m.id,e=>({...e,entries:[],index:-1,title:`新标签页`,loading:!1})),l(``)},[m.id,g]);(0,b.useEffect)(()=>{if(!m||!h)return;let e=m.id,t=h;pf(t).then(n=>{n&&!n.direct&&g(e,e=>e.entries[e.index]===t?{...e,mode:`proxy`}:e)})},[m?.id,h]);let E=(0,b.useCallback)((e,t)=>{t&&t.stopPropagation(),a(t=>{let n=t.filter(t=>t.id!==e),r=n.length?n:[X_()];return e===o&&s(r[r.length-1].id),r})},[o]),O=(0,b.useCallback)((e=``)=>{let t=X_(e);a(e=>[...e,t]),s(t.id)},[]),k=m&&m.index>0,A=m&&m.index!!h&&(e||[]).some(e=>e.url===h),[e,h]),ee=(0,b.useCallback)(async()=>{if(!h)return;let n=(e||[]).find(e=>e.url===h);n?await uf(n.id):await lf(q_(h),h),t()},[h,e,t]),M=(0,b.useCallback)(async()=>{await ff(),r()},[r]),N=(0,w.jsxs)(w.Fragment,{children:[i.map(e=>{let t=e.id===o;return(0,w.jsxs)(`div`,{onClick:()=>s(e.id),className:`edge-press`,style:{display:`flex`,alignItems:`center`,gap:6,height:30,padding:`0 6px 0 10px`,borderRadius:S.radius.md,background:t?f?S.surfaceAlt:S.surface:`transparent`,border:`1px solid ${t?S.border:`transparent`}`,fontSize:12,color:S.ink,whiteSpace:`nowrap`,cursor:`pointer`,flexShrink:0,maxWidth:220},children:[(0,w.jsx)(D,{name:`globe`,size:12,stroke:1.8,style:{color:S.ink3,flexShrink:0}}),(0,w.jsx)(`span`,{style:{overflow:`hidden`,textOverflow:`ellipsis`},children:e.title}),(0,w.jsx)(`button`,{onClick:t=>E(e.id,t),className:`edge-press`,title:`关闭标签页`,style:{width:18,height:18,borderRadius:S.radius.xs,border:`none`,background:`transparent`,cursor:`pointer`,display:`flex`,alignItems:`center`,justifyContent:`center`,color:S.ink3,flexShrink:0},children:(0,w.jsx)(D,{name:`x`,size:11,stroke:2})})]},e.id)}),(0,w.jsx)(`button`,{onClick:()=>O(),className:`edge-press`,title:`新建标签页`,style:{width:28,height:28,borderRadius:S.radius.sm,border:`none`,background:`transparent`,cursor:`pointer`,display:`flex`,alignItems:`center`,justifyContent:`center`,color:S.ink2,flexShrink:0},children:(0,w.jsx)(D,{name:`plus`,size:15,stroke:2})})]}),P=(0,w.jsxs)(w.Fragment,{children:[(0,w.jsx)(Z_,{name:`chevLeft`,title:`后退`,disabled:!k,onClick:y}),(0,w.jsx)(Z_,{name:`chevRight`,title:`前进`,disabled:!A,onClick:x}),(0,w.jsx)(Z_,{name:`refresh`,title:`刷新`,disabled:!h,onClick:C}),(0,w.jsx)(Z_,{name:`home`,title:`主页`,onClick:T}),(0,w.jsxs)(`div`,{style:{flex:1,display:`flex`,alignItems:`center`,gap:8,background:S.surfaceAlt,border:`1px solid ${S.border}`,borderRadius:S.radius.pill,padding:`0 14px`,height:34,marginLeft:4,marginRight:4,minWidth:0},children:[(0,w.jsx)(D,{name:`lock`,size:12,style:{color:h.startsWith(`https://`)?S.green:S.ink3,flexShrink:0}}),(0,w.jsx)(`input`,{value:c,onChange:e=>l(e.target.value),onKeyDown:e=>{e.key===`Enter`&&v()},placeholder:`输入网址(如 192.168.1.10:3000 或 example.com)`,spellCheck:!1,style:{flex:1,border:`none`,background:`transparent`,outline:`none`,fontSize:12.5,color:S.ink,...G_}}),m&&m.loading&&(0,w.jsx)(`span`,{style:{width:6,height:6,borderRadius:`50%`,background:S.blue,flexShrink:0},className:`edge-pulse`})]}),(0,w.jsx)(Z_,{name:`star`,title:j?`取消收藏`:`收藏当前页`,active:j,disabled:!h,onClick:ee}),(0,w.jsx)(Z_,{name:`history`,title:`历史记录`,active:u===`history`,onClick:()=>d(e=>e===`history`?null:`history`)}),(0,w.jsx)(Z_,{name:`sidebar`,title:f?`展开:标签与地址栏分行`:`合并:单行紧凑`,active:f,onClick:()=>p(e=>!e)})]});return(0,w.jsxs)(`div`,{style:{flex:1,display:`flex`,flexDirection:`column`,overflow:`hidden`,background:S.surfaceAlt,position:`relative`},children:[f?(0,w.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,gap:8,padding:`6px 8px`,background:S.surface,borderBottom:`1px solid ${S.borderSoft}`,flexShrink:0},children:[(0,w.jsx)(`div`,{style:{display:`flex`,alignItems:`center`,gap:4,flexShrink:0,maxWidth:`42%`,overflowX:`auto`},children:N}),(0,w.jsx)(`div`,{style:{display:`flex`,alignItems:`center`,gap:4,flex:1,minWidth:0},children:P})]}):(0,w.jsxs)(w.Fragment,{children:[(0,w.jsx)(`div`,{style:{display:`flex`,alignItems:`center`,gap:4,padding:`6px 8px`,background:S.surfaceAlt,borderBottom:`1px solid ${S.borderSoft}`,flexShrink:0,overflowX:`auto`},children:N}),(0,w.jsx)(`div`,{style:{display:`flex`,alignItems:`center`,gap:4,padding:`8px 12px`,background:S.surface,borderBottom:`1px solid ${S.borderSoft}`,flexShrink:0},children:P})]}),h?(0,w.jsx)(`iframe`,{src:m.mode===`proxy`?Y_(h):h,sandbox:`allow-scripts allow-same-origin allow-forms allow-popups allow-popups-to-escape-sandbox`,allow:`clipboard-read; clipboard-write`,onLoad:()=>g(m.id,e=>({...e,loading:!1})),style:{flex:1,width:`100%`,border:`none`,background:`#fff`},title:`browser-content`},`${h}-${m.mode}-${m._nonce}`):(0,w.jsx)($_,{bookmarks:e||[],history:n||[],onNavigate:_,onOpenBookmarks:()=>d(`bookmarks`)}),u===`bookmarks`&&(0,w.jsx)(ev,{title:`书签`,items:(e||[]).map(e=>({id:e.id,title:e.title||e.url,url:e.url})),emptyHint:`还没有书签,点地址栏右侧 ★ 收藏当前页`,onOpen:e=>_(e.url),onDelete:e=>{uf(e.id).then(t)},onClose:()=>d(null)}),u===`history`&&(0,w.jsx)(ev,{title:`历史记录`,items:(n||[]).map((e,t)=>({id:e.url+t,title:e.title||e.url,url:e.url,sub:e.visitedAt})),emptyHint:`还没有访问记录`,onOpen:e=>_(e.url),onClear:M,onClose:()=>d(null)})]})}function $_({bookmarks:e,history:t,onNavigate:n,onOpenBookmarks:r}){let[i,a]=(0,b.useState)(``),o=()=>{let e=J_(i);e&&n(e)},s=(t||[]).slice(0,8);return(0,w.jsxs)(`div`,{style:{flex:1,display:`flex`,flexDirection:`column`,alignItems:`center`,justifyContent:`flex-start`,background:S.surfaceAlt,padding:`48px 24px`,overflow:`auto`},children:[(0,w.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,gap:10,marginBottom:24},children:[(0,w.jsx)(D,{name:`globe`,size:36,stroke:1.6,style:{color:S.blue}}),(0,w.jsx)(`span`,{style:{fontSize:24,fontWeight:700,color:S.ink},children:`浏览器`})]}),(0,w.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,gap:8,width:`100%`,maxWidth:560,background:S.surface,border:`1px solid ${S.border}`,borderRadius:S.radius.pill,padding:`0 16px`,height:44,boxShadow:S.shadow.sm},children:[(0,w.jsx)(D,{name:`search`,size:16,style:{color:S.ink3}}),(0,w.jsx)(`input`,{autoFocus:!0,value:i,onChange:e=>a(e.target.value),onKeyDown:e=>{e.key===`Enter`&&o()},placeholder:`输入网址(如 192.168.1.10:3000 或 example.com)`,spellCheck:!1,style:{flex:1,border:`none`,background:`transparent`,outline:`none`,fontSize:14,color:S.ink,...G_}})]}),e&&e.length>0&&(0,w.jsxs)(`div`,{style:{width:`100%`,maxWidth:560,marginTop:32},children:[(0,w.jsx)(`div`,{style:{fontSize:11.5,fontWeight:600,color:S.ink3,marginBottom:10,letterSpacing:.3},children:`书签`}),(0,w.jsx)(`div`,{style:{display:`grid`,gridTemplateColumns:`repeat(auto-fill, minmax(120px, 1fr))`,gap:10},children:e.slice(0,8).map(e=>(0,w.jsxs)(`button`,{onClick:()=>n(e.url),className:`edge-press`,style:{display:`flex`,flexDirection:`column`,alignItems:`center`,gap:8,padding:`14px 8px`,borderRadius:S.radius.md,border:`1px solid ${S.borderSoft}`,background:S.surface,cursor:`pointer`},children:[(0,w.jsx)(`div`,{style:{width:32,height:32,borderRadius:S.radius.sm,background:S.blueSoft,display:`flex`,alignItems:`center`,justifyContent:`center`},children:(0,w.jsx)(D,{name:`globe`,size:16,style:{color:S.blueDeep}})}),(0,w.jsx)(`span`,{style:{fontSize:11.5,color:S.ink2,textAlign:`center`,overflow:`hidden`,textOverflow:`ellipsis`,whiteSpace:`nowrap`,maxWidth:`100%`},children:e.title||e.url})]},e.id))})]}),s.length>0&&(0,w.jsxs)(`div`,{style:{width:`100%`,maxWidth:560,marginTop:28},children:[(0,w.jsx)(`div`,{style:{fontSize:11.5,fontWeight:600,color:S.ink3,marginBottom:8,letterSpacing:.3},children:`最近访问`}),s.map((e,t)=>(0,w.jsxs)(`button`,{onClick:()=>n(e.url),className:`edge-press edge-row-hover`,style:{display:`flex`,alignItems:`center`,gap:10,width:`100%`,padding:`8px 10px`,borderRadius:S.radius.sm,border:`none`,background:`transparent`,cursor:`pointer`,textAlign:`left`},children:[(0,w.jsx)(D,{name:`history`,size:13,style:{color:S.ink4,flexShrink:0}}),(0,w.jsxs)(`div`,{style:{minWidth:0,flex:1},children:[(0,w.jsx)(`div`,{style:{fontSize:12.5,color:S.ink,overflow:`hidden`,textOverflow:`ellipsis`,whiteSpace:`nowrap`},children:e.title||e.url}),(0,w.jsx)(`div`,{style:{fontSize:11,color:S.ink4,overflow:`hidden`,textOverflow:`ellipsis`,whiteSpace:`nowrap`,...G_},children:e.url})]})]},t))]})]})}function ev({title:e,items:t,emptyHint:n,onOpen:r,onDelete:i,onClear:a,onClose:o}){return(0,w.jsxs)(w.Fragment,{children:[(0,w.jsx)(`div`,{onClick:o,style:{position:`fixed`,inset:0,zIndex:50}}),(0,w.jsxs)(`div`,{style:{position:`absolute`,top:76,right:12,zIndex:51,width:320,maxHeight:360,overflowY:`auto`,background:S.surface,border:`1px solid ${S.border}`,borderRadius:S.radius.md,boxShadow:S.shadow.lg,padding:6},children:[(0,w.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,padding:`6px 10px`},children:[(0,w.jsx)(`span`,{style:{fontSize:12,fontWeight:600,color:S.ink},children:e}),(0,w.jsx)(`div`,{style:{flex:1}}),a&&t.length>0&&(0,w.jsx)(`button`,{onClick:a,className:`edge-press`,style:{fontSize:11,color:S.red,background:`transparent`,border:`none`,cursor:`pointer`,padding:`2px 4px`},children:`清空`})]}),t.length===0?(0,w.jsx)(`div`,{style:{padding:`16px 12px`,fontSize:11.5,color:S.ink4,textAlign:`center`},children:n}):t.map(e=>(0,w.jsxs)(`div`,{className:`edge-row-hover`,style:{display:`flex`,alignItems:`center`,gap:8,padding:`7px 10px`,borderRadius:S.radius.sm,cursor:`pointer`},onClick:()=>r(e),children:[(0,w.jsx)(D,{name:`globe`,size:13,style:{color:S.ink4,flexShrink:0}}),(0,w.jsxs)(`div`,{style:{minWidth:0,flex:1},children:[(0,w.jsx)(`div`,{style:{fontSize:12,color:S.ink,overflow:`hidden`,textOverflow:`ellipsis`,whiteSpace:`nowrap`},children:e.title}),(0,w.jsx)(`div`,{style:{fontSize:10.5,color:S.ink4,overflow:`hidden`,textOverflow:`ellipsis`,whiteSpace:`nowrap`,...G_},children:e.url})]}),i&&(0,w.jsx)(`button`,{onClick:t=>{t.stopPropagation(),i(e)},className:`edge-press`,title:`删除`,style:{width:22,height:22,borderRadius:S.radius.xs,border:`none`,background:`transparent`,cursor:`pointer`,color:S.ink4,display:`flex`,alignItems:`center`,justifyContent:`center`,flexShrink:0},children:(0,w.jsx)(D,{name:`trash`,size:12})})]},e.id))]})]})}function tv({accent:e=S.blue,title:t,subtitle:n,version:r,kb:i,onMgmt:a,extra:o,errorMode:s}){return(0,w.jsxs)(`div`,{style:{padding:`10px 16px`,borderBottom:`1px solid ${S.borderSoft}`,background:S.surface,display:`flex`,alignItems:`center`,gap:10,flexShrink:0},children:[(0,w.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,gap:8},children:[(0,w.jsx)(q,{tone:s?`red`:`green`,size:7,pulse:s}),(0,w.jsx)(`span`,{style:{fontSize:12.5,fontWeight:600,color:S.ink},children:t}),r&&(0,w.jsx)(J,{tone:`gray`,children:(0,w.jsx)(`span`,{className:`mono`,children:r})}),i&&(0,w.jsxs)(J,{tone:`blue`,children:[(0,w.jsx)(D,{name:`book`,size:10,stroke:2}),i]}),s&&(0,w.jsx)(J,{tone:`red`,children:`运行异常`})]}),(0,w.jsx)(`div`,{style:{fontSize:11.5,color:S.ink3,marginLeft:4},children:n}),(0,w.jsx)(`div`,{style:{flex:1}}),o,(0,w.jsxs)(`button`,{onClick:a,className:`edge-press edge-btn-secondary`,style:{...gd,height:28,padding:`0 10px`,fontSize:11.5},children:[(0,w.jsx)(D,{name:`dashboard`,size:12,stroke:1.8}),`应用管理`]})]})}function nv({app:e,onMgmt:t}){let n=e?.ports?.find(e=>e.hostPort>0)?.hostPort||e?.ports?.find(e=>e.containerPort>0)?.containerPort;if(!n)return(0,w.jsxs)(`div`,{style:{flex:1,display:`flex`,flexDirection:`column`},children:[(0,w.jsx)(tv,{accent:S.blue,title:e?.name||`App`,version:e?.version,subtitle:`iframe 嵌入`,onMgmt:t}),(0,w.jsxs)(`div`,{style:{flex:1,display:`flex`,alignItems:`center`,justifyContent:`center`,color:S.ink3,fontSize:13},children:[(0,w.jsx)(D,{name:`info`,size:16,stroke:1.8,style:{marginRight:8}}),`该应用未暴露 HostPort,无法嵌入`]})]});let r=`http://${window.location.hostname}:${n}`;return(0,w.jsxs)(`div`,{style:{flex:1,display:`flex`,flexDirection:`column`},children:[(0,w.jsx)(tv,{accent:S.blue,title:e?.name||`App`,version:e?.version,subtitle:r,onMgmt:t,errorMode:e?.state===`error`}),(0,w.jsx)(`iframe`,{src:r,style:{flex:1,width:`100%`,border:`none`},allow:`clipboard-read; clipboard-write`,title:e?.name})]})}function rv({appId:e,app:t,authed:n,onRequireAuth:r,onOpenManagement:i}){return e===`vscode`?(0,w.jsx)(av,{onMgmt:i}):e===`jupyter`?(0,w.jsx)(lv,{onMgmt:i}):e===`ollama`?(0,w.jsx)(pv,{onMgmt:i}):e===`vllm`?(0,w.jsx)(hv,{authed:n,onRequireAuth:r,onMgmt:i}):e===`comfyui`?(0,w.jsx)(gv,{onMgmt:i}):e===`sdwebui`?(0,w.jsx)(bv,{onMgmt:i}):e===`openwebui`?(0,w.jsx)(xv,{onMgmt:i}):e===`training`?(0,w.jsx)(Cv,{onMgmt:i}):e===`files`?(0,w.jsx)(fg,{}):e===`models`?(0,w.jsx)(vg,{}):e===`processes`?(0,w.jsx)(wg,{}):e===`disks`?(0,w.jsx)(Rg,{}):e===`network-connections`?(0,w.jsx)(e_,{}):e===`monitoring`?(0,w.jsx)(__,{}):e===`ai-activity`?(0,w.jsx)(W_,{}):e===`browser`?(0,w.jsx)(Q_,{}):t?(0,w.jsx)(nv,{app:t,onMgmt:i}):null}function iv(e){return(0,w.jsx)(rv,{...e})}function av({onMgmt:e}){let[t,n]=(0,b.useState)(`train.py`),[r,i]=(0,b.useState)(!0);return(0,w.jsxs)(`div`,{"data-shortcut-scope":`editor`,style:{flex:1,display:`flex`,flexDirection:`column`,background:`#1e1e1e`,color:`#cccccc`,overflow:`hidden`},children:[(0,w.jsxs)(`div`,{style:{height:30,background:`#252526`,borderBottom:`1px solid #1e1e1e`,display:`flex`,alignItems:`center`,padding:`0 8px`,flexShrink:0,fontSize:12},children:[[`文件`,`编辑`,`选择`,`查看`,`转到`,`运行`,`终端`,`帮助`].map(e=>(0,w.jsx)(`div`,{className:`edge-menu-item`,style:{padding:`5px 9px`,color:`#cccccc`,cursor:`pointer`,borderRadius:3,"--edge-menu-hover-bg":`#37373d`},children:e},e)),(0,w.jsx)(`div`,{style:{flex:1,textAlign:`center`,color:`#888`,fontSize:11.5},children:`llama-finetune — VS Code Server [GB10-DEV-01]`}),(0,w.jsxs)(`button`,{onClick:e,className:`edge-press edge-menu-item`,style:{padding:`4px 9px`,borderRadius:3,fontSize:11,color:`#888`,background:`transparent`,border:`none`,cursor:`pointer`,display:`flex`,alignItems:`center`,gap:4,"--edge-menu-hover-bg":`#37373d`},children:[(0,w.jsx)(D,{name:`dashboard`,size:11,stroke:1.8}),`管理`]})]}),(0,w.jsxs)(`div`,{style:{flex:1,display:`flex`,overflow:`hidden`},children:[(0,w.jsxs)(`div`,{style:{width:48,background:`#333`,flexShrink:0,display:`flex`,flexDirection:`column`,alignItems:`center`,padding:`6px 0`},children:[[`folder`,`search`,`history`,`play`,`apps`].map((e,t)=>(0,w.jsx)(`div`,{style:{width:36,height:36,display:`flex`,alignItems:`center`,justifyContent:`center`,color:t===0?`#ffffff`:`#858585`,cursor:`pointer`,borderLeft:t===0?`2px solid #0078d4`:`2px solid transparent`,marginBottom:2},children:(0,w.jsx)(D,{name:e,size:20,stroke:1.6})},e)),(0,w.jsx)(`div`,{style:{flex:1}}),(0,w.jsx)(`div`,{style:{width:36,height:36,display:`flex`,alignItems:`center`,justifyContent:`center`,color:`#858585`},children:(0,w.jsx)(D,{name:`user`,size:18,stroke:1.6})})]}),(0,w.jsxs)(`div`,{style:{width:240,background:`#252526`,flexShrink:0,borderRight:`1px solid #1e1e1e`,display:`flex`,flexDirection:`column`},children:[(0,w.jsx)(`div`,{style:{padding:`8px 14px 6px`,fontSize:10.5,fontWeight:700,color:`#cccccc`,letterSpacing:`0.06em`,textTransform:`uppercase`},children:`资源管理器`}),(0,w.jsxs)(`div`,{style:{padding:`0 8px 6px`,fontSize:11,color:`#969696`,display:`flex`,alignItems:`center`,gap:4},children:[(0,w.jsx)(D,{name:`chevDown`,size:11,stroke:2}),`LLAMA-FINETUNE`]}),(0,w.jsx)(`div`,{style:{flex:1,overflow:`auto`,padding:`0 8px 8px`,fontSize:12,lineHeight:1.6},children:(0,w.jsx)(ov,{nodes:[{type:`dir`,name:`datasets`,open:!1},{type:`dir`,name:`models`,open:!1},{type:`dir`,name:`checkpoints`,open:!1},{type:`dir`,name:`notebooks`,open:!0,children:[{type:`ipynb`,name:`eda.ipynb`},{type:`ipynb`,name:`sft_data_prep.ipynb`}]},{type:`dir`,name:`projects`,open:!0,children:[{type:`dir`,name:`llama-finetune`,open:!0,children:[{type:`py`,name:`train.py`,active:!0},{type:`py`,name:`dataset.py`},{type:`yaml`,name:`config.yaml`}]}]},{type:`py`,name:`utils.py`},{type:`txt`,name:`requirements.txt`},{type:`md`,name:`README.md`},{type:`env`,name:`.env`}],depth:0})})]}),(0,w.jsxs)(`div`,{style:{flex:1,display:`flex`,flexDirection:`column`,minWidth:0},children:[(0,w.jsx)(Zf,{tabs:[{name:`train.py`,icon:`py`,dirty:!0},{name:`config.yaml`,icon:`yaml`,dirty:!1},{name:`README.md`,icon:`md`,dirty:!1}],active:t,onChange:n,getId:e=>e.name,activeColor:`#0078d4`,activeTextColor:`#ffffff`,inactiveTextColor:`#969696`,indicatorPosition:`top`,style:{display:`flex`,background:`#252526`,borderBottom:`1px solid #1e1e1e`,height:35,flexShrink:0,overflowX:`auto`},itemStyle:{padding:`0 14px 0 12px`,borderRight:`1px solid #1e1e1e`,fontSize:12.5},activeItemStyle:{background:`#1e1e1e`,marginTop:-2},renderLabel:e=>(0,w.jsxs)(w.Fragment,{children:[(0,w.jsx)(sv,{type:e.icon,size:13}),e.name,e.dirty&&(0,w.jsx)(`span`,{style:{color:`#cccccc`,fontSize:16,lineHeight:0},children:`●`}),(0,w.jsx)(`span`,{style:{color:`#858585`,marginLeft:4,fontSize:14},children:`×`})]})}),(0,w.jsxs)(`div`,{style:{flex:1,display:`flex`,overflow:`hidden`,minHeight:0},children:[(0,w.jsx)(`div`,{style:{width:40,background:`#1e1e1e`,borderRight:`1px solid #1e1e1e`,fontFamily:`ui-monospace, monospace`,fontSize:12,color:`#858585`,padding:`8px 0`,textAlign:`right`,userSelect:`none`,flexShrink:0},children:Array.from({length:30}).map((e,t)=>(0,w.jsx)(`div`,{style:{padding:`0 8px`,lineHeight:`18px`,color:t===12?`#ffffff`:t===16?`#ff5555`:`#858585`},children:t+1},t))}),(0,w.jsxs)(`div`,{style:{flex:1,padding:`8px 12px`,overflow:`auto`,fontFamily:`ui-monospace, "JetBrains Mono", monospace`,fontSize:12.5,lineHeight:`18px`,color:`#d4d4d4`},children:[(0,w.jsx)(cv,{kw:`import`,rest:` torch`}),(0,w.jsx)(cv,{kw:`import`,rest:` torch.nn `,kw2:`as`,rest2:` nn`}),(0,w.jsx)(cv,{kw:`from`,rest:` transformers `,kw2:`import`,rest2:` AutoTokenizer, AutoModelForCausalLM`}),(0,w.jsx)(cv,{kw:`from`,rest:` datasets `,kw2:`import`,rest2:` load_dataset`}),(0,w.jsx)(cv,{kw:`from`,rest:` peft `,kw2:`import`,rest2:` LoraConfig, get_peft_model`}),(0,w.jsx)(cv,{kw:`from`,rest:` trl `,kw2:`import`,rest2:` SFTTrainer, SFTConfig`}),(0,w.jsx)(cv,{}),(0,w.jsx)(cv,{comment:`# Configuration`}),(0,w.jsx)(cv,{txt:`MODEL_NAME = `,str:`"meta-llama/Llama-3.1-8B"`}),(0,w.jsx)(cv,{txt:`DATASET = `,str:`"alpaca-cleaned"`}),(0,w.jsx)(cv,{txt:`OUTPUT_DIR = `,str:`"/workspace/checkpoints/llama-finetune-72h"`}),(0,w.jsx)(cv,{}),(0,w.jsx)(cv,{kw:`def`,fn:` train`,rest:`():`}),(0,w.jsx)(cv,{highlight:!0,indent:1,txt:`tokenizer = `,kw2:`AutoTokenizer`,rest:`.from_pretrained(MODEL_NAME)`}),(0,w.jsx)(cv,{indent:1,txt:`model = `,kw2:`AutoModelForCausalLM`,rest:`.from_pretrained(`}),(0,w.jsx)(cv,{indent:2,txt:`MODEL_NAME,`}),(0,w.jsx)(cv,{error:!0,indent:2,txt:`torch_dtype=torch.bfloat16, `,comment:`# OOM: 改 fp16`}),(0,w.jsx)(cv,{indent:2,txt:`device_map=`,str:`"auto"`}),(0,w.jsx)(cv,{indent:1,txt:`)`}),(0,w.jsx)(cv,{}),(0,w.jsx)(cv,{indent:1,txt:`peft_config = `,kw2:`LoraConfig`,rest:`(`}),(0,w.jsx)(cv,{indent:2,txt:`r=64, lora_alpha=128,`}),(0,w.jsx)(cv,{indent:2,txt:`target_modules=[`,str:`"q_proj"`,txt2:`, `,str2:`"v_proj"`,txt2b:`],`}),(0,w.jsx)(cv,{indent:2,txt:`lora_dropout=0.05,`}),(0,w.jsx)(cv,{indent:1,txt:`)`}),(0,w.jsx)(cv,{indent:1,txt:`model = `,kw2:`get_peft_model`,rest:`(model, peft_config)`}),(0,w.jsx)(cv,{}),(0,w.jsx)(cv,{indent:1,txt:`trainer = `,kw2:`SFTTrainer`,rest:`(...)`}),(0,w.jsx)(cv,{indent:1,kw:`return`,rest:` trainer.train()`})]})]}),r&&(0,w.jsxs)(`div`,{style:{height:220,borderTop:`1px solid #1e1e1e`,background:`#181818`,display:`flex`,flexDirection:`column`,flexShrink:0},children:[(0,w.jsxs)(`div`,{style:{display:`flex`,padding:`4px 12px`,background:`#252526`,borderBottom:`1px solid #1e1e1e`,fontSize:11.5},children:[[`终端`,`问题 1`,`输出`,`调试控制台`].map((e,t)=>(0,w.jsx)(`div`,{style:{padding:`4px 10px`,color:t===0?`#ffffff`:`#969696`,borderBottom:t===0?`2px solid #0078d4`:`2px solid transparent`,marginBottom:-1,cursor:`pointer`},children:e},e)),(0,w.jsx)(`div`,{style:{flex:1}}),(0,w.jsx)(`button`,{onClick:()=>i(!1),style:{background:`transparent`,border:`none`,color:`#858585`,cursor:`pointer`,padding:`2px 6px`,fontSize:11},children:`×`})]}),(0,w.jsxs)(`div`,{style:{flex:1,padding:`8px 14px`,fontFamily:`ui-monospace, monospace`,fontSize:12,color:`#cccccc`,overflow:`auto`,lineHeight:1.55},children:[(0,w.jsxs)(`div`,{children:[(0,w.jsx)(`span`,{style:{color:`#23d18b`},children:`dev-zhang@gb10-dev-01`}),`:`,(0,w.jsx)(`span`,{style:{color:`#3b8eea`},children:`~/projects/llama-finetune`}),`$ python train.py --resume`]}),(0,w.jsx)(`div`,{style:{color:`#969696`},children:`[2026-05-26 14:08:01] Loading tokenizer from meta-llama/Llama-3.1-8B`}),(0,w.jsx)(`div`,{style:{color:`#969696`},children:`[2026-05-26 14:08:03] Loading model... (this may take 2-3 minutes)`}),(0,w.jsx)(`div`,{style:{color:`#23d18b`},children:`[2026-05-26 14:08:18] Model loaded · 16.0 GB GPU memory`}),(0,w.jsx)(`div`,{style:{color:`#23d18b`},children:`[2026-05-26 14:08:19] LoRA adapter attached · trainable params: 41M (0.5%)`}),(0,w.jsx)(`div`,{style:{color:`#969696`},children:`[2026-05-26 14:08:20] Resuming from step 14,300 / 30,000`}),(0,w.jsxs)(`div`,{style:{color:`#cccccc`},children:[`{`,`'loss': 1.842, 'grad_norm': 0.412, 'learning_rate': 0.0001, 'epoch': 1.43`,`}`]}),(0,w.jsxs)(`div`,{style:{color:`#cccccc`},children:[`{`,`'loss': 1.821, 'grad_norm': 0.398, 'learning_rate': 0.0001, 'epoch': 1.44`,`}`]}),(0,w.jsxs)(`div`,{style:{color:`#cccccc`},children:[`{`,`'loss': 1.835, 'grad_norm': 0.405, 'learning_rate': 0.0001, 'epoch': 1.44`,`}`]}),(0,w.jsx)(`div`,{style:{color:`#ffba2c`},children:`[2026-05-26 14:14:22] WARNING: free disk space < 400GB — checkpoints may fail`}),(0,w.jsxs)(`div`,{style:{display:`flex`},children:[(0,w.jsx)(`span`,{style:{color:`#23d18b`},children:`dev-zhang@gb10-dev-01`}),`:`,(0,w.jsx)(`span`,{style:{color:`#3b8eea`},children:`~/projects/llama-finetune`}),`$\xA0`,(0,w.jsx)(`span`,{className:`edge-cursor`,style:{color:`#cccccc`},children:`▍`})]})]})]})]})]}),(0,w.jsxs)(`div`,{style:{height:22,background:`#0078d4`,color:`white`,fontSize:11.5,display:`flex`,alignItems:`center`,padding:`0 12px`,gap:14,flexShrink:0},children:[(0,w.jsxs)(`span`,{style:{display:`inline-flex`,alignItems:`center`,gap:4},children:[(0,w.jsx)(D,{name:`history`,size:11,stroke:2}),`main`]}),(0,w.jsx)(`span`,{style:{display:`inline-flex`,alignItems:`center`,gap:4},children:`✗ 0 ⚠ 2`}),(0,w.jsx)(`div`,{style:{flex:1}}),(0,w.jsx)(`span`,{children:`UTF-8`}),(0,w.jsx)(`span`,{children:`LF`}),(0,w.jsx)(`span`,{children:`Python 3.11.7 (.venv)`}),(0,w.jsx)(`span`,{children:`行 13,列 28`}),(0,w.jsx)(`span`,{children:`空格: 4`})]})]})}function ov({nodes:e,depth:t}){return e.map((e,n)=>(0,w.jsxs)(b.Fragment,{children:[(0,w.jsxs)(`div`,{style:{paddingLeft:t*14+4,display:`flex`,alignItems:`center`,gap:4,cursor:`pointer`,padding:`2px 4px 2px `+(t*14+4)+`px`,background:e.active?`rgba(255,255,255,0.08)`:`transparent`,color:e.active?`#ffffff`:`#cccccc`},children:[e.type===`dir`?(0,w.jsx)(D,{name:`chevDown`,size:10,stroke:2,style:{color:`#858585`,transform:e.open?``:`rotate(-90deg)`}}):(0,w.jsx)(`span`,{style:{width:10}}),(0,w.jsx)(sv,{type:e.type,size:12}),(0,w.jsx)(`span`,{children:e.name})]}),e.open&&e.children&&(0,w.jsx)(ov,{nodes:e.children,depth:t+1})]},n))}function sv({type:e,size:t=14}){let n={dir:{color:`#dcb67a`,icon:`folder`},py:{color:`#3572a5`,icon:`code`},yaml:{color:`#fbc02d`,icon:`code`},md:{color:`#3b82f6`,icon:`book`},txt:{color:`#9e9e9e`,icon:`code`},env:{color:`#737373`,icon:`lock`},ipynb:{color:`#f37726`,icon:`jupyter`}},r=n[e]||n.txt;return(0,w.jsx)(`span`,{style:{color:r.color,display:`inline-flex`},children:(0,w.jsx)(D,{name:r.icon,size:t,stroke:1.7})})}function cv({kw:e,kw2:t,fn:n,str:r,str2:i,comment:a,txt:o,txt2:s,txt2b:c,rest:l,rest2:u,indent:d=0,highlight:f,error:p}){return(0,w.jsxs)(`div`,{style:{paddingLeft:d*24,position:`relative`,background:f?`rgba(33,150,243,0.12)`:p?`rgba(255,85,85,0.08)`:`transparent`},children:[a&&(0,w.jsx)(`span`,{style:{color:`#6a9955`},children:a}),e&&(0,w.jsx)(`span`,{style:{color:`#c586c0`},children:e}),n&&(0,w.jsx)(`span`,{style:{color:`#dcdcaa`},children:n}),t&&(0,w.jsx)(`span`,{style:{color:`#4ec9b0`},children:t}),o&&(0,w.jsx)(`span`,{children:o}),r&&(0,w.jsx)(`span`,{style:{color:`#ce9178`},children:r}),s&&(0,w.jsx)(`span`,{children:s}),i&&(0,w.jsx)(`span`,{style:{color:`#ce9178`},children:i}),c&&(0,w.jsx)(`span`,{children:c}),l&&(0,w.jsx)(`span`,{children:l}),u&&(0,w.jsx)(`span`,{children:u}),!e&&!n&&!o&&!a&&!l&&`\xA0`]})}function lv({onMgmt:e}){return(0,w.jsxs)(`div`,{"data-shortcut-scope":`editor`,style:{flex:1,display:`flex`,flexDirection:`column`,background:`#f6f6f6`,overflow:`hidden`},children:[(0,w.jsxs)(`div`,{style:{height:30,background:`#fafafa`,borderBottom:`1px solid #d8d8d8`,display:`flex`,alignItems:`center`,padding:`0 8px`,flexShrink:0,fontSize:12.5},children:[(0,w.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,gap:5,padding:`0 10px 0 6px`,borderRight:`1px solid #d8d8d8`,height:`100%`},children:[(0,w.jsx)(`div`,{style:{width:22,height:22,borderRadius:4,background:`linear-gradient(140deg, #fb923c, #c2410c)`,color:`white`,display:`flex`,alignItems:`center`,justifyContent:`center`},children:(0,w.jsx)(D,{name:`jupyter`,size:13,stroke:1.6})}),(0,w.jsx)(`span`,{style:{fontSize:12,fontWeight:600,color:S.ink},children:`JupyterLab`})]}),[`文件`,`编辑`,`查看`,`运行`,`内核`,`选项卡`,`设置`,`帮助`].map(e=>(0,w.jsx)(`div`,{style:{padding:`5px 10px`,color:`#333`,cursor:`pointer`},children:e},e)),(0,w.jsx)(`div`,{style:{flex:1}}),(0,w.jsxs)(`button`,{onClick:e,className:`edge-press edge-btn-secondary`,style:{...gd,height:22,padding:`0 8px`,fontSize:11},children:[(0,w.jsx)(D,{name:`dashboard`,size:11,stroke:1.8}),`管理`]})]}),(0,w.jsxs)(`div`,{style:{flex:1,display:`flex`,overflow:`hidden`},children:[(0,w.jsx)(`div`,{style:{width:40,background:`#f0f0f0`,borderRight:`1px solid #d8d8d8`,display:`flex`,flexDirection:`column`,alignItems:`center`,padding:`8px 0`,flexShrink:0},children:[{ic:`folder`,on:!0},{ic:`play`,on:!1},{ic:`sparkle`,on:!1},{ic:`apps`,on:!1},{ic:`gear`,on:!1}].map((e,t)=>(0,w.jsx)(`div`,{style:{width:32,height:32,display:`flex`,alignItems:`center`,justifyContent:`center`,color:e.on?`#0078d4`:`#666`,cursor:`pointer`,marginBottom:4,borderLeft:e.on?`2px solid #0078d4`:`2px solid transparent`},children:(0,w.jsx)(D,{name:e.ic,size:17,stroke:1.7})},t))}),(0,w.jsxs)(`div`,{style:{width:220,background:`white`,borderRight:`1px solid #d8d8d8`,display:`flex`,flexDirection:`column`,flexShrink:0},children:[(0,w.jsxs)(`div`,{style:{padding:`8px 12px`,borderBottom:`1px solid #ececec`,display:`flex`,alignItems:`center`,gap:6,fontSize:11.5},children:[(0,w.jsx)(D,{name:`plus`,size:13,stroke:1.8,style:{color:`#666`}}),(0,w.jsx)(D,{name:`folder`,size:13,stroke:1.8,style:{color:`#666`}}),(0,w.jsx)(D,{name:`refresh`,size:13,stroke:1.8,style:{color:`#666`}}),(0,w.jsx)(`div`,{style:{flex:1}}),(0,w.jsx)(`span`,{style:{color:S.ink3},children:`/workspace`})]}),(0,w.jsx)(`div`,{style:{flex:1,overflow:`auto`,padding:`4px 0`,fontSize:12},children:[[`.`,`dir`,`..`],[`notebooks`,`dir`,`23 项`],[`datasets`,`dir`,`12 项`],[`exploration.ipynb`,`ipynb`,`14 分钟前`],[`sft_data_prep.ipynb`,`ipynb`,`昨天`],[`loss_curves.ipynb`,`ipynb`,`昨天`],[`model_eval.ipynb`,`ipynb`,`5/24`],[`eda_alpaca.ipynb`,`ipynb`,`5/22`]].map(([e,t,n],r)=>(0,w.jsxs)(`div`,{style:{padding:`4px 12px 4px 18px`,display:`flex`,alignItems:`center`,gap:6,background:r===3?`#e8f0fe`:`transparent`,cursor:`pointer`},children:[(0,w.jsx)(sv,{type:t,size:13}),(0,w.jsx)(`span`,{style:{color:`#333`,fontSize:12,fontWeight:r===3?600:400},children:e}),(0,w.jsx)(`div`,{style:{flex:1}}),(0,w.jsx)(`span`,{style:{color:S.ink4,fontSize:10.5},children:n})]},r))})]}),(0,w.jsxs)(`div`,{style:{flex:1,display:`flex`,flexDirection:`column`,minWidth:0},children:[(0,w.jsx)(`div`,{style:{display:`flex`,background:`#fafafa`,borderBottom:`1px solid #d8d8d8`,flexShrink:0},children:(0,w.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,gap:6,padding:`8px 14px`,background:`white`,borderBottom:`2px solid #0078d4`,fontSize:12.5,color:S.ink,marginBottom:-1},children:[(0,w.jsx)(sv,{type:`ipynb`,size:13}),`exploration.ipynb`,(0,w.jsx)(`span`,{style:{marginLeft:4,color:`#858585`},children:`×`})]})}),(0,w.jsxs)(`div`,{style:{padding:`6px 14px`,background:`white`,borderBottom:`1px solid #ececec`,display:`flex`,alignItems:`center`,gap:6,flexShrink:0},children:[[`plus`,`stop`,`play`,`refresh`,`download`].map(e=>(0,w.jsx)(`button`,{className:`edge-press edge-menu-item`,style:{width:26,height:26,borderRadius:4,border:`1px solid transparent`,background:`transparent`,cursor:`pointer`,color:S.ink3,display:`flex`,alignItems:`center`,justifyContent:`center`,"--edge-menu-hover-bg":`#f0f0f0`},children:(0,w.jsx)(D,{name:e,size:13,stroke:1.7})},e)),(0,w.jsx)(`div`,{style:{width:1,height:18,background:`#d8d8d8`,margin:`0 4px`}}),(0,w.jsxs)(`select`,{style:{fontSize:12,padding:`2px 6px`,borderRadius:4,border:`1px solid #d8d8d8`,background:`white`},children:[(0,w.jsx)(`option`,{children:`代码`}),(0,w.jsx)(`option`,{children:`Markdown`})]}),(0,w.jsx)(`div`,{style:{flex:1}}),(0,w.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,gap:6,fontSize:11.5,color:S.ink3},children:[(0,w.jsx)(q,{tone:`green`,size:6}),(0,w.jsx)(`span`,{className:`mono`,children:`Python 3.11 (CUDA)`})]})]}),(0,w.jsxs)(`div`,{style:{flex:1,overflow:`auto`,padding:`14px 28px`,background:`white`},children:[(0,w.jsxs)(uv,{n:1,kind:`md`,children:[(0,w.jsx)(`h2`,{style:{margin:`0 0 8px`,fontSize:18,color:S.ink},children:`Alpaca 数据集 EDA`}),(0,w.jsx)(`p`,{style:{margin:0,fontSize:13,lineHeight:1.7,color:S.ink2},children:`探索 alpaca-cleaned 数据集的指令长度分布、主题聚类,并为 SFT 微调做数据准备。`})]}),(0,w.jsxs)(uv,{n:2,kind:`code`,children:[(0,w.jsxs)(`div`,{style:{fontFamily:`ui-monospace, monospace`,fontSize:12.5,lineHeight:1.65},children:[(0,w.jsxs)(`div`,{children:[(0,w.jsx)(`span`,{style:{color:`#c586c0`},children:`import`}),` pandas `,(0,w.jsx)(`span`,{style:{color:`#c586c0`},children:`as`}),` pd`]}),(0,w.jsxs)(`div`,{children:[(0,w.jsx)(`span`,{style:{color:`#c586c0`},children:`import`}),` matplotlib.pyplot `,(0,w.jsx)(`span`,{style:{color:`#c586c0`},children:`as`}),` plt`]}),(0,w.jsxs)(`div`,{children:[(0,w.jsx)(`span`,{style:{color:`#c586c0`},children:`from`}),` datasets `,(0,w.jsx)(`span`,{style:{color:`#c586c0`},children:`import`}),` load_dataset`]}),(0,w.jsx)(`div`,{children:`\xA0`}),(0,w.jsxs)(`div`,{children:[`ds = `,(0,w.jsx)(`span`,{style:{color:`#4ec9b0`},children:`load_dataset`}),`(`,(0,w.jsx)(`span`,{style:{color:`#ce9178`},children:`"yahma/alpaca-cleaned"`}),`)`]}),(0,w.jsxs)(`div`,{children:[`df = ds[`,(0,w.jsx)(`span`,{style:{color:`#ce9178`},children:`"train"`}),`].to_pandas()`]}),(0,w.jsx)(`div`,{children:`df.shape, df.columns.tolist()`})]}),(0,w.jsx)(dv,{children:(0,w.jsx)(`div`,{className:`mono`,style:{fontSize:12},children:`(51760, 3), ['instruction', 'input', 'output']`})})]}),(0,w.jsxs)(uv,{n:3,kind:`code`,children:[(0,w.jsxs)(`div`,{style:{fontFamily:`ui-monospace, monospace`,fontSize:12.5,lineHeight:1.65},children:[(0,w.jsxs)(`div`,{children:[`df[`,(0,w.jsx)(`span`,{style:{color:`#ce9178`},children:`"len"`}),`] = df[`,(0,w.jsx)(`span`,{style:{color:`#ce9178`},children:`"output"`}),`].str.`,(0,w.jsx)(`span`,{style:{color:`#4ec9b0`},children:`split`}),`().str.`,(0,w.jsx)(`span`,{style:{color:`#4ec9b0`},children:`len`}),`()`]}),(0,w.jsxs)(`div`,{children:[`df[`,(0,w.jsx)(`span`,{style:{color:`#ce9178`},children:`"len"`}),`].`,(0,w.jsx)(`span`,{style:{color:`#4ec9b0`},children:`hist`}),`(bins=`,(0,w.jsx)(`span`,{style:{color:`#b5cea8`},children:`50`}),`, figsize=(`,(0,w.jsx)(`span`,{style:{color:`#b5cea8`},children:`10`}),`, `,(0,w.jsx)(`span`,{style:{color:`#b5cea8`},children:`4`}),`))`]}),(0,w.jsxs)(`div`,{children:[`plt.`,(0,w.jsx)(`span`,{style:{color:`#4ec9b0`},children:`title`}),`(`,(0,w.jsx)(`span`,{style:{color:`#ce9178`},children:`"Token length distribution"`}),`)`]}),(0,w.jsxs)(`div`,{children:[`plt.`,(0,w.jsx)(`span`,{style:{color:`#4ec9b0`},children:`show`}),`()`]})]}),(0,w.jsx)(dv,{children:(0,w.jsx)(fv,{})})]}),(0,w.jsx)(uv,{n:4,kind:`code`,running:!0,children:(0,w.jsxs)(`div`,{style:{fontFamily:`ui-monospace, monospace`,fontSize:12.5,lineHeight:1.65},children:[(0,w.jsx)(`div`,{children:(0,w.jsx)(`span`,{style:{color:`#6a9955`},children:`# 长尾样本:超过 512 tokens 的样本占比`})}),(0,w.jsxs)(`div`,{children:[`(df[`,(0,w.jsx)(`span`,{style:{color:`#ce9178`},children:`"len"`}),`] `,`>`,` `,(0,w.jsx)(`span`,{style:{color:`#b5cea8`},children:`512`}),`).`,(0,w.jsx)(`span`,{style:{color:`#4ec9b0`},children:`mean`}),`()`]})]})}),(0,w.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,gap:8,padding:`8px 50px`,fontSize:12,color:S.ink3,cursor:`pointer`},children:[(0,w.jsx)(D,{name:`plus`,size:13,stroke:1.8}),`新增单元格`]})]}),(0,w.jsxs)(`div`,{style:{padding:`4px 14px`,background:`#fafafa`,borderTop:`1px solid #ececec`,display:`flex`,alignItems:`center`,gap:14,fontSize:11.5,color:S.ink3,flexShrink:0},children:[(0,w.jsxs)(`span`,{style:{display:`inline-flex`,alignItems:`center`,gap:4},children:[(0,w.jsx)(q,{tone:`green`,size:6}),`已保存`]}),(0,w.jsx)(`span`,{children:`3 / 4 单元格`}),(0,w.jsx)(`div`,{style:{flex:1}}),(0,w.jsx)(`span`,{className:`mono`,children:`PyTorch 2.5.1 · CUDA 12.4`}),(0,w.jsxs)(`span`,{style:{display:`inline-flex`,alignItems:`center`,gap:4},children:[(0,w.jsx)(D,{name:`bolt`,size:11,stroke:1.8}),(0,w.jsx)(`span`,{className:`mono`,children:`12% GPU`})]}),(0,w.jsx)(`span`,{className:`mono`,children:`RAM 3.8 GB`})]})]})]})]})}function uv({n:e,kind:t,running:n,children:r}){let i=t===`code`;return(0,w.jsxs)(`div`,{style:{display:`flex`,gap:8,marginBottom:10},children:[(0,w.jsx)(`div`,{style:{width:50,fontFamily:`ui-monospace, monospace`,fontSize:11.5,color:S.ink4,paddingTop:8,textAlign:`right`,flexShrink:0},children:n?(0,w.jsx)(`span`,{style:{color:S.amber},children:`[*]:`}):i?`[${e}]:`:``}),(0,w.jsx)(`div`,{style:{flex:1,padding:i?`8px 12px`:`4px 12px`,background:i?`#f8f8f8`:`transparent`,border:i?`1px solid #ececec`:`none`,borderLeft:i?`3px solid #0078d4`:`none`,borderRadius:4,minWidth:0},children:r})]})}function dv({children:e}){return(0,w.jsx)(`div`,{style:{marginTop:8,paddingTop:8,borderTop:`1px dashed #ececec`,color:S.ink2,fontSize:12},children:e})}function fv(){let e=[12,28,65,92,110,95,78,54,38,24,16,12,8,5,3],t=Math.max(...e);return(0,w.jsxs)(`svg`,{width:540,height:160,style:{display:`block`},children:[(0,w.jsx)(`line`,{x1:`40`,x2:530,y1:138,y2:138,stroke:`#999`,strokeWidth:`1`}),(0,w.jsx)(`line`,{x1:`40`,x2:`40`,y1:`10`,y2:138,stroke:`#999`,strokeWidth:`1`}),e.map((n,r)=>{let i=480/e.length,a=n/t*120;return(0,w.jsx)(`rect`,{x:42+r*i,y:138-a,width:i-2,height:a,fill:`#3b82f6`,opacity:`0.85`},r)}),(0,w.jsx)(`text`,{x:540/2,y:12,textAnchor:`middle`,fontSize:`11`,fill:`#333`,children:`Token length distribution`}),[0,200,400,600,800,1e3,1200].map((e,t)=>(0,w.jsx)(`text`,{x:42+480/6*t,y:154,fontSize:`10`,fill:`#666`,textAnchor:`middle`,children:e},t))]})}function pv({onMgmt:e}){let[t,n]=(0,b.useState)(`llama-3.1-8b-instruct`),[r,i]=(0,b.useState)(`帮我把 RAG 系统的查询流程画一个简单的时序图(用 mermaid 语法):`),[a,o]=(0,b.useState)(.7),[s,c]=(0,b.useState)(1024),[l,u]=(0,b.useState)(!1),[d,f]=(0,b.useState)(`\`\`\`mermaid +sequenceDiagram + participant U as 用户 + participant W as Open WebUI + participant O as Ollama + participant V as Qdrant + + U->>W: 提问 + W->>V: 1. 检索相关文档 + V-->>W: top-k 片段 + W->>O: 2. 拼接 Prompt + 检索结果 + O-->>W: 流式生成回答 + W-->>U: 渲染答案 + 引用 +\`\`\` + +这个流程图展示了 RAG 系统的核心五步:用户提问 → 向量库检索 → 提示词组装 → LLM 生成 → 流式返回。`),p=[{name:`llama-3.1-8b-instruct`,size:`4.7 GB`,params:`8B`,family:`Llama`,loaded:!0,ctx:`128K`},{name:`qwen2.5-14b`,size:`8.7 GB`,params:`14.7B`,family:`Qwen`,loaded:!0,ctx:`128K`},{name:`qwen2.5-coder-32b`,size:`19.0 GB`,params:`32.5B`,family:`Qwen`,loaded:!1,ctx:`128K`},{name:`deepseek-r1-distill-32b`,size:`18.4 GB`,params:`32.5B`,family:`DeepSeek`,loaded:!1,ctx:`64K`},{name:`glm5-9b`,size:`5.4 GB`,params:`9.4B`,family:`GLM`,loaded:!1,ctx:`128K`},{name:`bge-m3`,size:`1.2 GB`,params:`568M`,family:`BGE`,loaded:!0,ctx:`8K`,embedding:!0}];return(0,w.jsxs)(`div`,{style:{flex:1,display:`flex`,flexDirection:`column`,overflow:`hidden`,background:S.surfaceAlt},children:[(0,w.jsx)(tv,{title:`Ollama · 本地模型推理`,subtitle:`OpenAI 兼容 API`,version:`v0.4.7`,onMgmt:e,extra:(0,w.jsxs)(`div`,{style:{display:`inline-flex`,alignItems:`center`,gap:6,padding:`3px 9px`,borderRadius:999,background:`#0f172a`,color:`#e2e8f0`,fontSize:11,fontFamily:`ui-monospace, monospace`},children:[(0,w.jsx)(D,{name:`globe`,size:11,stroke:1.8}),`http://localhost:11434/v1`]})}),(0,w.jsxs)(`div`,{style:{flex:1,display:`flex`,overflow:`hidden`},children:[(0,w.jsxs)(`div`,{style:{width:280,flexShrink:0,borderRight:`1px solid ${S.borderSoft}`,background:S.surface,overflowY:`auto`,padding:`14px 12px`},children:[(0,w.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,marginBottom:10},children:[(0,w.jsx)(`div`,{style:{fontSize:12,fontWeight:700,color:S.ink},children:`已安装模型`}),(0,w.jsx)(`div`,{style:{flex:1}}),(0,w.jsxs)(`span`,{style:{fontSize:11,color:S.ink3},children:[p.filter(e=>e.loaded).length,` / `,p.length,` 加载`]})]}),(0,w.jsxs)(`button`,{style:{width:`100%`,height:32,marginBottom:10,borderRadius:7,background:`white`,border:`1px dashed ${S.border}`,color:S.ink2,fontSize:12,fontWeight:500,cursor:`pointer`,display:`flex`,alignItems:`center`,justifyContent:`center`,gap:5},children:[(0,w.jsx)(D,{name:`download`,size:12,stroke:1.8}),`从 ollama.ai 拉取`]}),(0,w.jsx)(`div`,{style:{display:`flex`,flexDirection:`column`,gap:4},children:p.map(e=>{let r=t===e.name;return(0,w.jsxs)(`div`,{onClick:()=>n(e.name),style:{padding:`10px`,borderRadius:8,cursor:`pointer`,background:r?`#eff4ff`:`transparent`,border:`1px solid ${r?`#bfdbfe`:`transparent`}`},children:[(0,w.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,gap:6},children:[(0,w.jsx)(D,{name:`sparkle`,size:12,stroke:1.8,style:{color:r?S.blueDeep:S.ink3}}),(0,w.jsx)(`span`,{style:{fontSize:12.5,fontWeight:600,color:r?S.blueDeep:S.ink},className:`mono`,children:e.name}),(0,w.jsx)(`div`,{style:{flex:1}}),e.loaded?(0,w.jsx)(`span`,{style:{fontSize:9.5,padding:`1px 5px`,borderRadius:3,background:`#ecfdf5`,color:`#047857`,fontWeight:600,border:`1px solid #a7f3d0`},children:`常驻`}):(0,w.jsx)(`span`,{style:{fontSize:9.5,color:S.ink4},children:`未加载`})]}),(0,w.jsxs)(`div`,{style:{display:`flex`,gap:8,marginTop:5,fontSize:10.5,color:S.ink3},className:`mono tnum`,children:[(0,w.jsx)(`span`,{children:e.params}),(0,w.jsx)(`span`,{style:{color:`#cbd5e1`},children:`·`}),(0,w.jsx)(`span`,{children:e.size}),(0,w.jsx)(`span`,{style:{color:`#cbd5e1`},children:`·`}),(0,w.jsx)(`span`,{children:e.ctx}),e.embedding&&(0,w.jsx)(J,{tone:`violet`,style:{fontSize:9,padding:`0 4px`,marginLeft:2},children:`EMB`})]})]},e.name)})})]}),(0,w.jsxs)(`div`,{style:{flex:1,display:`flex`,overflow:`hidden`,minWidth:0},children:[(0,w.jsxs)(`div`,{style:{flex:1,padding:18,display:`flex`,flexDirection:`column`,gap:12,overflow:`auto`,minWidth:0},children:[(0,w.jsxs)(`div`,{children:[(0,w.jsx)(`div`,{style:{fontSize:11.5,color:S.ink3,fontWeight:600,letterSpacing:`0.04em`,textTransform:`uppercase`,marginBottom:6},children:`提示词`}),(0,w.jsx)(`textarea`,{value:r,onChange:e=>i(e.target.value),style:{width:`100%`,height:86,padding:`10px 12px`,border:`1px solid ${S.border}`,borderRadius:8,fontSize:12.5,lineHeight:1.6,color:S.ink,background:`white`,outline:`none`,resize:`vertical`,fontFamily:`inherit`}})]}),(0,w.jsxs)(`div`,{children:[(0,w.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,marginBottom:6},children:[(0,w.jsx)(`span`,{style:{fontSize:11.5,color:S.ink3,fontWeight:600,letterSpacing:`0.04em`,textTransform:`uppercase`},children:`输出`}),(0,w.jsx)(`div`,{style:{flex:1}}),l&&(0,w.jsxs)(J,{tone:`blue`,children:[(0,w.jsx)(q,{tone:`blue`,size:6,pulse:!0}),`生成中 · 28 tok/s`]})]}),(0,w.jsxs)(`div`,{style:{background:`#0b1020`,color:`#e2e8f0`,borderRadius:8,padding:`14px 16px`,minHeight:220,fontSize:12.5,lineHeight:1.75,fontFamily:`ui-monospace, monospace`,whiteSpace:`pre-wrap`},children:[d.split(/(`{3}[\s\S]*?`{3}|`[^`]+`)/g).map((e,t)=>e.startsWith("```")?(0,w.jsx)(`div`,{style:{background:`rgba(255,255,255,0.04)`,borderLeft:`2px solid ${S.green}`,padding:`8px 10px`,borderRadius:4,margin:`6px 0`,fontSize:11.5,color:`#7dd3fc`},children:e.replace(/^```\w*\n?|```$/g,``)},t):e.startsWith("`")?(0,w.jsx)(`span`,{style:{background:`rgba(255,255,255,0.06)`,padding:`1px 5px`,borderRadius:3,color:`#fbbf24`},children:e.slice(1,-1)},t):e),l&&(0,w.jsx)(`span`,{className:`edge-cursor`,style:{color:`#34d399`},children:`▍`})]})]}),(0,w.jsxs)(`button`,{onClick:()=>{u(!0),f(``);let e=0,n="正在调用模型 `"+t+"`(temperature="+a+`, max_tokens=`+s+`)… 演示模式,模拟流式输出 …`,r=setInterval(()=>{if(e>=n.length){clearInterval(r),u(!1);return}f(t=>t+n[e]),e++},18)},disabled:l,style:{height:38,borderRadius:8,background:l?`#94a3b8`:S.blue,color:`white`,border:`none`,fontSize:13,fontWeight:600,cursor:l?`wait`:`pointer`,display:`flex`,alignItems:`center`,justifyContent:`center`,gap:6},children:[(0,w.jsx)(D,{name:`play`,size:13,stroke:2}),l?`生成中…`:`运行推理`]})]}),(0,w.jsxs)(`div`,{style:{width:240,flexShrink:0,padding:16,background:S.surface,borderLeft:`1px solid ${S.borderSoft}`,overflowY:`auto`},children:[(0,w.jsx)(`div`,{style:{fontSize:12,fontWeight:700,color:S.ink,marginBottom:12},children:`推理参数`}),(0,w.jsx)(mv,{label:`Temperature`,value:a,min:0,max:2,step:.1,onChange:o}),(0,w.jsx)(mv,{label:`Max tokens`,value:s,min:64,max:4096,step:64,onChange:c}),(0,w.jsx)(mv,{label:`Top-P`,value:.95,min:0,max:1,step:.05,onChange:()=>{}}),(0,w.jsx)(mv,{label:`Frequency`,value:0,min:-2,max:2,step:.1,onChange:()=>{}}),(0,w.jsxs)(`div`,{style:{marginTop:16,paddingTop:12,borderTop:`1px solid ${S.borderSoft}`},children:[(0,w.jsx)(`div`,{style:{fontSize:11.5,fontWeight:600,color:S.ink3,marginBottom:8,letterSpacing:`0.04em`,textTransform:`uppercase`},children:`API 示例`}),(0,w.jsx)(`pre`,{style:{margin:0,padding:10,background:`#0b1020`,color:`#cbd5e1`,borderRadius:6,fontSize:10.5,lineHeight:1.55,whiteSpace:`pre-wrap`,overflow:`auto`},children:`curl localhost:11434/v1/chat/completions \\ + -H "Content-Type: application/json" \\ + -d '{"model":"${t}","messages":[...]}'`})]})]})]})]})]})}function mv({label:e,value:t,min:n,max:r,step:i,onChange:a}){return(0,w.jsxs)(`div`,{style:{marginBottom:14},children:[(0,w.jsxs)(`div`,{style:{display:`flex`,alignItems:`baseline`,marginBottom:6},children:[(0,w.jsx)(`span`,{style:{fontSize:11.5,color:S.ink2,fontWeight:500},children:e}),(0,w.jsx)(`div`,{style:{flex:1}}),(0,w.jsx)(`span`,{className:`mono tnum`,style:{fontSize:12,color:S.ink,fontWeight:600},children:t})]}),(0,w.jsx)(`input`,{type:`range`,min:n,max:r,step:i,value:t,onChange:e=>a(Number(e.target.value)),style:{width:`100%`,accentColor:S.blue}})]})}function hv({authed:e,onRequireAuth:t,onMgmt:n}){return(0,w.jsxs)(`div`,{style:{flex:1,display:`flex`,flexDirection:`column`,overflow:`hidden`,background:S.surfaceAlt},children:[(0,w.jsx)(tv,{title:`vLLM · LLM 推理服务`,subtitle:`3 次自动重启失败,需人工介入`,version:`v0.6.4`,onMgmt:n,errorMode:!0}),(0,w.jsx)(`div`,{style:{flex:1,overflowY:`auto`,padding:`24px 28px`},children:(0,w.jsxs)(`div`,{style:{maxWidth:880,margin:`0 auto`},children:[(0,w.jsxs)(`div`,{style:{background:`linear-gradient(180deg, #fef2f2 0%, white 100%)`,border:`1px solid #fecaca`,borderRadius:14,padding:24,display:`flex`,gap:18,alignItems:`flex-start`,marginBottom:14},children:[(0,w.jsx)(`div`,{className:`edge-pulse`,style:{width:60,height:60,borderRadius:16,background:`linear-gradient(140deg, #fb7185, #be123c)`,color:`white`,display:`flex`,alignItems:`center`,justifyContent:`center`,flexShrink:0,boxShadow:`0 8px 22px -4px rgba(239,68,68,0.4)`},children:(0,w.jsx)(D,{name:`alertTri`,size:28,stroke:1.7})}),(0,w.jsxs)(`div`,{style:{flex:1,minWidth:0},children:[(0,w.jsx)(`div`,{style:{fontSize:10.5,color:S.red,fontWeight:700,letterSpacing:`0.06em`,textTransform:`uppercase`,marginBottom:4},children:`CUDA OOM · 启动阶段`}),(0,w.jsx)(`div`,{style:{fontSize:19,fontWeight:700,color:S.ink,letterSpacing:`-0.01em`,lineHeight:1.3},children:`vLLM 无法加载 Llama-3.1-70B-Instruct`}),(0,w.jsxs)(`div`,{style:{fontSize:12.5,color:S.ink2,marginTop:8,lineHeight:1.7},children:[`加载 `,(0,w.jsx)(`span`,{className:`mono`,style:{background:S.surface,padding:`1px 5px`,borderRadius:3,border:`1px solid ${S.border}`},children:`llama-3.1-70b-instruct`}),` 时, GPU 显存峰值达 `,(0,w.jsx)(`strong`,{children:`124.6 GB`}),`(含 KV cache 预分配),超出 128 GB 上限。`]}),(0,w.jsxs)(`div`,{style:{display:`flex`,gap:8,marginTop:14,flexWrap:`wrap`},children:[(0,w.jsxs)(`button`,{onClick:()=>!e&&t(`强制重启 vLLM`),className:`edge-press edge-btn-primary`,style:{..._d,background:S.red,border:`none`,height:34,padding:`0 14px`,fontSize:12.5},children:[(0,w.jsx)(D,{name:`refresh`,size:13,stroke:2}),e?`强制重启`:`需验证后强制重启`]}),(0,w.jsxs)(`button`,{className:`edge-press edge-btn-secondary`,style:{...gd,height:34,padding:`0 14px`,fontSize:12.5},children:[(0,w.jsx)(D,{name:`history`,size:13,stroke:1.8}),`切换到 70B-AWQ 量化版`]}),(0,w.jsxs)(`button`,{className:`edge-press edge-btn-secondary`,style:{...gd,height:34,padding:`0 14px`,fontSize:12.5},children:[(0,w.jsx)(D,{name:`terminal`,size:13,stroke:1.8}),`查看完整 stderr`]}),(0,w.jsxs)(`button`,{onClick:n,className:`edge-press edge-btn-secondary`,style:{...gd,height:34,padding:`0 14px`,fontSize:12.5},children:[(0,w.jsx)(D,{name:`download`,size:13,stroke:1.8}),`导出诊断包`]})]})]})]}),(0,w.jsxs)(`div`,{style:{background:S.surface,border:`1px solid ${S.border}`,borderRadius:10,padding:18,marginBottom:14},children:[(0,w.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,gap:8,marginBottom:10},children:[(0,w.jsx)(D,{name:`sparkle`,size:14,stroke:1.8,style:{color:S.blueDeep}}),(0,w.jsx)(`div`,{style:{fontSize:13,fontWeight:700,color:S.ink},children:`建议处置(按推荐顺序)`}),(0,w.jsx)(`div`,{style:{flex:1}}),(0,w.jsx)(J,{tone:`blue`,children:`来自社区最佳实践库`})]}),[{step:`1`,title:`使用 AWQ / GPTQ 量化版本`,detail:"70B 全精度需 ~140GB 显存,AWQ INT4 量化后仅需 ~38GB,质量损失 <2%。推荐 `casperhansen/llama-3.1-70b-instruct-awq`。",action:`一键切换模型`,risky:!1},{step:`2`,title:`降低 max_model_len 至 4096`,detail:`KV cache 预分配按 max_model_len 计算,从 16K 降到 4K 可节约约 28GB 显存,但牺牲长上下文能力。`,action:`编辑启动参数`,risky:!0},{step:`3`,title:`启用 chunked-prefill`,detail:`vLLM 0.6.5 引入的分块预填充可降低峰值显存约 20%,对吞吐量影响很小。需升级到 0.6.5+。`,action:`升级 vLLM 镜像`,risky:!0},{step:`4`,title:`改用 8B 版本`,detail:`Llama-3.1-8B-Instruct 仅需 16GB 显存,已在 Ollama 中常驻。仅作为兜底方案。`,action:`切换到 8B`,risky:!1}].map(e=>(0,w.jsxs)(`div`,{style:{display:`flex`,gap:12,padding:`12px 0`,borderTop:`1px solid ${S.borderSoft}`},children:[(0,w.jsx)(`div`,{style:{width:24,height:24,borderRadius:6,flexShrink:0,background:S.blueSoft,color:S.blueDeep,display:`flex`,alignItems:`center`,justifyContent:`center`,fontSize:12,fontWeight:700},className:`mono`,children:e.step}),(0,w.jsxs)(`div`,{style:{flex:1},children:[(0,w.jsx)(`div`,{style:{fontSize:13,fontWeight:600,color:S.ink},children:e.title}),(0,w.jsx)(`div`,{style:{fontSize:12,color:S.ink3,lineHeight:1.65,marginTop:4},children:e.detail.split(/(`[^`]+`)/g).map((e,t)=>e.startsWith("`")?(0,w.jsx)(`span`,{className:`mono`,style:{background:S.surfaceAlt,padding:`1px 5px`,borderRadius:3,fontSize:11.5},children:e.slice(1,-1)},t):e)})]}),(0,w.jsxs)(`button`,{className:`edge-press ${e.risky?`edge-btn-danger`:`edge-btn-secondary`}`,style:{...e.risky?vd:gd,height:28,padding:`0 12px`,fontSize:11.5,alignSelf:`flex-start`},children:[e.action,(0,w.jsx)(D,{name:`chevRight`,size:11,stroke:2})]})]},e.step))]}),(0,w.jsxs)(`div`,{style:{display:`grid`,gridTemplateColumns:`1.5fr 1fr`,gap:12},children:[(0,w.jsxs)(`div`,{style:{background:S.surface,border:`1px solid ${S.border}`,borderRadius:10,padding:18},children:[(0,w.jsx)(`div`,{style:{fontSize:13,fontWeight:700,color:S.ink,marginBottom:12},children:`故障时间线`}),[{t:`10:22:48`,tone:`gray`,title:`收到启动指令`,desc:`docker exec start vllm · 触发模型加载`},{t:`10:23:09`,tone:`amber`,title:`权重加载中`,desc:`safetensors → GPU memory · 已加载 87GB`},{t:`10:23:12`,tone:`red`,title:`CUDA OOM`,desc:`KV cache 预分配失败,显存超 124.6 GB`},{t:`10:23:13`,tone:`amber`,title:`自动重启 #1`,desc:`Supervisor 触发重启,10s 后失败`},{t:`10:23:24`,tone:`amber`,title:`自动重启 #2`,desc:`退避策略升至 20s,仍失败`},{t:`10:23:48`,tone:`amber`,title:`自动重启 #3`,desc:`退避至 40s,仍失败`},{t:`10:24:08`,tone:`red`,title:`进入恢复模式`,desc:`需人工介入;告警已推送`},{t:`现在`,tone:`gray`,title:`等待操作`,desc:`运维:dev-zhang · 当前未验证`}].map((e,t,n)=>(0,w.jsxs)(`div`,{style:{display:`flex`,gap:12,paddingBottom:t===n.length-1?0:12},children:[(0,w.jsxs)(`div`,{style:{width:16,display:`flex`,flexDirection:`column`,alignItems:`center`,flexShrink:0},children:[(0,w.jsx)(q,{tone:e.tone,size:8,pulse:t===n.length-1}),t(0,w.jsx)(`div`,{style:{position:`absolute`,left:e[0],top:e[1],width:e[2],height:e[3],background:e[4],borderRadius:2,opacity:.7}},t))})]})]}),(0,w.jsxs)(`div`,{style:{width:280,background:`#1a1a1a`,flexShrink:0,borderLeft:`1px solid #333`,display:`flex`,flexDirection:`column`},children:[(0,w.jsxs)(`div`,{style:{padding:14,borderBottom:`1px solid #333`},children:[(0,w.jsxs)(`button`,{style:{width:`100%`,height:38,borderRadius:8,background:`linear-gradient(140deg, #7c3aed, #4338ca)`,color:`white`,border:`none`,fontSize:13,fontWeight:700,cursor:`pointer`,display:`flex`,alignItems:`center`,justifyContent:`center`,gap:6},children:[(0,w.jsx)(D,{name:`play`,size:13,stroke:2.2}),`Queue Prompt`]}),(0,w.jsxs)(`div`,{style:{display:`flex`,gap:6,marginTop:8},children:[(0,w.jsx)(`button`,{style:_v,children:`Save`}),(0,w.jsx)(`button`,{style:_v,children:`Load`}),(0,w.jsx)(`button`,{style:_v,children:`Clear`})]})]}),(0,w.jsx)(`div`,{style:{padding:`12px 14px 6px`,fontSize:10.5,fontWeight:700,color:`#999`,letterSpacing:`0.06em`,textTransform:`uppercase`},children:`队列 · 1 运行 / 2 等待`}),(0,w.jsxs)(`div`,{style:{padding:`0 14px`},children:[(0,w.jsx)(yv,{state:`running`,prompt:`edge AI device, neon, 8k`,progress:68}),(0,w.jsx)(yv,{state:`pending`,prompt:`cyberpunk robot dog`}),(0,w.jsx)(yv,{state:`pending`,prompt:`datacenter at night, fog`})]}),(0,w.jsx)(`div`,{style:{padding:`12px 14px 6px`,fontSize:10.5,fontWeight:700,color:`#999`,letterSpacing:`0.06em`,textTransform:`uppercase`},children:`历史`}),(0,w.jsx)(`div`,{style:{flex:1,overflowY:`auto`,padding:`0 14px 14px`,display:`grid`,gridTemplateColumns:`1fr 1fr`,gap:6},children:Array.from({length:12}).map((e,t)=>(0,w.jsx)(`div`,{style:{aspectRatio:`1`,borderRadius:6,background:`linear-gradient(${135+t*17}deg, hsl(${t*31}, 60%, 40%), hsl(${t*31+60}, 60%, 25%))`,position:`relative`,overflow:`hidden`},children:(0,w.jsxs)(`div`,{style:{position:`absolute`,bottom:2,right:4,fontSize:8.5,color:`rgba(255,255,255,0.7)`},className:`mono`,children:[`#`,4280-t]})},t))})]})]})]})}var _v={flex:1,height:26,borderRadius:5,background:`#2a2a2a`,color:`#cccccc`,border:`1px solid #3a3a3a`,fontSize:11,cursor:`pointer`};function vv({x:e,y:t,title:n,color:r,rows:i,outputs:a,highlight:o}){return(0,w.jsxs)(`div`,{style:{position:`absolute`,left:e,top:t,width:212,background:`#2a2a2a`,border:`1px solid ${o?r:`#3a3a3a`}`,borderRadius:6,overflow:`hidden`,userSelect:`none`,boxShadow:o?`0 0 0 1px ${r}66, 0 4px 12px -4px ${r}66`:`0 2px 8px -2px rgba(0,0,0,0.4)`},children:[(0,w.jsxs)(`div`,{style:{padding:`6px 10px`,background:r,color:`white`,fontSize:11,fontWeight:700,display:`flex`,alignItems:`center`,gap:4},children:[(0,w.jsx)(`div`,{style:{width:6,height:6,borderRadius:`50%`,background:`rgba(255,255,255,0.6)`}}),n]}),(0,w.jsx)(`div`,{style:{padding:`6px 10px`},children:i.map(([e,t],n)=>(0,w.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,gap:6,marginBottom:3},children:[(0,w.jsx)(`span`,{style:{fontSize:10,color:`#999`},children:e}),(0,w.jsx)(`div`,{style:{flex:1,padding:`2px 6px`,borderRadius:3,background:`#1a1a1a`,border:`1px solid #333`,fontSize:10.5,color:`#e5e5e5`,fontFamily:`ui-monospace, monospace`,overflow:`hidden`,textOverflow:`ellipsis`,whiteSpace:`nowrap`},children:t})]},n))}),(0,w.jsx)(`div`,{style:{padding:`4px 10px 8px`,display:`flex`,gap:4,flexWrap:`wrap`},children:a.map(e=>(0,w.jsx)(`span`,{style:{fontSize:9,padding:`1px 5px`,borderRadius:2,background:`#1a1a1a`,color:r,border:`1px solid ${r}44`,fontFamily:`ui-monospace, monospace`},children:e},e))})]})}function yv({state:e,prompt:t,progress:n}){return(0,w.jsxs)(`div`,{style:{padding:8,borderRadius:6,background:`#2a2a2a`,border:`1px solid #333`,marginBottom:6},children:[(0,w.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,gap:6,marginBottom:5},children:[(0,w.jsx)(q,{tone:e===`running`?`blue`:`gray`,size:6,pulse:e===`running`}),(0,w.jsx)(`span`,{style:{fontSize:11,color:e===`running`?`#7dd3fc`:`#888`,fontWeight:600},children:e===`running`?`生成中`:`等待中`}),n!=null&&(0,w.jsxs)(`span`,{style:{fontSize:10.5,color:`#888`},className:`mono tnum`,children:[n,`%`]})]}),(0,w.jsx)(`div`,{style:{fontSize:11,color:`#cccccc`,overflow:`hidden`,textOverflow:`ellipsis`,whiteSpace:`nowrap`},children:t}),n!=null&&(0,w.jsx)(`div`,{style:{height:3,background:`#1a1a1a`,borderRadius:2,marginTop:6,overflow:`hidden`},children:(0,w.jsx)(`div`,{style:{width:`${n}%`,height:`100%`,background:`#7c3aed`}})})]})}function bv({onMgmt:e}){let[t,n]=(0,b.useState)(`txt2img`),[r,i]=(0,b.useState)(`a serene mountain lake at dawn, photorealistic, 8k, golden hour lighting`),[a,o]=(0,b.useState)(`low quality, blurry, text, watermark`);return(0,w.jsxs)(`div`,{style:{flex:1,display:`flex`,flexDirection:`column`,background:S.surfaceAlt,overflow:`hidden`},children:[(0,w.jsx)(tv,{title:`Stable Diffusion WebUI`,subtitle:`AUTOMATIC1111`,version:`v1.10.1`,onMgmt:e}),(0,w.jsx)(Zf,{tabs:[`txt2img`,`img2img`,`extras`,`PNG Info`,`LoRA`,`设置`].map(e=>({id:e,label:e})),active:t,onChange:n,activeColor:`#ec4899`,activeTextColor:S.ink,style:{background:S.surface,borderBottom:`1px solid ${S.border}`,padding:`0 16px`,flexShrink:0},itemStyle:{padding:`10px 14px 12px`,fontSize:12.5,marginBottom:-1}}),(0,w.jsxs)(`div`,{style:{padding:`10px 16px`,background:S.surface,borderBottom:`1px solid ${S.borderSoft}`,display:`flex`,alignItems:`center`,gap:10,flexShrink:0},children:[(0,w.jsx)(`span`,{style:{fontSize:11.5,color:S.ink3},children:`Checkpoint`}),(0,w.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,gap:5,padding:`5px 10px`,background:S.surfaceAlt,border:`1px solid ${S.border}`,borderRadius:6,fontSize:12},children:[(0,w.jsx)(`span`,{className:`mono`,style:{color:S.ink,fontWeight:600},children:`sd_xl_base_1.0.safetensors`}),(0,w.jsx)(D,{name:`chevDown`,size:11,stroke:2,style:{color:S.ink4}})]}),(0,w.jsx)(`span`,{style:{fontSize:11.5,color:S.ink3},children:`VAE`}),(0,w.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,gap:5,padding:`5px 10px`,background:S.surfaceAlt,border:`1px solid ${S.border}`,borderRadius:6,fontSize:12},children:[(0,w.jsx)(`span`,{className:`mono`,style:{color:S.ink,fontWeight:600},children:`Automatic`}),(0,w.jsx)(D,{name:`chevDown`,size:11,stroke:2,style:{color:S.ink4}})]}),(0,w.jsx)(`div`,{style:{flex:1}}),(0,w.jsxs)(`span`,{style:{fontSize:11,color:S.ink3,display:`inline-flex`,alignItems:`center`,gap:4},children:[(0,w.jsx)(q,{tone:`green`,size:6}),`已加载 · 显存 6.8 GB`]})]}),(0,w.jsxs)(`div`,{style:{flex:1,display:`grid`,gridTemplateColumns:`1fr 1fr`,overflow:`hidden`},children:[(0,w.jsxs)(`div`,{style:{padding:16,overflowY:`auto`,display:`flex`,flexDirection:`column`,gap:12},children:[(0,w.jsxs)(`div`,{children:[(0,w.jsx)(`div`,{style:{fontSize:11.5,color:S.ink3,fontWeight:600,letterSpacing:`0.04em`,textTransform:`uppercase`,marginBottom:6},children:`提示词`}),(0,w.jsx)(`textarea`,{value:r,onChange:e=>i(e.target.value),style:{width:`100%`,height:80,padding:`10px 12px`,border:`1px solid ${S.border}`,borderRadius:8,fontSize:12.5,lineHeight:1.6,color:S.ink,background:`white`,outline:`none`,resize:`vertical`,fontFamily:`inherit`}}),(0,w.jsx)(`div`,{style:{display:`flex`,gap:4,marginTop:6,flexWrap:`wrap`},children:[`masterpiece`,`8k`,`photorealistic`,`cinematic`].map(e=>(0,w.jsxs)(`span`,{style:{fontSize:10.5,padding:`2px 7px`,borderRadius:999,background:`#fdf2f8`,color:`#9d174d`,border:`1px solid #fbcfe8`},children:[`+ `,e]},e))})]}),(0,w.jsxs)(`div`,{children:[(0,w.jsx)(`div`,{style:{fontSize:11.5,color:S.ink3,fontWeight:600,letterSpacing:`0.04em`,textTransform:`uppercase`,marginBottom:6},children:`负面提示词`}),(0,w.jsx)(`textarea`,{value:a,onChange:e=>o(e.target.value),style:{width:`100%`,height:60,padding:`10px 12px`,border:`1px solid ${S.border}`,borderRadius:8,fontSize:12.5,color:S.ink,background:`white`,outline:`none`,resize:`vertical`,fontFamily:`inherit`}})]}),(0,w.jsx)(`div`,{style:{display:`grid`,gridTemplateColumns:`1fr 1fr`,gap:10},children:[{label:`采样方法`,val:`DPM++ 2M Karras`},{label:`采样步数`,val:`32`},{label:`CFG Scale`,val:`7.5`},{label:`Seed`,val:`8421337`},{label:`宽度`,val:`1024`},{label:`高度`,val:`1024`}].map(e=>(0,w.jsxs)(`div`,{style:{padding:10,borderRadius:7,background:S.surface,border:`1px solid ${S.border}`},children:[(0,w.jsx)(`div`,{style:{fontSize:10.5,color:S.ink3},children:e.label}),(0,w.jsx)(`div`,{className:`mono`,style:{fontSize:13,color:S.ink,fontWeight:600,marginTop:3},children:e.val})]},e.label))}),(0,w.jsxs)(`button`,{style:{height:44,borderRadius:8,background:`linear-gradient(140deg, #ec4899, #9d174d)`,color:`white`,border:`none`,fontSize:14,fontWeight:700,cursor:`pointer`,display:`flex`,alignItems:`center`,justifyContent:`center`,gap:6,boxShadow:`0 4px 12px -3px rgba(236, 72, 153, 0.5)`},children:[(0,w.jsx)(D,{name:`sparkle`,size:15,stroke:2.2}),`Generate · 4 张图`]})]}),(0,w.jsxs)(`div`,{style:{background:S.surface,borderLeft:`1px solid ${S.border}`,padding:16,overflowY:`auto`},children:[(0,w.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,marginBottom:10},children:[(0,w.jsx)(`span`,{style:{fontSize:12,fontWeight:600,color:S.ink},children:`预览`}),(0,w.jsxs)(J,{tone:`green`,style:{marginLeft:8},children:[(0,w.jsx)(q,{tone:`green`,size:6,pulse:!0}),`生成中 · 步骤 24 / 32`]}),(0,w.jsx)(`div`,{style:{flex:1}}),(0,w.jsx)(`span`,{className:`mono`,style:{fontSize:11,color:S.ink3},children:`seed 8421337`})]}),(0,w.jsxs)(`div`,{style:{aspectRatio:`1`,borderRadius:10,background:`linear-gradient(135deg, #fb7185 0%, #ec4899 30%, #8b5cf6 60%, #3b82f6 100%)`,position:`relative`,overflow:`hidden`,marginBottom:10,boxShadow:`0 8px 30px -10px rgba(15,23,42,0.3)`},children:[(0,w.jsx)(`div`,{style:{position:`absolute`,bottom:0,left:0,right:0,height:`40%`,background:`linear-gradient(180deg, rgba(15,23,42,0) 0%, rgba(15,23,42,0.5) 100%)`}}),(0,w.jsx)(`div`,{style:{position:`absolute`,top:`40%`,left:0,right:0,height:`20%`,background:`radial-gradient(ellipse at center, rgba(251,191,36,0.7), transparent 70%)`}}),(0,w.jsx)(`div`,{style:{position:`absolute`,top:8,left:10,padding:`3px 8px`,borderRadius:4,background:`rgba(0,0,0,0.45)`,fontSize:10,color:`rgba(255,255,255,0.85)`,fontFamily:`ui-monospace, monospace`},children:`1024×1024 · 24/32 步`})]}),(0,w.jsx)(`div`,{style:{display:`grid`,gridTemplateColumns:`repeat(4, 1fr)`,gap:6,marginBottom:14},children:[0,1,2,3].map(e=>(0,w.jsx)(`div`,{style:{aspectRatio:`1`,borderRadius:6,cursor:`pointer`,background:`linear-gradient(${130+e*15}deg, hsl(${320-e*8},70%,60%), hsl(${260-e*12},60%,40%))`,border:e===0?`2px solid #ec4899`:`2px solid transparent`}},e))}),(0,w.jsxs)(`div`,{style:{padding:10,borderRadius:7,background:S.surfaceAlt,border:`1px solid ${S.borderSoft}`,display:`flex`,alignItems:`center`,gap:8},children:[(0,w.jsx)(`span`,{style:{fontSize:11,color:S.ink3},children:`输出`}),(0,w.jsx)(`span`,{className:`mono`,style:{fontSize:11,color:S.ink,flex:1,overflow:`hidden`,textOverflow:`ellipsis`,whiteSpace:`nowrap`},children:`/workspace/outputs/2026-05-26/00037-8421337.png`}),(0,w.jsxs)(`button`,{className:`edge-press edge-btn-secondary`,style:{...gd,height:24,padding:`0 8px`,fontSize:11},children:[(0,w.jsx)(D,{name:`folder`,size:11,stroke:1.8}),`打开`]}),(0,w.jsxs)(`button`,{className:`edge-press edge-btn-secondary`,style:{...gd,height:24,padding:`0 8px`,fontSize:11},children:[(0,w.jsx)(D,{name:`download`,size:11,stroke:1.8}),`下载`]})]})]})]})]})}function xv({onMgmt:e}){let[t,n]=(0,b.useState)(`llama-3.1-8b-instruct`);return(0,w.jsxs)(`div`,{style:{flex:1,display:`flex`,flexDirection:`column`,overflow:`hidden`,background:`#fafbfc`},children:[(0,w.jsx)(tv,{title:`Open WebUI`,subtitle:`多模型聊天前端`,version:`v0.4.7`,onMgmt:e}),(0,w.jsxs)(`div`,{style:{flex:1,display:`flex`,overflow:`hidden`},children:[(0,w.jsxs)(`div`,{style:{width:200,flexShrink:0,borderRight:`1px solid ${S.borderSoft}`,background:S.surface,padding:12,display:`flex`,flexDirection:`column`},children:[(0,w.jsxs)(`button`,{style:{height:34,borderRadius:8,marginBottom:10,background:`#0f172a`,color:`white`,border:`none`,fontSize:12.5,fontWeight:600,cursor:`pointer`,display:`flex`,alignItems:`center`,justifyContent:`center`,gap:5},children:[(0,w.jsx)(D,{name:`plus`,size:13,stroke:2.2}),`新建聊天`]}),(0,w.jsx)(`div`,{style:{fontSize:10.5,color:S.ink3,fontWeight:600,letterSpacing:`0.06em`,textTransform:`uppercase`,padding:`6px 8px`},children:`今天`}),[`LoRA 训练 vs 全参微调`,`vLLM 显存调优`].map(e=>(0,w.jsx)(`div`,{style:{padding:`7px 10px`,borderRadius:6,fontSize:12,color:S.ink2,cursor:`pointer`,marginBottom:2},children:e},e)),(0,w.jsx)(`div`,{style:{fontSize:10.5,color:S.ink3,fontWeight:600,letterSpacing:`0.06em`,textTransform:`uppercase`,padding:`10px 8px 6px`},children:`昨天`}),[`SDXL ControlNet 用法`,`RAG 数据清洗 pipeline`].map(e=>(0,w.jsx)(`div`,{style:{padding:`7px 10px`,borderRadius:6,fontSize:12,color:S.ink2,cursor:`pointer`,marginBottom:2},children:e},e)),(0,w.jsx)(`div`,{style:{flex:1}}),(0,w.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,gap:8,padding:8,borderRadius:7,background:S.surfaceAlt},children:[(0,w.jsx)(`div`,{style:{width:28,height:28,borderRadius:`50%`,background:S.blueSoft,color:S.blueDeep,display:`flex`,alignItems:`center`,justifyContent:`center`,fontSize:11,fontWeight:700},children:`张`}),(0,w.jsxs)(`div`,{style:{minWidth:0},children:[(0,w.jsx)(`div`,{style:{fontSize:12,color:S.ink,fontWeight:600},children:`dev-zhang`}),(0,w.jsx)(`div`,{style:{fontSize:10.5,color:S.ink3},children:`模型研发组`})]})]})]}),(0,w.jsxs)(`div`,{style:{flex:1,display:`flex`,flexDirection:`column`},children:[(0,w.jsx)(`div`,{style:{display:`flex`,alignItems:`center`,justifyContent:`center`,padding:`12px 18px`,borderBottom:`1px solid ${S.borderSoft}`},children:(0,w.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,gap:6,padding:`5px 12px`,borderRadius:999,background:`white`,border:`1px solid ${S.border}`,boxShadow:`0 1px 2px rgba(15,23,42,0.04)`,cursor:`pointer`},children:[(0,w.jsx)(D,{name:`sparkle`,size:13,stroke:1.8,style:{color:S.cyan}}),(0,w.jsx)(`span`,{style:{fontSize:12.5,color:S.ink,fontWeight:600},className:`mono`,children:t}),(0,w.jsx)(D,{name:`chevDown`,size:11,stroke:2,style:{color:S.ink4}})]})}),(0,w.jsxs)(`div`,{style:{flex:1,display:`flex`,flexDirection:`column`,alignItems:`center`,justifyContent:`center`,padding:32},children:[(0,w.jsx)(`div`,{style:{width:56,height:56,borderRadius:16,background:`linear-gradient(140deg, #22d3ee, #0891b2)`,color:`white`,display:`flex`,alignItems:`center`,justifyContent:`center`,marginBottom:16,boxShadow:`0 8px 22px -6px rgba(34,211,238,0.5), inset 0 1px 0 rgba(255,255,255,0.3)`},children:(0,w.jsx)(D,{name:`openwebui`,size:28,stroke:1.6})}),(0,w.jsx)(`div`,{style:{fontSize:18,fontWeight:700,color:S.ink,letterSpacing:`-0.01em`},children:`你好,dev-zhang`}),(0,w.jsx)(`div`,{style:{fontSize:12.5,color:S.ink3,marginTop:6},children:`选一个开始,或直接在下方输入你的问题`}),(0,w.jsx)(`div`,{style:{display:`grid`,gridTemplateColumns:`repeat(2, 1fr)`,gap:10,marginTop:24,maxWidth:560},children:[{icon:`sparkle`,label:`总结这周的训练日志`,desc:`从 TensorBoard 抽取 loss / 评估指标`},{icon:`wrench`,label:`排查 vLLM OOM`,desc:`基于当前 GPU 占用给出建议`},{icon:`code`,label:`写一个 LoRA 微调脚本`,desc:`Llama-3.1-8B + alpaca 数据集`},{icon:`book`,label:`解释 PagedAttention`,desc:`通俗讲讲 vLLM 的核心机制`}].map((e,t)=>(0,w.jsxs)(`div`,{style:{padding:14,borderRadius:10,background:S.surface,border:`1px solid ${S.border}`,cursor:`pointer`,display:`flex`,gap:10,alignItems:`flex-start`},children:[(0,w.jsx)(`div`,{style:{width:30,height:30,borderRadius:8,flexShrink:0,background:S.surfaceAlt,color:S.blueDeep,display:`flex`,alignItems:`center`,justifyContent:`center`},children:(0,w.jsx)(D,{name:e.icon,size:15,stroke:1.8})}),(0,w.jsxs)(`div`,{children:[(0,w.jsx)(`div`,{style:{fontSize:12.5,color:S.ink,fontWeight:600},children:e.label}),(0,w.jsx)(`div`,{style:{fontSize:11,color:S.ink3,marginTop:3},children:e.desc})]})]},t))})]}),(0,w.jsx)(`div`,{style:{padding:18},children:(0,w.jsxs)(`div`,{style:{maxWidth:720,margin:`0 auto`,border:`1.5px solid ${S.border}`,borderRadius:14,background:`white`,boxShadow:`0 4px 14px -4px rgba(15,23,42,0.08)`,padding:`4px 4px 4px 14px`,display:`flex`,alignItems:`center`,gap:8},children:[(0,w.jsx)(`input`,{placeholder:`给 Open WebUI 发送消息…`,style:{flex:1,height:40,border:`none`,outline:`none`,fontSize:13,color:S.ink,background:`transparent`}}),(0,w.jsx)(`button`,{style:Sv,children:(0,w.jsx)(D,{name:`attach`,size:15,stroke:1.8})}),(0,w.jsx)(`button`,{style:Sv,children:(0,w.jsx)(D,{name:`mic`,size:15,stroke:1.8})}),(0,w.jsx)(`button`,{style:{...Sv,background:S.cyan,color:`white`},children:(0,w.jsx)(D,{name:`send`,size:14,stroke:2.2})})]})})]})]})]})}var Sv={width:32,height:32,borderRadius:8,border:`none`,background:`transparent`,color:S.ink3,cursor:`pointer`,display:`flex`,alignItems:`center`,justifyContent:`center`};function Cv({onMgmt:e}){let t=Array.from({length:60}).map((e,t)=>2.4-.022*t+Math.sin(t*.7)*.08+Math.cos(t*.3)*.04),n=Array.from({length:60}).map((e,t)=>78+Math.sin(t*.4)*8+Math.cos(t*.7)*5);return(0,w.jsxs)(`div`,{style:{flex:1,display:`flex`,flexDirection:`column`,overflow:`hidden`,background:S.surfaceAlt},children:[(0,w.jsx)(tv,{title:`train-72h · Llama-3.1-8B LoRA 微调`,subtitle:`Unsloth + Axolotl · 数据集 alpaca-cleaned`,version:`Step 14,300 / 30,000`,onMgmt:e}),(0,w.jsx)(`div`,{style:{flex:1,overflowY:`auto`,padding:24},children:(0,w.jsxs)(`div`,{style:{maxWidth:1100,margin:`0 auto`},children:[(0,w.jsx)(`div`,{style:{display:`grid`,gridTemplateColumns:`repeat(4, 1fr)`,gap:12,marginBottom:14},children:[{label:`进度`,val:`47.7`,unit:`%`,tone:S.blue,hint:`14,300 / 30,000 step`},{label:`Loss`,val:`1.82`,unit:``,tone:S.green,hint:`↓ -0.06 (近 1h)`},{label:`吞吐量`,val:`8.4`,unit:`tok/s/GPU`,tone:S.indigo,hint:`每 step 平均 1.6s`},{label:`预计剩余`,val:`37`,unit:`小时`,tone:S.amber,hint:`完成于 2026-05-28 03:14`}].map((e,t)=>(0,w.jsxs)(`div`,{style:{background:S.surface,border:`1px solid ${S.border}`,borderRadius:10,padding:16},children:[(0,w.jsx)(`div`,{style:{fontSize:10.5,color:S.ink3,fontWeight:600,letterSpacing:`0.04em`,textTransform:`uppercase`},children:e.label}),(0,w.jsxs)(`div`,{style:{display:`flex`,alignItems:`baseline`,gap:4,marginTop:6},children:[(0,w.jsx)(`span`,{className:`mono tnum`,style:{fontSize:24,fontWeight:700,color:e.tone,letterSpacing:`-0.02em`},children:e.val}),(0,w.jsx)(`span`,{style:{fontSize:12,color:S.ink3},children:e.unit})]}),(0,w.jsx)(`div`,{style:{fontSize:11,color:S.ink3,marginTop:4},children:e.hint})]},t))}),(0,w.jsxs)(`div`,{style:{display:`grid`,gridTemplateColumns:`1fr 1fr`,gap:12,marginBottom:14},children:[(0,w.jsxs)(Yu,{title:`Training Loss`,action:(0,w.jsx)(`span`,{style:{fontSize:11.5,color:S.ink3},children:`最近 60 步`}),children:[(0,w.jsx)(Ju,{data:t,color:S.green,width:460,height:140,fill:!0,showAxis:!0,max:2.5}),(0,w.jsxs)(`div`,{style:{display:`flex`,gap:16,fontSize:11.5,marginTop:8,color:S.ink3},children:[(0,w.jsxs)(`span`,{children:[`当前 `,(0,w.jsx)(`span`,{className:`mono tnum`,style:{color:S.ink,fontWeight:600},children:t[t.length-1].toFixed(3)})]}),(0,w.jsxs)(`span`,{children:[`开始时 `,(0,w.jsx)(`span`,{className:`mono tnum`,style:{color:S.ink2},children:`2.412`})]}),(0,w.jsx)(`span`,{style:{marginLeft:`auto`,color:S.green,fontWeight:600},children:`下降 24.5%`})]})]}),(0,w.jsxs)(Yu,{title:`GPU 利用率`,action:(0,w.jsx)(`span`,{style:{fontSize:11.5,color:S.ink3},children:`平均 78%`}),children:[(0,w.jsx)(Ju,{data:n,color:S.indigo,width:460,height:140,fill:!0,showAxis:!0,max:100}),(0,w.jsxs)(`div`,{style:{display:`flex`,gap:16,fontSize:11.5,marginTop:8,color:S.ink3},children:[(0,w.jsxs)(`span`,{children:[`当前 `,(0,w.jsxs)(`span`,{className:`mono tnum`,style:{color:S.ink,fontWeight:600},children:[n[n.length-1].toFixed(0),`%`]})]}),(0,w.jsxs)(`span`,{children:[`峰值 `,(0,w.jsxs)(`span`,{className:`mono tnum`,style:{color:S.ink2},children:[Math.max(...n).toFixed(0),`%`]})]}),(0,w.jsxs)(`span`,{style:{marginLeft:`auto`},children:[`显存 `,(0,w.jsx)(`span`,{className:`mono tnum`,style:{color:S.ink,fontWeight:600},children:`38.2 / 128 GB`})]})]})]})]}),(0,w.jsxs)(`div`,{style:{display:`grid`,gridTemplateColumns:`1fr 1fr`,gap:12},children:[(0,w.jsx)(Yu,{title:`配置`,padding:0,children:(0,w.jsx)(`table`,{style:{width:`100%`,borderCollapse:`collapse`,fontSize:12.5},children:(0,w.jsx)(`tbody`,{children:[[`基础模型`,`meta-llama/Llama-3.1-8B`],[`数据集`,`yahma/alpaca-cleaned (51,760 条)`],[`方法`,`LoRA · r=64, alpha=128`],[`优化器`,`AdamW (β=0.9, 0.95)`],[`学习率`,`1e-4 · cosine + warmup 100`],[`Batch`,`8 (per device) × 4 (grad accum) = 32`],[`序列长度`,`2048`],[`精度`,`bf16`]].map(([e,t],n)=>(0,w.jsxs)(`tr`,{style:{borderTop:n?`1px solid ${S.borderSoft}`:`none`},children:[(0,w.jsx)(`td`,{style:{width:90,padding:`10px 16px`,color:S.ink3,fontSize:12},children:e}),(0,w.jsx)(`td`,{style:{padding:`10px 16px`,color:S.ink},className:`mono`,children:t})]},e))})})}),(0,w.jsx)(Yu,{title:`最近 checkpoint`,padding:0,children:(0,w.jsx)(`div`,{style:{padding:`4px 0`},children:[[`step-14000`,`52 分钟前`,`16 GB`,`loss 1.834`],[`step-13500`,`1 小时前`,`16 GB`,`loss 1.871`],[`step-13000`,`2 小时前`,`16 GB`,`loss 1.892`],[`step-12500`,`3 小时前`,`16 GB`,`loss 1.928`],[`step-12000`,`4 小时前`,`16 GB`,`loss 1.953`]].map(([e,t,n,r],i)=>(0,w.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,gap:10,padding:`10px 16px`,borderTop:i?`1px solid ${S.borderSoft}`:`none`},children:[(0,w.jsx)(D,{name:`brain`,size:14,stroke:1.8,style:{color:S.violet}}),(0,w.jsx)(`span`,{className:`mono`,style:{fontSize:12.5,color:S.ink,fontWeight:600},children:e}),(0,w.jsx)(`span`,{className:`mono`,style:{fontSize:11,color:S.ink3},children:r}),(0,w.jsx)(`div`,{style:{flex:1}}),(0,w.jsx)(`span`,{style:{fontSize:11,color:S.ink3},children:t}),(0,w.jsx)(`span`,{className:`mono`,style:{fontSize:11,color:S.ink3},children:n})]},e))})})]})]})})]})}var wv={padding:14},Tv={background:S.surfaceAlt,border:`1px solid ${S.borderSoft}`,borderRadius:8,padding:12};function Ev({app:e}){let t=e.observed?.phase||`unknown`,n=e.observed?.conditions||[],r=e.observed?.endpoints||[];return(0,w.jsxs)(`div`,{style:wv,children:[(0,w.jsxs)(`div`,{style:{display:`grid`,gridTemplateColumns:`repeat(auto-fit,minmax(150px,1fr))`,gap:8},children:[(0,w.jsx)(Pv,{label:`状态`,value:dp[t]||t,tone:fp[t]}),(0,w.jsx)(Pv,{label:`运行时`,value:`Docker Compose`}),(0,w.jsx)(Pv,{label:`配置 revision`,value:`r${e.revision||0}`}),(0,w.jsx)(Pv,{label:`服务数`,value:(e.observed?.services||[]).length})]}),e.observed?.message&&(0,w.jsx)(Lv,{tone:`amber`,children:e.observed.message}),(0,w.jsx)(Fv,{title:`入口`,children:r.length?r.map((e,t)=>(0,w.jsxs)(`a`,{href:e.url,target:`_blank`,rel:`noreferrer`,style:{display:`block`,color:S.blueDeep,marginBottom:5},children:[e.name||e.url,` · `,e.url]},t)):(0,w.jsx)(Iv,{text:`该应用没有公开入口`})}),(0,w.jsx)(Fv,{title:`运行条件`,children:n.length?n.map((e,t)=>(0,w.jsxs)(`div`,{style:{...Tv,marginBottom:6},children:[(0,w.jsx)(`strong`,{children:e.type||`Condition`}),(0,w.jsx)(`span`,{style:{marginLeft:8,color:S.ink3},children:e.status}),e.message&&(0,w.jsx)(`div`,{style:{marginTop:4,color:S.ink3},children:e.message})]},t)):(0,w.jsx)(Iv,{text:`暂无异常条件`})})]})}function Dv({app:e}){let t=e.observed?.services||[];return(0,w.jsx)(`div`,{style:wv,children:t.length?t.map(e=>(0,w.jsxs)(`div`,{style:{...Tv,marginBottom:8},children:[(0,w.jsxs)(`div`,{style:{display:`flex`,gap:8,alignItems:`center`,flexWrap:`wrap`},children:[(0,w.jsx)(q,{tone:e.health===`unhealthy`?`red`:e.state===`running`?`green`:`gray`,size:7}),(0,w.jsx)(`strong`,{children:e.name}),(0,w.jsx)(J,{tone:e.health===`healthy`?`green`:e.health===`unhealthy`?`red`:`gray`,children:e.health||`无健康检查`}),(0,w.jsx)(`span`,{style:{marginLeft:`auto`,color:S.ink3},children:e.state||`unknown`})]}),(0,w.jsx)(`div`,{className:`mono`,style:{marginTop:7,color:S.ink3,wordBreak:`break-all`},children:e.image||`—`}),!!e.ports?.length&&(0,w.jsx)(`div`,{style:{marginTop:7},children:e.ports.map((e,t)=>(0,w.jsx)(J,{tone:`blue`,children:Rv(e)},t))}),e.containerId&&(0,w.jsxs)(`div`,{className:`mono`,style:{marginTop:7,fontSize:11,color:S.ink4},children:[`container `,e.containerId.slice(0,12)]})]},e.name)):(0,w.jsx)(Iv,{text:`尚未观察到 service/container;部署任务可能仍在执行`})})}function Ov({app:e}){let t=e.observed?.services||[],[n,r]=(0,b.useState)(()=>t[0]?.name||``),{lines:i,loading:a}=Ud(e.id,3e3,300,n),o=(0,b.useRef)(null);return(0,b.useEffect)(()=>{o.current&&(o.current.scrollTop=o.current.scrollHeight)},[i]),(0,w.jsxs)(`div`,{style:wv,children:[(0,w.jsxs)(`div`,{style:{display:`flex`,gap:8,marginBottom:8,alignItems:`center`},children:[(0,w.jsxs)(J,{tone:`green`,children:[(0,w.jsx)(q,{tone:`green`,size:6,pulse:!0}),`Service 日志`]}),t.length>0&&(0,w.jsxs)(`select`,{"aria-label":`选择 service`,value:n,onChange:e=>r(e.target.value),style:{height:30,borderRadius:7,border:`1px solid ${S.border}`,padding:`0 8px`,background:S.surface},children:[(0,w.jsx)(`option`,{value:``,children:`第一个 service`}),t.map(e=>(0,w.jsx)(`option`,{value:e.name,children:e.name},e.name))]}),(0,w.jsx)(`span`,{style:{color:S.ink4,fontSize:11},children:`3 秒刷新 · 最近 300 行`})]}),(0,w.jsxs)(`div`,{ref:o,style:{background:`#0b1020`,color:`#e2e8f0`,borderRadius:8,padding:12,minHeight:320,maxHeight:`calc(100vh - 290px)`,overflow:`auto`,font:`11px/1.6 ui-monospace,monospace`},children:[!i.length&&(0,w.jsx)(`div`,{style:{color:`#64748b`},children:a?`加载日志中…`:`暂无日志`}),i.map((e,t)=>(0,w.jsx)(`div`,{style:{whiteSpace:`pre-wrap`,wordBreak:`break-all`},children:e},t))]})]})}function kv({app:e}){let{data:t,loading:n,error:r,refresh:i}=Tf(e.id),[a,o]=(0,b.useState)(null),[s,c]=(0,b.useState)(null),[l,u]=(0,b.useState)(!1),[d,f]=(0,b.useState)(!1),[p,m]=(0,b.useState)(!1),[h,g]=(0,b.useState)(null),[_,v]=(0,b.useState)(``),{task:y}=hf(h),x=Sp(),C=a??t?.compose??``,T=ap(s?.risks),E=s?.ok&&T.blocked.length===0&&(!T.confirmation.length||l)&&!d;async function D(){c(null),u(!1),m(!1);try{c(await yf({name:e.name,compose:C,appId:e.id,retainEnvironment:!0,secrets:ep(_)}))}catch(e){x.err(`预检失败:${e.message}`)}}async function O(){f(!0),m(!1);try{g((await Of({id:e.id,name:e.name,compose:C,expectedRevision:t.revision,source:e.source,confirmRisky:l,retainEnvironment:!0,secrets:ep(_)})).id),x.ok(`配置更新任务已提交`)}catch(e){e.status===409||e.reason===`revision_mismatch`?m(!0):x.err(`保存失败:${e.message}`)}finally{f(!1)}}return(0,w.jsxs)(`div`,{style:wv,children:[(0,w.jsx)(Lv,{children:"保存前必须通过后端 `docker compose config` 与风险预检;使用 expectedRevision,绝不静默覆盖并发修改。"}),n&&(0,w.jsx)(Iv,{text:`加载 Compose 事实源…`}),r&&(0,w.jsxs)(Lv,{tone:`red`,children:[`无法读取 Compose:`,String(r.message||r)]}),(0,w.jsx)(`textarea`,{"aria-label":`Compose YAML`,spellCheck:!1,value:C,onChange:e=>{o(e.target.value),c(null)},style:{width:`100%`,minHeight:360,resize:`vertical`,boxSizing:`border-box`,border:`1px solid ${S.border}`,borderRadius:8,padding:12,background:`#0b1020`,color:`#e2e8f0`,font:`12px/1.55 ui-monospace,monospace`}}),(0,w.jsx)(`label`,{style:{display:`block`,marginTop:10,marginBottom:5,fontWeight:700},children:`轮换 Secret(可选)`}),(0,w.jsx)(`textarea`,{"aria-label":`轮换 Secret`,value:_,onChange:e=>{v(e.target.value),c(null)},rows:3,spellCheck:!1,placeholder:`DB_PASSWORD=new-value`,style:{width:`100%`,resize:`vertical`,boxSizing:`border-box`,border:`1px solid ${S.border}`,borderRadius:8,padding:10,font:`12px/1.5 ui-monospace,monospace`}}),(0,w.jsx)(`div`,{style:{color:S.ink4,fontSize:11,marginTop:4},children:`只提交要新增或轮换的键;未填写的现有 Secret 由后端保留,原值不会回传浏览器。`}),(0,w.jsxs)(`div`,{style:{display:`flex`,gap:8,alignItems:`center`,marginTop:10,flexWrap:`wrap`},children:[(0,w.jsx)(`button`,{onClick:D,style:gd,children:`预检`}),(0,w.jsx)(`button`,{onClick:O,disabled:!E,style:{..._d,opacity:E?1:.55},children:`保存并重新部署`}),(0,w.jsxs)(`span`,{style:{color:S.ink4},children:[`当前 r`,t?.revision||e.revision||0]})]}),s&&(0,w.jsx)(zv,{risks:T,confirm:l,setConfirm:u}),p&&(0,w.jsxs)(Lv,{tone:`red`,children:[`配置已被其他操作更新。请重新加载最新 revision 后再修改。 `,(0,w.jsx)(`button`,{onClick:()=>{o(null),c(null),m(!1),i()},style:Bv,children:`重新加载`})]}),y&&(0,w.jsxs)(Lv,{tone:y.status===`failed`?`red`:`blue`,children:[`任务 `,y.status,` · `,y.phase||`queued`,y.message?` · ${y.message}`:``]})]})}function Av({app:e}){let{data:t,loading:n,error:r}=Ef(e.id),i=t?.vars||[];return(0,w.jsxs)(`div`,{style:wv,children:[(0,w.jsx)(Lv,{children:`环境变量接口只返回 key、类型和 configured 状态。Secret 原值不会回显;要轮换 Secret,请编辑 Compose 引用并在重新部署时提交新值。`}),n&&(0,w.jsx)(Iv,{text:`加载环境变量元信息…`}),r&&(0,w.jsx)(Lv,{tone:`red`,children:`无法读取环境变量元信息`}),i.length?i.map(e=>{let t=cp(e);return(0,w.jsxs)(`div`,{style:{...Tv,display:`flex`,gap:8,alignItems:`center`,marginBottom:6},children:[(0,w.jsx)(`code`,{children:e.key}),(0,w.jsx)(J,{tone:t.secret?`amber`:`gray`,children:t.typeLabel}),e.required&&(0,w.jsx)(J,{tone:`red`,children:`必填`}),(0,w.jsx)(`span`,{style:{marginLeft:`auto`,color:e.configured?`#166534`:S.ink4},children:e.configured?`已配置`:`未配置`})]},e.key)}):!n&&(0,w.jsx)(Iv,{text:`Compose 未声明可展示的环境变量`})]})}function jv({app:e}){let{data:t,loading:n,error:r}=Df(e.id),i=t?.volumes||[];return(0,w.jsxs)(`div`,{style:wv,children:[(0,w.jsx)(Lv,{children:`只有 managed 卷在 purge 时可删除;external、bind 与 socket 生命周期不属于应用,devbox 永不自动删除。`}),n&&(0,w.jsx)(Iv,{text:`分析存储资源…`}),r&&(0,w.jsx)(Lv,{tone:`red`,children:`无法读取存储清单`}),i.length?i.map((e,t)=>{let n=sp(e);return(0,w.jsxs)(`div`,{style:{...Tv,marginBottom:7},children:[(0,w.jsxs)(`div`,{style:{display:`flex`,gap:8,alignItems:`center`},children:[(0,w.jsx)(J,{tone:n.tone,children:n.label}),(0,w.jsx)(`code`,{style:{wordBreak:`break-all`},children:e.source||`anonymous`}),(0,w.jsx)(`span`,{style:{marginLeft:`auto`,color:e.deletable?`#b91c1c`:S.ink4},children:e.deletable?`purge 可删`:`永不自动删除`})]}),(0,w.jsxs)(`div`,{style:{marginTop:6,color:S.ink3},children:[`挂载到 `,(0,w.jsx)(`code`,{children:e.target||`—`}),` · `,n.hint]})]},`${e.source}-${e.target}-${t}`)}):!n&&(0,w.jsx)(Iv,{text:`没有声明卷或宿主挂载`}),t?.managedDataDir&&(0,w.jsxs)(`div`,{style:{...Tv,marginTop:8},children:[(0,w.jsx)(`strong`,{children:`受管数据目录`}),(0,w.jsx)(`div`,{className:`mono`,style:{marginTop:5,wordBreak:`break-all`,color:S.ink3},children:t.managedDataDir})]})]})}function Mv({app:e}){let{data:t,loading:n,error:r,refresh:i}=_f(e.id),a=Array.isArray(t)?t:t?.revisions||[],[o,s]=(0,b.useState)(null),[c,l]=(0,b.useState)(null),{task:u}=hf(c),d=Sp();async function f(t){if(window.confirm(`恢复 revision ${t.number}?\n\n回退配置不会自动恢复应用数据;数据库 schema 也不保证可逆。`)){s(t.number);try{l((await Cf(e.id,t.number)).id),d.ok(`已提交 revision ${t.number} 配置回退任务`),i()}catch(e){d.err(`回退失败:${e.message}`)}finally{s(null)}}}return(0,w.jsxs)(`div`,{style:wv,children:[(0,w.jsxs)(Lv,{tone:`amber`,children:[(0,w.jsx)(`strong`,{children:`定义回退,不是数据恢复。`}),` 回退配置不会自动恢复应用数据,数据库 schema 可能不可逆。`]}),u&&(0,w.jsxs)(Lv,{tone:u.status===`failed`?`red`:`blue`,children:[`回退任务 `,u.status,` · `,u.phase||`queued`,u.message?` · ${u.message}`:``]}),n&&(0,w.jsx)(Iv,{text:`加载 revision…`}),r&&(0,w.jsx)(Lv,{tone:`red`,children:`无法读取 revision`}),a.map(t=>(0,w.jsxs)(`div`,{style:{...Tv,marginBottom:7,display:`flex`,alignItems:`center`,gap:10},children:[(0,w.jsxs)(`strong`,{children:[`r`,t.number]}),(0,w.jsx)(`span`,{style:{color:S.ink3},children:up(t.createdAt)}),(0,w.jsx)(J,{tone:`gray`,children:t.source?.kind||`inline`}),(0,w.jsx)(`span`,{className:`mono`,style:{color:S.ink4},children:t.composeHash?.slice(0,10)}),(0,w.jsx)(`button`,{onClick:()=>f(t),disabled:o!=null||t.number===e.revision,style:{...gd,marginLeft:`auto`,opacity:t.number===e.revision?.55:1},children:t.number===e.revision?`当前`:o===t.number?`提交中…`:`回退配置`})]},t.number)),!n&&!a.length&&(0,w.jsx)(Iv,{text:`暂无 revision 记录`})]})}function Nv({app:e}){let{data:t,loading:n,error:r}=gf(e.id,4e3),i=Array.isArray(t)?t:t?.operations||[];return(0,w.jsxs)(`div`,{style:wv,children:[n&&(0,w.jsx)(Iv,{text:`加载操作记录…`}),r&&(0,w.jsx)(Lv,{tone:`red`,children:`无法读取操作记录`}),i.map(e=>(0,w.jsxs)(`div`,{style:{...Tv,marginBottom:7},children:[(0,w.jsxs)(`div`,{style:{display:`flex`,gap:8,alignItems:`center`},children:[(0,w.jsx)(q,{tone:e.status===`succeeded`?`green`:e.status===`failed`?`red`:`blue`,size:7}),(0,w.jsxs)(`strong`,{children:[e.type,e.action?` · ${e.action}`:``]}),(0,w.jsx)(J,{tone:e.status===`failed`?`red`:e.status===`succeeded`?`green`:`blue`,children:e.status}),(0,w.jsx)(`span`,{style:{marginLeft:`auto`,color:S.ink4},children:up(e.createdAt)})]}),(0,w.jsxs)(`div`,{style:{marginTop:5,color:S.ink3},children:[e.phase||`queued`,e.message?` · ${e.message}`:``,e.revision?` · r${e.revision}`:``]})]},e.id)),!n&&!i.length&&(0,w.jsx)(Iv,{text:`暂无操作记录`})]})}function Pv({label:e,value:t,tone:n=`gray`}){return(0,w.jsxs)(`div`,{style:Tv,children:[(0,w.jsx)(`div`,{style:{color:S.ink4,fontSize:11},children:e}),(0,w.jsx)(`div`,{style:{marginTop:5,fontWeight:700,color:n===`red`?`#b91c1c`:n===`green`?`#166534`:S.ink},children:t})]})}function Fv({title:e,children:t}){return(0,w.jsxs)(`div`,{style:{marginTop:14},children:[(0,w.jsx)(`div`,{style:{fontSize:12,fontWeight:700,marginBottom:7},children:e}),t]})}function Iv({text:e}){return(0,w.jsx)(`div`,{style:{...Tv,color:S.ink4,textAlign:`center`,padding:20},children:e})}function Lv({tone:e=`blue`,children:t}){let n=e===`red`?[`#fef2f2`,`#fecaca`,`#b91c1c`]:e===`amber`?[`#fffbeb`,`#fde68a`,`#92400e`]:[`#eff6ff`,`#bfdbfe`,`#1e40af`];return(0,w.jsx)(`div`,{style:{marginBottom:10,padding:10,borderRadius:8,background:n[0],border:`1px solid ${n[1]}`,color:n[2],lineHeight:1.55},children:t})}function Rv(e){return typeof e==`string`?e:`${e.hostPort||e.containerPort||``}${e.hostPort?`→${e.containerPort||``}`:``}/${e.protocol||`tcp`}`}function zv({risks:e,confirm:t,setConfirm:n}){return(0,w.jsxs)(`div`,{style:{marginTop:10},children:[(0,b.useMemo)(()=>[[`blocked`,`阻断`,e.blocked,`#b91c1c`],[`confirmation`,`需确认`,e.confirmation,`#92400e`],[`warning`,`警告`,e.warning,`#92400e`]],[e]).map(([e,t,n,r])=>n.length?(0,w.jsxs)(`div`,{style:{...Tv,marginBottom:6,color:r},children:[(0,w.jsx)(`strong`,{children:t}),n.map((e,t)=>(0,w.jsxs)(`div`,{style:{marginTop:4},children:[e.service?`${e.service}: `:``,e.message]},t))]},e):null),e.confirmation.length>0&&e.blocked.length===0&&(0,w.jsxs)(`label`,{style:{display:`flex`,gap:8,alignItems:`flex-start`,...Tv},children:[(0,w.jsx)(`input`,{type:`checkbox`,checked:t,onChange:e=>n(e.target.checked)}),(0,w.jsx)(`span`,{children:`我已了解 confirmation 级风险并显式确认。blocked 风险不可绕过。`})]}),!e.blocked.length&&!e.confirmation.length&&!e.warning.length&&(0,w.jsx)(Lv,{children:`预检通过,没有风险项。`})]})}var Bv={border:0,background:`transparent`,color:`inherit`,textDecoration:`underline`,cursor:`pointer`,fontWeight:700},Vv=s(((e,t)=>{(function(n,r){if(typeof e==`object`&&typeof t==`object`)t.exports=r();else if(typeof define==`function`&&define.amd)define([],r);else{var i=r();for(var a in i)(typeof e==`object`?e:n)[a]=i[a]}})(globalThis,(()=>(()=>{var e={4567:function(e,t,n){var r=this&&this.__decorate||function(e,t,n,r){var i,a=arguments.length,o=a<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,n):r;if(typeof Reflect==`object`&&typeof Reflect.decorate==`function`)o=Reflect.decorate(e,t,n,r);else for(var s=e.length-1;s>=0;s--)(i=e[s])&&(o=(a<3?i(o):a>3?i(t,n,o):i(t,n))||o);return a>3&&o&&Object.defineProperty(t,n,o),o},i=this&&this.__param||function(e,t){return function(n,r){t(n,r,e)}};Object.defineProperty(t,"__esModule",{value:!0}),t.AccessibilityManager=void 0;let a=n(9042),o=n(9924),s=n(844),c=n(4725),l=n(2585),u=n(3656),d=t.AccessibilityManager=class extends s.Disposable{constructor(e,t,n,r){super(),this._terminal=e,this._coreBrowserService=n,this._renderService=r,this._rowColumns=new WeakMap,this._liveRegionLineCount=0,this._charsToConsume=[],this._charsToAnnounce=``,this._accessibilityContainer=this._coreBrowserService.mainDocument.createElement(`div`),this._accessibilityContainer.classList.add(`xterm-accessibility`),this._rowContainer=this._coreBrowserService.mainDocument.createElement(`div`),this._rowContainer.setAttribute(`role`,`list`),this._rowContainer.classList.add(`xterm-accessibility-tree`),this._rowElements=[];for(let e=0;ethis._handleBoundaryFocus(e,0),this._bottomBoundaryFocusListener=e=>this._handleBoundaryFocus(e,1),this._rowElements[0].addEventListener(`focus`,this._topBoundaryFocusListener),this._rowElements[this._rowElements.length-1].addEventListener(`focus`,this._bottomBoundaryFocusListener),this._refreshRowsDimensions(),this._accessibilityContainer.appendChild(this._rowContainer),this._liveRegion=this._coreBrowserService.mainDocument.createElement(`div`),this._liveRegion.classList.add(`live-region`),this._liveRegion.setAttribute(`aria-live`,`assertive`),this._accessibilityContainer.appendChild(this._liveRegion),this._liveRegionDebouncer=this.register(new o.TimeBasedDebouncer(this._renderRows.bind(this))),!this._terminal.element)throw Error(`Cannot enable accessibility before Terminal.open`);this._terminal.element.insertAdjacentElement(`afterbegin`,this._accessibilityContainer),this.register(this._terminal.onResize((e=>this._handleResize(e.rows)))),this.register(this._terminal.onRender((e=>this._refreshRows(e.start,e.end)))),this.register(this._terminal.onScroll((()=>this._refreshRows()))),this.register(this._terminal.onA11yChar((e=>this._handleChar(e)))),this.register(this._terminal.onLineFeed((()=>this._handleChar(` +`)))),this.register(this._terminal.onA11yTab((e=>this._handleTab(e)))),this.register(this._terminal.onKey((e=>this._handleKey(e.key)))),this.register(this._terminal.onBlur((()=>this._clearLiveRegion()))),this.register(this._renderService.onDimensionsChange((()=>this._refreshRowsDimensions()))),this.register((0,u.addDisposableDomListener)(document,`selectionchange`,(()=>this._handleSelectionChange()))),this.register(this._coreBrowserService.onDprChange((()=>this._refreshRowsDimensions()))),this._refreshRows(),this.register((0,s.toDisposable)((()=>{this._accessibilityContainer.remove(),this._rowElements.length=0})))}_handleTab(e){for(let t=0;t0?this._charsToConsume.shift()!==e&&(this._charsToAnnounce+=e):this._charsToAnnounce+=e,e===` +`&&(this._liveRegionLineCount++,this._liveRegionLineCount===21&&(this._liveRegion.textContent+=a.tooMuchOutput)))}_clearLiveRegion(){this._liveRegion.textContent=``,this._liveRegionLineCount=0}_handleKey(e){this._clearLiveRegion(),/\p{Control}/u.test(e)||this._charsToConsume.push(e)}_refreshRows(e,t){this._liveRegionDebouncer.refresh(e,t,this._terminal.rows)}_renderRows(e,t){let n=this._terminal.buffer,r=n.lines.length.toString();for(let i=e;i<=t;i++){let e=n.lines.get(n.ydisp+i),t=[],a=e?.translateToString(!0,void 0,void 0,t)||``,o=(n.ydisp+i+1).toString(),s=this._rowElements[i];s&&(a.length===0?(s.innerText=`\xA0`,this._rowColumns.set(s,[0,1])):(s.textContent=a,this._rowColumns.set(s,t)),s.setAttribute(`aria-posinset`,o),s.setAttribute(`aria-setsize`,r))}this._announceCharacters()}_announceCharacters(){this._charsToAnnounce.length!==0&&(this._liveRegion.textContent+=this._charsToAnnounce,this._charsToAnnounce=``)}_handleBoundaryFocus(e,t){let n=e.target,r=this._rowElements[t===0?1:this._rowElements.length-2];if(n.getAttribute(`aria-posinset`)===(t===0?`1`:`${this._terminal.buffer.lines.length}`)||e.relatedTarget!==r)return;let i,a;if(t===0?(i=n,a=this._rowElements.pop(),this._rowContainer.removeChild(a)):(i=this._rowElements.shift(),a=n,this._rowContainer.removeChild(i)),i.removeEventListener(`focus`,this._topBoundaryFocusListener),a.removeEventListener(`focus`,this._bottomBoundaryFocusListener),t===0){let e=this._createAccessibilityTreeNode();this._rowElements.unshift(e),this._rowContainer.insertAdjacentElement(`afterbegin`,e)}else{let e=this._createAccessibilityTreeNode();this._rowElements.push(e),this._rowContainer.appendChild(e)}this._rowElements[0].addEventListener(`focus`,this._topBoundaryFocusListener),this._rowElements[this._rowElements.length-1].addEventListener(`focus`,this._bottomBoundaryFocusListener),this._terminal.scrollLines(t===0?-1:1),this._rowElements[t===0?1:this._rowElements.length-2].focus(),e.preventDefault(),e.stopImmediatePropagation()}_handleSelectionChange(){if(this._rowElements.length===0)return;let e=document.getSelection();if(!e)return;if(e.isCollapsed)return void(this._rowContainer.contains(e.anchorNode)&&this._terminal.clearSelection());if(!e.anchorNode||!e.focusNode)return void console.error(`anchorNode and/or focusNode are null`);let t={node:e.anchorNode,offset:e.anchorOffset},n={node:e.focusNode,offset:e.focusOffset};if((t.node.compareDocumentPosition(n.node)&Node.DOCUMENT_POSITION_PRECEDING||t.node===n.node&&t.offset>n.offset)&&([t,n]=[n,t]),t.node.compareDocumentPosition(this._rowElements[0])&(Node.DOCUMENT_POSITION_CONTAINED_BY|Node.DOCUMENT_POSITION_FOLLOWING)&&(t={node:this._rowElements[0].childNodes[0],offset:0}),!this._rowContainer.contains(t.node))return;let r=this._rowElements.slice(-1)[0];if(n.node.compareDocumentPosition(r)&(Node.DOCUMENT_POSITION_CONTAINED_BY|Node.DOCUMENT_POSITION_PRECEDING)&&(n={node:r,offset:r.textContent?.length??0}),!this._rowContainer.contains(n.node))return;let i=({node:e,offset:t})=>{let n=e instanceof Text?e.parentNode:e,r=parseInt(n?.getAttribute(`aria-posinset`),10)-1;if(isNaN(r))return console.warn(`row is invalid. Race condition?`),null;let i=this._rowColumns.get(n);if(!i)return console.warn(`columns is null. Race condition?`),null;let a=t=this._terminal.cols&&(++r,a=0),{row:r,column:a}},a=i(t),o=i(n);if(a&&o){if(a.row>o.row||a.row===o.row&&a.column>=o.column)throw Error(`invalid range`);this._terminal.select(a.column,a.row,(o.row-a.row)*this._terminal.cols-a.column+o.column)}}_handleResize(e){this._rowElements[this._rowElements.length-1].removeEventListener(`focus`,this._bottomBoundaryFocusListener);for(let e=this._rowContainer.children.length;ee;)this._rowContainer.removeChild(this._rowElements.pop());this._rowElements[this._rowElements.length-1].addEventListener(`focus`,this._bottomBoundaryFocusListener),this._refreshRowsDimensions()}_createAccessibilityTreeNode(){let e=this._coreBrowserService.mainDocument.createElement(`div`);return e.setAttribute(`role`,`listitem`),e.tabIndex=-1,this._refreshRowDimensions(e),e}_refreshRowsDimensions(){if(this._renderService.dimensions.css.cell.height){this._accessibilityContainer.style.width=`${this._renderService.dimensions.css.canvas.width}px`,this._rowElements.length!==this._terminal.rows&&this._handleResize(this._terminal.rows);for(let e=0;e{function n(e){return e.replace(/\r?\n/g,`\r`)}function r(e,t){return t?`\x1B[200~`+e+`\x1B[201~`:e}function i(e,t,i,a){e=r(e=n(e),i.decPrivateModes.bracketedPasteMode&&!0!==a.rawOptions.ignoreBracketedPasteMode),i.triggerDataEvent(e,!0),t.value=``}function a(e,t,n){let r=n.getBoundingClientRect(),i=e.clientX-r.left-10,a=e.clientY-r.top-10;t.style.width=`20px`,t.style.height=`20px`,t.style.left=`${i}px`,t.style.top=`${a}px`,t.style.zIndex=`1000`,t.focus()}Object.defineProperty(t,"__esModule",{value:!0}),t.rightClickHandler=t.moveTextAreaUnderMouseCursor=t.paste=t.handlePasteEvent=t.copyHandler=t.bracketTextForPaste=t.prepareTextForTerminal=void 0,t.prepareTextForTerminal=n,t.bracketTextForPaste=r,t.copyHandler=function(e,t){e.clipboardData&&e.clipboardData.setData(`text/plain`,t.selectionText),e.preventDefault()},t.handlePasteEvent=function(e,t,n,r){e.stopPropagation(),e.clipboardData&&i(e.clipboardData.getData(`text/plain`),t,n,r)},t.paste=i,t.moveTextAreaUnderMouseCursor=a,t.rightClickHandler=function(e,t,n,r,i){a(e,t,n),i&&r.rightClickSelect(e),t.value=r.selectionText,t.select()}},7239:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.ColorContrastCache=void 0;let r=n(1505);t.ColorContrastCache=class{constructor(){this._color=new r.TwoKeyMap,this._css=new r.TwoKeyMap}setCss(e,t,n){this._css.set(e,t,n)}getCss(e,t){return this._css.get(e,t)}setColor(e,t,n){this._color.set(e,t,n)}getColor(e,t){return this._color.get(e,t)}clear(){this._color.clear(),this._css.clear()}}},3656:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.addDisposableDomListener=void 0,t.addDisposableDomListener=function(e,t,n,r){e.addEventListener(t,n,r);let i=!1;return{dispose:()=>{i||(i=!0,e.removeEventListener(t,n,r))}}}},3551:function(e,t,n){var r=this&&this.__decorate||function(e,t,n,r){var i,a=arguments.length,o=a<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,n):r;if(typeof Reflect==`object`&&typeof Reflect.decorate==`function`)o=Reflect.decorate(e,t,n,r);else for(var s=e.length-1;s>=0;s--)(i=e[s])&&(o=(a<3?i(o):a>3?i(t,n,o):i(t,n))||o);return a>3&&o&&Object.defineProperty(t,n,o),o},i=this&&this.__param||function(e,t){return function(n,r){t(n,r,e)}};Object.defineProperty(t,"__esModule",{value:!0}),t.Linkifier=void 0;let a=n(3656),o=n(8460),s=n(844),c=n(2585),l=n(4725),u=t.Linkifier=class extends s.Disposable{get currentLink(){return this._currentLink}constructor(e,t,n,r,i){super(),this._element=e,this._mouseService=t,this._renderService=n,this._bufferService=r,this._linkProviderService=i,this._linkCacheDisposables=[],this._isMouseOut=!0,this._wasResized=!1,this._activeLine=-1,this._onShowLinkUnderline=this.register(new o.EventEmitter),this.onShowLinkUnderline=this._onShowLinkUnderline.event,this._onHideLinkUnderline=this.register(new o.EventEmitter),this.onHideLinkUnderline=this._onHideLinkUnderline.event,this.register((0,s.getDisposeArrayDisposable)(this._linkCacheDisposables)),this.register((0,s.toDisposable)((()=>{this._lastMouseEvent=void 0,this._activeProviderReplies?.clear()}))),this.register(this._bufferService.onResize((()=>{this._clearCurrentLink(),this._wasResized=!0}))),this.register((0,a.addDisposableDomListener)(this._element,`mouseleave`,(()=>{this._isMouseOut=!0,this._clearCurrentLink()}))),this.register((0,a.addDisposableDomListener)(this._element,`mousemove`,this._handleMouseMove.bind(this))),this.register((0,a.addDisposableDomListener)(this._element,`mousedown`,this._handleMouseDown.bind(this))),this.register((0,a.addDisposableDomListener)(this._element,`mouseup`,this._handleMouseUp.bind(this)))}_handleMouseMove(e){this._lastMouseEvent=e;let t=this._positionFromMouseEvent(e,this._element,this._mouseService);if(!t)return;this._isMouseOut=!1;let n=e.composedPath();for(let e=0;e{e?.forEach((e=>{e.link.dispose&&e.link.dispose()}))})),this._activeProviderReplies=new Map,this._activeLine=e.y);let n=!1;for(let[r,i]of this._linkProviderService.linkProviders.entries())t?this._activeProviderReplies?.get(r)&&(n=this._checkLinkProviderResult(r,e,n)):i.provideLinks(e.y,(t=>{if(this._isMouseOut)return;let i=t?.map((e=>({link:e})));this._activeProviderReplies?.set(r,i),n=this._checkLinkProviderResult(r,e,n),this._activeProviderReplies?.size===this._linkProviderService.linkProviders.length&&this._removeIntersectingLinks(e.y,this._activeProviderReplies)}))}_removeIntersectingLinks(e,t){let n=new Set;for(let r=0;re?this._bufferService.cols:r.link.range.end.x;for(let e=a;e<=o;e++){if(n.has(e)){i.splice(t--,1);break}n.add(e)}}}}_checkLinkProviderResult(e,t,n){if(!this._activeProviderReplies)return n;let r=this._activeProviderReplies.get(e),i=!1;for(let t=0;tthis._linkAtPosition(e.link,t)));e&&(n=!0,this._handleNewLink(e))}if(this._activeProviderReplies.size===this._linkProviderService.linkProviders.length&&!n)for(let e=0;ethis._linkAtPosition(e.link,t)));if(r){n=!0,this._handleNewLink(r);break}}return n}_handleMouseDown(){this._mouseDownLink=this._currentLink}_handleMouseUp(e){if(!this._currentLink)return;let t=this._positionFromMouseEvent(e,this._element,this._mouseService);t&&this._mouseDownLink===this._currentLink&&this._linkAtPosition(this._currentLink.link,t)&&this._currentLink.link.activate(e,this._currentLink.link.text)}_clearCurrentLink(e,t){this._currentLink&&this._lastMouseEvent&&(!e||!t||this._currentLink.link.range.start.y>=e&&this._currentLink.link.range.end.y<=t)&&(this._linkLeave(this._element,this._currentLink.link,this._lastMouseEvent),this._currentLink=void 0,(0,s.disposeArray)(this._linkCacheDisposables))}_handleNewLink(e){if(!this._lastMouseEvent)return;let t=this._positionFromMouseEvent(this._lastMouseEvent,this._element,this._mouseService);t&&this._linkAtPosition(e.link,t)&&(this._currentLink=e,this._currentLink.state={decorations:{underline:e.link.decorations===void 0||e.link.decorations.underline,pointerCursor:e.link.decorations===void 0||e.link.decorations.pointerCursor},isHovered:!0},this._linkHover(this._element,e.link,this._lastMouseEvent),e.link.decorations={},Object.defineProperties(e.link.decorations,{pointerCursor:{get:()=>this._currentLink?.state?.decorations.pointerCursor,set:e=>{this._currentLink?.state&&this._currentLink.state.decorations.pointerCursor!==e&&(this._currentLink.state.decorations.pointerCursor=e,this._currentLink.state.isHovered&&this._element.classList.toggle(`xterm-cursor-pointer`,e))}},underline:{get:()=>this._currentLink?.state?.decorations.underline,set:t=>{this._currentLink?.state&&this._currentLink?.state?.decorations.underline!==t&&(this._currentLink.state.decorations.underline=t,this._currentLink.state.isHovered&&this._fireUnderlineEvent(e.link,t))}}}),this._linkCacheDisposables.push(this._renderService.onRenderedViewportChange((e=>{if(!this._currentLink)return;let t=e.start===0?0:e.start+1+this._bufferService.buffer.ydisp,n=this._bufferService.buffer.ydisp+1+e.end;if(this._currentLink.link.range.start.y>=t&&this._currentLink.link.range.end.y<=n&&(this._clearCurrentLink(t,n),this._lastMouseEvent)){let e=this._positionFromMouseEvent(this._lastMouseEvent,this._element,this._mouseService);e&&this._askForLink(e,!1)}}))))}_linkHover(e,t,n){this._currentLink?.state&&(this._currentLink.state.isHovered=!0,this._currentLink.state.decorations.underline&&this._fireUnderlineEvent(t,!0),this._currentLink.state.decorations.pointerCursor&&e.classList.add(`xterm-cursor-pointer`)),t.hover&&t.hover(n,t.text)}_fireUnderlineEvent(e,t){let n=e.range,r=this._bufferService.buffer.ydisp,i=this._createLinkUnderlineEvent(n.start.x-1,n.start.y-r-1,n.end.x,n.end.y-r-1,void 0);(t?this._onShowLinkUnderline:this._onHideLinkUnderline).fire(i)}_linkLeave(e,t,n){this._currentLink?.state&&(this._currentLink.state.isHovered=!1,this._currentLink.state.decorations.underline&&this._fireUnderlineEvent(t,!1),this._currentLink.state.decorations.pointerCursor&&e.classList.remove(`xterm-cursor-pointer`)),t.leave&&t.leave(n,t.text)}_linkAtPosition(e,t){let n=e.range.start.y*this._bufferService.cols+e.range.start.x,r=e.range.end.y*this._bufferService.cols+e.range.end.x,i=t.y*this._bufferService.cols+t.x;return n<=i&&i<=r}_positionFromMouseEvent(e,t,n){let r=n.getCoords(e,t,this._bufferService.cols,this._bufferService.rows);if(r)return{x:r[0],y:r[1]+this._bufferService.buffer.ydisp}}_createLinkUnderlineEvent(e,t,n,r,i){return{x1:e,y1:t,x2:n,y2:r,cols:this._bufferService.cols,fg:i}}};t.Linkifier=u=r([i(1,l.IMouseService),i(2,l.IRenderService),i(3,c.IBufferService),i(4,l.ILinkProviderService)],u)},9042:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.tooMuchOutput=t.promptLabel=void 0,t.promptLabel=`Terminal input`,t.tooMuchOutput=`Too much output to announce, navigate to rows manually to read`},3730:function(e,t,n){var r=this&&this.__decorate||function(e,t,n,r){var i,a=arguments.length,o=a<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,n):r;if(typeof Reflect==`object`&&typeof Reflect.decorate==`function`)o=Reflect.decorate(e,t,n,r);else for(var s=e.length-1;s>=0;s--)(i=e[s])&&(o=(a<3?i(o):a>3?i(t,n,o):i(t,n))||o);return a>3&&o&&Object.defineProperty(t,n,o),o},i=this&&this.__param||function(e,t){return function(n,r){t(n,r,e)}};Object.defineProperty(t,"__esModule",{value:!0}),t.OscLinkProvider=void 0;let a=n(511),o=n(2585),s=t.OscLinkProvider=class{constructor(e,t,n){this._bufferService=e,this._optionsService=t,this._oscLinkService=n}provideLinks(e,t){let n=this._bufferService.buffer.lines.get(e-1);if(!n)return void t(void 0);let r=[],i=this._optionsService.rawOptions.linkHandler,o=new a.CellData,s=n.getTrimmedLength(),l=-1,u=-1,d=!1;for(let t=0;ti?i.activate(e,t,a):c(0,t),hover:(e,t)=>i?.hover?.(e,t,a),leave:(e,t)=>i?.leave?.(e,t,a)})}d=!1,o.hasExtendedAttrs()&&o.extended.urlId?(u=t,l=o.extended.urlId):(u=-1,l=-1)}}t(r)}};function c(e,t){if(confirm(`Do you want to navigate to ${t}?\n\nWARNING: This link could potentially be dangerous`)){let e=window.open();if(e){try{e.opener=null}catch{}e.location.href=t}else console.warn(`Opening link blocked as opener could not be cleared`)}}t.OscLinkProvider=s=r([i(0,o.IBufferService),i(1,o.IOptionsService),i(2,o.IOscLinkService)],s)},6193:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.RenderDebouncer=void 0,t.RenderDebouncer=class{constructor(e,t){this._renderCallback=e,this._coreBrowserService=t,this._refreshCallbacks=[]}dispose(){this._animationFrame&&=(this._coreBrowserService.window.cancelAnimationFrame(this._animationFrame),void 0)}addRefreshCallback(e){return this._refreshCallbacks.push(e),this._animationFrame||=this._coreBrowserService.window.requestAnimationFrame((()=>this._innerRefresh())),this._animationFrame}refresh(e,t,n){this._rowCount=n,e=e===void 0?0:e,t=t===void 0?this._rowCount-1:t,this._rowStart=this._rowStart===void 0?e:Math.min(this._rowStart,e),this._rowEnd=this._rowEnd===void 0?t:Math.max(this._rowEnd,t),this._animationFrame||=this._coreBrowserService.window.requestAnimationFrame((()=>this._innerRefresh()))}_innerRefresh(){if(this._animationFrame=void 0,this._rowStart===void 0||this._rowEnd===void 0||this._rowCount===void 0)return void this._runRefreshCallbacks();let e=Math.max(this._rowStart,0),t=Math.min(this._rowEnd,this._rowCount-1);this._rowStart=void 0,this._rowEnd=void 0,this._renderCallback(e,t),this._runRefreshCallbacks()}_runRefreshCallbacks(){for(let e of this._refreshCallbacks)e(0);this._refreshCallbacks=[]}}},3236:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.Terminal=void 0;let r=n(3614),i=n(3656),a=n(3551),o=n(9042),s=n(3730),c=n(1680),l=n(3107),u=n(5744),d=n(2950),f=n(1296),p=n(428),m=n(4269),h=n(5114),g=n(8934),_=n(3230),v=n(9312),y=n(4725),b=n(6731),x=n(8055),S=n(8969),C=n(8460),w=n(844),T=n(6114),E=n(8437),D=n(2584),O=n(7399),k=n(5941),A=n(9074),j=n(2585),ee=n(5435),M=n(4567),N=n(779);class P extends S.CoreTerminal{get onFocus(){return this._onFocus.event}get onBlur(){return this._onBlur.event}get onA11yChar(){return this._onA11yCharEmitter.event}get onA11yTab(){return this._onA11yTabEmitter.event}get onWillOpen(){return this._onWillOpen.event}constructor(e={}){super(e),this.browser=T,this._keyDownHandled=!1,this._keyDownSeen=!1,this._keyPressHandled=!1,this._unprocessedDeadKey=!1,this._accessibilityManager=this.register(new w.MutableDisposable),this._onCursorMove=this.register(new C.EventEmitter),this.onCursorMove=this._onCursorMove.event,this._onKey=this.register(new C.EventEmitter),this.onKey=this._onKey.event,this._onRender=this.register(new C.EventEmitter),this.onRender=this._onRender.event,this._onSelectionChange=this.register(new C.EventEmitter),this.onSelectionChange=this._onSelectionChange.event,this._onTitleChange=this.register(new C.EventEmitter),this.onTitleChange=this._onTitleChange.event,this._onBell=this.register(new C.EventEmitter),this.onBell=this._onBell.event,this._onFocus=this.register(new C.EventEmitter),this._onBlur=this.register(new C.EventEmitter),this._onA11yCharEmitter=this.register(new C.EventEmitter),this._onA11yTabEmitter=this.register(new C.EventEmitter),this._onWillOpen=this.register(new C.EventEmitter),this._setup(),this._decorationService=this._instantiationService.createInstance(A.DecorationService),this._instantiationService.setService(j.IDecorationService,this._decorationService),this._linkProviderService=this._instantiationService.createInstance(N.LinkProviderService),this._instantiationService.setService(y.ILinkProviderService,this._linkProviderService),this._linkProviderService.registerLinkProvider(this._instantiationService.createInstance(s.OscLinkProvider)),this.register(this._inputHandler.onRequestBell((()=>this._onBell.fire()))),this.register(this._inputHandler.onRequestRefreshRows(((e,t)=>this.refresh(e,t)))),this.register(this._inputHandler.onRequestSendFocus((()=>this._reportFocus()))),this.register(this._inputHandler.onRequestReset((()=>this.reset()))),this.register(this._inputHandler.onRequestWindowsOptionsReport((e=>this._reportWindowsOptions(e)))),this.register(this._inputHandler.onColor((e=>this._handleColorEvent(e)))),this.register((0,C.forwardEvent)(this._inputHandler.onCursorMove,this._onCursorMove)),this.register((0,C.forwardEvent)(this._inputHandler.onTitleChange,this._onTitleChange)),this.register((0,C.forwardEvent)(this._inputHandler.onA11yChar,this._onA11yCharEmitter)),this.register((0,C.forwardEvent)(this._inputHandler.onA11yTab,this._onA11yTabEmitter)),this.register(this._bufferService.onResize((e=>this._afterResize(e.cols,e.rows)))),this.register((0,w.toDisposable)((()=>{this._customKeyEventHandler=void 0,this.element?.parentNode?.removeChild(this.element)})))}_handleColorEvent(e){if(this._themeService)for(let t of e){let e,n=``;switch(t.index){case 256:e=`foreground`,n=`10`;break;case 257:e=`background`,n=`11`;break;case 258:e=`cursor`,n=`12`;break;default:e=`ansi`,n=`4;`+t.index}switch(t.type){case 0:let r=x.color.toColorRGB(e===`ansi`?this._themeService.colors.ansi[t.index]:this._themeService.colors[e]);this.coreService.triggerDataEvent(`${D.C0.ESC}]${n};${(0,k.toRgbString)(r)}${D.C1_ESCAPED.ST}`);break;case 1:if(e===`ansi`)this._themeService.modifyColors((e=>e.ansi[t.index]=x.channels.toColor(...t.color)));else{let n=e;this._themeService.modifyColors((e=>e[n]=x.channels.toColor(...t.color)))}break;case 2:this._themeService.restoreColor(t.index)}}}_setup(){super._setup(),this._customKeyEventHandler=void 0}get buffer(){return this.buffers.active}focus(){this.textarea&&this.textarea.focus({preventScroll:!0})}_handleScreenReaderModeOptionChange(e){e?!this._accessibilityManager.value&&this._renderService&&(this._accessibilityManager.value=this._instantiationService.createInstance(M.AccessibilityManager,this)):this._accessibilityManager.clear()}_handleTextAreaFocus(e){this.coreService.decPrivateModes.sendFocus&&this.coreService.triggerDataEvent(D.C0.ESC+`[I`),this.element.classList.add(`focus`),this._showCursor(),this._onFocus.fire()}blur(){return this.textarea?.blur()}_handleTextAreaBlur(){this.textarea.value=``,this.refresh(this.buffer.y,this.buffer.y),this.coreService.decPrivateModes.sendFocus&&this.coreService.triggerDataEvent(D.C0.ESC+`[O`),this.element.classList.remove(`focus`),this._onBlur.fire()}_syncTextArea(){if(!this.textarea||!this.buffer.isCursorInViewport||this._compositionHelper.isComposing||!this._renderService)return;let e=this.buffer.ybase+this.buffer.y,t=this.buffer.lines.get(e);if(!t)return;let n=Math.min(this.buffer.x,this.cols-1),r=this._renderService.dimensions.css.cell.height,i=t.getWidth(n),a=this._renderService.dimensions.css.cell.width*i,o=this.buffer.y*this._renderService.dimensions.css.cell.height,s=n*this._renderService.dimensions.css.cell.width;this.textarea.style.left=s+`px`,this.textarea.style.top=o+`px`,this.textarea.style.width=a+`px`,this.textarea.style.height=r+`px`,this.textarea.style.lineHeight=r+`px`,this.textarea.style.zIndex=`-5`}_initGlobal(){this._bindKeys(),this.register((0,i.addDisposableDomListener)(this.element,`copy`,(e=>{this.hasSelection()&&(0,r.copyHandler)(e,this._selectionService)})));let e=e=>(0,r.handlePasteEvent)(e,this.textarea,this.coreService,this.optionsService);this.register((0,i.addDisposableDomListener)(this.textarea,`paste`,e)),this.register((0,i.addDisposableDomListener)(this.element,`paste`,e)),T.isFirefox?this.register((0,i.addDisposableDomListener)(this.element,`mousedown`,(e=>{e.button===2&&(0,r.rightClickHandler)(e,this.textarea,this.screenElement,this._selectionService,this.options.rightClickSelectsWord)}))):this.register((0,i.addDisposableDomListener)(this.element,`contextmenu`,(e=>{(0,r.rightClickHandler)(e,this.textarea,this.screenElement,this._selectionService,this.options.rightClickSelectsWord)}))),T.isLinux&&this.register((0,i.addDisposableDomListener)(this.element,`auxclick`,(e=>{e.button===1&&(0,r.moveTextAreaUnderMouseCursor)(e,this.textarea,this.screenElement)})))}_bindKeys(){this.register((0,i.addDisposableDomListener)(this.textarea,`keyup`,(e=>this._keyUp(e)),!0)),this.register((0,i.addDisposableDomListener)(this.textarea,`keydown`,(e=>this._keyDown(e)),!0)),this.register((0,i.addDisposableDomListener)(this.textarea,`keypress`,(e=>this._keyPress(e)),!0)),this.register((0,i.addDisposableDomListener)(this.textarea,`compositionstart`,(()=>this._compositionHelper.compositionstart()))),this.register((0,i.addDisposableDomListener)(this.textarea,`compositionupdate`,(e=>this._compositionHelper.compositionupdate(e)))),this.register((0,i.addDisposableDomListener)(this.textarea,`compositionend`,(()=>this._compositionHelper.compositionend()))),this.register((0,i.addDisposableDomListener)(this.textarea,`input`,(e=>this._inputEvent(e)),!0)),this.register(this.onRender((()=>this._compositionHelper.updateCompositionElements())))}open(e){if(!e)throw Error(`Terminal requires a parent element.`);if(e.isConnected||this._logService.debug(`Terminal.open was called on an element that was not attached to the DOM`),this.element?.ownerDocument.defaultView&&this._coreBrowserService)return void(this.element.ownerDocument.defaultView!==this._coreBrowserService.window&&(this._coreBrowserService.window=this.element.ownerDocument.defaultView));this._document=e.ownerDocument,this.options.documentOverride&&this.options.documentOverride instanceof Document&&(this._document=this.optionsService.rawOptions.documentOverride),this.element=this._document.createElement(`div`),this.element.dir=`ltr`,this.element.classList.add(`terminal`),this.element.classList.add(`xterm`),e.appendChild(this.element);let t=this._document.createDocumentFragment();this._viewportElement=this._document.createElement(`div`),this._viewportElement.classList.add(`xterm-viewport`),t.appendChild(this._viewportElement),this._viewportScrollArea=this._document.createElement(`div`),this._viewportScrollArea.classList.add(`xterm-scroll-area`),this._viewportElement.appendChild(this._viewportScrollArea),this.screenElement=this._document.createElement(`div`),this.screenElement.classList.add(`xterm-screen`),this.register((0,i.addDisposableDomListener)(this.screenElement,`mousemove`,(e=>this.updateCursorStyle(e)))),this._helperContainer=this._document.createElement(`div`),this._helperContainer.classList.add(`xterm-helpers`),this.screenElement.appendChild(this._helperContainer),t.appendChild(this.screenElement),this.textarea=this._document.createElement(`textarea`),this.textarea.classList.add(`xterm-helper-textarea`),this.textarea.setAttribute(`aria-label`,o.promptLabel),T.isChromeOS||this.textarea.setAttribute(`aria-multiline`,`false`),this.textarea.setAttribute(`autocorrect`,`off`),this.textarea.setAttribute(`autocapitalize`,`off`),this.textarea.setAttribute(`spellcheck`,`false`),this.textarea.tabIndex=0,this._coreBrowserService=this.register(this._instantiationService.createInstance(h.CoreBrowserService,this.textarea,e.ownerDocument.defaultView??window,this._document??typeof window<`u`?window.document:null)),this._instantiationService.setService(y.ICoreBrowserService,this._coreBrowserService),this.register((0,i.addDisposableDomListener)(this.textarea,`focus`,(e=>this._handleTextAreaFocus(e)))),this.register((0,i.addDisposableDomListener)(this.textarea,`blur`,(()=>this._handleTextAreaBlur()))),this._helperContainer.appendChild(this.textarea),this._charSizeService=this._instantiationService.createInstance(p.CharSizeService,this._document,this._helperContainer),this._instantiationService.setService(y.ICharSizeService,this._charSizeService),this._themeService=this._instantiationService.createInstance(b.ThemeService),this._instantiationService.setService(y.IThemeService,this._themeService),this._characterJoinerService=this._instantiationService.createInstance(m.CharacterJoinerService),this._instantiationService.setService(y.ICharacterJoinerService,this._characterJoinerService),this._renderService=this.register(this._instantiationService.createInstance(_.RenderService,this.rows,this.screenElement)),this._instantiationService.setService(y.IRenderService,this._renderService),this.register(this._renderService.onRenderedViewportChange((e=>this._onRender.fire(e)))),this.onResize((e=>this._renderService.resize(e.cols,e.rows))),this._compositionView=this._document.createElement(`div`),this._compositionView.classList.add(`composition-view`),this._compositionHelper=this._instantiationService.createInstance(d.CompositionHelper,this.textarea,this._compositionView),this._helperContainer.appendChild(this._compositionView),this._mouseService=this._instantiationService.createInstance(g.MouseService),this._instantiationService.setService(y.IMouseService,this._mouseService),this.linkifier=this.register(this._instantiationService.createInstance(a.Linkifier,this.screenElement)),this.element.appendChild(t);try{this._onWillOpen.fire(this.element)}catch{}this._renderService.hasRenderer()||this._renderService.setRenderer(this._createRenderer()),this.viewport=this._instantiationService.createInstance(c.Viewport,this._viewportElement,this._viewportScrollArea),this.viewport.onRequestScrollLines((e=>this.scrollLines(e.amount,e.suppressScrollEvent,1))),this.register(this._inputHandler.onRequestSyncScrollBar((()=>this.viewport.syncScrollArea()))),this.register(this.viewport),this.register(this.onCursorMove((()=>{this._renderService.handleCursorMove(),this._syncTextArea()}))),this.register(this.onResize((()=>this._renderService.handleResize(this.cols,this.rows)))),this.register(this.onBlur((()=>this._renderService.handleBlur()))),this.register(this.onFocus((()=>this._renderService.handleFocus()))),this.register(this._renderService.onDimensionsChange((()=>this.viewport.syncScrollArea()))),this._selectionService=this.register(this._instantiationService.createInstance(v.SelectionService,this.element,this.screenElement,this.linkifier)),this._instantiationService.setService(y.ISelectionService,this._selectionService),this.register(this._selectionService.onRequestScrollLines((e=>this.scrollLines(e.amount,e.suppressScrollEvent)))),this.register(this._selectionService.onSelectionChange((()=>this._onSelectionChange.fire()))),this.register(this._selectionService.onRequestRedraw((e=>this._renderService.handleSelectionChanged(e.start,e.end,e.columnSelectMode)))),this.register(this._selectionService.onLinuxMouseSelection((e=>{this.textarea.value=e,this.textarea.focus(),this.textarea.select()}))),this.register(this._onScroll.event((e=>{this.viewport.syncScrollArea(),this._selectionService.refresh()}))),this.register((0,i.addDisposableDomListener)(this._viewportElement,`scroll`,(()=>this._selectionService.refresh()))),this.register(this._instantiationService.createInstance(l.BufferDecorationRenderer,this.screenElement)),this.register((0,i.addDisposableDomListener)(this.element,`mousedown`,(e=>this._selectionService.handleMouseDown(e)))),this.coreMouseService.areMouseEventsActive?(this._selectionService.disable(),this.element.classList.add(`enable-mouse-events`)):this._selectionService.enable(),this.options.screenReaderMode&&(this._accessibilityManager.value=this._instantiationService.createInstance(M.AccessibilityManager,this)),this.register(this.optionsService.onSpecificOptionChange(`screenReaderMode`,(e=>this._handleScreenReaderModeOptionChange(e)))),this.options.overviewRulerWidth&&(this._overviewRulerRenderer=this.register(this._instantiationService.createInstance(u.OverviewRulerRenderer,this._viewportElement,this.screenElement))),this.optionsService.onSpecificOptionChange(`overviewRulerWidth`,(e=>{!this._overviewRulerRenderer&&e&&this._viewportElement&&this.screenElement&&(this._overviewRulerRenderer=this.register(this._instantiationService.createInstance(u.OverviewRulerRenderer,this._viewportElement,this.screenElement)))})),this._charSizeService.measure(),this.refresh(0,this.rows-1),this._initGlobal(),this.bindMouse()}_createRenderer(){return this._instantiationService.createInstance(f.DomRenderer,this,this._document,this.element,this.screenElement,this._viewportElement,this._helperContainer,this.linkifier)}bindMouse(){let e=this,t=this.element;function n(t){let n=e._mouseService.getMouseReportCoords(t,e.screenElement);if(!n)return!1;let r,i;switch(t.overrideType||t.type){case`mousemove`:i=32,t.buttons===void 0?(r=3,t.button!==void 0&&(r=t.button<3?t.button:3)):r=1&t.buttons?0:4&t.buttons?1:2&t.buttons?2:3;break;case`mouseup`:i=0,r=t.button<3?t.button:3;break;case`mousedown`:i=1,r=t.button<3?t.button:3;break;case`wheel`:if(e._customWheelEventHandler&&!1===e._customWheelEventHandler(t)||e.viewport.getLinesScrolled(t)===0)return!1;i=t.deltaY<0?0:1,r=4;break;default:return!1}return!(i===void 0||r===void 0||r>4)&&e.coreMouseService.triggerMouseEvent({col:n.col,row:n.row,x:n.x,y:n.y,button:r,action:i,ctrl:t.ctrlKey,alt:t.altKey,shift:t.shiftKey})}let r={mouseup:null,wheel:null,mousedrag:null,mousemove:null},a={mouseup:e=>(n(e),e.buttons||(this._document.removeEventListener(`mouseup`,r.mouseup),r.mousedrag&&this._document.removeEventListener(`mousemove`,r.mousedrag)),this.cancel(e)),wheel:e=>(n(e),this.cancel(e,!0)),mousedrag:e=>{e.buttons&&n(e)},mousemove:e=>{e.buttons||n(e)}};this.register(this.coreMouseService.onProtocolChange((e=>{e?(this.optionsService.rawOptions.logLevel===`debug`&&this._logService.debug(`Binding to mouse events:`,this.coreMouseService.explainEvents(e)),this.element.classList.add(`enable-mouse-events`),this._selectionService.disable()):(this._logService.debug(`Unbinding from mouse events.`),this.element.classList.remove(`enable-mouse-events`),this._selectionService.enable()),8&e?r.mousemove||=(t.addEventListener(`mousemove`,a.mousemove),a.mousemove):(t.removeEventListener(`mousemove`,r.mousemove),r.mousemove=null),16&e?r.wheel||=(t.addEventListener(`wheel`,a.wheel,{passive:!1}),a.wheel):(t.removeEventListener(`wheel`,r.wheel),r.wheel=null),2&e?r.mouseup||=a.mouseup:(this._document.removeEventListener(`mouseup`,r.mouseup),r.mouseup=null),4&e?r.mousedrag||=a.mousedrag:(this._document.removeEventListener(`mousemove`,r.mousedrag),r.mousedrag=null)}))),this.coreMouseService.activeProtocol=this.coreMouseService.activeProtocol,this.register((0,i.addDisposableDomListener)(t,`mousedown`,(e=>{if(e.preventDefault(),this.focus(),this.coreMouseService.areMouseEventsActive&&!this._selectionService.shouldForceSelection(e))return n(e),r.mouseup&&this._document.addEventListener(`mouseup`,r.mouseup),r.mousedrag&&this._document.addEventListener(`mousemove`,r.mousedrag),this.cancel(e)}))),this.register((0,i.addDisposableDomListener)(t,`wheel`,(e=>{if(!r.wheel){if(this._customWheelEventHandler&&!1===this._customWheelEventHandler(e))return!1;if(!this.buffer.hasScrollback){let t=this.viewport.getLinesScrolled(e);if(t===0)return;let n=D.C0.ESC+(this.coreService.decPrivateModes.applicationCursorKeys?`O`:`[`)+(e.deltaY<0?`A`:`B`),r=``;for(let e=0;e{if(!this.coreMouseService.areMouseEventsActive)return this.viewport.handleTouchStart(e),this.cancel(e)}),{passive:!0})),this.register((0,i.addDisposableDomListener)(t,`touchmove`,(e=>{if(!this.coreMouseService.areMouseEventsActive)return this.viewport.handleTouchMove(e)?void 0:this.cancel(e)}),{passive:!1}))}refresh(e,t){this._renderService?.refreshRows(e,t)}updateCursorStyle(e){this._selectionService?.shouldColumnSelect(e)?this.element.classList.add(`column-select`):this.element.classList.remove(`column-select`)}_showCursor(){this.coreService.isCursorInitialized||(this.coreService.isCursorInitialized=!0,this.refresh(this.buffer.y,this.buffer.y))}scrollLines(e,t,n=0){n===1?(super.scrollLines(e,t,n),this.refresh(0,this.rows-1)):this.viewport?.scrollLines(e)}paste(e){(0,r.paste)(e,this.textarea,this.coreService,this.optionsService)}attachCustomKeyEventHandler(e){this._customKeyEventHandler=e}attachCustomWheelEventHandler(e){this._customWheelEventHandler=e}registerLinkProvider(e){return this._linkProviderService.registerLinkProvider(e)}registerCharacterJoiner(e){if(!this._characterJoinerService)throw Error(`Terminal must be opened first`);let t=this._characterJoinerService.register(e);return this.refresh(0,this.rows-1),t}deregisterCharacterJoiner(e){if(!this._characterJoinerService)throw Error(`Terminal must be opened first`);this._characterJoinerService.deregister(e)&&this.refresh(0,this.rows-1)}get markers(){return this.buffer.markers}registerMarker(e){return this.buffer.addMarker(this.buffer.ybase+this.buffer.y+e)}registerDecoration(e){return this._decorationService.registerDecoration(e)}hasSelection(){return!!this._selectionService&&this._selectionService.hasSelection}select(e,t,n){this._selectionService.setSelection(e,t,n)}getSelection(){return this._selectionService?this._selectionService.selectionText:``}getSelectionPosition(){if(this._selectionService&&this._selectionService.hasSelection)return{start:{x:this._selectionService.selectionStart[0],y:this._selectionService.selectionStart[1]},end:{x:this._selectionService.selectionEnd[0],y:this._selectionService.selectionEnd[1]}}}clearSelection(){this._selectionService?.clearSelection()}selectAll(){this._selectionService?.selectAll()}selectLines(e,t){this._selectionService?.selectLines(e,t)}_keyDown(e){if(this._keyDownHandled=!1,this._keyDownSeen=!0,this._customKeyEventHandler&&!1===this._customKeyEventHandler(e))return!1;let t=this.browser.isMac&&this.options.macOptionIsMeta&&e.altKey;if(!t&&!this._compositionHelper.keydown(e))return this.options.scrollOnUserInput&&this.buffer.ybase!==this.buffer.ydisp&&this.scrollToBottom(),!1;t||e.key!==`Dead`&&e.key!==`AltGraph`||(this._unprocessedDeadKey=!0);let n=(0,O.evaluateKeyboardEvent)(e,this.coreService.decPrivateModes.applicationCursorKeys,this.browser.isMac,this.options.macOptionIsMeta);if(this.updateCursorStyle(e),n.type===3||n.type===2){let t=this.rows-1;return this.scrollLines(n.type===2?-t:t),this.cancel(e,!0)}return n.type===1&&this.selectAll(),!!this._isThirdLevelShift(this.browser,e)||(n.cancel&&this.cancel(e,!0),!n.key||!!(e.key&&!e.ctrlKey&&!e.altKey&&!e.metaKey&&e.key.length===1&&e.key.charCodeAt(0)>=65&&e.key.charCodeAt(0)<=90)||(this._unprocessedDeadKey?(this._unprocessedDeadKey=!1,!0):(n.key!==D.C0.ETX&&n.key!==D.C0.CR||(this.textarea.value=``),this._onKey.fire({key:n.key,domEvent:e}),this._showCursor(),this.coreService.triggerDataEvent(n.key,!0),!this.optionsService.rawOptions.screenReaderMode||e.altKey||e.ctrlKey?this.cancel(e,!0):void(this._keyDownHandled=!0))))}_isThirdLevelShift(e,t){let n=e.isMac&&!this.options.macOptionIsMeta&&t.altKey&&!t.ctrlKey&&!t.metaKey||e.isWindows&&t.altKey&&t.ctrlKey&&!t.metaKey||e.isWindows&&t.getModifierState(`AltGraph`);return t.type===`keypress`?n:n&&(!t.keyCode||t.keyCode>47)}_keyUp(e){this._keyDownSeen=!1,this._customKeyEventHandler&&!1===this._customKeyEventHandler(e)||(function(e){return e.keyCode===16||e.keyCode===17||e.keyCode===18}(e)||this.focus(),this.updateCursorStyle(e),this._keyPressHandled=!1)}_keyPress(e){let t;if(this._keyPressHandled=!1,this._keyDownHandled||this._customKeyEventHandler&&!1===this._customKeyEventHandler(e))return!1;if(this.cancel(e),e.charCode)t=e.charCode;else if(e.which===null||e.which===void 0)t=e.keyCode;else{if(e.which===0||e.charCode===0)return!1;t=e.which}return!(!t||(e.altKey||e.ctrlKey||e.metaKey)&&!this._isThirdLevelShift(this.browser,e)||(t=String.fromCharCode(t),this._onKey.fire({key:t,domEvent:e}),this._showCursor(),this.coreService.triggerDataEvent(t,!0),this._keyPressHandled=!0,this._unprocessedDeadKey=!1,0))}_inputEvent(e){if(e.data&&e.inputType===`insertText`&&(!e.composed||!this._keyDownSeen)&&!this.optionsService.rawOptions.screenReaderMode){if(this._keyPressHandled)return!1;this._unprocessedDeadKey=!1;let t=e.data;return this.coreService.triggerDataEvent(t,!0),this.cancel(e),!0}return!1}resize(e,t){e!==this.cols||t!==this.rows?super.resize(e,t):this._charSizeService&&!this._charSizeService.hasValidSize&&this._charSizeService.measure()}_afterResize(e,t){this._charSizeService?.measure(),this.viewport?.syncScrollArea(!0)}clear(){if(this.buffer.ybase!==0||this.buffer.y!==0){this.buffer.clearAllMarkers(),this.buffer.lines.set(0,this.buffer.lines.get(this.buffer.ybase+this.buffer.y)),this.buffer.lines.length=1,this.buffer.ydisp=0,this.buffer.ybase=0,this.buffer.y=0;for(let e=1;e{Object.defineProperty(t,"__esModule",{value:!0}),t.TimeBasedDebouncer=void 0,t.TimeBasedDebouncer=class{constructor(e,t=1e3){this._renderCallback=e,this._debounceThresholdMS=t,this._lastRefreshMs=0,this._additionalRefreshRequested=!1}dispose(){this._refreshTimeoutID&&clearTimeout(this._refreshTimeoutID)}refresh(e,t,n){this._rowCount=n,e=e===void 0?0:e,t=t===void 0?this._rowCount-1:t,this._rowStart=this._rowStart===void 0?e:Math.min(this._rowStart,e),this._rowEnd=this._rowEnd===void 0?t:Math.max(this._rowEnd,t);let r=Date.now();if(r-this._lastRefreshMs>=this._debounceThresholdMS)this._lastRefreshMs=r,this._innerRefresh();else if(!this._additionalRefreshRequested){let e=r-this._lastRefreshMs,t=this._debounceThresholdMS-e;this._additionalRefreshRequested=!0,this._refreshTimeoutID=window.setTimeout((()=>{this._lastRefreshMs=Date.now(),this._innerRefresh(),this._additionalRefreshRequested=!1,this._refreshTimeoutID=void 0}),t)}}_innerRefresh(){if(this._rowStart===void 0||this._rowEnd===void 0||this._rowCount===void 0)return;let e=Math.max(this._rowStart,0),t=Math.min(this._rowEnd,this._rowCount-1);this._rowStart=void 0,this._rowEnd=void 0,this._renderCallback(e,t)}}},1680:function(e,t,n){var r=this&&this.__decorate||function(e,t,n,r){var i,a=arguments.length,o=a<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,n):r;if(typeof Reflect==`object`&&typeof Reflect.decorate==`function`)o=Reflect.decorate(e,t,n,r);else for(var s=e.length-1;s>=0;s--)(i=e[s])&&(o=(a<3?i(o):a>3?i(t,n,o):i(t,n))||o);return a>3&&o&&Object.defineProperty(t,n,o),o},i=this&&this.__param||function(e,t){return function(n,r){t(n,r,e)}};Object.defineProperty(t,"__esModule",{value:!0}),t.Viewport=void 0;let a=n(3656),o=n(4725),s=n(8460),c=n(844),l=n(2585),u=t.Viewport=class extends c.Disposable{constructor(e,t,n,r,i,o,c,l){super(),this._viewportElement=e,this._scrollArea=t,this._bufferService=n,this._optionsService=r,this._charSizeService=i,this._renderService=o,this._coreBrowserService=c,this.scrollBarWidth=0,this._currentRowHeight=0,this._currentDeviceCellHeight=0,this._lastRecordedBufferLength=0,this._lastRecordedViewportHeight=0,this._lastRecordedBufferHeight=0,this._lastTouchY=0,this._lastScrollTop=0,this._wheelPartialScroll=0,this._refreshAnimationFrame=null,this._ignoreNextScrollEvent=!1,this._smoothScrollState={startTime:0,origin:-1,target:-1},this._onRequestScrollLines=this.register(new s.EventEmitter),this.onRequestScrollLines=this._onRequestScrollLines.event,this.scrollBarWidth=this._viewportElement.offsetWidth-this._scrollArea.offsetWidth||15,this.register((0,a.addDisposableDomListener)(this._viewportElement,`scroll`,this._handleScroll.bind(this))),this._activeBuffer=this._bufferService.buffer,this.register(this._bufferService.buffers.onBufferActivate((e=>this._activeBuffer=e.activeBuffer))),this._renderDimensions=this._renderService.dimensions,this.register(this._renderService.onDimensionsChange((e=>this._renderDimensions=e))),this._handleThemeChange(l.colors),this.register(l.onChangeColors((e=>this._handleThemeChange(e)))),this.register(this._optionsService.onSpecificOptionChange(`scrollback`,(()=>this.syncScrollArea()))),setTimeout((()=>this.syncScrollArea()))}_handleThemeChange(e){this._viewportElement.style.backgroundColor=e.background.css}reset(){this._currentRowHeight=0,this._currentDeviceCellHeight=0,this._lastRecordedBufferLength=0,this._lastRecordedViewportHeight=0,this._lastRecordedBufferHeight=0,this._lastTouchY=0,this._lastScrollTop=0,this._coreBrowserService.window.requestAnimationFrame((()=>this.syncScrollArea()))}_refresh(e){if(e)return this._innerRefresh(),void(this._refreshAnimationFrame!==null&&this._coreBrowserService.window.cancelAnimationFrame(this._refreshAnimationFrame));this._refreshAnimationFrame===null&&(this._refreshAnimationFrame=this._coreBrowserService.window.requestAnimationFrame((()=>this._innerRefresh())))}_innerRefresh(){if(this._charSizeService.height>0){this._currentRowHeight=this._renderDimensions.device.cell.height/this._coreBrowserService.dpr,this._currentDeviceCellHeight=this._renderDimensions.device.cell.height,this._lastRecordedViewportHeight=this._viewportElement.offsetHeight;let e=Math.round(this._currentRowHeight*this._lastRecordedBufferLength)+(this._lastRecordedViewportHeight-this._renderDimensions.css.canvas.height);this._lastRecordedBufferHeight!==e&&(this._lastRecordedBufferHeight=e,this._scrollArea.style.height=this._lastRecordedBufferHeight+`px`)}let e=this._bufferService.buffer.ydisp*this._currentRowHeight;this._viewportElement.scrollTop!==e&&(this._ignoreNextScrollEvent=!0,this._viewportElement.scrollTop=e),this._refreshAnimationFrame=null}syncScrollArea(e=!1){if(this._lastRecordedBufferLength!==this._bufferService.buffer.lines.length)return this._lastRecordedBufferLength=this._bufferService.buffer.lines.length,void this._refresh(e);this._lastRecordedViewportHeight===this._renderService.dimensions.css.canvas.height&&this._lastScrollTop===this._activeBuffer.ydisp*this._currentRowHeight&&this._renderDimensions.device.cell.height===this._currentDeviceCellHeight||this._refresh(e)}_handleScroll(e){if(this._lastScrollTop=this._viewportElement.scrollTop,!this._viewportElement.offsetParent)return;if(this._ignoreNextScrollEvent)return this._ignoreNextScrollEvent=!1,void this._onRequestScrollLines.fire({amount:0,suppressScrollEvent:!0});let t=Math.round(this._lastScrollTop/this._currentRowHeight)-this._bufferService.buffer.ydisp;this._onRequestScrollLines.fire({amount:t,suppressScrollEvent:!0})}_smoothScroll(){if(this._isDisposed||this._smoothScrollState.origin===-1||this._smoothScrollState.target===-1)return;let e=this._smoothScrollPercent();this._viewportElement.scrollTop=this._smoothScrollState.origin+Math.round(e*(this._smoothScrollState.target-this._smoothScrollState.origin)),e<1?this._coreBrowserService.window.requestAnimationFrame((()=>this._smoothScroll())):this._clearSmoothScrollState()}_smoothScrollPercent(){return this._optionsService.rawOptions.smoothScrollDuration&&this._smoothScrollState.startTime?Math.max(Math.min((Date.now()-this._smoothScrollState.startTime)/this._optionsService.rawOptions.smoothScrollDuration,1),0):1}_clearSmoothScrollState(){this._smoothScrollState.startTime=0,this._smoothScrollState.origin=-1,this._smoothScrollState.target=-1}_bubbleScroll(e,t){let n=this._viewportElement.scrollTop+this._lastRecordedViewportHeight;return!(t<0&&this._viewportElement.scrollTop!==0||t>0&&n0&&(n=e),r=``}}return{bufferElements:i,cursorElement:n}}getLinesScrolled(e){if(e.deltaY===0||e.shiftKey)return 0;let t=this._applyScrollModifier(e.deltaY,e);return e.deltaMode===WheelEvent.DOM_DELTA_PIXEL?(t/=this._currentRowHeight+0,this._wheelPartialScroll+=t,t=Math.floor(Math.abs(this._wheelPartialScroll))*(this._wheelPartialScroll>0?1:-1),this._wheelPartialScroll%=1):e.deltaMode===WheelEvent.DOM_DELTA_PAGE&&(t*=this._bufferService.rows),t}_applyScrollModifier(e,t){let n=this._optionsService.rawOptions.fastScrollModifier;return n===`alt`&&t.altKey||n===`ctrl`&&t.ctrlKey||n===`shift`&&t.shiftKey?e*this._optionsService.rawOptions.fastScrollSensitivity*this._optionsService.rawOptions.scrollSensitivity:e*this._optionsService.rawOptions.scrollSensitivity}handleTouchStart(e){this._lastTouchY=e.touches[0].pageY}handleTouchMove(e){let t=this._lastTouchY-e.touches[0].pageY;return this._lastTouchY=e.touches[0].pageY,t!==0&&(this._viewportElement.scrollTop+=t,this._bubbleScroll(e,t))}};t.Viewport=u=r([i(2,l.IBufferService),i(3,l.IOptionsService),i(4,o.ICharSizeService),i(5,o.IRenderService),i(6,o.ICoreBrowserService),i(7,o.IThemeService)],u)},3107:function(e,t,n){var r=this&&this.__decorate||function(e,t,n,r){var i,a=arguments.length,o=a<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,n):r;if(typeof Reflect==`object`&&typeof Reflect.decorate==`function`)o=Reflect.decorate(e,t,n,r);else for(var s=e.length-1;s>=0;s--)(i=e[s])&&(o=(a<3?i(o):a>3?i(t,n,o):i(t,n))||o);return a>3&&o&&Object.defineProperty(t,n,o),o},i=this&&this.__param||function(e,t){return function(n,r){t(n,r,e)}};Object.defineProperty(t,"__esModule",{value:!0}),t.BufferDecorationRenderer=void 0;let a=n(4725),o=n(844),s=n(2585),c=t.BufferDecorationRenderer=class extends o.Disposable{constructor(e,t,n,r,i){super(),this._screenElement=e,this._bufferService=t,this._coreBrowserService=n,this._decorationService=r,this._renderService=i,this._decorationElements=new Map,this._altBufferIsActive=!1,this._dimensionsChanged=!1,this._container=document.createElement(`div`),this._container.classList.add(`xterm-decoration-container`),this._screenElement.appendChild(this._container),this.register(this._renderService.onRenderedViewportChange((()=>this._doRefreshDecorations()))),this.register(this._renderService.onDimensionsChange((()=>{this._dimensionsChanged=!0,this._queueRefresh()}))),this.register(this._coreBrowserService.onDprChange((()=>this._queueRefresh()))),this.register(this._bufferService.buffers.onBufferActivate((()=>{this._altBufferIsActive=this._bufferService.buffer===this._bufferService.buffers.alt}))),this.register(this._decorationService.onDecorationRegistered((()=>this._queueRefresh()))),this.register(this._decorationService.onDecorationRemoved((e=>this._removeDecoration(e)))),this.register((0,o.toDisposable)((()=>{this._container.remove(),this._decorationElements.clear()})))}_queueRefresh(){this._animationFrame===void 0&&(this._animationFrame=this._renderService.addRefreshCallback((()=>{this._doRefreshDecorations(),this._animationFrame=void 0})))}_doRefreshDecorations(){for(let e of this._decorationService.decorations)this._renderDecoration(e);this._dimensionsChanged=!1}_renderDecoration(e){this._refreshStyle(e),this._dimensionsChanged&&this._refreshXPosition(e)}_createElement(e){let t=this._coreBrowserService.mainDocument.createElement(`div`);t.classList.add(`xterm-decoration`),t.classList.toggle(`xterm-decoration-top-layer`,e?.options?.layer===`top`),t.style.width=`${Math.round((e.options.width||1)*this._renderService.dimensions.css.cell.width)}px`,t.style.height=(e.options.height||1)*this._renderService.dimensions.css.cell.height+`px`,t.style.top=(e.marker.line-this._bufferService.buffers.active.ydisp)*this._renderService.dimensions.css.cell.height+`px`,t.style.lineHeight=`${this._renderService.dimensions.css.cell.height}px`;let n=e.options.x??0;return n&&n>this._bufferService.cols&&(t.style.display=`none`),this._refreshXPosition(e,t),t}_refreshStyle(e){let t=e.marker.line-this._bufferService.buffers.active.ydisp;if(t<0||t>=this._bufferService.rows)e.element&&(e.element.style.display=`none`,e.onRenderEmitter.fire(e.element));else{let n=this._decorationElements.get(e);n||(n=this._createElement(e),e.element=n,this._decorationElements.set(e,n),this._container.appendChild(n),e.onDispose((()=>{this._decorationElements.delete(e),n.remove()}))),n.style.top=t*this._renderService.dimensions.css.cell.height+`px`,n.style.display=this._altBufferIsActive?`none`:`block`,e.onRenderEmitter.fire(n)}}_refreshXPosition(e,t=e.element){if(!t)return;let n=e.options.x??0;(e.options.anchor||`left`)===`right`?t.style.right=n?n*this._renderService.dimensions.css.cell.width+`px`:``:t.style.left=n?n*this._renderService.dimensions.css.cell.width+`px`:``}_removeDecoration(e){this._decorationElements.get(e)?.remove(),this._decorationElements.delete(e),e.dispose()}};t.BufferDecorationRenderer=c=r([i(1,s.IBufferService),i(2,a.ICoreBrowserService),i(3,s.IDecorationService),i(4,a.IRenderService)],c)},5871:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.ColorZoneStore=void 0,t.ColorZoneStore=class{constructor(){this._zones=[],this._zonePool=[],this._zonePoolIndex=0,this._linePadding={full:0,left:0,center:0,right:0}}get zones(){return this._zonePool.length=Math.min(this._zonePool.length,this._zones.length),this._zones}clear(){this._zones.length=0,this._zonePoolIndex=0}addDecoration(e){if(e.options.overviewRulerOptions){for(let t of this._zones)if(t.color===e.options.overviewRulerOptions.color&&t.position===e.options.overviewRulerOptions.position){if(this._lineIntersectsZone(t,e.marker.line))return;if(this._lineAdjacentToZone(t,e.marker.line,e.options.overviewRulerOptions.position))return void this._addLineToZone(t,e.marker.line)}if(this._zonePoolIndex=e.startBufferLine&&t<=e.endBufferLine}_lineAdjacentToZone(e,t,n){return t>=e.startBufferLine-this._linePadding[n||`full`]&&t<=e.endBufferLine+this._linePadding[n||`full`]}_addLineToZone(e,t){e.startBufferLine=Math.min(e.startBufferLine,t),e.endBufferLine=Math.max(e.endBufferLine,t)}}},5744:function(e,t,n){var r=this&&this.__decorate||function(e,t,n,r){var i,a=arguments.length,o=a<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,n):r;if(typeof Reflect==`object`&&typeof Reflect.decorate==`function`)o=Reflect.decorate(e,t,n,r);else for(var s=e.length-1;s>=0;s--)(i=e[s])&&(o=(a<3?i(o):a>3?i(t,n,o):i(t,n))||o);return a>3&&o&&Object.defineProperty(t,n,o),o},i=this&&this.__param||function(e,t){return function(n,r){t(n,r,e)}};Object.defineProperty(t,"__esModule",{value:!0}),t.OverviewRulerRenderer=void 0;let a=n(5871),o=n(4725),s=n(844),c=n(2585),l={full:0,left:0,center:0,right:0},u={full:0,left:0,center:0,right:0},d={full:0,left:0,center:0,right:0},f=t.OverviewRulerRenderer=class extends s.Disposable{get _width(){return this._optionsService.options.overviewRulerWidth||0}constructor(e,t,n,r,i,o,c){super(),this._viewportElement=e,this._screenElement=t,this._bufferService=n,this._decorationService=r,this._renderService=i,this._optionsService=o,this._coreBrowserService=c,this._colorZoneStore=new a.ColorZoneStore,this._shouldUpdateDimensions=!0,this._shouldUpdateAnchor=!0,this._lastKnownBufferLength=0,this._canvas=this._coreBrowserService.mainDocument.createElement(`canvas`),this._canvas.classList.add(`xterm-decoration-overview-ruler`),this._refreshCanvasDimensions(),this._viewportElement.parentElement?.insertBefore(this._canvas,this._viewportElement);let l=this._canvas.getContext(`2d`);if(!l)throw Error(`Ctx cannot be null`);this._ctx=l,this._registerDecorationListeners(),this._registerBufferChangeListeners(),this._registerDimensionChangeListeners(),this.register((0,s.toDisposable)((()=>{this._canvas?.remove()})))}_registerDecorationListeners(){this.register(this._decorationService.onDecorationRegistered((()=>this._queueRefresh(void 0,!0)))),this.register(this._decorationService.onDecorationRemoved((()=>this._queueRefresh(void 0,!0))))}_registerBufferChangeListeners(){this.register(this._renderService.onRenderedViewportChange((()=>this._queueRefresh()))),this.register(this._bufferService.buffers.onBufferActivate((()=>{this._canvas.style.display=this._bufferService.buffer===this._bufferService.buffers.alt?`none`:`block`}))),this.register(this._bufferService.onScroll((()=>{this._lastKnownBufferLength!==this._bufferService.buffers.normal.lines.length&&(this._refreshDrawHeightConstants(),this._refreshColorZonePadding())})))}_registerDimensionChangeListeners(){this.register(this._renderService.onRender((()=>{this._containerHeight&&this._containerHeight===this._screenElement.clientHeight||(this._queueRefresh(!0),this._containerHeight=this._screenElement.clientHeight)}))),this.register(this._optionsService.onSpecificOptionChange(`overviewRulerWidth`,(()=>this._queueRefresh(!0)))),this.register(this._coreBrowserService.onDprChange((()=>this._queueRefresh(!0)))),this._queueRefresh(!0)}_refreshDrawConstants(){let e=Math.floor(this._canvas.width/3),t=Math.ceil(this._canvas.width/3);u.full=this._canvas.width,u.left=e,u.center=t,u.right=e,this._refreshDrawHeightConstants(),d.full=0,d.left=0,d.center=u.left,d.right=u.left+u.center}_refreshDrawHeightConstants(){l.full=Math.round(2*this._coreBrowserService.dpr);let e=this._canvas.height/this._bufferService.buffer.lines.length,t=Math.round(Math.max(Math.min(e,12),6)*this._coreBrowserService.dpr);l.left=t,l.center=t,l.right=t}_refreshColorZonePadding(){this._colorZoneStore.setPadding({full:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*l.full),left:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*l.left),center:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*l.center),right:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*l.right)}),this._lastKnownBufferLength=this._bufferService.buffers.normal.lines.length}_refreshCanvasDimensions(){this._canvas.style.width=`${this._width}px`,this._canvas.width=Math.round(this._width*this._coreBrowserService.dpr),this._canvas.style.height=`${this._screenElement.clientHeight}px`,this._canvas.height=Math.round(this._screenElement.clientHeight*this._coreBrowserService.dpr),this._refreshDrawConstants(),this._refreshColorZonePadding()}_refreshDecorations(){this._shouldUpdateDimensions&&this._refreshCanvasDimensions(),this._ctx.clearRect(0,0,this._canvas.width,this._canvas.height),this._colorZoneStore.clear();for(let e of this._decorationService.decorations)this._colorZoneStore.addDecoration(e);this._ctx.lineWidth=1;let e=this._colorZoneStore.zones;for(let t of e)t.position!==`full`&&this._renderColorZone(t);for(let t of e)t.position===`full`&&this._renderColorZone(t);this._shouldUpdateDimensions=!1,this._shouldUpdateAnchor=!1}_renderColorZone(e){this._ctx.fillStyle=e.color,this._ctx.fillRect(d[e.position||`full`],Math.round((this._canvas.height-1)*(e.startBufferLine/this._bufferService.buffers.active.lines.length)-l[e.position||`full`]/2),u[e.position||`full`],Math.round((this._canvas.height-1)*((e.endBufferLine-e.startBufferLine)/this._bufferService.buffers.active.lines.length)+l[e.position||`full`]))}_queueRefresh(e,t){this._shouldUpdateDimensions=e||this._shouldUpdateDimensions,this._shouldUpdateAnchor=t||this._shouldUpdateAnchor,this._animationFrame===void 0&&(this._animationFrame=this._coreBrowserService.window.requestAnimationFrame((()=>{this._refreshDecorations(),this._animationFrame=void 0})))}};t.OverviewRulerRenderer=f=r([i(2,c.IBufferService),i(3,c.IDecorationService),i(4,o.IRenderService),i(5,c.IOptionsService),i(6,o.ICoreBrowserService)],f)},2950:function(e,t,n){var r=this&&this.__decorate||function(e,t,n,r){var i,a=arguments.length,o=a<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,n):r;if(typeof Reflect==`object`&&typeof Reflect.decorate==`function`)o=Reflect.decorate(e,t,n,r);else for(var s=e.length-1;s>=0;s--)(i=e[s])&&(o=(a<3?i(o):a>3?i(t,n,o):i(t,n))||o);return a>3&&o&&Object.defineProperty(t,n,o),o},i=this&&this.__param||function(e,t){return function(n,r){t(n,r,e)}};Object.defineProperty(t,"__esModule",{value:!0}),t.CompositionHelper=void 0;let a=n(4725),o=n(2585),s=n(2584),c=t.CompositionHelper=class{get isComposing(){return this._isComposing}constructor(e,t,n,r,i,a){this._textarea=e,this._compositionView=t,this._bufferService=n,this._optionsService=r,this._coreService=i,this._renderService=a,this._isComposing=!1,this._isSendingComposition=!1,this._compositionPosition={start:0,end:0},this._dataAlreadySent=``}compositionstart(){this._isComposing=!0,this._compositionPosition.start=this._textarea.value.length,this._compositionView.textContent=``,this._dataAlreadySent=``,this._compositionView.classList.add(`active`)}compositionupdate(e){this._compositionView.textContent=e.data,this.updateCompositionElements(),setTimeout((()=>{this._compositionPosition.end=this._textarea.value.length}),0)}compositionend(){this._finalizeComposition(!0)}keydown(e){if(this._isComposing||this._isSendingComposition){if(e.keyCode===229||e.keyCode===16||e.keyCode===17||e.keyCode===18)return!1;this._finalizeComposition(!1)}return e.keyCode!==229||(this._handleAnyTextareaChanges(),!1)}_finalizeComposition(e){if(this._compositionView.classList.remove(`active`),this._isComposing=!1,e){let e={start:this._compositionPosition.start,end:this._compositionPosition.end};this._isSendingComposition=!0,setTimeout((()=>{if(this._isSendingComposition){let t;this._isSendingComposition=!1,e.start+=this._dataAlreadySent.length,t=this._isComposing?this._textarea.value.substring(e.start,e.end):this._textarea.value.substring(e.start),t.length>0&&this._coreService.triggerDataEvent(t,!0)}}),0)}else{this._isSendingComposition=!1;let e=this._textarea.value.substring(this._compositionPosition.start,this._compositionPosition.end);this._coreService.triggerDataEvent(e,!0)}}_handleAnyTextareaChanges(){let e=this._textarea.value;setTimeout((()=>{if(!this._isComposing){let t=this._textarea.value,n=t.replace(e,``);this._dataAlreadySent=n,t.length>e.length?this._coreService.triggerDataEvent(n,!0):t.lengththis.updateCompositionElements(!0)),0)}}};t.CompositionHelper=c=r([i(2,o.IBufferService),i(3,o.IOptionsService),i(4,o.ICoreService),i(5,a.IRenderService)],c)},9806:(e,t)=>{function n(e,t,n){let r=n.getBoundingClientRect(),i=e.getComputedStyle(n),a=parseInt(i.getPropertyValue(`padding-left`)),o=parseInt(i.getPropertyValue(`padding-top`));return[t.clientX-r.left-a,t.clientY-r.top-o]}Object.defineProperty(t,"__esModule",{value:!0}),t.getCoords=t.getCoordsRelativeToElement=void 0,t.getCoordsRelativeToElement=n,t.getCoords=function(e,t,r,i,a,o,s,c,l){if(!o)return;let u=n(e,t,r);return u?(u[0]=Math.ceil((u[0]+(l?s/2:0))/s),u[1]=Math.ceil(u[1]/c),u[0]=Math.min(Math.max(u[0],1),i+ +!!l),u[1]=Math.min(Math.max(u[1],1),a),u):void 0}},9504:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.moveToCellSequence=void 0;let r=n(2584);function i(e,t,n,r){let i=e-a(e,n),s=t-a(t,n);return l(Math.abs(i-s)-function(e,t,n){let r=0,i=e-a(e,n),s=t-a(t,n);for(let a=0;a=0&&et?`A`:`B`}function s(e,t,n,r,i,a){let o=e,s=t,c=``;for(;o!==n||s!==r;)o+=i?1:-1,i&&o>a.cols-1?(c+=a.buffer.translateBufferLineToString(s,!1,e,o),o=0,e=0,s++):!i&&o<0&&(c+=a.buffer.translateBufferLineToString(s,!1,0,e+1),o=a.cols-1,e=o,s--);return c+a.buffer.translateBufferLineToString(s,!1,e,o)}function c(e,t){let n=t?`O`:`[`;return r.C0.ESC+n+e}function l(e,t){e=Math.floor(e);let n=``;for(let r=0;r0?r-a(r,o):t;let f=r,p=function(e,t,n,r,o,s){let c;return c=i(n,r,o,s).length>0?r-a(r,o):t,e=n&&ce?`D`:`C`,l(Math.abs(o-e),c(d,r));d=u>t?`D`:`C`;let f=Math.abs(u-t);return l(function(e,t){return t.cols-e}(u>t?e:o,n)+(f-1)*n.cols+1+((u>t?o:e)-1),c(d,r))}},1296:function(e,t,n){var r=this&&this.__decorate||function(e,t,n,r){var i,a=arguments.length,o=a<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,n):r;if(typeof Reflect==`object`&&typeof Reflect.decorate==`function`)o=Reflect.decorate(e,t,n,r);else for(var s=e.length-1;s>=0;s--)(i=e[s])&&(o=(a<3?i(o):a>3?i(t,n,o):i(t,n))||o);return a>3&&o&&Object.defineProperty(t,n,o),o},i=this&&this.__param||function(e,t){return function(n,r){t(n,r,e)}};Object.defineProperty(t,"__esModule",{value:!0}),t.DomRenderer=void 0;let a=n(3787),o=n(2550),s=n(2223),c=n(6171),l=n(6052),u=n(4725),d=n(8055),f=n(8460),p=n(844),m=n(2585),h=`xterm-dom-renderer-owner-`,g=`xterm-rows`,_=`xterm-fg-`,v=`xterm-bg-`,y=`xterm-focus`,b=`xterm-selection`,x=1,S=t.DomRenderer=class extends p.Disposable{constructor(e,t,n,r,i,s,u,d,m,_,v,y,S){super(),this._terminal=e,this._document=t,this._element=n,this._screenElement=r,this._viewportElement=i,this._helperContainer=s,this._linkifier2=u,this._charSizeService=m,this._optionsService=_,this._bufferService=v,this._coreBrowserService=y,this._themeService=S,this._terminalClass=x++,this._rowElements=[],this._selectionRenderModel=(0,l.createSelectionRenderModel)(),this.onRequestRedraw=this.register(new f.EventEmitter).event,this._rowContainer=this._document.createElement(`div`),this._rowContainer.classList.add(g),this._rowContainer.style.lineHeight=`normal`,this._rowContainer.setAttribute(`aria-hidden`,`true`),this._refreshRowElements(this._bufferService.cols,this._bufferService.rows),this._selectionContainer=this._document.createElement(`div`),this._selectionContainer.classList.add(b),this._selectionContainer.setAttribute(`aria-hidden`,`true`),this.dimensions=(0,c.createRenderDimensions)(),this._updateDimensions(),this.register(this._optionsService.onOptionChange((()=>this._handleOptionsChanged()))),this.register(this._themeService.onChangeColors((e=>this._injectCss(e)))),this._injectCss(this._themeService.colors),this._rowFactory=d.createInstance(a.DomRendererRowFactory,document),this._element.classList.add(h+this._terminalClass),this._screenElement.appendChild(this._rowContainer),this._screenElement.appendChild(this._selectionContainer),this.register(this._linkifier2.onShowLinkUnderline((e=>this._handleLinkHover(e)))),this.register(this._linkifier2.onHideLinkUnderline((e=>this._handleLinkLeave(e)))),this.register((0,p.toDisposable)((()=>{this._element.classList.remove(h+this._terminalClass),this._rowContainer.remove(),this._selectionContainer.remove(),this._widthCache.dispose(),this._themeStyleElement.remove(),this._dimensionsStyleElement.remove()}))),this._widthCache=new o.WidthCache(this._document,this._helperContainer),this._widthCache.setFont(this._optionsService.rawOptions.fontFamily,this._optionsService.rawOptions.fontSize,this._optionsService.rawOptions.fontWeight,this._optionsService.rawOptions.fontWeightBold),this._setDefaultSpacing()}_updateDimensions(){let e=this._coreBrowserService.dpr;this.dimensions.device.char.width=this._charSizeService.width*e,this.dimensions.device.char.height=Math.ceil(this._charSizeService.height*e),this.dimensions.device.cell.width=this.dimensions.device.char.width+Math.round(this._optionsService.rawOptions.letterSpacing),this.dimensions.device.cell.height=Math.floor(this.dimensions.device.char.height*this._optionsService.rawOptions.lineHeight),this.dimensions.device.char.left=0,this.dimensions.device.char.top=0,this.dimensions.device.canvas.width=this.dimensions.device.cell.width*this._bufferService.cols,this.dimensions.device.canvas.height=this.dimensions.device.cell.height*this._bufferService.rows,this.dimensions.css.canvas.width=Math.round(this.dimensions.device.canvas.width/e),this.dimensions.css.canvas.height=Math.round(this.dimensions.device.canvas.height/e),this.dimensions.css.cell.width=this.dimensions.css.canvas.width/this._bufferService.cols,this.dimensions.css.cell.height=this.dimensions.css.canvas.height/this._bufferService.rows;for(let e of this._rowElements)e.style.width=`${this.dimensions.css.canvas.width}px`,e.style.height=`${this.dimensions.css.cell.height}px`,e.style.lineHeight=`${this.dimensions.css.cell.height}px`,e.style.overflow=`hidden`;this._dimensionsStyleElement||(this._dimensionsStyleElement=this._document.createElement(`style`),this._screenElement.appendChild(this._dimensionsStyleElement));let t=`${this._terminalSelector} .${g} span { display: inline-block; height: 100%; vertical-align: top;}`;this._dimensionsStyleElement.textContent=t,this._selectionContainer.style.height=this._viewportElement.style.height,this._screenElement.style.width=`${this.dimensions.css.canvas.width}px`,this._screenElement.style.height=`${this.dimensions.css.canvas.height}px`}_injectCss(e){this._themeStyleElement||(this._themeStyleElement=this._document.createElement(`style`),this._screenElement.appendChild(this._themeStyleElement));let t=`${this._terminalSelector} .${g} { color: ${e.foreground.css}; font-family: ${this._optionsService.rawOptions.fontFamily}; font-size: ${this._optionsService.rawOptions.fontSize}px; font-kerning: none; white-space: pre}`;t+=`${this._terminalSelector} .${g} .xterm-dim { color: ${d.color.multiplyOpacity(e.foreground,.5).css};}`,t+=`${this._terminalSelector} span:not(.xterm-bold) { font-weight: ${this._optionsService.rawOptions.fontWeight};}${this._terminalSelector} span.xterm-bold { font-weight: ${this._optionsService.rawOptions.fontWeightBold};}${this._terminalSelector} span.xterm-italic { font-style: italic;}`;let n=`blink_underline_${this._terminalClass}`,r=`blink_bar_${this._terminalClass}`,i=`blink_block_${this._terminalClass}`;t+=`@keyframes ${n} { 50% { border-bottom-style: hidden; }}`,t+=`@keyframes ${r} { 50% { box-shadow: none; }}`,t+=`@keyframes ${i} { 0% { background-color: ${e.cursor.css}; color: ${e.cursorAccent.css}; } 50% { background-color: inherit; color: ${e.cursor.css}; }}`,t+=`${this._terminalSelector} .${g}.${y} .xterm-cursor.xterm-cursor-blink.xterm-cursor-underline { animation: ${n} 1s step-end infinite;}${this._terminalSelector} .${g}.${y} .xterm-cursor.xterm-cursor-blink.xterm-cursor-bar { animation: ${r} 1s step-end infinite;}${this._terminalSelector} .${g}.${y} .xterm-cursor.xterm-cursor-blink.xterm-cursor-block { animation: ${i} 1s step-end infinite;}${this._terminalSelector} .${g} .xterm-cursor.xterm-cursor-block { background-color: ${e.cursor.css}; color: ${e.cursorAccent.css};}${this._terminalSelector} .${g} .xterm-cursor.xterm-cursor-block:not(.xterm-cursor-blink) { background-color: ${e.cursor.css} !important; color: ${e.cursorAccent.css} !important;}${this._terminalSelector} .${g} .xterm-cursor.xterm-cursor-outline { outline: 1px solid ${e.cursor.css}; outline-offset: -1px;}${this._terminalSelector} .${g} .xterm-cursor.xterm-cursor-bar { box-shadow: ${this._optionsService.rawOptions.cursorWidth}px 0 0 ${e.cursor.css} inset;}${this._terminalSelector} .${g} .xterm-cursor.xterm-cursor-underline { border-bottom: 1px ${e.cursor.css}; border-bottom-style: solid; height: calc(100% - 1px);}`,t+=`${this._terminalSelector} .${b} { position: absolute; top: 0; left: 0; z-index: 1; pointer-events: none;}${this._terminalSelector}.focus .${b} div { position: absolute; background-color: ${e.selectionBackgroundOpaque.css};}${this._terminalSelector} .${b} div { position: absolute; background-color: ${e.selectionInactiveBackgroundOpaque.css};}`;for(let[n,r]of e.ansi.entries())t+=`${this._terminalSelector} .${_}${n} { color: ${r.css}; }${this._terminalSelector} .${_}${n}.xterm-dim { color: ${d.color.multiplyOpacity(r,.5).css}; }${this._terminalSelector} .${v}${n} { background-color: ${r.css}; }`;t+=`${this._terminalSelector} .${_}${s.INVERTED_DEFAULT_COLOR} { color: ${d.color.opaque(e.background).css}; }${this._terminalSelector} .${_}${s.INVERTED_DEFAULT_COLOR}.xterm-dim { color: ${d.color.multiplyOpacity(d.color.opaque(e.background),.5).css}; }${this._terminalSelector} .${v}${s.INVERTED_DEFAULT_COLOR} { background-color: ${e.foreground.css}; }`,this._themeStyleElement.textContent=t}_setDefaultSpacing(){let e=this.dimensions.css.cell.width-this._widthCache.get(`W`,!1,!1);this._rowContainer.style.letterSpacing=`${e}px`,this._rowFactory.defaultSpacing=e}handleDevicePixelRatioChange(){this._updateDimensions(),this._widthCache.clear(),this._setDefaultSpacing()}_refreshRowElements(e,t){for(let e=this._rowElements.length;e<=t;e++){let e=this._document.createElement(`div`);this._rowContainer.appendChild(e),this._rowElements.push(e)}for(;this._rowElements.length>t;)this._rowContainer.removeChild(this._rowElements.pop())}handleResize(e,t){this._refreshRowElements(e,t),this._updateDimensions(),this.handleSelectionChanged(this._selectionRenderModel.selectionStart,this._selectionRenderModel.selectionEnd,this._selectionRenderModel.columnSelectMode)}handleCharSizeChanged(){this._updateDimensions(),this._widthCache.clear(),this._setDefaultSpacing()}handleBlur(){this._rowContainer.classList.remove(y),this.renderRows(0,this._bufferService.rows-1)}handleFocus(){this._rowContainer.classList.add(y),this.renderRows(this._bufferService.buffer.y,this._bufferService.buffer.y)}handleSelectionChanged(e,t,n){if(this._selectionContainer.replaceChildren(),this._rowFactory.handleSelectionChanged(e,t,n),this.renderRows(0,this._bufferService.rows-1),!e||!t)return;this._selectionRenderModel.update(this._terminal,e,t,n);let r=this._selectionRenderModel.viewportStartRow,i=this._selectionRenderModel.viewportEndRow,a=this._selectionRenderModel.viewportCappedStartRow,o=this._selectionRenderModel.viewportCappedEndRow;if(a>=this._bufferService.rows||o<0)return;let s=this._document.createDocumentFragment();if(n){let n=e[0]>t[0];s.appendChild(this._createSelectionElement(a,n?t[0]:e[0],n?e[0]:t[0],o-a+1))}else{let n=r===a?e[0]:0,c=a===i?t[0]:this._bufferService.cols;s.appendChild(this._createSelectionElement(a,n,c));let l=o-a-1;if(s.appendChild(this._createSelectionElement(a+1,0,this._bufferService.cols,l)),a!==o){let e=i===o?t[0]:this._bufferService.cols;s.appendChild(this._createSelectionElement(o,0,e))}}this._selectionContainer.appendChild(s)}_createSelectionElement(e,t,n,r=1){let i=this._document.createElement(`div`),a=t*this.dimensions.css.cell.width,o=this.dimensions.css.cell.width*(n-t);return a+o>this.dimensions.css.canvas.width&&(o=this.dimensions.css.canvas.width-a),i.style.height=r*this.dimensions.css.cell.height+`px`,i.style.top=e*this.dimensions.css.cell.height+`px`,i.style.left=`${a}px`,i.style.width=`${o}px`,i}handleCursorMove(){}_handleOptionsChanged(){this._updateDimensions(),this._injectCss(this._themeService.colors),this._widthCache.setFont(this._optionsService.rawOptions.fontFamily,this._optionsService.rawOptions.fontSize,this._optionsService.rawOptions.fontWeight,this._optionsService.rawOptions.fontWeightBold),this._setDefaultSpacing()}clear(){for(let e of this._rowElements)e.replaceChildren()}renderRows(e,t){let n=this._bufferService.buffer,r=n.ybase+n.y,i=Math.min(n.x,this._bufferService.cols-1),a=this._optionsService.rawOptions.cursorBlink,o=this._optionsService.rawOptions.cursorStyle,s=this._optionsService.rawOptions.cursorInactiveStyle;for(let c=e;c<=t;c++){let e=c+n.ydisp,t=this._rowElements[c],l=n.lines.get(e);if(!t||!l)break;t.replaceChildren(...this._rowFactory.createRow(l,e,e===r,o,s,i,a,this.dimensions.css.cell.width,this._widthCache,-1,-1))}}get _terminalSelector(){return`.${h}${this._terminalClass}`}_handleLinkHover(e){this._setCellUnderline(e.x1,e.x2,e.y1,e.y2,e.cols,!0)}_handleLinkLeave(e){this._setCellUnderline(e.x1,e.x2,e.y1,e.y2,e.cols,!1)}_setCellUnderline(e,t,n,r,i,a){n<0&&(e=0),r<0&&(t=0);let o=this._bufferService.rows-1;n=Math.max(Math.min(n,o),0),r=Math.max(Math.min(r,o),0),i=Math.min(i,this._bufferService.cols);let s=this._bufferService.buffer,c=s.ybase+s.y,l=Math.min(s.x,i-1),u=this._optionsService.rawOptions.cursorBlink,d=this._optionsService.rawOptions.cursorStyle,f=this._optionsService.rawOptions.cursorInactiveStyle;for(let o=n;o<=r;++o){let p=o+s.ydisp,m=this._rowElements[o],h=s.lines.get(p);if(!m||!h)break;m.replaceChildren(...this._rowFactory.createRow(h,p,p===c,d,f,l,u,this.dimensions.css.cell.width,this._widthCache,a?o===n?e:0:-1,a?(o===r?t:i)-1:-1))}}};t.DomRenderer=S=r([i(7,m.IInstantiationService),i(8,u.ICharSizeService),i(9,m.IOptionsService),i(10,m.IBufferService),i(11,u.ICoreBrowserService),i(12,u.IThemeService)],S)},3787:function(e,t,n){var r=this&&this.__decorate||function(e,t,n,r){var i,a=arguments.length,o=a<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,n):r;if(typeof Reflect==`object`&&typeof Reflect.decorate==`function`)o=Reflect.decorate(e,t,n,r);else for(var s=e.length-1;s>=0;s--)(i=e[s])&&(o=(a<3?i(o):a>3?i(t,n,o):i(t,n))||o);return a>3&&o&&Object.defineProperty(t,n,o),o},i=this&&this.__param||function(e,t){return function(n,r){t(n,r,e)}};Object.defineProperty(t,"__esModule",{value:!0}),t.DomRendererRowFactory=void 0;let a=n(2223),o=n(643),s=n(511),c=n(2585),l=n(8055),u=n(4725),d=n(4269),f=n(6171),p=n(3734),m=t.DomRendererRowFactory=class{constructor(e,t,n,r,i,a,o){this._document=e,this._characterJoinerService=t,this._optionsService=n,this._coreBrowserService=r,this._coreService=i,this._decorationService=a,this._themeService=o,this._workCell=new s.CellData,this._columnSelectMode=!1,this.defaultSpacing=0}handleSelectionChanged(e,t,n){this._selectionStart=e,this._selectionEnd=t,this._columnSelectMode=n}createRow(e,t,n,r,i,s,c,u,f,m,g){let _=[],v=this._characterJoinerService.getJoinedCharacters(t),y=this._themeService.colors,b,x=e.getNoBgTrimmedLength();n&&x0&&M===v[0][0]){N=!0;let t=v.shift();F=new d.JoinedCellData(this._workCell,e.translateToString(!0,t[0],t[1]),t[1]-t[0]),P=t[1]-1,x=F.getWidth()}let I=this._isCellInSelection(M,t),te=n&&M===s,ne=ee&&M>=m&&M<=g,re=!1;this._decorationService.forEachDecorationAtCell(M,t,void 0,(e=>{re=!0}));let L=F.getChars()||o.WHITESPACE_CELL_CHAR;if(L===` `&&(F.isUnderline()||F.isOverline())&&(L=`\xA0`),A=x*u-f.get(L,F.isBold(),F.isItalic()),b){if(S&&(I&&k||!I&&!k&&F.bg===w)&&(I&&k&&y.selectionForeground||F.fg===T)&&F.extended.ext===E&&ne===D&&A===O&&!te&&!N&&!re){F.isInvisible()?C+=o.WHITESPACE_CELL_CHAR:C+=L,S++;continue}S&&(b.textContent=C),b=this._document.createElement(`span`),S=0,C=``}else b=this._document.createElement(`span`);if(w=F.bg,T=F.fg,E=F.extended.ext,D=ne,O=A,k=I,N&&s>=M&&s<=P&&(s=M),!this._coreService.isCursorHidden&&te&&this._coreService.isCursorInitialized){if(j.push(`xterm-cursor`),this._coreBrowserService.isFocused)c&&j.push(`xterm-cursor-blink`),j.push(r===`bar`?`xterm-cursor-bar`:r===`underline`?`xterm-cursor-underline`:`xterm-cursor-block`);else if(i)switch(i){case`outline`:j.push(`xterm-cursor-outline`);break;case`block`:j.push(`xterm-cursor-block`);break;case`bar`:j.push(`xterm-cursor-bar`);break;case`underline`:j.push(`xterm-cursor-underline`)}}if(F.isBold()&&j.push(`xterm-bold`),F.isItalic()&&j.push(`xterm-italic`),F.isDim()&&j.push(`xterm-dim`),C=F.isInvisible()?o.WHITESPACE_CELL_CHAR:F.getChars()||o.WHITESPACE_CELL_CHAR,F.isUnderline()&&(j.push(`xterm-underline-${F.extended.underlineStyle}`),C===` `&&(C=`\xA0`),!F.isUnderlineColorDefault()))if(F.isUnderlineColorRGB())b.style.textDecorationColor=`rgb(${p.AttributeData.toColorRGB(F.getUnderlineColor()).join(`,`)})`;else{let e=F.getUnderlineColor();this._optionsService.rawOptions.drawBoldTextInBrightColors&&F.isBold()&&e<8&&(e+=8),b.style.textDecorationColor=y.ansi[e].css}F.isOverline()&&(j.push(`xterm-overline`),C===` `&&(C=`\xA0`)),F.isStrikethrough()&&j.push(`xterm-strikethrough`),ne&&(b.style.textDecoration=`underline`);let R=F.getFgColor(),z=F.getFgColorMode(),B=F.getBgColor(),ie=F.getBgColorMode(),ae=!!F.isInverse();if(ae){let e=R;R=B,B=e;let t=z;z=ie,ie=t}let oe,se,ce,le=!1;switch(this._decorationService.forEachDecorationAtCell(M,t,void 0,(e=>{e.options.layer!==`top`&&le||(e.backgroundColorRGB&&(ie=50331648,B=e.backgroundColorRGB.rgba>>8&16777215,oe=e.backgroundColorRGB),e.foregroundColorRGB&&(z=50331648,R=e.foregroundColorRGB.rgba>>8&16777215,se=e.foregroundColorRGB),le=e.options.layer===`top`)})),!le&&I&&(oe=this._coreBrowserService.isFocused?y.selectionBackgroundOpaque:y.selectionInactiveBackgroundOpaque,B=oe.rgba>>8&16777215,ie=50331648,le=!0,y.selectionForeground&&(z=50331648,R=y.selectionForeground.rgba>>8&16777215,se=y.selectionForeground)),le&&j.push(`xterm-decoration-top`),ie){case 16777216:case 33554432:ce=y.ansi[B],j.push(`xterm-bg-${B}`);break;case 50331648:ce=l.channels.toColor(B>>16,B>>8&255,255&B),this._addStyle(b,`background-color:#${h((B>>>0).toString(16),`0`,6)}`);break;default:ae?(ce=y.foreground,j.push(`xterm-bg-${a.INVERTED_DEFAULT_COLOR}`)):ce=y.background}switch(oe||F.isDim()&&(oe=l.color.multiplyOpacity(ce,.5)),z){case 16777216:case 33554432:F.isBold()&&R<8&&this._optionsService.rawOptions.drawBoldTextInBrightColors&&(R+=8),this._applyMinimumContrast(b,ce,y.ansi[R],F,oe,void 0)||j.push(`xterm-fg-${R}`);break;case 50331648:let e=l.channels.toColor(R>>16&255,R>>8&255,255&R);this._applyMinimumContrast(b,ce,e,F,oe,se)||this._addStyle(b,`color:#${h(R.toString(16),`0`,6)}`);break;default:this._applyMinimumContrast(b,ce,y.foreground,F,oe,se)||ae&&j.push(`xterm-fg-${a.INVERTED_DEFAULT_COLOR}`)}j.length&&=(b.className=j.join(` `),0),te||N||re?b.textContent=C:S++,A!==this.defaultSpacing&&(b.style.letterSpacing=`${A}px`),_.push(b),M=P}return b&&S&&(b.textContent=C),_}_applyMinimumContrast(e,t,n,r,i,a){if(this._optionsService.rawOptions.minimumContrastRatio===1||(0,f.treatGlyphAsBackgroundColor)(r.getCode()))return!1;let o=this._getContrastCache(r),s;if(i||a||(s=o.getColor(t.rgba,n.rgba)),s===void 0){let e=this._optionsService.rawOptions.minimumContrastRatio/(r.isDim()?2:1);s=l.color.ensureContrastRatio(i||t,a||n,e),o.setColor((i||t).rgba,(a||n).rgba,s??null)}return!!s&&(this._addStyle(e,`color:${s.css}`),!0)}_getContrastCache(e){return e.isDim()?this._themeService.colors.halfContrastCache:this._themeService.colors.contrastCache}_addStyle(e,t){e.setAttribute(`style`,`${e.getAttribute(`style`)||``}${t};`)}_isCellInSelection(e,t){let n=this._selectionStart,r=this._selectionEnd;return!(!n||!r)&&(this._columnSelectMode?n[0]<=r[0]?e>=n[0]&&t>=n[1]&&e=n[1]&&e>=r[0]&&t<=r[1]:t>n[1]&&t=n[0]&&e=n[0])}};function h(e,t,n){for(;e.length{Object.defineProperty(t,"__esModule",{value:!0}),t.WidthCache=void 0,t.WidthCache=class{constructor(e,t){this._flat=new Float32Array(256),this._font=``,this._fontSize=0,this._weight=`normal`,this._weightBold=`bold`,this._measureElements=[],this._container=e.createElement(`div`),this._container.classList.add(`xterm-width-cache-measure-container`),this._container.setAttribute(`aria-hidden`,`true`),this._container.style.whiteSpace=`pre`,this._container.style.fontKerning=`none`;let n=e.createElement(`span`);n.classList.add(`xterm-char-measure-element`);let r=e.createElement(`span`);r.classList.add(`xterm-char-measure-element`),r.style.fontWeight=`bold`;let i=e.createElement(`span`);i.classList.add(`xterm-char-measure-element`),i.style.fontStyle=`italic`;let a=e.createElement(`span`);a.classList.add(`xterm-char-measure-element`),a.style.fontWeight=`bold`,a.style.fontStyle=`italic`,this._measureElements=[n,r,i,a],this._container.appendChild(n),this._container.appendChild(r),this._container.appendChild(i),this._container.appendChild(a),t.appendChild(this._container),this.clear()}dispose(){this._container.remove(),this._measureElements.length=0,this._holey=void 0}clear(){this._flat.fill(-9999),this._holey=new Map}setFont(e,t,n,r){e===this._font&&t===this._fontSize&&n===this._weight&&r===this._weightBold||(this._font=e,this._fontSize=t,this._weight=n,this._weightBold=r,this._container.style.fontFamily=this._font,this._container.style.fontSize=`${this._fontSize}px`,this._measureElements[0].style.fontWeight=`${n}`,this._measureElements[1].style.fontWeight=`${r}`,this._measureElements[2].style.fontWeight=`${n}`,this._measureElements[3].style.fontWeight=`${r}`,this.clear())}get(e,t,n){let r=0;if(!t&&!n&&e.length===1&&(r=e.charCodeAt(0))<256){if(this._flat[r]!==-9999)return this._flat[r];let t=this._measure(e,0);return t>0&&(this._flat[r]=t),t}let i=e;t&&(i+=`B`),n&&(i+=`I`);let a=this._holey.get(i);if(a===void 0){let r=0;t&&(r|=1),n&&(r|=2),a=this._measure(e,r),a>0&&this._holey.set(i,a)}return a}_measure(e,t){let n=this._measureElements[t];return n.textContent=e.repeat(32),n.offsetWidth/32}}},2223:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.TEXT_BASELINE=t.DIM_OPACITY=t.INVERTED_DEFAULT_COLOR=void 0;let r=n(6114);t.INVERTED_DEFAULT_COLOR=257,t.DIM_OPACITY=.5,t.TEXT_BASELINE=r.isFirefox||r.isLegacyEdge?`bottom`:`ideographic`},6171:(e,t)=>{function n(e){return 57508<=e&&e<=57558}function r(e){return e>=128512&&e<=128591||e>=127744&&e<=128511||e>=128640&&e<=128767||e>=9728&&e<=9983||e>=9984&&e<=10175||e>=65024&&e<=65039||e>=129280&&e<=129535||e>=127462&&e<=127487}Object.defineProperty(t,"__esModule",{value:!0}),t.computeNextVariantOffset=t.createRenderDimensions=t.treatGlyphAsBackgroundColor=t.allowRescaling=t.isEmoji=t.isRestrictedPowerlineGlyph=t.isPowerlineGlyph=t.throwIfFalsy=void 0,t.throwIfFalsy=function(e){if(!e)throw Error(`value must not be falsy`);return e},t.isPowerlineGlyph=n,t.isRestrictedPowerlineGlyph=function(e){return 57520<=e&&e<=57527},t.isEmoji=r,t.allowRescaling=function(e,t,i,a){return t===1&&i>Math.ceil(1.5*a)&&e!==void 0&&e>255&&!r(e)&&!n(e)&&!function(e){return 57344<=e&&e<=63743}(e)},t.treatGlyphAsBackgroundColor=function(e){return n(e)||function(e){return 9472<=e&&e<=9631}(e)},t.createRenderDimensions=function(){return{css:{canvas:{width:0,height:0},cell:{width:0,height:0}},device:{canvas:{width:0,height:0},cell:{width:0,height:0},char:{width:0,height:0,left:0,top:0}}}},t.computeNextVariantOffset=function(e,t,n=0){return(e-(2*Math.round(t)-n))%(2*Math.round(t))}},6052:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.createSelectionRenderModel=void 0;class n{constructor(){this.clear()}clear(){this.hasSelection=!1,this.columnSelectMode=!1,this.viewportStartRow=0,this.viewportEndRow=0,this.viewportCappedStartRow=0,this.viewportCappedEndRow=0,this.startCol=0,this.endCol=0,this.selectionStart=void 0,this.selectionEnd=void 0}update(e,t,n,r=!1){if(this.selectionStart=t,this.selectionEnd=n,!t||!n||t[0]===n[0]&&t[1]===n[1])return void this.clear();let i=e.buffers.active.ydisp,a=t[1]-i,o=n[1]-i,s=Math.max(a,0),c=Math.min(o,e.rows-1);s>=e.rows||c<0?this.clear():(this.hasSelection=!0,this.columnSelectMode=r,this.viewportStartRow=a,this.viewportEndRow=o,this.viewportCappedStartRow=s,this.viewportCappedEndRow=c,this.startCol=t[0],this.endCol=n[0])}isCellSelected(e,t,n){return!!this.hasSelection&&(n-=e.buffer.active.viewportY,this.columnSelectMode?this.startCol<=this.endCol?t>=this.startCol&&n>=this.viewportCappedStartRow&&t=this.viewportCappedStartRow&&t>=this.endCol&&n<=this.viewportCappedEndRow:n>this.viewportStartRow&&n=this.startCol&&t=this.startCol)}}t.createSelectionRenderModel=function(){return new n}},456:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.SelectionModel=void 0,t.SelectionModel=class{constructor(e){this._bufferService=e,this.isSelectAllActive=!1,this.selectionStartLength=0}clearSelection(){this.selectionStart=void 0,this.selectionEnd=void 0,this.isSelectAllActive=!1,this.selectionStartLength=0}get finalSelectionStart(){return this.isSelectAllActive?[0,0]:this.selectionEnd&&this.selectionStart&&this.areSelectionValuesReversed()?this.selectionEnd:this.selectionStart}get finalSelectionEnd(){if(this.isSelectAllActive)return[this._bufferService.cols,this._bufferService.buffer.ybase+this._bufferService.rows-1];if(this.selectionStart){if(!this.selectionEnd||this.areSelectionValuesReversed()){let e=this.selectionStart[0]+this.selectionStartLength;return e>this._bufferService.cols?e%this._bufferService.cols==0?[this._bufferService.cols,this.selectionStart[1]+Math.floor(e/this._bufferService.cols)-1]:[e%this._bufferService.cols,this.selectionStart[1]+Math.floor(e/this._bufferService.cols)]:[e,this.selectionStart[1]]}if(this.selectionStartLength&&this.selectionEnd[1]===this.selectionStart[1]){let e=this.selectionStart[0]+this.selectionStartLength;return e>this._bufferService.cols?[e%this._bufferService.cols,this.selectionStart[1]+Math.floor(e/this._bufferService.cols)]:[Math.max(e,this.selectionEnd[0]),this.selectionEnd[1]]}return this.selectionEnd}}areSelectionValuesReversed(){let e=this.selectionStart,t=this.selectionEnd;return!(!e||!t)&&(e[1]>t[1]||e[1]===t[1]&&e[0]>t[0])}handleTrim(e){return this.selectionStart&&(this.selectionStart[1]-=e),this.selectionEnd&&(this.selectionEnd[1]-=e),this.selectionEnd&&this.selectionEnd[1]<0?(this.clearSelection(),!0):(this.selectionStart&&this.selectionStart[1]<0&&(this.selectionStart[1]=0),!1)}}},428:function(e,t,n){var r=this&&this.__decorate||function(e,t,n,r){var i,a=arguments.length,o=a<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,n):r;if(typeof Reflect==`object`&&typeof Reflect.decorate==`function`)o=Reflect.decorate(e,t,n,r);else for(var s=e.length-1;s>=0;s--)(i=e[s])&&(o=(a<3?i(o):a>3?i(t,n,o):i(t,n))||o);return a>3&&o&&Object.defineProperty(t,n,o),o},i=this&&this.__param||function(e,t){return function(n,r){t(n,r,e)}};Object.defineProperty(t,"__esModule",{value:!0}),t.CharSizeService=void 0;let a=n(2585),o=n(8460),s=n(844),c=t.CharSizeService=class extends s.Disposable{get hasValidSize(){return this.width>0&&this.height>0}constructor(e,t,n){super(),this._optionsService=n,this.width=0,this.height=0,this._onCharSizeChange=this.register(new o.EventEmitter),this.onCharSizeChange=this._onCharSizeChange.event;try{this._measureStrategy=this.register(new d(this._optionsService))}catch{this._measureStrategy=this.register(new u(e,t,this._optionsService))}this.register(this._optionsService.onMultipleOptionChange([`fontFamily`,`fontSize`],(()=>this.measure())))}measure(){let e=this._measureStrategy.measure();e.width===this.width&&e.height===this.height||(this.width=e.width,this.height=e.height,this._onCharSizeChange.fire())}};t.CharSizeService=c=r([i(2,a.IOptionsService)],c);class l extends s.Disposable{constructor(){super(...arguments),this._result={width:0,height:0}}_validateAndSet(e,t){e!==void 0&&e>0&&t!==void 0&&t>0&&(this._result.width=e,this._result.height=t)}}class u extends l{constructor(e,t,n){super(),this._document=e,this._parentElement=t,this._optionsService=n,this._measureElement=this._document.createElement(`span`),this._measureElement.classList.add(`xterm-char-measure-element`),this._measureElement.textContent=`W`.repeat(32),this._measureElement.setAttribute(`aria-hidden`,`true`),this._measureElement.style.whiteSpace=`pre`,this._measureElement.style.fontKerning=`none`,this._parentElement.appendChild(this._measureElement)}measure(){return this._measureElement.style.fontFamily=this._optionsService.rawOptions.fontFamily,this._measureElement.style.fontSize=`${this._optionsService.rawOptions.fontSize}px`,this._validateAndSet(Number(this._measureElement.offsetWidth)/32,Number(this._measureElement.offsetHeight)),this._result}}class d extends l{constructor(e){super(),this._optionsService=e,this._canvas=new OffscreenCanvas(100,100),this._ctx=this._canvas.getContext(`2d`);let t=this._ctx.measureText(`W`);if(!(`width`in t&&`fontBoundingBoxAscent`in t&&`fontBoundingBoxDescent`in t))throw Error(`Required font metrics not supported`)}measure(){this._ctx.font=`${this._optionsService.rawOptions.fontSize}px ${this._optionsService.rawOptions.fontFamily}`;let e=this._ctx.measureText(`W`);return this._validateAndSet(e.width,e.fontBoundingBoxAscent+e.fontBoundingBoxDescent),this._result}}},4269:function(e,t,n){var r=this&&this.__decorate||function(e,t,n,r){var i,a=arguments.length,o=a<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,n):r;if(typeof Reflect==`object`&&typeof Reflect.decorate==`function`)o=Reflect.decorate(e,t,n,r);else for(var s=e.length-1;s>=0;s--)(i=e[s])&&(o=(a<3?i(o):a>3?i(t,n,o):i(t,n))||o);return a>3&&o&&Object.defineProperty(t,n,o),o},i=this&&this.__param||function(e,t){return function(n,r){t(n,r,e)}};Object.defineProperty(t,"__esModule",{value:!0}),t.CharacterJoinerService=t.JoinedCellData=void 0;let a=n(3734),o=n(643),s=n(511),c=n(2585);class l extends a.AttributeData{constructor(e,t,n){super(),this.content=0,this.combinedData=``,this.fg=e.fg,this.bg=e.bg,this.combinedData=t,this._width=n}isCombined(){return 2097152}getWidth(){return this._width}getChars(){return this.combinedData}getCode(){return 2097151}setFromCharData(e){throw Error(`not implemented`)}getAsCharData(){return[this.fg,this.getChars(),this.getWidth(),this.getCode()]}}t.JoinedCellData=l;let u=t.CharacterJoinerService=class e{constructor(e){this._bufferService=e,this._characterJoiners=[],this._nextCharacterJoinerId=0,this._workCell=new s.CellData}register(e){let t={id:this._nextCharacterJoinerId++,handler:e};return this._characterJoiners.push(t),t.id}deregister(e){for(let t=0;t1){let e=this._getJoinedRanges(r,s,a,t,i);for(let t=0;t1){let e=this._getJoinedRanges(r,s,a,t,i);for(let t=0;t{Object.defineProperty(t,"__esModule",{value:!0}),t.CoreBrowserService=void 0;let r=n(844),i=n(8460),a=n(3656);class o extends r.Disposable{constructor(e,t,n){super(),this._textarea=e,this._window=t,this.mainDocument=n,this._isFocused=!1,this._cachedIsFocused=void 0,this._screenDprMonitor=new s(this._window),this._onDprChange=this.register(new i.EventEmitter),this.onDprChange=this._onDprChange.event,this._onWindowChange=this.register(new i.EventEmitter),this.onWindowChange=this._onWindowChange.event,this.register(this.onWindowChange((e=>this._screenDprMonitor.setWindow(e)))),this.register((0,i.forwardEvent)(this._screenDprMonitor.onDprChange,this._onDprChange)),this._textarea.addEventListener(`focus`,(()=>this._isFocused=!0)),this._textarea.addEventListener(`blur`,(()=>this._isFocused=!1))}get window(){return this._window}set window(e){this._window!==e&&(this._window=e,this._onWindowChange.fire(this._window))}get dpr(){return this.window.devicePixelRatio}get isFocused(){return this._cachedIsFocused===void 0&&(this._cachedIsFocused=this._isFocused&&this._textarea.ownerDocument.hasFocus(),queueMicrotask((()=>this._cachedIsFocused=void 0))),this._cachedIsFocused}}t.CoreBrowserService=o;class s extends r.Disposable{constructor(e){super(),this._parentWindow=e,this._windowResizeListener=this.register(new r.MutableDisposable),this._onDprChange=this.register(new i.EventEmitter),this.onDprChange=this._onDprChange.event,this._outerListener=()=>this._setDprAndFireIfDiffers(),this._currentDevicePixelRatio=this._parentWindow.devicePixelRatio,this._updateDpr(),this._setWindowResizeListener(),this.register((0,r.toDisposable)((()=>this.clearListener())))}setWindow(e){this._parentWindow=e,this._setWindowResizeListener(),this._setDprAndFireIfDiffers()}_setWindowResizeListener(){this._windowResizeListener.value=(0,a.addDisposableDomListener)(this._parentWindow,`resize`,(()=>this._setDprAndFireIfDiffers()))}_setDprAndFireIfDiffers(){this._parentWindow.devicePixelRatio!==this._currentDevicePixelRatio&&this._onDprChange.fire(this._parentWindow.devicePixelRatio),this._updateDpr()}_updateDpr(){this._outerListener&&(this._resolutionMediaMatchList?.removeListener(this._outerListener),this._currentDevicePixelRatio=this._parentWindow.devicePixelRatio,this._resolutionMediaMatchList=this._parentWindow.matchMedia(`screen and (resolution: ${this._parentWindow.devicePixelRatio}dppx)`),this._resolutionMediaMatchList.addListener(this._outerListener))}clearListener(){this._resolutionMediaMatchList&&this._outerListener&&(this._resolutionMediaMatchList.removeListener(this._outerListener),this._resolutionMediaMatchList=void 0,this._outerListener=void 0)}}},779:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.LinkProviderService=void 0;let r=n(844);class i extends r.Disposable{constructor(){super(),this.linkProviders=[],this.register((0,r.toDisposable)((()=>this.linkProviders.length=0)))}registerLinkProvider(e){return this.linkProviders.push(e),{dispose:()=>{let t=this.linkProviders.indexOf(e);t!==-1&&this.linkProviders.splice(t,1)}}}}t.LinkProviderService=i},8934:function(e,t,n){var r=this&&this.__decorate||function(e,t,n,r){var i,a=arguments.length,o=a<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,n):r;if(typeof Reflect==`object`&&typeof Reflect.decorate==`function`)o=Reflect.decorate(e,t,n,r);else for(var s=e.length-1;s>=0;s--)(i=e[s])&&(o=(a<3?i(o):a>3?i(t,n,o):i(t,n))||o);return a>3&&o&&Object.defineProperty(t,n,o),o},i=this&&this.__param||function(e,t){return function(n,r){t(n,r,e)}};Object.defineProperty(t,"__esModule",{value:!0}),t.MouseService=void 0;let a=n(4725),o=n(9806),s=t.MouseService=class{constructor(e,t){this._renderService=e,this._charSizeService=t}getCoords(e,t,n,r,i){return(0,o.getCoords)(window,e,t,n,r,this._charSizeService.hasValidSize,this._renderService.dimensions.css.cell.width,this._renderService.dimensions.css.cell.height,i)}getMouseReportCoords(e,t){let n=(0,o.getCoordsRelativeToElement)(window,e,t);if(this._charSizeService.hasValidSize)return n[0]=Math.min(Math.max(n[0],0),this._renderService.dimensions.css.canvas.width-1),n[1]=Math.min(Math.max(n[1],0),this._renderService.dimensions.css.canvas.height-1),{col:Math.floor(n[0]/this._renderService.dimensions.css.cell.width),row:Math.floor(n[1]/this._renderService.dimensions.css.cell.height),x:Math.floor(n[0]),y:Math.floor(n[1])}}};t.MouseService=s=r([i(0,a.IRenderService),i(1,a.ICharSizeService)],s)},3230:function(e,t,n){var r=this&&this.__decorate||function(e,t,n,r){var i,a=arguments.length,o=a<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,n):r;if(typeof Reflect==`object`&&typeof Reflect.decorate==`function`)o=Reflect.decorate(e,t,n,r);else for(var s=e.length-1;s>=0;s--)(i=e[s])&&(o=(a<3?i(o):a>3?i(t,n,o):i(t,n))||o);return a>3&&o&&Object.defineProperty(t,n,o),o},i=this&&this.__param||function(e,t){return function(n,r){t(n,r,e)}};Object.defineProperty(t,"__esModule",{value:!0}),t.RenderService=void 0;let a=n(6193),o=n(4725),s=n(8460),c=n(844),l=n(7226),u=n(2585),d=t.RenderService=class extends c.Disposable{get dimensions(){return this._renderer.value.dimensions}constructor(e,t,n,r,i,o,u,d){super(),this._rowCount=e,this._charSizeService=r,this._renderer=this.register(new c.MutableDisposable),this._pausedResizeTask=new l.DebouncedIdleTask,this._observerDisposable=this.register(new c.MutableDisposable),this._isPaused=!1,this._needsFullRefresh=!1,this._isNextRenderRedrawOnly=!0,this._needsSelectionRefresh=!1,this._canvasWidth=0,this._canvasHeight=0,this._selectionState={start:void 0,end:void 0,columnSelectMode:!1},this._onDimensionsChange=this.register(new s.EventEmitter),this.onDimensionsChange=this._onDimensionsChange.event,this._onRenderedViewportChange=this.register(new s.EventEmitter),this.onRenderedViewportChange=this._onRenderedViewportChange.event,this._onRender=this.register(new s.EventEmitter),this.onRender=this._onRender.event,this._onRefreshRequest=this.register(new s.EventEmitter),this.onRefreshRequest=this._onRefreshRequest.event,this._renderDebouncer=new a.RenderDebouncer(((e,t)=>this._renderRows(e,t)),u),this.register(this._renderDebouncer),this.register(u.onDprChange((()=>this.handleDevicePixelRatioChange()))),this.register(o.onResize((()=>this._fullRefresh()))),this.register(o.buffers.onBufferActivate((()=>this._renderer.value?.clear()))),this.register(n.onOptionChange((()=>this._handleOptionsChanged()))),this.register(this._charSizeService.onCharSizeChange((()=>this.handleCharSizeChanged()))),this.register(i.onDecorationRegistered((()=>this._fullRefresh()))),this.register(i.onDecorationRemoved((()=>this._fullRefresh()))),this.register(n.onMultipleOptionChange([`customGlyphs`,`drawBoldTextInBrightColors`,`letterSpacing`,`lineHeight`,`fontFamily`,`fontSize`,`fontWeight`,`fontWeightBold`,`minimumContrastRatio`,`rescaleOverlappingGlyphs`],(()=>{this.clear(),this.handleResize(o.cols,o.rows),this._fullRefresh()}))),this.register(n.onMultipleOptionChange([`cursorBlink`,`cursorStyle`],(()=>this.refreshRows(o.buffer.y,o.buffer.y,!0)))),this.register(d.onChangeColors((()=>this._fullRefresh()))),this._registerIntersectionObserver(u.window,t),this.register(u.onWindowChange((e=>this._registerIntersectionObserver(e,t))))}_registerIntersectionObserver(e,t){if(`IntersectionObserver`in e){let n=new e.IntersectionObserver((e=>this._handleIntersectionChange(e[e.length-1])),{threshold:0});n.observe(t),this._observerDisposable.value=(0,c.toDisposable)((()=>n.disconnect()))}}_handleIntersectionChange(e){this._isPaused=e.isIntersecting===void 0?e.intersectionRatio===0:!e.isIntersecting,this._isPaused||this._charSizeService.hasValidSize||this._charSizeService.measure(),!this._isPaused&&this._needsFullRefresh&&(this._pausedResizeTask.flush(),this.refreshRows(0,this._rowCount-1),this._needsFullRefresh=!1)}refreshRows(e,t,n=!1){this._isPaused?this._needsFullRefresh=!0:(n||(this._isNextRenderRedrawOnly=!1),this._renderDebouncer.refresh(e,t,this._rowCount))}_renderRows(e,t){this._renderer.value&&(e=Math.min(e,this._rowCount-1),t=Math.min(t,this._rowCount-1),this._renderer.value.renderRows(e,t),this._needsSelectionRefresh&&=(this._renderer.value.handleSelectionChanged(this._selectionState.start,this._selectionState.end,this._selectionState.columnSelectMode),!1),this._isNextRenderRedrawOnly||this._onRenderedViewportChange.fire({start:e,end:t}),this._onRender.fire({start:e,end:t}),this._isNextRenderRedrawOnly=!0)}resize(e,t){this._rowCount=t,this._fireOnCanvasResize()}_handleOptionsChanged(){this._renderer.value&&(this.refreshRows(0,this._rowCount-1),this._fireOnCanvasResize())}_fireOnCanvasResize(){this._renderer.value&&(this._renderer.value.dimensions.css.canvas.width===this._canvasWidth&&this._renderer.value.dimensions.css.canvas.height===this._canvasHeight||this._onDimensionsChange.fire(this._renderer.value.dimensions))}hasRenderer(){return!!this._renderer.value}setRenderer(e){this._renderer.value=e,this._renderer.value&&(this._renderer.value.onRequestRedraw((e=>this.refreshRows(e.start,e.end,!0))),this._needsSelectionRefresh=!0,this._fullRefresh())}addRefreshCallback(e){return this._renderDebouncer.addRefreshCallback(e)}_fullRefresh(){this._isPaused?this._needsFullRefresh=!0:this.refreshRows(0,this._rowCount-1)}clearTextureAtlas(){this._renderer.value&&(this._renderer.value.clearTextureAtlas?.(),this._fullRefresh())}handleDevicePixelRatioChange(){this._charSizeService.measure(),this._renderer.value&&(this._renderer.value.handleDevicePixelRatioChange(),this.refreshRows(0,this._rowCount-1))}handleResize(e,t){this._renderer.value&&(this._isPaused?this._pausedResizeTask.set((()=>this._renderer.value?.handleResize(e,t))):this._renderer.value.handleResize(e,t),this._fullRefresh())}handleCharSizeChanged(){this._renderer.value?.handleCharSizeChanged()}handleBlur(){this._renderer.value?.handleBlur()}handleFocus(){this._renderer.value?.handleFocus()}handleSelectionChanged(e,t,n){this._selectionState.start=e,this._selectionState.end=t,this._selectionState.columnSelectMode=n,this._renderer.value?.handleSelectionChanged(e,t,n)}handleCursorMove(){this._renderer.value?.handleCursorMove()}clear(){this._renderer.value?.clear()}};t.RenderService=d=r([i(2,u.IOptionsService),i(3,o.ICharSizeService),i(4,u.IDecorationService),i(5,u.IBufferService),i(6,o.ICoreBrowserService),i(7,o.IThemeService)],d)},9312:function(e,t,n){var r=this&&this.__decorate||function(e,t,n,r){var i,a=arguments.length,o=a<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,n):r;if(typeof Reflect==`object`&&typeof Reflect.decorate==`function`)o=Reflect.decorate(e,t,n,r);else for(var s=e.length-1;s>=0;s--)(i=e[s])&&(o=(a<3?i(o):a>3?i(t,n,o):i(t,n))||o);return a>3&&o&&Object.defineProperty(t,n,o),o},i=this&&this.__param||function(e,t){return function(n,r){t(n,r,e)}};Object.defineProperty(t,"__esModule",{value:!0}),t.SelectionService=void 0;let a=n(9806),o=n(9504),s=n(456),c=n(4725),l=n(8460),u=n(844),d=n(6114),f=n(4841),p=n(511),m=n(2585),h=RegExp(`\xA0`,`g`),g=t.SelectionService=class extends u.Disposable{constructor(e,t,n,r,i,a,o,c,d){super(),this._element=e,this._screenElement=t,this._linkifier=n,this._bufferService=r,this._coreService=i,this._mouseService=a,this._optionsService=o,this._renderService=c,this._coreBrowserService=d,this._dragScrollAmount=0,this._enabled=!0,this._workCell=new p.CellData,this._mouseDownTimeStamp=0,this._oldHasSelection=!1,this._oldSelectionStart=void 0,this._oldSelectionEnd=void 0,this._onLinuxMouseSelection=this.register(new l.EventEmitter),this.onLinuxMouseSelection=this._onLinuxMouseSelection.event,this._onRedrawRequest=this.register(new l.EventEmitter),this.onRequestRedraw=this._onRedrawRequest.event,this._onSelectionChange=this.register(new l.EventEmitter),this.onSelectionChange=this._onSelectionChange.event,this._onRequestScrollLines=this.register(new l.EventEmitter),this.onRequestScrollLines=this._onRequestScrollLines.event,this._mouseMoveListener=e=>this._handleMouseMove(e),this._mouseUpListener=e=>this._handleMouseUp(e),this._coreService.onUserInput((()=>{this.hasSelection&&this.clearSelection()})),this._trimListener=this._bufferService.buffer.lines.onTrim((e=>this._handleTrim(e))),this.register(this._bufferService.buffers.onBufferActivate((e=>this._handleBufferActivate(e)))),this.enable(),this._model=new s.SelectionModel(this._bufferService),this._activeSelectionMode=0,this.register((0,u.toDisposable)((()=>{this._removeMouseDownListeners()})))}reset(){this.clearSelection()}disable(){this.clearSelection(),this._enabled=!1}enable(){this._enabled=!0}get selectionStart(){return this._model.finalSelectionStart}get selectionEnd(){return this._model.finalSelectionEnd}get hasSelection(){let e=this._model.finalSelectionStart,t=this._model.finalSelectionEnd;return!(!e||!t||e[0]===t[0]&&e[1]===t[1])}get selectionText(){let e=this._model.finalSelectionStart,t=this._model.finalSelectionEnd;if(!e||!t)return``;let n=this._bufferService.buffer,r=[];if(this._activeSelectionMode===3){if(e[0]===t[0])return``;let i=e[0]e.replace(h,` `))).join(d.isWindows?`\r +`:` +`)}clearSelection(){this._model.clearSelection(),this._removeMouseDownListeners(),this.refresh(),this._onSelectionChange.fire()}refresh(e){this._refreshAnimationFrame||=this._coreBrowserService.window.requestAnimationFrame((()=>this._refresh())),d.isLinux&&e&&this.selectionText.length&&this._onLinuxMouseSelection.fire(this.selectionText)}_refresh(){this._refreshAnimationFrame=void 0,this._onRedrawRequest.fire({start:this._model.finalSelectionStart,end:this._model.finalSelectionEnd,columnSelectMode:this._activeSelectionMode===3})}_isClickInSelection(e){let t=this._getMouseBufferCoords(e),n=this._model.finalSelectionStart,r=this._model.finalSelectionEnd;return!!(n&&r&&t)&&this._areCoordsInSelection(t,n,r)}isCellInSelection(e,t){let n=this._model.finalSelectionStart,r=this._model.finalSelectionEnd;return!(!n||!r)&&this._areCoordsInSelection([e,t],n,r)}_areCoordsInSelection(e,t,n){return e[1]>t[1]&&e[1]=t[0]&&e[0]=t[0]}_selectWordAtCursor(e,t){let n=this._linkifier.currentLink?.link?.range;if(n)return this._model.selectionStart=[n.start.x-1,n.start.y-1],this._model.selectionStartLength=(0,f.getRangeLength)(n,this._bufferService.cols),this._model.selectionEnd=void 0,!0;let r=this._getMouseBufferCoords(e);return!!r&&(this._selectWordAt(r,t),this._model.selectionEnd=void 0,!0)}selectAll(){this._model.isSelectAllActive=!0,this.refresh(),this._onSelectionChange.fire()}selectLines(e,t){this._model.clearSelection(),e=Math.max(e,0),t=Math.min(t,this._bufferService.buffer.lines.length-1),this._model.selectionStart=[0,e],this._model.selectionEnd=[this._bufferService.cols,t],this.refresh(),this._onSelectionChange.fire()}_handleTrim(e){this._model.handleTrim(e)&&this.refresh()}_getMouseBufferCoords(e){let t=this._mouseService.getCoords(e,this._screenElement,this._bufferService.cols,this._bufferService.rows,!0);if(t)return t[0]--,t[1]--,t[1]+=this._bufferService.buffer.ydisp,t}_getMouseEventScrollAmount(e){let t=(0,a.getCoordsRelativeToElement)(this._coreBrowserService.window,e,this._screenElement)[1],n=this._renderService.dimensions.css.canvas.height;return t>=0&&t<=n?0:(t>n&&(t-=n),t=Math.min(Math.max(t,-50),50),t/=50,t/Math.abs(t)+Math.round(14*t))}shouldForceSelection(e){return d.isMac?e.altKey&&this._optionsService.rawOptions.macOptionClickForcesSelection:e.shiftKey}handleMouseDown(e){if(this._mouseDownTimeStamp=e.timeStamp,(e.button!==2||!this.hasSelection)&&e.button===0){if(!this._enabled){if(!this.shouldForceSelection(e))return;e.stopPropagation()}e.preventDefault(),this._dragScrollAmount=0,this._enabled&&e.shiftKey?this._handleIncrementalClick(e):e.detail===1?this._handleSingleClick(e):e.detail===2?this._handleDoubleClick(e):e.detail===3&&this._handleTripleClick(e),this._addMouseDownListeners(),this.refresh(!0)}}_addMouseDownListeners(){this._screenElement.ownerDocument&&(this._screenElement.ownerDocument.addEventListener(`mousemove`,this._mouseMoveListener),this._screenElement.ownerDocument.addEventListener(`mouseup`,this._mouseUpListener)),this._dragScrollIntervalTimer=this._coreBrowserService.window.setInterval((()=>this._dragScroll()),50)}_removeMouseDownListeners(){this._screenElement.ownerDocument&&(this._screenElement.ownerDocument.removeEventListener(`mousemove`,this._mouseMoveListener),this._screenElement.ownerDocument.removeEventListener(`mouseup`,this._mouseUpListener)),this._coreBrowserService.window.clearInterval(this._dragScrollIntervalTimer),this._dragScrollIntervalTimer=void 0}_handleIncrementalClick(e){this._model.selectionStart&&(this._model.selectionEnd=this._getMouseBufferCoords(e))}_handleSingleClick(e){if(this._model.selectionStartLength=0,this._model.isSelectAllActive=!1,this._activeSelectionMode=this.shouldColumnSelect(e)?3:0,this._model.selectionStart=this._getMouseBufferCoords(e),!this._model.selectionStart)return;this._model.selectionEnd=void 0;let t=this._bufferService.buffer.lines.get(this._model.selectionStart[1]);t&&t.length!==this._model.selectionStart[0]&&t.hasWidth(this._model.selectionStart[0])===0&&this._model.selectionStart[0]++}_handleDoubleClick(e){this._selectWordAtCursor(e,!0)&&(this._activeSelectionMode=1)}_handleTripleClick(e){let t=this._getMouseBufferCoords(e);t&&(this._activeSelectionMode=2,this._selectLineAt(t[1]))}shouldColumnSelect(e){return e.altKey&&!(d.isMac&&this._optionsService.rawOptions.macOptionClickForcesSelection)}_handleMouseMove(e){if(e.stopImmediatePropagation(),!this._model.selectionStart)return;let t=this._model.selectionEnd?[this._model.selectionEnd[0],this._model.selectionEnd[1]]:null;if(this._model.selectionEnd=this._getMouseBufferCoords(e),!this._model.selectionEnd)return void this.refresh(!0);this._activeSelectionMode===2?this._model.selectionEnd[1]0?this._model.selectionEnd[0]=this._bufferService.cols:this._dragScrollAmount<0&&(this._model.selectionEnd[0]=0));let n=this._bufferService.buffer;if(this._model.selectionEnd[1]0?(this._activeSelectionMode!==3&&(this._model.selectionEnd[0]=this._bufferService.cols),this._model.selectionEnd[1]=Math.min(e.ydisp+this._bufferService.rows,e.lines.length-1)):(this._activeSelectionMode!==3&&(this._model.selectionEnd[0]=0),this._model.selectionEnd[1]=e.ydisp),this.refresh()}}_handleMouseUp(e){let t=e.timeStamp-this._mouseDownTimeStamp;if(this._removeMouseDownListeners(),this.selectionText.length<=1&&t<500&&e.altKey&&this._optionsService.rawOptions.altClickMovesCursor){if(this._bufferService.buffer.ybase===this._bufferService.buffer.ydisp){let t=this._mouseService.getCoords(e,this._element,this._bufferService.cols,this._bufferService.rows,!1);if(t&&t[0]!==void 0&&t[1]!==void 0){let e=(0,o.moveToCellSequence)(t[0]-1,t[1]-1,this._bufferService,this._coreService.decPrivateModes.applicationCursorKeys);this._coreService.triggerDataEvent(e,!0)}}}else this._fireEventIfSelectionChanged()}_fireEventIfSelectionChanged(){let e=this._model.finalSelectionStart,t=this._model.finalSelectionEnd,n=!(!e||!t||e[0]===t[0]&&e[1]===t[1]);n?e&&t&&(this._oldSelectionStart&&this._oldSelectionEnd&&e[0]===this._oldSelectionStart[0]&&e[1]===this._oldSelectionStart[1]&&t[0]===this._oldSelectionEnd[0]&&t[1]===this._oldSelectionEnd[1]||this._fireOnSelectionChange(e,t,n)):this._oldHasSelection&&this._fireOnSelectionChange(e,t,n)}_fireOnSelectionChange(e,t,n){this._oldSelectionStart=e,this._oldSelectionEnd=t,this._oldHasSelection=n,this._onSelectionChange.fire()}_handleBufferActivate(e){this.clearSelection(),this._trimListener.dispose(),this._trimListener=e.activeBuffer.lines.onTrim((e=>this._handleTrim(e)))}_convertViewportColToCharacterIndex(e,t){let n=t;for(let r=0;t>=r;r++){let i=e.loadCell(r,this._workCell).getChars().length;this._workCell.getWidth()===0?n--:i>1&&t!==r&&(n+=i-1)}return n}setSelection(e,t,n){this._model.clearSelection(),this._removeMouseDownListeners(),this._model.selectionStart=[e,t],this._model.selectionStartLength=n,this.refresh(),this._fireEventIfSelectionChanged()}rightClickSelect(e){this._isClickInSelection(e)||(this._selectWordAtCursor(e,!1)&&this.refresh(!0),this._fireEventIfSelectionChanged())}_getWordAt(e,t,n=!0,r=!0){if(e[0]>=this._bufferService.cols)return;let i=this._bufferService.buffer,a=i.lines.get(e[1]);if(!a)return;let o=i.translateBufferLineToString(e[1],!1),s=this._convertViewportColToCharacterIndex(a,e[0]),c=s,l=e[0]-s,u=0,d=0,f=0,p=0;if(o.charAt(s)===` `){for(;s>0&&o.charAt(s-1)===` `;)s--;for(;c1&&(p+=r-1,c+=r-1);t>0&&s>0&&!this._isCharWordSeparator(a.loadCell(t-1,this._workCell));){a.loadCell(t-1,this._workCell);let e=this._workCell.getChars().length;this._workCell.getWidth()===0?(u++,t--):e>1&&(f+=e-1,s-=e-1),s--,t--}for(;n1&&(p+=e-1,c+=e-1),c++,n++}}c++;let m=s+l-u+f,h=Math.min(this._bufferService.cols,c-s+u+d-f-p);if(t||o.slice(s,c).trim()!==``){if(n&&m===0&&a.getCodePoint(0)!==32){let t=i.lines.get(e[1]-1);if(t&&a.isWrapped&&t.getCodePoint(this._bufferService.cols-1)!==32){let t=this._getWordAt([this._bufferService.cols-1,e[1]-1],!1,!0,!1);if(t){let e=this._bufferService.cols-t.start;m-=e,h+=e}}}if(r&&m+h===this._bufferService.cols&&a.getCodePoint(this._bufferService.cols-1)!==32){let t=i.lines.get(e[1]+1);if(t?.isWrapped&&t.getCodePoint(0)!==32){let t=this._getWordAt([0,e[1]+1],!1,!1,!0);t&&(h+=t.length)}}return{start:m,length:h}}}_selectWordAt(e,t){let n=this._getWordAt(e,t);if(n){for(;n.start<0;)n.start+=this._bufferService.cols,e[1]--;this._model.selectionStart=[n.start,e[1]],this._model.selectionStartLength=n.length}}_selectToWordAt(e){let t=this._getWordAt(e,!0);if(t){let n=e[1];for(;t.start<0;)t.start+=this._bufferService.cols,n--;if(!this._model.areSelectionValuesReversed())for(;t.start+t.length>this._bufferService.cols;)t.length-=this._bufferService.cols,n++;this._model.selectionEnd=[this._model.areSelectionValuesReversed()?t.start:t.start+t.length,n]}}_isCharWordSeparator(e){return e.getWidth()!==0&&this._optionsService.rawOptions.wordSeparator.indexOf(e.getChars())>=0}_selectLineAt(e){let t=this._bufferService.buffer.getWrappedRangeForLine(e),n={start:{x:0,y:t.first},end:{x:this._bufferService.cols-1,y:t.last}};this._model.selectionStart=[0,t.first],this._model.selectionEnd=void 0,this._model.selectionStartLength=(0,f.getRangeLength)(n,this._bufferService.cols)}};t.SelectionService=g=r([i(3,m.IBufferService),i(4,m.ICoreService),i(5,c.IMouseService),i(6,m.IOptionsService),i(7,c.IRenderService),i(8,c.ICoreBrowserService)],g)},4725:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.ILinkProviderService=t.IThemeService=t.ICharacterJoinerService=t.ISelectionService=t.IRenderService=t.IMouseService=t.ICoreBrowserService=t.ICharSizeService=void 0;let r=n(8343);t.ICharSizeService=(0,r.createDecorator)(`CharSizeService`),t.ICoreBrowserService=(0,r.createDecorator)(`CoreBrowserService`),t.IMouseService=(0,r.createDecorator)(`MouseService`),t.IRenderService=(0,r.createDecorator)(`RenderService`),t.ISelectionService=(0,r.createDecorator)(`SelectionService`),t.ICharacterJoinerService=(0,r.createDecorator)(`CharacterJoinerService`),t.IThemeService=(0,r.createDecorator)(`ThemeService`),t.ILinkProviderService=(0,r.createDecorator)(`LinkProviderService`)},6731:function(e,t,n){var r=this&&this.__decorate||function(e,t,n,r){var i,a=arguments.length,o=a<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,n):r;if(typeof Reflect==`object`&&typeof Reflect.decorate==`function`)o=Reflect.decorate(e,t,n,r);else for(var s=e.length-1;s>=0;s--)(i=e[s])&&(o=(a<3?i(o):a>3?i(t,n,o):i(t,n))||o);return a>3&&o&&Object.defineProperty(t,n,o),o},i=this&&this.__param||function(e,t){return function(n,r){t(n,r,e)}};Object.defineProperty(t,"__esModule",{value:!0}),t.ThemeService=t.DEFAULT_ANSI_COLORS=void 0;let a=n(7239),o=n(8055),s=n(8460),c=n(844),l=n(2585),u=o.css.toColor(`#ffffff`),d=o.css.toColor(`#000000`),f=o.css.toColor(`#ffffff`),p=o.css.toColor(`#000000`),m={css:`rgba(255, 255, 255, 0.3)`,rgba:4294967117};t.DEFAULT_ANSI_COLORS=Object.freeze((()=>{let e=[o.css.toColor(`#2e3436`),o.css.toColor(`#cc0000`),o.css.toColor(`#4e9a06`),o.css.toColor(`#c4a000`),o.css.toColor(`#3465a4`),o.css.toColor(`#75507b`),o.css.toColor(`#06989a`),o.css.toColor(`#d3d7cf`),o.css.toColor(`#555753`),o.css.toColor(`#ef2929`),o.css.toColor(`#8ae234`),o.css.toColor(`#fce94f`),o.css.toColor(`#729fcf`),o.css.toColor(`#ad7fa8`),o.css.toColor(`#34e2e2`),o.css.toColor(`#eeeeec`)],t=[0,95,135,175,215,255];for(let n=0;n<216;n++){let r=t[n/36%6|0],i=t[n/6%6|0],a=t[n%6];e.push({css:o.channels.toCss(r,i,a),rgba:o.channels.toRgba(r,i,a)})}for(let t=0;t<24;t++){let n=8+10*t;e.push({css:o.channels.toCss(n,n,n),rgba:o.channels.toRgba(n,n,n)})}return e})());let h=t.ThemeService=class extends c.Disposable{get colors(){return this._colors}constructor(e){super(),this._optionsService=e,this._contrastCache=new a.ColorContrastCache,this._halfContrastCache=new a.ColorContrastCache,this._onChangeColors=this.register(new s.EventEmitter),this.onChangeColors=this._onChangeColors.event,this._colors={foreground:u,background:d,cursor:f,cursorAccent:p,selectionForeground:void 0,selectionBackgroundTransparent:m,selectionBackgroundOpaque:o.color.blend(d,m),selectionInactiveBackgroundTransparent:m,selectionInactiveBackgroundOpaque:o.color.blend(d,m),ansi:t.DEFAULT_ANSI_COLORS.slice(),contrastCache:this._contrastCache,halfContrastCache:this._halfContrastCache},this._updateRestoreColors(),this._setTheme(this._optionsService.rawOptions.theme),this.register(this._optionsService.onSpecificOptionChange(`minimumContrastRatio`,(()=>this._contrastCache.clear()))),this.register(this._optionsService.onSpecificOptionChange(`theme`,(()=>this._setTheme(this._optionsService.rawOptions.theme))))}_setTheme(e={}){let n=this._colors;if(n.foreground=g(e.foreground,u),n.background=g(e.background,d),n.cursor=g(e.cursor,f),n.cursorAccent=g(e.cursorAccent,p),n.selectionBackgroundTransparent=g(e.selectionBackground,m),n.selectionBackgroundOpaque=o.color.blend(n.background,n.selectionBackgroundTransparent),n.selectionInactiveBackgroundTransparent=g(e.selectionInactiveBackground,n.selectionBackgroundTransparent),n.selectionInactiveBackgroundOpaque=o.color.blend(n.background,n.selectionInactiveBackgroundTransparent),n.selectionForeground=e.selectionForeground?g(e.selectionForeground,o.NULL_COLOR):void 0,n.selectionForeground===o.NULL_COLOR&&(n.selectionForeground=void 0),o.color.isOpaque(n.selectionBackgroundTransparent)&&(n.selectionBackgroundTransparent=o.color.opacity(n.selectionBackgroundTransparent,.3)),o.color.isOpaque(n.selectionInactiveBackgroundTransparent)&&(n.selectionInactiveBackgroundTransparent=o.color.opacity(n.selectionInactiveBackgroundTransparent,.3)),n.ansi=t.DEFAULT_ANSI_COLORS.slice(),n.ansi[0]=g(e.black,t.DEFAULT_ANSI_COLORS[0]),n.ansi[1]=g(e.red,t.DEFAULT_ANSI_COLORS[1]),n.ansi[2]=g(e.green,t.DEFAULT_ANSI_COLORS[2]),n.ansi[3]=g(e.yellow,t.DEFAULT_ANSI_COLORS[3]),n.ansi[4]=g(e.blue,t.DEFAULT_ANSI_COLORS[4]),n.ansi[5]=g(e.magenta,t.DEFAULT_ANSI_COLORS[5]),n.ansi[6]=g(e.cyan,t.DEFAULT_ANSI_COLORS[6]),n.ansi[7]=g(e.white,t.DEFAULT_ANSI_COLORS[7]),n.ansi[8]=g(e.brightBlack,t.DEFAULT_ANSI_COLORS[8]),n.ansi[9]=g(e.brightRed,t.DEFAULT_ANSI_COLORS[9]),n.ansi[10]=g(e.brightGreen,t.DEFAULT_ANSI_COLORS[10]),n.ansi[11]=g(e.brightYellow,t.DEFAULT_ANSI_COLORS[11]),n.ansi[12]=g(e.brightBlue,t.DEFAULT_ANSI_COLORS[12]),n.ansi[13]=g(e.brightMagenta,t.DEFAULT_ANSI_COLORS[13]),n.ansi[14]=g(e.brightCyan,t.DEFAULT_ANSI_COLORS[14]),n.ansi[15]=g(e.brightWhite,t.DEFAULT_ANSI_COLORS[15]),e.extendedAnsi){let r=Math.min(n.ansi.length-16,e.extendedAnsi.length);for(let i=0;i{Object.defineProperty(t,"__esModule",{value:!0}),t.CircularList=void 0;let r=n(8460),i=n(844);class a extends i.Disposable{constructor(e){super(),this._maxLength=e,this.onDeleteEmitter=this.register(new r.EventEmitter),this.onDelete=this.onDeleteEmitter.event,this.onInsertEmitter=this.register(new r.EventEmitter),this.onInsert=this.onInsertEmitter.event,this.onTrimEmitter=this.register(new r.EventEmitter),this.onTrim=this.onTrimEmitter.event,this._array=Array(this._maxLength),this._startIndex=0,this._length=0}get maxLength(){return this._maxLength}set maxLength(e){if(this._maxLength===e)return;let t=Array(e);for(let n=0;nthis._length)for(let t=this._length;t=e;t--)this._array[this._getCyclicIndex(t+n.length)]=this._array[this._getCyclicIndex(t)];for(let t=0;tthis._maxLength){let e=this._length+n.length-this._maxLength;this._startIndex+=e,this._length=this._maxLength,this.onTrimEmitter.fire(e)}else this._length+=n.length}trimStart(e){e>this._length&&(e=this._length),this._startIndex+=e,this._length-=e,this.onTrimEmitter.fire(e)}shiftElements(e,t,n){if(!(t<=0)){if(e<0||e>=this._length)throw Error(`start argument out of range`);if(e+n<0)throw Error(`Cannot shift elements in list beyond index 0`);if(n>0){for(let r=t-1;r>=0;r--)this.set(e+r+n,this.get(e+r));let r=e+t+n-this._length;if(r>0)for(this._length+=r;this._length>this._maxLength;)this._length--,this._startIndex++,this.onTrimEmitter.fire(1)}else for(let r=0;r{Object.defineProperty(t,"__esModule",{value:!0}),t.clone=void 0,t.clone=function e(t,n=5){if(typeof t!=`object`)return t;let r=Array.isArray(t)?[]:{};for(let i in t)r[i]=n<=1?t[i]:t[i]&&e(t[i],n-1);return r}},8055:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.contrastRatio=t.toPaddedHex=t.rgba=t.rgb=t.css=t.color=t.channels=t.NULL_COLOR=void 0;let n=0,r=0,i=0,a=0;var o,s,c,l,u;function d(e){let t=e.toString(16);return t.length<2?`0`+t:t}function f(e,t){return e>>0},e.toColor=function(t,n,r,i){return{css:e.toCss(t,n,r,i),rgba:e.toRgba(t,n,r,i)}}}(o||(t.channels=o={})),function(e){function t(e,t){return a=Math.round(255*t),[n,r,i]=u.toChannels(e.rgba),{css:o.toCss(n,r,i,a),rgba:o.toRgba(n,r,i,a)}}e.blend=function(e,t){if(a=(255&t.rgba)/255,a===1)return{css:t.css,rgba:t.rgba};let s=t.rgba>>24&255,c=t.rgba>>16&255,l=t.rgba>>8&255,u=e.rgba>>24&255,d=e.rgba>>16&255,f=e.rgba>>8&255;return n=u+Math.round((s-u)*a),r=d+Math.round((c-d)*a),i=f+Math.round((l-f)*a),{css:o.toCss(n,r,i),rgba:o.toRgba(n,r,i)}},e.isOpaque=function(e){return(255&e.rgba)==255},e.ensureContrastRatio=function(e,t,n){let r=u.ensureContrastRatio(e.rgba,t.rgba,n);if(r)return o.toColor(r>>24&255,r>>16&255,r>>8&255)},e.opaque=function(e){let t=(255|e.rgba)>>>0;return[n,r,i]=u.toChannels(t),{css:o.toCss(n,r,i),rgba:t}},e.opacity=t,e.multiplyOpacity=function(e,n){return a=255&e.rgba,t(e,a*n/255)},e.toColorRGB=function(e){return[e.rgba>>24&255,e.rgba>>16&255,e.rgba>>8&255]}}(s||(t.color=s={})),function(e){let t,s;try{let e=document.createElement(`canvas`);e.width=1,e.height=1;let n=e.getContext(`2d`,{willReadFrequently:!0});n&&(t=n,t.globalCompositeOperation=`copy`,s=t.createLinearGradient(0,0,1,1))}catch{}e.toColor=function(e){if(e.match(/#[\da-f]{3,8}/i))switch(e.length){case 4:return n=parseInt(e.slice(1,2).repeat(2),16),r=parseInt(e.slice(2,3).repeat(2),16),i=parseInt(e.slice(3,4).repeat(2),16),o.toColor(n,r,i);case 5:return n=parseInt(e.slice(1,2).repeat(2),16),r=parseInt(e.slice(2,3).repeat(2),16),i=parseInt(e.slice(3,4).repeat(2),16),a=parseInt(e.slice(4,5).repeat(2),16),o.toColor(n,r,i,a);case 7:return{css:e,rgba:(parseInt(e.slice(1),16)<<8|255)>>>0};case 9:return{css:e,rgba:parseInt(e.slice(1),16)>>>0}}let c=e.match(/rgba?\(\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(\d{1,3})\s*(,\s*(0|1|\d?\.(\d+))\s*)?\)/);if(c)return n=parseInt(c[1]),r=parseInt(c[2]),i=parseInt(c[3]),a=Math.round(255*(c[5]===void 0?1:parseFloat(c[5]))),o.toColor(n,r,i,a);if(!t||!s||(t.fillStyle=s,t.fillStyle=e,typeof t.fillStyle!=`string`)||(t.fillRect(0,0,1,1),[n,r,i,a]=t.getImageData(0,0,1,1).data,a!==255))throw Error(`css.toColor: Unsupported css format`);return{rgba:o.toRgba(n,r,i,a),css:e}}}(c||(t.css=c={})),function(e){function t(e,t,n){let r=e/255,i=t/255,a=n/255;return .2126*(r<=.03928?r/12.92:((r+.055)/1.055)**2.4)+.7152*(i<=.03928?i/12.92:((i+.055)/1.055)**2.4)+.0722*(a<=.03928?a/12.92:((a+.055)/1.055)**2.4)}e.relativeLuminance=function(e){return t(e>>16&255,e>>8&255,255&e)},e.relativeLuminance2=t}(l||(t.rgb=l={})),function(e){function t(e,t,n){let r=e>>24&255,i=e>>16&255,a=e>>8&255,o=t>>24&255,s=t>>16&255,c=t>>8&255,u=f(l.relativeLuminance2(o,s,c),l.relativeLuminance2(r,i,a));for(;u0||s>0||c>0);)o-=Math.max(0,Math.ceil(.1*o)),s-=Math.max(0,Math.ceil(.1*s)),c-=Math.max(0,Math.ceil(.1*c)),u=f(l.relativeLuminance2(o,s,c),l.relativeLuminance2(r,i,a));return(o<<24|s<<16|c<<8|255)>>>0}function s(e,t,n){let r=e>>24&255,i=e>>16&255,a=e>>8&255,o=t>>24&255,s=t>>16&255,c=t>>8&255,u=f(l.relativeLuminance2(o,s,c),l.relativeLuminance2(r,i,a));for(;u>>0}e.blend=function(e,t){if(a=(255&t)/255,a===1)return t;let s=t>>24&255,c=t>>16&255,l=t>>8&255,u=e>>24&255,d=e>>16&255,f=e>>8&255;return n=u+Math.round((s-u)*a),r=d+Math.round((c-d)*a),i=f+Math.round((l-f)*a),o.toRgba(n,r,i)},e.ensureContrastRatio=function(e,n,r){let i=l.relativeLuminance(e>>8),a=l.relativeLuminance(n>>8);if(f(i,a)>8));if(of(i,l.relativeLuminance(t>>8))?a:t}return a}let o=s(e,n,r),c=f(i,l.relativeLuminance(o>>8));if(cf(i,l.relativeLuminance(a>>8))?o:a}return o}},e.reduceLuminance=t,e.increaseLuminance=s,e.toChannels=function(e){return[e>>24&255,e>>16&255,e>>8&255,255&e]}}(u||(t.rgba=u={})),t.toPaddedHex=d,t.contrastRatio=f},8969:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.CoreTerminal=void 0;let r=n(844),i=n(2585),a=n(4348),o=n(7866),s=n(744),c=n(7302),l=n(6975),u=n(8460),d=n(1753),f=n(1480),p=n(7994),m=n(9282),h=n(5435),g=n(5981),_=n(2660),v=!1;class y extends r.Disposable{get onScroll(){return this._onScrollApi||(this._onScrollApi=this.register(new u.EventEmitter),this._onScroll.event((e=>{this._onScrollApi?.fire(e.position)}))),this._onScrollApi.event}get cols(){return this._bufferService.cols}get rows(){return this._bufferService.rows}get buffers(){return this._bufferService.buffers}get options(){return this.optionsService.options}set options(e){for(let t in e)this.optionsService.options[t]=e[t]}constructor(e){super(),this._windowsWrappingHeuristics=this.register(new r.MutableDisposable),this._onBinary=this.register(new u.EventEmitter),this.onBinary=this._onBinary.event,this._onData=this.register(new u.EventEmitter),this.onData=this._onData.event,this._onLineFeed=this.register(new u.EventEmitter),this.onLineFeed=this._onLineFeed.event,this._onResize=this.register(new u.EventEmitter),this.onResize=this._onResize.event,this._onWriteParsed=this.register(new u.EventEmitter),this.onWriteParsed=this._onWriteParsed.event,this._onScroll=this.register(new u.EventEmitter),this._instantiationService=new a.InstantiationService,this.optionsService=this.register(new c.OptionsService(e)),this._instantiationService.setService(i.IOptionsService,this.optionsService),this._bufferService=this.register(this._instantiationService.createInstance(s.BufferService)),this._instantiationService.setService(i.IBufferService,this._bufferService),this._logService=this.register(this._instantiationService.createInstance(o.LogService)),this._instantiationService.setService(i.ILogService,this._logService),this.coreService=this.register(this._instantiationService.createInstance(l.CoreService)),this._instantiationService.setService(i.ICoreService,this.coreService),this.coreMouseService=this.register(this._instantiationService.createInstance(d.CoreMouseService)),this._instantiationService.setService(i.ICoreMouseService,this.coreMouseService),this.unicodeService=this.register(this._instantiationService.createInstance(f.UnicodeService)),this._instantiationService.setService(i.IUnicodeService,this.unicodeService),this._charsetService=this._instantiationService.createInstance(p.CharsetService),this._instantiationService.setService(i.ICharsetService,this._charsetService),this._oscLinkService=this._instantiationService.createInstance(_.OscLinkService),this._instantiationService.setService(i.IOscLinkService,this._oscLinkService),this._inputHandler=this.register(new h.InputHandler(this._bufferService,this._charsetService,this.coreService,this._logService,this.optionsService,this._oscLinkService,this.coreMouseService,this.unicodeService)),this.register((0,u.forwardEvent)(this._inputHandler.onLineFeed,this._onLineFeed)),this.register(this._inputHandler),this.register((0,u.forwardEvent)(this._bufferService.onResize,this._onResize)),this.register((0,u.forwardEvent)(this.coreService.onData,this._onData)),this.register((0,u.forwardEvent)(this.coreService.onBinary,this._onBinary)),this.register(this.coreService.onRequestScrollToBottom((()=>this.scrollToBottom()))),this.register(this.coreService.onUserInput((()=>this._writeBuffer.handleUserInput()))),this.register(this.optionsService.onMultipleOptionChange([`windowsMode`,`windowsPty`],(()=>this._handleWindowsPtyOptionChange()))),this.register(this._bufferService.onScroll((e=>{this._onScroll.fire({position:this._bufferService.buffer.ydisp,source:0}),this._inputHandler.markRangeDirty(this._bufferService.buffer.scrollTop,this._bufferService.buffer.scrollBottom)}))),this.register(this._inputHandler.onScroll((e=>{this._onScroll.fire({position:this._bufferService.buffer.ydisp,source:0}),this._inputHandler.markRangeDirty(this._bufferService.buffer.scrollTop,this._bufferService.buffer.scrollBottom)}))),this._writeBuffer=this.register(new g.WriteBuffer(((e,t)=>this._inputHandler.parse(e,t)))),this.register((0,u.forwardEvent)(this._writeBuffer.onWriteParsed,this._onWriteParsed))}write(e,t){this._writeBuffer.write(e,t)}writeSync(e,t){this._logService.logLevel<=i.LogLevelEnum.WARN&&!v&&(this._logService.warn(`writeSync is unreliable and will be removed soon.`),v=!0),this._writeBuffer.writeSync(e,t)}input(e,t=!0){this.coreService.triggerDataEvent(e,t)}resize(e,t){isNaN(e)||isNaN(t)||(e=Math.max(e,s.MINIMUM_COLS),t=Math.max(t,s.MINIMUM_ROWS),this._bufferService.resize(e,t))}scroll(e,t=!1){this._bufferService.scroll(e,t)}scrollLines(e,t,n){this._bufferService.scrollLines(e,t,n)}scrollPages(e){this.scrollLines(e*(this.rows-1))}scrollToTop(){this.scrollLines(-this._bufferService.buffer.ydisp)}scrollToBottom(){this.scrollLines(this._bufferService.buffer.ybase-this._bufferService.buffer.ydisp)}scrollToLine(e){let t=e-this._bufferService.buffer.ydisp;t!==0&&this.scrollLines(t)}registerEscHandler(e,t){return this._inputHandler.registerEscHandler(e,t)}registerDcsHandler(e,t){return this._inputHandler.registerDcsHandler(e,t)}registerCsiHandler(e,t){return this._inputHandler.registerCsiHandler(e,t)}registerOscHandler(e,t){return this._inputHandler.registerOscHandler(e,t)}_setup(){this._handleWindowsPtyOptionChange()}reset(){this._inputHandler.reset(),this._bufferService.reset(),this._charsetService.reset(),this.coreService.reset(),this.coreMouseService.reset()}_handleWindowsPtyOptionChange(){let e=!1,t=this.optionsService.rawOptions.windowsPty;t&&t.buildNumber!==void 0&&t.buildNumber!==void 0?e=t.backend===`conpty`&&t.buildNumber<21376:this.optionsService.rawOptions.windowsMode&&(e=!0),e?this._enableWindowsWrappingHeuristics():this._windowsWrappingHeuristics.clear()}_enableWindowsWrappingHeuristics(){if(!this._windowsWrappingHeuristics.value){let e=[];e.push(this.onLineFeed(m.updateWindowsModeWrappedState.bind(null,this._bufferService))),e.push(this.registerCsiHandler({final:`H`},(()=>((0,m.updateWindowsModeWrappedState)(this._bufferService),!1)))),this._windowsWrappingHeuristics.value=(0,r.toDisposable)((()=>{for(let t of e)t.dispose()}))}}}t.CoreTerminal=y},8460:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.runAndSubscribe=t.forwardEvent=t.EventEmitter=void 0,t.EventEmitter=class{constructor(){this._listeners=[],this._disposed=!1}get event(){return this._event||=e=>(this._listeners.push(e),{dispose:()=>{if(!this._disposed){for(let t=0;tt.fire(e)))},t.runAndSubscribe=function(e,t){return t(void 0),e((e=>t(e)))}},5435:function(e,t,n){var r=this&&this.__decorate||function(e,t,n,r){var i,a=arguments.length,o=a<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,n):r;if(typeof Reflect==`object`&&typeof Reflect.decorate==`function`)o=Reflect.decorate(e,t,n,r);else for(var s=e.length-1;s>=0;s--)(i=e[s])&&(o=(a<3?i(o):a>3?i(t,n,o):i(t,n))||o);return a>3&&o&&Object.defineProperty(t,n,o),o},i=this&&this.__param||function(e,t){return function(n,r){t(n,r,e)}};Object.defineProperty(t,"__esModule",{value:!0}),t.InputHandler=t.WindowsOptionsReportType=void 0;let a=n(2584),o=n(7116),s=n(2015),c=n(844),l=n(482),u=n(8437),d=n(8460),f=n(643),p=n(511),m=n(3734),h=n(2585),g=n(1480),_=n(6242),v=n(6351),y=n(5941),b={"(":0,")":1,"*":2,"+":3,"-":1,".":2},x=131072;function S(e,t){if(e>24)return t.setWinLines||!1;switch(e){case 1:return!!t.restoreWin;case 2:return!!t.minimizeWin;case 3:return!!t.setWinPosition;case 4:return!!t.setWinSizePixels;case 5:return!!t.raiseWin;case 6:return!!t.lowerWin;case 7:return!!t.refreshWin;case 8:return!!t.setWinSizeChars;case 9:return!!t.maximizeWin;case 10:return!!t.fullscreenWin;case 11:return!!t.getWinState;case 13:return!!t.getWinPosition;case 14:return!!t.getWinSizePixels;case 15:return!!t.getScreenSizePixels;case 16:return!!t.getCellSizePixels;case 18:return!!t.getWinSizeChars;case 19:return!!t.getScreenSizeChars;case 20:return!!t.getIconTitle;case 21:return!!t.getWinTitle;case 22:return!!t.pushTitle;case 23:return!!t.popTitle;case 24:return!!t.setWinLines}return!1}var C;(function(e){e[e.GET_WIN_SIZE_PIXELS=0]=`GET_WIN_SIZE_PIXELS`,e[e.GET_CELL_SIZE_PIXELS=1]=`GET_CELL_SIZE_PIXELS`})(C||(t.WindowsOptionsReportType=C={}));let w=0;class T extends c.Disposable{getAttrData(){return this._curAttrData}constructor(e,t,n,r,i,c,f,m,h=new s.EscapeSequenceParser){super(),this._bufferService=e,this._charsetService=t,this._coreService=n,this._logService=r,this._optionsService=i,this._oscLinkService=c,this._coreMouseService=f,this._unicodeService=m,this._parser=h,this._parseBuffer=new Uint32Array(4096),this._stringDecoder=new l.StringToUtf32,this._utf8Decoder=new l.Utf8ToUtf32,this._workCell=new p.CellData,this._windowTitle=``,this._iconName=``,this._windowTitleStack=[],this._iconNameStack=[],this._curAttrData=u.DEFAULT_ATTR_DATA.clone(),this._eraseAttrDataInternal=u.DEFAULT_ATTR_DATA.clone(),this._onRequestBell=this.register(new d.EventEmitter),this.onRequestBell=this._onRequestBell.event,this._onRequestRefreshRows=this.register(new d.EventEmitter),this.onRequestRefreshRows=this._onRequestRefreshRows.event,this._onRequestReset=this.register(new d.EventEmitter),this.onRequestReset=this._onRequestReset.event,this._onRequestSendFocus=this.register(new d.EventEmitter),this.onRequestSendFocus=this._onRequestSendFocus.event,this._onRequestSyncScrollBar=this.register(new d.EventEmitter),this.onRequestSyncScrollBar=this._onRequestSyncScrollBar.event,this._onRequestWindowsOptionsReport=this.register(new d.EventEmitter),this.onRequestWindowsOptionsReport=this._onRequestWindowsOptionsReport.event,this._onA11yChar=this.register(new d.EventEmitter),this.onA11yChar=this._onA11yChar.event,this._onA11yTab=this.register(new d.EventEmitter),this.onA11yTab=this._onA11yTab.event,this._onCursorMove=this.register(new d.EventEmitter),this.onCursorMove=this._onCursorMove.event,this._onLineFeed=this.register(new d.EventEmitter),this.onLineFeed=this._onLineFeed.event,this._onScroll=this.register(new d.EventEmitter),this.onScroll=this._onScroll.event,this._onTitleChange=this.register(new d.EventEmitter),this.onTitleChange=this._onTitleChange.event,this._onColor=this.register(new d.EventEmitter),this.onColor=this._onColor.event,this._parseStack={paused:!1,cursorStartX:0,cursorStartY:0,decodedLength:0,position:0},this._specialColors=[256,257,258],this.register(this._parser),this._dirtyRowTracker=new E(this._bufferService),this._activeBuffer=this._bufferService.buffer,this.register(this._bufferService.buffers.onBufferActivate((e=>this._activeBuffer=e.activeBuffer))),this._parser.setCsiHandlerFallback(((e,t)=>{this._logService.debug(`Unknown CSI code: `,{identifier:this._parser.identToString(e),params:t.toArray()})})),this._parser.setEscHandlerFallback((e=>{this._logService.debug(`Unknown ESC code: `,{identifier:this._parser.identToString(e)})})),this._parser.setExecuteHandlerFallback((e=>{this._logService.debug(`Unknown EXECUTE code: `,{code:e})})),this._parser.setOscHandlerFallback(((e,t,n)=>{this._logService.debug(`Unknown OSC code: `,{identifier:e,action:t,data:n})})),this._parser.setDcsHandlerFallback(((e,t,n)=>{t===`HOOK`&&(n=n.toArray()),this._logService.debug(`Unknown DCS code: `,{identifier:this._parser.identToString(e),action:t,payload:n})})),this._parser.setPrintHandler(((e,t,n)=>this.print(e,t,n))),this._parser.registerCsiHandler({final:`@`},(e=>this.insertChars(e))),this._parser.registerCsiHandler({intermediates:` `,final:`@`},(e=>this.scrollLeft(e))),this._parser.registerCsiHandler({final:`A`},(e=>this.cursorUp(e))),this._parser.registerCsiHandler({intermediates:` `,final:`A`},(e=>this.scrollRight(e))),this._parser.registerCsiHandler({final:`B`},(e=>this.cursorDown(e))),this._parser.registerCsiHandler({final:`C`},(e=>this.cursorForward(e))),this._parser.registerCsiHandler({final:`D`},(e=>this.cursorBackward(e))),this._parser.registerCsiHandler({final:`E`},(e=>this.cursorNextLine(e))),this._parser.registerCsiHandler({final:`F`},(e=>this.cursorPrecedingLine(e))),this._parser.registerCsiHandler({final:`G`},(e=>this.cursorCharAbsolute(e))),this._parser.registerCsiHandler({final:`H`},(e=>this.cursorPosition(e))),this._parser.registerCsiHandler({final:`I`},(e=>this.cursorForwardTab(e))),this._parser.registerCsiHandler({final:`J`},(e=>this.eraseInDisplay(e,!1))),this._parser.registerCsiHandler({prefix:`?`,final:`J`},(e=>this.eraseInDisplay(e,!0))),this._parser.registerCsiHandler({final:`K`},(e=>this.eraseInLine(e,!1))),this._parser.registerCsiHandler({prefix:`?`,final:`K`},(e=>this.eraseInLine(e,!0))),this._parser.registerCsiHandler({final:`L`},(e=>this.insertLines(e))),this._parser.registerCsiHandler({final:`M`},(e=>this.deleteLines(e))),this._parser.registerCsiHandler({final:`P`},(e=>this.deleteChars(e))),this._parser.registerCsiHandler({final:`S`},(e=>this.scrollUp(e))),this._parser.registerCsiHandler({final:`T`},(e=>this.scrollDown(e))),this._parser.registerCsiHandler({final:`X`},(e=>this.eraseChars(e))),this._parser.registerCsiHandler({final:`Z`},(e=>this.cursorBackwardTab(e))),this._parser.registerCsiHandler({final:"`"},(e=>this.charPosAbsolute(e))),this._parser.registerCsiHandler({final:`a`},(e=>this.hPositionRelative(e))),this._parser.registerCsiHandler({final:`b`},(e=>this.repeatPrecedingCharacter(e))),this._parser.registerCsiHandler({final:`c`},(e=>this.sendDeviceAttributesPrimary(e))),this._parser.registerCsiHandler({prefix:`>`,final:`c`},(e=>this.sendDeviceAttributesSecondary(e))),this._parser.registerCsiHandler({final:`d`},(e=>this.linePosAbsolute(e))),this._parser.registerCsiHandler({final:`e`},(e=>this.vPositionRelative(e))),this._parser.registerCsiHandler({final:`f`},(e=>this.hVPosition(e))),this._parser.registerCsiHandler({final:`g`},(e=>this.tabClear(e))),this._parser.registerCsiHandler({final:`h`},(e=>this.setMode(e))),this._parser.registerCsiHandler({prefix:`?`,final:`h`},(e=>this.setModePrivate(e))),this._parser.registerCsiHandler({final:`l`},(e=>this.resetMode(e))),this._parser.registerCsiHandler({prefix:`?`,final:`l`},(e=>this.resetModePrivate(e))),this._parser.registerCsiHandler({final:`m`},(e=>this.charAttributes(e))),this._parser.registerCsiHandler({final:`n`},(e=>this.deviceStatus(e))),this._parser.registerCsiHandler({prefix:`?`,final:`n`},(e=>this.deviceStatusPrivate(e))),this._parser.registerCsiHandler({intermediates:`!`,final:`p`},(e=>this.softReset(e))),this._parser.registerCsiHandler({intermediates:` `,final:`q`},(e=>this.setCursorStyle(e))),this._parser.registerCsiHandler({final:`r`},(e=>this.setScrollRegion(e))),this._parser.registerCsiHandler({final:`s`},(e=>this.saveCursor(e))),this._parser.registerCsiHandler({final:`t`},(e=>this.windowOptions(e))),this._parser.registerCsiHandler({final:`u`},(e=>this.restoreCursor(e))),this._parser.registerCsiHandler({intermediates:`'`,final:`}`},(e=>this.insertColumns(e))),this._parser.registerCsiHandler({intermediates:`'`,final:`~`},(e=>this.deleteColumns(e))),this._parser.registerCsiHandler({intermediates:`"`,final:`q`},(e=>this.selectProtected(e))),this._parser.registerCsiHandler({intermediates:`$`,final:`p`},(e=>this.requestMode(e,!0))),this._parser.registerCsiHandler({prefix:`?`,intermediates:`$`,final:`p`},(e=>this.requestMode(e,!1))),this._parser.setExecuteHandler(a.C0.BEL,(()=>this.bell())),this._parser.setExecuteHandler(a.C0.LF,(()=>this.lineFeed())),this._parser.setExecuteHandler(a.C0.VT,(()=>this.lineFeed())),this._parser.setExecuteHandler(a.C0.FF,(()=>this.lineFeed())),this._parser.setExecuteHandler(a.C0.CR,(()=>this.carriageReturn())),this._parser.setExecuteHandler(a.C0.BS,(()=>this.backspace())),this._parser.setExecuteHandler(a.C0.HT,(()=>this.tab())),this._parser.setExecuteHandler(a.C0.SO,(()=>this.shiftOut())),this._parser.setExecuteHandler(a.C0.SI,(()=>this.shiftIn())),this._parser.setExecuteHandler(a.C1.IND,(()=>this.index())),this._parser.setExecuteHandler(a.C1.NEL,(()=>this.nextLine())),this._parser.setExecuteHandler(a.C1.HTS,(()=>this.tabSet())),this._parser.registerOscHandler(0,new _.OscHandler((e=>(this.setTitle(e),this.setIconName(e),!0)))),this._parser.registerOscHandler(1,new _.OscHandler((e=>this.setIconName(e)))),this._parser.registerOscHandler(2,new _.OscHandler((e=>this.setTitle(e)))),this._parser.registerOscHandler(4,new _.OscHandler((e=>this.setOrReportIndexedColor(e)))),this._parser.registerOscHandler(8,new _.OscHandler((e=>this.setHyperlink(e)))),this._parser.registerOscHandler(10,new _.OscHandler((e=>this.setOrReportFgColor(e)))),this._parser.registerOscHandler(11,new _.OscHandler((e=>this.setOrReportBgColor(e)))),this._parser.registerOscHandler(12,new _.OscHandler((e=>this.setOrReportCursorColor(e)))),this._parser.registerOscHandler(104,new _.OscHandler((e=>this.restoreIndexedColor(e)))),this._parser.registerOscHandler(110,new _.OscHandler((e=>this.restoreFgColor(e)))),this._parser.registerOscHandler(111,new _.OscHandler((e=>this.restoreBgColor(e)))),this._parser.registerOscHandler(112,new _.OscHandler((e=>this.restoreCursorColor(e)))),this._parser.registerEscHandler({final:`7`},(()=>this.saveCursor())),this._parser.registerEscHandler({final:`8`},(()=>this.restoreCursor())),this._parser.registerEscHandler({final:`D`},(()=>this.index())),this._parser.registerEscHandler({final:`E`},(()=>this.nextLine())),this._parser.registerEscHandler({final:`H`},(()=>this.tabSet())),this._parser.registerEscHandler({final:`M`},(()=>this.reverseIndex())),this._parser.registerEscHandler({final:`=`},(()=>this.keypadApplicationMode())),this._parser.registerEscHandler({final:`>`},(()=>this.keypadNumericMode())),this._parser.registerEscHandler({final:`c`},(()=>this.fullReset())),this._parser.registerEscHandler({final:`n`},(()=>this.setgLevel(2))),this._parser.registerEscHandler({final:`o`},(()=>this.setgLevel(3))),this._parser.registerEscHandler({final:`|`},(()=>this.setgLevel(3))),this._parser.registerEscHandler({final:`}`},(()=>this.setgLevel(2))),this._parser.registerEscHandler({final:`~`},(()=>this.setgLevel(1))),this._parser.registerEscHandler({intermediates:`%`,final:`@`},(()=>this.selectDefaultCharset())),this._parser.registerEscHandler({intermediates:`%`,final:`G`},(()=>this.selectDefaultCharset()));for(let e in o.CHARSETS)this._parser.registerEscHandler({intermediates:`(`,final:e},(()=>this.selectCharset(`(`+e))),this._parser.registerEscHandler({intermediates:`)`,final:e},(()=>this.selectCharset(`)`+e))),this._parser.registerEscHandler({intermediates:`*`,final:e},(()=>this.selectCharset(`*`+e))),this._parser.registerEscHandler({intermediates:`+`,final:e},(()=>this.selectCharset(`+`+e))),this._parser.registerEscHandler({intermediates:`-`,final:e},(()=>this.selectCharset(`-`+e))),this._parser.registerEscHandler({intermediates:`.`,final:e},(()=>this.selectCharset(`.`+e))),this._parser.registerEscHandler({intermediates:`/`,final:e},(()=>this.selectCharset(`/`+e)));this._parser.registerEscHandler({intermediates:`#`,final:`8`},(()=>this.screenAlignmentPattern())),this._parser.setErrorHandler((e=>(this._logService.error(`Parsing error: `,e),e))),this._parser.registerDcsHandler({intermediates:`$`,final:`q`},new v.DcsHandler(((e,t)=>this.requestStatusString(e,t))))}_preserveStack(e,t,n,r){this._parseStack.paused=!0,this._parseStack.cursorStartX=e,this._parseStack.cursorStartY=t,this._parseStack.decodedLength=n,this._parseStack.position=r}_logSlowResolvingAsync(e){this._logService.logLevel<=h.LogLevelEnum.WARN&&Promise.race([e,new Promise(((e,t)=>setTimeout((()=>t(`#SLOW_TIMEOUT`)),5e3)))]).catch((e=>{if(e!==`#SLOW_TIMEOUT`)throw e;console.warn(`async parser handler taking longer than 5000 ms`)}))}_getCurrentLinkId(){return this._curAttrData.extended.urlId}parse(e,t){let n,r=this._activeBuffer.x,i=this._activeBuffer.y,a=0,o=this._parseStack.paused;if(o){if(n=this._parser.parse(this._parseBuffer,this._parseStack.decodedLength,t))return this._logSlowResolvingAsync(n),n;r=this._parseStack.cursorStartX,i=this._parseStack.cursorStartY,this._parseStack.paused=!1,e.length>x&&(a=this._parseStack.position+x)}if(this._logService.logLevel<=h.LogLevelEnum.DEBUG&&this._logService.debug(`parsing data`+(typeof e==`string`?` "${e}"`:` "${Array.prototype.map.call(e,(e=>String.fromCharCode(e))).join(``)}"`),typeof e==`string`?e.split(``).map((e=>e.charCodeAt(0))):e),this._parseBuffer.lengthx)for(let t=a;t0&&m.getWidth(this._activeBuffer.x-1)===2&&m.setCellFromCodepoint(this._activeBuffer.x-1,0,1,p);let h=this._parser.precedingJoinState;for(let _=t;_s){if(c){let e=m,t=this._activeBuffer.x-v;for(this._activeBuffer.x=v,this._activeBuffer.y++,this._activeBuffer.y===this._activeBuffer.scrollBottom+1?(this._activeBuffer.y--,this._bufferService.scroll(this._eraseAttrData(),!0)):(this._activeBuffer.y>=this._bufferService.rows&&(this._activeBuffer.y=this._bufferService.rows-1),this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y).isWrapped=!0),m=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y),v>0&&m instanceof u.BufferLine&&m.copyCellsFrom(e,t,0,v,!1);t=0;)m.setCellFromCodepoint(this._activeBuffer.x++,0,0,p)}else if(d&&(m.insertCells(this._activeBuffer.x,i-v,this._activeBuffer.getNullCell(p)),m.getWidth(s-1)===2&&m.setCellFromCodepoint(s-1,f.NULL_CELL_CODE,f.NULL_CELL_WIDTH,p)),m.setCellFromCodepoint(this._activeBuffer.x++,r,i,p),i>0)for(;--i;)m.setCellFromCodepoint(this._activeBuffer.x++,0,0,p)}this._parser.precedingJoinState=h,this._activeBuffer.x0&&m.getWidth(this._activeBuffer.x)===0&&!m.hasContent(this._activeBuffer.x)&&m.setCellFromCodepoint(this._activeBuffer.x,0,1,p),this._dirtyRowTracker.markDirty(this._activeBuffer.y)}registerCsiHandler(e,t){return e.final!==`t`||e.prefix||e.intermediates?this._parser.registerCsiHandler(e,t):this._parser.registerCsiHandler(e,(e=>!S(e.params[0],this._optionsService.rawOptions.windowOptions)||t(e)))}registerDcsHandler(e,t){return this._parser.registerDcsHandler(e,new v.DcsHandler(t))}registerEscHandler(e,t){return this._parser.registerEscHandler(e,t)}registerOscHandler(e,t){return this._parser.registerOscHandler(e,new _.OscHandler(t))}bell(){return this._onRequestBell.fire(),!0}lineFeed(){return this._dirtyRowTracker.markDirty(this._activeBuffer.y),this._optionsService.rawOptions.convertEol&&(this._activeBuffer.x=0),this._activeBuffer.y++,this._activeBuffer.y===this._activeBuffer.scrollBottom+1?(this._activeBuffer.y--,this._bufferService.scroll(this._eraseAttrData())):this._activeBuffer.y>=this._bufferService.rows?this._activeBuffer.y=this._bufferService.rows-1:this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y).isWrapped=!1,this._activeBuffer.x>=this._bufferService.cols&&this._activeBuffer.x--,this._dirtyRowTracker.markDirty(this._activeBuffer.y),this._onLineFeed.fire(),!0}carriageReturn(){return this._activeBuffer.x=0,!0}backspace(){if(!this._coreService.decPrivateModes.reverseWraparound)return this._restrictCursor(),this._activeBuffer.x>0&&this._activeBuffer.x--,!0;if(this._restrictCursor(this._bufferService.cols),this._activeBuffer.x>0)this._activeBuffer.x--;else if(this._activeBuffer.x===0&&this._activeBuffer.y>this._activeBuffer.scrollTop&&this._activeBuffer.y<=this._activeBuffer.scrollBottom&&this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y)?.isWrapped){this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y).isWrapped=!1,this._activeBuffer.y--,this._activeBuffer.x=this._bufferService.cols-1;let e=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);e.hasWidth(this._activeBuffer.x)&&!e.hasContent(this._activeBuffer.x)&&this._activeBuffer.x--}return this._restrictCursor(),!0}tab(){if(this._activeBuffer.x>=this._bufferService.cols)return!0;let e=this._activeBuffer.x;return this._activeBuffer.x=this._activeBuffer.nextStop(),this._optionsService.rawOptions.screenReaderMode&&this._onA11yTab.fire(this._activeBuffer.x-e),!0}shiftOut(){return this._charsetService.setgLevel(1),!0}shiftIn(){return this._charsetService.setgLevel(0),!0}_restrictCursor(e=this._bufferService.cols-1){this._activeBuffer.x=Math.min(e,Math.max(0,this._activeBuffer.x)),this._activeBuffer.y=this._coreService.decPrivateModes.origin?Math.min(this._activeBuffer.scrollBottom,Math.max(this._activeBuffer.scrollTop,this._activeBuffer.y)):Math.min(this._bufferService.rows-1,Math.max(0,this._activeBuffer.y)),this._dirtyRowTracker.markDirty(this._activeBuffer.y)}_setCursor(e,t){this._dirtyRowTracker.markDirty(this._activeBuffer.y),this._coreService.decPrivateModes.origin?(this._activeBuffer.x=e,this._activeBuffer.y=this._activeBuffer.scrollTop+t):(this._activeBuffer.x=e,this._activeBuffer.y=t),this._restrictCursor(),this._dirtyRowTracker.markDirty(this._activeBuffer.y)}_moveCursor(e,t){this._restrictCursor(),this._setCursor(this._activeBuffer.x+e,this._activeBuffer.y+t)}cursorUp(e){let t=this._activeBuffer.y-this._activeBuffer.scrollTop;return t>=0?this._moveCursor(0,-Math.min(t,e.params[0]||1)):this._moveCursor(0,-(e.params[0]||1)),!0}cursorDown(e){let t=this._activeBuffer.scrollBottom-this._activeBuffer.y;return t>=0?this._moveCursor(0,Math.min(t,e.params[0]||1)):this._moveCursor(0,e.params[0]||1),!0}cursorForward(e){return this._moveCursor(e.params[0]||1,0),!0}cursorBackward(e){return this._moveCursor(-(e.params[0]||1),0),!0}cursorNextLine(e){return this.cursorDown(e),this._activeBuffer.x=0,!0}cursorPrecedingLine(e){return this.cursorUp(e),this._activeBuffer.x=0,!0}cursorCharAbsolute(e){return this._setCursor((e.params[0]||1)-1,this._activeBuffer.y),!0}cursorPosition(e){return this._setCursor(e.length>=2?(e.params[1]||1)-1:0,(e.params[0]||1)-1),!0}charPosAbsolute(e){return this._setCursor((e.params[0]||1)-1,this._activeBuffer.y),!0}hPositionRelative(e){return this._moveCursor(e.params[0]||1,0),!0}linePosAbsolute(e){return this._setCursor(this._activeBuffer.x,(e.params[0]||1)-1),!0}vPositionRelative(e){return this._moveCursor(0,e.params[0]||1),!0}hVPosition(e){return this.cursorPosition(e),!0}tabClear(e){let t=e.params[0];return t===0?delete this._activeBuffer.tabs[this._activeBuffer.x]:t===3&&(this._activeBuffer.tabs={}),!0}cursorForwardTab(e){if(this._activeBuffer.x>=this._bufferService.cols)return!0;let t=e.params[0]||1;for(;t--;)this._activeBuffer.x=this._activeBuffer.nextStop();return!0}cursorBackwardTab(e){if(this._activeBuffer.x>=this._bufferService.cols)return!0;let t=e.params[0]||1;for(;t--;)this._activeBuffer.x=this._activeBuffer.prevStop();return!0}selectProtected(e){let t=e.params[0];return t===1&&(this._curAttrData.bg|=536870912),t!==2&&t!==0||(this._curAttrData.bg&=-536870913),!0}_eraseInBufferLine(e,t,n,r=!1,i=!1){let a=this._activeBuffer.lines.get(this._activeBuffer.ybase+e);a.replaceCells(t,n,this._activeBuffer.getNullCell(this._eraseAttrData()),i),r&&(a.isWrapped=!1)}_resetBufferLine(e,t=!1){let n=this._activeBuffer.lines.get(this._activeBuffer.ybase+e);n&&(n.fill(this._activeBuffer.getNullCell(this._eraseAttrData()),t),this._bufferService.buffer.clearMarkers(this._activeBuffer.ybase+e),n.isWrapped=!1)}eraseInDisplay(e,t=!1){let n;switch(this._restrictCursor(this._bufferService.cols),e.params[0]){case 0:for(n=this._activeBuffer.y,this._dirtyRowTracker.markDirty(n),this._eraseInBufferLine(n++,this._activeBuffer.x,this._bufferService.cols,this._activeBuffer.x===0,t);n=this._bufferService.cols&&(this._activeBuffer.lines.get(n+1).isWrapped=!1);n--;)this._resetBufferLine(n,t);this._dirtyRowTracker.markDirty(0);break;case 2:for(n=this._bufferService.rows,this._dirtyRowTracker.markDirty(n-1);n--;)this._resetBufferLine(n,t);this._dirtyRowTracker.markDirty(0);break;case 3:let e=this._activeBuffer.lines.length-this._bufferService.rows;e>0&&(this._activeBuffer.lines.trimStart(e),this._activeBuffer.ybase=Math.max(this._activeBuffer.ybase-e,0),this._activeBuffer.ydisp=Math.max(this._activeBuffer.ydisp-e,0),this._onScroll.fire(0))}return!0}eraseInLine(e,t=!1){switch(this._restrictCursor(this._bufferService.cols),e.params[0]){case 0:this._eraseInBufferLine(this._activeBuffer.y,this._activeBuffer.x,this._bufferService.cols,this._activeBuffer.x===0,t);break;case 1:this._eraseInBufferLine(this._activeBuffer.y,0,this._activeBuffer.x+1,!1,t);break;case 2:this._eraseInBufferLine(this._activeBuffer.y,0,this._bufferService.cols,!0,t)}return this._dirtyRowTracker.markDirty(this._activeBuffer.y),!0}insertLines(e){this._restrictCursor();let t=e.params[0]||1;if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.ythis._activeBuffer.scrollBottom||this._activeBuffer.ythis._activeBuffer.scrollBottom||this._activeBuffer.ythis._activeBuffer.scrollBottom||this._activeBuffer.ythis._activeBuffer.scrollBottom||this._activeBuffer.ythis._activeBuffer.scrollBottom||this._activeBuffer.y65535?2:1}let c=s;for(let e=1;e0||(this._is(`xterm`)||this._is(`rxvt-unicode`)||this._is(`screen`)?this._coreService.triggerDataEvent(a.C0.ESC+`[?1;2c`):this._is(`linux`)&&this._coreService.triggerDataEvent(a.C0.ESC+`[?6c`)),!0}sendDeviceAttributesSecondary(e){return e.params[0]>0||(this._is(`xterm`)?this._coreService.triggerDataEvent(a.C0.ESC+`[>0;276;0c`):this._is(`rxvt-unicode`)?this._coreService.triggerDataEvent(a.C0.ESC+`[>85;95;0c`):this._is(`linux`)?this._coreService.triggerDataEvent(e.params[0]+`c`):this._is(`screen`)&&this._coreService.triggerDataEvent(a.C0.ESC+`[>83;40003;0c`)),!0}_is(e){return(this._optionsService.rawOptions.termName+``).indexOf(e)===0}setMode(e){for(let t=0;te?1:2,p=e.params[0];return m=p,h=t?p===2?4:p===4?f(o.modes.insertMode):p===12?3:p===20?f(d.convertEol):0:p===1?f(n.applicationCursorKeys):p===3?d.windowOptions.setWinLines?c===80?2:+(c===132):0:p===6?f(n.origin):p===7?f(n.wraparound):p===8?3:p===9?f(r===`X10`):p===12?f(d.cursorBlink):p===25?f(!o.isCursorHidden):p===45?f(n.reverseWraparound):p===66?f(n.applicationKeypad):p===67?4:p===1e3?f(r===`VT200`):p===1002?f(r===`DRAG`):p===1003?f(r===`ANY`):p===1004?f(n.sendFocus):p===1005?4:p===1006?f(i===`SGR`):p===1015?4:p===1016?f(i===`SGR_PIXELS`):p===1048?1:p===47||p===1047||p===1049?f(l===u):p===2004?f(n.bracketedPasteMode):0,o.triggerDataEvent(`${a.C0.ESC}[${t?``:`?`}${m};${h}$y`),!0;var m,h}_updateAttrColor(e,t,n,r,i){return t===2?(e|=50331648,e&=-16777216,e|=m.AttributeData.fromColorRGB([n,r,i])):t===5&&(e&=-50331904,e|=33554432|255&n),e}_extractColor(e,t,n){let r=[0,0,-1,0,0,0],i=0,a=0;do{if(r[a+i]=e.params[t+a],e.hasSubParams(t+a)){let n=e.getSubParams(t+a),o=0;do r[1]===5&&(i=1),r[a+o+1+i]=n[o];while(++o=2||r[1]===2&&a+i>=5)break;r[1]&&(i=1)}while(++a+t5)&&(e=1),t.extended.underlineStyle=e,t.fg|=268435456,e===0&&(t.fg&=-268435457),t.updateExtended()}_processSGR0(e){e.fg=u.DEFAULT_ATTR_DATA.fg,e.bg=u.DEFAULT_ATTR_DATA.bg,e.extended=e.extended.clone(),e.extended.underlineStyle=0,e.extended.underlineColor&=-67108864,e.updateExtended()}charAttributes(e){if(e.length===1&&e.params[0]===0)return this._processSGR0(this._curAttrData),!0;let t=e.length,n,r=this._curAttrData;for(let i=0;i=30&&n<=37?(r.fg&=-50331904,r.fg|=16777216|n-30):n>=40&&n<=47?(r.bg&=-50331904,r.bg|=16777216|n-40):n>=90&&n<=97?(r.fg&=-50331904,r.fg|=16777224|n-90):n>=100&&n<=107?(r.bg&=-50331904,r.bg|=16777224|n-100):n===0?this._processSGR0(r):n===1?r.fg|=134217728:n===3?r.bg|=67108864:n===4?(r.fg|=268435456,this._processUnderline(e.hasSubParams(i)?e.getSubParams(i)[0]:1,r)):n===5?r.fg|=536870912:n===7?r.fg|=67108864:n===8?r.fg|=1073741824:n===9?r.fg|=2147483648:n===2?r.bg|=134217728:n===21?this._processUnderline(2,r):n===22?(r.fg&=-134217729,r.bg&=-134217729):n===23?r.bg&=-67108865:n===24?(r.fg&=-268435457,this._processUnderline(0,r)):n===25?r.fg&=-536870913:n===27?r.fg&=-67108865:n===28?r.fg&=-1073741825:n===29?r.fg&=2147483647:n===39?(r.fg&=-67108864,r.fg|=16777215&u.DEFAULT_ATTR_DATA.fg):n===49?(r.bg&=-67108864,r.bg|=16777215&u.DEFAULT_ATTR_DATA.bg):n===38||n===48||n===58?i+=this._extractColor(e,i,r):n===53?r.bg|=1073741824:n===55?r.bg&=-1073741825:n===59?(r.extended=r.extended.clone(),r.extended.underlineColor=-1,r.updateExtended()):n===100?(r.fg&=-67108864,r.fg|=16777215&u.DEFAULT_ATTR_DATA.fg,r.bg&=-67108864,r.bg|=16777215&u.DEFAULT_ATTR_DATA.bg):this._logService.debug(`Unknown SGR attribute: %d.`,n);return!0}deviceStatus(e){switch(e.params[0]){case 5:this._coreService.triggerDataEvent(`${a.C0.ESC}[0n`);break;case 6:let e=this._activeBuffer.y+1,t=this._activeBuffer.x+1;this._coreService.triggerDataEvent(`${a.C0.ESC}[${e};${t}R`)}return!0}deviceStatusPrivate(e){if(e.params[0]===6){let e=this._activeBuffer.y+1,t=this._activeBuffer.x+1;this._coreService.triggerDataEvent(`${a.C0.ESC}[?${e};${t}R`)}return!0}softReset(e){return this._coreService.isCursorHidden=!1,this._onRequestSyncScrollBar.fire(),this._activeBuffer.scrollTop=0,this._activeBuffer.scrollBottom=this._bufferService.rows-1,this._curAttrData=u.DEFAULT_ATTR_DATA.clone(),this._coreService.reset(),this._charsetService.reset(),this._activeBuffer.savedX=0,this._activeBuffer.savedY=this._activeBuffer.ybase,this._activeBuffer.savedCurAttrData.fg=this._curAttrData.fg,this._activeBuffer.savedCurAttrData.bg=this._curAttrData.bg,this._activeBuffer.savedCharset=this._charsetService.charset,this._coreService.decPrivateModes.origin=!1,!0}setCursorStyle(e){let t=e.params[0]||1;switch(t){case 1:case 2:this._optionsService.options.cursorStyle=`block`;break;case 3:case 4:this._optionsService.options.cursorStyle=`underline`;break;case 5:case 6:this._optionsService.options.cursorStyle=`bar`}let n=t%2==1;return this._optionsService.options.cursorBlink=n,!0}setScrollRegion(e){let t=e.params[0]||1,n;return(e.length<2||(n=e.params[1])>this._bufferService.rows||n===0)&&(n=this._bufferService.rows),n>t&&(this._activeBuffer.scrollTop=t-1,this._activeBuffer.scrollBottom=n-1,this._setCursor(0,0)),!0}windowOptions(e){if(!S(e.params[0],this._optionsService.rawOptions.windowOptions))return!0;let t=e.length>1?e.params[1]:0;switch(e.params[0]){case 14:t!==2&&this._onRequestWindowsOptionsReport.fire(C.GET_WIN_SIZE_PIXELS);break;case 16:this._onRequestWindowsOptionsReport.fire(C.GET_CELL_SIZE_PIXELS);break;case 18:this._bufferService&&this._coreService.triggerDataEvent(`${a.C0.ESC}[8;${this._bufferService.rows};${this._bufferService.cols}t`);break;case 22:t!==0&&t!==2||(this._windowTitleStack.push(this._windowTitle),this._windowTitleStack.length>10&&this._windowTitleStack.shift()),t!==0&&t!==1||(this._iconNameStack.push(this._iconName),this._iconNameStack.length>10&&this._iconNameStack.shift());break;case 23:t!==0&&t!==2||this._windowTitleStack.length&&this.setTitle(this._windowTitleStack.pop()),t!==0&&t!==1||this._iconNameStack.length&&this.setIconName(this._iconNameStack.pop())}return!0}saveCursor(e){return this._activeBuffer.savedX=this._activeBuffer.x,this._activeBuffer.savedY=this._activeBuffer.ybase+this._activeBuffer.y,this._activeBuffer.savedCurAttrData.fg=this._curAttrData.fg,this._activeBuffer.savedCurAttrData.bg=this._curAttrData.bg,this._activeBuffer.savedCharset=this._charsetService.charset,!0}restoreCursor(e){return this._activeBuffer.x=this._activeBuffer.savedX||0,this._activeBuffer.y=Math.max(this._activeBuffer.savedY-this._activeBuffer.ybase,0),this._curAttrData.fg=this._activeBuffer.savedCurAttrData.fg,this._curAttrData.bg=this._activeBuffer.savedCurAttrData.bg,this._charsetService.charset=this._savedCharset,this._activeBuffer.savedCharset&&(this._charsetService.charset=this._activeBuffer.savedCharset),this._restrictCursor(),!0}setTitle(e){return this._windowTitle=e,this._onTitleChange.fire(e),!0}setIconName(e){return this._iconName=e,!0}setOrReportIndexedColor(e){let t=[],n=e.split(`;`);for(;n.length>1;){let e=n.shift(),r=n.shift();if(/^\d+$/.exec(e)){let n=parseInt(e);if(D(n))if(r===`?`)t.push({type:0,index:n});else{let e=(0,y.parseColor)(r);e&&t.push({type:1,index:n,color:e})}}}return t.length&&this._onColor.fire(t),!0}setHyperlink(e){let t=e.split(`;`);return!(t.length<2)&&(t[1]?this._createHyperlink(t[0],t[1]):!t[0]&&this._finishHyperlink())}_createHyperlink(e,t){this._getCurrentLinkId()&&this._finishHyperlink();let n=e.split(`:`),r,i=n.findIndex((e=>e.startsWith(`id=`)));return i!==-1&&(r=n[i].slice(3)||void 0),this._curAttrData.extended=this._curAttrData.extended.clone(),this._curAttrData.extended.urlId=this._oscLinkService.registerLink({id:r,uri:t}),this._curAttrData.updateExtended(),!0}_finishHyperlink(){return this._curAttrData.extended=this._curAttrData.extended.clone(),this._curAttrData.extended.urlId=0,this._curAttrData.updateExtended(),!0}_setOrReportSpecialColor(e,t){let n=e.split(`;`);for(let e=0;e=this._specialColors.length);++e,++t)if(n[e]===`?`)this._onColor.fire([{type:0,index:this._specialColors[t]}]);else{let r=(0,y.parseColor)(n[e]);r&&this._onColor.fire([{type:1,index:this._specialColors[t],color:r}])}return!0}setOrReportFgColor(e){return this._setOrReportSpecialColor(e,0)}setOrReportBgColor(e){return this._setOrReportSpecialColor(e,1)}setOrReportCursorColor(e){return this._setOrReportSpecialColor(e,2)}restoreIndexedColor(e){if(!e)return this._onColor.fire([{type:2}]),!0;let t=[],n=e.split(`;`);for(let e=0;e=this._bufferService.rows&&(this._activeBuffer.y=this._bufferService.rows-1),this._restrictCursor(),!0}tabSet(){return this._activeBuffer.tabs[this._activeBuffer.x]=!0,!0}reverseIndex(){if(this._restrictCursor(),this._activeBuffer.y===this._activeBuffer.scrollTop){let e=this._activeBuffer.scrollBottom-this._activeBuffer.scrollTop;this._activeBuffer.lines.shiftElements(this._activeBuffer.ybase+this._activeBuffer.y,e,1),this._activeBuffer.lines.set(this._activeBuffer.ybase+this._activeBuffer.y,this._activeBuffer.getBlankLine(this._eraseAttrData())),this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom)}else this._activeBuffer.y--,this._restrictCursor();return!0}fullReset(){return this._parser.reset(),this._onRequestReset.fire(),!0}reset(){this._curAttrData=u.DEFAULT_ATTR_DATA.clone(),this._eraseAttrDataInternal=u.DEFAULT_ATTR_DATA.clone()}_eraseAttrData(){return this._eraseAttrDataInternal.bg&=-67108864,this._eraseAttrDataInternal.bg|=67108863&this._curAttrData.bg,this._eraseAttrDataInternal}setgLevel(e){return this._charsetService.setgLevel(e),!0}screenAlignmentPattern(){let e=new p.CellData;e.content=4194373,e.fg=this._curAttrData.fg,e.bg=this._curAttrData.bg,this._setCursor(0,0);for(let t=0;t(this._coreService.triggerDataEvent(`${a.C0.ESC}${e}${a.C0.ESC}\\`),!0))(e===`"q`?`P1$r${+!!this._curAttrData.isProtected()}"q`:e===`"p`?`P1$r61;1"p`:e===`r`?`P1$r${n.scrollTop+1};${n.scrollBottom+1}r`:e===`m`?`P1$r0m`:e===` q`?`P1$r${{block:2,underline:4,bar:6}[r.cursorStyle]-+!!r.cursorBlink} q`:`P0$r`)}markRangeDirty(e,t){this._dirtyRowTracker.markRangeDirty(e,t)}}t.InputHandler=T;let E=class{constructor(e){this._bufferService=e,this.clearRange()}clearRange(){this.start=this._bufferService.buffer.y,this.end=this._bufferService.buffer.y}markDirty(e){ethis.end&&(this.end=e)}markRangeDirty(e,t){e>t&&(w=e,e=t,t=w),ethis.end&&(this.end=t)}markAllDirty(){this.markRangeDirty(0,this._bufferService.rows-1)}};function D(e){return 0<=e&&e<256}E=r([i(0,h.IBufferService)],E)},844:(e,t)=>{function n(e){for(let t of e)t.dispose();e.length=0}Object.defineProperty(t,"__esModule",{value:!0}),t.getDisposeArrayDisposable=t.disposeArray=t.toDisposable=t.MutableDisposable=t.Disposable=void 0,t.Disposable=class{constructor(){this._disposables=[],this._isDisposed=!1}dispose(){this._isDisposed=!0;for(let e of this._disposables)e.dispose();this._disposables.length=0}register(e){return this._disposables.push(e),e}unregister(e){let t=this._disposables.indexOf(e);t!==-1&&this._disposables.splice(t,1)}},t.MutableDisposable=class{constructor(){this._isDisposed=!1}get value(){return this._isDisposed?void 0:this._value}set value(e){this._isDisposed||e===this._value||(this._value?.dispose(),this._value=e)}clear(){this.value=void 0}dispose(){this._isDisposed=!0,this._value?.dispose(),this._value=void 0}},t.toDisposable=function(e){return{dispose:e}},t.disposeArray=n,t.getDisposeArrayDisposable=function(e){return{dispose:()=>n(e)}}},1505:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.FourKeyMap=t.TwoKeyMap=void 0;class n{constructor(){this._data={}}set(e,t,n){this._data[e]||(this._data[e]={}),this._data[e][t]=n}get(e,t){return this._data[e]?this._data[e][t]:void 0}clear(){this._data={}}}t.TwoKeyMap=n,t.FourKeyMap=class{constructor(){this._data=new n}set(e,t,r,i,a){this._data.get(e,t)||this._data.set(e,t,new n),this._data.get(e,t).set(r,i,a)}get(e,t,n,r){return this._data.get(e,t)?.get(n,r)}clear(){this._data.clear()}}},6114:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.isChromeOS=t.isLinux=t.isWindows=t.isIphone=t.isIpad=t.isMac=t.getSafariVersion=t.isSafari=t.isLegacyEdge=t.isFirefox=t.isNode=void 0,t.isNode=typeof process<`u`&&`title`in process;let n=t.isNode?`node`:navigator.userAgent,r=t.isNode?`node`:navigator.platform;t.isFirefox=n.includes(`Firefox`),t.isLegacyEdge=n.includes(`Edge`),t.isSafari=/^((?!chrome|android).)*safari/i.test(n),t.getSafariVersion=function(){if(!t.isSafari)return 0;let e=n.match(/Version\/(\d+)/);return e===null||e.length<2?0:parseInt(e[1])},t.isMac=[`Macintosh`,`MacIntel`,`MacPPC`,`Mac68K`].includes(r),t.isIpad=r===`iPad`,t.isIphone=r===`iPhone`,t.isWindows=[`Windows`,`Win16`,`Win32`,`WinCE`].includes(r),t.isLinux=r.indexOf(`Linux`)>=0,t.isChromeOS=/\bCrOS\b/.test(n)},6106:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.SortedList=void 0;let n=0;t.SortedList=class{constructor(e){this._getKey=e,this._array=[]}clear(){this._array.length=0}insert(e){this._array.length===0?this._array.push(e):(n=this._search(this._getKey(e)),this._array.splice(n,0,e))}delete(e){if(this._array.length===0)return!1;let t=this._getKey(e);if(t===void 0||(n=this._search(t),n===-1)||this._getKey(this._array[n])!==t)return!1;do if(this._array[n]===e)return this._array.splice(n,1),!0;while(++n=this._array.length)&&this._getKey(this._array[n])===e))do yield this._array[n];while(++n=this._array.length)&&this._getKey(this._array[n])===e))do t(this._array[n]);while(++n=t;){let r=t+n>>1,i=this._getKey(this._array[r]);if(i>e)n=r-1;else{if(!(i0&&this._getKey(this._array[r-1])===e;)r--;return r}t=r+1}}return t}}},7226:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.DebouncedIdleTask=t.IdleTaskQueue=t.PriorityTaskQueue=void 0;let r=n(6114);class i{constructor(){this._tasks=[],this._i=0}enqueue(e){this._tasks.push(e),this._start()}flush(){for(;this._ii)return r-t<-20&&console.warn(`task queue exceeded allotted deadline by ${Math.abs(Math.round(r-t))}ms`),void this._start();r=i}this.clear()}}class a extends i{_requestCallback(e){return setTimeout((()=>e(this._createDeadline(16))))}_cancelCallback(e){clearTimeout(e)}_createDeadline(e){let t=Date.now()+e;return{timeRemaining:()=>Math.max(0,t-Date.now())}}}t.PriorityTaskQueue=a,t.IdleTaskQueue=!r.isNode&&`requestIdleCallback`in window?class extends i{_requestCallback(e){return requestIdleCallback(e)}_cancelCallback(e){cancelIdleCallback(e)}}:a,t.DebouncedIdleTask=class{constructor(){this._queue=new t.IdleTaskQueue}set(e){this._queue.clear(),this._queue.enqueue(e)}flush(){this._queue.flush()}}},9282:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.updateWindowsModeWrappedState=void 0;let r=n(643);t.updateWindowsModeWrappedState=function(e){let t=e.buffer.lines.get(e.buffer.ybase+e.buffer.y-1)?.get(e.cols-1),n=e.buffer.lines.get(e.buffer.ybase+e.buffer.y);n&&t&&(n.isWrapped=t[r.CHAR_DATA_CODE_INDEX]!==r.NULL_CELL_CODE&&t[r.CHAR_DATA_CODE_INDEX]!==r.WHITESPACE_CELL_CODE)}},3734:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.ExtendedAttrs=t.AttributeData=void 0;class n{constructor(){this.fg=0,this.bg=0,this.extended=new r}static toColorRGB(e){return[e>>>16&255,e>>>8&255,255&e]}static fromColorRGB(e){return(255&e[0])<<16|(255&e[1])<<8|255&e[2]}clone(){let e=new n;return e.fg=this.fg,e.bg=this.bg,e.extended=this.extended.clone(),e}isInverse(){return 67108864&this.fg}isBold(){return 134217728&this.fg}isUnderline(){return this.hasExtendedAttrs()&&this.extended.underlineStyle!==0?1:268435456&this.fg}isBlink(){return 536870912&this.fg}isInvisible(){return 1073741824&this.fg}isItalic(){return 67108864&this.bg}isDim(){return 134217728&this.bg}isStrikethrough(){return 2147483648&this.fg}isProtected(){return 536870912&this.bg}isOverline(){return 1073741824&this.bg}getFgColorMode(){return 50331648&this.fg}getBgColorMode(){return 50331648&this.bg}isFgRGB(){return(50331648&this.fg)==50331648}isBgRGB(){return(50331648&this.bg)==50331648}isFgPalette(){return(50331648&this.fg)==16777216||(50331648&this.fg)==33554432}isBgPalette(){return(50331648&this.bg)==16777216||(50331648&this.bg)==33554432}isFgDefault(){return(50331648&this.fg)==0}isBgDefault(){return(50331648&this.bg)==0}isAttributeDefault(){return this.fg===0&&this.bg===0}getFgColor(){switch(50331648&this.fg){case 16777216:case 33554432:return 255&this.fg;case 50331648:return 16777215&this.fg;default:return-1}}getBgColor(){switch(50331648&this.bg){case 16777216:case 33554432:return 255&this.bg;case 50331648:return 16777215&this.bg;default:return-1}}hasExtendedAttrs(){return 268435456&this.bg}updateExtended(){this.extended.isEmpty()?this.bg&=-268435457:this.bg|=268435456}getUnderlineColor(){if(268435456&this.bg&&~this.extended.underlineColor)switch(50331648&this.extended.underlineColor){case 16777216:case 33554432:return 255&this.extended.underlineColor;case 50331648:return 16777215&this.extended.underlineColor;default:return this.getFgColor()}return this.getFgColor()}getUnderlineColorMode(){return 268435456&this.bg&&~this.extended.underlineColor?50331648&this.extended.underlineColor:this.getFgColorMode()}isUnderlineColorRGB(){return 268435456&this.bg&&~this.extended.underlineColor?(50331648&this.extended.underlineColor)==50331648:this.isFgRGB()}isUnderlineColorPalette(){return 268435456&this.bg&&~this.extended.underlineColor?(50331648&this.extended.underlineColor)==16777216||(50331648&this.extended.underlineColor)==33554432:this.isFgPalette()}isUnderlineColorDefault(){return 268435456&this.bg&&~this.extended.underlineColor?(50331648&this.extended.underlineColor)==0:this.isFgDefault()}getUnderlineStyle(){return 268435456&this.fg?268435456&this.bg?this.extended.underlineStyle:1:0}getUnderlineVariantOffset(){return this.extended.underlineVariantOffset}}t.AttributeData=n;class r{get ext(){return this._urlId?-469762049&this._ext|this.underlineStyle<<26:this._ext}set ext(e){this._ext=e}get underlineStyle(){return this._urlId?5:(469762048&this._ext)>>26}set underlineStyle(e){this._ext&=-469762049,this._ext|=e<<26&469762048}get underlineColor(){return 67108863&this._ext}set underlineColor(e){this._ext&=-67108864,this._ext|=67108863&e}get urlId(){return this._urlId}set urlId(e){this._urlId=e}get underlineVariantOffset(){let e=(3758096384&this._ext)>>29;return e<0?4294967288^e:e}set underlineVariantOffset(e){this._ext&=536870911,this._ext|=e<<29&3758096384}constructor(e=0,t=0){this._ext=0,this._urlId=0,this._ext=e,this._urlId=t}clone(){return new r(this._ext,this._urlId)}isEmpty(){return this.underlineStyle===0&&this._urlId===0}}t.ExtendedAttrs=r},9092:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.Buffer=t.MAX_BUFFER_SIZE=void 0;let r=n(6349),i=n(7226),a=n(3734),o=n(8437),s=n(4634),c=n(511),l=n(643),u=n(4863),d=n(7116);t.MAX_BUFFER_SIZE=4294967295,t.Buffer=class{constructor(e,t,n){this._hasScrollback=e,this._optionsService=t,this._bufferService=n,this.ydisp=0,this.ybase=0,this.y=0,this.x=0,this.tabs={},this.savedY=0,this.savedX=0,this.savedCurAttrData=o.DEFAULT_ATTR_DATA.clone(),this.savedCharset=d.DEFAULT_CHARSET,this.markers=[],this._nullCell=c.CellData.fromCharData([0,l.NULL_CELL_CHAR,l.NULL_CELL_WIDTH,l.NULL_CELL_CODE]),this._whitespaceCell=c.CellData.fromCharData([0,l.WHITESPACE_CELL_CHAR,l.WHITESPACE_CELL_WIDTH,l.WHITESPACE_CELL_CODE]),this._isClearing=!1,this._memoryCleanupQueue=new i.IdleTaskQueue,this._memoryCleanupPosition=0,this._cols=this._bufferService.cols,this._rows=this._bufferService.rows,this.lines=new r.CircularList(this._getCorrectBufferLength(this._rows)),this.scrollTop=0,this.scrollBottom=this._rows-1,this.setupTabStops()}getNullCell(e){return e?(this._nullCell.fg=e.fg,this._nullCell.bg=e.bg,this._nullCell.extended=e.extended):(this._nullCell.fg=0,this._nullCell.bg=0,this._nullCell.extended=new a.ExtendedAttrs),this._nullCell}getWhitespaceCell(e){return e?(this._whitespaceCell.fg=e.fg,this._whitespaceCell.bg=e.bg,this._whitespaceCell.extended=e.extended):(this._whitespaceCell.fg=0,this._whitespaceCell.bg=0,this._whitespaceCell.extended=new a.ExtendedAttrs),this._whitespaceCell}getBlankLine(e,t){return new o.BufferLine(this._bufferService.cols,this.getNullCell(e),t)}get hasScrollback(){return this._hasScrollback&&this.lines.maxLength>this._rows}get isCursorInViewport(){let e=this.ybase+this.y-this.ydisp;return e>=0&&et.MAX_BUFFER_SIZE?t.MAX_BUFFER_SIZE:n}fillViewportRows(e){if(this.lines.length===0){e===void 0&&(e=o.DEFAULT_ATTR_DATA);let t=this._rows;for(;t--;)this.lines.push(this.getBlankLine(e))}}clear(){this.ydisp=0,this.ybase=0,this.y=0,this.x=0,this.lines=new r.CircularList(this._getCorrectBufferLength(this._rows)),this.scrollTop=0,this.scrollBottom=this._rows-1,this.setupTabStops()}resize(e,t){let n=this.getNullCell(o.DEFAULT_ATTR_DATA),r=0,i=this._getCorrectBufferLength(t);if(i>this.lines.maxLength&&(this.lines.maxLength=i),this.lines.length>0){if(this._cols0&&this.lines.length<=this.ybase+this.y+a+1?(this.ybase--,a++,this.ydisp>0&&this.ydisp--):this.lines.push(new o.BufferLine(e,n)));else for(let e=this._rows;e>t;e--)this.lines.length>t+this.ybase&&(this.lines.length>this.ybase+this.y+1?this.lines.pop():(this.ybase++,this.ydisp++));if(i0&&(this.lines.trimStart(e),this.ybase=Math.max(this.ybase-e,0),this.ydisp=Math.max(this.ydisp-e,0),this.savedY=Math.max(this.savedY-e,0)),this.lines.maxLength=i}this.x=Math.min(this.x,e-1),this.y=Math.min(this.y,t-1),a&&(this.y+=a),this.savedX=Math.min(this.savedX,e-1),this.scrollTop=0}if(this.scrollBottom=t-1,this._isReflowEnabled&&(this._reflow(e,t),this._cols>e))for(let t=0;t.1*this.lines.length&&(this._memoryCleanupPosition=0,this._memoryCleanupQueue.enqueue((()=>this._batchedMemoryCleanup())))}_batchedMemoryCleanup(){let e=!0;this._memoryCleanupPosition>=this.lines.length&&(this._memoryCleanupPosition=0,e=!1);let t=0;for(;this._memoryCleanupPosition100)return!0;return e}get _isReflowEnabled(){let e=this._optionsService.rawOptions.windowsPty;return e&&e.buildNumber?this._hasScrollback&&e.backend===`conpty`&&e.buildNumber>=21376:this._hasScrollback&&!this._optionsService.rawOptions.windowsMode}_reflow(e,t){this._cols!==e&&(e>this._cols?this._reflowLarger(e,t):this._reflowSmaller(e,t))}_reflowLarger(e,t){let n=(0,s.reflowLargerGetLinesToRemove)(this.lines,this._cols,e,this.ybase+this.y,this.getNullCell(o.DEFAULT_ATTR_DATA));if(n.length>0){let r=(0,s.reflowLargerCreateNewLayout)(this.lines,n);(0,s.reflowLargerApplyNewLayout)(this.lines,r.layout),this._reflowLargerAdjustViewport(e,t,r.countRemoved)}}_reflowLargerAdjustViewport(e,t,n){let r=this.getNullCell(o.DEFAULT_ATTR_DATA),i=n;for(;i-- >0;)this.ybase===0?(this.y>0&&this.y--,this.lines.length=0;a--){let c=this.lines.get(a);if(!c||!c.isWrapped&&c.getTrimmedLength()<=e)continue;let l=[c];for(;c.isWrapped&&a>0;)c=this.lines.get(--a),l.unshift(c);let u=this.ybase+this.y;if(u>=a&&u0&&(r.push({start:a+l.length+i,newLines:h}),i+=h.length),l.push(...h);let g=f.length-1,_=f[g];_===0&&(g--,_=f[g]);let v=l.length-p-1,y=d;for(;v>=0;){let e=Math.min(y,_);if(l[g]===void 0)break;if(l[g].copyCellsFrom(l[v],y-e,_-e,e,!0),_-=e,_===0&&(g--,_=f[g]),y-=e,y===0){v--;let e=Math.max(v,0);y=(0,s.getWrappedLineTrimmedLength)(l,e,this._cols)}}for(let t=0;t0;)this.ybase===0?this.y0){let e=[],t=[];for(let e=0;e=0;l--)if(s&&s.start>a+c){for(let e=s.newLines.length-1;e>=0;e--)this.lines.set(l--,s.newLines[e]);l++,e.push({index:a+1,amount:s.newLines.length}),c+=s.newLines.length,s=r[++o]}else this.lines.set(l,t[a--]);let l=0;for(let t=e.length-1;t>=0;t--)e[t].index+=l,this.lines.onInsertEmitter.fire(e[t]),l+=e[t].amount;let u=Math.max(0,n+i-this.lines.maxLength);u>0&&this.lines.onTrimEmitter.fire(u)}}translateBufferLineToString(e,t,n=0,r){let i=this.lines.get(e);return i?i.translateToString(t,n,r):``}getWrappedRangeForLine(e){let t=e,n=e;for(;t>0&&this.lines.get(t).isWrapped;)t--;for(;n+10;);return e>=this._cols?this._cols-1:e<0?0:e}nextStop(e){for(e??=this.x;!this.tabs[++e]&&e=this._cols?this._cols-1:e<0?0:e}clearMarkers(e){this._isClearing=!0;for(let t=0;t{t.line-=e,t.line<0&&t.dispose()}))),t.register(this.lines.onInsert((e=>{t.line>=e.index&&(t.line+=e.amount)}))),t.register(this.lines.onDelete((e=>{t.line>=e.index&&t.linee.index&&(t.line-=e.amount)}))),t.register(t.onDispose((()=>this._removeMarker(t)))),t}_removeMarker(e){this._isClearing||this.markers.splice(this.markers.indexOf(e),1)}}},8437:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.BufferLine=t.DEFAULT_ATTR_DATA=void 0;let r=n(3734),i=n(511),a=n(643),o=n(482);t.DEFAULT_ATTR_DATA=Object.freeze(new r.AttributeData);let s=0;class c{constructor(e,t,n=!1){this.isWrapped=n,this._combined={},this._extendedAttrs={},this._data=new Uint32Array(3*e);let r=t||i.CellData.fromCharData([0,a.NULL_CELL_CHAR,a.NULL_CELL_WIDTH,a.NULL_CELL_CODE]);for(let t=0;t>22,2097152&t?this._combined[e].charCodeAt(this._combined[e].length-1):n]}set(e,t){this._data[3*e+1]=t[a.CHAR_DATA_ATTR_INDEX],t[a.CHAR_DATA_CHAR_INDEX].length>1?(this._combined[e]=t[1],this._data[3*e+0]=2097152|e|t[a.CHAR_DATA_WIDTH_INDEX]<<22):this._data[3*e+0]=t[a.CHAR_DATA_CHAR_INDEX].charCodeAt(0)|t[a.CHAR_DATA_WIDTH_INDEX]<<22}getWidth(e){return this._data[3*e+0]>>22}hasWidth(e){return 12582912&this._data[3*e+0]}getFg(e){return this._data[3*e+1]}getBg(e){return this._data[3*e+2]}hasContent(e){return 4194303&this._data[3*e+0]}getCodePoint(e){let t=this._data[3*e+0];return 2097152&t?this._combined[e].charCodeAt(this._combined[e].length-1):2097151&t}isCombined(e){return 2097152&this._data[3*e+0]}getString(e){let t=this._data[3*e+0];return 2097152&t?this._combined[e]:2097151&t?(0,o.stringFromCodePoint)(2097151&t):``}isProtected(e){return 536870912&this._data[3*e+2]}loadCell(e,t){return s=3*e,t.content=this._data[s+0],t.fg=this._data[s+1],t.bg=this._data[s+2],2097152&t.content&&(t.combinedData=this._combined[e]),268435456&t.bg&&(t.extended=this._extendedAttrs[e]),t}setCell(e,t){2097152&t.content&&(this._combined[e]=t.combinedData),268435456&t.bg&&(this._extendedAttrs[e]=t.extended),this._data[3*e+0]=t.content,this._data[3*e+1]=t.fg,this._data[3*e+2]=t.bg}setCellFromCodepoint(e,t,n,r){268435456&r.bg&&(this._extendedAttrs[e]=r.extended),this._data[3*e+0]=t|n<<22,this._data[3*e+1]=r.fg,this._data[3*e+2]=r.bg}addCodepointToCell(e,t,n){let r=this._data[3*e+0];2097152&r?this._combined[e]+=(0,o.stringFromCodePoint)(t):2097151&r?(this._combined[e]=(0,o.stringFromCodePoint)(2097151&r)+(0,o.stringFromCodePoint)(t),r&=-2097152,r|=2097152):r=t|1<<22,n&&(r&=-12582913,r|=n<<22),this._data[3*e+0]=r}insertCells(e,t,n){if((e%=this.length)&&this.getWidth(e-1)===2&&this.setCellFromCodepoint(e-1,0,1,n),t=0;--n)this.setCell(e+t+n,this.loadCell(e+n,r));for(let r=0;rthis.length){if(this._data.buffer.byteLength>=4*n)this._data=new Uint32Array(this._data.buffer,0,n);else{let e=new Uint32Array(n);e.set(this._data),this._data=e}for(let n=this.length;n=e&&delete this._combined[r]}let r=Object.keys(this._extendedAttrs);for(let t=0;t=e&&delete this._extendedAttrs[n]}}return this.length=e,4*n*2=0;--e)if(4194303&this._data[3*e+0])return e+(this._data[3*e+0]>>22);return 0}getNoBgTrimmedLength(){for(let e=this.length-1;e>=0;--e)if(4194303&this._data[3*e+0]||50331648&this._data[3*e+2])return e+(this._data[3*e+0]>>22);return 0}copyCellsFrom(e,t,n,r,i){let a=e._data;if(i)for(let i=r-1;i>=0;i--){for(let e=0;e<3;e++)this._data[3*(n+i)+e]=a[3*(t+i)+e];268435456&a[3*(t+i)+2]&&(this._extendedAttrs[n+i]=e._extendedAttrs[t+i])}else for(let i=0;i=t&&(this._combined[i-t+n]=e._combined[i])}}translateToString(e,t,n,r){t??=0,n??=this.length,e&&(n=Math.min(n,this.getTrimmedLength())),r&&(r.length=0);let i=``;for(;t>22||1}return r&&r.push(t),i}}t.BufferLine=c},4841:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.getRangeLength=void 0,t.getRangeLength=function(e,t){if(e.start.y>e.end.y)throw Error(`Buffer range end (${e.end.x}, ${e.end.y}) cannot be before start (${e.start.x}, ${e.start.y})`);return t*(e.end.y-e.start.y)+(e.end.x-e.start.x+1)}},4634:(e,t)=>{function n(e,t,n){if(t===e.length-1)return e[t].getTrimmedLength();let r=!e[t].hasContent(n-1)&&e[t].getWidth(n-1)===1,i=e[t+1].getWidth(0)===2;return r&&i?n-1:n}Object.defineProperty(t,"__esModule",{value:!0}),t.getWrappedLineTrimmedLength=t.reflowSmallerGetNewLineLengths=t.reflowLargerApplyNewLayout=t.reflowLargerCreateNewLayout=t.reflowLargerGetLinesToRemove=void 0,t.reflowLargerGetLinesToRemove=function(e,t,r,i,a){let o=[];for(let s=0;s=s&&i0&&(e>d||u[e].getTrimmedLength()===0);e--)h++;h>0&&(o.push(s+u.length-h),o.push(h)),s+=u.length-1}return o},t.reflowLargerCreateNewLayout=function(e,t){let n=[],r=0,i=t[r],a=0;for(let o=0;on(e,i,t))).reduce(((e,t)=>e+t)),o=0,s=0,c=0;for(;cl&&(o-=l,s++);let u=e[s].getWidth(o-1)===2;u&&o--;let d=u?r-1:r;i.push(d),c+=d}return i},t.getWrappedLineTrimmedLength=n},5295:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.BufferSet=void 0;let r=n(8460),i=n(844),a=n(9092);class o extends i.Disposable{constructor(e,t){super(),this._optionsService=e,this._bufferService=t,this._onBufferActivate=this.register(new r.EventEmitter),this.onBufferActivate=this._onBufferActivate.event,this.reset(),this.register(this._optionsService.onSpecificOptionChange(`scrollback`,(()=>this.resize(this._bufferService.cols,this._bufferService.rows)))),this.register(this._optionsService.onSpecificOptionChange(`tabStopWidth`,(()=>this.setupTabStops())))}reset(){this._normal=new a.Buffer(!0,this._optionsService,this._bufferService),this._normal.fillViewportRows(),this._alt=new a.Buffer(!1,this._optionsService,this._bufferService),this._activeBuffer=this._normal,this._onBufferActivate.fire({activeBuffer:this._normal,inactiveBuffer:this._alt}),this.setupTabStops()}get alt(){return this._alt}get active(){return this._activeBuffer}get normal(){return this._normal}activateNormalBuffer(){this._activeBuffer!==this._normal&&(this._normal.x=this._alt.x,this._normal.y=this._alt.y,this._alt.clearAllMarkers(),this._alt.clear(),this._activeBuffer=this._normal,this._onBufferActivate.fire({activeBuffer:this._normal,inactiveBuffer:this._alt}))}activateAltBuffer(e){this._activeBuffer!==this._alt&&(this._alt.fillViewportRows(e),this._alt.x=this._normal.x,this._alt.y=this._normal.y,this._activeBuffer=this._alt,this._onBufferActivate.fire({activeBuffer:this._alt,inactiveBuffer:this._normal}))}resize(e,t){this._normal.resize(e,t),this._alt.resize(e,t),this.setupTabStops(e)}setupTabStops(e){this._normal.setupTabStops(e),this._alt.setupTabStops(e)}}t.BufferSet=o},511:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.CellData=void 0;let r=n(482),i=n(643),a=n(3734);class o extends a.AttributeData{constructor(){super(...arguments),this.content=0,this.fg=0,this.bg=0,this.extended=new a.ExtendedAttrs,this.combinedData=``}static fromCharData(e){let t=new o;return t.setFromCharData(e),t}isCombined(){return 2097152&this.content}getWidth(){return this.content>>22}getChars(){return 2097152&this.content?this.combinedData:2097151&this.content?(0,r.stringFromCodePoint)(2097151&this.content):``}getCode(){return this.isCombined()?this.combinedData.charCodeAt(this.combinedData.length-1):2097151&this.content}setFromCharData(e){this.fg=e[i.CHAR_DATA_ATTR_INDEX],this.bg=0;let t=!1;if(e[i.CHAR_DATA_CHAR_INDEX].length>2)t=!0;else if(e[i.CHAR_DATA_CHAR_INDEX].length===2){let n=e[i.CHAR_DATA_CHAR_INDEX].charCodeAt(0);if(55296<=n&&n<=56319){let r=e[i.CHAR_DATA_CHAR_INDEX].charCodeAt(1);56320<=r&&r<=57343?this.content=1024*(n-55296)+r-56320+65536|e[i.CHAR_DATA_WIDTH_INDEX]<<22:t=!0}else t=!0}else this.content=e[i.CHAR_DATA_CHAR_INDEX].charCodeAt(0)|e[i.CHAR_DATA_WIDTH_INDEX]<<22;t&&(this.combinedData=e[i.CHAR_DATA_CHAR_INDEX],this.content=2097152|e[i.CHAR_DATA_WIDTH_INDEX]<<22)}getAsCharData(){return[this.fg,this.getChars(),this.getWidth(),this.getCode()]}}t.CellData=o},643:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.WHITESPACE_CELL_CODE=t.WHITESPACE_CELL_WIDTH=t.WHITESPACE_CELL_CHAR=t.NULL_CELL_CODE=t.NULL_CELL_WIDTH=t.NULL_CELL_CHAR=t.CHAR_DATA_CODE_INDEX=t.CHAR_DATA_WIDTH_INDEX=t.CHAR_DATA_CHAR_INDEX=t.CHAR_DATA_ATTR_INDEX=t.DEFAULT_EXT=t.DEFAULT_ATTR=t.DEFAULT_COLOR=void 0,t.DEFAULT_COLOR=0,t.DEFAULT_ATTR=256|t.DEFAULT_COLOR<<9,t.DEFAULT_EXT=0,t.CHAR_DATA_ATTR_INDEX=0,t.CHAR_DATA_CHAR_INDEX=1,t.CHAR_DATA_WIDTH_INDEX=2,t.CHAR_DATA_CODE_INDEX=3,t.NULL_CELL_CHAR=``,t.NULL_CELL_WIDTH=1,t.NULL_CELL_CODE=0,t.WHITESPACE_CELL_CHAR=` `,t.WHITESPACE_CELL_WIDTH=1,t.WHITESPACE_CELL_CODE=32},4863:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.Marker=void 0;let r=n(8460),i=n(844);class a{get id(){return this._id}constructor(e){this.line=e,this.isDisposed=!1,this._disposables=[],this._id=a._nextId++,this._onDispose=this.register(new r.EventEmitter),this.onDispose=this._onDispose.event}dispose(){this.isDisposed||(this.isDisposed=!0,this.line=-1,this._onDispose.fire(),(0,i.disposeArray)(this._disposables),this._disposables.length=0)}register(e){return this._disposables.push(e),e}}t.Marker=a,a._nextId=1},7116:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.DEFAULT_CHARSET=t.CHARSETS=void 0,t.CHARSETS={},t.DEFAULT_CHARSET=t.CHARSETS.B,t.CHARSETS[0]={"`":`◆`,a:`▒`,b:`␉`,c:`␌`,d:`␍`,e:`␊`,f:`°`,g:`±`,h:`␤`,i:`␋`,j:`┘`,k:`┐`,l:`┌`,m:`└`,n:`┼`,o:`⎺`,p:`⎻`,q:`─`,r:`⎼`,s:`⎽`,t:`├`,u:`┤`,v:`┴`,w:`┬`,x:`│`,y:`≤`,z:`≥`,"{":`π`,"|":`≠`,"}":`£`,"~":`·`},t.CHARSETS.A={"#":`£`},t.CHARSETS.B=void 0,t.CHARSETS[4]={"#":`£`,"@":`¾`,"[":`ij`,"\\":`½`,"]":`|`,"{":`¨`,"|":`f`,"}":`¼`,"~":`´`},t.CHARSETS.C=t.CHARSETS[5]={"[":`Ä`,"\\":`Ö`,"]":`Å`,"^":`Ü`,"`":`é`,"{":`ä`,"|":`ö`,"}":`å`,"~":`ü`},t.CHARSETS.R={"#":`£`,"@":`à`,"[":`°`,"\\":`ç`,"]":`§`,"{":`é`,"|":`ù`,"}":`è`,"~":`¨`},t.CHARSETS.Q={"@":`à`,"[":`â`,"\\":`ç`,"]":`ê`,"^":`î`,"`":`ô`,"{":`é`,"|":`ù`,"}":`è`,"~":`û`},t.CHARSETS.K={"@":`§`,"[":`Ä`,"\\":`Ö`,"]":`Ü`,"{":`ä`,"|":`ö`,"}":`ü`,"~":`ß`},t.CHARSETS.Y={"#":`£`,"@":`§`,"[":`°`,"\\":`ç`,"]":`é`,"`":`ù`,"{":`à`,"|":`ò`,"}":`è`,"~":`ì`},t.CHARSETS.E=t.CHARSETS[6]={"@":`Ä`,"[":`Æ`,"\\":`Ø`,"]":`Å`,"^":`Ü`,"`":`ä`,"{":`æ`,"|":`ø`,"}":`å`,"~":`ü`},t.CHARSETS.Z={"#":`£`,"@":`§`,"[":`¡`,"\\":`Ñ`,"]":`¿`,"{":`°`,"|":`ñ`,"}":`ç`},t.CHARSETS.H=t.CHARSETS[7]={"@":`É`,"[":`Ä`,"\\":`Ö`,"]":`Å`,"^":`Ü`,"`":`é`,"{":`ä`,"|":`ö`,"}":`å`,"~":`ü`},t.CHARSETS[`=`]={"#":`ù`,"@":`à`,"[":`é`,"\\":`ç`,"]":`ê`,"^":`î`,_:`è`,"`":`ô`,"{":`ä`,"|":`ö`,"}":`ü`,"~":`û`}},2584:(e,t)=>{var n,r,i;Object.defineProperty(t,"__esModule",{value:!0}),t.C1_ESCAPED=t.C1=t.C0=void 0,function(e){e.NUL=`\0`,e.SOH=``,e.STX=``,e.ETX=``,e.EOT=``,e.ENQ=``,e.ACK=``,e.BEL=`\x07`,e.BS=`\b`,e.HT=` `,e.LF=` +`,e.VT=`\v`,e.FF=`\f`,e.CR=`\r`,e.SO=``,e.SI=``,e.DLE=``,e.DC1=``,e.DC2=``,e.DC3=``,e.DC4=``,e.NAK=``,e.SYN=``,e.ETB=``,e.CAN=``,e.EM=``,e.SUB=``,e.ESC=`\x1B`,e.FS=``,e.GS=``,e.RS=``,e.US=``,e.SP=` `,e.DEL=``}(n||(t.C0=n={})),function(e){e.PAD=`€`,e.HOP=``,e.BPH=`‚`,e.NBH=`ƒ`,e.IND=`„`,e.NEL=`…`,e.SSA=`†`,e.ESA=`‡`,e.HTS=`ˆ`,e.HTJ=`‰`,e.VTS=`Š`,e.PLD=`‹`,e.PLU=`Œ`,e.RI=``,e.SS2=`Ž`,e.SS3=``,e.DCS=``,e.PU1=`‘`,e.PU2=`’`,e.STS=`“`,e.CCH=`”`,e.MW=`•`,e.SPA=`–`,e.EPA=`—`,e.SOS=`˜`,e.SGCI=`™`,e.SCI=`š`,e.CSI=`›`,e.ST=`œ`,e.OSC=``,e.PM=`ž`,e.APC=`Ÿ`}(r||(t.C1=r={})),function(e){e.ST=`${n.ESC}\\`}(i||(t.C1_ESCAPED=i={}))},7399:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.evaluateKeyboardEvent=void 0;let r=n(2584),i={48:[`0`,`)`],49:[`1`,`!`],50:[`2`,`@`],51:[`3`,`#`],52:[`4`,`$`],53:[`5`,`%`],54:[`6`,`^`],55:[`7`,`&`],56:[`8`,`*`],57:[`9`,`(`],186:[`;`,`:`],187:[`=`,`+`],188:[`,`,`<`],189:[`-`,`_`],190:[`.`,`>`],191:[`/`,`?`],192:["`",`~`],219:[`[`,`{`],220:[`\\`,`|`],221:[`]`,`}`],222:[`'`,`"`]};t.evaluateKeyboardEvent=function(e,t,n,a){let o={type:0,cancel:!1,key:void 0},s=!!e.shiftKey|(e.altKey?2:0)|(e.ctrlKey?4:0)|(e.metaKey?8:0);switch(e.keyCode){case 0:e.key===`UIKeyInputUpArrow`?o.key=t?r.C0.ESC+`OA`:r.C0.ESC+`[A`:e.key===`UIKeyInputLeftArrow`?o.key=t?r.C0.ESC+`OD`:r.C0.ESC+`[D`:e.key===`UIKeyInputRightArrow`?o.key=t?r.C0.ESC+`OC`:r.C0.ESC+`[C`:e.key===`UIKeyInputDownArrow`&&(o.key=t?r.C0.ESC+`OB`:r.C0.ESC+`[B`);break;case 8:o.key=e.ctrlKey?`\b`:r.C0.DEL,e.altKey&&(o.key=r.C0.ESC+o.key);break;case 9:if(e.shiftKey){o.key=r.C0.ESC+`[Z`;break}o.key=r.C0.HT,o.cancel=!0;break;case 13:o.key=e.altKey?r.C0.ESC+r.C0.CR:r.C0.CR,o.cancel=!0;break;case 27:o.key=r.C0.ESC,e.altKey&&(o.key=r.C0.ESC+r.C0.ESC),o.cancel=!0;break;case 37:if(e.metaKey)break;s?(o.key=r.C0.ESC+`[1;`+(s+1)+`D`,o.key===r.C0.ESC+`[1;3D`&&(o.key=r.C0.ESC+(n?`b`:`[1;5D`))):o.key=t?r.C0.ESC+`OD`:r.C0.ESC+`[D`;break;case 39:if(e.metaKey)break;s?(o.key=r.C0.ESC+`[1;`+(s+1)+`C`,o.key===r.C0.ESC+`[1;3C`&&(o.key=r.C0.ESC+(n?`f`:`[1;5C`))):o.key=t?r.C0.ESC+`OC`:r.C0.ESC+`[C`;break;case 38:if(e.metaKey)break;s?(o.key=r.C0.ESC+`[1;`+(s+1)+`A`,n||o.key!==r.C0.ESC+`[1;3A`||(o.key=r.C0.ESC+`[1;5A`)):o.key=t?r.C0.ESC+`OA`:r.C0.ESC+`[A`;break;case 40:if(e.metaKey)break;s?(o.key=r.C0.ESC+`[1;`+(s+1)+`B`,n||o.key!==r.C0.ESC+`[1;3B`||(o.key=r.C0.ESC+`[1;5B`)):o.key=t?r.C0.ESC+`OB`:r.C0.ESC+`[B`;break;case 45:e.shiftKey||e.ctrlKey||(o.key=r.C0.ESC+`[2~`);break;case 46:o.key=s?r.C0.ESC+`[3;`+(s+1)+`~`:r.C0.ESC+`[3~`;break;case 36:o.key=s?r.C0.ESC+`[1;`+(s+1)+`H`:t?r.C0.ESC+`OH`:r.C0.ESC+`[H`;break;case 35:o.key=s?r.C0.ESC+`[1;`+(s+1)+`F`:t?r.C0.ESC+`OF`:r.C0.ESC+`[F`;break;case 33:e.shiftKey?o.type=2:e.ctrlKey?o.key=r.C0.ESC+`[5;`+(s+1)+`~`:o.key=r.C0.ESC+`[5~`;break;case 34:e.shiftKey?o.type=3:e.ctrlKey?o.key=r.C0.ESC+`[6;`+(s+1)+`~`:o.key=r.C0.ESC+`[6~`;break;case 112:o.key=s?r.C0.ESC+`[1;`+(s+1)+`P`:r.C0.ESC+`OP`;break;case 113:o.key=s?r.C0.ESC+`[1;`+(s+1)+`Q`:r.C0.ESC+`OQ`;break;case 114:o.key=s?r.C0.ESC+`[1;`+(s+1)+`R`:r.C0.ESC+`OR`;break;case 115:o.key=s?r.C0.ESC+`[1;`+(s+1)+`S`:r.C0.ESC+`OS`;break;case 116:o.key=s?r.C0.ESC+`[15;`+(s+1)+`~`:r.C0.ESC+`[15~`;break;case 117:o.key=s?r.C0.ESC+`[17;`+(s+1)+`~`:r.C0.ESC+`[17~`;break;case 118:o.key=s?r.C0.ESC+`[18;`+(s+1)+`~`:r.C0.ESC+`[18~`;break;case 119:o.key=s?r.C0.ESC+`[19;`+(s+1)+`~`:r.C0.ESC+`[19~`;break;case 120:o.key=s?r.C0.ESC+`[20;`+(s+1)+`~`:r.C0.ESC+`[20~`;break;case 121:o.key=s?r.C0.ESC+`[21;`+(s+1)+`~`:r.C0.ESC+`[21~`;break;case 122:o.key=s?r.C0.ESC+`[23;`+(s+1)+`~`:r.C0.ESC+`[23~`;break;case 123:o.key=s?r.C0.ESC+`[24;`+(s+1)+`~`:r.C0.ESC+`[24~`;break;default:if(!e.ctrlKey||e.shiftKey||e.altKey||e.metaKey)if(n&&!a||!e.altKey||e.metaKey)!n||e.altKey||e.ctrlKey||e.shiftKey||!e.metaKey?e.key&&!e.ctrlKey&&!e.altKey&&!e.metaKey&&e.keyCode>=48&&e.key.length===1?o.key=e.key:e.key&&e.ctrlKey&&(e.key===`_`&&(o.key=r.C0.US),e.key===`@`&&(o.key=r.C0.NUL)):e.keyCode===65&&(o.type=1);else{let t=i[e.keyCode]?.[+!!e.shiftKey];if(t)o.key=r.C0.ESC+t;else if(e.keyCode>=65&&e.keyCode<=90){let t=e.ctrlKey?e.keyCode-64:e.keyCode+32,n=String.fromCharCode(t);e.shiftKey&&(n=n.toUpperCase()),o.key=r.C0.ESC+n}else if(e.keyCode===32)o.key=r.C0.ESC+(e.ctrlKey?r.C0.NUL:` `);else if(e.key===`Dead`&&e.code.startsWith(`Key`)){let t=e.code.slice(3,4);e.shiftKey||(t=t.toLowerCase()),o.key=r.C0.ESC+t,o.cancel=!0}}else e.keyCode>=65&&e.keyCode<=90?o.key=String.fromCharCode(e.keyCode-64):e.keyCode===32?o.key=r.C0.NUL:e.keyCode>=51&&e.keyCode<=55?o.key=String.fromCharCode(e.keyCode-51+27):e.keyCode===56?o.key=r.C0.DEL:e.keyCode===219?o.key=r.C0.ESC:e.keyCode===220?o.key=r.C0.FS:e.keyCode===221&&(o.key=r.C0.GS)}return o}},482:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.Utf8ToUtf32=t.StringToUtf32=t.utf32ToString=t.stringFromCodePoint=void 0,t.stringFromCodePoint=function(e){return e>65535?(e-=65536,String.fromCharCode(55296+(e>>10))+String.fromCharCode(e%1024+56320)):String.fromCharCode(e)},t.utf32ToString=function(e,t=0,n=e.length){let r=``;for(let i=t;i65535?(t-=65536,r+=String.fromCharCode(55296+(t>>10))+String.fromCharCode(t%1024+56320)):r+=String.fromCharCode(t)}return r},t.StringToUtf32=class{constructor(){this._interim=0}clear(){this._interim=0}decode(e,t){let n=e.length;if(!n)return 0;let r=0,i=0;if(this._interim){let n=e.charCodeAt(i++);56320<=n&&n<=57343?t[r++]=1024*(this._interim-55296)+n-56320+65536:(t[r++]=this._interim,t[r++]=n),this._interim=0}for(let a=i;a=n)return this._interim=i,r;let o=e.charCodeAt(a);56320<=o&&o<=57343?t[r++]=1024*(i-55296)+o-56320+65536:(t[r++]=i,t[r++]=o)}else i!==65279&&(t[r++]=i)}return r}},t.Utf8ToUtf32=class{constructor(){this.interim=new Uint8Array(3)}clear(){this.interim.fill(0)}decode(e,t){let n=e.length;if(!n)return 0;let r,i,a,o,s=0,c=0,l=0;if(this.interim[0]){let r=!1,i=this.interim[0];i&=(224&i)==192?31:(240&i)==224?15:7;let a,o=0;for(;(a=63&this.interim[++o])&&o<4;)i<<=6,i|=a;let c=(224&this.interim[0])==192?2:(240&this.interim[0])==224?3:4,u=c-o;for(;l=n)return 0;if(a=e[l++],(192&a)!=128){l--,r=!0;break}this.interim[o++]=a,i<<=6,i|=63&a}r||(c===2?i<128?l--:t[s++]=i:c===3?i<2048||i>=55296&&i<=57343||i===65279||(t[s++]=i):i<65536||i>1114111||(t[s++]=i)),this.interim.fill(0)}let u=n-4,d=l;for(;d=n)return this.interim[0]=r,s;if(i=e[d++],(192&i)!=128){d--;continue}if(c=(31&r)<<6|63&i,c<128){d--;continue}t[s++]=c}else if((240&r)==224){if(d>=n)return this.interim[0]=r,s;if(i=e[d++],(192&i)!=128){d--;continue}if(d>=n)return this.interim[0]=r,this.interim[1]=i,s;if(a=e[d++],(192&a)!=128){d--;continue}if(c=(15&r)<<12|(63&i)<<6|63&a,c<2048||c>=55296&&c<=57343||c===65279)continue;t[s++]=c}else if((248&r)==240){if(d>=n)return this.interim[0]=r,s;if(i=e[d++],(192&i)!=128){d--;continue}if(d>=n)return this.interim[0]=r,this.interim[1]=i,s;if(a=e[d++],(192&a)!=128){d--;continue}if(d>=n)return this.interim[0]=r,this.interim[1]=i,this.interim[2]=a,s;if(o=e[d++],(192&o)!=128){d--;continue}if(c=(7&r)<<18|(63&i)<<12|(63&a)<<6|63&o,c<65536||c>1114111)continue;t[s++]=c}}return s}}},225:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.UnicodeV6=void 0;let r=n(1480),i=[[768,879],[1155,1158],[1160,1161],[1425,1469],[1471,1471],[1473,1474],[1476,1477],[1479,1479],[1536,1539],[1552,1557],[1611,1630],[1648,1648],[1750,1764],[1767,1768],[1770,1773],[1807,1807],[1809,1809],[1840,1866],[1958,1968],[2027,2035],[2305,2306],[2364,2364],[2369,2376],[2381,2381],[2385,2388],[2402,2403],[2433,2433],[2492,2492],[2497,2500],[2509,2509],[2530,2531],[2561,2562],[2620,2620],[2625,2626],[2631,2632],[2635,2637],[2672,2673],[2689,2690],[2748,2748],[2753,2757],[2759,2760],[2765,2765],[2786,2787],[2817,2817],[2876,2876],[2879,2879],[2881,2883],[2893,2893],[2902,2902],[2946,2946],[3008,3008],[3021,3021],[3134,3136],[3142,3144],[3146,3149],[3157,3158],[3260,3260],[3263,3263],[3270,3270],[3276,3277],[3298,3299],[3393,3395],[3405,3405],[3530,3530],[3538,3540],[3542,3542],[3633,3633],[3636,3642],[3655,3662],[3761,3761],[3764,3769],[3771,3772],[3784,3789],[3864,3865],[3893,3893],[3895,3895],[3897,3897],[3953,3966],[3968,3972],[3974,3975],[3984,3991],[3993,4028],[4038,4038],[4141,4144],[4146,4146],[4150,4151],[4153,4153],[4184,4185],[4448,4607],[4959,4959],[5906,5908],[5938,5940],[5970,5971],[6002,6003],[6068,6069],[6071,6077],[6086,6086],[6089,6099],[6109,6109],[6155,6157],[6313,6313],[6432,6434],[6439,6440],[6450,6450],[6457,6459],[6679,6680],[6912,6915],[6964,6964],[6966,6970],[6972,6972],[6978,6978],[7019,7027],[7616,7626],[7678,7679],[8203,8207],[8234,8238],[8288,8291],[8298,8303],[8400,8431],[12330,12335],[12441,12442],[43014,43014],[43019,43019],[43045,43046],[64286,64286],[65024,65039],[65056,65059],[65279,65279],[65529,65531]],a=[[68097,68099],[68101,68102],[68108,68111],[68152,68154],[68159,68159],[119143,119145],[119155,119170],[119173,119179],[119210,119213],[119362,119364],[917505,917505],[917536,917631],[917760,917999]],o;t.UnicodeV6=class{constructor(){if(this.version=`6`,!o){o=new Uint8Array(65536),o.fill(1),o[0]=0,o.fill(0,1,32),o.fill(0,127,160),o.fill(2,4352,4448),o[9001]=2,o[9002]=2,o.fill(2,11904,42192),o[12351]=1,o.fill(2,44032,55204),o.fill(2,63744,64256),o.fill(2,65040,65050),o.fill(2,65072,65136),o.fill(2,65280,65377),o.fill(2,65504,65511);for(let e=0;et[i][1])return!1;for(;i>=r;)if(n=r+i>>1,e>t[n][1])r=n+1;else{if(!(e=131072&&e<=196605||e>=196608&&e<=262141?2:1}charProperties(e,t){let n=this.wcwidth(e),i=n===0&&t!==0;if(i){let e=r.UnicodeService.extractWidth(t);e===0?i=!1:e>n&&(n=e)}return r.UnicodeService.createPropertyValue(0,n,i)}}},5981:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.WriteBuffer=void 0;let r=n(8460),i=n(844);class a extends i.Disposable{constructor(e){super(),this._action=e,this._writeBuffer=[],this._callbacks=[],this._pendingData=0,this._bufferOffset=0,this._isSyncWriting=!1,this._syncCalls=0,this._didUserInput=!1,this._onWriteParsed=this.register(new r.EventEmitter),this.onWriteParsed=this._onWriteParsed.event}handleUserInput(){this._didUserInput=!0}writeSync(e,t){if(t!==void 0&&this._syncCalls>t)return void(this._syncCalls=0);if(this._pendingData+=e.length,this._writeBuffer.push(e),this._callbacks.push(void 0),this._syncCalls++,this._isSyncWriting)return;let n;for(this._isSyncWriting=!0;n=this._writeBuffer.shift();){this._action(n);let e=this._callbacks.shift();e&&e()}this._pendingData=0,this._bufferOffset=2147483647,this._isSyncWriting=!1,this._syncCalls=0}write(e,t){if(this._pendingData>5e7)throw Error(`write data discarded, use flow control to avoid losing data`);if(!this._writeBuffer.length){if(this._bufferOffset=0,this._didUserInput)return this._didUserInput=!1,this._pendingData+=e.length,this._writeBuffer.push(e),this._callbacks.push(t),void this._innerWrite();setTimeout((()=>this._innerWrite()))}this._pendingData+=e.length,this._writeBuffer.push(e),this._callbacks.push(t)}_innerWrite(e=0,t=!0){let n=e||Date.now();for(;this._writeBuffer.length>this._bufferOffset;){let e=this._writeBuffer[this._bufferOffset],r=this._action(e,t);if(r){r.catch((e=>(queueMicrotask((()=>{throw e})),Promise.resolve(!1)))).then(e=>Date.now()-n>=12?setTimeout((()=>this._innerWrite(0,e))):this._innerWrite(n,e));return}let i=this._callbacks[this._bufferOffset];if(i&&i(),this._bufferOffset++,this._pendingData-=e.length,Date.now()-n>=12)break}this._writeBuffer.length>this._bufferOffset?(this._bufferOffset>50&&(this._writeBuffer=this._writeBuffer.slice(this._bufferOffset),this._callbacks=this._callbacks.slice(this._bufferOffset),this._bufferOffset=0),setTimeout((()=>this._innerWrite()))):(this._writeBuffer.length=0,this._callbacks.length=0,this._pendingData=0,this._bufferOffset=0),this._onWriteParsed.fire()}}t.WriteBuffer=a},5941:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.toRgbString=t.parseColor=void 0;let n=/^([\da-f])\/([\da-f])\/([\da-f])$|^([\da-f]{2})\/([\da-f]{2})\/([\da-f]{2})$|^([\da-f]{3})\/([\da-f]{3})\/([\da-f]{3})$|^([\da-f]{4})\/([\da-f]{4})\/([\da-f]{4})$/,r=/^[\da-f]+$/;function i(e,t){let n=e.toString(16),r=n.length<2?`0`+n:n;switch(t){case 4:return n[0];case 8:return r;case 12:return(r+r).slice(0,3);default:return r+r}}t.parseColor=function(e){if(!e)return;let t=e.toLowerCase();if(t.indexOf(`rgb:`)===0){t=t.slice(4);let e=n.exec(t);if(e){let t=e[1]?15:e[4]?255:e[7]?4095:65535;return[Math.round(parseInt(e[1]||e[4]||e[7]||e[10],16)/t*255),Math.round(parseInt(e[2]||e[5]||e[8]||e[11],16)/t*255),Math.round(parseInt(e[3]||e[6]||e[9]||e[12],16)/t*255)]}}else if(t.indexOf(`#`)===0&&(t=t.slice(1),r.exec(t)&&[3,6,9,12].includes(t.length))){let e=t.length/3,n=[0,0,0];for(let r=0;r<3;++r){let i=parseInt(t.slice(e*r,e*r+e),16);n[r]=e===1?i<<4:e===2?i:e===3?i>>4:i>>8}return n}},t.toRgbString=function(e,t=16){let[n,r,a]=e;return`rgb:${i(n,t)}/${i(r,t)}/${i(a,t)}`}},5770:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.PAYLOAD_LIMIT=void 0,t.PAYLOAD_LIMIT=1e7},6351:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.DcsHandler=t.DcsParser=void 0;let r=n(482),i=n(8742),a=n(5770),o=[];t.DcsParser=class{constructor(){this._handlers=Object.create(null),this._active=o,this._ident=0,this._handlerFb=()=>{},this._stack={paused:!1,loopPosition:0,fallThrough:!1}}dispose(){this._handlers=Object.create(null),this._handlerFb=()=>{},this._active=o}registerHandler(e,t){this._handlers[e]===void 0&&(this._handlers[e]=[]);let n=this._handlers[e];return n.push(t),{dispose:()=>{let e=n.indexOf(t);e!==-1&&n.splice(e,1)}}}clearHandler(e){this._handlers[e]&&delete this._handlers[e]}setHandlerFallback(e){this._handlerFb=e}reset(){if(this._active.length)for(let e=this._stack.paused?this._stack.loopPosition-1:this._active.length-1;e>=0;--e)this._active[e].unhook(!1);this._stack.paused=!1,this._active=o,this._ident=0}hook(e,t){if(this.reset(),this._ident=e,this._active=this._handlers[e]||o,this._active.length)for(let e=this._active.length-1;e>=0;e--)this._active[e].hook(t);else this._handlerFb(this._ident,`HOOK`,t)}put(e,t,n){if(this._active.length)for(let r=this._active.length-1;r>=0;r--)this._active[r].put(e,t,n);else this._handlerFb(this._ident,`PUT`,(0,r.utf32ToString)(e,t,n))}unhook(e,t=!0){if(this._active.length){let n=!1,r=this._active.length-1,i=!1;if(this._stack.paused&&(r=this._stack.loopPosition-1,n=t,i=this._stack.fallThrough,this._stack.paused=!1),!i&&!1===n){for(;r>=0&&(n=this._active[r].unhook(e),!0!==n);r--)if(n instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=r,this._stack.fallThrough=!1,n;r--}for(;r>=0;r--)if(n=this._active[r].unhook(!1),n instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=r,this._stack.fallThrough=!0,n}else this._handlerFb(this._ident,`UNHOOK`,e);this._active=o,this._ident=0}};let s=new i.Params;s.addParam(0),t.DcsHandler=class{constructor(e){this._handler=e,this._data=``,this._params=s,this._hitLimit=!1}hook(e){this._params=e.length>1||e.params[0]?e.clone():s,this._data=``,this._hitLimit=!1}put(e,t,n){this._hitLimit||(this._data+=(0,r.utf32ToString)(e,t,n),this._data.length>a.PAYLOAD_LIMIT&&(this._data=``,this._hitLimit=!0))}unhook(e){let t=!1;if(this._hitLimit)t=!1;else if(e&&(t=this._handler(this._data,this._params),t instanceof Promise))return t.then((e=>(this._params=s,this._data=``,this._hitLimit=!1,e)));return this._params=s,this._data=``,this._hitLimit=!1,t}}},2015:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.EscapeSequenceParser=t.VT500_TRANSITION_TABLE=t.TransitionTable=void 0;let r=n(844),i=n(8742),a=n(6242),o=n(6351);class s{constructor(e){this.table=new Uint8Array(e)}setDefault(e,t){this.table.fill(e<<4|t)}add(e,t,n,r){this.table[t<<8|e]=n<<4|r}addMany(e,t,n,r){for(let i=0;it)),n=(e,n)=>t.slice(e,n),r=n(32,127),i=n(0,24);i.push(25),i.push.apply(i,n(28,32));let a=n(0,14),o;for(o in e.setDefault(1,0),e.addMany(r,0,2,0),a)e.addMany([24,26,153,154],o,3,0),e.addMany(n(128,144),o,3,0),e.addMany(n(144,152),o,3,0),e.add(156,o,0,0),e.add(27,o,11,1),e.add(157,o,4,8),e.addMany([152,158,159],o,0,7),e.add(155,o,11,3),e.add(144,o,11,9);return e.addMany(i,0,3,0),e.addMany(i,1,3,1),e.add(127,1,0,1),e.addMany(i,8,0,8),e.addMany(i,3,3,3),e.add(127,3,0,3),e.addMany(i,4,3,4),e.add(127,4,0,4),e.addMany(i,6,3,6),e.addMany(i,5,3,5),e.add(127,5,0,5),e.addMany(i,2,3,2),e.add(127,2,0,2),e.add(93,1,4,8),e.addMany(r,8,5,8),e.add(127,8,5,8),e.addMany([156,27,24,26,7],8,6,0),e.addMany(n(28,32),8,0,8),e.addMany([88,94,95],1,0,7),e.addMany(r,7,0,7),e.addMany(i,7,0,7),e.add(156,7,0,0),e.add(127,7,0,7),e.add(91,1,11,3),e.addMany(n(64,127),3,7,0),e.addMany(n(48,60),3,8,4),e.addMany([60,61,62,63],3,9,4),e.addMany(n(48,60),4,8,4),e.addMany(n(64,127),4,7,0),e.addMany([60,61,62,63],4,0,6),e.addMany(n(32,64),6,0,6),e.add(127,6,0,6),e.addMany(n(64,127),6,0,0),e.addMany(n(32,48),3,9,5),e.addMany(n(32,48),5,9,5),e.addMany(n(48,64),5,0,6),e.addMany(n(64,127),5,7,0),e.addMany(n(32,48),4,9,5),e.addMany(n(32,48),1,9,2),e.addMany(n(32,48),2,9,2),e.addMany(n(48,127),2,10,0),e.addMany(n(48,80),1,10,0),e.addMany(n(81,88),1,10,0),e.addMany([89,90,92],1,10,0),e.addMany(n(96,127),1,10,0),e.add(80,1,11,9),e.addMany(i,9,0,9),e.add(127,9,0,9),e.addMany(n(28,32),9,0,9),e.addMany(n(32,48),9,9,12),e.addMany(n(48,60),9,8,10),e.addMany([60,61,62,63],9,9,10),e.addMany(i,11,0,11),e.addMany(n(32,128),11,0,11),e.addMany(n(28,32),11,0,11),e.addMany(i,10,0,10),e.add(127,10,0,10),e.addMany(n(28,32),10,0,10),e.addMany(n(48,60),10,8,10),e.addMany([60,61,62,63],10,0,11),e.addMany(n(32,48),10,9,12),e.addMany(i,12,0,12),e.add(127,12,0,12),e.addMany(n(28,32),12,0,12),e.addMany(n(32,48),12,9,12),e.addMany(n(48,64),12,0,11),e.addMany(n(64,127),12,12,13),e.addMany(n(64,127),10,12,13),e.addMany(n(64,127),9,12,13),e.addMany(i,13,13,13),e.addMany(r,13,13,13),e.add(127,13,0,13),e.addMany([27,156,24,26],13,14,0),e.add(160,0,2,0),e.add(160,8,5,8),e.add(160,6,0,6),e.add(160,11,0,11),e.add(160,13,13,13),e}();class c extends r.Disposable{constructor(e=t.VT500_TRANSITION_TABLE){super(),this._transitions=e,this._parseStack={state:0,handlers:[],handlerPos:0,transition:0,chunkPos:0},this.initialState=0,this.currentState=this.initialState,this._params=new i.Params,this._params.addParam(0),this._collect=0,this.precedingJoinState=0,this._printHandlerFb=(e,t,n)=>{},this._executeHandlerFb=e=>{},this._csiHandlerFb=(e,t)=>{},this._escHandlerFb=e=>{},this._errorHandlerFb=e=>e,this._printHandler=this._printHandlerFb,this._executeHandlers=Object.create(null),this._csiHandlers=Object.create(null),this._escHandlers=Object.create(null),this.register((0,r.toDisposable)((()=>{this._csiHandlers=Object.create(null),this._executeHandlers=Object.create(null),this._escHandlers=Object.create(null)}))),this._oscParser=this.register(new a.OscParser),this._dcsParser=this.register(new o.DcsParser),this._errorHandler=this._errorHandlerFb,this.registerEscHandler({final:`\\`},(()=>!0))}_identifier(e,t=[64,126]){let n=0;if(e.prefix){if(e.prefix.length>1)throw Error(`only one byte as prefix supported`);if(n=e.prefix.charCodeAt(0),n&&60>n||n>63)throw Error(`prefix must be in range 0x3c .. 0x3f`)}if(e.intermediates){if(e.intermediates.length>2)throw Error(`only two bytes as intermediates are supported`);for(let t=0;tr||r>47)throw Error(`intermediate must be in range 0x20 .. 0x2f`);n<<=8,n|=r}}if(e.final.length!==1)throw Error(`final must be a single byte`);let r=e.final.charCodeAt(0);if(t[0]>r||r>t[1])throw Error(`final must be in range ${t[0]} .. ${t[1]}`);return n<<=8,n|=r,n}identToString(e){let t=[];for(;e;)t.push(String.fromCharCode(255&e)),e>>=8;return t.reverse().join(``)}setPrintHandler(e){this._printHandler=e}clearPrintHandler(){this._printHandler=this._printHandlerFb}registerEscHandler(e,t){let n=this._identifier(e,[48,126]);this._escHandlers[n]===void 0&&(this._escHandlers[n]=[]);let r=this._escHandlers[n];return r.push(t),{dispose:()=>{let e=r.indexOf(t);e!==-1&&r.splice(e,1)}}}clearEscHandler(e){this._escHandlers[this._identifier(e,[48,126])]&&delete this._escHandlers[this._identifier(e,[48,126])]}setEscHandlerFallback(e){this._escHandlerFb=e}setExecuteHandler(e,t){this._executeHandlers[e.charCodeAt(0)]=t}clearExecuteHandler(e){this._executeHandlers[e.charCodeAt(0)]&&delete this._executeHandlers[e.charCodeAt(0)]}setExecuteHandlerFallback(e){this._executeHandlerFb=e}registerCsiHandler(e,t){let n=this._identifier(e);this._csiHandlers[n]===void 0&&(this._csiHandlers[n]=[]);let r=this._csiHandlers[n];return r.push(t),{dispose:()=>{let e=r.indexOf(t);e!==-1&&r.splice(e,1)}}}clearCsiHandler(e){this._csiHandlers[this._identifier(e)]&&delete this._csiHandlers[this._identifier(e)]}setCsiHandlerFallback(e){this._csiHandlerFb=e}registerDcsHandler(e,t){return this._dcsParser.registerHandler(this._identifier(e),t)}clearDcsHandler(e){this._dcsParser.clearHandler(this._identifier(e))}setDcsHandlerFallback(e){this._dcsParser.setHandlerFallback(e)}registerOscHandler(e,t){return this._oscParser.registerHandler(e,t)}clearOscHandler(e){this._oscParser.clearHandler(e)}setOscHandlerFallback(e){this._oscParser.setHandlerFallback(e)}setErrorHandler(e){this._errorHandler=e}clearErrorHandler(){this._errorHandler=this._errorHandlerFb}reset(){this.currentState=this.initialState,this._oscParser.reset(),this._dcsParser.reset(),this._params.reset(),this._params.addParam(0),this._collect=0,this.precedingJoinState=0,this._parseStack.state!==0&&(this._parseStack.state=2,this._parseStack.handlers=[])}_preserveStack(e,t,n,r,i){this._parseStack.state=e,this._parseStack.handlers=t,this._parseStack.handlerPos=n,this._parseStack.transition=r,this._parseStack.chunkPos=i}parse(e,t,n){let r,i=0,a=0,o=0;if(this._parseStack.state)if(this._parseStack.state===2)this._parseStack.state=0,o=this._parseStack.chunkPos+1;else{if(n===void 0||this._parseStack.state===1)throw this._parseStack.state=1,Error(`improper continuation due to previous async handler, giving up parsing`);let t=this._parseStack.handlers,a=this._parseStack.handlerPos-1;switch(this._parseStack.state){case 3:if(!1===n&&a>-1){for(;a>=0&&(r=t[a](this._params),!0!==r);a--)if(r instanceof Promise)return this._parseStack.handlerPos=a,r}this._parseStack.handlers=[];break;case 4:if(!1===n&&a>-1){for(;a>=0&&(r=t[a](),!0!==r);a--)if(r instanceof Promise)return this._parseStack.handlerPos=a,r}this._parseStack.handlers=[];break;case 6:if(i=e[this._parseStack.chunkPos],r=this._dcsParser.unhook(i!==24&&i!==26,n),r)return r;i===27&&(this._parseStack.transition|=1),this._params.reset(),this._params.addParam(0),this._collect=0;break;case 5:if(i=e[this._parseStack.chunkPos],r=this._oscParser.end(i!==24&&i!==26,n),r)return r;i===27&&(this._parseStack.transition|=1),this._params.reset(),this._params.addParam(0),this._collect=0}this._parseStack.state=0,o=this._parseStack.chunkPos+1,this.precedingJoinState=0,this.currentState=15&this._parseStack.transition}for(let n=o;n>4){case 2:for(let r=n+1;;++r){if(r>=t||(i=e[r])<32||i>126&&i<160){this._printHandler(e,n,r),n=r-1;break}if(++r>=t||(i=e[r])<32||i>126&&i<160){this._printHandler(e,n,r),n=r-1;break}if(++r>=t||(i=e[r])<32||i>126&&i<160){this._printHandler(e,n,r),n=r-1;break}if(++r>=t||(i=e[r])<32||i>126&&i<160){this._printHandler(e,n,r),n=r-1;break}}break;case 3:this._executeHandlers[i]?this._executeHandlers[i]():this._executeHandlerFb(i),this.precedingJoinState=0;break;case 0:break;case 1:if(this._errorHandler({position:n,code:i,currentState:this.currentState,collect:this._collect,params:this._params,abort:!1}).abort)return;break;case 7:let o=this._csiHandlers[this._collect<<8|i],s=o?o.length-1:-1;for(;s>=0&&(r=o[s](this._params),!0!==r);s--)if(r instanceof Promise)return this._preserveStack(3,o,s,a,n),r;s<0&&this._csiHandlerFb(this._collect<<8|i,this._params),this.precedingJoinState=0;break;case 8:do switch(i){case 59:this._params.addParam(0);break;case 58:this._params.addSubParam(-1);break;default:this._params.addDigit(i-48)}while(++n47&&i<60);n--;break;case 9:this._collect<<=8,this._collect|=i;break;case 10:let c=this._escHandlers[this._collect<<8|i],l=c?c.length-1:-1;for(;l>=0&&(r=c[l](),!0!==r);l--)if(r instanceof Promise)return this._preserveStack(4,c,l,a,n),r;l<0&&this._escHandlerFb(this._collect<<8|i),this.precedingJoinState=0;break;case 11:this._params.reset(),this._params.addParam(0),this._collect=0;break;case 12:this._dcsParser.hook(this._collect<<8|i,this._params);break;case 13:for(let r=n+1;;++r)if(r>=t||(i=e[r])===24||i===26||i===27||i>127&&i<160){this._dcsParser.put(e,n,r),n=r-1;break}break;case 14:if(r=this._dcsParser.unhook(i!==24&&i!==26),r)return this._preserveStack(6,[],0,a,n),r;i===27&&(a|=1),this._params.reset(),this._params.addParam(0),this._collect=0,this.precedingJoinState=0;break;case 4:this._oscParser.start();break;case 5:for(let r=n+1;;r++)if(r>=t||(i=e[r])<32||i>127&&i<160){this._oscParser.put(e,n,r),n=r-1;break}break;case 6:if(r=this._oscParser.end(i!==24&&i!==26),r)return this._preserveStack(5,[],0,a,n),r;i===27&&(a|=1),this._params.reset(),this._params.addParam(0),this._collect=0,this.precedingJoinState=0}this.currentState=15&a}}}t.EscapeSequenceParser=c},6242:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.OscHandler=t.OscParser=void 0;let r=n(5770),i=n(482),a=[];t.OscParser=class{constructor(){this._state=0,this._active=a,this._id=-1,this._handlers=Object.create(null),this._handlerFb=()=>{},this._stack={paused:!1,loopPosition:0,fallThrough:!1}}registerHandler(e,t){this._handlers[e]===void 0&&(this._handlers[e]=[]);let n=this._handlers[e];return n.push(t),{dispose:()=>{let e=n.indexOf(t);e!==-1&&n.splice(e,1)}}}clearHandler(e){this._handlers[e]&&delete this._handlers[e]}setHandlerFallback(e){this._handlerFb=e}dispose(){this._handlers=Object.create(null),this._handlerFb=()=>{},this._active=a}reset(){if(this._state===2)for(let e=this._stack.paused?this._stack.loopPosition-1:this._active.length-1;e>=0;--e)this._active[e].end(!1);this._stack.paused=!1,this._active=a,this._id=-1,this._state=0}_start(){if(this._active=this._handlers[this._id]||a,this._active.length)for(let e=this._active.length-1;e>=0;e--)this._active[e].start();else this._handlerFb(this._id,`START`)}_put(e,t,n){if(this._active.length)for(let r=this._active.length-1;r>=0;r--)this._active[r].put(e,t,n);else this._handlerFb(this._id,`PUT`,(0,i.utf32ToString)(e,t,n))}start(){this.reset(),this._state=1}put(e,t,n){if(this._state!==3){if(this._state===1)for(;t0&&this._put(e,t,n)}}end(e,t=!0){if(this._state!==0){if(this._state!==3)if(this._state===1&&this._start(),this._active.length){let n=!1,r=this._active.length-1,i=!1;if(this._stack.paused&&(r=this._stack.loopPosition-1,n=t,i=this._stack.fallThrough,this._stack.paused=!1),!i&&!1===n){for(;r>=0&&(n=this._active[r].end(e),!0!==n);r--)if(n instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=r,this._stack.fallThrough=!1,n;r--}for(;r>=0;r--)if(n=this._active[r].end(!1),n instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=r,this._stack.fallThrough=!0,n}else this._handlerFb(this._id,`END`,e);this._active=a,this._id=-1,this._state=0}}},t.OscHandler=class{constructor(e){this._handler=e,this._data=``,this._hitLimit=!1}start(){this._data=``,this._hitLimit=!1}put(e,t,n){this._hitLimit||(this._data+=(0,i.utf32ToString)(e,t,n),this._data.length>r.PAYLOAD_LIMIT&&(this._data=``,this._hitLimit=!0))}end(e){let t=!1;if(this._hitLimit)t=!1;else if(e&&(t=this._handler(this._data),t instanceof Promise))return t.then((e=>(this._data=``,this._hitLimit=!1,e)));return this._data=``,this._hitLimit=!1,t}}},8742:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.Params=void 0;let n=2147483647;class r{static fromArray(e){let t=new r;if(!e.length)return t;for(let n=+!!Array.isArray(e[0]);n256)throw Error(`maxSubParamsLength must not be greater than 256`);this.params=new Int32Array(e),this.length=0,this._subParams=new Int32Array(t),this._subParamsLength=0,this._subParamsIdx=new Uint16Array(e),this._rejectDigits=!1,this._rejectSubDigits=!1,this._digitIsSub=!1}clone(){let e=new r(this.maxLength,this.maxSubParamsLength);return e.params.set(this.params),e.length=this.length,e._subParams.set(this._subParams),e._subParamsLength=this._subParamsLength,e._subParamsIdx.set(this._subParamsIdx),e._rejectDigits=this._rejectDigits,e._rejectSubDigits=this._rejectSubDigits,e._digitIsSub=this._digitIsSub,e}toArray(){let e=[];for(let t=0;t>8,r=255&this._subParamsIdx[t];r-n>0&&e.push(Array.prototype.slice.call(this._subParams,n,r))}return e}reset(){this.length=0,this._subParamsLength=0,this._rejectDigits=!1,this._rejectSubDigits=!1,this._digitIsSub=!1}addParam(e){if(this._digitIsSub=!1,this.length>=this.maxLength)this._rejectDigits=!0;else{if(e<-1)throw Error(`values lesser than -1 are not allowed`);this._subParamsIdx[this.length]=this._subParamsLength<<8|this._subParamsLength,this.params[this.length++]=e>n?n:e}}addSubParam(e){if(this._digitIsSub=!0,this.length)if(this._rejectDigits||this._subParamsLength>=this.maxSubParamsLength)this._rejectSubDigits=!0;else{if(e<-1)throw Error(`values lesser than -1 are not allowed`);this._subParams[this._subParamsLength++]=e>n?n:e,this._subParamsIdx[this.length-1]++}}hasSubParams(e){return(255&this._subParamsIdx[e])-(this._subParamsIdx[e]>>8)>0}getSubParams(e){let t=this._subParamsIdx[e]>>8,n=255&this._subParamsIdx[e];return n-t>0?this._subParams.subarray(t,n):null}getSubParamsAll(){let e={};for(let t=0;t>8,r=255&this._subParamsIdx[t];r-n>0&&(e[t]=this._subParams.slice(n,r))}return e}addDigit(e){let t;if(this._rejectDigits||!(t=this._digitIsSub?this._subParamsLength:this.length)||this._digitIsSub&&this._rejectSubDigits)return;let r=this._digitIsSub?this._subParams:this.params,i=r[t-1];r[t-1]=~i?Math.min(10*i+e,n):e}}t.Params=r},5741:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.AddonManager=void 0,t.AddonManager=class{constructor(){this._addons=[]}dispose(){for(let e=this._addons.length-1;e>=0;e--)this._addons[e].instance.dispose()}loadAddon(e,t){let n={instance:t,dispose:t.dispose,isDisposed:!1};this._addons.push(n),t.dispose=()=>this._wrappedAddonDispose(n),t.activate(e)}_wrappedAddonDispose(e){if(e.isDisposed)return;let t=-1;for(let n=0;n{Object.defineProperty(t,"__esModule",{value:!0}),t.BufferApiView=void 0;let r=n(3785),i=n(511);t.BufferApiView=class{constructor(e,t){this._buffer=e,this.type=t}init(e){return this._buffer=e,this}get cursorY(){return this._buffer.y}get cursorX(){return this._buffer.x}get viewportY(){return this._buffer.ydisp}get baseY(){return this._buffer.ybase}get length(){return this._buffer.lines.length}getLine(e){let t=this._buffer.lines.get(e);if(t)return new r.BufferLineApiView(t)}getNullCell(){return new i.CellData}}},3785:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.BufferLineApiView=void 0;let r=n(511);t.BufferLineApiView=class{constructor(e){this._line=e}get isWrapped(){return this._line.isWrapped}get length(){return this._line.length}getCell(e,t){if(!(e<0||e>=this._line.length))return t?(this._line.loadCell(e,t),t):this._line.loadCell(e,new r.CellData)}translateToString(e,t,n){return this._line.translateToString(e,t,n)}}},8285:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.BufferNamespaceApi=void 0;let r=n(8771),i=n(8460),a=n(844);class o extends a.Disposable{constructor(e){super(),this._core=e,this._onBufferChange=this.register(new i.EventEmitter),this.onBufferChange=this._onBufferChange.event,this._normal=new r.BufferApiView(this._core.buffers.normal,`normal`),this._alternate=new r.BufferApiView(this._core.buffers.alt,`alternate`),this._core.buffers.onBufferActivate((()=>this._onBufferChange.fire(this.active)))}get active(){if(this._core.buffers.active===this._core.buffers.normal)return this.normal;if(this._core.buffers.active===this._core.buffers.alt)return this.alternate;throw Error(`Active buffer is neither normal nor alternate`)}get normal(){return this._normal.init(this._core.buffers.normal)}get alternate(){return this._alternate.init(this._core.buffers.alt)}}t.BufferNamespaceApi=o},7975:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.ParserApi=void 0,t.ParserApi=class{constructor(e){this._core=e}registerCsiHandler(e,t){return this._core.registerCsiHandler(e,(e=>t(e.toArray())))}addCsiHandler(e,t){return this.registerCsiHandler(e,t)}registerDcsHandler(e,t){return this._core.registerDcsHandler(e,((e,n)=>t(e,n.toArray())))}addDcsHandler(e,t){return this.registerDcsHandler(e,t)}registerEscHandler(e,t){return this._core.registerEscHandler(e,t)}addEscHandler(e,t){return this.registerEscHandler(e,t)}registerOscHandler(e,t){return this._core.registerOscHandler(e,t)}addOscHandler(e,t){return this.registerOscHandler(e,t)}}},7090:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.UnicodeApi=void 0,t.UnicodeApi=class{constructor(e){this._core=e}register(e){this._core.unicodeService.register(e)}get versions(){return this._core.unicodeService.versions}get activeVersion(){return this._core.unicodeService.activeVersion}set activeVersion(e){this._core.unicodeService.activeVersion=e}}},744:function(e,t,n){var r=this&&this.__decorate||function(e,t,n,r){var i,a=arguments.length,o=a<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,n):r;if(typeof Reflect==`object`&&typeof Reflect.decorate==`function`)o=Reflect.decorate(e,t,n,r);else for(var s=e.length-1;s>=0;s--)(i=e[s])&&(o=(a<3?i(o):a>3?i(t,n,o):i(t,n))||o);return a>3&&o&&Object.defineProperty(t,n,o),o},i=this&&this.__param||function(e,t){return function(n,r){t(n,r,e)}};Object.defineProperty(t,"__esModule",{value:!0}),t.BufferService=t.MINIMUM_ROWS=t.MINIMUM_COLS=void 0;let a=n(8460),o=n(844),s=n(5295),c=n(2585);t.MINIMUM_COLS=2,t.MINIMUM_ROWS=1;let l=t.BufferService=class extends o.Disposable{get buffer(){return this.buffers.active}constructor(e){super(),this.isUserScrolling=!1,this._onResize=this.register(new a.EventEmitter),this.onResize=this._onResize.event,this._onScroll=this.register(new a.EventEmitter),this.onScroll=this._onScroll.event,this.cols=Math.max(e.rawOptions.cols||0,t.MINIMUM_COLS),this.rows=Math.max(e.rawOptions.rows||0,t.MINIMUM_ROWS),this.buffers=this.register(new s.BufferSet(e,this))}resize(e,t){this.cols=e,this.rows=t,this.buffers.resize(e,t),this._onResize.fire({cols:e,rows:t})}reset(){this.buffers.reset(),this.isUserScrolling=!1}scroll(e,t=!1){let n=this.buffer,r;r=this._cachedBlankLine,r&&r.length===this.cols&&r.getFg(0)===e.fg&&r.getBg(0)===e.bg||(r=n.getBlankLine(e,t),this._cachedBlankLine=r),r.isWrapped=t;let i=n.ybase+n.scrollTop,a=n.ybase+n.scrollBottom;if(n.scrollTop===0){let e=n.lines.isFull;a===n.lines.length-1?e?n.lines.recycle().copyFrom(r):n.lines.push(r.clone()):n.lines.splice(a+1,0,r.clone()),e?this.isUserScrolling&&(n.ydisp=Math.max(n.ydisp-1,0)):(n.ybase++,this.isUserScrolling||n.ydisp++)}else{let e=a-i+1;n.lines.shiftElements(i+1,e-1,-1),n.lines.set(a,r.clone())}this.isUserScrolling||(n.ydisp=n.ybase),this._onScroll.fire(n.ydisp)}scrollLines(e,t,n){let r=this.buffer;if(e<0){if(r.ydisp===0)return;this.isUserScrolling=!0}else e+r.ydisp>=r.ybase&&(this.isUserScrolling=!1);let i=r.ydisp;r.ydisp=Math.max(Math.min(r.ydisp+e,r.ybase),0),i!==r.ydisp&&(t||this._onScroll.fire(r.ydisp))}};t.BufferService=l=r([i(0,c.IOptionsService)],l)},7994:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.CharsetService=void 0,t.CharsetService=class{constructor(){this.glevel=0,this._charsets=[]}reset(){this.charset=void 0,this._charsets=[],this.glevel=0}setgLevel(e){this.glevel=e,this.charset=this._charsets[e]}setgCharset(e,t){this._charsets[e]=t,this.glevel===e&&(this.charset=t)}}},1753:function(e,t,n){var r=this&&this.__decorate||function(e,t,n,r){var i,a=arguments.length,o=a<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,n):r;if(typeof Reflect==`object`&&typeof Reflect.decorate==`function`)o=Reflect.decorate(e,t,n,r);else for(var s=e.length-1;s>=0;s--)(i=e[s])&&(o=(a<3?i(o):a>3?i(t,n,o):i(t,n))||o);return a>3&&o&&Object.defineProperty(t,n,o),o},i=this&&this.__param||function(e,t){return function(n,r){t(n,r,e)}};Object.defineProperty(t,"__esModule",{value:!0}),t.CoreMouseService=void 0;let a=n(2585),o=n(8460),s=n(844),c={NONE:{events:0,restrict:()=>!1},X10:{events:1,restrict:e=>e.button!==4&&e.action===1&&(e.ctrl=!1,e.alt=!1,e.shift=!1,!0)},VT200:{events:19,restrict:e=>e.action!==32},DRAG:{events:23,restrict:e=>e.action!==32||e.button!==3},ANY:{events:31,restrict:e=>!0}};function l(e,t){let n=(e.ctrl?16:0)|(e.shift?4:0)|(e.alt?8:0);return e.button===4?(n|=64,n|=e.action):(n|=3&e.button,4&e.button&&(n|=64),8&e.button&&(n|=128),e.action===32?n|=32:e.action!==0||t||(n|=3)),n}let u=String.fromCharCode,d={DEFAULT:e=>{let t=[l(e,!1)+32,e.col+32,e.row+32];return t[0]>255||t[1]>255||t[2]>255?``:`${u(t[0])}${u(t[1])}${u(t[2])}`},SGR:e=>{let t=e.action===0&&e.button!==4?`m`:`M`;return`[<${l(e,!0)};${e.col};${e.row}${t}`},SGR_PIXELS:e=>{let t=e.action===0&&e.button!==4?`m`:`M`;return`[<${l(e,!0)};${e.x};${e.y}${t}`}},f=t.CoreMouseService=class extends s.Disposable{constructor(e,t){super(),this._bufferService=e,this._coreService=t,this._protocols={},this._encodings={},this._activeProtocol=``,this._activeEncoding=``,this._lastEvent=null,this._onProtocolChange=this.register(new o.EventEmitter),this.onProtocolChange=this._onProtocolChange.event;for(let e of Object.keys(c))this.addProtocol(e,c[e]);for(let e of Object.keys(d))this.addEncoding(e,d[e]);this.reset()}addProtocol(e,t){this._protocols[e]=t}addEncoding(e,t){this._encodings[e]=t}get activeProtocol(){return this._activeProtocol}get areMouseEventsActive(){return this._protocols[this._activeProtocol].events!==0}set activeProtocol(e){if(!this._protocols[e])throw Error(`unknown protocol "${e}"`);this._activeProtocol=e,this._onProtocolChange.fire(this._protocols[e].events)}get activeEncoding(){return this._activeEncoding}set activeEncoding(e){if(!this._encodings[e])throw Error(`unknown encoding "${e}"`);this._activeEncoding=e}reset(){this.activeProtocol=`NONE`,this.activeEncoding=`DEFAULT`,this._lastEvent=null}triggerMouseEvent(e){if(e.col<0||e.col>=this._bufferService.cols||e.row<0||e.row>=this._bufferService.rows||e.button===4&&e.action===32||e.button===3&&e.action!==32||e.button!==4&&(e.action===2||e.action===3)||(e.col++,e.row++,e.action===32&&this._lastEvent&&this._equalEvents(this._lastEvent,e,this._activeEncoding===`SGR_PIXELS`))||!this._protocols[this._activeProtocol].restrict(e))return!1;let t=this._encodings[this._activeEncoding](e);return t&&(this._activeEncoding===`DEFAULT`?this._coreService.triggerBinaryEvent(t):this._coreService.triggerDataEvent(t,!0)),this._lastEvent=e,!0}explainEvents(e){return{down:!!(1&e),up:!!(2&e),drag:!!(4&e),move:!!(8&e),wheel:!!(16&e)}}_equalEvents(e,t,n){if(n){if(e.x!==t.x||e.y!==t.y)return!1}else if(e.col!==t.col||e.row!==t.row)return!1;return e.button===t.button&&e.action===t.action&&e.ctrl===t.ctrl&&e.alt===t.alt&&e.shift===t.shift}};t.CoreMouseService=f=r([i(0,a.IBufferService),i(1,a.ICoreService)],f)},6975:function(e,t,n){var r=this&&this.__decorate||function(e,t,n,r){var i,a=arguments.length,o=a<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,n):r;if(typeof Reflect==`object`&&typeof Reflect.decorate==`function`)o=Reflect.decorate(e,t,n,r);else for(var s=e.length-1;s>=0;s--)(i=e[s])&&(o=(a<3?i(o):a>3?i(t,n,o):i(t,n))||o);return a>3&&o&&Object.defineProperty(t,n,o),o},i=this&&this.__param||function(e,t){return function(n,r){t(n,r,e)}};Object.defineProperty(t,"__esModule",{value:!0}),t.CoreService=void 0;let a=n(1439),o=n(8460),s=n(844),c=n(2585),l=Object.freeze({insertMode:!1}),u=Object.freeze({applicationCursorKeys:!1,applicationKeypad:!1,bracketedPasteMode:!1,origin:!1,reverseWraparound:!1,sendFocus:!1,wraparound:!0}),d=t.CoreService=class extends s.Disposable{constructor(e,t,n){super(),this._bufferService=e,this._logService=t,this._optionsService=n,this.isCursorInitialized=!1,this.isCursorHidden=!1,this._onData=this.register(new o.EventEmitter),this.onData=this._onData.event,this._onUserInput=this.register(new o.EventEmitter),this.onUserInput=this._onUserInput.event,this._onBinary=this.register(new o.EventEmitter),this.onBinary=this._onBinary.event,this._onRequestScrollToBottom=this.register(new o.EventEmitter),this.onRequestScrollToBottom=this._onRequestScrollToBottom.event,this.modes=(0,a.clone)(l),this.decPrivateModes=(0,a.clone)(u)}reset(){this.modes=(0,a.clone)(l),this.decPrivateModes=(0,a.clone)(u)}triggerDataEvent(e,t=!1){if(this._optionsService.rawOptions.disableStdin)return;let n=this._bufferService.buffer;t&&this._optionsService.rawOptions.scrollOnUserInput&&n.ybase!==n.ydisp&&this._onRequestScrollToBottom.fire(),t&&this._onUserInput.fire(),this._logService.debug(`sending data "${e}"`,(()=>e.split(``).map((e=>e.charCodeAt(0))))),this._onData.fire(e)}triggerBinaryEvent(e){this._optionsService.rawOptions.disableStdin||(this._logService.debug(`sending binary "${e}"`,(()=>e.split(``).map((e=>e.charCodeAt(0))))),this._onBinary.fire(e))}};t.CoreService=d=r([i(0,c.IBufferService),i(1,c.ILogService),i(2,c.IOptionsService)],d)},9074:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.DecorationService=void 0;let r=n(8055),i=n(8460),a=n(844),o=n(6106),s=0,c=0;class l extends a.Disposable{get decorations(){return this._decorations.values()}constructor(){super(),this._decorations=new o.SortedList((e=>e?.marker.line)),this._onDecorationRegistered=this.register(new i.EventEmitter),this.onDecorationRegistered=this._onDecorationRegistered.event,this._onDecorationRemoved=this.register(new i.EventEmitter),this.onDecorationRemoved=this._onDecorationRemoved.event,this.register((0,a.toDisposable)((()=>this.reset())))}registerDecoration(e){if(e.marker.isDisposed)return;let t=new u(e);if(t){let e=t.marker.onDispose((()=>t.dispose()));t.onDispose((()=>{t&&(this._decorations.delete(t)&&this._onDecorationRemoved.fire(t),e.dispose())})),this._decorations.insert(t),this._onDecorationRegistered.fire(t)}return t}reset(){for(let e of this._decorations.values())e.dispose();this._decorations.clear()}*getDecorationsAtCell(e,t,n){let r=0,i=0;for(let a of this._decorations.getKeyIterator(t))r=a.options.x??0,i=r+(a.options.width??1),e>=r&&e{s=t.options.x??0,c=s+(t.options.width??1),e>=s&&e{Object.defineProperty(t,"__esModule",{value:!0}),t.InstantiationService=t.ServiceCollection=void 0;let r=n(2585),i=n(8343);class a{constructor(...e){this._entries=new Map;for(let[t,n]of e)this.set(t,n)}set(e,t){let n=this._entries.get(e);return this._entries.set(e,t),n}forEach(e){for(let[t,n]of this._entries.entries())e(t,n)}has(e){return this._entries.has(e)}get(e){return this._entries.get(e)}}t.ServiceCollection=a,t.InstantiationService=class{constructor(){this._services=new a,this._services.set(r.IInstantiationService,this)}setService(e,t){this._services.set(e,t)}getService(e){return this._services.get(e)}createInstance(e,...t){let n=(0,i.getServiceDependencies)(e).sort(((e,t)=>e.index-t.index)),r=[];for(let t of n){let n=this._services.get(t.id);if(!n)throw Error(`[createInstance] ${e.name} depends on UNKNOWN service ${t.id}.`);r.push(n)}let a=n.length>0?n[0].index:t.length;if(t.length!==a)throw Error(`[createInstance] First service dependency of ${e.name} at position ${a+1} conflicts with ${t.length} static arguments`);return new e(...t,...r)}}},7866:function(e,t,n){var r=this&&this.__decorate||function(e,t,n,r){var i,a=arguments.length,o=a<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,n):r;if(typeof Reflect==`object`&&typeof Reflect.decorate==`function`)o=Reflect.decorate(e,t,n,r);else for(var s=e.length-1;s>=0;s--)(i=e[s])&&(o=(a<3?i(o):a>3?i(t,n,o):i(t,n))||o);return a>3&&o&&Object.defineProperty(t,n,o),o},i=this&&this.__param||function(e,t){return function(n,r){t(n,r,e)}};Object.defineProperty(t,"__esModule",{value:!0}),t.traceCall=t.setTraceLogger=t.LogService=void 0;let a=n(844),o=n(2585),s={trace:o.LogLevelEnum.TRACE,debug:o.LogLevelEnum.DEBUG,info:o.LogLevelEnum.INFO,warn:o.LogLevelEnum.WARN,error:o.LogLevelEnum.ERROR,off:o.LogLevelEnum.OFF},c,l=t.LogService=class extends a.Disposable{get logLevel(){return this._logLevel}constructor(e){super(),this._optionsService=e,this._logLevel=o.LogLevelEnum.OFF,this._updateLogLevel(),this.register(this._optionsService.onSpecificOptionChange(`logLevel`,(()=>this._updateLogLevel()))),c=this}_updateLogLevel(){this._logLevel=s[this._optionsService.rawOptions.logLevel]}_evalLazyOptionalParams(e){for(let t=0;tJSON.stringify(e))).join(`, `)})`);let t=r.apply(this,e);return c.trace(`GlyphRenderer#${r.name} return`,t),t}}},7302:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.OptionsService=t.DEFAULT_OPTIONS=void 0;let r=n(8460),i=n(844);t.DEFAULT_OPTIONS={cols:80,rows:24,cursorBlink:!1,cursorStyle:`block`,cursorWidth:1,cursorInactiveStyle:`outline`,customGlyphs:!0,drawBoldTextInBrightColors:!0,documentOverride:null,fastScrollModifier:`alt`,fastScrollSensitivity:5,fontFamily:`courier-new, courier, monospace`,fontSize:15,fontWeight:`normal`,fontWeightBold:`bold`,ignoreBracketedPasteMode:!1,lineHeight:1,letterSpacing:0,linkHandler:null,logLevel:`info`,logger:null,scrollback:1e3,scrollOnUserInput:!0,scrollSensitivity:1,screenReaderMode:!1,smoothScrollDuration:0,macOptionIsMeta:!1,macOptionClickForcesSelection:!1,minimumContrastRatio:1,disableStdin:!1,allowProposedApi:!1,allowTransparency:!1,tabStopWidth:8,theme:{},rescaleOverlappingGlyphs:!1,rightClickSelectsWord:n(6114).isMac,windowOptions:{},windowsMode:!1,windowsPty:{},wordSeparator:` ()[]{}',"\``,altClickMovesCursor:!0,convertEol:!1,termName:`xterm`,cancelEvents:!1,overviewRulerWidth:0};let a=[`normal`,`bold`,`100`,`200`,`300`,`400`,`500`,`600`,`700`,`800`,`900`];class o extends i.Disposable{constructor(e){super(),this._onOptionChange=this.register(new r.EventEmitter),this.onOptionChange=this._onOptionChange.event;let n={...t.DEFAULT_OPTIONS};for(let t in e)if(t in n)try{let r=e[t];n[t]=this._sanitizeAndValidateOption(t,r)}catch(e){console.error(e)}this.rawOptions=n,this.options={...n},this._setupOptions(),this.register((0,i.toDisposable)((()=>{this.rawOptions.linkHandler=null,this.rawOptions.documentOverride=null})))}onSpecificOptionChange(e,t){return this.onOptionChange((n=>{n===e&&t(this.rawOptions[e])}))}onMultipleOptionChange(e,t){return this.onOptionChange((n=>{e.indexOf(n)!==-1&&t()}))}_setupOptions(){let e=e=>{if(!(e in t.DEFAULT_OPTIONS))throw Error(`No option with key "${e}"`);return this.rawOptions[e]},n=(e,n)=>{if(!(e in t.DEFAULT_OPTIONS))throw Error(`No option with key "${e}"`);n=this._sanitizeAndValidateOption(e,n),this.rawOptions[e]!==n&&(this.rawOptions[e]=n,this._onOptionChange.fire(e))};for(let t in this.rawOptions){let r={get:e.bind(this,t),set:n.bind(this,t)};Object.defineProperty(this.options,t,r)}}_sanitizeAndValidateOption(e,n){switch(e){case`cursorStyle`:if(n||=t.DEFAULT_OPTIONS[e],!function(e){return e===`block`||e===`underline`||e===`bar`}(n))throw Error(`"${n}" is not a valid value for ${e}`);break;case`wordSeparator`:n||=t.DEFAULT_OPTIONS[e];break;case`fontWeight`:case`fontWeightBold`:if(typeof n==`number`&&1<=n&&n<=1e3)break;n=a.includes(n)?n:t.DEFAULT_OPTIONS[e];break;case`cursorWidth`:n=Math.floor(n);case`lineHeight`:case`tabStopWidth`:if(n<1)throw Error(`${e} cannot be less than 1, value: ${n}`);break;case`minimumContrastRatio`:n=Math.max(1,Math.min(21,Math.round(10*n)/10));break;case`scrollback`:if((n=Math.min(n,4294967295))<0)throw Error(`${e} cannot be less than 0, value: ${n}`);break;case`fastScrollSensitivity`:case`scrollSensitivity`:if(n<=0)throw Error(`${e} cannot be less than or equal to 0, value: ${n}`);break;case`rows`:case`cols`:if(!n&&n!==0)throw Error(`${e} must be numeric, value: ${n}`);break;case`windowsPty`:n??={}}return n}}t.OptionsService=o},2660:function(e,t,n){var r=this&&this.__decorate||function(e,t,n,r){var i,a=arguments.length,o=a<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,n):r;if(typeof Reflect==`object`&&typeof Reflect.decorate==`function`)o=Reflect.decorate(e,t,n,r);else for(var s=e.length-1;s>=0;s--)(i=e[s])&&(o=(a<3?i(o):a>3?i(t,n,o):i(t,n))||o);return a>3&&o&&Object.defineProperty(t,n,o),o},i=this&&this.__param||function(e,t){return function(n,r){t(n,r,e)}};Object.defineProperty(t,"__esModule",{value:!0}),t.OscLinkService=void 0;let a=n(2585),o=t.OscLinkService=class{constructor(e){this._bufferService=e,this._nextId=1,this._entriesWithId=new Map,this._dataByLinkId=new Map}registerLink(e){let t=this._bufferService.buffer;if(e.id===void 0){let n=t.addMarker(t.ybase+t.y),r={data:e,id:this._nextId++,lines:[n]};return n.onDispose((()=>this._removeMarkerFromLink(r,n))),this._dataByLinkId.set(r.id,r),r.id}let n=e,r=this._getEntryIdKey(n),i=this._entriesWithId.get(r);if(i)return this.addLineToLink(i.id,t.ybase+t.y),i.id;let a=t.addMarker(t.ybase+t.y),o={id:this._nextId++,key:this._getEntryIdKey(n),data:n,lines:[a]};return a.onDispose((()=>this._removeMarkerFromLink(o,a))),this._entriesWithId.set(o.key,o),this._dataByLinkId.set(o.id,o),o.id}addLineToLink(e,t){let n=this._dataByLinkId.get(e);if(n&&n.lines.every((e=>e.line!==t))){let e=this._bufferService.buffer.addMarker(t);n.lines.push(e),e.onDispose((()=>this._removeMarkerFromLink(n,e)))}}getLinkData(e){return this._dataByLinkId.get(e)?.data}_getEntryIdKey(e){return`${e.id};;${e.uri}`}_removeMarkerFromLink(e,t){let n=e.lines.indexOf(t);n!==-1&&(e.lines.splice(n,1),e.lines.length===0&&(e.data.id!==void 0&&this._entriesWithId.delete(e.key),this._dataByLinkId.delete(e.id)))}};t.OscLinkService=o=r([i(0,a.IBufferService)],o)},8343:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.createDecorator=t.getServiceDependencies=t.serviceRegistry=void 0;let n=`di$target`,r=`di$dependencies`;t.serviceRegistry=new Map,t.getServiceDependencies=function(e){return e[r]||[]},t.createDecorator=function(e){if(t.serviceRegistry.has(e))return t.serviceRegistry.get(e);let i=function(e,t,a){if(arguments.length!==3)throw Error(`@IServiceName-decorator can only be used to decorate a parameter`);(function(e,t,i){t[n]===t?t[r].push({id:e,index:i}):(t[r]=[{id:e,index:i}],t[n]=t)})(i,e,a)};return i.toString=()=>e,t.serviceRegistry.set(e,i),i}},2585:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.IDecorationService=t.IUnicodeService=t.IOscLinkService=t.IOptionsService=t.ILogService=t.LogLevelEnum=t.IInstantiationService=t.ICharsetService=t.ICoreService=t.ICoreMouseService=t.IBufferService=void 0;let r=n(8343);var i;t.IBufferService=(0,r.createDecorator)(`BufferService`),t.ICoreMouseService=(0,r.createDecorator)(`CoreMouseService`),t.ICoreService=(0,r.createDecorator)(`CoreService`),t.ICharsetService=(0,r.createDecorator)(`CharsetService`),t.IInstantiationService=(0,r.createDecorator)(`InstantiationService`),function(e){e[e.TRACE=0]=`TRACE`,e[e.DEBUG=1]=`DEBUG`,e[e.INFO=2]=`INFO`,e[e.WARN=3]=`WARN`,e[e.ERROR=4]=`ERROR`,e[e.OFF=5]=`OFF`}(i||(t.LogLevelEnum=i={})),t.ILogService=(0,r.createDecorator)(`LogService`),t.IOptionsService=(0,r.createDecorator)(`OptionsService`),t.IOscLinkService=(0,r.createDecorator)(`OscLinkService`),t.IUnicodeService=(0,r.createDecorator)(`UnicodeService`),t.IDecorationService=(0,r.createDecorator)(`DecorationService`)},1480:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.UnicodeService=void 0;let r=n(8460),i=n(225);class a{static extractShouldJoin(e){return(1&e)!=0}static extractWidth(e){return e>>1&3}static extractCharKind(e){return e>>3}static createPropertyValue(e,t,n=!1){return(16777215&e)<<3|(3&t)<<1|!!n}constructor(){this._providers=Object.create(null),this._active=``,this._onChange=new r.EventEmitter,this.onChange=this._onChange.event;let e=new i.UnicodeV6;this.register(e),this._active=e.version,this._activeProvider=e}dispose(){this._onChange.dispose()}get versions(){return Object.keys(this._providers)}get activeVersion(){return this._active}set activeVersion(e){if(!this._providers[e])throw Error(`unknown Unicode version "${e}"`);this._active=e,this._activeProvider=this._providers[e],this._onChange.fire(e)}register(e){this._providers[e.version]=e}wcwidth(e){return this._activeProvider.wcwidth(e)}getStringCellWidth(e){let t=0,n=0,r=e.length;for(let i=0;i=r)return t+this.wcwidth(o);let n=e.charCodeAt(i);56320<=n&&n<=57343?o=1024*(o-55296)+n-56320+65536:t+=this.wcwidth(n)}let s=this.charProperties(o,n),c=a.extractWidth(s);a.extractShouldJoin(s)&&(c-=a.extractWidth(n)),t+=c,n=s}return t}charProperties(e,t){return this._activeProvider.charProperties(e,t)}}t.UnicodeService=a}},t={};function n(r){var i=t[r];if(i!==void 0)return i.exports;var a=t[r]={exports:{}};return e[r].call(a.exports,a,a.exports,n),a.exports}var r={};return(()=>{var e=r;Object.defineProperty(e,"__esModule",{value:!0}),e.Terminal=void 0;let t=n(9042),i=n(3236),a=n(844),o=n(5741),s=n(8285),c=n(7975),l=n(7090),u=[`cols`,`rows`];class d extends a.Disposable{constructor(e){super(),this._core=this.register(new i.Terminal(e)),this._addonManager=this.register(new o.AddonManager),this._publicOptions={...this._core.options};let t=e=>this._core.options[e],n=(e,t)=>{this._checkReadonlyOptions(e),this._core.options[e]=t};for(let e in this._core.options){let r={get:t.bind(this,e),set:n.bind(this,e)};Object.defineProperty(this._publicOptions,e,r)}}_checkReadonlyOptions(e){if(u.includes(e))throw Error(`Option "${e}" can only be set in the constructor`)}_checkProposedApi(){if(!this._core.optionsService.rawOptions.allowProposedApi)throw Error(`You must set the allowProposedApi option to true to use proposed API`)}get onBell(){return this._core.onBell}get onBinary(){return this._core.onBinary}get onCursorMove(){return this._core.onCursorMove}get onData(){return this._core.onData}get onKey(){return this._core.onKey}get onLineFeed(){return this._core.onLineFeed}get onRender(){return this._core.onRender}get onResize(){return this._core.onResize}get onScroll(){return this._core.onScroll}get onSelectionChange(){return this._core.onSelectionChange}get onTitleChange(){return this._core.onTitleChange}get onWriteParsed(){return this._core.onWriteParsed}get element(){return this._core.element}get parser(){return this._parser||=new c.ParserApi(this._core),this._parser}get unicode(){return this._checkProposedApi(),new l.UnicodeApi(this._core)}get textarea(){return this._core.textarea}get rows(){return this._core.rows}get cols(){return this._core.cols}get buffer(){return this._buffer||=this.register(new s.BufferNamespaceApi(this._core)),this._buffer}get markers(){return this._checkProposedApi(),this._core.markers}get modes(){let e=this._core.coreService.decPrivateModes,t=`none`;switch(this._core.coreMouseService.activeProtocol){case`X10`:t=`x10`;break;case`VT200`:t=`vt200`;break;case`DRAG`:t=`drag`;break;case`ANY`:t=`any`}return{applicationCursorKeysMode:e.applicationCursorKeys,applicationKeypadMode:e.applicationKeypad,bracketedPasteMode:e.bracketedPasteMode,insertMode:this._core.coreService.modes.insertMode,mouseTrackingMode:t,originMode:e.origin,reverseWraparoundMode:e.reverseWraparound,sendFocusMode:e.sendFocus,wraparoundMode:e.wraparound}}get options(){return this._publicOptions}set options(e){for(let t in e)this._publicOptions[t]=e[t]}blur(){this._core.blur()}focus(){this._core.focus()}input(e,t=!0){this._core.input(e,t)}resize(e,t){this._verifyIntegers(e,t),this._core.resize(e,t)}open(e){this._core.open(e)}attachCustomKeyEventHandler(e){this._core.attachCustomKeyEventHandler(e)}attachCustomWheelEventHandler(e){this._core.attachCustomWheelEventHandler(e)}registerLinkProvider(e){return this._core.registerLinkProvider(e)}registerCharacterJoiner(e){return this._checkProposedApi(),this._core.registerCharacterJoiner(e)}deregisterCharacterJoiner(e){this._checkProposedApi(),this._core.deregisterCharacterJoiner(e)}registerMarker(e=0){return this._verifyIntegers(e),this._core.registerMarker(e)}registerDecoration(e){return this._checkProposedApi(),this._verifyPositiveIntegers(e.x??0,e.width??0,e.height??0),this._core.registerDecoration(e)}hasSelection(){return this._core.hasSelection()}select(e,t,n){this._verifyIntegers(e,t,n),this._core.select(e,t,n)}getSelection(){return this._core.getSelection()}getSelectionPosition(){return this._core.getSelectionPosition()}clearSelection(){this._core.clearSelection()}selectAll(){this._core.selectAll()}selectLines(e,t){this._verifyIntegers(e,t),this._core.selectLines(e,t)}dispose(){super.dispose()}scrollLines(e){this._verifyIntegers(e),this._core.scrollLines(e)}scrollPages(e){this._verifyIntegers(e),this._core.scrollPages(e)}scrollToTop(){this._core.scrollToTop()}scrollToBottom(){this._core.scrollToBottom()}scrollToLine(e){this._verifyIntegers(e),this._core.scrollToLine(e)}clear(){this._core.clear()}write(e,t){this._core.write(e,t)}writeln(e,t){this._core.write(e),this._core.write(`\r +`,t)}paste(e){this._core.paste(e)}refresh(e,t){this._verifyIntegers(e,t),this._core.refresh(e,t)}reset(){this._core.reset()}clearTextureAtlas(){this._core.clearTextureAtlas()}loadAddon(e){this._addonManager.loadAddon(this,e)}static get strings(){return t}_verifyIntegers(...e){for(let t of e)if(t===1/0||isNaN(t)||t%1!=0)throw Error(`This API only accepts integers`)}_verifyPositiveIntegers(...e){for(let t of e)if(t&&(t===1/0||isNaN(t)||t%1!=0||t<0))throw Error(`This API only accepts positive integers`)}}e.Terminal=d})(),r})()))})),Hv=s(((e,t)=>{(function(n,r){typeof e==`object`&&typeof t==`object`?t.exports=r():typeof define==`function`&&define.amd?define([],r):typeof e==`object`?e.FitAddon=r():n.FitAddon=r()})(self,(()=>(()=>{var e={};return(()=>{var t=e;Object.defineProperty(t,"__esModule",{value:!0}),t.FitAddon=void 0,t.FitAddon=class{activate(e){this._terminal=e}dispose(){}fit(){let e=this.proposeDimensions();if(!e||!this._terminal||isNaN(e.cols)||isNaN(e.rows))return;let t=this._terminal._core;this._terminal.rows===e.rows&&this._terminal.cols===e.cols||(t._renderService.clear(),this._terminal.resize(e.cols,e.rows))}proposeDimensions(){if(!this._terminal||!this._terminal.element||!this._terminal.element.parentElement)return;let e=this._terminal._core,t=e._renderService.dimensions;if(t.css.cell.width===0||t.css.cell.height===0)return;let n=this._terminal.options.scrollback===0?0:e.viewport.scrollBarWidth,r=window.getComputedStyle(this._terminal.element.parentElement),i=parseInt(r.getPropertyValue(`height`)),a=Math.max(0,parseInt(r.getPropertyValue(`width`))),o=window.getComputedStyle(this._terminal.element),s=i-(parseInt(o.getPropertyValue(`padding-top`))+parseInt(o.getPropertyValue(`padding-bottom`))),c=a-(parseInt(o.getPropertyValue(`padding-right`))+parseInt(o.getPropertyValue(`padding-left`)))-n;return{cols:Math.max(2,Math.floor(c/t.css.cell.width)),rows:Math.max(1,Math.floor(s/t.css.cell.height))}}}})(),e})()))})),Uv=Vv(),Wv=Hv();function Gv(){try{return localStorage.getItem(`edge_token`)||sessionStorage.getItem(`edge_token`)||``}catch{return``}}function Kv({appId:e,app:t}){let[n,r]=(0,b.useState)(`connecting`),[i,a]=(0,b.useState)(``),o=(0,b.useRef)(null),s=(0,b.useRef)(null),c=(0,b.useRef)(null),l=(0,b.useRef)(null),u=t?.state===`running`||t?.status===`Running`;return(0,b.useEffect)(()=>{if(!e||!u){r(`disabled`);return}let t=Gv();if(!t){r(`error`),a(`未登录或 token 缺失`);return}let n=new Uv.Terminal({cursorBlink:!0,fontFamily:`ui-monospace, "SF Mono", Menlo, Consolas, monospace`,fontSize:13,theme:{background:`#0b1220`,foreground:`#e2e8f0`,cursor:`#60a5fa`,selectionBackground:`rgba(96,165,250,0.32)`},scrollback:5e3,convertEol:!1}),i=new Wv.FitAddon;n.loadAddon(i),s.current=n,c.current=i,o.current&&(n.open(o.current),requestAnimationFrame(()=>{try{i.fit()}catch{}}));let d=`${window.location.protocol===`https:`?`wss:`:`ws:`}//${window.location.host}/api/v1/pod-shell/${encodeURIComponent(e)}?access_token=${encodeURIComponent(t)}`,f=new WebSocket(d);f.binaryType=`arraybuffer`,l.current=f,f.onopen=()=>{r(`open`),n.focus(),m()},f.onclose=()=>{r(`closed`),n.write(`\r +\x1B[33m[连接已断开]\x1B[0m\r +`)},f.onerror=()=>{r(`error`),a(`WebSocket 连接错误`)},f.onmessage=e=>{if(typeof e.data==`string`){try{let t=JSON.parse(e.data);if(t&&t.error){n.write(`\r\n\x1b[31m[错误] ${t.error}\x1b[0m\r\n`);return}}catch{}n.write(e.data)}else e.data instanceof ArrayBuffer&&n.write(new Uint8Array(e.data))};let p=n.onData(e=>{f.readyState===WebSocket.OPEN&&f.send(new TextEncoder().encode(e))});function m(){if(f.readyState!==WebSocket.OPEN)return;let e=JSON.stringify({type:`resize`,cols:n.cols,rows:n.rows});f.send(e)}let h=n.onResize(()=>m()),g=()=>{try{i.fit()}catch{}};window.addEventListener(`resize`,g);let _=null;return typeof ResizeObserver<`u`&&o.current&&(_=new ResizeObserver(()=>{try{i.fit()}catch{}}),_.observe(o.current)),()=>{try{p.dispose()}catch{}try{h.dispose()}catch{}window.removeEventListener(`resize`,g),_&&_.disconnect();try{f.close()}catch{}try{n.dispose()}catch{}l.current=null,s.current=null,c.current=null}},[e,u]),(0,w.jsxs)(`div`,{"data-shortcut-scope":`terminal`,style:{display:`flex`,flexDirection:`column`,height:`100%`,background:`#0b1220`,overflow:`hidden`},children:[(0,w.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,gap:8,padding:`8px 12px`,borderBottom:`1px solid ${S.ink2}`,background:`#0f172a`,flexShrink:0},children:[(0,w.jsx)(D,{name:`terminal`,size:14,stroke:1.8,style:{color:`#60a5fa`}}),(0,w.jsxs)(`span`,{style:{fontSize:11,color:`#94a3b8`,fontFamily:`ui-monospace, monospace`},children:[`容器 Shell · `,e]}),(0,w.jsx)(`span`,{style:{flex:1}}),(0,w.jsx)(`span`,{style:{padding:`1px 6px`,borderRadius:3,fontSize:10,background:n===`open`?`#065f46`:n===`connecting`?`#854d0e`:n===`disabled`?`#374151`:`#7f1d1d`,color:`#f8fafc`},children:n===`open`?`已连接`:n===`connecting`?`连接中...`:n===`closed`?`已断开`:n===`disabled`?`应用未运行`:`错误`})]}),(0,w.jsxs)(`div`,{style:{flex:1,position:`relative`,overflow:`hidden`,padding:8},children:[n===`disabled`&&(0,w.jsx)(`div`,{style:{color:`#94a3b8`,fontSize:12.5,padding:12,fontFamily:`ui-monospace, monospace`},children:`应用未运行,无法打开容器 Shell(应用 status = Running 时启用)`}),i&&(0,w.jsx)(`div`,{style:{color:`#fca5a5`,fontSize:12.5,padding:12,fontFamily:`ui-monospace, monospace`},children:i}),(0,w.jsx)(`div`,{ref:o,style:{width:`100%`,height:`100%`,display:n===`disabled`||i?`none`:`block`}})]})]})}function qv({label:e,value:t,tone:n,mono:r}){return(0,w.jsxs)(`div`,{style:{padding:`8px 10px`,borderRadius:7,background:S.surfaceAlt,border:`1px solid ${S.borderSoft}`},children:[(0,w.jsx)(`div`,{style:{...S.type.label,color:S.ink3},children:e}),(0,w.jsx)(`div`,{className:r===!1?``:`mono tnum`,style:{marginTop:4,...S.type.heading,color:n},children:t})]})}function Jv(e){if(!e)return`—`;let t=Date.now(),n=new Date(e).getTime();if(isNaN(n))return`—`;let r=Math.max(0,t-n),i=Math.floor(r/864e5),a=Math.floor(r%864e5/36e5),o=Math.floor(r%36e5/6e4);return i>0?`${i}天 ${a}h`:a>0?`${a}h ${o}m`:`${o}m`}function Yv(e){if(!e)return`—`;let t=e.replace(/^(docker|containerd):\/\//,``);return t.length>12?t.slice(0,12):t}function Xv({app:e,cpu:t,gpu:n}){let r=e.state===`error`,i=e.startedAt||e.createdAt,a=r?`已停止`:Jv(i),o=e.ports&&e.ports.length>0?e.ports.map(e=>e.hostPort?`${e.hostPort}→${e.containerPort}`:`${e.containerPort}`).join(`, `):`—`,s=e.volumeMounts&&e.volumeMounts.length>0?e.volumeMounts.map(e=>e.hostPath?`${e.hostPath} → ${e.mountPath}`:e.mountPath).join(`; `):`—`;return(0,w.jsxs)(`div`,{style:{padding:`14px 18px 18px`},children:[(0,w.jsxs)(`div`,{style:{display:`grid`,gridTemplateColumns:`1fr 1fr`,gap:8,marginBottom:14},children:[(0,w.jsx)(qv,{label:`CPU`,value:`${t.toFixed(0)}%`,tone:S.blue}),(0,w.jsx)(qv,{label:`GPU`,value:r?`—`:`${n.toFixed(0)}%`,tone:r?S.ink4:S.indigo}),(0,w.jsx)(qv,{label:`运行时长`,value:a,tone:r?S.red:S.green,mono:!r}),(0,w.jsx)(qv,{label:`重启次数`,value:`${e.restartCount||0}`,tone:e.restartCount>0?S.amber:S.green})]}),(0,w.jsx)(`div`,{style:{background:S.surfaceAlt,border:`1px solid ${S.borderSoft}`,borderRadius:8,overflow:`hidden`},children:[[`镜像`,(0,w.jsx)(`span`,{className:`mono`,style:{fontSize:11},children:e.image||e.desc||`—`})],[`容器 ID`,(0,w.jsx)(`span`,{className:`mono`,style:{fontSize:11},children:Yv(e.containerID)})],[`GPU`,e.gpu||`CPU`],[`部署时间`,(0,w.jsx)(`span`,{className:`mono`,style:{fontSize:11},children:e.deployedAt||`—`})],[`端口`,(0,w.jsx)(`span`,{className:`mono`,style:{fontSize:11},children:o})],[`挂载`,(0,w.jsx)(`span`,{className:`mono`,style:{fontSize:11,wordBreak:`break-all`},children:s})],[`重启策略`,e.restartPolicy||`—`]].map(([e,t],n)=>(0,w.jsxs)(`div`,{style:{display:`flex`,padding:`8px 12px`,borderTop:n?`1px solid ${S.borderSoft}`:`none`,fontSize:12},children:[(0,w.jsx)(`span`,{style:{width:80,color:S.ink3,flexShrink:0},children:e}),(0,w.jsx)(`span`,{style:{color:S.ink,fontWeight:500,flex:1},children:t})]},e))}),(e.cpuLimit||e.memLimit)&&(0,w.jsxs)(`div`,{style:{marginTop:14},children:[(0,w.jsx)(`div`,{style:{...S.type.label,color:S.ink3,marginBottom:6},children:`资源配额`}),(0,w.jsx)(`div`,{style:{background:S.surfaceAlt,border:`1px solid ${S.borderSoft}`,borderRadius:8,overflow:`hidden`},children:[e.cpuRequest||e.cpuLimit?[`CPU`,`${e.cpuRequest||`—`} / ${e.cpuLimit||`—`}`]:null,e.memRequest||e.memLimit?[`内存`,`${e.memRequest||`—`} / ${e.memLimit||`—`}`]:null].filter(Boolean).map(([e,t],n)=>(0,w.jsxs)(`div`,{style:{display:`flex`,padding:`8px 12px`,borderTop:n?`1px solid ${S.borderSoft}`:`none`,fontSize:12},children:[(0,w.jsx)(`span`,{style:{width:80,color:S.ink3,flexShrink:0},children:e}),(0,w.jsx)(`span`,{className:`mono`,style:{color:S.ink,fontWeight:500,flex:1,fontSize:11},children:t})]},e))})]}),(0,w.jsxs)(`div`,{style:{marginTop:14},children:[(0,w.jsx)(`div`,{style:{fontSize:10.5,color:S.ink3,fontWeight:600,letterSpacing:`0.04em`,textTransform:`uppercase`,marginBottom:6},children:`当前状态`}),(0,w.jsxs)(`div`,{style:{padding:`8px 12px`,borderRadius:7,background:r?`#fef2f2`:`#f0fdf4`,border:`1px solid ${r?`#fecaca`:`#bbf7d0`}`,fontSize:12,fontWeight:500,color:r?`#b91c1c`:`#166534`,display:`flex`,alignItems:`center`,gap:6},children:[(0,w.jsx)(q,{tone:r?`red`:`green`,size:7,pulse:r}),r?`运行异常`:`运行正常`,` · `,e.ready||0,`/`,e.replicas||1,` Pod 就绪`]})]})]})}function Zv({open:e,onToggle:t,icon:n,title:r,valueLabel:i,series:a,max:o,timeLabels:s,color:c,avg:l,peak:u,emptyHint:d}){let f=`mgrad-`+(0,b.useId)().replaceAll(`:`,``),p=(0,b.useRef)(null),[m,h]=(0,b.useState)(358);(0,b.useEffect)(()=>{if(!e||!p.current)return;let t=p.current,n=()=>{h(Math.max(120,Math.floor(t.clientWidth)))};n();let r=new ResizeObserver(n);return r.observe(t),()=>r.disconnect()},[e]);let g=m-32-6,_=a||[],v=g/Math.max(1,_.length-1),y=_.map((e,t)=>[32+t*v,78-Math.min(o,e)/o*70]),x=y.map((e,t)=>`${t?`L`:`M`}${e[0].toFixed(1)} ${e[1].toFixed(1)}`).join(` `),C=y.length?`${x} L ${y[y.length-1][0].toFixed(1)} 78 L ${y[0][0].toFixed(1)} 78 Z`:``,T=[0,.25,.5,.75,1].map(e=>e*o),E=e=>o<=1||o<=10?e.toFixed(2):e.toFixed(0);return(0,w.jsxs)(`div`,{style:{marginBottom:8,background:`white`,border:`1px solid ${S.border}`,borderRadius:7,overflow:`hidden`},children:[(0,w.jsxs)(`div`,{onClick:t,style:{display:`flex`,alignItems:`center`,gap:6,padding:`7px 10px 7px 8px`,cursor:`pointer`,background:e?`#fcfdfe`:S.surfaceAlt,borderBottom:e?`1px solid ${S.borderSoft}`:`none`},children:[(0,w.jsx)(D,{name:`chevDown`,size:11,stroke:2.2,style:{color:S.ink3,transform:e?`none`:`rotate(-90deg)`,transition:`transform 0.15s ease`}}),(0,w.jsx)(D,{name:n,size:12,stroke:1.8,style:{color:S.ink2}}),(0,w.jsx)(`span`,{style:{fontSize:11.5,color:S.ink,fontWeight:600},children:r}),(0,w.jsx)(`div`,{style:{flex:1}}),(0,w.jsx)(`span`,{style:{fontSize:11,color:S.ink2},children:i})]}),e&&(0,w.jsxs)(`div`,{ref:p,style:{padding:`4px 4px 0`},children:[(0,w.jsxs)(`svg`,{width:m,height:96,style:{display:`block`},children:[T.map((e,t)=>{let n=78-e/o*70;return(0,w.jsxs)(`g`,{children:[(0,w.jsx)(`line`,{x1:32,x2:m-6,y1:n,y2:n,stroke:`#eef1f5`,strokeWidth:`1`,strokeDasharray:t===0||t===T.length-1?`0`:`2 3`}),(0,w.jsx)(`text`,{x:28,y:n+3,fontSize:`9`,fill:S.ink4,textAnchor:`end`,className:`mono`,children:E(e)})]},t)}),(0,w.jsx)(`line`,{x1:32,x2:m-6,y1:78,y2:78,stroke:`#e2e8f0`,strokeWidth:`1`}),y.length>0&&(0,w.jsxs)(w.Fragment,{children:[(0,w.jsx)(`defs`,{children:(0,w.jsxs)(`linearGradient`,{id:f,x1:`0`,x2:`0`,y1:`0`,y2:`1`,children:[(0,w.jsx)(`stop`,{offset:`0%`,stopColor:c,stopOpacity:`0.18`}),(0,w.jsx)(`stop`,{offset:`100%`,stopColor:c,stopOpacity:`0.02`})]})}),(0,w.jsx)(`path`,{d:C,fill:`url(#${f})`}),(0,w.jsx)(`path`,{d:x,fill:`none`,stroke:c,strokeWidth:`1.4`,strokeLinejoin:`round`,strokeLinecap:`round`})]}),s.map((e,t)=>(0,w.jsx)(`text`,{x:32+t/(s.length-1)*g,y:92,fontSize:`9`,fill:S.ink4,textAnchor:`middle`,className:`mono`,children:e},t)),d&&(0,w.jsx)(`text`,{x:m/2,y:46,fontSize:`10`,fill:S.ink4,textAnchor:`middle`,children:d})]}),(0,w.jsxs)(`div`,{style:{display:`flex`,gap:14,padding:`4px 10px 8px 32px`,fontSize:10,color:S.ink3},children:[(0,w.jsxs)(`span`,{children:[`平均 `,(0,w.jsx)(`span`,{className:`mono tnum`,style:{color:S.ink2,fontWeight:600},children:l})]}),(0,w.jsxs)(`span`,{children:[`峰值 `,(0,w.jsx)(`span`,{className:`mono tnum`,style:{color:S.ink2,fontWeight:600},children:u})]})]})]})]})}function Qv({app:e,metricsData:t,historyData:n}){let r=e.state===`error`,i=(t.metrics?.gpu?.used||0)>0||n.gpuUtil&&n.gpuUtil.some(e=>e>0),[a,o]=(0,b.useState)({cpu:!0,mem:!0,netRx:!0,netTx:!0,gpuCompute:!0,gpuMem:!0}),s=e=>o(t=>({...t,[e]:!t[e]})),c=n.cpuPercent||[],l=n.memoryPercent||[],u=n.gpuUtil||[],d=n.gpuMemPercent||[],f=(0,b.useMemo)(()=>{let e=n.netBytesSent||[],t=n.timestamps||[];if(e.length<2)return[];let r=[];for(let n=1;n0?Math.round((e[n]-e[n-1])/i/1024):0)}return r},[n.netBytesSent,n.timestamps]),p=(0,b.useMemo)(()=>{let e=n.netBytesRecv||[],t=n.timestamps||[];if(e.length<2)return[];let r=[];for(let n=1;n0?Math.round((e[n]-e[n-1])/i/1024):0)}return r},[n.netBytesRecv,n.timestamps]),m=(0,b.useMemo)(()=>{let e=n.timestamps||[];if(!e.length)return[``,``,``,``,``];let t=Math.max(1,Math.floor((e.length-1)/5)),r=[];for(let n=0;ne&&e.length>0?e:[0],g=e=>{let t=h(e);return t[t.length-1]},_=e=>{let t=h(e);return t.reduce((e,t)=>e+t,0)/t.length};return(0,w.jsxs)(`div`,{style:{padding:`12px 14px 18px`},children:[(0,w.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,gap:6,marginBottom:10},children:[(0,w.jsx)(D,{name:`history`,size:12,stroke:1.8,style:{color:S.ink3}}),(0,w.jsx)(`span`,{style:{fontSize:11.5,color:S.ink2,fontWeight:600},children:`系统监控指标`}),(0,w.jsx)(`span`,{style:{fontSize:10,color:S.ink4},children:`· 5s 刷新`}),(0,w.jsx)(`div`,{style:{flex:1}})]}),(0,w.jsx)(Zv,{open:a.cpu,onToggle:()=>s(`cpu`),icon:`cpu`,title:`CPU 用量 (%)`,valueLabel:(0,w.jsxs)(w.Fragment,{children:[`当前: `,(0,w.jsxs)(`span`,{className:`mono tnum`,children:[g(c).toFixed(1),`%`]})]}),series:c,max:100,unit:`%`,timeLabels:m,color:S.green,avg:_(c).toFixed(1)+`%`,peak:Math.max(...h(c)).toFixed(1)+`%`}),(0,w.jsx)(Zv,{open:a.mem,onToggle:()=>s(`mem`),icon:`memory`,title:`内存用量 (%)`,valueLabel:(0,w.jsxs)(w.Fragment,{children:[`当前: `,(0,w.jsxs)(`span`,{className:`mono tnum`,children:[g(l).toFixed(0),`%`]})]}),series:l,max:100,unit:`%`,timeLabels:m,color:S.green,avg:_(l).toFixed(0)+`%`,peak:Math.max(...h(l)).toFixed(0)+`%`}),(0,w.jsx)(Zv,{open:a.netRx,onToggle:()=>s(`netRx`),icon:`arrowDown`,title:`网络接收 (KB/s)`,valueLabel:(0,w.jsxs)(w.Fragment,{children:[`当前: `,(0,w.jsx)(`span`,{className:`mono tnum`,children:g(p).toFixed(0)}),` KB/s`]}),series:p,max:Math.max(8,Math.max(...h(p))*1.15),unit:``,timeLabels:m,color:S.green,avg:_(p).toFixed(0),peak:Math.max(...h(p)).toFixed(0)}),(0,w.jsx)(Zv,{open:a.netTx,onToggle:()=>s(`netTx`),icon:`arrowUp`,title:`网络发送 (KB/s)`,valueLabel:(0,w.jsxs)(w.Fragment,{children:[`当前: `,(0,w.jsx)(`span`,{className:`mono tnum`,children:g(f).toFixed(0)}),` KB/s`]}),series:f,max:Math.max(8,Math.max(...h(f))*1.15),unit:``,timeLabels:m,color:S.green,avg:_(f).toFixed(0),peak:Math.max(...h(f)).toFixed(0)}),i&&(0,w.jsx)(Zv,{open:a.gpuCompute,onToggle:()=>s(`gpuCompute`),icon:`bolt`,title:`GPU 算力 (%)`,valueLabel:r?(0,w.jsx)(`span`,{style:{color:S.ink4},children:`当前: 无数据`}):(0,w.jsxs)(w.Fragment,{children:[`当前: `,(0,w.jsxs)(`span`,{className:`mono tnum`,children:[g(u).toFixed(1),`%`]})]}),series:u,max:100,unit:`%`,timeLabels:m,color:r?S.ink4:S.green,avg:r?`—`:_(u).toFixed(1)+`%`,peak:r?`—`:Math.max(...h(u)).toFixed(1)+`%`,emptyHint:r?`进程已退出 · 暂无 GPU 采集`:null}),i&&(0,w.jsx)(Zv,{open:a.gpuMem,onToggle:()=>s(`gpuMem`),icon:`memory`,title:`GPU 显存 (%)`,valueLabel:r?(0,w.jsx)(`span`,{style:{color:S.ink4},children:`当前: 无数据`}):(0,w.jsxs)(w.Fragment,{children:[`当前: `,(0,w.jsxs)(`span`,{className:`mono tnum`,children:[g(d).toFixed(0),`%`]})]}),series:d,max:100,unit:`%`,timeLabels:m,color:r?S.ink4:S.green,avg:r?`—`:_(d).toFixed(0)+`%`,peak:r?`—`:Math.max(...h(d)).toFixed(0)+`%`,emptyHint:r?`进程已退出 · 显存已释放`:null})]})}function $v({app:e}){let{lines:t,loading:n}=Ud(e.name,3e3,200),r=(0,b.useRef)(null),[i,a]=(0,b.useState)(!0);return(0,b.useEffect)(()=>{i&&r.current&&(r.current.scrollTop=r.current.scrollHeight)},[t,i]),(0,w.jsxs)(`div`,{style:{padding:14},children:[(0,w.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,gap:8,marginBottom:8},children:[(0,w.jsxs)(J,{tone:`green`,children:[(0,w.jsx)(q,{tone:`green`,size:6,pulse:!0}),`实时日志`]}),(0,w.jsx)(`span`,{style:{fontSize:10,color:S.ink4},children:`3s 刷新 · 最近 200 行`}),(0,w.jsx)(`div`,{style:{flex:1}})]}),(0,w.jsxs)(`div`,{ref:r,onScroll:()=>{if(!r.current)return;let{scrollTop:e,scrollHeight:t,clientHeight:n}=r.current;a(t-e-n<40)},style:{background:`#0b1020`,borderRadius:7,padding:`10px 12px`,height:`calc(100vh - 360px)`,minHeight:280,overflowY:`auto`,fontFamily:`ui-monospace, monospace`,fontSize:11,lineHeight:1.55,color:`#cbd5e1`,border:`1px solid #0f1729`},children:[n&&t.length===0&&(0,w.jsx)(`div`,{style:{color:`#64748b`,padding:`20px 0`,textAlign:`center`},children:`加载日志中…`}),!n&&t.length===0&&(0,w.jsx)(`div`,{style:{color:`#64748b`,padding:`20px 0`,textAlign:`center`},children:`暂无日志`}),t.map((e,t)=>(0,w.jsx)(`div`,{style:{whiteSpace:`pre-wrap`,wordBreak:`break-all`,color:`#e2e8f0`},children:e},t)),(0,w.jsx)(`span`,{className:`edge-cursor`,style:{color:`#34d399`},children:`▍`})]})]})}function ey({app:e,onUninstallClick:t}){let n=e.state===`error`,r={name:e.name||e.id,image:e.image||e.desc||`—`,version:e.version||`latest`,namespace:e.namespace||`—`,nodeName:e.nodeName||`—`,podName:e.podName||`—`,restartPolicy:e.restartPolicy||`—`,ports:(e.ports||[]).map(e=>`${e.containerPort}/${e.protocol||`TCP`}${e.hostPort?` → `+e.hostPort:``}`).join(` + `)||`none`,mounts:(e.volumeMounts||[]).map(e=>`${e.mountPath}${e.hostPath?` ← `+e.hostPath:``}${e.readOnly?` (ro)`:``}`).join(` + `)||`none`,resources:[e.cpuRequest||e.cpuLimit?`cpu: ${e.cpuRequest||`—`}/${e.cpuLimit||`—`}`:null,e.memRequest||e.memLimit?`memory: ${e.memRequest||`—`}/${e.memLimit||`—`}`:null].filter(Boolean).join(`, `)||`—`},i=`name: ${r.name} +image: ${r.image} +version: ${r.version} +namespace: ${r.namespace} +node: ${r.nodeName} +pod: ${r.podName} +restartPolicy: ${r.restartPolicy} +ports: + ${r.ports} +volumeMounts: + ${r.mounts} +resources: ${r.resources}`;return(0,w.jsxs)(`div`,{style:{padding:14},children:[(0,w.jsxs)(`div`,{style:{background:S.surfaceAlt,border:`1px solid ${S.borderSoft}`,borderRadius:8,padding:12,marginBottom:12},children:[(0,w.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,gap:6,marginBottom:10},children:[(0,w.jsx)(D,{name:`apps`,size:13,stroke:1.8,style:{color:S.indigo}}),(0,w.jsx)(`span`,{style:{fontSize:12,fontWeight:700,color:S.ink},children:`Pod 调度状态`}),(0,w.jsx)(`div`,{style:{flex:1}}),(0,w.jsxs)(J,{tone:n?`red`:`green`,children:[(0,w.jsx)(q,{tone:n?`red`:`green`,size:6,pulse:n}),n?`Error`:`Running`]})]}),(0,w.jsx)(`div`,{style:{display:`flex`,flexDirection:`column`,gap:5,fontSize:11.5},children:[[`Pod 名称`,(0,w.jsx)(`span`,{className:`mono`,children:e.podName||`—`})],[`命名空间`,(0,w.jsx)(`span`,{className:`mono`,children:e.namespace||`—`})],[`节点`,(0,w.jsx)(`span`,{className:`mono`,children:e.nodeName||`—`})],[`部署时间`,(0,w.jsx)(`span`,{className:`mono`,children:e.deployedAt||`—`})],[`重启次数`,(0,w.jsx)(`span`,{className:`mono tnum`,children:e.restartCount||0})]].map(([e,t])=>(0,w.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,gap:8},children:[(0,w.jsx)(`span`,{style:{color:S.ink3,width:64,flexShrink:0},children:e}),(0,w.jsx)(`span`,{style:{color:S.ink,fontWeight:500,flex:1},children:t})]},e))})]}),(0,w.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,gap:8,marginBottom:6},children:[(0,w.jsx)(`span`,{style:{fontSize:11.5,color:S.ink3},children:`应用配置摘要`}),(0,w.jsx)(`div`,{style:{flex:1}}),(0,w.jsxs)(`button`,{onClick:()=>navigator.clipboard.writeText(i),className:`edge-press edge-btn-secondary`,style:{...gd,height:24,padding:`0 8px`,fontSize:11},children:[(0,w.jsx)(D,{name:`copy`,size:11,stroke:1.8}),`复制`]})]}),(0,w.jsx)(`pre`,{style:{margin:0,background:`#0b1020`,color:`#cbd5e1`,borderRadius:7,padding:`12px 14px`,border:`1px solid #0f1729`,fontFamily:`ui-monospace, "JetBrains Mono", monospace`,fontSize:11,lineHeight:1.65,whiteSpace:`pre`,overflow:`auto`,maxHeight:360},children:i.split(` +`).map((e,t)=>{let n=e.match(/^(\s*)([\w./-]+)(:.*)$/);return n?(0,w.jsxs)(`div`,{children:[(0,w.jsx)(`span`,{children:n[1]}),(0,w.jsx)(`span`,{style:{color:`#7dd3fc`},children:n[2]}),(0,w.jsx)(`span`,{children:n[3]})]},t):(0,w.jsx)(`div`,{children:e},t)})}),(0,w.jsx)(ay,{values:e.deployValues}),(0,w.jsx)(iy,{env:e.env}),(0,w.jsxs)(`div`,{style:{marginTop:10,padding:10,background:S.blueSoft,border:`1px solid #bfdbfe`,borderRadius:7,fontSize:11.5,color:S.ink2,lineHeight:1.55,display:`flex`,gap:8,alignItems:`flex-start`},children:[(0,w.jsx)(D,{name:`info`,size:13,stroke:1.8,style:{color:S.blueDeep,marginTop:1,flexShrink:0}}),(0,w.jsxs)(`div`,{children:[`本机 Pod 由 `,(0,w.jsx)(`strong`,{children:`云端调度器`}),` 下发,本地无法直接修改。 如需调整资源/端口/挂载,请在云端「应用编排」中重新部署。`]})]}),(0,w.jsxs)(`div`,{style:{marginTop:14,borderRadius:8,border:`1px solid #fecaca`,overflow:`hidden`},children:[(0,w.jsxs)(`div`,{style:{padding:`8px 12px`,background:`#fef2f2`,borderBottom:`1px solid #fecaca`,fontSize:11.5,fontWeight:700,color:`#b91c1c`,letterSpacing:`0.02em`,display:`flex`,alignItems:`center`,gap:6},children:[(0,w.jsx)(D,{name:`alertTri`,size:12,stroke:2}),`危险操作区`]}),(0,w.jsxs)(`div`,{style:{padding:12,background:`white`,display:`flex`,alignItems:`center`,gap:12},children:[(0,w.jsxs)(`div`,{style:{flex:1},children:[(0,w.jsx)(`div`,{style:{fontSize:12.5,color:S.ink,fontWeight:600},children:`卸载应用`}),(0,w.jsxs)(`div`,{style:{fontSize:11,color:S.ink3,marginTop:3,lineHeight:1.5},children:[`立即终止 Pod,释放 GPU 与端口;保留 `,(0,w.jsx)(`span`,{className:`mono`,children:`/workspace`}),` 数据`]})]}),(0,w.jsxs)(`button`,{onClick:t,className:`edge-press edge-btn-danger`,style:{...vd,height:30,padding:`0 12px`,fontSize:11.5,flexShrink:0},children:[(0,w.jsx)(D,{name:`x`,size:12,stroke:2}),`卸载`]})]})]})]})}var ty=/password|pass(?!port)|pwd|token|secret|apikey|api_key|auth/i;function ny(e){return e?ty.test(String(e)):!1}function ry({name:e,value:t,source:n,error:r}){let i=ny(e),[a,o]=(0,b.useState)(!i),s=r?``:i&&!a?`••••••••`:String(t??``);return(0,w.jsxs)(`div`,{style:{display:`grid`,gridTemplateColumns:`160px 1fr auto`,gap:8,padding:`6px 0`,alignItems:`center`,borderTop:`1px solid ${S.borderSoft}`},children:[(0,w.jsxs)(`div`,{style:{fontSize:11.5,color:S.ink2,fontWeight:500,wordBreak:`break-all`},children:[e,n&&(0,w.jsx)(`div`,{style:{display:`inline-block`,marginLeft:6,padding:`0 5px`,borderRadius:3,background:`#dbeafe`,color:`#1e40af`,fontSize:10,fontWeight:500,verticalAlign:`middle`},title:`来自 ${n}`,children:n.split(`:`)[0]})]}),(0,w.jsx)(`div`,{style:{fontFamily:`ui-monospace, "JetBrains Mono", monospace`,fontSize:11.5,color:r?S.red:S.ink,wordBreak:`break-all`,minWidth:0},children:r?(0,w.jsxs)(`span`,{title:r,children:[`⚠ `,r.length>60?r.slice(0,60)+`…`:r]}):s}),(0,w.jsxs)(`div`,{style:{display:`flex`,gap:4,alignItems:`center`},children:[i&&!r&&(0,w.jsx)(`button`,{onClick:()=>o(e=>!e),title:a?`隐藏`:`显示`,style:{border:`none`,background:`transparent`,cursor:`pointer`,padding:3,color:a?S.blue:S.ink4,display:`flex`},children:(0,w.jsx)(D,{name:`eye`,size:13,stroke:1.8})}),!r&&t!=null&&t!==``&&(0,w.jsx)(`button`,{onClick:()=>navigator.clipboard?.writeText(String(t)),title:`复制明文`,style:{border:`none`,background:`transparent`,cursor:`pointer`,padding:3,color:S.ink4,display:`flex`},children:(0,w.jsx)(D,{name:`copy`,size:13,stroke:1.8})})]})]})}function iy({env:e}){return e==null?null:e.length===0?(0,w.jsxs)(`div`,{style:{marginTop:14},children:[(0,w.jsxs)(`div`,{style:{fontSize:11.5,color:S.ink3,marginBottom:6,display:`flex`,alignItems:`center`,gap:6},children:[(0,w.jsx)(D,{name:`key`,size:12,stroke:1.8}),`环境变量 (env)`]}),(0,w.jsx)(`div`,{style:{padding:`10px 12px`,background:S.surfaceAlt,border:`1px solid ${S.borderSoft}`,borderRadius:7,fontSize:11.5,color:S.ink3},children:`该容器未声明任何环境变量`})]}):(0,w.jsxs)(`div`,{style:{marginTop:14},children:[(0,w.jsxs)(`div`,{style:{fontSize:11.5,color:S.ink3,marginBottom:6,display:`flex`,alignItems:`center`,gap:6},children:[(0,w.jsx)(D,{name:`key`,size:12,stroke:1.8}),`环境变量 (env) · `,e.length,` 项`]}),(0,w.jsx)(`div`,{style:{background:S.surface,border:`1px solid ${S.borderSoft}`,borderRadius:7,padding:`0 12px`},children:e.map((e,t)=>(0,w.jsx)(ry,{name:e.name,value:e.value,source:e.source,error:e.error},t))})]})}function ay({values:e}){if(e==null)return null;let t=Object.entries(e);return t.length===0?null:(0,w.jsxs)(`div`,{style:{marginTop:14},children:[(0,w.jsxs)(`div`,{style:{fontSize:11.5,color:S.ink3,marginBottom:6,display:`flex`,alignItems:`center`,gap:6},children:[(0,w.jsx)(D,{name:`edit`,size:12,stroke:1.8}),`部署参数 (Helm values) · `,t.length,` 项`]}),(0,w.jsx)(`div`,{style:{background:S.surface,border:`1px solid ${S.borderSoft}`,borderRadius:7,padding:`0 12px`},children:t.map(([e,t])=>(0,w.jsx)(ry,{name:e,value:typeof t==`object`&&t?JSON.stringify(t):t},e))})]})}function oy({app:e}){let{data:t,loading:n,error:r}=Wd(e.name),[i,a]=(0,b.useState)(null),[o,s]=(0,b.useState)(null),[c,l]=(0,b.useState)(null),u=async t=>{a(t),s(null),l(null);try{await Gd(e.name,t),l(t)}catch(e){s(e.message||`切换失败`)}finally{a(null)}};if(n)return(0,w.jsx)(`div`,{style:{padding:14,textAlign:`center`,color:S.ink3,fontSize:12},children:`加载版本信息…`});if(r||!t)return(0,w.jsx)(`div`,{style:{padding:14},children:(0,w.jsxs)(`div`,{style:{padding:12,borderRadius:7,background:`#fffbeb`,border:`1px solid #fde68a`,fontSize:12,color:`#92400e`,display:`flex`,alignItems:`center`,gap:6},children:[(0,w.jsx)(D,{name:`alertTri`,size:13,stroke:1.8}),r?`无法获取版本信息`:`暂无版本数据`]})});let d=t.versions||[];return(0,w.jsxs)(`div`,{style:{padding:14},children:[(0,w.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,gap:8,marginBottom:10},children:[(0,w.jsxs)(J,{tone:`blue`,children:[(0,w.jsx)(D,{name:`gear`,size:10,stroke:1.8}),`当前版本: `,t.currentVersion]}),(0,w.jsxs)(`span`,{style:{fontSize:10,color:S.ink4},children:[`共 `,d.length,` 个版本`]})]}),c&&(0,w.jsxs)(`div`,{style:{padding:`8px 12px`,borderRadius:7,marginBottom:10,background:`#f0fdf4`,border:`1px solid #bbf7d0`,fontSize:12,color:`#166534`,display:`flex`,alignItems:`center`,gap:6},children:[(0,w.jsx)(q,{tone:`green`,size:6}),`已切换到版本 `,c,`,正在滚动更新…`]}),o&&(0,w.jsxs)(`div`,{style:{padding:`8px 12px`,borderRadius:7,marginBottom:10,background:`#fef2f2`,border:`1px solid #fecaca`,fontSize:12,color:`#b91c1c`,display:`flex`,alignItems:`center`,gap:6},children:[(0,w.jsx)(D,{name:`alertTri`,size:12,stroke:1.8}),o]}),(0,w.jsxs)(`div`,{style:{background:S.surfaceAlt,border:`1px solid ${S.borderSoft}`,borderRadius:8,overflow:`hidden`},children:[(0,w.jsxs)(`div`,{style:{display:`grid`,gridTemplateColumns:`1fr 80px 120px 70px`,padding:`8px 12px`,fontSize:10.5,color:S.ink3,fontWeight:600,letterSpacing:`0.04em`,textTransform:`uppercase`,borderBottom:`1px solid ${S.borderSoft}`},children:[(0,w.jsx)(`span`,{children:`版本号`}),(0,w.jsx)(`span`,{children:`状态`}),(0,w.jsx)(`span`,{children:`创建时间`}),(0,w.jsx)(`span`,{style:{textAlign:`right`},children:`操作`})]}),d.length===0&&(0,w.jsx)(`div`,{style:{padding:`20px 12px`,textAlign:`center`,color:S.ink4,fontSize:12},children:`暂无版本记录`}),d.map((e,t)=>{let n=e.isCurrent?S.green:e.status===`Approved`?S.blue:S.ink4,r=e.isCurrent?`当前版本`:e.status===`Approved`?`已审核`:e.status,a=e.createdAt?new Date(e.createdAt).toLocaleString(`zh-CN`,{year:`numeric`,month:`2-digit`,day:`2-digit`,hour:`2-digit`,minute:`2-digit`}):`—`;return(0,w.jsxs)(`div`,{style:{display:`grid`,gridTemplateColumns:`1fr 80px 120px 70px`,padding:`10px 12px`,fontSize:12,alignItems:`center`,borderTop:t>0?`1px solid ${S.borderSoft}`:`none`,background:e.isCurrent?`#f0fdf4`:`transparent`},children:[(0,w.jsx)(`span`,{className:`mono`,style:{fontWeight:e.isCurrent?700:500,color:S.ink},children:e.version}),(0,w.jsxs)(`span`,{style:{fontSize:11,color:n,fontWeight:600,display:`inline-flex`,alignItems:`center`,gap:4},children:[(0,w.jsx)(q,{tone:e.isCurrent?`green`:e.status===`Approved`?`blue`:`grey`,size:5}),r]}),(0,w.jsx)(`span`,{className:`mono`,style:{fontSize:11,color:S.ink3},children:a}),(0,w.jsx)(`div`,{style:{textAlign:`right`},children:e.isCurrent?(0,w.jsx)(`span`,{style:{fontSize:11,color:S.ink4},children:`当前运行中`}):e.status===`Approved`?(0,w.jsx)(`button`,{onClick:()=>u(e.version),disabled:!!i,className:`edge-press edge-btn-primary`,style:{..._d,height:26,padding:`0 10px`,fontSize:11,opacity:i?.6:1,cursor:i?`not-allowed`:`pointer`},children:i===e.version?`切换中…`:`切换`}):(0,w.jsx)(`span`,{style:{fontSize:11,color:S.ink4},children:`未审核`})})]},e.version)})]}),(0,w.jsxs)(`div`,{style:{marginTop:10,padding:10,background:S.blueSoft,border:`1px solid #bfdbfe`,borderRadius:7,fontSize:11.5,color:S.ink2,lineHeight:1.55,display:`flex`,gap:8,alignItems:`flex-start`},children:[(0,w.jsx)(D,{name:`info`,size:13,stroke:1.8,style:{color:S.blueDeep,marginTop:1,flexShrink:0}}),(0,w.jsxs)(`div`,{children:[`版本切换会触发`,(0,w.jsx)(`strong`,{children:`滚动更新`}),`,新版本 Pod 就绪后旧 Pod 自动回收。只能切换到已审核的版本。`]})]})]})}function sy({app:e,onCancel:t,onConfirm:n}){let[r,i]=(0,b.useState)(``),a=r===e.name,o=(0,b.useRef)(null),s=(0,b.useRef)(null),{backdropProps:c,layerProps:l}=Om({id:`uninstall-confirm`,onDismiss:t,layerRef:o,initialFocusRef:s,modal:!0});return(0,w.jsx)(`div`,{className:`edge-backdrop-in`,...c,style:{position:`fixed`,inset:0,zIndex:250,background:`rgba(15,23,41,0.5)`,display:`flex`,alignItems:`center`,justifyContent:`center`,backdropFilter:`blur(4px)`,WebkitBackdropFilter:`blur(4px)`},children:(0,w.jsxs)(`div`,{ref:o,role:`alertdialog`,"aria-modal":`true`,"aria-labelledby":`uninstall-title`,tabIndex:-1,className:`edge-fade-in`,...l,style:{width:460,background:`white`,borderRadius:12,boxShadow:`0 28px 64px -12px rgba(15,23,42,0.45)`,overflow:`hidden`},children:[(0,w.jsxs)(`div`,{style:{padding:`14px 20px`,display:`flex`,alignItems:`center`,gap:10,background:`#fef2f2`,borderBottom:`1px solid #fecaca`},children:[(0,w.jsx)(`div`,{style:{width:30,height:30,borderRadius:8,background:S.red,color:`white`,display:`flex`,alignItems:`center`,justifyContent:`center`},children:(0,w.jsx)(D,{name:`alertTri`,size:16,stroke:2})}),(0,w.jsxs)(`div`,{style:{flex:1},children:[(0,w.jsx)(`div`,{id:`uninstall-title`,style:{fontSize:14,fontWeight:700,color:S.ink},children:`卸载应用`}),(0,w.jsx)(`div`,{style:{fontSize:11.5,color:`#b91c1c`,marginTop:2},children:`此操作不可撤销`})]}),(0,w.jsx)(`div`,{onClick:t,style:{width:28,height:28,borderRadius:7,cursor:`pointer`,display:`flex`,alignItems:`center`,justifyContent:`center`,color:S.ink3},children:(0,w.jsx)(D,{name:`x`,size:15,stroke:2})})]}),(0,w.jsxs)(`div`,{style:{padding:`18px 20px 20px`},children:[(0,w.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,gap:12,marginBottom:14},children:[(0,w.jsx)(`div`,{style:{width:44,height:44,borderRadius:11,background:e.bg,color:`white`,display:`flex`,alignItems:`center`,justifyContent:`center`,boxShadow:`inset 0 1px 0 rgba(255,255,255,0.3)`,flexShrink:0},children:(0,w.jsx)(D,{name:e.icon,size:22,stroke:1.6})}),(0,w.jsxs)(`div`,{children:[(0,w.jsx)(`div`,{style:{...S.type.heading,color:S.ink},children:e.name}),(0,w.jsxs)(`div`,{style:{fontSize:11.5,color:S.ink3,marginTop:2},className:`mono`,children:[e.version,` · `,e.category]})]})]}),(0,w.jsx)(`div`,{style:{padding:12,borderRadius:8,marginBottom:14,background:S.surfaceAlt,border:`1px solid ${S.borderSoft}`},children:(0,w.jsxs)(`div`,{style:{fontSize:12,color:S.ink2,lineHeight:1.65},children:[(0,w.jsx)(`strong`,{style:{color:S.ink},children:`将会发生什么`}),(0,w.jsxs)(`ul`,{style:{margin:`6px 0 0`,paddingLeft:20,fontSize:11.5,color:S.ink3},children:[(0,w.jsx)(`li`,{children:`立即终止该 Pod,释放占用的 GPU / 内存 / 端口`}),(0,w.jsx)(`li`,{children:`删除容器镜像与配置(保留模型权重和数据集)`}),(0,w.jsxs)(`li`,{children:[`云端「应用编排」状态同步为 `,(0,w.jsx)(`span`,{className:`mono`,children:`Uninstalled`})]}),(0,w.jsxs)(`li`,{children:[`本机暴露的公网链接 `,(0,w.jsx)(`span`,{className:`mono`,children:`share.edgex.cloud/...`}),` 将失效`]})]})]})}),(0,w.jsxs)(`div`,{style:{marginBottom:14},children:[(0,w.jsxs)(`div`,{style:{fontSize:12,color:S.ink2,marginBottom:6},children:[`请输入应用名称 `,(0,w.jsx)(`span`,{className:`mono`,style:{background:S.surfaceAlt,padding:`1px 6px`,borderRadius:3,color:S.ink,fontWeight:600,border:`1px solid ${S.border}`},children:e.name}),` 确认:`]}),(0,w.jsx)(`input`,{ref:s,value:r,onChange:e=>i(e.target.value),autoFocus:!0,placeholder:e.name,style:{width:`100%`,height:38,padding:`0 12px`,border:`1px solid ${a?S.red:S.border}`,borderRadius:7,fontSize:13,color:S.ink,background:`white`,outline:`none`,boxShadow:a?`0 0 0 3px ${S.red}22`:`none`},className:`mono`})]}),(0,w.jsxs)(`div`,{style:{display:`flex`,gap:8},children:[(0,w.jsx)(`button`,{onClick:t,style:{flex:1,height:38,borderRadius:8,background:`white`,border:`1px solid ${S.border}`,fontSize:13,fontWeight:500,color:S.ink2,cursor:`pointer`},children:`取消`}),(0,w.jsxs)(`button`,{onClick:a?n:null,disabled:!a,style:{flex:1.4,height:38,borderRadius:8,background:a?S.red:`#fca5a5`,color:`white`,border:`none`,fontSize:13,fontWeight:600,cursor:a?`pointer`:`not-allowed`,display:`flex`,alignItems:`center`,justifyContent:`center`,gap:6,opacity:a?1:.7},children:[(0,w.jsx)(D,{name:`x`,size:13,stroke:2}),`我已了解,卸载`]})]})]})]})})}function cy({app:e}){return(0,w.jsx)(`div`,{className:`edge-backdrop-in`,style:{position:`fixed`,inset:0,zIndex:250,background:`rgba(15,23,41,0.5)`,display:`flex`,alignItems:`center`,justifyContent:`center`,backdropFilter:`blur(4px)`,WebkitBackdropFilter:`blur(4px)`},children:(0,w.jsxs)(`div`,{className:`edge-fade-in`,style:{width:360,background:`white`,borderRadius:12,boxShadow:`0 28px 64px -12px rgba(15,23,42,0.45)`,padding:`20px 24px 22px`,textAlign:`center`},children:[(0,w.jsx)(`div`,{style:{width:44,height:44,borderRadius:11,margin:`0 auto 12px`,background:e.bg,color:`white`,display:`flex`,alignItems:`center`,justifyContent:`center`,opacity:.7},children:(0,w.jsx)(D,{name:e.icon,size:22,stroke:1.6})}),(0,w.jsxs)(`div`,{style:{fontSize:14,fontWeight:700,color:S.ink,marginBottom:4},children:[`正在卸载 `,e.name,`…`]}),(0,w.jsx)(`div`,{style:{fontSize:11.5,color:S.ink3,marginBottom:14},children:`释放资源 · 删除容器 · 通知云端`}),(0,w.jsx)(`div`,{style:{height:4,borderRadius:2,background:S.surfaceAlt,overflow:`hidden`},children:(0,w.jsx)(`div`,{style:{width:`60%`,height:`100%`,background:S.red,animation:`edgeProgress 2s ease-out forwards`}})}),(0,w.jsx)(`style`,{children:` + @keyframes edgeProgress { + from { width: 0%; } + to { width: 100%; } + } + `})]})})}function ly({app:e,open:t,onClose:n,onUninstall:r,metricsData:i,historyData:a}){let[o,s]=(0,b.useState)(`overview`),[c,l]=(0,b.useState)(null),[u,d]=(0,b.useState)(null),{task:f}=hf(u),p=Wu(),m=(0,b.useRef)(null),h=(0,b.useRef)(980),g=(0,b.useRef)(0),_=Vu(),v=Ru(),y=Du(t?0:1e3),[x,C]=(0,b.useState)(980),T=Au(y,[0,x||1],[.18,0]),E=(0,b.useRef)(null),{backdropProps:O,layerProps:k}=Om({id:`app-management`,onDismiss:n,layerRef:m,initialFocusRef:E,active:t}),A=(0,b.useCallback)(()=>m.current?.getBoundingClientRect().width||h.current,[]);(0,b.useLayoutEffect)(()=>{let e=A();h.current=e,p.reduced?y.set(0):t||y.set(e)},[t,p.reduced,y,A]),(0,b.useEffect)(()=>{let e=A();if(h.current=e,p.reduced){y.set(0),v.start({opacity:+!!t,transition:{duration:.2}});return}let n=g.current;g.current=0,v.start({x:t?0:e,opacity:1,transition:n?{...Uu.momentum,velocity:n}:Uu.default})},[t,p.reduced,v,y,A]),(0,b.useEffect)(()=>{if(!m.current)return;let e=new ResizeObserver(()=>{let e=A();h.current=e,C(e),!t&&!p.reduced&&y.set(e)});return e.observe(m.current),()=>e.disconnect()},[t,p.reduced,y,A]);let{data:j}=Vd(t&&e?.id?e.id:null),ee=(0,b.useMemo)(()=>e?j?{...e,env:j.env,deployValues:j.deployValues}:e:null,[e,j]),M=i||{metrics:{},gpus:[]},N=a||{},P=M.metrics?.cpu?.used||0,F=M.metrics?.gpu?.used||0;if(!e)return null;let I=e.runtime===`compose`,te=I?e.observed?.phase||`unknown`:e.state===`error`?`failed`:`running`,ne=te===`failed`||te===`degraded`,re={running:{tone:`green`,label:`运行中`,dot:`green`,pulse:!1},degraded:{tone:`amber`,label:`运行降级`,dot:`yellow`,pulse:!0},failed:{tone:`red`,label:`运行异常`,dot:`red`,pulse:!0},stopped:{tone:`gray`,label:`已停止`,dot:`gray`,pulse:!1},pending:{tone:`blue`,label:`等待中`,dot:`blue`,pulse:!0},deploying:{tone:`blue`,label:`部署中`,dot:`blue`,pulse:!0},removing:{tone:`amber`,label:`卸载中`,dot:`yellow`,pulse:!0},unknown:{tone:`gray`,label:`未知`,dot:`gray`,pulse:!1}},L=I?re[te]||re.unknown:ne?{tone:`red`,label:`运行异常`,dot:`red`,pulse:!0}:{tone:`green`,label:`运行中`,dot:`green`,pulse:!1},R=I?[{id:`overview`,label:`概览`,icon:`info`},{id:`services`,label:`服务`,icon:`apps`},{id:`logs`,label:`日志`,icon:`terminal`},{id:`compose`,label:`Compose`,icon:`code`},{id:`env`,label:`环境变量`,icon:`gear`},{id:`storage`,label:`存储`,icon:`database`},{id:`revisions`,label:`版本`,icon:`refresh`},{id:`operations`,label:`操作记录`,icon:`clock`}]:[{id:`overview`,label:`概览`,icon:`info`},{id:`metrics`,label:`指标`,icon:`dashboard`},{id:`logs`,label:`日志`,icon:`terminal`},{id:`shell`,label:`容器 Shell`,icon:`terminal`},{id:`versions`,label:`版本`,icon:`refresh`},{id:`config`,label:`配置`,icon:`gear`}],z=R.some(e=>e.id===o)?o:`overview`;return(0,w.jsxs)(w.Fragment,{children:[(0,w.jsx)(Hu.div,{...O,animate:p.reduced?{opacity:t?.18:0}:void 0,transition:{duration:.2},style:{position:`absolute`,inset:0,zIndex:40,background:`rgb(15,23,42)`,opacity:p.reduced?0:T,pointerEvents:t?`auto`:`none`}}),(0,w.jsxs)(Hu.div,{ref:m,role:`dialog`,"aria-modal":`true`,"aria-labelledby":`app-management-title`,tabIndex:-1,...k,drag:p.reduced?!1:`x`,dragControls:_,dragListener:!1,dragMomentum:!1,dragConstraints:{left:0,right:x},dragElastic:{left:.08,right:0},animate:v,onDragEnd:(e,t)=>{let r=A();if(h.current=r,C(r),t.offset.x+Ku(t.velocity.x)>r/2||t.velocity.x>500){g.current=t.velocity.x,n();return}v.start({x:0,transition:{...Uu.momentum,velocity:t.velocity.x}})},style:{position:`absolute`,top:0,right:0,bottom:0,width:`clamp(640px, 65%, 980px)`,background:S.surface,zIndex:41,borderLeft:`1px solid ${S.border}`,boxShadow:`-10px 0 30px -8px rgba(15,23,42,0.22)`,x:p.reduced?0:y,opacity:+!p.reduced,pointerEvents:t?`auto`:`none`,display:`flex`,flexDirection:`column`,overflow:`hidden`},children:[(0,w.jsxs)(`div`,{style:{padding:`14px 18px 0`,flexShrink:0,borderBottom:`1px solid ${S.borderSoft}`,background:`linear-gradient(180deg, #fafbfc, white)`},children:[(0,w.jsxs)(`div`,{onPointerDown:e=>{p.reduced||_.start(e)},style:{display:`flex`,alignItems:`center`,gap:12,marginBottom:14,cursor:p.reduced?`default`:`grab`,touchAction:`none`},children:[(0,w.jsx)(`div`,{style:{width:44,height:44,borderRadius:11,background:e.bg,color:`white`,display:`flex`,alignItems:`center`,justifyContent:`center`,boxShadow:`0 4px 12px -2px ${e.color}55, inset 0 1px 0 rgba(255,255,255,0.4)`,flexShrink:0},children:(0,w.jsx)(D,{name:e.icon,size:22,stroke:1.6})}),(0,w.jsxs)(`div`,{style:{flex:1,minWidth:0},children:[(0,w.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,gap:6},children:[(0,w.jsx)(`div`,{id:`app-management-title`,style:{...S.type.heading,color:S.ink},children:e.name}),(0,w.jsxs)(J,{tone:L.tone,children:[(0,w.jsx)(q,{tone:L.dot,size:6,pulse:L.pulse}),L.label]})]}),(0,w.jsxs)(`div`,{style:{fontSize:11.5,color:S.ink3,marginTop:3,display:`flex`,alignItems:`center`,gap:6},children:[(0,w.jsx)(`span`,{className:`mono`,children:I?`Docker Compose · r${e.revision||0}`:e.version}),(0,w.jsx)(`span`,{style:{color:`#cbd5e1`},children:`·`}),(0,w.jsx)(`span`,{children:e.category||`应用`}),(0,w.jsx)(`span`,{style:{color:`#cbd5e1`},children:`·`}),(0,w.jsx)(`span`,{children:e.gpu||`CPU`})]})]}),(0,w.jsx)(`button`,{ref:E,"aria-label":`关闭应用管理`,onPointerDown:e=>e.stopPropagation(),onClick:n,className:`edge-press edge-menu-item`,style:{width:28,height:28,borderRadius:7,cursor:`pointer`,display:`flex`,alignItems:`center`,justifyContent:`center`,color:S.ink3,background:`transparent`,border:`none`},children:(0,w.jsx)(D,{name:`x`,size:15,stroke:2})})]}),(0,w.jsx)(Zf,{tabs:R,active:z,onChange:s,style:{gap:2,overflowX:`auto`,scrollbarWidth:`thin`},itemStyle:{padding:`8px 12px 10px`,fontSize:12.5,marginBottom:-1,gap:5,flexShrink:0},renderLabel:e=>(0,w.jsxs)(w.Fragment,{children:[(0,w.jsx)(D,{name:e.icon,size:12,stroke:1.8}),e.label]})})]}),(0,w.jsxs)(`div`,{style:{flex:1,overflowY:`auto`},children:[I&&f&&(0,w.jsxs)(`div`,{style:{margin:`10px 14px 0`,padding:`8px 10px`,borderRadius:7,background:f.status===`failed`?`#fef2f2`:`#eff6ff`,border:`1px solid ${f.status===`failed`?`#fecaca`:`#bfdbfe`}`,color:f.status===`failed`?`#b91c1c`:`#1e40af`,fontSize:11.5},children:[`操作任务 `,f.status||`queued`,` · `,f.phase||`queued`,f.message?` · ${f.message}`:``]}),I?(0,w.jsxs)(w.Fragment,{children:[z===`overview`&&(0,w.jsx)(Ev,{app:e}),z===`services`&&(0,w.jsx)(Dv,{app:e}),z===`logs`&&(0,w.jsx)(Ov,{app:e}),z===`compose`&&(0,w.jsx)(kv,{app:e}),z===`env`&&(0,w.jsx)(Av,{app:e}),z===`storage`&&(0,w.jsx)(jv,{app:e}),z===`revisions`&&(0,w.jsx)(Mv,{app:e}),z===`operations`&&(0,w.jsx)(Nv,{app:e})]}):(0,w.jsxs)(w.Fragment,{children:[z===`overview`&&(0,w.jsx)(Xv,{app:e,cpu:P,gpu:F}),z===`metrics`&&(0,w.jsx)(Qv,{app:e,metricsData:M,historyData:N}),z===`logs`&&(0,w.jsx)($v,{app:e}),z===`shell`&&(0,w.jsx)(Kv,{appId:e.id,app:e}),z===`versions`&&(0,w.jsx)(oy,{app:e}),z===`config`&&(0,w.jsx)(ey,{app:ee,onUninstallClick:()=>l(`confirm`)})]})]}),(0,w.jsxs)(`div`,{style:{padding:`10px 16px`,background:S.surfaceAlt,borderTop:`1px solid ${S.borderSoft}`,flexShrink:0,display:`flex`,gap:6,alignItems:`center`},children:[(0,w.jsx)(`div`,{style:{flex:1}}),I&&(0,w.jsxs)(`button`,{className:`edge-press edge-btn-danger`,style:{...vd,height:30,padding:`0 10px`,fontSize:11.5},onClick:()=>l(`confirm`),children:[(0,w.jsx)(D,{name:`trash`,size:12,stroke:1.8}),`卸载`]}),I&&te===`stopped`?(0,w.jsxs)(`button`,{className:`edge-press edge-btn-primary`,style:{..._d,height:30,padding:`0 12px`,fontSize:11.5},onClick:()=>xf(e.id,`start`).then(e=>d(e.id)).catch(e=>console.error(`Start failed:`,e)),children:[(0,w.jsx)(D,{name:`play`,size:12,stroke:2}),`启动`]}):ne?(0,w.jsxs)(`button`,{className:`edge-press edge-btn-primary`,style:{..._d,background:S.red,border:`none`,height:30,padding:`0 12px`,fontSize:11.5},onClick:()=>Kd(e.id,`restart`).catch(e=>console.error(`Restart failed:`,e)),children:[(0,w.jsx)(D,{name:`refresh`,size:12,stroke:2}),`强制重启`]}):(0,w.jsxs)(w.Fragment,{children:[(0,w.jsxs)(`button`,{className:`edge-press edge-btn-secondary`,style:{...gd,height:30,padding:`0 10px`,fontSize:11.5},onClick:()=>xf(e.id,`restart`).then(e=>d(e.id)).catch(e=>console.error(`Restart failed:`,e)),children:[(0,w.jsx)(D,{name:`refresh`,size:12,stroke:1.8}),`重启`]}),(0,w.jsxs)(`button`,{className:`edge-press edge-btn-danger`,style:{...vd,height:30,padding:`0 10px`,fontSize:11.5},onClick:()=>xf(e.id,`stop`).then(e=>d(e.id)).catch(e=>console.error(`Stop failed:`,e)),children:[(0,w.jsx)(D,{name:`stop`,size:12,stroke:1.8}),`停止`]})]})]})]}),c===`confirm`&&I&&(0,w.jsx)(Fp,{app:e,trackTask:!0,onClose:()=>l(null),onDone:()=>{l(null),n(),r&&r(e)}}),c===`confirm`&&!I&&(0,w.jsx)(sy,{app:e,onCancel:()=>l(null),onConfirm:async()=>{l(`running`);try{await qd(e.id)}catch(e){console.error(`Uninstall failed:`,e)}l(null),n(),r&&r(e)}}),c===`running`&&(0,w.jsx)(cy,{app:e})]})}function uy({onLogin:e,deviceName:t}){let[n,r]=(0,b.useState)(``),[i,a]=(0,b.useState)(``),[o,s]=(0,b.useState)(!1),[c,l]=(0,b.useState)(`idle`),[u,d]=(0,b.useState)(``),[f,p]=(0,b.useState)(null),[m,h]=(0,b.useState)(null),g=yy();(0,b.useEffect)(()=>{let e=!1;return fetch(`/api/v1/device`).then(e=>e.ok?e.json():null).then(t=>{e||!t||h({deviceName:t.hostname||``,alias:t.ip||``,model:t.cpuModel||``,computePower:t.cpuCores?`${t.cpuCores} 核 CPU`:``,memoryTotal:t.memoryTotal||0,uptime:t.uptime||0,uptimeHuman:t.uptimeHuman||``,agentVersion:t.agentVersion||``,osVersion:t.platform||``})}).catch(()=>{}),()=>{e=!0}},[]);let _=async t=>{if(t&&t.preventDefault(),c!==`idle`)return;let r=i.trim();if(!n||!r){d(`请输入账号与密码`);return}d(``),l(`verifying`);try{let t=await fetch(`/api/v1/auth/verify`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({password:r})}),i=await t.json().catch(()=>({}));if(!t.ok||!i.authenticated){d(i.message||`密码错误`),l(`idle`);return}l(`success`),setTimeout(()=>e(i.token||``,n,`local`),1100)}catch{d(`无法连接到服务器`),l(`idle`)}},v=t||m?.deviceName||`本地节点`,y=m?.alias||``,x=m?.model||``;return(0,w.jsxs)(`div`,{style:{display:`flex`,width:`100vw`,height:`100vh`,overflow:`hidden`,background:`#fff`,fontFamily:`"PingFang SC", "Noto Sans SC", -apple-system, BlinkMacSystemFont, "Microsoft YaHei", "Segoe UI", Arial, sans-serif`,WebkitFontSmoothing:`antialiased`},children:[(0,w.jsx)(`style`,{children:py}),(0,w.jsxs)(`div`,{className:`login-brand`,style:{position:`relative`,width:`52%`,flexShrink:0,overflow:`hidden`,display:`flex`,flexDirection:`column`,padding:`46px 52px`,color:`#e2e8f0`,background:`#0b1220`,backgroundImage:`radial-gradient(ellipse 70% 50% at 25% 8%, rgba(37,99,235,0.30), transparent 60%),radial-gradient(ellipse 60% 45% at 92% 100%, rgba(16,185,129,0.16), transparent 60%),linear-gradient(to right, rgba(148,163,184,0.07) 1px, transparent 1px),linear-gradient(to bottom, rgba(148,163,184,0.07) 1px, transparent 1px)`,backgroundSize:`auto, auto, 54px 54px, 54px 54px`},children:[(0,w.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,gap:12},children:[(0,w.jsx)(`div`,{style:{width:40,height:40,borderRadius:11,background:`linear-gradient(150deg,#3b82f6,#1d4ed8)`,display:`flex`,alignItems:`center`,justifyContent:`center`,boxShadow:`0 6px 18px -4px rgba(37,99,235,0.6), inset 0 1px 0 rgba(255,255,255,0.4)`},children:(0,w.jsx)(D,{name:`cpu`,size:21,stroke:1.8,style:{color:`#fff`}})}),(0,w.jsxs)(`div`,{children:[(0,w.jsx)(`div`,{style:{fontSize:17,fontWeight:700,color:`#fff`,letterSpacing:`-0.01em`},children:`EDGE-X`}),(0,w.jsx)(`div`,{style:{fontSize:11.5,color:`rgba(226,232,240,0.5)`},children:`GPU开发桌面`})]})]}),(0,w.jsxs)(`div`,{style:{flex:1,display:`flex`,flexDirection:`column`,justifyContent:`center`,maxWidth:520},children:[(0,w.jsx)(my,{online:f}),(0,w.jsx)(`h1`,{className:`login-mono`,style:{fontSize:38,fontWeight:700,color:`#fff`,margin:`20px 0 0`,letterSpacing:`-0.02em`,lineHeight:1.05,wordBreak:`break-all`},children:v}),y&&(0,w.jsx)(`div`,{style:{fontSize:15,color:`rgba(226,232,240,0.7)`,marginTop:10},children:y}),x&&(0,w.jsx)(`div`,{style:{fontSize:12.5,color:`rgba(226,232,240,0.45)`,marginTop:14,lineHeight:1.6},children:x}),(0,w.jsx)(hy,{about:m})]}),(0,w.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,gap:14,fontSize:11.5,color:`rgba(226,232,240,0.4)`,flexWrap:`wrap`},children:[m?.agentVersion&&(0,w.jsxs)(`span`,{className:`login-mono`,children:[`Edge Platform `,m.agentVersion]}),m?.agentVersion&&m?.osVersion&&(0,w.jsx)(`span`,{children:`·`}),m?.osVersion&&(0,w.jsx)(`span`,{children:m.osVersion}),(0,w.jsx)(`div`,{style:{flex:1,minWidth:8}}),(0,w.jsx)(`span`,{className:`login-mono login-tnum`,children:g})]})]}),(0,w.jsx)(`div`,{style:{flex:1,minWidth:0,display:`flex`,alignItems:`center`,justifyContent:`center`,padding:`32px 40px`,background:`#fff`},children:(0,w.jsx)(`div`,{style:{width:`100%`,maxWidth:360},children:c===`success`?(0,w.jsx)(_y,{username:n}):(0,w.jsxs)(w.Fragment,{children:[(0,w.jsx)(`div`,{style:{fontSize:23,fontWeight:700,color:dy.ink,letterSpacing:`-0.01em`},children:`欢迎回来`}),(0,w.jsx)(`div`,{style:{fontSize:13.5,color:dy.ink3,marginTop:7},children:`登录以进入本地控制台`}),(0,w.jsxs)(`form`,{onSubmit:_,style:{marginTop:26,display:`flex`,flexDirection:`column`,gap:12},children:[(0,w.jsxs)(`div`,{children:[(0,w.jsx)(`label`,{style:fy,children:`账号`}),(0,w.jsx)(gy,{icon:`user`,value:n,onChange:r,placeholder:`本地账号`,type:`text`,autoFocus:!0,autoComplete:`username`})]}),(0,w.jsxs)(`div`,{children:[(0,w.jsx)(`label`,{style:fy,children:`密码`}),(0,w.jsx)(gy,{icon:`lock`,type:o?`text`:`password`,value:i,onChange:a,placeholder:`登录密码`,autoComplete:`current-password`,trailing:(0,w.jsx)(`button`,{type:`button`,onClick:()=>s(e=>!e),style:{border:`none`,background:`transparent`,cursor:`pointer`,color:o?dy.blue:dy.ink4,padding:4,display:`flex`},"aria-label":o?`隐藏密码`:`显示密码`,children:(0,w.jsx)(D,{name:`eye`,size:16,stroke:1.8})})})]}),u&&(0,w.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,gap:6,color:dy.red,fontSize:12},children:[(0,w.jsx)(D,{name:`alertTri`,size:13,stroke:1.9}),u]}),(0,w.jsx)(`button`,{type:`submit`,disabled:c===`verifying`||!n||!i,style:{height:46,marginTop:6,borderRadius:10,border:`none`,cursor:c===`verifying`||!n||!i?`default`:`pointer`,background:c===`verifying`||!n||!i?`#cbd5e1`:`linear-gradient(150deg,#3b82f6,#1d4ed8)`,color:`#fff`,fontSize:14.5,fontWeight:600,display:`flex`,alignItems:`center`,justifyContent:`center`,gap:9,boxShadow:c===`verifying`||!n||!i?`none`:`0 8px 20px -8px rgba(37,99,235,0.6)`,transition:`background .15s, box-shadow .15s`},children:c===`verifying`?(0,w.jsxs)(w.Fragment,{children:[(0,w.jsx)(vy,{}),`验证中…`]}):(0,w.jsxs)(w.Fragment,{children:[`登录控制台`,(0,w.jsx)(D,{name:`chevRight`,size:17,stroke:2.2})]})})]}),(0,w.jsxs)(`div`,{style:{marginTop:26,paddingTop:16,borderTop:`1px solid ${dy.borderSoft}`,display:`flex`,alignItems:`center`,gap:7,fontSize:11,color:dy.ink3,lineHeight:1.5},children:[(0,w.jsx)(D,{name:`shield`,size:13,stroke:1.8,style:{color:dy.ink4,flexShrink:0}}),`登录受云端审计中心保护,所有访问将被记录。`]})]})})})]})}var dy={ink:`#0f172a`,ink2:`#334155`,ink3:`#64748b`,ink4:`#94a3b8`,border:`#e2e8f0`,borderSoft:`#eef1f5`,surfaceAlt:`#f8fafc`,blue:`#2563eb`,blueDeep:`#1d4ed8`,red:`#ef4444`,green:`#10b981`},fy={display:`block`,fontSize:11.5,fontWeight:600,color:dy.ink2,marginBottom:6},py=` + .login-mono { font-family: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, monospace; font-feature-settings: "tnum"; } + .login-tnum { font-variant-numeric: tabular-nums; } + @keyframes login-spin { to { transform: rotate(360deg); } } + @media (max-width: 880px) { + .login-brand { display: none !important; } + } +`;function my({online:e}){let t=e===null?{bg:`rgba(148,163,184,0.12)`,fg:`#cbd5e1`,border:`rgba(148,163,184,0.3)`,dot:`#94a3b8`}:e?{bg:`rgba(16,185,129,0.14)`,fg:`#6ee7b7`,border:`rgba(16,185,129,0.3)`,dot:`#34d399`}:{bg:`rgba(245,158,11,0.14)`,fg:`#fcd34d`,border:`rgba(245,158,11,0.32)`,dot:`#fbbf24`},n=e===null?`检测云端连接…`:e?`设备在线 · 已连接云端`:`云端离线 · 将使用本地缓存凭据`;return(0,w.jsxs)(`div`,{style:{display:`inline-flex`,alignItems:`center`,gap:6,alignSelf:`flex-start`,padding:`5px 10px`,borderRadius:999,background:t.bg,color:t.fg,border:`1px solid ${t.border}`,fontSize:11.5,fontWeight:600},children:[(0,w.jsx)(`span`,{style:{width:6,height:6,borderRadius:`50%`,background:t.dot,boxShadow:e?`0 0 6px ${t.dot}`:`none`}}),n]})}function hy({about:e}){let t=[];if(e?.computePower&&t.push({icon:`bolt`,label:`算力`,value:e.computePower}),e?.memoryTotal>0){let n=Math.round(e.memoryTotal/(1024*1024*1024)),r=e?.model?.includes(`统一内存`)?`统一内存`:`内存`;t.push({icon:`memory`,label:r,value:`${n} GB`})}return e?.uptimeHuman&&t.push({icon:`history`,label:`在线`,value:e.uptimeHuman}),t.length===0?null:(0,w.jsx)(`div`,{style:{display:`flex`,gap:10,marginTop:28,flexWrap:`wrap`},children:t.map((e,t)=>(0,w.jsxs)(`div`,{style:{flex:`1 1 140px`,minWidth:140,padding:`12px 14px`,borderRadius:11,background:`rgba(255,255,255,0.04)`,border:`1px solid rgba(255,255,255,0.08)`},children:[(0,w.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,gap:6,color:`rgba(226,232,240,0.55)`},children:[(0,w.jsx)(D,{name:e.icon,size:13,stroke:1.7}),(0,w.jsx)(`span`,{style:{fontSize:11},children:e.label})]}),(0,w.jsx)(`div`,{className:`login-mono login-tnum`,style:{fontSize:16,fontWeight:700,color:`#f1f5f9`,marginTop:6,letterSpacing:`-0.01em`},children:e.value})]},t))})}function gy({icon:e,type:t=`text`,value:n,onChange:r,placeholder:i,trailing:a,autoFocus:o,autoComplete:s}){let[c,l]=(0,b.useState)(!1);return(0,w.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,gap:10,height:46,padding:`0 12px`,borderRadius:10,background:c?`#ffffff`:dy.surfaceAlt,border:`1.5px solid ${c?dy.blue:dy.border}`,boxShadow:c?`0 0 0 3px rgba(37,99,235,0.12)`:`none`,transition:`border-color .15s, box-shadow .15s, background .15s`},children:[(0,w.jsx)(D,{name:e,size:17,stroke:1.8,style:{color:c?dy.blue:dy.ink4,flexShrink:0}}),(0,w.jsx)(`input`,{type:t,value:n,placeholder:i,autoFocus:o,autoComplete:s,onChange:e=>r(e.target.value),onFocus:()=>l(!0),onBlur:()=>l(!1),style:{flex:1,minWidth:0,border:`none`,outline:`none`,background:`transparent`,fontSize:14,color:dy.ink,letterSpacing:t===`password`?`0.18em`:0,fontFamily:`inherit`}}),a]})}function _y({username:e}){return(0,w.jsxs)(`div`,{style:{textAlign:`center`},children:[(0,w.jsx)(`div`,{style:{width:60,height:60,borderRadius:`50%`,margin:`0 auto 16px`,background:`#ecfdf5`,color:dy.green,display:`flex`,alignItems:`center`,justifyContent:`center`,boxShadow:`0 0 0 7px #d1fae5`},children:(0,w.jsx)(D,{name:`check`,size:30,stroke:2.4})}),(0,w.jsx)(`div`,{style:{fontSize:18,fontWeight:700,color:dy.ink},children:`登录成功`}),(0,w.jsxs)(`div`,{style:{fontSize:13,color:dy.ink3,marginTop:8,lineHeight:1.6},children:[`欢迎回来,`,(0,w.jsx)(`span`,{className:`login-mono`,style:{color:dy.ink2,fontWeight:600},children:e}),(0,w.jsx)(`br`,{}),`正在进入控制台…`]}),(0,w.jsx)(`div`,{style:{display:`flex`,alignItems:`center`,justifyContent:`center`,marginTop:18},children:(0,w.jsx)(vy,{color:dy.blue,size:20})})]})}function vy({color:e=`#fff`,size:t=16}){return(0,w.jsxs)(`svg`,{width:t,height:t,viewBox:`0 0 24 24`,style:{animation:`login-spin 0.9s linear infinite`},children:[(0,w.jsx)(`circle`,{cx:`12`,cy:`12`,r:`9`,stroke:e,strokeOpacity:`0.28`,strokeWidth:`2.6`,fill:`none`}),(0,w.jsx)(`path`,{d:`M12 3a9 9 0 0 1 9 9`,stroke:e,strokeWidth:`2.6`,strokeLinecap:`round`,fill:`none`})]})}function yy(){let[e,t]=(0,b.useState)(``);return(0,b.useEffect)(()=>{let e=e=>String(e).padStart(2,`0`),n=()=>{let n=new Date;t(`${n.getFullYear()}/${e(n.getMonth()+1)}/${e(n.getDate())} ${e(n.getHours())}:${e(n.getMinutes())}:${e(n.getSeconds())}`)};n();let r=setInterval(n,1e3);return()=>clearInterval(r)},[]),e}var by={ok:{bg:`#f0fdf4`,border:`#bbf7d0`,text:`#166534`,dot:`#22c55e`},warn:{bg:`#fffbeb`,border:`#fde68a`,text:`#92400e`,dot:`#f59e0b`},err:{bg:`#fef2f2`,border:`#fecaca`,text:`#991b1b`,dot:`#ef4444`}};function xy({children:e}){let[t,n]=(0,b.useState)([]),r=(0,b.useRef)(new Map),i=(0,b.useRef)(0),a=(0,b.useRef)(!0),o=(0,b.useCallback)(e=>{if(!a.current)return;let t=r.current.get(e);t&&clearTimeout(t),r.current.delete(e),n(t=>t.filter(t=>t.id!==e))},[]),s=(0,b.useCallback)((e,t)=>{if(!a.current)return;let s=by[e]?e:`ok`,c=`${Date.now()}-${i.current++}`;return n(e=>[...e,{id:c,kind:s,text:t}]),r.current.set(c,setTimeout(()=>o(c),3e3)),c},[o]);(0,b.useEffect)(()=>{let e=r.current;return a.current=!0,()=>{a.current=!1,e.forEach(e=>clearTimeout(e)),e.clear()}},[]);let c=(0,b.useMemo)(()=>({ok:e=>s(`ok`,e),warn:e=>s(`warn`,e),err:e=>s(`err`,e),dismiss:o}),[s,o]);return(0,w.jsxs)(xp.Provider,{value:c,children:[e,(0,w.jsx)(Sy,{items:t})]})}function Sy({items:e}){let t=Wu();return(0,w.jsx)(`div`,{style:{position:`fixed`,left:`50%`,bottom:28,zIndex:2e3,transform:`translateX(-50%)`,display:`flex`,flexDirection:`column`,alignItems:`center`,gap:8,width:`min(440px, calc(100vw - 32px))`,pointerEvents:`none`},children:(0,w.jsx)(Mc,{mode:`popLayout`,children:e.map(e=>{let n=by[e.kind];return(0,w.jsxs)(Hu.div,{layout:!0,initial:t.reduced?{opacity:0}:{opacity:0,y:16,scale:.95},animate:t.reduced?{opacity:1}:{opacity:1,y:0,scale:1},exit:t.reduced?{opacity:0}:{opacity:0,y:16,scale:.95},transition:t.reduced?t.fadeTransition:Uu.default,className:`edge-material-surface`,role:`status`,style:{width:`100%`,border:`1px solid ${n.border}`,borderRadius:8,boxShadow:`0 12px 28px -12px rgba(15,23,42,0.28), 0 1px 0 rgba(255,255,255,0.72) inset`,color:n.text,padding:`10px 14px`,fontSize:12.5,fontWeight:600,display:`flex`,alignItems:`center`,gap:9},children:[(0,w.jsx)(`span`,{style:{width:8,height:8,borderRadius:`50%`,background:n.dot,flexShrink:0,boxShadow:`0 0 0 3px ${n.bg}`}}),(0,w.jsx)(`span`,{style:{flex:1,minWidth:0,overflowWrap:`anywhere`,lineHeight:1.4},children:e.text})]},e.id)})})})}var Cy=` + .twk-panel{position:fixed;right:16px;bottom:16px;z-index:2147483646;width:280px; + max-height:calc(100vh - 32px);display:flex;flex-direction:column; + transform:scale(var(--dc-inv-zoom,1));transform-origin:bottom right; + background:rgba(250,249,247,.78);color:#29261b; + -webkit-backdrop-filter:blur(24px) saturate(160%);backdrop-filter:blur(24px) saturate(160%); + border:.5px solid rgba(255,255,255,.6);border-radius:14px; + box-shadow:0 1px 0 rgba(255,255,255,.5) inset,0 12px 40px rgba(0,0,0,.18); + font:11.5px/1.4 ui-sans-serif,system-ui,-apple-system,sans-serif;overflow:hidden} + .twk-hd{display:flex;align-items:center;justify-content:space-between; + padding:10px 8px 10px 14px;cursor:move;user-select:none} + .twk-hd b{font-size:12px;font-weight:600;letter-spacing:.01em} + .twk-x{appearance:none;border:0;background:transparent;color:rgba(41,38,27,.55); + width:22px;height:22px;border-radius:6px;cursor:default;font-size:13px;line-height:1} + .twk-x:hover{background:rgba(0,0,0,.06);color:#29261b} + .twk-body{padding:2px 14px 14px;display:flex;flex-direction:column;gap:10px; + overflow-y:auto;overflow-x:hidden;min-height:0; + scrollbar-width:thin;scrollbar-color:rgba(0,0,0,.15) transparent} + .twk-body::-webkit-scrollbar{width:8px} + .twk-body::-webkit-scrollbar-track{background:transparent;margin:2px} + .twk-body::-webkit-scrollbar-thumb{background:rgba(0,0,0,.15);border-radius:4px; + border:2px solid transparent;background-clip:content-box} + .twk-body::-webkit-scrollbar-thumb:hover{background:rgba(0,0,0,.25); + border:2px solid transparent;background-clip:content-box} + .twk-row{display:flex;flex-direction:column;gap:5px} + .twk-row-h{flex-direction:row;align-items:center;justify-content:space-between;gap:10px} + .twk-lbl{display:flex;justify-content:space-between;align-items:baseline; + color:rgba(41,38,27,.72)} + .twk-lbl>span:first-child{font-weight:500} + .twk-val{color:rgba(41,38,27,.5);font-variant-numeric:tabular-nums} + + .twk-sect{font-size:10px;font-weight:600;letter-spacing:.06em;text-transform:uppercase; + color:rgba(41,38,27,.45);padding:10px 0 0} + .twk-sect:first-child{padding-top:0} + + .twk-field{appearance:none;box-sizing:border-box;width:100%;min-width:0;height:26px;padding:0 8px; + border:.5px solid rgba(0,0,0,.1);border-radius:7px; + background:rgba(255,255,255,.6);color:inherit;font:inherit;outline:none} + .twk-field:focus{border-color:rgba(0,0,0,.25);background:rgba(255,255,255,.85)} + select.twk-field{padding-right:22px; + background-image:url("data:image/svg+xml;utf8,"); + background-repeat:no-repeat;background-position:right 8px center} + + .twk-slider{appearance:none;-webkit-appearance:none;width:100%;height:4px;margin:6px 0; + border-radius:999px;background:rgba(0,0,0,.12);outline:none} + .twk-slider::-webkit-slider-thumb{-webkit-appearance:none;appearance:none; + width:14px;height:14px;border-radius:50%;background:#fff; + border:.5px solid rgba(0,0,0,.12);box-shadow:0 1px 3px rgba(0,0,0,.2);cursor:default} + .twk-slider::-moz-range-thumb{width:14px;height:14px;border-radius:50%; + background:#fff;border:.5px solid rgba(0,0,0,.12);box-shadow:0 1px 3px rgba(0,0,0,.2);cursor:default} + + .twk-seg{position:relative;display:flex;padding:2px;border-radius:8px; + background:rgba(0,0,0,.06);user-select:none} + .twk-seg-thumb{position:absolute;top:2px;bottom:2px;border-radius:6px; + background:rgba(255,255,255,.9);box-shadow:0 1px 2px rgba(0,0,0,.12); + transition:left .18s cubic-bezier(.2,1.4,.25,1),width .18s cubic-bezier(.2,1.4,.25,1)} + .twk-seg.dragging .twk-seg-thumb{transition:none} + .twk-seg button{appearance:none;position:relative;z-index:1;flex:1;border:0; + background:transparent;color:inherit;font:inherit;font-weight:500;min-height:22px; + border-radius:6px;cursor:default;padding:4px 6px;line-height:1.2; + overflow-wrap:anywhere} + + .twk-toggle{position:relative;width:32px;height:18px;border:0;border-radius:999px; + background:rgba(0,0,0,.15);transition:background .18s cubic-bezier(.2,1.4,.25,1);cursor:default;padding:0} + .twk-toggle[data-on="1"]{background:#34c759} + .twk-toggle i{position:absolute;top:2px;left:2px;width:14px;height:14px;border-radius:50%; + background:#fff;box-shadow:0 1px 2px rgba(0,0,0,.25);transition:transform .18s cubic-bezier(.2,1.4,.25,1)} + .twk-toggle[data-on="1"] i{transform:translateX(14px)} + + .twk-num{display:flex;align-items:center;box-sizing:border-box;min-width:0;height:26px;padding:0 0 0 8px; + border:.5px solid rgba(0,0,0,.1);border-radius:7px;background:rgba(255,255,255,.6)} + .twk-num-lbl{font-weight:500;color:rgba(41,38,27,.6);cursor:ew-resize; + user-select:none;padding-right:8px} + .twk-num input{flex:1;min-width:0;height:100%;border:0;background:transparent; + font:inherit;font-variant-numeric:tabular-nums;text-align:right;padding:0 8px 0 0; + outline:none;color:inherit;-moz-appearance:textfield} + .twk-num input::-webkit-inner-spin-button,.twk-num input::-webkit-outer-spin-button{ + -webkit-appearance:none;margin:0} + .twk-num-unit{padding-right:8px;color:rgba(41,38,27,.45)} + + .twk-btn{appearance:none;height:26px;padding:0 12px;border:0;border-radius:7px; + background:rgba(0,0,0,.78);color:#fff;font:inherit;font-weight:500;cursor:default} + .twk-btn:hover{background:rgba(0,0,0,.88)} + .twk-btn.secondary{background:rgba(0,0,0,.06);color:inherit} + .twk-btn.secondary:hover{background:rgba(0,0,0,.1)} + + .twk-swatch{appearance:none;-webkit-appearance:none;width:56px;height:22px; + border:.5px solid rgba(0,0,0,.1);border-radius:6px;padding:0;cursor:default; + background:transparent;flex-shrink:0} + .twk-swatch::-webkit-color-swatch-wrapper{padding:0} + .twk-swatch::-webkit-color-swatch{border:0;border-radius:5.5px} + .twk-swatch::-moz-color-swatch{border:0;border-radius:5.5px} + + .twk-chips{display:flex;gap:6px} + .twk-chip{position:relative;appearance:none;flex:1;min-width:0;height:46px; + padding:0;border:0;border-radius:6px;overflow:hidden;cursor:default; + box-shadow:0 0 0 .5px rgba(0,0,0,.12),0 1px 2px rgba(0,0,0,.06); + transition:transform .12s cubic-bezier(.3,.7,.4,1),box-shadow .12s} + .twk-chip:hover{transform:translateY(-1px); + box-shadow:0 0 0 .5px rgba(0,0,0,.18),0 4px 10px rgba(0,0,0,.12)} + .twk-chip[data-on="1"]{box-shadow:0 0 0 1.5px rgba(0,0,0,.85), + 0 2px 6px rgba(0,0,0,.15)} + .twk-chip>span{position:absolute;top:0;bottom:0;right:0;width:34%; + display:flex;flex-direction:column;box-shadow:-1px 0 0 rgba(0,0,0,.1)} + .twk-chip>span>i{flex:1;box-shadow:0 -1px 0 rgba(0,0,0,.1)} + .twk-chip>span>i:first-child{box-shadow:none} + .twk-chip svg{position:absolute;top:6px;left:6px;width:13px;height:13px; + filter:drop-shadow(0 1px 1px rgba(0,0,0,.3))} +`,wy=`edgex-user-prefs`;function Ty(e){try{let t=localStorage.getItem(wy);if(!t)return e;let n=JSON.parse(t);return{...e,...n}}catch{return e}}function Ey(e){try{localStorage.setItem(wy,JSON.stringify(e))}catch{}}function Dy(e){let[t,n]=(0,b.useState)(()=>Ty(e));return[t,(0,b.useCallback)((e,t)=>{let r=typeof e==`object`&&e?e:{[e]:t};n(e=>{let t={...e,...r};return Ey(t),t}),window.parent.postMessage({type:`__edit_mode_set_keys`,edits:r},`*`),window.dispatchEvent(new CustomEvent(`tweakchange`,{detail:r}))},[])]}function Oy({title:e=`Tweaks`,children:t}){let[n,r]=(0,b.useState)(!1),i=(0,b.useRef)(null),a=(0,b.useRef)({x:16,y:16}),o=(0,b.useCallback)(()=>{let e=i.current;if(!e)return;let t=e.offsetWidth,n=e.offsetHeight,r=Math.max(16,window.innerWidth-t-16),o=Math.max(16,window.innerHeight-n-16);a.current={x:Math.min(r,Math.max(16,a.current.x)),y:Math.min(o,Math.max(16,a.current.y))},e.style.right=a.current.x+`px`,e.style.bottom=a.current.y+`px`},[]);return(0,b.useEffect)(()=>{if(!n)return;if(o(),typeof ResizeObserver>`u`)return window.addEventListener(`resize`,o),()=>window.removeEventListener(`resize`,o);let e=new ResizeObserver(o);return e.observe(document.documentElement),()=>e.disconnect()},[n,o]),(0,b.useEffect)(()=>{let e=e=>{let t=e?.data?.type;t===`__activate_edit_mode`?r(!0):t===`__deactivate_edit_mode`&&r(!1)};return window.addEventListener(`message`,e),window.parent.postMessage({type:`__edit_mode_available`},`*`),()=>window.removeEventListener(`message`,e)},[]),n?(0,w.jsxs)(w.Fragment,{children:[(0,w.jsx)(`style`,{children:Cy}),(0,w.jsxs)(`div`,{ref:i,className:`twk-panel`,"data-omelette-chrome":``,style:{right:a.current.x,bottom:a.current.y},children:[(0,w.jsxs)(`div`,{className:`twk-hd`,onMouseDown:e=>{let t=i.current;if(!t)return;let n=t.getBoundingClientRect(),r=e.clientX,s=e.clientY,c=window.innerWidth-n.right,l=window.innerHeight-n.bottom,u=e=>{a.current={x:c-(e.clientX-r),y:l-(e.clientY-s)},o()},d=()=>{window.removeEventListener(`mousemove`,u),window.removeEventListener(`mouseup`,d)};window.addEventListener(`mousemove`,u),window.addEventListener(`mouseup`,d)},children:[(0,w.jsx)(`b`,{children:e}),(0,w.jsx)(`button`,{className:`twk-x`,"aria-label":`Close tweaks`,onMouseDown:e=>e.stopPropagation(),onClick:()=>{r(!1),window.parent.postMessage({type:`__edit_mode_dismissed`},`*`)},children:`✕`})]}),(0,w.jsx)(`div`,{className:`twk-body`,children:t})]})]}):null}function ky({label:e,children:t}){return(0,w.jsxs)(w.Fragment,{children:[(0,w.jsx)(`div`,{className:`twk-sect`,children:e}),t]})}function Ay({label:e,value:t,children:n,inline:r=!1}){return(0,w.jsxs)(`div`,{className:r?`twk-row twk-row-h`:`twk-row`,children:[(0,w.jsxs)(`div`,{className:`twk-lbl`,children:[(0,w.jsx)(`span`,{children:e}),t!=null&&(0,w.jsx)(`span`,{className:`twk-val`,children:t})]}),n]})}function jy({label:e,value:t,onChange:n}){return(0,w.jsxs)(`div`,{className:`twk-row twk-row-h`,children:[(0,w.jsx)(`div`,{className:`twk-lbl`,children:(0,w.jsx)(`span`,{children:e})}),(0,w.jsx)(`button`,{type:`button`,className:`twk-toggle`,"data-on":t?`1`:`0`,role:`switch`,"aria-checked":!!t,onClick:()=>n(!t),children:(0,w.jsx)(`i`,{})})]})}function My({label:e,value:t,options:n,onChange:r}){return(0,w.jsx)(Ay,{label:e,children:(0,w.jsx)(`select`,{className:`twk-field`,value:t,onChange:e=>r(e.target.value),children:n.map(e=>{let t=typeof e==`object`?e.value:e;return(0,w.jsx)(`option`,{value:t,children:typeof e==`object`?e.label:e},t)})})})}function Ny({label:e,value:t,options:n,onChange:r}){let i=(0,b.useRef)(null),[a,o]=(0,b.useState)(!1),s=(0,b.useRef)(t);s.current=t;let c=e=>String(typeof e==`object`?e.label:e).length;if(!(n.reduce((e,t)=>Math.max(e,c(t)),0)<=({2:16,3:10}[n.length]??0))){let i=e=>{let t=n.find(t=>String(typeof t==`object`?t.value:t)===e);return t===void 0?e:typeof t==`object`?t.value:t};return(0,w.jsx)(My,{label:e,value:t,options:n,onChange:e=>r(i(e))})}let l=n.map(e=>typeof e==`object`?e:{value:e,label:e}),u=Math.max(0,l.findIndex(e=>e.value===t)),d=l.length,f=e=>{let t=i.current.getBoundingClientRect(),n=t.width-4,r=Math.floor((e-t.left-2)/n*d);return l[Math.max(0,Math.min(d-1,r))].value};return(0,w.jsx)(Ay,{label:e,children:(0,w.jsxs)(`div`,{ref:i,role:`radiogroup`,onPointerDown:e=>{o(!0);let t=f(e.clientX);t!==s.current&&r(t);let n=e=>{if(!i.current)return;let t=f(e.clientX);t!==s.current&&r(t)},a=()=>{o(!1),window.removeEventListener(`pointermove`,n),window.removeEventListener(`pointerup`,a)};window.addEventListener(`pointermove`,n),window.addEventListener(`pointerup`,a)},className:a?`twk-seg dragging`:`twk-seg`,children:[(0,w.jsx)(`div`,{className:`twk-seg-thumb`,style:{left:`calc(2px + ${u} * (100% - 4px) / ${d})`,width:`calc((100% - 4px) / ${d})`}}),l.map(e=>(0,w.jsx)(`button`,{type:`button`,role:`radio`,"aria-checked":e.value===t,children:e.label},e.value))]})})}function Py(e){let t=String(e).replace(`#`,``),n=t.length===3?t.replace(/./g,e=>e+e):t.padEnd(6,`0`),r=parseInt(n.slice(0,6),16);if(Number.isNaN(r))return!0;let i=r>>16&255,a=r>>8&255,o=r&255;return i*299+a*587+o*114>148e3}var Fy=({light:e})=>(0,w.jsx)(`svg`,{viewBox:`0 0 14 14`,"aria-hidden":`true`,children:(0,w.jsx)(`path`,{d:`M3 7.2 5.8 10 11 4.2`,fill:`none`,strokeWidth:`2.2`,strokeLinecap:`round`,strokeLinejoin:`round`,stroke:e?`rgba(0,0,0,.78)`:`#fff`})});function Iy({label:e,value:t,options:n,onChange:r}){if(!n||!n.length)return(0,w.jsxs)(`div`,{className:`twk-row twk-row-h`,children:[(0,w.jsx)(`div`,{className:`twk-lbl`,children:(0,w.jsx)(`span`,{children:e})}),(0,w.jsx)(`input`,{type:`color`,className:`twk-swatch`,value:t,onChange:e=>r(e.target.value)})]});let i=e=>String(JSON.stringify(e)).toLowerCase(),a=i(t);return(0,w.jsx)(Ay,{label:e,children:(0,w.jsx)(`div`,{className:`twk-chips`,role:`radiogroup`,children:n.map((e,t)=>{let n=Array.isArray(e)?e:[e],[o,...s]=n,c=s.slice(0,4),l=i(e)===a;return(0,w.jsxs)(`button`,{type:`button`,className:`twk-chip`,role:`radio`,"aria-checked":l,"data-on":l?`1`:`0`,"aria-label":n.join(`, `),title:n.join(` · `),style:{background:o},onClick:()=>r(e),children:[c.length>0&&(0,w.jsx)(`span`,{children:c.map((e,t)=>(0,w.jsx)(`i`,{style:{background:e}},t))}),l&&(0,w.jsx)(Fy,{light:Py(o)})]},t)})})})}var Ly={primary:!0,alt:!0},Ry=[{id:`shortcut-help`,action:`toggle-shortcut-help`,name:`快捷键帮助`,description:`打开或关闭此快捷键面板`,category:`general`,bindings:[{code:`Slash`,key:`?`,shift:!0,displayKey:`?`},{code:`Slash`,key:`/`,primary:!0,displayKey:`/`}]},{id:`show-desktop`,action:`show-desktop`,name:`显示桌面`,description:`最小化当前窗口并返回桌面`,category:`navigation`,bindings:[{code:`KeyD`,key:`d`,...Ly,displayKey:`D`}]},{id:`dock-app`,action:`focus-dock-app`,name:`聚焦 Dock 应用`,description:`按当前运行中的 Dock 顺序聚焦第 1–9 个应用`,category:`navigation`,bindings:Array.from({length:9},(e,t)=>({code:`Digit${t+1}`,key:String(t+1),alt:!0,displayKey:String(t+1),argument:t})),enabled:({dockApps:e=[]},t)=>!!e[t.argument]},{id:`window-minimize`,action:`minimize-window`,name:`最小化当前应用`,description:`最小化当前活动窗口`,category:`window`,bindings:[{code:`KeyM`,key:`m`,...Ly,displayKey:`M`}],enabled:({activeId:e})=>!!e},{id:`window-maximize`,action:`toggle-maximized`,name:`最大化或还原`,description:`切换当前活动窗口的显示模式`,category:`window`,bindings:[{code:`KeyF`,key:`f`,...Ly,displayKey:`F`}],enabled:({activeId:e})=>!!e},{id:`window-close`,action:`close-window`,name:`关闭当前应用`,description:`关闭当前活动窗口并退出运行`,category:`window`,bindings:[{code:`KeyW`,key:`w`,...Ly,displayKey:`W`}],enabled:({activeId:e})=>!!e}],zy=[{id:`general`,label:`通用`},{id:`navigation`,label:`导航`},{id:`window`,label:`窗口`}];function By(e=navigator.userAgent,t=navigator.platform){let n=`${e} ${t}`.toLowerCase();return/mac|iphone|ipad|ipod/.test(n)?`mac`:/win/.test(n)?`windows`:`linux`}function Vy(e,t,n){return!!e[n]==!!t[n===`ctrlKey`||n===`metaKey`?`primary`:n.replace(`Key`,``)]}function Hy(e,t){let n=t.primary?(e.ctrlKey||e.metaKey)&&!(e.ctrlKey&&e.metaKey):!e.ctrlKey&&!e.metaKey;return(e.code&&e.code!==`Unidentified`?e.code===t.code:e.key===t.key)&&n&&Vy(e,t,`altKey`)&&Vy(e,t,`shiftKey`)}function Uy(e){return e instanceof Element?!!e.closest([`input`,`textarea`,`select`,`[contenteditable]:not([contenteditable="false"])`,`[role="textbox"]`,`.xterm`,`[data-shortcut-scope]`].join(`,`)):!1}function Wy(e,t=Ry,n={}){if(e.repeat||e.isComposing||e.keyCode===229||Uy(e.target))return null;for(let r of t)for(let t of r.bindings)if(Hy(e,t)&&!(r.enabled&&!r.enabled(n,t)))return{shortcut:r,binding:t};return null}function Gy(e,t=By()){let n=[];return e.primary&&n.push(t===`mac`?`⌘`:`Ctrl`),e.alt&&n.push(t===`mac`?`Option`:`Alt`),e.shift&&e.displayKey!==`?`&&n.push(`Shift`),n.push(e.displayKey),n.join(` + `)}var Ky={backdrop:`_backdrop_3ua5r_1`,dialog:`_dialog_3ua5r_13`,header:`_header_3ua5r_24`,title:`_title_3ua5r_33`,subtitle:`_subtitle_3ua5r_34`,close:`_close_3ua5r_35`,body:`_body_3ua5r_47`,section:`_section_3ua5r_48`,sectionTitle:`_sectionTitle_3ua5r_49`,row:`_row_3ua5r_50`,name:`_name_3ua5r_58`,description:`_description_3ua5r_59`,keys:`_keys_3ua5r_60`,key:`_key_3ua5r_60`,notice:`_notice_3ua5r_72`,backdropIn:`_backdropIn_3ua5r_1`,dialogIn:`_dialogIn_3ua5r_1`};function qy({onClose:e,context:t={}}){let n=(0,b.useRef)(null),r=(0,b.useRef)(null),i=Wu(),a=(0,b.useMemo)(()=>By(),[]),{backdropProps:o,layerProps:s}=Om({id:`shortcut-help`,onDismiss:e,layerRef:n,initialFocusRef:r,modal:!0}),c=zy.map(e=>({...e,shortcuts:Ry.filter(t=>t.category===e.id).map(e=>({...e,unavailable:e.enabled&&!e.bindings.some(n=>e.enabled(t,n))}))}));return(0,w.jsx)(`div`,{className:Ky.backdrop,...o,"data-reduced-motion":i.reduced?`true`:`false`,children:(0,w.jsxs)(`section`,{ref:n,className:Ky.dialog,role:`dialog`,"aria-modal":`true`,"aria-labelledby":`shortcut-help-title`,"aria-describedby":`shortcut-help-description`,tabIndex:-1,...s,children:[(0,w.jsxs)(`header`,{className:Ky.header,children:[(0,w.jsxs)(`div`,{children:[(0,w.jsx)(`h2`,{id:`shortcut-help-title`,className:Ky.title,children:`键盘快捷键`}),(0,w.jsx)(`p`,{id:`shortcut-help-description`,className:Ky.subtitle,children:`在 devbox Console UI 中快速导航和管理窗口`})]}),(0,w.jsx)(`button`,{ref:r,type:`button`,className:Ky.close,onClick:e,"aria-label":`关闭快捷键帮助`,children:(0,w.jsx)(D,{name:`x`,size:16,stroke:2})})]}),(0,w.jsxs)(`div`,{className:Ky.body,children:[c.map(e=>(0,w.jsxs)(`section`,{className:Ky.section,"aria-labelledby":`shortcut-group-${e.id}`,children:[(0,w.jsx)(`h3`,{className:Ky.sectionTitle,id:`shortcut-group-${e.id}`,children:e.label}),e.shortcuts.map(e=>(0,w.jsxs)(`div`,{className:Ky.row,"aria-disabled":e.unavailable||void 0,children:[(0,w.jsxs)(`div`,{children:[(0,w.jsxs)(`div`,{className:Ky.name,children:[e.name,e.unavailable?`(当前不可用)`:``]}),(0,w.jsx)(`div`,{className:Ky.description,children:e.description})]}),(0,w.jsx)(`div`,{className:Ky.keys,"aria-label":e.bindings.map(e=>Gy(e,a)).join(` 或 `),children:e.bindings.map((e,t)=>(0,w.jsx)(`kbd`,{className:Ky.key,children:Gy(e,a)},`${e.code}-${t}`))})]},e.id))]},e.id)),(0,w.jsx)(`div`,{className:Ky.notice,children:`快捷键仅在焦点位于 devbox Console UI 时生效。跨域 iframe、终端、代码编辑器和输入区域会接收自己的键盘事件,父页面无法也不会拦截这些按键。`})]})]})})}function Jy({enabled:e,actions:t,context:n,registry:r=Ry}){let i=(0,b.useEffectEvent)(i=>{if(!e)return;let a=Wy(i,r,n);if(!a)return;let o=t[a.shortcut.action];typeof o==`function`&&(i.preventDefault(),o(a.binding.argument,a))});(0,b.useEffect)(()=>(window.addEventListener(`keydown`,i,!0),()=>window.removeEventListener(`keydown`,i,!0)),[])}function Yy({text:e}){let t=(0,b.useRef)(null),n=(0,b.useCallback)(()=>{let n=t.current;if(!n)return;let r=new Date,i=`${e} ${`${String(r.getHours()).padStart(2,`0`)}:${String(r.getMinutes()).padStart(2,`0`)}`}`,a=document.createElement(`canvas`),o=window.devicePixelRatio||1;a.width=280*o,a.height=160*o;let s=a.getContext(`2d`);s.scale(o,o),s.rotate(-22*Math.PI/180),s.font=`13px -apple-system, BlinkMacSystemFont, sans-serif`,s.fillStyle=`rgba(0,0,0,0.06)`,s.fillText(i,20,120),n.style.backgroundImage=`url(${a.toDataURL()})`,n.style.backgroundSize=`280px 160px`},[e]);return(0,b.useEffect)(()=>{n();let e=setInterval(n,6e4);return()=>clearInterval(e)},[n]),(0,w.jsx)(`div`,{ref:t,style:{position:`fixed`,inset:0,zIndex:9999,pointerEvents:`none`}})}var Xy={preset:`platform-dark`,wallpaper:`grid`,iconStyle:`gradient`,topbar:`dark`,accent:`#2563eb`,layout:`workstation`,iconSize:`md`,showRecent:!0,online:!0},Zy={"platform-dark":{label:`云端同款`,desc:`深色顶栏 · 与管理平台一致`,set:{topbar:`dark`,iconStyle:`gradient`,accent:`#2563eb`,wallpaper:`grid`}},"aurora-light":{label:`极光浅色`,desc:`浅色玻璃顶栏 · 渐变图标`,set:{topbar:`light`,iconStyle:`gradient`,accent:`#2563eb`,wallpaper:`grid`}},"field-cyan":{label:`现场青绿`,desc:`工业青色调 · 拓扑背景`,set:{topbar:`dark`,iconStyle:`gradient`,accent:`#06b6d4`,wallpaper:`topo`}},"minimal-flat":{label:`极简扁平`,desc:`扁平图标 · 灰底无渐变`,set:{topbar:`light`,iconStyle:`flat`,accent:`#0f172a`,wallpaper:`plain`}},sunrise:{label:`晨曦渐变`,desc:`暖色调 · 紫橙光晕`,set:{topbar:`light`,iconStyle:`gradient`,accent:`#8b5cf6`,wallpaper:`topo`}},"mono-dev":{label:`研发暗调`,desc:`深色顶栏 + 灰底 + 扁平`,set:{topbar:`dark`,iconStyle:`flat`,accent:`#10b981`,wallpaper:`plain`}}};function Qy(e,t,n){return Math.max(t,Math.min(n,e))}var $y=420,eb=300,tb=44,nb=28,rb=6;function ib(e,t,n){let r=Math.min(1280,Math.round(t*.72)),i=Math.min(820,Math.round(n*.74)),a=e%rb;return{x:Qy(60+a*nb,0,Math.max(0,t-r)),y:Qy(40+a*nb,0,Math.max(0,n-i-tb)),w:r,h:i}}function ab(e,t){return{x:0,y:0,w:e,h:t}}function ob(e,t,n){let r=Qy(e.w,$y,Math.max($y,t)),i=Qy(e.h,eb,Math.max(eb,n)),a=-(r-80),o=t-80;return{x:Qy(e.x,Math.min(a,o),Math.max(a,o)),y:Qy(e.y,0,Math.max(0,n-tb)),w:r,h:i}}function sb(){let[e,t]=(0,b.useState)(()=>!!kd()),[n,r]=(0,b.useState)(``),i=Em(),a=(e,n)=>{Od(e),r(n),t(!0)},o=()=>{Ad(),t(!1),r(``)};(0,b.useEffect)(()=>{Nd(()=>{t(!1),r(``)})},[]);let[s,c]=Dy(Xy),l=e=>{let t=Zy[e];t&&c({preset:e,...t.set})},u=(0,b.useMemo)(()=>({topbar:s.topbar,iconStyle:s.iconStyle,accent:s.accent,wallpaper:s.wallpaper}),[s.topbar,s.iconStyle,s.accent,s.wallpaper]),[d,f]=(0,b.useState)([]),[p,m]=(0,b.useState)(null),[h,g]=(0,b.useState)(()=>new Set),[_,v]=(0,b.useState)({}),y=(0,b.useRef)(new Map),x=(0,b.useCallback)((e,t)=>{e&&(t?y.current.set(e,t):y.current.delete(e))},[]),C=(0,b.useCallback)(e=>y.current.get(e)?.getBoundingClientRect(),[]),[T,E]=(0,b.useState)({}),[O,k]=(0,b.useState)({}),A=(0,b.useRef)(10),[j,ee]=(0,b.useState)(null),M=(0,b.useRef)(null),[N,P]=(0,b.useState)(()=>({vw:window.innerWidth,vh:window.innerHeight}));(0,b.useEffect)(()=>{let e=()=>{let e=M.current?.getBoundingClientRect?.();e&&e.width>0&&P({vw:e.width,vh:e.height})};return e(),window.addEventListener(`resize`,e),()=>window.removeEventListener(`resize`,e)},[]);let F=(0,b.useCallback)(e=>{e&&(m(e),A.current+=1,k(t=>({...t,[e]:A.current})))},[]),I=(0,b.useCallback)((e,t)=>{E(n=>{let r=n[e];return r?{...n,[e]:ob({...r,...t},N.vw,N.vh)}:n})},[N.vw,N.vh]),te=p?_[p]??!0:!0,ne=e=>{p&&v(t=>{let n=t[p]??!0,r=typeof e==`function`?e(n):e;return r===n?t:{...t,[p]:r}})},[re,L]=(0,b.useState)(!1),[R,z]=(0,b.useState)(!1),[B,ie]=(0,b.useState)(null),[ae,oe]=(0,b.useState)(null),[se,ce]=(0,b.useState)(()=>new Set),[le,ue]=(0,b.useState)(!1),de=e=>{!e||!e.id||(f(t=>t.includes(e.id)?t:[...t,e.id]),g(t=>{if(!t.has(e.id))return t;let n=new Set(t);return n.delete(e.id),n}),v(t=>e.id in t?t:{...t,[e.id]:!0}),E(t=>e.id in t?t:{...t,[e.id]:ib(d.length,N.vw,N.vh)}),F(e.id),L(!1))},fe=e=>{if(d.includes(e)){if(p===e){g(t=>{let n=new Set(t);return n.add(e),n}),m(null),L(!1);return}g(t=>{if(!t.has(e))return t;let n=new Set(t);return n.delete(e),n}),F(e),L(!1)}},pe=e=>{g(t=>{let n=new Set(t);return n.add(e),n}),p===e&&(m(null),L(!1))},me=e=>{f(t=>t.filter(t=>t!==e)),g(t=>{let n=new Set(t);return n.delete(e),n}),v(t=>{if(!(e in t))return t;let n={...t};return delete n[e],n}),E(t=>{if(!(e in t))return t;let n={...t};return delete n[e],n}),k(t=>{if(!(e in t))return t;let n={...t};return delete n[e],n}),p===e&&(m(null),L(!1))},he=()=>{p&&g(e=>{let t=new Set(e);return t.add(p),t}),m(null),L(!1)},ge=Rd(),{data:_e}=zd(),{data:ve}=Bd(),{data:ye}=Hd(),{data:be}=Ld(),xe=(0,b.useMemo)(()=>ve?Object.fromEntries(ve.map(e=>[e.id,e])):{},[ve]),Se=(0,b.useMemo)(()=>({...Object.fromEntries(Ip.map(e=>[e.id,e])),...xe||{}}),[xe]),Ce=ge?.data?.metrics,[we,Te]=(0,b.useState)(0),[Ee,De]=(0,b.useState)(0),[Oe,ke]=(0,b.useState)(0);(0,b.useEffect)(()=>{Ce&&(Te(Ce.cpu?.used||0),De(Ce.gpu?.used||0),ke(Ce.mem?.pct||0))},[Ce]);let Ae=e=>{z(!0)},je=be||{},V=(0,b.useMemo)(()=>d.map(e=>Se[e]).filter(Boolean),[d,Se]),Me=le?Ry.filter(e=>e.action===`toggle-shortcut-help`):Ry;if(Jy({enabled:e&&(!i.hasLayers||le),registry:Me,actions:{"toggle-shortcut-help":()=>ue(e=>!e),"show-desktop":he,"minimize-window":minimizeWindow,"toggle-maximized":()=>ne(e=>!e),"close-window":closeWindow,"focus-dock-app":e=>{let t=V[e];t&&fe(t.id)}},context:{activeId:p,dockApps:V}}),!e)return(0,w.jsx)(xy,{children:(0,w.jsx)(uy,{onLogin:a,deviceName:je.deviceName||je.hostname})});let Ne=Array.isArray(ve)?ve.filter(e=>e.kind===`app`):[],Pe=[...Ip,...Ne],Fe=ye||[],Ie=p?Se[p]:null,Le=Ip,Re=Ne.filter(e=>!se.has(e.id)),ze=Array.isArray(Fe)?Fe.filter(e=>e.state===`active`).length:0,Be=s.wallpaper===`grid`?`edge-bg`:``,Ve=s.wallpaper===`topo`?{background:`#eef3fa`,backgroundImage:`radial-gradient(circle at 20% 20%, rgba(59,130,246,0.15), transparent 40%), radial-gradient(circle at 80% 70%, rgba(20,184,166,0.12), transparent 45%), radial-gradient(circle at 50% 100%, rgba(99,102,241,0.10), transparent 50%)`}:s.wallpaper===`plain`?{background:`#f1f5f9`}:{},He=d.map(e=>Se[e]).filter(Boolean).map(e=>({...e,isActive:p===e.id,isMinimized:h.has(e.id)})),Ue=!!Ie&&!h.has(Ie.id);return(0,w.jsx)(xy,{children:(0,w.jsxs)(`div`,{style:{width:`100vw`,height:`100vh`,overflow:`hidden`,position:`relative`,display:`flex`,flexDirection:`column`},className:Be,children:[(0,w.jsx)(`div`,{style:{position:`absolute`,inset:0,...Ve,zIndex:0},className:Be}),(0,w.jsx)(Yy,{text:je.deviceName||je.hostname||``}),(0,w.jsx)(`div`,{style:{position:`relative`,zIndex:30},children:(0,w.jsx)(Zu,{theme:u.topbar,deviceLabel:je.deviceName||je.hostname||s.deviceLabel,DEVICE:je,cpu:Math.round(we),gpu:Math.round(Ee),mem:Math.round(Oe),alertCount:ze,online:s.online,lastSync:`5 分钟前`,onOpenAlerts:()=>de({id:`alerts`}),onOpenShortcutHelp:()=>ue(!0),loginUser:n,onLogout:o})}),(0,w.jsxs)(`div`,{ref:M,style:{position:`relative`,flex:1,overflow:`hidden`},children:[(0,w.jsx)(`div`,{style:{position:`absolute`,inset:0,display:`flex`,flexDirection:`column`},children:(0,w.jsx)(fd,{onOpenApp:e=>{if(e.locked){Ae(`打开「${e.name}」`);return}de(e)},sysApps:Le,deployedApps:Re,APPS:Pe,RECENT_IDS:[],DEVICE:je,showRecent:s.showRecent,iconStyle:u.iconStyle,accent:u.accent,layout:s.layout,iconSize:s.iconSize})}),(0,w.jsx)(Mc,{children:d.map(e=>{let t=Se[e];if(!t)return null;let n=!h.has(e),r=_[e]??!0,i=(r?ab(N.vw,N.vh):T[e])||ib(0,N.vw,N.vh);return(0,w.jsxs)(Td,{app:t,active:p===e,visible:n,minimized:h.has(e),maximized:r,geo:i,zIndex:O[e]??10,interacting:j===e,stageSize:N,getDockIconRect:C,onMaximize:()=>{F(e),v(t=>({...t,[e]:!(t[e]??!0)}))},onMinimize:()=>pe(e),onClose:()=>me(e),onBringToFront:()=>F(e),onChangeGeo:t=>I(e,t),onInteractStart:()=>ee(e),onInteractEnd:()=>ee(null),canManage:t.kind===`app`,mgmtOpen:p===e&&re,onToggleMgmt:()=>L(e=>!e),children:[e===`dashboard`&&(0,w.jsx)(Jf,{onOpenApp:de}),e===`store`&&(0,w.jsx)(Mp,{onOpenApp:de,authed:R,onRequireAuth:Ae}),e===`compose-manager`&&(0,w.jsx)(Lp,{authed:R,onRequireAuth:Ae,onOpenStore:()=>de({id:`store`}),onOpenApp:de}),e===`alerts`&&(0,w.jsx)(ym,{authed:R,onRequireAuth:Ae}),e===`audit`&&(0,w.jsx)(Nm,{}),e===`supervisor`&&(0,w.jsx)(Zm,{}),e===`virtual-machines`&&(0,w.jsx)(ph,{}),e===`hardware`&&(0,w.jsx)(Th,{}),e===`links`&&(0,w.jsx)(Qh,{}),(e===`diag`||e===`settings`)&&(0,w.jsx)(eg,{}),![`dashboard`,`store`,`compose-manager`,`alerts`,`audit`,`supervisor`,`virtual-machines`,`hardware`,`links`,`diag`,`settings`].includes(e)&&(0,w.jsx)(iv,{appId:e,app:t,authed:R,onRequireAuth:Ae,onOpenManagement:()=>L(!0)}),t.kind===`app`&&(0,w.jsx)(ly,{app:t,open:p===e&&re,onClose:()=>L(!1),authed:R,onRequireAuth:Ae,onUninstall:e=>{ce(t=>new Set([...t,e.id])),me(e.id)},metricsData:ge?.data,historyData:_e})]},e)})}),(0,w.jsx)(md,{apps:He,registerDockIconRect:x,onShowDesktop:he,onFocusApp:fe,onCloseApp:me,anyVisible:Ue,hidden:Ue&&te,authed:R,alertBadge:ze})]}),le&&(0,w.jsx)(qy,{onClose:()=>ue(!1),context:{activeId:p,dockApps:He}}),(0,w.jsxs)(Oy,{title:`Tweaks`,children:[(0,w.jsx)(ky,{label:`主题预设`}),(0,w.jsx)(`div`,{style:{display:`flex`,flexDirection:`column`,gap:6,padding:`0 0 6px`},children:Object.entries(Zy).map(([e,t])=>(0,w.jsxs)(`button`,{onClick:()=>l(e),style:{display:`flex`,alignItems:`center`,gap:10,padding:`8px 10px`,borderRadius:8,textAlign:`left`,background:s.preset===e?S.blueSoft:`white`,border:`1px solid ${s.preset===e?`#bfdbfe`:S.border}`,cursor:`pointer`},children:[(0,w.jsxs)(`div`,{style:{width:28,height:28,borderRadius:6,flexShrink:0,background:t.set.topbar===`dark`?`#0b1220`:`#f1f5f9`,border:`1px solid ${S.borderSoft}`,position:`relative`,overflow:`hidden`},children:[(0,w.jsx)(`div`,{style:{position:`absolute`,top:0,left:0,right:0,height:8,background:t.set.topbar===`dark`?`#0b1220`:`rgba(255,255,255,0.9)`,borderBottom:`1px solid ${t.set.topbar===`dark`?`rgba(255,255,255,0.1)`:`#e2e8f0`}`}}),(0,w.jsx)(`div`,{style:{position:`absolute`,left:5,top:12,width:6,height:6,borderRadius:t.set.iconStyle===`flat`?1.5:2,background:t.set.accent}}),(0,w.jsx)(`div`,{style:{position:`absolute`,left:14,top:12,width:6,height:6,borderRadius:t.set.iconStyle===`flat`?1.5:2,background:`#fb7185`}})]}),(0,w.jsxs)(`div`,{style:{minWidth:0,flex:1},children:[(0,w.jsx)(`div`,{style:{fontSize:12.5,fontWeight:600,color:s.preset===e?S.blueDeep:S.ink},children:t.label}),(0,w.jsx)(`div`,{style:{fontSize:10.5,color:S.ink3,marginTop:2},children:t.desc})]}),s.preset===e&&(0,w.jsx)(D,{name:`check`,size:13,stroke:2.4,style:{color:S.blueDeep,flexShrink:0}})]},e))}),(0,w.jsx)(ky,{label:`桌面布局`}),(0,w.jsx)(Ny,{label:`排列`,value:s.layout,options:[{value:`workstation`,label:`工作站`},{value:`launcher`,label:`启动器`},{value:`compact`,label:`紧凑`}],onChange:e=>c(`layout`,e)}),(0,w.jsx)(Ny,{label:`图标尺寸`,value:s.iconSize,options:[{value:`sm`,label:`小`},{value:`md`,label:`中`},{value:`lg`,label:`大`}],onChange:e=>c(`iconSize`,e)}),(0,w.jsx)(ky,{label:`单项覆盖`}),(0,w.jsx)(Ny,{label:`顶栏`,value:s.topbar,options:[{value:`dark`,label:`深色`},{value:`light`,label:`浅色`}],onChange:e=>c(`topbar`,e)}),(0,w.jsx)(Ny,{label:`图标`,value:s.iconStyle,options:[{value:`gradient`,label:`渐变`},{value:`flat`,label:`扁平`}],onChange:e=>c(`iconStyle`,e)}),(0,w.jsx)(Ny,{label:`背景`,value:s.wallpaper,options:[{value:`grid`,label:`网格`},{value:`topo`,label:`光晕`},{value:`plain`,label:`纯色`}],onChange:e=>c(`wallpaper`,e)}),(0,w.jsx)(Iy,{label:`主色`,value:s.accent,options:[`#2563eb`,`#06b6d4`,`#10b981`,`#8b5cf6`,`#0f172a`],onChange:e=>c(`accent`,e)}),(0,w.jsx)(jy,{label:`显示最近使用`,value:s.showRecent,onChange:e=>c(`showRecent`,e)}),(0,w.jsx)(ky,{label:`状态`}),(0,w.jsx)(jy,{label:`云端在线`,value:s.online,onChange:e=>c(`online`,e)}),(0,w.jsxs)(`button`,{onClick:o,style:{width:`100%`,height:32,borderRadius:7,marginTop:4,background:`white`,color:`#dc2626`,border:`1px solid #fecaca`,fontSize:12,fontWeight:600,cursor:`pointer`},children:[`退出登录 (`,n||`user`,`)`]}),(0,w.jsx)(ky,{label:`演示快捷`}),[[`dashboard`,`仪表盘`],[`ai-activity`,`AI 活动`],[`store`,`应用商店`],[`vscode`,`VS Code Server`],[`jupyter`,`JupyterLab`],[`vllm`,`vLLM (异常)`],[`comfyui`,`ComfyUI`],[`sdwebui`,`SD WebUI`],[`training`,`训练任务`],[`terminal`,`终端`],[`files`,`文件浏览器`],[`ports`,`端口与公网`],[`models`,`模型仓库`],[`alerts`,`告警中心`]].map(([e,t])=>(0,w.jsxs)(`button`,{onClick:()=>de({id:e}),style:{width:`100%`,height:30,borderRadius:6,marginBottom:4,background:p===e?S.blueSoft:d.includes(e)?`#f1f5f9`:`white`,color:p===e?S.blueDeep:S.ink2,border:`1px solid ${p===e?`#bfdbfe`:S.border}`,fontSize:12,fontWeight:500,textAlign:`left`,paddingLeft:10,cursor:`pointer`,display:`flex`,alignItems:`center`,gap:6},children:[d.includes(e)&&(0,w.jsx)(`span`,{style:{width:5,height:5,borderRadius:`50%`,background:p===e?S.blueDeep:S.ink3}}),t]},e)),d.length>0&&(0,w.jsxs)(`button`,{onClick:()=>{d.forEach(e=>me(e))},style:{width:`100%`,height:30,borderRadius:6,marginTop:4,background:`white`,color:S.ink3,border:`1px solid ${S.border}`,fontSize:12,fontWeight:500,textAlign:`left`,paddingLeft:10,cursor:`pointer`},children:[`退出全部 (`,d.length,`) 个运行中应用`]})]})]})})}var cb=class extends b.Component{constructor(e){super(e),this.state={error:null}}static getDerivedStateFromError(e){return{error:e}}render(){return this.state.error?b.createElement(`pre`,{style:{position:`fixed`,inset:0,background:`#2a1215`,color:`#ff8a80`,font:`13px monospace`,padding:20,overflow:`auto`,zIndex:99999,whiteSpace:`pre-wrap`}},`[React Error] + +`+this.state.error.message+` + +`+(this.state.error.stack||``)):this.props.children}};x.createRoot(document.getElementById(`root`)).render((0,w.jsx)(cb,{children:(0,w.jsx)(Tm,{children:(0,w.jsx)(sb,{})})})); \ No newline at end of file diff --git a/pkg/console/dist/assets/index-DCcHkGpE.css b/pkg/console/dist/assets/index-DCcHkGpE.css deleted file mode 100644 index 3b7716b..0000000 --- a/pkg/console/dist/assets/index-DCcHkGpE.css +++ /dev/null @@ -1 +0,0 @@ -.xterm{cursor:text;-webkit-user-select:none;user-select:none;position:relative}.xterm.focus,.xterm:focus{outline:none}.xterm .xterm-helpers{z-index:5;position:absolute;top:0}.xterm .xterm-helper-textarea{opacity:0;z-index:-5;white-space:nowrap;resize:none;border:0;width:0;height:0;margin:0;padding:0;position:absolute;top:0;left:-9999em;overflow:hidden}.xterm .composition-view{color:#fff;white-space:nowrap;z-index:1;background:#000;display:none;position:absolute}.xterm .composition-view.active{display:block}.xterm .xterm-viewport{cursor:default;background-color:#000;position:absolute;inset:0;overflow-y:scroll}.xterm .xterm-screen{position:relative}.xterm .xterm-screen canvas{position:absolute;top:0;left:0}.xterm .xterm-scroll-area{visibility:hidden}.xterm-char-measure-element{visibility:hidden;line-height:normal;display:inline-block;position:absolute;top:0;left:-9999em}.xterm.enable-mouse-events{cursor:default}.xterm.xterm-cursor-pointer,.xterm .xterm-cursor-pointer{cursor:pointer}.xterm.column-select.focus{cursor:crosshair}.xterm .xterm-accessibility:not(.debug),.xterm .xterm-message{z-index:10;color:#0000;pointer-events:none;position:absolute;inset:0}.xterm .xterm-accessibility-tree:not(.debug) ::selection{color:#0000}.xterm .xterm-accessibility-tree{-webkit-user-select:text;user-select:text;white-space:pre}.xterm .live-region{width:1px;height:1px;position:absolute;left:-9999px;overflow:hidden}.xterm-dim{opacity:1!important}.xterm-underline-1{text-decoration:underline}.xterm-underline-2{-webkit-text-decoration:underline double;text-decoration:underline double}.xterm-underline-3{-webkit-text-decoration:underline wavy;text-decoration:underline wavy}.xterm-underline-4{-webkit-text-decoration:underline dotted;text-decoration:underline dotted}.xterm-underline-5{-webkit-text-decoration:underline dashed;text-decoration:underline dashed}.xterm-overline{text-decoration:overline}.xterm-overline.xterm-underline-1{text-decoration:underline overline}.xterm-overline.xterm-underline-2{-webkit-text-decoration:overline double underline;text-decoration:overline double underline}.xterm-overline.xterm-underline-3{-webkit-text-decoration:overline wavy underline;text-decoration:overline wavy underline}.xterm-overline.xterm-underline-4{-webkit-text-decoration:overline dotted underline;text-decoration:overline dotted underline}.xterm-overline.xterm-underline-5{-webkit-text-decoration:overline dashed underline;text-decoration:overline dashed underline}.xterm-strikethrough{text-decoration:line-through}.xterm-screen .xterm-decoration-container .xterm-decoration{z-index:6;position:absolute}.xterm-screen .xterm-decoration-container .xterm-decoration.xterm-decoration-top-layer{z-index:7}.xterm-decoration-overview-ruler{z-index:8;pointer-events:none;position:absolute;top:0;right:0}.xterm-decoration-top{z-index:2;position:relative}html,body{-webkit-font-smoothing:antialiased;color:#0f172a;background:#eef3fa;height:100%;margin:0;padding:0;font-family:PingFang SC,Noto Sans SC,-apple-system,BlinkMacSystemFont,Microsoft YaHei,Segoe UI,Arial,sans-serif;overflow:hidden}*,:before,:after{box-sizing:border-box}button,input{font-family:inherit}::-webkit-scrollbar{width:8px;height:8px}::-webkit-scrollbar-thumb{background:#cbd5e1;border-radius:4px}::-webkit-scrollbar-thumb:hover{background:#94a3b8}::-webkit-scrollbar-track{background:0 0}.mono{font-feature-settings:"tnum";font-family:JetBrains Mono,ui-monospace,SFMono-Regular,Menlo,monospace}.tnum{font-variant-numeric:tabular-nums}@keyframes edgePulse{0%,to{box-shadow:0 0 #ef44448c,0 8px 18px -8px #ef444480}50%{box-shadow:0 0 0 10px #ef444400,0 8px 18px -8px #ef444480}}.edge-pulse{animation:2s ease-out infinite edgePulse}@keyframes edgeFadeIn{0%{opacity:0;transform:scale(.985)translateY(6px)}to{opacity:1;transform:scale(1)translateY(0)}}.edge-fade-in{animation:.22s cubic-bezier(.2,.7,.2,1) edgeFadeIn}@keyframes edgeBackdropIn{0%{opacity:0}to{opacity:1}}.edge-backdrop-in{animation:.18s edgeBackdropIn}@keyframes edgeDotPulse{0%,to{opacity:1}50%{opacity:.35}}.edge-live-dot{animation:1.4s ease-in-out infinite edgeDotPulse}@keyframes edgeBlink{50%{opacity:0}}.edge-cursor{animation:1s step-end infinite edgeBlink}.edge-icon-hover{transition:transform .18s,box-shadow .18s}.edge-icon-hover:hover{box-shadow:var(--edge-icon-hover-shadow);transform:translateY(-3px)}.edge-dock-item{transition:transform .14s}.edge-dock-item:hover{transform:translateY(-4px)scale(1.08)}.edge-bg{background-color:#eef3fa;background-image:linear-gradient(#ffffff80 0%,#eff6ff00 40%),radial-gradient(80% 50% at 50% 0,#3b82f61a,#0000 60%),radial-gradient(60% 40% at 85% 100%,#10b9810d,#0000 60%),linear-gradient(90deg,#94a3b829 1px,#0000 1px),linear-gradient(#94a3b829 1px,#0000 1px);background-position:0 0,0 0,0 0,-1px -1px,-1px -1px;background-size:auto,auto,auto,56px 56px,56px 56px}.edge-glass{-webkit-backdrop-filter:saturate(180%)blur(18px);background:#ffffffb8}.edge-press{transition:transform .1s cubic-bezier(.2,.7,.2,1)}.edge-press:active{transform:scale(.97)}.edge-btn-primary:hover{background:var(--edge-btn-primary-hover-bg,#1d4ed8)}.edge-btn-secondary:hover,.edge-row-hover:hover{background:var(--edge-row-hover-bg,#f8fafc);border-color:var(--edge-row-hover-border-color);box-shadow:var(--edge-row-hover-box-shadow)}.edge-menu-item:hover{background:var(--edge-menu-hover-bg,#f8fafc)}.edge-btn-danger:hover{background:var(--edge-btn-danger-hover-bg,#fef2f2);color:var(--edge-btn-danger-hover-color,#dc2626)}.edge-link-hover:hover{text-decoration:underline}.edge-menu-item{transition:background .15s cubic-bezier(.2,.7,.2,1)}.edge-material-chrome,.edge-glass{-webkit-backdrop-filter:saturate(180%)blur(18px);background:#ffffffb8}.edge-material-surface{-webkit-backdrop-filter:saturate(160%)blur(12px);background:#ffffffd9}.edge-material-overlay{-webkit-backdrop-filter:saturate(190%)blur(24px);background:#ffffffeb}@media (prefers-reduced-motion:reduce){*,:before,:after{scroll-behavior:auto!important;transition-duration:.001ms!important;transition-delay:0s!important;animation-duration:.001ms!important;animation-iteration-count:1!important}.edge-icon-hover,.edge-dock-item,.edge-press,.edge-menu-item{transition-duration:.001ms!important}.edge-icon-hover:hover,.edge-dock-item:hover,.edge-press:active{transform:none!important}}@media (prefers-reduced-transparency:reduce){.edge-material-chrome,.edge-material-surface,.edge-material-overlay,.edge-glass{-webkit-backdrop-filter:none;background:#fff}} diff --git a/pkg/console/dist/assets/index-DRWv--Pc.css b/pkg/console/dist/assets/index-DRWv--Pc.css new file mode 100644 index 0000000..697a98e --- /dev/null +++ b/pkg/console/dist/assets/index-DRWv--Pc.css @@ -0,0 +1 @@ +.xterm{cursor:text;-webkit-user-select:none;user-select:none;position:relative}.xterm.focus,.xterm:focus{outline:none}.xterm .xterm-helpers{z-index:5;position:absolute;top:0}.xterm .xterm-helper-textarea{opacity:0;z-index:-5;white-space:nowrap;resize:none;border:0;width:0;height:0;margin:0;padding:0;position:absolute;top:0;left:-9999em;overflow:hidden}.xterm .composition-view{color:#fff;white-space:nowrap;z-index:1;background:#000;display:none;position:absolute}.xterm .composition-view.active{display:block}.xterm .xterm-viewport{cursor:default;background-color:#000;position:absolute;inset:0;overflow-y:scroll}.xterm .xterm-screen{position:relative}.xterm .xterm-screen canvas{position:absolute;top:0;left:0}.xterm .xterm-scroll-area{visibility:hidden}.xterm-char-measure-element{visibility:hidden;line-height:normal;display:inline-block;position:absolute;top:0;left:-9999em}.xterm.enable-mouse-events{cursor:default}.xterm.xterm-cursor-pointer,.xterm .xterm-cursor-pointer{cursor:pointer}.xterm.column-select.focus{cursor:crosshair}.xterm .xterm-accessibility:not(.debug),.xterm .xterm-message{z-index:10;color:#0000;pointer-events:none;position:absolute;inset:0}.xterm .xterm-accessibility-tree:not(.debug) ::selection{color:#0000}.xterm .xterm-accessibility-tree{-webkit-user-select:text;user-select:text;white-space:pre}.xterm .live-region{width:1px;height:1px;position:absolute;left:-9999px;overflow:hidden}.xterm-dim{opacity:1!important}.xterm-underline-1{text-decoration:underline}.xterm-underline-2{-webkit-text-decoration:underline double;text-decoration:underline double}.xterm-underline-3{-webkit-text-decoration:underline wavy;text-decoration:underline wavy}.xterm-underline-4{-webkit-text-decoration:underline dotted;text-decoration:underline dotted}.xterm-underline-5{-webkit-text-decoration:underline dashed;text-decoration:underline dashed}.xterm-overline{text-decoration:overline}.xterm-overline.xterm-underline-1{text-decoration:underline overline}.xterm-overline.xterm-underline-2{-webkit-text-decoration:overline double underline;text-decoration:overline double underline}.xterm-overline.xterm-underline-3{-webkit-text-decoration:overline wavy underline;text-decoration:overline wavy underline}.xterm-overline.xterm-underline-4{-webkit-text-decoration:overline dotted underline;text-decoration:overline dotted underline}.xterm-overline.xterm-underline-5{-webkit-text-decoration:overline dashed underline;text-decoration:overline dashed underline}.xterm-strikethrough{text-decoration:line-through}.xterm-screen .xterm-decoration-container .xterm-decoration{z-index:6;position:absolute}.xterm-screen .xterm-decoration-container .xterm-decoration.xterm-decoration-top-layer{z-index:7}.xterm-decoration-overview-ruler{z-index:8;pointer-events:none;position:absolute;top:0;right:0}.xterm-decoration-top{z-index:2;position:relative}._backdrop_3ua5r_1{z-index:10000;-webkit-backdrop-filter:blur(8px);backdrop-filter:blur(8px);background:#0f172a7a;justify-content:center;align-items:center;padding:24px;display:flex;position:fixed;inset:0}._dialog_3ua5r_13{color:#0f172a;background:#fff;border:1px solid #94a3b84d;border-radius:18px;width:min(680px,100vw - 32px);max-height:min(720px,100vh - 48px);overflow:hidden;box-shadow:0 30px 80px -20px #0f172a8c}._header_3ua5r_24{background:linear-gradient(#f8fafc,#fff);border-bottom:1px solid #e2e8f0;align-items:flex-start;gap:16px;padding:22px 24px 18px;display:flex}._title_3ua5r_33{letter-spacing:-.02em;margin:0;font-size:19px}._subtitle_3ua5r_34{color:#64748b;margin:5px 0 0;font-size:12.5px}._close_3ua5r_35{color:#475569;cursor:pointer;background:#f1f5f9;border:0;border-radius:9px;width:32px;height:32px;margin-left:auto}._close_3ua5r_35:hover{color:#0f172a;background:#e2e8f0}._body_3ua5r_47{max-height:calc(min(720px,100vh - 48px) - 104px);padding:18px 24px 22px;overflow:auto}._section_3ua5r_48+._section_3ua5r_48{margin-top:20px}._sectionTitle_3ua5r_49{color:#64748b;letter-spacing:.08em;text-transform:uppercase;margin:0 0 8px;font-size:11px}._row_3ua5r_50{border-top:1px solid #f1f5f9;grid-template-columns:minmax(150px,1fr) minmax(180px,auto);align-items:center;gap:16px;padding:10px 0;display:grid}._name_3ua5r_58{font-size:13px;font-weight:650}._description_3ua5r_59{color:#64748b;margin-top:3px;font-size:11.5px;line-height:1.45}._keys_3ua5r_60{flex-wrap:wrap;justify-content:flex-end;gap:5px;display:flex}._key_3ua5r_60{color:#334155;text-align:center;background:#f8fafc;border:1px solid #cbd5e1;border-bottom-width:2px;border-radius:7px;min-width:28px;padding:4px 8px;font:600 11.5px ui-monospace,SFMono-Regular,Menlo,monospace}._notice_3ua5r_72{color:#1e40af;background:#eff6ff;border:1px solid #bfdbfe;border-radius:9px;margin-top:20px;padding:11px 13px;font-size:11.5px;line-height:1.6}@media (prefers-reduced-motion:no-preference){._backdrop_3ua5r_1{animation:.16s ease-out _backdropIn_3ua5r_1}._dialog_3ua5r_13{animation:.2s cubic-bezier(.2,.8,.2,1) _dialogIn_3ua5r_1}}@keyframes _backdropIn_3ua5r_1{0%{opacity:0}}@keyframes _dialogIn_3ua5r_1{0%{opacity:0;transform:translateY(8px)scale(.98)}}html,body{-webkit-font-smoothing:antialiased;color:#0f172a;background:#eef3fa;height:100%;margin:0;padding:0;font-family:PingFang SC,Noto Sans SC,-apple-system,BlinkMacSystemFont,Microsoft YaHei,Segoe UI,Arial,sans-serif;overflow:hidden}*,:before,:after{box-sizing:border-box}button,input{font-family:inherit}::-webkit-scrollbar{width:8px;height:8px}::-webkit-scrollbar-thumb{background:#cbd5e1;border-radius:4px}::-webkit-scrollbar-thumb:hover{background:#94a3b8}::-webkit-scrollbar-track{background:0 0}.mono{font-feature-settings:"tnum";font-family:JetBrains Mono,ui-monospace,SFMono-Regular,Menlo,monospace}.tnum{font-variant-numeric:tabular-nums}@keyframes edgePulse{0%,to{box-shadow:0 0 #ef44448c,0 8px 18px -8px #ef444480}50%{box-shadow:0 0 0 10px #ef444400,0 8px 18px -8px #ef444480}}.edge-pulse{animation:2s ease-out infinite edgePulse}@keyframes edgeFadeIn{0%{opacity:0;transform:scale(.985)translateY(6px)}to{opacity:1;transform:scale(1)translateY(0)}}.edge-fade-in{animation:.22s cubic-bezier(.2,.7,.2,1) edgeFadeIn}@keyframes edgeBackdropIn{0%{opacity:0}to{opacity:1}}.edge-backdrop-in{animation:.18s edgeBackdropIn}@keyframes edgeDotPulse{0%,to{opacity:1}50%{opacity:.35}}.edge-live-dot{animation:1.4s ease-in-out infinite edgeDotPulse}@keyframes edgeBlink{50%{opacity:0}}.edge-cursor{animation:1s step-end infinite edgeBlink}.edge-icon-hover{transition:transform .18s,box-shadow .18s}.edge-icon-hover:hover{box-shadow:var(--edge-icon-hover-shadow);transform:translateY(-3px)}.edge-dock-item{transition:transform .14s}.edge-dock-item:hover{transform:translateY(-4px)scale(1.08)}.edge-bg{background-color:#eef3fa;background-image:linear-gradient(#ffffff80 0%,#eff6ff00 40%),radial-gradient(80% 50% at 50% 0,#3b82f61a,#0000 60%),radial-gradient(60% 40% at 85% 100%,#10b9810d,#0000 60%),linear-gradient(90deg,#94a3b829 1px,#0000 1px),linear-gradient(#94a3b829 1px,#0000 1px);background-position:0 0,0 0,0 0,-1px -1px,-1px -1px;background-size:auto,auto,auto,56px 56px,56px 56px}.edge-glass{-webkit-backdrop-filter:saturate(180%)blur(18px);background:#ffffffb8}.edge-press{transition:transform .1s cubic-bezier(.2,.7,.2,1)}.edge-press:active{transform:scale(.97)}.edge-btn-primary:hover{background:var(--edge-btn-primary-hover-bg,#1d4ed8)}.edge-btn-secondary:hover,.edge-row-hover:hover{background:var(--edge-row-hover-bg,#f8fafc);border-color:var(--edge-row-hover-border-color);box-shadow:var(--edge-row-hover-box-shadow)}.edge-menu-item:hover{background:var(--edge-menu-hover-bg,#f8fafc)}.edge-btn-danger:hover{background:var(--edge-btn-danger-hover-bg,#fef2f2);color:var(--edge-btn-danger-hover-color,#dc2626)}.edge-link-hover:hover{text-decoration:underline}.edge-menu-item{transition:background .15s cubic-bezier(.2,.7,.2,1)}.edge-material-chrome,.edge-glass{-webkit-backdrop-filter:saturate(180%)blur(18px);background:#ffffffb8}.edge-material-surface{-webkit-backdrop-filter:saturate(160%)blur(12px);background:#ffffffd9}.edge-material-overlay{-webkit-backdrop-filter:saturate(190%)blur(24px);background:#ffffffeb}@media (prefers-reduced-motion:reduce){*,:before,:after{scroll-behavior:auto!important;transition-duration:.001ms!important;transition-delay:0s!important;animation-duration:.001ms!important;animation-iteration-count:1!important}.edge-icon-hover,.edge-dock-item,.edge-press,.edge-menu-item{transition-duration:.001ms!important}.edge-icon-hover:hover,.edge-dock-item:hover,.edge-press:active{transform:none!important}}@media (prefers-reduced-transparency:reduce){.edge-material-chrome,.edge-material-surface,.edge-material-overlay,.edge-glass{-webkit-backdrop-filter:none;background:#fff}} diff --git a/pkg/console/dist/index.html b/pkg/console/dist/index.html index 1da5678..52a1d2a 100644 --- a/pkg/console/dist/index.html +++ b/pkg/console/dist/index.html @@ -3,8 +3,8 @@ Edge-X · 本地控制台 - - + +