litepaseo 0.12.0 → 0.12.2
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/CHANGELOG.md +9 -0
- package/dist/server/cli.mjs +2 -2
- package/dist/server/{worker-TNHqbaQJ.mjs → worker-BFGIplko.mjs} +62 -5
- package/dist/web/assets/{AddProjectDialog-_36OIb51.js → AddProjectDialog-BLxWPHSV.js} +1 -1
- package/dist/web/assets/AddProjectDialog-BLxWPHSV.js.br +0 -0
- package/dist/web/assets/AddProjectDialog-BLxWPHSV.js.gz +0 -0
- package/dist/web/assets/{ArchivedWorkspaces-CqqsYbdO.js → ArchivedWorkspaces-CI1WOL06.js} +1 -1
- package/dist/web/assets/ArchivedWorkspaces-CI1WOL06.js.br +0 -0
- package/dist/web/assets/ArchivedWorkspaces-CI1WOL06.js.gz +0 -0
- package/dist/web/assets/{ChangesPanel-CwViT_wP.js → ChangesPanel-BkZxgG02.js} +1 -1
- package/dist/web/assets/ChangesPanel-BkZxgG02.js.br +0 -0
- package/dist/web/assets/ChangesPanel-BkZxgG02.js.gz +0 -0
- package/dist/web/assets/{CodeBlockNode-D5zVOBI7.js → CodeBlockNode-DdarDbUY.js} +1 -1
- package/dist/web/assets/CodeBlockNode-DdarDbUY.js.br +0 -0
- package/dist/web/assets/CodeBlockNode-DdarDbUY.js.gz +0 -0
- package/dist/web/assets/{CommandCenter-CPKoI-EY.js → CommandCenter-B5_Pxy0J.js} +1 -1
- package/dist/web/assets/CommandCenter-B5_Pxy0J.js.br +0 -0
- package/dist/web/assets/CommandCenter-B5_Pxy0J.js.gz +0 -0
- package/dist/web/assets/{ConversationSearch-BbIj0S1y.js → ConversationSearch-CalLvgyc.js} +1 -1
- package/dist/web/assets/ConversationSearch-CalLvgyc.js.br +0 -0
- package/dist/web/assets/ConversationSearch-CalLvgyc.js.gz +0 -0
- package/dist/web/assets/{FileViewer-DH405NTP.js → FileViewer-B7MjCzPt.js} +1 -1
- package/dist/web/assets/FileViewer-B7MjCzPt.js.br +0 -0
- package/dist/web/assets/FileViewer-B7MjCzPt.js.gz +0 -0
- package/dist/web/assets/{FilesPanel-DQJZABpn.js → FilesPanel-BnJhiHEi.js} +1 -1
- package/dist/web/assets/FilesPanel-BnJhiHEi.js.br +0 -0
- package/dist/web/assets/FilesPanel-BnJhiHEi.js.gz +0 -0
- package/dist/web/assets/{HostSettings-D3rQBnhs.js → HostSettings-DNQuE0Bg.js} +1 -1
- package/dist/web/assets/HostSettings-DNQuE0Bg.js.br +0 -0
- package/dist/web/assets/HostSettings-DNQuE0Bg.js.gz +0 -0
- package/dist/web/assets/{KanbanPage-B-nOkn_9.js → KanbanPage-Bo1lGpZJ.js} +1 -1
- package/dist/web/assets/KanbanPage-Bo1lGpZJ.js.br +0 -0
- package/dist/web/assets/KanbanPage-Bo1lGpZJ.js.gz +0 -0
- package/dist/web/assets/{MarkdownMessage-DVfTcl-N.js → MarkdownMessage-N6A4HF22.js} +5 -5
- package/dist/web/assets/MarkdownMessage-N6A4HF22.js.br +0 -0
- package/dist/web/assets/MarkdownMessage-N6A4HF22.js.gz +0 -0
- package/dist/web/assets/{PreCodeBlock-CARNO3EN.js → PreCodeBlock-CkuCPuPW.js} +1 -1
- package/dist/web/assets/{PreCodeBlock.vue_vue_type_style_index_0_lang-BseU3RGb.js → PreCodeBlock.vue_vue_type_style_index_0_lang-uQYvfuPo.js} +1 -1
- package/dist/web/assets/PreCodeBlock.vue_vue_type_style_index_0_lang-uQYvfuPo.js.br +0 -0
- package/dist/web/assets/PreCodeBlock.vue_vue_type_style_index_0_lang-uQYvfuPo.js.gz +0 -0
- package/dist/web/assets/{SubagentsPanel-yzUFEqvy.js → SubagentsPanel-9hNkpyCH.js} +1 -1
- package/dist/web/assets/SubagentsPanel-9hNkpyCH.js.br +0 -0
- package/dist/web/assets/SubagentsPanel-9hNkpyCH.js.gz +0 -0
- package/dist/web/assets/{TerminalPanel-Dc4stiMR.js → TerminalPanel-DdYYjx43.js} +1 -1
- package/dist/web/assets/TerminalPanel-DdYYjx43.js.br +0 -0
- package/dist/web/assets/TerminalPanel-DdYYjx43.js.gz +0 -0
- package/dist/web/assets/{Tooltip-Begx0pjU.js → Tooltip-Dm05uqJp.js} +1 -1
- package/dist/web/assets/Tooltip-Dm05uqJp.js.br +0 -0
- package/dist/web/assets/Tooltip-Dm05uqJp.js.gz +0 -0
- package/dist/web/assets/index-BYfYTC37.js +36 -0
- package/dist/web/assets/index-BYfYTC37.js.br +0 -0
- package/dist/web/assets/index-BYfYTC37.js.gz +0 -0
- package/dist/web/assets/{index10-BESFh9pI.js → index10-BM68C-_8.js} +1 -1
- package/dist/web/assets/index10-BM68C-_8.js.br +0 -0
- package/dist/web/assets/index10-BM68C-_8.js.gz +0 -0
- package/dist/web/assets/index3-DRTxELjn.js +1 -0
- package/dist/web/assets/index4-CC_NIAY8.js +1 -0
- package/dist/web/assets/{index5-BPWZUGCC.js → index5-BAhnSjSa.js} +1 -1
- package/dist/web/assets/index5-BAhnSjSa.js.br +0 -0
- package/dist/web/assets/index5-BAhnSjSa.js.gz +0 -0
- package/dist/web/assets/{index6-Dh9oRg8n.js → index6-DqBuE7Hj.js} +1 -1
- package/dist/web/assets/index6-DqBuE7Hj.js.br +0 -0
- package/dist/web/assets/index6-DqBuE7Hj.js.gz +0 -0
- package/dist/web/assets/{index7-D8FkUkPj.js → index7-Dpl81yIG.js} +1 -1
- package/dist/web/assets/index7-Dpl81yIG.js.br +0 -0
- package/dist/web/assets/index7-Dpl81yIG.js.gz +0 -0
- package/dist/web/assets/{index8-Co4X7Em2.js → index8-H-v6DMrA.js} +1 -1
- package/dist/web/assets/index8-H-v6DMrA.js.br +0 -0
- package/dist/web/assets/index8-H-v6DMrA.js.gz +0 -0
- package/dist/web/assets/{index9-q2f3EgxS.js → index9-CuB3jKlU.js} +1 -1
- package/dist/web/assets/index9-CuB3jKlU.js.br +0 -0
- package/dist/web/assets/{index9-q2f3EgxS.js.gz → index9-CuB3jKlU.js.gz} +0 -0
- package/dist/web/index.html +1 -1
- package/dist/web/index.html.br +0 -0
- package/dist/web/index.html.gz +0 -0
- package/package.json +1 -1
- package/dist/web/assets/AddProjectDialog-_36OIb51.js.br +0 -0
- package/dist/web/assets/AddProjectDialog-_36OIb51.js.gz +0 -0
- package/dist/web/assets/ArchivedWorkspaces-CqqsYbdO.js.br +0 -0
- package/dist/web/assets/ArchivedWorkspaces-CqqsYbdO.js.gz +0 -0
- package/dist/web/assets/ChangesPanel-CwViT_wP.js.br +0 -0
- package/dist/web/assets/ChangesPanel-CwViT_wP.js.gz +0 -0
- package/dist/web/assets/CodeBlockNode-D5zVOBI7.js.br +0 -0
- package/dist/web/assets/CodeBlockNode-D5zVOBI7.js.gz +0 -0
- package/dist/web/assets/CommandCenter-CPKoI-EY.js.br +0 -0
- package/dist/web/assets/CommandCenter-CPKoI-EY.js.gz +0 -0
- package/dist/web/assets/ConversationSearch-BbIj0S1y.js.br +0 -0
- package/dist/web/assets/ConversationSearch-BbIj0S1y.js.gz +0 -0
- package/dist/web/assets/FileViewer-DH405NTP.js.br +0 -0
- package/dist/web/assets/FileViewer-DH405NTP.js.gz +0 -0
- package/dist/web/assets/FilesPanel-DQJZABpn.js.br +0 -0
- package/dist/web/assets/FilesPanel-DQJZABpn.js.gz +0 -0
- package/dist/web/assets/HostSettings-D3rQBnhs.js.br +0 -0
- package/dist/web/assets/HostSettings-D3rQBnhs.js.gz +0 -0
- package/dist/web/assets/KanbanPage-B-nOkn_9.js.br +0 -0
- package/dist/web/assets/KanbanPage-B-nOkn_9.js.gz +0 -0
- package/dist/web/assets/MarkdownMessage-DVfTcl-N.js.br +0 -0
- package/dist/web/assets/MarkdownMessage-DVfTcl-N.js.gz +0 -0
- package/dist/web/assets/PreCodeBlock.vue_vue_type_style_index_0_lang-BseU3RGb.js.br +0 -0
- package/dist/web/assets/PreCodeBlock.vue_vue_type_style_index_0_lang-BseU3RGb.js.gz +0 -0
- package/dist/web/assets/SubagentsPanel-yzUFEqvy.js.br +0 -0
- package/dist/web/assets/SubagentsPanel-yzUFEqvy.js.gz +0 -0
- package/dist/web/assets/TerminalPanel-Dc4stiMR.js.br +0 -0
- package/dist/web/assets/TerminalPanel-Dc4stiMR.js.gz +0 -0
- package/dist/web/assets/Tooltip-Begx0pjU.js.br +0 -0
- package/dist/web/assets/Tooltip-Begx0pjU.js.gz +0 -0
- package/dist/web/assets/index-E9is825N.js +0 -36
- package/dist/web/assets/index-E9is825N.js.br +0 -0
- package/dist/web/assets/index-E9is825N.js.gz +0 -0
- package/dist/web/assets/index10-BESFh9pI.js.br +0 -0
- package/dist/web/assets/index10-BESFh9pI.js.gz +0 -0
- package/dist/web/assets/index3-BUZLp-Gs.js +0 -1
- package/dist/web/assets/index4-CaPspL_B.js +0 -1
- package/dist/web/assets/index5-BPWZUGCC.js.br +0 -0
- package/dist/web/assets/index5-BPWZUGCC.js.gz +0 -0
- package/dist/web/assets/index6-Dh9oRg8n.js.br +0 -0
- package/dist/web/assets/index6-Dh9oRg8n.js.gz +0 -0
- package/dist/web/assets/index7-D8FkUkPj.js.br +0 -0
- package/dist/web/assets/index7-D8FkUkPj.js.gz +0 -0
- package/dist/web/assets/index8-Co4X7Em2.js.br +0 -0
- package/dist/web/assets/index8-Co4X7Em2.js.gz +0 -0
- package/dist/web/assets/index9-q2f3EgxS.js.br +0 -0
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,14 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 0.12.2
|
|
4
|
+
|
|
5
|
+
- **Next message suggestions compatibility & testing**: switch default token limit to `max_completion_tokens` (512) with automatic fallback to `max_tokens` for older gateways, fixing 400 errors on newer OpenAI/reasoning models; add a **Test** button in Settings to verify the configured endpoint directly.
|
|
6
|
+
- **Live turn stats refresh & summary**: automatically refresh the tail's projected `turnMetrics` when a turn finishes so Speed, Tokens, Cache, and Cost appear right away without reloading; show Speed, Tokens, and Cost directly in the turn footer button (skipping Model/Elapsed already shown beside it).
|
|
7
|
+
|
|
8
|
+
## 0.12.1
|
|
9
|
+
|
|
10
|
+
- Fix checkbox layout for **Auto-expand thinking** and **Chat outline rail** in Settings (use `switch-row` and `switch` styling so labels no longer collapse vertically).
|
|
11
|
+
|
|
3
12
|
## 0.12.0
|
|
4
13
|
|
|
5
14
|
- Upgrade `@getpaseo/client` and `@getpaseo/protocol` to `0.17.3`.
|
package/dist/server/cli.mjs
CHANGED
|
@@ -8,7 +8,7 @@ import { DatabaseSync } from "node:sqlite";
|
|
|
8
8
|
import { homedir } from "node:os";
|
|
9
9
|
import { fileURLToPath } from "node:url";
|
|
10
10
|
// src/server/version.ts
|
|
11
|
-
const VERSION = "0.12.
|
|
11
|
+
const VERSION = "0.12.2";
|
|
12
12
|
// src/server/rotating-log.ts
|
|
13
13
|
/** One writer (the supervisor); bounded active file plus numbered archives. */
|
|
14
14
|
var RotatingLog = class {
|
|
@@ -1764,7 +1764,7 @@ async function run() {
|
|
|
1764
1764
|
if (name === "--help" || name === "-h") return console.log(mainHelp(VERSION, displayDirectory(), out));
|
|
1765
1765
|
if (name === "worker") {
|
|
1766
1766
|
const paths = await dataDirectory();
|
|
1767
|
-
const { runWorker } = await import("./worker-
|
|
1767
|
+
const { runWorker } = await import("./worker-BFGIplko.mjs");
|
|
1768
1768
|
return runWorker(paths.directory, fileURLToPath(new URL("../web/", import.meta.url)));
|
|
1769
1769
|
}
|
|
1770
1770
|
const command = findCommand(name);
|
|
@@ -1229,6 +1229,34 @@ var TimelineView = class {
|
|
|
1229
1229
|
kind: "join"
|
|
1230
1230
|
});
|
|
1231
1231
|
}
|
|
1232
|
+
/**
|
|
1233
|
+
* Pulls the last few projected entries after a turn finishes so daemon-computed turnMetrics
|
|
1234
|
+
* (speed, tokens, cache, cost) attach to live rows without reloading the whole timeline.
|
|
1235
|
+
*/
|
|
1236
|
+
async refreshTailMetrics() {
|
|
1237
|
+
if (this.state !== "live" || !this.watchers.size) return;
|
|
1238
|
+
const token = this.token;
|
|
1239
|
+
try {
|
|
1240
|
+
const page = await this.driver.fetchAgentTimeline(this.agentId, {
|
|
1241
|
+
direction: "tail",
|
|
1242
|
+
limit: 8,
|
|
1243
|
+
projection: "projected",
|
|
1244
|
+
wholeTurns: false
|
|
1245
|
+
});
|
|
1246
|
+
if (token !== this.token || this.state !== "live" || page.epoch !== this.epoch) return;
|
|
1247
|
+
let updated = false;
|
|
1248
|
+
for (const entry of page.entries) {
|
|
1249
|
+
if (!entry.turnMetrics?.length) continue;
|
|
1250
|
+
const existing = this.bySeqStart.get(entry.seqStart);
|
|
1251
|
+
if (!existing) continue;
|
|
1252
|
+
if (JSON.stringify(existing.turnMetrics ?? null) === JSON.stringify(entry.turnMetrics)) continue;
|
|
1253
|
+
existing.turnMetrics = entry.turnMetrics;
|
|
1254
|
+
this.mark(existing.seqStart, true);
|
|
1255
|
+
updated = true;
|
|
1256
|
+
}
|
|
1257
|
+
if (updated) this.flush();
|
|
1258
|
+
} catch {}
|
|
1259
|
+
}
|
|
1232
1260
|
broadcast(ops) {
|
|
1233
1261
|
notifyListeners(this.watchers, ops);
|
|
1234
1262
|
}
|
|
@@ -1746,7 +1774,10 @@ var Hosts = class {
|
|
|
1746
1774
|
/** Wires a connected-or-connecting driver; separate from `add` so tests can inject doubles. */
|
|
1747
1775
|
attach(hostId, driver, api) {
|
|
1748
1776
|
this.assertDetached(hostId);
|
|
1749
|
-
const directory = new HostDirectory(hostId, driver, this.agents, () => this.emit(this.agentListeners), (previous, next) =>
|
|
1777
|
+
const directory = new HostDirectory(hostId, driver, this.agents, () => this.emit(this.agentListeners), (previous, next) => {
|
|
1778
|
+
if (previous && next && (previous.turnActive || previous.state === "running") && !next.turnActive && next.state !== "running") this.timelines.get(next.key)?.view.refreshTailMetrics();
|
|
1779
|
+
notifyListeners(this.transitionListeners, previous, next);
|
|
1780
|
+
});
|
|
1750
1781
|
const workspaces = new HostWorkspaces(hostId, driver, this.workspaces, () => this.emit(this.agentListeners), this.emptyProjects);
|
|
1751
1782
|
const update = (state) => {
|
|
1752
1783
|
const previous = this.diagnostics.get(hostId) ?? {};
|
|
@@ -6270,7 +6301,7 @@ async function generateNextSuggestion(config, messages, fetchImpl = fetch) {
|
|
|
6270
6301
|
const controller = new AbortController();
|
|
6271
6302
|
const timer = setTimeout(() => controller.abort(), UPSTREAM_TIMEOUT_MS);
|
|
6272
6303
|
timer.unref?.();
|
|
6273
|
-
|
|
6304
|
+
const call = async (tokenField) => {
|
|
6274
6305
|
const response = await fetchImpl(`${config.baseUrl}/chat/completions`, {
|
|
6275
6306
|
method: "POST",
|
|
6276
6307
|
headers: {
|
|
@@ -6279,8 +6310,7 @@ async function generateNextSuggestion(config, messages, fetchImpl = fetch) {
|
|
|
6279
6310
|
},
|
|
6280
6311
|
body: JSON.stringify({
|
|
6281
6312
|
model: config.model,
|
|
6282
|
-
|
|
6283
|
-
max_tokens: 120,
|
|
6313
|
+
[tokenField]: tokenField === "max_completion_tokens" ? 512 : 160,
|
|
6284
6314
|
messages: [{
|
|
6285
6315
|
role: "system",
|
|
6286
6316
|
content: INSTRUCTION
|
|
@@ -6291,7 +6321,14 @@ async function generateNextSuggestion(config, messages, fetchImpl = fetch) {
|
|
|
6291
6321
|
}),
|
|
6292
6322
|
signal: controller.signal
|
|
6293
6323
|
});
|
|
6294
|
-
|
|
6324
|
+
return {
|
|
6325
|
+
response,
|
|
6326
|
+
bodyText: await readBoundedText(response)
|
|
6327
|
+
};
|
|
6328
|
+
};
|
|
6329
|
+
try {
|
|
6330
|
+
let { response, bodyText } = await call("max_completion_tokens");
|
|
6331
|
+
if (response.status === 400 && /max_completion_tokens/i.test(bodyText)) ({response, bodyText} = await call("max_tokens"));
|
|
6295
6332
|
if (!response.ok) {
|
|
6296
6333
|
let detail = `HTTP ${response.status}`;
|
|
6297
6334
|
try {
|
|
@@ -6367,6 +6404,26 @@ function registerSuggestionRoutes(app, { store, fetch }) {
|
|
|
6367
6404
|
cache.clear();
|
|
6368
6405
|
return c.json(nextSuggestionSettings(store));
|
|
6369
6406
|
});
|
|
6407
|
+
app.post("/api/next-suggestion/test", async (c) => {
|
|
6408
|
+
const config = nextSuggestionConfig(store);
|
|
6409
|
+
if (!config) return c.json({ error: "Suggestion service is not configured." }, 409);
|
|
6410
|
+
try {
|
|
6411
|
+
const text = await generateNextSuggestion(config, [{
|
|
6412
|
+
role: "user",
|
|
6413
|
+
text: "Fix the failing unit test and check the build."
|
|
6414
|
+
}, {
|
|
6415
|
+
role: "assistant",
|
|
6416
|
+
text: "Fixed the test and the build passes."
|
|
6417
|
+
}], fetch);
|
|
6418
|
+
return c.json({
|
|
6419
|
+
ok: true,
|
|
6420
|
+
sample: text || "(empty suggestion)"
|
|
6421
|
+
});
|
|
6422
|
+
} catch (error) {
|
|
6423
|
+
if (error instanceof NextSuggestionError) return c.json({ error: error.message }, error.status);
|
|
6424
|
+
throw error;
|
|
6425
|
+
}
|
|
6426
|
+
});
|
|
6370
6427
|
app.post("/api/hosts/:host/agents/:agent/next-suggestion", async (c) => {
|
|
6371
6428
|
const config = nextSuggestionConfig(store);
|
|
6372
6429
|
if (!config) return c.json({
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{C as e,H as t,I as ee,Q as n,S as r,T as i,Y as te,c as a,ct as o,d as s,dt as c,f as l,g as u,h as ne,it as d,s as re,st as ie,v as f,y as p,z as m}from"./vue.runtime.esm-bundler-DmQNwI70.js";import{_ as h,g as ae,h as oe}from"./index-
|
|
1
|
+
import{C as e,H as t,I as ee,Q as n,S as r,T as i,Y as te,c as a,ct as o,d as s,dt as c,f as l,g as u,h as ne,it as d,s as re,st as ie,v as f,y as p,z as m}from"./vue.runtime.esm-bundler-DmQNwI70.js";import{_ as h,g as ae,h as oe}from"./index-BYfYTC37.js";var se={class:`sheet-head`},g={class:`add-project-body`},ce={key:0,class:`field`},le=[`value`],ue={class:`segmented segmented-sm`,role:`tablist`},de=[`aria-selected`],fe=[`aria-selected`],pe={key:1,class:`setting-note is-error`,role:`alert`},me={class:`field`},he=[`disabled`],ge={class:`form-actions`},_e=[`disabled`],ve={key:0,class:`add-project-suggestions`},ye={key:0,class:`subtle`},be=[`disabled`,`onClick`],_={class:`grow`},v={class:`row-title`},y={class:`row-sub mono`},b=[`disabled`],x={key:0,class:`add-project-suggestions`},S=[`onClick`],C={class:`grow`},w={class:`row-title`},T={key:0,class:`hs-tag`},E={key:0,class:`row-sub`},D={class:`field`},O=[`disabled`],k={class:`field`},A=[`disabled`],j={class:`segmented segmented-sm`},M={class:`form-actions`},N=[`disabled`],P=i({__name:`AddProjectDialog`,props:{hosts:{},initialHostId:{},api:{type:Function}},emits:[`close`,`added`],setup(i,{emit:P}){let F=i,I=P,L=d(null);ae(L,()=>I(`close`));let R=ne(()=>F.hosts.filter(e=>e.state===`connected`)),z=d(R.value.find(e=>e.id===F.initialHostId)?.id??R.value[0]?.id??``),B=d(`path`),V=d(``),H=d([]),U=d(!1),W=d(!1),G=d(``),K=d(``),q=d([]),J=d(!1),Y=d(``),X=d(``),Z=d(`ssh`);async function Q(){if(z.value){U.value=!0;try{let e=await F.api(`/hosts/${encodeURIComponent(z.value)}/project-suggestions`);H.value=(e.suggestions??[]).map(e=>({path:e.path??e.rootPath??e.cwd??``,name:e.name??e.displayName})).filter(e=>!!e.path)}catch{H.value=[]}finally{U.value=!1}}}te(z,()=>{H.value=[],Q()},{immediate:!0});async function $(e){let t=(e??V.value).trim();if(z.value&&t){W.value=!0,G.value=``;try{await F.api(`/hosts/${encodeURIComponent(z.value)}/projects`,`POST`,{cwd:t}),I(`added`,z.value,t),I(`close`)}catch(e){G.value=e.message||`Could not add project.`}finally{W.value=!1}}}async function xe(){if(z.value&&K.value.trim()){J.value=!0,G.value=``;try{let e=await F.api(`/hosts/${encodeURIComponent(z.value)}/github/search?q=${encodeURIComponent(K.value.trim())}`);q.value=(e.repositories??[]).map(e=>({fullName:e.fullName??e.nameWithOwner??e.repo??``,description:e.description??null,isPrivate:e.isPrivate===!0||e.private===!0})).filter(e=>!!e.fullName)}catch(e){G.value=e.message||`Could not search GitHub.`}finally{J.value=!1}}}async function Se(){if(z.value&&Y.value.trim()&&X.value.trim()){W.value=!0,G.value=``;try{let e=await F.api(`/hosts/${encodeURIComponent(z.value)}/projects/clone`,`POST`,{repo:Y.value.trim(),targetDirectory:X.value.trim(),cloneProtocol:Z.value},12e4);I(`added`,z.value,e.path||X.value.trim()),I(`close`)}catch(e){G.value=e.message||`Could not clone repository.`}finally{W.value=!1}}}return ee(()=>void Q()),(ee,i)=>(m(),p(`div`,{class:`overlay`,onMousedown:i[13]||=s(e=>I(`close`),[`self`])},[u(`section`,{ref_key:`sheet`,ref:L,class:`sheet add-project-sheet`,role:`dialog`,"aria-modal":`true`,"aria-label":`Add project`,tabindex:`-1`},[u(`header`,se,[i[14]||=u(`h2`,null,`Add project`,-1),u(`button`,{type:`button`,class:`icon-btn`,"aria-label":`Close`,onClick:i[0]||=e=>I(`close`)},[e(h,{name:`close`,size:16})])]),u(`div`,g,[R.value.length>1?(m(),p(`label`,ce,[i[15]||=u(`span`,null,`Host`,-1),n(u(`select`,{"onUpdate:modelValue":i[1]||=e=>z.value=e},[(m(!0),p(l,null,t(R.value,e=>(m(),p(`option`,{key:e.id,value:e.id},c(e.label),9,le))),128))],512),[[re,z.value]])])):f(``,!0),u(`div`,ue,[u(`button`,{type:`button`,role:`tab`,"aria-selected":B.value===`path`,class:o({chosen:B.value===`path`}),onClick:i[2]||=e=>B.value=`path`},`Host directory`,10,de),u(`button`,{type:`button`,role:`tab`,"aria-selected":B.value===`github`,class:o({chosen:B.value===`github`}),onClick:i[3]||=e=>B.value=`github`},`Clone from GitHub`,10,fe)]),G.value?(m(),p(`p`,pe,c(G.value),1)):f(``,!0),B.value===`path`?(m(),p(l,{key:2},[u(`form`,{class:`add-project-form`,onSubmit:i[6]||=s(e=>$(),[`prevent`])},[u(`label`,me,[i[16]||=u(`span`,null,`Directory path on host`,-1),n(u(`input`,{"onUpdate:modelValue":i[4]||=e=>V.value=e,placeholder:`/home/user/code/my-repo`,disabled:W.value,autofocus:``},null,8,he),[[a,V.value]])]),u(`div`,ge,[u(`button`,{type:`button`,class:`btn btn-ghost`,onClick:i[5]||=e=>I(`close`)},`Cancel`),u(`button`,{type:`submit`,class:`btn btn-primary`,disabled:W.value||!V.value.trim()},c(W.value?`Adding…`:`Add project`),9,_e)])],32),H.value.length||U.value?(m(),p(`div`,ve,[i[19]||=u(`span`,{class:`subtle`},`Recent repositories on this host`,-1),U.value&&!H.value.length?(m(),p(`p`,ye,[...i[17]||=[u(`span`,{class:`spinner spinner-sm`},null,-1),r(` Loading…`,-1)]])):f(``,!0),(m(!0),p(l,null,t(H.value.slice(0,10),t=>(m(),p(`button`,{key:t.path,type:`button`,class:`suggestion-row`,disabled:W.value,onClick:e=>$(t.path)},[e(h,{name:`folder`,size:14}),u(`span`,_,[u(`span`,v,c(t.name||t.path.split(`/`).pop()),1),u(`span`,y,c(ie(oe)(t.path)),1)]),i[18]||=u(`span`,{class:`row-sub`},`Add`,-1)],8,be))),128))])):f(``,!0)],64)):(m(),p(l,{key:3},[u(`form`,{class:`archived-search`,onSubmit:s(xe,[`prevent`])},[n(u(`input`,{"onUpdate:modelValue":i[7]||=e=>K.value=e,placeholder:`Search GitHub repos (owner/name or keyword)…`},null,512),[[a,K.value]]),u(`button`,{type:`submit`,class:`btn btn-sm btn-outline`,disabled:J.value||!K.value.trim()},c(J.value?`Searching…`:`Search`),9,b)],32),q.value.length?(m(),p(`div`,x,[(m(!0),p(l,null,t(q.value,t=>(m(),p(`button`,{key:t.fullName,type:`button`,class:o([`suggestion-row`,{chosen:Y.value===t.fullName}]),onClick:e=>Y.value=t.fullName},[e(h,{name:`branch`,size:14}),u(`span`,C,[u(`span`,w,[r(c(t.fullName)+` `,1),t.isPrivate?(m(),p(`small`,T,`private`)):f(``,!0)]),t.description?(m(),p(`span`,E,c(t.description),1)):f(``,!0)])],10,S))),128))])):f(``,!0),u(`form`,{class:`add-project-form`,onSubmit:s(Se,[`prevent`])},[u(`label`,D,[i[20]||=u(`span`,null,`Repository (owner/repo)`,-1),n(u(`input`,{"onUpdate:modelValue":i[8]||=e=>Y.value=e,placeholder:`owner/repo`,disabled:W.value},null,8,O),[[a,Y.value]])]),u(`label`,k,[i[21]||=u(`span`,null,`Target directory on host`,-1),n(u(`input`,{"onUpdate:modelValue":i[9]||=e=>X.value=e,placeholder:`/home/user/code/repo`,disabled:W.value},null,8,A),[[a,X.value]])]),u(`div`,j,[u(`button`,{type:`button`,class:o({chosen:Z.value===`ssh`}),onClick:i[10]||=e=>Z.value=`ssh`},`SSH`,2),u(`button`,{type:`button`,class:o({chosen:Z.value===`https`}),onClick:i[11]||=e=>Z.value=`https`},`HTTPS`,2)]),u(`div`,M,[u(`button`,{type:`button`,class:`btn btn-ghost`,onClick:i[12]||=e=>I(`close`)},`Cancel`),u(`button`,{type:`submit`,class:`btn btn-primary`,disabled:W.value||!Y.value.trim()||!X.value.trim()},c(W.value?`Cloning…`:`Clone & add`),9,N)])],32)],64))])],512)],32))}});export{P as default};
|
|
Binary file
|
|
Binary file
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{C as e,H as t,I as n,Q as r,S as i,T as a,c as o,d as s,dt as c,f as l,g as u,h as d,it as f,v as p,y as m,z as h}from"./vue.runtime.esm-bundler-DmQNwI70.js";import{_ as g,g as _,t as v}from"./index-
|
|
1
|
+
import{C as e,H as t,I as n,Q as r,S as i,T as a,c as o,d as s,dt as c,f as l,g as u,h as d,it as f,v as p,y as m,z as h}from"./vue.runtime.esm-bundler-DmQNwI70.js";import{_ as g,g as _,t as v}from"./index-BYfYTC37.js";var y={class:`sheet-head`},b={class:`archived-search`},x=[`disabled`],S={key:0,class:`setting-note is-error`,role:`alert`},C={class:`archived-list`},w={key:0,class:`subtle archived-empty`},T={key:1,class:`subtle archived-empty`},E={class:`grow`},D={class:`row-title`},O={class:`row-sub`},k=[`disabled`,`onClick`],A=a({__name:`ArchivedWorkspaces`,props:{hosts:{},api:{type:Function}},emits:[`close`,`restored`],setup(a,{emit:A}){let j=a,M=A,N=f(null);_(N,()=>M(`close`));let P=f(``),F=f([]),I=f(!1),L=f(``),R=f(null),z=d(()=>new Map(j.hosts.map(e=>[e.id,e.label])));async function B(){I.value=!0,L.value=``;let e=j.hosts.filter(e=>e.state===`connected`);try{let t=await Promise.allSettled(e.map(e=>{let t=P.value.trim()?`?q=${encodeURIComponent(P.value.trim())}`:``;return j.api(`/hosts/${encodeURIComponent(e.id)}/archived-workspaces${t}`)})),n=[];for(let e of t)e.status===`fulfilled`&&Array.isArray(e.value)&&n.push(...e.value);n.sort((e,t)=>Date.parse(t.archivedAt)-Date.parse(e.archivedAt)),F.value=n}catch(e){L.value=e.message||`Could not load archived workspaces.`}finally{I.value=!1}}async function V(e){if(!e.workspaceId)return;let t=`${e.hostId}:${e.workspaceId}`;R.value=t,L.value=``;try{await j.api(`/hosts/${encodeURIComponent(e.hostId)}/workspaces/${encodeURIComponent(e.workspaceId)}/restore`,`POST`,{}),F.value=F.value.filter(t=>t.hostId!==e.hostId||t.workspaceId!==e.workspaceId),M(`restored`,e.hostId,e.workspaceId)}catch(e){L.value=e.message||`Could not restore workspace.`}finally{R.value=null}}function H(e){let t=Math.max(0,(Date.now()-Date.parse(e))/1e3);return t<90?`just now`:t<3600?Math.round(t/60)+`m ago`:t<86400?Math.round(t/3600)+`h ago`:Math.round(t/86400)+`d ago`}return n(()=>void B()),(n,d)=>(h(),m(`div`,{class:`overlay`,onMousedown:d[2]||=s(e=>M(`close`),[`self`])},[u(`section`,{ref_key:`sheet`,ref:N,class:`sheet archived-sheet`,role:`dialog`,"aria-modal":`true`,"aria-label":`Archived workspaces`,tabindex:`-1`},[u(`header`,y,[d[3]||=u(`h2`,null,`Archived workspaces`,-1),u(`button`,{type:`button`,class:`icon-btn`,"aria-label":`Close`,onClick:d[0]||=e=>M(`close`)},[e(g,{name:`close`,size:16})])]),u(`div`,b,[u(`form`,{onSubmit:s(B,[`prevent`])},[r(u(`input`,{"onUpdate:modelValue":d[1]||=e=>P.value=e,type:`search`,placeholder:`Search archived workspaces…`,"aria-label":`Search archived workspaces`},null,512),[[o,P.value]]),u(`button`,{type:`submit`,class:`btn btn-sm btn-outline`,disabled:I.value},c(I.value?`Loading…`:`Search`),9,x)],32)]),L.value?(h(),m(`p`,S,c(L.value),1)):p(``,!0),u(`div`,C,[I.value&&!F.value.length?(h(),m(`p`,w,[...d[4]||=[u(`span`,{class:`spinner spinner-sm`},null,-1),i(` Loading archived workspaces…`,-1)]])):F.value.length?p(``,!0):(h(),m(`p`,T,`No archived workspaces found.`)),(h(!0),m(l,null,t(F.value,t=>(h(),m(`div`,{key:t.hostId+`:`+(t.workspaceId||t.id),class:`archived-row`},[e(v,{provider:t.provider},null,8,[`provider`]),u(`div`,E,[u(`div`,D,c(t.name),1),u(`div`,O,[i(c(t.project)+` `,1),a.hosts.length>1?(h(),m(l,{key:0},[i(` · `+c(z.value.get(t.hostId)||t.hostId),1)],64)):p(``,!0),i(` · archived `+c(H(t.archivedAt)),1)])]),t.workspaceId?(h(),m(`button`,{key:0,type:`button`,class:`btn btn-sm btn-outline`,disabled:R.value===t.hostId+`:`+t.workspaceId,onClick:e=>V(t)},[e(g,{name:`undo`,size:13}),i(c(R.value===t.hostId+`:`+t.workspaceId?`Restoring…`:`Restore`),1)],8,k)):p(``,!0)]))),128))])],512)],32))}});export{A as default};
|
|
Binary file
|
|
Binary file
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{H as e,L as t,S as n,T as r,Y as i,ct as a,dt as o,f as s,g as c,it as l,v as u,y as d,z as f}from"./vue.runtime.esm-bundler-DmQNwI70.js";import{m as p}from"./index-
|
|
1
|
+
import{H as e,L as t,S as n,T as r,Y as i,ct as a,dt as o,f as s,g as c,it as l,v as u,y as d,z as f}from"./vue.runtime.esm-bundler-DmQNwI70.js";import{m as p}from"./index-BYfYTC37.js";var m={class:`changes-panel`},h=[`disabled`],g={key:0,role:`alert`},_={key:1},v={key:2},y=[`onToggle`],b=[`onClick`],x={key:0},S={key:1},C={class:`hunk`},w=p(r({__name:`ChangesPanel`,props:{hostId:{},cwd:{},api:{type:Function}},setup(r){let p=r,w=l([]),T=l(``),E=l(!1),D=l(!1),O=0,k=l(new Set);t(()=>O++);async function A(){let e=++O;E.value=!0,T.value=``,w.value=[],D.value=!1,k.value=new Set;try{let t=await p.api(`/hosts/${encodeURIComponent(p.hostId)}/changes?cwd=${encodeURIComponent(p.cwd)}`);if(e!==O)return;w.value=t.files,D.value=!!t.diffTooLarge}catch(t){e===O&&(T.value=t.message)}finally{e===O&&(E.value=!1)}}async function j(e){try{await navigator.clipboard.writeText(e)}catch{T.value=`Could not copy path.`}}return i(()=>[p.hostId,p.cwd],()=>{w.value=[],A()},{immediate:!0}),(t,r)=>(f(),d(`section`,m,[r[0]||=c(`p`,null,`Workspace uncommitted changes · includes changes from all contributors.`,-1),c(`button`,{class:`btn`,disabled:E.value,onClick:A},o(E.value?`Loading…`:`Refresh changes`),9,h),T.value?(f(),d(`p`,g,o(T.value),1)):u(``,!0),D.value?(f(),d(`p`,_,`Diff exceeds the host limit; some changes are omitted.`)):u(``,!0),!E.value&&!T.value&&!w.value.length?(f(),d(`p`,v,`No uncommitted changes.`)):u(``,!0),(f(!0),d(s,null,e(w.value,t=>(f(),d(`details`,{key:t.path,onToggle:e=>e.target.open?k.value.add(t.path):k.value.delete(t.path)},[c(`summary`,null,[n(o(t.oldPath?t.oldPath+` → `:``)+o(t.path)+` `,1),c(`span`,null,`+`+o(t.additions)+` −`+o(t.deletions),1)]),c(`button`,{class:`btn btn-ghost`,onClick:e=>j(t.path)},`Copy path`,8,b),t.status===`binary`?(f(),d(`p`,x,`Binary file changed.`)):t.status===`too_large`?(f(),d(`p`,S,`File diff is too large to display.`)):u(``,!0),k.value.has(t.path)?(f(!0),d(s,{key:2},e(t.hunks,(t,n)=>(f(),d(`pre`,{key:n},[c(`code`,null,[c(`span`,C,`@@ −`+o(t.oldStart)+`,`+o(t.oldCount)+` +`+o(t.newStart)+`,`+o(t.newCount)+` @@
|
|
2
2
|
`,1),(f(!0),d(s,null,e(t.lines,(e,t)=>(f(),d(`span`,{key:t,class:a(e.type)},o(e.type===`add`?`+`:e.type===`remove`?`−`:` `)+o(e.content),3))),128))])]))),128)):u(``,!0)],40,y))),128))]))}}),[[`__scopeId`,`data-v-4de9f4ce`]]);export{w as default};
|
|
Binary file
|
|
Binary file
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import{C as e,E as t,I as n,L as r,M as i,P as a,Q as o,T as s,U as c,Y as l,Z as u,_ as d,at as f,b as p,ct as ee,d as m,dt as te,g as h,h as g,it as _,k as ne,l as re,m as v,q as ie,st as ae,ut as oe,v as se,y as ce,z as le}from"./vue.runtime.esm-bundler-DmQNwI70.js";import{E as ue,G as de,U as fe,W as pe,X as me,Y as he,Z as ge,a as _e,at as ve,b as ye,c as be,d as xe,et as Se,ft as Ce,g as we,it as Te,lt as Ee,n as De,nt as Oe,ot as ke,rt as Ae,ut as je,v as Me,w as Ne,x as Pe}from"./MarkdownMessage-DVfTcl-N.js";import{n as Fe,r as Ie,t as Le}from"./PreCodeBlock.vue_vue_type_style_index_0_lang-BseU3RGb.js";import{n as Re,t as y}from"./safeRaf-BDp3SJMs.js";import{a as ze}from"./index-E9is825N.js";var b=(e,t,n)=>new Promise((r,i)=>{var a=e=>{try{s(n.next(e))}catch(e){i(e)}},o=e=>{try{s(n.throw(e))}catch(e){i(e)}},s=e=>e.done?r(e.value):Promise.resolve(e.value).then(a,o);s((n=n.apply(e,t)).next())}),Be=!1,Ve=null,He=null,Ue=null;function We(){return b(this,null,function*(){if(Ue)return Ue;Ue=b(null,null,function*(){if(!He)try{if(He=function(e){let t=e,n=typeof t?.createCodeBlockRuntime==`function`||typeof t?.useMonaco==`function`?t:e?.default,r=n?.createCodeBlockRuntime??n?.useMonaco;return typeof r==`function`?{createCodeBlockRuntime:e=>r.call(n,e),detectLanguage:(n?.detectLanguage)?.bind(n),preloadStreamDiffs:(n?.preloadStreamDiffs)?.bind(n)}:null}(yield ze(()=>import(`./markstream_markstream-vue-Bj0UewdV.js`),[])),!He)return null}catch{return null}try{return yield function(e){return b(this,null,function*(){if(!Be)return Ve||(Ve=b(null,null,function*(){let t=e?.preloadStreamDiffs;typeof t==`function`&&(yield t()),Be=!0}).finally(()=>{Ve=null}),Ve)})}(He),pe(),He}catch{return null}});try{return yield Ue}finally{Ue=null}})}var Ge=Object.defineProperty,Ke=Object.defineProperties,x=Object.getOwnPropertyDescriptors,S=Object.getOwnPropertySymbols,qe=Object.prototype.hasOwnProperty,C=Object.prototype.propertyIsEnumerable,Je=(e,t,n)=>t in e?Ge(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,w=(e,t)=>{for(var n in t||={})qe.call(t,n)&&Je(e,n,t[n]);if(S)for(var n of S(t))C.call(t,n)&&Je(e,n,t[n]);return e},Ye=(e,t)=>Ke(e,x(t)),T=(e,t,n)=>new Promise((r,i)=>{var a=e=>{try{s(n.next(e))}catch(e){i(e)}},o=e=>{try{s(n.throw(e))}catch(e){i(e)}},s=e=>e.done?r(e.value):Promise.resolve(e.value).then(a,o);s((n=n.apply(e,t)).next())}),E={class:`html-preview-frame__header`},Xe={class:`html-preview-frame__title`},D={class:`html-preview-frame__label`},O=[`sandbox`,`srcdoc`],Ze=Me(s({__name:`HtmlPreviewFrame`,props:{code:{},isDark:{type:Boolean},htmlPreviewAllowScripts:{type:Boolean},htmlPreviewSandbox:{},onClose:{type:Function},title:{}},setup(e){let t=e,{t:i}=Pe(),a=g(()=>{let e=t.code||``,n=e.trim().toLowerCase();return n.startsWith(`<!doctype`)||n.startsWith(`<html`)||n.startsWith(`<body`)?e:`<!doctype html>\n<html lang="en">\n <head>\n <meta charset="utf-8" />\n <meta name="viewport" content="width=device-width, initial-scale=1" />\n <style>\n html, body {\n margin: 0;\n padding: 0;\n height: 100%;\n background-color: ${t.isDark?`#020617`:`#ffffff`};\n color: ${t.isDark?`#e5e7eb`:`#020617`};\n }\n body {\n font-family: system-ui, -apple-system, BlinkMacSystemFont, 'SF Pro Text', ui-sans-serif, sans-serif;\n }\n </style>\n </head>\n <body>\n ${e}\n </body>\n</html>`}),o=g(()=>{return e=t.htmlPreviewSandbox,n=t.htmlPreviewAllowScripts,typeof e==`string`?e:e===void 0&&!0===n?`allow-scripts`:``;var e,n});function s(e){var n;e.key!==`Escape`&&e.key!==`Esc`||(n=t.onClose)==null||n.call(t)}return n(()=>{typeof window<`u`&&window.addEventListener(`keydown`,s)}),r(()=>{typeof window<`u`&&window.removeEventListener(`keydown`,s)}),(e,n)=>(le(),d(v,{to:`body`},[h(`div`,{class:ee([`markstream-vue`,{dark:t.isDark}])},[h(`div`,{class:`html-preview-frame__backdrop`,onClick:n[2]||=e=>t.onClose?.call(t)},[h(`div`,{class:`html-preview-frame`,onClick:n[1]||=m(()=>{},[`stop`])},[h(`div`,E,[h(`div`,Xe,[n[3]||=h(`span`,{class:`html-preview-frame__dot`},null,-1),h(`span`,D,te(t.title||ae(i)(`common.preview`)||`Preview`),1)]),h(`button`,{type:`button`,class:`html-preview-frame__close`,onClick:n[0]||=e=>t.onClose?.call(t)},` × `)]),h(`iframe`,{class:`html-preview-frame__iframe`,sandbox:o.value,referrerpolicy:`no-referrer`,srcdoc:a.value},null,8,O)])])],2)]))}}),[[`__scopeId`,`data-v-24e66176`]]),Qe=[`data-markstream-enhanced`,`data-markstream-enhancement-state`,`data-markstream-code-block-state`,`data-markstream-pending`,`data-markstream-viewport-pending`],$e={class:`code-header-main`},et=[`innerHTML`],tt={class:`code-header-copy`},nt={class:`code-header-title`},rt={key:0,class:`code-header-caption`},it=[`data-markstream-host-hidden`],k=Me(s({__name:`CodeBlockNode`,props:{node:{},codeBlockOptions:{},clipboardWriter:{},showLineNumbers:{type:Boolean,default:void 0},isDark:{type:Boolean,default:!1},loading:{type:Boolean,default:!0},stream:{type:Boolean,default:!0},theme:{},darkTheme:{default:void 0},lightTheme:{default:void 0},isShowPreview:{type:Boolean,default:!0},enableFontSizeControl:{type:Boolean,default:!0},minWidth:{default:void 0},maxWidth:{default:void 0},themes:{},showPreviewButton:{type:Boolean,default:!0},showCollapseButton:{type:Boolean,default:!0},showFontSizeButtons:{type:Boolean,default:!0},showTooltips:{type:Boolean},htmlPreviewAllowScripts:{type:Boolean},htmlPreviewSandbox:{},customId:{},showHeader:{type:Boolean,default:!0},showCopyButton:{type:Boolean,default:!0},showExpandButton:{type:Boolean,default:!0},estimatedHeightPx:{},estimatedContentHeightPx:{},estimatedDiffInline:{type:Boolean}},emits:[`previewCode`,`copy`],setup(s,{emit:m}){let v=s,pe=m,Me=g(()=>v.showLineNumbers??!0!==v.codeBlockOptions?.disableLineNumbers),ze=ie(),b=ne(me,null),Be=ne(`markstreamHostScrollManaged`,null),Ve=ne(we,void 0),He=g(()=>be(v,ze)),Ue=t(),Ge=g(()=>{let e=Ue?.vnode.props;return!(!e||!e.onPreviewCode&&!e[`onPreview-code`])}),{t:Ke}=Pe(),x=_(null),S=_(null),qe=_(!1),C=_(Hr(v.node.language,v.node.code,Vr())),Je=g(()=>ge(C.value)),E=g(()=>Je.value===`plaintext`?`text`:Je.value),Xe=g(()=>Je.value===`plaintext`),D=_(!1),O=_(!1),k=_(!1),A=_(!1),j=_(!1),at=_(!1),M=!1,ot=!1,st=null,ct=null,lt=null,ut=0,dt=!1,ft=``,pt=_(null),mt=0,ht=!1,gt=De(),_t=ue(),vt=xe(),yt=f(null),N=_(typeof window>`u`||!vt.value),bt=t()?.vnode.el?.textContent??``,xt=typeof window<`u`&&String(v.node.code??``).length>0&&bt.includes(String(v.node.code)),St=_(!xt);n(()=>{St.value=!0}),typeof window<`u`&&l([()=>S.value,vt],([e,t],n,r)=>{var i;if((i=yt.value)==null||i.destroy(),yt.value=null,!t||N.value)return void(N.value=!0);if(!e)return void(N.value=!1);let a=!0,o=_t?.value.heavyBlockMargin??_t?.value.rootMargin??`0px`,s=gt(e,{rootMargin:o,allowIdle:!1});yt.value=s,N.value=N.value||s.isVisible.value,s.whenVisible.then(()=>{a&&yt.value===s&&(N.value=!0)}).catch(()=>{}),r(()=>{a=!1,s.destroy(),yt.value===s&&(yt.value=null)})},{immediate:!0}),a(()=>{var e;M=!0,function(){let e=ft;b&&e&&(ft=``,b.markSettled(e))}(),(e=yt.value)==null||e.destroy(),yt.value=null});let P=null,Ct=null,wt=()=>{},Tt=()=>{},Et=()=>{},Dt=()=>{},Ot=()=>null,F=()=>({getModel:()=>({getLineCount:()=>1}),getOption:()=>14,updateOptions:()=>{}}),I=()=>({getModel:()=>({getLineCount:()=>1}),getOption:()=>14,updateOptions:()=>{}}),kt=()=>{},At=()=>{},jt=()=>{},Mt=null,L=null,Nt=null,Pt=null,Ft=()=>String(v.node.language??`plaintext`),It=()=>T(null,null,function*(){}),Lt=!1,Rt=null,zt=[],Bt=[],R=null,Vt=null,z=g(()=>Ae(v.node)),Ht=_({removed:0,added:0}),Ut=g(()=>`-${Ht.value.removed} +${Ht.value.added}`);function Wt(e,t){return{original:e,updated:t}}function Gt(e){return String(e??``).replace(/\r\n$|\n$|\r$/,``)}function Kt(e){return String(e?.message??e).includes(`no diff result available`)}function qt(){if(!$())try{let e=jt();e&&typeof e.catch==`function`&&e.catch(e=>{Kt(e)})}catch(e){Kt(e)}}let Jt=g(()=>{let e=w({},v.codeBlockOptions||{});for(let t of[`theme`,`themes`,`themeType`,`language`,`languages`,`stream`,`disableFileHeader`,`onThemeChange`,`renderCustomHeader`,`renderHeaderMetadata`,`renderHeaderPrefix`,`maxHeight`,`padding`,`tabSize`])delete e[t];if(!z.value)return e;let t=e.parseDiffOptions&&typeof e.parseDiffOptions==`object`?e.parseDiffOptions:{},n={diffStyle:`split`,expandUnchanged:!1,collapsedContextThreshold:5,hunkSeparators:`line-info`,parseDiffOptions:{context:2}};return Ye(w(w({},n),e),{parseDiffOptions:w(w({},n.parseDiffOptions),t)})}),Yt=g(()=>{return(v.theme===void 0?!fi(v.darkTheme,v.lightTheme):(e=v.theme)&&typeof e==`object`&&`light`in e&&`dark`in e)?!!v.isDark:function(e){let t=di(e)??``;return Te(t,!0===v.isDark)}(pi());var e}),Xt=g(()=>(z.value,Yt.value?`dark`:`light`)),Zt=g(()=>z.value?Xt.value===`dark`:Yt.value),B=g(()=>je({darkTheme:v.darkTheme,isDark:v.isDark,lightTheme:v.lightTheme,theme:v.theme,themes:v.themes})),Qt=g(()=>z.value?`diff`:`single`),$t=_(Qt.value),V=_(!1),H=_(!1),en=_(!1),U=_(!1),tn=_(null),nn=_(0),rn=_(0),an=_(!1),on=null,sn=!1,cn=null,ln=!1,un=g(()=>!!z.value&&Jt.value?.diffStyle===`unified`),dn=g(()=>ke(Jt.value));function fn(e){return!0===Be?.value||!!e&&(!!e.closest(`[data-markstream-virtual-timeline="1"], .markstream-virtual-timeline`)||!!e.closest(`.vue-recycle-scroller, [data-virtualizer], [data-virtual-scroll-root]`))}let pn=g(()=>fn(S.value)),mn=g(()=>!(V.value||!U.value&&H.value)),hn=g(()=>mn.value),gn=g(()=>mn.value&&!en.value),_n=g(()=>!V.value&&!U.value&&mn.value),vn=g(()=>H.value&&!V.value?`ready`:U.value?`fallback`:`pending`),yn=_(!1),W=g(()=>Gt(v.node.code)),bn=g(()=>z.value?!0===v.node.diff?v.node:Ye(w({},v.node),{diff:!0}):W.value===v.node.code?v.node:Ye(w({},v.node),{code:W.value}));function xn(e){let t=e.detectLanguage;typeof t==`function`&&(Ft=t),Vt=e,R=gi();let n=e.createCodeBlockRuntime(R);return!!n&&(P=n.createEditor||P,Ct=n.createDiffEditor||Ct,wt=n.updateCode||wt,Tt=n.updateDiff||Tt,Et=n.finalizeCode||Et,Dt=n.finalizeDiff||Dt,Ot=n.getEditor||Ot,F=n.getEditorView||F,I=n.getDiffEditorView||I,kt=n.cleanupEditor||kt,At=n.safeClean||n.cleanupEditor||At,jt=n.refreshDiffPresentation||jt,It=n.setTheme||It,Mt=n.whenVisualReady||null,at.value=!0,!0)}let G=_(typeof v.codeBlockOptions?.fontSize==`number`?v.codeBlockOptions.fontSize:NaN),K=_(G.value),Sn=_(null),Cn=_(null),wn=_(null),Tn=_(null),En=g(()=>{let e=G.value,t=K.value;return typeof e==`number`&&Number.isFinite(e)&&e>0&&typeof t==`number`&&Number.isFinite(t)&&t>0}),Dn=g(()=>{let e=v.codeBlockOptions?.fontSize;if(typeof e==`number`&&Number.isFinite(e)&&e>0)return e;let t=K.value;return typeof t==`number`&&Number.isFinite(t)&&t>0?t:12}),On=g(()=>{let e=v.codeBlockOptions?.lineHeight;return typeof e==`number`&&Number.isFinite(e)&&e>0?e:Dn.value===12?18:Math.max(12,Math.round(1.5*Dn.value))}),kn=g(()=>On.value),An=g(()=>{let e=v.codeBlockOptions?.tabSize;return typeof e==`number`&&Number.isFinite(e)&&e>0?e:4}),jn=g(()=>{let e=v.codeBlockOptions?.padding,t=typeof e==`number`&&Number.isFinite(e)&&e>=0?e:8;return{top:t,bottom:t}}),Mn=g(()=>Ye(w({},Ce(v.codeBlockOptions)),{fontSize:Dn.value,lineHeight:kn.value,maxHeight:zr(),padding:jn.value.top,paddingBottom:jn.value.bottom,tabSize:An.value})),Nn=g(()=>{let e=v.estimatedContentHeightPx;return typeof e==`number`&&Number.isFinite(e)&&e>0?e:null});function Pn(e){if(e==null)return null;let t=Math.ceil(e);return!Number.isFinite(t)||t<=0?null:Math.min(t,Math.ceil(zr()))}function Fn(){return!z.value&&!1!==v.stream&&!1!==v.loading}let In=_(Fn());function Ln(){return Fn()||In.value}let Rn=g(()=>z.value?null:Nn.value==null||Ln()?Math.ceil((e=>{let t=String(e??``);if(!t)return 1;let n=1;for(let e=0;e<t.length;e++)t[e]===`
|
|
1
|
+
import{C as e,E as t,I as n,L as r,M as i,P as a,Q as o,T as s,U as c,Y as l,Z as u,_ as d,at as f,b as p,ct as ee,d as m,dt as te,g as h,h as g,it as _,k as ne,l as re,m as v,q as ie,st as ae,ut as oe,v as se,y as ce,z as le}from"./vue.runtime.esm-bundler-DmQNwI70.js";import{E as ue,G as de,U as fe,W as pe,X as me,Y as he,Z as ge,a as _e,at as ve,b as ye,c as be,d as xe,et as Se,ft as Ce,g as we,it as Te,lt as Ee,n as De,nt as Oe,ot as ke,rt as Ae,ut as je,v as Me,w as Ne,x as Pe}from"./MarkdownMessage-N6A4HF22.js";import{n as Fe,r as Ie,t as Le}from"./PreCodeBlock.vue_vue_type_style_index_0_lang-uQYvfuPo.js";import{n as Re,t as y}from"./safeRaf-BDp3SJMs.js";import{a as ze}from"./index-BYfYTC37.js";var b=(e,t,n)=>new Promise((r,i)=>{var a=e=>{try{s(n.next(e))}catch(e){i(e)}},o=e=>{try{s(n.throw(e))}catch(e){i(e)}},s=e=>e.done?r(e.value):Promise.resolve(e.value).then(a,o);s((n=n.apply(e,t)).next())}),Be=!1,Ve=null,He=null,Ue=null;function We(){return b(this,null,function*(){if(Ue)return Ue;Ue=b(null,null,function*(){if(!He)try{if(He=function(e){let t=e,n=typeof t?.createCodeBlockRuntime==`function`||typeof t?.useMonaco==`function`?t:e?.default,r=n?.createCodeBlockRuntime??n?.useMonaco;return typeof r==`function`?{createCodeBlockRuntime:e=>r.call(n,e),detectLanguage:(n?.detectLanguage)?.bind(n),preloadStreamDiffs:(n?.preloadStreamDiffs)?.bind(n)}:null}(yield ze(()=>import(`./markstream_markstream-vue-Bj0UewdV.js`),[])),!He)return null}catch{return null}try{return yield function(e){return b(this,null,function*(){if(!Be)return Ve||(Ve=b(null,null,function*(){let t=e?.preloadStreamDiffs;typeof t==`function`&&(yield t()),Be=!0}).finally(()=>{Ve=null}),Ve)})}(He),pe(),He}catch{return null}});try{return yield Ue}finally{Ue=null}})}var Ge=Object.defineProperty,Ke=Object.defineProperties,x=Object.getOwnPropertyDescriptors,S=Object.getOwnPropertySymbols,qe=Object.prototype.hasOwnProperty,C=Object.prototype.propertyIsEnumerable,Je=(e,t,n)=>t in e?Ge(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,w=(e,t)=>{for(var n in t||={})qe.call(t,n)&&Je(e,n,t[n]);if(S)for(var n of S(t))C.call(t,n)&&Je(e,n,t[n]);return e},Ye=(e,t)=>Ke(e,x(t)),T=(e,t,n)=>new Promise((r,i)=>{var a=e=>{try{s(n.next(e))}catch(e){i(e)}},o=e=>{try{s(n.throw(e))}catch(e){i(e)}},s=e=>e.done?r(e.value):Promise.resolve(e.value).then(a,o);s((n=n.apply(e,t)).next())}),E={class:`html-preview-frame__header`},Xe={class:`html-preview-frame__title`},D={class:`html-preview-frame__label`},O=[`sandbox`,`srcdoc`],Ze=Me(s({__name:`HtmlPreviewFrame`,props:{code:{},isDark:{type:Boolean},htmlPreviewAllowScripts:{type:Boolean},htmlPreviewSandbox:{},onClose:{type:Function},title:{}},setup(e){let t=e,{t:i}=Pe(),a=g(()=>{let e=t.code||``,n=e.trim().toLowerCase();return n.startsWith(`<!doctype`)||n.startsWith(`<html`)||n.startsWith(`<body`)?e:`<!doctype html>\n<html lang="en">\n <head>\n <meta charset="utf-8" />\n <meta name="viewport" content="width=device-width, initial-scale=1" />\n <style>\n html, body {\n margin: 0;\n padding: 0;\n height: 100%;\n background-color: ${t.isDark?`#020617`:`#ffffff`};\n color: ${t.isDark?`#e5e7eb`:`#020617`};\n }\n body {\n font-family: system-ui, -apple-system, BlinkMacSystemFont, 'SF Pro Text', ui-sans-serif, sans-serif;\n }\n </style>\n </head>\n <body>\n ${e}\n </body>\n</html>`}),o=g(()=>{return e=t.htmlPreviewSandbox,n=t.htmlPreviewAllowScripts,typeof e==`string`?e:e===void 0&&!0===n?`allow-scripts`:``;var e,n});function s(e){var n;e.key!==`Escape`&&e.key!==`Esc`||(n=t.onClose)==null||n.call(t)}return n(()=>{typeof window<`u`&&window.addEventListener(`keydown`,s)}),r(()=>{typeof window<`u`&&window.removeEventListener(`keydown`,s)}),(e,n)=>(le(),d(v,{to:`body`},[h(`div`,{class:ee([`markstream-vue`,{dark:t.isDark}])},[h(`div`,{class:`html-preview-frame__backdrop`,onClick:n[2]||=e=>t.onClose?.call(t)},[h(`div`,{class:`html-preview-frame`,onClick:n[1]||=m(()=>{},[`stop`])},[h(`div`,E,[h(`div`,Xe,[n[3]||=h(`span`,{class:`html-preview-frame__dot`},null,-1),h(`span`,D,te(t.title||ae(i)(`common.preview`)||`Preview`),1)]),h(`button`,{type:`button`,class:`html-preview-frame__close`,onClick:n[0]||=e=>t.onClose?.call(t)},` × `)]),h(`iframe`,{class:`html-preview-frame__iframe`,sandbox:o.value,referrerpolicy:`no-referrer`,srcdoc:a.value},null,8,O)])])],2)]))}}),[[`__scopeId`,`data-v-24e66176`]]),Qe=[`data-markstream-enhanced`,`data-markstream-enhancement-state`,`data-markstream-code-block-state`,`data-markstream-pending`,`data-markstream-viewport-pending`],$e={class:`code-header-main`},et=[`innerHTML`],tt={class:`code-header-copy`},nt={class:`code-header-title`},rt={key:0,class:`code-header-caption`},it=[`data-markstream-host-hidden`],k=Me(s({__name:`CodeBlockNode`,props:{node:{},codeBlockOptions:{},clipboardWriter:{},showLineNumbers:{type:Boolean,default:void 0},isDark:{type:Boolean,default:!1},loading:{type:Boolean,default:!0},stream:{type:Boolean,default:!0},theme:{},darkTheme:{default:void 0},lightTheme:{default:void 0},isShowPreview:{type:Boolean,default:!0},enableFontSizeControl:{type:Boolean,default:!0},minWidth:{default:void 0},maxWidth:{default:void 0},themes:{},showPreviewButton:{type:Boolean,default:!0},showCollapseButton:{type:Boolean,default:!0},showFontSizeButtons:{type:Boolean,default:!0},showTooltips:{type:Boolean},htmlPreviewAllowScripts:{type:Boolean},htmlPreviewSandbox:{},customId:{},showHeader:{type:Boolean,default:!0},showCopyButton:{type:Boolean,default:!0},showExpandButton:{type:Boolean,default:!0},estimatedHeightPx:{},estimatedContentHeightPx:{},estimatedDiffInline:{type:Boolean}},emits:[`previewCode`,`copy`],setup(s,{emit:m}){let v=s,pe=m,Me=g(()=>v.showLineNumbers??!0!==v.codeBlockOptions?.disableLineNumbers),ze=ie(),b=ne(me,null),Be=ne(`markstreamHostScrollManaged`,null),Ve=ne(we,void 0),He=g(()=>be(v,ze)),Ue=t(),Ge=g(()=>{let e=Ue?.vnode.props;return!(!e||!e.onPreviewCode&&!e[`onPreview-code`])}),{t:Ke}=Pe(),x=_(null),S=_(null),qe=_(!1),C=_(Hr(v.node.language,v.node.code,Vr())),Je=g(()=>ge(C.value)),E=g(()=>Je.value===`plaintext`?`text`:Je.value),Xe=g(()=>Je.value===`plaintext`),D=_(!1),O=_(!1),k=_(!1),A=_(!1),j=_(!1),at=_(!1),M=!1,ot=!1,st=null,ct=null,lt=null,ut=0,dt=!1,ft=``,pt=_(null),mt=0,ht=!1,gt=De(),_t=ue(),vt=xe(),yt=f(null),N=_(typeof window>`u`||!vt.value),bt=t()?.vnode.el?.textContent??``,xt=typeof window<`u`&&String(v.node.code??``).length>0&&bt.includes(String(v.node.code)),St=_(!xt);n(()=>{St.value=!0}),typeof window<`u`&&l([()=>S.value,vt],([e,t],n,r)=>{var i;if((i=yt.value)==null||i.destroy(),yt.value=null,!t||N.value)return void(N.value=!0);if(!e)return void(N.value=!1);let a=!0,o=_t?.value.heavyBlockMargin??_t?.value.rootMargin??`0px`,s=gt(e,{rootMargin:o,allowIdle:!1});yt.value=s,N.value=N.value||s.isVisible.value,s.whenVisible.then(()=>{a&&yt.value===s&&(N.value=!0)}).catch(()=>{}),r(()=>{a=!1,s.destroy(),yt.value===s&&(yt.value=null)})},{immediate:!0}),a(()=>{var e;M=!0,function(){let e=ft;b&&e&&(ft=``,b.markSettled(e))}(),(e=yt.value)==null||e.destroy(),yt.value=null});let P=null,Ct=null,wt=()=>{},Tt=()=>{},Et=()=>{},Dt=()=>{},Ot=()=>null,F=()=>({getModel:()=>({getLineCount:()=>1}),getOption:()=>14,updateOptions:()=>{}}),I=()=>({getModel:()=>({getLineCount:()=>1}),getOption:()=>14,updateOptions:()=>{}}),kt=()=>{},At=()=>{},jt=()=>{},Mt=null,L=null,Nt=null,Pt=null,Ft=()=>String(v.node.language??`plaintext`),It=()=>T(null,null,function*(){}),Lt=!1,Rt=null,zt=[],Bt=[],R=null,Vt=null,z=g(()=>Ae(v.node)),Ht=_({removed:0,added:0}),Ut=g(()=>`-${Ht.value.removed} +${Ht.value.added}`);function Wt(e,t){return{original:e,updated:t}}function Gt(e){return String(e??``).replace(/\r\n$|\n$|\r$/,``)}function Kt(e){return String(e?.message??e).includes(`no diff result available`)}function qt(){if(!$())try{let e=jt();e&&typeof e.catch==`function`&&e.catch(e=>{Kt(e)})}catch(e){Kt(e)}}let Jt=g(()=>{let e=w({},v.codeBlockOptions||{});for(let t of[`theme`,`themes`,`themeType`,`language`,`languages`,`stream`,`disableFileHeader`,`onThemeChange`,`renderCustomHeader`,`renderHeaderMetadata`,`renderHeaderPrefix`,`maxHeight`,`padding`,`tabSize`])delete e[t];if(!z.value)return e;let t=e.parseDiffOptions&&typeof e.parseDiffOptions==`object`?e.parseDiffOptions:{},n={diffStyle:`split`,expandUnchanged:!1,collapsedContextThreshold:5,hunkSeparators:`line-info`,parseDiffOptions:{context:2}};return Ye(w(w({},n),e),{parseDiffOptions:w(w({},n.parseDiffOptions),t)})}),Yt=g(()=>{return(v.theme===void 0?!fi(v.darkTheme,v.lightTheme):(e=v.theme)&&typeof e==`object`&&`light`in e&&`dark`in e)?!!v.isDark:function(e){let t=di(e)??``;return Te(t,!0===v.isDark)}(pi());var e}),Xt=g(()=>(z.value,Yt.value?`dark`:`light`)),Zt=g(()=>z.value?Xt.value===`dark`:Yt.value),B=g(()=>je({darkTheme:v.darkTheme,isDark:v.isDark,lightTheme:v.lightTheme,theme:v.theme,themes:v.themes})),Qt=g(()=>z.value?`diff`:`single`),$t=_(Qt.value),V=_(!1),H=_(!1),en=_(!1),U=_(!1),tn=_(null),nn=_(0),rn=_(0),an=_(!1),on=null,sn=!1,cn=null,ln=!1,un=g(()=>!!z.value&&Jt.value?.diffStyle===`unified`),dn=g(()=>ke(Jt.value));function fn(e){return!0===Be?.value||!!e&&(!!e.closest(`[data-markstream-virtual-timeline="1"], .markstream-virtual-timeline`)||!!e.closest(`.vue-recycle-scroller, [data-virtualizer], [data-virtual-scroll-root]`))}let pn=g(()=>fn(S.value)),mn=g(()=>!(V.value||!U.value&&H.value)),hn=g(()=>mn.value),gn=g(()=>mn.value&&!en.value),_n=g(()=>!V.value&&!U.value&&mn.value),vn=g(()=>H.value&&!V.value?`ready`:U.value?`fallback`:`pending`),yn=_(!1),W=g(()=>Gt(v.node.code)),bn=g(()=>z.value?!0===v.node.diff?v.node:Ye(w({},v.node),{diff:!0}):W.value===v.node.code?v.node:Ye(w({},v.node),{code:W.value}));function xn(e){let t=e.detectLanguage;typeof t==`function`&&(Ft=t),Vt=e,R=gi();let n=e.createCodeBlockRuntime(R);return!!n&&(P=n.createEditor||P,Ct=n.createDiffEditor||Ct,wt=n.updateCode||wt,Tt=n.updateDiff||Tt,Et=n.finalizeCode||Et,Dt=n.finalizeDiff||Dt,Ot=n.getEditor||Ot,F=n.getEditorView||F,I=n.getDiffEditorView||I,kt=n.cleanupEditor||kt,At=n.safeClean||n.cleanupEditor||At,jt=n.refreshDiffPresentation||jt,It=n.setTheme||It,Mt=n.whenVisualReady||null,at.value=!0,!0)}let G=_(typeof v.codeBlockOptions?.fontSize==`number`?v.codeBlockOptions.fontSize:NaN),K=_(G.value),Sn=_(null),Cn=_(null),wn=_(null),Tn=_(null),En=g(()=>{let e=G.value,t=K.value;return typeof e==`number`&&Number.isFinite(e)&&e>0&&typeof t==`number`&&Number.isFinite(t)&&t>0}),Dn=g(()=>{let e=v.codeBlockOptions?.fontSize;if(typeof e==`number`&&Number.isFinite(e)&&e>0)return e;let t=K.value;return typeof t==`number`&&Number.isFinite(t)&&t>0?t:12}),On=g(()=>{let e=v.codeBlockOptions?.lineHeight;return typeof e==`number`&&Number.isFinite(e)&&e>0?e:Dn.value===12?18:Math.max(12,Math.round(1.5*Dn.value))}),kn=g(()=>On.value),An=g(()=>{let e=v.codeBlockOptions?.tabSize;return typeof e==`number`&&Number.isFinite(e)&&e>0?e:4}),jn=g(()=>{let e=v.codeBlockOptions?.padding,t=typeof e==`number`&&Number.isFinite(e)&&e>=0?e:8;return{top:t,bottom:t}}),Mn=g(()=>Ye(w({},Ce(v.codeBlockOptions)),{fontSize:Dn.value,lineHeight:kn.value,maxHeight:zr(),padding:jn.value.top,paddingBottom:jn.value.bottom,tabSize:An.value})),Nn=g(()=>{let e=v.estimatedContentHeightPx;return typeof e==`number`&&Number.isFinite(e)&&e>0?e:null});function Pn(e){if(e==null)return null;let t=Math.ceil(e);return!Number.isFinite(t)||t<=0?null:Math.min(t,Math.ceil(zr()))}function Fn(){return!z.value&&!1!==v.stream&&!1!==v.loading}let In=_(Fn());function Ln(){return Fn()||In.value}let Rn=g(()=>z.value?null:Nn.value==null||Ln()?Math.ceil((e=>{let t=String(e??``);if(!t)return 1;let n=1;for(let e=0;e<t.length;e++)t[e]===`
|
|
2
2
|
`?n++:t[e]===`\r`&&(n++,t[e+1]===`
|
|
3
3
|
`&&e++);return n})(W.value)*kn.value+1):null),zn=g(()=>{if(z.value)return null;let e=Nn.value;return e==null||Ln()?Pn(Rn.value):Pn(e)}),Bn=g(()=>{let e=v.estimatedHeightPx;return typeof e==`number`&&Number.isFinite(e)&&e>0?e:null}),Vn=_(null);function Hn(){let e=Vn.value;return typeof e==`number`&&Number.isFinite(e)&&e>0?Math.round(e):null}let Un=g(()=>Hn()??(!z.value&&an.value?null:mn.value||!H.value?zn.value:null));function Wn(e){let t=e?`hsl(152 42% 60%)`:`var(--diff-added-fg)`,n=e?`hsl(0 58% 58%)`:`var(--diff-removed-fg)`,r=e?`color-mix(in lab, #121212 80%, #4d9375)`:`color-mix(in lab, #ffffff 88%, #1e754f)`,i=e?`color-mix(in lab, #121212 80%, #cb7676)`:`color-mix(in lab, #ffffff 88%, #ab5959)`;return{"--markstream-diff-line-number-bg":`var(--markstream-diff-editor-bg)`,"--markstream-diff-added-fg":t,"--markstream-diff-removed-fg":n,"--markstream-diff-added-line":r,"--markstream-diff-removed-line":i,"--markstream-diff-added-line-fill":r,"--markstream-diff-added-number-fill":e?`color-mix(in lab, #121212 85%, #4d9375)`:`color-mix(in lab, #ffffff 91%, #1e754f)`,"--markstream-diff-removed-line-fill":i,"--markstream-diff-removed-number-fill":e?`color-mix(in lab, #121212 85%, #cb7676)`:`color-mix(in lab, #ffffff 91%, #ab5959)`,"--markstream-diff-added-gutter":`linear-gradient(90deg, ${t} 0 4px, transparent 4px 100%)`,"--markstream-diff-removed-gutter":`linear-gradient(90deg, ${n} 0 4px, transparent 4px 100%)`,"--markstream-diff-added-inline":e?`hsl(152 42% 60% / 0.28)`:`var(--diff-added-inline-bg)`,"--markstream-diff-removed-inline":e?`hsl(0 58% 58% / 0.28)`:`var(--diff-removed-inline-bg)`}}let Gn=g(()=>{let e=Pn(Nn.value),t=Pn(Rn.value),n=Ln(),r=w({},z.value||e==null||n?z.value||t==null?{}:{minHeight:`${t}px`}:{height:`${e}px`,minHeight:`${e}px`});if(r[`--markstream-code-fallback-bg`]=B.value.background,r[`--markstream-code-fallback-fg`]=B.value.foreground,B.value.builtin&&(r[`--markstream-code-theme-bg`]=B.value.background,r[`--markstream-code-theme-fg`]=B.value.foreground,r[`--markstream-code-theme-line-number`]=B.value.lineNumber),r[`--markstream-pre-line-number-top`]=`${jn.value.top}px`,r[`--markstream-pre-line-number-left`]=`0px`,r[`--markstream-pre-line-number-padding-left`]=`2ch`,r[`--markstream-pre-line-number-padding-right`]=`1ch`,r[`--markstream-pre-line-number-separator-width`]=`2px`,z.value){r[`--markstream-pre-diff-line-height`]=`${kn.value}px`,r[`--markstream-pre-diff-pane-bottom-padding`]=(un.value,`0px`);let e=Tn.value;e!=null&&e>0&&(r.height=`${e}px`,r.minHeight=`${e}px`,r.maxHeight=`${e}px`),Object.assign(r,Wn(Zt.value))}return r}),Kn=g(()=>Un.value!=null&&(!H.value||Hn()!=null)),qn=g(()=>{let e=Un.value;if(e==null)return null;if(z.value)return Math.ceil(e);let t=Bn.value,n=Nn.value;if(t==null||n==null)return Math.ceil(e);let r=Math.max(0,Math.ceil(t)-Math.ceil(n));return Math.ceil(e+r)}),Jn=g(()=>{if(z.value&&mn.value)return{};let e=Un.value;return Kn.value&&e!=null?{minHeight:`${e}px`}:{}});function Yn(){Vn.value=null}function Xn(){var e,t,n,r;let i=S.value?.querySelector(`pre.code-pre-fallback`),a=I(),o=i?.scrollTop??0;(t=(e=(a?.getOriginalEditor)?.call(a))?.setScrollTop)==null||t.call(e,o),(r=(n=(a?.getModifiedEditor)?.call(a))?.setScrollTop)==null||r.call(n,o)}function Zn(){return T(this,null,function*(){return z.value?(vr(),er(),X(!0),Xn(),Z(),en.value=!0,yield i(),X(!0),yield q(),X(!0),gr(),er(),!!(yield function(){return T(this,null,function*(){if(!z.value)return!0;for(let e=0;e<4;e++){let e=er();X(!0),Qn(e),$n(e),yield i(),yield q();let t=S.value?.querySelector(`pre.code-pre-fallback`);if(!t)return!1;if(e==null)return jr();let n=t.getBoundingClientRect().height;if(n>0&&Math.abs(n-e)<=2)return!0}return!1})}())&&(H.value=!0,yield i(),er(),X(!0),gr(),Z(),y(()=>{M||y(()=>{M||(function(){let e=S.value?.querySelector(`.code-block-shell-content`),t=S.value?.querySelector(`.code-editor-layer`);e&&t&&(t.style.removeProperty(`height`),t.style.removeProperty(`min-height`),e.style.removeProperty(`height`),e.style.removeProperty(`min-height`))}(),Q(!0))})}),Q(),!0)):!(Mt&&!(yield Mt())||(en.value=!0,yield i(),X(!0),H.value=!0,yield i(),Q(),0))})}function Qn(e){if(!z.value)return;let t=x.value,n=S.value?.querySelector(`pre.code-pre-fallback`);if(!t||!n)return;let r=e??Number.parseFloat(t.style.height||``);if(!Number.isFinite(r)||r<=0)return;let i=Math.ceil(r),a=`${i}px`;Tn.value=i;let o=S.value;o&&(o.dataset.markstreamDiffHandoffHeight=a),n.dataset.markstreamDiffHandoffHeight=a,n.style.setProperty(`height`,a),n.style.setProperty(`min-height`,a)}function $n(e){if(!z.value)return;let t=S.value?.querySelector(`.code-block-shell-content`),n=S.value?.querySelector(`.code-editor-layer`);if(!t||!n)return;let r=typeof e==`number`&&Number.isFinite(e)&&e>0?Math.ceil(e):Number.parseFloat(x.value?.style.height||``);if(!Number.isFinite(r)||r<=0)return;let i=`${r}px`;n.style.height=i,n.style.minHeight=i,t.style.height=i,t.style.minHeight=i}function er(){let e=x.value;if(e&&jr(e)){Z();let t=mr(e);if(t!=null&&t>0){let n=Math.ceil(t),r=Math.ceil(zr()),i=Math.min(n,r),a=`${i}px`;return e.style.height=a,e.style.minHeight=`0px`,e.style.maxHeight=`${r}px`,e.style.overflow=n>r+1?`auto`:`hidden`,mn.value&&(Tn.value=i,Qn(i)),Dr(),i}return Y({preferModelDiffHeight:!0}),Qn(),Dr(),Number.parseFloat(e.style.height||``)||null}return vr()}function tr(e,t=!1,n={}){let r=Math.ceil(e),i=Hn();if(i==null)return r;let a=!0===n.allowBelowEstimatedFloor;return r>=i||a?((t||a)&&j.value&&Yn(),r):i}function q(){return new Promise(e=>{let t=!1,n=null,r=null,i=()=>{t||(t=!0,r!=null&&globalThis.clearTimeout(r),n!=null&&Re(n),e())};r=globalThis.setTimeout(i,50),n=y(i)})}function nr(){try{let e=x.value;if(!e)return null;let t=e.querySelector(`.stream-diffs-shell .stream-diffs-surface`)??e.querySelector(`.stream-diffs-shell`);if(t){let e=Math.ceil(t.getBoundingClientRect().height);if(e>0)return e}}catch{}return null}function rr(){var e;try{let t=z.value?((e=I())?.getModifiedEditor)?.call(e)??I():F(),n=Ot()?.EditorOption?.fontInfo;if(t&&n!=null){let e=t.getOption?.call(t,n)?.fontSize;if(typeof e==`number`&&Number.isFinite(e)&&e>0)return e}}catch{}try{let e=x.value;if(e){let t=e.querySelector(`.stream-diffs-shell .stream-diffs-surface`)??e.querySelector(`.stream-diffs-shell`);if(t)try{if(typeof window<`u`&&typeof window.getComputedStyle==`function`){let e=window.getComputedStyle(t).fontSize,n=e&&e.match(/^(\d+(?:\.\d+)?)/);if(n)return Number.parseFloat(n[1])}}catch{}}}catch{}return null}function ir(e){try{let t=Ot()?.EditorOption?.lineHeight;if(t!=null){let n=(e?.getOption)?.call(e,t);if(typeof n==`number`&&n>0)return n}}catch{}let t=nr();if(t&&t>0)return t;let n=Number.isFinite(K.value)&&K.value>0?K.value:14;return Math.max(12,Math.round(1.35*n))}function ar(){let e=v.codeBlockOptions?.padding;return typeof e==`number`&&Number.isFinite(e)?2*Math.max(0,e):z.value?24:0}function or(e){return!!Xe.value||!!e&&($(e)||Mt!=null)}function sr(){z.value?Ht.value=Oe(String(v.node.originalCode??``),String(v.node.updatedCode??``)):Ht.value={removed:0,added:0}}function cr(){if(Number.isFinite(K.value)&&K.value>0&&Number.isFinite(G.value))return K.value;if(typeof v.codeBlockOptions?.fontSize==`number`)return G.value=v.codeBlockOptions.fontSize,K.value=v.codeBlockOptions.fontSize,v.codeBlockOptions.fontSize;let e=rr();return e&&e>0?(G.value=e,K.value=e,e):(G.value=12,K.value=12,12)}function lr(){let e=cr(),t=Math.min(36,e+1);K.value=t}function ur(){let e=cr(),t=Math.max(10,e-1);K.value=t}function dr(){cr(),Number.isFinite(G.value)&&(K.value=G.value)}function fr(){var e,t,n,r,i;try{let a=z.value?I():null,o=z.value?a:F();if(!o)return null;if(a?.getOriginalEditor&&a?.getModifiedEditor){let i=a.getOriginalEditor?.call(a),o=a.getModifiedEditor?.call(a);(e=i?.layout)==null||e.call(i),(t=o?.layout)==null||t.call(o);let s=(i?.getContentHeight)?.call(i)||0,c=(o?.getContentHeight)?.call(o)||0,l=Math.max(s,c);if(l>0)return Math.ceil(l);let u=((n=(i?.getModel)?.call(i))?.getLineCount)?.call(n)||1,d=((r=(o?.getModel)?.call(o))?.getLineCount)?.call(r)||1,f=Math.max(u,d),p=Math.max(ir(i),ir(o)),ee=ar();return Math.ceil(f*p+ee+0)}if(o?.getContentHeight){(i=o?.layout)==null||i.call(o);let e=o.getContentHeight();if(e>0)return z.value||(an.value=!0),Math.ceil(e)}let s=(o?.getModel)?.call(o),c=1;s&&typeof s.getLineCount==`function`&&(c=s.getLineCount());let l=ir(o);return Math.ceil(c*(l+1.5)+0)}catch{return null}}function pr(){var e;if(z.value)return!1;try{let t=((e=F())?.getContentHeight)?.call(e),n=typeof t==`number`&&Number.isFinite(t)&&t>0;return n&&(an.value=!0),n}catch{return!1}}function mr(e){if(typeof window>`u`)return null;try{if(window.getComputedStyle(e).display===`none`)return null;let t=e.querySelector(`diffs-container`);if(t instanceof HTMLElement){let e=t.getBoundingClientRect();if(e.height>0)return Math.ceil(e.height)}let n=e.querySelector(`.stream-diffs-shell`);if(n){let e=n.getBoundingClientRect();if(e.height>0)return Math.ceil(e.height)}return null}catch{return null}}function hr(e){let t=String(e??``).trim(),n=t.match(/^#([0-9a-f]{3}|[0-9a-f]{6})$/i)?.[1];if(n){let e=n.length===3?n.split(``).map(e=>`${e}${e}`).join(``):n;return .2126*Number.parseInt(e.slice(0,2),16)+.7152*Number.parseInt(e.slice(2,4),16)+.0722*Number.parseInt(e.slice(4,6),16)}let r=t.match(/\d+(?:\.\d+)?/g);if(!r||r.length<3)return null;let[i,a,o]=r.slice(0,3).map(Number);return .2126*i+.7152*a+.0722*o}function gr(){var e;if(_r())return;let t=rr();t&&t>0&&(Sn.value=t,K.value=t,G.value=t);try{let t=ir(z.value?((e=I())?.getModifiedEditor)?.call(e)??I():F());t&&t>0&&(Cn.value=t)}catch{}try{let e=nr();e&&e>0&&(Cn.value=e)}catch{}}function _r(){return z.value&&hn.value}function vr(){if(!mn.value)return null;let e=x.value,t=S.value?.querySelector(`pre.code-pre-fallback`);if(!e||!t)return null;let n=Math.ceil(t.getBoundingClientRect().height),r=z.value?mr(e):null,i=Math.max(n,r!=null&&r>0?Math.ceil(r):0),a=Math.ceil(zr()),o=Math.min(i,a);return!Number.isFinite(o)||o<=0?null:(z.value&&o>n&&(Tn.value=o),e.style.height=`${o}px`,e.style.minHeight=`${o}px`,e.style.maxHeight=`${a}px`,e.style.overflow=i>a+1?`auto`:`hidden`,o)}function yr(){let e=x.value,t=S.value;if(!e||!t)return;let n=e;n.style.setProperty(`--markstream-diff-metadata-bg`,B.value.background),n.style.setProperty(`--markstream-diff-metadata-fg`,B.value.lineNumber),n.style.setProperty(`--diffs-tab-size`,String(An.value)),n.style.setProperty(`--diffs-scrollbar-gutter-override`,`0px`),typeof v.codeBlockOptions?.padding==`number`?n.style.setProperty(`--diffs-gap-block`,`${jn.value.top}px`):n.style.removeProperty(`--diffs-gap-block`);let r=e.querySelector(`.stream-diffs-shell`)||e,i=r,a=r,o=null,s=null,c=null;try{typeof window<`u`&&typeof window.getComputedStyle==`function`&&(o=window.getComputedStyle(r),s=i===r?o:window.getComputedStyle(i),c=a===r?o:window.getComputedStyle(a))}catch{o=null,s=null,c=null}let l=String(o?.getPropertyValue(`--vscode-editor-foreground`)??``).trim(),u=String(o?.getPropertyValue(`--vscode-editor-background`)??``).trim(),d=String(o?.getPropertyValue(`--vscode-editor-selectionBackground`)??o?.getPropertyValue(`--vscode-editor-hoverHighlightBackground`)??``).trim(),f=l||String(c?.color??o?.color??``).trim(),p=u||String(s?.backgroundColor??o?.backgroundColor??``).trim(),ee=function(){var e;try{let t=z.value?((e=I())?.getModifiedEditor)?.call(e)??I():F(),n=Ot()?.EditorOption?.fontInfo;if(t&&n!=null){let e=t.getOption?.call(t,n)?.typicalHalfwidthCharacterWidth;if(typeof e==`number`&&Number.isFinite(e)&&e>0)return e}}catch{}return null}();if(ee!=null&&(wn.value=ee),z.value){let e=(e,r)=>{r?(t.style.setProperty(e,r),n.style.setProperty(e,r)):(t.style.removeProperty(e),n.style.removeProperty(e))};for(let[n,r]of Object.entries(Wn(t.classList.contains(`is-dark`))))e(n,r);f?(t.style.setProperty(`--markstream-diff-editor-fg`,f),n.style.setProperty(`--vscode-editor-foreground`,f)):(t.style.removeProperty(`--markstream-diff-editor-fg`),n.style.removeProperty(`--vscode-editor-foreground`)),p?(t.style.setProperty(`--markstream-diff-editor-bg`,p),t.style.setProperty(`--markstream-diff-panel-bg`,p),t.style.setProperty(`--markstream-diff-panel-bg-soft`,p),t.style.setProperty(`--markstream-diff-panel-bg-strong`,p),n.style.setProperty(`--vscode-editor-background`,p),n.style.backgroundColor=p):(t.style.removeProperty(`--markstream-diff-editor-bg`),t.style.removeProperty(`--markstream-diff-panel-bg`),t.style.removeProperty(`--markstream-diff-panel-bg-soft`),t.style.removeProperty(`--markstream-diff-panel-bg-strong`),n.style.removeProperty(`--vscode-editor-background`),n.style.backgroundColor=``),d?n.style.setProperty(`--vscode-editor-selectionBackground`,d):n.style.removeProperty(`--vscode-editor-selectionBackground`)}else{if(function(e,t,n){if(!Xe.value)return!1;let r=hr(e),i=hr(t);return n?r!=null&&r>170||i!=null&&i<110:r!=null&&r<85||i!=null&&i>190}(p,f,t.classList.contains(`is-dark`)))return n.style.removeProperty(`--vscode-editor-foreground`),n.style.removeProperty(`--vscode-editor-background`),void n.style.removeProperty(`--vscode-editor-selectionBackground`);f&&n.style.setProperty(`--vscode-editor-foreground`,f),p&&n.style.setProperty(`--vscode-editor-background`,p),d&&n.style.setProperty(`--vscode-editor-selectionBackground`,d)}}l(()=>[v.stream,v.loading,v.node.loading,z.value],([e,t,n,r])=>{r||!1===e||!1===t||In.value?(r||!1===e)&&In.value&&(In.value=!1):(In.value=!0,Yn())},{immediate:!0});let br=0,xr=0,Sr=/auto|scroll|overlay/i;function J(e,t,n){if(typeof window>`u`||z.value||function(e){return pn.value||fn(e)}(e))return;let r=Math.ceil(n)-Math.ceil(t);if(Math.abs(r)<=1)return;let i=function(e){if(typeof window>`u`)return null;let t=e?.ownerDocument??document,n=t.scrollingElement||t.documentElement||t.body,r=e?.parentElement??null;for(;r&&r!==t.body&&r!==n;){let e=window.getComputedStyle(r),t=(e.overflowY||``).toLowerCase(),n=(e.overflow||``).toLowerCase();if(Sr.test(t)||Sr.test(n))return r;r=r.parentElement}return n}(e);if(!i)return;let a=e.ownerDocument??document,o=i===a.body||i===a.documentElement||i===a.scrollingElement,s=o?0:i.getBoundingClientRect().top;e.getBoundingClientRect().top-s>=0||(o&&typeof window.scrollBy==`function`?window.scrollBy(0,r):i.scrollTop+=r)}function Cr(){try{let e=x.value;if(!e)return;let t=e.getBoundingClientRect().height,n=fr();if(n!=null&&n>0){let r=tr(n,!0,{allowBelowEstimatedFloor:!z.value&&j.value&&pr()}),i=Hn();e.style.minHeight=i==null?`0px`:`${i}px`,e.style.height=`${r}px`,e.style.maxHeight=`none`,e.style.overflow=`visible`,J(e,t,r);return}let r=Hn();r!=null&&(e.style.minHeight=`${r}px`,e.style.height=`${r}px`,e.style.maxHeight=`none`,e.style.overflow=`visible`,J(e,t,r))}catch{}}function wr(){for(var e,t;zt.length>0;)try{(t=(e=zt.pop())?.dispose)==null||t.call(e)}catch{}st!=null&&(Re(st),st=null),ct!=null&&(Re(ct),ct=null),lt!=null&&(Re(lt),lt=null),ut=0,dt=!1}function Tr(){for(var e;Bt.length>0;)try{(e=Bt.pop())==null||e()}catch{}}function Y(e=!1){O.value||(D.value?Cr():function(e={}){try{let t=x.value;if(!t)return;let n=t.getBoundingClientRect().height,r=Math.ceil(n||0),i=zr(),a=r,o=Number.parseFloat(t.style.height||``),s=a>0?a:Number.isFinite(o)&&o>0?Math.ceil(o):0,c=z.value?function(){var e,t;if($())return null;try{let n=I(),r=(n?.getOriginalEditor)?.call(n),i=(n?.getModifiedEditor)?.call(n);if(!r||!i)return null;let a=((e=r.getModel?.call(r))?.getLineCount)?.call(e)||1,o=((t=i.getModel?.call(i))?.getLineCount)?.call(t)||1,s=Math.max(a,o),c=Math.max(ir(r),ir(i)),l=ar(),u=Math.max(r.getContentHeight?.call(r)??0,i.getContentHeight?.call(i)??0);return Math.ceil(Math.max(u,s*c+l+0))}catch{return null}}():null,l=z.value&&jr(t);if(mt>0&&(mt--,pt.value!=null))return void J(t,n,Or(t,pt.value,i,{preserveScrollableOverflow:Ar(t)}));if(z.value&&!l&&mn.value){let e=vr();if(e!=null){let r=Or(t,e,i,{allowBelowEstimatedFloor:!0});X(!0),J(t,n,r);return}}let u=z.value&&!0===e.preferModelDiffHeight,d=z.value?mr(t):null,f=!z.value&&j.value&&pr(),p=z.value&&!1!==v.loading&&(d!=null||c!=null&&a>0&&c<a-1),ee=c!=null,m;if(z.value){if(u){let e=c!=null&&!1===v.loading&&s>0&&c<s-1;m=!1===v.loading&&d!=null?c==null?d:Math.max(d,c):e?c:d!=null&&c!=null?Math.max(d,c,!1===v.loading?0:s):Math.max(d??0,c??0,!1===v.loading?0:s)||null}else m=un.value&&d!=null||d!=null?ee?Math.max(d,c):d:z.value&&!1!==v.loading?c!=null&&s>0&&c<s-1?c:s>0?s:null:c}else m=fr();if(z.value&&m!=null&&s>0&&(!1!==v.loading||!0===e.holdCurrentDiffHeight)&&(m=Math.max(m,s)),m!=null&&m>0)return void J(t,n,Or(t,m,i,{clearEstimatedFloor:!0,allowBelowEstimatedFloor:f||p,preserveScrollableOverflow:Ar(t),renderedStreamingDiffHeight:d}));if(pt.value!=null)return void J(t,n,Or(t,pt.value,i,{preserveScrollableOverflow:Ar(t)}));let te=z.value&&!1!==v.loading?a:Math.max(a,c!=null&&c>0?c:0);if(te>0)return void J(t,n,Or(t,te,i));let h=Hn();if(!(h==null||z.value&&!1!==v.loading&&l))return void J(t,n,Or(t,h,i));let g=Number.parseFloat(t.style.height);!Number.isNaN(g)&&g>0?J(t,n,Or(t,g,i)):z.value||J(t,n,Or(t,i,i))}catch{}}(typeof e==`object`?e:{}))}function Er(){br=0,xr=0}function X(e=!1){if(O.value)return;let t=x.value;if(!t)return;let n=z.value?I():F();if(n&&typeof n.layout==`function`)try{let r=t.getBoundingClientRect?.call(t),i=Math.ceil((r?.width??0)||t.clientWidth||0),a=Math.ceil((r?.height??0)||t.clientHeight||Number.parseFloat(t.style.height||``)||0);if(i>0&&a>0){if(!e&&i===br&&a===xr)return;br=i,xr=a,n.layout({width:i,height:a})}else Er(),n.layout()}catch{}}function Z(){Tr()}function Q(e=!1){if(M||st!=null)return;let t=()=>{M||(Z(),Y(e),X())};st=y(()=>{st=null,t(),ct=y(()=>{ct=null,t()})}),Dr()}function Dr(e=!1){if(!z.value||M||!e&&!1===v.loading||(dt||=e,ut=Math.max(ut,e?18:6),lt!=null))return;let t=()=>{if(lt=null,!z.value||M||ut<=0||!dt&&!1===v.loading)return ut=0,void(dt=!1);ut--,Z(),Y({preferModelDiffHeight:!0,holdCurrentDiffHeight:dt}),X(),ut>0?lt=y(t):dt=!1};lt=y(t)}function Or(e,t,n,r={}){var i;let a=z.value&&!1!==v.loading,o=`renderedStreamingDiffHeight`in r?a&&(i=r.renderedStreamingDiffHeight)!=null?i:null:a?mr(e):null,s=o!=null&&o>t+1?o:t,c=Math.min(s,n),l=!0===r.allowBelowEstimatedFloor,u=tr(c,!0===r.clearEstimatedFloor,{allowBelowEstimatedFloor:l}),d=Hn();e.style.minHeight=d==null||l?`0px`:`${Math.min(d,Math.ceil(n))}px`,e.style.height=`${u}px`,e.style.maxHeight=`${Math.ceil(n)}px`;let f=!0===r.preserveScrollableOverflow||s>n+1||kr(e,u);return e.style.overflow=f?`auto`:`hidden`,u}function kr(e,t=0){let n=Math.ceil(e.getBoundingClientRect?.call(e).height||0),r=Math.max(t,e.clientHeight||0,n);return r>0&&e.scrollHeight>r+1}function Ar(e){return ht||kr(e,pt.value??0)}function jr(e=x.value){return $(e)}function Mr(e=x.value){return $(e)}function Nr(){var e;if($())return!0;let t=((e=F())?.getModel)?.call(e);return typeof t?.getValue==`function`&&t.getValue()===W.value}function $(e=x.value){return!!e?.querySelector(`diffs-container`)}function Pr(){return!1!==v.loading||H.value}function Fr(){let e=I();return typeof e?.getOriginalEditor==`function`||typeof e?.getModifiedEditor==`function`||typeof e?.getLineChanges==`function`}function Ir(){return T(this,null,function*(){if(!z.value)return!0;for(let e=0;e<30;e++){if(M)return!1;if($())return yield i(),yield q(),!M&&$();yield i(),yield q()}return!1})}let Lr=``;function Rr(e,t,n){return T(this,null,function*(){let r=`${e}\0${t}\0${n}`;if(Lr!==r){try{yield Tt(e,t,n),Lr=r;return}catch(e){if(!Kt(e))throw e}if(yield i(),yield q(),!M&&z.value)try{yield Tt(e,t,n),Lr=r}catch(e){if(!Kt(e))throw e}}})}function zr(){return v.codeBlockOptions?.maxHeight??500}let Br=g(()=>v.isShowPreview&&(C.value===`html`||C.value===`svg`));function Vr(){return typeof v.node.loading==`boolean`?v.node.loading:!0===v.loading}function Hr(e,t,n){return!n||function(){if(!Vr())return!0;let e=String(v.node.raw??``),t=e.split(/\r\n|\n|\r/,1)[0]?.trimStart()??``;return!/^(?:`{3,}|~{3,})/.test(t)||/\r\n|\n|\r/.test(e)}()&&String(t??``)?fe(String(e??``)):`plain`}function Ur(){return Vr()}let Wr=null,Gr=!1,Kr=0;function qr(){Wr=null,Kr++}function Jr(){return T(this,arguments,function*(e=Kr){if(!Gr){Gr=!0;try{for(;Wr&&!M&&!z.value&&e===Kr;){let e=Wr;Wr=null;try{yield Promise.resolve(wt(e.code,e.language)),yield i(),M||z.value||(Y(!1),X())}catch{}}}finally{Gr=!1,!Wr||M||z.value||Jr()}}})}function Yr(e,t){Wr={code:e,language:t},Jr(Kr)}l(()=>[v.node.language,v.node.code,v.node.raw,v.node.loading,v.loading],([e,t,n,r,i])=>{C.value=Hr(e,t,typeof r==`boolean`?r:!0===i)}),l(()=>[v.node.originalCode,v.node.updatedCode,z.value],()=>{y(()=>sr())},{immediate:!0});let Xr=0;l(()=>[v.node.originalCode,v.node.updatedCode,E.value,z.value,v.stream],e=>T(null,[e],function*([,,,e,t]){let n=++Xr;if(!e||Vr()||!1===t&&!k.value)return;if(!1!==t&&P&&!k.value&&x.value)try{yield ci(x.value)}catch{}let r=Nt;if(r&&!A.value){try{yield r}catch{}if(M||!z.value||n!==Xr)return}if(n!==Xr)return;let a=Wt(String(v.node.originalCode??``),String(v.node.updatedCode??``)),o=!1===v.loading;o&&_i();try{if(yield Rr(a.original,a.updated,E.value),M||!z.value||n!==Xr)return;yield i(),X(!0),Z(),Y(!1===v.loading||{preferModelDiffHeight:!0}),X(!0),Q(!0)}catch{return}if(o){if(M||!z.value)return;qt(),Z(),sr(),Q(),Dr(!0)}D.value&&y(()=>Cr())})),l(()=>v.node.code,e=>T(null,null,function*(){if(Vr()||!1===v.stream||(C.value||=fe(Ft(e)),z.value))return;let t=Nt;if(t&&!A.value){try{yield t}catch{}if(M||z.value)return}if(P&&!k.value&&x.value)try{yield ci(x.value)}catch{}Yr(Gt(v.node.code),E.value),D.value&&y(()=>Cr())}));let Zr=g(()=>{let e=C.value;return e?he[e]||e.charAt(0).toUpperCase()+e.slice(1):he[``]||`Plain Text`}),Qr=g(()=>ve(String(v.node.raw??``),Zr.value,z.value)),$r=g(()=>Qr.value.title),ei=g(()=>Qr.value.caption),ti=g(()=>(de.value,Ie(C.value||``,Ve))),ni=g(()=>{let e={};e[`--markstream-code-layout-character-width`]=wn.value==null?`1ch`:`${wn.value}px`,e[`--markstream-code-fallback-bg`]=B.value.background,e[`--markstream-code-fallback-fg`]=B.value.foreground,B.value.builtin&&(e[`--markstream-code-theme-bg`]=B.value.background,e[`--markstream-code-theme-fg`]=B.value.foreground,e[`--markstream-code-theme-line-number`]=B.value.lineNumber),e[`--markstream-diff-added-line-fill`]=B.value.diffAddedLine,e[`--markstream-diff-added-number-fill`]=B.value.diffAddedNumber,e[`--markstream-diff-editor-bg`]=B.value.background,e[`--markstream-diff-removed-line-fill`]=B.value.diffRemovedLine,e[`--markstream-diff-removed-number-fill`]=B.value.diffRemovedNumber,e[`--markstream-diff-shell-bg`]=B.value.background,e[`--markstream-pre-resolved-theme-bg`]=B.value.background,e[`--markstream-pre-resolved-theme-fg`]=B.value.foreground,e[`--markstream-pre-resolved-theme-line-number`]=B.value.lineNumber;let t=e=>{if(e!=null)return typeof e==`number`?`${e}px`:String(e)},n=t(v.minWidth),r=t(v.maxWidth);if(n&&(e.minWidth=n),r&&(e.maxWidth=r),Kn.value&&!z.value&&!O.value){let t=qn.value;t!=null&&(e.minHeight=`${t}px`)}return e.color=`var(--markstream-code-fallback-fg, var(--markstream-code-theme-fg, var(--markstream-pre-resolved-theme-fg)))`,e.backgroundColor=`var(--markstream-code-fallback-bg, var(--markstream-code-theme-bg, var(--markstream-pre-resolved-theme-bg)))`,z.value||(e.borderColor=`var(--markstream-code-border-color, var(--code-border))`),e}),ri=g(()=>!1!==v.showTooltips);function ii(){return T(this,null,function*(){let e=v.node.code;try{v.clipboardWriter?yield v.clipboardWriter(e):typeof navigator<`u`&&navigator.clipboard&&typeof navigator.clipboard.writeText==`function`&&(yield navigator.clipboard.writeText(e)),qe.value=!0,pe(`copy`,e),setTimeout(()=>{qe.value=!1},1e3)}catch(e){console.error(`复制失败:`,e)}})}function ai(){D.value=!D.value;let e=z.value?I():F(),t=x.value;e&&t&&(D.value?(t.style.maxHeight=`none`,t.style.overflow=`visible`,Y(!0)):(t.style.overflow=`auto`,Y(!0)))}function oi(){var e;if(O.value=!O.value,O.value){if(ht=!1,x.value){let t=Math.ceil((e=x.value).getBoundingClientRect?.call(e).height||0);ht=kr(x.value,t)||x.value.style.overflow===`auto`||x.value.style.overflowY===`auto`,t>0&&(pt.value=t)}}else x.value&&pt.value!=null&&(x.value.style.height=`${pt.value}px`),mt=2,i(()=>{O.value||M||(Y(!0),X(!0))})}function si(){if(!Br.value)return;let e=C.value;if(Ge.value){let t=e===`html`?`text/html`:`image/svg+xml`,n=e===`html`?Ke(`artifacts.htmlPreviewTitle`)||`HTML Preview`:Ke(`artifacts.svgPreviewTitle`)||`SVG Preview`;pe(`previewCode`,{node:v.node,artifactType:t,artifactTitle:n,id:`temp-${e}-${Date.now()}`})}else e===`html`&&(yn.value=!yn.value)}function ci(e,t={}){if(!P||M||!1===v.stream&&!1!==v.loading||(Ci(),wi())||V.value||x.value!==e||Ur())return null;if(L)return L;if(k.value&&j.value)return Promise.resolve();let n=xi(),r=nn.value,a=!1;k.value=!0,function(){let e=He.value;b&&e&&ft!==e&&(ft&&b.markSettled(ft),ft=e,b.markPending(e))}();let o=T(null,null,function*(){try{yield function(e){return T(this,null,function*(){var t;if(!P||M)return;ot=!1;let n=Qt.value;if(ln=!1,U.value=!1,tn.value=null,A.value=!1,H.value=!1,en.value=!1,Sn.value=null,Cn.value=null,wn.value=null,Tn.value=null,Er(),function(){if(an.value=!1,Ln())return void(Vn.value=null);let e=zn.value;Vn.value=j.value||e==null?null:e}(),wr(),Tr(),function(e){e.replaceChildren()}(e),_i(),yield ye(hi()),M)return;let r=T(null,null,function*(){if(n===`diff`){(function(){if(Lt||typeof window>`u`)return;Lt=!0;let e=e=>{Kt(`reason`in e?e.reason:e.error??e.message)&&(e.preventDefault(),e.stopImmediatePropagation())};window.addEventListener(`error`,e,!0),window.addEventListener(`unhandledrejection`,e,!0),Rt=()=>{window.removeEventListener(`error`,e,!0),window.removeEventListener(`unhandledrejection`,e,!0),Lt=!1,Rt=null}})(),At();let t=Wt(String(v.node.originalCode??``),String(v.node.updatedCode??``));Ct?yield Ct(e,t.original,t.updated,E.value):yield P(e,v.node.code,E.value)}else yield P(e,W.value,E.value);A.value=!0}).finally(()=>{Nt===r&&(Nt=null)});if(Nt=r,yield function(e){return T(this,null,function*(){if(!z.value)return void(yield e);let t,n=!1;for(e.then(()=>{n=!0},e=>{n=!0,t=e});;){if(M)return;if(n){if(t)throw t;return}if(jr()&&Fr())return;yield i(),yield q()}})}(r),M||Qt.value!==n)return;A.value=!0;let a=v.codeBlockOptions?.fontSize;if(typeof a==`number`&&Number.isFinite(a)&&a>0){let e=n===`diff`?I():F();(t=e?.updateOptions)==null||t.call(e,{fontSize:a}),G.value=a,K.value=a}else if(!_r()){let e=rr();e&&e>0?(G.value=e,K.value=e):(G.value=12,K.value=12)}for(gr();ot;)if(ot=!1,yield mi(),M)return;D.value||O.value||Y(!1),j.value=!0,$t.value=n,function(){if(wr(),z.value){let e=I(),t=(e?.getOriginalEditor)?.call(e),n=(e?.getModifiedEditor)?.call(e),r=(e,t)=>{try{let n=e?.[t];if(typeof n!=`function`)return;let r=n.call(e,()=>Q());r&&zt.push(r)}catch{}};try{let t=(e?.onDidUpdateDiff)?.call(e,()=>{Q(),y(()=>sr())});t&&zt.push(t)}catch{}r(t,`onDidContentSizeChange`),r(n,`onDidContentSizeChange`);let i=x.value;if(i&&typeof MutationObserver<`u`){let e=`diffs-container,.stream-diffs-shell,.stream-diffs-surface`,t=t=>{let n=t instanceof HTMLElement?t:t.parentElement;return!!(n?.closest)?.call(n,e)},n=t=>{let n=t instanceof HTMLElement?t:t.parentElement;return!!((n?.closest)?.call(n,e)||(n?.querySelector)?.call(n,e))},r=new MutationObserver(e=>{z.value&&Pr()&&e.some(e=>t(e.target)||Array.from(e.addedNodes).some(n)||Array.from(e.removedNodes).some(t))&&(Z(),Y({preferModelDiffHeight:!0}),X(),Dr())});r.observe(i,{attributeFilter:[`class`],attributes:!0,childList:!0,characterData:!0,subtree:!0}),zt.push({dispose:()=>r.disconnect()})}if(i&&typeof ResizeObserver<`u`){let e=new ResizeObserver(()=>{if(!z.value||(X(),!Pr()))return;let e=mr(i);e!=null&&(Math.ceil(i.getBoundingClientRect().height||0)<=e+1||(Z(),Y({preferModelDiffHeight:!0}),X()))});e.observe(i),zt.push({dispose:()=>e.disconnect()})}return}let e=F();try{let t=(e?.onDidContentSizeChange)?.call(e,()=>Q());t&&zt.push(t)}catch{}try{let t=(e?.onDidLayoutChange)?.call(e,()=>Q());t&&zt.push(t)}catch{}}(),yr(),gr(),Z(),sr(),Q(),yield i();let o=null;Mt&&(o=yield Mt(),o&&(yield i(),yield q()));let s=o??(n===`diff`?yield Ir():yield function(){return T(this,null,function*(){if($())return yield i(),yield q(),$();for(let e=0;e<30;e++){if(M||z.value)return!1;let e=x.value,t=Nr(),n=Mr(e),r=!W.value.trim()||or(e);if(t&&n&&r&&(yield i(),yield q(),!M&&!z.value&&Nr()&&Mr(x.value)&&(!W.value.trim()||or(x.value))))return!0;yield i(),yield q()}return!1})}());M||(s?(gr(),er(),(yield Zn())||Ti()):Ti())})}(e),on=null}catch(e){let i=xi(),o=r!==nn.value,s=!1!==t.allowStaleContentRetry&&o&&on!==i;if(n!==i||s)return s&&(on=i),a=!0,k.value=!1,j.value=!1,A.value=!1,void(H.value=!1);throw Ti(n),e}}).finally(()=>{L===o&&(L=null),function(){let e=ft;b&&e&&(ft=``,i(()=>{if(!M){let t=S.value?.offsetHeight??0;t>0&&b.reportHeight(e,t)}b.markSettled(e)}))}(),a&&!M&&queueMicrotask(()=>{var e;let t=x.value;t&&!M&&((e=ci(t))==null||e.catch(e=>{j.value=!1,H.value=!1,Ti()}))})});return L=o,o}l(ri,e=>{e||Ne()}),l(()=>K.value,(e,t)=>{var n;let r=z.value?I():F();r&&typeof e==`number`&&Number.isFinite(e)&&e>0&&((n=r.updateOptions)==null||n.call(r,{fontSize:e}),O.value||Y(!0))},{flush:`post`,immediate:!1});let li=0,ui=l(()=>[x.value,z.value,v.stream,v.loading,at.value,N.value,v.node.language,v.node.raw,v.node.code,v.node.loading],e=>T(null,[e],function*([e,t,n,r,i,a]){let o=++li;if(!e||!a||Vr()||sn||!1===n&&!1!==r||!P&&(yield function(){return T(this,null,function*(){if(typeof window>`u`||M||at.value||V.value)return;if(Pt)return Pt;let e=T(null,null,function*(){try{let e=yield We();if(M)return;if(!e)return void(V.value=!0);xn(e)}catch{if(M)return;V.value=!0}}).finally(()=>{Pt===e&&(Pt=null)});return Pt=e,e})}(),o!==li||!1===v.stream&&!1!==v.loading||Ur()||!N.value||!P||V.value||k.value||wi()||M||x.value!==e)||Ur())return;let s=ci(e);if(s){try{yield s}catch{j.value=!1,H.value=!1,Ti()}j.value&&H.value&&ui()}}));function di(e){return typeof e==`string`?e:null}function fi(e,t){if(e===t)return!0;let n=di(e),r=di(t);return!!n&&n===r}function pi(){return Ee({darkTheme:v.darkTheme,isDark:v.isDark,lightTheme:v.lightTheme,theme:v.theme,themes:v.themes})}function mi(){return T(this,arguments,function*(e={}){_i();let t=()=>{z.value&&qt(),y(()=>{yr(),Q()})};if(e.appearanceOnly)return void t();let n=pi();if(n)try{yield ye(hi()),yield It(n),t()}catch{}else t()})}function hi(){let e=v.themes;return e&&typeof e[0]==`string`&&typeof e[1]==`string`?{dark:e[0],light:e[1]}:pi()}function gi(){let e=Mn.value,t=Ye(w({},Jt.value||{}),{wordWrap:e.overflow===`wrap`?`on`:`off`,overflow:e.overflow,themes:v.themes,stream:!1,MAX_HEIGHT:v.codeBlockOptions?.maxHeight??500,fontSize:Dn.value,lineHeight:kn.value,theme:pi(),themeType:v.isDark?`dark`:`light`,disableLineNumbers:!Me.value,disableFileHeader:!0,workerManager:Jt.value?.workerManager??_e()??void 0,onThemeChange(){yr()}}),n=function(){let e=Jt.value?.fontFamily;return typeof e==`string`&&e.trim()?e.trim():z.value?function(){if(typeof window>`u`)return;let e=S.value?.querySelector(`pre.code-pre-fallback`);if(e)return window.getComputedStyle(e).fontFamily.trim()||void 0}():void 0}();n&&(t.fontFamily??=n);let r=typeof t.unsafeCSS==`string`?t.unsafeCSS:``;return t.unsafeCSS=Se(e.overflow,r),t}function _i(){let e=gi();if(!R)return R=e,R;for(let t of Object.keys(R))t in e||delete R[t];return Object.assign(R,e),R}l(Qt,(e,t)=>T(null,null,function*(){if(e===t||U.value||sn||(qr(),!P||!x.value)||!k.value||!1===v.stream&&!1!==v.loading||!N.value)return;let n=L;if(n){try{yield n}catch{}if(M||!x.value)return}if($t.value!==e||!k.value||!j.value)try{j.value=!1,H.value=!1,k.value=!1,A.value=!1,wr(),Tr(),At(),yield i(),yield ci(x.value)}catch{j.value=!1,H.value=!1,Ti()}}));let vi=_(0),yi=g(()=>String(vi.value)),bi=!1;function xi(){let e=pi();return JSON.stringify({kind:Qt.value,language:E.value,structural:yi.value,optionsRevision:vi.value,settledContentGeneration:rn.value,theme:di(e)??(e==null?null:`custom`),isDark:v.isDark})}l(()=>v.codeBlockOptions?.fontSize,e=>{let t=typeof e==`number`&&Number.isFinite(e)&&e>0?e:12;G.value=t,K.value=t,Sn.value=null,Cn.value=null,wn.value=null}),l(()=>[v.codeBlockOptions,v.showLineNumbers],()=>{vi.value+=1,!1===v.stream&&!1!==v.loading&&(bi=!0)},{deep:!0}),l(()=>[W.value,v.node.originalCode,v.node.updatedCode],()=>{nn.value+=1,Vr()||(rn.value+=1)});let Si=g(()=>xi());function Ci(){U.value&&tn.value!==Si.value&&(U.value=!1,tn.value=null,on=null,cn=null,k.value=!1,j.value=!1,A.value=!1,H.value=!1,en.value=!1)}function wi(){return Ci(),U.value&&tn.value===Si.value}function Ti(e=Si.value){tn.value=e,U.value=!0,en.value=!1}return l(Si,()=>T(null,null,function*(){if(sn||!U.value||tn.value===Si.value||!P||!x.value||V.value||M||!N.value||!1===v.stream&&!1!==v.loading||Ur())return;let e=Si.value;sn=!0;try{if(Ci(),U.value)return;yield ci(x.value)}catch{j.value=!1,H.value=!1,Ti()}finally{cn=e,yield i(),sn=!1}})),l(()=>[v.codeBlockOptions,N.value],()=>{var e;if(_i(),!P||!N.value)return;let t=z.value?I():F(),n=typeof v.codeBlockOptions?.fontSize==`number`?v.codeBlockOptions.fontSize:Number.isFinite(K.value)?K.value:void 0;typeof n==`number`&&Number.isFinite(n)&&n>0&&((e=t?.updateOptions)==null||e.call(t,{fontSize:n})),Y(!1)},{deep:!0}),l(()=>[pi(),Xt.value,at.value,k.value,N.value],([e,t],n)=>{if(!at.value||!N.value)return;let r=n!=null&&fi(e,n[0]),i=n!=null&&t!==n[1];j.value?(ot=!1,mi({appearanceOnly:r})):r&&!i||(ot=!0)},{flush:`post`}),l(()=>[yi.value,at.value,N.value],(e,t)=>T(null,[e,t],function*([e,t,n],[r]){if(_i(),!t||!n||!P||!x.value||!k.value||e===r)return;if(!1===v.stream&&!1!==v.loading)return void(bi=!0);bi=!1;let a=L;if(a){try{yield a}catch{}if(M||!x.value)return}try{j.value=!1,H.value=!1,k.value=!1,A.value=!1,wr(),Tr(),At(),Vt&&xn(Vt),yield i(),yield ci(x.value,{allowStaleContentRetry:!1})}catch{j.value=!1,H.value=!1,Ti()}}),{flush:`post`}),l(()=>[v.loading,N.value],([e,t])=>{!1===e&&t&&bi&&(bi=!1,vi.value+=1)},{flush:`post`}),l(()=>[v.loading,N.value],(e,t)=>T(null,[e,t],function*([e,t],n){if(!t)return;let r=n?.[0];if(!1===r&&!1!==e&&z.value&&k.value&&(yield i(),y(()=>{T(null,null,function*(){let e=L;if(e)try{yield e}catch{}!M&&z.value&&!1!==v.loading&&(_i(),qt(),Q())})})),e)return;let a=r!==void 0&&!1!==r;yield i(),y(()=>{T(null,null,function*(){try{if(a&&(yield function(){return T(this,null,function*(){if(!U.value||!P||!x.value||V.value||M||!N.value)return!1;if(cn===Si.value)return!0;sn=!0;try{U.value=!1,tn.value=null,on=null,k.value=!1,j.value=!1,A.value=!1,H.value=!1,wr(),Tr(),At(),Vt&&xn(Vt),yield i();try{yield ci(x.value)}catch{j.value=!1,H.value=!1,Ti()}}finally{yield i(),sn=!1}return!0})}()))return void Y(!1);if(a&&z.value&&k.value&&ln&&x.value)return ln=!1,j.value=!1,H.value=!1,k.value=!1,A.value=!1,wr(),Tr(),At(),yield i(),yield ci(x.value,{allowStaleContentRetry:!1}),void Dr(!0);if(a&&k.value){if(z.value&&x.value){let e=L;if(e)try{yield e}catch{}_i();let t=Wt(String(v.node.originalCode??``),String(v.node.updatedCode??``));if(yield Rr(t.original,t.updated,E.value),M||!z.value)return;yield Promise.resolve(Dt()),qt(),X(!0),Xn(),Z(),sr();let n=yield Ir();M||!n||H.value||(yield Zn()),Q(),Dr(!0)}else qr(),Yr(W.value,E.value),yield new Promise(e=>{let t=()=>{M?e():Gr||Wr?setTimeout(t,16):e()};t()}),M||z.value||(yield Promise.resolve(Et()))}a&&z.value?(Y({preferModelDiffHeight:!0,holdCurrentDiffHeight:!0}),Dr(!0)):Y(!1)}catch{}})})}),{immediate:!0,flush:`post`}),r(()=>{wr(),Tr(),kt(),Rt?.()}),(t,n)=>{var r;return V.value?(le(),d(Le,{key:0,style:oe(Gn.value),node:bn.value,loading:v.loading,"show-line-numbers":Me.value,"diff-inline":un.value,"diff-hide-unchanged-regions":dn.value,"code-block-options":v.codeBlockOptions,"resolved-visual-options":Mn.value,"reserved-height-px":z.value&&(r=Tn.value)!=null?r:void 0,"is-dark":v.isDark,theme:v.theme,"dark-theme":v.darkTheme,"light-theme":v.lightTheme,themes:v.themes,"show-header":v.showHeader,"show-copy-button":v.showCopyButton,"clipboard-writer":v.clipboardWriter,"show-tooltips":v.showTooltips,onCopy:n[0]||=e=>pe(`copy`,e)},p({_:2},[t.$slots[`header-left`]?{name:`header-left`,fn:u(()=>[c(t.$slots,`header-left`,{},void 0,!0)]),key:`0`}:void 0,t.$slots[`header-right`]?{name:`header-right`,fn:u(()=>[c(t.$slots,`header-right`,{},void 0,!0)]),key:`1`}:void 0]),1032,[`style`,`node`,`loading`,`show-line-numbers`,`diff-inline`,`diff-hide-unchanged-regions`,`code-block-options`,`resolved-visual-options`,`reserved-height-px`,`is-dark`,`theme`,`dark-theme`,`light-theme`,`themes`,`show-header`,`show-copy-button`,`clipboard-writer`,`show-tooltips`])):(le(),ce(`div`,{key:1,ref_key:`container`,ref:S,style:oe(ni.value),class:ee([`code-block-container rounded-lg border`,[{dark:v.isDark,"is-rendering":v.loading,"is-dark":Zt.value,"is-diff":z.value,"is-plain-text":Xe.value}]]),"data-markstream-code-block":`1`,"data-markstream-enhanced":H.value&&!V.value?`true`:`false`,"data-markstream-enhancement-state":vn.value,"data-markstream-code-block-state":Vr()?`streaming`:`settled`,"data-markstream-pending":_n.value?`true`:void 0,"data-markstream-viewport-pending":St.value&&ae(vt)&&!N.value?`true`:void 0},[e(Fe,{"show-header":v.showHeader,"show-collapse-button":v.showCollapseButton,"show-font-size-buttons":v.showFontSizeButtons,"enable-font-size-control":v.enableFontSizeControl,"show-copy-button":v.showCopyButton,"show-expand-button":v.showExpandButton,"show-preview-button":v.showPreviewButton,"show-tooltips":v.showTooltips,"is-dark":v.isDark,loading:v.loading,stream:s.stream,"is-collapsed":O.value,"is-expanded":D.value,"copy-text":qe.value,"is-previewable":Br.value,"code-font-size":K.value,"code-font-min":10,"code-font-max":36,"default-code-font-size":G.value,"font-baseline-ready":En.value,"diff-stats":z.value?Ht.value:null,"diff-stats-aria-label":Ut.value,onToggleCollapse:oi,onDecreaseFont:ur,onResetFont:dr,onIncreaseFont:lr,onCopy:ii,onToggleExpand:ai,onPreview:si},p({"header-left":u(()=>[c(t.$slots,`header-left`,{},()=>[h(`div`,$e,[h(`span`,{class:`icon-slot h-4 w-4 flex-shrink-0`,innerHTML:ti.value},null,8,et),h(`div`,tt,[h(`div`,nt,te($r.value),1),ei.value?(le(),ce(`div`,rt,te(ei.value),1)):se(``,!0)])])],!0)]),loading:u(()=>[c(t.$slots,`loading`,{loading:s.loading,stream:s.stream},()=>[n[1]||=h(`div`,{class:`loading-skeleton`},[h(`div`,{class:`skeleton-line`}),h(`div`,{class:`skeleton-line`}),h(`div`,{class:`skeleton-line short`})],-1)],!0)]),default:u(()=>{var e;return[o(h(`div`,{class:ee([`code-editor-layer`,{"code-editor-layer--collapsed":O.value}])},[h(`div`,{ref_key:`codeEditor`,ref:x,class:ee([`code-editor-container`,s.stream?``:`code-height-placeholder`]),"data-markstream-host-hidden":gn.value?`true`:void 0,style:oe(Jn.value)},null,14,it),hn.value?(le(),d(Le,{key:0,style:oe(Gn.value),node:bn.value,loading:v.loading,"show-line-numbers":Me.value,"diff-inline":un.value,"diff-hide-unchanged-regions":dn.value,"code-block-options":v.codeBlockOptions,"resolved-visual-options":Mn.value,"reserved-height-px":z.value&&(e=Tn.value)!=null?e:void 0,"is-dark":v.isDark,theme:v.theme,"dark-theme":v.darkTheme,"light-theme":v.lightTheme,themes:v.themes,"show-toolbar":!1},null,8,[`style`,`node`,`loading`,`show-line-numbers`,`diff-inline`,`diff-hide-unchanged-regions`,`code-block-options`,`resolved-visual-options`,`reserved-height-px`,`is-dark`,`theme`,`dark-theme`,`light-theme`,`themes`])):se(``,!0)],2),[[re,!!s.stream||!s.loading]]),yn.value&&!Ge.value&&Br.value&&C.value===`html`?(le(),d(Ze,{key:0,code:v.node.code,"html-preview-allow-scripts":v.htmlPreviewAllowScripts,"html-preview-sandbox":v.htmlPreviewSandbox,"is-dark":v.isDark,"on-close":()=>yn.value=!1},null,8,[`code`,`html-preview-allow-scripts`,`html-preview-sandbox`,`is-dark`,`on-close`])):se(``,!0)]}),_:2},[t.$slots[`header-right`]?{name:`header-right`,fn:u(()=>[c(t.$slots,`header-right`,{},void 0,!0)]),key:`0`}:void 0]),1032,[`show-header`,`show-collapse-button`,`show-font-size-buttons`,`enable-font-size-control`,`show-copy-button`,`show-expand-button`,`show-preview-button`,`show-tooltips`,`is-dark`,`loading`,`stream`,`is-collapsed`,`is-expanded`,`copy-text`,`is-previewable`,`code-font-size`,`default-code-font-size`,`font-baseline-ready`,`diff-stats`,`diff-stats-aria-label`])],14,Qe))}}}),[[`__scopeId`,`data-v-f293a87c`]]);export{k as default};
|
|
Binary file
|
|
Binary file
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{C as e,H as t,I as n,M as r,Q as i,S as a,T as o,Y as s,c,ct as l,d as u,dt as d,f,g as p,h as m,it as h,v as g,y as _,z as v}from"./vue.runtime.esm-bundler-DmQNwI70.js";import{_ as y,g as b}from"./index-
|
|
1
|
+
import{C as e,H as t,I as n,M as r,Q as i,S as a,T as o,Y as s,c,ct as l,d as u,dt as d,f,g as p,h as m,it as h,v as g,y as _,z as v}from"./vue.runtime.esm-bundler-DmQNwI70.js";import{_ as y,g as b}from"./index-BYfYTC37.js";var x={class:`cc-input-row`},S=[`placeholder`],C={class:`cc-tabs`,role:`tablist`},w=[`aria-selected`,`disabled`,`onClick`],T={class:`cc-list`,role:`listbox`},E={key:0,class:`cc-empty`},D={key:1,class:`cc-empty`},O=[`aria-selected`,`onClick`,`onPointerenter`],k={class:`cc-item-body`},A={class:`cc-item-title`},j={key:0,class:`cc-item-sub`},M={key:0,class:`cc-badge`},N={key:1,class:`cc-kbd`},P=o({__name:`CommandCenter`,props:{workspaces:{},hosts:{},activeAgent:{},actions:{},api:{type:Function}},emits:[`close`,`selectWorkspace`,`openFile`,`restoreArchived`],setup(o,{emit:P}){let F=o,I=P,L=h(null),R=h(null);b(L,()=>I(`close`));let z=h(`workspaces`),B=h(``),V=h(0),H=m(()=>new Map(F.hosts.map(e=>[e.id,e.label]))),U=h([]),W=h(!1);async function G(){if(W.value)return;W.value=!0;let e=F.hosts.filter(e=>e.state===`connected`),t=await Promise.allSettled(e.map(e=>F.api(`/hosts/${encodeURIComponent(e.id)}/archived-workspaces`))),n=[];for(let e of t)e.status===`fulfilled`&&Array.isArray(e.value)&&n.push(...e.value);n.sort((e,t)=>Date.parse(t.archivedAt)-Date.parse(e.archivedAt)),U.value=n}let K=h([]),q=h(!1),J,Y=0;async function X(){let e=F.activeAgent;if(!e){K.value=[];return}let t=++Y;q.value=!0;try{let n=await F.api(`/hosts/${encodeURIComponent(e.hostId)}/fs/search?cwd=${encodeURIComponent(e.cwd)}&q=${encodeURIComponent(B.value.trim())}&limit=40`);t===Y&&(K.value=Array.isArray(n.files)?n.files:[])}catch{t===Y&&(K.value=[])}finally{t===Y&&(q.value=!1)}}s([z,B],([e,t])=>{V.value=0,e===`files`?(clearTimeout(J),J=setTimeout(()=>void X(),t?120:0)):e===`workspaces`&&t.trim().length>=2&&G()});let Z=m(()=>{let e=B.value.trim().toLowerCase(),t=e.split(/\s+/).filter(Boolean),n=e=>!t.length||t.every(t=>e.toLowerCase().includes(t));if(z.value===`workspaces`){let t=F.workspaces.filter(e=>n(`${e.name} ${e.project} ${e.branch??``} ${H.value.get(e.hostId)??``}`)).slice(0,30).map(e=>({key:`ws:`+e.key,icon:`chat`,title:e.name,sub:[e.project,e.branch,F.hosts.length>1?H.value.get(e.hostId):``].filter(Boolean).join(` · `),badge:e.attention?`needs input`:e.state===`running`?`running`:void 0,run:()=>{I(`selectWorkspace`,e.key),I(`close`)}})),r=e?U.value.filter(e=>e.workspaceId&&n(`${e.name} ${e.project} ${H.value.get(e.hostId)??``}`)).slice(0,12).map(e=>({key:`arch:${e.hostId}:${e.workspaceId}`,icon:`archive`,title:e.name,sub:`${e.project} · archived`,badge:`restore`,run:()=>{e.workspaceId&&I(`restoreArchived`,e.hostId,e.workspaceId),I(`close`)}})):[];return[...t,...r]}return z.value===`files`?K.value.map(e=>({key:`file:`+e,icon:`file`,title:e.split(`/`).pop()||e,sub:e,run:()=>{I(`openFile`,e),I(`close`)}})):F.actions.filter(e=>n(`${e.label} ${e.sub??``}`)).map(e=>({key:`act:`+e.id,icon:e.icon,title:e.label,sub:e.sub??``,shortcut:e.shortcut,run:()=>{I(`close`),e.run()}}))}),Q=[{id:`workspaces`,label:`Workspaces`},{id:`files`,label:`Files`},{id:`actions`,label:`Actions`}];function $(e){if(e.key===`Tab`){e.preventDefault();let t=Q.findIndex(e=>e.id===z.value),n=Q[(t+(e.shiftKey?Q.length-1:1))%Q.length];z.value=n.id}else e.key===`ArrowDown`&&Z.value.length?(e.preventDefault(),V.value=(V.value+1)%Z.value.length):e.key===`ArrowUp`&&Z.value.length?(e.preventDefault(),V.value=(V.value-1+Z.value.length)%Z.value.length):e.key===`Enter`&&Z.value[V.value]&&(e.preventDefault(),Z.value[V.value].run())}return n(()=>{r(()=>R.value?.focus())}),(n,r)=>(v(),_(`div`,{class:`overlay cc-overlay`,onMousedown:r[1]||=u(e=>I(`close`),[`self`])},[p(`section`,{ref_key:`sheet`,ref:L,class:`sheet cc-sheet`,role:`dialog`,"aria-modal":`true`,"aria-label":`Command center`,tabindex:`-1`,onKeydown:$},[p(`div`,x,[e(y,{name:`search`,size:16,class:`cc-search-icon`}),i(p(`input`,{ref_key:`inputEl`,ref:R,"onUpdate:modelValue":r[0]||=e=>B.value=e,type:`search`,class:`cc-input`,placeholder:z.value===`workspaces`?`Jump to workspace or archived session…`:z.value===`files`?`Search files in current workspace…`:`Run an action…`,"aria-label":`Command center search`},null,8,S),[[c,B.value]]),r[2]||=p(`kbd`,{class:`cc-kbd`},`Esc`,-1)]),p(`div`,C,[(v(),_(f,null,t(Q,e=>p(`button`,{key:e.id,type:`button`,role:`tab`,class:l([`cc-tab`,{chosen:z.value===e.id}]),"aria-selected":z.value===e.id,disabled:e.id===`files`&&!o.activeAgent,onClick:t=>{z.value=e.id,R.value?.focus()}},d(e.label),11,w)),64)),r[3]||=p(`span`,{class:`cc-hint`},`Tab to switch`,-1)]),p(`div`,T,[z.value===`files`&&q.value&&!Z.value.length?(v(),_(`p`,E,[...r[4]||=[p(`span`,{class:`spinner spinner-sm`},null,-1),a(` Searching files…`,-1)]])):Z.value.length?g(``,!0):(v(),_(`p`,D,d(z.value===`files`&&!o.activeAgent?`Open a conversation to search its files.`:`No matches.`),1)),(v(!0),_(f,null,t(Z.value,(t,n)=>(v(),_(`button`,{key:t.key,type:`button`,role:`option`,class:l([`cc-item`,{active:n===V.value}]),"aria-selected":n===V.value,onClick:e=>t.run(),onPointerenter:e=>V.value=n},[e(y,{name:t.icon,size:15,class:`cc-item-icon`},null,8,[`name`]),p(`span`,k,[p(`span`,A,d(t.title),1),t.sub?(v(),_(`span`,j,d(t.sub),1)):g(``,!0)]),t.badge?(v(),_(`span`,M,d(t.badge),1)):g(``,!0),t.shortcut?(v(),_(`kbd`,N,d(t.shortcut),1)):g(``,!0)],42,O))),128))])],544)],32))}});export{P as default};
|
|
Binary file
|
|
Binary file
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{H as e,L as t,Q as n,S as r,T as i,Y as a,c as o,d as s,dt as c,f as l,g as u,it as d,v as f,y as p,z as m}from"./vue.runtime.esm-bundler-DmQNwI70.js";import{m as h}from"./index-
|
|
1
|
+
import{H as e,L as t,Q as n,S as r,T as i,Y as a,c as o,d as s,dt as c,f as l,g as u,it as d,v as f,y as p,z as m}from"./vue.runtime.esm-bundler-DmQNwI70.js";import{m as h}from"./index-BYfYTC37.js";var g={class:`conversation-search`},_=[`disabled`],v={key:0,class:`form-error`,role:`alert`},y={key:1,class:`subtle small`,role:`status`},b={key:2,class:`subtle small`,role:`status`},x={key:3,class:`search-results`,"aria-label":`Search results`},S=[`onClick`],C={class:`search-result-role`},w={class:`search-result-meta`},T=[`disabled`],E=h(i({__name:`ConversationSearch`,props:{base:{},api:{type:Function}},emits:[`jump`],setup(i,{emit:h}){let E=i,D=h,O=d(``),k=d(``),A=d(!1),j=d(!1),M=d([]),N=d(null),P=d(``),F=0,I=``;t(()=>F++);function L(){F++,M.value=[],N.value=null,j.value=!1,A.value=!1,k.value=``}a(O,L),a(()=>E.base,()=>{O.value=``,L()});async function R(e=!1){if(A.value||!O.value.trim())return;let t=++F;e||(M.value=[],N.value=null,I=O.value.trim()),A.value=!0,k.value=``;try{let n=await E.api(E.base+`/search?q=`+encodeURIComponent(I)+(e&&N.value!==null?`&cursor=`+N.value:``));if(t!==F)return;if(e&&P.value!==n.epoch)throw Error(`Conversation changed. Search again.`);P.value=n.epoch,M.value=[...new Map((e?[...M.value,...n.locations]:n.locations).map(e=>[e.seq,e])).values()],N.value=n.nextCursor,j.value=!0}catch(e){t===F&&(k.value=e.message)}finally{t===F&&(A.value=!1)}}return(t,i)=>(m(),p(`section`,g,[i[6]||=u(`p`,{class:`subtle small search-intro`},`Search user and agent messages across the full conversation history. Select a result to read it in context.`,-1),u(`form`,{class:`search-form`,role:`search`,onSubmit:i[1]||=s(e=>R(!1),[`prevent`])},[n(u(`input`,{"onUpdate:modelValue":i[0]||=e=>O.value=e,type:`search`,maxlength:`500`,"aria-label":`Search conversation content`,placeholder:`Search all messages…`},null,512),[[o,O.value]]),u(`button`,{class:`btn btn-primary btn-sm`,disabled:A.value||!O.value.trim()},`Search`,8,_)],32),k.value?(m(),p(`p`,v,c(k.value),1)):f(``,!0),j.value&&!M.value.length&&!A.value?(m(),p(`p`,y,`No matching messages.`)):f(``,!0),A.value?(m(),p(`p`,b,`Searching…`)):f(``,!0),M.value.length?(m(),p(`ul`,x,[(m(!0),p(l,null,e(M.value,e=>(m(),p(`li`,{key:e.seq},[u(`button`,{type:`button`,class:`search-result`,onClick:t=>D(`jump`,e.seq,P.value)},[u(`span`,C,c(e.role===`assistant`?`Agent reply`:`Your message`),1),i[3]||=r(),u(`span`,w,`#`+c(e.seq)+c(e.count?` · ${e.count} matches`:``),1),i[4]||=r(),i[5]||=u(`span`,{class:`search-result-go`,"aria-hidden":`true`},`→`,-1)],8,S)]))),128))])):f(``,!0),N.value===null?f(``,!0):(m(),p(`button`,{key:4,type:`button`,class:`btn btn-outline btn-sm search-more`,disabled:A.value,onClick:i[2]||=e=>R(!0)},`More results`,8,T))]))}}),[[`__scopeId`,`data-v-d9291547`]]);export{E as default};
|
|
Binary file
|
|
Binary file
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{C as e,G as t,M as n,P as r,S as i,T as a,Y as o,_ as s,dt as c,f as l,g as u,h as d,it as f,st as p,ut as m,v as h,y as g,z as _}from"./vue.runtime.esm-bundler-DmQNwI70.js";import{_ as v,d as y,f as b,i as x,m as S,p as C,r as w}from"./index-
|
|
1
|
+
import{C as e,G as t,M as n,P as r,S as i,T as a,Y as o,_ as s,dt as c,f as l,g as u,h as d,it as f,st as p,ut as m,v as h,y as g,z as _}from"./vue.runtime.esm-bundler-DmQNwI70.js";import{_ as v,d as y,f as b,i as x,m as S,p as C,r as w}from"./index-BYfYTC37.js";import{n as T,t as E}from"./highlight-BnTrj1LT.js";var ee={class:`file-view`},te={class:`file-bar`},ne=[`title`],re={key:0,class:`file-bar-meta`},ie=[`title`],ae=[`title`],oe={key:0,class:`timeline-empty`},se={key:1,class:`file-error`},ce=[`src`,`alt`],le={key:0,class:`file-link-notice`,role:`status`},ue={key:2,class:`file-text wrap`},de={class:`code-wrap`},fe={class:`code-gutter`,"aria-hidden":`true`},pe=[`innerHTML`],me={key:2,class:`file-text`},D={key:0,class:`file-note`},O={key:5,class:`file-note`},k=S(a({__name:`FileViewer`,props:{hostId:{},cwd:{},path:{},api:{type:Function},session:{},jump:{},view:{},viewKey:{}},emits:[`open`,`reveal`,`view`],setup(a,{emit:S}){let k=a,A=S,j=f(null),M=f(``),N=f(!1),P=f(k.view?.rendered??!0),F=d(()=>`/hosts/${encodeURIComponent(k.hostId)}/fs`),I=d(()=>`cwd=${encodeURIComponent(k.cwd)}&path=${encodeURIComponent(k.path)}`),L=d(()=>/\.(png|jpe?g|webp|gif|bmp|avif)$/i.test(k.path)),R=d(()=>/\.(md|markdown|mdx)$/i.test(k.path)&&j.value?.text!==void 0),z=0;async function B(){let e=++z;N.value=!0,M.value=``;try{let t=await k.api(`${F.value}/read?${I.value}`);if(e!==z)return;j.value=t,R.value&&w()}catch(t){e===z&&(M.value=t.message)}finally{e===z&&(N.value=!1)}}o(()=>[k.hostId,k.cwd,k.path],B,{immediate:!0});let V=d(()=>k.path.startsWith(`/`)||k.path.startsWith(`~`)?k.path:`${k.cwd.replace(/\/$/,``)}/${k.path}`),he=d(()=>{let e=j.value?.text??``;if(!k.session)return e;let t=V.value.slice(0,V.value.lastIndexOf(`/`))||`/`,n={session:k.session,cwd:t,workspace:k.cwd};return C(b(e,{...n,rawBase:`/api${F.value}`}),n)}),H=f(``),U;function W(e){H.value=e,clearTimeout(U),U=setTimeout(()=>H.value=``,4e3)}function ge(e){let t=e.target?.closest?.(`a`),n=y(t?.getAttribute(`href`));if(n){if(n.kind===`copy`){e.preventDefault();let t=()=>W(`Can't open this here. Path: ${n.path}`);navigator.clipboard?navigator.clipboard.writeText(n.path).then(()=>W(`Copied path: ${n.path}`),t):t()}else e.ctrlKey||e.metaKey||e.shiftKey||e.altKey||(e.preventDefault(),n.kind===`reveal`?A(`reveal`,n.path):A(`open`,n.path,n))}}let G=f(null),K=f(k.view?.mark??null),q=k.view?.jumped??0,J=!1,Y=d(()=>{let e=j.value?.text??``,t=1;for(let n=0;n<e.length;n++)e.charCodeAt(n)===10&&t++;return t});o([()=>k.jump?.seq,()=>j.value],async()=>{if(!j.value)return;let e=k.jump;if(e&&e.seq!==q&&j.value.text!==void 0){q=e.seq,J=!0,/\.(md|markdown|mdx)$/i.test(k.path)&&(P.value=!1),await n();let t=G.value?.querySelector(`.code-gutter`);if(!G.value||!t)return;let r=getComputedStyle(t),i=parseFloat(r.lineHeight)||20,a=Math.min(e.line,Y.value),o=Math.min(Math.max(e.end??a,a),Y.value);K.value={top:parseFloat(r.paddingTop)+(a-1)*i,height:(o-a+1)*i},G.value.scrollTop=Math.max(0,K.value.top-G.value.clientHeight/3);return}if(J)return;J=!0;let t=k.view?.scrollTop??0;t&&(await n(),G.value&&(G.value.scrollTop=t),requestAnimationFrame(()=>{G.value&&G.value.scrollTop<t&&(G.value.scrollTop=t)}))},{immediate:!0}),r(()=>{z++,clearTimeout(U),clearTimeout($),k.viewKey&&A(`view`,k.viewKey,{rendered:P.value,scrollTop:G.value?.scrollTop??0,mark:K.value,jumped:q})});let _e=d(()=>`/api${F.value}/raw?${I.value}`),ve=d(()=>Array.from({length:Y.value},(e,t)=>t+1).join(`
|
|
2
2
|
`)),X=d(()=>j.value?.text===void 0?null:E(j.value.text,T(k.path))),Z=e=>e<1024?`${e} B`:e<1048576?`${(e/1024).toFixed(1)} KB`:`${(e/1024/1024).toFixed(1)} MB`,Q=f(!1),$;async function ye(){await navigator.clipboard?.writeText(V.value).catch(()=>{}),Q.value=!0,clearTimeout($),$=setTimeout(()=>Q.value=!1,1200)}return(n,r)=>(_(),g(`div`,ee,[u(`div`,te,[e(v,{name:`file`,size:14,class:`file-bar-icon`}),u(`span`,{class:`file-bar-path`,title:a.path},c(a.path),9,ne),j.value?(_(),g(`span`,re,c(Z(j.value.size)),1)):h(``,!0),R.value?(_(),g(`button`,{key:1,class:`icon-btn`,title:P.value?`Show source`:`Show rendered`,onClick:r[0]||=e=>P.value=!P.value},[e(v,{name:P.value?`terminal`:`eye`,size:14},null,8,[`name`])],8,ie)):h(``,!0),u(`button`,{class:`icon-btn`,title:`Reload`,"aria-label":`Reload file`,onClick:B},[e(v,{name:`refresh`,size:14})]),u(`button`,{class:`icon-btn`,title:Q.value?`Copied`:`Copy path`,"aria-label":`Copy path`,onClick:ye},[e(v,{name:Q.value?`check`:`copy`,size:14},null,8,[`name`])],8,ae)]),u(`div`,{ref_key:`body`,ref:G,class:`file-body`},[N.value&&!j.value?(_(),g(`div`,oe,[...r[1]||=[u(`span`,{class:`spinner`},null,-1)]])):M.value?(_(),g(`p`,se,[e(v,{name:`alert`,size:13}),i(c(M.value),1)])):L.value?(_(),g(`img`,{key:2,src:_e.value,alt:a.path,class:`file-image`},null,8,ce)):R.value&&P.value?(_(),g(`div`,{key:3,class:`file-markdown`,onClick:ge},[H.value?(_(),g(`p`,le,c(H.value),1)):h(``,!0),p(x)?(_(),s(t(p(x)),{key:1,content:he.value,final:!0},null,8,[`content`])):(_(),g(`pre`,ue,c(j.value?.text),1))])):j.value?.text===void 0?j.value?(_(),g(`p`,O,c(j.value.mime||j.value.kind)+` · not shown as text`,1)):h(``,!0):(_(),g(l,{key:4},[u(`div`,de,[K.value?(_(),g(`div`,{key:0,class:`line-mark`,style:m({top:K.value.top+`px`,height:K.value.height+`px`}),"aria-hidden":`true`},null,4)):h(``,!0),u(`pre`,fe,c(ve.value),1),X.value===null?(_(),g(`pre`,me,c(j.value.text),1)):(_(),g(`pre`,{key:1,class:`file-text hljs`,innerHTML:X.value},null,8,pe))]),j.value.truncated?(_(),g(`p`,D,`Showing the first 1 MB.`)):h(``,!0)],64))],512)]))}}),[[`__scopeId`,`data-v-f7483425`]]);export{k as default};
|
|
Binary file
|
|
Binary file
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{C as e,H as t,M as n,S as r,T as i,Y as a,_ as o,at as s,ct as c,dt as l,f as u,g as d,h as f,it as p,ut as m,v as h,y as g,z as _}from"./vue.runtime.esm-bundler-DmQNwI70.js";import{_ as v,m as y}from"./index-
|
|
1
|
+
import{C as e,H as t,M as n,S as r,T as i,Y as a,_ as o,at as s,ct as c,dt as l,f as u,g as d,h as f,it as p,ut as m,v as h,y as g,z as _}from"./vue.runtime.esm-bundler-DmQNwI70.js";import{_ as v,m as y}from"./index-BYfYTC37.js";var b={class:`files`},x={class:`files-head`},S=[`title`],C={key:0,class:`files-error`},w=[`data-path`,`aria-expanded`,`title`,`onClick`],T={key:1,class:`tree-caret`},E={class:`tree-name`},D={key:2,class:`spinner spinner-sm`},O={key:0,class:`files-empty`},k=y(i({__name:`FilesPanel`,props:{hostId:{},cwd:{},api:{type:Function},activePath:{},reveal:{}},emits:[`open`],setup(i,{emit:y}){let k=i,A=y,j=s(new Map),M=p(new Set),N=p(new Set),P=p(``),F=f(()=>`/hosts/${encodeURIComponent(k.hostId)}/fs`),I=e=>`cwd=${encodeURIComponent(k.cwd)}&path=${encodeURIComponent(e)}`,L=new Map,R=0;function z(e){let t=L.get(e);if(t)return t;let n=L,r=B(e).finally(()=>{n.get(e)===r&&n.delete(e)});return n.set(e,r),r}async function B(e){let t=R;N.value=new Set(N.value).add(e);try{let n=await k.api(`${F.value}/list?${I(e)}`);if(t!==R)return;let r=new Map(j.value);r.set(e,n.entries),j.value=r,P.value=``}catch(e){t===R&&(P.value=e.message)}finally{if(t!==R)return;let n=new Set(N.value);n.delete(e),N.value=n}}a(()=>[k.hostId,k.cwd],()=>{R++,L=new Map,N.value=new Set,P.value=``,j.value=new Map,M.value=new Set,z(`.`)},{immediate:!0});function V(e){let t=new Set(M.value);t.has(e.path)?t.delete(e.path):(t.add(e.path),j.value.has(e.path)||z(e.path)),M.value=t}let H=f(()=>{let e=[],t=(n,r)=>{for(let i of j.value.get(n)??[])e.push({entry:i,depth:r}),i.kind===`directory`&&M.value.has(i.path)&&t(i.path,r+1)};return t(`.`,0),e}),U=p(null),W=p(null);return a(()=>k.activePath,()=>W.value=null),a(()=>k.reveal?.seq,async()=>{let e=k.reveal?.path;if(!e)return;let t=e===`.`?[]:e.split(`/`).filter(Boolean),r=R;await z(`.`);for(let e=1;e<=t.length;e++){if(r!==R)return;let n=t.slice(0,e).join(`/`);if(j.value.has(n)||await z(n),r!==R)return;M.value=new Set(M.value).add(n)}W.value=t.join(`/`)||null,await n();let i=Array.from(U.value?.querySelectorAll(`.tree-row`)??[]).find(e=>e.dataset.path===W.value);i?.scrollIntoView({block:`center`}),i?.focus({preventScroll:!0})},{immediate:!0}),(n,a)=>(_(),g(`div`,b,[d(`div`,x,[d(`span`,{class:`files-root`,title:i.cwd},l(i.cwd.split(`/`).filter(Boolean).pop()||i.cwd),9,S),d(`button`,{class:`icon-btn`,title:`Refresh`,"aria-label":`Refresh files`,onClick:a[0]||=e=>{j.value=new Map,M.value=new Set,z(`.`)}},[e(v,{name:`refresh`,size:14})])]),P.value?(_(),g(`p`,C,[e(v,{name:`alert`,size:13}),r(l(P.value),1)])):h(``,!0),d(`div`,{ref_key:`tree`,ref:U,class:`tree`,role:`tree`},[(_(!0),g(u,null,t(H.value,t=>(_(),g(`button`,{key:t.entry.path,class:c([`tree-row`,{chosen:t.entry.path===i.activePath||t.entry.path===W.value}]),"data-path":t.entry.path,role:`treeitem`,"aria-expanded":t.entry.kind===`directory`?M.value.has(t.entry.path):void 0,style:m({paddingLeft:8+t.depth*14+`px`}),title:t.entry.path,onClick:e=>t.entry.kind===`directory`?V(t.entry):A(`open`,t.entry.path)},[t.entry.kind===`directory`?(_(),o(v,{key:0,name:`chevron`,size:11,class:c([`tree-caret`,{open:M.value.has(t.entry.path)}])},null,8,[`class`])):(_(),g(`span`,T)),e(v,{name:t.entry.kind===`directory`?`folder`:`file`,size:14,class:`tree-icon`},null,8,[`name`]),d(`span`,E,l(t.entry.name),1),N.value.has(t.entry.path)?(_(),g(`span`,D)):h(``,!0)],14,w))),128)),!H.value.length&&N.value.has(`.`)?(_(),g(`div`,O,[...a[1]||=[d(`span`,{class:`spinner`},null,-1)]])):h(``,!0)],512)]))}}),[[`__scopeId`,`data-v-64ccc6d9`]]);export{k as default};
|
|
Binary file
|
|
Binary file
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{A as e,C as t,H as n,I as r,J as i,L as a,Q as o,S as s,T as c,Y as l,_ as u,a as d,c as f,ct as p,d as m,dt as h,f as g,g as _,h as v,it as y,s as b,st as x,u as S,v as C,y as w,z as T}from"./vue.runtime.esm-bundler-DmQNwI70.js";import{E,_ as D,m as O,t as k,v as A}from"./index-
|
|
1
|
+
import{A as e,C as t,H as n,I as r,J as i,L as a,Q as o,S as s,T as c,Y as l,_ as u,a as d,c as f,ct as p,d as m,dt as h,f as g,g as _,h as v,it as y,s as b,st as x,u as S,v as C,y as w,z as T}from"./vue.runtime.esm-bundler-DmQNwI70.js";import{E,_ as D,m as O,t as k,v as A}from"./index-BYfYTC37.js";var j=[`claude`,`codex`,`copilot`,`opencode`,`pi`,`omp`,`acp`],M=/^[a-z][a-z0-9-]*$/,N=[`agentProfiles`,`terminalProfiles`,`metadataGeneration`,`providers`],P=e=>e===void 0?e:JSON.parse(JSON.stringify(e)),F=0,I=()=>`k${++F}`,L=e=>e.split(`
|
|
2
2
|
`).map(e=>e.trim()).filter(Boolean);function R(e,t){return Object.fromEntries(Object.entries(e).filter(([e])=>!t.includes(e)))}function z(e){return Object.fromEntries(Object.entries(e).filter(([,e])=>e.trim()!==``).map(([e,t])=>[e,t.trim()]))}function B(e){let t=P(e),n=R(t,N),r={};for(let[e,n]of Object.entries(t.providers??{}))r[e]={...R(n,[`command`,`additionalModels`]),commandText:(n.command??[]).join(`
|
|
3
3
|
`),additionalModels:(n.additionalModels??[]).map(e=>({id:e.id??``,label:e.label??``,isDefault:e.isDefault===!0,rest:R(e,[`id`,`label`,`isDefault`])}))};return{values:n,providers:r,removeProviders:[],agentProfiles:t.agentProfiles?t.agentProfiles.map(e=>({key:I(),id:e.id,name:e.name??``,provider:e.provider??``,model:e.model??``,modeId:e.modeId??``,thinkingOptionId:e.thinkingOptionId??``,notes:e.notes??``,rest:R(e,[`id`,`name`,`provider`,`model`,`modeId`,`thinkingOptionId`,`notes`])})):null,terminalProfiles:t.terminalProfiles?t.terminalProfiles.map(e=>({key:I(),id:e.id,name:e.name??``,command:e.command??``,argsText:(e.args??[]).join(`
|
|
4
4
|
`),rest:R(e,[`id`,`name`,`command`,`args`])})):null,metadataProviders:t.metadataGeneration?(t.metadataGeneration.providers??[]).map(e=>({key:I(),provider:e.provider??``,model:e.model??``,thinkingOptionId:e.thinkingOptionId??``,rest:R(e,[`provider`,`model`,`thinkingOptionId`])})):null}}function V(e){let t=P(e.values),n={};for(let[t,r]of Object.entries(e.providers)){if(e.removeProviders.includes(t))continue;let{commandText:i,additionalModels:a,...o}=r,s={...P(o)};L(i).length&&(s.command=L(i)),a.length&&(s.additionalModels=a.map(e=>({...e.rest,id:e.id.trim(),label:e.label.trim(),...e.isDefault?{isDefault:!0}:{}}))),n[t]=s}return(Object.keys(n).length||Object.keys(e.providers).length)&&(t.providers=n),e.agentProfiles&&(t.agentProfiles=e.agentProfiles.map(e=>({...e.rest,id:e.id,name:e.name.trim(),provider:e.provider.trim(),...z({model:e.model,modeId:e.modeId,thinkingOptionId:e.thinkingOptionId}),...e.notes.trim()?{notes:e.notes.trim()}:{}}))),e.terminalProfiles&&(t.terminalProfiles=e.terminalProfiles.map(e=>({...e.rest,id:e.id,name:e.name.trim(),command:e.command.trim(),...L(e.argsText).length?{args:L(e.argsText)}:{}}))),e.metadataProviders&&(t.metadataGeneration={providers:e.metadataProviders.map(e=>({...e.rest,provider:e.provider.trim(),...z({model:e.model,thinkingOptionId:e.thinkingOptionId})}))}),t}function H(e){return Array.isArray(e)?`[`+e.map(H).join(`,`)+`]`:e&&typeof e==`object`?`{`+Object.entries(e).filter(([,e])=>e!==void 0).sort(([e],[t])=>e.localeCompare(t)).map(([e,t])=>JSON.stringify(e)+`:`+H(t)).join(`,`)+`}`:JSON.stringify(e)??`null`}var U=(e,t)=>H(e)===H(t),W=e=>!!e&&typeof e==`object`&&!Array.isArray(e);function G(e,t){let n=V(B(e)),r=V(t),i={};for(let e of new Set([...Object.keys(n),...Object.keys(r)]))e===`providers`||r[e]===void 0||U(n[e],r[e])||(i[e]=W(n[e])&&W(r[e])?Object.fromEntries(Object.entries(r[e]).filter(([t,r])=>!U(n[e][t],r))):r[e]);let a={};for(let[e,t]of Object.entries(r.providers??{})){let r=n.providers?.[e]??{},i=Object.fromEntries(Object.entries(t).filter(([e,t])=>!U(r[e],t)));Object.keys(i).length&&(a[e]=i)}return Object.keys(a).length&&(i.providers=a),t.removeProviders.length&&(i.removeProviders=[...t.removeProviders]),i}function K(e,t){let n=[];t.agentProfiles?.forEach((e,t)=>{let r=e.name.trim()||`Agent profile ${t+1}`;e.name.trim()||n.push(`${r} needs a name.`),e.provider.trim()||n.push(`${r} needs a provider.`)});let r=(t.agentProfiles??[]).map(e=>e.name.trim().toLowerCase()).filter(Boolean);new Set(r).size!==r.length&&n.push(`Agent profile names must be unique.`),t.terminalProfiles?.forEach((e,t)=>{let r=e.name.trim()||`Terminal profile ${t+1}`;e.name.trim()||n.push(`${r} needs a name.`),e.command.trim()||n.push(`${r} needs a command.`)}),t.metadataProviders?.forEach((e,t)=>{e.provider.trim()||n.push(`Metadata provider ${t+1} needs a provider.`)});for(let[r,i]of Object.entries(t.providers)){if(t.removeProviders.includes(r))continue;i.extends!==void 0&&!i.label?.trim()&&n.push(`${r} needs a display name.`),e.providers?.[r]?.command?.length&&!L(i.commandText).length&&n.push(`${r}: a command override cannot be cleared from here. Edit the host's config file instead.`);let a=i.additionalModels.map(e=>e.id.trim());i.additionalModels.some(e=>!e.id.trim()||!e.label.trim())?n.push(`${r}: every additional model needs an ID and a label.`):new Set(a).size!==a.length&&n.push(`${r}: additional model IDs must be unique.`),i.additionalModels.filter(e=>e.isDefault).length>1&&n.push(`${r}: only one additional model can be the default.`)}return n}function q(e){return{key:I(),id:E(),name:``,provider:e,model:``,modeId:``,thinkingOptionId:``,notes:``,rest:{}}}function J(){return{key:I(),id:E(),name:``,command:``,argsText:``,rest:{}}}function ee(e){return{key:I(),provider:e,model:``,thinkingOptionId:``,rest:{}}}function te(e,t,n){if(!e||!t)return e;let r=[...e];return t.forEach((e,t)=>{e.provider===n&&(r.some(t=>t.provider===n&&t.model===e.model&&t.thinkingOptionId===e.thinkingOptionId)||r.splice(Math.min(t,r.length),0,e))}),r}function ne(e,t,n){let r=t=>e.find(e=>e.id===t);return[...e.map(e=>e.id),...Object.keys(t.providers).filter(e=>!r(e))].map(e=>{let i=r(e),a=t.providers[e],o=t.removeProviders.includes(e),s=a?.enabled??i?.enabled??!0;return{id:e,reported:i,conf:a,removed:o,enabled:s,custom:a?.extends!==void 0||i?.source===`custom`,saved:!!n?.providers?.[e]||!!i,label:a?.label?.trim()||i?.label||e,pendingToggle:i?s!==i.enabled:!1}})}function re(e,t=Date.now()){if(!e)return`never`;let n=Math.max(0,(t-Date.parse(e))/1e3);if(!Number.isFinite(n))return`unknown`;if(n<60)return`just now`;if(n<3600)return`${Math.floor(n/60)} min ago`;if(n<86400)return`${Math.floor(n/3600)} h ago`;let r=Math.floor(n/86400);return r===1?`1 day ago`:`${r} days ago`}var Y={class:`card`},X={class:`card-row hs-daemon`},Z={class:`grow`},ie={class:`row-title`},ae={class:`row-sub`},Q={class:`hs-row-actions`},oe=[`disabled`],$=[`disabled`],se=[`disabled`],ce={key:0},le={key:1},ue={key:1,class:`setting-note is-error`,role:`alert`},de={key:2,class:`hs-output`},fe=c({__name:`HostSettingsDaemon`,props:e({api:{type:Function},base:{},version:{},desktopManaged:{type:Boolean},features:{},dirty:{type:Boolean},locked:{type:Boolean},restarting:{type:Boolean},lifecycleJob:{}},{error:{required:!0},errorModifiers:{}}),emits:e([`lifecycle`],[`update:error`]),setup(e,{emit:t}){let n=e,r=i(e,`error`),a=t,o=e=>e.message||`Request failed`,c=y(``),l=y(!1);async function u(){if(c.value)c.value=``;else{l.value=!0;try{c.value=JSON.stringify(await n.api(n.base+`/status`),null,2)}catch(e){r.value=o(e)}finally{l.value=!1}}}return(t,n)=>(T(),w(g,null,[n[2]||=_(`h2`,{id:`hs-daemon`,class:`section-label`},`Daemon`,-1),_(`div`,Y,[_(`div`,X,[_(`div`,Z,[_(`div`,ie,`Paseo `+h(e.version||`version unknown`),1),_(`div`,ae,[e.desktopManaged?(T(),w(g,{key:0},[s(`Managed by Paseo Desktop. Update it through Desktop.`)],64)):e.features.daemonSelfUpdate?e.dirty?(T(),w(g,{key:2},[s(`Save or discard your changes before restarting.`)],64)):(T(),w(g,{key:3},[s(`Restarting interrupts running agents briefly.`)],64)):(T(),w(g,{key:1},[s(`This installation cannot update itself remotely.`)],64))])]),_(`div`,Q,[e.features.daemonStatusRpc?(T(),w(`button`,{key:0,type:`button`,class:`btn btn-outline btn-sm`,disabled:l.value,onClick:u},h(c.value?`Hide status`:`Status`),9,oe)):C(``,!0),e.features.daemonStatusRpc?(T(),w(`button`,{key:1,type:`button`,class:`btn btn-outline btn-sm`,disabled:e.dirty||e.locked,onClick:n[0]||=e=>a(`lifecycle`,`restart`)},` Restart… `,8,$)):C(``,!0),e.features.daemonStatusRpc&&e.features.daemonSelfUpdate&&!e.desktopManaged?(T(),w(`button`,{key:2,type:`button`,class:`btn btn-outline btn-sm`,disabled:e.dirty||e.locked,onClick:n[1]||=e=>a(`lifecycle`,`update`)},` Update & restart… `,8,se)):C(``,!0)])])]),e.lifecycleJob&&!e.restarting?(T(),w(`p`,{key:0,role:`status`,class:p([`setting-note`,{"is-error":e.lifecycleJob.state===`failed`}])},[s(h(e.lifecycleJob.phase),1),e.lifecycleJob.version?(T(),w(`span`,ce,` · `+h(e.lifecycleJob.version),1)):C(``,!0),e.lifecycleJob.error?(T(),w(`span`,le,`: `+h(e.lifecycleJob.error),1)):C(``,!0)],2)):C(``,!0),r.value?(T(),w(`p`,ue,h(r.value),1)):C(``,!0),c.value?(T(),w(`pre`,de,h(c.value),1)):C(``,!0)],64))}}),pe={class:`card form-card`},me={class:`field`},he=[`value`,`disabled`],ge={key:0,class:`hs-skill-list`},_e=[`value`,`disabled`],ve={class:`hs-actions`},ye=[`disabled`],be={class:`card`},xe={key:0,class:`card-row subtle`},Se={class:`grow`},Ce={class:`row-title`},we={key:0,class:`row-sub`},Te={key:1,class:`row-sub is-error`},Ee={class:`hs-row-actions`},De=[`disabled`,`onClick`],Oe=[`disabled`,`onClick`],ke=[`disabled`,`aria-label`,`onClick`],Ae={key:0,class:`spinner`},je={key:1,class:`card-row hs-add`},Me=[`disabled`],Ne=c({__name:`HostSettingsExtensions`,props:{api:{type:Function},base:{},features:{},loads:{}},emits:[`skills`],setup(e,{emit:t}){let r=e,i=t,a=e=>e.message||`Request failed`,c=y(null),b=y(``),x=y(!1),E=y(null),O=v(()=>!!c.value&&H(k())!==b.value);l(()=>!!c.value,e=>i(`skills`,e),{immediate:!0});function k(){let e=c.value.selection;return e.mode===`all`?{mode:`all`}:{mode:`custom`,skills:[...e.skills??[]].sort()}}async function j(){if(r.features.skillManagement)try{c.value=await r.api(r.base+`/skills`),b.value=H(k())}catch(e){E.value={text:a(e),error:!0}}}function M(e){c.value.selection=e===`custom`?{mode:e,skills:c.value.selection.skills??[...c.value.installed]}:{mode:e}}async function N(){x.value=!0,E.value=null;try{let e=await r.api(r.base+`/skills`,`PUT`,{selection:k()});if(e.confirmationRequired){if(!await A({title:`Remove these Paseo skills from this host?`,message:e.confirmationRequired.removals.join(`, `),confirmLabel:`Remove skills`,danger:!0}))return;e=await r.api(r.base+`/skills`,`PUT`,{selection:k(),confirmedRemovals:e.confirmationRequired.removals})}c.value=e,b.value=H(k()),E.value={text:`Skill selection applied.`}}catch(e){E.value={text:a(e),error:!0}}finally{x.value=!1}}let P=y([]),F=y(``),I=y(null),L=y(null),R=v(()=>!!r.features.pluginManagement);async function z(){if(R.value)try{P.value=await r.api(r.base+`/plugins`)}catch(e){L.value={text:a(e),error:!0}}}async function B(e,t){let n=P.value.find(t=>t.id===e)?.name??e;if(t!==`remove`||await A({title:`Remove plugin ${n} from this host?`,confirmLabel:`Remove plugin`,danger:!0})){I.value=e||`install`,L.value=null;try{await r.api(r.base+`/plugins`+(e?`/`+encodeURIComponent(e)+`/`+t:``),`POST`,e?{}:{source:F.value.trim()},12e4),e||(F.value=``),L.value={text:e?`${n}: ${t===`remove`?`removed`:t+`d`}.`:`Plugin installed.`},P.value=await r.api(r.base+`/plugins`)}catch(e){L.value={text:a(e),error:!0}}finally{I.value=null}}}return l(()=>r.loads,()=>void Promise.all([j(),z()]),{immediate:!0}),(t,r)=>(T(),w(g,null,[c.value?(T(),w(g,{key:0},[r[6]||=_(`h2`,{id:`hs-skills`,class:`section-label`},`Paseo skills`,-1),r[7]||=_(`p`,{class:`subtle hs-hint`},`Skills Paseo installs for agents on this host. Applied immediately, separately from Save.`,-1),_(`div`,pe,[_(`label`,me,[_(`span`,null,`Installed skills · `+h(c.value.state),1),_(`select`,{value:c.value.selection.mode,disabled:x.value,onChange:r[0]||=e=>M(e.target.value)},[...r[5]||=[_(`option`,{value:`all`},`All Paseo skills`,-1),_(`option`,{value:`custom`},`Only the skills I choose`,-1)]],40,he)]),c.value.selection.mode===`custom`?(T(),w(`div`,ge,[(T(!0),w(g,null,n(c.value.available,e=>(T(),w(`label`,{key:e,class:`hs-check`},[o(_(`input`,{"onUpdate:modelValue":r[1]||=e=>c.value.selection.skills=e,type:`checkbox`,value:e,disabled:x.value},null,8,_e),[[d,c.value.selection.skills]]),s(h(e),1)]))),128))])):C(``,!0),_(`div`,ve,[_(`button`,{type:`button`,class:`btn btn-outline btn-sm`,disabled:!O.value||x.value,onClick:N},h(x.value?`Applying…`:`Apply skill selection`),9,ye),E.value?(T(),w(`span`,{key:0,class:p([`setting-note`,{"is-error":E.value.error}]),role:`status`},h(E.value.text),3)):C(``,!0)])])],64)):C(``,!0),R.value?(T(),w(g,{key:1},[r[8]||=_(`h2`,{id:`hs-plugins`,class:`section-label`},`Host plugins`,-1),r[9]||=_(`p`,{class:`subtle hs-hint`},`Plugin code runs on this host with its user's permissions. Actions apply immediately.`,-1),L.value?(T(),w(`p`,{key:0,class:p([`setting-note`,{"is-error":L.value.error}]),role:`status`},h(L.value.text),3)):C(``,!0),_(`div`,be,[P.value.length?C(``,!0):(T(),w(`p`,xe,`No plugins installed.`)),(T(!0),w(g,null,n(P.value,e=>(T(),w(`div`,{key:e.id,class:`card-row hs-plugin`},[_(`div`,Se,[_(`div`,Ce,[s(h(e.name??e.id)+` `,1),_(`span`,{class:p([`badge`,{"is-error":e.status===`error`||e.error,"is-running":e.status===`running`}])},h(e.status),3)]),e.description?(T(),w(`div`,we,h(e.description),1)):C(``,!0),e.error?(T(),w(`div`,Te,h(e.error),1)):C(``,!0)]),_(`div`,Ee,[_(`button`,{type:`button`,class:`btn btn-outline btn-sm`,disabled:!!I.value,onClick:t=>B(e.id,e.enabled?`disable`:`enable`)},h(e.enabled?`Disable`:`Enable`),9,De),_(`button`,{type:`button`,class:`btn btn-outline btn-sm`,disabled:!!I.value,onClick:t=>B(e.id,`reload`)},`Reload`,8,Oe),_(`button`,{type:`button`,class:`icon-btn hs-danger`,disabled:!!I.value,"aria-label":`Remove `+(e.name??e.id),title:`Remove`,onClick:t=>B(e.id,`remove`)},[I.value===e.id?(T(),w(`span`,Ae)):(T(),u(D,{key:1,name:`trash`,size:14}))],8,ke)])]))),128)),e.features.pluginSourceInstallation?(T(),w(`div`,je,[o(_(`input`,{"onUpdate:modelValue":r[2]||=e=>F.value=e,placeholder:`npm package, Git URL or host directory`,"aria-label":`Install trusted plugin`,onKeydown:r[3]||=S(m(e=>F.value.trim()&&B(``,`install`),[`prevent`]),[`enter`])},null,544),[[f,F.value]]),_(`button`,{type:`button`,class:`btn btn-outline btn-sm`,disabled:!F.value.trim()||!!I.value,onClick:r[4]||=e=>B(``,`install`)},h(I.value===`install`?`Installing…`:`Install`),9,Me)])):C(``,!0)])],64)):C(``,!0)],64))}}),Pe={class:`card`},Fe={class:`grow`},Ie={class:`row-title`},Le={class:`row-sub`},Re=[`onUpdate:modelValue`,`aria-label`],ze={key:0,class:`card-row switch-row`},Be={key:1,class:`card-row switch-row`},Ve={key:2,class:`card-row switch-row`},He={class:`card form-card`},Ue={class:`field`},We={key:0,class:`field`},Ge=c({__name:`HostSettingsGeneral`,props:{draft:{},features:{}},setup(e){let t=e,r=[[`idleRuntimeCleanup`,`Release idle agents`,`Free memory held by idle agents that can be resumed later.`,`idleRuntimeCleanupSetting`],[`resumeOnStartup`,`Resume agents after restart`,`Continue interrupted agents when the daemon starts.`,`resumeOnStartupSetting`],[`autoArchiveAfterMerge`,`Archive merged workspaces`,`Archive a workspace once its changes are merged.`,``],[`enableTerminalAgentHooks`,`Terminal agent hooks`,`Track supported agents launched from terminals.`,``],[`pluginsEnabled`,`Host plugins`,`Run the plugins configured on this host.`,`plugins`]],i=v(()=>{let e=t.draft.values??{};return r.filter(([n,,,r])=>r?t.features[r]:n in e)});return(t,r)=>(T(),w(g,null,[r[10]||=_(`h2`,{id:`hs-general`,class:`section-label`},`General`,-1),_(`div`,Pe,[(T(!0),w(g,null,n(i.value,([t,n,r])=>(T(),w(`label`,{key:t,class:`card-row switch-row`},[_(`div`,Fe,[_(`div`,Ie,h(n),1),_(`div`,Le,h(r),1)]),o(_(`input`,{"onUpdate:modelValue":n=>e.draft.values[t]=n,type:`checkbox`,class:`switch`,"aria-label":n},null,8,Re),[[d,e.draft.values[t]]])]))),128)),e.draft.values.mcp?(T(),w(`label`,ze,[r[5]||=_(`div`,{class:`grow`},[_(`div`,{class:`row-title`},`Paseo orchestration tools`),_(`div`,{class:`row-sub`},`Give agents Paseo's tools for starting and managing other agents.`)],-1),o(_(`input`,{"onUpdate:modelValue":r[0]||=t=>e.draft.values.mcp.injectIntoAgents=t,type:`checkbox`,class:`switch`,"aria-label":`Paseo orchestration tools`},null,512),[[d,e.draft.values.mcp.injectIntoAgents]])])):C(``,!0),e.draft.values.browserTools?(T(),w(`label`,Be,[r[6]||=_(`div`,{class:`grow`},[_(`div`,{class:`row-title`},`Browser tools`),_(`div`,{class:`row-sub`},`Let agents automate a browser on this host.`)],-1),o(_(`input`,{"onUpdate:modelValue":r[1]||=t=>e.draft.values.browserTools.enabled=t,type:`checkbox`,class:`switch`,"aria-label":`Browser tools`},null,512),[[d,e.draft.values.browserTools.enabled]])])):C(``,!0),e.draft.values.usage?(T(),w(`label`,Ve,[r[7]||=_(`div`,{class:`grow`},[_(`div`,{class:`row-title`},`Provider usage`),_(`div`,{class:`row-sub`},`Collect usage limits from providers for the usage panel.`)],-1),o(_(`input`,{"onUpdate:modelValue":r[2]||=t=>e.draft.values.usage.enabled=t,type:`checkbox`,class:`switch`,"aria-label":`Provider usage`},null,512),[[d,e.draft.values.usage.enabled]])])):C(``,!0)]),_(`div`,He,[_(`label`,Ue,[r[8]||=_(`span`,null,`Additional system instructions`,-1),o(_(`textarea`,{"onUpdate:modelValue":r[3]||=t=>e.draft.values.appendSystemPrompt=t,rows:`4`,placeholder:`Appended to every agent's instructions on this host`},null,512),[[f,e.draft.values.appendSystemPrompt]])]),e.features.resumeOnStartupSetting?(T(),w(`label`,We,[r[9]||=_(`span`,null,`Restart recovery prompt`,-1),o(_(`textarea`,{"onUpdate:modelValue":r[4]||=t=>e.draft.values.resumePrompt=t,rows:`2`,placeholder:`Sent to agents resumed after a restart`},null,512),[[f,e.draft.values.resumePrompt]])])):C(``,!0)])],64))}}),Ke={class:`hs-head`},qe={class:`card`},Je={key:0,class:`card-row subtle`},Ye=[`aria-expanded`,`onClick`],Xe={class:`grow`},Ze={class:`row-title`},Qe={class:`row-sub`},$e={key:0,class:`hs-item-body`},et={class:`hs-grid`},tt={class:`field`},nt=[`onUpdate:modelValue`,`aria-invalid`],rt={class:`field`},it=[`onUpdate:modelValue`,`onChange`],at=[`value`],ot=[`value`],st={class:`field`},ct=[`onUpdate:modelValue`,`onChange`],lt=[`value`],ut=[`value`],dt={class:`field`},ft=[`onUpdate:modelValue`],pt=[`value`],mt=[`value`],ht={class:`field`},gt=[`onUpdate:modelValue`],_t=[`value`],vt=[`value`],yt={class:`field`},bt=[`onUpdate:modelValue`],xt={class:`hs-actions`},St=[`disabled`,`onClick`],Ct=[`disabled`,`onClick`],wt=[`onClick`],Tt={class:`hs-head`},Et={class:`card`},Dt={key:0,class:`card-row subtle`},Ot={class:`hs-order`},kt=[`onUpdate:modelValue`,`aria-label`,`onChange`],At=[`value`],jt=[`value`],Mt=[`onUpdate:modelValue`,`aria-label`,`onChange`],Nt=[`value`],Pt=[`value`],Ft=[`onUpdate:modelValue`,`aria-label`],It=[`value`],Lt=[`value`],Rt={class:`hs-row-actions`},zt=[`disabled`,`onClick`],Bt=[`onClick`],Vt={class:`hs-head`},Ht={class:`card`},Ut={key:0,class:`card-row subtle`},Wt=[`aria-expanded`,`onClick`],Gt={class:`grow`},Kt={class:`row-title`},qt={class:`row-sub hs-mono`},Jt={key:0,class:`hs-item-body`},Yt={class:`hs-grid`},Xt={class:`field`},Zt=[`onUpdate:modelValue`,`aria-invalid`],Qt={class:`field`},$t=[`onUpdate:modelValue`,`aria-invalid`],en={class:`field`},tn=[`onUpdate:modelValue`],nn={class:`hs-actions`},rn=[`disabled`,`onClick`],an=[`disabled`,`onClick`],on=[`onClick`],sn=c({__name:`HostSettingsProfiles`,props:{draft:{},features:{},providers:{},rows:{}},setup(e){let r=e,i=v(()=>r.rows.filter(e=>!e.removed&&e.enabled).map(e=>({id:e.id,label:e.label}))),a=e=>r.providers.find(t=>t.id===e),c=e=>a(e)?.models??[],l=e=>a(e)?.modes??[];function u(e,t){let n=c(e);return(n.find(e=>e.id===t)??n.find(e=>e.isDefault)??n[0])?.thinking??[]}let d=(e,t)=>e.find(e=>e.id===t)?.label??t;function m(e){e.model=e.thinkingOptionId=``,e.modeId!==void 0&&(e.modeId=``)}function x(e){e.thinkingOptionId&&!u(e.provider,e.model).some(t=>t.id===e.thinkingOptionId)&&(e.thinkingOptionId=``)}let S=y({});function E(e,t,n){let r=t+n;r>=0&&r<e.length&&([e[t],e[r]]=[e[r],e[t]])}function O(){let e=q(i.value[0]?.id??`codex`);(r.draft.agentProfiles??=[]).push(e),S.value[e.key]=!0}function k(){let e=J();(r.draft.terminalProfiles??=[]).push(e),S.value[e.key]=!0}function j(){(r.draft.metadataProviders??=[]).push(ee(i.value[0]?.id??`codex`))}async function M(e,t,n){let r=e[t],i=r?.name?.trim();if(i&&!await A({title:`Remove ${n} ${i}?`,confirmLabel:`Remove`,danger:!0}))return;let a=e.indexOf(r);a>=0&&e.splice(a,1)}function N(e){let t=[d(i.value,e.provider)||`No provider`,e.model?d(c(e.provider),e.model):`Default model`];return e.thinkingOptionId&&t.push(d(u(e.provider,e.model),e.thinkingOptionId)),e.modeId&&t.push(d(l(e.provider),e.modeId)),t.join(` · `)}return(r,a)=>(T(),w(g,null,[e.features.agentProfiles?(T(),w(g,{key:0},[_(`div`,Ke,[a[1]||=_(`h2`,{id:`hs-profiles`,class:`section-label`},`Agent profiles`,-1),_(`button`,{type:`button`,class:`btn btn-outline btn-sm`,onClick:O},[t(D,{name:`plus`,size:13}),a[0]||=s(`Add agent profile`,-1)])]),a[12]||=_(`p`,{class:`subtle hs-hint`},`Named launch settings, also offered to orchestrating agents.`,-1),_(`div`,qe,[e.draft.agentProfiles?.length?C(``,!0):(T(),w(`p`,Je,`No agent profiles yet.`)),(T(!0),w(g,null,n(e.draft.agentProfiles??[],(r,d)=>(T(),w(`div`,{key:r.key,class:p([`hs-item`,{"is-open":S.value[r.key]}])},[_(`button`,{type:`button`,class:`card-row hs-item-head`,"aria-expanded":!!S.value[r.key],onClick:e=>S.value[r.key]=!S.value[r.key]},[_(`span`,Xe,[_(`span`,Ze,h(r.name.trim()||`Untitled profile`),1),_(`span`,Qe,h(N(r)),1)]),t(D,{name:`chevron`,size:15,class:`hs-chevron`})],8,Ye),S.value[r.key]?(T(),w(`div`,$e,[_(`div`,et,[_(`label`,tt,[a[2]||=_(`span`,null,`Name`,-1),o(_(`input`,{"onUpdate:modelValue":e=>r.name=e,"aria-invalid":!r.name.trim(),placeholder:`Review`},null,8,nt),[[f,r.name]])]),_(`label`,rt,[a[3]||=_(`span`,null,`Provider`,-1),o(_(`select`,{"onUpdate:modelValue":e=>r.provider=e,"aria-label":`Provider`,onChange:e=>m(r)},[r.provider&&!i.value.some(e=>e.id===r.provider)?(T(),w(`option`,{key:0,value:r.provider},h(r.provider)+` (not enabled)`,9,at)):C(``,!0),(T(!0),w(g,null,n(i.value,e=>(T(),w(`option`,{key:e.id,value:e.id},h(e.label),9,ot))),128))],40,it),[[b,r.provider]])]),_(`label`,st,[a[5]||=_(`span`,null,`Model`,-1),o(_(`select`,{"onUpdate:modelValue":e=>r.model=e,"aria-label":`Model`,onChange:e=>x(r)},[a[4]||=_(`option`,{value:``},`Provider default`,-1),r.model&&!c(r.provider).some(e=>e.id===r.model)?(T(),w(`option`,{key:0,value:r.model},h(r.model)+` (not reported)`,9,lt)):C(``,!0),(T(!0),w(g,null,n(c(r.provider),e=>(T(),w(`option`,{key:e.id,value:e.id},h(e.label),9,ut))),128))],40,ct),[[b,r.model]])]),_(`label`,dt,[a[7]||=_(`span`,null,`Thinking`,-1),o(_(`select`,{"onUpdate:modelValue":e=>r.thinkingOptionId=e,"aria-label":`Thinking`},[a[6]||=_(`option`,{value:``},`Model default`,-1),r.thinkingOptionId&&!u(r.provider,r.model).some(e=>e.id===r.thinkingOptionId)?(T(),w(`option`,{key:0,value:r.thinkingOptionId},h(r.thinkingOptionId)+` (not reported) `,9,pt)):C(``,!0),(T(!0),w(g,null,n(u(r.provider,r.model),e=>(T(),w(`option`,{key:e.id,value:e.id},h(e.label),9,mt))),128))],8,ft),[[b,r.thinkingOptionId]])]),_(`label`,ht,[a[9]||=_(`span`,null,`Mode`,-1),o(_(`select`,{"onUpdate:modelValue":e=>r.modeId=e,"aria-label":`Mode`},[a[8]||=_(`option`,{value:``},`Provider default`,-1),r.modeId&&!l(r.provider).some(e=>e.id===r.modeId)?(T(),w(`option`,{key:0,value:r.modeId},h(r.modeId)+` (not reported)`,9,_t)):C(``,!0),(T(!0),w(g,null,n(l(r.provider),e=>(T(),w(`option`,{key:e.id,value:e.id},h(e.label),9,vt))),128))],8,gt),[[b,r.modeId]])])]),_(`label`,yt,[a[10]||=_(`span`,null,`When to use`,-1),o(_(`textarea`,{"onUpdate:modelValue":e=>r.notes=e,rows:`4`,placeholder:`Shown to orchestrating agents choosing a profile`},null,8,bt),[[f,r.notes]])]),_(`div`,xt,[_(`button`,{type:`button`,class:`btn btn-outline btn-sm`,disabled:d===0,onClick:t=>E(e.draft.agentProfiles,d,-1)},`Move up`,8,St),_(`button`,{type:`button`,class:`btn btn-outline btn-sm`,disabled:d===e.draft.agentProfiles.length-1,onClick:t=>E(e.draft.agentProfiles,d,1)},` Move down `,8,Ct),_(`button`,{type:`button`,class:`btn btn-outline btn-sm hs-danger`,onClick:t=>M(e.draft.agentProfiles,d,`agent profile`)},[t(D,{name:`trash`,size:13}),a[11]||=s(`Remove `,-1)],8,wt)])])):C(``,!0)],2))),128))])],64)):C(``,!0),e.draft.metadataProviders?(T(),w(g,{key:1},[_(`div`,Tt,[a[14]||=_(`h2`,{id:`hs-metadata`,class:`section-label`},`Metadata generation`,-1),_(`button`,{type:`button`,class:`btn btn-outline btn-sm`,onClick:j},[t(D,{name:`plus`,size:13}),a[13]||=s(`Add provider`,-1)])]),a[17]||=_(`p`,{class:`subtle hs-hint`},`Providers tried in order for branch names, commit messages and pull requests. None: Paseo picks automatically.`,-1),_(`div`,Et,[e.draft.metadataProviders.length?C(``,!0):(T(),w(`p`,Dt,`Automatic selection.`)),(T(!0),w(g,null,n(e.draft.metadataProviders,(r,s)=>(T(),w(`div`,{key:r.key,class:`card-row hs-meta-row`},[_(`span`,Ot,h(s+1),1),o(_(`select`,{"onUpdate:modelValue":e=>r.provider=e,"aria-label":`Metadata provider `+(s+1),onChange:e=>m(r)},[r.provider&&!i.value.some(e=>e.id===r.provider)?(T(),w(`option`,{key:0,value:r.provider},h(r.provider)+` (not enabled)`,9,At)):C(``,!0),(T(!0),w(g,null,n(i.value,e=>(T(),w(`option`,{key:e.id,value:e.id},h(e.label),9,jt))),128))],40,kt),[[b,r.provider]]),o(_(`select`,{"onUpdate:modelValue":e=>r.model=e,"aria-label":`Metadata model `+(s+1),onChange:e=>x(r)},[a[15]||=_(`option`,{value:``},`Default model`,-1),r.model&&!c(r.provider).some(e=>e.id===r.model)?(T(),w(`option`,{key:0,value:r.model},h(r.model)+` (not reported)`,9,Nt)):C(``,!0),(T(!0),w(g,null,n(c(r.provider),e=>(T(),w(`option`,{key:e.id,value:e.id},h(e.label),9,Pt))),128))],40,Mt),[[b,r.model]]),o(_(`select`,{"onUpdate:modelValue":e=>r.thinkingOptionId=e,"aria-label":`Metadata thinking `+(s+1)},[a[16]||=_(`option`,{value:``},`Default thinking`,-1),r.thinkingOptionId&&!u(r.provider,r.model).some(e=>e.id===r.thinkingOptionId)?(T(),w(`option`,{key:0,value:r.thinkingOptionId},h(r.thinkingOptionId),9,It)):C(``,!0),(T(!0),w(g,null,n(u(r.provider,r.model),e=>(T(),w(`option`,{key:e.id,value:e.id},h(e.label),9,Lt))),128))],8,Ft),[[b,r.thinkingOptionId]]),_(`span`,Rt,[_(`button`,{type:`button`,class:`icon-btn hs-up`,disabled:s===0,"aria-label":`Move up`,title:`Move up`,onClick:t=>E(e.draft.metadataProviders,s,-1)},[t(D,{name:`chevron`,size:14})],8,zt),_(`button`,{type:`button`,class:`icon-btn`,"aria-label":`Remove`,title:`Remove`,onClick:t=>e.draft.metadataProviders.splice(s,1)},[t(D,{name:`close`,size:14})],8,Bt)])]))),128))])],64)):C(``,!0),_(`div`,Vt,[a[19]||=_(`h2`,{id:`hs-terminals`,class:`section-label`},`Terminal profiles`,-1),_(`button`,{type:`button`,class:`btn btn-outline btn-sm`,onClick:k},[t(D,{name:`plus`,size:13}),a[18]||=s(`Add terminal profile`,-1)])]),a[24]||=_(`p`,{class:`subtle hs-hint`},`Commands offered when opening a new terminal on this host.`,-1),_(`div`,Ht,[e.draft.terminalProfiles?.length?C(``,!0):(T(),w(`p`,Ut,`No terminal profiles yet.`)),(T(!0),w(g,null,n(e.draft.terminalProfiles??[],(n,r)=>(T(),w(`div`,{key:n.key,class:p([`hs-item`,{"is-open":S.value[n.key]}])},[_(`button`,{type:`button`,class:`card-row hs-item-head`,"aria-expanded":!!S.value[n.key],onClick:e=>S.value[n.key]=!S.value[n.key]},[_(`span`,Gt,[_(`span`,Kt,h(n.name.trim()||`Untitled terminal`),1),_(`span`,qt,h([n.command,...n.argsText.split(`
|
|
Binary file
|
|
Binary file
|