@evandu/super-pi 0.1.270 → 0.1.271
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/bin/super-pi.js +40 -5
- package/bin/update-receipt.js +2 -2
- package/desktop/update-lifecycle.cjs +1 -1
- package/dist/client/.super-pi-client-sources.json +3 -3
- package/dist/client/assets/{CodeMirrorEditor-DTd2NBhi.js → CodeMirrorEditor-Q77Plbqw.js} +1 -1
- package/dist/client/assets/{GitDiffEditor-BDy7xWCL.js → GitDiffEditor-C0XYcNpE.js} +1 -1
- package/dist/client/assets/{index-BaYymkGX.js → index-CoLvWsuI.js} +5 -5
- package/dist/client/index.html +1 -1
- package/dist/server/managed-http-direct.d.ts +1 -1
- package/dist/server/managed-http-direct.js +2 -2
- package/dist/server/managed-http-tunnel.js +1 -1
- package/dist/server/managed-servers.d.ts +10 -1
- package/dist/server/managed-servers.js +166 -56
- package/dist/shared/managed-servers.d.ts +3 -0
- package/package.json +1 -1
- package/scripts/restart-server.mjs +76 -23
package/bin/super-pi.js
CHANGED
|
@@ -292,6 +292,22 @@ async function disable() { const target = paths(); if (platform === "win32") awa
|
|
|
292
292
|
async function status() { const target = paths(); let enabled = false; if (platform === "win32") { try { await execFileAsync("schtasks.exe", ["/Query", "/TN", target.task]); enabled = true; } catch {} } else enabled = existsSync(target.file); console.log(enabled ? "Automatic startup is enabled." : "Automatic startup is disabled."); }
|
|
293
293
|
async function start(value) { if (await running(value.port)) return; const child = spawn(process.execPath, [entry, `--port=${value.port}`, `--host=${value.host}`], { detached: true, stdio: "ignore", env: { ...process.env, SUPER_PI_PORT: String(value.port), SUPER_PI_HOST: value.host }, windowsHide: true }); child.unref(); const until = Date.now() + 8000; while (Date.now() < until && !(await running(value.port))) await new Promise((resolve) => setTimeout(resolve, 200)); if (!(await running(value.port))) throw new Error("Server did not respond within 8 seconds."); }
|
|
294
294
|
|
|
295
|
+
async function restart(value, targetVersion, operationId) {
|
|
296
|
+
const directory = dataDir();
|
|
297
|
+
const startupLog = join(directory, "logs", "service-restart.log");
|
|
298
|
+
mkdirSync(dirname(startupLog), { recursive: true });
|
|
299
|
+
const env = {
|
|
300
|
+
...process.env,
|
|
301
|
+
SUPER_PI_PORT: String(value.port), SUPER_PI_HOST: value.host, SUPER_PI_DATA_DIR: directory,
|
|
302
|
+
SUPER_PI_LOG: startupLog, SUPER_PI_RESTART_EXPECTED_VERSION: targetVersion, SUPER_PI_RESTART_GRACEFUL_ONLY: "1",
|
|
303
|
+
};
|
|
304
|
+
if (operationId) env.SUPER_PI_UPDATE_OPERATION_ID = operationId;
|
|
305
|
+
else delete env.SUPER_PI_UPDATE_OPERATION_ID;
|
|
306
|
+
const helper = spawn(process.execPath, [join(root, "scripts", "restart-server.mjs")], { cwd: root, stdio: "inherit", env, windowsHide: true });
|
|
307
|
+
const code = await new Promise((resolve, reject) => { helper.once("error", reject); helper.once("close", resolve); });
|
|
308
|
+
if (code !== 0) throw new Error(`服务重启未完成。启动日志在 ${startupLog},也可运行 super_pi logs 查看服务日志。`);
|
|
309
|
+
}
|
|
310
|
+
|
|
295
311
|
const [raw, ...rest] = process.argv.slice(2);
|
|
296
312
|
const implicitStart = raw?.startsWith("-") ?? false;
|
|
297
313
|
const command = implicitStart ? "start" : raw?.toLowerCase();
|
|
@@ -354,12 +370,31 @@ try {
|
|
|
354
370
|
if (command === "set") { process.exit(await runSet(args)); }
|
|
355
371
|
if (!["start", "stop", "restart", "update"].includes(command)) throw new Error(`Unknown command: ${command}`);
|
|
356
372
|
const value = options(args);
|
|
357
|
-
if (command === "update") {
|
|
358
|
-
|
|
373
|
+
if (command === "update") {
|
|
374
|
+
const packageName = JSON.parse(readFileSync(join(root, "package.json"), "utf8")).name === "@evandu/super-pi-server" ? "@evandu/super-pi-server" : "@evandu/super-pi";
|
|
375
|
+
const npm = platform === "win32" ? "npm.cmd" : "npm";
|
|
376
|
+
const npmArgs = ["install", "-g", ...(prefix ? ["--prefix", prefix] : []), "--fetch-timeout=900000", "--fetch-retries=8", "--fetch-retry-maxtimeout=120000", packageName];
|
|
377
|
+
try { updateReceipt = beginCliUpdate(dataDir(), ownVersion().version); } catch { console.warn("无法记录升级进度,终端升级仍将继续。"); }
|
|
378
|
+
const child = spawn(npm, npmArgs, { stdio: "inherit", shell: platform === "win32", env: process.env });
|
|
379
|
+
const code = await new Promise((resolve, reject) => { child.once("error", reject); child.once("close", resolve); });
|
|
380
|
+
if (code !== 0) {
|
|
381
|
+
updateReceipt?.update("failed", { failure: { step: "installing", message: "npm 升级失败,请查看终端输出。", code: code ?? 1 } });
|
|
382
|
+
process.exit(code ?? 1);
|
|
383
|
+
}
|
|
384
|
+
}
|
|
359
385
|
if (command === "stop") { console.log(await running(value.port) ? (await stop(value.port) ? `Shutdown requested on port ${value.port}.` : "Shutdown request failed.") : `Super Pi is not running on port ${value.port}.`); process.exit(0); }
|
|
360
|
-
|
|
361
|
-
|
|
386
|
+
const targetVersion = ownVersion().version;
|
|
387
|
+
if (command === "restart" || command === "update") {
|
|
388
|
+
updateStep = "restarting";
|
|
389
|
+
if (command === "update") console.log(`Super Pi ${targetVersion} 已安装,正在重启服务…`);
|
|
390
|
+
updateReceipt?.update("restarting", { targetVersion });
|
|
391
|
+
await restart(value, targetVersion, updateReceipt?.id);
|
|
392
|
+
} else {
|
|
393
|
+
await start(value);
|
|
394
|
+
}
|
|
395
|
+
updateReceipt?.update("completed", { targetVersion });
|
|
396
|
+
const url = `http://127.0.0.1:${value.port}`;
|
|
362
397
|
const desktopAfterUpdate = (command === "update" || command === "restart") && !value.browser && !args.includes("--no-browser") && JSON.parse(readFileSync(join(root, "package.json"), "utf8")).name !== "@evandu/super-pi-server" && (platform !== "linux" || Boolean(process.env.DISPLAY || process.env.WAYLAND_DISPLAY));
|
|
363
398
|
if (desktopAfterUpdate) { process.env.SUPER_PI_DESKTOP_PORT = String(value.port); const launcher = await import(pathToFileURL(join(root, "desktop", "launch.cjs")).href); await launcher.default.launchDesktop([]); console.log(`Opened Super Pi desktop\n${runningBanner(url)}`); }
|
|
364
399
|
else { if (value.browser) openBrowser(url); console.log(value.browser ? `Opened ${url}\n${runningBanner(url)}` : runningBanner(url)); }
|
|
365
|
-
} catch (error) { try { updateReceipt?.("failed", { failure: { step: updateStep, message: "软件更新流程未完成,请查看终端输出并重试。" } }); } catch {} console.error(error instanceof Error ? error.message : String(error)); usage(); process.exit(1); }
|
|
400
|
+
} catch (error) { try { updateReceipt?.update("failed", { failure: { step: updateStep, message: "软件更新流程未完成,请查看终端输出并重试。" } }); } catch {} console.error(error instanceof Error ? error.message : String(error)); if (updateStep !== "restarting") usage(); process.exit(1); }
|
package/bin/update-receipt.js
CHANGED
|
@@ -5,11 +5,11 @@ import { randomUUID } from "node:crypto";
|
|
|
5
5
|
/** Let an already-running desktop distinguish CLI upgrades from unexpected server exits. */
|
|
6
6
|
export function beginCliUpdate(directory, fromVersion) {
|
|
7
7
|
const path = join(directory, "update-status.json");
|
|
8
|
-
const record = { id: randomUUID(), action: "update", phase: "installing", fromVersion, startedAt: new Date().toISOString(), changedAt: new Date().toISOString() };
|
|
8
|
+
const record = { id: randomUUID(), action: "update", source: "cli", phase: "installing", fromVersion, startedAt: new Date().toISOString(), changedAt: new Date().toISOString() };
|
|
9
9
|
const update = (phase, details = {}) => {
|
|
10
10
|
Object.assign(record, details, { phase, changedAt: new Date().toISOString() });
|
|
11
11
|
mkdirSync(directory, { recursive: true }); const temporary = `${path}.${process.pid}.tmp`;
|
|
12
12
|
writeFileSync(temporary, JSON.stringify(record), { mode: 0o600 }); renameSync(temporary, path);
|
|
13
13
|
};
|
|
14
|
-
update("installing"); return update;
|
|
14
|
+
update("installing"); return { id: record.id, update };
|
|
15
15
|
}
|
|
@@ -3,7 +3,7 @@ function expectedServiceExit(operation, now = Date.now()) {
|
|
|
3
3
|
}
|
|
4
4
|
function shouldRestartDesktop({ desktopVersion, diskVersion, health, operation, handledOperation }) {
|
|
5
5
|
if (!operation?.id || operation.id === handledOperation || !expectedServiceExit({ ...operation, phase: 'restarting' })) return false;
|
|
6
|
-
return Boolean(diskVersion && operation.targetVersion === diskVersion && (operation.phase === 'restarting'
|
|
6
|
+
return Boolean(diskVersion && operation.targetVersion === diskVersion && (operation.phase === 'restarting' && operation.source !== 'cli'
|
|
7
7
|
|| operation.phase === 'completed' && diskVersion !== desktopVersion && health?.runningVersion === diskVersion));
|
|
8
8
|
}
|
|
9
9
|
module.exports = { expectedServiceExit, shouldRestartDesktop };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
{
|
|
2
|
-
"hash": "
|
|
2
|
+
"hash": "92affd07b0af48f8fc1e15308d0adf46944e537365583f3f9d39fa0e27958316",
|
|
3
3
|
"files": {
|
|
4
4
|
"src/client/App.tsx": "53775fd356250703627e2184281eff1e233f59f5e8e8c77a2b3f8d229bc9c81a",
|
|
5
5
|
"src/client/CacheWarmingSettings.tsx": "cce26c4547634b76c08c681a4b9605f884d8502f554f12ff8c30cbd2fd0bd9c0",
|
|
@@ -18,7 +18,7 @@
|
|
|
18
18
|
"src/client/HelpWindow.tsx": "dd4767f4cdced2fcdb50769eb5417ef8de722f43bbd594c9854f49fe61d15d97",
|
|
19
19
|
"src/client/KnowledgeFilePicker.tsx": "82bdd65e8a624276abd5a7530ef47f86a5f9b7649b464080638055991f6278cf",
|
|
20
20
|
"src/client/KnowledgePanel.tsx": "1e64ee6f9d29456ab9470424def8269cc9b3935e3b8ba674739ce5a6cb7db56d",
|
|
21
|
-
"src/client/ManagedServersPanel.tsx": "
|
|
21
|
+
"src/client/ManagedServersPanel.tsx": "a8bf67570888aadb2eddd1e1d371f98f1d63156b372db4255c9a411d0974bde6",
|
|
22
22
|
"src/client/MarkdownSyntaxSettings.tsx": "9124d02956a4d70e2607fc584b226f8a82764b613015958fe117159d0cbf78e1",
|
|
23
23
|
"src/client/MarkdownView.tsx": "16eae0d3d5c23e30ad2ed297dc4b2325e3b505376dbf3e498388c50f84ef3439",
|
|
24
24
|
"src/client/MathView.tsx": "f322a430b93594dd625b4c699994574f81d9bac72fa49b904505ca6e9e3dcb93",
|
|
@@ -86,5 +86,5 @@
|
|
|
86
86
|
"src/client/workbench-navigation.ts": "3b229752a8ce4a45eba7aeff040eb33001413190141f1e9b8e5f38246a1761e2",
|
|
87
87
|
"src/client/workbench-search-panel.css": "6978c03db4f17411e9064242b0ff786a520ee8cf58fe8a9d0ea42872ba3737f0"
|
|
88
88
|
},
|
|
89
|
-
"recordedAt": "2026-11-
|
|
89
|
+
"recordedAt": "2026-11-20T15:57:30.211Z"
|
|
90
90
|
}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/dist-ZAR1Tu2c.js","assets/rolldown-runtime-XKyaHtl9.js","assets/dist-i79xiXVk.js","assets/dist-D978o95T.js","assets/dist-DlPa5gNa.js","assets/dist-DRBIy9A1.js","assets/dist-BlRuQIg1.js","assets/dist-HXD8sSA4.js","assets/dist-DjI7p99D.js","assets/dist-CZ4PyxQu.js","assets/dist-DGBjhKI9.js","assets/dist-LbeLCeoq.js","assets/dist-D8HpMxmZ.js","assets/dist-Dcww9FSw.js","assets/dist-D5u1uPmZ.js","assets/dist-CxmJXjJI.js","assets/dist-ONdtnupI.js","assets/dist-CQncCwUc.js","assets/dist-3qQVP6l8.js","assets/dist-BvjUKkwy.js","assets/dist-YqmXusLA.js","assets/dist-DxPJ1PN-.js","assets/dist-CfTFp0AF.js"])))=>i.map(i=>d[i]);
|
|
2
|
-
import{r as e}from"./rolldown-runtime-XKyaHtl9.js";import{c as t,l as n,n as r,r as i,t as a}from"./index-BaYymkGX.js";var o=e(n(),1);async function s(e,t){let[{StreamLanguage:n},r]=await Promise.all([i(()=>import(`./dist-ZAR1Tu2c.js`).then(e=>e.d),__vite__mapDeps([0,1,2,3,4])),e()]),a=r[t]??r.default??r;return n.define(a)}var c={cpp:()=>i(()=>import(`./dist-DRBIy9A1.js`).then(e=>e.cpp()),__vite__mapDeps([5,6,2,1,0,3,4])),cc:()=>i(()=>import(`./dist-DRBIy9A1.js`).then(e=>e.cpp()),__vite__mapDeps([5,6,2,1,0,3,4])),cxx:()=>i(()=>import(`./dist-DRBIy9A1.js`).then(e=>e.cpp()),__vite__mapDeps([5,6,2,1,0,3,4])),hpp:()=>i(()=>import(`./dist-DRBIy9A1.js`).then(e=>e.cpp()),__vite__mapDeps([5,6,2,1,0,3,4])),hh:()=>i(()=>import(`./dist-DRBIy9A1.js`).then(e=>e.cpp()),__vite__mapDeps([5,6,2,1,0,3,4])),hxx:()=>i(()=>import(`./dist-DRBIy9A1.js`).then(e=>e.cpp()),__vite__mapDeps([5,6,2,1,0,3,4])),c:()=>i(()=>import(`./dist-DRBIy9A1.js`).then(e=>e.cpp()),__vite__mapDeps([5,6,2,1,0,3,4])),h:()=>i(()=>import(`./dist-DRBIy9A1.js`).then(e=>e.cpp()),__vite__mapDeps([5,6,2,1,0,3,4])),cu:()=>i(()=>import(`./dist-DRBIy9A1.js`).then(e=>e.cpp()),__vite__mapDeps([5,6,2,1,0,3,4])),cuh:()=>i(()=>import(`./dist-DRBIy9A1.js`).then(e=>e.cpp()),__vite__mapDeps([5,6,2,1,0,3,4])),js:()=>i(()=>import(`./dist-HXD8sSA4.js`).then(e=>e.t).then(e=>e.javascript()),__vite__mapDeps([7,1,6,2,0,3,4,8])),jsx:()=>i(()=>import(`./dist-HXD8sSA4.js`).then(e=>e.t).then(e=>e.javascript({jsx:!0})),__vite__mapDeps([7,1,6,2,0,3,4,8])),mjs:()=>i(()=>import(`./dist-HXD8sSA4.js`).then(e=>e.t).then(e=>e.javascript()),__vite__mapDeps([7,1,6,2,0,3,4,8])),cjs:()=>i(()=>import(`./dist-HXD8sSA4.js`).then(e=>e.t).then(e=>e.javascript()),__vite__mapDeps([7,1,6,2,0,3,4,8])),ts:()=>i(()=>import(`./dist-HXD8sSA4.js`).then(e=>e.t).then(e=>e.javascript({typescript:!0})),__vite__mapDeps([7,1,6,2,0,3,4,8])),tsx:()=>i(()=>import(`./dist-HXD8sSA4.js`).then(e=>e.t).then(e=>e.javascript({typescript:!0,jsx:!0})),__vite__mapDeps([7,1,6,2,0,3,4,8])),mts:()=>i(()=>import(`./dist-HXD8sSA4.js`).then(e=>e.t).then(e=>e.javascript({typescript:!0})),__vite__mapDeps([7,1,6,2,0,3,4,8])),cts:()=>i(()=>import(`./dist-HXD8sSA4.js`).then(e=>e.t).then(e=>e.javascript({typescript:!0})),__vite__mapDeps([7,1,6,2,0,3,4,8])),py:()=>i(()=>import(`./dist-CZ4PyxQu.js`).then(e=>e.python()),__vite__mapDeps([9,6,2,1,0,3,4,8])),pyi:()=>i(()=>import(`./dist-CZ4PyxQu.js`).then(e=>e.python()),__vite__mapDeps([9,6,2,1,0,3,4,8])),java:()=>i(()=>import(`./dist-DGBjhKI9.js`).then(e=>e.java()),__vite__mapDeps([10,6,2,1,0,3,4])),php:()=>i(()=>import(`./dist-LbeLCeoq.js`).then(e=>e.php()),__vite__mapDeps([11,6,2,1,12,13,0,3,4,7,8])),sql:()=>i(()=>import(`./dist-D5u1uPmZ.js`).then(e=>e.sql()),__vite__mapDeps([14,0,1,2,3,4,6,8])),yaml:()=>i(()=>import(`./dist-CxmJXjJI.js`).then(e=>e.yaml()),__vite__mapDeps([15,6,2,1,0,3,4])),yml:()=>i(()=>import(`./dist-CxmJXjJI.js`).then(e=>e.yaml()),__vite__mapDeps([15,6,2,1,0,3,4])),xml:()=>i(()=>import(`./dist-ONdtnupI.js`).then(e=>e.xml()),__vite__mapDeps([16,6,2,1,0,3,4])),json:()=>i(()=>import(`./dist-CQncCwUc.js`).then(e=>e.json()),__vite__mapDeps([17,6,2,1,0,3,4])),jsonc:()=>i(()=>import(`./dist-CQncCwUc.js`).then(e=>e.json()),__vite__mapDeps([17,6,2,1,0,3,4])),json5:()=>i(()=>import(`./dist-CQncCwUc.js`).then(e=>e.json()),__vite__mapDeps([17,6,2,1,0,3,4])),html:()=>i(()=>import(`./dist-D8HpMxmZ.js`).then(e=>e.html()),__vite__mapDeps([12,6,2,1,13,0,3,4,7,8])),htm:()=>i(()=>import(`./dist-D8HpMxmZ.js`).then(e=>e.html()),__vite__mapDeps([12,6,2,1,13,0,3,4,7,8])),vue:()=>i(()=>import(`./dist-D8HpMxmZ.js`).then(e=>e.html()),__vite__mapDeps([12,6,2,1,13,0,3,4,7,8])),svelte:()=>i(()=>import(`./dist-D8HpMxmZ.js`).then(e=>e.html()),__vite__mapDeps([12,6,2,1,13,0,3,4,7,8])),css:()=>i(()=>import(`./dist-Dcww9FSw.js`).then(e=>e.r).then(e=>e.css()),__vite__mapDeps([13,1,6,2,0,3,4])),md:()=>i(()=>import(`./dist-3qQVP6l8.js`).then(e=>e.markdown()),__vite__mapDeps([18,3,1,4,0,2,8,12,6,13,7])),markdown:()=>i(()=>import(`./dist-3qQVP6l8.js`).then(e=>e.markdown()),__vite__mapDeps([18,3,1,4,0,2,8,12,6,13,7])),mdx:()=>i(()=>import(`./dist-3qQVP6l8.js`).then(e=>e.markdown()),__vite__mapDeps([18,3,1,4,0,2,8,12,6,13,7])),rs:()=>i(()=>import(`./dist-BvjUKkwy.js`).then(e=>e.rust()),__vite__mapDeps([19,6,2,1,0,3,4])),go:()=>i(()=>import(`./dist-YqmXusLA.js`).then(e=>e.go()),__vite__mapDeps([20,6,2,1,0,3,4,8])),sh:()=>s(()=>i(()=>import(`./shell-DwuoZtxw.js`),[]),`shell`),bash:()=>s(()=>i(()=>import(`./shell-DwuoZtxw.js`),[]),`shell`),zsh:()=>s(()=>i(()=>import(`./shell-DwuoZtxw.js`),[]),`shell`),fish:()=>s(()=>i(()=>import(`./shell-DwuoZtxw.js`),[]),`shell`),ps1:()=>s(()=>i(()=>import(`./powershell-D8WpQPaX.js`),[]),`powershell`),psm1:()=>s(()=>i(()=>import(`./powershell-D8WpQPaX.js`),[]),`powershell`),rb:()=>s(()=>i(()=>import(`./ruby-ChfNwlCY.js`),[]),`ruby`),swift:()=>s(()=>i(()=>import(`./swift-DKB6_1j6.js`),[]),`swift`),toml:()=>s(()=>i(()=>import(`./toml-BPTmHmyx.js`),[]),`toml`),ini:()=>s(()=>i(()=>import(`./properties-C357ku5U.js`),[]),`properties`),cfg:()=>s(()=>i(()=>import(`./properties-C357ku5U.js`),[]),`properties`),conf:()=>s(()=>i(()=>import(`./properties-C357ku5U.js`),[]),`properties`),properties:()=>s(()=>i(()=>import(`./properties-C357ku5U.js`),[]),`properties`),dockerfile:()=>s(()=>i(()=>import(`./dockerfile-BDePf5PZ.js`),[]),`dockerfile`),diff:()=>s(()=>i(()=>import(`./diff-ChtP43wD.js`),[]),`diff`),patch:()=>s(()=>i(()=>import(`./diff-ChtP43wD.js`),[]),`diff`)},l={cpp:`C++`,cc:`C++`,cxx:`C++`,hpp:`C++`,hh:`C++`,hxx:`C++`,cu:`CUDA C++`,cuh:`CUDA C++`,c:`C`,h:`C/C++ Header`,js:`JavaScript`,jsx:`JSX`,mjs:`JavaScript`,cjs:`JavaScript`,ts:`TypeScript`,tsx:`TSX`,mts:`TypeScript`,cts:`TypeScript`,py:`Python`,pyi:`Python Stub`,java:`Java`,php:`PHP`,sql:`SQL`,yaml:`YAML`,yml:`YAML`,xml:`XML`,json:`JSON`,jsonc:`JSON with Comments`,json5:`JSON5`,css:`CSS`,md:`Markdown`,markdown:`Markdown`,mdx:`MDX`,rs:`Rust`,go:`Go`,html:`HTML`,htm:`HTML`,vue:`Vue`,svelte:`Svelte`,sh:`Shell`,bash:`Bash`,zsh:`Zsh`,fish:`Fish`,ps1:`PowerShell`,psm1:`PowerShell`,rb:`Ruby`,swift:`Swift`,toml:`TOML`,ini:`INI`,cfg:`Config`,conf:`Config`,properties:`Properties`,dockerfile:`Dockerfile`,diff:`Diff`,patch:`Patch`};function u(e){return c[e.toLowerCase()]}function d(e){return l[e.toLowerCase()]}var f=t(),p=262144,m=131072;function h(e){return e.split(`.`).pop()?.toLowerCase()??``}function g(e){return getComputedStyle(document.documentElement).getPropertyValue(e).trim()}function _(e,t){return e.HighlightStyle.define([{tag:t.tags.keyword,color:g(`--cm-keyword`)},{tag:t.tags.string,color:g(`--cm-string`)},{tag:t.tags.number,color:g(`--cm-number`)},{tag:t.tags.comment,color:g(`--cm-comment`),fontStyle:`italic`},{tag:t.tags.function(t.tags.variableName),color:g(`--cm-function`)},{tag:t.tags.typeName,color:g(`--cm-type`)},{tag:t.tags.className,color:g(`--cm-type`)},{tag:t.tags.propertyName,color:g(`--cm-property`)},{tag:t.tags.operator,color:g(`--cm-operator`)},{tag:t.tags.variableName,color:g(`--cm-variable`)}])}function v({path:e,value:t,onChange:n,jumpToLine:s,onSave:c,workspaceId:l,blame:g,onPosition:v,readOnly:y=!1}){let b=(0,o.useRef)(null),x=(0,o.useRef)(null),S=(0,o.useRef)(null),C=(0,o.useRef)(null),w=(0,o.useRef)(null),T=(0,o.useRef)(null),E=(0,o.useRef)(null),D=(0,o.useRef)(null),O=(0,o.useRef)(n),k=(0,o.useRef)(c);O.current=n,k.current=c;let[A,j]=(0,o.useState)(!1),[M,N]=(0,o.useState)(!1),[P,F]=(0,o.useState)(`0,0`),[I,L]=(0,o.useState)(0);(0,o.useEffect)(()=>{let n=!1,a,o,s,c,l;return(async()=>{try{let d=h(e),f=u(d),[m,g,v,A,M,P,I,R]=await Promise.all([i(()=>import(`./dist-D978o95T.js`).then(e=>e.S),__vite__mapDeps([3,1])),i(()=>import(`./dist-DlPa5gNa.js`).then(e=>e.s),__vite__mapDeps([4,1,3])),i(()=>import(`./dist-DxPJ1PN-.js`),__vite__mapDeps([21,3,1,4,0,2])),i(()=>import(`./dist-CfTFp0AF.js`),__vite__mapDeps([22,4,1,3])),i(()=>import(`./dist-ZAR1Tu2c.js`).then(e=>e.d),__vite__mapDeps([0,1,2,3,4])),i(()=>import(`./dist-i79xiXVk.js`).then(e=>e.n),__vite__mapDeps([2,1])),f?f().catch(e=>(console.warn(`[CodeMirror] Failed to load language for .${d}:`,e),null)):Promise.resolve(null),r().catch(e=>(console.warn(`[CodeMirror] Failed to build the blame extension:`,e),null))]);if(n||!b.current)return;c=M,l=P,C.current=m.Annotation.define(),w.current=m.Transaction.addToHistory;let z=t.length<=p&&I!==null;o=new m.Compartment;let B=[g.lineNumbers(),g.highlightActiveLine(),g.drawSelection(),v.history(),g.keymap.of([v.indentWithTab,...v.defaultKeymap,...v.historyKeymap,...A.searchKeymap,{key:`Mod-s`,run:()=>(k.current(),!0)}]),g.EditorView.updateListener.of(e=>{e.docChanged&&!(C.current&&e.transactions.some(e=>e.annotation(C.current)===!0))&&O.current(e.state.doc.toString()),e.selectionSet&&F(`${e.state.selection.main.from},${e.state.selection.main.to}`)}),g.EditorView.domEventHandlers({mousedown:(e,t)=>(t.focus(),!1)})];if(y&&B.push(m.EditorState.readOnly.of(!0),g.EditorView.editable.of(!1)),R&&!y&&(s=new m.Compartment,B.splice(1,0,s.of([])),B.push(R.base)),I)try{B.push(I)}catch(e){console.warn(`[CodeMirror] Failed to apply language extension for .${d}:`,e),z=!1}if(z&&o&&c&&l)try{B.push(o.of(c.syntaxHighlighting(_(c,l))))}catch(e){console.warn(`[CodeMirror] Failed to attach syntaxHighlighting for .${d}:`,e),z=!1}if(a=new g.EditorView({state:m.EditorState.create({doc:t,extensions:B}),parent:b.current}),n){a.destroy();return}x.current=a,j(z),N(!0),T.current=R,E.current=s??null,D.current=null,L(e=>e+1);let V=new MutationObserver(()=>{let e=x.current;if(e&&z&&o&&c&&l)try{e.dispatch({effects:o.reconfigure(c.syntaxHighlighting(_(c,l)))})}catch{}});S.current=V,V.observe(document.documentElement,{attributes:!0,attributeFilter:[`data-theme`]})}catch(e){console.error(`[CodeMirror] Fatal editor initialization error:`,e),n||N(!0)}})(),()=>{n=!0,S.current?.disconnect(),S.current=null,a?.destroy(),x.current=null,N(!1),b.current&&(b.current.textContent=``)}},[e,y]),(0,o.useEffect)(()=>{let e=x.current;if(!e)return;let n=e.state.doc.toString();n!==t&&e.dispatch({changes:{from:0,to:n.length,insert:t},annotations:C.current?C.current.of(!0):void 0})},[t]),(0,o.useEffect)(()=>{let e=x.current;if(!e||!s)return;let t=e.state.doc.line(Math.min(Math.max(1,s.line),e.state.doc.lines)),n=Math.min(t.to,t.from+(s.column??1)-1);e.dispatch({selection:{anchor:t.to,head:n},scrollIntoView:!0}),e.focus()},[s,M]);let R=!!(g&&g.state===`ready`&&g.response&&g.path===e&&g.workspaceId===l);(0,o.useEffect)(()=>{let t=x.current,n=T.current,r=E.current;if(!t||!n||!r)return;let i=g&&g.state===`ready`&&g.response&&g.path===e&&g.workspaceId===l?g.response:null,o=i?a(i):null;D.current!==o&&(D.current=o,t.dispatch({effects:[n.setBlame.of(o),r.reconfigure(o?n.gutter:[])]}))},[g?.state,g?.response,g?.path,g?.workspaceId,e,l,I]);let z=x.current?.state.doc.toString()??t,B=z.length<=m?z:z.slice(0,m),V=h(e),H=d(V),U=x.current?.state,W=U?.selection.main.head,G=W===void 0?void 0:U?.doc.lineAt(W),K=G?.number,q=W!==void 0&&G?W-G.from+1:void 0;return(0,o.useEffect)(()=>{M&&K!==void 0&&q!==void 0&&v?.({line:K,column:q,language:A&&H||`纯文本`,highlight:A?V:`plain`})},[M,K,q,A,H,V,v]),(0,o.useEffect)(()=>()=>v?.(),[v]),(0,f.jsxs)(`div`,{className:`file-cm-wrap`,"data-file-text":e,"data-file-content":B,"data-file-content-truncated":z.length>m?`1`:`0`,"data-file-selection":P,"data-file-editor-ready":M?`1`:`0`,"data-file-blame-gutter":R?`1`:void 0,onMouseDown:()=>x.current?.focus(),children:[(0,f.jsx)(`div`,{className:`file-cm`,ref:b,"aria-label":`${y?`查看`:`编辑`} ${e}`}),(!M||!v)&&(0,f.jsxs)(`div`,{className:`file-editor-status`,children:[!M&&(0,f.jsx)(`span`,{"data-file-editor-loading":`1`,children:`正在加载编辑器…`}),M&&W!==void 0&&G&&(0,f.jsxs)(`span`,{children:[`第 `,G.number,` 行,第 `,W-G.from+1,` 列`]}),M&&!A&&(0,f.jsx)(`span`,{"data-file-highlight-status":`plain`,children:`纯文本`}),M&&A&&H&&(0,f.jsx)(`span`,{"data-file-highlight-status":V,children:H})]})]})}export{v as CodeMirrorEditor,u as t,_ as themeHighlightStyle};
|
|
2
|
+
import{r as e}from"./rolldown-runtime-XKyaHtl9.js";import{c as t,l as n,n as r,r as i,t as a}from"./index-CoLvWsuI.js";var o=e(n(),1);async function s(e,t){let[{StreamLanguage:n},r]=await Promise.all([i(()=>import(`./dist-ZAR1Tu2c.js`).then(e=>e.d),__vite__mapDeps([0,1,2,3,4])),e()]),a=r[t]??r.default??r;return n.define(a)}var c={cpp:()=>i(()=>import(`./dist-DRBIy9A1.js`).then(e=>e.cpp()),__vite__mapDeps([5,6,2,1,0,3,4])),cc:()=>i(()=>import(`./dist-DRBIy9A1.js`).then(e=>e.cpp()),__vite__mapDeps([5,6,2,1,0,3,4])),cxx:()=>i(()=>import(`./dist-DRBIy9A1.js`).then(e=>e.cpp()),__vite__mapDeps([5,6,2,1,0,3,4])),hpp:()=>i(()=>import(`./dist-DRBIy9A1.js`).then(e=>e.cpp()),__vite__mapDeps([5,6,2,1,0,3,4])),hh:()=>i(()=>import(`./dist-DRBIy9A1.js`).then(e=>e.cpp()),__vite__mapDeps([5,6,2,1,0,3,4])),hxx:()=>i(()=>import(`./dist-DRBIy9A1.js`).then(e=>e.cpp()),__vite__mapDeps([5,6,2,1,0,3,4])),c:()=>i(()=>import(`./dist-DRBIy9A1.js`).then(e=>e.cpp()),__vite__mapDeps([5,6,2,1,0,3,4])),h:()=>i(()=>import(`./dist-DRBIy9A1.js`).then(e=>e.cpp()),__vite__mapDeps([5,6,2,1,0,3,4])),cu:()=>i(()=>import(`./dist-DRBIy9A1.js`).then(e=>e.cpp()),__vite__mapDeps([5,6,2,1,0,3,4])),cuh:()=>i(()=>import(`./dist-DRBIy9A1.js`).then(e=>e.cpp()),__vite__mapDeps([5,6,2,1,0,3,4])),js:()=>i(()=>import(`./dist-HXD8sSA4.js`).then(e=>e.t).then(e=>e.javascript()),__vite__mapDeps([7,1,6,2,0,3,4,8])),jsx:()=>i(()=>import(`./dist-HXD8sSA4.js`).then(e=>e.t).then(e=>e.javascript({jsx:!0})),__vite__mapDeps([7,1,6,2,0,3,4,8])),mjs:()=>i(()=>import(`./dist-HXD8sSA4.js`).then(e=>e.t).then(e=>e.javascript()),__vite__mapDeps([7,1,6,2,0,3,4,8])),cjs:()=>i(()=>import(`./dist-HXD8sSA4.js`).then(e=>e.t).then(e=>e.javascript()),__vite__mapDeps([7,1,6,2,0,3,4,8])),ts:()=>i(()=>import(`./dist-HXD8sSA4.js`).then(e=>e.t).then(e=>e.javascript({typescript:!0})),__vite__mapDeps([7,1,6,2,0,3,4,8])),tsx:()=>i(()=>import(`./dist-HXD8sSA4.js`).then(e=>e.t).then(e=>e.javascript({typescript:!0,jsx:!0})),__vite__mapDeps([7,1,6,2,0,3,4,8])),mts:()=>i(()=>import(`./dist-HXD8sSA4.js`).then(e=>e.t).then(e=>e.javascript({typescript:!0})),__vite__mapDeps([7,1,6,2,0,3,4,8])),cts:()=>i(()=>import(`./dist-HXD8sSA4.js`).then(e=>e.t).then(e=>e.javascript({typescript:!0})),__vite__mapDeps([7,1,6,2,0,3,4,8])),py:()=>i(()=>import(`./dist-CZ4PyxQu.js`).then(e=>e.python()),__vite__mapDeps([9,6,2,1,0,3,4,8])),pyi:()=>i(()=>import(`./dist-CZ4PyxQu.js`).then(e=>e.python()),__vite__mapDeps([9,6,2,1,0,3,4,8])),java:()=>i(()=>import(`./dist-DGBjhKI9.js`).then(e=>e.java()),__vite__mapDeps([10,6,2,1,0,3,4])),php:()=>i(()=>import(`./dist-LbeLCeoq.js`).then(e=>e.php()),__vite__mapDeps([11,6,2,1,12,13,0,3,4,7,8])),sql:()=>i(()=>import(`./dist-D5u1uPmZ.js`).then(e=>e.sql()),__vite__mapDeps([14,0,1,2,3,4,6,8])),yaml:()=>i(()=>import(`./dist-CxmJXjJI.js`).then(e=>e.yaml()),__vite__mapDeps([15,6,2,1,0,3,4])),yml:()=>i(()=>import(`./dist-CxmJXjJI.js`).then(e=>e.yaml()),__vite__mapDeps([15,6,2,1,0,3,4])),xml:()=>i(()=>import(`./dist-ONdtnupI.js`).then(e=>e.xml()),__vite__mapDeps([16,6,2,1,0,3,4])),json:()=>i(()=>import(`./dist-CQncCwUc.js`).then(e=>e.json()),__vite__mapDeps([17,6,2,1,0,3,4])),jsonc:()=>i(()=>import(`./dist-CQncCwUc.js`).then(e=>e.json()),__vite__mapDeps([17,6,2,1,0,3,4])),json5:()=>i(()=>import(`./dist-CQncCwUc.js`).then(e=>e.json()),__vite__mapDeps([17,6,2,1,0,3,4])),html:()=>i(()=>import(`./dist-D8HpMxmZ.js`).then(e=>e.html()),__vite__mapDeps([12,6,2,1,13,0,3,4,7,8])),htm:()=>i(()=>import(`./dist-D8HpMxmZ.js`).then(e=>e.html()),__vite__mapDeps([12,6,2,1,13,0,3,4,7,8])),vue:()=>i(()=>import(`./dist-D8HpMxmZ.js`).then(e=>e.html()),__vite__mapDeps([12,6,2,1,13,0,3,4,7,8])),svelte:()=>i(()=>import(`./dist-D8HpMxmZ.js`).then(e=>e.html()),__vite__mapDeps([12,6,2,1,13,0,3,4,7,8])),css:()=>i(()=>import(`./dist-Dcww9FSw.js`).then(e=>e.r).then(e=>e.css()),__vite__mapDeps([13,1,6,2,0,3,4])),md:()=>i(()=>import(`./dist-3qQVP6l8.js`).then(e=>e.markdown()),__vite__mapDeps([18,3,1,4,0,2,8,12,6,13,7])),markdown:()=>i(()=>import(`./dist-3qQVP6l8.js`).then(e=>e.markdown()),__vite__mapDeps([18,3,1,4,0,2,8,12,6,13,7])),mdx:()=>i(()=>import(`./dist-3qQVP6l8.js`).then(e=>e.markdown()),__vite__mapDeps([18,3,1,4,0,2,8,12,6,13,7])),rs:()=>i(()=>import(`./dist-BvjUKkwy.js`).then(e=>e.rust()),__vite__mapDeps([19,6,2,1,0,3,4])),go:()=>i(()=>import(`./dist-YqmXusLA.js`).then(e=>e.go()),__vite__mapDeps([20,6,2,1,0,3,4,8])),sh:()=>s(()=>i(()=>import(`./shell-DwuoZtxw.js`),[]),`shell`),bash:()=>s(()=>i(()=>import(`./shell-DwuoZtxw.js`),[]),`shell`),zsh:()=>s(()=>i(()=>import(`./shell-DwuoZtxw.js`),[]),`shell`),fish:()=>s(()=>i(()=>import(`./shell-DwuoZtxw.js`),[]),`shell`),ps1:()=>s(()=>i(()=>import(`./powershell-D8WpQPaX.js`),[]),`powershell`),psm1:()=>s(()=>i(()=>import(`./powershell-D8WpQPaX.js`),[]),`powershell`),rb:()=>s(()=>i(()=>import(`./ruby-ChfNwlCY.js`),[]),`ruby`),swift:()=>s(()=>i(()=>import(`./swift-DKB6_1j6.js`),[]),`swift`),toml:()=>s(()=>i(()=>import(`./toml-BPTmHmyx.js`),[]),`toml`),ini:()=>s(()=>i(()=>import(`./properties-C357ku5U.js`),[]),`properties`),cfg:()=>s(()=>i(()=>import(`./properties-C357ku5U.js`),[]),`properties`),conf:()=>s(()=>i(()=>import(`./properties-C357ku5U.js`),[]),`properties`),properties:()=>s(()=>i(()=>import(`./properties-C357ku5U.js`),[]),`properties`),dockerfile:()=>s(()=>i(()=>import(`./dockerfile-BDePf5PZ.js`),[]),`dockerfile`),diff:()=>s(()=>i(()=>import(`./diff-ChtP43wD.js`),[]),`diff`),patch:()=>s(()=>i(()=>import(`./diff-ChtP43wD.js`),[]),`diff`)},l={cpp:`C++`,cc:`C++`,cxx:`C++`,hpp:`C++`,hh:`C++`,hxx:`C++`,cu:`CUDA C++`,cuh:`CUDA C++`,c:`C`,h:`C/C++ Header`,js:`JavaScript`,jsx:`JSX`,mjs:`JavaScript`,cjs:`JavaScript`,ts:`TypeScript`,tsx:`TSX`,mts:`TypeScript`,cts:`TypeScript`,py:`Python`,pyi:`Python Stub`,java:`Java`,php:`PHP`,sql:`SQL`,yaml:`YAML`,yml:`YAML`,xml:`XML`,json:`JSON`,jsonc:`JSON with Comments`,json5:`JSON5`,css:`CSS`,md:`Markdown`,markdown:`Markdown`,mdx:`MDX`,rs:`Rust`,go:`Go`,html:`HTML`,htm:`HTML`,vue:`Vue`,svelte:`Svelte`,sh:`Shell`,bash:`Bash`,zsh:`Zsh`,fish:`Fish`,ps1:`PowerShell`,psm1:`PowerShell`,rb:`Ruby`,swift:`Swift`,toml:`TOML`,ini:`INI`,cfg:`Config`,conf:`Config`,properties:`Properties`,dockerfile:`Dockerfile`,diff:`Diff`,patch:`Patch`};function u(e){return c[e.toLowerCase()]}function d(e){return l[e.toLowerCase()]}var f=t(),p=262144,m=131072;function h(e){return e.split(`.`).pop()?.toLowerCase()??``}function g(e){return getComputedStyle(document.documentElement).getPropertyValue(e).trim()}function _(e,t){return e.HighlightStyle.define([{tag:t.tags.keyword,color:g(`--cm-keyword`)},{tag:t.tags.string,color:g(`--cm-string`)},{tag:t.tags.number,color:g(`--cm-number`)},{tag:t.tags.comment,color:g(`--cm-comment`),fontStyle:`italic`},{tag:t.tags.function(t.tags.variableName),color:g(`--cm-function`)},{tag:t.tags.typeName,color:g(`--cm-type`)},{tag:t.tags.className,color:g(`--cm-type`)},{tag:t.tags.propertyName,color:g(`--cm-property`)},{tag:t.tags.operator,color:g(`--cm-operator`)},{tag:t.tags.variableName,color:g(`--cm-variable`)}])}function v({path:e,value:t,onChange:n,jumpToLine:s,onSave:c,workspaceId:l,blame:g,onPosition:v,readOnly:y=!1}){let b=(0,o.useRef)(null),x=(0,o.useRef)(null),S=(0,o.useRef)(null),C=(0,o.useRef)(null),w=(0,o.useRef)(null),T=(0,o.useRef)(null),E=(0,o.useRef)(null),D=(0,o.useRef)(null),O=(0,o.useRef)(n),k=(0,o.useRef)(c);O.current=n,k.current=c;let[A,j]=(0,o.useState)(!1),[M,N]=(0,o.useState)(!1),[P,F]=(0,o.useState)(`0,0`),[I,L]=(0,o.useState)(0);(0,o.useEffect)(()=>{let n=!1,a,o,s,c,l;return(async()=>{try{let d=h(e),f=u(d),[m,g,v,A,M,P,I,R]=await Promise.all([i(()=>import(`./dist-D978o95T.js`).then(e=>e.S),__vite__mapDeps([3,1])),i(()=>import(`./dist-DlPa5gNa.js`).then(e=>e.s),__vite__mapDeps([4,1,3])),i(()=>import(`./dist-DxPJ1PN-.js`),__vite__mapDeps([21,3,1,4,0,2])),i(()=>import(`./dist-CfTFp0AF.js`),__vite__mapDeps([22,4,1,3])),i(()=>import(`./dist-ZAR1Tu2c.js`).then(e=>e.d),__vite__mapDeps([0,1,2,3,4])),i(()=>import(`./dist-i79xiXVk.js`).then(e=>e.n),__vite__mapDeps([2,1])),f?f().catch(e=>(console.warn(`[CodeMirror] Failed to load language for .${d}:`,e),null)):Promise.resolve(null),r().catch(e=>(console.warn(`[CodeMirror] Failed to build the blame extension:`,e),null))]);if(n||!b.current)return;c=M,l=P,C.current=m.Annotation.define(),w.current=m.Transaction.addToHistory;let z=t.length<=p&&I!==null;o=new m.Compartment;let B=[g.lineNumbers(),g.highlightActiveLine(),g.drawSelection(),v.history(),g.keymap.of([v.indentWithTab,...v.defaultKeymap,...v.historyKeymap,...A.searchKeymap,{key:`Mod-s`,run:()=>(k.current(),!0)}]),g.EditorView.updateListener.of(e=>{e.docChanged&&!(C.current&&e.transactions.some(e=>e.annotation(C.current)===!0))&&O.current(e.state.doc.toString()),e.selectionSet&&F(`${e.state.selection.main.from},${e.state.selection.main.to}`)}),g.EditorView.domEventHandlers({mousedown:(e,t)=>(t.focus(),!1)})];if(y&&B.push(m.EditorState.readOnly.of(!0),g.EditorView.editable.of(!1)),R&&!y&&(s=new m.Compartment,B.splice(1,0,s.of([])),B.push(R.base)),I)try{B.push(I)}catch(e){console.warn(`[CodeMirror] Failed to apply language extension for .${d}:`,e),z=!1}if(z&&o&&c&&l)try{B.push(o.of(c.syntaxHighlighting(_(c,l))))}catch(e){console.warn(`[CodeMirror] Failed to attach syntaxHighlighting for .${d}:`,e),z=!1}if(a=new g.EditorView({state:m.EditorState.create({doc:t,extensions:B}),parent:b.current}),n){a.destroy();return}x.current=a,j(z),N(!0),T.current=R,E.current=s??null,D.current=null,L(e=>e+1);let V=new MutationObserver(()=>{let e=x.current;if(e&&z&&o&&c&&l)try{e.dispatch({effects:o.reconfigure(c.syntaxHighlighting(_(c,l)))})}catch{}});S.current=V,V.observe(document.documentElement,{attributes:!0,attributeFilter:[`data-theme`]})}catch(e){console.error(`[CodeMirror] Fatal editor initialization error:`,e),n||N(!0)}})(),()=>{n=!0,S.current?.disconnect(),S.current=null,a?.destroy(),x.current=null,N(!1),b.current&&(b.current.textContent=``)}},[e,y]),(0,o.useEffect)(()=>{let e=x.current;if(!e)return;let n=e.state.doc.toString();n!==t&&e.dispatch({changes:{from:0,to:n.length,insert:t},annotations:C.current?C.current.of(!0):void 0})},[t]),(0,o.useEffect)(()=>{let e=x.current;if(!e||!s)return;let t=e.state.doc.line(Math.min(Math.max(1,s.line),e.state.doc.lines)),n=Math.min(t.to,t.from+(s.column??1)-1);e.dispatch({selection:{anchor:t.to,head:n},scrollIntoView:!0}),e.focus()},[s,M]);let R=!!(g&&g.state===`ready`&&g.response&&g.path===e&&g.workspaceId===l);(0,o.useEffect)(()=>{let t=x.current,n=T.current,r=E.current;if(!t||!n||!r)return;let i=g&&g.state===`ready`&&g.response&&g.path===e&&g.workspaceId===l?g.response:null,o=i?a(i):null;D.current!==o&&(D.current=o,t.dispatch({effects:[n.setBlame.of(o),r.reconfigure(o?n.gutter:[])]}))},[g?.state,g?.response,g?.path,g?.workspaceId,e,l,I]);let z=x.current?.state.doc.toString()??t,B=z.length<=m?z:z.slice(0,m),V=h(e),H=d(V),U=x.current?.state,W=U?.selection.main.head,G=W===void 0?void 0:U?.doc.lineAt(W),K=G?.number,q=W!==void 0&&G?W-G.from+1:void 0;return(0,o.useEffect)(()=>{M&&K!==void 0&&q!==void 0&&v?.({line:K,column:q,language:A&&H||`纯文本`,highlight:A?V:`plain`})},[M,K,q,A,H,V,v]),(0,o.useEffect)(()=>()=>v?.(),[v]),(0,f.jsxs)(`div`,{className:`file-cm-wrap`,"data-file-text":e,"data-file-content":B,"data-file-content-truncated":z.length>m?`1`:`0`,"data-file-selection":P,"data-file-editor-ready":M?`1`:`0`,"data-file-blame-gutter":R?`1`:void 0,onMouseDown:()=>x.current?.focus(),children:[(0,f.jsx)(`div`,{className:`file-cm`,ref:b,"aria-label":`${y?`查看`:`编辑`} ${e}`}),(!M||!v)&&(0,f.jsxs)(`div`,{className:`file-editor-status`,children:[!M&&(0,f.jsx)(`span`,{"data-file-editor-loading":`1`,children:`正在加载编辑器…`}),M&&W!==void 0&&G&&(0,f.jsxs)(`span`,{children:[`第 `,G.number,` 行,第 `,W-G.from+1,` 列`]}),M&&!A&&(0,f.jsx)(`span`,{"data-file-highlight-status":`plain`,children:`纯文本`}),M&&A&&H&&(0,f.jsx)(`span`,{"data-file-highlight-status":V,children:H})]})]})}export{v as CodeMirrorEditor,u as t,_ as themeHighlightStyle};
|