nexus-shell 0.2.5 → 0.2.7

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