@principal-ade/panel-layouts 0.2.8 → 0.3.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.
package/dist/index.esm.js CHANGED
@@ -1,13 +1,13 @@
1
- import './index.css';var we = Object.defineProperty;
2
- var ke = (o, e, t) => e in o ? we(o, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : o[e] = t;
3
- var H = (o, e, t) => ke(o, typeof e != "symbol" ? e + "" : e, t);
4
- import { EditableConfigurablePanelLayout as It, ResponsiveConfigurablePanelLayout as Rt, mapThemeToPanelVars as Lt, mapThemeToTabVars as At } from "@principal-ade/panels";
5
- import Ce, { useState as L, useRef as z, useEffect as W, useCallback as x, forwardRef as ve, useMemo as X } from "react";
6
- import { jsx as l, jsxs as b, Fragment as se } from "react/jsx-runtime";
7
- import { useTheme as q } from "@principal-ade/industry-theme";
8
- class Se {
1
+ import './index.css';var he = Object.defineProperty;
2
+ var ge = (o, e, t) => e in o ? he(o, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : o[e] = t;
3
+ var U = (o, e, t) => ge(o, typeof e != "symbol" ? e + "" : e, t);
4
+ import { EditableConfigurablePanelLayout as lt, ResponsiveConfigurablePanelLayout as ct, mapThemeToPanelVars as dt, mapThemeToTabVars as pt } from "@principal-ade/panels";
5
+ import { useState as W, useRef as M, useEffect as A, useCallback as g, useMemo as me } from "react";
6
+ import { jsx as s, jsxs as m, Fragment as ke } from "react/jsx-runtime";
7
+ import { useTheme as K } from "@principal-ade/industry-theme";
8
+ class xe {
9
9
  constructor() {
10
- H(this, "storageKey", "panel-layouts");
10
+ U(this, "storageKey", "panel-layouts");
11
11
  }
12
12
  async load(e) {
13
13
  try {
@@ -28,122 +28,122 @@ class Se {
28
28
  }
29
29
  }
30
30
  }
31
- function tt(o) {
31
+ function Ke(o) {
32
32
  const {
33
33
  viewKey: e,
34
34
  defaultSizes: t,
35
35
  panelType: r,
36
- adapter: s = new Se()
37
- } = o, [a, n] = L(t), [i, p] = L(o.collapsed), u = z(o.collapsed), h = z({}), d = z(null), f = z(null);
38
- W(() => {
36
+ adapter: a = new xe()
37
+ } = o, [n, i] = W(t), [d, y] = W(o.collapsed), c = M(o.collapsed), T = M({}), p = M(null), u = M(null);
38
+ A(() => {
39
39
  (async () => {
40
- const P = await s.load(e);
41
- P != null && P.sizes && (n(P.sizes), g(P.sizes));
40
+ const b = await a.load(e);
41
+ b != null && b.sizes && (i(b.sizes), x(b.sizes));
42
42
  })();
43
43
  }, [e]);
44
- const g = x(
45
- (w) => {
46
- "left" in w && w.left > 0 && (h.current.left = w.left), "middle" in w && w.middle > 0 && (h.current.middle = w.middle), "right" in w && w.right > 0 && (h.current.right = w.right);
44
+ const x = g(
45
+ (f) => {
46
+ "left" in f && f.left > 0 && (T.current.left = f.left), "middle" in f && f.middle > 0 && (T.current.middle = f.middle), "right" in f && f.right > 0 && (T.current.right = f.right);
47
47
  },
48
48
  []
49
- ), m = x(
50
- (w) => {
51
- const P = h.current[w];
52
- if (P && P > 0)
53
- return P;
54
- if (w === "left" && "left" in t && t.left > 0)
49
+ ), k = g(
50
+ (f) => {
51
+ const b = T.current[f];
52
+ if (b && b > 0)
53
+ return b;
54
+ if (f === "left" && "left" in t && t.left > 0)
55
55
  return t.left;
56
- if (w === "right" && "right" in t && t.right > 0)
56
+ if (f === "right" && "right" in t && t.right > 0)
57
57
  return t.right;
58
58
  },
59
59
  [t]
60
- ), c = z(t);
61
- W(() => {
62
- ("left" in t && t.left !== c.current.left || "middle" in t && "middle" in c.current && t.middle !== c.current.middle || "right" in t && t.right !== c.current.right) && (n(t), g(t), c.current = t);
63
- }, [t, g]), W(() => {
64
- const w = o.collapsed.left !== u.current.left, P = "right" in o.collapsed && "right" in u.current && o.collapsed.right !== u.current.right;
65
- (w || P) && (p(o.collapsed), u.current = { ...o.collapsed });
60
+ ), l = M(t);
61
+ A(() => {
62
+ ("left" in t && t.left !== l.current.left || "middle" in t && "middle" in l.current && t.middle !== l.current.middle || "right" in t && t.right !== l.current.right) && (i(t), x(t), l.current = t);
63
+ }, [t, x]), A(() => {
64
+ const f = o.collapsed.left !== c.current.left, b = "right" in o.collapsed && "right" in c.current && o.collapsed.right !== c.current.right;
65
+ (f || b) && (y(o.collapsed), c.current = { ...o.collapsed });
66
66
  }, [o.collapsed.left, o.collapsed.right]);
67
- const k = x(
68
- async (w) => {
67
+ const h = g(
68
+ async (f) => {
69
69
  try {
70
- await s.save(e, { sizes: w });
71
- } catch (P) {
70
+ await a.save(e, { sizes: f });
71
+ } catch (b) {
72
72
  console.error(
73
73
  `Failed to save panel preferences for ${e}:`,
74
- P
74
+ b
75
75
  );
76
76
  }
77
77
  },
78
- [e, s]
79
- ), R = x(
80
- (w) => {
81
- const P = { ...w };
78
+ [e, a]
79
+ ), C = g(
80
+ (f) => {
81
+ const b = { ...f };
82
82
  let v = !0;
83
- if ("left" in w) {
84
- const C = !!(i != null && i.left), y = w.left;
85
- if (C) {
86
- const S = m("left");
87
- S !== void 0 && S > 0 ? P.left = S : v = !1;
88
- } else y === 0 && (v = !1);
83
+ if ("left" in f) {
84
+ const S = !!(d != null && d.left), _ = f.left;
85
+ if (S) {
86
+ const P = k("left");
87
+ P !== void 0 && P > 0 ? b.left = P : v = !1;
88
+ } else _ === 0 && (v = !1);
89
89
  }
90
- if (r === "three-panel" && "right" in w) {
91
- const C = !!(i != null && i.right), y = w.right;
92
- if (C) {
93
- const S = m("right");
94
- S !== void 0 && S > 0 ? P.right = S : v = !1;
95
- } else y === 0 && (v = !1);
90
+ if (r === "three-panel" && "right" in f) {
91
+ const S = !!(d != null && d.right), _ = f.right;
92
+ if (S) {
93
+ const P = k("right");
94
+ P !== void 0 && P > 0 ? b.right = P : v = !1;
95
+ } else _ === 0 && (v = !1);
96
96
  }
97
- if (n(P), g(P), d.current && (clearTimeout(d.current), d.current = null), !v) {
98
- f.current = null;
97
+ if (i(b), x(b), p.current && (clearTimeout(p.current), p.current = null), !v) {
98
+ u.current = null;
99
99
  return;
100
100
  }
101
- f.current = P, d.current = setTimeout(() => {
102
- const C = f.current;
103
- C && (k(C), f.current = null), d.current = null;
101
+ u.current = b, p.current = setTimeout(() => {
102
+ const S = u.current;
103
+ S && (h(S), u.current = null), p.current = null;
104
104
  }, 500);
105
105
  },
106
106
  [
107
- i,
108
- m,
109
- r,
107
+ d,
110
108
  k,
111
- g
109
+ r,
110
+ h,
111
+ x
112
112
  ]
113
113
  );
114
- W(() => () => {
115
- if (d.current) {
116
- const w = f.current;
117
- w && (k(w), f.current = null), clearTimeout(d.current), d.current = null;
114
+ A(() => () => {
115
+ if (p.current) {
116
+ const f = u.current;
117
+ f && (h(f), u.current = null), clearTimeout(p.current), p.current = null;
118
118
  }
119
- }, [k]);
120
- const A = x(async () => {
121
- }, []), I = x(async () => {
122
- }, []), $ = x(async () => {
123
- }, []), D = x(async () => {
119
+ }, [h]);
120
+ const E = g(async () => {
121
+ }, []), R = g(async () => {
122
+ }, []), I = g(async () => {
123
+ }, []), F = g(async () => {
124
124
  }, []);
125
125
  return r === "three-panel" ? {
126
126
  type: "three-panel",
127
- sizes: a,
128
- collapsed: i,
129
- handlePanelResize: R,
130
- handleLeftCollapseComplete: A,
131
- handleLeftExpandComplete: I,
132
- handleRightCollapseComplete: $,
133
- handleRightExpandComplete: D
127
+ sizes: n,
128
+ collapsed: d,
129
+ handlePanelResize: C,
130
+ handleLeftCollapseComplete: E,
131
+ handleLeftExpandComplete: R,
132
+ handleRightCollapseComplete: I,
133
+ handleRightExpandComplete: F
134
134
  } : {
135
135
  type: "two-panel",
136
- sizes: a,
137
- collapsed: i,
138
- handlePanelResize: R,
139
- handleLeftCollapseComplete: A,
140
- handleLeftExpandComplete: I
136
+ sizes: n,
137
+ collapsed: d,
138
+ handlePanelResize: C,
139
+ handleLeftCollapseComplete: E,
140
+ handleLeftExpandComplete: R
141
141
  };
142
142
  }
143
- class Te {
143
+ class we {
144
144
  constructor() {
145
- H(this, "PRESETS_KEY", "panel-layouts:workspace-presets");
146
- H(this, "REPO_STATE_PREFIX", "panel-layouts:repo-state:");
145
+ U(this, "PRESETS_KEY", "panel-layouts:workspace-presets");
146
+ U(this, "REPO_STATE_PREFIX", "panel-layouts:repo-state:");
147
147
  }
148
148
  /**
149
149
  * Load all user-created workspace presets
@@ -203,14 +203,14 @@ class Te {
203
203
  for (let t = 0; t < localStorage.length; t++) {
204
204
  const r = localStorage.key(t);
205
205
  if (r && r.startsWith(this.REPO_STATE_PREFIX)) {
206
- const s = r.substring(this.REPO_STATE_PREFIX.length), a = localStorage.getItem(r);
207
- if (a)
206
+ const a = r.substring(this.REPO_STATE_PREFIX.length), n = localStorage.getItem(r);
207
+ if (n)
208
208
  try {
209
- e[s] = JSON.parse(a);
210
- } catch (n) {
209
+ e[a] = JSON.parse(n);
210
+ } catch (i) {
211
211
  console.error(
212
- `Failed to parse repository state for ${s}:`,
213
- n
212
+ `Failed to parse repository state for ${a}:`,
213
+ i
214
214
  );
215
215
  }
216
216
  }
@@ -221,7 +221,7 @@ class Te {
221
221
  }
222
222
  }
223
223
  }
224
- class _ {
224
+ class L {
225
225
  /**
226
226
  * Configure a custom storage adapter (for Electron IPC or remote storage)
227
227
  */
@@ -248,7 +248,7 @@ class _ {
248
248
  * Create a new workspace layout
249
249
  */
250
250
  static async createWorkspaceLayout(e) {
251
- const t = await this.adapter.loadWorkspacePresets(), r = this.generateWorkspaceId(e.name), s = {
251
+ const t = await this.adapter.loadWorkspacePresets(), r = this.generateWorkspaceId(e.name), a = {
252
252
  id: r,
253
253
  name: e.name,
254
254
  description: e.description,
@@ -258,34 +258,34 @@ class _ {
258
258
  createdAt: Date.now(),
259
259
  updatedAt: Date.now(),
260
260
  isBuiltIn: !1
261
- }, a = {
261
+ }, n = {
262
262
  ...t,
263
- [r]: s
263
+ [r]: a
264
264
  };
265
- return await this.adapter.saveWorkspacePresets(a), s;
265
+ return await this.adapter.saveWorkspacePresets(n), a;
266
266
  }
267
267
  /**
268
268
  * Update an existing workspace layout
269
269
  */
270
270
  static async updateWorkspaceLayout(e, t) {
271
- const r = await this.adapter.loadWorkspacePresets(), s = r[e];
272
- if (!s)
271
+ const r = await this.adapter.loadWorkspacePresets(), a = r[e];
272
+ if (!a)
273
273
  return console.error(`Workspace layout ${e} not found`), null;
274
- if (s.isBuiltIn)
274
+ if (a.isBuiltIn)
275
275
  return console.error(`Cannot update built-in workspace layout ${e}`), null;
276
- const a = {
277
- ...s,
276
+ const n = {
277
+ ...a,
278
278
  ...t,
279
279
  id: e,
280
280
  // Preserve ID
281
- createdAt: s.createdAt,
281
+ createdAt: a.createdAt,
282
282
  // Preserve creation time
283
283
  updatedAt: Date.now()
284
- }, n = {
284
+ }, i = {
285
285
  ...r,
286
- [e]: a
286
+ [e]: n
287
287
  };
288
- return await this.adapter.saveWorkspacePresets(n), a;
288
+ return await this.adapter.saveWorkspacePresets(i), n;
289
289
  }
290
290
  /**
291
291
  * Delete a workspace layout
@@ -296,8 +296,8 @@ class _ {
296
296
  return console.error(`Workspace layout ${e} not found`), !1;
297
297
  if (r.isBuiltIn)
298
298
  return console.error(`Cannot delete built-in workspace layout ${e}`), !1;
299
- const s = { ...t };
300
- return delete s[e], await this.adapter.saveWorkspacePresets(s), !0;
299
+ const a = { ...t };
300
+ return delete a[e], await this.adapter.saveWorkspacePresets(a), !0;
301
301
  }
302
302
  /**
303
303
  * Get repository state (which workspace + current sizes/collapsed)
@@ -335,23 +335,23 @@ class _ {
335
335
  * Check if repository state differs from workspace defaults
336
336
  */
337
337
  static hasStateDeviation(e, t) {
338
- const r = t.defaultSizes ? JSON.stringify(e.sizes) !== JSON.stringify(t.defaultSizes) : !1, s = t.defaultCollapsed ? JSON.stringify(e.collapsed) !== JSON.stringify(t.defaultCollapsed) : !1;
339
- return { hasSizeDeviation: r, hasCollapsedDeviation: s };
338
+ const r = t.defaultSizes ? JSON.stringify(e.sizes) !== JSON.stringify(t.defaultSizes) : !1, a = t.defaultCollapsed ? JSON.stringify(e.collapsed) !== JSON.stringify(t.defaultCollapsed) : !1;
339
+ return { hasSizeDeviation: r, hasCollapsedDeviation: a };
340
340
  }
341
341
  /**
342
342
  * Update workspace defaults from repository state
343
343
  */
344
344
  static async updateWorkspaceFromRepositoryState(e, t) {
345
- const r = await this.getWorkspaceLayout(e), s = await this.getRepositoryState(t);
346
- if (!r || !s || r.isBuiltIn) {
345
+ const r = await this.getWorkspaceLayout(e), a = await this.getRepositoryState(t);
346
+ if (!r || !a || r.isBuiltIn) {
347
347
  console.error(
348
348
  "Cannot update built-in workspace or workspace/state not found"
349
349
  );
350
350
  return;
351
351
  }
352
352
  await this.updateWorkspaceLayout(e, {
353
- defaultSizes: s.sizes,
354
- defaultCollapsed: s.collapsed
353
+ defaultSizes: a.sizes,
354
+ defaultCollapsed: a.collapsed
355
355
  });
356
356
  }
357
357
  /**
@@ -363,9 +363,9 @@ class _ {
363
363
  console.error(`Workspace ${t} not found`);
364
364
  return;
365
365
  }
366
- const s = await this.getRepositoryState(e);
367
- s && await this.setRepositoryState(e, {
368
- ...s,
366
+ const a = await this.getRepositoryState(e);
367
+ a && await this.setRepositoryState(e, {
368
+ ...a,
369
369
  sizes: r.defaultSizes || { left: 20, middle: 45, right: 35 },
370
370
  collapsed: r.defaultCollapsed || { left: !1, right: !1 }
371
371
  });
@@ -381,8 +381,8 @@ class _ {
381
381
  */
382
382
  static async findMatchingWorkspace(e) {
383
383
  const t = await this.getWorkspaceLayouts();
384
- for (const [r, s] of Object.entries(t))
385
- if (this.isLayoutMatchingWorkspace(e, s))
384
+ for (const [r, a] of Object.entries(t))
385
+ if (this.isLayoutMatchingWorkspace(e, a))
386
386
  return r;
387
387
  return null;
388
388
  }
@@ -610,296 +610,296 @@ class _ {
610
610
  Object.keys(e).length;
611
611
  }
612
612
  }
613
- H(_, "adapter", new Te());
614
- function ot(o = {}) {
615
- const { repositoryKey: e, autoInitialize: t = !1, defaultWorkspaceId: r } = o, [s, a] = L(
613
+ U(L, "adapter", new we());
614
+ function Ve(o = {}) {
615
+ const { repositoryKey: e, autoInitialize: t = !1, defaultWorkspaceId: r } = o, [a, n] = W(
616
616
  {}
617
- ), [n, i] = L(null), [p, u] = L(null), [h, d] = L(!0), [f, g] = L(null), m = x(async () => {
617
+ ), [i, d] = W(null), [y, c] = W(null), [T, p] = W(!0), [u, x] = W(null), k = g(async () => {
618
618
  try {
619
- d(!0), g(null);
620
- const v = await _.getWorkspaceLayouts();
621
- if (a(v), e) {
622
- let C = await _.getRepositoryState(e);
623
- if (!C && t) {
624
- const y = r || "project-management", S = await _.getWorkspaceLayout(y);
625
- S && (C = {
626
- workspaceId: y,
627
- sizes: S.defaultSizes || {
619
+ p(!0), x(null);
620
+ const v = await L.getWorkspaceLayouts();
621
+ if (n(v), e) {
622
+ let S = await L.getRepositoryState(e);
623
+ if (!S && t) {
624
+ const _ = r || "project-management", P = await L.getWorkspaceLayout(_);
625
+ P && (S = {
626
+ workspaceId: _,
627
+ sizes: P.defaultSizes || {
628
628
  left: 20,
629
629
  middle: 45,
630
630
  right: 35
631
631
  },
632
- collapsed: S.defaultCollapsed || {
632
+ collapsed: P.defaultCollapsed || {
633
633
  left: !1,
634
634
  right: !1
635
635
  }
636
- }, await _.setRepositoryState(
636
+ }, await L.setRepositoryState(
637
637
  e,
638
- C
638
+ S
639
639
  ));
640
640
  }
641
- if (i(C), C != null && C.workspaceId) {
642
- const y = await _.getWorkspaceLayout(
643
- C.workspaceId
641
+ if (d(S), S != null && S.workspaceId) {
642
+ const _ = await L.getWorkspaceLayout(
643
+ S.workspaceId
644
644
  );
645
- u(y);
645
+ c(_);
646
646
  } else
647
- u(null);
647
+ c(null);
648
648
  }
649
649
  } catch (v) {
650
- g(v), console.error("Failed to load workspace data:", v);
650
+ x(v), console.error("Failed to load workspace data:", v);
651
651
  } finally {
652
- d(!1);
652
+ p(!1);
653
653
  }
654
654
  }, [e, t, r]);
655
- W(() => {
656
- m();
657
- }, [m]);
658
- const c = x(
659
- async (v) => await _.getWorkspaceLayout(v),
655
+ A(() => {
656
+ k();
657
+ }, [k]);
658
+ const l = g(
659
+ async (v) => await L.getWorkspaceLayout(v),
660
660
  []
661
- ), k = x(
661
+ ), h = g(
662
662
  async (v) => {
663
- const C = await _.createWorkspaceLayout(v);
664
- return await m(), C;
663
+ const S = await L.createWorkspaceLayout(v);
664
+ return await k(), S;
665
665
  },
666
- [m]
667
- ), R = x(
668
- async (v, C) => {
669
- const y = await _.updateWorkspaceLayout(v, C);
670
- return await m(), y;
666
+ [k]
667
+ ), C = g(
668
+ async (v, S) => {
669
+ const _ = await L.updateWorkspaceLayout(v, S);
670
+ return await k(), _;
671
671
  },
672
- [m]
673
- ), A = x(
672
+ [k]
673
+ ), E = g(
674
674
  async (v) => {
675
- const C = await _.deleteWorkspaceLayout(v);
676
- return C && await m(), C;
675
+ const S = await L.deleteWorkspaceLayout(v);
676
+ return S && await k(), S;
677
677
  },
678
- [m]
679
- ), I = x(
678
+ [k]
679
+ ), R = g(
680
680
  async (v) => {
681
681
  if (!e) {
682
682
  console.error("Cannot apply workspace without repositoryKey");
683
683
  return;
684
684
  }
685
- const C = await _.getWorkspaceLayout(v);
686
- if (!C) {
685
+ const S = await L.getWorkspaceLayout(v);
686
+ if (!S) {
687
687
  console.error(`Workspace ${v} not found`);
688
688
  return;
689
689
  }
690
- const y = {
690
+ const _ = {
691
691
  workspaceId: v,
692
- sizes: C.defaultSizes || { left: 20, middle: 45, right: 35 },
693
- collapsed: C.defaultCollapsed || {
692
+ sizes: S.defaultSizes || { left: 20, middle: 45, right: 35 },
693
+ collapsed: S.defaultCollapsed || {
694
694
  left: !1,
695
695
  right: !1
696
696
  }
697
697
  };
698
- await _.setRepositoryState(e, y), await m();
698
+ await L.setRepositoryState(e, _), await k();
699
699
  },
700
- [e, m]
701
- ), $ = x(
700
+ [e, k]
701
+ ), I = g(
702
702
  async (v) => {
703
703
  if (!e) {
704
704
  console.error("Cannot update sizes without repositoryKey");
705
705
  return;
706
706
  }
707
- await _.updateRepositorySizes(e, v), await m();
707
+ await L.updateRepositorySizes(e, v), await k();
708
708
  },
709
- [e, m]
710
- ), D = x(
709
+ [e, k]
710
+ ), F = g(
711
711
  async (v) => {
712
712
  if (!e) {
713
713
  console.error("Cannot update collapsed without repositoryKey");
714
714
  return;
715
715
  }
716
- await _.updateRepositoryCollapsed(
716
+ await L.updateRepositoryCollapsed(
717
717
  e,
718
718
  v
719
- ), await m();
719
+ ), await k();
720
720
  },
721
- [e, m]
722
- ), w = x(async () => {
723
- if (!e || !(n != null && n.workspaceId)) {
721
+ [e, k]
722
+ ), f = g(async () => {
723
+ if (!e || !(i != null && i.workspaceId)) {
724
724
  console.error("Cannot reset without repositoryKey and active workspace");
725
725
  return;
726
726
  }
727
- await _.resetRepositoryToWorkspaceDefaults(
727
+ await L.resetRepositoryToWorkspaceDefaults(
728
728
  e,
729
- n.workspaceId
730
- ), await m();
731
- }, [e, n == null ? void 0 : n.workspaceId, m]), P = x(async () => {
732
- await m();
733
- }, [m]);
729
+ i.workspaceId
730
+ ), await k();
731
+ }, [e, i == null ? void 0 : i.workspaceId, k]), b = g(async () => {
732
+ await k();
733
+ }, [k]);
734
734
  return {
735
- workspaces: s,
736
- repositoryState: n,
737
- activeWorkspace: p,
738
- loading: h,
739
- error: f,
740
- getWorkspace: c,
741
- createWorkspace: k,
742
- updateWorkspace: R,
743
- deleteWorkspace: A,
744
- applyWorkspace: I,
745
- updateSizes: $,
746
- updateCollapsed: D,
747
- resetToDefaults: w,
748
- refresh: P
735
+ workspaces: a,
736
+ repositoryState: i,
737
+ activeWorkspace: y,
738
+ loading: T,
739
+ error: u,
740
+ getWorkspace: l,
741
+ createWorkspace: h,
742
+ updateWorkspace: C,
743
+ deleteWorkspace: E,
744
+ applyWorkspace: R,
745
+ updateSizes: I,
746
+ updateCollapsed: F,
747
+ resetToDefaults: f,
748
+ refresh: b
749
749
  };
750
750
  }
751
- function rt(o = {}) {
751
+ function Je(o = {}) {
752
752
  const {
753
753
  initialFocus: e = null,
754
754
  collapsed: t = {},
755
755
  panelType: r = "three-panel",
756
- onFocusChange: s,
757
- events: a,
758
- getPanelId: n
759
- } = o, [i, p] = L(
756
+ onFocusChange: a,
757
+ events: n,
758
+ getPanelId: i
759
+ } = o, [d, y] = W(
760
760
  e
761
- ), u = x(
762
- (c) => {
763
- const k = i;
764
- if (p(c), s == null || s(c), a && n) {
765
- if (k) {
766
- const A = n(k);
767
- A && a.emit({
761
+ ), c = g(
762
+ (l) => {
763
+ const h = d;
764
+ if (y(l), a == null || a(l), n && i) {
765
+ if (h) {
766
+ const E = i(h);
767
+ E && n.emit({
768
768
  type: "panel:blur",
769
769
  source: "panel-layouts",
770
770
  timestamp: Date.now(),
771
771
  payload: {
772
- panelId: A,
773
- panelSlot: k,
774
- nextPanelId: n(c)
772
+ panelId: E,
773
+ panelSlot: h,
774
+ nextPanelId: i(l)
775
775
  }
776
776
  });
777
777
  }
778
- const R = n(c);
779
- R && a.emit({
778
+ const C = i(l);
779
+ C && n.emit({
780
780
  type: "panel:focus",
781
781
  source: "panel-layouts",
782
782
  timestamp: Date.now(),
783
783
  payload: {
784
- panelId: R,
785
- panelSlot: c,
784
+ panelId: C,
785
+ panelSlot: l,
786
786
  source: "keyboard-shortcut"
787
787
  }
788
788
  });
789
789
  }
790
790
  },
791
- [i, s, a, n]
792
- ), h = x(() => {
793
- const c = i;
794
- if (p(null), s == null || s(null), a && n && c) {
795
- const k = n(c);
796
- k && a.emit({
791
+ [d, a, n, i]
792
+ ), T = g(() => {
793
+ const l = d;
794
+ if (y(null), a == null || a(null), n && i && l) {
795
+ const h = i(l);
796
+ h && n.emit({
797
797
  type: "panel:blur",
798
798
  source: "panel-layouts",
799
799
  timestamp: Date.now(),
800
800
  payload: {
801
- panelId: k,
802
- panelSlot: c
801
+ panelId: h,
802
+ panelSlot: l
803
803
  }
804
804
  });
805
805
  }
806
- }, [i, s, a, n]), d = x(() => {
807
- const c = [];
808
- return t.left || c.push("left"), c.push("middle"), r === "three-panel" && !t.right && c.push("right"), c;
809
- }, [t, r]), f = x(() => {
810
- const c = d();
811
- if (c.length === 0) return;
812
- if (i === null) {
813
- u(c[0]);
806
+ }, [d, a, n, i]), p = g(() => {
807
+ const l = [];
808
+ return t.left || l.push("left"), l.push("middle"), r === "three-panel" && !t.right && l.push("right"), l;
809
+ }, [t, r]), u = g(() => {
810
+ const l = p();
811
+ if (l.length === 0) return;
812
+ if (d === null) {
813
+ c(l[0]);
814
814
  return;
815
815
  }
816
- const k = c.indexOf(i);
817
- if (k === -1) {
818
- u(c[0]);
816
+ const h = l.indexOf(d);
817
+ if (h === -1) {
818
+ c(l[0]);
819
819
  return;
820
820
  }
821
- const R = (k + 1) % c.length;
822
- u(c[R]);
823
- }, [i, d, u]), g = x(() => {
824
- const c = d();
825
- if (c.length === 0) return;
826
- if (i === null) {
827
- u(c[c.length - 1]);
821
+ const C = (h + 1) % l.length;
822
+ c(l[C]);
823
+ }, [d, p, c]), x = g(() => {
824
+ const l = p();
825
+ if (l.length === 0) return;
826
+ if (d === null) {
827
+ c(l[l.length - 1]);
828
828
  return;
829
829
  }
830
- const k = c.indexOf(i);
831
- if (k === -1) {
832
- u(c[c.length - 1]);
830
+ const h = l.indexOf(d);
831
+ if (h === -1) {
832
+ c(l[l.length - 1]);
833
833
  return;
834
834
  }
835
- const R = k === 0 ? c.length - 1 : k - 1;
836
- u(c[R]);
837
- }, [i, d, u]), m = x(
838
- (c) => i === c,
839
- [i]
835
+ const C = h === 0 ? l.length - 1 : h - 1;
836
+ c(l[C]);
837
+ }, [d, p, c]), k = g(
838
+ (l) => d === l,
839
+ [d]
840
840
  );
841
841
  return {
842
- focusedPanel: i,
843
- setFocus: u,
844
- clearFocus: h,
845
- focusNext: f,
846
- focusPrevious: g,
847
- isFocused: m
842
+ focusedPanel: d,
843
+ setFocus: c,
844
+ clearFocus: T,
845
+ focusNext: u,
846
+ focusPrevious: x,
847
+ isFocused: k
848
848
  };
849
849
  }
850
- function st(o) {
850
+ function He(o) {
851
851
  const {
852
852
  enabled: e = !0,
853
853
  focusedPanel: t,
854
854
  collapsed: r,
855
- panelType: s,
856
- setFocus: a,
857
- onExpand: n,
858
- onCollapse: i
859
- } = o, p = z(t), u = z(r), h = z(s);
860
- W(() => {
861
- p.current = t;
862
- }, [t]), W(() => {
863
- u.current = r;
864
- }, [r]), W(() => {
865
- h.current = s;
866
- }, [s]);
867
- const d = x(
868
- (f) => {
869
- if (!f.altKey || f.ctrlKey || f.metaKey || f.shiftKey)
855
+ panelType: a,
856
+ setFocus: n,
857
+ onExpand: i,
858
+ onCollapse: d
859
+ } = o, y = M(t), c = M(r), T = M(a);
860
+ A(() => {
861
+ y.current = t;
862
+ }, [t]), A(() => {
863
+ c.current = r;
864
+ }, [r]), A(() => {
865
+ T.current = a;
866
+ }, [a]);
867
+ const p = g(
868
+ (u) => {
869
+ if (!u.altKey || u.ctrlKey || u.metaKey || u.shiftKey)
870
870
  return;
871
- const g = f.code, m = p.current, c = u.current, k = h.current;
872
- g === "Digit1" || g === "Numpad1" ? (f.preventDefault(), c.left ? n("left") : m !== "left" ? a("left") : (i("left"), a("middle"))) : g === "Digit2" || g === "Numpad2" ? (f.preventDefault(), a("middle")) : (g === "Digit3" || g === "Numpad3") && k === "three-panel" && (f.preventDefault(), c.right ? n("right") : m !== "right" ? a("right") : (i("right"), a("middle")));
871
+ const x = u.code, k = y.current, l = c.current, h = T.current;
872
+ x === "Digit1" || x === "Numpad1" ? (u.preventDefault(), l.left ? i("left") : k !== "left" ? n("left") : (d("left"), n("middle"))) : x === "Digit2" || x === "Numpad2" ? (u.preventDefault(), n("middle")) : (x === "Digit3" || x === "Numpad3") && h === "three-panel" && (u.preventDefault(), l.right ? i("right") : k !== "right" ? n("right") : (d("right"), n("middle")));
873
873
  },
874
- [a, n, i]
874
+ [n, i, d]
875
875
  );
876
- W(() => {
876
+ A(() => {
877
877
  if (e)
878
- return window.addEventListener("keydown", d), () => {
879
- window.removeEventListener("keydown", d);
878
+ return window.addEventListener("keydown", p), () => {
879
+ window.removeEventListener("keydown", p);
880
880
  };
881
- }, [e, d]);
881
+ }, [e, p]);
882
882
  }
883
- function at(o, e, t, r) {
884
- W(() => {
885
- const s = e.on(
883
+ function Ue(o, e, t, r) {
884
+ A(() => {
885
+ const a = e.on(
886
886
  "panel:focus",
887
- (n) => {
888
- n.payload.panelId === o && t();
887
+ (i) => {
888
+ i.payload.panelId === o && t();
889
889
  }
890
890
  );
891
- let a;
892
- return r && (a = e.on(
891
+ let n;
892
+ return r && (n = e.on(
893
893
  "panel:blur",
894
- (n) => {
895
- n.payload.panelId === o && r();
894
+ (i) => {
895
+ i.payload.panelId === o && r();
896
896
  }
897
897
  )), () => {
898
- s(), a == null || a();
898
+ a(), n == null || n();
899
899
  };
900
900
  }, [o, e, t, r]);
901
901
  }
902
- const nt = ({
902
+ const Qe = ({
903
903
  isFocused: o,
904
904
  className: e = "",
905
905
  style: t = {}
@@ -920,7 +920,7 @@ const nt = ({
920
920
  transition: "opacity 0.15s ease-in-out",
921
921
  ...t
922
922
  };
923
- return /* @__PURE__ */ l(
923
+ return /* @__PURE__ */ s(
924
924
  "div",
925
925
  {
926
926
  className: `panel-focus-indicator ${e}`,
@@ -929,835 +929,41 @@ const nt = ({
929
929
  "aria-hidden": "true"
930
930
  }
931
931
  );
932
- }, Pe = ({
933
- value: o,
934
- onChange: e,
935
- placeholder: t = "> Type a command...",
936
- onClose: r,
937
- onEnter: s
938
- }) => {
939
- const { theme: a } = q(), n = z(null);
940
- W(() => {
941
- n.current && n.current.focus();
942
- }, []);
943
- const i = (p) => {
944
- switch (p.key) {
945
- case "Enter":
946
- p.preventDefault(), s == null || s();
947
- break;
948
- case "Escape":
949
- p.preventDefault(), r();
950
- break;
951
- }
952
- };
953
- return /* @__PURE__ */ l(
954
- "div",
955
- {
956
- style: {
957
- padding: "0",
958
- borderBottom: `1px solid ${a.colors.border}`,
959
- backgroundColor: a.colors.background
960
- },
961
- children: /* @__PURE__ */ l(
962
- "input",
963
- {
964
- ref: n,
965
- type: "text",
966
- value: o,
967
- onChange: (p) => e(p.target.value),
968
- onKeyDown: i,
969
- placeholder: t,
970
- style: {
971
- width: "100%",
972
- padding: "16px 20px",
973
- fontSize: "16px",
974
- fontFamily: a.fonts.monospace,
975
- backgroundColor: "transparent",
976
- border: "none",
977
- outline: "none",
978
- color: a.colors.text,
979
- caretColor: a.colors.primary
980
- },
981
- autoComplete: "off",
982
- autoCorrect: "off",
983
- autoCapitalize: "off",
984
- spellCheck: !1
985
- }
986
- )
987
- }
988
- );
989
- }, ae = ve(
990
- ({ command: o, isSelected: e, onClick: t, onMouseEnter: r }, s) => {
991
- const { theme: a } = q(), { label: n, description: i, icon: p, shortcut: u } = o, [h, d] = Ce.useState(!1);
992
- return /* @__PURE__ */ b(
993
- "div",
994
- {
995
- ref: s,
996
- onClick: t,
997
- onMouseEnter: () => {
998
- d(!0), r();
999
- },
1000
- onMouseLeave: () => d(!1),
1001
- style: {
1002
- padding: "10px 16px",
1003
- cursor: "pointer",
1004
- backgroundColor: e || h ? a.colors.backgroundSecondary : "transparent",
1005
- borderLeft: e || h ? `3px solid ${a.colors.primary}` : "3px solid transparent",
1006
- transition: "all 0.1s ease",
1007
- display: "flex",
1008
- alignItems: "center",
1009
- gap: "12px"
1010
- },
1011
- onMouseDown: (f) => {
1012
- f.preventDefault();
1013
- },
1014
- children: [
1015
- p && /* @__PURE__ */ l(
1016
- "div",
1017
- {
1018
- style: {
1019
- flexShrink: 0,
1020
- width: "20px",
1021
- height: "20px",
1022
- display: "flex",
1023
- alignItems: "center",
1024
- justifyContent: "center",
1025
- fontSize: "16px",
1026
- color: e || h ? a.colors.primary : a.colors.textSecondary
1027
- },
1028
- children: p
1029
- }
1030
- ),
1031
- /* @__PURE__ */ b("div", { style: { flex: 1, minWidth: 0 }, children: [
1032
- /* @__PURE__ */ l(
1033
- "div",
1034
- {
1035
- style: {
1036
- fontSize: "14px",
1037
- fontWeight: 500,
1038
- color: e || h ? a.colors.text : a.colors.textSecondary,
1039
- marginBottom: i ? "2px" : 0
1040
- },
1041
- children: n
1042
- }
1043
- ),
1044
- i && /* @__PURE__ */ l(
1045
- "div",
1046
- {
1047
- style: {
1048
- fontSize: "12px",
1049
- color: a.colors.textMuted,
1050
- overflow: "hidden",
1051
- textOverflow: "ellipsis",
1052
- whiteSpace: "nowrap"
1053
- },
1054
- children: i
1055
- }
1056
- )
1057
- ] }),
1058
- u && /* @__PURE__ */ l(
1059
- "div",
1060
- {
1061
- style: {
1062
- flexShrink: 0,
1063
- fontSize: "11px",
1064
- color: a.colors.textMuted,
1065
- padding: "2px 8px",
1066
- backgroundColor: a.colors.background,
1067
- border: `1px solid ${a.colors.border}`,
1068
- borderRadius: "4px",
1069
- fontFamily: a.fonts.monospace
1070
- },
1071
- children: u
1072
- }
1073
- )
1074
- ]
1075
- }
1076
- );
1077
- }
1078
- );
1079
- ae.displayName = "CommandItem";
1080
- const Ie = ({
1081
- commands: o,
1082
- selectedIndex: e,
1083
- onSelect: t,
1084
- onHover: r,
1085
- maxResults: s = 10
1086
- }) => {
1087
- const { theme: a } = q(), n = z(null), i = z(null), p = o.slice(0, s);
1088
- W(() => {
1089
- if (i.current && n.current) {
1090
- const d = i.current, f = n.current, g = d.offsetTop, m = g + d.offsetHeight, c = f.scrollTop, k = f.clientHeight;
1091
- g < c ? f.scrollTop = g - 8 : m > c + k && (f.scrollTop = m - k + 8);
1092
- }
1093
- }, [e]);
1094
- const u = p.reduce((d, f, g) => {
1095
- const m = f.category || "Other";
1096
- return d[m] || (d[m] = []), d[m].push({ command: f, index: g }), d;
1097
- }, {}), h = Object.keys(u).sort((d, f) => d === "Other" ? 1 : f === "Other" ? -1 : d.localeCompare(f));
1098
- return /* @__PURE__ */ b(
1099
- "div",
1100
- {
1101
- ref: n,
1102
- style: {
1103
- overflowY: "auto",
1104
- maxHeight: "400px",
1105
- padding: "8px 0"
1106
- },
1107
- children: [
1108
- h.map((d) => /* @__PURE__ */ b("div", { children: [
1109
- h.length > 1 && /* @__PURE__ */ l(
1110
- "div",
1111
- {
1112
- style: {
1113
- padding: "8px 16px 4px",
1114
- fontSize: "11px",
1115
- fontWeight: 600,
1116
- textTransform: "uppercase",
1117
- color: a.colors.textMuted,
1118
- letterSpacing: "0.5px"
1119
- },
1120
- children: d
1121
- }
1122
- ),
1123
- u[d].map(({ command: f, index: g }) => /* @__PURE__ */ l(
1124
- ae,
1125
- {
1126
- command: f,
1127
- isSelected: g === e,
1128
- onClick: () => t(f),
1129
- onMouseEnter: () => r(g),
1130
- ref: g === e ? i : void 0
1131
- },
1132
- f.id
1133
- ))
1134
- ] }, d)),
1135
- o.length > s && /* @__PURE__ */ b(
1136
- "div",
1137
- {
1138
- style: {
1139
- padding: "8px 16px",
1140
- fontSize: "12px",
1141
- color: a.colors.textMuted,
1142
- textAlign: "center",
1143
- borderTop: `1px solid ${a.colors.border}`
1144
- },
1145
- children: [
1146
- "Showing ",
1147
- s,
1148
- " of ",
1149
- o.length,
1150
- " results"
1151
- ]
1152
- }
1153
- )
1154
- ]
1155
- }
1156
- );
1157
- }, it = ({
1158
- commandPalette: o,
1159
- config: e
1160
- }) => {
1161
- const { theme: t } = q(), r = z(null), {
1162
- isOpen: s,
1163
- close: a,
1164
- query: n,
1165
- setQuery: i,
1166
- filteredCommands: p,
1167
- selectedIndex: u,
1168
- setSelectedIndex: h,
1169
- executeSelected: d
1170
- } = o;
1171
- if (W(() => {
1172
- if (!s) return;
1173
- const m = (k) => {
1174
- r.current && !r.current.contains(k.target) && a();
1175
- }, c = setTimeout(() => {
1176
- document.addEventListener("mousedown", m);
1177
- }, 100);
1178
- return () => {
1179
- clearTimeout(c), document.removeEventListener("mousedown", m);
1180
- };
1181
- }, [s, a]), !s)
1182
- return null;
1183
- const f = (e == null ? void 0 : e.maxHeight) || "50vh", g = (e == null ? void 0 : e.placeholder) || "> Type a command...";
1184
- return /* @__PURE__ */ b(se, { children: [
1185
- /* @__PURE__ */ l(
1186
- "div",
1187
- {
1188
- style: {
1189
- position: "fixed",
1190
- inset: 0,
1191
- backgroundColor: "rgba(0, 0, 0, 0.4)",
1192
- backdropFilter: "blur(2px)",
1193
- zIndex: 999
1194
- },
1195
- onClick: a
1196
- }
1197
- ),
1198
- /* @__PURE__ */ b(
1199
- "div",
1200
- {
1201
- ref: r,
1202
- className: e == null ? void 0 : e.className,
1203
- style: {
1204
- position: "fixed",
1205
- bottom: 0,
1206
- left: 0,
1207
- right: 0,
1208
- maxHeight: f,
1209
- backgroundColor: t.colors.surface,
1210
- borderTop: `1px solid ${t.colors.border}`,
1211
- boxShadow: t.shadows[2],
1212
- zIndex: 1e3,
1213
- display: "flex",
1214
- flexDirection: "column-reverse",
1215
- ...e == null ? void 0 : e.style
1216
- },
1217
- children: [
1218
- /* @__PURE__ */ b("div", { children: [
1219
- /* @__PURE__ */ l(
1220
- Pe,
1221
- {
1222
- value: n,
1223
- onChange: i,
1224
- placeholder: g,
1225
- onClose: a,
1226
- onEnter: d
1227
- }
1228
- ),
1229
- /* @__PURE__ */ b(
1230
- "div",
1231
- {
1232
- style: {
1233
- padding: "8px 16px",
1234
- borderTop: `1px solid ${t.colors.border}`,
1235
- display: "flex",
1236
- gap: "16px",
1237
- fontSize: "12px",
1238
- color: t.colors.textMuted,
1239
- backgroundColor: t.colors.background
1240
- },
1241
- children: [
1242
- /* @__PURE__ */ b("span", { children: [
1243
- /* @__PURE__ */ l("kbd", { style: { padding: "2px 6px", backgroundColor: t.colors.backgroundSecondary, borderRadius: "3px", border: `1px solid ${t.colors.border}` }, children: "Enter" }),
1244
- " Execute"
1245
- ] }),
1246
- /* @__PURE__ */ b("span", { children: [
1247
- /* @__PURE__ */ l("kbd", { style: { padding: "2px 6px", backgroundColor: t.colors.backgroundSecondary, borderRadius: "3px", border: `1px solid ${t.colors.border}` }, children: "Esc" }),
1248
- " Close"
1249
- ] })
1250
- ]
1251
- }
1252
- )
1253
- ] }),
1254
- p.length > 0 && /* @__PURE__ */ l(
1255
- Ie,
1256
- {
1257
- commands: p,
1258
- selectedIndex: u,
1259
- onSelect: (m) => {
1260
- o.executeCommand(m.id);
1261
- },
1262
- onHover: h,
1263
- maxResults: e == null ? void 0 : e.maxResults
1264
- }
1265
- ),
1266
- n && p.length === 0 && /* @__PURE__ */ b(
1267
- "div",
1268
- {
1269
- style: {
1270
- padding: "24px 16px",
1271
- color: t.colors.textMuted,
1272
- textAlign: "center",
1273
- fontSize: "14px"
1274
- },
1275
- children: [
1276
- 'No commands found for "',
1277
- n,
1278
- '"'
1279
- ]
1280
- }
1281
- )
1282
- ]
1283
- }
1284
- )
1285
- ] });
1286
- };
1287
- class ne {
1288
- constructor() {
1289
- H(this, "commands", /* @__PURE__ */ new Map());
1290
- H(this, "listeners", /* @__PURE__ */ new Set());
1291
- }
1292
- /**
1293
- * Register one or more commands
1294
- * @param commands - Array of commands to register
1295
- */
1296
- registerCommands(e) {
1297
- e.forEach((t) => {
1298
- this.commands.set(t.id, t);
1299
- }), this.notifyListeners();
1300
- }
1301
- /**
1302
- * Register a single command
1303
- * @param command - Command to register
1304
- */
1305
- registerCommand(e) {
1306
- this.commands.set(e.id, e), this.notifyListeners();
1307
- }
1308
- /**
1309
- * Unregister commands by ID
1310
- * @param commandIds - Array of command IDs to unregister
1311
- */
1312
- unregisterCommands(e) {
1313
- e.forEach((t) => {
1314
- this.commands.delete(t);
1315
- }), this.notifyListeners();
1316
- }
1317
- /**
1318
- * Unregister a single command
1319
- * @param commandId - Command ID to unregister
1320
- */
1321
- unregisterCommand(e) {
1322
- this.commands.delete(e), this.notifyListeners();
1323
- }
1324
- /**
1325
- * Get all registered commands
1326
- * @param context - Command context for availability checks
1327
- * @returns Array of available commands
1328
- */
1329
- getCommands(e) {
1330
- const t = Array.from(this.commands.values());
1331
- return e ? t.filter((r) => r.isAvailable ? r.isAvailable(e) : !0) : t;
1332
- }
1333
- /**
1334
- * Get a command by ID
1335
- * @param commandId - Command ID
1336
- * @returns Command if found, undefined otherwise
1337
- */
1338
- getCommand(e) {
1339
- return this.commands.get(e);
1340
- }
1341
- /**
1342
- * Execute a command by ID
1343
- * @param commandId - Command ID to execute
1344
- * @param context - Command context
1345
- */
1346
- async executeCommand(e, t) {
1347
- var s, a;
1348
- const r = this.commands.get(e);
1349
- if (!r) {
1350
- console.warn(`Command not found: ${e}`);
1351
- return;
1352
- }
1353
- if (r.isAvailable && !r.isAvailable(t)) {
1354
- console.warn(`Command not available: ${e}`);
1355
- return;
1356
- }
1357
- try {
1358
- await r.execute(t), (s = t.events) == null || s.emit({
1359
- type: "command:executed",
1360
- source: "command-palette",
1361
- timestamp: Date.now(),
1362
- payload: {
1363
- commandId: r.id,
1364
- commandLabel: r.label
1365
- }
1366
- });
1367
- } catch (n) {
1368
- console.error(`Error executing command ${e}:`, n), (a = t.events) == null || a.emit({
1369
- type: "command:error",
1370
- source: "command-palette",
1371
- timestamp: Date.now(),
1372
- payload: {
1373
- commandId: r.id,
1374
- error: n instanceof Error ? n.message : String(n)
1375
- }
1376
- });
1377
- }
1378
- }
1379
- /**
1380
- * Search commands by query
1381
- * @param query - Search query
1382
- * @param context - Command context for availability checks
1383
- * @returns Filtered and sorted commands
1384
- */
1385
- searchCommands(e, t) {
1386
- const r = this.getCommands(t);
1387
- if (!e.trim())
1388
- return this.sortCommands(r);
1389
- const s = e.toLowerCase();
1390
- return r.map((n) => {
1391
- var p, u;
1392
- let i = 0;
1393
- return n.label.toLowerCase() === s ? i += 1e3 : n.label.toLowerCase().startsWith(s) ? i += 500 : n.label.toLowerCase().includes(s) && (i += 250), (p = n.description) != null && p.toLowerCase().includes(s) && (i += 100), n.keywords && n.keywords.some(
1394
- (d) => d.toLowerCase().includes(s)
1395
- ) && (i += 150), (u = n.category) != null && u.toLowerCase().includes(s) && (i += 50), i > 0 && n.priority && (i += n.priority), { command: n, score: i };
1396
- }).filter((n) => n.score > 0).sort((n, i) => i.score - n.score).map((n) => n.command);
1397
- }
1398
- /**
1399
- * Sort commands by priority and label
1400
- * @param commands - Commands to sort
1401
- * @returns Sorted commands
1402
- */
1403
- sortCommands(e) {
1404
- return e.sort((t, r) => {
1405
- const s = (r.priority || 0) - (t.priority || 0);
1406
- if (s !== 0)
1407
- return s;
1408
- const a = t.category || "", n = r.category || "", i = a.localeCompare(n);
1409
- return i !== 0 ? i : t.label.localeCompare(r.label);
1410
- });
1411
- }
1412
- /**
1413
- * Subscribe to registry changes
1414
- * @param listener - Callback function called when registry changes
1415
- * @returns Unsubscribe function
1416
- */
1417
- subscribe(e) {
1418
- return this.listeners.add(e), () => {
1419
- this.listeners.delete(e);
1420
- };
1421
- }
1422
- /**
1423
- * Clear all commands
1424
- */
1425
- clear() {
1426
- this.commands.clear(), this.notifyListeners();
1427
- }
1428
- /**
1429
- * Get count of registered commands
1430
- */
1431
- get size() {
1432
- return this.commands.size;
1433
- }
1434
- /**
1435
- * Notify all listeners of registry changes
1436
- */
1437
- notifyListeners() {
1438
- this.listeners.forEach((e) => e());
1439
- }
1440
- }
1441
- let Y = null;
1442
- function lt() {
1443
- return Y || (Y = new ne()), Y;
1444
- }
1445
- function ct() {
1446
- Y = null;
1447
- }
1448
- function dt({
1449
- context: o,
1450
- commands: e = [],
1451
- keyboard: t = { key: " ", altKey: !0 },
1452
- config: r = {},
1453
- registry: s
1454
- }) {
1455
- const [a, n] = L(!1), [i, p] = L(""), [u, h] = L(0), [d, f] = L([]), g = X(
1456
- () => s || new ne(),
1457
- [s]
1458
- ), m = X(
1459
- () => ({
1460
- ...o,
1461
- closeCommandPalette: () => n(!1)
1462
- }),
1463
- [o]
1464
- );
1465
- W(() => {
1466
- let y = !0;
1467
- const S = g.subscribe(() => {
1468
- if (y) {
1469
- const E = g.getCommands(m);
1470
- f(E);
1471
- }
1472
- });
1473
- if (e.length > 0)
1474
- g.registerCommands(e);
1475
- else {
1476
- const E = g.getCommands(m);
1477
- f(E);
1478
- }
1479
- return () => {
1480
- y = !1, S();
1481
- };
1482
- }, [g]);
1483
- const c = X(() => (r.fuzzySearch === !1, g.searchCommands(i, m)), [i, g, m, r.fuzzySearch]);
1484
- W(() => {
1485
- h(0);
1486
- }, [c]);
1487
- const k = x(() => {
1488
- var y;
1489
- n(!0), p(""), h(0), (y = o.events) == null || y.emit({
1490
- type: "command-palette:opened",
1491
- source: "command-palette",
1492
- timestamp: Date.now(),
1493
- payload: {}
1494
- });
1495
- }, [o.events]), R = x(() => {
1496
- var y;
1497
- n(!1), p(""), h(0), (y = o.events) == null || y.emit({
1498
- type: "command-palette:closed",
1499
- source: "command-palette",
1500
- timestamp: Date.now(),
1501
- payload: {}
1502
- });
1503
- }, [o.events]), A = x(() => {
1504
- a ? R() : k();
1505
- }, [a, k, R]), I = x(
1506
- async (y) => {
1507
- await g.executeCommand(y, m), R();
1508
- },
1509
- [g, m, R]
1510
- ), $ = x(() => {
1511
- h((y) => {
1512
- const S = r.maxResults || c.length, E = Math.min(c.length, S) - 1;
1513
- return y < E ? y + 1 : 0;
1514
- });
1515
- }, [c.length, r.maxResults]), D = x(() => {
1516
- h((y) => {
1517
- const S = r.maxResults || c.length, E = Math.min(c.length, S) - 1;
1518
- return y > 0 ? y - 1 : E;
1519
- });
1520
- }, [c.length, r.maxResults]), w = x(async () => {
1521
- const y = c[0];
1522
- y && await I(y.id);
1523
- }, [c, I]), P = x(
1524
- (y) => {
1525
- g.registerCommands(y);
1526
- },
1527
- [g]
1528
- ), v = x(
1529
- (y) => {
1530
- g.unregisterCommands(y);
1531
- },
1532
- [g]
1533
- ), C = x(
1534
- (y) => {
1535
- const {
1536
- key: S = " ",
1537
- altKey: E = !0,
1538
- ctrlKey: F = !1,
1539
- metaKey: V = !1,
1540
- shiftKey: Q = !1
1541
- } = t, Z = y.altKey === E && y.ctrlKey === F && y.metaKey === V && y.shiftKey === Q;
1542
- if ((S === " " ? y.code === "Space" : y.key === S) && Z) {
1543
- const G = y.target;
1544
- if (G.tagName === "INPUT" || G.tagName === "TEXTAREA" || G.isContentEditable)
1545
- return;
1546
- y.preventDefault(), A();
1547
- }
1548
- },
1549
- [t, A]
1550
- );
1551
- return W(() => (window.addEventListener("keydown", C), () => window.removeEventListener("keydown", C)), [C]), {
1552
- isOpen: a,
1553
- open: k,
1554
- close: R,
1555
- toggle: A,
1556
- query: i,
1557
- setQuery: p,
1558
- filteredCommands: c,
1559
- executeCommand: I,
1560
- selectedIndex: u,
1561
- setSelectedIndex: h,
1562
- selectNext: $,
1563
- selectPrevious: D,
1564
- executeSelected: w,
1565
- commands: d,
1566
- registerCommands: P,
1567
- unregisterCommands: v
1568
- };
1569
- }
1570
- const Re = [
1571
- {
1572
- id: "panel.focus.left",
1573
- label: "Focus Left Panel",
1574
- description: "Set focus to the left panel",
1575
- icon: "◀",
1576
- category: "Panel Navigation",
1577
- shortcut: "Alt+1",
1578
- priority: 100,
1579
- keywords: ["left", "sidebar", "focus", "switch"],
1580
- execute: (o) => {
1581
- o.setFocus("left");
1582
- },
1583
- isAvailable: (o) => o.focusedPanel !== "left"
1584
- },
1585
- {
1586
- id: "panel.focus.middle",
1587
- label: "Focus Middle Panel",
1588
- description: "Set focus to the middle panel",
1589
- icon: "▣",
1590
- category: "Panel Navigation",
1591
- shortcut: "Alt+2",
1592
- priority: 100,
1593
- keywords: ["middle", "center", "main", "focus", "switch"],
1594
- execute: (o) => {
1595
- o.setFocus("middle");
1596
- },
1597
- isAvailable: (o) => o.focusedPanel !== "middle"
1598
- },
1599
- {
1600
- id: "panel.focus.right",
1601
- label: "Focus Right Panel",
1602
- description: "Set focus to the right panel",
1603
- icon: "▶",
1604
- category: "Panel Navigation",
1605
- shortcut: "Alt+3",
1606
- priority: 100,
1607
- keywords: ["right", "sidebar", "focus", "switch"],
1608
- execute: (o) => {
1609
- o.setFocus("right");
1610
- },
1611
- isAvailable: (o) => o.focusedPanel !== "right"
1612
- },
1613
- {
1614
- id: "panel.toggle.left",
1615
- label: "Toggle Left Panel",
1616
- description: "Expand or collapse the left panel",
1617
- icon: "◀◀",
1618
- category: "Panel Control",
1619
- keywords: ["toggle", "left", "collapse", "expand", "hide", "show"],
1620
- priority: 80,
1621
- execute: (o) => {
1622
- var e;
1623
- (e = o.events) == null || e.emit({
1624
- type: "panel:toggle",
1625
- source: "command-palette",
1626
- timestamp: Date.now(),
1627
- payload: { panelId: "left" }
1628
- });
1629
- }
1630
- },
1631
- {
1632
- id: "panel.toggle.right",
1633
- label: "Toggle Right Panel",
1634
- description: "Expand or collapse the right panel",
1635
- icon: "▶▶",
1636
- category: "Panel Control",
1637
- keywords: ["toggle", "right", "collapse", "expand", "hide", "show"],
1638
- priority: 80,
1639
- execute: (o) => {
1640
- var e;
1641
- (e = o.events) == null || e.emit({
1642
- type: "panel:toggle",
1643
- source: "command-palette",
1644
- timestamp: Date.now(),
1645
- payload: { panelId: "right" }
1646
- });
1647
- }
1648
- },
1649
- {
1650
- id: "panel.collapse.all",
1651
- label: "Collapse All Panels",
1652
- description: "Collapse all side panels to maximize middle panel",
1653
- icon: "⬌",
1654
- category: "Panel Control",
1655
- keywords: ["collapse", "hide", "all", "maximize", "focus mode"],
1656
- priority: 70,
1657
- execute: (o) => {
1658
- var e;
1659
- (e = o.events) == null || e.emit({
1660
- type: "panel:collapse-all",
1661
- source: "command-palette",
1662
- timestamp: Date.now(),
1663
- payload: {}
1664
- });
1665
- }
1666
- },
1667
- {
1668
- id: "panel.expand.all",
1669
- label: "Expand All Panels",
1670
- description: "Expand all side panels to default layout",
1671
- icon: "⬍",
1672
- category: "Panel Control",
1673
- keywords: ["expand", "show", "all", "restore", "default"],
1674
- priority: 70,
1675
- execute: (o) => {
1676
- var e;
1677
- (e = o.events) == null || e.emit({
1678
- type: "panel:expand-all",
1679
- source: "command-palette",
1680
- timestamp: Date.now(),
1681
- payload: {}
1682
- });
1683
- }
1684
- },
1685
- {
1686
- id: "panel.refresh",
1687
- label: "Refresh Panel Data",
1688
- description: "Reload data for the currently focused panel",
1689
- icon: "↻",
1690
- category: "Panel Control",
1691
- keywords: ["refresh", "reload", "update", "sync"],
1692
- priority: 60,
1693
- execute: (o) => {
1694
- var t;
1695
- const e = o.focusedPanel;
1696
- e && ((t = o.events) == null || t.emit({
1697
- type: "panel:refresh",
1698
- source: "command-palette",
1699
- timestamp: Date.now(),
1700
- payload: { panelId: e }
1701
- }));
1702
- },
1703
- isAvailable: (o) => o.focusedPanel !== null
1704
- },
1705
- {
1706
- id: "panel.reset.layout",
1707
- label: "Reset Panel Layout",
1708
- description: "Reset panel sizes to default layout",
1709
- icon: "⟲",
1710
- category: "Panel Control",
1711
- keywords: ["reset", "layout", "default", "restore"],
1712
- priority: 50,
1713
- execute: (o) => {
1714
- var e;
1715
- (e = o.events) == null || e.emit({
1716
- type: "panel:reset-layout",
1717
- source: "command-palette",
1718
- timestamp: Date.now(),
1719
- payload: {}
1720
- });
1721
- }
1722
- }
1723
- ];
1724
- function pt() {
1725
- return Re;
1726
- }
1727
- const ie = ({
932
+ }, ee = ({
1728
933
  value: o,
1729
934
  onChange: e,
1730
935
  onSubmit: t,
1731
936
  onClose: r,
1732
- onHistoryPrevious: s,
1733
- onHistoryNext: a,
1734
- mode: n,
1735
- status: i,
1736
- placeholder: p = "What would you like to do?",
1737
- disabled: u = !1,
1738
- autoFocus: h = !0
937
+ onHistoryPrevious: a,
938
+ onHistoryNext: n,
939
+ mode: i,
940
+ status: d,
941
+ placeholder: y = "What would you like to do?",
942
+ disabled: c = !1,
943
+ autoFocus: T = !0,
944
+ agentAvailable: p = !0
1739
945
  }) => {
1740
- const { theme: d } = q(), f = z(null);
1741
- W(() => {
1742
- h && f.current && f.current.focus();
1743
- }, [h]);
1744
- const g = (c) => {
1745
- switch (c.key) {
946
+ const { theme: u } = K(), x = M(null);
947
+ A(() => {
948
+ T && x.current && x.current.focus();
949
+ }, [T]);
950
+ const k = (h) => {
951
+ switch (h.stopPropagation(), h.key) {
1746
952
  case "Enter":
1747
- c.preventDefault(), t();
953
+ h.preventDefault(), t();
1748
954
  break;
1749
955
  case "Escape":
1750
- c.preventDefault(), r();
956
+ h.preventDefault(), r();
1751
957
  break;
1752
958
  case "ArrowUp":
1753
- c.preventDefault(), s();
959
+ h.preventDefault(), a();
1754
960
  break;
1755
961
  case "ArrowDown":
1756
- c.preventDefault(), a();
962
+ h.preventDefault(), n();
1757
963
  break;
1758
964
  }
1759
- }, m = i === "thinking" || i === "executing";
1760
- return /* @__PURE__ */ b(
965
+ }, l = d === "thinking" || d === "executing";
966
+ return /* @__PURE__ */ m(
1761
967
  "div",
1762
968
  {
1763
969
  style: {
@@ -1765,57 +971,94 @@ const ie = ({
1765
971
  alignItems: "center",
1766
972
  gap: "8px",
1767
973
  padding: "12px 16px",
1768
- backgroundColor: d.colors.background,
1769
- borderBottom: `1px solid ${d.colors.border}`
974
+ backgroundColor: u.colors.background,
975
+ borderBottom: `1px solid ${u.colors.border}`
1770
976
  },
1771
977
  children: [
1772
- /* @__PURE__ */ l(
978
+ /* @__PURE__ */ s(
1773
979
  "span",
1774
980
  {
1775
981
  style: {
1776
- color: n === "quick-command" ? d.colors.info : d.colors.textMuted,
1777
- fontFamily: d.fonts.monospace,
982
+ color: i === "quick-command" ? u.colors.info : p ? u.colors.primary : u.colors.textMuted,
983
+ fontFamily: u.fonts.monospace,
1778
984
  fontSize: "14px",
1779
- userSelect: "none"
985
+ userSelect: "none",
986
+ display: "flex",
987
+ alignItems: "center"
1780
988
  },
1781
- children: n === "quick-command" ? "/" : ">"
989
+ children: i === "quick-command" ? /* @__PURE__ */ m(
990
+ "svg",
991
+ {
992
+ width: "16",
993
+ height: "16",
994
+ viewBox: "0 0 24 24",
995
+ fill: "none",
996
+ stroke: "currentColor",
997
+ strokeWidth: "2",
998
+ strokeLinecap: "round",
999
+ strokeLinejoin: "round",
1000
+ children: [
1001
+ /* @__PURE__ */ s("polyline", { points: "4 17 10 11 4 5" }),
1002
+ /* @__PURE__ */ s("line", { x1: "12", y1: "19", x2: "20", y2: "19" })
1003
+ ]
1004
+ }
1005
+ ) : p ? /* @__PURE__ */ m(
1006
+ "svg",
1007
+ {
1008
+ width: "16",
1009
+ height: "16",
1010
+ viewBox: "0 0 24 24",
1011
+ fill: "none",
1012
+ stroke: "currentColor",
1013
+ strokeWidth: "2",
1014
+ strokeLinecap: "round",
1015
+ strokeLinejoin: "round",
1016
+ children: [
1017
+ /* @__PURE__ */ s("rect", { x: "3", y: "11", width: "18", height: "10", rx: "2" }),
1018
+ /* @__PURE__ */ s("circle", { cx: "12", cy: "5", r: "2" }),
1019
+ /* @__PURE__ */ s("path", { d: "M12 7v4" }),
1020
+ /* @__PURE__ */ s("line", { x1: "8", y1: "16", x2: "8", y2: "16" }),
1021
+ /* @__PURE__ */ s("line", { x1: "16", y1: "16", x2: "16", y2: "16" })
1022
+ ]
1023
+ }
1024
+ ) : ">"
1782
1025
  }
1783
1026
  ),
1784
- /* @__PURE__ */ l(
1027
+ /* @__PURE__ */ s(
1785
1028
  "input",
1786
1029
  {
1787
- ref: f,
1030
+ ref: x,
1788
1031
  "data-agent-command-palette-input": !0,
1789
1032
  type: "text",
1790
1033
  value: o,
1791
- onChange: (c) => e(c.target.value),
1792
- onKeyDown: g,
1793
- placeholder: p,
1794
- disabled: u || m,
1034
+ onChange: (h) => e(h.target.value),
1035
+ onKeyDown: k,
1036
+ placeholder: y,
1037
+ disabled: c || l,
1795
1038
  style: {
1796
1039
  flex: 1,
1797
1040
  backgroundColor: "transparent",
1798
1041
  border: "none",
1799
1042
  outline: "none",
1800
- color: d.colors.text,
1801
- fontFamily: d.fonts.monospace,
1043
+ color: u.colors.text,
1044
+ fontFamily: u.fonts.monospace,
1802
1045
  fontSize: "14px",
1803
- caretColor: d.colors.primary
1046
+ caretColor: u.colors.primary
1804
1047
  }
1805
1048
  }
1806
1049
  ),
1807
- m && /* @__PURE__ */ b(
1050
+ l && /* @__PURE__ */ m(
1808
1051
  "span",
1809
1052
  {
1810
1053
  style: {
1811
- color: d.colors.info,
1054
+ color: u.colors.info,
1812
1055
  fontSize: "12px",
1813
1056
  display: "flex",
1814
1057
  alignItems: "center",
1815
1058
  gap: "4px"
1816
1059
  },
1817
1060
  children: [
1818
- /* @__PURE__ */ l(
1061
+ /* @__PURE__ */ s(
1819
1062
  "span",
1820
1063
  {
1821
1064
  style: {
@@ -1823,25 +1066,25 @@ const ie = ({
1823
1066
  width: "8px",
1824
1067
  height: "8px",
1825
1068
  borderRadius: "50%",
1826
- backgroundColor: d.colors.info,
1069
+ backgroundColor: u.colors.info,
1827
1070
  animation: "pulse 1s ease-in-out infinite"
1828
1071
  }
1829
1072
  }
1830
1073
  ),
1831
- i === "thinking" ? "Thinking..." : "Executing..."
1074
+ d === "thinking" ? "Thinking..." : "Executing..."
1832
1075
  ]
1833
1076
  }
1834
1077
  ),
1835
- !m && /* @__PURE__ */ l(
1078
+ !l && /* @__PURE__ */ s(
1836
1079
  "kbd",
1837
1080
  {
1838
1081
  style: {
1839
1082
  padding: "2px 6px",
1840
- backgroundColor: d.colors.backgroundSecondary,
1083
+ backgroundColor: u.colors.backgroundSecondary,
1841
1084
  borderRadius: "3px",
1842
- border: `1px solid ${d.colors.border}`,
1085
+ border: `1px solid ${u.colors.border}`,
1843
1086
  fontSize: "11px",
1844
- color: d.colors.textMuted
1087
+ color: u.colors.textMuted
1845
1088
  },
1846
1089
  children: "Alt+P"
1847
1090
  }
@@ -1850,9 +1093,9 @@ const ie = ({
1850
1093
  }
1851
1094
  );
1852
1095
  };
1853
- ie.displayName = "AgentCommandInput";
1854
- const Le = ({ status: o }) => {
1855
- const { theme: e } = q(), t = {
1096
+ ee.displayName = "AgentCommandInput";
1097
+ const be = ({ status: o }) => {
1098
+ const { theme: e } = K(), t = {
1856
1099
  display: "inline-flex",
1857
1100
  alignItems: "center",
1858
1101
  justifyContent: "center",
@@ -1862,9 +1105,9 @@ const Le = ({ status: o }) => {
1862
1105
  };
1863
1106
  switch (o) {
1864
1107
  case "pending":
1865
- return /* @__PURE__ */ l("span", { style: { ...t, color: e.colors.textMuted }, children: "○" });
1108
+ return /* @__PURE__ */ s("span", { style: { ...t, color: e.colors.textMuted }, children: "○" });
1866
1109
  case "running":
1867
- return /* @__PURE__ */ l(
1110
+ return /* @__PURE__ */ s(
1868
1111
  "span",
1869
1112
  {
1870
1113
  style: {
@@ -1876,16 +1119,16 @@ const Le = ({ status: o }) => {
1876
1119
  }
1877
1120
  );
1878
1121
  case "success":
1879
- return /* @__PURE__ */ l("span", { style: { ...t, color: e.colors.success }, children: "✓" });
1122
+ return /* @__PURE__ */ s("span", { style: { ...t, color: e.colors.success }, children: "✓" });
1880
1123
  case "error":
1881
- return /* @__PURE__ */ l("span", { style: { ...t, color: e.colors.error }, children: "✗" });
1124
+ return /* @__PURE__ */ s("span", { style: { ...t, color: e.colors.error }, children: "✗" });
1882
1125
  }
1883
- }, Ae = (o) => {
1126
+ }, ve = (o) => {
1884
1127
  const e = Object.entries(o);
1885
1128
  return e.length === 0 ? "" : e.map(([t, r]) => t === "args" && Array.isArray(r) ? r.join(", ") : typeof r == "string" ? `"${r}"` : JSON.stringify(r)).join(", ");
1886
- }, We = ({ tool: o, compact: e }) => {
1887
- const { theme: t } = q(), r = Ae(o.args);
1888
- return /* @__PURE__ */ b(
1129
+ }, Se = ({ tool: o, compact: e }) => {
1130
+ const { theme: t } = K(), r = ve(o.args);
1131
+ return /* @__PURE__ */ m(
1889
1132
  "div",
1890
1133
  {
1891
1134
  style: {
@@ -1897,16 +1140,16 @@ const Le = ({ status: o }) => {
1897
1140
  fontSize: "13px"
1898
1141
  },
1899
1142
  children: [
1900
- /* @__PURE__ */ l(Le, { status: o.status }),
1901
- /* @__PURE__ */ b("span", { style: { color: t.colors.text }, children: [
1143
+ /* @__PURE__ */ s(be, { status: o.status }),
1144
+ /* @__PURE__ */ m("span", { style: { color: t.colors.text }, children: [
1902
1145
  o.name,
1903
- r && /* @__PURE__ */ b("span", { style: { color: t.colors.textMuted }, children: [
1146
+ r && /* @__PURE__ */ m("span", { style: { color: t.colors.textMuted }, children: [
1904
1147
  "(",
1905
1148
  r,
1906
1149
  ")"
1907
1150
  ] })
1908
1151
  ] }),
1909
- o.status === "running" && /* @__PURE__ */ l(
1152
+ o.status === "running" && /* @__PURE__ */ s(
1910
1153
  "span",
1911
1154
  {
1912
1155
  style: {
@@ -1917,7 +1160,7 @@ const Le = ({ status: o }) => {
1917
1160
  children: "[running]"
1918
1161
  }
1919
1162
  ),
1920
- o.status === "success" && /* @__PURE__ */ l(
1163
+ o.status === "success" && /* @__PURE__ */ s(
1921
1164
  "span",
1922
1165
  {
1923
1166
  style: {
@@ -1928,7 +1171,7 @@ const Le = ({ status: o }) => {
1928
1171
  children: "[done]"
1929
1172
  }
1930
1173
  ),
1931
- o.status === "error" && /* @__PURE__ */ l(
1174
+ o.status === "error" && /* @__PURE__ */ s(
1932
1175
  "span",
1933
1176
  {
1934
1177
  style: {
@@ -1943,12 +1186,12 @@ const Le = ({ status: o }) => {
1943
1186
  ]
1944
1187
  }
1945
1188
  );
1946
- }, le = ({
1189
+ }, te = ({
1947
1190
  tools: o,
1948
1191
  compact: e = !1
1949
1192
  }) => {
1950
- const { theme: t } = q();
1951
- return o.length === 0 ? null : /* @__PURE__ */ l(
1193
+ const { theme: t } = K();
1194
+ return o.length === 0 ? null : /* @__PURE__ */ s(
1952
1195
  "div",
1953
1196
  {
1954
1197
  style: {
@@ -1957,36 +1200,36 @@ const Le = ({ status: o }) => {
1957
1200
  borderRadius: "4px",
1958
1201
  margin: "8px 16px"
1959
1202
  },
1960
- children: o.map((r) => /* @__PURE__ */ l(We, { tool: r, compact: e }, r.id))
1203
+ children: o.map((r) => /* @__PURE__ */ s(Se, { tool: r, compact: e }, r.id))
1961
1204
  }
1962
1205
  );
1963
1206
  };
1964
- le.displayName = "ToolExecutionList";
1965
- const ce = ({
1207
+ te.displayName = "ToolExecutionList";
1208
+ const oe = ({
1966
1209
  response: o,
1967
1210
  streaming: e = !1
1968
1211
  }) => {
1969
- const { theme: t } = q();
1212
+ const { theme: t } = K();
1970
1213
  if (!o)
1971
1214
  return null;
1972
- const r = o.toLowerCase().startsWith("error"), s = o.toLowerCase().startsWith("done") || o.toLowerCase().startsWith("executed");
1973
- return /* @__PURE__ */ b(
1215
+ const r = o.toLowerCase().startsWith("error"), a = o.toLowerCase().startsWith("done") || o.toLowerCase().startsWith("executed");
1216
+ return /* @__PURE__ */ m(
1974
1217
  "div",
1975
1218
  {
1976
1219
  style: {
1977
1220
  padding: "12px 16px",
1978
- color: r ? t.colors.error : s ? t.colors.success : t.colors.text,
1221
+ color: r ? t.colors.error : a ? t.colors.success : t.colors.text,
1979
1222
  fontSize: "13px",
1980
1223
  display: "flex",
1981
1224
  alignItems: "center",
1982
1225
  gap: "8px"
1983
1226
  },
1984
1227
  children: [
1985
- s && /* @__PURE__ */ l("span", { children: "✓" }),
1986
- r && /* @__PURE__ */ l("span", { children: "✗" }),
1987
- /* @__PURE__ */ b("span", { children: [
1228
+ a && /* @__PURE__ */ s("span", { children: "✓" }),
1229
+ r && /* @__PURE__ */ s("span", { children: "✗" }),
1230
+ /* @__PURE__ */ m("span", { children: [
1988
1231
  o,
1989
- e && /* @__PURE__ */ l(
1232
+ e && /* @__PURE__ */ s(
1990
1233
  "span",
1991
1234
  {
1992
1235
  style: {
@@ -2004,57 +1247,58 @@ const ce = ({
2004
1247
  }
2005
1248
  );
2006
1249
  };
2007
- ce.displayName = "AgentResponseDisplay";
2008
- const De = ({
1250
+ oe.displayName = "AgentResponseDisplay";
1251
+ const Te = ({
2009
1252
  palette: o,
2010
1253
  config: e
2011
1254
  }) => {
2012
- const { theme: t } = q(), r = z(null), {
2013
- isOpen: s,
2014
- close: a,
2015
- query: n,
2016
- setQuery: i,
2017
- mode: p,
2018
- status: u,
2019
- pendingTools: h,
2020
- completedTools: d,
2021
- agentResponse: f,
2022
- submit: g,
2023
- historyPrevious: m,
2024
- historyNext: c,
2025
- suggestions: k
1255
+ const { theme: t } = K(), r = M(null), {
1256
+ isOpen: a,
1257
+ close: n,
1258
+ query: i,
1259
+ setQuery: d,
1260
+ mode: y,
1261
+ status: c,
1262
+ pendingTools: T,
1263
+ completedTools: p,
1264
+ agentResponse: u,
1265
+ submit: x,
1266
+ historyPrevious: k,
1267
+ historyNext: l,
1268
+ suggestions: h,
1269
+ agentAvailable: C
2026
1270
  } = o;
2027
- W(() => {
2028
- if (!s) return;
2029
- const S = (F) => {
2030
- r.current && !r.current.contains(F.target) && a();
2031
- }, E = setTimeout(() => {
2032
- document.addEventListener("mousedown", S);
1271
+ A(() => {
1272
+ if (!a) return;
1273
+ const N = (D) => {
1274
+ r.current && !r.current.contains(D.target) && n();
1275
+ }, V = setTimeout(() => {
1276
+ document.addEventListener("mousedown", N);
2033
1277
  }, 100);
2034
1278
  return () => {
2035
- clearTimeout(E), document.removeEventListener("mousedown", S);
1279
+ clearTimeout(V), document.removeEventListener("mousedown", N);
2036
1280
  };
2037
- }, [s, a]);
2038
- const [R, A] = L(!1), [I, $] = L(!1);
2039
- if (W(() => {
2040
- if (s)
2041
- $(!0), requestAnimationFrame(() => {
1281
+ }, [a, n]);
1282
+ const [E, R] = W(!1), [I, F] = W(!1);
1283
+ if (A(() => {
1284
+ if (a)
1285
+ F(!0), requestAnimationFrame(() => {
2042
1286
  requestAnimationFrame(() => {
2043
- A(!0);
1287
+ R(!0);
2044
1288
  });
2045
1289
  });
2046
1290
  else {
2047
- A(!1);
2048
- const S = setTimeout(() => {
2049
- $(!1);
1291
+ R(!1);
1292
+ const N = setTimeout(() => {
1293
+ F(!1);
2050
1294
  }, 150);
2051
- return () => clearTimeout(S);
1295
+ return () => clearTimeout(N);
2052
1296
  }
2053
- }, [s]), !I)
1297
+ }, [a]), !I)
2054
1298
  return null;
2055
- const D = (e == null ? void 0 : e.placeholder) || "What would you like to do?", w = [...d, ...h], P = w.length > 0, v = f && u !== "idle", C = !n && u === "idle" && k.length > 0, y = p === "quick-command" && u === "idle";
2056
- return /* @__PURE__ */ b(se, { children: [
2057
- /* @__PURE__ */ l(
1299
+ const f = C ? (e == null ? void 0 : e.placeholder) || "What would you like to do?" : "Quick command mode (agent unavailable)", b = [...p, ...T], v = b.length > 0, S = u && c !== "idle", _ = C && !i && c === "idle" && h.length > 0, P = (y === "quick-command" || !C) && c === "idle", H = !C && y !== "quick-command" && c === "idle";
1300
+ return /* @__PURE__ */ m(ke, { children: [
1301
+ /* @__PURE__ */ s(
2058
1302
  "div",
2059
1303
  {
2060
1304
  style: {
@@ -2062,10 +1306,10 @@ const De = ({
2062
1306
  inset: 0,
2063
1307
  zIndex: 999
2064
1308
  },
2065
- onClick: a
1309
+ onClick: n
2066
1310
  }
2067
1311
  ),
2068
- /* @__PURE__ */ b(
1312
+ /* @__PURE__ */ m(
2069
1313
  "div",
2070
1314
  {
2071
1315
  ref: r,
@@ -2083,27 +1327,28 @@ const De = ({
2083
1327
  display: "flex",
2084
1328
  flexDirection: "column-reverse",
2085
1329
  overflow: "hidden",
2086
- transform: R ? "translateY(0)" : "translateY(100%)",
1330
+ transform: E ? "translateY(0)" : "translateY(100%)",
2087
1331
  transition: "transform 150ms ease-out",
2088
1332
  ...e == null ? void 0 : e.style
2089
1333
  },
2090
1334
  children: [
2091
- /* @__PURE__ */ b("div", { children: [
2092
- /* @__PURE__ */ l(
2093
- ie,
1335
+ /* @__PURE__ */ m("div", { children: [
1336
+ /* @__PURE__ */ s(
1337
+ ee,
2094
1338
  {
2095
- value: n,
2096
- onChange: i,
2097
- onSubmit: g,
2098
- onClose: a,
2099
- onHistoryPrevious: m,
2100
- onHistoryNext: c,
2101
- mode: p,
2102
- status: u,
2103
- placeholder: D
1339
+ value: i,
1340
+ onChange: d,
1341
+ onSubmit: x,
1342
+ onClose: n,
1343
+ onHistoryPrevious: k,
1344
+ onHistoryNext: l,
1345
+ mode: y,
1346
+ status: c,
1347
+ placeholder: f,
1348
+ agentAvailable: C
2104
1349
  }
2105
1350
  ),
2106
- /* @__PURE__ */ b(
1351
+ /* @__PURE__ */ m(
2107
1352
  "div",
2108
1353
  {
2109
1354
  style: {
@@ -2116,8 +1361,8 @@ const De = ({
2116
1361
  backgroundColor: t.colors.background
2117
1362
  },
2118
1363
  children: [
2119
- /* @__PURE__ */ b("span", { children: [
2120
- /* @__PURE__ */ l(
1364
+ /* @__PURE__ */ m("span", { children: [
1365
+ /* @__PURE__ */ s(
2121
1366
  "kbd",
2122
1367
  {
2123
1368
  style: {
@@ -2132,8 +1377,8 @@ const De = ({
2132
1377
  " ",
2133
1378
  "Execute"
2134
1379
  ] }),
2135
- /* @__PURE__ */ b("span", { children: [
2136
- /* @__PURE__ */ l(
1380
+ /* @__PURE__ */ m("span", { children: [
1381
+ /* @__PURE__ */ s(
2137
1382
  "kbd",
2138
1383
  {
2139
1384
  style: {
@@ -2148,8 +1393,8 @@ const De = ({
2148
1393
  " ",
2149
1394
  "Close"
2150
1395
  ] }),
2151
- /* @__PURE__ */ b("span", { children: [
2152
- /* @__PURE__ */ l(
1396
+ /* @__PURE__ */ m("span", { children: [
1397
+ /* @__PURE__ */ s(
2153
1398
  "kbd",
2154
1399
  {
2155
1400
  style: {
@@ -2164,8 +1409,8 @@ const De = ({
2164
1409
  " ",
2165
1410
  "History"
2166
1411
  ] }),
2167
- /* @__PURE__ */ b("span", { style: { marginLeft: "auto" }, children: [
2168
- /* @__PURE__ */ l(
1412
+ /* @__PURE__ */ m("span", { style: { marginLeft: "auto" }, children: [
1413
+ /* @__PURE__ */ s(
2169
1414
  "kbd",
2170
1415
  {
2171
1416
  style: {
@@ -2184,16 +1429,16 @@ const De = ({
2184
1429
  }
2185
1430
  )
2186
1431
  ] }),
2187
- /* @__PURE__ */ b("div", { style: { overflow: "auto" }, children: [
2188
- P && /* @__PURE__ */ l(le, { tools: w, compact: w.length > 3 }),
2189
- v && /* @__PURE__ */ l(
2190
- ce,
1432
+ /* @__PURE__ */ m("div", { style: { overflow: "auto" }, children: [
1433
+ v && /* @__PURE__ */ s(te, { tools: b, compact: b.length > 3 }),
1434
+ S && /* @__PURE__ */ s(
1435
+ oe,
2191
1436
  {
2192
- response: f,
2193
- streaming: u === "thinking"
1437
+ response: u,
1438
+ streaming: c === "thinking"
2194
1439
  }
2195
1440
  ),
2196
- C && /* @__PURE__ */ b(
1441
+ _ && /* @__PURE__ */ m(
2197
1442
  "div",
2198
1443
  {
2199
1444
  style: {
@@ -2203,7 +1448,7 @@ const De = ({
2203
1448
  flexWrap: "wrap"
2204
1449
  },
2205
1450
  children: [
2206
- /* @__PURE__ */ l(
1451
+ /* @__PURE__ */ s(
2207
1452
  "span",
2208
1453
  {
2209
1454
  style: {
@@ -2214,11 +1459,11 @@ const De = ({
2214
1459
  children: "Try:"
2215
1460
  }
2216
1461
  ),
2217
- k.map((S, E) => /* @__PURE__ */ b(
1462
+ h.map((N, V) => /* @__PURE__ */ m(
2218
1463
  "button",
2219
1464
  {
2220
1465
  onClick: () => {
2221
- i(S);
1466
+ d(N);
2222
1467
  },
2223
1468
  style: {
2224
1469
  padding: "4px 10px",
@@ -2230,24 +1475,50 @@ const De = ({
2230
1475
  cursor: "pointer",
2231
1476
  transition: "background-color 150ms ease"
2232
1477
  },
2233
- onMouseEnter: (F) => {
2234
- F.currentTarget.style.backgroundColor = t.colors.backgroundTertiary;
1478
+ onMouseEnter: (D) => {
1479
+ D.currentTarget.style.backgroundColor = t.colors.backgroundTertiary;
2235
1480
  },
2236
- onMouseLeave: (F) => {
2237
- F.currentTarget.style.backgroundColor = t.colors.backgroundSecondary;
1481
+ onMouseLeave: (D) => {
1482
+ D.currentTarget.style.backgroundColor = t.colors.backgroundSecondary;
2238
1483
  },
2239
1484
  children: [
2240
1485
  '"',
2241
- S,
1486
+ N,
2242
1487
  '"'
2243
1488
  ]
2244
1489
  },
2245
- E
1490
+ V
2246
1491
  ))
2247
1492
  ]
2248
1493
  }
2249
1494
  ),
2250
- y && /* @__PURE__ */ b(
1495
+ H && /* @__PURE__ */ m(
1496
+ "div",
1497
+ {
1498
+ style: {
1499
+ padding: "12px 16px",
1500
+ fontSize: "12px",
1501
+ color: t.colors.warning,
1502
+ display: "flex",
1503
+ alignItems: "center",
1504
+ gap: "8px"
1505
+ },
1506
+ children: [
1507
+ /* @__PURE__ */ s("span", { children: "Agent unavailable." }),
1508
+ /* @__PURE__ */ m("span", { style: { color: t.colors.textMuted }, children: [
1509
+ "Use quick commands (start with ",
1510
+ /* @__PURE__ */ s("kbd", { style: {
1511
+ padding: "2px 6px",
1512
+ backgroundColor: t.colors.backgroundSecondary,
1513
+ borderRadius: "3px",
1514
+ border: `1px solid ${t.colors.border}`
1515
+ }, children: "/" }),
1516
+ ")"
1517
+ ] })
1518
+ ]
1519
+ }
1520
+ ),
1521
+ P && /* @__PURE__ */ m(
2251
1522
  "div",
2252
1523
  {
2253
1524
  style: {
@@ -2257,29 +1528,29 @@ const De = ({
2257
1528
  fontFamily: t.fonts.monospace
2258
1529
  },
2259
1530
  children: [
2260
- /* @__PURE__ */ l("div", { style: { marginBottom: "8px", color: t.colors.textSecondary }, children: "Quick commands:" }),
2261
- /* @__PURE__ */ b("div", { style: { display: "flex", flexDirection: "column", gap: "4px" }, children: [
2262
- /* @__PURE__ */ b("div", { children: [
2263
- /* @__PURE__ */ l("span", { style: { color: t.colors.info }, children: "/toggle" }),
1531
+ /* @__PURE__ */ s("div", { style: { marginBottom: "8px", color: t.colors.textSecondary }, children: "Quick commands:" }),
1532
+ /* @__PURE__ */ m("div", { style: { display: "flex", flexDirection: "column", gap: "4px" }, children: [
1533
+ /* @__PURE__ */ m("div", { children: [
1534
+ /* @__PURE__ */ s("span", { style: { color: t.colors.info }, children: "/toggle" }),
2264
1535
  " ",
2265
- /* @__PURE__ */ l("span", { style: { color: t.colors.textMuted }, children: "<left|right>" }),
1536
+ /* @__PURE__ */ s("span", { style: { color: t.colors.textMuted }, children: "<left|right>" }),
2266
1537
  " ",
2267
1538
  "- Toggle sidebar visibility"
2268
1539
  ] }),
2269
- /* @__PURE__ */ b("div", { children: [
2270
- /* @__PURE__ */ l("span", { style: { color: t.colors.info }, children: "/switch" }),
1540
+ /* @__PURE__ */ m("div", { children: [
1541
+ /* @__PURE__ */ s("span", { style: { color: t.colors.info }, children: "/switch" }),
2271
1542
  " ",
2272
- /* @__PURE__ */ l("span", { style: { color: t.colors.textMuted }, children: "<slot> <panel>" }),
1543
+ /* @__PURE__ */ s("span", { style: { color: t.colors.textMuted }, children: "<slot> <panel>" }),
2273
1544
  " ",
2274
1545
  "- Switch panel content"
2275
1546
  ] }),
2276
- /* @__PURE__ */ b("div", { children: [
2277
- /* @__PURE__ */ l("span", { style: { color: t.colors.info }, children: "/collapse" }),
1547
+ /* @__PURE__ */ m("div", { children: [
1548
+ /* @__PURE__ */ s("span", { style: { color: t.colors.info }, children: "/collapse" }),
2278
1549
  " ",
2279
1550
  "- Collapse all sidebars"
2280
1551
  ] }),
2281
- /* @__PURE__ */ b("div", { children: [
2282
- /* @__PURE__ */ l("span", { style: { color: t.colors.info }, children: "/expand" }),
1552
+ /* @__PURE__ */ m("div", { children: [
1553
+ /* @__PURE__ */ s("span", { style: { color: t.colors.info }, children: "/expand" }),
2283
1554
  " ",
2284
1555
  "- Expand all sidebars"
2285
1556
  ] })
@@ -2291,7 +1562,7 @@ const De = ({
2291
1562
  ]
2292
1563
  }
2293
1564
  ),
2294
- /* @__PURE__ */ l("style", { children: `
1565
+ /* @__PURE__ */ s("style", { children: `
2295
1566
  @keyframes pulse {
2296
1567
  0%, 100% { opacity: 1; }
2297
1568
  50% { opacity: 0.5; }
@@ -2307,177 +1578,184 @@ const De = ({
2307
1578
  ` })
2308
1579
  ] });
2309
1580
  };
2310
- De.displayName = "AgentCommandPalette";
2311
- const Ee = [
1581
+ Te.displayName = "AgentCommandPalette";
1582
+ const Ce = [
2312
1583
  "hide sidebars",
2313
1584
  "show terminal",
2314
1585
  "focus editor"
2315
1586
  ];
2316
- function ut({
1587
+ function Ge({
2317
1588
  events: o,
2318
1589
  keyboard: e = { key: "p", altKey: !0 },
2319
1590
  config: t = {},
2320
1591
  onExecuteTool: r,
2321
- initialSuggestions: s = Ee
1592
+ initialSuggestions: a = Ce,
1593
+ agentAvailable: n = !0
2322
1594
  } = {}) {
2323
- const [a, n] = L(!1), [i, p] = L(""), [u, h] = L("natural"), [d, f] = L("idle"), [g, m] = L([]), [c, k] = L([]), [R, A] = L(""), [I, $] = L([]), [D, w] = L(-1), P = X(() => s, [s]), v = x((T) => {
2324
- p(T), h(T.startsWith("/") ? "quick-command" : "natural");
2325
- }, []), C = x(() => {
2326
- n(!0), p(""), h("natural"), f("idle"), m([]), k([]), A(""), w(-1), o == null || o.emit({
1595
+ const [i, d] = W(!1), [y, c] = W(""), [T, p] = W("natural"), [u, x] = W("idle"), [k, l] = W([]), [h, C] = W([]), [E, R] = W(""), [I, F] = W([]), [f, b] = W(-1), v = me(() => a, [a]), S = g((w) => {
1596
+ c(w), p(w.startsWith("/") ? "quick-command" : "natural");
1597
+ }, []), _ = g(() => {
1598
+ d(!0), n ? (c(""), p("natural")) : (c("/"), p("quick-command")), x("idle"), l([]), C([]), R(""), b(-1), o == null || o.emit({
2327
1599
  type: "agent-command-palette:opened",
2328
1600
  source: "agent-command-palette",
2329
1601
  timestamp: Date.now(),
2330
1602
  payload: {}
2331
1603
  });
2332
- }, [o]), y = x(() => {
2333
- n(!1), o == null || o.emit({
1604
+ }, [o, n]), P = g(() => {
1605
+ d(!1), o == null || o.emit({
2334
1606
  type: "agent-command-palette:closed",
2335
1607
  source: "agent-command-palette",
2336
1608
  timestamp: Date.now(),
2337
1609
  payload: {}
2338
1610
  });
2339
- }, [o]), S = x(() => {
2340
- a ? y() : C();
2341
- }, [a, C, y]), E = x(() => {
2342
- p(""), h("natural"), f("idle"), m([]), k([]), A(""), w(-1);
2343
- }, []), F = x((T) => {
2344
- const j = {
2345
- ...T,
1611
+ }, [o]), H = g(() => {
1612
+ i ? P() : _();
1613
+ }, [i, _, P]), N = g(() => {
1614
+ c(""), p("natural"), x("idle"), l([]), C([]), R(""), b(-1);
1615
+ }, []), V = g((w) => {
1616
+ const z = {
1617
+ ...w,
2346
1618
  status: "pending"
2347
1619
  };
2348
- return m((M) => [...M, j]), j;
2349
- }, []), V = x(
2350
- (T, j, M, J) => {
2351
- m((N) => {
2352
- const K = N.find((B) => B.id === T);
2353
- if (!K) return N;
2354
- const O = {
2355
- ...K,
2356
- status: j,
2357
- result: M,
1620
+ return l((j) => [...j, z]), z;
1621
+ }, []), D = g(
1622
+ (w, z, j, J) => {
1623
+ l((q) => {
1624
+ const O = q.find((B) => B.id === w);
1625
+ if (!O) return q;
1626
+ const $ = {
1627
+ ...O,
1628
+ status: z,
1629
+ result: j,
2358
1630
  error: J
2359
1631
  };
2360
- return j === "success" || j === "error" ? (k((B) => [...B, O]), N.filter((B) => B.id !== T)) : N.map((B) => B.id === T ? O : B);
1632
+ return z === "success" || z === "error" ? (C((B) => [...B, $]), q.filter((B) => B.id !== w)) : q.map((B) => B.id === w ? $ : B);
2361
1633
  });
2362
1634
  },
2363
1635
  []
2364
- ), Q = x(
2365
- async (T) => {
2366
- const j = T.replace(/^\//, "").trim().split(/\s+/), M = j[0], J = j.slice(1);
2367
- if (!M) return;
2368
- f("executing");
2369
- const N = `quick-${Date.now()}`;
2370
- F({
2371
- id: N,
2372
- name: M,
1636
+ ), G = g(
1637
+ async (w) => {
1638
+ const z = w.replace(/^\//, "").trim().split(/\s+/), j = z[0], J = z.slice(1);
1639
+ if (!j) return;
1640
+ x("executing");
1641
+ const q = `quick-${Date.now()}`;
1642
+ V({
1643
+ id: q,
1644
+ name: j,
2373
1645
  args: { args: J }
2374
- }), V(N, "running");
1646
+ }), D(q, "running");
2375
1647
  try {
2376
1648
  if (r) {
2377
- const O = await r(M, { args: J });
2378
- V(N, "success", String(O));
1649
+ const $ = await r(j, { args: J });
1650
+ D(q, "success", String($));
2379
1651
  } else
2380
- V(N, "success", "Tool executed (no handler)");
2381
- $((O) => [
1652
+ D(q, "success", "Tool executed (no handler)");
1653
+ F(($) => [
2382
1654
  {
2383
- query: T,
1655
+ query: w,
2384
1656
  timestamp: Date.now(),
2385
- toolsExecuted: [M],
1657
+ toolsExecuted: [j],
2386
1658
  success: !0
2387
1659
  },
2388
- ...O.slice(0, (t.maxHistoryEntries || 50) - 1)
2389
- ]), f("complete"), A(`Executed: ${M}`);
2390
- const K = t.autoCloseDelay ?? 1e3;
2391
- K > 0 && setTimeout(() => y(), K);
2392
- } catch (K) {
2393
- const O = K instanceof Error ? K.message : "Unknown error";
2394
- V(N, "error", void 0, O), f("error"), A(`Error: ${O}`);
1660
+ ...$.slice(0, (t.maxHistoryEntries || 50) - 1)
1661
+ ]), x("complete"), R(`Executed: ${j}`);
1662
+ const O = t.autoCloseDelay ?? 1e3;
1663
+ O > 0 && setTimeout(() => P(), O);
1664
+ } catch (O) {
1665
+ const $ = O instanceof Error ? O.message : "Unknown error";
1666
+ D(q, "error", void 0, $), x("error"), R(`Error: ${$}`);
2395
1667
  }
2396
1668
  },
2397
- [r, F, V, t.autoCloseDelay, t.maxHistoryEntries, y]
2398
- ), Z = x(() => {
2399
- if (i.trim()) {
2400
- if (u === "quick-command") {
2401
- Q(i);
1669
+ [r, V, D, t.autoCloseDelay, t.maxHistoryEntries, P]
1670
+ ), ue = g(() => {
1671
+ if (y.trim()) {
1672
+ if (T === "quick-command") {
1673
+ G(y);
2402
1674
  return;
2403
1675
  }
2404
- f("thinking"), o == null || o.emit({
1676
+ if (!n) {
1677
+ R("Agent unavailable. Use quick commands (start with /)."), x("error");
1678
+ return;
1679
+ }
1680
+ x("thinking"), o == null || o.emit({
2405
1681
  type: "agent-command-palette:submit",
2406
1682
  source: "agent-command-palette",
2407
1683
  timestamp: Date.now(),
2408
- payload: { query: i, mode: u }
2409
- }), $((T) => [
1684
+ payload: { query: y, mode: T }
1685
+ }), F((w) => [
2410
1686
  {
2411
- query: i,
1687
+ query: y,
2412
1688
  timestamp: Date.now(),
2413
1689
  toolsExecuted: [],
2414
1690
  success: !0
2415
1691
  },
2416
- ...T.slice(0, (t.maxHistoryEntries || 50) - 1)
1692
+ ...w.slice(0, (t.maxHistoryEntries || 50) - 1)
2417
1693
  ]);
2418
1694
  }
2419
- }, [i, u, Q, o, t.maxHistoryEntries]), te = x(() => {
1695
+ }, [y, T, G, o, t.maxHistoryEntries, n]), fe = g(() => {
2420
1696
  if (I.length === 0) return;
2421
- const T = D < I.length - 1 ? D + 1 : D;
2422
- w(T), I[T] && (p(I[T].query), h(I[T].query.startsWith("/") ? "quick-command" : "natural"));
2423
- }, [I, D]), G = x(() => {
2424
- if (D <= 0) {
2425
- w(-1), p(""), h("natural");
1697
+ const w = f < I.length - 1 ? f + 1 : f;
1698
+ b(w), I[w] && (c(I[w].query), p(I[w].query.startsWith("/") ? "quick-command" : "natural"));
1699
+ }, [I, f]), ye = g(() => {
1700
+ if (f <= 0) {
1701
+ b(-1), c(""), p("natural");
2426
1702
  return;
2427
1703
  }
2428
- const T = D - 1;
2429
- w(T), I[T] && (p(I[T].query), h(I[T].query.startsWith("/") ? "quick-command" : "natural"));
2430
- }, [I, D]), ee = x(
2431
- (T) => {
1704
+ const w = f - 1;
1705
+ b(w), I[w] && (c(I[w].query), p(I[w].query.startsWith("/") ? "quick-command" : "natural"));
1706
+ }, [I, f]), X = g(
1707
+ (w) => {
2432
1708
  const {
2433
- key: j = "p",
2434
- altKey: M = !0,
1709
+ key: z = "p",
1710
+ altKey: j = !0,
2435
1711
  ctrlKey: J = !1,
2436
- metaKey: N = !1,
2437
- shiftKey: K = !1
2438
- } = e, O = T.altKey === M && T.ctrlKey === J && T.metaKey === N && T.shiftKey === K;
2439
- if ((M ? T.code === `Key${j.toUpperCase()}` : T.key.toLowerCase() === j.toLowerCase()) && O) {
2440
- const U = T.target;
2441
- if (!U.closest("[data-agent-command-palette-input]") && (U.tagName === "INPUT" || U.tagName === "TEXTAREA" || U.isContentEditable))
1712
+ metaKey: q = !1,
1713
+ shiftKey: O = !1
1714
+ } = e, $ = w.altKey === j && w.ctrlKey === J && w.metaKey === q && w.shiftKey === O;
1715
+ if ((j ? w.code === `Key${z.toUpperCase()}` : w.key.toLowerCase() === z.toLowerCase()) && $) {
1716
+ const Q = w.target;
1717
+ if (!Q.closest("[data-agent-command-palette-input]") && (Q.tagName === "INPUT" || Q.tagName === "TEXTAREA" || Q.isContentEditable))
2442
1718
  return;
2443
- T.preventDefault(), S();
1719
+ w.preventDefault(), H();
2444
1720
  }
2445
1721
  },
2446
- [e, S]
1722
+ [e, H]
2447
1723
  );
2448
- return W(() => (window.addEventListener("keydown", ee), () => window.removeEventListener("keydown", ee)), [ee]), {
1724
+ return A(() => (window.addEventListener("keydown", X), () => window.removeEventListener("keydown", X)), [X]), {
1725
+ // Agent availability
1726
+ agentAvailable: n,
2449
1727
  // Visibility
2450
- isOpen: a,
2451
- open: C,
2452
- close: y,
2453
- toggle: S,
1728
+ isOpen: i,
1729
+ open: _,
1730
+ close: P,
1731
+ toggle: H,
2454
1732
  // Input
2455
- query: i,
2456
- setQuery: v,
2457
- mode: u,
1733
+ query: y,
1734
+ setQuery: S,
1735
+ mode: T,
2458
1736
  // Execution
2459
- status: d,
2460
- setStatus: f,
2461
- pendingTools: g,
2462
- completedTools: c,
2463
- agentResponse: R,
2464
- setAgentResponse: A,
2465
- submit: Z,
2466
- executeQuickCommand: Q,
1737
+ status: u,
1738
+ setStatus: x,
1739
+ pendingTools: k,
1740
+ completedTools: h,
1741
+ agentResponse: E,
1742
+ setAgentResponse: R,
1743
+ submit: ue,
1744
+ executeQuickCommand: G,
2467
1745
  // Tool management (for external AI integration)
2468
- addPendingTool: F,
2469
- updateToolStatus: V,
1746
+ addPendingTool: V,
1747
+ updateToolStatus: D,
2470
1748
  // History
2471
1749
  history: I,
2472
- historyPrevious: te,
2473
- historyNext: G,
1750
+ historyPrevious: fe,
1751
+ historyNext: ye,
2474
1752
  // Suggestions
2475
- suggestions: P,
1753
+ suggestions: v,
2476
1754
  // Actions
2477
- clear: E
1755
+ clear: N
2478
1756
  };
2479
1757
  }
2480
- const de = {
1758
+ const re = {
2481
1759
  name: "get_visible_panels",
2482
1760
  description: "Get the current visibility state of all panel slots (left, middle, right). Returns which panels are active in each slot and whether side panels are collapsed.",
2483
1761
  inputs: {
@@ -2546,7 +1824,7 @@ const de = {
2546
1824
  call_template_type: "panel_event",
2547
1825
  event_type: "panel:get-visibility"
2548
1826
  }
2549
- }, pe = {
1827
+ }, se = {
2550
1828
  name: "get_panel_state",
2551
1829
  description: "Get the current state of a specific panel. Returns panel-specific state data if the panel supports state queries.",
2552
1830
  inputs: {
@@ -2578,7 +1856,7 @@ const de = {
2578
1856
  call_template_type: "panel_event",
2579
1857
  event_type: "panel:get-state"
2580
1858
  }
2581
- }, ue = {
1859
+ }, ae = {
2582
1860
  name: "list_panels_with_state",
2583
1861
  description: "Get a list of all panels that support state queries. Use this to discover which panels can be queried with get_panel_state.",
2584
1862
  inputs: {
@@ -2611,7 +1889,7 @@ const de = {
2611
1889
  call_template_type: "panel_event",
2612
1890
  event_type: "panel:list-state-panels"
2613
1891
  }
2614
- }, fe = {
1892
+ }, ne = {
2615
1893
  name: "toggle_panel",
2616
1894
  description: "Collapse or expand a side panel to give more space to the main content area.",
2617
1895
  inputs: {
@@ -2638,7 +1916,7 @@ const de = {
2638
1916
  call_template_type: "panel_event",
2639
1917
  event_type: "panel:toggle"
2640
1918
  }
2641
- }, me = {
1919
+ }, ie = {
2642
1920
  name: "collapse_all_panels",
2643
1921
  description: "Collapse both left and right panels to maximize the main content area. Useful for focus mode.",
2644
1922
  inputs: {
@@ -2658,7 +1936,7 @@ const de = {
2658
1936
  call_template_type: "panel_event",
2659
1937
  event_type: "panel:collapse-all"
2660
1938
  }
2661
- }, ye = {
1939
+ }, le = {
2662
1940
  name: "expand_all_panels",
2663
1941
  description: "Expand both left and right panels to show all content. Restores the default layout.",
2664
1942
  inputs: {
@@ -2678,7 +1956,7 @@ const de = {
2678
1956
  call_template_type: "panel_event",
2679
1957
  event_type: "panel:expand-all"
2680
1958
  }
2681
- }, he = {
1959
+ }, ce = {
2682
1960
  name: "switch_panel",
2683
1961
  description: "Change which content is displayed in a panel slot (left, middle, or right).",
2684
1962
  inputs: {
@@ -2709,7 +1987,7 @@ const de = {
2709
1987
  call_template_type: "panel_event",
2710
1988
  event_type: "panel:switch"
2711
1989
  }
2712
- }, ge = {
1990
+ }, de = {
2713
1991
  name: "focus_panel",
2714
1992
  description: "Set focus to a specific panel slot for keyboard navigation.",
2715
1993
  inputs: {
@@ -2735,7 +2013,7 @@ const de = {
2735
2013
  call_template_type: "panel_event",
2736
2014
  event_type: "panel:focus"
2737
2015
  }
2738
- }, xe = {
2016
+ }, pe = {
2739
2017
  name: "reset_layout",
2740
2018
  description: "Reset panel sizes to the default layout configuration.",
2741
2019
  inputs: {
@@ -2755,113 +2033,44 @@ const de = {
2755
2033
  call_template_type: "panel_event",
2756
2034
  event_type: "panel:reset-layout"
2757
2035
  }
2758
- }, _e = [
2036
+ }, Ie = [
2759
2037
  // State query tools
2760
- de,
2761
- pe,
2762
- ue,
2038
+ re,
2039
+ se,
2040
+ ae,
2763
2041
  // Layout action tools
2764
- fe,
2765
- me,
2766
- ye,
2767
- he,
2768
- ge,
2769
- xe
2770
- ], ft = [
2042
+ ne,
2043
+ ie,
2044
+ le,
2045
+ ce,
2046
+ de,
2047
+ pe
2048
+ ], Xe = [
2049
+ re,
2050
+ se,
2051
+ ae
2052
+ ], Ye = [
2053
+ ne,
2054
+ ie,
2055
+ le,
2056
+ ce,
2771
2057
  de,
2772
- pe,
2773
- ue
2774
- ], mt = [
2775
- fe,
2776
- me,
2777
- ye,
2778
- he,
2779
- ge,
2780
- xe
2781
- ], yt = {
2058
+ pe
2059
+ ], Ze = {
2782
2060
  id: "panel-layouts",
2783
2061
  name: "Panel Layouts",
2784
2062
  description: "Generic panel layout and state query operations",
2785
- tools: _e
2063
+ tools: Ie
2786
2064
  };
2787
- function ze(o, e, t = {}) {
2788
- const {
2789
- categoryPrefix: r = "Panel Tools",
2790
- basePriority: s = 50,
2791
- includePanelInCategory: a = !0
2792
- } = t, n = a ? `${r} > ${o.panelId}` : r, i = qe(o.inputs);
2793
- return {
2794
- id: `tool.${o.qualifiedName}`,
2795
- label: $e(o.name),
2796
- description: o.description,
2797
- category: n,
2798
- keywords: [...o.tags, o.panelId, "tool"],
2799
- priority: s,
2800
- execute: async (p) => {
2801
- var h;
2802
- if (i) {
2803
- console.warn(
2804
- `Tool "${o.qualifiedName}" requires parameters. Invoke programmatically with: registry.invokeTool('${o.qualifiedName}', { ... })`
2805
- ), (h = p.events) == null || h.emit({
2806
- type: "tool:requires-parameters",
2807
- source: "command-palette",
2808
- timestamp: Date.now(),
2809
- payload: {
2810
- toolName: o.qualifiedName,
2811
- inputs: o.inputs
2812
- }
2813
- });
2814
- return;
2815
- }
2816
- const u = await e.invokeTool(
2817
- o.qualifiedName,
2818
- {},
2819
- "command-palette"
2820
- );
2821
- u.success || console.error(`Tool invocation failed: ${u.error}`), p.closeCommandPalette();
2822
- }
2823
- };
2824
- }
2825
- function be(o, e = {}) {
2826
- return o.getAllTools().map((r) => ze(r, o, e));
2827
- }
2828
- function ht(o, e = {}) {
2829
- return () => be(o, e);
2830
- }
2831
- function $e(o) {
2832
- return o.split("_").map((e) => e.charAt(0).toUpperCase() + e.slice(1)).join(" ");
2833
- }
2834
- function qe(o) {
2835
- return !(o.type !== "object" || !o.required || o.required.length === 0);
2836
- }
2837
- function gt(o, e = {}) {
2838
- return be(o, e);
2839
- }
2840
- function xt(o) {
2841
- const { inputs: e } = o;
2842
- if (e.type !== "object" || !e.properties)
2843
- return [];
2844
- const t = new Set(e.required || []), r = [];
2845
- for (const [s, a] of Object.entries(e.properties))
2846
- r.push({
2847
- name: s,
2848
- type: a.type || "unknown",
2849
- description: a.description || "",
2850
- required: t.has(s),
2851
- default: a.default,
2852
- enum: a.enum
2853
- });
2854
- return r;
2855
- }
2856
- function je(o) {
2065
+ function Pe(o) {
2857
2066
  const e = {};
2858
2067
  if (o.inputs.properties)
2859
2068
  for (const [t, r] of Object.entries(o.inputs.properties)) {
2860
- const s = r;
2069
+ const a = r;
2861
2070
  e[t] = {
2862
- type: s.type || "string",
2863
- description: s.description,
2864
- ...s.enum && { enum: s.enum }
2071
+ type: a.type || "string",
2072
+ description: a.description,
2073
+ ...a.enum && { enum: a.enum }
2865
2074
  };
2866
2075
  }
2867
2076
  return {
@@ -2874,12 +2083,12 @@ function je(o) {
2874
2083
  }
2875
2084
  };
2876
2085
  }
2877
- function bt(o) {
2086
+ function et(o) {
2878
2087
  return {
2879
- functionDeclarations: o.map(je)
2088
+ functionDeclarations: o.map(Pe)
2880
2089
  };
2881
2090
  }
2882
- function Me(o) {
2091
+ function We(o) {
2883
2092
  return {
2884
2093
  type: "function",
2885
2094
  function: {
@@ -2889,54 +2098,54 @@ function Me(o) {
2889
2098
  }
2890
2099
  };
2891
2100
  }
2892
- function wt(o) {
2893
- return o.map(Me);
2101
+ function tt(o) {
2102
+ return o.map(We);
2894
2103
  }
2895
- function Ne(o) {
2104
+ function _e(o) {
2896
2105
  return {
2897
2106
  name: o.name,
2898
2107
  description: o.description,
2899
2108
  input_schema: o.inputs
2900
2109
  };
2901
2110
  }
2902
- function kt(o) {
2903
- return o.map(Ne);
2111
+ function ot(o) {
2112
+ return o.map(_e);
2904
2113
  }
2905
- function Fe(o) {
2114
+ function Re(o) {
2906
2115
  return {
2907
2116
  name: o.name,
2908
2117
  description: o.description,
2909
2118
  parameters: o.inputs
2910
2119
  };
2911
2120
  }
2912
- function Ct(o) {
2913
- return o.map(Fe);
2121
+ function rt(o) {
2122
+ return o.map(Re);
2914
2123
  }
2915
- function vt(o, e = {}) {
2124
+ function st(o, e = {}) {
2916
2125
  const {
2917
2126
  header: t = "You have access to the following tools:",
2918
2127
  includeParameters: r = !0
2919
- } = e, s = o.map((a) => {
2920
- let n = `- ${a.name}: ${a.description}`;
2921
- if (r && a.inputs.properties) {
2922
- const i = Object.entries(a.inputs.properties).map(([p, u]) => {
2923
- var f;
2924
- const h = u, d = (f = a.inputs.required) != null && f.includes(p) ? " (required)" : "";
2925
- return ` - ${p}: ${h.description || h.type}${d}`;
2128
+ } = e, a = o.map((n) => {
2129
+ let i = `- ${n.name}: ${n.description}`;
2130
+ if (r && n.inputs.properties) {
2131
+ const d = Object.entries(n.inputs.properties).map(([y, c]) => {
2132
+ var u;
2133
+ const T = c, p = (u = n.inputs.required) != null && u.includes(y) ? " (required)" : "";
2134
+ return ` - ${y}: ${T.description || T.type}${p}`;
2926
2135
  }).join(`
2927
2136
  `);
2928
- i && (n += `
2929
- ${i}`);
2137
+ d && (i += `
2138
+ ${d}`);
2930
2139
  }
2931
- return n;
2140
+ return i;
2932
2141
  });
2933
2142
  return `${t}
2934
2143
 
2935
- ${s.join(`
2144
+ ${a.join(`
2936
2145
 
2937
2146
  `)}`;
2938
2147
  }
2939
- const Oe = ({ size: o = 18 }) => /* @__PURE__ */ b(
2148
+ const Le = ({ size: o = 18 }) => /* @__PURE__ */ m(
2940
2149
  "svg",
2941
2150
  {
2942
2151
  width: o,
@@ -2948,11 +2157,11 @@ const Oe = ({ size: o = 18 }) => /* @__PURE__ */ b(
2948
2157
  strokeLinecap: "round",
2949
2158
  strokeLinejoin: "round",
2950
2159
  children: [
2951
- /* @__PURE__ */ l("rect", { width: "18", height: "18", x: "3", y: "3", rx: "2" }),
2952
- /* @__PURE__ */ l("path", { d: "M9 3v18" })
2160
+ /* @__PURE__ */ s("rect", { width: "18", height: "18", x: "3", y: "3", rx: "2" }),
2161
+ /* @__PURE__ */ s("path", { d: "M9 3v18" })
2953
2162
  ]
2954
2163
  }
2955
- ), Ke = ({ size: o = 18 }) => /* @__PURE__ */ b(
2164
+ ), Ae = ({ size: o = 18 }) => /* @__PURE__ */ m(
2956
2165
  "svg",
2957
2166
  {
2958
2167
  width: o,
@@ -2964,12 +2173,12 @@ const Oe = ({ size: o = 18 }) => /* @__PURE__ */ b(
2964
2173
  strokeLinecap: "round",
2965
2174
  strokeLinejoin: "round",
2966
2175
  children: [
2967
- /* @__PURE__ */ l("rect", { width: "18", height: "18", x: "3", y: "3", rx: "2" }),
2968
- /* @__PURE__ */ l("path", { d: "M9 3v18" }),
2969
- /* @__PURE__ */ l("path", { d: "m16 15-3-3 3-3" })
2176
+ /* @__PURE__ */ s("rect", { width: "18", height: "18", x: "3", y: "3", rx: "2" }),
2177
+ /* @__PURE__ */ s("path", { d: "M9 3v18" }),
2178
+ /* @__PURE__ */ s("path", { d: "m16 15-3-3 3-3" })
2970
2179
  ]
2971
2180
  }
2972
- ), Be = ({ size: o = 18 }) => /* @__PURE__ */ b(
2181
+ ), Ee = ({ size: o = 18 }) => /* @__PURE__ */ m(
2973
2182
  "svg",
2974
2183
  {
2975
2184
  width: o,
@@ -2981,11 +2190,11 @@ const Oe = ({ size: o = 18 }) => /* @__PURE__ */ b(
2981
2190
  strokeLinecap: "round",
2982
2191
  strokeLinejoin: "round",
2983
2192
  children: [
2984
- /* @__PURE__ */ l("rect", { width: "18", height: "18", x: "3", y: "3", rx: "2" }),
2985
- /* @__PURE__ */ l("path", { d: "M15 3v18" })
2193
+ /* @__PURE__ */ s("rect", { width: "18", height: "18", x: "3", y: "3", rx: "2" }),
2194
+ /* @__PURE__ */ s("path", { d: "M15 3v18" })
2986
2195
  ]
2987
2196
  }
2988
- ), Ve = ({ size: o = 18 }) => /* @__PURE__ */ b(
2197
+ ), De = ({ size: o = 18 }) => /* @__PURE__ */ m(
2989
2198
  "svg",
2990
2199
  {
2991
2200
  width: o,
@@ -2997,32 +2206,32 @@ const Oe = ({ size: o = 18 }) => /* @__PURE__ */ b(
2997
2206
  strokeLinecap: "round",
2998
2207
  strokeLinejoin: "round",
2999
2208
  children: [
3000
- /* @__PURE__ */ l("rect", { width: "18", height: "18", x: "3", y: "3", rx: "2" }),
3001
- /* @__PURE__ */ l("path", { d: "M15 3v18" }),
3002
- /* @__PURE__ */ l("path", { d: "m8 9 3 3-3 3" })
2209
+ /* @__PURE__ */ s("rect", { width: "18", height: "18", x: "3", y: "3", rx: "2" }),
2210
+ /* @__PURE__ */ s("path", { d: "M15 3v18" }),
2211
+ /* @__PURE__ */ s("path", { d: "m8 9 3 3-3 3" })
3003
2212
  ]
3004
2213
  }
3005
- ), oe = ({
2214
+ ), Y = ({
3006
2215
  isCollapsed: o,
3007
2216
  onToggle: e,
3008
2217
  side: t = "left",
3009
2218
  iconSize: r = 18,
3010
- style: s,
3011
- shortcutHint: a = "Cmd/Ctrl+B",
3012
- title: n,
3013
- className: i
2219
+ style: a,
2220
+ shortcutHint: n = "Cmd/Ctrl+B",
2221
+ title: i,
2222
+ className: d
3014
2223
  }) => {
3015
- const { theme: p } = q(), u = () => t === "right" ? o ? /* @__PURE__ */ l(Be, { size: r }) : /* @__PURE__ */ l(Ve, { size: r }) : o ? /* @__PURE__ */ l(Oe, { size: r }) : /* @__PURE__ */ l(Ke, { size: r });
3016
- return /* @__PURE__ */ l(
2224
+ const { theme: y } = K(), c = () => t === "right" ? o ? /* @__PURE__ */ s(Ee, { size: r }) : /* @__PURE__ */ s(De, { size: r }) : o ? /* @__PURE__ */ s(Le, { size: r }) : /* @__PURE__ */ s(Ae, { size: r });
2225
+ return /* @__PURE__ */ s(
3017
2226
  "button",
3018
2227
  {
3019
2228
  onClick: e,
3020
- title: n ?? `${o ? "Show" : "Hide"} ${t === "right" ? "Right Panel" : "Sidebar"}${a ? ` (${a})` : ""}`,
3021
- className: i,
2229
+ title: i ?? `${o ? "Show" : "Hide"} ${t === "right" ? "Right Panel" : "Sidebar"}${n ? ` (${n})` : ""}`,
2230
+ className: d,
3022
2231
  style: {
3023
2232
  background: "transparent",
3024
2233
  border: "none",
3025
- color: o ? p.colors.textSecondary : p.colors.primary,
2234
+ color: o ? y.colors.textSecondary : y.colors.primary,
3026
2235
  cursor: "pointer",
3027
2236
  padding: "6px",
3028
2237
  borderRadius: "4px",
@@ -3032,18 +2241,18 @@ const Oe = ({ size: o = 18 }) => /* @__PURE__ */ b(
3032
2241
  transition: "all 0.2s",
3033
2242
  width: "32px",
3034
2243
  height: "32px",
3035
- ...s
2244
+ ...a
3036
2245
  },
3037
- onMouseEnter: (d) => {
3038
- d.currentTarget.style.backgroundColor = p.colors.backgroundTertiary, d.currentTarget.style.color = p.colors.primary;
2246
+ onMouseEnter: (p) => {
2247
+ p.currentTarget.style.backgroundColor = y.colors.backgroundTertiary, p.currentTarget.style.color = y.colors.primary;
3039
2248
  },
3040
- onMouseLeave: (d) => {
3041
- d.currentTarget.style.backgroundColor = "transparent", d.currentTarget.style.color = o ? p.colors.textSecondary : p.colors.primary;
2249
+ onMouseLeave: (p) => {
2250
+ p.currentTarget.style.backgroundColor = "transparent", p.currentTarget.style.color = o ? y.colors.textSecondary : y.colors.primary;
3042
2251
  },
3043
- children: u()
2252
+ children: c()
3044
2253
  }
3045
2254
  );
3046
- }, He = ({ size: o = 14 }) => /* @__PURE__ */ b(
2255
+ }, ze = ({ size: o = 14 }) => /* @__PURE__ */ m(
3047
2256
  "svg",
3048
2257
  {
3049
2258
  width: o,
@@ -3055,13 +2264,13 @@ const Oe = ({ size: o = 18 }) => /* @__PURE__ */ b(
3055
2264
  strokeLinecap: "round",
3056
2265
  strokeLinejoin: "round",
3057
2266
  children: [
3058
- /* @__PURE__ */ l("path", { d: "M8 3 4 7l4 4" }),
3059
- /* @__PURE__ */ l("path", { d: "M4 7h16" }),
3060
- /* @__PURE__ */ l("path", { d: "m16 21 4-4-4-4" }),
3061
- /* @__PURE__ */ l("path", { d: "M20 17H4" })
2267
+ /* @__PURE__ */ s("path", { d: "M8 3 4 7l4 4" }),
2268
+ /* @__PURE__ */ s("path", { d: "M4 7h16" }),
2269
+ /* @__PURE__ */ s("path", { d: "m16 21 4-4-4-4" }),
2270
+ /* @__PURE__ */ s("path", { d: "M20 17H4" })
3062
2271
  ]
3063
2272
  }
3064
- ), Je = ({ size: o = 14 }) => /* @__PURE__ */ b(
2273
+ ), je = ({ size: o = 14 }) => /* @__PURE__ */ m(
3065
2274
  "svg",
3066
2275
  {
3067
2276
  width: o,
@@ -3073,31 +2282,31 @@ const Oe = ({ size: o = 18 }) => /* @__PURE__ */ b(
3073
2282
  strokeLinecap: "round",
3074
2283
  strokeLinejoin: "round",
3075
2284
  children: [
3076
- /* @__PURE__ */ l("path", { d: "m16 3 4 4-4 4" }),
3077
- /* @__PURE__ */ l("path", { d: "M20 7H4" }),
3078
- /* @__PURE__ */ l("path", { d: "m8 21-4-4 4-4" }),
3079
- /* @__PURE__ */ l("path", { d: "M4 17h16" })
2285
+ /* @__PURE__ */ s("path", { d: "m16 3 4 4-4 4" }),
2286
+ /* @__PURE__ */ s("path", { d: "M20 7H4" }),
2287
+ /* @__PURE__ */ s("path", { d: "m8 21-4-4 4-4" }),
2288
+ /* @__PURE__ */ s("path", { d: "M4 17h16" })
3080
2289
  ]
3081
2290
  }
3082
- ), re = ({
2291
+ ), Z = ({
3083
2292
  onSwitch: o,
3084
2293
  variant: e = "left-middle",
3085
2294
  iconSize: t = 14,
3086
2295
  style: r,
3087
- title: s,
3088
- className: a
2296
+ title: a,
2297
+ className: n
3089
2298
  }) => {
3090
- const { theme: n } = q(), i = () => e === "left-middle" ? "Switch left and middle panels" : "Switch right and middle panels", p = e === "left-middle" ? He : Je;
3091
- return /* @__PURE__ */ l(
2299
+ const { theme: i } = K(), d = () => e === "left-middle" ? "Switch left and middle panels" : "Switch right and middle panels", y = e === "left-middle" ? ze : je;
2300
+ return /* @__PURE__ */ s(
3092
2301
  "button",
3093
2302
  {
3094
2303
  onClick: o,
3095
- title: s ?? i(),
3096
- className: a,
2304
+ title: a ?? d(),
2305
+ className: n,
3097
2306
  style: {
3098
2307
  background: "transparent",
3099
2308
  border: "none",
3100
- color: n.colors.textSecondary,
2309
+ color: i.colors.textSecondary,
3101
2310
  cursor: "pointer",
3102
2311
  padding: "6px",
3103
2312
  borderRadius: "4px",
@@ -3109,16 +2318,16 @@ const Oe = ({ size: o = 18 }) => /* @__PURE__ */ b(
3109
2318
  height: "32px",
3110
2319
  ...r
3111
2320
  },
3112
- onMouseEnter: (u) => {
3113
- u.currentTarget.style.backgroundColor = n.colors.backgroundTertiary, u.currentTarget.style.color = n.colors.text;
2321
+ onMouseEnter: (c) => {
2322
+ c.currentTarget.style.backgroundColor = i.colors.backgroundTertiary, c.currentTarget.style.color = i.colors.text;
3114
2323
  },
3115
- onMouseLeave: (u) => {
3116
- u.currentTarget.style.backgroundColor = "transparent", u.currentTarget.style.color = n.colors.textSecondary;
2324
+ onMouseLeave: (c) => {
2325
+ c.currentTarget.style.backgroundColor = "transparent", c.currentTarget.style.color = i.colors.textSecondary;
3117
2326
  },
3118
- children: /* @__PURE__ */ l(p, { size: t })
2327
+ children: /* @__PURE__ */ s(y, { size: t })
3119
2328
  }
3120
2329
  );
3121
- }, Qe = ({ size: o = 14 }) => /* @__PURE__ */ b(
2330
+ }, qe = ({ size: o = 14 }) => /* @__PURE__ */ m(
3122
2331
  "svg",
3123
2332
  {
3124
2333
  width: o,
@@ -3130,29 +2339,29 @@ const Oe = ({ size: o = 18 }) => /* @__PURE__ */ b(
3130
2339
  strokeLinecap: "round",
3131
2340
  strokeLinejoin: "round",
3132
2341
  children: [
3133
- /* @__PURE__ */ l("rect", { width: "18", height: "18", x: "3", y: "3", rx: "2" }),
3134
- /* @__PURE__ */ l("path", { d: "M3 9h18" }),
3135
- /* @__PURE__ */ l("path", { d: "M9 21V9" })
2342
+ /* @__PURE__ */ s("rect", { width: "18", height: "18", x: "3", y: "3", rx: "2" }),
2343
+ /* @__PURE__ */ s("path", { d: "M3 9h18" }),
2344
+ /* @__PURE__ */ s("path", { d: "M9 21V9" })
3136
2345
  ]
3137
2346
  }
3138
- ), Ge = ({
2347
+ ), $e = ({
3139
2348
  onConfigure: o,
3140
2349
  iconSize: e = 14,
3141
2350
  style: t,
3142
2351
  title: r = "Configure panel layout",
3143
- className: s
2352
+ className: a
3144
2353
  }) => {
3145
- const { theme: a } = q();
3146
- return /* @__PURE__ */ l(
2354
+ const { theme: n } = K();
2355
+ return /* @__PURE__ */ s(
3147
2356
  "button",
3148
2357
  {
3149
2358
  onClick: o,
3150
2359
  title: r,
3151
- className: s,
2360
+ className: a,
3152
2361
  style: {
3153
2362
  background: "transparent",
3154
2363
  border: "none",
3155
- color: a.colors.textSecondary,
2364
+ color: n.colors.textSecondary,
3156
2365
  cursor: "pointer",
3157
2366
  padding: "6px",
3158
2367
  borderRadius: "4px",
@@ -3164,156 +2373,141 @@ const Oe = ({ size: o = 18 }) => /* @__PURE__ */ b(
3164
2373
  height: "32px",
3165
2374
  ...t
3166
2375
  },
3167
- onMouseEnter: (n) => {
3168
- n.currentTarget.style.backgroundColor = a.colors.backgroundTertiary, n.currentTarget.style.color = a.colors.text;
2376
+ onMouseEnter: (i) => {
2377
+ i.currentTarget.style.backgroundColor = n.colors.backgroundTertiary, i.currentTarget.style.color = n.colors.text;
3169
2378
  },
3170
- onMouseLeave: (n) => {
3171
- n.currentTarget.style.backgroundColor = "transparent", n.currentTarget.style.color = a.colors.textSecondary;
2379
+ onMouseLeave: (i) => {
2380
+ i.currentTarget.style.backgroundColor = "transparent", i.currentTarget.style.color = n.colors.textSecondary;
3172
2381
  },
3173
- children: /* @__PURE__ */ l(Qe, { size: e })
2382
+ children: /* @__PURE__ */ s(qe, { size: e })
3174
2383
  }
3175
2384
  );
3176
- }, St = ({
2385
+ }, at = ({
3177
2386
  leftSidebarCollapsed: o = !1,
3178
2387
  onToggleLeftSidebar: e,
3179
2388
  showLeftSidebarControl: t = !1,
3180
2389
  rightSidebarCollapsed: r = !1,
3181
- onToggleRightSidebar: s,
3182
- showRightSidebarControl: a = !1,
3183
- onSwitchLeftMiddlePanels: n,
3184
- showSwitchLeftMiddle: i = !1,
3185
- onSwitchRightMiddlePanels: p,
3186
- showSwitchRightMiddle: u = !1,
3187
- onConfigurePanels: h,
3188
- showConfigureButton: d = !1,
3189
- gap: f = 4,
3190
- style: g,
3191
- className: m,
3192
- iconSize: c,
3193
- leftCollapseButtonProps: k,
3194
- rightCollapseButtonProps: R,
3195
- leftMiddleSwitchButtonProps: A,
3196
- rightMiddleSwitchButtonProps: I,
3197
- configureButtonProps: $
3198
- }) => t && e || i && n || d && h || u && p || a && s ? /* @__PURE__ */ b(
2390
+ onToggleRightSidebar: a,
2391
+ showRightSidebarControl: n = !1,
2392
+ onSwitchLeftMiddlePanels: i,
2393
+ showSwitchLeftMiddle: d = !1,
2394
+ onSwitchRightMiddlePanels: y,
2395
+ showSwitchRightMiddle: c = !1,
2396
+ onConfigurePanels: T,
2397
+ showConfigureButton: p = !1,
2398
+ gap: u = 4,
2399
+ style: x,
2400
+ className: k,
2401
+ iconSize: l,
2402
+ leftCollapseButtonProps: h,
2403
+ rightCollapseButtonProps: C,
2404
+ leftMiddleSwitchButtonProps: E,
2405
+ rightMiddleSwitchButtonProps: R,
2406
+ configureButtonProps: I
2407
+ }) => t && e || d && i || p && T || c && y || n && a ? /* @__PURE__ */ m(
3199
2408
  "div",
3200
2409
  {
3201
- className: m,
2410
+ className: k,
3202
2411
  style: {
3203
2412
  display: "flex",
3204
2413
  alignItems: "center",
3205
- gap: `${f}px`,
3206
- ...g
2414
+ gap: `${u}px`,
2415
+ ...x
3207
2416
  },
3208
2417
  children: [
3209
- t && e && /* @__PURE__ */ l(
3210
- oe,
2418
+ t && e && /* @__PURE__ */ s(
2419
+ Y,
3211
2420
  {
3212
2421
  isCollapsed: o,
3213
2422
  onToggle: e,
3214
2423
  side: "left",
3215
- iconSize: c ?? 18,
3216
- ...k
2424
+ iconSize: l ?? 18,
2425
+ ...h
3217
2426
  }
3218
2427
  ),
3219
- i && n && /* @__PURE__ */ l(
3220
- re,
2428
+ d && i && /* @__PURE__ */ s(
2429
+ Z,
3221
2430
  {
3222
- onSwitch: n,
2431
+ onSwitch: i,
3223
2432
  variant: "left-middle",
3224
- iconSize: c ?? 14,
3225
- ...A
2433
+ iconSize: l ?? 14,
2434
+ ...E
3226
2435
  }
3227
2436
  ),
3228
- d && h && /* @__PURE__ */ l(
3229
- Ge,
2437
+ p && T && /* @__PURE__ */ s(
2438
+ $e,
3230
2439
  {
3231
- onConfigure: h,
3232
- iconSize: c ?? 14,
3233
- ...$
2440
+ onConfigure: T,
2441
+ iconSize: l ?? 14,
2442
+ ...I
3234
2443
  }
3235
2444
  ),
3236
- u && p && /* @__PURE__ */ l(
3237
- re,
2445
+ c && y && /* @__PURE__ */ s(
2446
+ Z,
3238
2447
  {
3239
- onSwitch: p,
2448
+ onSwitch: y,
3240
2449
  variant: "right-middle",
3241
- iconSize: c ?? 14,
3242
- ...I
2450
+ iconSize: l ?? 14,
2451
+ ...R
3243
2452
  }
3244
2453
  ),
3245
- a && s && /* @__PURE__ */ l(
3246
- oe,
2454
+ n && a && /* @__PURE__ */ s(
2455
+ Y,
3247
2456
  {
3248
2457
  isCollapsed: r,
3249
- onToggle: s,
2458
+ onToggle: a,
3250
2459
  side: "right",
3251
- iconSize: c ?? 18,
3252
- ...R
2460
+ iconSize: l ?? 18,
2461
+ ...C
3253
2462
  }
3254
2463
  )
3255
2464
  ]
3256
2465
  }
3257
2466
  ) : null;
3258
2467
  export {
3259
- ie as AgentCommandInput,
3260
- De as AgentCommandPalette,
3261
- ce as AgentResponseDisplay,
3262
- Pe as CommandInput,
3263
- ae as CommandItem,
3264
- Ie as CommandList,
3265
- it as CommandPalette,
3266
- ne as CommandRegistryService,
3267
- It as EditableConfigurablePanelLayout,
3268
- nt as FocusIndicator,
3269
- Se as LocalStoragePersistenceAdapter,
3270
- Te as LocalStorageWorkspaceAdapter,
3271
- oe as PanelCollapseButton,
3272
- Ge as PanelConfigureButton,
3273
- St as PanelControls,
3274
- re as PanelSwitchButton,
3275
- Rt as ResponsiveConfigurablePanelLayout,
3276
- le as ToolExecutionList,
3277
- _ as WorkspaceLayoutService,
3278
- me as collapseAllPanelsTool,
3279
- ht as createToolCommandsProvider,
3280
- ye as expandAllPanelsTool,
3281
- ge as focusPanelTool,
3282
- vt as generateToolsSystemPrompt,
3283
- lt as getGlobalCommandRegistry,
3284
- pt as getPanelCommands,
3285
- pe as getPanelStateTool,
3286
- xt as getToolParameterInfo,
3287
- de as getVisiblePanelsTool,
3288
- mt as layoutActionTools,
3289
- _e as layoutTools,
3290
- yt as layoutToolsMetadata,
3291
- ue as listPanelsWithStateTool,
3292
- Lt as mapThemeToPanelVars,
3293
- At as mapThemeToTabVars,
3294
- Re as panelCommands,
3295
- ct as resetGlobalCommandRegistry,
3296
- xe as resetLayoutTool,
3297
- ft as stateQueryTools,
3298
- he as switchPanelTool,
3299
- fe as togglePanelTool,
3300
- Fe as toolToAIFunction,
3301
- Ne as toolToAnthropicFormat,
3302
- ze as toolToCommand,
3303
- je as toolToGeminiFunction,
3304
- Me as toolToOpenAIFunction,
3305
- Ct as toolsToAIFunctions,
3306
- kt as toolsToAnthropicFormat,
3307
- be as toolsToCommands,
3308
- bt as toolsToGeminiFormat,
3309
- wt as toolsToOpenAIFormat,
3310
- ut as useAgentCommandPalette,
3311
- dt as useCommandPalette,
3312
- rt as usePanelFocus,
3313
- at as usePanelFocusListener,
3314
- st as usePanelKeyboardShortcuts,
3315
- tt as usePanelPersistence,
3316
- gt as useToolCommands,
3317
- ot as useWorkspace
2468
+ ee as AgentCommandInput,
2469
+ Te as AgentCommandPalette,
2470
+ oe as AgentResponseDisplay,
2471
+ lt as EditableConfigurablePanelLayout,
2472
+ Qe as FocusIndicator,
2473
+ xe as LocalStoragePersistenceAdapter,
2474
+ we as LocalStorageWorkspaceAdapter,
2475
+ Y as PanelCollapseButton,
2476
+ $e as PanelConfigureButton,
2477
+ at as PanelControls,
2478
+ Z as PanelSwitchButton,
2479
+ ct as ResponsiveConfigurablePanelLayout,
2480
+ te as ToolExecutionList,
2481
+ L as WorkspaceLayoutService,
2482
+ ie as collapseAllPanelsTool,
2483
+ le as expandAllPanelsTool,
2484
+ de as focusPanelTool,
2485
+ st as generateToolsSystemPrompt,
2486
+ se as getPanelStateTool,
2487
+ re as getVisiblePanelsTool,
2488
+ Ye as layoutActionTools,
2489
+ Ie as layoutTools,
2490
+ Ze as layoutToolsMetadata,
2491
+ ae as listPanelsWithStateTool,
2492
+ dt as mapThemeToPanelVars,
2493
+ pt as mapThemeToTabVars,
2494
+ pe as resetLayoutTool,
2495
+ Xe as stateQueryTools,
2496
+ ce as switchPanelTool,
2497
+ ne as togglePanelTool,
2498
+ Re as toolToAIFunction,
2499
+ _e as toolToAnthropicFormat,
2500
+ Pe as toolToGeminiFunction,
2501
+ We as toolToOpenAIFunction,
2502
+ rt as toolsToAIFunctions,
2503
+ ot as toolsToAnthropicFormat,
2504
+ et as toolsToGeminiFormat,
2505
+ tt as toolsToOpenAIFormat,
2506
+ Ge as useAgentCommandPalette,
2507
+ Je as usePanelFocus,
2508
+ Ue as usePanelFocusListener,
2509
+ He as usePanelKeyboardShortcuts,
2510
+ Ke as usePanelPersistence,
2511
+ Ve as useWorkspace
3318
2512
  };
3319
2513
  //# sourceMappingURL=index.esm.js.map