@neuralnomads/codenomad-dev 0.18.0-dev-20260809-67cb394e → 0.19.0-dev-20260813-ac153312

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.
Files changed (53) hide show
  1. package/dist/opencode-plugin/codenomad-opencode-plugin.tgz +0 -0
  2. package/dist/settings/service.js +17 -5
  3. package/dist/settings/service.test.js +51 -0
  4. package/dist/settings/yaml-doc-store.js +55 -4
  5. package/dist/settings/yaml-doc-store.test.js +78 -0
  6. package/dist/sidecars/manager.js +26 -3
  7. package/dist/sidecars/manager.test.js +42 -0
  8. package/package.json +1 -1
  9. package/public/assets/FilesTab-BFPVTSho.js +2 -0
  10. package/public/assets/{GitChangesTab-Tw90ns02.js → GitChangesTab-CKBFVNI8.js} +2 -2
  11. package/public/assets/{SplitFilePanel-Cd76S2b9.js → SplitFilePanel-CaD8pox4.js} +1 -1
  12. package/public/assets/StatusTab-C7OAyimT.js +1 -0
  13. package/public/assets/{align-justify-DYMhLgIY.js → align-justify-BiSxVeYp.js} +1 -1
  14. package/public/assets/{bundle-full-yMAV5vbj.js → bundle-full-CEFzES5w.js} +1 -1
  15. package/public/assets/{diff-viewer-cbFMYFnG.js → diff-viewer-D5fGlZEl.js} +1 -1
  16. package/public/assets/index--I9sbcs5.css +1 -0
  17. package/public/assets/index-B2O4H5Qa.js +1 -0
  18. package/public/assets/{index-COh163c2.js → index-B81f0aWL.js} +1 -1
  19. package/public/assets/index-C1DHYMgf.js +1 -0
  20. package/public/assets/index-CKjfzBbg.js +1 -0
  21. package/public/assets/index-CuF7nIit.js +1 -0
  22. package/public/assets/index-Cy4pOSir.js +1 -0
  23. package/public/assets/index-DLsqhfb5.js +1 -0
  24. package/public/assets/index-DYdKQoFg.js +1 -0
  25. package/public/assets/index-DaQdDlze.js +1 -0
  26. package/public/assets/index-RnXDcFsv.js +2 -0
  27. package/public/assets/{index-Glx2xi1x.js → index-lORR8OnW.js} +1 -1
  28. package/public/assets/{loading-CLR16KdT.js → loading-BpZBMbqV.js} +1 -1
  29. package/public/assets/main-BnwG4srg.js +69 -0
  30. package/public/assets/{markdown-Cn1rfx2F.js → markdown-CFb0Suko.js} +3 -3
  31. package/public/assets/monaco-viewer-NKl8kwH2.js +26 -0
  32. package/public/assets/terminal-square-QNfjv56N.js +1 -0
  33. package/public/assets/{tool-call-D3ADKESH.js → tool-call-BKkxYXma.js} +3 -3
  34. package/public/assets/{unified-picker-BvrsMVs5.js → unified-picker-CXQhDzIV.js} +1 -1
  35. package/public/assets/{wrap-text-CusvDWcP.js → wrap-text-CUOAN4GW.js} +1 -1
  36. package/public/index.html +4 -4
  37. package/public/loading.html +4 -4
  38. package/public/sw.js +1 -1
  39. package/public/ui-version.json +1 -1
  40. package/public/assets/FilesTab-Ch4jXstC.js +0 -2
  41. package/public/assets/StatusTab-B_nwxUsE.js +0 -1
  42. package/public/assets/index-B65LjlYB.js +0 -1
  43. package/public/assets/index-B7bZsUV8.css +0 -1
  44. package/public/assets/index-BSA3SyyP.js +0 -2
  45. package/public/assets/index-Bl7UvYP-.js +0 -1
  46. package/public/assets/index-Bo71H1mG.js +0 -1
  47. package/public/assets/index-D5sicp6K.js +0 -1
  48. package/public/assets/index-Db4ROxbH.js +0 -1
  49. package/public/assets/index-DiEt035Z.js +0 -1
  50. package/public/assets/index-QXzSNJqc.js +0 -1
  51. package/public/assets/index-nuiLUXEP.js +0 -1
  52. package/public/assets/main-DxKSa1-Y.js +0 -69
  53. package/public/assets/monaco-viewer-BSlOM5Le.js +0 -26
@@ -2,6 +2,7 @@ import { z } from "zod";
2
2
  import { YamlDocStore } from "./yaml-doc-store";
3
3
  import { migrateSettingsLayout } from "./migrate";
4
4
  import { sanitizeConfigOwner } from "./public-config";
5
+ import { applyMergePatch } from "./merge-patch";
5
6
  const CanonicalLogLevelSchema = z.preprocess((value) => (typeof value === "string" ? value.trim().toUpperCase() : value), z.enum(["DEBUG", "INFO", "WARN", "ERROR"]));
