nexus-shell 0.2.3 → 0.2.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,251 +1,251 @@
1
- var Ee = Object.defineProperty;
2
- var Ie = (o, e, n) => e in o ? Ee(o, e, { enumerable: !0, configurable: !0, writable: !0, value: n }) : o[e] = n;
3
- var J = (o, e, n) => Ie(o, typeof e != "symbol" ? e + "" : e, n);
4
- import { jsxs as c, jsx as r, Fragment as he } from "react/jsx-runtime";
5
- import se, { useMemo as j, useState as A, useRef as M, useEffect as O } from "react";
6
- import { Model as K, Actions as G, DockLocation as Oe, Layout as Ae } from "flexlayout-react";
1
+ var Ge = Object.defineProperty;
2
+ var Ye = (t, e, n) => e in t ? Ge(t, e, { enumerable: !0, configurable: !0, writable: !0, value: n }) : t[e] = n;
3
+ var X = (t, e, n) => Ye(t, typeof e != "symbol" ? e + "" : e, n);
4
+ import { jsxs as f, jsx as o, Fragment as Le } from "react/jsx-runtime";
5
+ import ge, { useMemo as H, useState as P, useRef as F, useEffect as z, forwardRef as Je, useCallback as oe, useImperativeHandle as Xe } from "react";
6
+ import { Model as B, Actions as Z, DockLocation as Ve, Layout as qe } from "flexlayout-react";
7
7
  import "flexlayout-react/style/light.css";
