citadel_cli 1.3.0 → 1.4.0

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.
@@ -1,13 +1,13 @@
1
- var Ne = Object.defineProperty;
2
- var ze = (t, e, n) => e in t ? Ne(t, e, { enumerable: !0, configurable: !0, writable: !0, value: n }) : t[e] = n;
3
- var b = (t, e, n) => ze(t, typeof e != "symbol" ? e + "" : e, n);
4
- import { jsx as m, jsxs as E, Fragment as Ae } from "react/jsx-runtime";
5
- import L, { createContext as _e, useState as I, useMemo as M, useEffect as z, useContext as J, useCallback as v, useReducer as Ie, useRef as F } from "react";
6
- import { createRoot as Re } from "react-dom/client";
7
- var W = /* @__PURE__ */ ((t) => (t.Pending = "pending", t.Success = "success", t.Failure = "failure", t.Timeout = "timeout", t))(W || {});
8
- class O {
1
+ var Ae = Object.defineProperty;
2
+ var Pe = (n, e, t) => e in n ? Ae(n, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : n[e] = t;
3
+ var f = (n, e, t) => Pe(n, typeof e != "symbol" ? e + "" : e, t);
4
+ import { jsx as m, jsxs as I, Fragment as He } from "react/jsx-runtime";
5
+ import U, { createContext as Re, useState as _, useMemo as A, useEffect as P, useContext as Q, useCallback as w, useReducer as _e, useRef as z, useLayoutEffect as Me } from "react";
6
+ import { createRoot as Te } from "react-dom/client";
7
+ var q = /* @__PURE__ */ ((n) => (n.Pending = "pending", n.Success = "success", n.Failure = "failure", n.Timeout = "timeout", n))(q || {});
8
+ class W {
9
9
  constructor(e = Date.now()) {
10
- b(this, "_status", "pending");
10
+ f(this, "_status", "pending");
11
11
  this.timestamp = e;
12
12
  }
13
13
  get status() {
@@ -23,80 +23,80 @@ class O {
23
23
  this._status = "timeout";
24
24
  }
25
25
  }
26
- class Pe extends O {
27
- constructor(e, n) {
28
- super(n), this.data = e;
26
+ class ze extends W {
27
+ constructor(e, t) {
28
+ super(t), this.data = e;
29
29
  }
30
30
  render() {
31
- return /* @__PURE__ */ m("pre", { className: "text-gray-200", children: JSON.stringify(this.data, null, 2) });
31
+ return /* @__PURE__ */ m("pre", { className: "citadel-result-json", children: JSON.stringify(this.data, null, 2) });
32
32
  }
33
33
  }
34
- class Y extends O {
35
- constructor(e, n) {
36
- super(n), this.text = e;
34
+ class Y extends W {
35
+ constructor(e, t) {
36
+ super(t), this.text = e;
37
37
  }
38
38
  render() {
39
- return /* @__PURE__ */ m("div", { className: "text-gray-200 whitespace-pre", children: this.text });
39
+ return /* @__PURE__ */ m("div", { className: "citadel-result-text", children: this.text });
40
40
  }
41
41
  }
42
- class fe extends O {
43
- constructor(e, n) {
44
- super(n), this.error = e, this.markFailure();
42
+ class we extends W {
43
+ constructor(e, t) {
44
+ super(t), this.error = e, this.markFailure();
45
45
  }
46
46
  render() {
47
- return /* @__PURE__ */ m("div", { className: "mt-1 text-red-400", children: this.error });
47
+ return /* @__PURE__ */ m("div", { className: "citadel-result-error", children: this.error });
48
48
  }
49
49
  }
50
- class He extends O {
50
+ class De extends W {
51
51
  render() {
52
- return /* @__PURE__ */ m("div", { className: "text-gray-400", children: "..." });
52
+ return /* @__PURE__ */ m("div", { className: "citadel-result-pending", children: "..." });
53
53
  }
54
54
  }
55
- class Me extends O {
56
- constructor(e, n = "", r) {
57
- super(r), this.imageUrl = e, this.altText = n;
55
+ class Fe extends W {
56
+ constructor(e, t = "", s) {
57
+ super(s), this.imageUrl = e, this.altText = t;
58
58
  }
59
59
  render() {
60
- return /* @__PURE__ */ m("div", { className: "my-2", children: /* @__PURE__ */ m(
60
+ return /* @__PURE__ */ m("div", { className: "citadel-result-image-wrap", children: /* @__PURE__ */ m(
61
61
  "img",
62
62
  {
63
63
  src: this.imageUrl,
64
64
  alt: this.altText,
65
- className: "max-w-[400px] max-h-[300px] h-auto rounded-lg object-contain"
65
+ className: "citadel-result-image"
66
66
  }
67
67
  ) });
68
68
  }
69
69
  }
70
- const Te = (t) => async function() {
71
- const n = t.commands.filter((r) => r.fullPath[0] !== "help").map((r) => {
72
- const s = `${r.segments.map((l) => l.type === "argument" ? `<${l.name}>` : l.name).join(" ")} - ${r.description}`, i = r.segments.filter((l) => l.type === "argument" && l.description).map((l) => ` <${l.name}>: ${l.description}`);
70
+ const Le = (n) => async function() {
71
+ const t = n.commands.filter((s) => s.fullPath[0] !== "help").map((s) => {
72
+ const a = `${s.segments.map((c) => c.type === "argument" ? `<${c.name}>` : c.name).join(" ")} - ${s.description}`, o = s.segments.filter((c) => c.type === "argument" && c.description).map((c) => ` <${c.name}>: ${c.description}`);
73
73
  return {
74
- commandLine: s,
75
- argumentLines: i
74
+ commandLine: a,
75
+ argumentLines: o
76
76
  };
77
- }).sort((r, o) => r.commandLine.localeCompare(o.commandLine)).flatMap((r) => [
78
- r.commandLine,
79
- ...r.argumentLines
77
+ }).sort((s, r) => s.commandLine.localeCompare(r.commandLine)).flatMap((s) => [
78
+ s.commandLine,
79
+ ...s.argumentLines
80
80
  ]);
81
- return n.length === 0 ? new Y(
81
+ return t.length === 0 ? new Y(
82
82
  "No commands available yet. Add some commands to get started!"
83
- ) : (n.push("help - Show available commands"), new Y(
83
+ ) : (t.push("help - Show available commands"), new Y(
84
84
  `Available Commands:
85
- ` + n.join(`
85
+ ` + t.join(`
86
86
  `)
87
87
  ));
88
88
  };
89
- var re = /* @__PURE__ */ ((t) => (t[t.NONE = 0] = "NONE", t[t.ERROR = 1] = "ERROR", t[t.WARN = 2] = "WARN", t[t.INFO = 3] = "INFO", t[t.DEBUG = 4] = "DEBUG", t[t.TRACE = 5] = "TRACE", t))(re || {});
90
- const ie = !0;
89
+ var ie = /* @__PURE__ */ ((n) => (n[n.NONE = 0] = "NONE", n[n.ERROR = 1] = "ERROR", n[n.WARN = 2] = "WARN", n[n.INFO = 3] = "INFO", n[n.DEBUG = 4] = "DEBUG", n[n.TRACE = 5] = "TRACE", n))(ie || {});
90
+ const ue = !0;
91
91
  class k {
92
92
  static configure(e) {
93
93
  this.level = e.level, this.prefix = e.prefix || "[Citadel]";
94
94
  }
95
95
  static trace(...e) {
96
- this.level >= 5 && !ie && console.trace(this.prefix, ...e);
96
+ this.level >= 5 && !ue && console.trace(this.prefix, ...e);
97
97
  }
98
98
  static debug(...e) {
99
- this.level >= 4 && !ie && console.debug(this.prefix, ...e);
99
+ this.level >= 4 && !ue && console.debug(this.prefix, ...e);
100
100
  }
101
101
  static info(...e) {
102
102
  this.level >= 3 && console.info(this.prefix, ...e);
@@ -108,7 +108,7 @@ class k {
108
108
  this.level >= 1 && console.error(this.prefix, ...e);
109
109
  }
110
110
  }
111
- b(k, "level", 0), b(k, "prefix", "");
111
+ f(k, "level", 0), f(k, "prefix", "");
112
112
  const N = {
113
113
  commandTimeoutMs: 1e4,
114
114
  cursorColor: "var(--cursor-color, #fff)",
@@ -117,8 +117,8 @@ const N = {
117
117
  includeHelpCommand: !0,
118
118
  fontFamily: "monospace",
119
119
  fontSize: "0.875rem",
120
- initialHeight: "40vh",
121
- logLevel: re.ERROR,
120
+ initialHeight: "50vh",
121
+ logLevel: ie.ERROR,
122
122
  maxHeight: "80vh",
123
123
  minHeight: "200",
124
124
  outputFontSize: "0.875rem",
@@ -129,51 +129,51 @@ const N = {
129
129
  type: "localStorage",
130
130
  maxCommands: 100
131
131
  }
132
- }, we = async () => new Y("");
133
- class oe {
134
- constructor(e, n, r) {
135
- this.type = e, this.name = n, this.description = r;
132
+ }, Ce = async () => new Y("");
133
+ class ce {
134
+ constructor(e, t, s) {
135
+ this.type = e, this.name = t, this.description = s;
136
136
  }
137
137
  toString() {
138
138
  return this.name;
139
139
  }
140
140
  }
141
- class se extends oe {
141
+ class le extends ce {
142
142
  constructor() {
143
143
  super("null", ">null<", "Empty segment");
144
144
  }
145
145
  }
146
- class ye extends oe {
147
- constructor(e, n) {
148
- super("word", e, n);
146
+ class ve extends ce {
147
+ constructor(e, t) {
148
+ super("word", e, t);
149
149
  }
150
150
  }
151
- class $ extends oe {
152
- constructor(e, n, r, o) {
153
- super("argument", e, n), this.value = r, this.valid = o;
151
+ class O extends ce {
152
+ constructor(e, t, s, r) {
153
+ super("argument", e, t), this.value = s, this.valid = r;
154
154
  }
155
155
  }
156
- const Fe = (t) => {
157
- if (t.type === "word")
158
- return new ye(t.name, t.description);
159
- if (t.type === "argument") {
160
- const e = t;
161
- return new $(
156
+ const $e = (n) => {
157
+ if (n.type === "word")
158
+ return new ve(n.name, n.description);
159
+ if (n.type === "argument") {
160
+ const e = n;
161
+ return new O(
162
162
  e.name,
163
163
  e.description,
164
164
  e.value,
165
165
  e.valid
166
166
  );
167
167
  }
168
- return new se();
169
- }, H = (t) => t.map((e) => Fe(e));
170
- class De {
171
- constructor(e, n, r = we) {
172
- b(this, "_segments");
173
- b(this, "_description");
168
+ return new le();
169
+ }, D = (n) => n.map((e) => $e(e));
170
+ class je {
171
+ constructor(e, t, s = Ce) {
172
+ f(this, "_segments");
173
+ f(this, "_description");
174
174
  // Used by `Help` command, etc.
175
- b(this, "_handler");
176
- this._segments = e, this._description = n, this._handler = r;
175
+ f(this, "_handler");
176
+ this._segments = e, this._description = t, this._handler = s;
177
177
  }
178
178
  get segments() {
179
179
  return this._segments;
@@ -199,7 +199,7 @@ class De {
199
199
  }
200
200
  class X {
201
201
  constructor() {
202
- b(this, "_commands", []);
202
+ f(this, "_commands", []);
203
203
  }
204
204
  get commands() {
205
205
  return this._commands;
@@ -215,20 +215,20 @@ class X {
215
215
  * @param handler Async handler executed when the command is submitted; defaults to `NoopHandler`.
216
216
  * @throws {Error} If the segment list is empty or the path collides with an existing command.
217
217
  */
218
- addCommand(e, n, r = we) {
218
+ addCommand(e, t, s = Ce) {
219
219
  if (e === void 0 || e.length === 0)
220
220
  throw new Error("Command path cannot be empty");
221
- const o = new De(e, n, r), s = this._commands.find((i) => {
222
- const l = i.segments.map(
223
- (c) => c.type === "argument" ? "*" : c.name
224
- ).join(" "), a = e.map(
225
- (c) => c.type === "argument" ? "*" : c.name
221
+ const r = new je(e, t, s), a = this._commands.find((o) => {
222
+ const c = o.segments.map(
223
+ (d) => d.type === "argument" ? "*" : d.name
224
+ ).join(" "), i = e.map(
225
+ (d) => d.type === "argument" ? "*" : d.name
226
226
  ).join(" ");
227
- return l === a;
227
+ return c === i;
228
228
  });
229
- if (s)
230
- throw new Error(`Duplicate commands: '${s.fullPath_s}' and '${o.fullPath_s}'`);
231
- this._commands.push(o);
229
+ if (a)
230
+ throw new Error(`Duplicate commands: '${a.fullPath_s}' and '${r.fullPath_s}'`);
231
+ this._commands.push(r);
232
232
  }
233
233
  /**
234
234
  * Removes a command that exactly matches the provided path.
@@ -237,8 +237,8 @@ class X {
237
237
  * @returns True if a command was removed; otherwise false.
238
238
  */
239
239
  removeCommand(e) {
240
- const n = e.join(" "), r = this._commands.findIndex((o) => o.fullPath.join(" ") === n);
241
- return r === -1 ? !1 : (this._commands.splice(r, 1), !0);
240
+ const t = e.join(" "), s = this._commands.findIndex((r) => r.fullPath.join(" ") === t);
241
+ return s === -1 ? !1 : (this._commands.splice(s, 1), !0);
242
242
  }
243
243
  /**
244
244
  * Retrieves a command from the registry for the given path.
@@ -247,26 +247,26 @@ class X {
247
247
  * @returns The command node or undefined if not found.
248
248
  */
249
249
  getCommand(e) {
250
- return this._commands.find((n) => {
251
- const r = n.fullPath.join(" "), o = e.join(" ");
252
- if (r === o)
250
+ return this._commands.find((t) => {
251
+ const s = t.fullPath.join(" "), r = e.join(" ");
252
+ if (s === r)
253
253
  return !0;
254
- const i = n.segments.filter((l) => l.type === "word").map((l) => l.name);
255
- return i.length === e.length && i.join(" ") === o;
254
+ const o = t.segments.filter((c) => c.type === "word").map((c) => c.name);
255
+ return o.length === e.length && o.join(" ") === r;
256
256
  });
257
257
  }
258
258
  commandExistsForPath(e) {
259
- const n = this._commands.map(
260
- (o) => o.segments.map(
261
- (s) => s.type === "argument" ? "*" : s.name
259
+ const t = this._commands.map(
260
+ (r) => r.segments.map(
261
+ (a) => a.type === "argument" ? "*" : a.name
262
262
  ).join(" ")
263
- ), r = e.map((o, s) => this._commands.some(
264
- (l) => {
265
- var a;
266
- return ((a = l.segments[s]) == null ? void 0 : a.type) === "argument";
263
+ ), s = e.map((r, a) => this._commands.some(
264
+ (c) => {
265
+ var i;
266
+ return ((i = c.segments[a]) == null ? void 0 : i.type) === "argument";
267
267
  }
268
- ) ? "*" : o).join(" ");
269
- return n.includes(r);
268
+ ) ? "*" : r).join(" ");
269
+ return t.includes(s);
270
270
  }
271
271
  /**
272
272
  * Gets possible matches for a given path.
@@ -275,26 +275,26 @@ class X {
275
275
  * @returns An array of completion strings.
276
276
  */
277
277
  getCompletionNames(e) {
278
- return this.getCompletions(e).map((n) => n.name);
278
+ return this.getCompletions(e).map((t) => t.name);
279
279
  }
280
280
  /**
281
281
  * Returns completion segments whose names start with the given prefix.
282
282
  * Matching is case-insensitive.
283
283
  */
284
- getMatchingCompletions(e, n) {
285
- const r = n.trim().toLowerCase(), o = this.getCompletions(e);
286
- return r ? o.filter(
287
- (s) => s.name.toLowerCase().startsWith(r)
288
- ) : o;
284
+ getMatchingCompletions(e, t) {
285
+ const s = t.trim().toLowerCase(), r = this.getCompletions(e);
286
+ return s ? r.filter(
287
+ (a) => a.name.toLowerCase().startsWith(s)
288
+ ) : r;
289
289
  }
290
290
  /**
291
291
  * Returns a single completion when prefix matching is unambiguous.
292
292
  * Returns undefined for ambiguous or no-match prefixes.
293
293
  */
294
- getUniqueCompletion(e, n) {
295
- const r = this.getMatchingCompletions(e, n);
296
- if (r.length === 1)
297
- return r[0];
294
+ getUniqueCompletion(e, t) {
295
+ const s = this.getMatchingCompletions(e, t);
296
+ if (s.length === 1)
297
+ return s[0];
298
298
  }
299
299
  /**
300
300
  * Gets an array of segments reachable from a given path
@@ -304,28 +304,28 @@ class X {
304
304
  */
305
305
  getCompletions(e) {
306
306
  if (k.debug("[getCompletions] path: ", e), !e.length) {
307
- const s = this._commands.map((a) => a.segments[0]), i = (a, c) => a.type === c.type && a.name === c.name;
308
- return s.filter(
309
- (a, c, g) => c === g.findIndex((f) => i(f, a))
307
+ const a = this._commands.map((i) => i.segments[0]), o = (i, d) => i.type === d.type && i.name === d.name;
308
+ return a.filter(
309
+ (i, d, g) => d === g.findIndex((u) => o(u, i))
310
310
  );
311
311
  }
312
- const n = e.length;
313
- return this._commands.filter((s) => {
314
- const i = s.segments;
315
- if (i.length <= n - 1)
312
+ const t = e.length;
313
+ return this._commands.filter((a) => {
314
+ const o = a.segments;
315
+ if (o.length <= t - 1)
316
316
  return !1;
317
- for (let l = 0; l < n; l++) {
318
- const a = e[l], c = i[l];
319
- if (!(a === "*" && c.type === "argument") && a !== c.name)
317
+ for (let c = 0; c < t; c++) {
318
+ const i = e[c], d = o[c];
319
+ if (!(i === "*" && d.type === "argument") && i !== d.name)
320
320
  return !1;
321
321
  }
322
322
  return !0;
323
- }).filter((s) => s.segments.length > n).map((s) => {
324
- const i = s.segments[n], l = i.type === "argument" ? $ : ye;
325
- return new l(i.name, i.description);
323
+ }).filter((a) => a.segments.length > t).map((a) => {
324
+ const o = a.segments[t], c = o.type === "argument" ? O : ve;
325
+ return new c(o.name, o.description);
326
326
  }).filter(
327
- (s, i, l) => i === l.findIndex(
328
- (a) => a.type === s.type && a.name === s.name
327
+ (a, o, c) => o === c.findIndex(
328
+ (i) => i.type === a.type && i.name === a.name
329
329
  )
330
330
  );
331
331
  }
@@ -333,9 +333,9 @@ class X {
333
333
  return this.getCompletions(e).length > 0;
334
334
  }
335
335
  }
336
- class be {
336
+ class Se {
337
337
  constructor(e) {
338
- b(this, "config");
338
+ f(this, "config");
339
339
  this.config = {
340
340
  type: "localStorage",
341
341
  maxCommands: 100,
@@ -346,88 +346,88 @@ class be {
346
346
  * Add a command to history, enforcing storage limits
347
347
  */
348
348
  async addStoredCommand(e) {
349
- const n = await this.getStoredCommands();
350
- for (n.push(e); n.length > this.config.maxCommands; )
351
- n.shift();
352
- await this.saveCommands(n);
349
+ const t = await this.getStoredCommands();
350
+ for (t.push(e); t.length > this.config.maxCommands; )
351
+ t.shift();
352
+ await this.saveCommands(t);
353
353
  }
354
354
  }
355
- class Ue extends be {
356
- constructor(n) {
357
- super(n);
358
- b(this, "storageKey", "citadel_command_history");
355
+ class Ue extends Se {
356
+ constructor(t) {
357
+ super(t);
358
+ f(this, "storageKey", "citadel_command_history");
359
359
  }
360
360
  async getStoredCommands() {
361
361
  try {
362
- const n = window.localStorage.getItem(this.storageKey);
363
- return n ? JSON.parse(n).map((o) => ({
364
- commandSegments: Array.isArray(o.commandSegments) ? H(o.commandSegments) : [],
365
- timestamp: o.timestamp
362
+ const t = window.localStorage.getItem(this.storageKey);
363
+ return t ? JSON.parse(t).map((r) => ({
364
+ commandSegments: Array.isArray(r.commandSegments) ? D(r.commandSegments) : [],
365
+ timestamp: r.timestamp
366
366
  })) : [];
367
- } catch (n) {
368
- return console.warn("Failed to load commands from localStorage:", n), [];
367
+ } catch (t) {
368
+ return console.warn("Failed to load commands from localStorage:", t), [];
369
369
  }
370
370
  }
371
371
  async clear() {
372
372
  try {
373
373
  window.localStorage.removeItem(this.storageKey);
374
- } catch (n) {
375
- console.warn("Failed to clear localStorage:", n);
374
+ } catch (t) {
375
+ console.warn("Failed to clear localStorage:", t);
376
376
  }
377
377
  }
378
- async saveCommands(n) {
378
+ async saveCommands(t) {
379
379
  try {
380
- const r = n.map((o) => ({
381
- commandSegments: Array.isArray(o.commandSegments) ? H(o.commandSegments).map((s) => ({
382
- type: s.type,
383
- name: s.name,
384
- description: s.description,
385
- ...s instanceof $ ? { value: s.value } : {}
380
+ const s = t.map((r) => ({
381
+ commandSegments: Array.isArray(r.commandSegments) ? D(r.commandSegments).map((a) => ({
382
+ type: a.type,
383
+ name: a.name,
384
+ description: a.description,
385
+ ...a instanceof O ? { value: a.value } : {}
386
386
  })) : [],
387
- timestamp: o.timestamp
387
+ timestamp: r.timestamp
388
388
  }));
389
- window.localStorage.setItem(this.storageKey, JSON.stringify(r));
390
- } catch (r) {
391
- throw console.warn("Failed to save commands to localStorage:", r), r;
389
+ window.localStorage.setItem(this.storageKey, JSON.stringify(s));
390
+ } catch (s) {
391
+ throw console.warn("Failed to save commands to localStorage:", s), s;
392
392
  }
393
393
  }
394
394
  }
395
- class le extends be {
396
- constructor(n) {
397
- super(n);
398
- b(this, "storedCommands", []);
395
+ class pe extends Se {
396
+ constructor(t) {
397
+ super(t);
398
+ f(this, "storedCommands", []);
399
399
  }
400
400
  async getStoredCommands() {
401
- return this.storedCommands.map((n) => ({
402
- commandSegments: Array.isArray(n.commandSegments) ? H(n.commandSegments) : [],
403
- timestamp: n.timestamp
401
+ return this.storedCommands.map((t) => ({
402
+ commandSegments: Array.isArray(t.commandSegments) ? D(t.commandSegments) : [],
403
+ timestamp: t.timestamp
404
404
  }));
405
405
  }
406
406
  async clear() {
407
407
  this.storedCommands = [];
408
408
  }
409
- async saveCommands(n) {
410
- this.storedCommands = n.map((r) => ({
411
- commandSegments: Array.isArray(r.commandSegments) ? H(r.commandSegments) : [],
412
- timestamp: r.timestamp
409
+ async saveCommands(t) {
410
+ this.storedCommands = t.map((s) => ({
411
+ commandSegments: Array.isArray(s.commandSegments) ? D(s.commandSegments) : [],
412
+ timestamp: s.timestamp
413
413
  }));
414
414
  }
415
415
  }
416
- const U = class U {
416
+ const $ = class $ {
417
417
  constructor() {
418
- b(this, "currentStorage");
418
+ f(this, "currentStorage");
419
419
  }
420
420
  static reset() {
421
- U.instance = void 0;
421
+ $.instance = void 0;
422
422
  }
423
423
  static getInstance() {
424
- return U.instance || (U.instance = new U()), U.instance;
424
+ return $.instance || ($.instance = new $()), $.instance;
425
425
  }
426
426
  initializeStorage(e) {
427
427
  try {
428
- e.type === "memory" ? this.currentStorage = new le(e) : this.currentStorage = new Ue(e);
429
- } catch (n) {
430
- console.warn("Failed to create storage, falling back to memory storage:", n), this.currentStorage = new le(e);
428
+ e.type === "memory" ? this.currentStorage = new pe(e) : this.currentStorage = new Ue(e);
429
+ } catch (t) {
430
+ console.warn("Failed to create storage, falling back to memory storage:", t), this.currentStorage = new pe(e);
431
431
  }
432
432
  }
433
433
  getStorage() {
@@ -436,19 +436,19 @@ const U = class U {
436
436
  return this.currentStorage;
437
437
  }
438
438
  };
439
- b(U, "instance");
440
- let V = U;
439
+ f($, "instance");
440
+ let J = $;
441
441
  class xe {
442
442
  constructor() {
443
- b(this, "segments", []);
444
- b(this, "nullSegment", new se());
445
- b(this, "observers", []);
443
+ f(this, "segments", []);
444
+ f(this, "nullSegment", new le());
445
+ f(this, "observers", []);
446
446
  }
447
447
  subscribe(e) {
448
448
  this.observers.push(e);
449
449
  }
450
450
  unsubscribe(e) {
451
- this.observers = this.observers.filter((n) => n !== e);
451
+ this.observers = this.observers.filter((t) => t !== e);
452
452
  }
453
453
  notifyObservers() {
454
454
  this.observers.forEach((e) => e.update());
@@ -469,7 +469,7 @@ class xe {
469
469
  * Pushes an array of segments onto the stack
470
470
  */
471
471
  pushAll(e) {
472
- e.forEach((n) => this.push(n));
472
+ e.forEach((t) => this.push(t));
473
473
  }
474
474
  /**
475
475
  * Removes and returns the top segment from the stack
@@ -525,420 +525,411 @@ class xe {
525
525
  return [...this.segments];
526
526
  }
527
527
  }
528
- const je = {
528
+ const Oe = {
529
529
  config: N,
530
530
  commands: new X(),
531
531
  segmentStack: new xe()
532
- }, q = _e(je), Le = ({ config: t = N, commandRegistry: e, children: n }) => {
533
- const [r, o] = L.useState(), [s] = I(() => new xe()), i = M(() => ({
532
+ }, B = Re(Oe), We = ({ config: n = N, commandRegistry: e, children: t }) => {
533
+ const [s, r] = U.useState(), [a] = _(() => new xe()), o = A(() => ({
534
534
  ...N,
535
- ...t,
535
+ ...n,
536
536
  // Ensure nested objects are properly merged
537
537
  storage: {
538
538
  ...N.storage,
539
- ...t.storage
539
+ ...n.storage
540
540
  },
541
541
  // Ensure explicit values from config take precedence
542
- cursorType: t.cursorType ?? N.cursorType,
543
- cursorColor: t.cursorColor ?? N.cursorColor,
544
- cursorSpeed: t.cursorSpeed ?? N.cursorSpeed,
545
- showCitadelKey: t.showCitadelKey || "."
546
- }), [t]);
547
- z(() => {
548
- V.getInstance().initializeStorage(
549
- i.storage ?? N.storage
550
- ), o(V.getInstance().getStorage());
551
- }, [i.storage]), z(() => {
542
+ cursorType: n.cursorType ?? N.cursorType,
543
+ cursorColor: n.cursorColor ?? N.cursorColor,
544
+ cursorSpeed: n.cursorSpeed ?? N.cursorSpeed,
545
+ showCitadelKey: n.showCitadelKey || "."
546
+ }), [n]);
547
+ P(() => {
548
+ J.getInstance().initializeStorage(
549
+ o.storage ?? N.storage
550
+ ), r(J.getInstance().getStorage());
551
+ }, [o.storage]), P(() => {
552
552
  if (e) {
553
- if (i.includeHelpCommand) {
553
+ if (o.includeHelpCommand) {
554
554
  if (!e.commandExistsForPath(["help"])) {
555
- const a = Te(e);
555
+ const i = Le(e);
556
556
  e.addCommand(
557
557
  [{ type: "word", name: "help" }],
558
558
  "Show available commands",
559
- a
559
+ i
560
560
  );
561
561
  }
562
562
  return;
563
563
  }
564
564
  e.removeCommand(["help"]);
565
565
  }
566
- }, [e, i.includeHelpCommand]);
567
- const l = M(() => ({
568
- config: i,
566
+ }, [e, o.includeHelpCommand]);
567
+ const c = A(() => ({
568
+ config: o,
569
569
  commands: e || new X(),
570
- storage: r,
571
- segmentStack: s
572
- }), [i, e, r, s]);
573
- return /* @__PURE__ */ m(q.Provider, { value: l, children: n });
570
+ storage: s,
571
+ segmentStack: a
572
+ }), [o, e, s, a]);
573
+ return /* @__PURE__ */ m(B.Provider, { value: c, children: t });
574
574
  }, j = () => {
575
- const t = J(q);
576
- if (t === void 0)
575
+ const n = Q(B);
576
+ if (n === void 0)
577
577
  throw new Error("useCitadelConfig must be used within a CitadelConfigProvider");
578
- return t.config;
579
- }, Q = () => {
580
- const t = J(q);
581
- if (t === void 0)
578
+ return n.config;
579
+ }, Z = () => {
580
+ const n = Q(B);
581
+ if (n === void 0)
582
582
  throw new Error("useCitadelCommands must be used within a CitadelConfigProvider");
583
- return t.commands;
584
- }, ve = () => {
585
- const t = J(q);
586
- if (t === void 0)
583
+ return n.commands;
584
+ }, be = () => {
585
+ const n = Q(B);
586
+ if (n === void 0)
587
587
  throw new Error("useCitadelStorage must be used within a CitadelConfigProvider");
588
- return t.storage;
589
- }, B = () => {
590
- const t = J(q);
591
- if (t === void 0)
588
+ return n.storage;
589
+ }, V = () => {
590
+ const n = Q(B);
591
+ if (n === void 0)
592
592
  throw new Error("useSegmentStack must be used within a CitadelConfigProvider");
593
- return t.segmentStack;
593
+ return n.segmentStack;
594
594
  }, G = class G {
595
- constructor(e, n) {
596
- b(this, "id");
597
- b(this, "timestamp");
598
- b(this, "command");
599
- b(this, "result");
600
- this.id = `output-${Date.now()}-${G.idCounter++}`, this.command = e.toArray().map((r) => r.type === "argument" ? r.value || "" : r.name), this.timestamp = Date.now(), this.result = n ?? new He();
595
+ constructor(e, t) {
596
+ f(this, "id");
597
+ f(this, "timestamp");
598
+ f(this, "command");
599
+ f(this, "result");
600
+ this.id = `output-${Date.now()}-${G.idCounter++}`, this.command = e.toArray().map((s) => s.type === "argument" ? s.value || "" : s.name), this.timestamp = Date.now(), this.result = t ?? new De();
601
601
  }
602
602
  };
603
- b(G, "idCounter", 0);
604
- let te = G;
605
- function $e(t) {
603
+ f(G, "idCounter", 0);
604
+ let oe = G;
605
+ function Ke(n) {
606
606
  return {
607
- commandSegments: H(t),
607
+ commandSegments: D(n),
608
608
  timestamp: Date.now()
609
609
  };
610
610
  }
611
- function Ce() {
612
- const t = ve(), [e, n] = I({
611
+ function ke() {
612
+ const n = be(), [e, t] = _({
613
613
  storedCommands: [],
614
614
  position: null
615
- }), r = v(async (l) => {
616
- if (t)
615
+ }), s = w(async (c) => {
616
+ if (n)
617
617
  try {
618
- const a = $e(l);
619
- await t.addStoredCommand(a), n((c) => ({
620
- ...c,
621
- storedCommands: [...c.storedCommands, {
622
- ...a,
623
- commandSegments: H(a.commandSegments)
618
+ const i = Ke(c);
619
+ await n.addStoredCommand(i), t((d) => ({
620
+ ...d,
621
+ storedCommands: [...d.storedCommands, {
622
+ ...i,
623
+ commandSegments: D(i.commandSegments)
624
624
  }],
625
625
  position: null
626
626
  }));
627
- } catch (a) {
628
- console.warn("Failed to save command to history:", a);
627
+ } catch (i) {
628
+ console.warn("Failed to save command to history:", i);
629
629
  }
630
- }, [t]), o = v(async () => t ? (await t.getStoredCommands()).map((a) => ({
631
- ...a,
632
- commandSegments: H(a.commandSegments)
633
- })) : [], [t]);
634
- z(() => {
635
- if (!t) return;
630
+ }, [n]), r = w(async () => n ? (await n.getStoredCommands()).map((i) => ({
631
+ ...i,
632
+ commandSegments: D(i.commandSegments)
633
+ })) : [], [n]);
634
+ P(() => {
635
+ if (!n) return;
636
636
  (async () => {
637
637
  try {
638
- const c = (await t.getStoredCommands()).map((g) => ({
638
+ const d = (await n.getStoredCommands()).map((g) => ({
639
639
  ...g,
640
- commandSegments: H(g.commandSegments)
640
+ commandSegments: D(g.commandSegments)
641
641
  }));
642
- return n((g) => ({
642
+ return t((g) => ({
643
643
  ...g,
644
- storedCommands: c
645
- })), c;
646
- } catch (a) {
647
- console.warn("Failed to load command history:", a);
644
+ storedCommands: d
645
+ })), d;
646
+ } catch (i) {
647
+ console.warn("Failed to load command history:", i);
648
648
  }
649
649
  })();
650
- }, [t]);
651
- const s = v(async (l) => {
652
- const a = await o();
653
- if (a.length === 0)
654
- return n((f) => ({
655
- ...f,
650
+ }, [n]);
651
+ const a = w(async (c) => {
652
+ const i = await r();
653
+ if (i.length === 0)
654
+ return t((u) => ({
655
+ ...u,
656
656
  storedCommands: [],
657
657
  position: null
658
658
  })), { segments: null, position: null };
659
- let c = null;
660
- if (l === "up" ? e.position === null ? c = a.length - 1 : e.position > 0 ? c = e.position - 1 : c = 0 : e.position === null || e.position >= a.length - 1 ? c = null : c = e.position + 1, n((f) => ({
661
- ...f,
662
- storedCommands: a.map((x) => ({
663
- ...x,
664
- commandSegments: H(x.commandSegments)
659
+ let d = null;
660
+ if (c === "up" ? e.position === null ? d = i.length - 1 : e.position > 0 ? d = e.position - 1 : d = 0 : e.position === null || e.position >= i.length - 1 ? d = null : d = e.position + 1, t((u) => ({
661
+ ...u,
662
+ storedCommands: i.map((h) => ({
663
+ ...h,
664
+ commandSegments: D(h.commandSegments)
665
665
  })),
666
- position: c
667
- })), c === null)
666
+ position: d
667
+ })), d === null)
668
668
  return {
669
669
  segments: [],
670
670
  position: null
671
671
  };
672
- const g = a[c];
672
+ const g = i[d];
673
673
  return g ? {
674
- segments: H(g.commandSegments),
675
- position: c
674
+ segments: D(g.commandSegments),
675
+ position: d
676
676
  } : {
677
677
  segments: [],
678
678
  position: null
679
679
  };
680
- }, [e.position, o]), i = v(async () => {
680
+ }, [e.position, r]), o = w(async () => {
681
681
  try {
682
- if (!t) return;
683
- await t.clear(), n({
682
+ if (!n) return;
683
+ await n.clear(), t({
684
684
  storedCommands: [],
685
685
  position: null
686
686
  });
687
- } catch (l) {
688
- console.warn("Failed to clear command history:", l);
687
+ } catch (c) {
688
+ console.warn("Failed to clear command history:", c);
689
689
  }
690
- }, [t]);
690
+ }, [n]);
691
691
  return {
692
692
  history: e,
693
- addStoredCommand: r,
694
- getStoredCommands: o,
695
- navigateHistory: s,
696
- clear: i
693
+ addStoredCommand: s,
694
+ getStoredCommands: r,
695
+ navigateHistory: a,
696
+ clear: o
697
697
  };
698
698
  }
699
- const ae = () => {
700
- const t = j(), e = Q(), n = Ce(), r = B(), o = ve(), [s, i] = I({
699
+ const de = () => {
700
+ const n = j(), e = Z(), t = ke(), s = V(), r = be(), [a, o] = _({
701
701
  currentInput: "",
702
702
  isEnteringArg: !1,
703
703
  output: [],
704
704
  history: {
705
705
  commands: [],
706
706
  position: null,
707
- storage: o
707
+ storage: r
708
708
  }
709
709
  });
710
- z(() => {
711
- }, [o]), z(() => {
712
- i((a) => ({
713
- ...a,
710
+ P(() => {
711
+ }, [r]), P(() => {
712
+ o((i) => ({
713
+ ...i,
714
714
  history: {
715
- commands: n.history.storedCommands,
716
- position: n.history.position,
717
- storage: o
715
+ commands: t.history.storedCommands,
716
+ position: t.history.position,
717
+ storage: r
718
718
  }
719
719
  }));
720
- }, [n.history, o]);
721
- const l = {
722
- setCurrentInput: v((a) => {
723
- k.debug("[CitadelActions] setCurrentInput: ", a), i((c) => ({ ...c, currentInput: a }));
720
+ }, [t.history, r]);
721
+ const c = {
722
+ setCurrentInput: w((i) => {
723
+ k.debug("[CitadelActions] setCurrentInput: ", i), o((d) => ({ ...d, currentInput: i }));
724
724
  }, []),
725
- setIsEnteringArg: v((a) => {
726
- k.debug("[CitadelActions] setIsEnteringArg: ", a), i((c) => ({ ...c, isEnteringArg: a }));
725
+ setIsEnteringArg: w((i) => {
726
+ k.debug("[CitadelActions] setIsEnteringArg: ", i), o((d) => ({ ...d, isEnteringArg: i }));
727
727
  }, []),
728
- addOutput: v((a) => {
729
- k.debug("[CitadelActions]addOutput: ", a), i((c) => ({
730
- ...c,
731
- output: [...c.output, a]
728
+ addOutput: w((i) => {
729
+ k.debug("[CitadelActions]addOutput: ", i), o((d) => ({
730
+ ...d,
731
+ output: [...d.output, i]
732
732
  }));
733
733
  }, []),
734
- executeCommand: v(async () => {
735
- const a = r.path(), c = e.getCommand(a);
736
- if (!c) {
737
- console.error("[CitadelActions][executeCommand] Cannot execute command because no command was found for the given path: ", a);
734
+ executeCommand: w(async () => {
735
+ const i = s.path(), d = e.getCommand(i);
736
+ if (!d) {
737
+ console.error("[CitadelActions][executeCommand] Cannot execute command because no command was found for the given path: ", i);
738
738
  return;
739
739
  }
740
- const g = new te(r);
741
- i((f) => ({
742
- ...f,
743
- output: [...f.output, g]
740
+ const g = new oe(s);
741
+ o((u) => ({
742
+ ...u,
743
+ output: [...u.output, g]
744
744
  }));
745
745
  try {
746
- const f = new Promise((h, S) => {
746
+ const u = new Promise((y, v) => {
747
747
  setTimeout(() => {
748
- S(new Error("Request timed out"));
749
- }, t.commandTimeoutMs);
750
- }), x = r.arguments.map((h) => h.value || ""), w = await Promise.race([
751
- c.handler(x),
752
- f
748
+ v(new Error("Request timed out"));
749
+ }, n.commandTimeoutMs);
750
+ }), h = s.arguments.map((y) => y.value || ""), x = await Promise.race([
751
+ d.handler(h),
752
+ u
753
753
  ]);
754
- if (!(w instanceof O))
754
+ if (!(x instanceof W))
755
755
  throw new Error(
756
- `The ${a.join(".")} command returned an invalid result type. Commands must return an instance of a CommandResult.
756
+ `The ${i.join(".")} command returned an invalid result type. Commands must return an instance of a CommandResult.
757
757
  For example:
758
758
  return new JsonCommandResult({ text: "Hello World" });
759
- Check the definition of the ${a.join(".")} command and update the return type for its handler.`
759
+ Check the definition of the ${i.join(".")} command and update the return type for its handler.`
760
760
  );
761
- w.markSuccess(), i((h) => ({
762
- ...h,
763
- output: h.output.map(
764
- (S) => S.id === g.id ? { ...S, result: w } : S
761
+ x.markSuccess(), o((y) => ({
762
+ ...y,
763
+ output: y.output.map(
764
+ (v) => v.id === g.id ? { ...v, result: x } : v
765
765
  )
766
766
  }));
767
- } catch (f) {
768
- const x = new fe(
769
- f instanceof Error ? f.message : "Unknown error"
767
+ } catch (u) {
768
+ const h = new we(
769
+ u instanceof Error ? u.message : "Unknown error"
770
770
  );
771
- x.markFailure(), i((w) => ({
772
- ...w,
773
- output: w.output.map(
774
- (h) => h.id === g.id ? { ...h, result: x } : h
771
+ h.markFailure(), o((x) => ({
772
+ ...x,
773
+ output: x.output.map(
774
+ (y) => y.id === g.id ? { ...y, result: h } : y
775
775
  )
776
776
  }));
777
777
  }
778
- }, [e, t.commandTimeoutMs, r]),
779
- clearHistory: v(async () => {
778
+ }, [e, n.commandTimeoutMs, s]),
779
+ clearHistory: w(async () => {
780
780
  try {
781
- await n.clear();
782
- } catch (a) {
783
- console.warn("Failed to clear history:", a);
781
+ await t.clear();
782
+ } catch (i) {
783
+ console.warn("Failed to clear history:", i);
784
784
  }
785
- }, [n])
785
+ }, [t])
786
786
  };
787
- return { state: s, actions: l };
788
- }, Oe = ({ onOpen: t, onClose: e, isVisible: n, showCitadelKey: r }) => {
789
- z(() => {
790
- const o = (s) => {
791
- var i, l;
792
- !n && s.key === r && !["input", "textarea"].includes(((l = (i = s.target) == null ? void 0 : i.tagName) == null ? void 0 : l.toLowerCase()) || "") && (s.preventDefault(), t()), n && s.key === "Escape" && (s.preventDefault(), e());
787
+ return { state: a, actions: c };
788
+ }, qe = ({ onOpen: n, onClose: e, isVisible: t, showCitadelKey: s }) => {
789
+ P(() => {
790
+ const r = (a) => {
791
+ var o, c;
792
+ !t && a.key === s && !["input", "textarea"].includes(((c = (o = a.target) == null ? void 0 : o.tagName) == null ? void 0 : c.toLowerCase()) || "") && (a.preventDefault(), n()), t && a.key === "Escape" && (a.preventDefault(), e());
793
793
  };
794
- return document.addEventListener("keydown", o), () => document.removeEventListener("keydown", o);
795
- }, [t, e, n, r]);
796
- }, Ke = "_panelContainer_1pav9_3", We = "_innerContainer_1pav9_19", qe = "_inputSection_1pav9_29", Be = "_resizeHandle_1pav9_36", Ye = "_citadel_slideUp_1pav9_65", Ve = "_citadel_slideDown_1pav9_69", Ge = "_inlineContainer_1pav9_73", ce = {
797
- panelContainer: Ke,
798
- innerContainer: We,
799
- inputSection: qe,
800
- resizeHandle: Be,
801
- citadel_slideUp: Ye,
802
- citadel_slideDown: Ve,
803
- inlineContainer: Ge
804
- }, Je = (t) => {
805
- const { isVisible: e, isClosing: n, onAnimationComplete: r } = t, o = M(() => e ? n ? ce.slideDown : ce.slideUp : "", [e, n]);
806
- return z(() => {
807
- if (r) {
808
- const i = setTimeout(() => {
809
- r();
794
+ return document.addEventListener("keydown", r), () => document.removeEventListener("keydown", r);
795
+ }, [n, e, t, s]);
796
+ }, Be = (n) => {
797
+ const { isVisible: e, isClosing: t, onAnimationComplete: s } = n, r = A(() => e ? t ? "citadel_slideDown" : "citadel_slideUp" : "", [e, t]);
798
+ return P(() => {
799
+ if (s) {
800
+ const o = setTimeout(() => {
801
+ s();
810
802
  }, 200);
811
- return () => clearTimeout(i);
803
+ return () => clearTimeout(o);
812
804
  }
813
- }, [n, r]), {
814
- style: M(() => ({
805
+ }, [t, s]), {
806
+ style: A(() => ({
815
807
  opacity: e ? 1 : 0,
816
- transform: e ? "translateY(0)" : n ? "translateY(100%)" : "translateY(-100%)",
808
+ transform: e ? "translateY(0)" : t ? "translateY(100%)" : "translateY(-100%)",
817
809
  transition: "opacity 200ms ease-in-out, transform 200ms ease-in-out"
818
- }), [e, n]),
819
- animationClass: o
810
+ }), [e, t]),
811
+ animationClass: r
820
812
  };
821
- }, Xe = () => /* @__PURE__ */ m(
813
+ }, Ve = () => /* @__PURE__ */ m(
822
814
  "div",
823
815
  {
824
816
  "data-testid": "spinner",
825
- className: "animate-spin rounded-full h-4 w-4 border-2 border-gray-300 border-t-gray-600"
817
+ className: "citadel-spinner"
826
818
  }
827
- ), Qe = /^text-(xs|sm|base|lg|xl|[2-9]xl|\[[^\]]+\])$/, Se = (t) => {
828
- const e = t == null ? void 0 : t.trim();
819
+ ), Ee = (n) => {
820
+ const e = n == null ? void 0 : n.trim();
829
821
  return e || void 0;
830
- }, Ze = (t) => {
831
- const e = Se(t);
832
- return e ? Qe.test(e) ? { className: e } : { style: { fontSize: e } } : {};
833
- }, Z = (t, e) => {
834
- const n = Se(t), r = Ze(e), o = {
835
- ...r.style
822
+ }, Ye = (n) => {
823
+ const e = Ee(n);
824
+ return e ? { style: { fontSize: e } } : {};
825
+ }, ee = (n, e) => {
826
+ const t = Ee(n), r = {
827
+ ...Ye(e).style
836
828
  };
837
- return n && (o.fontFamily = n), {
838
- className: r.className,
839
- style: Object.keys(o).length > 0 ? o : void 0
829
+ return t && (r.fontFamily = t), {
830
+ style: Object.keys(r).length > 0 ? r : void 0
840
831
  };
841
- }, en = ({
842
- command: t,
832
+ }, Je = ({
833
+ command: n,
843
834
  timestamp: e,
844
- status: n,
845
- fontFamily: r,
846
- fontSize: o
835
+ status: t,
836
+ fontFamily: s,
837
+ fontSize: r
847
838
  }) => {
848
- const s = M(
849
- () => Z(r, o ?? "text-sm"),
850
- [r, o]
839
+ const a = A(
840
+ () => ee(s, r ?? "0.875rem"),
841
+ [s, r]
851
842
  );
852
- return /* @__PURE__ */ E(
843
+ return /* @__PURE__ */ I(
853
844
  "div",
854
845
  {
855
- className: `flex items-center gap-2 ${s.className ?? ""}`.trim(),
856
- style: s.style,
846
+ className: "citadel-output-line",
847
+ style: a.style,
857
848
  children: [
858
- /* @__PURE__ */ E("span", { className: "text-gray-200", children: [
849
+ /* @__PURE__ */ I("span", { className: "citadel-output-command", children: [
859
850
  "> ",
860
- t.split(" ").map((i, l) => {
861
- const a = i.startsWith("<") && i.endsWith(">");
862
- return /* @__PURE__ */ E(
851
+ n.split(" ").map((o, c) => {
852
+ const i = o.startsWith("<") && o.endsWith(">");
853
+ return /* @__PURE__ */ I(
863
854
  "span",
864
855
  {
865
- className: a ? "text-green-400" : "text-gray-200",
856
+ className: i ? "citadel-output-command-arg" : "citadel-output-command-word",
866
857
  children: [
867
- l > 0 ? " " : "",
868
- i
858
+ c > 0 ? " " : "",
859
+ o
869
860
  ]
870
861
  },
871
- l
862
+ c
872
863
  );
873
864
  })
874
865
  ] }),
875
- /* @__PURE__ */ m("span", { className: "text-gray-400", children: "·" }),
876
- /* @__PURE__ */ m("span", { className: "text-gray-500", children: e }),
877
- n === W.Pending && /* @__PURE__ */ m(Xe, {}),
878
- n === W.Success && /* @__PURE__ */ m(
866
+ /* @__PURE__ */ m("span", { className: "citadel-output-separator", children: "·" }),
867
+ /* @__PURE__ */ m("span", { className: "citadel-output-timestamp", children: e }),
868
+ t === q.Pending && /* @__PURE__ */ m(Ve, {}),
869
+ t === q.Success && /* @__PURE__ */ m(
879
870
  "div",
880
871
  {
881
872
  "data-testid": "success-indicator",
882
- className: "w-4 h-4 rounded-full bg-green-500"
873
+ className: "citadel-status-dot citadel-status-dot-success"
883
874
  }
884
875
  ),
885
- (n === W.Timeout || n === W.Failure) && /* @__PURE__ */ m(
876
+ (t === q.Timeout || t === q.Failure) && /* @__PURE__ */ m(
886
877
  "div",
887
878
  {
888
879
  "data-testid": "success-indicator",
889
- className: "w-4 h-4 rounded-full bg-red-500"
880
+ className: "citadel-status-dot citadel-status-dot-failure"
890
881
  }
891
882
  )
892
883
  ]
893
884
  }
894
885
  );
895
- }, nn = ({ output: t, outputRef: e }) => {
896
- const n = j(), r = M(
897
- () => Z(n.fontFamily, n.outputFontSize ?? n.fontSize),
898
- [n.fontFamily, n.fontSize, n.outputFontSize]
899
- ), o = v(() => {
886
+ }, Ge = ({ output: n, outputRef: e }) => {
887
+ const t = j(), s = A(
888
+ () => ee(t.fontFamily, t.outputFontSize ?? t.fontSize),
889
+ [t.fontFamily, t.fontSize, t.outputFontSize]
890
+ ), r = w(() => {
900
891
  if (e.current) {
901
- const s = e.current;
892
+ const a = e.current;
902
893
  requestAnimationFrame(() => {
903
- s.scrollTop = s.scrollHeight;
894
+ a.scrollTop = a.scrollHeight;
904
895
  });
905
896
  }
906
897
  }, [e]);
907
- return z(() => {
908
- if (o(), e.current) {
909
- const s = e.current.getElementsByTagName("img"), i = s[s.length - 1];
910
- if (i && !i.complete)
911
- return i.addEventListener("load", o), () => i.removeEventListener("load", o);
898
+ return P(() => {
899
+ if (r(), e.current) {
900
+ const a = e.current.getElementsByTagName("img"), o = a[a.length - 1];
901
+ if (o && !o.complete)
902
+ return o.addEventListener("load", r), () => o.removeEventListener("load", r);
912
903
  }
913
- }, [t, o, e]), /* @__PURE__ */ m(
904
+ }, [n, r, e]), /* @__PURE__ */ m(
914
905
  "div",
915
906
  {
916
907
  ref: e,
917
- className: "h-full overflow-y-auto border border-gray-700 rounded-lg p-3 text-left",
908
+ className: "citadel-output",
918
909
  "data-testid": "citadel-command-output",
919
- children: t.map((s) => /* @__PURE__ */ E("div", { className: "mb-4 last:mb-0", children: [
910
+ children: n.map((a) => /* @__PURE__ */ I("div", { className: "citadel-output-item", children: [
920
911
  /* @__PURE__ */ m(
921
- en,
912
+ Je,
922
913
  {
923
- command: s.command.join(" "),
924
- timestamp: new Date(s.timestamp).toLocaleTimeString(),
925
- status: s.result.status,
926
- fontFamily: n.fontFamily,
927
- fontSize: n.fontSize
914
+ command: a.command.join(" "),
915
+ timestamp: new Date(a.timestamp).toLocaleTimeString(),
916
+ status: a.result.status,
917
+ fontFamily: t.fontFamily,
918
+ fontSize: t.fontSize
928
919
  }
929
920
  ),
930
921
  /* @__PURE__ */ m(
931
- "pre",
922
+ "div",
932
923
  {
933
- className: `text-gray-200 whitespace-pre ${r.className ?? ""}`.trim(),
934
- style: r.style,
935
- children: s.result.render()
924
+ className: "citadel-output-content",
925
+ style: s.style,
926
+ children: a.result.render()
936
927
  }
937
928
  )
938
- ] }, s.id))
929
+ ] }, a.id))
939
930
  }
940
931
  );
941
- }, tn = {
932
+ }, Qe = {
942
933
  blink: {
943
934
  character: "▋",
944
935
  speed: 530,
@@ -959,487 +950,510 @@ Check the definition of the ${a.join(".")} command and update the return type fo
959
950
  speed: 120,
960
951
  color: "#fff"
961
952
  }
962
- }, de = ["⠋", "⠙", "⠹", "⠸", "⠼", "⠴", "⠦", "⠧", "⠇", "⠏"], me = ["|", "/", "-", "\\"], rn = ({
963
- style: t = { type: "blink" },
953
+ }, he = ["⠋", "⠙", "⠹", "⠸", "⠼", "⠴", "⠦", "⠧", "⠇", "⠏"], ge = ["|", "/", "-", "\\"], Xe = ({
954
+ style: n = { type: "blink" },
964
955
  isValid: e = !0,
965
- errorMessage: n
956
+ errorMessage: t
966
957
  }) => {
967
- const r = M(() => ({
968
- ...tn[t.type],
969
- ...t
970
- }), [t]), [o, s] = I(!0), [i, l] = I(0);
971
- z(() => {
972
- if (r.speed === 0) return;
958
+ const s = A(() => ({
959
+ ...Qe[n.type],
960
+ ...n
961
+ }), [n]), [r, a] = _(!0), [o, c] = _(0);
962
+ P(() => {
963
+ if (s.speed === 0) return;
973
964
  const g = setInterval(() => {
974
- r.type === "blink" ? s((f) => !f) : ["spin", "bbs"].includes(r.type) && l((f) => (f + 1) % (r.type === "bbs" ? me.length : de.length));
975
- }, r.speed);
965
+ s.type === "blink" ? a((u) => !u) : ["spin", "bbs"].includes(s.type) && c((u) => (u + 1) % (s.type === "bbs" ? ge.length : he.length));
966
+ }, s.speed);
976
967
  return () => clearInterval(g);
977
- }, [r.type, r.speed]);
978
- const a = M(() => ({
979
- color: e ? r.color : "#ff4444",
968
+ }, [s.type, s.speed]);
969
+ const i = A(() => ({
970
+ color: e ? s.color : "#ff4444",
980
971
  transition: "color 0.15s ease-in-out"
981
- }), [e, r.color]);
982
- return /* @__PURE__ */ m("div", { className: "relative inline-block", children: /* @__PURE__ */ m(
972
+ }), [e, s.color]);
973
+ return /* @__PURE__ */ m("div", { className: "citadel-cursor-wrapper", children: /* @__PURE__ */ m(
983
974
  "span",
984
975
  {
985
976
  className: `command-cursor ${e ? "" : "animate-shake"}`,
986
- style: a,
987
- title: n,
988
- children: !e && n ? "✗" : ["spin", "bbs"].includes(r.type) ? (r.type === "bbs" ? me : de)[i] : r.type === "solid" || o ? r.character : " "
977
+ style: i,
978
+ title: t,
979
+ children: !e && t ? "✗" : ["spin", "bbs"].includes(s.type) ? (s.type === "bbs" ? ge : he)[o] : s.type === "solid" || r ? s.character : " "
989
980
  }
990
981
  ) });
991
982
  };
992
- function on(t, e) {
983
+ function Ze(n, e) {
993
984
  switch (e.type) {
994
985
  case "set":
995
- return k.debug(`[inputStateReducer] InputState changing from ${t} to ${e.state}`), e.state;
986
+ return k.debug(`[inputStateReducer] InputState changing from ${n} to ${e.state}`), e.state;
996
987
  default:
997
- return t;
998
- }
999
- }
1000
- const sn = () => {
1001
- const { state: t } = ae(), e = Q(), n = Ce(), r = B(), [o, s] = Ie(on, "idle"), i = (d) => {
1002
- s({ type: "set", state: d });
1003
- }, l = v(() => {
1004
- const u = e.getCompletions(r.path())[0] || r.nullSegment;
1005
- return k.debug("[getNextExpectedSegment] ", u), u;
1006
- }, [e, r]), a = v(() => e.getCompletionNames(r.path()).map((u) => e.getCommand([...r.path(), u])).filter((u) => u !== void 0), [e, r]), c = v((d, u) => {
1007
- if (!d) return u;
1008
- const p = r.path().length;
1009
- return u.filter((R) => {
1010
- const C = R.segments[p];
1011
- return !C || C.type !== "word" ? !1 : C.name.toLowerCase().startsWith(d.toLowerCase());
988
+ return n;
989
+ }
990
+ }
991
+ const et = () => {
992
+ const { state: n } = de(), e = Z(), t = ke(), s = V(), [r, a] = _e(Ze, "idle"), o = (l) => {
993
+ a({ type: "set", state: l });
994
+ }, c = w(() => {
995
+ const p = e.getCompletions(s.path())[0] || s.nullSegment;
996
+ return k.debug("[getNextExpectedSegment] ", p), p;
997
+ }, [e, s]), i = w(() => e.getCompletionNames(s.path()).map((p) => e.getCommand([...s.path(), p])).filter((p) => p !== void 0), [e, s]), d = w((l, p) => {
998
+ if (!l) return p;
999
+ const C = s.path().length;
1000
+ return p.filter((M) => {
1001
+ const S = M.segments[C];
1002
+ return !S || S.type !== "word" ? !1 : S.name.toLowerCase().startsWith(l.toLowerCase());
1012
1003
  });
1013
- }, [r]), g = v((d) => {
1014
- const u = e.getUniqueCompletion(r.path(), d);
1015
- return u && u.type === "word" ? u : r.nullSegment;
1016
- }, [e, r]), f = v((d) => {
1017
- const u = r.path(), p = e.getCompletions(u);
1018
- return p.length === 0 && d ? !1 : p.some((C) => C.type === "argument") ? !0 : e.getMatchingCompletions(u, d).some((C) => C.type === "word");
1019
- }, [e, r]), x = v((d) => {
1020
- k.debug("[tryAutoComplete] input: ", d);
1021
- const u = g(d);
1022
- return !u || u.type === "null" ? new se() : (k.debug("[tryAutoComplete] result: ", u), u);
1023
- }, [g]), w = v((d, u) => {
1024
- if (t.history.position !== null)
1004
+ }, [s]), g = w((l) => {
1005
+ const p = e.getUniqueCompletion(s.path(), l);
1006
+ return p && p.type === "word" ? p : s.nullSegment;
1007
+ }, [e, s]), u = w((l) => {
1008
+ const p = s.path(), C = e.getCompletions(p);
1009
+ return C.length === 0 && l ? !1 : C.some((S) => S.type === "argument") ? !0 : e.getMatchingCompletions(p, l).some((S) => S.type === "word");
1010
+ }, [e, s]), h = w((l) => {
1011
+ k.debug("[tryAutoComplete] input: ", l);
1012
+ const p = g(l);
1013
+ return !p || p.type === "null" ? new le() : (k.debug("[tryAutoComplete] result: ", p), p);
1014
+ }, [g]), x = w((l, p) => {
1015
+ if (n.history.position !== null)
1025
1016
  return;
1026
- u.setCurrentInput(d), k.debug("[useCommandParser][handleInputChange] newValue: ", d);
1027
- const p = l();
1028
- if (p.type === "argument" || o === "entering_argument") {
1029
- const A = ue(d);
1030
- if (A.isQuoted)
1031
- if (A.isComplete) {
1032
- if (!(p instanceof $)) return;
1033
- p.value = d.trim() || "", k.debug("[useCommandParser][handleInputChange][entering_command] pushing: ", p), r.push(p), u.setCurrentInput(""), i("idle");
1017
+ p.setCurrentInput(l), k.debug("[useCommandParser][handleInputChange] newValue: ", l);
1018
+ const C = c();
1019
+ if (C.type === "argument" || r === "entering_argument") {
1020
+ const H = fe(l);
1021
+ if (H.isQuoted)
1022
+ if (H.isComplete) {
1023
+ if (!(C instanceof O)) return;
1024
+ C.value = l.trim() || "", k.debug("[useCommandParser][handleInputChange][entering_command] pushing: ", C), s.push(C), p.setCurrentInput(""), o("idle");
1034
1025
  return;
1035
1026
  } else
1036
1027
  return;
1037
- else if (A.isComplete) {
1038
- if (!(p instanceof $)) return;
1039
- p.value = d.trim() || "", k.debug("[useCommandParser][handleInputChange][entering_command] pushing: ", p), r.push(p), u.setCurrentInput(""), i("idle");
1028
+ else if (H.isComplete) {
1029
+ if (!(C instanceof O)) return;
1030
+ C.value = l.trim() || "", k.debug("[useCommandParser][handleInputChange][entering_command] pushing: ", C), s.push(C), p.setCurrentInput(""), o("idle");
1040
1031
  return;
1041
1032
  } else
1042
1033
  return;
1043
1034
  }
1044
- if (d.endsWith(" ")) {
1045
- const A = d.trim().toLowerCase(), P = e.getCompletions(r.path()).filter(
1046
- (y) => y.type === "word" && y.name.toLowerCase() === A
1035
+ if (l.endsWith(" ")) {
1036
+ const H = l.trim().toLowerCase(), T = e.getCompletions(s.path()).filter(
1037
+ (b) => b.type === "word" && b.name.toLowerCase() === H
1047
1038
  );
1048
- if (P.length === 1) {
1049
- r.push(P[0]), u.setCurrentInput(""), i("idle");
1039
+ if (T.length === 1) {
1040
+ s.push(T[0]), p.setCurrentInput(""), o("idle");
1050
1041
  return;
1051
1042
  }
1052
1043
  }
1053
- const C = x(d);
1054
- if (C.type === "word") {
1055
- k.debug("[useCommandParser][handleInputChange][entering_command] pushing: ", C), r.push(C), u.setCurrentInput(""), i("idle");
1044
+ const S = h(l);
1045
+ if (S.type === "word") {
1046
+ k.debug("[useCommandParser][handleInputChange][entering_command] pushing: ", S), s.push(S), p.setCurrentInput(""), o("idle");
1056
1047
  return;
1057
1048
  }
1058
- }, [x, t, l, o, r, e]), h = v((d) => {
1059
- d.setCurrentInput(""), d.setIsEnteringArg(!1), r.clear(), i("idle");
1060
- }, [r]), S = v((d, u, p) => {
1061
- if (!(d.key === "Backspace" || d.key === "Enter" || d.key === "ArrowUp" || d.key === "ArrowDown" || d.key === "ArrowLeft" || d.key === "ArrowRight" || d.key === "Escape" || d.key === "Delete" || d.key === "Home" || d.key === "End" || d.key.length === 1))
1049
+ }, [h, n, c, r, s, e]), y = w((l) => {
1050
+ l.setCurrentInput(""), l.setIsEnteringArg(!1), s.clear(), o("idle");
1051
+ }, [s]), v = w((l, p, C) => {
1052
+ if (!(l.key === "Backspace" || l.key === "Enter" || l.key === "ArrowUp" || l.key === "ArrowDown" || l.key === "ArrowLeft" || l.key === "ArrowRight" || l.key === "Escape" || l.key === "Delete" || l.key === "Home" || l.key === "End" || l.key.length === 1))
1062
1053
  return !0;
1063
- const { currentInput: C, isEnteringArg: A } = u, P = ue(C);
1064
- switch (d.key) {
1054
+ const { currentInput: S, isEnteringArg: H } = p, T = fe(S);
1055
+ switch (l.key) {
1065
1056
  case "Backspace":
1066
- return C === "" && (d.preventDefault(), r.size() > 0 && r.pop(), i("idle")), !0;
1057
+ return S === "" && (l.preventDefault(), s.size() > 0 && s.pop(), o("idle")), !0;
1067
1058
  case "Enter": {
1068
- if (d.preventDefault(), P.isQuoted && !P.isComplete)
1059
+ if (l.preventDefault(), T.isQuoted && !T.isComplete)
1069
1060
  return !0;
1070
- if (o === "entering_argument" || A && C.trim()) {
1071
- const T = l();
1072
- T instanceof $ && (T.value = C, k.debug("[handleKeyDown][Enter]['entering_argument'] pushing: ", T), r.push(T));
1061
+ if (r === "entering_argument" || H && S.trim()) {
1062
+ const F = c();
1063
+ F instanceof O && (F.value = S, k.debug("[handleKeyDown][Enter]['entering_argument'] pushing: ", F), s.push(F));
1073
1064
  }
1074
- const y = r.path(), _ = e.getCommand(y);
1075
- if (!_)
1065
+ const b = s.path(), te = e.getCommand(b);
1066
+ if (!te)
1076
1067
  return !1;
1077
- const D = _.segments.filter((T) => T.type === "argument"), K = r.arguments;
1078
- return D.length > K.length ? !1 : (k.debug("[handleKeyDown][Enter] calling actions.executeCommand. segmentStack: ", r), p.executeCommand(), n.addStoredCommand(r.toArray()), h(p), !0);
1068
+ const K = te.segments.filter((F) => F.type === "argument"), ne = s.arguments;
1069
+ return K.length > ne.length ? !1 : (k.debug("[handleKeyDown][Enter] calling actions.executeCommand. segmentStack: ", s), C.executeCommand(), t.addStoredCommand(s.toArray()), y(C), !0);
1079
1070
  }
1080
1071
  case "ArrowUp":
1081
- return d.preventDefault(), (async () => {
1082
- const y = await n.navigateHistory("up");
1083
- return y.segments && (r.clear(), r.pushAll(y.segments), p.setCurrentInput("")), !0;
1072
+ return l.preventDefault(), (async () => {
1073
+ const b = await t.navigateHistory("up");
1074
+ return b.segments && (s.clear(), s.pushAll(b.segments), C.setCurrentInput("")), !0;
1084
1075
  })();
1085
1076
  case "ArrowDown":
1086
- return d.preventDefault(), (async () => {
1087
- const y = await n.navigateHistory("down");
1088
- return y.segments && (r.clear(), r.pushAll(y.segments), p.setCurrentInput("")), !0;
1077
+ return l.preventDefault(), (async () => {
1078
+ const b = await t.navigateHistory("down");
1079
+ return b.segments && (s.clear(), s.pushAll(b.segments), C.setCurrentInput("")), !0;
1089
1080
  })();
1090
1081
  default: {
1091
- if (!A && d.key.length === 1) {
1092
- const y = C + d.key;
1093
- if (!f(y))
1094
- return d.preventDefault(), !1;
1082
+ if (!H && l.key.length === 1) {
1083
+ const b = S + l.key;
1084
+ if (!u(b))
1085
+ return l.preventDefault(), !1;
1095
1086
  }
1096
1087
  return !0;
1097
1088
  }
1098
1089
  }
1099
1090
  }, [
1100
- o,
1101
- f,
1102
- l,
1103
- n,
1104
- h,
1091
+ r,
1092
+ u,
1093
+ c,
1094
+ t,
1095
+ y,
1105
1096
  e,
1106
- r
1097
+ s
1107
1098
  ]);
1108
1099
  return {
1109
- handleInputChange: w,
1110
- handleKeyDown: S,
1111
- inputState: o,
1112
- setInputStateWithLogging: i,
1100
+ handleInputChange: x,
1101
+ handleKeyDown: v,
1102
+ inputState: r,
1103
+ setInputStateWithLogging: o,
1113
1104
  // Expose internal functions for testing
1114
- findMatchingCommands: c,
1105
+ findMatchingCommands: d,
1115
1106
  getAutocompleteSuggestion: g,
1116
- getAvailableNodes: a,
1117
- getNextExpectedSegment: l,
1118
- isValidCommandInput: f
1107
+ getAvailableNodes: i,
1108
+ getNextExpectedSegment: c,
1109
+ isValidCommandInput: u
1119
1110
  };
1120
1111
  };
1121
- function ue(t) {
1112
+ function fe(n) {
1122
1113
  const e = [];
1123
- let n = "", r = !1, o;
1124
- for (let s = 0; s < t.length; s++) {
1125
- const i = t[s];
1126
- (i === '"' || i === "'") && (!r || i === o) ? r ? (e.push(n), n = "", r = !1, o = void 0) : (n && (e.push(n), n = ""), r = !0, o = i) : !r && i === " " ? n && (e.push(n), n = "") : n += i;
1114
+ let t = "", s = !1, r;
1115
+ for (let a = 0; a < n.length; a++) {
1116
+ const o = n[a];
1117
+ (o === '"' || o === "'") && (!s || o === r) ? s ? (e.push(t), t = "", s = !1, r = void 0) : (t && (e.push(t), t = ""), s = !0, r = o) : !s && o === " " ? t && (e.push(t), t = "") : t += o;
1127
1118
  }
1128
1119
  return {
1129
1120
  words: e,
1130
- currentWord: n,
1131
- isQuoted: r,
1132
- quoteChar: o,
1133
- isComplete: !r && !n
1121
+ currentWord: t,
1122
+ isQuoted: s,
1123
+ quoteChar: r,
1124
+ isComplete: !s && !t
1134
1125
  };
1135
1126
  }
1136
- const an = () => {
1137
- const t = B(), [e, n] = I(0);
1138
- return z(() => {
1139
- const r = {
1127
+ const tt = () => {
1128
+ const n = V(), [e, t] = _(0);
1129
+ return P(() => {
1130
+ const s = {
1140
1131
  update: () => {
1141
- n((o) => o + 1);
1132
+ t((r) => r + 1);
1142
1133
  }
1143
1134
  };
1144
- return t.subscribe(r), () => {
1145
- t.unsubscribe(r);
1135
+ return n.subscribe(s), () => {
1136
+ n.unsubscribe(s);
1146
1137
  };
1147
- }, [t]), e;
1148
- }, ln = ({
1149
- state: t,
1138
+ }, [n]), e;
1139
+ }, nt = ({
1140
+ state: n,
1150
1141
  actions: e
1151
1142
  }) => {
1152
- const n = F(null), r = Q(), o = B(), {
1153
- handleKeyDown: s,
1154
- handleInputChange: i,
1155
- inputState: l,
1156
- setInputStateWithLogging: a,
1157
- getNextExpectedSegment: c
1158
- } = sn(), [g, f] = I(!1), x = j(), w = an(), h = M(
1159
- () => Z(x.fontFamily, x.fontSize),
1160
- [x.fontFamily, x.fontSize]
1161
- ), S = async (y) => {
1162
- const _ = s(y, t, e);
1163
- await Promise.resolve(_) === !1 && (f(!0), setTimeout(() => f(!1), 500));
1164
- }, d = (y) => {
1165
- i(y.target.value, e);
1166
- }, u = (y) => {
1167
- y.preventDefault();
1168
- const _ = y.clipboardData.getData("text");
1169
- i(_, e);
1170
- };
1171
- z(() => {
1172
- n.current && n.current.focus(), l !== "entering_command" && a("entering_command");
1173
- }, [l, a]), z(() => {
1174
- if (l !== "idle") return;
1175
- const y = c();
1176
- let _ = "idle";
1177
- switch (y.type) {
1143
+ const t = z(null), s = Z(), r = V(), {
1144
+ handleKeyDown: a,
1145
+ handleInputChange: o,
1146
+ inputState: c,
1147
+ setInputStateWithLogging: i,
1148
+ getNextExpectedSegment: d
1149
+ } = et(), [g, u] = _(!1), h = j(), x = tt(), y = z(null), [v, l] = _(0), p = A(
1150
+ () => ee(h.fontFamily, h.fontSize),
1151
+ [h.fontFamily, h.fontSize]
1152
+ ), C = w(async (E) => {
1153
+ const R = a(E, n, e);
1154
+ await Promise.resolve(R) === !1 && (u(!0), setTimeout(() => u(!1), 500));
1155
+ }, [e, a, n]), M = w((E) => {
1156
+ o(E.target.value, e);
1157
+ }, [e, o]), S = w((E) => {
1158
+ E.preventDefault();
1159
+ const R = E.clipboardData.getData("text");
1160
+ o(R, e);
1161
+ }, [e, o]);
1162
+ P(() => {
1163
+ t.current && t.current.focus(), c !== "entering_command" && i("entering_command");
1164
+ }, [c, i]), P(() => {
1165
+ if (c !== "idle") return;
1166
+ const E = d();
1167
+ let R = "idle";
1168
+ switch (E.type) {
1178
1169
  case "word":
1179
- _ = "entering_command", e.setIsEnteringArg(!1);
1170
+ R = "entering_command", e.setIsEnteringArg(!1);
1180
1171
  break;
1181
1172
  case "argument":
1182
- _ = "entering_argument", e.setIsEnteringArg(!0);
1173
+ R = "entering_argument", e.setIsEnteringArg(!0);
1183
1174
  break;
1184
1175
  }
1185
- a(_);
1186
- }, [w, l, c, a, e]);
1187
- const p = M(() => {
1188
- const y = [], _ = o.toArray().map((D, K) => {
1189
- y.push(D.name);
1190
- const T = r.hasNextSegment(y);
1191
- if (D.type === "argument") {
1192
- const ee = D;
1193
- return /* @__PURE__ */ E(L.Fragment, { children: [
1194
- /* @__PURE__ */ m("span", { className: "text-gray-200 whitespace-pre", children: ee.value }),
1195
- K < o.size() && T && /* @__PURE__ */ m("span", { className: "text-gray-200 whitespace-pre", children: " " })
1196
- ] }, "arg-" + ee.name + ee.value);
1176
+ i(R);
1177
+ }, [x, c, d, i, e]);
1178
+ const H = A(() => {
1179
+ const E = [], R = r.toArray().map((L, se) => {
1180
+ E.push(L.name);
1181
+ const me = s.hasNextSegment(E);
1182
+ if (L.type === "argument") {
1183
+ const re = L;
1184
+ return /* @__PURE__ */ I(U.Fragment, { children: [
1185
+ /* @__PURE__ */ m("span", { className: "citadel-input-segment-arg", children: re.value }),
1186
+ se < r.size() && me && /* @__PURE__ */ m("span", { className: "citadel-input-segment-space", children: " " })
1187
+ ] }, "arg-" + re.name + re.value);
1197
1188
  }
1198
- return /* @__PURE__ */ E(L.Fragment, { children: [
1199
- /* @__PURE__ */ m("span", { className: "text-blue-400 whitespace-pre", children: D.name }),
1200
- K < o.size() && T && /* @__PURE__ */ m("span", { className: "text-blue-400 whitespace-pre", children: " " })
1201
- ] }, "word-" + D.name);
1189
+ return /* @__PURE__ */ I(U.Fragment, { children: [
1190
+ /* @__PURE__ */ m("span", { className: "citadel-input-segment-word", children: L.name }),
1191
+ se < r.size() && me && /* @__PURE__ */ m("span", { className: "citadel-input-segment-space citadel-input-segment-space-command", children: " " })
1192
+ ] }, "word-" + L.name);
1202
1193
  });
1203
- return [/* @__PURE__ */ m("div", { className: "flex items-center gap-1", "data-testid": "user-input-area", children: _ }, w)];
1204
- }, [w, r, o]), [R, C] = I("");
1205
- z(() => {
1206
- const y = c();
1207
- y.type === "argument" ? C(y.name) : C("");
1208
- }, [w, c]);
1209
- const A = !t.isEnteringArg, P = t.currentInput.length;
1210
- return /* @__PURE__ */ E("div", { className: "flex flex-col w-full bg-gray-900 rounded-lg p-4", children: [
1211
- /* @__PURE__ */ m("style", { children: `
1212
- @keyframes subtleGlow {
1213
- 0%, 100% { box-shadow: 0 0 0 rgba(239, 68, 68, 0); }
1214
- 50% { box-shadow: 0 0 8px rgba(239, 68, 68, 0.6); }
1215
- }
1216
- .invalid-input-animation {
1217
- animation: subtleGlow 0.4s ease-in-out;
1218
- }
1219
- ` }),
1220
- /* @__PURE__ */ E(
1221
- "div",
1222
- {
1223
- className: `flex items-center gap-2 ${h.className ?? ""}`.trim(),
1224
- style: h.style,
1225
- children: [
1226
- /* @__PURE__ */ m("div", { className: "text-gray-400", children: ">" }),
1227
- /* @__PURE__ */ E("div", { className: "flex-1 flex items-center", children: [
1228
- p,
1229
- /* @__PURE__ */ E("div", { className: "relative flex-1", children: [
1230
- /* @__PURE__ */ m(
1231
- "input",
1232
- {
1233
- ref: n,
1234
- type: "text",
1235
- role: "textbox",
1236
- value: t.currentInput,
1237
- onChange: d,
1238
- onKeyDown: S,
1239
- onPaste: u,
1240
- "data-testid": "citadel-command-input",
1241
- className: `w-full bg-transparent outline-none caret-transparent ${A ? "text-blue-400" : "text-gray-200"} ${g ? "invalid-input-animation" : ""}`,
1242
- spellCheck: !1,
1243
- autoComplete: "off",
1244
- placeholder: R
1245
- }
1246
- ),
1247
- /* @__PURE__ */ m(
1248
- "div",
1249
- {
1250
- className: "absolute top-0 pointer-events-none",
1251
- style: {
1252
- left: `${P}ch`,
1253
- transition: "left 0.05s ease-out"
1254
- },
1255
- children: /* @__PURE__ */ m(
1256
- rn,
1257
- {
1258
- style: {
1259
- type: x.cursorType ?? N.cursorType,
1260
- color: x.cursorColor || N.cursorColor,
1261
- speed: x.cursorSpeed || N.cursorSpeed
1262
- }
1263
- }
1264
- )
1265
- }
1266
- )
1267
- ] })
1194
+ return [/* @__PURE__ */ m("div", { className: "citadel-input-segments", "data-testid": "user-input-area", children: R }, x)];
1195
+ }, [x, s, r]), [T, b] = _("");
1196
+ P(() => {
1197
+ const E = d();
1198
+ E.type === "argument" ? b(E.name) : b("");
1199
+ }, [x, d]);
1200
+ const K = !n.isEnteringArg ? "is-command-mode" : "is-argument-mode", ne = A(
1201
+ () => ({
1202
+ left: `${v}px`,
1203
+ transition: "left 0.05s ease-out"
1204
+ }),
1205
+ [v]
1206
+ ), F = A(
1207
+ () => ({
1208
+ type: h.cursorType ?? N.cursorType,
1209
+ color: h.cursorColor || N.cursorColor,
1210
+ speed: h.cursorSpeed || N.cursorSpeed
1211
+ }),
1212
+ [h.cursorColor, h.cursorSpeed, h.cursorType]
1213
+ );
1214
+ return Me(() => {
1215
+ const E = y.current, R = t.current;
1216
+ if (!E || !R) {
1217
+ l(0);
1218
+ return;
1219
+ }
1220
+ const L = E.getBoundingClientRect().width;
1221
+ l(Math.max(0, L - R.scrollLeft));
1222
+ }, [n.currentInput, K, p.style]), /* @__PURE__ */ m("div", { className: "citadel-input-shell", children: /* @__PURE__ */ I(
1223
+ "div",
1224
+ {
1225
+ className: "citadel-input-line",
1226
+ style: p.style,
1227
+ children: [
1228
+ /* @__PURE__ */ m("div", { className: "citadel-input-prompt", children: ">" }),
1229
+ /* @__PURE__ */ I("div", { className: "citadel-input-row", children: [
1230
+ H,
1231
+ /* @__PURE__ */ I("div", { className: "citadel-input-control", children: [
1232
+ /* @__PURE__ */ m(
1233
+ "span",
1234
+ {
1235
+ ref: y,
1236
+ className: `citadel-input-measure ${K}`.trim(),
1237
+ "aria-hidden": "true",
1238
+ children: n.currentInput
1239
+ }
1240
+ ),
1241
+ /* @__PURE__ */ m(
1242
+ "input",
1243
+ {
1244
+ ref: t,
1245
+ type: "text",
1246
+ role: "textbox",
1247
+ value: n.currentInput,
1248
+ onChange: M,
1249
+ onKeyDown: C,
1250
+ onPaste: S,
1251
+ "data-testid": "citadel-command-input",
1252
+ className: `citadel-input-field ${K} ${g ? "invalid-input-animation" : ""}`.trim(),
1253
+ spellCheck: !1,
1254
+ autoComplete: "off",
1255
+ placeholder: T
1256
+ }
1257
+ ),
1258
+ /* @__PURE__ */ m(
1259
+ "div",
1260
+ {
1261
+ className: "citadel-input-cursor",
1262
+ style: ne,
1263
+ children: /* @__PURE__ */ m(Xe, { style: F })
1264
+ }
1265
+ )
1268
1266
  ] })
1269
- ]
1270
- }
1271
- )
1272
- ] });
1273
- }, cn = ({ currentInput: t = "" }) => {
1274
- const e = Q(), n = j(), r = B(), o = L.useMemo(
1275
- () => Z(n.fontFamily, n.fontSize),
1276
- [n.fontFamily, n.fontSize]
1277
- ), s = "mt-2 border-t border-gray-700 px-4 py-2", i = `text-gray-300 ${o.className ?? ""}`.trim(), l = t.trim().toLowerCase(), a = e.getMatchingCompletions(
1278
- r.path(),
1279
- l
1267
+ ] })
1268
+ ]
1269
+ }
1270
+ ) });
1271
+ }, st = ({ currentInput: n = "" }) => {
1272
+ const e = Z(), t = j(), s = V(), r = U.useMemo(
1273
+ () => ee(t.fontFamily, t.fontSize),
1274
+ [t.fontFamily, t.fontSize]
1275
+ ), a = n.trim().toLowerCase(), o = e.getMatchingCompletions(
1276
+ s.path(),
1277
+ a
1280
1278
  );
1281
- k.debug("[AvailableCommands] nextCommandSegments: ", a);
1282
- const c = L.useMemo(() => {
1283
- const w = [...a], h = (p) => p.name.toLowerCase() === "help", S = w.filter(h);
1284
- return [...w.filter((p) => !h(p)).sort(
1285
- (p, R) => p.name.localeCompare(R.name, void 0, { sensitivity: "base" })
1286
- ), ...S];
1287
- }, [a]), g = L.useMemo(() => {
1288
- const w = /* @__PURE__ */ new Map();
1279
+ k.debug("[AvailableCommands] nextCommandSegments: ", o);
1280
+ const c = U.useMemo(() => {
1281
+ const u = [...o], h = (l) => l.name.toLowerCase() === "help", x = u.filter(h);
1282
+ return [...u.filter((l) => !h(l)).sort(
1283
+ (l, p) => l.name.localeCompare(p.name, void 0, { sensitivity: "base" })
1284
+ ), ...x];
1285
+ }, [o]), i = U.useMemo(() => {
1286
+ const u = /* @__PURE__ */ new Map();
1289
1287
  for (const h of c) {
1290
- const S = c.reduce((d, u) => {
1291
- if (u === h) return d;
1292
- let p = 0;
1293
- for (; p < h.name.length && p < u.name.length && h.name[p].toLowerCase() === u.name[p].toLowerCase(); )
1294
- p++;
1295
- return Math.max(d, p + 1);
1288
+ const x = c.reduce((y, v) => {
1289
+ if (v === h) return y;
1290
+ let l = 0;
1291
+ for (; l < h.name.length && l < v.name.length && h.name[l].toLowerCase() === v.name[l].toLowerCase(); )
1292
+ l++;
1293
+ return Math.max(y, l + 1);
1296
1294
  }, 1);
1297
- w.set(h.name, S);
1295
+ u.set(h.name, x);
1298
1296
  }
1299
- return w;
1300
- }, [c]), f = a.some((w) => w.type === "argument"), x = a[0];
1301
- return /* @__PURE__ */ m("div", { className: s, "data-testid": "available-commands", children: /* @__PURE__ */ m("div", { className: i, style: o.style, children: f ? a.length > 0 ? /* @__PURE__ */ E(Ae, { children: [
1302
- /* @__PURE__ */ m("span", { className: "text-blue-400", children: x.name }),
1303
- x.description && /* @__PURE__ */ E("span", { className: "text-gray-400 ml-2", children: [
1297
+ return u;
1298
+ }, [c]), d = o.some((u) => u.type === "argument"), g = o[0];
1299
+ return /* @__PURE__ */ m("div", { className: "citadel-available-commands", "data-testid": "available-commands", children: /* @__PURE__ */ m("div", { className: "citadel-available-commands-content", style: r.style, children: d ? o.length > 0 ? /* @__PURE__ */ I(He, { children: [
1300
+ /* @__PURE__ */ m("span", { className: "citadel-available-next-arg", children: g.name }),
1301
+ g.description && /* @__PURE__ */ I("span", { className: "citadel-available-next-desc", children: [
1304
1302
  "- ",
1305
- x.description
1303
+ g.description
1306
1304
  ] })
1307
- ] }) : null : /* @__PURE__ */ m("div", { className: "flex flex-wrap gap-2", children: c == null ? void 0 : c.map((w) => {
1308
- const h = g.get(w.name) ?? 1;
1305
+ ] }) : null : /* @__PURE__ */ m("div", { className: "citadel-available-chip-list", children: c == null ? void 0 : c.map((u) => {
1306
+ const h = i.get(u.name) ?? 1;
1309
1307
  return /* @__PURE__ */ m(
1310
1308
  "div",
1311
1309
  {
1312
1310
  "data-testid": "available-command-chip",
1313
- className: "px-2 py-1 rounded bg-gray-800 mr-2 last:mr-0",
1314
- children: /* @__PURE__ */ E("span", { className: "text-white", children: [
1315
- /* @__PURE__ */ m("strong", { className: "underline", children: w.name.slice(0, h) }),
1316
- w.name.slice(h)
1311
+ className: "citadel-available-chip",
1312
+ children: /* @__PURE__ */ I("span", { className: "citadel-available-chip-text", children: [
1313
+ /* @__PURE__ */ m("strong", { className: "citadel-available-chip-prefix", children: u.name.slice(0, h) }),
1314
+ u.name.slice(h)
1317
1315
  ] })
1318
1316
  },
1319
- w.name
1317
+ u.name
1320
1318
  );
1321
1319
  }) }) }) });
1322
- }, ke = ({
1323
- state: t,
1320
+ }, Ne = ({
1321
+ state: n,
1324
1322
  actions: e,
1325
- outputRef: n
1323
+ outputRef: t
1326
1324
  }) => {
1327
- const o = j().displayMode === "inline";
1328
- return /* @__PURE__ */ E("div", { className: "innerContainer", children: [
1325
+ const r = j().displayMode === "inline", a = U.useMemo(
1326
+ () => r ? { overflow: "hidden" } : void 0,
1327
+ [r]
1328
+ );
1329
+ return /* @__PURE__ */ I("div", { className: "innerContainer citadel-tty", children: [
1329
1330
  /* @__PURE__ */ m(
1330
1331
  "div",
1331
1332
  {
1332
- className: "flex-1 min-h-0 pt-3 px-4",
1333
+ className: "citadel-tty-output-pane",
1333
1334
  "data-testid": "citadel-output-pane",
1334
- style: o ? { overflow: "hidden" } : void 0,
1335
- children: /* @__PURE__ */ m(nn, { output: t.output, outputRef: n })
1335
+ style: a,
1336
+ children: /* @__PURE__ */ m(Ge, { output: n.output, outputRef: t })
1336
1337
  }
1337
1338
  ),
1338
- /* @__PURE__ */ E("div", { className: "shrink-0", children: [
1339
- /* @__PURE__ */ m(ln, { state: t, actions: e }),
1340
- /* @__PURE__ */ m(cn, { currentInput: t.isEnteringArg ? "" : t.currentInput })
1339
+ /* @__PURE__ */ I("div", { className: "citadel-tty-input-region", children: [
1340
+ /* @__PURE__ */ m(nt, { state: n, actions: e }),
1341
+ /* @__PURE__ */ m(st, { currentInput: n.isEnteringArg ? "" : n.currentInput })
1341
1342
  ] })
1342
1343
  ] });
1343
- }, dn = () => {
1344
- const [t, e] = I(!1), [n, r] = I(!1), o = j(), [s, i] = I(() => o.initialHeight || null), l = F(null), a = F(null), c = F(!1), g = F(0), f = F(0), { state: x, actions: w } = ae();
1345
- Oe({
1344
+ }, rt = () => {
1345
+ const [n, e] = _(!1), [t, s] = _(!1), r = j(), [a, o] = _(() => r.initialHeight || null), c = z(null), i = z(null), d = z(!1), g = z(0), u = z(0), { state: h, actions: x } = de();
1346
+ qe({
1346
1347
  onOpen: () => e(!0),
1347
- onClose: () => r(!0),
1348
- isVisible: t,
1349
- showCitadelKey: o.showCitadelKey || "."
1348
+ onClose: () => s(!0),
1349
+ isVisible: n,
1350
+ showCitadelKey: r.showCitadelKey || "."
1350
1351
  });
1351
- const h = v((p) => {
1352
- var P;
1353
- if (!c.current) return;
1354
- const R = p.clientY - g.current, C = (P = o.maxHeight) != null && P.endsWith("vh") ? window.innerHeight * parseInt(o.maxHeight, 10) / 100 : parseInt(o.maxHeight || "80vh", 10), A = Math.min(
1355
- Math.max(f.current - R, parseInt(o.minHeight || "200", 10)),
1356
- C
1352
+ const y = w((M) => {
1353
+ var b;
1354
+ if (!d.current) return;
1355
+ const S = M.clientY - g.current, H = (b = r.maxHeight) != null && b.endsWith("vh") ? window.innerHeight * parseInt(r.maxHeight, 10) / 100 : parseInt(r.maxHeight || "80vh", 10), T = Math.min(
1356
+ Math.max(u.current - S, parseInt(r.minHeight || "200", 10)),
1357
+ H
1357
1358
  );
1358
- a.current && (a.current.style.height = `${A}px`, a.current.style.bottom = "0", i(`${A}px`));
1359
- }, [o.maxHeight, o.minHeight]), S = v(() => {
1360
- c.current = !1, document.documentElement.style.userSelect = "", document.documentElement.style.webkitUserSelect = "", document.documentElement.style.mozUserSelect = "", document.documentElement.style.msUserSelect = "", document.removeEventListener("mousemove", h), document.removeEventListener("mouseup", S);
1361
- }, [h]), d = v((p) => {
1362
- a.current && (c.current = !0, g.current = p.clientY, f.current = a.current.offsetHeight, document.documentElement.style.userSelect = "none", document.documentElement.style.webkitUserSelect = "none", document.documentElement.style.mozUserSelect = "none", document.documentElement.style.msUserSelect = "none", document.addEventListener("mousemove", h), document.addEventListener("mouseup", S));
1363
- }, [h, S]);
1364
- z(() => () => {
1365
- document.removeEventListener("mousemove", h), document.removeEventListener("mouseup", S);
1366
- }, [h, S]);
1367
- const u = v(() => {
1368
- n && (e(!1), r(!1));
1369
- }, [n]);
1370
- return Je({
1371
- isVisible: t,
1372
- isClosing: n,
1373
- onAnimationComplete: u
1374
- }), t ? /* @__PURE__ */ E(
1359
+ i.current && (i.current.style.height = `${T}px`, i.current.style.bottom = "0", o(`${T}px`));
1360
+ }, [r.maxHeight, r.minHeight]), v = w(() => {
1361
+ d.current = !1, document.documentElement.style.userSelect = "", document.documentElement.style.webkitUserSelect = "", document.documentElement.style.mozUserSelect = "", document.documentElement.style.msUserSelect = "", document.removeEventListener("mousemove", y), document.removeEventListener("mouseup", v);
1362
+ }, [y]), l = w((M) => {
1363
+ i.current && (d.current = !0, g.current = M.clientY, u.current = i.current.offsetHeight, document.documentElement.style.userSelect = "none", document.documentElement.style.webkitUserSelect = "none", document.documentElement.style.mozUserSelect = "none", document.documentElement.style.msUserSelect = "none", document.addEventListener("mousemove", y), document.addEventListener("mouseup", v));
1364
+ }, [y, v]);
1365
+ P(() => () => {
1366
+ document.removeEventListener("mousemove", y), document.removeEventListener("mouseup", v);
1367
+ }, [y, v]);
1368
+ const p = w(() => {
1369
+ t && (e(!1), s(!1));
1370
+ }, [t]);
1371
+ Be({
1372
+ isVisible: n,
1373
+ isClosing: t,
1374
+ onAnimationComplete: p
1375
+ });
1376
+ const C = A(
1377
+ () => ({
1378
+ ...a ? { height: a } : {},
1379
+ maxHeight: r.maxHeight
1380
+ }),
1381
+ [r.maxHeight, a]
1382
+ );
1383
+ return n ? /* @__PURE__ */ I(
1375
1384
  "div",
1376
1385
  {
1377
- ref: a,
1378
- className: `panelContainer ${t ? "citadel_slideUp" : ""} ${n ? "citadel_slideDown" : ""}`,
1379
- style: {
1380
- ...s ? { height: s } : void 0,
1381
- maxHeight: o.maxHeight
1382
- },
1386
+ ref: i,
1387
+ className: `panelContainer ${n ? "citadel_slideUp" : ""} ${t ? "citadel_slideDown" : ""}`,
1388
+ style: C,
1383
1389
  children: [
1384
- /* @__PURE__ */ m("div", { className: "resizeHandle", onMouseDown: d }),
1390
+ /* @__PURE__ */ m("div", { className: "resizeHandle", onMouseDown: l }),
1385
1391
  /* @__PURE__ */ m(
1386
- ke,
1392
+ Ne,
1387
1393
  {
1388
- state: x,
1389
- actions: w,
1390
- outputRef: l
1394
+ state: h,
1395
+ actions: x,
1396
+ outputRef: c
1391
1397
  }
1392
1398
  )
1393
1399
  ]
1394
1400
  }
1395
1401
  ) : null;
1396
- }, ne = (t) => {
1397
- if (!t) return;
1398
- const e = t.trim();
1402
+ }, ae = (n) => {
1403
+ if (!n) return;
1404
+ const e = n.trim();
1399
1405
  if (e)
1400
1406
  return /^\d+(\.\d+)?$/.test(e) ? `${e}px` : e;
1401
- }, mn = () => {
1402
- const { state: t, actions: e } = ae(), n = j(), r = F(null);
1407
+ }, at = () => {
1408
+ const { state: n, actions: e } = de(), t = j(), s = z(null), r = A(
1409
+ () => ({
1410
+ height: ae(t.initialHeight),
1411
+ maxHeight: ae(t.maxHeight),
1412
+ minHeight: ae(t.minHeight)
1413
+ }),
1414
+ [t.initialHeight, t.maxHeight, t.minHeight]
1415
+ );
1403
1416
  return /* @__PURE__ */ m(
1404
1417
  "div",
1405
1418
  {
1406
1419
  className: "inlineContainer",
1407
1420
  "data-testid": "citadel-inline-container",
1408
- style: {
1409
- height: ne(n.initialHeight),
1410
- maxHeight: ne(n.maxHeight),
1411
- minHeight: ne(n.minHeight)
1412
- },
1421
+ style: r,
1413
1422
  children: /* @__PURE__ */ m(
1414
- ke,
1423
+ Ne,
1415
1424
  {
1416
- state: t,
1425
+ state: n,
1417
1426
  actions: e,
1418
- outputRef: r
1427
+ outputRef: s
1419
1428
  }
1420
1429
  )
1421
1430
  }
1422
1431
  );
1423
- }, pe = `:host {
1424
- --citadel-bg: rgb(17, 24, 39);
1425
- --citadel-text: rgba(255, 255, 255, 0.87);
1426
- --citadel-border: rgb(55, 65, 81);
1427
- --citadel-accent: #646cff;
1428
- --citadel-accent-hover: #535bf2;
1432
+ }, ye = `:host {
1433
+ --citadel-bg: oklch(20.8% 0.042 265.8);
1434
+ --citadel-surface: oklch(27.9% 0.041 260);
1435
+ --citadel-border: oklch(37.2% 0.044 257.3);
1436
+ --citadel-text: oklch(92.8% 0.006 264.5);
1437
+ --citadel-muted: oklch(70.7% 0.022 261.3);
1438
+ --citadel-subtle: oklch(55.1% 0.023 264.4);
1439
+ --citadel-word: oklch(70.7% 0.165 254.6);
1440
+ --citadel-arg: oklch(72.3% 0.219 149.6);
1441
+ --citadel-error: oklch(70.4% 0.191 22.2);
1442
+ --citadel-success: oklch(72.3% 0.219 149.6);
1429
1443
  --citadel-min-height: 200px;
1430
1444
  --citadel-max-height: 80vh;
1431
1445
  --citadel-default-height: 35vh;
1432
- --citadel-error: rgb(239, 68, 68);
1433
1446
 
1434
1447
  display: block;
1435
1448
  pointer-events: auto;
1449
+ color: var(--citadel-text);
1436
1450
  font-synthesis: none;
1437
1451
  text-rendering: optimizeLegibility;
1438
1452
  -webkit-font-smoothing: antialiased;
1439
1453
  -moz-osx-font-smoothing: grayscale;
1440
1454
  }
1441
1455
 
1442
- :host([data-display-mode="panel"]) {
1456
+ :host([data-display-mode='panel']) {
1443
1457
  position: fixed;
1444
1458
  bottom: 0;
1445
1459
  left: 0;
@@ -1448,11 +1462,11 @@ const an = () => {
1448
1462
  height: var(--citadel-default-height);
1449
1463
  max-height: var(--citadel-max-height);
1450
1464
  min-height: var(--citadel-min-height);
1451
- z-index: 2147483647; /* Maximum z-index value */
1465
+ z-index: 2147483647;
1452
1466
  overflow: hidden;
1453
1467
  }
1454
1468
 
1455
- :host([data-display-mode="inline"]) {
1469
+ :host([data-display-mode='inline']) {
1456
1470
  position: relative;
1457
1471
  bottom: auto;
1458
1472
  left: auto;
@@ -1465,127 +1479,93 @@ const an = () => {
1465
1479
  overflow: hidden;
1466
1480
  }
1467
1481
 
1468
- button {
1469
- border-radius: 8px;
1470
- border: 1px solid transparent;
1471
- padding: 0.6em 1.2em;
1472
- font-size: 1em;
1473
- font-weight: 500;
1474
- font-family: inherit;
1475
- background-color: #1a1a1a;
1476
- cursor: pointer;
1477
- transition: border-color 0.25s;
1478
- }
1479
-
1480
- button:hover {
1481
- border-color: var(--citadel-accent);
1482
- }
1483
-
1484
- button:focus,
1485
- button:focus-visible {
1486
- outline: 4px auto -webkit-focus-ring-color;
1487
- }
1488
-
1489
- a {
1490
- font-weight: 500;
1491
- color: var(--citadel-accent);
1492
- text-decoration: inherit;
1493
- }
1494
-
1495
- a:hover {
1496
- color: var(--citadel-accent-hover);
1497
- }
1498
-
1499
- .flex-1 { flex: 1 1 0%; }
1500
- .flex-shrink-0 { flex-shrink: 0; }
1501
- .min-h-0 { min-height: 0px; }
1502
- .pt-3 { padding-top: 0.75rem; }
1503
- .px-4 { padding-left: 1rem; padding-right: 1rem; }
1504
-
1505
- .h-full {
1482
+ #citadel-root {
1483
+ width: 100%;
1506
1484
  height: 100%;
1507
1485
  }
1508
- .overflow-y-auto {
1509
- overflow-y: auto;
1510
- }
1511
- .border {
1512
- border-width: 1px;
1513
- }
1514
- .border-gray-700 {
1515
- --tw-border-opacity: 1;
1516
- border-color: rgb(55 65 81 / var(--tw-border-opacity, 1));
1517
- }
1518
- .rounded-lg {
1519
- border-radius: 0.5rem;
1520
- }
1521
- .p-3 {
1522
- padding: 0.75rem;
1523
- }
1524
- .text-left {
1525
- text-align: left;
1486
+
1487
+ #citadel-root,
1488
+ #citadel-root * {
1489
+ box-sizing: border-box;
1526
1490
  }
1527
- `, he = `/* Keep only component-specific styles here */
1528
1491
 
1529
1492
  .panelContainer {
1530
1493
  position: fixed;
1494
+ bottom: 0;
1495
+ left: 0;
1496
+ right: 0;
1497
+ width: 100%;
1531
1498
  height: var(--citadel-default-height);
1532
1499
  min-height: var(--citadel-min-height);
1533
1500
  max-height: var(--citadel-max-height);
1534
- background-color: var(--citadel-bg);
1535
- overflow: hidden;
1536
- width: 100%;
1537
- box-sizing: border-box;
1538
1501
  margin: 0;
1539
1502
  padding: 0;
1540
- bottom: 0;
1541
- left: 0;
1542
- right: 0;
1503
+ background-color: var(--citadel-bg);
1504
+ overflow: hidden;
1543
1505
  }
1544
1506
 
1545
1507
  .innerContainer {
1546
- height: 100%;
1547
- flex: 1;
1548
1508
  width: 100%;
1549
- display: flex;
1550
- flex-direction: column;
1509
+ height: 100%;
1551
1510
  margin: 0;
1552
1511
  padding: 0;
1512
+ display: flex;
1513
+ flex: 1;
1514
+ flex-direction: column;
1553
1515
  }
1554
1516
 
1555
- .inputSection {
1556
- border-top: 1px solid var(--citadel-border);
1557
- padding: 1rem;
1558
- margin: 0;
1559
- box-sizing: border-box;
1517
+ .citadel-tty {
1518
+ background: var(--citadel-bg);
1519
+ }
1520
+
1521
+ .citadel-tty-output-pane {
1522
+ display: flex;
1523
+ flex: 1 1 auto;
1524
+ min-height: 0;
1525
+ padding: 0.75rem 1rem 0;
1526
+ }
1527
+
1528
+ .citadel-tty-input-region {
1529
+ flex-shrink: 0;
1560
1530
  }
1561
1531
 
1562
1532
  .resizeHandle {
1563
- width: 100%;
1564
- height: 6px;
1565
- background: transparent;
1566
- cursor: ns-resize;
1567
1533
  position: absolute;
1568
1534
  top: -3px;
1569
1535
  left: 0;
1570
1536
  right: 0;
1571
1537
  z-index: 10;
1538
+ width: 100%;
1539
+ height: 6px;
1540
+ background: transparent;
1541
+ cursor: ns-resize;
1572
1542
  user-select: none;
1573
1543
  -webkit-user-select: none;
1574
1544
  pointer-events: all;
1575
1545
  }
1576
1546
 
1577
1547
  .resizeHandle:hover {
1578
- background: rgba(255, 255, 255, 0.1);
1548
+ background: color-mix(in oklch, var(--citadel-text) 10%, transparent);
1579
1549
  }
1580
1550
 
1581
1551
  @keyframes citadel_slideUp {
1582
- from { transform: translateY(100%); }
1583
- to { transform: translateY(0); }
1552
+ from {
1553
+ transform: translateY(100%);
1554
+ }
1555
+
1556
+ to {
1557
+ transform: translateY(0);
1558
+ }
1584
1559
  }
1585
1560
 
1586
1561
  @keyframes citadel_slideDown {
1587
- from { transform: translateY(0); }
1588
- to { transform: translateY(100%); }
1562
+ from {
1563
+ transform: translateY(0);
1564
+ }
1565
+
1566
+ to {
1567
+ transform: translateY(100%);
1568
+ }
1589
1569
  }
1590
1570
 
1591
1571
  .citadel_slideUp {
@@ -1604,900 +1584,382 @@ a:hover {
1604
1584
  flex-direction: column;
1605
1585
  background-color: var(--citadel-bg);
1606
1586
  overflow: hidden;
1607
- box-sizing: border-box;
1608
- }
1609
- `, ge = `@tailwind base;
1610
- @tailwind components;
1611
- @tailwind utilities;
1612
- `, un = `*, ::before, ::after {
1613
- --tw-border-spacing-x: 0;
1614
- --tw-border-spacing-y: 0;
1615
- --tw-translate-x: 0;
1616
- --tw-translate-y: 0;
1617
- --tw-rotate: 0;
1618
- --tw-skew-x: 0;
1619
- --tw-skew-y: 0;
1620
- --tw-scale-x: 1;
1621
- --tw-scale-y: 1;
1622
- --tw-pan-x: ;
1623
- --tw-pan-y: ;
1624
- --tw-pinch-zoom: ;
1625
- --tw-scroll-snap-strictness: proximity;
1626
- --tw-gradient-from-position: ;
1627
- --tw-gradient-via-position: ;
1628
- --tw-gradient-to-position: ;
1629
- --tw-ordinal: ;
1630
- --tw-slashed-zero: ;
1631
- --tw-numeric-figure: ;
1632
- --tw-numeric-spacing: ;
1633
- --tw-numeric-fraction: ;
1634
- --tw-ring-inset: ;
1635
- --tw-ring-offset-width: 0px;
1636
- --tw-ring-offset-color: #fff;
1637
- --tw-ring-color: rgb(59 130 246 / 0.5);
1638
- --tw-ring-offset-shadow: 0 0 #0000;
1639
- --tw-ring-shadow: 0 0 #0000;
1640
- --tw-shadow: 0 0 #0000;
1641
- --tw-shadow-colored: 0 0 #0000;
1642
- --tw-blur: ;
1643
- --tw-brightness: ;
1644
- --tw-contrast: ;
1645
- --tw-grayscale: ;
1646
- --tw-hue-rotate: ;
1647
- --tw-invert: ;
1648
- --tw-saturate: ;
1649
- --tw-sepia: ;
1650
- --tw-drop-shadow: ;
1651
- --tw-backdrop-blur: ;
1652
- --tw-backdrop-brightness: ;
1653
- --tw-backdrop-contrast: ;
1654
- --tw-backdrop-grayscale: ;
1655
- --tw-backdrop-hue-rotate: ;
1656
- --tw-backdrop-invert: ;
1657
- --tw-backdrop-opacity: ;
1658
- --tw-backdrop-saturate: ;
1659
- --tw-backdrop-sepia: ;
1660
- --tw-contain-size: ;
1661
- --tw-contain-layout: ;
1662
- --tw-contain-paint: ;
1663
- --tw-contain-style: ;
1664
- }
1665
-
1666
- ::backdrop {
1667
- --tw-border-spacing-x: 0;
1668
- --tw-border-spacing-y: 0;
1669
- --tw-translate-x: 0;
1670
- --tw-translate-y: 0;
1671
- --tw-rotate: 0;
1672
- --tw-skew-x: 0;
1673
- --tw-skew-y: 0;
1674
- --tw-scale-x: 1;
1675
- --tw-scale-y: 1;
1676
- --tw-pan-x: ;
1677
- --tw-pan-y: ;
1678
- --tw-pinch-zoom: ;
1679
- --tw-scroll-snap-strictness: proximity;
1680
- --tw-gradient-from-position: ;
1681
- --tw-gradient-via-position: ;
1682
- --tw-gradient-to-position: ;
1683
- --tw-ordinal: ;
1684
- --tw-slashed-zero: ;
1685
- --tw-numeric-figure: ;
1686
- --tw-numeric-spacing: ;
1687
- --tw-numeric-fraction: ;
1688
- --tw-ring-inset: ;
1689
- --tw-ring-offset-width: 0px;
1690
- --tw-ring-offset-color: #fff;
1691
- --tw-ring-color: rgb(59 130 246 / 0.5);
1692
- --tw-ring-offset-shadow: 0 0 #0000;
1693
- --tw-ring-shadow: 0 0 #0000;
1694
- --tw-shadow: 0 0 #0000;
1695
- --tw-shadow-colored: 0 0 #0000;
1696
- --tw-blur: ;
1697
- --tw-brightness: ;
1698
- --tw-contrast: ;
1699
- --tw-grayscale: ;
1700
- --tw-hue-rotate: ;
1701
- --tw-invert: ;
1702
- --tw-saturate: ;
1703
- --tw-sepia: ;
1704
- --tw-drop-shadow: ;
1705
- --tw-backdrop-blur: ;
1706
- --tw-backdrop-brightness: ;
1707
- --tw-backdrop-contrast: ;
1708
- --tw-backdrop-grayscale: ;
1709
- --tw-backdrop-hue-rotate: ;
1710
- --tw-backdrop-invert: ;
1711
- --tw-backdrop-opacity: ;
1712
- --tw-backdrop-saturate: ;
1713
- --tw-backdrop-sepia: ;
1714
- --tw-contain-size: ;
1715
- --tw-contain-layout: ;
1716
- --tw-contain-paint: ;
1717
- --tw-contain-style: ;
1718
- }/*
1719
- ! tailwindcss v3.4.15 | MIT License | https://tailwindcss.com
1720
- *//*
1721
- 1. Prevent padding and border from affecting element width. (https://github.com/mozdevs/cssremedy/issues/4)
1722
- 2. Allow adding a border to an element by just adding a border-width. (https://github.com/tailwindcss/tailwindcss/pull/116)
1723
- */
1724
-
1725
- *,
1726
- ::before,
1727
- ::after {
1728
- box-sizing: border-box; /* 1 */
1729
- border-width: 0; /* 2 */
1730
- border-style: solid; /* 2 */
1731
- border-color: #e5e7eb; /* 2 */
1732
- }
1733
-
1734
- ::before,
1735
- ::after {
1736
- --tw-content: '';
1737
- }
1738
-
1739
- /*
1740
- 1. Use a consistent sensible line-height in all browsers.
1741
- 2. Prevent adjustments of font size after orientation changes in iOS.
1742
- 3. Use a more readable tab size.
1743
- 4. Use the user's configured \`sans\` font-family by default.
1744
- 5. Use the user's configured \`sans\` font-feature-settings by default.
1745
- 6. Use the user's configured \`sans\` font-variation-settings by default.
1746
- 7. Disable tap highlights on iOS
1747
- */
1748
-
1749
- html,
1750
- :host {
1751
- line-height: 1.5; /* 1 */
1752
- -webkit-text-size-adjust: 100%; /* 2 */
1753
- -moz-tab-size: 4; /* 3 */
1754
- -o-tab-size: 4;
1755
- tab-size: 4; /* 3 */
1756
- font-family: ui-sans-serif, system-ui, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji"; /* 4 */
1757
- font-feature-settings: normal; /* 5 */
1758
- font-variation-settings: normal; /* 6 */
1759
- -webkit-tap-highlight-color: transparent; /* 7 */
1760
- }
1761
-
1762
- /*
1763
- 1. Remove the margin in all browsers.
1764
- 2. Inherit line-height from \`html\` so users can set them as a class directly on the \`html\` element.
1765
- */
1766
-
1767
- body {
1768
- margin: 0; /* 1 */
1769
- line-height: inherit; /* 2 */
1770
- }
1771
-
1772
- /*
1773
- 1. Add the correct height in Firefox.
1774
- 2. Correct the inheritance of border color in Firefox. (https://bugzilla.mozilla.org/show_bug.cgi?id=190655)
1775
- 3. Ensure horizontal rules are visible by default.
1776
- */
1777
-
1778
- hr {
1779
- height: 0; /* 1 */
1780
- color: inherit; /* 2 */
1781
- border-top-width: 1px; /* 3 */
1782
- }
1783
-
1784
- /*
1785
- Add the correct text decoration in Chrome, Edge, and Safari.
1786
- */
1787
-
1788
- abbr:where([title]) {
1789
- -webkit-text-decoration: underline dotted;
1790
- text-decoration: underline dotted;
1791
- }
1792
-
1793
- /*
1794
- Remove the default font size and weight for headings.
1795
- */
1796
-
1797
- h1,
1798
- h2,
1799
- h3,
1800
- h4,
1801
- h5,
1802
- h6 {
1803
- font-size: inherit;
1804
- font-weight: inherit;
1805
- }
1806
-
1807
- /*
1808
- Reset links to optimize for opt-in styling instead of opt-out.
1809
- */
1810
-
1811
- a {
1812
- color: inherit;
1813
- text-decoration: inherit;
1814
- }
1815
-
1816
- /*
1817
- Add the correct font weight in Edge and Safari.
1818
- */
1819
-
1820
- b,
1821
- strong {
1822
- font-weight: bolder;
1823
1587
  }
1824
1588
 
1825
- /*
1826
- 1. Use the user's configured \`mono\` font-family by default.
1827
- 2. Use the user's configured \`mono\` font-feature-settings by default.
1828
- 3. Use the user's configured \`mono\` font-variation-settings by default.
1829
- 4. Correct the odd \`em\` font sizing in all browsers.
1830
- */
1831
-
1832
- code,
1833
- kbd,
1834
- samp,
1835
- pre {
1836
- font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace; /* 1 */
1837
- font-feature-settings: normal; /* 2 */
1838
- font-variation-settings: normal; /* 3 */
1839
- font-size: 1em; /* 4 */
1840
- }
1841
-
1842
- /*
1843
- Add the correct font size in all browsers.
1844
- */
1845
-
1846
- small {
1847
- font-size: 80%;
1589
+ .citadel-output {
1590
+ width: 100%;
1591
+ height: 100%;
1592
+ overflow-y: auto;
1593
+ padding: 0.75rem;
1594
+ border: 1px solid var(--citadel-border);
1595
+ border-radius: 0.5rem;
1596
+ background: color-mix(in oklch, var(--citadel-bg) 75%, black);
1597
+ text-align: left;
1848
1598
  }
1849
1599
 
1850
- /*
1851
- Prevent \`sub\` and \`sup\` elements from affecting the line height in all browsers.
1852
- */
1853
-
1854
- sub,
1855
- sup {
1856
- font-size: 75%;
1857
- line-height: 0;
1858
- position: relative;
1859
- vertical-align: baseline;
1600
+ .citadel-output-item {
1601
+ margin-bottom: 1rem;
1860
1602
  }
1861
1603
 
1862
- sub {
1863
- bottom: -0.25em;
1604
+ .citadel-output-item:last-child {
1605
+ margin-bottom: 0;
1864
1606
  }
1865
1607
 
1866
- sup {
1867
- top: -0.5em;
1608
+ .citadel-output-content {
1609
+ margin-top: 0.35rem;
1610
+ color: var(--citadel-text);
1868
1611
  }
1869
1612
 
1870
- /*
1871
- 1. Remove text indentation from table contents in Chrome and Safari. (https://bugs.chromium.org/p/chromium/issues/detail?id=999088, https://bugs.webkit.org/show_bug.cgi?id=201297)
1872
- 2. Correct table border color inheritance in all Chrome and Safari. (https://bugs.chromium.org/p/chromium/issues/detail?id=935729, https://bugs.webkit.org/show_bug.cgi?id=195016)
1873
- 3. Remove gaps between table borders by default.
1874
- */
1875
-
1876
- table {
1877
- text-indent: 0; /* 1 */
1878
- border-color: inherit; /* 2 */
1879
- border-collapse: collapse; /* 3 */
1613
+ .citadel-output-content > :first-child {
1614
+ margin-top: 0;
1880
1615
  }
1881
1616
 
1882
- /*
1883
- 1. Change the font styles in all browsers.
1884
- 2. Remove the margin in Firefox and Safari.
1885
- 3. Remove default padding in all browsers.
1886
- */
1887
-
1888
- button,
1889
- input,
1890
- optgroup,
1891
- select,
1892
- textarea {
1893
- font-family: inherit; /* 1 */
1894
- font-feature-settings: inherit; /* 1 */
1895
- font-variation-settings: inherit; /* 1 */
1896
- font-size: 100%; /* 1 */
1897
- font-weight: inherit; /* 1 */
1898
- line-height: inherit; /* 1 */
1899
- letter-spacing: inherit; /* 1 */
1900
- color: inherit; /* 1 */
1901
- margin: 0; /* 2 */
1902
- padding: 0; /* 3 */
1617
+ .citadel-output-content > :last-child {
1618
+ margin-bottom: 0;
1903
1619
  }
1904
1620
 
1905
- /*
1906
- Remove the inheritance of text transform in Edge and Firefox.
1907
- */
1908
-
1909
- button,
1910
- select {
1911
- text-transform: none;
1621
+ .citadel-output-line {
1622
+ display: flex;
1623
+ flex-wrap: wrap;
1624
+ align-items: center;
1625
+ gap: 0.5rem;
1912
1626
  }
1913
1627
 
1914
- /*
1915
- 1. Correct the inability to style clickable types in iOS and Safari.
1916
- 2. Remove default button styles.
1917
- */
1918
-
1919
- button,
1920
- input:where([type='button']),
1921
- input:where([type='reset']),
1922
- input:where([type='submit']) {
1923
- -webkit-appearance: button; /* 1 */
1924
- background-color: transparent; /* 2 */
1925
- background-image: none; /* 2 */
1628
+ .citadel-output-command,
1629
+ .citadel-output-command-word {
1630
+ color: var(--citadel-text);
1926
1631
  }
1927
1632
 
1928
- /*
1929
- Use the modern Firefox focus style for all focusable elements.
1930
- */
1931
-
1932
- :-moz-focusring {
1933
- outline: auto;
1633
+ .citadel-output-command-arg {
1634
+ color: var(--citadel-arg);
1934
1635
  }
1935
1636
 
1936
- /*
1937
- Remove the additional \`:invalid\` styles in Firefox. (https://github.com/mozilla/gecko-dev/blob/2f9eacd9d3d995c937b4251a5557d95d494c9be1/layout/style/res/forms.css#L728-L737)
1938
- */
1637
+ .citadel-output-separator {
1638
+ color: var(--citadel-muted);
1639
+ }
1939
1640
 
1940
- :-moz-ui-invalid {
1941
- box-shadow: none;
1641
+ .citadel-output-timestamp {
1642
+ color: var(--citadel-subtle);
1942
1643
  }
1943
1644
 
1944
- /*
1945
- Add the correct vertical alignment in Chrome and Firefox.
1946
- */
1645
+ .citadel-status-dot {
1646
+ width: 1rem;
1647
+ height: 1rem;
1648
+ border-radius: 999px;
1649
+ }
1947
1650
 
1948
- progress {
1949
- vertical-align: baseline;
1651
+ .citadel-status-dot-success {
1652
+ background: var(--citadel-success);
1950
1653
  }
1951
1654
 
1952
- /*
1953
- Correct the cursor style of increment and decrement buttons in Safari.
1954
- */
1655
+ .citadel-status-dot-failure {
1656
+ background: var(--citadel-error);
1657
+ }
1955
1658
 
1956
- ::-webkit-inner-spin-button,
1957
- ::-webkit-outer-spin-button {
1958
- height: auto;
1659
+ .citadel-spinner {
1660
+ width: 1rem;
1661
+ height: 1rem;
1662
+ border: 2px solid color-mix(in oklch, var(--citadel-text) 60%, transparent);
1663
+ border-top-color: color-mix(in oklch, var(--citadel-muted) 80%, black);
1664
+ border-radius: 999px;
1665
+ animation: citadel-spin 0.9s linear infinite;
1959
1666
  }
1960
1667
 
1961
- /*
1962
- 1. Correct the odd appearance in Chrome and Safari.
1963
- 2. Correct the outline style in Safari.
1964
- */
1668
+ @keyframes citadel-spin {
1669
+ to {
1670
+ transform: rotate(360deg);
1671
+ }
1672
+ }
1965
1673
 
1966
- [type='search'] {
1967
- -webkit-appearance: textfield; /* 1 */
1968
- outline-offset: -2px; /* 2 */
1674
+ .citadel-input-shell {
1675
+ width: 100%;
1676
+ padding: 1rem;
1677
+ border-radius: 0.5rem;
1678
+ background-color: var(--citadel-bg);
1969
1679
  }
1970
1680
 
1971
- /*
1972
- Remove the inner padding in Chrome and Safari on macOS.
1973
- */
1681
+ .citadel-input-line {
1682
+ display: flex;
1683
+ align-items: center;
1684
+ gap: 0.5rem;
1685
+ }
1974
1686
 
1975
- ::-webkit-search-decoration {
1976
- -webkit-appearance: none;
1687
+ .citadel-input-prompt {
1688
+ color: var(--citadel-muted);
1977
1689
  }
1978
1690
 
1979
- /*
1980
- 1. Correct the inability to style clickable types in iOS and Safari.
1981
- 2. Change font properties to \`inherit\` in Safari.
1982
- */
1691
+ .citadel-input-row {
1692
+ display: flex;
1693
+ align-items: center;
1694
+ flex: 1 1 auto;
1695
+ min-width: 0;
1696
+ }
1983
1697
 
1984
- ::-webkit-file-upload-button {
1985
- -webkit-appearance: button; /* 1 */
1986
- font: inherit; /* 2 */
1698
+ .citadel-input-segments {
1699
+ display: flex;
1700
+ align-items: center;
1701
+ gap: 0.25rem;
1987
1702
  }
1988
1703
 
1989
- /*
1990
- Add the correct display in Chrome and Safari.
1991
- */
1704
+ .citadel-input-segment-arg {
1705
+ color: var(--citadel-text);
1706
+ white-space: pre;
1707
+ }
1992
1708
 
1993
- summary {
1994
- display: list-item;
1709
+ .citadel-input-segment-word {
1710
+ color: var(--citadel-word);
1711
+ white-space: pre;
1995
1712
  }
1996
1713
 
1997
- /*
1998
- Removes the default spacing and border for appropriate elements.
1999
- */
1714
+ .citadel-input-segment-space {
1715
+ color: var(--citadel-text);
1716
+ white-space: pre;
1717
+ }
2000
1718
 
2001
- blockquote,
2002
- dl,
2003
- dd,
2004
- h1,
2005
- h2,
2006
- h3,
2007
- h4,
2008
- h5,
2009
- h6,
2010
- hr,
2011
- figure,
2012
- p,
2013
- pre {
2014
- margin: 0;
1719
+ .citadel-input-segment-space-command {
1720
+ color: var(--citadel-word);
2015
1721
  }
2016
1722
 
2017
- fieldset {
2018
- margin: 0;
2019
- padding: 0;
1723
+ .citadel-input-control {
1724
+ position: relative;
1725
+ flex: 1 1 auto;
1726
+ min-width: 0;
2020
1727
  }
2021
1728
 
2022
- legend {
2023
- padding: 0;
1729
+ .citadel-input-measure {
1730
+ position: absolute;
1731
+ top: 0;
1732
+ left: 0;
1733
+ visibility: hidden;
1734
+ pointer-events: none;
1735
+ white-space: pre;
1736
+ font: inherit;
1737
+ letter-spacing: inherit;
2024
1738
  }
2025
1739
 
2026
- ol,
2027
- ul,
2028
- menu {
2029
- list-style: none;
1740
+ .citadel-input-field {
1741
+ width: 100%;
2030
1742
  margin: 0;
2031
1743
  padding: 0;
1744
+ border: 0;
1745
+ border-radius: 0;
1746
+ outline: none;
1747
+ background: transparent;
1748
+ font: inherit;
1749
+ line-height: inherit;
1750
+ letter-spacing: inherit;
1751
+ appearance: none;
1752
+ -webkit-appearance: none;
1753
+ caret-color: transparent;
2032
1754
  }
2033
1755
 
2034
- /*
2035
- Reset default styling for dialogs.
2036
- */
2037
- dialog {
2038
- padding: 0;
1756
+ .citadel-input-field::placeholder {
1757
+ color: var(--citadel-subtle);
1758
+ opacity: 1;
2039
1759
  }
2040
1760
 
2041
- /*
2042
- Prevent resizing textareas horizontally by default.
2043
- */
2044
-
2045
- textarea {
2046
- resize: vertical;
1761
+ .citadel-input-field.is-command-mode {
1762
+ color: var(--citadel-word);
2047
1763
  }
2048
1764
 
2049
- /*
2050
- 1. Reset the default placeholder opacity in Firefox. (https://github.com/tailwindlabs/tailwindcss/issues/3300)
2051
- 2. Set the default placeholder color to the user's configured gray 400 color.
2052
- */
2053
-
2054
- input::-moz-placeholder, textarea::-moz-placeholder {
2055
- opacity: 1; /* 1 */
2056
- color: #9ca3af; /* 2 */
1765
+ .citadel-input-field.is-argument-mode {
1766
+ color: var(--citadel-text);
2057
1767
  }
2058
1768
 
2059
- input::placeholder,
2060
- textarea::placeholder {
2061
- opacity: 1; /* 1 */
2062
- color: #9ca3af; /* 2 */
1769
+ .citadel-input-cursor {
1770
+ position: absolute;
1771
+ top: 0;
1772
+ pointer-events: none;
2063
1773
  }
2064
1774
 
2065
- /*
2066
- Set the default cursor for buttons.
2067
- */
1775
+ @keyframes citadel-invalid-glow {
1776
+ 0%,
1777
+ 100% {
1778
+ box-shadow: 0 0 0 color-mix(in oklch, var(--citadel-error) 0%, transparent);
1779
+ }
2068
1780
 
2069
- button,
2070
- [role="button"] {
2071
- cursor: pointer;
1781
+ 50% {
1782
+ box-shadow: 0 0 8px color-mix(in oklch, var(--citadel-error) 70%, transparent);
1783
+ }
2072
1784
  }
2073
1785
 
2074
- /*
2075
- Make sure disabled buttons don't get the pointer cursor.
2076
- */
2077
- :disabled {
2078
- cursor: default;
1786
+ .invalid-input-animation {
1787
+ animation: citadel-invalid-glow 0.4s ease-in-out;
2079
1788
  }
2080
1789
 
2081
- /*
2082
- 1. Make replaced elements \`display: block\` by default. (https://github.com/mozdevs/cssremedy/issues/14)
2083
- 2. Add \`vertical-align: middle\` to align replaced elements more sensibly by default. (https://github.com/jensimmons/cssremedy/issues/14#issuecomment-634934210)
2084
- This can trigger a poorly considered lint error in some tools but is included by design.
2085
- */
1790
+ .citadel-cursor-wrapper {
1791
+ position: relative;
1792
+ display: inline-block;
1793
+ }
2086
1794
 
2087
- img,
2088
- svg,
2089
- video,
2090
- canvas,
2091
- audio,
2092
- iframe,
2093
- embed,
2094
- object {
2095
- display: block; /* 1 */
2096
- vertical-align: middle; /* 2 */
1795
+ .command-cursor {
1796
+ display: inline-block;
1797
+ white-space: pre;
2097
1798
  }
2098
1799
 
2099
- /*
2100
- Constrain images and videos to the parent width and preserve their intrinsic aspect ratio. (https://github.com/mozdevs/cssremedy/issues/14)
2101
- */
1800
+ @keyframes citadel-shake {
1801
+ 0%,
1802
+ 100% {
1803
+ transform: translateX(0);
1804
+ }
2102
1805
 
2103
- img,
2104
- video {
2105
- max-width: 100%;
2106
- height: auto;
2107
- }
1806
+ 25% {
1807
+ transform: translateX(-4px);
1808
+ }
2108
1809
 
2109
- /* Make elements with the HTML hidden attribute stay hidden by default */
2110
- [hidden]:where(:not([hidden="until-found"])) {
2111
- display: none;
2112
- }
2113
- .container {
2114
- width: 100%;
2115
- }
2116
- .pointer-events-none {
2117
- pointer-events: none;
2118
- }
2119
- .visible {
2120
- visibility: visible;
2121
- }
2122
- .static {
2123
- position: static;
2124
- }
2125
- .fixed {
2126
- position: fixed;
2127
- }
2128
- .absolute {
2129
- position: absolute;
2130
- }
2131
- .relative {
2132
- position: relative;
2133
- }
2134
- .top-0 {
2135
- top: 0px;
2136
- }
2137
- .my-2 {
2138
- margin-top: 0.5rem;
2139
- margin-bottom: 0.5rem;
2140
- }
2141
- .mb-4 {
2142
- margin-bottom: 1rem;
2143
- }
2144
- .ml-2 {
2145
- margin-left: 0.5rem;
2146
- }
2147
- .mr-2 {
2148
- margin-right: 0.5rem;
1810
+ 75% {
1811
+ transform: translateX(4px);
1812
+ }
2149
1813
  }
2150
- .mt-1 {
2151
- margin-top: 0.25rem;
1814
+
1815
+ .animate-shake {
1816
+ animation: citadel-shake 0.2s ease-in-out;
2152
1817
  }
2153
- .mt-2 {
1818
+
1819
+ .citadel-available-commands {
2154
1820
  margin-top: 0.5rem;
1821
+ padding: 0.5rem 1rem;
1822
+ border-top: 1px solid var(--citadel-border);
2155
1823
  }
2156
- .block {
2157
- display: block;
2158
- }
2159
- .inline-block {
2160
- display: inline-block;
2161
- }
2162
- .flex {
2163
- display: flex;
2164
- }
2165
- .hidden {
2166
- display: none;
2167
- }
2168
- .h-12 {
2169
- height: 3rem;
2170
- }
2171
- .h-4 {
2172
- height: 1rem;
2173
- }
2174
- .h-auto {
2175
- height: auto;
2176
- }
2177
- .h-full {
2178
- height: 100%;
2179
- }
2180
- .max-h-\\[300px\\] {
2181
- max-height: 300px;
2182
- }
2183
- .min-h-0 {
2184
- min-height: 0px;
2185
- }
2186
- .min-h-screen {
2187
- min-height: 100vh;
2188
- }
2189
- .w-4 {
2190
- width: 1rem;
2191
- }
2192
- .w-full {
2193
- width: 100%;
2194
- }
2195
- .max-w-\\[400px\\] {
2196
- max-width: 400px;
2197
- }
2198
- .flex-1 {
2199
- flex: 1 1 0%;
2200
- }
2201
- .flex-shrink-0 {
2202
- flex-shrink: 0;
2203
- }
2204
- .transform {
2205
- transform: translate(var(--tw-translate-x), var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y));
2206
- }
2207
- @keyframes spin {
2208
1824
 
2209
- to {
2210
- transform: rotate(360deg);
2211
- }
2212
- }
2213
- .animate-spin {
2214
- animation: spin 1s linear infinite;
2215
- }
2216
- .flex-col {
2217
- flex-direction: column;
1825
+ .citadel-available-commands-content {
1826
+ color: var(--citadel-muted);
2218
1827
  }
2219
- .flex-wrap {
1828
+
1829
+ .citadel-available-chip-list {
1830
+ display: flex;
2220
1831
  flex-wrap: wrap;
2221
- }
2222
- .items-center {
2223
- align-items: center;
2224
- }
2225
- .justify-center {
2226
- justify-content: center;
2227
- }
2228
- .gap-2 {
2229
1832
  gap: 0.5rem;
2230
1833
  }
2231
- .overflow-y-auto {
2232
- overflow-y: auto;
2233
- }
2234
- .whitespace-pre {
2235
- white-space: pre;
2236
- }
2237
- .rounded {
2238
- border-radius: 0.25rem;
2239
- }
2240
- .rounded-full {
2241
- border-radius: 9999px;
2242
- }
2243
- .rounded-lg {
2244
- border-radius: 0.5rem;
2245
- }
2246
- .border {
2247
- border-width: 1px;
2248
- }
2249
- .border-2 {
2250
- border-width: 2px;
2251
- }
2252
- .border-t {
2253
- border-top-width: 1px;
2254
- }
2255
- .border-gray-300 {
2256
- --tw-border-opacity: 1;
2257
- border-color: rgb(209 213 219 / var(--tw-border-opacity, 1));
2258
- }
2259
- .border-gray-700 {
2260
- --tw-border-opacity: 1;
2261
- border-color: rgb(55 65 81 / var(--tw-border-opacity, 1));
2262
- }
2263
- .border-t-gray-600 {
2264
- --tw-border-opacity: 1;
2265
- border-top-color: rgb(75 85 99 / var(--tw-border-opacity, 1));
2266
- }
2267
- .bg-gray-100 {
2268
- --tw-bg-opacity: 1;
2269
- background-color: rgb(243 244 246 / var(--tw-bg-opacity, 1));
2270
- }
2271
- .bg-gray-800 {
2272
- --tw-bg-opacity: 1;
2273
- background-color: rgb(31 41 55 / var(--tw-bg-opacity, 1));
2274
- }
2275
- .bg-gray-900 {
2276
- --tw-bg-opacity: 1;
2277
- background-color: rgb(17 24 39 / var(--tw-bg-opacity, 1));
2278
- }
2279
- .bg-green-500 {
2280
- --tw-bg-opacity: 1;
2281
- background-color: rgb(34 197 94 / var(--tw-bg-opacity, 1));
2282
- }
2283
- .bg-red-500 {
2284
- --tw-bg-opacity: 1;
2285
- background-color: rgb(239 68 68 / var(--tw-bg-opacity, 1));
2286
- }
2287
- .bg-transparent {
2288
- background-color: transparent;
2289
- }
2290
- .bg-white {
2291
- --tw-bg-opacity: 1;
2292
- background-color: rgb(255 255 255 / var(--tw-bg-opacity, 1));
2293
- }
2294
- .object-contain {
2295
- -o-object-fit: contain;
2296
- object-fit: contain;
2297
- }
2298
- .p-3 {
2299
- padding: 0.75rem;
2300
- }
2301
- .p-4 {
2302
- padding: 1rem;
2303
- }
2304
- .p-6 {
2305
- padding: 1.5rem;
2306
- }
2307
- .px-2 {
2308
- padding-left: 0.5rem;
2309
- padding-right: 0.5rem;
2310
- }
2311
- .px-4 {
2312
- padding-left: 1rem;
2313
- padding-right: 1rem;
2314
- }
2315
- .py-1 {
2316
- padding-top: 0.25rem;
2317
- padding-bottom: 0.25rem;
2318
- }
2319
- .pt-2 {
2320
- padding-top: 0.5rem;
2321
- }
2322
- .pt-3 {
2323
- padding-top: 0.75rem;
2324
- }
2325
- .text-left {
2326
- text-align: left;
2327
- }
2328
- .font-mono {
2329
- font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
2330
- }
2331
- .text-base {
2332
- font-size: 1rem;
2333
- line-height: 1.5rem;
2334
- }
2335
- .text-lg {
2336
- font-size: 1.125rem;
2337
- line-height: 1.75rem;
2338
- }
2339
- .text-sm {
2340
- font-size: 0.875rem;
2341
- line-height: 1.25rem;
2342
- }
2343
- .text-xs {
2344
- font-size: 0.75rem;
2345
- line-height: 1rem;
2346
- }
2347
- .text-blue-400 {
2348
- --tw-text-opacity: 1;
2349
- color: rgb(96 165 250 / var(--tw-text-opacity, 1));
2350
- }
2351
- .text-gray-200 {
2352
- --tw-text-opacity: 1;
2353
- color: rgb(229 231 235 / var(--tw-text-opacity, 1));
2354
- }
2355
- .text-gray-300 {
2356
- --tw-text-opacity: 1;
2357
- color: rgb(209 213 219 / var(--tw-text-opacity, 1));
2358
- }
2359
- .text-gray-400 {
2360
- --tw-text-opacity: 1;
2361
- color: rgb(156 163 175 / var(--tw-text-opacity, 1));
2362
- }
2363
- .text-gray-500 {
2364
- --tw-text-opacity: 1;
2365
- color: rgb(107 114 128 / var(--tw-text-opacity, 1));
2366
- }
2367
- .text-gray-700 {
2368
- --tw-text-opacity: 1;
2369
- color: rgb(55 65 81 / var(--tw-text-opacity, 1));
2370
- }
2371
- .text-green-500 {
2372
- --tw-text-opacity: 1;
2373
- color: rgb(34 197 94 / var(--tw-text-opacity, 1));
2374
- }
2375
- .text-red-400 {
2376
- --tw-text-opacity: 1;
2377
- color: rgb(248 113 113 / var(--tw-text-opacity, 1));
2378
- }
2379
- .text-red-500 {
2380
- --tw-text-opacity: 1;
2381
- color: rgb(239 68 68 / var(--tw-text-opacity, 1));
2382
- }
2383
- .text-white {
2384
- --tw-text-opacity: 1;
2385
- color: rgb(255 255 255 / var(--tw-text-opacity, 1));
1834
+
1835
+ .citadel-available-chip {
1836
+ padding: 0.25rem 0.5rem;
1837
+ border-radius: 0.375rem;
1838
+ background: var(--citadel-surface);
2386
1839
  }
2387
- .underline {
2388
- text-decoration-line: underline;
1840
+
1841
+ .citadel-available-chip-text {
1842
+ color: white;
2389
1843
  }
2390
- .caret-transparent {
2391
- caret-color: transparent;
1844
+
1845
+ .citadel-available-chip-prefix {
1846
+ text-decoration: underline;
2392
1847
  }
2393
- .shadow {
2394
- --tw-shadow: 0 1px 3px 0 rgb(0 0 0 / 0.1), 0 1px 2px -1px rgb(0 0 0 / 0.1);
2395
- --tw-shadow-colored: 0 1px 3px 0 var(--tw-shadow-color), 0 1px 2px -1px var(--tw-shadow-color);
2396
- box-shadow: var(--tw-ring-offset-shadow, 0 0 #0000), var(--tw-ring-shadow, 0 0 #0000), var(--tw-shadow);
1848
+
1849
+ .citadel-available-next-arg {
1850
+ color: var(--citadel-word);
2397
1851
  }
2398
- .shadow-lg {
2399
- --tw-shadow: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
2400
- --tw-shadow-colored: 0 10px 15px -3px var(--tw-shadow-color), 0 4px 6px -4px var(--tw-shadow-color);
2401
- box-shadow: var(--tw-ring-offset-shadow, 0 0 #0000), var(--tw-ring-shadow, 0 0 #0000), var(--tw-shadow);
1852
+
1853
+ .citadel-available-next-desc {
1854
+ margin-left: 0.5rem;
1855
+ color: var(--citadel-muted);
2402
1856
  }
2403
- .outline-none {
2404
- outline: 2px solid transparent;
2405
- outline-offset: 2px;
1857
+
1858
+ .citadel-result-json,
1859
+ .citadel-result-text {
1860
+ color: var(--citadel-text);
2406
1861
  }
2407
- .filter {
2408
- filter: var(--tw-blur) var(--tw-brightness) var(--tw-contrast) var(--tw-grayscale) var(--tw-hue-rotate) var(--tw-invert) var(--tw-saturate) var(--tw-sepia) var(--tw-drop-shadow);
1862
+
1863
+ .citadel-result-json {
1864
+ margin: 0;
2409
1865
  }
2410
- .transition {
2411
- transition-property: color, background-color, border-color, text-decoration-color, fill, stroke, opacity, box-shadow, transform, filter, -webkit-backdrop-filter;
2412
- transition-property: color, background-color, border-color, text-decoration-color, fill, stroke, opacity, box-shadow, transform, filter, backdrop-filter;
2413
- transition-property: color, background-color, border-color, text-decoration-color, fill, stroke, opacity, box-shadow, transform, filter, backdrop-filter, -webkit-backdrop-filter;
2414
- transition-timing-function: cubic-bezier(0.4, 0, 0.2, 1);
2415
- transition-duration: 150ms;
1866
+
1867
+ .citadel-result-text {
1868
+ white-space: pre;
2416
1869
  }
2417
- .ease-in-out {
2418
- transition-timing-function: cubic-bezier(0.4, 0, 0.2, 1);
1870
+
1871
+ .citadel-result-error {
1872
+ margin-top: 0.25rem;
1873
+ color: var(--citadel-error);
2419
1874
  }
2420
- .ease-out {
2421
- transition-timing-function: cubic-bezier(0, 0, 0.2, 1);
1875
+
1876
+ .citadel-result-pending {
1877
+ color: var(--citadel-muted);
2422
1878
  }
2423
- .last\\:mb-0:last-child {
2424
- margin-bottom: 0px;
1879
+
1880
+ .citadel-result-image-wrap {
1881
+ margin-block: 0.5rem;
2425
1882
  }
2426
- .last\\:mr-0:last-child {
2427
- margin-right: 0px;
1883
+
1884
+ .citadel-result-image {
1885
+ max-width: 400px;
1886
+ max-height: 300px;
1887
+ height: auto;
1888
+ object-fit: contain;
1889
+ border-radius: 0.5rem;
2428
1890
  }
2429
- `, En = ({
2430
- config: t = N,
1891
+ `, wt = ({
1892
+ config: n = N,
2431
1893
  commandRegistry: e,
2432
- containerId: n = null
1894
+ containerId: t = null
2433
1895
  }) => {
2434
- const r = F(new X()), o = e ?? r.current, s = F(null), i = t.displayMode ?? N.displayMode ?? "panel";
2435
- return z(() => {
1896
+ const s = z(new X()), r = e ?? s.current, a = z(null), o = A(() => ({ width: "100%", height: "100%" }), []), c = n.displayMode ?? N.displayMode ?? "panel";
1897
+ return P(() => {
2436
1898
  k.configure({
2437
- level: t.logLevel || N.logLevel || re.ERROR,
1899
+ level: n.logLevel || N.logLevel || ie.ERROR,
2438
1900
  prefix: "[Citadel]"
2439
1901
  });
2440
- const l = new Ee(o, t), a = i === "inline" && !n, c = a ? s.current : n ? document.getElementById(n) : document.body;
2441
- if (c)
2442
- c.appendChild(l);
1902
+ const i = new Ie(r, n), d = c === "inline" && !t, g = d ? a.current : t ? document.getElementById(t) : document.body;
1903
+ if (g)
1904
+ g.appendChild(i);
2443
1905
  else {
2444
- if (a) {
1906
+ if (d) {
2445
1907
  console.warn("[Citadel] No host available for inline mode; skipping mount.");
2446
1908
  return;
2447
1909
  }
2448
- console.warn(`Container with id "${n}" not found, falling back to body`), document.body.appendChild(l);
1910
+ console.warn(`Container with id "${t}" not found, falling back to body`), document.body.appendChild(i);
2449
1911
  }
2450
1912
  return () => {
2451
- var g;
2452
- (g = l.parentElement) == null || g.removeChild(l);
1913
+ var u;
1914
+ (u = i.parentElement) == null || u.removeChild(i);
2453
1915
  };
2454
- }, [o, n, t, i]), i === "inline" && !n ? /* @__PURE__ */ m("div", { ref: s, style: { width: "100%", height: "100%" } }) : null;
1916
+ }, [r, t, n, c]), c === "inline" && !t ? /* @__PURE__ */ m("div", { ref: a, style: o }) : null;
2455
1917
  };
2456
- class Ee extends HTMLElement {
2457
- constructor(n, r) {
2458
- var s;
1918
+ class Ie extends HTMLElement {
1919
+ constructor(t, s) {
1920
+ var a;
2459
1921
  super();
2460
- b(this, "shadow");
2461
- b(this, "root", null);
2462
- b(this, "commandRegistry");
2463
- b(this, "config");
2464
- this.shadow = this.attachShadow({ mode: "open" }), this.commandRegistry = n, this.config = r;
2465
- const o = ((s = this.config) == null ? void 0 : s.displayMode) ?? "panel";
2466
- this.setAttribute("data-display-mode", o);
1922
+ f(this, "shadow");
1923
+ f(this, "root", null);
1924
+ f(this, "commandRegistry");
1925
+ f(this, "config");
1926
+ this.shadow = this.attachShadow({ mode: "open" }), this.commandRegistry = t, this.config = s;
1927
+ const r = ((a = this.config) == null ? void 0 : a.displayMode) ?? "panel";
1928
+ this.setAttribute("data-display-mode", r);
2467
1929
  }
2468
1930
  connectedCallback() {
2469
1931
  try {
2470
- const r = [pe, he, ge, un].map((o) => {
2471
- const s = new CSSStyleSheet();
2472
- return s.replaceSync(o), s;
1932
+ const s = [ye].map((r) => {
1933
+ const a = new CSSStyleSheet();
1934
+ return a.replaceSync(r), a;
2473
1935
  });
2474
- this.shadow.adoptedStyleSheets = [...r];
1936
+ this.shadow.adoptedStyleSheets = [...s];
2475
1937
  } catch {
2476
- const r = [pe, he, ge].join(`
2477
- `), o = document.createElement("style");
2478
- o.textContent = r, this.shadow.appendChild(o);
1938
+ const s = [ye].join(`
1939
+ `), r = document.createElement("style");
1940
+ r.textContent = s, this.shadow.appendChild(r);
2479
1941
  }
2480
- const n = document.createElement("div");
2481
- n.id = "citadel-root", n.style.width = "100%", n.style.height = "100%", this.shadow.appendChild(n), this.root = Re(n), this.root.render(
2482
- /* @__PURE__ */ m(Le, { config: this.config || N, commandRegistry: this.commandRegistry, children: /* @__PURE__ */ m(pn, {}) })
1942
+ const t = document.createElement("div");
1943
+ t.id = "citadel-root", t.style.width = "100%", t.style.height = "100%", this.shadow.appendChild(t), this.root = Te(t), this.root.render(
1944
+ /* @__PURE__ */ m(We, { config: this.config || N, commandRegistry: this.commandRegistry, children: /* @__PURE__ */ m(ot, {}) })
2483
1945
  );
2484
1946
  }
2485
1947
  disconnectedCallback() {
2486
- const n = this.root;
2487
- if (this.root = null, !n) {
1948
+ const t = this.root;
1949
+ if (this.root = null, !t) {
2488
1950
  this.shadow.replaceChildren();
2489
1951
  return;
2490
1952
  }
2491
1953
  queueMicrotask(() => {
2492
- n.unmount(), this.shadow.replaceChildren();
1954
+ t.unmount(), this.shadow.replaceChildren();
2493
1955
  });
2494
1956
  }
2495
1957
  }
2496
- typeof window < "u" && window.customElements && !window.customElements.get("citadel-element") && window.customElements.define("citadel-element", Ee);
2497
- const pn = () => (j().displayMode ?? "panel") === "inline" ? /* @__PURE__ */ m(mn, {}) : /* @__PURE__ */ m(dn, {});
2498
- class hn {
1958
+ typeof window < "u" && window.customElements && !window.customElements.get("citadel-element") && window.customElements.define("citadel-element", Ie);
1959
+ const ot = () => (j().displayMode ?? "panel") === "inline" ? /* @__PURE__ */ m(at, {}) : /* @__PURE__ */ m(rt, {});
1960
+ class it {
2499
1961
  constructor() {
2500
- b(this, "_description");
1962
+ f(this, "_description");
2501
1963
  }
2502
1964
  describe(e) {
2503
1965
  return this._description = e, this;
@@ -2506,13 +1968,13 @@ class hn {
2506
1968
  return this._description;
2507
1969
  }
2508
1970
  }
2509
- class gn {
1971
+ class ct {
2510
1972
  constructor(e) {
2511
- b(this, "state");
1973
+ f(this, "state");
2512
1974
  this.state = {
2513
1975
  path: e,
2514
1976
  description: "",
2515
- segments: fn(e)
1977
+ segments: lt(e)
2516
1978
  };
2517
1979
  }
2518
1980
  describe(e) {
@@ -2521,12 +1983,12 @@ class gn {
2521
1983
  details(e) {
2522
1984
  return this.state.details = e, this;
2523
1985
  }
2524
- arg(e, n) {
2525
- const r = new hn();
2526
- return n == null || n(r), this.state.segments.push({
1986
+ arg(e, t) {
1987
+ const s = new it();
1988
+ return t == null || t(s), this.state.segments.push({
2527
1989
  type: "argument",
2528
1990
  name: e,
2529
- description: r.description
1991
+ description: s.description
2530
1992
  }), this;
2531
1993
  }
2532
1994
  handle(e) {
@@ -2539,85 +2001,85 @@ class gn {
2539
2001
  };
2540
2002
  }
2541
2003
  }
2542
- function fn(t) {
2543
- const e = t.trim();
2004
+ function lt(n) {
2005
+ const e = n.trim();
2544
2006
  if (!e)
2545
2007
  throw new Error("Command path cannot be empty");
2546
- const n = e.split(".");
2547
- if (n.some((r) => r.trim() === ""))
2548
- throw new Error(`Invalid command path "${t}". Empty segments are not allowed.`);
2549
- if (n.some((r) => r.includes(" ")))
2008
+ const t = e.split(".");
2009
+ if (t.some((s) => s.trim() === ""))
2010
+ throw new Error(`Invalid command path "${n}". Empty segments are not allowed.`);
2011
+ if (t.some((s) => s.includes(" ")))
2550
2012
  throw new Error(
2551
- `Invalid command path "${t}". Use dot-delimited words (e.g. "user.show").`
2013
+ `Invalid command path "${n}". Use dot-delimited words (e.g. "user.show").`
2552
2014
  );
2553
- return n.map((r) => ({
2015
+ return t.map((s) => ({
2554
2016
  type: "word",
2555
- name: r
2017
+ name: s
2556
2018
  }));
2557
2019
  }
2558
- function wn(t) {
2559
- return t.flatMap((e) => e.type === "argument" ? [e.name] : []);
2020
+ function dt(n) {
2021
+ return n.flatMap((e) => e.type === "argument" ? [e.name] : []);
2560
2022
  }
2561
- function yn(t) {
2562
- const e = wn(t.segments);
2563
- return async (n) => {
2564
- const r = e.reduce((o, s, i) => (o[s] = n[i], o), {});
2023
+ function mt(n) {
2024
+ const e = dt(n.segments);
2025
+ return async (t) => {
2026
+ const s = e.reduce((r, a, o) => (r[a] = t[o], r), {});
2565
2027
  return Promise.resolve(
2566
- t.handler({
2567
- rawArgs: n,
2568
- namedArgs: r,
2569
- commandPath: t.path
2028
+ n.handler({
2029
+ rawArgs: t,
2030
+ namedArgs: s,
2031
+ commandPath: n.path
2570
2032
  })
2571
2033
  );
2572
2034
  };
2573
2035
  }
2574
- function Nn(t) {
2575
- return new gn(t);
2036
+ function Ct(n) {
2037
+ return new ct(n);
2576
2038
  }
2577
- function bn(t, e) {
2578
- t.addCommand(
2039
+ function ut(n, e) {
2040
+ n.addCommand(
2579
2041
  e.segments,
2580
2042
  e.description,
2581
- yn(e)
2043
+ mt(e)
2582
2044
  );
2583
2045
  }
2584
- function xn(t, e) {
2585
- return e.forEach((n) => bn(t, n)), t;
2046
+ function pt(n, e) {
2047
+ return e.forEach((t) => ut(n, t)), n;
2586
2048
  }
2587
- function zn(t) {
2049
+ function vt(n) {
2588
2050
  const e = new X();
2589
- return xn(e, t);
2051
+ return pt(e, n);
2590
2052
  }
2591
- function An(t) {
2592
- return new Y(t);
2053
+ function St(n) {
2054
+ return new Y(n);
2593
2055
  }
2594
- function _n(t) {
2595
- return new Pe(t);
2056
+ function xt(n) {
2057
+ return new ze(n);
2596
2058
  }
2597
- function In(t, e = "") {
2598
- return new Me(t, e);
2059
+ function bt(n, e = "") {
2060
+ return new Fe(n, e);
2599
2061
  }
2600
- function Rn(t) {
2601
- return new fe(t);
2062
+ function kt(n) {
2063
+ return new we(n);
2602
2064
  }
2603
2065
  export {
2604
- En as Citadel,
2066
+ wt as Citadel,
2605
2067
  X as CommandRegistry,
2606
- O as CommandResult,
2607
- W as CommandStatus,
2608
- tn as DEFAULT_CURSOR_CONFIGS,
2609
- fe as ErrorCommandResult,
2610
- Me as ImageCommandResult,
2611
- Pe as JsonCommandResult,
2612
- te as OutputItem,
2613
- He as PendingCommandResult,
2068
+ W as CommandResult,
2069
+ q as CommandStatus,
2070
+ Qe as DEFAULT_CURSOR_CONFIGS,
2071
+ we as ErrorCommandResult,
2072
+ Fe as ImageCommandResult,
2073
+ ze as JsonCommandResult,
2074
+ oe as OutputItem,
2075
+ De as PendingCommandResult,
2614
2076
  Y as TextCommandResult,
2615
- Nn as command,
2616
- zn as createCommandRegistry,
2617
- Rn as error,
2618
- In as image,
2619
- _n as json,
2620
- bn as registerCommand,
2621
- xn as registerCommands,
2622
- An as text
2077
+ Ct as command,
2078
+ vt as createCommandRegistry,
2079
+ kt as error,
2080
+ bt as image,
2081
+ xt as json,
2082
+ ut as registerCommand,
2083
+ pt as registerCommands,
2084
+ St as text
2623
2085
  };