6
7
  function isPlainObject(value) {
7
8
  return typeof value === "object" && value !== null && !Array.isArray(value);
@@ -48,8 +49,8 @@ export class SettingsService {
48
49
  this.eventBus = eventBus;
49
50
  this.logger = logger;
50
51
  migrateSettingsLayout(location, logger);
51
- this.configStore = new YamlDocStore(location.configYamlPath, logger.child({ component: "settings-config" }));
52
- this.stateStore = new YamlDocStore(location.stateYamlPath, logger.child({ component: "settings-state" }));
52
+ this.configStore = new YamlDocStore(location.configYamlPath, logger.child({ component: "settings-config" }), { throwOnPersistError: true });
53
+ this.stateStore = new YamlDocStore(location.stateYamlPath, logger.child({ component: "settings-state" }), { throwOnPersistError: true });
53
54
  }
54
55
  getDoc(kind) {
55
56
  if (kind !== "config") {
@@ -63,8 +64,11 @@ export class SettingsService {
63
64
  return normalized;
64
65
  }
65
66
  mergePatchDoc(kind, patch) {
67
+ if (!isPlainObject(patch)) {
68
+ throw new Error("Patch must be a JSON object");
69
+ }
66
70
  const updated = kind === "config"
67
- ? this.configStore.replace(normalizeConfigDoc(this.configStore.mergePatch(patch)))
71
+ ? this.configStore.replace(normalizeConfigDoc(applyMergePatch(this.configStore.get(), patch)))
68
72
  : this.stateStore.mergePatch(patch);
69
73
  this.publish(kind, "*");
70
74
  return updated;
@@ -78,9 +82,12 @@ export class SettingsService {
78
82
  : this.getDoc("config")[owner];
79
83
  }
80
84
  mergePatchOwner(kind, owner, patch) {
85
+ if (!isPlainObject(patch)) {
86
+ throw new Error("Patch must be a JSON object");
87
+ }
81
88
  const updated = kind === "config"
82
89
  ? owner === "server"
83
- ? this.configStore.replaceOwner(owner, normalizeServerConfigOwner(this.configStore.mergePatchOwner(owner, patch)))
90
+ ? this.configStore.replaceOwner(owner, normalizeServerConfigOwner(applyMergePatch(this.configStore.getOwner(owner), patch)))
84
91
  : this.configStore.mergePatchOwner(owner, patch)
85
92
  : this.stateStore.mergePatchOwner(owner, patch);
86
93
  this.publish(kind, owner, updated);
@@ -96,6 +103,11 @@ export class SettingsService {
96
103
  owner,
97
104
  value: kind === "config" ? sanitizeConfigOwner(owner, nextValue) : nextValue,
98
105
  };
99
- this.eventBus.publish(payload);
106
+ try {
107
+ this.eventBus.publish(payload);
108
+ }
109
+ catch (error) {
110
+ this.logger.warn({ err: error, kind, owner }, "Failed to publish settings change");
111
+ }
100
112
  }
101
113
  }
@@ -0,0 +1,51 @@
1
+ import assert from "node:assert/strict";
2
+ import { describe, it } from "node:test";
3
+ import { SettingsService } from "./service";
4
+ function serviceWithStore(store) {
5
+ const service = Object.create(SettingsService.prototype);
6
+ Object.assign(service, { configStore: store, eventBus: undefined });
7
+ return service;
8
+ }
9
+ describe("SettingsService config persistence", () => {
10
+ it("normalizes and persists a document patch once", () => {
11
+ let writes = 0;
12
+ const service = serviceWithStore({
13
+ get: () => ({ server: { logLevel: "info" } }),
14
+ replace: (value) => {
15
+ writes += 1;
16
+ return value;
17
+ },
18
+ mergePatch: () => assert.fail("must not persist an intermediate document"),
19
+ });
20
+ const result = service.mergePatchDoc("config", { ui: { theme: "dark" } });
21
+ assert.equal(writes, 1);
22
+ assert.deepEqual(result, { server: { logLevel: "INFO" }, ui: { theme: "dark" } });
23
+ });
24
+ it("normalizes and persists a server-owner patch once", () => {
25
+ let writes = 0;
26
+ const service = serviceWithStore({
27
+ getOwner: () => ({ logLevel: "info", sidecars: [] }),
28
+ replaceOwner: (_owner, value) => {
29
+ writes += 1;
30
+ return value;
31
+ },
32
+ mergePatchOwner: () => assert.fail("must not persist an intermediate owner"),
33
+ });
34
+ const result = service.mergePatchOwner("config", "server", { sidecars: [{ id: "one" }] });
35
+ assert.equal(writes, 1);
36
+ assert.deepEqual(result, { logLevel: "INFO", sidecars: [{ id: "one" }] });
37
+ });
38
+ it("does not report a persisted patch as failed when an event listener throws", () => {
39
+ let warnings = 0;
40
+ const service = serviceWithStore({
41
+ getOwner: () => ({}),
42
+ mergePatchOwner: (_owner, patch) => patch,
43
+ });
44
+ Object.assign(service, {
45
+ eventBus: { publish: () => { throw new Error("listener failed"); } },
46
+ logger: { warn: () => { warnings += 1; } },
47
+ });
48
+ assert.deepEqual(service.mergePatchOwner("config", "ui", { theme: "dark" }), { theme: "dark" });
49
+ assert.equal(warnings, 1);
50
+ });
51
+ });
@@ -1,5 +1,6 @@
1
1
  import fs from "fs";
2
2
  import path from "path";
3
+ import { randomUUID } from "node:crypto";
3
4
  import { parse as parseYaml, stringify as stringifyYaml } from "yaml";
4
5
  import { applyMergePatch, isPlainObject } from "./merge-patch";
5
6
  function ensureTrailingNewline(content) {
@@ -13,10 +14,32 @@ function normalizeDoc(input) {
13
14
  }
14
15
  return input;
15
16
  }
17
+ function resolveWriteDestination(filePath) {
18
+ let current = path.resolve(filePath);
19
+ const seen = new Set();
20
+ while (true) {
21
+ let stat;
22
+ try {
23
+ stat = fs.lstatSync(current);
24
+ }
25
+ catch (error) {
26
+ if (error?.code === "ENOENT")
27
+ return current;
28
+ throw error;
29
+ }
30
+ if (!stat.isSymbolicLink())
31
+ return current;
32
+ if (seen.has(current))
33
+ throw new Error(`Circular settings symlink: ${filePath}`);
34
+ seen.add(current);
35
+ current = path.resolve(path.dirname(current), fs.readlinkSync(current));
36
+ }
37
+ }
16
38
  export class YamlDocStore {
17
- constructor(filePath, logger) {
39
+ constructor(filePath, logger, options = {}) {
18
40
  this.filePath = filePath;
19
41
  this.logger = logger;
42
+ this.options = options;
20
43
  this.cache = {};
21
44
  this.loaded = false;
22
45
  }
@@ -48,9 +71,18 @@ export class YamlDocStore {
48
71
  }
49
72
  replace(next) {
50
73
  const normalized = normalizeDoc(next);
74
+ const previousCache = this.cache;
75
+ const previousLoaded = this.loaded;
51
76
  this.cache = normalized;
52
77
  this.loaded = true;
53
- this.persist();
78
+ try {
79
+ this.persist();
80
+ }
81
+ catch (error) {
82
+ this.cache = previousCache;
83
+ this.loaded = previousLoaded;
84
+ throw error;
85
+ }
54
86
  return this.cache;
55
87
  }
56
88
  mergePatch(patch) {
@@ -84,13 +116,32 @@ export class YamlDocStore {
84
116
  return nextOwner;
85
117
  }
86
118
  persist() {
119
+ let tempPath;
87
120
  try {
88
- fs.mkdirSync(path.dirname(this.filePath), { recursive: true });
121
+ const destination = resolveWriteDestination(this.filePath);
122
+ fs.mkdirSync(path.dirname(destination), { recursive: true });
89
123
  const yaml = stringifyYaml(this.cache);
90
- fs.writeFileSync(this.filePath, ensureTrailingNewline(yaml), "utf-8");
124
+ const mode = fs.existsSync(destination) ? fs.statSync(destination).mode & 0o777 : 0o600;
125
+ tempPath = `${destination}.${process.pid}.${randomUUID()}.tmp`;
126
+ fs.writeFileSync(tempPath, ensureTrailingNewline(yaml), { encoding: "utf-8", mode });
127
+ if (process.platform !== "win32")
128
+ fs.chmodSync(tempPath, mode);
129
+ fs.renameSync(tempPath, destination);
91
130
  }
92
131
  catch (error) {
93
132
  this.logger.warn({ err: error, filePath: this.filePath }, "Failed to persist YAML doc");
133
+ if (this.options.throwOnPersistError)
134
+ throw error;
135
+ }
136
+ finally {
137
+ if (tempPath) {
138
+ try {
139
+ fs.rmSync(tempPath, { force: true });
140
+ }
141
+ catch (error) {
142
+ this.logger.warn({ err: error, tempPath }, "Failed to remove temporary YAML doc");
143
+ }
144
+ }
94
145
  }
95
146
  }
96
147
  }
@@ -0,0 +1,78 @@
1
+ import assert from "node:assert/strict";
2
+ import fs from "node:fs";
3
+ import os from "node:os";
4
+ import path from "node:path";
5
+ import { describe, it } from "node:test";
6
+ import { YamlDocStore } from "./yaml-doc-store";
7
+ describe("YamlDocStore", () => {
8
+ it("reports persistence failures without replacing the cached document", () => {
9
+ const root = fs.mkdtempSync(path.join(os.tmpdir(), "codenomad-yaml-store-"));
10
+ const parent = path.join(root, "settings");
11
+ const file = path.join(parent, "config.yaml");
12
+ const store = new YamlDocStore(file, { warn() { } }, { throwOnPersistError: true });
13
+ try {
14
+ store.replace({ version: 1 });
15
+ fs.rmSync(parent, { recursive: true });
16
+ fs.writeFileSync(parent, "blocks directory creation");
17
+ assert.throws(() => store.replace({ version: 2 }));
18
+ assert.deepEqual(store.get(), { version: 1 });
19
+ }
20
+ finally {
21
+ fs.rmSync(root, { recursive: true, force: true });
22
+ }
23
+ });
24
+ it("keeps the live document intact when atomic replacement fails", () => {
25
+ const root = fs.mkdtempSync(path.join(os.tmpdir(), "codenomad-yaml-store-"));
26
+ const file = path.join(root, "config.yaml");
27
+ const store = new YamlDocStore(file, { warn() { } }, { throwOnPersistError: true });
28
+ const renameSync = fs.renameSync;
29
+ try {
30
+ store.replace({ version: 1 });
31
+ fs.renameSync = () => { throw new Error("replacement failed"); };
32
+ assert.throws(() => store.replace({ version: 2 }));
33
+ assert.match(fs.readFileSync(file, "utf8"), /version: 1/);
34
+ assert.deepEqual(store.get(), { version: 1 });
35
+ fs.renameSync = renameSync;
36
+ store.replace({ version: 2 });
37
+ assert.match(fs.readFileSync(file, "utf8"), /version: 2/);
38
+ }
39
+ finally {
40
+ ;
41
+ fs.renameSync = renameSync;
42
+ fs.rmSync(root, { recursive: true, force: true });
43
+ }
44
+ });
45
+ it("preserves private file permissions", { skip: process.platform === "win32" }, () => {
46
+ const root = fs.mkdtempSync(path.join(os.tmpdir(), "codenomad-yaml-store-"));
47
+ const file = path.join(root, "config.yaml");
48
+ const store = new YamlDocStore(file, { warn() { } }, { throwOnPersistError: true });
49
+ try {
50
+ store.replace({ version: 1 });
51
+ fs.chmodSync(file, 0o664);
52
+ store.replace({ version: 2 });
53
+ assert.equal(fs.statSync(file).mode & 0o777, 0o664);
54
+ }
55
+ finally {
56
+ fs.rmSync(root, { recursive: true, force: true });
57
+ }
58
+ });
59
+ it("updates the final target without replacing a symlink chain", { skip: process.platform === "win32" }, () => {
60
+ const root = fs.mkdtempSync(path.join(os.tmpdir(), "codenomad-yaml-store-"));
61
+ const target = path.join(root, "target.yaml");
62
+ const intermediate = path.join(root, "current.yaml");
63
+ const link = path.join(root, "config.yaml");
64
+ fs.writeFileSync(target, "version: 1\n");
65
+ fs.symlinkSync(target, intermediate);
66
+ fs.symlinkSync(intermediate, link);
67
+ const store = new YamlDocStore(link, { warn() { } }, { throwOnPersistError: true });
68
+ try {
69
+ store.replace({ version: 2 });
70
+ assert.equal(fs.lstatSync(link).isSymbolicLink(), true);
71
+ assert.equal(fs.lstatSync(intermediate).isSymbolicLink(), true);
72
+ assert.match(fs.readFileSync(target, "utf8"), /version: 2/);
73
+ }
74
+ finally {
75
+ fs.rmSync(root, { recursive: true, force: true });
76
+ }
77
+ });
78
+ });
@@ -45,18 +45,32 @@ export class SideCarManager {
45
45
  };
46
46
  this.configs.set(record.id, record);
47
47
  this.runtime.set(record.id, { status: "stopped" });
48
- this.persistConfigs();
48
+ try {
49
+ this.persistConfigs();
50
+ }
51
+ catch (error) {
52
+ this.configs.delete(record.id);
53
+ this.runtime.delete(record.id);
54
+ throw error;
55
+ }
49
56
  await this.refreshPortSideCar(record.id);
50
57
  return this.toSideCar(record);
51
58
  }
52
59
  async update(id, input) {
53
60
  const record = this.requireConfig(id);
61
+ const previous = { ...record };
54
62
  record.name = typeof input.name === "string" ? input.name.trim() : record.name;
55
63
  record.port = typeof input.port === "number" ? input.port : record.port;
56
64
  record.insecure = typeof input.insecure === "boolean" ? input.insecure : record.insecure;
57
65
  record.prefixMode = typeof input.prefixMode === "string" ? input.prefixMode : record.prefixMode;
58
66
  record.updatedAt = new Date().toISOString();
59
- this.persistConfigs();
67
+ try {
68
+ this.persistConfigs();
69
+ }
70
+ catch (error) {
71
+ this.configs.set(id, previous);
72
+ throw error;
73
+ }
60
74
  await this.refreshPortSideCar(id);
61
75
  return this.toSideCar(record);
62
76
  }
@@ -64,9 +78,18 @@ export class SideCarManager {
64
78
  const record = this.configs.get(id);
65
79
  if (!record)
66
80
  return false;
81
+ const runtime = this.runtime.get(id);
67
82
  this.configs.delete(id);
68
83
  this.runtime.delete(id);
69
- this.persistConfigs();
84
+ try {
85
+ this.persistConfigs();
86
+ }
87
+ catch (error) {
88
+ this.configs.set(id, record);
89
+ if (runtime)
90
+ this.runtime.set(id, runtime);
91
+ throw error;
92
+ }
70
93
  this.options.eventBus.publish({ type: "sidecar.removed", sidecarId: id });
71
94
  return true;
72
95
  }
@@ -0,0 +1,42 @@
1
+ import assert from "node:assert/strict";
2
+ import { describe, it } from "node:test";
3
+ import { SideCarManager } from "./manager";
4
+ const existing = {
5
+ id: "existing",
6
+ kind: "port",
7
+ name: "Existing",
8
+ port: 65534,
9
+ insecure: true,
10
+ prefixMode: "strip",
11
+ createdAt: "2026-01-01T00:00:00.000Z",
12
+ updatedAt: "2026-01-01T00:00:00.000Z",
13
+ };
14
+ function manager(sidecars = []) {
15
+ return new SideCarManager({
16
+ settings: {
17
+ getOwner: () => ({ sidecars }),
18
+ mergePatchOwner: () => { throw new Error("disk full"); },
19
+ },
20
+ eventBus: { publish() { } },
21
+ logger: { warn() { } },
22
+ });
23
+ }
24
+ describe("SideCarManager persistence rollback", () => {
25
+ it("restores create, update, and delete state when persistence fails", async () => {
26
+ const createManager = manager();
27
+ await assert.rejects(createManager.create({
28
+ kind: "port",
29
+ name: "New",
30
+ port: 65533,
31
+ insecure: true,
32
+ prefixMode: "strip",
33
+ }));
34
+ assert.deepEqual(await createManager.list(), []);
35
+ const updateManager = manager([existing]);
36
+ await assert.rejects(updateManager.update(existing.id, { name: "Changed" }));
37
+ assert.equal((await updateManager.get(existing.id))?.name, existing.name);
38
+ const deleteManager = manager([existing]);
39
+ await assert.rejects(deleteManager.delete(existing.id));
40
+ assert.equal((await deleteManager.get(existing.id))?.id, existing.id);
41
+ });
42
+ });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@neuralnomads/codenomad-dev",
3
- "version": "0.18.0-dev-20260809-67cb394e",
3
+ "version": "0.19.0-dev-20260813-ac153312",
4
4
  "description": "CodeNomad Server",
5
5
  "license": "MIT",
6
6
  "author": {
@@ -0,0 +1,2 @@
1
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/monaco-viewer-NKl8kwH2.js","assets/git-diff-vendor-CYS3ApzA.js","assets/fast-diff-vendor-DgdwVvTQ.js","assets/highlight-vendor-8FKMu9os.js","assets/git-diff-vendor-HAZkIolJ.css"])))=>i.map(i=>d[i]);
2
+ import{a9 as Y,m as $,t as u,i as o,d as v,a as W,u as Z,_ as ee,f as te}from"./monaco-viewer-NKl8kwH2.js";import{d as j,b as F,c as C,n as s,S as w,a as g,z as ne,A as le,F as ae}from"./git-diff-vendor-CYS3ApzA.js";import{S as re}from"./SplitFilePanel-CaD8pox4.js";import{R,ay as ie,M as se,az as oe,A as ce,C as q,aA as K,aB as V,aC as de,e as he,aD as N,aE as ue}from"./main-BnwG4srg.js";import{W as fe}from"./wrap-text-CUOAN4GW.js";import{T as ve}from"./terminal-square-QNfjv56N.js";import"./fast-diff-vendor-DgdwVvTQ.js";import"./highlight-vendor-8FKMu9os.js";import"./index-RnXDcFsv.js";var we=u('<div class="px-2 py-2 border-b border-base"><div class=selector-input-group><div class="flex items-center gap-2 px-3 text-muted"></div><input type=text class=selector-input>'),ge=u("<div class=file-list-header><span class=file-list-title></span><span class=file-list-count>"),Q=u('<div class="p-3 text-xs text-secondary">'),Se=u("<div class=file-list-item><div class=file-list-item-content><div class=file-list-item-path><span class=file-path-text>.."),me=u('<div class="p-3 text-xs text-error">'),be=u("<div>"),$e=u('<div><div class=file-list-item-content><div class=file-list-item-path><span class=file-path-text></span></div><div class="flex items-center gap-2 shrink-0"><div class=file-list-item-stats><span class="text-[10px] text-secondary">'),ye=u("<button type=button class=git-change-row-action>"),M=u("<div class=file-viewer-empty><span class=file-viewer-empty-text>"),_e=u('<div class="file-viewer-panel flex-1"><div>'),ke=u('<div class="h-full outline-none"tabindex=0>'),xe=u("<span>"),Ce=u("<div class=files-tab-stats><span class=files-tab-stat><span class=files-tab-selected-path><span class=file-path-text>"),Pe=u("<button type=button style=margin-inline-start:auto>"),Ee=u("<button type=button>"),B=u("<button type=button class=files-header-icon-button>"),Le=u("<span class=text-error>");const We=le(()=>ee(()=>import("./monaco-viewer-NKl8kwH2.js").then(e=>e.ax),__vite__mapDeps([0,1,2,3,4])).then(e=>({default:e.MonacoFileViewer}))),H=typeof navigator<"u"&&/windows/i.test(navigator.userAgent),Me=typeof navigator<"u"&&/macintosh|mac os x/i.test(navigator.userAgent),De=new Set(["7z","avi","bmp","c","cc","cfg","conf","cpp","cs","css","csv","dart","diff","docx","env","flac","fs","fsx","gif","go","gz","h","hpp","htm","html","ini","java","jpeg","jpg","json","jsonc","jsx","kt","kts","less","lock","log","lua","md","markdown","mkv","mov","mp3","mp4","ogg","patch","pdf","png","pptx","r","rar","rmd","rs","scss","sql","svg","svelte","swift","tar","toml","ts","tsx","txt","vue","wav","webm","webp","xlsx","xml","yaml","yml","zip"]),Fe=new Set(["bat","cmd","js","jse","pl","ps1","psd1","psm1","py","pyw","rb","reg","vbe","vbs","wsf","wsh"]);function Te(e){const y=e.split(/[\\/]/).pop()??"",_=y.lastIndexOf("."),m=_>0?y.slice(_+1).toLowerCase():"";return!H||m&&De.has(m)?"open":m&&Fe.has(m)?"edit":"choose"}function Ae(e){return e?/\.(md|markdown|mdown|mkdn)$/i.test(e):!1}const Be=e=>{const[y,_]=j(""),{isDark:m}=Y(),[p,T]=j(!1);let S;F(()=>{e.browserPath(),_("")});const G=C(()=>[...e.browserEntries()||[]].sort((r,c)=>{const l=r.type==="directory"?0:1,n=c.type==="directory"?0:1;return l!==n?l-n:String(r.name||"").localeCompare(String(c.name||""))})),A=C(()=>y().trim().toLowerCase()),D=C(()=>{const t=A(),r=G();return t?r.filter(c=>String(c.name||"").toLowerCase().includes(t)):r}),P=()=>e.browserLoading()&&e.browserEntries()===null,J=()=>A()?e.t("instanceShell.filesShell.search.empty"):e.t("instanceShell.filesShell.listEmpty"),E=C(()=>Ae(e.browserSelectedPath())),b=C(()=>E()&&p());F(()=>{E()||T(!1)});const z=()=>{const t=e.browserSelectedContent();t!=null&&e.onSave(t)},I=async(t,r)=>{r==null||r.stopPropagation();const c=await he(t);N({message:c?e.t("instanceShell.filesShell.toast.copyPathSuccess"):e.t("instanceShell.filesShell.toast.copyPathError"),variant:c?"success":"error"})},L=async(t,r)=>{try{await ue({target:t,instanceId:e.instanceId,worktreeSlug:e.worktreeSlug(),path:r})}catch(c){N({message:e.t("instanceShell.filesShell.toast.openError",{message:c instanceof Error?c.message:String(c)}),variant:"error"})}},U=t=>{const r=[];if(K())if(t.type==="directory"){const c=Me&&t.path.toLowerCase().endsWith(".app");r.push({key:"open-folder",label:e.t(c?"instanceShell.filesShell.actions.showInFolder":"instanceShell.filesShell.actions.openFolder"),icon:s(V,{class:"w-3.5 h-3.5"}),onSelect:()=>L(c?"reveal":"default",t.path)},{key:"open-terminal",label:e.t("instanceShell.filesShell.actions.openTerminal"),icon:s(ve,{class:"w-3.5 h-3.5"}),onSelect:()=>L("terminal",t.path)})}else H&&r.push({key:"open-default",label:e.t({open:"instanceShell.filesShell.actions.openDefault",edit:"instanceShell.filesShell.actions.editDefault",choose:"instanceShell.filesShell.actions.chooseApplication"}[Te(t.path)]),icon:s(de,{class:"w-3.5 h-3.5"}),onSelect:()=>L("default",t.path)}),r.push({key:"show-in-folder",label:e.t("instanceShell.filesShell.actions.showInFolder"),icon:s(V,{class:"w-3.5 h-3.5"}),onSelect:()=>L("reveal",t.path)});return r.push({key:"copy-path",label:e.t("instanceShell.filesShell.actions.copyPath"),icon:s(q,{class:"w-3.5 h-3.5"}),onSelect:()=>I(t.path)}),r};F(()=>{b()&&requestAnimationFrame(()=>S==null?void 0:S.focus())});const O=()=>[(()=>{var t=we(),r=t.firstChild,c=r.firstChild,l=c.nextSibling;return o(c,s(oe,{class:"w-4 h-4"})),l.$$input=n=>_(n.currentTarget.value),g(n=>{var i=e.t("instanceShell.filesShell.search.placeholder"),a=e.t("instanceShell.filesShell.search.ariaLabel");return i!==n.e&&v(l,"placeholder",n.e=i),a!==n.t&&v(l,"aria-label",n.t=a),n},{e:void 0,t:void 0}),g(()=>l.value=y()),t})(),(()=>{var t=ge(),r=t.firstChild,c=r.nextSibling;return o(r,()=>e.t("instanceShell.filesShell.fileListTitle")),o(c,()=>D().length),t})(),s(w,{get when(){return e.parentPath()},children:t=>(()=>{var r=Se(),c=r.firstChild,l=c.firstChild;return r.$$click=()=>e.onLoadEntries(t()),g(()=>v(l,"title",t())),r})()}),s(w,{get when(){return P()},get children(){var t=Q();return o(t,()=>e.t("instanceInfo.loading")),t}}),s(w,{get when(){return $(()=>!e.browserError()&&!P())()&&D().length>0},get fallback(){return $(()=>!P())()?$(()=>!!e.browserError())()?(()=>{var t=me();return o(t,()=>e.browserError()),t})():(()=>{var t=Q();return o(t,J),t})():void 0},get children(){return s(ae,{get each(){return D()},children:t=>(()=>{var r=$e(),c=r.firstChild,l=c.firstChild,n=l.firstChild,i=l.nextSibling,a=i.firstChild,h=a.firstChild;return r.$$click=()=>{if(t.type==="directory"){e.onLoadEntries(t.path);return}e.onRequestOpenFile(t.path)},o(n,()=>t.name),o(h,()=>t.type),o(i,s(w,{get when(){return K()},get fallback(){return(()=>{var d=ye();return d.$$click=f=>void I(t.path,f),o(d,s(q,{class:"w-3 h-3"})),g(f=>{var k=e.t("instanceShell.filesShell.actions.copyPath"),x=e.t("instanceShell.filesShell.actions.copyPath");return k!==f.e&&v(d,"title",f.e=k),x!==f.t&&v(d,"aria-label",f.t=x),f},{e:void 0,t:void 0}),d})()},get children(){var d=be();return d.$$pointerdown=f=>f.stopPropagation(),d.$$click=f=>f.stopPropagation(),o(d,s(ce,{get items(){return U(t)},get label(){return e.t("instanceShell.filesShell.actions.more",{name:t.name})},triggerClass:"git-change-row-action file-row-action-menu"})),d}}),null),g(d=>{var f=`file-list-item ${e.browserSelectedPath()===t.path?"file-list-item-active":""}`,k=t.path,x=t.path;return f!==d.e&&W(r,d.e=f),k!==d.t&&v(r,"title",d.t=k),x!==d.a&&v(l,"title",d.a=x),d},{e:void 0,t:void 0,a:void 0}),r})()})}})],X=t=>{!(t.ctrlKey||t.metaKey)||t.key.toLowerCase()!=="s"||e.browserSelectedSaving()||!e.browserSelectedDirty()||(t.preventDefault(),z())};return $(()=>{const t=()=>e.browserSelectedPath()||e.browserPath(),r=()=>P()?e.t("instanceInfo.loading"):e.t("instanceShell.filesShell.viewerEmpty"),c=()=>(()=>{var l=_e(),n=l.firstChild;return o(n,s(w,{get when(){return e.browserSelectedLoading()},get fallback(){return s(w,{get when(){return e.browserSelectedError()},get fallback(){return s(w,{get when(){return $(()=>!!(e.browserSelectedPath()&&e.browserSelectedContent()!==null))()?{path:e.browserSelectedPath(),content:e.browserSelectedContent()}:null},get fallback(){return(()=>{var i=M(),a=i.firstChild;return o(a,r),i})()},children:i=>s(w,{get when(){return b()},get fallback(){return s(ne,{get fallback(){return(()=>{var a=M(),h=a.firstChild;return o(h,()=>e.t("instanceInfo.loading")),a})()},get children(){return s(We,{get scopeKey(){return e.scopeKey()},get path(){return i().path},get content(){return i().content},get wordWrap(){return e.wordWrapMode()},get onSave(){return e.onSave},get onContentChange(){return e.onContentChange}})}})},get children(){var a=ke();a.$$mousedown=()=>S==null?void 0:S.focus(),a.$$keydown=X;var h=S;return typeof h=="function"?Z(h,a):S=a,o(a,s(se,{get part(){return{type:"text",text:i().content}},get isDark(){return m()},escapeRawHtml:!0})),a}})})},children:i=>(()=>{var a=M(),h=a.firstChild;return o(h,i),a})()})},get children(){var i=M(),a=i.firstChild;return o(a,()=>e.t("instanceInfo.loading")),i}})),g(()=>W(n,b()?"file-viewer-content":"file-viewer-content file-viewer-content--monaco")),l})();return s(re,{get header(){return[(()=>{var l=Ce(),n=l.firstChild,i=n.firstChild,a=i.firstChild;return o(a,t),o(l,s(w,{get when(){return e.browserLoading()},get children(){var h=xe();return o(h,()=>e.t("instanceInfo.loading")),h}}),null),o(l,s(w,{get when(){return e.browserError()},children:h=>(()=>{var d=Le();return o(d,h),d})()}),null),g(()=>v(i,"title",t())),l})(),(()=>{var l=Pe();return l.$$click=()=>E()&&T(n=>!n),o(l,(()=>{var n=$(()=>!!b());return()=>n()?e.t("instanceShell.filesShell.showSource"):e.t("instanceShell.filesShell.previewMarkdown")})()),g(n=>{var i=`file-viewer-toolbar-button${b()?" active":""}`,a=!E();return i!==n.e&&W(l,n.e=i),a!==n.t&&(l.disabled=n.t=a),n},{e:void 0,t:void 0}),l})(),(()=>{var l=Ee();return l.$$click=()=>e.onWordWrapModeChange(e.wordWrapMode()==="on"?"off":"on"),o(l,s(fe,{class:"h-4 w-4"})),g(n=>{var i=`file-viewer-toolbar-icon-button${e.wordWrapMode()==="on"?" active":""}`,a=e.wordWrapMode()==="on"?e.t("instanceShell.filesShell.disableWordWrap"):e.t("instanceShell.filesShell.enableWordWrap"),h=e.wordWrapMode()==="on"?e.t("instanceShell.filesShell.disableWordWrap"):e.t("instanceShell.filesShell.enableWordWrap"),d=b();return i!==n.e&&W(l,n.e=i),a!==n.t&&v(l,"title",n.t=a),h!==n.a&&v(l,"aria-label",n.a=h),d!==n.o&&(l.disabled=n.o=d),n},{e:void 0,t:void 0,a:void 0,o:void 0}),l})(),(()=>{var l=B();return l.$$click=z,o(l,s(w,{get when(){return e.browserSelectedSaving()},get fallback(){return s(ie,{class:"h-4 w-4"})},get children(){return s(R,{class:"h-4 w-4 animate-spin"})}})),g(n=>{var i=e.t("instanceShell.rightPanel.actions.save")||"Save (Ctrl+S)",a=e.t("instanceShell.rightPanel.actions.save")||"Save",h=e.browserSelectedSaving()||!e.browserSelectedDirty();return i!==n.e&&v(l,"title",n.e=i),a!==n.t&&v(l,"aria-label",n.t=a),h!==n.a&&(l.disabled=n.a=h),n},{e:void 0,t:void 0,a:void 0}),l})(),(()=>{var l=B();return l.$$click=()=>e.onRefresh(),o(l,s(R,{get class(){return`h-4 w-4${e.browserLoading()?" animate-spin":""}`}})),g(n=>{var i=e.t("instanceShell.rightPanel.actions.refresh"),a=e.t("instanceShell.rightPanel.actions.refresh"),h=e.browserLoading();return i!==n.e&&v(l,"title",n.e=i),a!==n.t&&v(l,"aria-label",n.t=a),h!==n.a&&(l.disabled=n.a=h),n},{e:void 0,t:void 0,a:void 0}),l})()]},list:{panel:()=>s(O,{}),overlay:()=>s(O,{})},get viewer(){return c()},get listOpen(){return e.listOpen()},get onToggleList(){return e.onToggleList},get splitWidth(){return e.splitWidth()},get onResizeMouseDown(){return e.onResizeMouseDown},get onResizeTouchStart(){return e.onResizeTouchStart},get isPhoneLayout(){return e.isPhoneLayout()},get overlayAriaLabel(){return e.t("instanceShell.rightPanel.tabs.files")}})})};te(["input","click","pointerdown","keydown","mousedown"]);export{Be as default};
@@ -1,2 +1,2 @@
1
- const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/monaco-viewer-BSlOM5Le.js","assets/git-diff-vendor-CYS3ApzA.js","assets/fast-diff-vendor-DgdwVvTQ.js","assets/highlight-vendor-8FKMu9os.js","assets/git-diff-vendor-HAZkIolJ.css"])))=>i.map(i=>d[i]);
2
- import{t as u,i as n,m as D,d as g,a as q,f as ae,h as ee,_ as re}from"./monaco-viewer-BSlOM5Le.js";import{n as i,m as ce,a as P,c as b,S as k,F as te,z as oe,A as de}from"./git-diff-vendor-CYS3ApzA.js";import{u as he}from"./index-BSA3SyyP.js";import{I as ge,S as ue,H as fe,J as ve,R as me,K as ne,N as ie,O as be}from"./main-DxKSa1-Y.js";import{A as $e}from"./align-justify-DYMhLgIY.js";import{W as Ce}from"./wrap-text-CusvDWcP.js";import{S as we}from"./SplitFilePanel-Cd76S2b9.js";import"./fast-diff-vendor-DgdwVvTQ.js";import"./highlight-vendor-8FKMu9os.js";const _e=[["path",{d:"M12 22v-6",key:"6o8u61"}],["path",{d:"M12 8V2",key:"1wkif3"}],["path",{d:"M4 12H2",key:"rhcxmi"}],["path",{d:"M10 12H8",key:"s88cx1"}],["path",{d:"M16 12h-2",key:"10asgb"}],["path",{d:"M22 12h-2",key:"14jgyd"}],["path",{d:"m15 19-3 3-3-3",key:"11eu04"}],["path",{d:"m15 5-3-3-3 3",key:"itvq4r"}]],Se=e=>i(ge,ce(e,{name:"UnfoldVertical",iconNode:_e}));var ye=u("<div class=file-viewer-toolbar><button type=button class=file-viewer-toolbar-icon-button></button><button type=button class=file-viewer-toolbar-icon-button></button><button type=button>");const xe=e=>{const{t:S}=he(),L=()=>e.viewMode==="split"?"unified":"split",V=()=>e.contextMode==="collapsed"?"expanded":"collapsed",F=()=>e.wordWrapMode==="on"?"off":"on",w=()=>L()==="split"?S("instanceShell.diff.switchToSplit"):S("instanceShell.diff.switchToUnified"),K=()=>V()==="collapsed"?S("instanceShell.diff.hideUnchanged"):S("instanceShell.diff.showFull"),O=()=>F()==="on"?S("instanceShell.diff.enableWordWrap"):S("instanceShell.diff.disableWordWrap");return(()=>{var U=ye(),T=U.firstChild,E=T.nextSibling,I=E.nextSibling;return T.$$click=()=>e.onViewModeChange(L()),n(T,(()=>{var c=D(()=>L()==="split");return()=>c()?i(ue,{class:"h-4 w-4","aria-hidden":"true"}):i($e,{class:"h-4 w-4","aria-hidden":"true"})})()),E.$$click=()=>e.onContextModeChange(V()),n(E,(()=>{var c=D(()=>V()==="collapsed");return()=>c()?i(fe,{class:"h-4 w-4","aria-hidden":"true"}):i(Se,{class:"h-4 w-4","aria-hidden":"true"})})()),I.$$click=()=>e.onWordWrapModeChange(F()),n(I,i(Ce,{class:"h-4 w-4","aria-hidden":"true"})),P(c=>{var N=w(),o=w(),d=K(),y=K(),x=`file-viewer-toolbar-icon-button${e.wordWrapMode==="on"?" active":""}`,W=O(),G=O();return N!==c.e&&g(T,"aria-label",c.e=N),o!==c.t&&g(T,"title",c.t=o),d!==c.a&&g(E,"aria-label",c.a=d),y!==c.o&&g(E,"title",c.o=y),x!==c.i&&q(I,c.i=x),W!==c.n&&g(I,"aria-label",c.n=W),G!==c.s&&g(I,"title",c.s=G),c},{e:void 0,t:void 0,a:void 0,o:void 0,i:void 0,n:void 0,s:void 0}),U})()};ae(["click"]);var H=u("<div class=file-viewer-empty><span class=file-viewer-empty-text>"),Me=u('<div class="file-viewer-panel flex-1"><div class="file-viewer-content file-viewer-content--monaco">'),ke=u('<div class="p-3 text-xs text-secondary">'),Ie=u('<span class="git-change-row-action-bar git-change-row-action-bar-vertical">'),We=u('<div><div class=file-list-item-content><div class=file-list-item-path><span class=file-path-text></span></div><div class=git-change-list-item-right><div class=file-list-item-stats><span class=file-list-item-additions>+</span><span class=file-list-item-deletions>-</span></div></div></div><div class=git-change-list-item-actions-zone><div class=git-change-list-item-actions><button type=button class=git-change-row-action><span aria-hidden=true><span class="git-change-row-action-bar git-change-row-action-bar-horizontal">'),Le=u("<div class=git-change-section-items>"),Ve=u("<div class=git-change-section><button type=button class=git-change-section-header><span class=git-change-section-header-main><span class=git-change-section-chevron></span><span class=git-change-section-title></span></span><span class=git-change-section-count>"),Te=u('<div class=git-change-section-items><div class=git-change-commit-box><div class=git-change-commit-input-wrap><textarea class=git-change-commit-input rows=1></textarea><button type=button class="git-change-commit-button git-change-commit-button-overlay">'),Ee=u("<div class=git-change-sections><div class=git-change-section><button type=button class=git-change-section-header><span class=git-change-section-header-main><span class=git-change-section-chevron></span><span class=git-change-section-title-row><span class=git-change-section-title></span></span></span><span class=git-change-section-count>"),Ae=u('<span class="status-indicator session-status-list worktree-indicator git-change-section-badge"><span class=worktree-indicator-label>'),Pe=u("<span class=files-tab-selected-path><span class=file-path-text>"),Re=u('<div class=files-tab-stats style="flex:0 0 auto"><span class="files-tab-stat files-tab-stat-additions"><span class=files-tab-stat-value>+</span></span><span class="files-tab-stat files-tab-stat-deletions"><span class=files-tab-stat-value>-'),ze=u("<button type=button class=files-header-icon-button style=margin-left:auto>"),De=u("<span class=text-error>");const Oe=de(()=>re(()=>import("./monaco-viewer-BSlOM5Le.js").then(e=>e.au),__vite__mapDeps([0,1,2,3,4])).then(e=>({default:e.MonacoDiffViewer}))),je=e=>{const S=b(()=>e.activeSessionId()),L=b(()=>!!(S()&&S()!=="info")),V=b(()=>L()?e.entries():null),F=b(()=>{const o=V();return Array.isArray(o)?[...o].sort((d,y)=>String(d.path||"").localeCompare(String(y.path||""))):[]}),w=b(()=>ve(F())),K=b(()=>w().reduce((o,d)=>(o.additions+=typeof d.additions=="number"?d.additions:0,o.deletions+=typeof d.deletions=="number"?d.deletions:0,o),{additions:0,deletions:0})),O=b(()=>w().filter(o=>o.section==="staged")),U=b(()=>w().filter(o=>o.section==="unstaged")),T=b(()=>O().length>0&&e.commitMessage().trim().length>0&&!e.commitSubmitting()),E=b(()=>{const o=w(),d=e.selectedItemId(),y=e.mostChangedItemId(),x=o.find(W=>W.id===d)||(y?o.find(W=>W.id===y):void 0);return(x==null?void 0:x.entry)??null}),I=b(()=>L()?V()===null?e.t("instanceShell.gitChanges.loading"):w().length===0?e.t("instanceShell.gitChanges.empty"):e.t("instanceShell.filesShell.viewerEmpty"):e.t("instanceShell.gitChanges.noSessionSelected")),c=b(()=>e.selectedError()===e.t("instanceShell.gitChanges.binaryViewer"));return D(()=>{const o=K(),d=E(),y=w(),x=O(),W=U(),G=()=>(()=>{var t=Me(),r=t.firstChild;return n(r,i(k,{get when(){return e.selectedLoading()},get fallback(){return i(k,{get when(){return e.selectedError()},get fallback(){return i(k,{get when(){return D(()=>!!(d&&e.selectedBefore()!==null&&e.selectedAfter()!==null))()?{path:d.path,before:e.selectedBefore(),after:e.selectedAfter()}:null},get fallback(){return(()=>{var a=H(),s=a.firstChild;return n(s,I),a})()},children:a=>i(oe,{get fallback(){return(()=>{var s=H(),l=s.firstChild;return n(l,()=>e.t("instanceInfo.loading")),s})()},get children(){return i(Oe,{get scopeKey(){return e.scopeKey()},get path(){return String(a().path||"")},get before(){return String(a().before||"")},get after(){return String(a().after||"")},get viewMode(){return e.diffViewMode()},get contextMode(){return e.diffContextMode()},get wordWrap(){return e.diffWordWrapMode()},get insertContextLabel(){return e.t("instanceShell.gitChanges.actions.insertContext")},get onRequestInsertContext(){return c()?void 0:s=>{const l=e.selectedItemId();if(!l)return;const f=w().find(v=>v.id===l);f&&e.onInsertContext(f,s)}}})}})})},children:a=>(()=>{var s=H(),l=s.firstChild;return n(l,a),s})()})},get children(){var a=H(),s=a.firstChild;return n(s,()=>e.t("instanceInfo.loading")),a}})),t})(),le=()=>(()=>{var t=ke();return n(t,I),t})(),J=t=>{const r=b(()=>e.selectedBulkItemIds().has(t.id)),a=t.section==="staged"?e.t("instanceShell.gitChanges.actions.unstage"):e.t("instanceShell.gitChanges.actions.stage"),s=()=>{t.section==="staged"?e.onUnstageFile(t):e.onStageFile(t)};return(()=>{var l=We(),f=l.firstChild,v=f.firstChild,R=v.firstChild,$=v.nextSibling,_=$.firstChild,C=_.firstChild;C.firstChild;var M=C.nextSibling;M.firstChild;var B=f.nextSibling,m=B.firstChild,A=m.firstChild,z=A.firstChild;return z.firstChild,l.$$click=h=>e.onRowClick(t,h),l.$$mousedown=h=>{(h.shiftKey||h.ctrlKey||h.metaKey)&&h.preventDefault()},n(R,()=>t.path),n(C,()=>t.additions,null),n(M,()=>t.deletions,null),A.$$click=h=>{h.stopPropagation(),s()},g(A,"title",a),g(A,"aria-label",a),n(z,i(k,{get when(){return t.section!=="staged"},get children(){return Ie()}}),null),P(h=>{var Q=`file-list-item git-change-list-item ${e.selectedItemId()===t.id?"file-list-item-active":""} ${r()?"git-change-list-item-bulk-selected":""}`,X=t.path,Y=t.path,Z=t.path,p=`git-change-row-action-glyph ${t.section==="staged"?"git-change-row-action-glyph-minus":"git-change-row-action-glyph-plus"}`;return Q!==h.e&&q(l,h.e=Q),X!==h.t&&g(l,"title",h.t=X),Y!==h.a&&g(f,"title",h.a=Y),Z!==h.o&&g(v,"title",h.o=Z),p!==h.i&&q(z,h.i=p),h},{e:void 0,t:void 0,a:void 0,o:void 0,i:void 0}),l})()},se=(t,r,a,s)=>(()=>{var l=Ve(),f=l.firstChild,v=f.firstChild,R=v.firstChild,$=R.nextSibling,_=v.nextSibling;return ee(f,"click",s,!0),n(R,a?i(ne,{class:"h-3.5 w-3.5"}):i(ie,{class:"h-3.5 w-3.5"})),n($,t),n(_,()=>r.length),n(l,i(k,{when:a,get children(){var C=Le();return n(C,i(te,{each:r,children:M=>J(M)})),C}}),null),l})(),j=()=>i(k,{get when(){return y.length>0},get fallback(){return le()},get children(){var t=Ee(),r=t.firstChild,a=r.firstChild,s=a.firstChild,l=s.firstChild,f=l.nextSibling,v=f.firstChild,R=s.nextSibling;return ee(a,"click",e.onToggleStagedOpen,!0),n(l,(()=>{var $=D(()=>!!e.stagedOpen());return()=>$()?i(ne,{class:"h-3.5 w-3.5"}):i(ie,{class:"h-3.5 w-3.5"})})()),n(v,()=>e.t("instanceShell.gitChanges.sections.staged")),n(f,i(k,{get when(){return e.branchLabel()},children:$=>(()=>{var _=Ae(),C=_.firstChild;return n(_,i(be,{class:"w-3.5 h-3.5","aria-hidden":"true"}),C),n(C,$),P(()=>g(_,"title",`Branch: ${$()}`)),_})()}),null),n(R,()=>x.length),n(r,i(k,{get when(){return e.stagedOpen()},get children(){var $=Te(),_=$.firstChild,C=_.firstChild,M=C.firstChild,B=M.nextSibling;return M.$$input=m=>e.onCommitMessageInput(m.currentTarget.value),B.$$click=()=>e.onSubmitCommit(),n(B,(()=>{var m=D(()=>!!e.commitSubmitting());return()=>m()?e.t("instanceShell.gitChanges.commit.submitting"):e.t("instanceShell.gitChanges.commit.submit")})()),n($,i(te,{each:x,children:m=>J(m)}),null),P(m=>{var A=e.t("instanceShell.gitChanges.commit.placeholder"),z=!T();return A!==m.e&&g(M,"placeholder",m.e=A),z!==m.t&&(B.disabled=m.t=z),m},{e:void 0,t:void 0}),P(()=>M.value=e.commitMessage()),$}}),null),n(t,()=>se(e.t("instanceShell.gitChanges.sections.unstaged"),W,e.unstagedOpen(),e.onToggleUnstagedOpen),null),t}});return i(we,{get header(){return[(()=>{var t=Pe(),r=t.firstChild;return n(r,()=>(d==null?void 0:d.path)||e.t("instanceShell.rightPanel.tabs.gitChanges")),P(()=>g(t,"title",(d==null?void 0:d.path)||e.t("instanceShell.rightPanel.tabs.gitChanges"))),t})(),(()=>{var t=Re(),r=t.firstChild,a=r.firstChild;a.firstChild;var s=r.nextSibling,l=s.firstChild;return l.firstChild,n(a,()=>o.additions,null),n(l,()=>o.deletions,null),n(t,i(k,{get when(){return e.statusError()},children:f=>(()=>{var v=De();return n(v,f),v})()}),null),t})(),(()=>{var t=ze();return t.$$click=()=>e.onRefresh(),n(t,i(me,{get class(){return`h-4 w-4${e.statusLoading()?" animate-spin":""}`}})),P(r=>{var a=e.t("instanceShell.rightPanel.actions.refresh"),s=e.t("instanceShell.rightPanel.actions.refresh"),l=!L()||e.statusLoading()||V()===null;return a!==r.e&&g(t,"title",r.e=a),s!==r.t&&g(t,"aria-label",r.t=s),l!==r.a&&(t.disabled=r.a=l),r},{e:void 0,t:void 0,a:void 0}),t})(),i(xe,{get viewMode(){return e.diffViewMode()},get contextMode(){return e.diffContextMode()},get wordWrapMode(){return e.diffWordWrapMode()},get onViewModeChange(){return e.onViewModeChange},get onContextModeChange(){return e.onContextModeChange},get onWordWrapModeChange(){return e.onWordWrapModeChange}})]},list:{panel:j,overlay:j},get viewer(){return G()},get listOpen(){return e.listOpen()},get onToggleList(){return e.onToggleList},get splitWidth(){return e.splitWidth()},get onResizeMouseDown(){return e.onResizeMouseDown},get onResizeTouchStart(){return e.onResizeTouchStart},get isPhoneLayout(){return e.isPhoneLayout()},get overlayAriaLabel(){return e.t("instanceShell.rightPanel.tabs.gitChanges")}})})};ae(["mousedown","click","input"]);export{je as default};
1
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/monaco-viewer-NKl8kwH2.js","assets/git-diff-vendor-CYS3ApzA.js","assets/fast-diff-vendor-DgdwVvTQ.js","assets/highlight-vendor-8FKMu9os.js","assets/git-diff-vendor-HAZkIolJ.css"])))=>i.map(i=>d[i]);
2
+ import{t as u,i as n,m as D,d as g,a as q,f as ae,h as ee,_ as re}from"./monaco-viewer-NKl8kwH2.js";import{n as i,m as ce,a as P,c as b,S as k,F as te,z as oe,A as de}from"./git-diff-vendor-CYS3ApzA.js";import{u as he}from"./index-RnXDcFsv.js";import{I as ge,S as ue,H as fe,J as ve,R as me,K as ne,N as ie,O as be}from"./main-BnwG4srg.js";import{A as $e}from"./align-justify-BiSxVeYp.js";import{W as Ce}from"./wrap-text-CUOAN4GW.js";import{S as we}from"./SplitFilePanel-CaD8pox4.js";import"./fast-diff-vendor-DgdwVvTQ.js";import"./highlight-vendor-8FKMu9os.js";const _e=[["path",{d:"M12 22v-6",key:"6o8u61"}],["path",{d:"M12 8V2",key:"1wkif3"}],["path",{d:"M4 12H2",key:"rhcxmi"}],["path",{d:"M10 12H8",key:"s88cx1"}],["path",{d:"M16 12h-2",key:"10asgb"}],["path",{d:"M22 12h-2",key:"14jgyd"}],["path",{d:"m15 19-3 3-3-3",key:"11eu04"}],["path",{d:"m15 5-3-3-3 3",key:"itvq4r"}]],Se=e=>i(ge,ce(e,{name:"UnfoldVertical",iconNode:_e}));var ye=u("<div class=file-viewer-toolbar><button type=button class=file-viewer-toolbar-icon-button></button><button type=button class=file-viewer-toolbar-icon-button></button><button type=button>");const xe=e=>{const{t:S}=he(),L=()=>e.viewMode==="split"?"unified":"split",V=()=>e.contextMode==="collapsed"?"expanded":"collapsed",F=()=>e.wordWrapMode==="on"?"off":"on",w=()=>L()==="split"?S("instanceShell.diff.switchToSplit"):S("instanceShell.diff.switchToUnified"),K=()=>V()==="collapsed"?S("instanceShell.diff.hideUnchanged"):S("instanceShell.diff.showFull"),O=()=>F()==="on"?S("instanceShell.diff.enableWordWrap"):S("instanceShell.diff.disableWordWrap");return(()=>{var U=ye(),T=U.firstChild,E=T.nextSibling,I=E.nextSibling;return T.$$click=()=>e.onViewModeChange(L()),n(T,(()=>{var c=D(()=>L()==="split");return()=>c()?i(ue,{class:"h-4 w-4","aria-hidden":"true"}):i($e,{class:"h-4 w-4","aria-hidden":"true"})})()),E.$$click=()=>e.onContextModeChange(V()),n(E,(()=>{var c=D(()=>V()==="collapsed");return()=>c()?i(fe,{class:"h-4 w-4","aria-hidden":"true"}):i(Se,{class:"h-4 w-4","aria-hidden":"true"})})()),I.$$click=()=>e.onWordWrapModeChange(F()),n(I,i(Ce,{class:"h-4 w-4","aria-hidden":"true"})),P(c=>{var N=w(),o=w(),d=K(),y=K(),x=`file-viewer-toolbar-icon-button${e.wordWrapMode==="on"?" active":""}`,W=O(),G=O();return N!==c.e&&g(T,"aria-label",c.e=N),o!==c.t&&g(T,"title",c.t=o),d!==c.a&&g(E,"aria-label",c.a=d),y!==c.o&&g(E,"title",c.o=y),x!==c.i&&q(I,c.i=x),W!==c.n&&g(I,"aria-label",c.n=W),G!==c.s&&g(I,"title",c.s=G),c},{e:void 0,t:void 0,a:void 0,o:void 0,i:void 0,n:void 0,s:void 0}),U})()};ae(["click"]);var H=u("<div class=file-viewer-empty><span class=file-viewer-empty-text>"),Me=u('<div class="file-viewer-panel flex-1"><div class="file-viewer-content file-viewer-content--monaco">'),ke=u('<div class="p-3 text-xs text-secondary">'),Ie=u('<span class="git-change-row-action-bar git-change-row-action-bar-vertical">'),We=u('<div><div class=file-list-item-content><div class=file-list-item-path><span class=file-path-text></span></div><div class=git-change-list-item-right><div class=file-list-item-stats><span class=file-list-item-additions>+</span><span class=file-list-item-deletions>-</span></div></div></div><div class=git-change-list-item-actions-zone><div class=git-change-list-item-actions><button type=button class=git-change-row-action><span aria-hidden=true><span class="git-change-row-action-bar git-change-row-action-bar-horizontal">'),Le=u("<div class=git-change-section-items>"),Ve=u("<div class=git-change-section><button type=button class=git-change-section-header><span class=git-change-section-header-main><span class=git-change-section-chevron></span><span class=git-change-section-title></span></span><span class=git-change-section-count>"),Te=u('<div class=git-change-section-items><div class=git-change-commit-box><div class=git-change-commit-input-wrap><textarea class=git-change-commit-input rows=1></textarea><button type=button class="git-change-commit-button git-change-commit-button-overlay">'),Ee=u("<div class=git-change-sections><div class=git-change-section><button type=button class=git-change-section-header><span class=git-change-section-header-main><span class=git-change-section-chevron></span><span class=git-change-section-title-row><span class=git-change-section-title></span></span></span><span class=git-change-section-count>"),Ae=u('<span class="status-indicator session-status-list worktree-indicator git-change-section-badge"><span class=worktree-indicator-label>'),Pe=u("<span class=files-tab-selected-path><span class=file-path-text>"),Re=u('<div class=files-tab-stats style="flex:0 0 auto"><span class="files-tab-stat files-tab-stat-additions"><span class=files-tab-stat-value>+</span></span><span class="files-tab-stat files-tab-stat-deletions"><span class=files-tab-stat-value>-'),ze=u("<button type=button class=files-header-icon-button style=margin-left:auto>"),De=u("<span class=text-error>");const Oe=de(()=>re(()=>import("./monaco-viewer-NKl8kwH2.js").then(e=>e.ay),__vite__mapDeps([0,1,2,3,4])).then(e=>({default:e.MonacoDiffViewer}))),je=e=>{const S=b(()=>e.activeSessionId()),L=b(()=>!!(S()&&S()!=="info")),V=b(()=>L()?e.entries():null),F=b(()=>{const o=V();return Array.isArray(o)?[...o].sort((d,y)=>String(d.path||"").localeCompare(String(y.path||""))):[]}),w=b(()=>ve(F())),K=b(()=>w().reduce((o,d)=>(o.additions+=typeof d.additions=="number"?d.additions:0,o.deletions+=typeof d.deletions=="number"?d.deletions:0,o),{additions:0,deletions:0})),O=b(()=>w().filter(o=>o.section==="staged")),U=b(()=>w().filter(o=>o.section==="unstaged")),T=b(()=>O().length>0&&e.commitMessage().trim().length>0&&!e.commitSubmitting()),E=b(()=>{const o=w(),d=e.selectedItemId(),y=e.mostChangedItemId(),x=o.find(W=>W.id===d)||(y?o.find(W=>W.id===y):void 0);return(x==null?void 0:x.entry)??null}),I=b(()=>L()?V()===null?e.t("instanceShell.gitChanges.loading"):w().length===0?e.t("instanceShell.gitChanges.empty"):e.t("instanceShell.filesShell.viewerEmpty"):e.t("instanceShell.gitChanges.noSessionSelected")),c=b(()=>e.selectedError()===e.t("instanceShell.gitChanges.binaryViewer"));return D(()=>{const o=K(),d=E(),y=w(),x=O(),W=U(),G=()=>(()=>{var t=Me(),r=t.firstChild;return n(r,i(k,{get when(){return e.selectedLoading()},get fallback(){return i(k,{get when(){return e.selectedError()},get fallback(){return i(k,{get when(){return D(()=>!!(d&&e.selectedBefore()!==null&&e.selectedAfter()!==null))()?{path:d.path,before:e.selectedBefore(),after:e.selectedAfter()}:null},get fallback(){return(()=>{var a=H(),s=a.firstChild;return n(s,I),a})()},children:a=>i(oe,{get fallback(){return(()=>{var s=H(),l=s.firstChild;return n(l,()=>e.t("instanceInfo.loading")),s})()},get children(){return i(Oe,{get scopeKey(){return e.scopeKey()},get path(){return String(a().path||"")},get before(){return String(a().before||"")},get after(){return String(a().after||"")},get viewMode(){return e.diffViewMode()},get contextMode(){return e.diffContextMode()},get wordWrap(){return e.diffWordWrapMode()},get insertContextLabel(){return e.t("instanceShell.gitChanges.actions.insertContext")},get onRequestInsertContext(){return c()?void 0:s=>{const l=e.selectedItemId();if(!l)return;const f=w().find(v=>v.id===l);f&&e.onInsertContext(f,s)}}})}})})},children:a=>(()=>{var s=H(),l=s.firstChild;return n(l,a),s})()})},get children(){var a=H(),s=a.firstChild;return n(s,()=>e.t("instanceInfo.loading")),a}})),t})(),le=()=>(()=>{var t=ke();return n(t,I),t})(),J=t=>{const r=b(()=>e.selectedBulkItemIds().has(t.id)),a=t.section==="staged"?e.t("instanceShell.gitChanges.actions.unstage"):e.t("instanceShell.gitChanges.actions.stage"),s=()=>{t.section==="staged"?e.onUnstageFile(t):e.onStageFile(t)};return(()=>{var l=We(),f=l.firstChild,v=f.firstChild,R=v.firstChild,$=v.nextSibling,_=$.firstChild,C=_.firstChild;C.firstChild;var M=C.nextSibling;M.firstChild;var B=f.nextSibling,m=B.firstChild,A=m.firstChild,z=A.firstChild;return z.firstChild,l.$$click=h=>e.onRowClick(t,h),l.$$mousedown=h=>{(h.shiftKey||h.ctrlKey||h.metaKey)&&h.preventDefault()},n(R,()=>t.path),n(C,()=>t.additions,null),n(M,()=>t.deletions,null),A.$$click=h=>{h.stopPropagation(),s()},g(A,"title",a),g(A,"aria-label",a),n(z,i(k,{get when(){return t.section!=="staged"},get children(){return Ie()}}),null),P(h=>{var Q=`file-list-item git-change-list-item ${e.selectedItemId()===t.id?"file-list-item-active":""} ${r()?"git-change-list-item-bulk-selected":""}`,X=t.path,Y=t.path,Z=t.path,p=`git-change-row-action-glyph ${t.section==="staged"?"git-change-row-action-glyph-minus":"git-change-row-action-glyph-plus"}`;return Q!==h.e&&q(l,h.e=Q),X!==h.t&&g(l,"title",h.t=X),Y!==h.a&&g(f,"title",h.a=Y),Z!==h.o&&g(v,"title",h.o=Z),p!==h.i&&q(z,h.i=p),h},{e:void 0,t:void 0,a:void 0,o:void 0,i:void 0}),l})()},se=(t,r,a,s)=>(()=>{var l=Ve(),f=l.firstChild,v=f.firstChild,R=v.firstChild,$=R.nextSibling,_=v.nextSibling;return ee(f,"click",s,!0),n(R,a?i(ne,{class:"h-3.5 w-3.5"}):i(ie,{class:"h-3.5 w-3.5"})),n($,t),n(_,()=>r.length),n(l,i(k,{when:a,get children(){var C=Le();return n(C,i(te,{each:r,children:M=>J(M)})),C}}),null),l})(),j=()=>i(k,{get when(){return y.length>0},get fallback(){return le()},get children(){var t=Ee(),r=t.firstChild,a=r.firstChild,s=a.firstChild,l=s.firstChild,f=l.nextSibling,v=f.firstChild,R=s.nextSibling;return ee(a,"click",e.onToggleStagedOpen,!0),n(l,(()=>{var $=D(()=>!!e.stagedOpen());return()=>$()?i(ne,{class:"h-3.5 w-3.5"}):i(ie,{class:"h-3.5 w-3.5"})})()),n(v,()=>e.t("instanceShell.gitChanges.sections.staged")),n(f,i(k,{get when(){return e.branchLabel()},children:$=>(()=>{var _=Ae(),C=_.firstChild;return n(_,i(be,{class:"w-3.5 h-3.5","aria-hidden":"true"}),C),n(C,$),P(()=>g(_,"title",`Branch: ${$()}`)),_})()}),null),n(R,()=>x.length),n(r,i(k,{get when(){return e.stagedOpen()},get children(){var $=Te(),_=$.firstChild,C=_.firstChild,M=C.firstChild,B=M.nextSibling;return M.$$input=m=>e.onCommitMessageInput(m.currentTarget.value),B.$$click=()=>e.onSubmitCommit(),n(B,(()=>{var m=D(()=>!!e.commitSubmitting());return()=>m()?e.t("instanceShell.gitChanges.commit.submitting"):e.t("instanceShell.gitChanges.commit.submit")})()),n($,i(te,{each:x,children:m=>J(m)}),null),P(m=>{var A=e.t("instanceShell.gitChanges.commit.placeholder"),z=!T();return A!==m.e&&g(M,"placeholder",m.e=A),z!==m.t&&(B.disabled=m.t=z),m},{e:void 0,t:void 0}),P(()=>M.value=e.commitMessage()),$}}),null),n(t,()=>se(e.t("instanceShell.gitChanges.sections.unstaged"),W,e.unstagedOpen(),e.onToggleUnstagedOpen),null),t}});return i(we,{get header(){return[(()=>{var t=Pe(),r=t.firstChild;return n(r,()=>(d==null?void 0:d.path)||e.t("instanceShell.rightPanel.tabs.gitChanges")),P(()=>g(t,"title",(d==null?void 0:d.path)||e.t("instanceShell.rightPanel.tabs.gitChanges"))),t})(),(()=>{var t=Re(),r=t.firstChild,a=r.firstChild;a.firstChild;var s=r.nextSibling,l=s.firstChild;return l.firstChild,n(a,()=>o.additions,null),n(l,()=>o.deletions,null),n(t,i(k,{get when(){return e.statusError()},children:f=>(()=>{var v=De();return n(v,f),v})()}),null),t})(),(()=>{var t=ze();return t.$$click=()=>e.onRefresh(),n(t,i(me,{get class(){return`h-4 w-4${e.statusLoading()?" animate-spin":""}`}})),P(r=>{var a=e.t("instanceShell.rightPanel.actions.refresh"),s=e.t("instanceShell.rightPanel.actions.refresh"),l=!L()||e.statusLoading()||V()===null;return a!==r.e&&g(t,"title",r.e=a),s!==r.t&&g(t,"aria-label",r.t=s),l!==r.a&&(t.disabled=r.a=l),r},{e:void 0,t:void 0,a:void 0}),t})(),i(xe,{get viewMode(){return e.diffViewMode()},get contextMode(){return e.diffContextMode()},get wordWrapMode(){return e.diffWordWrapMode()},get onViewModeChange(){return e.onViewModeChange},get onContextModeChange(){return e.onContextModeChange},get onWordWrapModeChange(){return e.onWordWrapModeChange}})]},list:{panel:j,overlay:j},get viewer(){return G()},get listOpen(){return e.listOpen()},get onToggleList(){return e.onToggleList},get splitWidth(){return e.splitWidth()},get onResizeMouseDown(){return e.onResizeMouseDown},get onResizeTouchStart(){return e.onResizeTouchStart},get isPhoneLayout(){return e.isPhoneLayout()},get overlayAriaLabel(){return e.t("instanceShell.rightPanel.tabs.gitChanges")}})})};ae(["mousedown","click","input"]);export{je as default};
@@ -1 +1 @@
1
- import{t as d,i as l,d as m,h as s,m as b,g as _,f as w}from"./monaco-viewer-BSlOM5Le.js";import{a as g,n as r,S as n}from"./git-diff-vendor-CYS3ApzA.js";import{u as S}from"./index-BSA3SyyP.js";var y=d("<div class=file-list-overlay role=dialog><div class=file-list-scroll>");const L=e=>(()=>{var t=y(),a=t.firstChild;return l(a,()=>e.children),g(()=>m(t,"aria-label",e.ariaLabel)),t})();var C=d('<div class=files-split><div class=file-list-panel><div class=file-list-scroll></div></div><div class=file-split-handle role=separator aria-orientation=vertical aria-label="Resize file list">'),x=d("<div class=files-tab-container><div class=files-tab-header><div class=files-tab-header-row><button type=button class=files-toggle-button></button></div></div><div class=files-tab-body>");const z=e=>{const{t}=S();return(()=>{var a=x(),c=a.firstChild,o=c.firstChild,u=o.firstChild,h=c.nextSibling;return s(u,"click",e.onToggleList,!0),l(u,(()=>{var i=b(()=>!!e.listOpen);return()=>i()?t("instanceShell.filesShell.hideFiles"):t("instanceShell.filesShell.showFiles")})()),l(o,()=>e.header,null),l(h,r(n,{get when(){return b(()=>!e.isPhoneLayout)()&&e.listOpen},get fallback(){return e.viewer},get children(){var i=C(),v=i.firstChild,$=v.firstChild,f=v.nextSibling;return l($,()=>e.list.panel()),s(f,"touchstart",e.onResizeTouchStart,!0),s(f,"mousedown",e.onResizeMouseDown,!0),l(i,()=>e.viewer,null),g(O=>_(i,"--files-pane-width",`${e.splitWidth}px`)),i}}),null),l(h,r(n,{get when(){return e.isPhoneLayout},get children(){return r(n,{get when(){return e.listOpen},get children(){return r(L,{get ariaLabel(){return e.overlayAriaLabel},get children(){return e.list.overlay()}})}})}}),null),a})()};w(["click","mousedown","touchstart"]);export{z as S};
1
+ import{t as d,i as l,d as m,h as s,m as b,g as _,f as w}from"./monaco-viewer-NKl8kwH2.js";import{a as g,n as r,S as n}from"./git-diff-vendor-CYS3ApzA.js";import{u as S}from"./index-RnXDcFsv.js";var y=d("<div class=file-list-overlay role=dialog><div class=file-list-scroll>");const L=e=>(()=>{var t=y(),a=t.firstChild;return l(a,()=>e.children),g(()=>m(t,"aria-label",e.ariaLabel)),t})();var C=d('<div class=files-split><div class=file-list-panel><div class=file-list-scroll></div></div><div class=file-split-handle role=separator aria-orientation=vertical aria-label="Resize file list">'),x=d("<div class=files-tab-container><div class=files-tab-header><div class=files-tab-header-row><button type=button class=files-toggle-button></button></div></div><div class=files-tab-body>");const z=e=>{const{t}=S();return(()=>{var a=x(),c=a.firstChild,o=c.firstChild,u=o.firstChild,h=c.nextSibling;return s(u,"click",e.onToggleList,!0),l(u,(()=>{var i=b(()=>!!e.listOpen);return()=>i()?t("instanceShell.filesShell.hideFiles"):t("instanceShell.filesShell.showFiles")})()),l(o,()=>e.header,null),l(h,r(n,{get when(){return b(()=>!e.isPhoneLayout)()&&e.listOpen},get fallback(){return e.viewer},get children(){var i=C(),v=i.firstChild,$=v.firstChild,f=v.nextSibling;return l($,()=>e.list.panel()),s(f,"touchstart",e.onResizeTouchStart,!0),s(f,"mousedown",e.onResizeMouseDown,!0),l(i,()=>e.viewer,null),g(O=>_(i,"--files-pane-width",`${e.splitWidth}px`)),i}}),null),l(h,r(n,{get when(){return e.isPhoneLayout},get children(){return r(n,{get when(){return e.listOpen},get children(){return r(L,{get ariaLabel(){return e.overlayAriaLabel},get children(){return e.list.overlay()}})}})}}),null),a})()};w(["click","mousedown","touchstart"]);export{z as S};
@@ -0,0 +1 @@
1
+ import{m as ce,P as Ye,O as Qe,t as $,i as g,a as De,g as Ie,d as B,j as Ze,u as Je,f as et}from"./monaco-viewer-NKl8kwH2.js";import{n as i,m as M,q as de,s as j,d as F,b as V,o as H,c as k,k as ue,S as K,l as ge,t as tt,w as _e,a as pe,F as ye}from"./git-diff-vendor-CYS3ApzA.js";import{I as Ce,Q as Oe,T as W,U as Me,W as Ee,X as xe,Y as nt,Z as me,_ as le,$ as fe,a0 as Ue,a1 as te,a2 as ne,a3 as ot,a4 as we,a5 as st,a6 as rt,a7 as z,a8 as Se,a9 as it,aa as at,ab as lt,ac as ct,ad as q,ae as dt,af as ut,ag as gt,ah as pt,ai as ft,aj as Z,ak as ht,al as mt,am as vt,an as bt,ao as yt,ap as xt,aq as ve,ar as Ct,K as wt,as as St,at as kt,au as $t,av as Pt,aw as Tt,ax as It}from"./main-BnwG4srg.js";import{u as Ae}from"./index-RnXDcFsv.js";import{T as _t}from"./terminal-square-QNfjv56N.js";import"./fast-diff-vendor-DgdwVvTQ.js";import"./highlight-vendor-8FKMu9os.js";const Dt=[["path",{d:"M6 8a6 6 0 0 1 12 0c0 7 3 9 3 9H3s3-2 3-9",key:"1qo2s2"}],["path",{d:"M10.3 21a1.94 1.94 0 0 0 3.4 0",key:"qgo35s"}],["path",{d:"M4 2C2.8 3.7 2 5.7 2 8",key:"tap9e0"}],["path",{d:"M22 8c0-2.3-.8-4.3-2-6",key:"5bb3ad"}]],Ot=e=>i(Ce,M(e,{name:"BellRing",iconNode:Dt})),Mt=[["circle",{cx:"9",cy:"12",r:"1",key:"1vctgf"}],["circle",{cx:"9",cy:"5",r:"1",key:"hp0tcf"}],["circle",{cx:"9",cy:"19",r:"1",key:"fkjjf6"}],["circle",{cx:"15",cy:"12",r:"1",key:"1tmaij"}],["circle",{cx:"15",cy:"5",r:"1",key:"19l28e"}],["circle",{cx:"15",cy:"19",r:"1",key:"f4zoj3"}]],Et=e=>i(Ce,M(e,{name:"GripVertical",iconNode:Mt})),Ut=[["polygon",{points:"7.86 2 16.14 2 22 7.86 22 16.14 16.14 22 7.86 22 2 16.14 2 7.86 7.86 2",key:"h1p8hx"}],["path",{d:"m15 9-6 6",key:"1uzhvr"}],["path",{d:"m9 9 6 6",key:"z0biqf"}]],At=e=>i(Ce,M(e,{name:"XOctagon",iconNode:Ut}));var Rt={};Se(Rt,{Arrow:()=>Oe,Content:()=>Fe,Portal:()=>Le,Root:()=>Ke,Tooltip:()=>ee,Trigger:()=>Be,useTooltipContext:()=>he});var Re=ue();function he(){const e=ge(Re);if(e===void 0)throw new Error("[kobalte]: `useTooltipContext` must be used within a `Tooltip` component");return e}function Fe(e){const n=he(),c=W({id:n.generateId("content")},e),[l,t]=j(c,["ref","style"]);return V(()=>H(n.registerContentId(t.id))),i(K,{get when(){return n.contentPresent()},get children(){return i(Ue.Positioner,{get children(){return i(ot,M({ref(o){var s=te(d=>{n.setContentRef(d)},l.ref);typeof s=="function"&&s(o)},role:"tooltip",disableOutsidePointerEvents:!1,get style(){return we({"--kb-tooltip-content-transform-origin":"var(--kb-popper-content-transform-origin)",position:"relative"},l.style)},onFocusOutside:o=>o.preventDefault(),onDismiss:()=>n.hideTooltip(!0)},()=>n.dataset(),t))}})}})}function Le(e){const n=he();return i(K,{get when(){return n.contentPresent()},get children(){return i(Ye,e)}})}function Ft(e,n,c){const l=e.split("-")[0],t=n.getBoundingClientRect(),o=c.getBoundingClientRect(),s=[],d=t.left+t.width/2,x=t.top+t.height/2;switch(l){case"top":s.push([t.left,x]),s.push([o.left,o.bottom]),s.push([o.left,o.top]),s.push([o.right,o.top]),s.push([o.right,o.bottom]),s.push([t.right,x]);break;case"right":s.push([d,t.top]),s.push([o.left,o.top]),s.push([o.right,o.top]),s.push([o.right,o.bottom]),s.push([o.left,o.bottom]),s.push([d,t.bottom]);break;case"bottom":s.push([t.left,x]),s.push([o.left,o.top]),s.push([o.left,o.bottom]),s.push([o.right,o.bottom]),s.push([o.right,o.top]),s.push([t.right,x]);break;case"left":s.push([d,t.top]),s.push([o.right,o.top]),s.push([o.left,o.top]),s.push([o.left,o.bottom]),s.push([o.right,o.bottom]),s.push([d,t.bottom]);break}return s}var X={},Lt=0,G=!1,N,J,Y;function Ke(e){const n=`tooltip-${de()}`,c=`${++Lt}`,l=W({id:n,openDelay:700,closeDelay:300,skipDelayDuration:300},e),[t,o]=j(l,["id","open","defaultOpen","onOpenChange","disabled","triggerOnFocusOnly","openDelay","closeDelay","skipDelayDuration","ignoreSafeArea","forceMount"]);let s;const[d,x]=F(),[m,u]=F(),[a,p]=F(),[r,v]=F(o.placement),f=Me({open:()=>t.open,defaultOpen:()=>t.defaultOpen,onOpenChange:y=>{var U;return(U=t.onOpenChange)==null?void 0:U.call(t,y)}}),{present:C}=Ee({show:()=>t.forceMount||f.isOpen(),element:()=>a()??null}),h=()=>{X[c]=T},S=()=>{for(const y in X)y!==c&&(X[y](!0),delete X[y])},T=(y=!1)=>{y||t.closeDelay&&t.closeDelay<=0?(window.clearTimeout(s),s=void 0,f.close()):s||(s=window.setTimeout(()=>{s=void 0,f.close()},t.closeDelay)),window.clearTimeout(N),N=void 0,t.skipDelayDuration&&t.skipDelayDuration>=0&&(Y=window.setTimeout(()=>{window.clearTimeout(Y),Y=void 0},t.skipDelayDuration)),G&&(window.clearTimeout(J),J=window.setTimeout(()=>{delete X[c],J=void 0,G=!1},t.closeDelay))},E=()=>{clearTimeout(s),s=void 0,S(),h(),G=!0,f.open(),window.clearTimeout(N),N=void 0,window.clearTimeout(J),J=void 0,window.clearTimeout(Y),Y=void 0},O=()=>{S(),h(),!f.isOpen()&&!N&&!G?N=window.setTimeout(()=>{N=void 0,G=!0,E()},t.openDelay):f.isOpen()||E()},A=(y=!1)=>{!y&&t.openDelay&&t.openDelay>0&&!s&&!Y?O():E()},b=()=>{window.clearTimeout(N),N=void 0,G=!1},R=()=>{window.clearTimeout(s),s=void 0},I=y=>me(m(),y)||me(a(),y),_=y=>{const U=m(),L=a();if(!(!U||!L))return Ft(y,U,L)},w=y=>{const U=y.target;if(I(U)){R();return}if(!t.ignoreSafeArea){const L=_(r());if(L&&st(rt(y),L)){R();return}}s||T()};V(()=>{if(!f.isOpen())return;const y=xe();y.addEventListener("pointermove",w,!0),H(()=>{y.removeEventListener("pointermove",w,!0)})}),V(()=>{const y=m();if(!y||!f.isOpen())return;const U=se=>{const re=se.target;me(re,y)&&T(!0)},L=nt();L.addEventListener("scroll",U,{capture:!0}),H(()=>{L.removeEventListener("scroll",U,{capture:!0})})}),H(()=>{clearTimeout(s),X[c]&&delete X[c]});const D={dataset:k(()=>({"data-expanded":f.isOpen()?"":void 0,"data-closed":f.isOpen()?void 0:""})),isOpen:f.isOpen,isDisabled:()=>t.disabled??!1,triggerOnFocusOnly:()=>t.triggerOnFocusOnly??!1,contentId:d,contentPresent:C,openTooltip:A,hideTooltip:T,cancelOpening:b,generateId:fe(()=>l.id),registerContentId:le(x),isTargetOnTooltip:I,setTriggerRef:u,setContentRef:p};return i(Re.Provider,{value:D,get children(){return i(Ue,M({anchorRef:m,contentRef:a,onCurrentPlacementChange:v},o))}})}function Be(e){let n;const c=he(),[l,t]=j(e,["ref","onPointerEnter","onPointerLeave","onPointerDown","onClick","onFocus","onBlur"]);let o=!1,s=!1,d=!1;const x=()=>{o=!1},m=()=>{!c.isOpen()&&(s||d)&&c.openTooltip(d)},u=h=>{c.isOpen()&&!s&&!d&&c.hideTooltip(h)},a=h=>{z(h,l.onPointerEnter),!(h.pointerType==="touch"||c.triggerOnFocusOnly()||c.isDisabled()||h.defaultPrevented)&&(s=!0,m())},p=h=>{z(h,l.onPointerLeave),h.pointerType!=="touch"&&(s=!1,d=!1,c.isOpen()?u():c.cancelOpening())},r=h=>{z(h,l.onPointerDown),o=!0,xe(n).addEventListener("pointerup",x,{once:!0})},v=h=>{z(h,l.onClick),s=!1,d=!1,u(!0)},f=h=>{z(h,l.onFocus),!(c.isDisabled()||h.defaultPrevented||o)&&(d=!0,m())},C=h=>{z(h,l.onBlur);const S=h.relatedTarget;c.isTargetOnTooltip(S)||(s=!1,d=!1,u(!0))};return H(()=>{xe(n).removeEventListener("pointerup",x)}),i(ne,M({as:"button",ref(h){var S=te(T=>{c.setTriggerRef(T),n=T},l.ref);typeof S=="function"&&S(h)},get"aria-describedby"(){return ce(()=>!!c.isOpen())()?c.contentId():void 0},onPointerEnter:a,onPointerLeave:p,onPointerDown:r,onClick:v,onFocus:f,onBlur:C},()=>c.dataset(),t))}var ee=Object.assign(Ke,{Arrow:Oe,Content:Fe,Portal:Le,Trigger:Be}),Kt={};Se(Kt,{Collapsible:()=>Bt,Content:()=>ke,Root:()=>$e,Trigger:()=>Pe,useCollapsibleContext:()=>oe});var He=ue();function oe(){const e=ge(He);if(e===void 0)throw new Error("[kobalte]: `useCollapsibleContext` must be used within a `Collapsible.Root` component");return e}function ke(e){const[n,c]=F(),l=oe(),t=W({id:l.generateId("content")},e),[o,s]=j(t,["ref","id","style"]),{present:d}=Ee({show:l.shouldMount,element:()=>n()??null}),[x,m]=F(0),[u,a]=F(0);let r=l.isOpen()||d();return tt(()=>{const v=requestAnimationFrame(()=>{r=!1});H(()=>{cancelAnimationFrame(v)})}),V(_e(d,()=>{if(!n())return;n().style.transitionDuration="0s",n().style.animationName="none";const v=n().getBoundingClientRect();m(v.height),a(v.width),r||(n().style.transitionDuration="",n().style.animationName="")})),V(_e(l.isOpen,v=>{!v&&n()&&(n().style.transitionDuration="",n().style.animationName="")},{defer:!0})),V(()=>H(l.registerContentId(o.id))),i(K,{get when(){return d()},get children(){return i(ne,M({as:"div",ref(v){var f=te(c,o.ref);typeof f=="function"&&f(v)},get id(){return o.id},get style(){return we({"--kb-collapsible-content-height":x()?`${x()}px`:void 0,"--kb-collapsible-content-width":u()?`${u()}px`:void 0},o.style)}},()=>l.dataset(),s))}})}function $e(e){const n=`collapsible-${de()}`,c=W({id:n},e),[l,t]=j(c,["open","defaultOpen","onOpenChange","disabled","forceMount"]),[o,s]=F(),d=Me({open:()=>l.open,defaultOpen:()=>l.defaultOpen,onOpenChange:u=>{var a;return(a=l.onOpenChange)==null?void 0:a.call(l,u)}}),x=k(()=>({"data-expanded":d.isOpen()?"":void 0,"data-closed":d.isOpen()?void 0:"","data-disabled":l.disabled?"":void 0})),m={dataset:x,isOpen:d.isOpen,disabled:()=>l.disabled??!1,shouldMount:()=>l.forceMount||d.isOpen(),contentId:o,toggle:d.toggle,generateId:fe(()=>t.id),registerContentId:le(s)};return i(He.Provider,{value:m,get children(){return i(ne,M({as:"div"},x,t))}})}function Pe(e){const n=oe(),[c,l]=j(e,["onClick"]);return i(it,M({get"aria-expanded"(){return n.isOpen()},get"aria-controls"(){return ce(()=>!!n.isOpen())()?n.contentId():void 0},get disabled(){return n.disabled()},onClick:o=>{z(o,c.onClick),n.toggle()}},()=>n.dataset(),l))}var Bt=Object.assign($e,{Content:ke,Trigger:Pe}),Q={};Se(Q,{Accordion:()=>Ht,Content:()=>ze,Header:()=>qe,Item:()=>We,Root:()=>Xe,Trigger:()=>Ge,useAccordionContext:()=>Te});var je=ue();function Ne(){const e=ge(je);if(e===void 0)throw new Error("[kobalte]: `useAccordionItemContext` must be used within a `Accordion.Item` component");return e}function ze(e){const n=Ne(),c=n.generateId("content"),l=W({id:c},e),[t,o]=j(l,["id","style"]);return V(()=>H(n.registerContentId(t.id))),i(ke,M({role:"region",get"aria-labelledby"(){return n.triggerId()},get style(){return we({"--kb-accordion-content-height":"var(--kb-collapsible-content-height)","--kb-accordion-content-width":"var(--kb-collapsible-content-width)"},t.style)}},o))}function qe(e){const n=oe();return i(ne,M({as:"h3"},()=>n.dataset(),e))}var Ve=ue();function Te(){const e=ge(Ve);if(e===void 0)throw new Error("[kobalte]: `useAccordionContext` must be used within a `Accordion.Root` component");return e}function We(e){const n=Te(),c=`${n.generateId("item")}-${de()}`,l=W({id:c},e),[t,o]=j(l,["value","disabled"]),[s,d]=F(),[x,m]=F(),u=()=>n.listState().selectionManager(),a=()=>u().isSelected(t.value),p={value:()=>t.value,triggerId:s,contentId:x,generateId:fe(()=>o.id),registerTriggerId:le(d),registerContentId:le(m)};return i(je.Provider,{value:p,get children(){return i($e,M({get open(){return a()},get disabled(){return t.disabled}},o))}})}function Xe(e){let n;const c=`accordion-${de()}`,l=W({id:c,multiple:!1,collapsible:!1,shouldFocusWrap:!0},e),[t,o]=j(l,["id","ref","value","defaultValue","onChange","multiple","collapsible","shouldFocusWrap","onKeyDown","onMouseDown","onFocusIn","onFocusOut"]),[s,d]=F([]),{DomCollectionProvider:x}=at({items:s,onItemsChange:d}),m=lt({selectedKeys:()=>t.value,defaultSelectedKeys:()=>t.defaultValue,onSelectionChange:p=>{var r;return(r=t.onChange)==null?void 0:r.call(t,Array.from(p))},disallowEmptySelection:()=>!t.multiple&&!t.collapsible,selectionMode:()=>t.multiple?"multiple":"single",dataSource:s});m.selectionManager().setFocusedKey("item-1");const u=ct({selectionManager:()=>m.selectionManager(),collection:()=>m.collection(),disallowEmptySelection:()=>m.selectionManager().disallowEmptySelection(),shouldFocusWrap:()=>t.shouldFocusWrap,disallowTypeAhead:!0,allowsTabNavigation:!0},()=>n),a={listState:()=>m,generateId:fe(()=>t.id)};return i(x,{get children(){return i(Ve.Provider,{value:a,get children(){return i(ne,M({as:"div",get id(){return t.id},ref(p){var r=te(v=>n=v,t.ref);typeof r=="function"&&r(p)},get onKeyDown(){return q([t.onKeyDown,u.onKeyDown])},get onMouseDown(){return q([t.onMouseDown,u.onMouseDown])},get onFocusIn(){return q([t.onFocusIn])},get onFocusOut(){return q([t.onFocusOut,u.onFocusOut])}},o))}})}})}function Ge(e){let n;const c=Te(),l=Ne(),t=oe(),o=l.generateId("trigger"),s=W({id:o},e),[d,x]=j(s,["ref","onPointerDown","onPointerUp","onClick","onKeyDown","onMouseDown","onFocus"]);dt({getItem:()=>({ref:()=>n,type:"item",key:l.value(),textValue:"",disabled:t.disabled()})});const m=ut({key:()=>l.value(),selectionManager:()=>c.listState().selectionManager(),disabled:()=>t.disabled(),shouldSelectOnPressUp:!0},()=>n),u=a=>{["Enter"," "].includes(a.key)&&a.preventDefault(),z(a,d.onKeyDown),z(a,m.onKeyDown)};return V(()=>H(l.registerTriggerId(x.id))),i(Pe,M({ref(a){var p=te(r=>n=r,d.ref);typeof p=="function"&&p(a)},get"data-key"(){return m.dataKey()},get onPointerDown(){return q([d.onPointerDown,m.onPointerDown])},get onPointerUp(){return q([d.onPointerUp,m.onPointerUp])},get onClick(){return q([d.onClick,m.onClick])},onKeyDown:u,get onMouseDown(){return q([d.onMouseDown,m.onMouseDown])},get onFocus(){return q([d.onFocus,m.onFocus])}},x))}var Ht=Object.assign(Xe,{Content:ze,Header:qe,Item:We,Trigger:Ge}),ie=$('<div class="inline-flex items-center gap-1 rounded-full border border-base px-2 py-0.5 text-xs text-primary"><span class="uppercase text-[10px] tracking-wide text-muted"></span><span class="font-semibold text-primary">'),jt=$('<div><div class="flex flex-wrap items-center gap-2 text-xs text-primary"><div class="inline-flex items-center gap-1 rounded-full border border-base px-2 py-0.5 text-xs text-primary"><span class="uppercase text-[10px] tracking-wide text-muted"></span><span class="font-semibold text-primary"></span></div><div class="inline-flex items-center gap-1 rounded-full border border-base px-2 py-0.5 text-xs text-primary"><span class="uppercase text-[10px] tracking-wide text-muted"></span><span class="font-semibold text-primary"></span></div><div class="inline-flex items-center gap-1 rounded-full border border-base px-2 py-0.5 text-xs text-primary"><span class="uppercase text-[10px] tracking-wide text-muted"></span><span class="font-semibold text-primary">');const Nt=e=>{const{t:n}=Ae(),{preferences:c}=Qe(),l=k(()=>c().showUsageMetrics??!0),t=k(()=>gt(e.instanceId,e.sessionId)??{cost:0,contextWindow:0,isSubscriptionModel:!1,inputTokens:0,outputTokens:0,reasoningTokens:0,actualUsageTokens:0,modelOutputLimit:0,contextAvailableTokens:null}),o=k(()=>pt(e.instanceId,e.sessionId)),s=k(()=>o().length>0),d=k(()=>s()?ft(e.instanceId,e.sessionId)??{cost:0,inputTokens:0,outputTokens:0,reasoningTokens:0}:{cost:0,inputTokens:0,outputTokens:0,reasoningTokens:0}),x=k(()=>`$${d().cost.toFixed(2)}`),m=k(()=>d().inputTokens),u=k(()=>d().outputTokens),a=k(()=>d().reasoningTokens),p=k(()=>t().inputTokens??0),r=k(()=>t().outputTokens??0),v=k(()=>{const C=t().isSubscriptionModel?0:t().cost;return C>0?C:0}),f=k(()=>t().isSubscriptionModel?n("contextUsagePanel.included"):`$${v().toFixed(2)}`);return(()=>{var C=jt(),h=C.firstChild,S=h.firstChild,T=S.firstChild,E=T.nextSibling,O=S.nextSibling,A=O.firstChild,b=A.nextSibling,R=O.nextSibling,I=R.firstChild,_=I.nextSibling;return g(T,()=>n("contextUsagePanel.labels.input")),g(E,()=>Z(p())),g(A,()=>n("contextUsagePanel.labels.output")),g(b,()=>Z(r())),g(I,()=>n("contextUsagePanel.labels.cost")),g(_,f),g(h,i(K,{get when(){return ce(()=>!!s())()&&l()},get children(){return[(()=>{var w=ie(),P=w.firstChild,D=P.nextSibling;return g(P,()=>n("contextUsagePanel.labels.totalInput")),g(D,()=>Z(m())),w})(),(()=>{var w=ie(),P=w.firstChild,D=P.nextSibling;return g(P,()=>n("contextUsagePanel.labels.totalOutput")),g(D,()=>Z(u())),w})(),(()=>{var w=ie(),P=w.firstChild,D=P.nextSibling;return g(P,()=>n("contextUsagePanel.labels.totalCost")),g(D,x),w})(),(()=>{var w=ie(),P=w.firstChild,D=P.nextSibling;return g(P,()=>n("contextUsagePanel.labels.totalReasoning")),g(D,()=>Z(a())),w})()]}}),null),pe(()=>De(C,`session-context-panel px-4 py-2 ${e.class??""}`)),C})()};var zt=$('<div><div class="mt-2 truncate text-right text-sm font-semibold text-secondary">'),be=$('<div class="text-xs text-tertiary">'),qt=$("<div class=space-y-2>"),Vt=$('<div class="h-2 overflow-hidden border border-base"style=background-color:var(--surface-base)><div class="h-full transition-[width] duration-300"role=progressbar aria-valuemin=0 aria-valuemax=100>'),Wt=$('<div><div class="mb-1 flex items-baseline justify-between gap-2 text-[11px] text-primary"><span class=font-medium></span><div class="flex min-w-0 items-baseline gap-1.5 text-right"><span class="shrink-0 font-medium">'),Xt=$("<span class=text-tertiary aria-hidden=true>·"),Gt=$('<span class="truncate text-[10px] text-tertiary">');const Yt=6e4,Qt=e=>{const{t:n}=Ae(),c=k(()=>{const r=e.providerId.trim();return r?{providerId:r,modelId:e.modelId.trim()}:null}),[l,t]=F();let o=0;const s=async(r,v,f)=>{const C=++o;f&&t(void 0);try{const h=await Ze.fetchProviderUsage(r,v);C===o&&t(h)}catch{C===o&&l()===void 0&&t(null)}};V(()=>{const r=c();if(!r){o+=1,t(void 0);return}s(r.providerId,r.modelId,!0)});const d=setInterval(()=>{const r=c();r&&s(r.providerId,r.modelId,!1)},Yt);H(()=>{o+=1,clearInterval(d)});const x=k(()=>{var r;return Object.entries(((r=l())==null?void 0:r.windows)??{})}),m=r=>{const v={"5h":"fiveHours","7d":"sevenDays","7d-sonnet":"sevenDaysSonnet","7d-opus":"sevenDaysOpus",weekly:"weekly",daily:"daily",monthly:"monthly",credits:"credits",billing_cycle:"billingCycle",session:"session",premium:"premium",chat:"chat",completions:"completions","mcp-tools":"mcpTools"}[r];return v?n(`providerUsage.windows.${v}`):r},u=r=>r.valueLabel?r.valueLabel:r.usedPercent===null?n("providerUsage.unavailableValue"):n("providerUsage.usedPercent",{percent:Math.round(r.usedPercent)}),a=r=>{if(!r)return null;const v=new Date(r);return Number.isFinite(v.getTime())?n("providerUsage.resets",{time:v.toLocaleString([],{dateStyle:"short",timeStyle:"short"})}):null},p=r=>r!==null&&r>=80?"var(--status-error)":r!==null&&r>=50?"var(--status-warning)":"var(--status-success)";return(()=>{var r=zt(),v=r.firstChild;return g(r,i(K,{get when(){return l()!==void 0},get fallback(){return(()=>{var f=be();return g(f,()=>n("providerUsage.loading")),f})()},get children(){return i(K,{get when(){return l()},get fallback(){return(()=>{var f=be();return g(f,()=>n("providerUsage.unavailable")),f})()},children:f=>i(K,{get when(){return ce(()=>!!(f().supported&&f().configured&&f().ok))()&&x().length>0},get fallback(){return(()=>{var C=be();return g(C,()=>n(f().supported?f().configured?"providerUsage.unavailable":"providerUsage.notConfigured":"providerUsage.unsupported")),C})()},get children(){var C=qt();return g(C,i(ye,{get each(){return x()},children:([h,S])=>(()=>{var T=Wt(),E=T.firstChild,O=E.firstChild,A=O.nextSibling,b=A.firstChild;return g(O,()=>m(h)),g(b,()=>u(S)),g(A,i(K,{get when(){return a(S.resetAt)},children:R=>[Xt(),(()=>{var I=Gt();return g(I,R),I})()]}),null),g(T,i(K,{get when(){return S.usedPercent!==null},get children(){var R=Vt(),I=R.firstChild;return pe(_=>{var w=`${Math.max(0,Math.min(100,S.usedPercent??0))}%`,P=p(S.usedPercent),D=n("providerUsage.progressLabel",{window:m(h)}),y=Math.round(S.usedPercent??0);return w!==_.e&&Ie(I,"width",_.e=w),P!==_.t&&Ie(I,"background-color",_.t=P),D!==_.a&&B(I,"aria-label",_.a=D),y!==_.o&&B(I,"aria-valuenow",_.o=y),_},{e:void 0,t:void 0,a:void 0,o:void 0}),R}}),null),T})()})),C}})})}}),v),g(v,()=>{var f;return((f=l())==null?void 0:f.providerName)??e.providerId}),r})()};var Zt=$("<span class=section-left><span class=section-label>"),Jt=$("<div>"),ae=$('<div class="right-panel-empty right-panel-empty--left"><span class=text-xs>'),en=$('<div class="flex items-center justify-between gap-2 border border-base bg-surface-secondary px-3 py-2"><p class="min-w-0 text-xs leading-5 text-secondary"></p><div class="-mr-2 shrink-0">'),tn=$('<div class="flex flex-col gap-2">'),nn=$("<span>"),on=$('<div class=status-process-card><div class=status-process-header><span class=status-process-title></span><div class=status-process-meta><span></span><span></span></div></div><div class=status-process-actions><button type=button class="button-tertiary w-full p-1 inline-flex items-center justify-center"></button><button type=button class="button-tertiary w-full p-1 inline-flex items-center justify-center"></button><button type=button class="button-tertiary w-full p-1 inline-flex items-center justify-center">'),sn=$('<div class="text-xs text-tertiary">'),rn=$('<div class="border border-base bg-surface-secondary px-3 py-2">'),an=$("<div class=status-tab-container>");const ln=e=>{const n=Ct(e.section.id);return(()=>{var c=Jt();return Je(n,c),g(c,i(Q.Item,{get value(){return e.section.id},class:"right-panel-accordion-item",get children(){return[i(Q.Header,{class:"right-panel-accordion-header-row",get children(){return[i(Q.Trigger,{class:"right-panel-accordion-trigger",get children(){return[(()=>{var l=Zt(),t=l.firstChild;return g(l,i(Et,{class:"h-3.5 w-3.5 text-tertiary","aria-hidden":"true"}),t),g(t,()=>e.t(e.section.labelKey)),l})(),i(wt,{get class(){return`right-panel-accordion-chevron ${e.expanded?"right-panel-accordion-chevron-expanded":""}`}})]}}),i(ee,{openDelay:200,gutter:4,placement:"top",get children(){return[i(ee.Trigger,{as:"button",type:"button",class:"section-info-trigger",get"aria-label"(){return e.t(e.section.tooltipKey)},get children(){return i(St,{class:"section-info-icon"})}}),i(ee.Portal,{get children(){return i(ee.Content,{class:"section-info-tooltip",get children(){return e.t(e.section.tooltipKey)}})}})]}})]}}),i(Q.Content,{class:"right-panel-accordion-content",get children(){return e.section.render()}})]}})),pe(()=>De(c,`right-panel-section-draggable ${n.isActiveDraggable?"right-panel-section-draggable-active":""}`)),c})()},mn=e=>{const n=u=>e.expandedItems().includes(u),c=()=>{const u=e.activeSession();return u?(()=>{var a=en(),p=a.firstChild,r=p.nextSibling;return g(p,()=>e.t("instanceShell.yoloMode.description")),g(r,i(It,{get checked(){return Tt(e.instanceId,u.id)},color:"warning",size:"small",get inputProps(){return{"aria-label":e.t("instanceShell.yoloMode.title")}},onChange:()=>Pt(e.instanceId,u.id)})),a})():(()=>{var a=ae(),p=a.firstChild;return g(p,()=>e.t("instanceShell.yoloMode.noSessionSelected")),a})()},l=()=>{const u=e.activeSessionId();if(!u||u==="info")return(()=>{var p=ae(),r=p.firstChild;return g(r,()=>e.t("instanceShell.plan.noSessionSelected")),p})();const a=e.latestTodoState();return a?i($t,{state:a,get emptyLabel(){return e.t("instanceShell.plan.empty")},showStatusLabel:!1}):(()=>{var p=ae(),r=p.firstChild;return g(r,()=>e.t("instanceShell.plan.empty")),p})()},t=()=>{const u=e.backgroundProcessList();return u.length===0?(()=>{var a=ae(),p=a.firstChild;return g(p,()=>e.t("instanceShell.backgroundProcesses.empty")),a})():(()=>{var a=tn();return g(a,i(ye,{each:u,children:p=>(()=>{var r=on(),v=r.firstChild,f=v.firstChild,C=f.nextSibling,h=C.firstChild,S=h.nextSibling,T=v.nextSibling,E=T.firstChild,O=E.nextSibling,A=O.nextSibling;return g(f,()=>p.title),g(h,i(Ot,{class:"h-3.5 w-3.5"})),g(S,()=>e.t("instanceShell.backgroundProcesses.status",{status:p.status})),g(C,i(K,{get when(){return typeof p.outputSizeBytes=="number"},get children(){var b=nn();return g(b,()=>e.t("instanceShell.backgroundProcesses.output",{sizeKb:Math.round((p.outputSizeBytes??0)/1024)})),b}}),null),E.$$click=()=>e.onOpenBackgroundOutput(p),g(E,i(_t,{class:"h-4 w-4"})),O.$$click=()=>e.onStopBackgroundProcess(p.id),g(O,i(At,{class:"h-4 w-4"})),A.$$click=()=>e.onTerminateBackgroundProcess(p.id),g(A,i(kt,{class:"h-4 w-4"})),pe(b=>{var R=!!p.notifyEnabled,I=!p.notifyEnabled,_=e.t(p.notifyEnabled?"instanceShell.backgroundProcesses.notify.enabled":"instanceShell.backgroundProcesses.notify.disabled"),w=e.t(p.notifyEnabled?"instanceShell.backgroundProcesses.notify.enabled":"instanceShell.backgroundProcesses.notify.disabled"),P=e.t("instanceShell.backgroundProcesses.actions.output"),D=e.t("instanceShell.backgroundProcesses.actions.output"),y=p.status!=="running",U=e.t("instanceShell.backgroundProcesses.actions.stop"),L=e.t("instanceShell.backgroundProcesses.actions.stop"),se=e.t("instanceShell.backgroundProcesses.actions.terminate"),re=e.t("instanceShell.backgroundProcesses.actions.terminate");return R!==b.e&&h.classList.toggle("text-success",b.e=R),I!==b.t&&h.classList.toggle("text-tertiary",b.t=I),_!==b.a&&B(h,"aria-label",b.a=_),w!==b.o&&B(h,"title",b.o=w),P!==b.i&&B(E,"aria-label",b.i=P),D!==b.n&&B(E,"title",b.n=D),y!==b.s&&(O.disabled=b.s=y),U!==b.h&&B(O,"aria-label",b.h=U),L!==b.r&&B(O,"title",b.r=L),se!==b.d&&B(A,"aria-label",b.d=se),re!==b.l&&B(A,"title",b.l=re),b},{e:void 0,t:void 0,a:void 0,o:void 0,i:void 0,n:void 0,s:void 0,h:void 0,r:void 0,d:void 0,l:void 0}),r})()})),a})()},o=()=>{const u=e.activeSession();return u?(()=>{var a=rn();return g(a,i(Qt,{get providerId(){return u.model.providerId},get modelId(){return u.model.modelId}})),a})():(()=>{var a=sn();return g(a,()=>e.t("providerUsage.noSession")),a})()},s=k(()=>[...ht({renderYoloModeSection:c,renderProviderUsage:o,renderPlanSectionContent:l,renderBackgroundProcesses:t,renderMcpStatus:()=>i(ve,{get initialInstance(){return e.instance},sections:["mcp"],showSectionHeadings:!1,class:"space-y-2"}),renderLspStatus:()=>i(ve,{get initialInstance(){return e.instance},sections:["lsp"],showSectionHeadings:!1,class:"space-y-2"}),renderPluginStatus:()=>i(ve,{get initialInstance(){return e.instance},sections:["plugins"],showSectionHeadings:!1,class:"space-y-2"})}).statusSections??[],...e.extraSections??[]]),d=k(()=>mt(s(),e.customization().statusSectionOrder,e.customization().hiddenStatusSectionIds)),x=(u,a)=>{if(!u||u===a)return;const p=d().map(h=>h.id),r=p.indexOf(u),v=p.indexOf(a);if(r===-1||v===-1)return;const f=[...p],[C]=f.splice(r,1);f.splice(v,0,C),e.onCustomizationChange(h=>({...h,statusSectionOrder:f}))},m=({draggable:u,droppable:a})=>{a&&x(String(u.id),String(a.id))};return(()=>{var u=an();return g(u,i(K,{get when(){return e.activeSession()},children:a=>i(Nt,{get instanceId(){return e.instanceId},get sessionId(){return a().id},class:"status-tab-context-panel"})}),null),g(u,i(Q.Root,{class:"right-panel-accordion",collapsible:!0,multiple:!0,get value(){return e.expandedItems()},get onChange(){return e.onExpandedItemsChange},get children(){return i(vt,{collisionDetector:bt,onDragEnd:m,get children(){return i(yt,{get children(){return i(xt,{get ids(){return d().map(a=>a.id)},get children(){return i(ye,{get each(){return d()},children:a=>i(ln,{section:a,get expanded(){return n(a.id)},get t(){return e.t}})})}})}})}})}}),null),u})()};et(["click"]);export{mn as default};
@@ -1 +1 @@
1
- import{I as n}from"./main-DxKSa1-Y.js";import{n as o,m as y}from"./git-diff-vendor-CYS3ApzA.js";const i=[["line",{x1:"3",x2:"21",y1:"6",y2:"6",key:"4m8b97"}],["line",{x1:"3",x2:"21",y1:"12",y2:"12",key:"10d38w"}],["line",{x1:"3",x2:"21",y1:"18",y2:"18",key:"kwyyxn"}]],t=e=>o(n,y(e,{name:"AlignJustify",iconNode:i}));export{t as A};
1
+ import{I as n}from"./main-BnwG4srg.js";import{n as o,m as y}from"./git-diff-vendor-CYS3ApzA.js";const i=[["line",{x1:"3",x2:"21",y1:"6",y2:"6",key:"4m8b97"}],["line",{x1:"3",x2:"21",y1:"12",y2:"12",key:"10d38w"}],["line",{x1:"3",x2:"21",y1:"18",y2:"18",key:"kwyyxn"}]],t=e=>o(n,y(e,{name:"AlignJustify",iconNode:i}));export{t as A};