8
- import { Settings as Le, MessageCircle as be, X as B, User as xe, Terminal as ve, Send as ze, ChevronRight as ye, Sun as Me, Moon as Pe, GraduationCap as Re, ChevronUp as we, Search as X, Info as Ke, HelpCircle as $e, AlertCircle as je, Check as Fe, Camera as Ue, Edit2 as _e, Loader2 as Ne, ChevronsUpDown as Be, ChevronDown as ke, Clock as Je } from "lucide-react";
9
- import { clsx as He } from "clsx";
10
- import { twMerge as We } from "tailwind-merge";
11
- import { create as U } from "zustand";
12
- import { TableVirtuoso as Ge, Virtuoso as Ve } from "react-virtuoso";
13
- function S(...o) {
14
- return We(He(o));
8
+ import { Settings as Qe, MessageCircle as Oe, X as J, User as $e, Terminal as Ae, Send as Ze, ChevronRight as Me, GraduationCap as Ne, Moon as et, Sun as tt, Palette as rt, ChevronUp as Pe, Search as de, Info as nt, HelpCircle as ot, AlertCircle as st, Check as at, Camera as it, Edit2 as lt, Loader2 as ze, ChevronsUpDown as ct, ChevronDown as Re, Clock as dt } from "lucide-react";
9
+ import { clsx as ut } from "clsx";
10
+ import { twMerge as ft } from "tailwind-merge";
11
+ import { create as G } from "zustand";
12
+ import { TableVirtuoso as mt, Virtuoso as pt } from "react-virtuoso";
13
+ function D(...t) {
14
+ return ft(ut(t));
15
15
  }
16
- const Ye = [
17
- { id: "settings", label: "Settings", icon: Le }
18
- ], qe = ({
19
- items: o = [],
20
- bottomItems: e = Ye,
16
+ const gt = [
17
+ { id: "settings", label: "Settings", icon: Qe }
18
+ ], ht = ({
19
+ items: t = [],
20
+ bottomItems: e = gt,
21
21
  activeId: n = null,
22
- onSelect: t,
23
- className: a,
22
+ onSelect: r,
23
+ className: i,
24
24
  "aria-label": s = "Activity Bar"
25
25
  }) => {
26
- const l = ({ id: u, label: i, icon: d }) => /* @__PURE__ */ r(
26
+ const a = ({ id: d, label: l, icon: c }) => /* @__PURE__ */ o(
27
27
  "button",
28
28
  {
29
29
  type: "button",
30
- onClick: () => t == null ? void 0 : t(u),
31
- "aria-label": i,
32
- title: i,
33
- "aria-pressed": n === u,
34
- className: S(
30
+ onClick: () => r == null ? void 0 : r(d),
31
+ "aria-label": l,
32
+ title: l,
33
+ "aria-pressed": n === d,
34
+ className: D(
35
35
  "p-2 cursor-pointer rounded text-muted-foreground hover:text-foreground transition-colors focus:outline-none focus:ring-2 focus:ring-ring",
36
- n === u && "text-foreground border-l-2 border-primary rounded-none"
36
+ n === d && "text-foreground border-l-2 border-primary rounded-none"
37
37
  ),
38
- children: /* @__PURE__ */ r(d, { size: 20 })
38
+ children: /* @__PURE__ */ o(c, { size: 20 })
39
39
  },
40
- u
40
+ d
41
41
  );
42
- return /* @__PURE__ */ c(
42
+ return /* @__PURE__ */ f(
43
43
  "aside",
44
44
  {
45
45
  role: "navigation",
46
46
  "aria-label": s,
47
- className: S(
47
+ className: D(
48
48
  "w-12 h-full bg-muted border-r flex flex-col items-center py-2 select-none",
49
- a
49
+ i
50
50
  ),
51
51
  children: [
52
- /* @__PURE__ */ r("div", { className: "flex-1 flex flex-col space-y-4", children: o.map(l) }),
53
- e.length > 0 && /* @__PURE__ */ r("div", { className: "flex flex-col space-y-4", children: e.map(l) })
52
+ /* @__PURE__ */ o("div", { className: "flex-1 flex flex-col space-y-4", children: t.map(a) }),
53
+ e.length > 0 && /* @__PURE__ */ o("div", { className: "flex flex-col space-y-4", children: e.map(a) })
54
54
  ]
55
55
  }
56
56
  );
57
- }, q = "nexus-shell-sidebar", F = U((o) => {
58
- const e = localStorage.getItem(q);
57
+ }, ne = "nexus-shell-sidebar", W = G((t) => {
58
+ const e = localStorage.getItem(ne);
59
59
  return {
60
60
  activeSidebar: e !== null ? e : null,
61
61
  panels: [],
62
- setActiveSidebar: (t) => {
63
- t === null ? localStorage.removeItem(q) : localStorage.setItem(q, t), o({ activeSidebar: t });
62
+ setActiveSidebar: (r) => {
63
+ r === null ? localStorage.removeItem(ne) : localStorage.setItem(ne, r), t({ activeSidebar: r });
64
64
  },
65
- toggleSidebar: (t) => o((a) => {
66
- const s = a.activeSidebar === t ? null : t;
67
- return s === null ? localStorage.removeItem(q) : localStorage.setItem(q, s), { activeSidebar: s };
65
+ toggleSidebar: (r) => t((i) => {
66
+ const s = i.activeSidebar === r ? null : r;
67
+ return s === null ? localStorage.removeItem(ne) : localStorage.setItem(ne, s), { activeSidebar: s };
68
68
  }),
69
- setPanels: (t) => o({ panels: t })
69
+ setPanels: (r) => t({ panels: r })
70
70
  };
71
- }), Qe = (o) => {
72
- const e = F((s) => s.panels), n = F((s) => s.activeSidebar), t = F((s) => s.toggleSidebar), a = j(
73
- () => e.map(({ id: s, label: l, icon: u }) => ({ id: s, label: l, icon: u })),
71
+ }), bt = (t) => {
72
+ const e = W((s) => s.panels), n = W((s) => s.activeSidebar), r = W((s) => s.toggleSidebar), i = H(
73
+ () => e.map(({ id: s, label: a, icon: d }) => ({ id: s, label: a, icon: d })),
74
74
  [e]
75
75
  );
76
- return /* @__PURE__ */ r(
77
- qe,
76
+ return /* @__PURE__ */ o(
77
+ ht,
78
78
  {
79
- ...o,
80
- items: a,
79
+ ...t,
80
+ items: i,
81
81
  activeId: n,
82
- onSelect: t
82
+ onSelect: r
83
83
  }
84
84
  );
85
- }, Xe = /* @__PURE__ */ c("div", { className: "h-full flex flex-col items-center justify-center text-center px-6 text-muted-foreground", children: [
86
- /* @__PURE__ */ r(be, { size: 28, className: "mb-3 opacity-40" }),
87
- /* @__PURE__ */ r("p", { className: "text-xs", children: "No messages yet." }),
88
- /* @__PURE__ */ c("p", { className: "text-[11px] mt-1 opacity-70", children: [
85
+ }, xt = /* @__PURE__ */ f("div", { className: "h-full flex flex-col items-center justify-center text-center px-6 text-muted-foreground", children: [
86
+ /* @__PURE__ */ o(Oe, { size: 28, className: "mb-3 opacity-40" }),
87
+ /* @__PURE__ */ o("p", { className: "text-xs", children: "No messages yet." }),
88
+ /* @__PURE__ */ f("p", { className: "text-[11px] mt-1 opacity-70", children: [
89
89
  "Type a message, or ",
90
- /* @__PURE__ */ r("span", { className: "font-mono", children: "/" }),
90
+ /* @__PURE__ */ o("span", { className: "font-mono", children: "/" }),
91
91
  " for commands."
92
92
  ] })
93
- ] }), Ze = ({
94
- messages: o = [],
93
+ ] }), yt = ({
94
+ messages: t = [],
95
95
  onSend: e,
96
96
  slashCommands: n = [],
97
- onSlashCommand: t,
98
- onClose: a,
97
+ onSlashCommand: r,
98
+ onClose: i,
99
99
  title: s = "Chat",
100
- placeholder: l = "Send a message…",
101
- emptyState: u = Xe,
102
- className: i
100
+ placeholder: a = "Send a message…",
101
+ emptyState: d = xt,
102
+ className: l
103
103
  }) => {
104
- const [d, m] = A(""), [f, p] = A(0), N = M(null), k = M(null), w = d.startsWith("/") ? n.filter(
105
- (g) => `/${g.command}`.startsWith(d.toLowerCase().split(" ")[0])
106
- ) : [], h = w.length > 0;
107
- O(() => {
108
- k.current && (k.current.scrollTop = k.current.scrollHeight);
109
- }, [o]), O(() => {
110
- p(0);
111
- }, [d]);
112
- const x = () => {
113
- const g = d.trim();
114
- g && (e == null || e(g), m(""));
115
- }, b = (g) => {
116
- var C;
117
- t == null || t(g), m(`/${g.command} `), (C = N.current) == null || C.focus();
118
- }, y = (g) => {
119
- if (h) {
120
- if (g.key === "ArrowDown") {
121
- g.preventDefault(), p((C) => (C + 1) % w.length);
104
+ const [c, h] = P(""), [g, m] = P(0), C = F(null), E = F(null), w = c.startsWith("/") ? n.filter(
105
+ (u) => `/${u.command}`.startsWith(c.toLowerCase().split(" ")[0])
106
+ ) : [], y = w.length > 0;
107
+ z(() => {
108
+ E.current && (E.current.scrollTop = E.current.scrollHeight);
109
+ }, [t]), z(() => {
110
+ m(0);
111
+ }, [c]);
112
+ const b = () => {
113
+ const u = c.trim();
114
+ u && (e == null || e(u), h(""));
115
+ }, x = (u) => {
116
+ var S;
117
+ r == null || r(u), h(`/${u.command} `), (S = C.current) == null || S.focus();
118
+ }, N = (u) => {
119
+ if (y) {
120
+ if (u.key === "ArrowDown") {
121
+ u.preventDefault(), m((S) => (S + 1) % w.length);
122
122
  return;
123
123
  }
124
- if (g.key === "ArrowUp") {
125
- g.preventDefault(), p((C) => (C - 1 + w.length) % w.length);
124
+ if (u.key === "ArrowUp") {
125
+ u.preventDefault(), m((S) => (S - 1 + w.length) % w.length);
126
126
  return;
127
127
  }
128
- if (g.key === "Tab" || g.key === "Enter" && !g.shiftKey) {
129
- g.preventDefault(), b(w[f]);
128
+ if (u.key === "Tab" || u.key === "Enter" && !u.shiftKey) {
129
+ u.preventDefault(), x(w[g]);
130
130
  return;
131
131
  }
132
132
  }
133
- g.key === "Enter" && !g.shiftKey && (g.preventDefault(), x());
133
+ u.key === "Enter" && !u.shiftKey && (u.preventDefault(), b());
134
134
  };
135
- return /* @__PURE__ */ c(
135
+ return /* @__PURE__ */ f(
136
136
  "aside",
137
137
  {
138
138
  role: "complementary",
139
139
  "aria-label": s,
140
- className: S(
140
+ className: D(
141
141
  "w-[320px] h-full bg-muted border-l border-border flex flex-col select-none shrink-0",
142
- i
142
+ l
143
143
  ),
144
144
  children: [
145
- /* @__PURE__ */ c("div", { className: "h-10 flex items-center justify-between px-4 shrink-0", children: [
146
- /* @__PURE__ */ c("div", { className: "flex items-center space-x-2 text-muted-foreground", children: [
147
- /* @__PURE__ */ r(be, { size: 13 }),
148
- /* @__PURE__ */ r("span", { className: "text-[11px] font-bold uppercase tracking-widest", children: s })
145
+ /* @__PURE__ */ f("div", { className: "h-10 flex items-center justify-between px-4 shrink-0", children: [
146
+ /* @__PURE__ */ f("div", { className: "flex items-center space-x-2 text-muted-foreground", children: [
147
+ /* @__PURE__ */ o(Oe, { size: 13 }),
148
+ /* @__PURE__ */ o("span", { className: "text-[11px] font-bold uppercase tracking-widest", children: s })
149
149
  ] }),
150
- a && /* @__PURE__ */ r(
150
+ i && /* @__PURE__ */ o(
151
151
  "button",
152
152
  {
153
153
  type: "button",
154
- onClick: a,
154
+ onClick: i,
155
155
  "aria-label": "Close Chat",
156
156
  className: "p-1 rounded hover:bg-accent hover:text-foreground text-muted-foreground transition-colors focus:outline-none focus:ring-2 focus:ring-ring",
157
- children: /* @__PURE__ */ r(B, { size: 14 })
157
+ children: /* @__PURE__ */ o(J, { size: 14 })
158
158
  }
159
159
  )
160
160
  ] }),
161
- /* @__PURE__ */ r(
161
+ /* @__PURE__ */ o(
162
162
  "div",
163
163
  {
164
- ref: k,
164
+ ref: E,
165
165
  role: "log",
166
166
  "aria-label": `${s} transcript`,
167
167
  className: "flex-1 overflow-y-auto border-t border-border/50 bg-background/50 px-3 py-3 space-y-3",
168
- children: o.length === 0 ? u : o.map((g) => {
169
- const C = g.role === "user";
170
- return /* @__PURE__ */ c(
168
+ children: t.length === 0 ? d : t.map((u) => {
169
+ const S = u.role === "user";
170
+ return /* @__PURE__ */ f(
171
171
  "div",
172
172
  {
173
- className: S("flex flex-col", C ? "items-end" : "items-start"),
173
+ className: D("flex flex-col", S ? "items-end" : "items-start"),
174
174
  children: [
175
- /* @__PURE__ */ c("div", { className: "flex items-center space-x-1 mb-1 text-[10px] uppercase tracking-wider text-muted-foreground font-bold", children: [
176
- C ? /* @__PURE__ */ r(xe, { size: 10 }) : /* @__PURE__ */ r(ve, { size: 10 }),
177
- /* @__PURE__ */ r("span", { children: g.author ?? (C ? "You" : "Assistant") })
175
+ /* @__PURE__ */ f("div", { className: "flex items-center space-x-1 mb-1 text-[10px] uppercase tracking-wider text-muted-foreground font-bold", children: [
176
+ S ? /* @__PURE__ */ o($e, { size: 10 }) : /* @__PURE__ */ o(Ae, { size: 10 }),
177
+ /* @__PURE__ */ o("span", { children: u.author ?? (S ? "You" : "Assistant") })
178
178
  ] }),
179
- /* @__PURE__ */ r(
179
+ /* @__PURE__ */ o(
180
180
  "div",
181
181
  {
182
- className: S(
182
+ className: D(
183
183
  "max-w-[85%] rounded-lg px-3 py-2 text-xs whitespace-pre-wrap break-words",
184
- C ? "bg-primary text-primary-foreground" : "bg-card border border-border text-foreground"
184
+ S ? "bg-primary text-primary-foreground" : "bg-card border border-border text-foreground"
185
185
  ),
186
- children: g.text
186
+ children: u.text
187
187
  }
188
188
  )
189
189
  ]
190
190
  },
191
- g.id
191
+ u.id
192
192
  );
193
193
  })
194
194
  }
195
195
  ),
196
- /* @__PURE__ */ c("div", { className: "relative border-t border-border/50 p-2 shrink-0", children: [
197
- h && /* @__PURE__ */ r(
196
+ /* @__PURE__ */ f("div", { className: "relative border-t border-border/50 p-2 shrink-0", children: [
197
+ y && /* @__PURE__ */ o(
198
198
  "div",
199
199
  {
200
200
  role: "listbox",
201
201
  "aria-label": "Slash commands",
202
202
  className: "absolute bottom-full left-2 right-2 mb-1 bg-popover border border-border rounded-md shadow-lg overflow-hidden z-20",
203
- children: w.map((g, C) => /* @__PURE__ */ c(
203
+ children: w.map((u, S) => /* @__PURE__ */ f(
204
204
  "div",
205
205
  {
206
206
  role: "option",
207
- "aria-selected": C === f,
208
- onMouseEnter: () => p(C),
209
- onClick: () => b(g),
210
- className: S(
207
+ "aria-selected": S === g,
208
+ onMouseEnter: () => m(S),
209
+ onClick: () => x(u),
210
+ className: D(
211
211
  "px-3 py-1.5 text-xs cursor-pointer flex items-baseline justify-between gap-3",
212
- C === f ? "bg-accent text-accent-foreground" : "hover:bg-accent/50"
212
+ S === g ? "bg-accent text-accent-foreground" : "hover:bg-accent/50"
213
213
  ),
214
214
  children: [
215
- /* @__PURE__ */ c("span", { className: "font-mono", children: [
215
+ /* @__PURE__ */ f("span", { className: "font-mono", children: [
216
216
  "/",
217
- g.command
217
+ u.command
218
218
  ] }),
219
- /* @__PURE__ */ r("span", { className: "text-[10px] text-muted-foreground truncate", children: g.description })
219
+ /* @__PURE__ */ o("span", { className: "text-[10px] text-muted-foreground truncate", children: u.description })
220
220
  ]
221
221
  },
222
- g.command
222
+ u.command
223
223
  ))
224
224
  }
225
225
  ),
226
- /* @__PURE__ */ c("div", { className: "flex items-end space-x-2", children: [
227
- /* @__PURE__ */ r(
226
+ /* @__PURE__ */ f("div", { className: "flex items-end space-x-2", children: [
227
+ /* @__PURE__ */ o(
228
228
  "textarea",
229
229
  {
230
- ref: N,
230
+ ref: C,
231
231
  rows: 1,
232
- value: d,
232
+ value: c,
233
233
  "aria-label": `${s} message`,
234
- placeholder: l,
235
- onChange: (g) => m(g.target.value),
236
- onKeyDown: y,
234
+ placeholder: a,
235
+ onChange: (u) => h(u.target.value),
236
+ onKeyDown: N,
237
237
  className: "flex-1 resize-none bg-background border border-border rounded-md px-3 py-2 text-xs text-foreground placeholder:text-muted-foreground focus:outline-none focus:ring-2 focus:ring-primary/50 max-h-32"
238
238
  }
239
239
  ),
240
- /* @__PURE__ */ r(
240
+ /* @__PURE__ */ o(
241
241
  "button",
242
242
  {
243
243
  type: "button",
244
- onClick: x,
245
- disabled: !d.trim(),
244
+ onClick: b,
245
+ disabled: !c.trim(),
246
246
  "aria-label": "Send message",
247
247
  className: "p-2 rounded-md bg-primary text-primary-foreground disabled:opacity-40 disabled:cursor-not-allowed hover:bg-primary/90 transition-colors focus:outline-none focus:ring-2 focus:ring-ring",
248
- children: /* @__PURE__ */ r(ze, { size: 14 })
248
+ children: /* @__PURE__ */ o(Ze, { size: 14 })
249
249
  }
250
250
  )
251
251
  ] })
@@ -254,157 +254,157 @@ const Ye = [
254
254
  }
255
255
  );
256
256
  };
257
- let et = 0;
258
- const tt = () => `msg-${Date.now()}-${et += 1}`, Q = U((o) => ({
257
+ let vt = 0;
258
+ const wt = () => `msg-${Date.now()}-${vt += 1}`, se = G((t) => ({
259
259
  messages: [],
260
260
  slashCommands: [],
261
- setMessages: (e) => o({ messages: e }),
262
- addMessage: (e) => o((n) => ({
263
- messages: [...n.messages, { ...e, id: e.id ?? tt() }]
261
+ setMessages: (e) => t({ messages: e }),
262
+ addMessage: (e) => t((n) => ({
263
+ messages: [...n.messages, { ...e, id: e.id ?? wt() }]
264
264
  })),
265
- clearMessages: () => o({ messages: [] }),
266
- setSlashCommands: (e) => o({ slashCommands: e }),
267
- registerSlashCommand: (e) => o((n) => ({ slashCommands: [...n.slashCommands, e] }))
268
- })), te = "nexus-shell-right-sidebar", ae = U((o) => ({
269
- isChatOpen: localStorage.getItem(te) === "true",
270
- setChatOpen: (t) => {
271
- localStorage.setItem(te, String(t)), o({ isChatOpen: t });
265
+ clearMessages: () => t({ messages: [] }),
266
+ setSlashCommands: (e) => t({ slashCommands: e }),
267
+ registerSlashCommand: (e) => t((n) => ({ slashCommands: [...n.slashCommands, e] }))
268
+ })), ue = "nexus-shell-right-sidebar", he = G((t) => ({
269
+ isChatOpen: localStorage.getItem(ue) === "true",
270
+ setChatOpen: (r) => {
271
+ localStorage.setItem(ue, String(r)), t({ isChatOpen: r });
272
272
  },
273
- toggleChat: () => o((t) => {
274
- const a = !t.isChatOpen;
275
- return localStorage.setItem(te, String(a)), { isChatOpen: a };
273
+ toggleChat: () => t((r) => {
274
+ const i = !r.isChatOpen;
275
+ return localStorage.setItem(ue, String(i)), { isChatOpen: i };
276
276
  })
277
- })), rt = ({ onSend: o, ...e }) => {
278
- const n = ae((i) => i.isChatOpen), t = ae((i) => i.setChatOpen), a = Q((i) => i.messages), s = Q((i) => i.slashCommands), l = Q((i) => i.addMessage);
279
- return n ? /* @__PURE__ */ r(
280
- Ze,
277
+ })), Nt = ({ onSend: t, ...e }) => {
278
+ const n = he((l) => l.isChatOpen), r = he((l) => l.setChatOpen), i = se((l) => l.messages), s = se((l) => l.slashCommands), a = se((l) => l.addMessage);
279
+ return n ? /* @__PURE__ */ o(
280
+ yt,
281
281
  {
282
282
  ...e,
283
- messages: a,
283
+ messages: i,
284
284
  slashCommands: s,
285
- onSend: (i) => {
286
- if (l({ role: "user", text: i }), i.startsWith("/")) {
287
- const [d, ...m] = i.slice(1).split(/\s+/), f = s.find((p) => p.command === d);
288
- if (f) {
289
- f.execute(m);
285
+ onSend: (l) => {
286
+ if (a({ role: "user", text: l }), l.startsWith("/")) {
287
+ const [c, ...h] = l.slice(1).split(/\s+/), g = s.find((m) => m.command === c);
288
+ if (g) {
289
+ g.execute(h);
290
290
  return;
291
291
  }
292
- l({ role: "assistant", text: `Unknown command: /${d}` });
292
+ a({ role: "assistant", text: `Unknown command: /${c}` });
293
293
  return;
294
294
  }
295
- o == null || o(i);
295
+ t == null || t(l);
296
296
  },
297
- onClose: () => t(!1)
297
+ onClose: () => r(!1)
298
298
  }
299
299
  ) : null;
300
- }, nt = ({
301
- menus: o = {},
300
+ }, kt = ({
301
+ menus: t = {},
302
302
  onSelect: e,
303
303
  title: n,
304
- center: t,
305
- right: a,
304
+ center: r,
305
+ right: i,
306
306
  className: s
307
307
  }) => {
308
- const l = (i) => i.keybinding ? /* @__PURE__ */ r("span", { className: "text-[10px] text-muted-foreground opacity-60 ml-4", children: i.keybinding }) : null, u = (i) => /* @__PURE__ */ r(
308
+ const a = (l) => l.keybinding ? /* @__PURE__ */ o("span", { className: "text-[10px] text-muted-foreground opacity-60 ml-4", children: l.keybinding }) : null, d = (l) => /* @__PURE__ */ o(
309
309
  "div",
310
310
  {
311
311
  role: "menu",
312
312
  className: "absolute left-0 top-full hidden group-hover:block z-50 min-w-[180px] bg-popover text-popover-foreground border shadow-md rounded-md py-1",
313
- children: i.map((d) => /* @__PURE__ */ c("div", { className: "relative group/sub", children: [
314
- /* @__PURE__ */ c(
313
+ children: l.map((c) => /* @__PURE__ */ f("div", { className: "relative group/sub", children: [
314
+ /* @__PURE__ */ f(
315
315
  "div",
316
316
  {
317
317
  role: "menuitem",
318
318
  tabIndex: 0,
319
- onClick: () => !d.submenu && (e == null ? void 0 : e(d)),
320
- onKeyDown: (m) => {
321
- !d.submenu && (m.key === "Enter" || m.key === " ") && (m.preventDefault(), e == null || e(d));
319
+ onClick: () => !c.submenu && (e == null ? void 0 : e(c)),
320
+ onKeyDown: (h) => {
321
+ !c.submenu && (h.key === "Enter" || h.key === " ") && (h.preventDefault(), e == null || e(c));
322
322
  },
323
323
  className: "px-3 py-1.5 hover:bg-accent hover:text-accent-foreground cursor-pointer text-xs flex justify-between items-center focus:outline-none focus:bg-accent",
324
324
  children: [
325
- /* @__PURE__ */ r("span", { children: d.label }),
326
- /* @__PURE__ */ c("div", { className: "flex items-center space-x-2", children: [
327
- l(d),
328
- d.submenu && /* @__PURE__ */ r(ye, { size: 10 })
325
+ /* @__PURE__ */ o("span", { children: c.label }),
326
+ /* @__PURE__ */ f("div", { className: "flex items-center space-x-2", children: [
327
+ a(c),
328
+ c.submenu && /* @__PURE__ */ o(Me, { size: 10 })
329
329
  ] })
330
330
  ]
331
331
  }
332
332
  ),
333
- d.submenu && /* @__PURE__ */ r(
333
+ c.submenu && /* @__PURE__ */ o(
334
334
  "div",
335
335
  {
336
336
  role: "menu",
337
337
  className: "absolute left-full top-0 hidden group-hover/sub:block z-[60] min-w-[180px] bg-popover text-popover-foreground border shadow-md rounded-md py-1 ml-[-2px]",
338
- children: d.submenu.map((m) => /* @__PURE__ */ c(
338
+ children: c.submenu.map((h) => /* @__PURE__ */ f(
339
339
  "div",
340
340
  {
341
341
  role: "menuitem",
342
342
  tabIndex: 0,
343
- onClick: () => e == null ? void 0 : e(m),
344
- onKeyDown: (f) => {
345
- (f.key === "Enter" || f.key === " ") && (f.preventDefault(), e == null || e(m));
343
+ onClick: () => e == null ? void 0 : e(h),
344
+ onKeyDown: (g) => {
345
+ (g.key === "Enter" || g.key === " ") && (g.preventDefault(), e == null || e(h));
346
346
  },
347
347
  className: "px-3 py-1.5 hover:bg-accent hover:text-accent-foreground cursor-pointer text-xs flex justify-between items-center focus:outline-none focus:bg-accent",
348
348
  children: [
349
- /* @__PURE__ */ r("span", { children: m.label }),
350
- l(m)
349
+ /* @__PURE__ */ o("span", { children: h.label }),
350
+ a(h)
351
351
  ]
352
352
  },
353
- m.id
353
+ h.id
354
354
  ))
355
355
  }
356
356
  )
357
- ] }, d.id))
357
+ ] }, c.id))
358
358
  }
359
359
  );
360
- return /* @__PURE__ */ c(
360
+ return /* @__PURE__ */ f(
361
361
  "header",
362
362
  {
363
363
  role: "banner",
364
364
  "aria-label": "Application Header",
365
- className: S(
365
+ className: D(
366
366
  "bg-muted border-b flex items-center justify-between px-4 select-none shrink-0 transition-all z-50 relative",
367
367
  n !== void 0 ? "h-12 bg-card/65 backdrop-blur-sm" : "h-8",
368
368
  s
369
369
  ),
370
370
  children: [
371
- /* @__PURE__ */ c("div", { className: "flex items-center flex-1 min-w-0", children: [
372
- n !== void 0 ? /* @__PURE__ */ r("div", { className: "mr-12 flex items-center shrink-0", children: n }) : /* @__PURE__ */ r("div", { className: "font-semibold mr-6 text-sm shrink-0", children: "Nexus Shell" }),
373
- /* @__PURE__ */ r(
371
+ /* @__PURE__ */ f("div", { className: "flex items-center flex-1 min-w-0", children: [
372
+ n !== void 0 ? /* @__PURE__ */ o("div", { className: "mr-12 flex items-center shrink-0", children: n }) : /* @__PURE__ */ o("div", { className: "font-semibold mr-6 text-sm shrink-0", children: "Nexus Shell" }),
373
+ /* @__PURE__ */ o(
374
374
  "nav",
375
375
  {
376
376
  role: "navigation",
377
377
  "aria-label": "Main Menu",
378
378
  className: "flex space-x-1 text-sm shrink-0",
379
- children: Object.entries(o).map(([i, d]) => /* @__PURE__ */ c("div", { className: "relative group", children: [
380
- /* @__PURE__ */ r(
379
+ children: Object.entries(t).map(([l, c]) => /* @__PURE__ */ f("div", { className: "relative group", children: [
380
+ /* @__PURE__ */ o(
381
381
  "div",
382
382
  {
383
383
  role: "button",
384
384
  tabIndex: 0,
385
385
  "aria-haspopup": "menu",
386
386
  className: "cursor-pointer hover:bg-accent hover:text-accent-foreground px-3 py-1 rounded text-xs focus:outline-none focus:ring-2 focus:ring-ring",
387
- children: i
387
+ children: l
388
388
  }
389
389
  ),
390
- d.length > 0 && u(d)
391
- ] }, i))
390
+ c.length > 0 && d(c)
391
+ ] }, l))
392
392
  }
393
393
  ),
394
- t && /* @__PURE__ */ r("div", { className: "ml-8 w-60 md:w-72 relative hidden sm:block", children: t })
394
+ r && /* @__PURE__ */ o("div", { className: "ml-8 w-60 md:w-72 relative hidden sm:block", children: r })
395
395
  ] }),
396
- a && /* @__PURE__ */ r("div", { className: "flex items-center ml-4 shrink-0", children: a })
396
+ i && /* @__PURE__ */ o("div", { className: "flex items-center ml-4 shrink-0", children: i })
397
397
  ]
398
398
  }
399
399
  );
400
400
  };
401
- class ot {
401
+ class Ct {
402
402
  constructor() {
403
- J(this, "menus", /* @__PURE__ */ new Map());
403
+ X(this, "menus", /* @__PURE__ */ new Map());
404
404
  }
405
405
  registerMenu(e, n) {
406
- var t;
407
- this.menus.has(e) || this.menus.set(e, []), (t = this.menus.get(e)) == null || t.push(n);
406
+ var r;
407
+ this.menus.has(e) || this.menus.set(e, []), (r = this.menus.get(e)) == null || r.push(n);
408
408
  }
409
409
  setMenus(e) {
410
410
  this.menus = new Map(Object.entries(e));
@@ -414,15 +414,15 @@ class ot {
414
414
  }
415
415
  getAllMenus() {
416
416
  const e = {};
417
- return this.menus.forEach((n, t) => {
418
- e[t] = n;
417
+ return this.menus.forEach((n, r) => {
418
+ e[r] = n;
419
419
  }), e;
420
420
  }
421
421
  }
422
- const le = new ot();
423
- class st {
422
+ const ye = new Ct();
423
+ class Tt {
424
424
  constructor() {
425
- J(this, "commands", /* @__PURE__ */ new Map());
425
+ X(this, "commands", /* @__PURE__ */ new Map());
426
426
  }
427
427
  registerCommand(e) {
428
428
  if (this.commands.has(e.id)) {
@@ -432,8 +432,8 @@ class st {
432
432
  this.commands.set(e.id, e);
433
433
  }
434
434
  executeCommand(e, ...n) {
435
- const t = this.commands.get(e);
436
- t ? t.execute(...n) : console.warn(`Command ${e} not found.`);
435
+ const r = this.commands.get(e);
436
+ r ? r.execute(...n) : console.warn(`Command ${e} not found.`);
437
437
  }
438
438
  getCommand(e) {
439
439
  return this.commands.get(e);
@@ -442,283 +442,316 @@ class st {
442
442
  return Array.from(this.commands.values());
443
443
  }
444
444
  }
445
- const W = new st(), Ce = (o) => o.map((e) => {
445
+ const q = new Tt(), Ke = (t) => t.map((e) => {
446
446
  var n;
447
447
  return {
448
448
  ...e,
449
- keybinding: e.keybinding ?? (e.commandId ? (n = W.getCommand(e.commandId)) == null ? void 0 : n.keybinding : void 0),
450
- submenu: e.submenu ? Ce(e.submenu) : void 0
449
+ keybinding: e.keybinding ?? (e.commandId ? (n = q.getCommand(e.commandId)) == null ? void 0 : n.keybinding : void 0),
450
+ submenu: e.submenu ? Ke(e.submenu) : void 0
451
451
  };
452
- }), Se = (o, e) => {
453
- for (const n of o) {
452
+ }), _e = (t, e) => {
453
+ for (const n of t) {
454
454
  if (n.id === e) return n;
455
- const t = n.submenu && Se(n.submenu, e);
456
- if (t) return t;
455
+ const r = n.submenu && _e(n.submenu, e);
456
+ if (r) return r;
457
457
  }
458
- }, at = (o) => {
459
- const e = le.getAllMenus(), n = Object.fromEntries(
460
- Object.entries(e).map(([a, s]) => [a, Ce(s)])
458
+ }, Et = (t) => {
459
+ const e = ye.getAllMenus(), n = Object.fromEntries(
460
+ Object.entries(e).map(([i, s]) => [i, Ke(s)])
461
461
  );
462
- return /* @__PURE__ */ r(nt, { ...o, menus: n, onSelect: (a) => {
462
+ return /* @__PURE__ */ o(kt, { ...t, menus: n, onSelect: (i) => {
463
463
  for (const s of Object.values(e)) {
464
- const l = Se(s, a.id);
465
- if (l != null && l.commandId) {
466
- W.executeCommand(l.commandId);
464
+ const a = _e(s, i.id);
465
+ if (a != null && a.commandId) {
466
+ q.executeCommand(a.commandId);
467
467
  return;
468
468
  }
469
469
  }
470
470
  } });
471
- }, re = ({
472
- title: o,
471
+ }, fe = ({
472
+ title: t,
473
473
  children: e,
474
474
  onClose: n,
475
- width: t = "300px",
476
- className: a
477
- }) => /* @__PURE__ */ c(
475
+ width: r = "300px",
476
+ className: i
477
+ }) => /* @__PURE__ */ f(
478
478
  "aside",
479
479
  {
480
480
  role: "tabpanel",
481
- "aria-label": `${o} Panel`,
482
- style: { width: t },
483
- className: S(
481
+ "aria-label": `${t} Panel`,
482
+ style: { width: r },
483
+ className: D(
484
484
  "h-full bg-muted border-r flex flex-col select-none shrink-0",
485
- a
485
+ i
486
486
  ),
487
487
  children: [
488
- /* @__PURE__ */ c("div", { className: "h-10 flex items-center justify-between px-4 text-[11px] font-bold text-muted-foreground uppercase tracking-widest", children: [
489
- /* @__PURE__ */ r("span", { className: "truncate", children: o }),
490
- n && /* @__PURE__ */ r(
488
+ /* @__PURE__ */ f("div", { className: "h-10 flex items-center justify-between px-4 text-[11px] font-bold text-muted-foreground uppercase tracking-widest", children: [
489
+ /* @__PURE__ */ o("span", { className: "truncate", children: t }),
490
+ n && /* @__PURE__ */ o(
491
491
  "button",
492
492
  {
493
493
  type: "button",
494
494
  onClick: n,
495
495
  "aria-label": "Close Panel",
496
496
  className: "p-1 hover:bg-accent hover:text-foreground rounded transition-colors focus:outline-none focus:ring-2 focus:ring-ring shrink-0",
497
- children: /* @__PURE__ */ r(B, { size: 14 })
497
+ children: /* @__PURE__ */ o(J, { size: 14 })
498
498
  }
499
499
  )
500
500
  ] }),
501
- /* @__PURE__ */ r("div", { className: "flex-1 overflow-auto border-t border-border/50 bg-background/50", children: e })
501
+ /* @__PURE__ */ o("div", { className: "flex-1 overflow-auto border-t border-border/50 bg-background/50", children: e })
502
502
  ]
503
503
  }
504
- ), lt = [
505
- { id: "light", label: "Light", icon: Me },
506
- { id: "dark", label: "Dark", icon: Pe },
507
- { id: "gt", label: "Georgia Tech", icon: Re }
508
- ], it = ({
509
- theme: o,
504
+ ), ae = [
505
+ {
506
+ id: "light",
507
+ label: "Light",
508
+ shortLabel: "Light",
509
+ description: "Neutral light theme. The default."
510
+ },
511
+ {
512
+ id: "dark",
513
+ label: "Dark",
514
+ shortLabel: "Dark",
515
+ description: "Low-glare dark theme on a soft grey base."
516
+ },
517
+ {
518
+ id: "gt",
519
+ label: "Georgia Tech",
520
+ shortLabel: "GT",
521
+ description: "Buzz Gold (#EAAA00) on Tech Tower White."
522
+ },
523
+ {
524
+ id: "tamu",
525
+ label: "Texas A&M",
526
+ shortLabel: "TAMU",
527
+ description: "Aggie Maroon (#500000) on white."
528
+ }
529
+ ], St = ae.map((t) => `theme-${t.id}`), Dt = (t) => `theme-${t}`, It = {
530
+ light: tt,
531
+ dark: et,
532
+ gt: Ne,
533
+ tamu: Ne
534
+ }, Lt = ae.map((t) => ({
535
+ id: t.id,
536
+ label: t.label,
537
+ icon: It[t.id] ?? rt
538
+ })), Ot = ({
539
+ theme: t,
510
540
  onThemeChange: e,
511
- themes: n = lt,
512
- className: t
513
- }) => /* @__PURE__ */ r("div", { className: S("p-4 space-y-6", t), children: /* @__PURE__ */ c("section", { children: [
514
- /* @__PURE__ */ r("h3", { className: "text-[11px] font-bold text-muted-foreground uppercase mb-3", children: "Theme" }),
515
- /* @__PURE__ */ r(
541
+ themes: n = Lt,
542
+ className: r
543
+ }) => /* @__PURE__ */ o("div", { className: D("p-4 space-y-6", r), children: /* @__PURE__ */ f("section", { children: [
544
+ /* @__PURE__ */ o("h3", { className: "text-[11px] font-bold text-muted-foreground uppercase mb-3", children: "Theme" }),
545
+ /* @__PURE__ */ o(
516
546
  "div",
517
547
  {
518
548
  role: "radiogroup",
519
549
  "aria-label": "Theme",
520
550
  className: "grid grid-cols-1 gap-2",
521
- children: n.map(({ id: a, label: s, icon: l }) => /* @__PURE__ */ c(
551
+ children: n.map(({ id: i, label: s, icon: a }) => /* @__PURE__ */ f(
522
552
  "button",
523
553
  {
524
554
  type: "button",
525
555
  role: "radio",
526
- "aria-checked": o === a,
527
- onClick: () => e(a),
528
- className: S(
556
+ "aria-checked": t === i,
557
+ onClick: () => e(i),
558
+ className: D(
529
559
  "flex items-center space-x-3 px-3 py-2 rounded-md border text-sm transition-all focus:outline-none focus:ring-2 focus:ring-ring",
530
- o === a ? "bg-primary text-primary-foreground border-primary" : "bg-background hover:bg-accent border-border"
560
+ t === i ? "bg-primary text-primary-foreground border-primary" : "bg-background hover:bg-accent border-border"
531
561
  ),
532
562
  children: [
533
- /* @__PURE__ */ r(l, { size: 16 }),
534
- /* @__PURE__ */ r("span", { children: s })
563
+ /* @__PURE__ */ o(a, { size: 16 }),
564
+ /* @__PURE__ */ o("span", { children: s })
535
565
  ]
536
566
  },
537
- a
567
+ i
538
568
  ))
539
569
  }
540
570
  )
541
- ] }) }), ue = "nexus-shell-theme", me = (o) => {
542
- const e = window.document.documentElement;
543
- e.classList.remove("theme-light", "theme-dark", "theme-gt"), e.classList.add(`theme-${o}`);
544
- }, Y = U((o) => {
545
- const n = localStorage.getItem(ue) || "light";
546
- return me(n), {
571
+ ] }) }), ke = "nexus-shell-theme", Ce = (t) => {
572
+ const e = window.document.documentElement, n = [
573
+ ...St,
574
+ ...Array.from(e.classList).filter((r) => r.startsWith("theme-"))
575
+ ];
576
+ e.classList.remove(...n), e.classList.add(Dt(t));
577
+ }, te = G((t) => {
578
+ const n = localStorage.getItem(ke) || "light";
579
+ return Ce(n), {
547
580
  theme: n,
548
- setTheme: (t) => {
549
- localStorage.setItem(ue, t), me(t), o({ theme: t });
581
+ setTheme: (r) => {
582
+ localStorage.setItem(ke, r), Ce(r), t({ theme: r });
550
583
  }
551
584
  };
552
- }), dt = (o) => {
553
- const e = F((d) => d.activeSidebar), n = F((d) => d.panels), t = F((d) => d.setActiveSidebar), a = Y((d) => d.theme), s = Y((d) => d.setTheme);
585
+ }), $t = (t) => {
586
+ const e = W((c) => c.activeSidebar), n = W((c) => c.panels), r = W((c) => c.setActiveSidebar), i = te((c) => c.theme), s = te((c) => c.setTheme);
554
587
  if (!e) return null;
555
- const l = () => t(null);
588
+ const a = () => r(null);
556
589
  if (e === "settings")
557
- return /* @__PURE__ */ r(re, { ...o, title: "Settings", onClose: l, children: /* @__PURE__ */ r(
558
- it,
590
+ return /* @__PURE__ */ o(fe, { ...t, title: "Settings", onClose: a, children: /* @__PURE__ */ o(
591
+ Ot,
559
592
  {
560
- theme: a,
561
- onThemeChange: (d) => s(d)
593
+ theme: i,
594
+ onThemeChange: (c) => s(c)
562
595
  }
563
596
  ) });
564
- const u = n.find((d) => d.id === e);
565
- if (!u)
566
- return /* @__PURE__ */ r(re, { ...o, title: e, onClose: l, children: /* @__PURE__ */ r("div", { className: "p-4 text-sm italic text-muted-foreground", children: "Panel content not found." }) });
567
- const i = typeof u.component == "function" ? u.component : null;
568
- return /* @__PURE__ */ r(re, { ...o, title: u.label, onClose: l, children: i ? /* @__PURE__ */ r(i, {}) : u.component });
569
- }, ne = (o, e) => (e.priority ?? 0) - (o.priority ?? 0), ct = ({
570
- widgets: o = [],
597
+ const d = n.find((c) => c.id === e);
598
+ if (!d)
599
+ return /* @__PURE__ */ o(fe, { ...t, title: e, onClose: a, children: /* @__PURE__ */ o("div", { className: "p-4 text-sm italic text-muted-foreground", children: "Panel content not found." }) });
600
+ const l = typeof d.component == "function" ? d.component : null;
601
+ return /* @__PURE__ */ o(fe, { ...t, title: d.label, onClose: a, children: l ? /* @__PURE__ */ o(l, {}) : d.component });
602
+ }, me = (t, e) => (e.priority ?? 0) - (t.priority ?? 0), At = ({
603
+ widgets: t = [],
571
604
  className: e,
572
605
  "aria-label": n = "Status Bar"
573
606
  }) => {
574
- const t = {
575
- left: o.filter((s) => s.alignment === "left").sort(ne),
576
- center: o.filter((s) => s.alignment === "center").sort(ne),
577
- right: o.filter((s) => s.alignment === "right").sort(ne)
578
- }, a = (s) => {
579
- const l = s.icon, u = !!s.onClick;
580
- return /* @__PURE__ */ c(
607
+ const r = {
608
+ left: t.filter((s) => s.alignment === "left").sort(me),
609
+ center: t.filter((s) => s.alignment === "center").sort(me),
610
+ right: t.filter((s) => s.alignment === "right").sort(me)
611
+ }, i = (s) => {
612
+ const a = s.icon, d = !!s.onClick;
613
+ return /* @__PURE__ */ f(
581
614
  "div",
582
615
  {
583
616
  onClick: s.onClick,
584
- onKeyDown: u ? (i) => {
585
- var d;
586
- (i.key === "Enter" || i.key === " ") && (i.preventDefault(), (d = s.onClick) == null || d.call(s));
617
+ onKeyDown: d ? (l) => {
618
+ var c;
619
+ (l.key === "Enter" || l.key === " ") && (l.preventDefault(), (c = s.onClick) == null || c.call(s));
587
620
  } : void 0,
588
- role: u ? "button" : void 0,
589
- tabIndex: u ? 0 : void 0,
590
- className: S(
621
+ role: d ? "button" : void 0,
622
+ tabIndex: d ? 0 : void 0,
623
+ className: D(
591
624
  "flex items-center space-x-1.5 px-2 py-0.5 rounded transition-colors h-full focus:outline-none",
592
- u ? "cursor-pointer hover:bg-white/10 focus:ring-1 focus:ring-white" : "cursor-default",
625
+ d ? "cursor-pointer hover:bg-white/10 focus:ring-1 focus:ring-white" : "cursor-default",
593
626
  s.className
594
627
  ),
595
628
  children: [
596
- l && /* @__PURE__ */ r(l, { size: 12 }),
597
- s.label && /* @__PURE__ */ r("span", { children: s.label })
629
+ a && /* @__PURE__ */ o(a, { size: 12 }),
630
+ s.label && /* @__PURE__ */ o("span", { children: s.label })
598
631
  ]
599
632
  },
600
633
  s.id
601
634
  );
602
635
  };
603
- return /* @__PURE__ */ c(
636
+ return /* @__PURE__ */ f(
604
637
  "footer",
605
638
  {
606
639
  role: "status",
607
640
  "aria-label": n,
608
- className: S(
641
+ className: D(
609
642
  "h-6 bg-primary text-primary-foreground text-[11px] flex items-center justify-between px-1 select-none shrink-0 border-t border-white/5",
610
643
  e
611
644
  ),
612
645
  children: [
613
- /* @__PURE__ */ r("div", { className: "flex items-center space-x-1 h-full", children: t.left.map(a) }),
614
- /* @__PURE__ */ r("div", { className: "flex items-center space-x-1 h-full", children: t.center.map(a) }),
615
- /* @__PURE__ */ r("div", { className: "flex items-center space-x-1 h-full", children: t.right.map(a) })
646
+ /* @__PURE__ */ o("div", { className: "flex items-center space-x-1 h-full", children: r.left.map(i) }),
647
+ /* @__PURE__ */ o("div", { className: "flex items-center space-x-1 h-full", children: r.center.map(i) }),
648
+ /* @__PURE__ */ o("div", { className: "flex items-center space-x-1 h-full", children: r.right.map(i) })
616
649
  ]
617
650
  }
618
651
  );
619
- }, ie = U((o) => ({
652
+ }, ve = G((t) => ({
620
653
  widgets: [],
621
- setWidgets: (e) => o({ widgets: e }),
622
- addWidget: (e) => o((n) => ({
654
+ setWidgets: (e) => t({ widgets: e }),
655
+ addWidget: (e) => t((n) => ({
623
656
  widgets: [...n.widgets, e].sort(
624
- (t, a) => (a.priority || 0) - (t.priority || 0)
657
+ (r, i) => (i.priority || 0) - (r.priority || 0)
625
658
  )
626
659
  })),
627
- removeWidget: (e) => o((n) => ({
628
- widgets: n.widgets.filter((t) => t.id !== e)
660
+ removeWidget: (e) => t((n) => ({
661
+ widgets: n.widgets.filter((r) => r.id !== e)
629
662
  })),
630
- updateWidget: (e, n) => o((t) => ({
631
- widgets: t.widgets.map((a) => a.id === e ? { ...a, ...n } : a)
663
+ updateWidget: (e, n) => t((r) => ({
664
+ widgets: r.widgets.map((i) => i.id === e ? { ...i, ...n } : i)
632
665
  }))
633
- })), ut = (o) => {
634
- const e = ie((t) => t.widgets), n = j(
635
- () => e.map(({ commandId: t, ...a }) => ({
636
- ...a,
637
- onClick: a.onClick ?? (t ? () => W.executeCommand(t) : void 0)
666
+ })), Mt = (t) => {
667
+ const e = ve((r) => r.widgets), n = H(
668
+ () => e.map(({ commandId: r, ...i }) => ({
669
+ ...i,
670
+ onClick: i.onClick ?? (r ? () => q.executeCommand(r) : void 0)
638
671
  })),
639
672
  [e]
640
673
  );
641
- return /* @__PURE__ */ r(ct, { ...o, widgets: n });
642
- }, mt = ({
643
- history: o = [],
674
+ return /* @__PURE__ */ o(At, { ...t, widgets: n });
675
+ }, Pt = ({
676
+ history: t = [],
644
677
  onCommand: e,
645
678
  onClose: n,
646
- height: t = "250px",
647
- prompt: a = "$",
679
+ height: r = "250px",
680
+ prompt: i = "$",
648
681
  title: s = "Terminal",
649
- className: l
682
+ className: a
650
683
  }) => {
651
- const [u, i] = A(""), d = M(null), m = M(null);
652
- O(() => {
653
- d.current && (d.current.scrollTop = d.current.scrollHeight);
654
- }, [o]);
655
- const f = (p) => {
656
- if (p.key !== "Enter") return;
657
- const N = u.trim();
658
- N && (e == null || e(N), i(""));
684
+ const [d, l] = P(""), c = F(null), h = F(null);
685
+ z(() => {
686
+ c.current && (c.current.scrollTop = c.current.scrollHeight);
687
+ }, [t]);
688
+ const g = (m) => {
689
+ if (m.key !== "Enter") return;
690
+ const C = d.trim();
691
+ C && (e == null || e(C), l(""));
659
692
  };
660
- return /* @__PURE__ */ c(
693
+ return /* @__PURE__ */ f(
661
694
  "div",
662
695
  {
663
- style: { height: t },
664
- className: S(
696
+ style: { height: r },
697
+ className: D(
665
698
  "bg-card border-t border-border flex flex-col shrink-0 font-mono text-xs",
666
- l
699
+ a
667
700
  ),
668
701
  children: [
669
- /* @__PURE__ */ c("div", { className: "h-8 flex items-center justify-between px-3 border-b border-border/50 shrink-0", children: [
670
- /* @__PURE__ */ c("div", { className: "flex items-center space-x-2 text-muted-foreground", children: [
671
- /* @__PURE__ */ r(ve, { size: 13 }),
672
- /* @__PURE__ */ r("span", { className: "text-[11px] font-bold uppercase tracking-widest", children: s })
702
+ /* @__PURE__ */ f("div", { className: "h-8 flex items-center justify-between px-3 border-b border-border/50 shrink-0", children: [
703
+ /* @__PURE__ */ f("div", { className: "flex items-center space-x-2 text-muted-foreground", children: [
704
+ /* @__PURE__ */ o(Ae, { size: 13 }),
705
+ /* @__PURE__ */ o("span", { className: "text-[11px] font-bold uppercase tracking-widest", children: s })
673
706
  ] }),
674
- n && /* @__PURE__ */ c("div", { className: "flex items-center space-x-1", children: [
675
- /* @__PURE__ */ r(
707
+ n && /* @__PURE__ */ f("div", { className: "flex items-center space-x-1", children: [
708
+ /* @__PURE__ */ o(
676
709
  "button",
677
710
  {
678
711
  type: "button",
679
712
  onClick: n,
680
713
  "aria-label": "Collapse Terminal",
681
714
  className: "p-1 rounded hover:bg-accent hover:text-foreground text-muted-foreground transition-colors focus:outline-none focus:ring-2 focus:ring-ring",
682
- children: /* @__PURE__ */ r(we, { size: 14 })
715
+ children: /* @__PURE__ */ o(Pe, { size: 14 })
683
716
  }
684
717
  ),
685
- /* @__PURE__ */ r(
718
+ /* @__PURE__ */ o(
686
719
  "button",
687
720
  {
688
721
  type: "button",
689
722
  onClick: n,
690
723
  "aria-label": "Close Terminal",
691
724
  className: "p-1 rounded hover:bg-accent hover:text-foreground text-muted-foreground transition-colors focus:outline-none focus:ring-2 focus:ring-ring",
692
- children: /* @__PURE__ */ r(B, { size: 14 })
725
+ children: /* @__PURE__ */ o(J, { size: 14 })
693
726
  }
694
727
  )
695
728
  ] })
696
729
  ] }),
697
- /* @__PURE__ */ r(
730
+ /* @__PURE__ */ o(
698
731
  "div",
699
732
  {
700
- ref: d,
733
+ ref: c,
701
734
  role: "log",
702
735
  "aria-label": `${s} output`,
703
736
  className: "flex-1 overflow-y-auto px-3 py-2 space-y-0.5",
704
737
  onClick: () => {
705
- var p;
706
- return (p = m.current) == null ? void 0 : p.focus();
738
+ var m;
739
+ return (m = h.current) == null ? void 0 : m.focus();
707
740
  },
708
- children: o.map((p, N) => /* @__PURE__ */ r("div", { className: "whitespace-pre-wrap break-all text-foreground/90", children: p }, N))
741
+ children: t.map((m, C) => /* @__PURE__ */ o("div", { className: "whitespace-pre-wrap break-all text-foreground/90", children: m }, C))
709
742
  }
710
743
  ),
711
- /* @__PURE__ */ c("div", { className: "flex items-center px-3 py-2 border-t border-border/50 shrink-0", children: [
712
- /* @__PURE__ */ r("span", { className: "text-primary mr-2 select-none", children: a }),
713
- /* @__PURE__ */ r(
744
+ /* @__PURE__ */ f("div", { className: "flex items-center px-3 py-2 border-t border-border/50 shrink-0", children: [
745
+ /* @__PURE__ */ o("span", { className: "text-primary mr-2 select-none", children: i }),
746
+ /* @__PURE__ */ o(
714
747
  "input",
715
748
  {
716
- ref: m,
749
+ ref: h,
717
750
  type: "text",
718
751
  "aria-label": `${s} input`,
719
- value: u,
720
- onChange: (p) => i(p.target.value),
721
- onKeyDown: f,
752
+ value: d,
753
+ onChange: (m) => l(m.target.value),
754
+ onKeyDown: g,
722
755
  spellCheck: !1,
723
756
  autoComplete: "off",
724
757
  className: "flex-1 bg-transparent outline-none text-foreground placeholder:text-muted-foreground"
@@ -728,47 +761,47 @@ const W = new st(), Ce = (o) => o.map((e) => {
728
761
  ]
729
762
  }
730
763
  );
731
- }, V = U((o) => ({
764
+ }, ee = G((t) => ({
732
765
  isOpen: !1,
733
766
  history: ["Welcome to Nexus Shell Terminal v0.1.0", 'Type "help" for a list of commands.'],
734
- setOpen: (e) => o({ isOpen: e }),
735
- toggle: () => o((e) => ({ isOpen: !e.isOpen })),
736
- addHistory: (e) => o((n) => ({ history: [...n.history, e] })),
737
- clearHistory: () => o({ history: [] })
738
- })), ft = [
767
+ setOpen: (e) => t({ isOpen: e }),
768
+ toggle: () => t((e) => ({ isOpen: !e.isOpen })),
769
+ addHistory: (e) => t((n) => ({ history: [...n.history, e] })),
770
+ clearHistory: () => t({ history: [] })
771
+ })), zt = [
739
772
  "Available commands:",
740
773
  " help — show this message",
741
774
  " clear — clear the terminal"
742
- ], pt = ({
743
- onCommand: o,
775
+ ], Rt = ({
776
+ onCommand: t,
744
777
  ...e
745
778
  }) => {
746
- const n = V((i) => i.isOpen), t = V((i) => i.history), a = V((i) => i.setOpen), s = V((i) => i.addHistory), l = V((i) => i.clearHistory);
747
- return n ? /* @__PURE__ */ r(
748
- mt,
779
+ const n = ee((l) => l.isOpen), r = ee((l) => l.history), i = ee((l) => l.setOpen), s = ee((l) => l.addHistory), a = ee((l) => l.clearHistory);
780
+ return n ? /* @__PURE__ */ o(
781
+ Pt,
749
782
  {
750
783
  ...e,
751
- history: t,
752
- onCommand: (i) => {
753
- s(`$ ${i}`);
754
- const d = i.toLowerCase();
755
- if (d === "clear") {
756
- l();
784
+ history: r,
785
+ onCommand: (l) => {
786
+ s(`$ ${l}`);
787
+ const c = l.toLowerCase();
788
+ if (c === "clear") {
789
+ a();
757
790
  return;
758
791
  }
759
- if (d === "help") {
760
- ft.forEach(s);
792
+ if (c === "help") {
793
+ zt.forEach(s);
761
794
  return;
762
795
  }
763
- (o == null ? void 0 : o(i)) !== !0 && s(`command not found: ${i.split(" ")[0]}`);
796
+ (t == null ? void 0 : t(l)) !== !0 && s(`command not found: ${l.split(" ")[0]}`);
764
797
  },
765
- onClose: () => a(!1)
798
+ onClose: () => i(!1)
766
799
  }
767
800
  ) : null;
768
801
  };
769
- class gt {
802
+ class Kt {
770
803
  constructor() {
771
- J(this, "components", /* @__PURE__ */ new Map());
804
+ X(this, "components", /* @__PURE__ */ new Map());
772
805
  }
773
806
  /**
774
807
  * Register a component with a unique ID.
@@ -790,7 +823,7 @@ class gt {
790
823
  return Array.from(this.components.keys());
791
824
  }
792
825
  }
793
- const ht = new gt(), _ = {
826
+ const _t = new Kt(), Y = {
794
827
  global: { tabEnableClose: !0, tabSetEnableMaximize: !1, tabSetEnableDivide: !0 },
795
828
  borders: [
796
829
  {
@@ -816,273 +849,273 @@ const ht = new gt(), _ = {
816
849
  }
817
850
  ]
818
851
  }
819
- }, fe = "nexus-shell-layout", bt = U((o, e) => {
852
+ }, Te = "nexus-shell-layout", Ut = G((t, e) => {
820
853
  let n;
821
854
  if (typeof window < "u")
822
855
  try {
823
- const t = localStorage.getItem(fe);
824
- if (t) {
825
- const a = JSON.parse(t);
826
- n = K.fromJson(a);
827
- const s = /* @__PURE__ */ new Set(["dialogue-library", "argument-inspector"]), l = [];
828
- n.visitNodes((u) => {
829
- if (u.getType() === "tab") {
830
- const i = u;
831
- s.has(i.getComponent()) && l.push(i.getId());
856
+ const r = localStorage.getItem(Te);
857
+ if (r) {
858
+ const i = JSON.parse(r);
859
+ n = B.fromJson(i);
860
+ const s = /* @__PURE__ */ new Set(["dialogue-library", "argument-inspector"]), a = [];
861
+ n.visitNodes((d) => {
862
+ if (d.getType() === "tab") {
863
+ const l = d;
864
+ s.has(l.getComponent()) && a.push(l.getId());
832
865
  }
833
- }), l.forEach((u) => {
834
- n.doAction(G.deleteTab(u));
866
+ }), a.forEach((d) => {
867
+ n.doAction(Z.deleteTab(d));
835
868
  });
836
869
  } else
837
- n = K.fromJson(_);
838
- } catch (t) {
839
- console.warn("Failed to load layout from storage, using default", t), n = K.fromJson(_);
870
+ n = B.fromJson(Y);
871
+ } catch (r) {
872
+ console.warn("Failed to load layout from storage, using default", r), n = B.fromJson(Y);
840
873
  }
841
874
  else
842
- n = K.fromJson(_);
875
+ n = B.fromJson(Y);
843
876
  return {
844
877
  model: n,
845
878
  dirtyTabs: /* @__PURE__ */ new Set(),
846
- storageKey: fe,
879
+ storageKey: Te,
847
880
  disableLocalStorage: !1,
848
- initLayout: (t, a) => {
881
+ initLayout: (r, i) => {
849
882
  let s;
850
- if (t && Object.keys(t).length > 0)
883
+ if (r && Object.keys(r).length > 0)
851
884
  try {
852
- s = K.fromJson(t);
853
- } catch (l) {
854
- console.warn("Failed to parse init layout json, using default", l), s = K.fromJson(_);
885
+ s = B.fromJson(r);
886
+ } catch (a) {
887
+ console.warn("Failed to parse init layout json, using default", a), s = B.fromJson(Y);
855
888
  }
856
889
  else
857
- s = K.fromJson(_);
858
- o({ model: s, disableLocalStorage: a || !1 });
890
+ s = B.fromJson(Y);
891
+ t({ model: s, disableLocalStorage: i || !1 });
859
892
  },
860
- setModel: (t) => {
861
- o({ model: t });
862
- const a = e().storageKey;
893
+ setModel: (r) => {
894
+ t({ model: r });
895
+ const i = e().storageKey;
863
896
  if (typeof window < "u" && !e().disableLocalStorage)
864
897
  try {
865
- localStorage.setItem(a, JSON.stringify(t.toJson()));
898
+ localStorage.setItem(i, JSON.stringify(r.toJson()));
866
899
  } catch (s) {
867
900
  console.error("Failed to save layout to storage", s);
868
901
  }
869
902
  },
870
- setStorageKey: (t, a) => {
903
+ setStorageKey: (r, i) => {
871
904
  let s;
872
905
  if (typeof window < "u")
873
906
  try {
874
- const l = localStorage.getItem(t);
875
- l ? s = K.fromJson(JSON.parse(l)) : s = K.fromJson(a || _);
876
- } catch (l) {
877
- console.warn("Failed to load layout from storage for key", t, l), s = K.fromJson(a || _);
907
+ const a = localStorage.getItem(r);
908
+ a ? s = B.fromJson(JSON.parse(a)) : s = B.fromJson(i || Y);
909
+ } catch (a) {
910
+ console.warn("Failed to load layout from storage for key", r, a), s = B.fromJson(i || Y);
878
911
  }
879
912
  else
880
- s = K.fromJson(a || _);
881
- o({ storageKey: t, model: s });
913
+ s = B.fromJson(i || Y);
914
+ t({ storageKey: r, model: s });
882
915
  },
883
- setTabDirty: (t, a) => {
884
- o((s) => {
885
- const l = new Set(s.dirtyTabs);
886
- return a ? l.add(t) : l.delete(t), { dirtyTabs: l };
916
+ setTabDirty: (r, i) => {
917
+ t((s) => {
918
+ const a = new Set(s.dirtyTabs);
919
+ return i ? a.add(r) : a.delete(r), { dirtyTabs: a };
887
920
  });
888
921
  },
889
- isTabDirty: (t) => e().dirtyTabs.has(t),
890
- addTab: (t, a, s) => {
891
- const l = e().model, u = l.getActiveTabset();
892
- let i = u == null ? void 0 : u.getId();
893
- if (!i)
922
+ isTabDirty: (r) => e().dirtyTabs.has(r),
923
+ addTab: (r, i, s) => {
924
+ const a = e().model, d = a.getActiveTabset();
925
+ let l = d == null ? void 0 : d.getId();
926
+ if (!l)
894
927
  try {
895
- const f = l.getFirstTabSet();
896
- i = f == null ? void 0 : f.getId();
897
- } catch (f) {
898
- console.warn("Failed to get first tabset fallback", f);
928
+ const g = a.getFirstTabSet();
929
+ l = g == null ? void 0 : g.getId();
930
+ } catch (g) {
931
+ console.warn("Failed to get first tabset fallback", g);
899
932
  }
900
- const m = { ...{}, ...s };
901
- if (["nexus-dashboard", "nexus-docs"].includes(t)) {
902
- let f = null;
903
- if (l.visitNodes((p) => {
904
- if (p.getType() === "tab") {
905
- const N = p;
906
- N.getComponent() === t && (f = N.getId());
933
+ const h = { ...{}, ...s };
934
+ if (["nexus-dashboard", "nexus-docs"].includes(r)) {
935
+ let g = null;
936
+ if (a.visitNodes((m) => {
937
+ if (m.getType() === "tab") {
938
+ const C = m;
939
+ C.getComponent() === r && (g = C.getId());
907
940
  }
908
- }), f) {
909
- l.doAction(G.selectTab(f));
941
+ }), g) {
942
+ a.doAction(Z.selectTab(g));
910
943
  return;
911
944
  }
912
945
  }
913
- if (m.mapId) {
914
- let f = null;
915
- if (l.visitNodes((p) => {
916
- var N;
917
- if (p.getType() === "tab") {
918
- const k = p;
919
- ((N = k.getConfig()) == null ? void 0 : N.mapId) === m.mapId && (f = k.getId());
946
+ if (h.mapId) {
947
+ let g = null;
948
+ if (a.visitNodes((m) => {
949
+ var C;
950
+ if (m.getType() === "tab") {
951
+ const E = m;
952
+ ((C = E.getConfig()) == null ? void 0 : C.mapId) === h.mapId && (g = E.getId());
920
953
  }
921
- }), f) {
922
- l.doAction(G.selectTab(f));
954
+ }), g) {
955
+ a.doAction(Z.selectTab(g));
923
956
  return;
924
957
  }
925
958
  }
926
- if (m.projectId) {
927
- let f = null;
928
- if (l.visitNodes((p) => {
929
- var N;
930
- if (p.getType() === "tab") {
931
- const k = p;
932
- ((N = k.getConfig()) == null ? void 0 : N.projectId) === m.projectId && (f = k.getId());
959
+ if (h.projectId) {
960
+ let g = null;
961
+ if (a.visitNodes((m) => {
962
+ var C;
963
+ if (m.getType() === "tab") {
964
+ const E = m;
965
+ ((C = E.getConfig()) == null ? void 0 : C.projectId) === h.projectId && (g = E.getId());
933
966
  }
934
- }), f) {
935
- l.doAction(G.selectTab(f));
967
+ }), g) {
968
+ a.doAction(Z.selectTab(g));
936
969
  return;
937
970
  }
938
971
  }
939
- i && l.doAction(
940
- G.addNode(
941
- { type: "tab", component: t, name: a || t, config: m },
942
- i,
943
- Oe.CENTER,
972
+ l && a.doAction(
973
+ Z.addNode(
974
+ { type: "tab", component: r, name: i || r, config: h },
975
+ l,
976
+ Ve.CENTER,
944
977
  -1
945
978
  )
946
979
  );
947
980
  }
948
981
  };
949
- }), Te = U((o, e) => ({
982
+ }), Ue = G((t, e) => ({
950
983
  isOpen: !1,
951
984
  type: "alert",
952
985
  title: "",
953
986
  message: "",
954
987
  defaultValue: "",
955
988
  resolve: null,
956
- openAlert: (n, t = "Alert") => new Promise((a) => {
957
- o({ isOpen: !0, type: "alert", title: t, message: n, defaultValue: "", resolve: a });
989
+ openAlert: (n, r = "Alert") => new Promise((i) => {
990
+ t({ isOpen: !0, type: "alert", title: r, message: n, defaultValue: "", resolve: i });
958
991
  }),
959
- openConfirm: (n, t = "Confirm") => new Promise((a) => {
960
- o({ isOpen: !0, type: "confirm", title: t, message: n, defaultValue: "", resolve: a });
992
+ openConfirm: (n, r = "Confirm") => new Promise((i) => {
993
+ t({ isOpen: !0, type: "confirm", title: r, message: n, defaultValue: "", resolve: i });
961
994
  }),
962
- openPrompt: (n, t = "", a = "Prompt") => new Promise((s) => {
963
- o({ isOpen: !0, type: "prompt", title: a, message: n, defaultValue: t, resolve: s });
995
+ openPrompt: (n, r = "", i = "Prompt") => new Promise((s) => {
996
+ t({ isOpen: !0, type: "prompt", title: i, message: n, defaultValue: r, resolve: s });
964
997
  }),
965
998
  close: (n = null) => {
966
- const { resolve: t } = e();
967
- t && t(n), o({ isOpen: !1, resolve: null });
999
+ const { resolve: r } = e();
1000
+ r && r(n), t({ isOpen: !1, resolve: null });
968
1001
  }
969
- })), _t = ({
970
- panels: o,
1002
+ })), Nr = ({
1003
+ panels: t,
971
1004
  slashCommands: e,
972
1005
  menuConfig: n,
973
- statusBarConfig: t,
974
- title: a,
1006
+ statusBarConfig: r,
1007
+ title: i,
975
1008
  rightMenuBarContent: s,
976
- centerMenuBarContent: l,
977
- layoutModel: u,
978
- initialLayoutJson: i,
979
- disableLocalStorage: d = !1,
980
- onLayoutChange: m
1009
+ centerMenuBarContent: a,
1010
+ layoutModel: d,
1011
+ initialLayoutJson: l,
1012
+ disableLocalStorage: c = !1,
1013
+ onLayoutChange: h
981
1014
  }) => {
982
- const { model: f, setModel: p, initLayout: N, isTabDirty: k, setTabDirty: w } = bt(), h = Y((E) => E.theme), x = F((E) => E.setPanels), b = Q((E) => E.setSlashCommands), y = ie((E) => E.setWidgets);
983
- O(() => {
984
- o && x(o);
985
- }, [o, x]), O(() => {
986
- e && b(e);
987
- }, [e, b]), O(() => {
988
- n && le.setMenus(n);
989
- }, [n]), O(() => {
990
- t && y(t);
991
- }, [t, y]), O(() => {
992
- u || !i && !d || N(i, d);
1015
+ const { model: g, setModel: m, initLayout: C, isTabDirty: E, setTabDirty: w } = Ut(), y = te((L) => L.theme), b = W((L) => L.setPanels), x = se((L) => L.setSlashCommands), N = ve((L) => L.setWidgets);
1016
+ z(() => {
1017
+ t && b(t);
1018
+ }, [t, b]), z(() => {
1019
+ e && x(e);
1020
+ }, [e, x]), z(() => {
1021
+ n && ye.setMenus(n);
1022
+ }, [n]), z(() => {
1023
+ r && N(r);
1024
+ }, [r, N]), z(() => {
1025
+ d || !l && !c || C(l, c);
993
1026
  }, []);
994
- const g = (E) => {
1027
+ const u = (L) => {
995
1028
  try {
996
- const L = E.getComponent(), T = E.getConfig() || {}, P = L ? ht.get(L) : void 0;
997
- return P ? /* @__PURE__ */ r(P, { node: E, ...T }) : /* @__PURE__ */ c("div", { className: "p-4 text-sm", children: [
1029
+ const $ = L.getComponent(), T = L.getConfig() || {}, O = $ ? _t.get($) : void 0;
1030
+ return O ? /* @__PURE__ */ o(O, { node: L, ...T }) : /* @__PURE__ */ f("div", { className: "p-4 text-sm", children: [
998
1031
  "Unknown Component: ",
999
- L
1032
+ $
1000
1033
  ] });
1001
- } catch (L) {
1002
- return console.error("Error in component factory:", L), /* @__PURE__ */ c("div", { className: "p-8 text-destructive bg-destructive/10 border border-destructive/20 h-full flex items-center justify-center", children: [
1034
+ } catch ($) {
1035
+ return console.error("Error in component factory:", $), /* @__PURE__ */ f("div", { className: "p-8 text-destructive bg-destructive/10 border border-destructive/20 h-full flex items-center justify-center", children: [
1003
1036
  "Error rendering component: ",
1004
- L instanceof Error ? L.message : "Unknown error"
1037
+ $ instanceof Error ? $.message : "Unknown error"
1005
1038
  ] });
1006
1039
  }
1007
- }, C = (E) => {
1008
- if (E.type !== G.DELETE_TAB) return E;
1009
- const L = f.getNodeById(E.data.node);
1010
- if (!L || !k(L.getId())) return E;
1011
- Te.getState().openConfirm(
1012
- `Tab "${L.getName()}" has unsaved changes. Are you sure you want to close it?`
1040
+ }, S = (L) => {
1041
+ if (L.type !== Z.DELETE_TAB) return L;
1042
+ const $ = g.getNodeById(L.data.node);
1043
+ if (!$ || !E($.getId())) return L;
1044
+ Ue.getState().openConfirm(
1045
+ `Tab "${$.getName()}" has unsaved changes. Are you sure you want to close it?`
1013
1046
  ).then((T) => {
1014
- T && (w(L.getId(), !1), f.doAction(E));
1047
+ T && (w($.getId(), !1), g.doAction(L));
1015
1048
  });
1016
1049
  };
1017
- return /* @__PURE__ */ c(
1050
+ return /* @__PURE__ */ f(
1018
1051
  "div",
1019
1052
  {
1020
- className: `flex flex-col h-screen w-screen bg-background text-foreground overflow-hidden theme-${h}`,
1053
+ className: `flex flex-col h-screen w-screen bg-background text-foreground overflow-hidden theme-${y}`,
1021
1054
  children: [
1022
- /* @__PURE__ */ r(
1023
- at,
1055
+ /* @__PURE__ */ o(
1056
+ Et,
1024
1057
  {
1025
- title: a,
1026
- center: l,
1058
+ title: i,
1059
+ center: a,
1027
1060
  right: s
1028
1061
  }
1029
1062
  ),
1030
- /* @__PURE__ */ c("div", { className: "flex-1 flex overflow-hidden", children: [
1031
- /* @__PURE__ */ r(Qe, {}),
1032
- /* @__PURE__ */ r(dt, {}),
1033
- /* @__PURE__ */ c("div", { className: "flex-1 flex flex-col min-w-0 bg-card", children: [
1034
- /* @__PURE__ */ r("div", { className: "flex-1 relative h-full w-full", children: /* @__PURE__ */ r(
1035
- Ae,
1063
+ /* @__PURE__ */ f("div", { className: "flex-1 flex overflow-hidden", children: [
1064
+ /* @__PURE__ */ o(bt, {}),
1065
+ /* @__PURE__ */ o($t, {}),
1066
+ /* @__PURE__ */ f("div", { className: "flex-1 flex flex-col min-w-0 bg-card", children: [
1067
+ /* @__PURE__ */ o("div", { className: "flex-1 relative h-full w-full", children: /* @__PURE__ */ o(
1068
+ qe,
1036
1069
  {
1037
- model: u || f,
1038
- factory: g,
1039
- onModelChange: (E) => {
1040
- u || p(E), m == null || m(E.toJson());
1070
+ model: d || g,
1071
+ factory: u,
1072
+ onModelChange: (L) => {
1073
+ d || m(L), h == null || h(L.toJson());
1041
1074
  },
1042
- onAction: C
1075
+ onAction: S
1043
1076
  }
1044
1077
  ) }),
1045
- /* @__PURE__ */ r(pt, {})
1078
+ /* @__PURE__ */ o(Rt, {})
1046
1079
  ] }),
1047
- /* @__PURE__ */ r(rt, {})
1080
+ /* @__PURE__ */ o(Nt, {})
1048
1081
  ] }),
1049
- /* @__PURE__ */ r(ut, {})
1082
+ /* @__PURE__ */ o(Mt, {})
1050
1083
  ]
1051
1084
  }
1052
1085
  );
1053
- }, Bt = [
1086
+ }, Fe = ae.map((t) => ({
1087
+ id: `theme.${t.id}`,
1088
+ label: `Preferences: ${t.label} Theme`,
1089
+ execute: () => te.getState().setTheme(t.id)
1090
+ })), kr = [
1054
1091
  "view.toggleTerminal",
1055
1092
  "view.toggleChat",
1056
1093
  "view.toggleSidebar",
1057
- "theme.light",
1058
- "theme.dark",
1059
- "theme.gt"
1060
- ], oe = (o) => () => Y.getState().setTheme(o), xt = [
1094
+ ...Fe.map((t) => t.id)
1095
+ ], Ft = [
1061
1096
  {
1062
1097
  id: "view.toggleTerminal",
1063
1098
  label: "View: Toggle Terminal",
1064
1099
  keybinding: "Control+`",
1065
- execute: () => V.getState().toggle()
1100
+ execute: () => ee.getState().toggle()
1066
1101
  },
1067
1102
  {
1068
1103
  id: "view.toggleChat",
1069
1104
  label: "View: Toggle Chat",
1070
- execute: () => ae.getState().toggleChat()
1105
+ execute: () => he.getState().toggleChat()
1071
1106
  },
1072
1107
  {
1073
1108
  id: "view.toggleSidebar",
1074
1109
  label: "View: Toggle Sidebar",
1075
1110
  keybinding: "Control+b",
1076
1111
  execute: () => {
1077
- var t;
1078
- const { activeSidebar: o, panels: e, setActiveSidebar: n } = F.getState();
1079
- n(o ? null : ((t = e[0]) == null ? void 0 : t.id) ?? null);
1112
+ var r;
1113
+ const { activeSidebar: t, panels: e, setActiveSidebar: n } = W.getState();
1114
+ n(t ? null : ((r = e[0]) == null ? void 0 : r.id) ?? null);
1080
1115
  }
1081
1116
  },
1082
- { id: "theme.light", label: "Preferences: Light Theme", execute: oe("light") },
1083
- { id: "theme.dark", label: "Preferences: Dark Theme", execute: oe("dark") },
1084
- { id: "theme.gt", label: "Preferences: Georgia Tech Theme", execute: oe("gt") }
1085
- ], vt = {
1117
+ ...Fe
1118
+ ], jt = {
1086
1119
  View: [
1087
1120
  { id: "view.terminal", label: "Toggle Terminal", commandId: "view.toggleTerminal" },
1088
1121
  { id: "view.chat", label: "Toggle Chat", commandId: "view.toggleChat" },
@@ -1090,35 +1123,35 @@ const ht = new gt(), _ = {
1090
1123
  {
1091
1124
  id: "view.theme",
1092
1125
  label: "Theme",
1093
- submenu: [
1094
- { id: "view.theme.light", label: "Light", commandId: "theme.light" },
1095
- { id: "view.theme.dark", label: "Dark", commandId: "theme.dark" },
1096
- { id: "view.theme.gt", label: "Georgia Tech", commandId: "theme.gt" }
1097
- ]
1126
+ submenu: ae.map((t) => ({
1127
+ id: `view.theme.${t.id}`,
1128
+ label: t.label,
1129
+ commandId: `theme.${t.id}`
1130
+ }))
1098
1131
  }
1099
1132
  ]
1100
- }, Jt = (o = {}) => {
1133
+ }, Cr = (t = {}) => {
1101
1134
  const {
1102
1135
  panels: e,
1103
1136
  menus: n,
1104
- commands: t,
1105
- statusBar: a,
1137
+ commands: r,
1138
+ statusBar: i,
1106
1139
  slashCommands: s,
1107
- defaultCommands: l = !0,
1108
- defaultMenus: u = !0
1109
- } = o;
1110
- l && xt.forEach((d) => W.registerCommand(d)), t == null || t.forEach((d) => W.registerCommand(d));
1111
- const i = {
1112
- ...l && u ? vt : {},
1140
+ defaultCommands: a = !0,
1141
+ defaultMenus: d = !0
1142
+ } = t;
1143
+ a && Ft.forEach((c) => q.registerCommand(c)), r == null || r.forEach((c) => q.registerCommand(c));
1144
+ const l = {
1145
+ ...a && d ? jt : {},
1113
1146
  ...n ?? {}
1114
1147
  };
1115
- Object.keys(i).length > 0 && le.setMenus(i), e && F.getState().setPanels(e), a && ie.getState().setWidgets(a), s && Q.getState().setSlashCommands(s);
1148
+ Object.keys(l).length > 0 && ye.setMenus(l), e && W.getState().setPanels(e), i && ve.getState().setWidgets(i), s && se.getState().setSlashCommands(s);
1116
1149
  };
1117
- class yt {
1150
+ class Bt {
1118
1151
  constructor() {
1119
- J(this, "plugins", /* @__PURE__ */ new Map());
1120
- J(this, "loaders", /* @__PURE__ */ new Map());
1121
- J(this, "statuses", /* @__PURE__ */ new Map());
1152
+ X(this, "plugins", /* @__PURE__ */ new Map());
1153
+ X(this, "loaders", /* @__PURE__ */ new Map());
1154
+ X(this, "statuses", /* @__PURE__ */ new Map());
1122
1155
  }
1123
1156
  registerPlugin(e) {
1124
1157
  if (this.plugins.has(e.id)) {
@@ -1139,15 +1172,15 @@ class yt {
1139
1172
  if (!n && this.loaders.has(e))
1140
1173
  try {
1141
1174
  n = await this.loaders.get(e)(), this.plugins.set(e, n), this.statuses.set(e, "registered"), console.log(`Lazy plugin ${e} loaded.`);
1142
- } catch (t) {
1143
- console.error(`Failed to load lazy plugin ${e}`, t), this.statuses.set(e, "failed");
1175
+ } catch (r) {
1176
+ console.error(`Failed to load lazy plugin ${e}`, r), this.statuses.set(e, "failed");
1144
1177
  return;
1145
1178
  }
1146
1179
  if (n)
1147
1180
  try {
1148
1181
  this.statuses.set(e, "activating"), n.activate(), this.statuses.set(e, "active"), console.log(`Plugin ${n.name} activated.`);
1149
- } catch (t) {
1150
- console.error(`Failed to activate plugin ${e}`, t), this.statuses.set(e, "failed");
1182
+ } catch (r) {
1183
+ console.error(`Failed to activate plugin ${e}`, r), this.statuses.set(e, "failed");
1151
1184
  }
1152
1185
  else
1153
1186
  console.warn(`Plugin ${e} not found for activation.`), this.statuses.set(e, "failed");
@@ -1157,8 +1190,8 @@ class yt {
1157
1190
  if (n)
1158
1191
  try {
1159
1192
  n.deactivate(), this.statuses.set(e, "deactivated"), console.log(`Plugin ${n.name} deactivated.`);
1160
- } catch (t) {
1161
- console.error(`Failed to deactivate plugin ${e}`, t), this.statuses.set(e, "failed");
1193
+ } catch (r) {
1194
+ console.error(`Failed to deactivate plugin ${e}`, r), this.statuses.set(e, "failed");
1162
1195
  }
1163
1196
  }
1164
1197
  getPluginStatus(e) {
@@ -1166,8 +1199,8 @@ class yt {
1166
1199
  }
1167
1200
  getPluginStatuses() {
1168
1201
  const e = {};
1169
- return this.statuses.forEach((n, t) => {
1170
- e[t] = n;
1202
+ return this.statuses.forEach((n, r) => {
1203
+ e[r] = n;
1171
1204
  }), e;
1172
1205
  }
1173
1206
  getPlugin(e) {
@@ -1177,177 +1210,177 @@ class yt {
1177
1210
  return Array.from(this.plugins.values());
1178
1211
  }
1179
1212
  }
1180
- const Ht = new yt(), pe = "nexus-shell-user-profile", ge = {
1213
+ const Tr = new Bt(), Ee = "nexus-shell-user-profile", Se = {
1181
1214
  name: "David Tech",
1182
1215
  role: "Shell Architect",
1183
1216
  email: "david@techmuch.io",
1184
1217
  avatarUrl: "",
1185
1218
  customAvatar: ""
1186
- }, H = U((o) => {
1187
- let e = { ...ge };
1219
+ }, V = G((t) => {
1220
+ let e = { ...Se };
1188
1221
  if (typeof window < "u")
1189
1222
  try {
1190
- const t = localStorage.getItem(pe);
1191
- t && (e = { ...ge, ...JSON.parse(t) });
1192
- } catch (t) {
1193
- console.error("Failed to parse saved user profile:", t);
1223
+ const r = localStorage.getItem(Ee);
1224
+ r && (e = { ...Se, ...JSON.parse(r) });
1225
+ } catch (r) {
1226
+ console.error("Failed to parse saved user profile:", r);
1194
1227
  }
1195
- const n = (t) => {
1228
+ const n = (r) => {
1196
1229
  if (typeof window < "u")
1197
1230
  try {
1198
1231
  localStorage.setItem(
1199
- pe,
1232
+ Ee,
1200
1233
  JSON.stringify({
1201
- name: t.name,
1202
- role: t.role,
1203
- email: t.email,
1204
- avatarUrl: t.avatarUrl,
1205
- customAvatar: t.customAvatar
1234
+ name: r.name,
1235
+ role: r.role,
1236
+ email: r.email,
1237
+ avatarUrl: r.avatarUrl,
1238
+ customAvatar: r.customAvatar
1206
1239
  })
1207
1240
  );
1208
- } catch (a) {
1209
- console.error("Failed to save user profile:", a);
1241
+ } catch (i) {
1242
+ console.error("Failed to save user profile:", i);
1210
1243
  }
1211
1244
  };
1212
1245
  return {
1213
1246
  ...e,
1214
- updateProfile: (t) => o((a) => {
1215
- const s = { ...a, ...t };
1216
- return n(s), t;
1247
+ updateProfile: (r) => t((i) => {
1248
+ const s = { ...i, ...r };
1249
+ return n(s), r;
1217
1250
  }),
1218
- setCustomAvatar: (t) => o((a) => {
1219
- const s = { ...a, customAvatar: t };
1220
- return n(s), { customAvatar: t };
1251
+ setCustomAvatar: (r) => t((i) => {
1252
+ const s = { ...i, customAvatar: r };
1253
+ return n(s), { customAvatar: r };
1221
1254
  }),
1222
- clearCustomAvatar: () => o((t) => {
1223
- const a = { ...t, customAvatar: "" };
1224
- return n(a), { customAvatar: "" };
1255
+ clearCustomAvatar: () => t((r) => {
1256
+ const i = { ...r, customAvatar: "" };
1257
+ return n(i), { customAvatar: "" };
1225
1258
  })
1226
1259
  };
1227
- }), Wt = () => {
1228
- O(() => {
1229
- const o = (e) => {
1230
- const n = W.getCommands();
1231
- for (const t of n)
1232
- if (t.keybinding && wt(e, t.keybinding)) {
1233
- e.preventDefault(), t.execute();
1260
+ }), Er = () => {
1261
+ z(() => {
1262
+ const t = (e) => {
1263
+ const n = q.getCommands();
1264
+ for (const r of n)
1265
+ if (r.keybinding && Ht(e, r.keybinding)) {
1266
+ e.preventDefault(), r.execute();
1234
1267
  break;
1235
1268
  }
1236
1269
  };
1237
- return window.addEventListener("keydown", o), () => window.removeEventListener("keydown", o);
1270
+ return window.addEventListener("keydown", t), () => window.removeEventListener("keydown", t);
1238
1271
  }, []);
1239
1272
  };
1240
- function wt(o, e) {
1241
- var p;
1242
- const n = e.split("+"), t = (p = n.pop()) == null ? void 0 : p.toLowerCase(), a = n.includes("Control") || n.includes("Ctrl"), s = n.includes("Shift"), l = n.includes("Alt"), u = n.includes("Meta") || n.includes("Cmd"), i = o.ctrlKey, d = o.shiftKey, m = o.altKey, f = o.metaKey;
1243
- return o.key.toLowerCase() === t && i === a && d === s && m === l && f === u;
1273
+ function Ht(t, e) {
1274
+ var m;
1275
+ const n = e.split("+"), r = (m = n.pop()) == null ? void 0 : m.toLowerCase(), i = n.includes("Control") || n.includes("Ctrl"), s = n.includes("Shift"), a = n.includes("Alt"), d = n.includes("Meta") || n.includes("Cmd"), l = t.ctrlKey, c = t.shiftKey, h = t.altKey, g = t.metaKey;
1276
+ return t.key.toLowerCase() === r && l === i && c === s && h === a && g === d;
1244
1277
  }
1245
- const Nt = (o, e) => {
1278
+ const Wt = (t, e) => {
1246
1279
  const n = e.toLowerCase();
1247
- return o.label.toLowerCase().includes(n) || o.id.toLowerCase().includes(n);
1248
- }, kt = ({
1249
- open: o,
1280
+ return t.label.toLowerCase().includes(n) || t.id.toLowerCase().includes(n);
1281
+ }, Gt = ({
1282
+ open: t,
1250
1283
  commands: e,
1251
1284
  onSelect: n,
1252
- onClose: t,
1253
- inline: a = !1,
1285
+ onClose: r,
1286
+ inline: i = !1,
1254
1287
  placeholder: s = "Type a command to run…",
1255
- filter: l = Nt,
1256
- className: u
1288
+ filter: a = Wt,
1289
+ className: d
1257
1290
  }) => {
1258
- const [i, d] = A(""), [m, f] = A(0), p = M(null), N = j(
1259
- () => e.filter((w) => l(w, i)),
1260
- [e, i, l]
1291
+ const [l, c] = P(""), [h, g] = P(0), m = F(null), C = H(
1292
+ () => e.filter((w) => a(w, l)),
1293
+ [e, l, a]
1261
1294
  );
1262
- if (O(() => {
1295
+ if (z(() => {
1263
1296
  var w;
1264
- o && (d(""), f(0), (w = p.current) == null || w.focus());
1265
- }, [o]), O(() => {
1266
- f(0);
1267
- }, [i]), !o) return null;
1268
- const k = (w) => {
1269
- w.key === "ArrowDown" ? (w.preventDefault(), f((h) => N.length ? (h + 1) % N.length : 0)) : w.key === "ArrowUp" ? (w.preventDefault(), f(
1270
- (h) => N.length ? (h - 1 + N.length) % N.length : 0
1271
- )) : w.key === "Enter" ? (w.preventDefault(), N[m] && n(N[m])) : w.key === "Escape" && (w.preventDefault(), t == null || t());
1297
+ t && (c(""), g(0), (w = m.current) == null || w.focus());
1298
+ }, [t]), z(() => {
1299
+ g(0);
1300
+ }, [l]), !t) return null;
1301
+ const E = (w) => {
1302
+ w.key === "ArrowDown" ? (w.preventDefault(), g((y) => C.length ? (y + 1) % C.length : 0)) : w.key === "ArrowUp" ? (w.preventDefault(), g(
1303
+ (y) => C.length ? (y - 1 + C.length) % C.length : 0
1304
+ )) : w.key === "Enter" ? (w.preventDefault(), C[h] && n(C[h])) : w.key === "Escape" && (w.preventDefault(), r == null || r());
1272
1305
  };
1273
- return /* @__PURE__ */ r(
1306
+ return /* @__PURE__ */ o(
1274
1307
  "div",
1275
1308
  {
1276
- onClick: a ? void 0 : t,
1277
- className: S(
1309
+ onClick: i ? void 0 : r,
1310
+ className: D(
1278
1311
  "z-[100] flex items-start justify-center",
1279
- a ? "relative w-full max-w-xl" : "fixed inset-0 pt-[10vh] bg-black/50 backdrop-blur-sm"
1312
+ i ? "relative w-full max-w-xl" : "fixed inset-0 pt-[10vh] bg-black/50 backdrop-blur-sm"
1280
1313
  ),
1281
- children: /* @__PURE__ */ c(
1314
+ children: /* @__PURE__ */ f(
1282
1315
  "div",
1283
1316
  {
1284
1317
  role: "dialog",
1285
- "aria-modal": !a,
1318
+ "aria-modal": !i,
1286
1319
  "aria-label": "Command Palette",
1287
1320
  onClick: (w) => w.stopPropagation(),
1288
- className: S(
1321
+ className: D(
1289
1322
  "w-full max-w-xl bg-popover text-popover-foreground border shadow-2xl rounded-xl overflow-hidden animate-in fade-in zoom-in duration-200",
1290
- u
1323
+ d
1291
1324
  ),
1292
1325
  children: [
1293
- /* @__PURE__ */ c("div", { className: "flex items-center px-4 border-b", children: [
1294
- /* @__PURE__ */ r(X, { size: 18, className: "text-muted-foreground mr-3" }),
1295
- /* @__PURE__ */ r(
1326
+ /* @__PURE__ */ f("div", { className: "flex items-center px-4 border-b", children: [
1327
+ /* @__PURE__ */ o(de, { size: 18, className: "text-muted-foreground mr-3" }),
1328
+ /* @__PURE__ */ o(
1296
1329
  "input",
1297
1330
  {
1298
- ref: p,
1331
+ ref: m,
1299
1332
  type: "text",
1300
1333
  role: "combobox",
1301
1334
  "aria-expanded": !0,
1302
1335
  "aria-controls": "command-palette-list",
1303
1336
  "aria-label": "Command",
1304
1337
  placeholder: s,
1305
- value: i,
1306
- onChange: (w) => d(w.target.value),
1307
- onKeyDown: k,
1338
+ value: l,
1339
+ onChange: (w) => c(w.target.value),
1340
+ onKeyDown: E,
1308
1341
  className: "flex-1 h-14 bg-transparent outline-none text-base text-foreground placeholder:text-muted-foreground"
1309
1342
  }
1310
1343
  )
1311
1344
  ] }),
1312
- /* @__PURE__ */ r(
1345
+ /* @__PURE__ */ o(
1313
1346
  "div",
1314
1347
  {
1315
1348
  id: "command-palette-list",
1316
1349
  role: "listbox",
1317
1350
  className: "max-h-[300px] overflow-y-auto py-2",
1318
- children: N.length === 0 ? /* @__PURE__ */ r("div", { className: "px-4 py-8 text-center text-sm text-muted-foreground", children: i ? `No commands found matching "${i}"` : "No commands available." }) : N.map((w, h) => /* @__PURE__ */ c(
1351
+ children: C.length === 0 ? /* @__PURE__ */ o("div", { className: "px-4 py-8 text-center text-sm text-muted-foreground", children: l ? `No commands found matching "${l}"` : "No commands available." }) : C.map((w, y) => /* @__PURE__ */ f(
1319
1352
  "div",
1320
1353
  {
1321
1354
  role: "option",
1322
- "aria-selected": h === m,
1355
+ "aria-selected": y === h,
1323
1356
  onClick: () => n(w),
1324
- onMouseEnter: () => f(h),
1325
- className: S(
1357
+ onMouseEnter: () => g(y),
1358
+ className: D(
1326
1359
  "px-4 py-2 cursor-pointer flex justify-between items-center text-sm",
1327
- h === m ? "bg-accent text-accent-foreground" : "hover:bg-accent/50"
1360
+ y === h ? "bg-accent text-accent-foreground" : "hover:bg-accent/50"
1328
1361
  ),
1329
1362
  children: [
1330
- /* @__PURE__ */ r("span", { children: w.label }),
1331
- w.keybinding && /* @__PURE__ */ r("span", { className: "text-[10px] text-muted-foreground bg-muted px-1.5 py-0.5 rounded border border-border/50", children: w.keybinding })
1363
+ /* @__PURE__ */ o("span", { children: w.label }),
1364
+ w.keybinding && /* @__PURE__ */ o("span", { className: "text-[10px] text-muted-foreground bg-muted px-1.5 py-0.5 rounded border border-border/50", children: w.keybinding })
1332
1365
  ]
1333
1366
  },
1334
1367
  w.id
1335
1368
  ))
1336
1369
  }
1337
1370
  ),
1338
- /* @__PURE__ */ c("div", { className: "px-4 py-2 border-t bg-muted/30 flex justify-between items-center text-[10px] text-muted-foreground", children: [
1339
- /* @__PURE__ */ c("div", { className: "flex gap-3", children: [
1340
- /* @__PURE__ */ c("span", { children: [
1341
- /* @__PURE__ */ r("kbd", { className: "bg-muted px-1 rounded border", children: "↑↓" }),
1371
+ /* @__PURE__ */ f("div", { className: "px-4 py-2 border-t bg-muted/30 flex justify-between items-center text-[10px] text-muted-foreground", children: [
1372
+ /* @__PURE__ */ f("div", { className: "flex gap-3", children: [
1373
+ /* @__PURE__ */ f("span", { children: [
1374
+ /* @__PURE__ */ o("kbd", { className: "bg-muted px-1 rounded border", children: "↑↓" }),
1342
1375
  " to navigate"
1343
1376
  ] }),
1344
- /* @__PURE__ */ c("span", { children: [
1345
- /* @__PURE__ */ r("kbd", { className: "bg-muted px-1 rounded border", children: "Enter" }),
1377
+ /* @__PURE__ */ f("span", { children: [
1378
+ /* @__PURE__ */ o("kbd", { className: "bg-muted px-1 rounded border", children: "Enter" }),
1346
1379
  " to select"
1347
1380
  ] })
1348
1381
  ] }),
1349
- /* @__PURE__ */ c("span", { children: [
1350
- /* @__PURE__ */ r("kbd", { className: "bg-muted px-1 rounded border", children: "Esc" }),
1382
+ /* @__PURE__ */ f("span", { children: [
1383
+ /* @__PURE__ */ o("kbd", { className: "bg-muted px-1 rounded border", children: "Esc" }),
1351
1384
  " to close"
1352
1385
  ] })
1353
1386
  ] })
@@ -1356,133 +1389,133 @@ const Nt = (o, e) => {
1356
1389
  )
1357
1390
  }
1358
1391
  );
1359
- }, Gt = ({
1360
- shortcutKey: o = "p",
1392
+ }, Sr = ({
1393
+ shortcutKey: t = "p",
1361
1394
  ...e
1362
1395
  }) => {
1363
- const [n, t] = A(!1);
1364
- return O(() => {
1365
- if (o === null) return;
1366
- const a = (s) => {
1367
- (s.metaKey || s.ctrlKey) && s.shiftKey && s.key.toLowerCase() === o && (s.preventDefault(), t((l) => !l));
1396
+ const [n, r] = P(!1);
1397
+ return z(() => {
1398
+ if (t === null) return;
1399
+ const i = (s) => {
1400
+ (s.metaKey || s.ctrlKey) && s.shiftKey && s.key.toLowerCase() === t && (s.preventDefault(), r((a) => !a));
1368
1401
  };
1369
- return window.addEventListener("keydown", a), () => window.removeEventListener("keydown", a);
1370
- }, [o]), /* @__PURE__ */ r(
1371
- kt,
1402
+ return window.addEventListener("keydown", i), () => window.removeEventListener("keydown", i);
1403
+ }, [t]), /* @__PURE__ */ o(
1404
+ Gt,
1372
1405
  {
1373
1406
  ...e,
1374
1407
  open: n,
1375
- commands: W.getCommands(),
1376
- onSelect: (a) => {
1377
- a.execute(), t(!1);
1408
+ commands: q.getCommands(),
1409
+ onSelect: (i) => {
1410
+ i.execute(), r(!1);
1378
1411
  },
1379
- onClose: () => t(!1)
1412
+ onClose: () => r(!1)
1380
1413
  }
1381
1414
  );
1382
- }, Ct = {
1383
- alert: je,
1384
- confirm: $e,
1385
- prompt: Ke
1386
- }, St = {
1415
+ }, Yt = {
1416
+ alert: st,
1417
+ confirm: ot,
1418
+ prompt: nt
1419
+ }, Jt = {
1387
1420
  alert: "text-destructive",
1388
1421
  confirm: "text-amber-500",
1389
1422
  prompt: "text-blue-500"
1390
- }, Tt = ({
1391
- open: o,
1423
+ }, Xt = ({
1424
+ open: t,
1392
1425
  type: e = "alert",
1393
1426
  title: n,
1394
- message: t,
1395
- defaultValue: a = "",
1427
+ message: r,
1428
+ defaultValue: i = "",
1396
1429
  onConfirm: s,
1397
- onCancel: l,
1398
- confirmLabel: u,
1399
- cancelLabel: i = "Cancel",
1400
- placeholder: d = "Enter value…",
1401
- className: m
1430
+ onCancel: a,
1431
+ confirmLabel: d,
1432
+ cancelLabel: l = "Cancel",
1433
+ placeholder: c = "Enter value…",
1434
+ className: h
1402
1435
  }) => {
1403
- const [f, p] = A(a), N = M(null);
1404
- if (O(() => {
1405
- if (!o || (p(a), e !== "prompt")) return;
1406
- const x = window.setTimeout(() => {
1407
- var b, y;
1408
- (b = N.current) == null || b.focus(), (y = N.current) == null || y.select();
1436
+ const [g, m] = P(i), C = F(null);
1437
+ if (z(() => {
1438
+ if (!t || (m(i), e !== "prompt")) return;
1439
+ const b = window.setTimeout(() => {
1440
+ var x, N;
1441
+ (x = C.current) == null || x.focus(), (N = C.current) == null || N.select();
1409
1442
  }, 50);
1410
- return () => window.clearTimeout(x);
1411
- }, [o, e, a]), O(() => {
1412
- if (!o) return;
1413
- const x = (b) => {
1414
- b.key === "Escape" && (b.preventDefault(), l == null || l());
1443
+ return () => window.clearTimeout(b);
1444
+ }, [t, e, i]), z(() => {
1445
+ if (!t) return;
1446
+ const b = (x) => {
1447
+ x.key === "Escape" && (x.preventDefault(), a == null || a());
1415
1448
  };
1416
- return document.addEventListener("keydown", x), () => document.removeEventListener("keydown", x);
1417
- }, [o, l]), !o) return null;
1418
- const k = () => s == null ? void 0 : s(e === "prompt" ? f : void 0), w = (x) => {
1419
- x.key === "Enter" && (x.preventDefault(), k());
1420
- }, h = Ct[e];
1421
- return /* @__PURE__ */ r(
1449
+ return document.addEventListener("keydown", b), () => document.removeEventListener("keydown", b);
1450
+ }, [t, a]), !t) return null;
1451
+ const E = () => s == null ? void 0 : s(e === "prompt" ? g : void 0), w = (b) => {
1452
+ b.key === "Enter" && (b.preventDefault(), E());
1453
+ }, y = Yt[e];
1454
+ return /* @__PURE__ */ o(
1422
1455
  "div",
1423
1456
  {
1424
1457
  className: "fixed inset-0 z-50 flex items-center justify-center overflow-hidden bg-background/80 backdrop-blur-sm transition-all duration-300",
1425
- onClick: l,
1426
- children: /* @__PURE__ */ c(
1458
+ onClick: a,
1459
+ children: /* @__PURE__ */ f(
1427
1460
  "div",
1428
1461
  {
1429
1462
  role: "dialog",
1430
1463
  "aria-modal": "true",
1431
1464
  "aria-label": n,
1432
- onClick: (x) => x.stopPropagation(),
1465
+ onClick: (b) => b.stopPropagation(),
1433
1466
  onKeyDown: w,
1434
- className: S(
1467
+ className: D(
1435
1468
  "relative flex flex-col w-full max-w-md p-6 bg-card border border-border shadow-2xl rounded-2xl animate-in fade-in zoom-in-95 ring-1 ring-white/10",
1436
- m
1469
+ h
1437
1470
  ),
1438
1471
  children: [
1439
- /* @__PURE__ */ r(
1472
+ /* @__PURE__ */ o(
1440
1473
  "button",
1441
1474
  {
1442
1475
  type: "button",
1443
- onClick: l,
1476
+ onClick: a,
1444
1477
  "aria-label": "Close",
1445
1478
  className: "absolute top-4 right-4 p-1 rounded-full text-muted-foreground hover:bg-muted hover:text-foreground transition-colors focus:outline-none focus:ring-2 focus:ring-ring",
1446
- children: /* @__PURE__ */ r(B, { size: 18 })
1479
+ children: /* @__PURE__ */ o(J, { size: 18 })
1447
1480
  }
1448
1481
  ),
1449
- /* @__PURE__ */ c("div", { className: "flex items-start space-x-4 mb-4", children: [
1450
- /* @__PURE__ */ r("div", { className: S("p-2 bg-muted rounded-full shrink-0", St[e]), children: /* @__PURE__ */ r(h, { size: 24 }) }),
1451
- /* @__PURE__ */ c("div", { className: "flex-1 mt-1", children: [
1452
- /* @__PURE__ */ r("h2", { className: "text-lg font-semibold tracking-tight pr-6", children: n }),
1453
- t && /* @__PURE__ */ r("p", { className: "text-sm text-muted-foreground mt-1 whitespace-pre-wrap", children: t })
1482
+ /* @__PURE__ */ f("div", { className: "flex items-start space-x-4 mb-4", children: [
1483
+ /* @__PURE__ */ o("div", { className: D("p-2 bg-muted rounded-full shrink-0", Jt[e]), children: /* @__PURE__ */ o(y, { size: 24 }) }),
1484
+ /* @__PURE__ */ f("div", { className: "flex-1 mt-1", children: [
1485
+ /* @__PURE__ */ o("h2", { className: "text-lg font-semibold tracking-tight pr-6", children: n }),
1486
+ r && /* @__PURE__ */ o("p", { className: "text-sm text-muted-foreground mt-1 whitespace-pre-wrap", children: r })
1454
1487
  ] })
1455
1488
  ] }),
1456
- e === "prompt" && /* @__PURE__ */ r("div", { className: "mt-2 mb-4", children: /* @__PURE__ */ r(
1489
+ e === "prompt" && /* @__PURE__ */ o("div", { className: "mt-2 mb-4", children: /* @__PURE__ */ o(
1457
1490
  "input",
1458
1491
  {
1459
- ref: N,
1492
+ ref: C,
1460
1493
  type: "text",
1461
1494
  "aria-label": n,
1462
- value: f,
1463
- placeholder: d,
1464
- onChange: (x) => p(x.target.value),
1495
+ value: g,
1496
+ placeholder: c,
1497
+ onChange: (b) => m(b.target.value),
1465
1498
  className: "w-full bg-background border border-border rounded-lg px-4 py-2 text-sm focus:outline-none focus:ring-2 focus:ring-primary/50 transition-all placeholder:text-muted-foreground/50"
1466
1499
  }
1467
1500
  ) }),
1468
- /* @__PURE__ */ c("div", { className: "flex items-center justify-end space-x-3 mt-4", children: [
1469
- e !== "alert" && /* @__PURE__ */ r(
1501
+ /* @__PURE__ */ f("div", { className: "flex items-center justify-end space-x-3 mt-4", children: [
1502
+ e !== "alert" && /* @__PURE__ */ o(
1470
1503
  "button",
1471
1504
  {
1472
1505
  type: "button",
1473
- onClick: l,
1506
+ onClick: a,
1474
1507
  className: "px-4 py-2 text-sm font-medium rounded-lg border border-border hover:bg-muted transition-colors focus:outline-none focus:ring-2 focus:ring-ring",
1475
- children: i
1508
+ children: l
1476
1509
  }
1477
1510
  ),
1478
- /* @__PURE__ */ r(
1511
+ /* @__PURE__ */ o(
1479
1512
  "button",
1480
1513
  {
1481
1514
  type: "button",
1482
- onClick: k,
1515
+ onClick: E,
1483
1516
  autoFocus: e !== "prompt",
1484
1517
  className: "px-4 py-2 text-sm font-medium rounded-lg bg-primary text-primary-foreground hover:bg-primary/90 transition-colors focus:outline-none focus:ring-2 focus:ring-ring",
1485
- children: u ?? (e === "alert" ? "OK" : "Confirm")
1518
+ children: d ?? (e === "alert" ? "OK" : "Confirm")
1486
1519
  }
1487
1520
  )
1488
1521
  ] })
@@ -1491,250 +1524,249 @@ const Nt = (o, e) => {
1491
1524
  )
1492
1525
  }
1493
1526
  );
1494
- }, Vt = (o) => {
1495
- const { isOpen: e, type: n, title: t, message: a, defaultValue: s, close: l } = Te();
1496
- return /* @__PURE__ */ r(
1497
- Tt,
1527
+ }, Dr = (t) => {
1528
+ const { isOpen: e, type: n, title: r, message: i, defaultValue: s, close: a } = Ue();
1529
+ return /* @__PURE__ */ o(
1530
+ Xt,
1498
1531
  {
1499
- ...o,
1532
+ ...t,
1500
1533
  open: e,
1501
1534
  type: n,
1502
- title: t,
1503
- message: a,
1535
+ title: r,
1536
+ message: i,
1504
1537
  defaultValue: s,
1505
- onConfirm: (d) => {
1506
- n === "prompt" ? l(d ?? "") : n === "confirm" ? l(!0) : l();
1538
+ onConfirm: (c) => {
1539
+ n === "prompt" ? a(c ?? "") : n === "confirm" ? a(!0) : a();
1507
1540
  },
1508
1541
  onCancel: () => {
1509
- n === "prompt" ? l(null) : n === "confirm" ? l(!1) : l();
1542
+ n === "prompt" ? a(null) : n === "confirm" ? a(!1) : a();
1510
1543
  }
1511
1544
  }
1512
1545
  );
1513
- }, Dt = [
1514
- { id: "light", label: "Light" },
1515
- { id: "dark", label: "Dark" },
1516
- { id: "gt", label: "GT" }
1517
- ], Et = ({
1518
- value: o,
1546
+ }, Vt = ae.map((t) => ({
1547
+ id: t.id,
1548
+ label: t.shortLabel
1549
+ })), qt = ({
1550
+ value: t,
1519
1551
  onChange: e,
1520
- options: n = Dt,
1521
- className: t,
1522
- "aria-label": a = "Theme"
1523
- }) => /* @__PURE__ */ r(
1552
+ options: n = Vt,
1553
+ className: r,
1554
+ "aria-label": i = "Theme"
1555
+ }) => /* @__PURE__ */ o(
1524
1556
  "div",
1525
1557
  {
1526
1558
  role: "radiogroup",
1527
- "aria-label": a,
1528
- className: S(
1559
+ "aria-label": i,
1560
+ className: D(
1529
1561
  "flex items-center border border-border rounded-lg p-0.5 bg-secondary/80 select-none",
1530
- t
1562
+ r
1531
1563
  ),
1532
- children: n.map((s) => /* @__PURE__ */ r(
1564
+ children: n.map((s) => /* @__PURE__ */ o(
1533
1565
  "button",
1534
1566
  {
1535
1567
  role: "radio",
1536
- "aria-checked": o === s.id,
1568
+ "aria-checked": t === s.id,
1537
1569
  onClick: () => e(s.id),
1538
- className: S(
1570
+ className: D(
1539
1571
  "px-2.5 py-1 text-[9px] font-extrabold uppercase rounded-md transition-all font-mono cursor-pointer outline-none focus-visible:ring-1 focus-visible:ring-ring",
1540
- o === s.id ? "bg-primary text-primary-foreground shadow" : "text-muted-foreground hover:bg-accent hover:text-foreground"
1572
+ t === s.id ? "bg-primary text-primary-foreground shadow" : "text-muted-foreground hover:bg-accent hover:text-foreground"
1541
1573
  ),
1542
1574
  children: s.label
1543
1575
  },
1544
1576
  s.id
1545
1577
  ))
1546
1578
  }
1547
- ), Yt = (o) => {
1548
- const e = Y((t) => t.theme), n = Y((t) => t.setTheme);
1549
- return /* @__PURE__ */ r(Et, { ...o, value: e, onChange: n });
1550
- }, It = ({
1551
- profile: o,
1579
+ ), Ir = (t) => {
1580
+ const e = te((r) => r.theme), n = te((r) => r.setTheme);
1581
+ return /* @__PURE__ */ o(qt, { ...t, value: e, onChange: n });
1582
+ }, Qt = ({
1583
+ profile: t,
1552
1584
  actions: e = [],
1553
1585
  onProfileChange: n,
1554
- onAvatarChange: t,
1555
- onClick: a,
1586
+ onAvatarChange: r,
1587
+ onClick: i,
1556
1588
  showName: s = !0,
1557
- className: l
1589
+ className: a
1558
1590
  }) => {
1559
- const { name: u, role: i, email: d, avatarUrl: m } = o, [f, p] = A(!1), [N, k] = A(!1), [w, h] = A(u), [x, b] = A(i ?? ""), y = M(null), g = M(null);
1560
- O(() => {
1561
- f && (h(u), b(i ?? ""), k(!1));
1562
- }, [f, u, i]), O(() => {
1563
- if (!f) return;
1564
- const T = (P) => {
1565
- y.current && !y.current.contains(P.target) && p(!1);
1591
+ const { name: d, role: l, email: c, avatarUrl: h } = t, [g, m] = P(!1), [C, E] = P(!1), [w, y] = P(d), [b, x] = P(l ?? ""), N = F(null), u = F(null);
1592
+ z(() => {
1593
+ g && (y(d), x(l ?? ""), E(!1));
1594
+ }, [g, d, l]), z(() => {
1595
+ if (!g) return;
1596
+ const T = (O) => {
1597
+ N.current && !N.current.contains(O.target) && m(!1);
1566
1598
  };
1567
1599
  return document.addEventListener("mousedown", T), () => document.removeEventListener("mousedown", T);
1568
- }, [f]);
1569
- const C = (T) => {
1570
- T.preventDefault(), n == null || n({ name: w, role: x }), k(!1);
1571
- }, E = (T) => {
1572
- var v;
1573
- const P = (v = T.target.files) == null ? void 0 : v[0];
1574
- P && (t == null || t(P)), T.target.value = "";
1575
- }, L = (T) => m ? /* @__PURE__ */ r("img", { src: m, alt: u, className: "w-full h-full object-cover" }) : /* @__PURE__ */ r(xe, { size: T, className: "text-muted-foreground" });
1576
- return /* @__PURE__ */ c("div", { ref: y, className: "relative inline-block text-left", children: [
1577
- /* @__PURE__ */ c(
1600
+ }, [g]);
1601
+ const S = (T) => {
1602
+ T.preventDefault(), n == null || n({ name: w, role: b }), E(!1);
1603
+ }, L = (T) => {
1604
+ var p;
1605
+ const O = (p = T.target.files) == null ? void 0 : p[0];
1606
+ O && (r == null || r(O)), T.target.value = "";
1607
+ }, $ = (T) => h ? /* @__PURE__ */ o("img", { src: h, alt: d, className: "w-full h-full object-cover" }) : /* @__PURE__ */ o($e, { size: T, className: "text-muted-foreground" });
1608
+ return /* @__PURE__ */ f("div", { ref: N, className: "relative inline-block text-left", children: [
1609
+ /* @__PURE__ */ f(
1578
1610
  "button",
1579
1611
  {
1580
1612
  type: "button",
1581
- onClick: () => a ? a() : p((T) => !T),
1582
- "aria-haspopup": a ? void 0 : "menu",
1583
- "aria-expanded": a ? void 0 : f,
1613
+ onClick: () => i ? i() : m((T) => !T),
1614
+ "aria-haspopup": i ? void 0 : "menu",
1615
+ "aria-expanded": i ? void 0 : g,
1584
1616
  "aria-label": "User Profile Menu",
1585
- className: S(
1617
+ className: D(
1586
1618
  "focus-visible:ring-2 focus-visible:ring-ring focus-visible:outline-none transition-all duration-200 select-none",
1587
1619
  s ? "flex items-center space-x-2 px-2 py-1 rounded-md hover:bg-accent/50 hover:text-accent-foreground text-left cursor-pointer border border-transparent hover:border-border/30" : "w-7 h-7 rounded-full bg-secondary/80 border border-border flex items-center justify-center text-muted-foreground hover:text-foreground hover:bg-secondary cursor-pointer",
1588
- f && (s ? "bg-accent/60 border-border/40" : "border-primary/50 text-foreground ring-1 ring-primary/20"),
1589
- l
1620
+ g && (s ? "bg-accent/60 border-border/40" : "border-primary/50 text-foreground ring-1 ring-primary/20"),
1621
+ a
1590
1622
  ),
1591
1623
  children: [
1592
- /* @__PURE__ */ r(
1624
+ /* @__PURE__ */ o(
1593
1625
  "div",
1594
1626
  {
1595
- className: S(
1627
+ className: D(
1596
1628
  "rounded-full overflow-hidden border border-border/50 bg-muted flex items-center justify-center shrink-0 shadow-sm",
1597
1629
  s ? "w-6 h-6" : "w-full h-full"
1598
1630
  ),
1599
- children: L(s ? 13 : 12)
1631
+ children: $(s ? 13 : 12)
1600
1632
  }
1601
1633
  ),
1602
- s && /* @__PURE__ */ c("div", { className: "flex flex-col min-w-0 leading-tight pr-1", children: [
1603
- /* @__PURE__ */ r("span", { className: "text-[11px] font-semibold truncate text-foreground", children: u }),
1604
- i && /* @__PURE__ */ r("span", { className: "text-[9px] text-muted-foreground/80 truncate font-medium", children: i })
1634
+ s && /* @__PURE__ */ f("div", { className: "flex flex-col min-w-0 leading-tight pr-1", children: [
1635
+ /* @__PURE__ */ o("span", { className: "text-[11px] font-semibold truncate text-foreground", children: d }),
1636
+ l && /* @__PURE__ */ o("span", { className: "text-[9px] text-muted-foreground/80 truncate font-medium", children: l })
1605
1637
  ] })
1606
1638
  ]
1607
1639
  }
1608
1640
  ),
1609
- t && /* @__PURE__ */ r(
1641
+ r && /* @__PURE__ */ o(
1610
1642
  "input",
1611
1643
  {
1612
1644
  type: "file",
1613
- ref: g,
1614
- onChange: E,
1645
+ ref: u,
1646
+ onChange: L,
1615
1647
  accept: "image/*",
1616
1648
  "aria-label": "Upload avatar",
1617
1649
  className: "hidden"
1618
1650
  }
1619
1651
  ),
1620
- f && /* @__PURE__ */ r(
1652
+ g && /* @__PURE__ */ o(
1621
1653
  "div",
1622
1654
  {
1623
1655
  role: "menu",
1624
- className: S(
1656
+ className: D(
1625
1657
  "absolute z-50 w-64 rounded-lg border border-border/50 bg-card text-card-foreground shadow-lg backdrop-blur-md p-2 flex flex-col gap-1 mt-1.5 animate-in fade-in slide-in-from-top-2 duration-150 origin-top-right",
1626
1658
  s ? "left-0" : "right-0"
1627
1659
  ),
1628
- children: N ? /* @__PURE__ */ c("form", { onSubmit: C, className: "p-2 flex flex-col gap-2", children: [
1629
- /* @__PURE__ */ r("span", { className: "text-[10px] font-bold uppercase tracking-wider text-muted-foreground", children: "Edit Profile" }),
1630
- /* @__PURE__ */ c("div", { className: "flex flex-col gap-1", children: [
1631
- /* @__PURE__ */ r("label", { htmlFor: "profile-name", className: "text-[9px] font-semibold text-muted-foreground", children: "Name" }),
1632
- /* @__PURE__ */ r(
1660
+ children: C ? /* @__PURE__ */ f("form", { onSubmit: S, className: "p-2 flex flex-col gap-2", children: [
1661
+ /* @__PURE__ */ o("span", { className: "text-[10px] font-bold uppercase tracking-wider text-muted-foreground", children: "Edit Profile" }),
1662
+ /* @__PURE__ */ f("div", { className: "flex flex-col gap-1", children: [
1663
+ /* @__PURE__ */ o("label", { htmlFor: "profile-name", className: "text-[9px] font-semibold text-muted-foreground", children: "Name" }),
1664
+ /* @__PURE__ */ o(
1633
1665
  "input",
1634
1666
  {
1635
1667
  id: "profile-name",
1636
1668
  type: "text",
1637
1669
  value: w,
1638
- onChange: (T) => h(T.target.value),
1670
+ onChange: (T) => y(T.target.value),
1639
1671
  required: !0,
1640
1672
  className: "w-full px-2 py-1 text-xs border rounded bg-background focus:ring-1 focus:ring-primary focus:outline-none"
1641
1673
  }
1642
1674
  )
1643
1675
  ] }),
1644
- /* @__PURE__ */ c("div", { className: "flex flex-col gap-1", children: [
1645
- /* @__PURE__ */ r("label", { htmlFor: "profile-role", className: "text-[9px] font-semibold text-muted-foreground", children: "Role" }),
1646
- /* @__PURE__ */ r(
1676
+ /* @__PURE__ */ f("div", { className: "flex flex-col gap-1", children: [
1677
+ /* @__PURE__ */ o("label", { htmlFor: "profile-role", className: "text-[9px] font-semibold text-muted-foreground", children: "Role" }),
1678
+ /* @__PURE__ */ o(
1647
1679
  "input",
1648
1680
  {
1649
1681
  id: "profile-role",
1650
1682
  type: "text",
1651
- value: x,
1652
- onChange: (T) => b(T.target.value),
1683
+ value: b,
1684
+ onChange: (T) => x(T.target.value),
1653
1685
  className: "w-full px-2 py-1 text-xs border rounded bg-background focus:ring-1 focus:ring-primary focus:outline-none"
1654
1686
  }
1655
1687
  )
1656
1688
  ] }),
1657
- /* @__PURE__ */ c("div", { className: "flex gap-1.5 mt-1 justify-end", children: [
1658
- /* @__PURE__ */ c(
1689
+ /* @__PURE__ */ f("div", { className: "flex gap-1.5 mt-1 justify-end", children: [
1690
+ /* @__PURE__ */ f(
1659
1691
  "button",
1660
1692
  {
1661
1693
  type: "button",
1662
- onClick: () => k(!1),
1694
+ onClick: () => E(!1),
1663
1695
  className: "px-2 py-1 text-[10px] rounded hover:bg-accent text-muted-foreground flex items-center gap-1 border border-border/30",
1664
1696
  children: [
1665
- /* @__PURE__ */ r(B, { size: 10 }),
1697
+ /* @__PURE__ */ o(J, { size: 10 }),
1666
1698
  " Cancel"
1667
1699
  ]
1668
1700
  }
1669
1701
  ),
1670
- /* @__PURE__ */ c(
1702
+ /* @__PURE__ */ f(
1671
1703
  "button",
1672
1704
  {
1673
1705
  type: "submit",
1674
1706
  className: "px-2 py-1 text-[10px] rounded bg-primary text-primary-foreground hover:bg-primary/95 flex items-center gap-1 font-semibold",
1675
1707
  children: [
1676
- /* @__PURE__ */ r(Fe, { size: 10 }),
1708
+ /* @__PURE__ */ o(at, { size: 10 }),
1677
1709
  " Save"
1678
1710
  ]
1679
1711
  }
1680
1712
  )
1681
1713
  ] })
1682
- ] }) : /* @__PURE__ */ c(he, { children: [
1683
- /* @__PURE__ */ c("div", { className: "p-2 flex items-center gap-3 border-b border-border/40 pb-2.5 mb-1", children: [
1684
- /* @__PURE__ */ c(
1714
+ ] }) : /* @__PURE__ */ f(Le, { children: [
1715
+ /* @__PURE__ */ f("div", { className: "p-2 flex items-center gap-3 border-b border-border/40 pb-2.5 mb-1", children: [
1716
+ /* @__PURE__ */ f(
1685
1717
  "div",
1686
1718
  {
1687
1719
  onClick: () => {
1688
1720
  var T;
1689
- return t && ((T = g.current) == null ? void 0 : T.click());
1721
+ return r && ((T = u.current) == null ? void 0 : T.click());
1690
1722
  },
1691
- title: t ? "Upload avatar image" : void 0,
1692
- className: S(
1723
+ title: r ? "Upload avatar image" : void 0,
1724
+ className: D(
1693
1725
  "group relative w-12 h-12 rounded-full overflow-hidden border border-border/80 bg-muted flex items-center justify-center shrink-0 shadow-inner",
1694
- t && "cursor-pointer"
1726
+ r && "cursor-pointer"
1695
1727
  ),
1696
1728
  children: [
1697
- L(24),
1698
- t && /* @__PURE__ */ r("div", { className: "absolute inset-0 bg-black/40 opacity-0 group-hover:opacity-100 flex items-center justify-center transition-opacity", children: /* @__PURE__ */ r(Ue, { size: 14, className: "text-white" }) })
1729
+ $(24),
1730
+ r && /* @__PURE__ */ o("div", { className: "absolute inset-0 bg-black/40 opacity-0 group-hover:opacity-100 flex items-center justify-center transition-opacity", children: /* @__PURE__ */ o(it, { size: 14, className: "text-white" }) })
1699
1731
  ]
1700
1732
  }
1701
1733
  ),
1702
- /* @__PURE__ */ c("div", { className: "flex flex-col min-w-0 leading-normal flex-1", children: [
1703
- /* @__PURE__ */ c("div", { className: "flex items-center gap-1", children: [
1704
- /* @__PURE__ */ r("span", { className: "text-xs font-bold truncate text-foreground", children: u }),
1705
- n && /* @__PURE__ */ r(
1734
+ /* @__PURE__ */ f("div", { className: "flex flex-col min-w-0 leading-normal flex-1", children: [
1735
+ /* @__PURE__ */ f("div", { className: "flex items-center gap-1", children: [
1736
+ /* @__PURE__ */ o("span", { className: "text-xs font-bold truncate text-foreground", children: d }),
1737
+ n && /* @__PURE__ */ o(
1706
1738
  "button",
1707
1739
  {
1708
1740
  type: "button",
1709
- onClick: () => k(!0),
1741
+ onClick: () => E(!0),
1710
1742
  title: "Edit Profile",
1711
1743
  "aria-label": "Edit Profile",
1712
1744
  className: "p-1 text-muted-foreground hover:text-foreground hover:bg-accent/40 rounded transition-colors",
1713
- children: /* @__PURE__ */ r(_e, { size: 10 })
1745
+ children: /* @__PURE__ */ o(lt, { size: 10 })
1714
1746
  }
1715
1747
  )
1716
1748
  ] }),
1717
- i && /* @__PURE__ */ r("span", { className: "text-[10px] text-muted-foreground/80 truncate font-semibold", children: i }),
1718
- d && /* @__PURE__ */ r("span", { className: "text-[9px] text-muted-foreground/60 truncate font-mono mt-0.5", children: d })
1749
+ l && /* @__PURE__ */ o("span", { className: "text-[10px] text-muted-foreground/80 truncate font-semibold", children: l }),
1750
+ c && /* @__PURE__ */ o("span", { className: "text-[9px] text-muted-foreground/60 truncate font-mono mt-0.5", children: c })
1719
1751
  ] })
1720
1752
  ] }),
1721
1753
  e.map((T) => {
1722
- const P = T.icon;
1723
- return /* @__PURE__ */ c(
1754
+ const O = T.icon;
1755
+ return /* @__PURE__ */ f(
1724
1756
  "button",
1725
1757
  {
1726
1758
  type: "button",
1727
1759
  role: "menuitem",
1728
1760
  onClick: () => {
1729
- T.onSelect(), p(!1);
1761
+ T.onSelect(), m(!1);
1730
1762
  },
1731
- className: S(
1763
+ className: D(
1732
1764
  "w-full px-2 py-1.5 text-left rounded-md text-[11px] font-medium flex items-center gap-2 cursor-pointer transition-colors",
1733
1765
  T.destructive ? "text-destructive hover:bg-destructive/10" : "hover:bg-accent/60 hover:text-accent-foreground",
1734
1766
  T.divider && "border-t border-border/20 pt-2 mt-1"
1735
1767
  ),
1736
1768
  children: [
1737
- P && /* @__PURE__ */ r(P, { size: 12, className: "opacity-70" }),
1769
+ O && /* @__PURE__ */ o(O, { size: 12, className: "opacity-70" }),
1738
1770
  T.label
1739
1771
  ]
1740
1772
  },
@@ -1745,661 +1777,1353 @@ const Nt = (o, e) => {
1745
1777
  }
1746
1778
  )
1747
1779
  ] });
1748
- }, qt = (o) => {
1749
- const e = H((d) => d.name), n = H((d) => d.role), t = H((d) => d.email), a = H((d) => d.avatarUrl), s = H((d) => d.customAvatar), l = H((d) => d.updateProfile), u = H((d) => d.setCustomAvatar);
1750
- return /* @__PURE__ */ r(
1751
- It,
1780
+ }, Lr = (t) => {
1781
+ const e = V((c) => c.name), n = V((c) => c.role), r = V((c) => c.email), i = V((c) => c.avatarUrl), s = V((c) => c.customAvatar), a = V((c) => c.updateProfile), d = V((c) => c.setCustomAvatar);
1782
+ return /* @__PURE__ */ o(
1783
+ Qt,
1752
1784
  {
1753
- ...o,
1754
- profile: { name: e, role: n, email: t, avatarUrl: s || a },
1755
- onProfileChange: l,
1756
- onAvatarChange: (d) => {
1757
- const m = new FileReader();
1758
- m.onloadend = () => {
1759
- typeof m.result == "string" && u(m.result);
1760
- }, m.readAsDataURL(d);
1785
+ ...t,
1786
+ profile: { name: e, role: n, email: r, avatarUrl: s || i },
1787
+ onProfileChange: a,
1788
+ onAvatarChange: (c) => {
1789
+ const h = new FileReader();
1790
+ h.onloadend = () => {
1791
+ typeof h.result == "string" && d(h.result);
1792
+ }, h.readAsDataURL(c);
1761
1793
  }
1762
1794
  }
1763
1795
  );
1764
- }, Qt = ({ title: o, subtitle: e, icon: n, className: t }) => /* @__PURE__ */ c("div", { className: S("flex items-center space-x-3 select-none", t), children: [
1765
- n && /* @__PURE__ */ r("div", { className: "w-8 h-8 rounded-lg bg-primary/10 border border-primary/30 flex items-center justify-center text-primary shadow-inner shrink-0", children: n }),
1766
- /* @__PURE__ */ c("div", { className: "min-w-0", children: [
1767
- /* @__PURE__ */ r("h1", { className: "text-xs font-black uppercase tracking-wider text-foreground font-mono truncate", children: o }),
1768
- e && /* @__PURE__ */ r("p", { className: "text-[9px] text-muted-foreground font-semibold truncate", children: e })
1796
+ }, Or = ({ title: t, subtitle: e, icon: n, className: r }) => /* @__PURE__ */ f("div", { className: D("flex items-center space-x-3 select-none", r), children: [
1797
+ n && /* @__PURE__ */ o("div", { className: "w-8 h-8 rounded-lg bg-primary/10 border border-primary/30 flex items-center justify-center text-primary shadow-inner shrink-0", children: n }),
1798
+ /* @__PURE__ */ f("div", { className: "min-w-0", children: [
1799
+ /* @__PURE__ */ o("h1", { className: "text-xs font-black uppercase tracking-wider text-foreground font-mono truncate", children: t }),
1800
+ e && /* @__PURE__ */ o("p", { className: "text-[9px] text-muted-foreground font-semibold truncate", children: e })
1769
1801
  ] })
1770
- ] }), Ot = ({ x: o, y: e, items: n, onClose: t, className: a }) => {
1771
- const s = M(null);
1772
- return O(() => {
1773
- const l = (i) => {
1774
- s.current && !s.current.contains(i.target) && t();
1775
- }, u = (i) => {
1776
- i.key === "Escape" && t();
1802
+ ] }), Zt = ({ x: t, y: e, items: n, onClose: r, className: i }) => {
1803
+ const s = F(null);
1804
+ return z(() => {
1805
+ const a = (l) => {
1806
+ s.current && !s.current.contains(l.target) && r();
1807
+ }, d = (l) => {
1808
+ l.key === "Escape" && r();
1777
1809
  };
1778
- return document.addEventListener("mousedown", l), document.addEventListener("keydown", u), () => {
1779
- document.removeEventListener("mousedown", l), document.removeEventListener("keydown", u);
1810
+ return document.addEventListener("mousedown", a), document.addEventListener("keydown", d), () => {
1811
+ document.removeEventListener("mousedown", a), document.removeEventListener("keydown", d);
1780
1812
  };
1781
- }, [t]), /* @__PURE__ */ r(
1813
+ }, [r]), /* @__PURE__ */ o(
1782
1814
  "div",
1783
1815
  {
1784
1816
  ref: s,
1785
1817
  role: "menu",
1786
- style: { top: e, left: o },
1787
- className: S(
1818
+ style: { top: e, left: t },
1819
+ className: D(
1788
1820
  "fixed z-[1000] min-w-[160px] bg-popover text-popover-foreground border shadow-md rounded-md py-1 animate-in fade-in zoom-in-95 duration-100",
1789
- a
1821
+ i
1790
1822
  ),
1791
- children: n.map((l, u) => /* @__PURE__ */ c(se.Fragment, { children: [
1792
- l.divider && /* @__PURE__ */ r("div", { className: "h-[1px] bg-border my-1" }),
1793
- /* @__PURE__ */ c(
1823
+ children: n.map((a, d) => /* @__PURE__ */ f(ge.Fragment, { children: [
1824
+ a.divider && /* @__PURE__ */ o("div", { className: "h-[1px] bg-border my-1" }),
1825
+ /* @__PURE__ */ f(
1794
1826
  "div",
1795
1827
  {
1796
1828
  role: "menuitem",
1797
- tabIndex: l.disabled ? void 0 : 0,
1798
- "aria-disabled": l.disabled,
1829
+ tabIndex: a.disabled ? void 0 : 0,
1830
+ "aria-disabled": a.disabled,
1799
1831
  onClick: () => {
1800
- l.disabled || (l.onClick(), t());
1832
+ a.disabled || (a.onClick(), r());
1801
1833
  },
1802
- onKeyDown: (i) => {
1803
- l.disabled || i.key !== "Enter" && i.key !== " " || (i.preventDefault(), l.onClick(), t());
1834
+ onKeyDown: (l) => {
1835
+ a.disabled || l.key !== "Enter" && l.key !== " " || (l.preventDefault(), a.onClick(), r());
1804
1836
  },
1805
- className: S(
1837
+ className: D(
1806
1838
  "px-3 py-1.5 text-xs flex items-center focus:outline-none",
1807
- l.disabled ? "opacity-40 cursor-default" : "cursor-pointer hover:bg-accent hover:text-accent-foreground focus:bg-accent"
1839
+ a.disabled ? "opacity-40 cursor-default" : "cursor-pointer hover:bg-accent hover:text-accent-foreground focus:bg-accent"
1808
1840
  ),
1809
1841
  children: [
1810
- l.icon && /* @__PURE__ */ r("span", { className: "mr-2 opacity-70", children: l.icon }),
1811
- /* @__PURE__ */ r("span", { children: l.label })
1842
+ a.icon && /* @__PURE__ */ o("span", { className: "mr-2 opacity-70", children: a.icon }),
1843
+ /* @__PURE__ */ o("span", { children: a.label })
1812
1844
  ]
1813
1845
  }
1814
1846
  )
1815
- ] }, `${l.label}-${u}`))
1847
+ ] }, `${a.label}-${d}`))
1816
1848
  }
1817
1849
  );
1818
- }, Xt = ({
1819
- columns: o,
1850
+ }, $r = ({
1851
+ columns: t,
1820
1852
  data: e,
1821
1853
  onRowClick: n,
1822
- selectedRowId: t,
1823
- rowKey: a = "id",
1854
+ selectedRowId: r,
1855
+ rowKey: i = "id",
1824
1856
  virtualized: s = !0,
1825
- showFilter: l = !0,
1826
- loading: u = !1,
1827
- placeholder: i = "No data available",
1828
- className: d
1857
+ showFilter: a = !0,
1858
+ loading: d = !1,
1859
+ placeholder: l = "No data available",
1860
+ className: c
1829
1861
  }) => {
1830
- const [m, f] = A(""), [p, N] = A(null), [k, w] = A(-1), h = M(null);
1831
- O(() => {
1862
+ const [h, g] = P(""), [m, C] = P(null), [E, w] = P(-1), y = F(null);
1863
+ z(() => {
1832
1864
  w(-1);
1833
- }, [m, p]);
1834
- const x = j(() => {
1835
- if (!m) return e;
1836
- const v = m.toLowerCase();
1837
- return e.filter((D) => Object.values(D).some((I) => I == null ? !1 : String(I).toLowerCase().includes(v)));
1838
- }, [e, m]), b = j(() => {
1839
- if (!p) return x;
1840
- const { key: v, direction: D } = p;
1841
- return [...x].sort((I, $) => {
1842
- const R = I[v], z = $[v];
1843
- if (R === z) return 0;
1865
+ }, [h, m]);
1866
+ const b = H(() => {
1867
+ if (!h) return e;
1868
+ const p = h.toLowerCase();
1869
+ return e.filter((k) => Object.values(k).some((I) => I == null ? !1 : String(I).toLowerCase().includes(p)));
1870
+ }, [e, h]), x = H(() => {
1871
+ if (!m) return b;
1872
+ const { key: p, direction: k } = m;
1873
+ return [...b].sort((I, _) => {
1874
+ const R = I[p], K = _[p];
1875
+ if (R === K) return 0;
1844
1876
  if (R == null) return 1;
1845
- if (z == null) return -1;
1846
- const Z = Number(R), ee = Number(z);
1847
- if (!isNaN(Z) && !isNaN(ee))
1848
- return D === "asc" ? Z - ee : ee - Z;
1849
- const de = String(R).toLowerCase(), ce = String(z).toLowerCase();
1850
- return D === "asc" ? de.localeCompare(ce) : ce.localeCompare(de);
1877
+ if (K == null) return -1;
1878
+ const v = Number(R), A = Number(K);
1879
+ if (!isNaN(v) && !isNaN(A))
1880
+ return k === "asc" ? v - A : A - v;
1881
+ const M = String(R).toLowerCase(), U = String(K).toLowerCase();
1882
+ return k === "asc" ? M.localeCompare(U) : U.localeCompare(M);
1851
1883
  });
1852
- }, [x, p]), y = (v, D) => {
1853
- D !== !1 && N((I) => !I || I.key !== v ? { key: v, direction: "asc" } : I.direction === "asc" ? { key: v, direction: "desc" } : null);
1854
- }, g = (v) => {
1855
- if (!(b.length === 0 || u)) {
1856
- if (v.key === "ArrowDown")
1857
- v.preventDefault(), w((D) => {
1858
- const I = D + 1;
1859
- return I >= b.length ? 0 : I;
1884
+ }, [b, m]), N = (p, k) => {
1885
+ k !== !1 && C((I) => !I || I.key !== p ? { key: p, direction: "asc" } : I.direction === "asc" ? { key: p, direction: "desc" } : null);
1886
+ }, u = (p) => {
1887
+ if (!(x.length === 0 || d)) {
1888
+ if (p.key === "ArrowDown")
1889
+ p.preventDefault(), w((k) => {
1890
+ const I = k + 1;
1891
+ return I >= x.length ? 0 : I;
1860
1892
  });
1861
- else if (v.key === "ArrowUp")
1862
- v.preventDefault(), w((D) => {
1863
- const I = D - 1;
1864
- return I < 0 ? b.length - 1 : I;
1893
+ else if (p.key === "ArrowUp")
1894
+ p.preventDefault(), w((k) => {
1895
+ const I = k - 1;
1896
+ return I < 0 ? x.length - 1 : I;
1865
1897
  });
1866
- else if ((v.key === "Enter" || v.key === " ") && (v.preventDefault(), k >= 0 && k < b.length)) {
1867
- const D = b[k];
1868
- n && n(D);
1898
+ else if ((p.key === "Enter" || p.key === " ") && (p.preventDefault(), E >= 0 && E < x.length)) {
1899
+ const k = x[E];
1900
+ n && n(k);
1869
1901
  }
1870
1902
  }
1871
- }, C = (v) => v.sortable === !1 ? null : (p == null ? void 0 : p.key) !== v.key ? /* @__PURE__ */ r(Be, { size: 14, className: "text-muted-foreground/60 ml-1.5 opacity-0 group-hover:opacity-100 transition-opacity" }) : p.direction === "asc" ? /* @__PURE__ */ r(we, { size: 14, className: "text-primary ml-1.5" }) : /* @__PURE__ */ r(ke, { size: 14, className: "text-primary ml-1.5" }), E = () => /* @__PURE__ */ r("tr", { role: "row", className: "border-b border-border bg-muted/30 select-none", children: o.map((v) => /* @__PURE__ */ r(
1903
+ }, S = (p) => p.sortable === !1 ? null : (m == null ? void 0 : m.key) !== p.key ? /* @__PURE__ */ o(ct, { size: 14, className: "text-muted-foreground/60 ml-1.5 opacity-0 group-hover:opacity-100 transition-opacity" }) : m.direction === "asc" ? /* @__PURE__ */ o(Pe, { size: 14, className: "text-primary ml-1.5" }) : /* @__PURE__ */ o(Re, { size: 14, className: "text-primary ml-1.5" }), L = () => /* @__PURE__ */ o("tr", { role: "row", className: "border-b border-border bg-muted/30 select-none", children: t.map((p) => /* @__PURE__ */ o(
1872
1904
  "th",
1873
1905
  {
1874
1906
  role: "columnheader",
1875
- "aria-sort": (p == null ? void 0 : p.key) === v.key ? p.direction === "asc" ? "ascending" : "descending" : "none",
1876
- className: S(
1907
+ "aria-sort": (m == null ? void 0 : m.key) === p.key ? m.direction === "asc" ? "ascending" : "descending" : "none",
1908
+ className: D(
1877
1909
  "p-3 text-xs font-semibold text-muted-foreground uppercase tracking-wider text-left transition-colors",
1878
- v.sortable !== !1 && "cursor-pointer hover:bg-accent/30 hover:text-foreground group"
1910
+ p.sortable !== !1 && "cursor-pointer hover:bg-accent/30 hover:text-foreground group"
1879
1911
  ),
1880
- style: { width: v.width },
1881
- onClick: () => y(v.key, v.sortable),
1882
- children: /* @__PURE__ */ c("div", { className: "flex items-center", children: [
1883
- /* @__PURE__ */ r("span", { children: v.header }),
1884
- C(v)
1912
+ style: { width: p.width },
1913
+ onClick: () => N(p.key, p.sortable),
1914
+ children: /* @__PURE__ */ f("div", { className: "flex items-center", children: [
1915
+ /* @__PURE__ */ o("span", { children: p.header }),
1916
+ S(p)
1885
1917
  ] })
1886
1918
  },
1887
- v.key
1888
- )) }), L = (v, D) => {
1889
- const I = t !== void 0 && v[a] === t;
1890
- return /* @__PURE__ */ r(
1919
+ p.key
1920
+ )) }), $ = (p, k) => {
1921
+ const I = r !== void 0 && p[i] === r;
1922
+ return /* @__PURE__ */ o(
1891
1923
  "tr",
1892
1924
  {
1893
1925
  role: "row",
1894
1926
  "aria-selected": I,
1895
- onClick: () => n && n(v),
1896
- className: S(
1927
+ onClick: () => n && n(p),
1928
+ className: D(
1897
1929
  "border-b border-border/40 hover:bg-accent/40 transition-colors cursor-pointer text-sm outline-none",
1898
1930
  I && "bg-primary/10 text-primary hover:bg-primary/15 font-medium border-l-2 border-l-primary",
1899
- k === D && "bg-accent/60 ring-1 ring-inset ring-ring"
1931
+ E === k && "bg-accent/60 ring-1 ring-inset ring-ring"
1900
1932
  ),
1901
- children: o.map((R) => {
1902
- const z = v[R.key];
1903
- return /* @__PURE__ */ r("td", { role: "gridcell", className: "p-3 align-middle truncate max-w-xs", children: R.render ? R.render(z, v) : z != null ? String(z) : "" }, R.key);
1933
+ children: t.map((R) => {
1934
+ const K = p[R.key];
1935
+ return /* @__PURE__ */ o("td", { role: "gridcell", className: "p-3 align-middle truncate max-w-xs", children: R.render ? R.render(K, p) : K != null ? String(K) : "" }, R.key);
1904
1936
  })
1905
1937
  },
1906
- String(v[a] || D)
1938
+ String(p[i] || k)
1907
1939
  );
1908
- }, T = j(() => ({
1909
- Table: (v) => /* @__PURE__ */ r(
1940
+ }, T = H(() => ({
1941
+ Table: (p) => /* @__PURE__ */ o(
1910
1942
  "table",
1911
1943
  {
1912
- ...v,
1944
+ ...p,
1913
1945
  role: "grid",
1914
1946
  className: "w-full border-collapse text-left bg-background text-foreground"
1915
1947
  }
1916
1948
  ),
1917
- TableHead: se.forwardRef((v, D) => /* @__PURE__ */ r("thead", { ref: D, ...v, className: "sticky top-0 bg-background z-10 shadow-[0_1px_0_0_rgba(0,0,0,0.1)] dark:shadow-[0_1px_0_0_rgba(255,255,255,0.05)]" })),
1918
- TableBody: se.forwardRef((v, D) => /* @__PURE__ */ r("tbody", { ref: D, ...v })),
1919
- TableRow: ({ item: v, context: D, ...I }) => {
1920
- if (!D || !v) return /* @__PURE__ */ r("tr", { ...I });
1921
- const $ = D.selectedRowId !== void 0 && v[D.rowKey] === D.selectedRowId, R = D.focusedIndex === I["data-index"];
1922
- return /* @__PURE__ */ r(
1949
+ TableHead: ge.forwardRef((p, k) => /* @__PURE__ */ o("thead", { ref: k, ...p, className: "sticky top-0 bg-background z-10 shadow-[0_1px_0_0_rgba(0,0,0,0.1)] dark:shadow-[0_1px_0_0_rgba(255,255,255,0.05)]" })),
1950
+ TableBody: ge.forwardRef((p, k) => /* @__PURE__ */ o("tbody", { ref: k, ...p })),
1951
+ TableRow: ({ item: p, context: k, ...I }) => {
1952
+ if (!k || !p) return /* @__PURE__ */ o("tr", { ...I });
1953
+ const _ = k.selectedRowId !== void 0 && p[k.rowKey] === k.selectedRowId, R = k.focusedIndex === I["data-index"];
1954
+ return /* @__PURE__ */ o(
1923
1955
  "tr",
1924
1956
  {
1925
1957
  ...I,
1926
1958
  onClick: () => {
1927
- var z;
1928
- return (z = D.onRowClick) == null ? void 0 : z.call(D, v);
1959
+ var K;
1960
+ return (K = k.onRowClick) == null ? void 0 : K.call(k, p);
1929
1961
  },
1930
- className: S(
1962
+ className: D(
1931
1963
  "border-b border-border/40 hover:bg-accent/40 transition-colors cursor-pointer text-sm outline-none",
1932
- $ && "bg-primary/10 text-primary hover:bg-primary/15 font-medium border-l-2 border-l-primary",
1964
+ _ && "bg-primary/10 text-primary hover:bg-primary/15 font-medium border-l-2 border-l-primary",
1933
1965
  R && "bg-accent/60 ring-1 ring-inset ring-ring"
1934
1966
  )
1935
1967
  }
1936
1968
  );
1937
1969
  }
1938
- }), []), P = () => u ? /* @__PURE__ */ c("div", { className: "flex flex-col items-center justify-center h-64 space-y-3", children: [
1939
- /* @__PURE__ */ r(Ne, { className: "animate-spin text-primary", size: 24 }),
1940
- /* @__PURE__ */ r("span", { className: "text-xs text-muted-foreground", children: "Loading dataset..." })
1941
- ] }) : b.length === 0 ? /* @__PURE__ */ c("div", { className: "flex flex-col items-center justify-center h-48 text-center px-4", children: [
1942
- /* @__PURE__ */ r("span", { className: "text-sm font-medium text-foreground", children: i }),
1943
- /* @__PURE__ */ r("span", { className: "text-xs text-muted-foreground mt-1", children: "No items matched your search query." })
1944
- ] }) : s ? /* @__PURE__ */ r("div", { className: "flex-1 min-h-[300px] h-full relative", children: /* @__PURE__ */ r(
1945
- Ge,
1970
+ }), []), O = () => d ? /* @__PURE__ */ f("div", { className: "flex flex-col items-center justify-center h-64 space-y-3", children: [
1971
+ /* @__PURE__ */ o(ze, { className: "animate-spin text-primary", size: 24 }),
1972
+ /* @__PURE__ */ o("span", { className: "text-xs text-muted-foreground", children: "Loading dataset..." })
1973
+ ] }) : x.length === 0 ? /* @__PURE__ */ f("div", { className: "flex flex-col items-center justify-center h-48 text-center px-4", children: [
1974
+ /* @__PURE__ */ o("span", { className: "text-sm font-medium text-foreground", children: l }),
1975
+ /* @__PURE__ */ o("span", { className: "text-xs text-muted-foreground mt-1", children: "No items matched your search query." })
1976
+ ] }) : s ? /* @__PURE__ */ o("div", { className: "flex-1 min-h-[300px] h-full relative", children: /* @__PURE__ */ o(
1977
+ mt,
1946
1978
  {
1947
- data: b,
1979
+ data: x,
1948
1980
  context: {
1949
- selectedRowId: t,
1950
- focusedIndex: k,
1951
- rowKey: a,
1981
+ selectedRowId: r,
1982
+ focusedIndex: E,
1983
+ rowKey: i,
1952
1984
  onRowClick: n
1953
1985
  },
1954
1986
  components: T,
1955
- fixedHeaderContent: E,
1956
- itemContent: (v, D) => /* @__PURE__ */ r(he, { children: o.map((I) => {
1957
- const $ = D[I.key];
1958
- return /* @__PURE__ */ r("td", { role: "gridcell", className: "p-3 align-middle truncate max-w-xs", children: I.render ? I.render($, D) : $ != null ? String($) : "" }, I.key);
1987
+ fixedHeaderContent: L,
1988
+ itemContent: (p, k) => /* @__PURE__ */ o(Le, { children: t.map((I) => {
1989
+ const _ = k[I.key];
1990
+ return /* @__PURE__ */ o("td", { role: "gridcell", className: "p-3 align-middle truncate max-w-xs", children: I.render ? I.render(_, k) : _ != null ? String(_) : "" }, I.key);
1959
1991
  }) })
1960
1992
  }
1961
- ) }) : /* @__PURE__ */ r("div", { className: "flex-1 overflow-auto", children: /* @__PURE__ */ c("table", { role: "grid", className: "w-full border-collapse text-left bg-background text-foreground", children: [
1962
- /* @__PURE__ */ r("thead", { children: E() }),
1963
- /* @__PURE__ */ r("tbody", { children: b.map((v, D) => L(v, D)) })
1993
+ ) }) : /* @__PURE__ */ o("div", { className: "flex-1 overflow-auto", children: /* @__PURE__ */ f("table", { role: "grid", className: "w-full border-collapse text-left bg-background text-foreground", children: [
1994
+ /* @__PURE__ */ o("thead", { children: L() }),
1995
+ /* @__PURE__ */ o("tbody", { children: x.map((p, k) => $(p, k)) })
1964
1996
  ] }) });
1965
- return /* @__PURE__ */ c(
1997
+ return /* @__PURE__ */ f(
1966
1998
  "div",
1967
1999
  {
1968
- ref: h,
2000
+ ref: y,
1969
2001
  role: "region",
1970
2002
  "aria-label": "Data Grid",
1971
2003
  tabIndex: 0,
1972
- onKeyDown: g,
1973
- className: S(
2004
+ onKeyDown: u,
2005
+ className: D(
1974
2006
  "flex flex-col h-full bg-background border border-border rounded-lg shadow-sm overflow-hidden focus:outline-none focus:ring-1 focus:ring-ring focus:border-transparent",
1975
- d
2007
+ c
1976
2008
  ),
1977
2009
  children: [
1978
- l && /* @__PURE__ */ c("div", { className: "flex items-center justify-between p-3 border-b border-border bg-muted/20", children: [
1979
- /* @__PURE__ */ c("div", { className: "relative flex-1 max-w-sm", children: [
1980
- /* @__PURE__ */ r(X, { size: 14, className: "absolute left-2.5 top-2.5 text-muted-foreground" }),
1981
- /* @__PURE__ */ r(
2010
+ a && /* @__PURE__ */ f("div", { className: "flex items-center justify-between p-3 border-b border-border bg-muted/20", children: [
2011
+ /* @__PURE__ */ f("div", { className: "relative flex-1 max-w-sm", children: [
2012
+ /* @__PURE__ */ o(de, { size: 14, className: "absolute left-2.5 top-2.5 text-muted-foreground" }),
2013
+ /* @__PURE__ */ o(
1982
2014
  "input",
1983
2015
  {
1984
2016
  type: "text",
1985
2017
  placeholder: "Filter table rows...",
1986
2018
  className: "w-full bg-secondary/40 border border-border rounded-md pl-8 pr-7 py-1.5 text-xs text-foreground placeholder:text-muted-foreground focus:outline-none focus:ring-1 focus:ring-primary focus:border-transparent transition-all",
1987
- value: m,
1988
- onChange: (v) => f(v.target.value)
2019
+ value: h,
2020
+ onChange: (p) => g(p.target.value)
1989
2021
  }
1990
2022
  ),
1991
- m && /* @__PURE__ */ r(
2023
+ h && /* @__PURE__ */ o(
1992
2024
  "button",
1993
2025
  {
1994
- onClick: () => f(""),
2026
+ onClick: () => g(""),
1995
2027
  className: "absolute right-2 top-2.5 text-muted-foreground hover:text-foreground",
1996
2028
  "aria-label": "Clear filter",
1997
- children: /* @__PURE__ */ r(B, { size: 12 })
2029
+ children: /* @__PURE__ */ o(J, { size: 12 })
1998
2030
  }
1999
2031
  )
2000
2032
  ] }),
2001
- /* @__PURE__ */ c("div", { className: "text-[11px] text-muted-foreground font-medium ml-4", children: [
2002
- b.length,
2033
+ /* @__PURE__ */ f("div", { className: "text-[11px] text-muted-foreground font-medium ml-4", children: [
2034
+ x.length,
2003
2035
  " of ",
2004
2036
  e.length,
2005
2037
  " records"
2006
2038
  ] })
2007
2039
  ] }),
2008
- P()
2040
+ O()
2009
2041
  ]
2010
2042
  }
2011
2043
  );
2012
- }, Zt = ({
2013
- results: o,
2044
+ }, Ar = ({
2045
+ results: t,
2014
2046
  onQueryChange: e,
2015
2047
  onSelect: n,
2016
- categories: t,
2017
- placeholder: a = "Search…",
2048
+ categories: r,
2049
+ placeholder: i = "Search…",
2018
2050
  debounceMs: s = 200,
2019
- className: l
2051
+ className: a
2020
2052
  }) => {
2021
- const [u, i] = A(""), [d, m] = A(!1), [f, p] = A(0), N = M(null), k = M(null), w = j(() => t || [...new Set(o.map((y) => y.category))], [t, o]), h = j(
2022
- () => w.flatMap((y) => o.filter((g) => g.category === y)),
2023
- [w, o]
2053
+ const [d, l] = P(""), [c, h] = P(!1), [g, m] = P(0), C = F(null), E = F(null), w = H(() => r || [...new Set(t.map((N) => N.category))], [r, t]), y = H(
2054
+ () => w.flatMap((N) => t.filter((u) => u.category === N)),
2055
+ [w, t]
2024
2056
  );
2025
- O(() => {
2026
- const y = (g) => {
2027
- N.current && !N.current.contains(g.target) && m(!1);
2057
+ z(() => {
2058
+ const N = (u) => {
2059
+ C.current && !C.current.contains(u.target) && h(!1);
2028
2060
  };
2029
- return document.addEventListener("mousedown", y), () => document.removeEventListener("mousedown", y);
2030
- }, []), O(() => {
2061
+ return document.addEventListener("mousedown", N), () => document.removeEventListener("mousedown", N);
2062
+ }, []), z(() => {
2031
2063
  if (!e) return;
2032
- const y = window.setTimeout(() => e(u), s);
2033
- return () => window.clearTimeout(y);
2034
- }, [u, s, e]), O(() => {
2035
- p(0);
2036
- }, [o]);
2037
- const x = (y) => {
2038
- n(y), m(!1), i("");
2039
- }, b = (y) => {
2040
- var g;
2041
- if (!d) {
2042
- (y.key === "ArrowDown" || y.key === "Enter") && m(!0);
2064
+ const N = window.setTimeout(() => e(d), s);
2065
+ return () => window.clearTimeout(N);
2066
+ }, [d, s, e]), z(() => {
2067
+ m(0);
2068
+ }, [t]);
2069
+ const b = (N) => {
2070
+ n(N), h(!1), l("");
2071
+ }, x = (N) => {
2072
+ var u;
2073
+ if (!c) {
2074
+ (N.key === "ArrowDown" || N.key === "Enter") && h(!0);
2043
2075
  return;
2044
2076
  }
2045
- y.key === "ArrowDown" ? (y.preventDefault(), p((C) => h.length ? (C + 1) % h.length : 0)) : y.key === "ArrowUp" ? (y.preventDefault(), p(
2046
- (C) => h.length ? (C - 1 + h.length) % h.length : 0
2047
- )) : y.key === "Enter" ? (y.preventDefault(), h[f] && x(h[f])) : y.key === "Escape" && (y.preventDefault(), m(!1), (g = k.current) == null || g.blur());
2077
+ N.key === "ArrowDown" ? (N.preventDefault(), m((S) => y.length ? (S + 1) % y.length : 0)) : N.key === "ArrowUp" ? (N.preventDefault(), m(
2078
+ (S) => y.length ? (S - 1 + y.length) % y.length : 0
2079
+ )) : N.key === "Enter" ? (N.preventDefault(), y[g] && b(y[g])) : N.key === "Escape" && (N.preventDefault(), h(!1), (u = E.current) == null || u.blur());
2048
2080
  };
2049
- return /* @__PURE__ */ c("div", { ref: N, className: S("relative w-full", l), children: [
2050
- /* @__PURE__ */ c("div", { className: "relative flex items-center", children: [
2051
- /* @__PURE__ */ r(
2052
- X,
2081
+ return /* @__PURE__ */ f("div", { ref: C, className: D("relative w-full", a), children: [
2082
+ /* @__PURE__ */ f("div", { className: "relative flex items-center", children: [
2083
+ /* @__PURE__ */ o(
2084
+ de,
2053
2085
  {
2054
2086
  size: 13,
2055
2087
  className: "absolute left-2.5 top-1/2 -translate-y-1/2 text-muted-foreground"
2056
2088
  }
2057
2089
  ),
2058
- /* @__PURE__ */ r(
2090
+ /* @__PURE__ */ o(
2059
2091
  "input",
2060
2092
  {
2061
- ref: k,
2093
+ ref: E,
2062
2094
  type: "text",
2063
2095
  role: "combobox",
2064
- "aria-expanded": d,
2065
- "aria-label": a,
2066
- value: u,
2067
- placeholder: a,
2068
- onChange: (y) => {
2069
- i(y.target.value), m(!0);
2096
+ "aria-expanded": c,
2097
+ "aria-label": i,
2098
+ value: d,
2099
+ placeholder: i,
2100
+ onChange: (N) => {
2101
+ l(N.target.value), h(!0);
2070
2102
  },
2071
- onFocus: () => m(!0),
2072
- onKeyDown: b,
2103
+ onFocus: () => h(!0),
2104
+ onKeyDown: x,
2073
2105
  className: "w-full h-7 pl-8 pr-7 bg-secondary/35 border border-border/40 rounded-md text-xs text-foreground placeholder:text-muted-foreground/75 focus:outline-none focus:ring-1 focus:ring-primary/40 focus:bg-background/95 focus:border-primary/50 transition-all font-sans"
2074
2106
  }
2075
2107
  ),
2076
- u && /* @__PURE__ */ r(
2108
+ d && /* @__PURE__ */ o(
2077
2109
  "button",
2078
2110
  {
2079
2111
  type: "button",
2080
2112
  onClick: () => {
2081
- var y;
2082
- i(""), (y = k.current) == null || y.focus();
2113
+ var N;
2114
+ l(""), (N = E.current) == null || N.focus();
2083
2115
  },
2084
2116
  "aria-label": "Clear search",
2085
2117
  className: "absolute right-2 top-1/2 -translate-y-1/2 text-muted-foreground hover:text-foreground transition-colors",
2086
- children: /* @__PURE__ */ r(B, { size: 11 })
2118
+ children: /* @__PURE__ */ o(J, { size: 11 })
2087
2119
  }
2088
2120
  )
2089
2121
  ] }),
2090
- d && u.trim() && /* @__PURE__ */ c(
2122
+ c && d.trim() && /* @__PURE__ */ f(
2091
2123
  "div",
2092
2124
  {
2093
2125
  role: "listbox",
2094
2126
  className: "absolute right-0 md:left-0 mt-1.5 w-80 max-h-[380px] bg-popover text-popover-foreground border border-border shadow-lg rounded-lg overflow-hidden flex flex-col z-[100] animate-in fade-in-50 slide-in-from-top-1 duration-100",
2095
2127
  children: [
2096
- /* @__PURE__ */ r("div", { className: "flex-1 overflow-y-auto py-1", children: h.length === 0 ? /* @__PURE__ */ c("div", { className: "px-4 py-6 text-center text-xs text-muted-foreground italic", children: [
2128
+ /* @__PURE__ */ o("div", { className: "flex-1 overflow-y-auto py-1", children: y.length === 0 ? /* @__PURE__ */ f("div", { className: "px-4 py-6 text-center text-xs text-muted-foreground italic", children: [
2097
2129
  'No results found matching "',
2098
- u,
2130
+ d,
2099
2131
  '"'
2100
- ] }) : w.map((y) => {
2101
- const g = o.filter((C) => C.category === y);
2102
- return g.length === 0 ? null : /* @__PURE__ */ c("div", { className: "flex flex-col", children: [
2103
- /* @__PURE__ */ r("div", { className: "px-3 py-1 text-[9px] font-bold uppercase tracking-wider text-muted-foreground/80 bg-muted/40 border-y border-border/20 first:border-t-0", children: y }),
2104
- g.map((C) => {
2105
- const E = C.icon, L = h.indexOf(C), T = L === f;
2106
- return /* @__PURE__ */ c(
2132
+ ] }) : w.map((N) => {
2133
+ const u = t.filter((S) => S.category === N);
2134
+ return u.length === 0 ? null : /* @__PURE__ */ f("div", { className: "flex flex-col", children: [
2135
+ /* @__PURE__ */ o("div", { className: "px-3 py-1 text-[9px] font-bold uppercase tracking-wider text-muted-foreground/80 bg-muted/40 border-y border-border/20 first:border-t-0", children: N }),
2136
+ u.map((S) => {
2137
+ const L = S.icon, $ = y.indexOf(S), T = $ === g;
2138
+ return /* @__PURE__ */ f(
2107
2139
  "div",
2108
2140
  {
2109
2141
  role: "option",
2110
2142
  "aria-selected": T,
2111
- onClick: () => x(C),
2112
- onMouseEnter: () => p(L),
2113
- className: S(
2143
+ onClick: () => b(S),
2144
+ onMouseEnter: () => m($),
2145
+ className: D(
2114
2146
  "px-3 py-2 cursor-pointer flex items-start space-x-2.5 transition-colors border-l-2",
2115
2147
  T ? "bg-accent text-accent-foreground border-primary" : "border-transparent hover:bg-accent/40"
2116
2148
  ),
2117
2149
  children: [
2118
- E && /* @__PURE__ */ r(
2150
+ L && /* @__PURE__ */ o(
2119
2151
  "div",
2120
2152
  {
2121
- className: S(
2153
+ className: D(
2122
2154
  "mt-0.5 p-1 rounded bg-muted/50",
2123
2155
  T && "bg-background text-primary"
2124
2156
  ),
2125
- children: /* @__PURE__ */ r(E, { size: 12 })
2157
+ children: /* @__PURE__ */ o(L, { size: 12 })
2126
2158
  }
2127
2159
  ),
2128
- /* @__PURE__ */ c("div", { className: "flex-1 min-w-0", children: [
2129
- /* @__PURE__ */ r("div", { className: "text-xs font-medium truncate", children: C.title }),
2130
- C.description && /* @__PURE__ */ r("div", { className: "text-[10px] text-muted-foreground truncate mt-0.5", children: C.description })
2160
+ /* @__PURE__ */ f("div", { className: "flex-1 min-w-0", children: [
2161
+ /* @__PURE__ */ o("div", { className: "text-xs font-medium truncate", children: S.title }),
2162
+ S.description && /* @__PURE__ */ o("div", { className: "text-[10px] text-muted-foreground truncate mt-0.5", children: S.description })
2131
2163
  ] })
2132
2164
  ]
2133
2165
  },
2134
- `${C.category}-${C.id}`
2166
+ `${S.category}-${S.id}`
2135
2167
  );
2136
2168
  })
2137
- ] }, y);
2169
+ ] }, N);
2138
2170
  }) }),
2139
- h.length > 0 && /* @__PURE__ */ c("div", { className: "px-3 py-1.5 border-t border-border bg-muted/20 flex items-center justify-between text-[9px] text-muted-foreground select-none shrink-0 font-mono", children: [
2140
- /* @__PURE__ */ c("div", { className: "flex space-x-2", children: [
2141
- /* @__PURE__ */ c("span", { children: [
2142
- /* @__PURE__ */ r("kbd", { className: "bg-muted px-1 rounded border border-border/60", children: "↑↓" }),
2171
+ y.length > 0 && /* @__PURE__ */ f("div", { className: "px-3 py-1.5 border-t border-border bg-muted/20 flex items-center justify-between text-[9px] text-muted-foreground select-none shrink-0 font-mono", children: [
2172
+ /* @__PURE__ */ f("div", { className: "flex space-x-2", children: [
2173
+ /* @__PURE__ */ f("span", { children: [
2174
+ /* @__PURE__ */ o("kbd", { className: "bg-muted px-1 rounded border border-border/60", children: "↑↓" }),
2143
2175
  " ",
2144
2176
  "navigate"
2145
2177
  ] }),
2146
- /* @__PURE__ */ c("span", { children: [
2147
- /* @__PURE__ */ r("kbd", { className: "bg-muted px-1 rounded border border-border/60", children: "↵" }),
2178
+ /* @__PURE__ */ f("span", { children: [
2179
+ /* @__PURE__ */ o("kbd", { className: "bg-muted px-1 rounded border border-border/60", children: "↵" }),
2148
2180
  " ",
2149
2181
  "select"
2150
2182
  ] })
2151
2183
  ] }),
2152
- /* @__PURE__ */ r("span", { children: "ESC to close" })
2184
+ /* @__PURE__ */ o("span", { children: "ESC to close" })
2153
2185
  ] })
2154
2186
  ]
2155
2187
  }
2156
2188
  )
2157
2189
  ] });
2158
- }, er = ({
2159
- placeholder: o = "Search...",
2190
+ }, Mr = ({
2191
+ placeholder: t = "Search...",
2160
2192
  onSearch: e,
2161
2193
  results: n,
2162
- onSelect: t,
2163
- suggestions: a = [],
2194
+ onSelect: r,
2195
+ suggestions: i = [],
2164
2196
  loading: s = !1,
2165
- className: l
2197
+ className: a
2166
2198
  }) => {
2167
- const [u, i] = A(""), [d, m] = A(!1), [f, p] = A(-1), N = M(null);
2168
- O(() => {
2169
- const h = setTimeout(() => {
2170
- e(u);
2199
+ const [d, l] = P(""), [c, h] = P(!1), [g, m] = P(-1), C = F(null);
2200
+ z(() => {
2201
+ const y = setTimeout(() => {
2202
+ e(d);
2171
2203
  }, 300);
2172
- return () => clearTimeout(h);
2173
- }, [u, e]);
2174
- const k = a.filter(
2175
- (h) => h.toLowerCase().includes(u.toLowerCase()) && h.toLowerCase() !== u.toLowerCase()
2176
- ), w = (h) => {
2177
- d && k.length > 0 && (h.key === "ArrowDown" ? (h.preventDefault(), p((x) => (x + 1) % k.length)) : h.key === "ArrowUp" ? (h.preventDefault(), p((x) => (x - 1 + k.length) % k.length)) : h.key === "Enter" && f >= 0 && (h.preventDefault(), i(k[f]), m(!1)));
2204
+ return () => clearTimeout(y);
2205
+ }, [d, e]);
2206
+ const E = i.filter(
2207
+ (y) => y.toLowerCase().includes(d.toLowerCase()) && y.toLowerCase() !== d.toLowerCase()
2208
+ ), w = (y) => {
2209
+ c && E.length > 0 && (y.key === "ArrowDown" ? (y.preventDefault(), m((b) => (b + 1) % E.length)) : y.key === "ArrowUp" ? (y.preventDefault(), m((b) => (b - 1 + E.length) % E.length)) : y.key === "Enter" && g >= 0 && (y.preventDefault(), l(E[g]), h(!1)));
2178
2210
  };
2179
- return /* @__PURE__ */ c("div", { ref: N, className: S("flex flex-col h-full bg-background", l), children: [
2180
- /* @__PURE__ */ c("div", { className: "p-3 border-b border-border/50", children: [
2181
- /* @__PURE__ */ c("div", { className: "relative", children: [
2182
- /* @__PURE__ */ r("div", { className: "absolute left-2.5 top-2.5 text-muted-foreground", children: s ? /* @__PURE__ */ r(Ne, { size: 14, className: "animate-spin" }) : /* @__PURE__ */ r(X, { size: 14 }) }),
2183
- /* @__PURE__ */ r(
2211
+ return /* @__PURE__ */ f("div", { ref: C, className: D("flex flex-col h-full bg-background", a), children: [
2212
+ /* @__PURE__ */ f("div", { className: "p-3 border-b border-border/50", children: [
2213
+ /* @__PURE__ */ f("div", { className: "relative", children: [
2214
+ /* @__PURE__ */ o("div", { className: "absolute left-2.5 top-2.5 text-muted-foreground", children: s ? /* @__PURE__ */ o(ze, { size: 14, className: "animate-spin" }) : /* @__PURE__ */ o(de, { size: 14 }) }),
2215
+ /* @__PURE__ */ o(
2184
2216
  "input",
2185
2217
  {
2186
2218
  type: "text",
2187
2219
  className: "w-full bg-secondary/50 border border-border rounded-md pl-9 pr-8 py-2 text-sm text-foreground placeholder:text-muted-foreground focus:outline-none focus:ring-2 focus:ring-primary focus:border-transparent transition-all",
2188
- placeholder: o,
2189
- value: u,
2190
- onChange: (h) => {
2191
- i(h.target.value), m(!0), p(-1);
2220
+ placeholder: t,
2221
+ value: d,
2222
+ onChange: (y) => {
2223
+ l(y.target.value), h(!0), m(-1);
2192
2224
  },
2193
2225
  onKeyDown: w,
2194
- onFocus: () => m(!0)
2226
+ onFocus: () => h(!0)
2195
2227
  }
2196
2228
  ),
2197
- u && /* @__PURE__ */ r(
2229
+ d && /* @__PURE__ */ o(
2198
2230
  "button",
2199
2231
  {
2200
2232
  onClick: () => {
2201
- i(""), e("");
2233
+ l(""), e("");
2202
2234
  },
2203
2235
  className: "absolute right-2 top-2.5 text-muted-foreground hover:text-foreground",
2204
- children: /* @__PURE__ */ r(B, { size: 14 })
2236
+ children: /* @__PURE__ */ o(J, { size: 14 })
2205
2237
  }
2206
2238
  )
2207
2239
  ] }),
2208
- d && k.length > 0 && /* @__PURE__ */ r("div", { className: "absolute left-3 right-3 mt-1 bg-popover border shadow-lg rounded-md z-50 py-1 overflow-hidden", children: k.map((h, x) => /* @__PURE__ */ c(
2240
+ c && E.length > 0 && /* @__PURE__ */ o("div", { className: "absolute left-3 right-3 mt-1 bg-popover border shadow-lg rounded-md z-50 py-1 overflow-hidden", children: E.map((y, b) => /* @__PURE__ */ f(
2209
2241
  "div",
2210
2242
  {
2211
- className: S(
2243
+ className: D(
2212
2244
  "px-3 py-1.5 text-xs cursor-pointer flex items-center space-x-2",
2213
- x === f ? "bg-accent text-accent-foreground" : "hover:bg-accent/50"
2245
+ b === g ? "bg-accent text-accent-foreground" : "hover:bg-accent/50"
2214
2246
  ),
2215
2247
  onClick: () => {
2216
- i(h), m(!1);
2248
+ l(y), h(!1);
2217
2249
  },
2218
2250
  children: [
2219
- /* @__PURE__ */ r(Je, { size: 12, className: "text-muted-foreground" }),
2220
- /* @__PURE__ */ r("span", { children: h })
2251
+ /* @__PURE__ */ o(dt, { size: 12, className: "text-muted-foreground" }),
2252
+ /* @__PURE__ */ o("span", { children: y })
2221
2253
  ]
2222
2254
  },
2223
- h
2255
+ y
2224
2256
  )) })
2225
2257
  ] }),
2226
- /* @__PURE__ */ r("div", { className: "flex-1 overflow-y-auto", children: n.length === 0 ? /* @__PURE__ */ r("div", { className: "p-8 text-center text-xs text-muted-foreground italic", children: u ? `No results found for "${u}"` : "Type to start searching..." }) : /* @__PURE__ */ r("div", { className: "py-2", children: n.map((h) => {
2227
- const x = h.icon;
2228
- return /* @__PURE__ */ r(
2258
+ /* @__PURE__ */ o("div", { className: "flex-1 overflow-y-auto", children: n.length === 0 ? /* @__PURE__ */ o("div", { className: "p-8 text-center text-xs text-muted-foreground italic", children: d ? `No results found for "${d}"` : "Type to start searching..." }) : /* @__PURE__ */ o("div", { className: "py-2", children: n.map((y) => {
2259
+ const b = y.icon;
2260
+ return /* @__PURE__ */ o(
2229
2261
  "div",
2230
2262
  {
2231
- onClick: () => t(h),
2263
+ onClick: () => r(y),
2232
2264
  className: "px-4 py-2 hover:bg-accent/50 cursor-pointer group transition-colors border-l-2 border-transparent hover:border-primary",
2233
- children: /* @__PURE__ */ c("div", { className: "flex items-start space-x-3", children: [
2234
- x && /* @__PURE__ */ r("div", { className: "mt-0.5 p-1 rounded bg-muted group-hover:bg-background transition-colors", children: /* @__PURE__ */ r(x, { size: 14, className: "text-muted-foreground group-hover:text-primary" }) }),
2235
- /* @__PURE__ */ c("div", { className: "flex-1 min-w-0", children: [
2236
- /* @__PURE__ */ c("div", { className: "flex items-center justify-between", children: [
2237
- /* @__PURE__ */ r("span", { className: "text-xs font-medium truncate", children: h.title }),
2238
- h.category && /* @__PURE__ */ r("span", { className: "text-[10px] uppercase tracking-wider text-muted-foreground font-bold px-1.5 py-0.5 bg-muted rounded", children: h.category })
2265
+ children: /* @__PURE__ */ f("div", { className: "flex items-start space-x-3", children: [
2266
+ b && /* @__PURE__ */ o("div", { className: "mt-0.5 p-1 rounded bg-muted group-hover:bg-background transition-colors", children: /* @__PURE__ */ o(b, { size: 14, className: "text-muted-foreground group-hover:text-primary" }) }),
2267
+ /* @__PURE__ */ f("div", { className: "flex-1 min-w-0", children: [
2268
+ /* @__PURE__ */ f("div", { className: "flex items-center justify-between", children: [
2269
+ /* @__PURE__ */ o("span", { className: "text-xs font-medium truncate", children: y.title }),
2270
+ y.category && /* @__PURE__ */ o("span", { className: "text-[10px] uppercase tracking-wider text-muted-foreground font-bold px-1.5 py-0.5 bg-muted rounded", children: y.category })
2239
2271
  ] }),
2240
- h.description && /* @__PURE__ */ r("p", { className: "text-[11px] text-muted-foreground truncate mt-0.5", children: h.description })
2272
+ y.description && /* @__PURE__ */ o("p", { className: "text-[11px] text-muted-foreground truncate mt-0.5", children: y.description })
2241
2273
  ] })
2242
2274
  ] })
2243
2275
  },
2244
- h.id
2276
+ y.id
2245
2277
  );
2246
2278
  }) }) })
2247
2279
  ] });
2248
- }, De = (o, e = 0) => o.reduce((n, t) => (n.push({ ...t, level: e }), t.isOpen && t.children && n.push(...De(t.children, e + 1)), n), []), At = (o) => {
2249
- if (!o) return ["background"];
2250
- const e = [o.isBranch ? "branch" : "leaf"];
2251
- return o.kind && e.push(o.kind), e;
2252
- }, tr = ({
2253
- data: o,
2280
+ }, je = (t, e = 0) => t.reduce((n, r) => (n.push({ ...r, level: e }), r.isOpen && r.children && n.push(...je(r.children, e + 1)), n), []), er = (t) => {
2281
+ if (!t) return ["background"];
2282
+ const e = [t.isBranch ? "branch" : "leaf"];
2283
+ return t.kind && e.push(t.kind), e;
2284
+ }, Pr = ({
2285
+ data: t,
2254
2286
  onToggle: e,
2255
2287
  onActivate: n,
2256
- onMoveNode: t,
2257
- actions: a = [],
2288
+ onMoveNode: r,
2289
+ actions: i = [],
2258
2290
  indent: s = 12,
2259
- virtualized: l = !0,
2260
- "aria-label": u = "Tree",
2261
- className: i
2291
+ virtualized: a = !0,
2292
+ "aria-label": d = "Tree",
2293
+ className: l
2262
2294
  }) => {
2263
- const [d, m] = A(null), [f, p] = A(null), N = j(() => De(o), [o]);
2264
- O(() => {
2265
- p(null);
2266
- }, [o]);
2267
- const k = a.filter(
2268
- (x) => !x.showFor || d && x.showFor.some((b) => d.scopes.includes(b))
2269
- ).map((x) => ({
2270
- label: x.label,
2271
- icon: x.icon,
2272
- divider: x.divider,
2273
- onClick: () => d && x.onSelect(d.context)
2274
- })), w = (x, b) => {
2275
- a.length !== 0 && (x.preventDefault(), x.stopPropagation(), m({
2276
- x: x.clientX,
2277
- y: x.clientY,
2278
- scopes: At(b),
2279
- context: { nodeId: (b == null ? void 0 : b.id) ?? null, node: b }
2295
+ const [c, h] = P(null), [g, m] = P(null), C = H(() => je(t), [t]);
2296
+ z(() => {
2297
+ m(null);
2298
+ }, [t]);
2299
+ const E = i.filter(
2300
+ (b) => !b.showFor || c && b.showFor.some((x) => c.scopes.includes(x))
2301
+ ).map((b) => ({
2302
+ label: b.label,
2303
+ icon: b.icon,
2304
+ divider: b.divider,
2305
+ onClick: () => c && b.onSelect(c.context)
2306
+ })), w = (b, x) => {
2307
+ i.length !== 0 && (b.preventDefault(), b.stopPropagation(), h({
2308
+ x: b.clientX,
2309
+ y: b.clientY,
2310
+ scopes: er(x),
2311
+ context: { nodeId: (x == null ? void 0 : x.id) ?? null, node: x }
2280
2312
  }));
2281
- }, h = (x) => {
2282
- const b = N[x], y = !!b.isBranch;
2283
- return /* @__PURE__ */ c(
2313
+ }, y = (b) => {
2314
+ const x = C[b], N = !!x.isBranch;
2315
+ return /* @__PURE__ */ f(
2284
2316
  "div",
2285
2317
  {
2286
2318
  role: "treeitem",
2287
- "aria-expanded": y ? !!b.isOpen : void 0,
2288
- "aria-level": b.level + 1,
2319
+ "aria-expanded": N ? !!x.isOpen : void 0,
2320
+ "aria-level": x.level + 1,
2289
2321
  tabIndex: 0,
2290
2322
  draggable: !0,
2291
- onDragStart: (g) => {
2292
- g.dataTransfer.setData("text/plain", b.id), g.dataTransfer.effectAllowed = "move";
2323
+ onDragStart: (u) => {
2324
+ u.dataTransfer.setData("text/plain", x.id), u.dataTransfer.effectAllowed = "move";
2293
2325
  },
2294
- onDragOver: (g) => {
2295
- y && (g.preventDefault(), p(b.id));
2326
+ onDragOver: (u) => {
2327
+ N && (u.preventDefault(), m(x.id));
2296
2328
  },
2297
- onDragLeave: () => p(null),
2298
- onDrop: (g) => {
2299
- g.preventDefault(), p(null);
2300
- const C = g.dataTransfer.getData("text/plain");
2301
- C && C !== b.id && y && (t == null || t(C, b.id));
2329
+ onDragLeave: () => m(null),
2330
+ onDrop: (u) => {
2331
+ u.preventDefault(), m(null);
2332
+ const S = u.dataTransfer.getData("text/plain");
2333
+ S && S !== x.id && N && (r == null || r(S, x.id));
2302
2334
  },
2303
- onClick: () => y && (e == null ? void 0 : e(b)),
2304
- onDoubleClick: () => n == null ? void 0 : n(b),
2305
- onKeyDown: (g) => {
2306
- g.key === "Enter" && (g.preventDefault(), y ? e == null || e(b) : n == null || n(b));
2335
+ onClick: () => N && (e == null ? void 0 : e(x)),
2336
+ onDoubleClick: () => n == null ? void 0 : n(x),
2337
+ onKeyDown: (u) => {
2338
+ u.key === "Enter" && (u.preventDefault(), N ? e == null || e(x) : n == null || n(x));
2307
2339
  },
2308
- onContextMenu: (g) => w(g, b),
2309
- style: { paddingLeft: `${b.level * s + 8}px` },
2310
- className: S(
2340
+ onContextMenu: (u) => w(u, x),
2341
+ style: { paddingLeft: `${x.level * s + 8}px` },
2342
+ className: D(
2311
2343
  "flex items-center py-1 px-2 cursor-pointer hover:bg-accent hover:text-accent-foreground select-none text-xs",
2312
2344
  "transition-colors duration-150 relative focus:outline-none focus:ring-1 focus:ring-ring",
2313
- f === b.id && "bg-primary/20 ring-1 ring-primary/50 rounded-sm",
2314
- b.className
2345
+ g === x.id && "bg-primary/20 ring-1 ring-primary/50 rounded-sm",
2346
+ x.className
2315
2347
  ),
2316
2348
  children: [
2317
- /* @__PURE__ */ r("div", { className: "w-4 h-4 mr-1 flex items-center justify-center shrink-0", children: y && (b.isOpen ? /* @__PURE__ */ r(ke, { size: 14 }) : /* @__PURE__ */ r(ye, { size: 14 })) }),
2318
- b.icon && /* @__PURE__ */ r("div", { className: "mr-2 flex items-center shrink-0", children: b.icon }),
2319
- /* @__PURE__ */ r("span", { className: "truncate", children: b.label })
2349
+ /* @__PURE__ */ o("div", { className: "w-4 h-4 mr-1 flex items-center justify-center shrink-0", children: N && (x.isOpen ? /* @__PURE__ */ o(Re, { size: 14 }) : /* @__PURE__ */ o(Me, { size: 14 })) }),
2350
+ x.icon && /* @__PURE__ */ o("div", { className: "mr-2 flex items-center shrink-0", children: x.icon }),
2351
+ /* @__PURE__ */ o("span", { className: "truncate", children: x.label })
2320
2352
  ]
2321
2353
  },
2322
- b.id
2354
+ x.id
2323
2355
  );
2324
2356
  };
2325
- return /* @__PURE__ */ c(
2357
+ return /* @__PURE__ */ f(
2326
2358
  "div",
2327
2359
  {
2328
2360
  role: "tree",
2329
- "aria-label": u,
2330
- className: S("h-full w-full bg-muted/30", i),
2331
- onContextMenu: (x) => w(x, null),
2361
+ "aria-label": d,
2362
+ className: D("h-full w-full bg-muted/30", l),
2363
+ onContextMenu: (b) => w(b, null),
2332
2364
  children: [
2333
- l ? /* @__PURE__ */ r(
2334
- Ve,
2365
+ a ? /* @__PURE__ */ o(
2366
+ pt,
2335
2367
  {
2336
2368
  style: { height: "100%" },
2337
- totalCount: N.length,
2338
- itemContent: h
2369
+ totalCount: C.length,
2370
+ itemContent: y
2339
2371
  }
2340
- ) : /* @__PURE__ */ r("div", { className: "h-full overflow-auto", children: N.map((x, b) => h(b)) }),
2341
- d && k.length > 0 && /* @__PURE__ */ r(
2342
- Ot,
2372
+ ) : /* @__PURE__ */ o("div", { className: "h-full overflow-auto", children: C.map((b, x) => y(x)) }),
2373
+ c && E.length > 0 && /* @__PURE__ */ o(
2374
+ Zt,
2343
2375
  {
2344
- x: d.x,
2345
- y: d.y,
2346
- items: k,
2347
- onClose: () => m(null)
2376
+ x: c.x,
2377
+ y: c.y,
2378
+ items: E,
2379
+ onClose: () => h(null)
2348
2380
  }
2349
2381
  )
2350
2382
  ]
2351
2383
  }
2352
2384
  );
2353
- };
2385
+ }, ce = { width: 180, height: 72 }, Be = { x: 0, y: 0, scale: 1 }, Q = (t) => {
2386
+ var e, n;
2387
+ return {
2388
+ x: t.position.x,
2389
+ y: t.position.y,
2390
+ width: ((e = t.size) == null ? void 0 : e.width) ?? ce.width,
2391
+ height: ((n = t.size) == null ? void 0 : n.height) ?? ce.height
2392
+ };
2393
+ }, re = (t) => ({
2394
+ x: t.x + t.width / 2,
2395
+ y: t.y + t.height / 2
2396
+ }), be = (t, e) => ({
2397
+ x: (t.x - e.x) / e.scale,
2398
+ y: (t.y - e.y) / e.scale
2399
+ }), zr = (t, e) => ({
2400
+ x: t.x * e.scale + e.x,
2401
+ y: t.y * e.scale + e.y
2402
+ }), De = (t, e, n) => {
2403
+ const r = be(e, t);
2404
+ return {
2405
+ scale: n,
2406
+ x: e.x - r.x * n,
2407
+ y: e.y - r.y * n
2408
+ };
2409
+ }, xe = (t, e = 0.1, n = 4) => Math.min(n, Math.max(e, t)), Ie = (t, e) => {
2410
+ const n = re(t);
2411
+ switch (e) {
2412
+ case "top":
2413
+ return { x: n.x, y: t.y };
2414
+ case "bottom":
2415
+ return { x: n.x, y: t.y + t.height };
2416
+ case "left":
2417
+ return { x: t.x, y: n.y };
2418
+ case "right":
2419
+ return { x: t.x + t.width, y: n.y };
2420
+ }
2421
+ }, tr = (t, e) => {
2422
+ const n = re(t), r = re(e), i = r.x - n.x, s = r.y - n.y;
2423
+ return Math.abs(i) >= Math.abs(s) ? i >= 0 ? { source: "right", target: "left" } : { source: "left", target: "right" } : s >= 0 ? { source: "bottom", target: "top" } : { source: "top", target: "bottom" };
2424
+ }, rr = (t) => {
2425
+ if (t.length === 0) return null;
2426
+ const e = t.map(Q), n = Math.min(...e.map((a) => a.x)), r = Math.min(...e.map((a) => a.y)), i = Math.max(...e.map((a) => a.x + a.width)), s = Math.max(...e.map((a) => a.y + a.height));
2427
+ return { x: n, y: r, width: i - n, height: s - r };
2428
+ }, nr = (t, e, n = 48) => {
2429
+ const r = rr(t);
2430
+ if (!r || e.width === 0 || e.height === 0) return Be;
2431
+ const i = xe(
2432
+ Math.min(
2433
+ (e.width - n * 2) / Math.max(r.width, 1),
2434
+ (e.height - n * 2) / Math.max(r.height, 1)
2435
+ )
2436
+ ), s = re(r);
2437
+ return {
2438
+ scale: i,
2439
+ x: e.width / 2 - s.x * i,
2440
+ y: e.height / 2 - s.y * i
2441
+ };
2442
+ }, He = {
2443
+ up: { x: 0, y: -1 },
2444
+ down: { x: 0, y: 1 },
2445
+ left: { x: -1, y: 0 },
2446
+ right: { x: 1, y: 0 }
2447
+ }, pe = (t, e, n) => {
2448
+ const r = t.find((d) => d.id === e);
2449
+ if (!r) return null;
2450
+ const i = re(Q(r)), s = He[n];
2451
+ let a = null;
2452
+ for (const d of t) {
2453
+ if (d.id === e) continue;
2454
+ const l = re(Q(d)), c = l.x - i.x, h = l.y - i.y, g = c * s.x + h * s.y;
2455
+ if (g <= 0) continue;
2456
+ const m = Math.abs(c * s.y - h * s.x);
2457
+ if (m > g * 2) continue;
2458
+ const C = g + m * 2;
2459
+ (!a || C < a.score) && (a = { node: d, score: C });
2460
+ }
2461
+ return (a == null ? void 0 : a.node) ?? null;
2462
+ }, or = (t, e, n, r = 64) => {
2463
+ const i = t.find((c) => c.id === e);
2464
+ if (!i) return { x: 0, y: 0 };
2465
+ const s = Q(i), a = He[n], d = {
2466
+ x: a.x * (s.width + r),
2467
+ y: a.y * (s.height + r)
2468
+ };
2469
+ let l = { x: s.x + d.x, y: s.y + d.y };
2470
+ for (let c = 0; c < 24; c += 1) {
2471
+ const h = { ...l, width: s.width, height: s.height };
2472
+ if (!t.some((m) => sr(Q(m), h))) break;
2473
+ l = a.x !== 0 ? { x: l.x, y: l.y + s.height + r } : { x: l.x + s.width + r, y: l.y };
2474
+ }
2475
+ return l;
2476
+ }, sr = (t, e) => t.x < e.x + e.width && t.x + t.width > e.x && t.y < e.y + e.height && t.y + t.height > e.y, Rr = (t, e) => t.filter((n) => n.source === e || n.target === e), Kr = (t, e, n) => t.some(
2477
+ (r) => r.source === e && r.target === n || r.source === n && r.target === e
2478
+ ), _r = (t, e, n) => ({
2479
+ nodes: t.filter((r) => r.id !== n),
2480
+ edges: e.filter((r) => r.source !== n && r.target !== n)
2481
+ }), Ur = (t, e) => {
2482
+ let n = e.length + 1;
2483
+ const r = new Set(e.map((i) => i.id));
2484
+ for (; r.has(`${t}-${n}`); ) n += 1;
2485
+ return `${t}-${n}`;
2486
+ }, ar = Je(
2487
+ ({
2488
+ children: t,
2489
+ overlay: e,
2490
+ viewport: n,
2491
+ defaultViewport: r = Be,
2492
+ onViewportChange: i,
2493
+ onCanvasClick: s,
2494
+ onCanvasDoubleClick: a,
2495
+ onCanvasContextMenu: d,
2496
+ onDrop: l,
2497
+ grid: c = !0,
2498
+ gridSize: h = 24,
2499
+ minScale: g = 0.1,
2500
+ maxScale: m = 4,
2501
+ pannable: C = !0,
2502
+ zoomable: E = !0,
2503
+ "aria-label": w = "Graph canvas",
2504
+ className: y
2505
+ }, b) => {
2506
+ const x = F(null), [N, u] = P(r), [S, L] = P(!1), [$, T] = P(!1), O = n ?? N, p = F(O);
2507
+ p.current = O;
2508
+ const k = oe(
2509
+ (v) => {
2510
+ n || u(v), i == null || i(v);
2511
+ },
2512
+ [n, i]
2513
+ ), I = oe((v) => {
2514
+ var M;
2515
+ const A = (M = x.current) == null ? void 0 : M.getBoundingClientRect();
2516
+ return A ? { x: v.x - A.left, y: v.y - A.top } : v;
2517
+ }, []);
2518
+ z(() => {
2519
+ const v = x.current;
2520
+ if (!v || !E) return;
2521
+ const A = (M) => {
2522
+ M.preventDefault();
2523
+ const U = p.current, j = I({ x: M.clientX, y: M.clientY }), ie = M.ctrlKey ? 0.01 : 2e-3, le = xe(
2524
+ U.scale * Math.exp(-M.deltaY * ie),
2525
+ g,
2526
+ m
2527
+ );
2528
+ k(De(U, j, le));
2529
+ };
2530
+ return v.addEventListener("wheel", A, { passive: !1 }), () => v.removeEventListener("wheel", A);
2531
+ }, [E, g, m, k, I]), z(() => {
2532
+ if (!C) return;
2533
+ const v = (M) => {
2534
+ var j;
2535
+ if (M.code !== "Space") return;
2536
+ const U = M.target;
2537
+ U != null && U.closest('input, textarea, [contenteditable="true"]') || (j = x.current) != null && j.contains(document.activeElement) && (M.preventDefault(), T(!0));
2538
+ }, A = (M) => {
2539
+ M.code === "Space" && T(!1);
2540
+ };
2541
+ return window.addEventListener("keydown", v), window.addEventListener("keyup", A), () => {
2542
+ window.removeEventListener("keydown", v), window.removeEventListener("keyup", A);
2543
+ };
2544
+ }, [C]);
2545
+ const _ = (v) => {
2546
+ if (!C) return;
2547
+ const A = v.target === v.currentTarget, M = v.button === 1;
2548
+ if (!A && !M && !$ || v.button !== 0 && !M) return;
2549
+ v.preventDefault(), L(!0);
2550
+ const U = { x: v.clientX, y: v.clientY }, j = { ...p.current }, ie = (we) => {
2551
+ k({
2552
+ ...j,
2553
+ x: j.x + (we.clientX - U.x),
2554
+ y: j.y + (we.clientY - U.y)
2555
+ });
2556
+ }, le = () => {
2557
+ L(!1), window.removeEventListener("pointermove", ie), window.removeEventListener("pointerup", le);
2558
+ };
2559
+ window.addEventListener("pointermove", ie), window.addEventListener("pointerup", le);
2560
+ };
2561
+ Xe(
2562
+ b,
2563
+ () => ({
2564
+ getViewport: () => p.current,
2565
+ setViewport: k,
2566
+ fitTo: (v, A) => {
2567
+ var U;
2568
+ const M = (U = x.current) == null ? void 0 : U.getBoundingClientRect();
2569
+ M && k(nr(v, { width: M.width, height: M.height }, A));
2570
+ },
2571
+ zoomBy: (v) => {
2572
+ var j;
2573
+ const A = (j = x.current) == null ? void 0 : j.getBoundingClientRect();
2574
+ if (!A) return;
2575
+ const M = { x: A.width / 2, y: A.height / 2 }, U = xe(
2576
+ p.current.scale * v,
2577
+ g,
2578
+ m
2579
+ );
2580
+ k(De(p.current, M, U));
2581
+ },
2582
+ clientToGraph: (v) => be(I(v), p.current),
2583
+ focus: () => {
2584
+ var v;
2585
+ return (v = x.current) == null ? void 0 : v.focus();
2586
+ }
2587
+ }),
2588
+ [k, g, m, I]
2589
+ );
2590
+ const R = (v) => be(I({ x: v.clientX, y: v.clientY }), O), K = (v) => v.target === v.currentTarget;
2591
+ return /* @__PURE__ */ f(
2592
+ "div",
2593
+ {
2594
+ ref: x,
2595
+ role: "application",
2596
+ "aria-label": w,
2597
+ tabIndex: 0,
2598
+ onPointerDown: _,
2599
+ onClick: (v) => K(v) && (s == null ? void 0 : s(R(v), v)),
2600
+ onDoubleClick: (v) => K(v) && (a == null ? void 0 : a(R(v), v)),
2601
+ onContextMenu: (v) => {
2602
+ !d || !K(v) || (v.preventDefault(), d(R(v), v));
2603
+ },
2604
+ onDragOver: (v) => {
2605
+ l && (v.preventDefault(), v.dataTransfer.dropEffect = "copy");
2606
+ },
2607
+ onDrop: (v) => {
2608
+ l && (v.preventDefault(), l(R(v), v));
2609
+ },
2610
+ style: c ? {
2611
+ // The grid is painted on the element rather than inside the
2612
+ // transformed layer, so it can be infinite without needing a
2613
+ // giant element behind it.
2614
+ backgroundImage: "radial-gradient(circle, hsl(var(--border)) 1px, transparent 1px)",
2615
+ backgroundSize: `${h * O.scale}px ${h * O.scale}px`,
2616
+ backgroundPosition: `${O.x}px ${O.y}px`
2617
+ } : void 0,
2618
+ className: D(
2619
+ "relative w-full h-full overflow-hidden bg-background outline-none",
2620
+ "focus-visible:ring-1 focus-visible:ring-ring focus-visible:ring-inset",
2621
+ $ || S ? "cursor-grabbing" : "cursor-grab",
2622
+ y
2623
+ ),
2624
+ children: [
2625
+ /* @__PURE__ */ o(
2626
+ "div",
2627
+ {
2628
+ style: {
2629
+ transform: `translate(${O.x}px, ${O.y}px) scale(${O.scale})`,
2630
+ transformOrigin: "0 0",
2631
+ willChange: "transform"
2632
+ },
2633
+ className: "absolute inset-0 pointer-events-none [&>*]:pointer-events-auto",
2634
+ children: t
2635
+ }
2636
+ ),
2637
+ e && /* @__PURE__ */ o("div", { className: "absolute inset-0 pointer-events-none [&>*]:pointer-events-auto", children: e })
2638
+ ]
2639
+ }
2640
+ );
2641
+ }
2642
+ );
2643
+ ar.displayName = "GraphCanvas";
2644
+ const ir = ["top", "right", "bottom", "left"], lr = {
2645
+ top: "left-1/2 -translate-x-1/2 -top-1.5",
2646
+ bottom: "left-1/2 -translate-x-1/2 -bottom-1.5",
2647
+ left: "top-1/2 -translate-y-1/2 -left-1.5",
2648
+ right: "top-1/2 -translate-y-1/2 -right-1.5"
2649
+ }, Fr = ({
2650
+ node: t,
2651
+ children: e,
2652
+ onMove: n,
2653
+ onMoveEnd: r,
2654
+ onSelect: i,
2655
+ onActivate: s,
2656
+ onContextMenu: a,
2657
+ onConnectStart: d,
2658
+ onConnectEnd: l,
2659
+ selected: c = !1,
2660
+ focused: h = !1,
2661
+ ports: g = !0,
2662
+ draggable: m = !0,
2663
+ className: C
2664
+ }) => {
2665
+ var x, N;
2666
+ const E = F(!1), w = ((x = t.size) == null ? void 0 : x.width) ?? ce.width, y = ((N = t.size) == null ? void 0 : N.height) ?? ce.height, b = (u) => {
2667
+ if (!m || !n || u.button !== 0 || u.nativeEvent.shiftKey) return;
2668
+ u.stopPropagation(), E.current = !1;
2669
+ const S = { x: u.clientX, y: u.clientY }, L = { ...t.position }, $ = cr(u.currentTarget);
2670
+ let T = L;
2671
+ const O = (k) => {
2672
+ const I = (k.clientX - S.x) / $, _ = (k.clientY - S.y) / $;
2673
+ (Math.abs(I) > 1 || Math.abs(_) > 1) && (E.current = !0), T = { x: L.x + I, y: L.y + _ }, n(t.id, T);
2674
+ }, p = () => {
2675
+ E.current && (r == null || r(t.id, T)), window.removeEventListener("pointermove", O), window.removeEventListener("pointerup", p);
2676
+ };
2677
+ window.addEventListener("pointermove", O), window.addEventListener("pointerup", p);
2678
+ };
2679
+ return /* @__PURE__ */ f(
2680
+ "div",
2681
+ {
2682
+ "data-graph-node": t.id,
2683
+ role: "button",
2684
+ tabIndex: -1,
2685
+ "aria-pressed": c,
2686
+ style: {
2687
+ position: "absolute",
2688
+ left: t.position.x,
2689
+ top: t.position.y,
2690
+ width: w,
2691
+ height: y
2692
+ },
2693
+ onPointerDown: b,
2694
+ onClick: (u) => {
2695
+ u.stopPropagation(), E.current || i == null || i(t.id, u);
2696
+ },
2697
+ onDoubleClick: (u) => {
2698
+ u.stopPropagation(), s == null || s(t.id);
2699
+ },
2700
+ onContextMenu: (u) => {
2701
+ a && (u.preventDefault(), u.stopPropagation(), a(t.id, { x: u.clientX, y: u.clientY }, u));
2702
+ },
2703
+ onPointerUp: () => l == null ? void 0 : l(t.id),
2704
+ className: D(
2705
+ "group rounded-lg border bg-card text-card-foreground shadow-sm select-none",
2706
+ "flex flex-col overflow-hidden transition-shadow",
2707
+ m && n && "cursor-grab active:cursor-grabbing",
2708
+ c ? "border-primary shadow-md" : "border-border",
2709
+ // Focus is the keyboard cursor: it must be visible even when the node
2710
+ // is also selected, so it gets a ring rather than a border change.
2711
+ h && "ring-2 ring-ring ring-offset-1 ring-offset-background",
2712
+ C
2713
+ ),
2714
+ children: [
2715
+ e,
2716
+ g && d && ir.map((u) => /* @__PURE__ */ o(
2717
+ "button",
2718
+ {
2719
+ type: "button",
2720
+ tabIndex: -1,
2721
+ "aria-label": `Connect from ${u}`,
2722
+ onPointerDown: (S) => {
2723
+ S.stopPropagation(), d(t.id, u);
2724
+ },
2725
+ className: D(
2726
+ "absolute w-3 h-3 rounded-full border-2 border-background bg-primary",
2727
+ "opacity-0 group-hover:opacity-100 focus-visible:opacity-100 transition-opacity",
2728
+ h && "opacity-100",
2729
+ lr[u]
2730
+ )
2731
+ },
2732
+ u
2733
+ ))
2734
+ ]
2735
+ }
2736
+ );
2737
+ }, cr = (t) => {
2738
+ let e = t.parentElement;
2739
+ for (; e; ) {
2740
+ const n = window.getComputedStyle(e).transform;
2741
+ if (n && n !== "none") {
2742
+ const r = /matrix\(([^,]+),/.exec(n), i = r ? parseFloat(r[1]) : NaN;
2743
+ if (Number.isFinite(i) && i !== 0) return i;
2744
+ }
2745
+ e = e.parentElement;
2746
+ }
2747
+ return 1;
2748
+ }, dr = (t, e, n, r) => {
2749
+ if (r === "straight")
2750
+ return `M ${t.x} ${t.y} L ${e.x} ${e.y}`;
2751
+ const i = n === "left" || n === "right";
2752
+ if (r === "smoothstep") {
2753
+ const c = i ? (t.x + e.x) / 2 : (t.y + e.y) / 2;
2754
+ return i ? `M ${t.x} ${t.y} L ${c} ${t.y} L ${c} ${e.y} L ${e.x} ${e.y}` : `M ${t.x} ${t.y} L ${t.x} ${c} L ${e.x} ${c} L ${e.x} ${e.y}`;
2755
+ }
2756
+ const s = Math.hypot(e.x - t.x, e.y - t.y), a = Math.min(Math.max(s / 2, 24), 160), d = i ? { x: t.x + (n === "right" ? a : -a), y: t.y } : { x: t.x, y: t.y + (n === "bottom" ? a : -a) }, l = i ? { x: e.x - (n === "right" ? a : -a), y: e.y } : { x: e.x, y: e.y - (n === "bottom" ? a : -a) };
2757
+ return `M ${t.x} ${t.y} C ${d.x} ${d.y}, ${l.x} ${l.y}, ${e.x} ${e.y}`;
2758
+ }, jr = ({
2759
+ edge: t,
2760
+ source: e,
2761
+ target: n,
2762
+ routing: r = "bezier",
2763
+ selected: i = !1,
2764
+ arrow: s = !0,
2765
+ onSelect: a,
2766
+ onContextMenu: d,
2767
+ className: l
2768
+ }) => {
2769
+ const c = Q(e), h = Q(n), g = tr(c, h), m = Ie(c, g.source), C = Ie(h, g.target), E = dr(m, C, g.source, r), w = { x: (m.x + C.x) / 2, y: (m.y + C.y) / 2 }, y = !!(a || d);
2770
+ return /* @__PURE__ */ f(
2771
+ "g",
2772
+ {
2773
+ "data-graph-edge": t.id,
2774
+ className: D(y && "cursor-pointer"),
2775
+ onClick: (b) => {
2776
+ a && (b.stopPropagation(), a(t.id, b));
2777
+ },
2778
+ onContextMenu: (b) => {
2779
+ d && (b.preventDefault(), b.stopPropagation(), d(t.id, { x: b.clientX, y: b.clientY }, b));
2780
+ },
2781
+ children: [
2782
+ y && /* @__PURE__ */ o("path", { d: E, fill: "none", stroke: "transparent", strokeWidth: 16 }),
2783
+ /* @__PURE__ */ o(
2784
+ "path",
2785
+ {
2786
+ d: E,
2787
+ fill: "none",
2788
+ strokeWidth: i ? 2.5 : 1.5,
2789
+ markerEnd: s ? "url(#nexus-graph-arrow)" : void 0,
2790
+ className: D(
2791
+ "transition-[stroke]",
2792
+ i ? "stroke-primary" : "stroke-border",
2793
+ l
2794
+ )
2795
+ }
2796
+ ),
2797
+ t.label && /* @__PURE__ */ o(
2798
+ "text",
2799
+ {
2800
+ x: w.x,
2801
+ y: w.y,
2802
+ textAnchor: "middle",
2803
+ dominantBaseline: "middle",
2804
+ className: "fill-muted-foreground text-[10px] font-medium select-none",
2805
+ style: { paintOrder: "stroke", stroke: "hsl(var(--background))", strokeWidth: 4 },
2806
+ children: t.label
2807
+ }
2808
+ )
2809
+ ]
2810
+ }
2811
+ );
2812
+ }, Br = ({ children: t, className: e }) => /* @__PURE__ */ f(
2813
+ "svg",
2814
+ {
2815
+ style: { position: "absolute", left: -5e4, top: -5e4, overflow: "visible" },
2816
+ width: 1e5,
2817
+ height: 1e5,
2818
+ viewBox: "-50000 -50000 100000 100000",
2819
+ className: D("pointer-events-none [&_g]:pointer-events-auto", e),
2820
+ children: [
2821
+ /* @__PURE__ */ o("defs", { children: /* @__PURE__ */ o(
2822
+ "marker",
2823
+ {
2824
+ id: "nexus-graph-arrow",
2825
+ viewBox: "0 0 10 10",
2826
+ refX: 9,
2827
+ refY: 5,
2828
+ markerWidth: 6,
2829
+ markerHeight: 6,
2830
+ orient: "auto-start-reverse",
2831
+ children: /* @__PURE__ */ o("path", { d: "M 0 0 L 10 5 L 0 10 z", className: "fill-border" })
2832
+ }
2833
+ ) }),
2834
+ t
2835
+ ]
2836
+ }
2837
+ ), Hr = {
2838
+ /** Move focus to the nearest node in a direction. */
2839
+ moveFocus: ["ArrowUp", "ArrowDown", "ArrowLeft", "ArrowRight"],
2840
+ /** Create a connected node in a direction. */
2841
+ createConnected: "Tab",
2842
+ /** Edit the focused node. */
2843
+ edit: "Enter",
2844
+ /** Leave edit mode, cancel a pending connection, or clear focus. */
2845
+ cancel: "Escape",
2846
+ /** Delete the focused node. */
2847
+ delete: ["Delete", "Backspace"],
2848
+ /** Begin connecting from the focused node. */
2849
+ connect: "c",
2850
+ /** Nudge the focused node. Held with the arrow keys. */
2851
+ nudgeModifier: "shiftKey"
2852
+ }, ur = {
2853
+ ArrowUp: "up",
2854
+ ArrowDown: "down",
2855
+ ArrowLeft: "left",
2856
+ ArrowRight: "right"
2857
+ }, Wr = ({
2858
+ nodes: t,
2859
+ edges: e,
2860
+ focusedId: n,
2861
+ defaultFocusedId: r = null,
2862
+ onFocusChange: i,
2863
+ targetRef: s,
2864
+ nudgeDistance: a = 16,
2865
+ disabled: d = !1,
2866
+ onCreateNode: l,
2867
+ onConnect: c,
2868
+ onDeleteNode: h,
2869
+ onMoveNode: g,
2870
+ onEditNode: m
2871
+ }) => {
2872
+ const [C, E] = P(
2873
+ r
2874
+ ), [w, y] = P(null), [b, x] = P(null), N = n !== void 0 ? n : C, u = oe(
2875
+ (T) => {
2876
+ n === void 0 && E(T), i == null || i(T);
2877
+ },
2878
+ [n, i]
2879
+ ), S = F({
2880
+ nodes: t,
2881
+ edges: e,
2882
+ focusedId: N,
2883
+ editingId: w,
2884
+ connectingFrom: b
2885
+ });
2886
+ S.current = { nodes: t, edges: e, focusedId: N, editingId: w, connectingFrom: b };
2887
+ const L = oe(
2888
+ (T) => {
2889
+ const { nodes: O, focusedId: p } = S.current;
2890
+ if (O.length === 0) return;
2891
+ if (!p) {
2892
+ u(O[0].id);
2893
+ return;
2894
+ }
2895
+ const k = pe(O, p, T);
2896
+ k && u(k.id);
2897
+ },
2898
+ [u]
2899
+ ), $ = oe(
2900
+ (T = "right") => {
2901
+ const { nodes: O, focusedId: p } = S.current;
2902
+ if (!l) return;
2903
+ const k = p ? or(O, p, T) : { x: 0, y: 0 }, I = l(k, { from: p ?? void 0, direction: T });
2904
+ I && (p && (c == null || c(p, I)), u(I), y(I));
2905
+ },
2906
+ [l, c, u]
2907
+ );
2908
+ return z(() => {
2909
+ if (d) return;
2910
+ const T = s.current;
2911
+ if (!T) return;
2912
+ const O = (p) => {
2913
+ const { focusedId: k, editingId: I, connectingFrom: _ } = S.current;
2914
+ if (I) {
2915
+ p.key === "Escape" && (p.preventDefault(), y(null));
2916
+ return;
2917
+ }
2918
+ const R = p.target;
2919
+ if (R != null && R.closest('input, textarea, select, [contenteditable="true"]')) return;
2920
+ const K = ur[p.key];
2921
+ if (K) {
2922
+ p.preventDefault();
2923
+ const v = S.current.nodes.find((A) => A.id === k);
2924
+ if (p.shiftKey && v && g) {
2925
+ const A = {
2926
+ up: { x: 0, y: -a },
2927
+ down: { x: 0, y: a },
2928
+ left: { x: -a, y: 0 },
2929
+ right: { x: a, y: 0 }
2930
+ }[K];
2931
+ g(v.id, {
2932
+ x: v.position.x + A.x,
2933
+ y: v.position.y + A.y
2934
+ });
2935
+ return;
2936
+ }
2937
+ L(K);
2938
+ return;
2939
+ }
2940
+ switch (p.key) {
2941
+ case "Tab": {
2942
+ if (!l) return;
2943
+ p.preventDefault(), $(p.shiftKey ? "left" : "right");
2944
+ return;
2945
+ }
2946
+ case "Enter": {
2947
+ if (!k) return;
2948
+ if (p.preventDefault(), _ && _ !== k) {
2949
+ c == null || c(_, k), x(null);
2950
+ return;
2951
+ }
2952
+ m == null || m(k), y(k);
2953
+ return;
2954
+ }
2955
+ case "Escape": {
2956
+ p.preventDefault(), _ ? x(null) : u(null);
2957
+ return;
2958
+ }
2959
+ case "Delete":
2960
+ case "Backspace": {
2961
+ if (!k || !h) return;
2962
+ p.preventDefault();
2963
+ const v = S.current.nodes.filter((M) => M.id !== k), A = pe(S.current.nodes, k, "left") ?? pe(S.current.nodes, k, "right") ?? v[0] ?? null;
2964
+ h(k), u((A == null ? void 0 : A.id) ?? null);
2965
+ return;
2966
+ }
2967
+ case "c":
2968
+ case "C": {
2969
+ if (!k || !c || p.metaKey || p.ctrlKey) return;
2970
+ p.preventDefault(), x(_ === k ? null : k);
2971
+ return;
2972
+ }
2973
+ }
2974
+ };
2975
+ return T.addEventListener("keydown", O), () => T.removeEventListener("keydown", O);
2976
+ }, [
2977
+ d,
2978
+ s,
2979
+ L,
2980
+ $,
2981
+ a,
2982
+ c,
2983
+ l,
2984
+ h,
2985
+ m,
2986
+ g,
2987
+ u
2988
+ ]), z(() => {
2989
+ N && !t.some((T) => T.id === N) && u(null), w && !t.some((T) => T.id === w) && y(null), b && !t.some((T) => T.id === b) && x(null);
2990
+ }, [t, N, w, b, u]), H(
2991
+ () => ({
2992
+ focusedId: N,
2993
+ setFocusedId: u,
2994
+ editingId: w,
2995
+ setEditingId: y,
2996
+ connectingFrom: b,
2997
+ setConnectingFrom: x,
2998
+ moveFocus: L,
2999
+ createConnected: $
3000
+ }),
3001
+ [N, u, w, b, L, $]
3002
+ );
3003
+ }, We = "application/x-nexus-graph-node", Gr = ({
3004
+ items: t,
3005
+ onSelect: e,
3006
+ onDragStart: n,
3007
+ vertical: r = !1,
3008
+ className: i,
3009
+ "aria-label": s = "Node palette"
3010
+ }) => /* @__PURE__ */ o(
3011
+ "div",
3012
+ {
3013
+ role: "toolbar",
3014
+ "aria-label": s,
3015
+ "aria-orientation": r ? "vertical" : "horizontal",
3016
+ className: D(
3017
+ "flex gap-1.5 p-1.5 rounded-lg border border-border bg-card/90 backdrop-blur-sm shadow-sm",
3018
+ r ? "flex-col" : "flex-wrap items-center",
3019
+ i
3020
+ ),
3021
+ children: t.map((a) => /* @__PURE__ */ f(
3022
+ "button",
3023
+ {
3024
+ type: "button",
3025
+ draggable: !0,
3026
+ title: a.description,
3027
+ onDragStart: (d) => {
3028
+ d.dataTransfer.setData(We, a.kind), d.dataTransfer.setData("text/plain", a.label), d.dataTransfer.effectAllowed = "copy", n == null || n(a);
3029
+ },
3030
+ onClick: () => e == null ? void 0 : e(a),
3031
+ className: D(
3032
+ "flex items-center gap-1.5 px-2.5 py-1.5 rounded-md text-xs font-medium",
3033
+ "border border-border bg-background text-foreground",
3034
+ "hover:bg-accent hover:text-accent-foreground transition-colors",
3035
+ "cursor-grab active:cursor-grabbing",
3036
+ "focus:outline-none focus-visible:ring-2 focus-visible:ring-ring"
3037
+ ),
3038
+ children: [
3039
+ a.icon,
3040
+ a.label
3041
+ ]
3042
+ },
3043
+ a.kind
3044
+ ))
3045
+ }
3046
+ ), Yr = (t) => t.dataTransfer.getData(We) || null;
2354
3047
  export {
2355
- qe as ActivityBar,
2356
- Qt as AppTitle,
2357
- Ze as ChatPane,
2358
- kt as CommandPalette,
2359
- st as CommandRegistry,
2360
- Qe as ConnectedActivityBar,
2361
- rt as ConnectedChatPane,
2362
- Gt as ConnectedCommandPalette,
2363
- at as ConnectedMenuBar,
2364
- Vt as ConnectedModal,
2365
- dt as ConnectedSidebarPane,
2366
- ut as ConnectedStatusBar,
2367
- pt as ConnectedTerminalPane,
2368
- Yt as ConnectedThemeSwitcher,
2369
- qt as ConnectedUserProfile,
2370
- Ot as ContextMenu,
2371
- Bt as DEFAULT_COMMAND_IDS,
2372
- lt as DEFAULT_SETTINGS_THEMES,
2373
- Dt as DEFAULT_THEME_OPTIONS,
2374
- Xt as DataGrid,
2375
- nt as MenuBar,
2376
- ot as MenuRegistry,
2377
- Tt as Modal,
2378
- _t as NexusWorkspaceShell,
2379
- Zt as QuickSearch,
2380
- er as SearchWidget,
2381
- it as SettingsPanel,
2382
- _t as ShellLayout,
2383
- re as SidebarPane,
2384
- ct as StatusBar,
2385
- mt as TerminalPane,
2386
- Et as ThemeSwitcher,
2387
- tr as TreeWidget,
2388
- It as UserProfile,
2389
- S as cn,
2390
- W as commandRegistry,
2391
- ht as componentRegistry,
2392
- Jt as initializeShell,
2393
- le as menuRegistry,
2394
- Ht as pluginRegistry,
2395
- Q as useChatStore,
2396
- Wt as useKeyboardShortcuts,
2397
- bt as useLayoutStore,
2398
- Te as useModalStore,
2399
- ae as useRightSidebarStore,
2400
- F as useSidebarStore,
2401
- ie as useStatusBarStore,
2402
- V as useTerminalStore,
2403
- Y as useThemeStore,
2404
- H as useUserProfileStore
3048
+ ht as ActivityBar,
3049
+ Or as AppTitle,
3050
+ ae as BUNDLED_THEMES,
3051
+ St as BUNDLED_THEME_CLASSES,
3052
+ yt as ChatPane,
3053
+ Gt as CommandPalette,
3054
+ Tt as CommandRegistry,
3055
+ bt as ConnectedActivityBar,
3056
+ Nt as ConnectedChatPane,
3057
+ Sr as ConnectedCommandPalette,
3058
+ Et as ConnectedMenuBar,
3059
+ Dr as ConnectedModal,
3060
+ $t as ConnectedSidebarPane,
3061
+ Mt as ConnectedStatusBar,
3062
+ Rt as ConnectedTerminalPane,
3063
+ Ir as ConnectedThemeSwitcher,
3064
+ Lr as ConnectedUserProfile,
3065
+ Zt as ContextMenu,
3066
+ kr as DEFAULT_COMMAND_IDS,
3067
+ Hr as DEFAULT_GRAPH_KEYS,
3068
+ ce as DEFAULT_NODE_SIZE,
3069
+ Lt as DEFAULT_SETTINGS_THEMES,
3070
+ Vt as DEFAULT_THEME_OPTIONS,
3071
+ $r as DataGrid,
3072
+ We as GRAPH_NODE_MIME,
3073
+ ar as GraphCanvas,
3074
+ jr as GraphEdge,
3075
+ Br as GraphEdgeLayer,
3076
+ Fr as GraphNode,
3077
+ Be as IDENTITY_VIEWPORT,
3078
+ kt as MenuBar,
3079
+ Ct as MenuRegistry,
3080
+ Xt as Modal,
3081
+ Nr as NexusWorkspaceShell,
3082
+ Gr as NodePalette,
3083
+ Ar as QuickSearch,
3084
+ Mr as SearchWidget,
3085
+ Ot as SettingsPanel,
3086
+ Nr as ShellLayout,
3087
+ fe as SidebarPane,
3088
+ At as StatusBar,
3089
+ Pt as TerminalPane,
3090
+ qt as ThemeSwitcher,
3091
+ Pr as TreeWidget,
3092
+ Qt as UserProfile,
3093
+ xe as clampScale,
3094
+ D as cn,
3095
+ q as commandRegistry,
3096
+ _t as componentRegistry,
3097
+ dr as edgePath,
3098
+ Rr as edgesOf,
3099
+ pe as findNeighbour,
3100
+ nr as fitViewport,
3101
+ rr as graphBounds,
3102
+ Cr as initializeShell,
3103
+ Kr as isConnected,
3104
+ ye as menuRegistry,
3105
+ Ur as nextId,
3106
+ Q as nodeRect,
3107
+ or as placeRelativeTo,
3108
+ Tr as pluginRegistry,
3109
+ Ie as portPoint,
3110
+ Yr as readPaletteDrag,
3111
+ re as rectCenter,
3112
+ _r as removeNode,
3113
+ tr as resolvePorts,
3114
+ Dt as themeClass,
3115
+ be as toGraphSpace,
3116
+ zr as toScreenSpace,
3117
+ se as useChatStore,
3118
+ Wr as useGraphKeyboard,
3119
+ Er as useKeyboardShortcuts,
3120
+ Ut as useLayoutStore,
3121
+ Ue as useModalStore,
3122
+ he as useRightSidebarStore,
3123
+ W as useSidebarStore,
3124
+ ve as useStatusBarStore,
3125
+ ee as useTerminalStore,
3126
+ te as useThemeStore,
3127
+ V as useUserProfileStore,
3128
+ De as zoomAt
2405
3129
  };