nexus-shell 0.2.6 → 0.2.8

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,60 +1,60 @@
1
- var qe = Object.defineProperty;
2
- var Ve = (t, e, n) => e in t ? qe(t, e, { enumerable: !0, configurable: !0, writable: !0, value: n }) : t[e] = n;
3
- var Q = (t, e, n) => Ve(t, typeof e != "symbol" ? e + "" : e, n);
4
- import { jsxs as p, jsx as o, Fragment as Ae } from "react/jsx-runtime";
5
- import ge, { useMemo as B, useState as R, useRef as F, useEffect as O, forwardRef as Qe, useCallback as ee, useImperativeHandle as Ze } from "react";
6
- import { Model as W, Actions as re, DockLocation as et, Layout as tt } 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 rt, MessageCircle as $e, X as V, User as Oe, Terminal as Re, Send as nt, ChevronRight as Pe, GraduationCap as ke, Moon as ot, Sun as st, Palette as at, ChevronUp as ze, Search as ue, Info as it, HelpCircle as lt, AlertCircle as ct, Check as dt, Camera as ut, Edit2 as ft, Loader2 as Ke, ChevronsUpDown as mt, ChevronDown as Fe, Clock as pt } from "lucide-react";
9
- import { clsx as ht } from "clsx";
10
- import { twMerge as gt } from "tailwind-merge";
11
- import { create as J } from "zustand";
12
- import { TableVirtuoso as xt, Virtuoso as bt } from "react-virtuoso";
13
- function L(...t) {
14
- return gt(ht(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 yt = [
17
- { id: "settings", label: "Settings", icon: rt }
18
- ], vt = ({
16
+ const wt = [
17
+ { id: "settings", label: "Settings", icon: ot }
18
+ ], Nt = ({
19
19
  items: t = [],
20
- bottomItems: e = yt,
20
+ bottomItems: e = wt,
21
21
  activeId: n = null,
22
22
  onSelect: r,
23
23
  className: a,
24
24
  "aria-label": s = "Activity Bar"
25
25
  }) => {
26
- const i = ({ 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: L(
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__ */ p(
42
+ return /* @__PURE__ */ b(
43
43
  "aside",
44
44
  {
45
45
  role: "navigation",
46
46
  "aria-label": s,
47
- className: L(
47
+ className: A(
48
48
  "w-12 h-full bg-muted border-r flex flex-col items-center py-2 select-none",
49
49
  a
50
50
  ),
51
51
  children: [
52
- /* @__PURE__ */ o("div", { className: "flex-1 flex flex-col space-y-4", children: t.map(i) }),
53
- e.length > 0 && /* @__PURE__ */ o("div", { className: "flex flex-col space-y-4", children: e.map(i) })
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
- }, se = "nexus-shell-sidebar", G = J((t) => {
57
+ }, se = "nexus-shell-sidebar", J = q((t) => {
58
58
  const e = localStorage.getItem(se);
59
59
  return {
60
60
  activeSidebar: e !== null ? e : null,
@@ -68,13 +68,13 @@ const yt = [
68
68
  }),
69
69
  setPanels: (r) => t({ panels: r })
70
70
  };
71
- }), wt = (t) => {
72
- const e = G((s) => s.panels), n = G((s) => s.activeSidebar), r = G((s) => s.toggleSidebar), a = B(
73
- () => e.map(({ id: s, label: i, icon: d }) => ({ id: s, label: i, 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
- vt,
77
+ Nt,
78
78
  {
79
79
  ...t,
80
80
  items: a,
@@ -82,69 +82,69 @@ const yt = [
82
82
  onSelect: r
83
83
  }
84
84
  );
85
- }, Nt = /* @__PURE__ */ p("div", { className: "h-full flex flex-col items-center justify-center text-center px-6 text-muted-foreground", children: [
86
- /* @__PURE__ */ o($e, { 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__ */ p("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
- ] }), kt = ({
93
+ ] }), Tt = ({
94
94
  messages: t = [],
95
95
  onSend: e,
96
96
  slashCommands: n = [],
97
97
  onSlashCommand: r,
98
98
  onClose: a,
99
99
  title: s = "Chat",
100
- placeholder: i = "Send a message…",
101
- emptyState: d = Nt,
102
- className: l
100
+ placeholder: l = "Send a message…",
101
+ emptyState: d = Et,
102
+ className: c
103
103
  }) => {
104
- const [c, y] = R(""), [x, h] = R(0), T = F(null), E = F(null), g = c.startsWith("/") ? n.filter(
105
- (f) => `/${f.command}`.startsWith(c.toLowerCase().split(" ")[0])
106
- ) : [], m = g.length > 0;
107
- O(() => {
108
- E.current && (E.current.scrollTop = E.current.scrollHeight);
109
- }, [t]), O(() => {
110
- h(0);
111
- }, [c]);
112
- const b = () => {
113
- const f = c.trim();
114
- f && (e == null || e(f), y(""));
115
- }, N = (f) => {
116
- var D;
117
- r == null || r(f), y(`/${f.command} `), (D = T.current) == null || D.focus();
118
- }, w = (f) => {
119
- if (m) {
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
+ var S;
117
+ r == null || r(f), g(`/${f.command} `), (S = w.current) == null || S.focus();
118
+ }, x = (f) => {
119
+ if (p) {
120
120
  if (f.key === "ArrowDown") {
121
- f.preventDefault(), h((D) => (D + 1) % g.length);
121
+ f.preventDefault(), u((S) => (S + 1) % y.length);
122
122
  return;
123
123
  }
124
124
  if (f.key === "ArrowUp") {
125
- f.preventDefault(), h((D) => (D - 1 + g.length) % g.length);
125
+ f.preventDefault(), u((S) => (S - 1 + y.length) % y.length);
126
126
  return;
127
127
  }
128
128
  if (f.key === "Tab" || f.key === "Enter" && !f.shiftKey) {
129
- f.preventDefault(), N(g[x]);
129
+ f.preventDefault(), k(y[h]);
130
130
  return;
131
131
  }
132
132
  }
133
- f.key === "Enter" && !f.shiftKey && (f.preventDefault(), b());
133
+ f.key === "Enter" && !f.shiftKey && (f.preventDefault(), v());
134
134
  };
135
- return /* @__PURE__ */ p(
135
+ return /* @__PURE__ */ b(
136
136
  "aside",
137
137
  {
138
138
  role: "complementary",
139
139
  "aria-label": s,
140
- className: L(
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__ */ p("div", { className: "h-10 flex items-center justify-between px-4 shrink-0", children: [
146
- /* @__PURE__ */ p("div", { className: "flex items-center space-x-2 text-muted-foreground", children: [
147
- /* @__PURE__ */ o($e, { 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
150
  a && /* @__PURE__ */ o(
@@ -154,34 +154,34 @@ const yt = [
154
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(V, { 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
168
  children: t.length === 0 ? d : t.map((f) => {
169
- const D = f.role === "user";
170
- return /* @__PURE__ */ p(
169
+ const S = f.role === "user";
170
+ return /* @__PURE__ */ b(
171
171
  "div",
172
172
  {
173
- className: L("flex flex-col", D ? "items-end" : "items-start"),
173
+ className: A("flex flex-col", S ? "items-end" : "items-start"),
174
174
  children: [
175
- /* @__PURE__ */ p("div", { className: "flex items-center space-x-1 mb-1 text-[10px] uppercase tracking-wider text-muted-foreground font-bold", children: [
176
- D ? /* @__PURE__ */ o(Oe, { size: 10 }) : /* @__PURE__ */ o(Re, { size: 10 }),
177
- /* @__PURE__ */ o("span", { children: f.author ?? (D ? "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: L(
182
+ className: A(
183
183
  "max-w-[85%] rounded-lg px-3 py-2 text-xs whitespace-pre-wrap break-words",
184
- D ? "bg-primary text-primary-foreground" : "bg-card border border-border text-foreground"
184
+ S ? "bg-primary text-primary-foreground" : "bg-card border border-border text-foreground"
185
185
  ),
186
186
  children: f.text
187
187
  }
@@ -193,26 +193,26 @@ const yt = [
193
193
  })
194
194
  }
195
195
  ),
196
- /* @__PURE__ */ p("div", { className: "relative border-t border-border/50 p-2 shrink-0", children: [
197
- m && /* @__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: g.map((f, D) => /* @__PURE__ */ p(
203
+ children: y.map((f, S) => /* @__PURE__ */ b(
204
204
  "div",
205
205
  {
206
206
  role: "option",
207
- "aria-selected": D === x,
208
- onMouseEnter: () => h(D),
209
- onClick: () => N(f),
210
- className: L(
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
- D === x ? "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__ */ p("span", { className: "font-mono", children: [
215
+ /* @__PURE__ */ b("span", { className: "font-mono", children: [
216
216
  "/",
217
217
  f.command
218
218
  ] }),
@@ -223,17 +223,17 @@ const yt = [
223
223
  ))
224
224
  }
225
225
  ),
226
- /* @__PURE__ */ p("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: T,
230
+ ref: w,
231
231
  rows: 1,
232
- value: c,
232
+ value: i,
233
233
  "aria-label": `${s} message`,
234
- placeholder: i,
235
- onChange: (f) => y(f.target.value),
236
- onKeyDown: w,
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 yt = [
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(nt, { size: 14 })
248
+ children: /* @__PURE__ */ o(st, { size: 14 })
249
249
  }
250
250
  )
251
251
  ] })
@@ -254,50 +254,50 @@ const yt = [
254
254
  }
255
255
  );
256
256
  };
257
- let Et = 0;
258
- const Tt = () => `msg-${Date.now()}-${Et += 1}`, ae = J((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 ?? Tt() }]
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
- })), fe = "nexus-shell-right-sidebar", xe = J((t) => ({
269
- isChatOpen: localStorage.getItem(fe) === "true",
268
+ })), me = "nexus-shell-right-sidebar", be = q((t) => ({
269
+ isChatOpen: localStorage.getItem(me) === "true",
270
270
  setChatOpen: (r) => {
271
- localStorage.setItem(fe, String(r)), t({ isChatOpen: r });
271
+ localStorage.setItem(me, String(r)), t({ isChatOpen: r });
272
272
  },
273
273
  toggleChat: () => t((r) => {
274
274
  const a = !r.isChatOpen;
275
- return localStorage.setItem(fe, String(a)), { isChatOpen: a };
275
+ return localStorage.setItem(me, String(a)), { isChatOpen: a };
276
276
  })
277
- })), Ct = ({ onSend: t, ...e }) => {
278
- const n = xe((l) => l.isChatOpen), r = xe((l) => l.setChatOpen), a = ae((l) => l.messages), s = ae((l) => l.slashCommands), i = ae((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
- kt,
280
+ Tt,
281
281
  {
282
282
  ...e,
283
283
  messages: a,
284
284
  slashCommands: s,
285
- onSend: (l) => {
286
- if (i({ role: "user", text: l }), l.startsWith("/")) {
287
- const [c, ...y] = l.slice(1).split(/\s+/), x = s.find((h) => h.command === c);
288
- if (x) {
289
- x.execute(y);
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
- i({ 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
- }, Dt = ({
300
+ }, Lt = ({
301
301
  menus: t = {},
302
302
  onSelect: e,
303
303
  title: n,
@@ -305,70 +305,70 @@ const Tt = () => `msg-${Date.now()}-${Et += 1}`, ae = J((t) => ({
305
305
  right: a,
306
306
  className: s
307
307
  }) => {
308
- const i = (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__ */ p("div", { className: "relative group/sub", children: [
314
- /* @__PURE__ */ p(
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: (y) => {
321
- !c.submenu && (y.key === "Enter" || y.key === " ") && (y.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__ */ p("div", { className: "flex items-center space-x-2", children: [
327
- i(c),
328
- c.submenu && /* @__PURE__ */ o(Pe, { 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((y) => /* @__PURE__ */ p(
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(y),
344
- onKeyDown: (x) => {
345
- (x.key === "Enter" || x.key === " ") && (x.preventDefault(), e == null || e(y));
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: y.label }),
350
- i(y)
349
+ /* @__PURE__ */ o("span", { children: g.label }),
350
+ l(g)
351
351
  ]
352
352
  },
353
- y.id
353
+ g.id
354
354
  ))
355
355
  }
356
356
  )
357
- ] }, c.id))
357
+ ] }, i.id))
358
358
  }
359
359
  );
360
- return /* @__PURE__ */ p(
360
+ return /* @__PURE__ */ b(
361
361
  "header",
362
362
  {
363
363
  role: "banner",
364
364
  "aria-label": "Application Header",
365
- className: L(
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__ */ p("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 Tt = () => `msg-${Date.now()}-${Et += 1}`, ae = J((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__ */ p("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,11 +384,11 @@ const Tt = () => `msg-${Date.now()}-${Et += 1}`, ae = J((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 })
@@ -398,9 +398,9 @@ const Tt = () => `msg-${Date.now()}-${Et += 1}`, ae = J((t) => ({
398
398
  }
399
399
  );
400
400
  };
401
- class St {
401
+ class It {
402
402
  constructor() {
403
- Q(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 St {
419
419
  }), e;
420
420
  }
421
421
  }
422
- const ve = new St();
423
- class It {
422
+ const we = new It();
423
+ class Mt {
424
424
  constructor() {
425
- Q(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 It {
442
442
  return Array.from(this.commands.values());
443
443
  }
444
444
  }
445
- const te = new It(), _e = (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
449
  keybinding: e.keybinding ?? (e.commandId ? (n = te.getCommand(e.commandId)) == null ? void 0 : n.keybinding : void 0),
450
- submenu: e.submenu ? _e(e.submenu) : void 0
450
+ submenu: e.submenu ? je(e.submenu) : void 0
451
451
  };
452
- }), Ue = (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 && Ue(n.submenu, e);
455
+ const r = n.submenu && Be(n.submenu, e);
456
456
  if (r) return r;
457
457
  }
458
- }, Lt = (t) => {
459
- const e = ve.getAllMenus(), n = Object.fromEntries(
460
- Object.entries(e).map(([a, s]) => [a, _e(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(Dt, { ...t, menus: n, onSelect: (a) => {
462
+ return /* @__PURE__ */ o(Lt, { ...t, menus: n, onSelect: (a) => {
463
463
  for (const s of Object.values(e)) {
464
- const i = Ue(s, a.id);
465
- if (i != null && i.commandId) {
466
- te.executeCommand(i.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
- }, me = ({
471
+ }, he = ({
472
472
  title: t,
473
473
  children: e,
474
474
  onClose: n,
475
475
  width: r = "300px",
476
476
  className: a
477
- }) => /* @__PURE__ */ p(
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: L(
483
+ className: A(
484
484
  "h-full bg-muted border-r flex flex-col select-none shrink-0",
485
485
  a
486
486
  ),
487
487
  children: [
488
- /* @__PURE__ */ p("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,7 +494,7 @@ const te = new It(), _e = (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(V, { size: 14 })
497
+ children: /* @__PURE__ */ o(Q, { size: 14 })
498
498
  }
499
499
  )
500
500
  ] }),
@@ -526,21 +526,21 @@ const te = new It(), _e = (t) => t.map((e) => {
526
526
  shortLabel: "TAMU",
527
527
  description: "Aggie Maroon (#500000) on white."
528
528
  }
529
- ], Mt = ie.map((t) => `theme-${t.id}`), At = (t) => `theme-${t}`, $t = {
530
- light: st,
531
- dark: ot,
532
- gt: ke,
533
- tamu: ke
534
- }, Ot = ie.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: $t[t.id] ?? at
538
- })), Rt = ({
537
+ icon: Rt[t.id] ?? lt
538
+ })), zt = ({
539
539
  theme: t,
540
540
  onThemeChange: e,
541
- themes: n = Ot,
541
+ themes: n = Pt,
542
542
  className: r
543
- }) => /* @__PURE__ */ o("div", { className: L("p-4 space-y-6", r), children: /* @__PURE__ */ p("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,19 +548,19 @@ const te = new It(), _e = (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: a, label: s, icon: i }) => /* @__PURE__ */ p(
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
556
  "aria-checked": t === a,
557
557
  onClick: () => e(a),
558
- className: L(
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
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(i, { size: 16 }),
563
+ /* @__PURE__ */ o(l, { size: 16 }),
564
564
  /* @__PURE__ */ o("span", { children: s })
565
565
  ]
566
566
  },
@@ -568,38 +568,38 @@ const te = new It(), _e = (t) => t.map((e) => {
568
568
  ))
569
569
  }
570
570
  )
571
- ] }) }), Ee = "nexus-shell-theme", Te = (t) => {
571
+ ] }) }), Te = "nexus-shell-theme", Ce = (t) => {
572
572
  const e = window.document.documentElement, n = [
573
- ...Mt,
573
+ ...Ot,
574
574
  ...Array.from(e.classList).filter((r) => r.startsWith("theme-"))
575
575
  ];
576
- e.classList.remove(...n), e.classList.add(At(t));
577
- }, oe = J((t) => {
578
- const n = localStorage.getItem(Ee) || "light";
579
- return Te(n), {
576
+ e.classList.remove(...n), e.classList.add($t(t));
577
+ }, oe = q((t) => {
578
+ const n = localStorage.getItem(Te) || "light";
579
+ return Ce(n), {
580
580
  theme: n,
581
581
  setTheme: (r) => {
582
- localStorage.setItem(Ee, r), Te(r), t({ theme: r });
582
+ localStorage.setItem(Te, r), Ce(r), t({ theme: r });
583
583
  }
584
584
  };
585
- }), Pt = (t) => {
586
- const e = G((c) => c.activeSidebar), n = G((c) => c.panels), r = G((c) => c.setActiveSidebar), a = oe((c) => c.theme), s = oe((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 i = () => r(null);
588
+ const l = () => r(null);
589
589
  if (e === "settings")
590
- return /* @__PURE__ */ o(me, { ...t, title: "Settings", onClose: i, children: /* @__PURE__ */ o(
591
- Rt,
590
+ return /* @__PURE__ */ o(he, { ...t, title: "Settings", onClose: l, children: /* @__PURE__ */ o(
591
+ zt,
592
592
  {
593
593
  theme: a,
594
- onThemeChange: (c) => s(c)
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(me, { ...t, title: e, onClose: i, 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(me, { ...t, title: d.label, onClose: i, children: l ? /* @__PURE__ */ o(l, {}) : d.component });
602
- }, pe = (t, e) => (e.priority ?? 0) - (t.priority ?? 0), zt = ({
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"
@@ -609,36 +609,36 @@ const te = new It(), _e = (t) => t.map((e) => {
609
609
  center: t.filter((s) => s.alignment === "center").sort(pe),
610
610
  right: t.filter((s) => s.alignment === "right").sort(pe)
611
611
  }, a = (s) => {
612
- const i = s.icon, d = !!s.onClick;
613
- return /* @__PURE__ */ p(
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: L(
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
- i && /* @__PURE__ */ o(i, { 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__ */ p(
636
+ return /* @__PURE__ */ b(
637
637
  "footer",
638
638
  {
639
639
  role: "status",
640
640
  "aria-label": n,
641
- className: L(
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
  ),
@@ -649,7 +649,7 @@ const te = new It(), _e = (t) => t.map((e) => {
649
649
  ]
650
650
  }
651
651
  );
652
- }, we = J((t) => ({
652
+ }, Ne = q((t) => ({
653
653
  widgets: [],
654
654
  setWidgets: (e) => t({ widgets: e }),
655
655
  addWidget: (e) => t((n) => ({
@@ -664,47 +664,47 @@ const te = new It(), _e = (t) => t.map((e) => {
664
664
  widgets: r.widgets.map((a) => a.id === e ? { ...a, ...n } : a)
665
665
  }))
666
666
  })), Kt = (t) => {
667
- const e = we((r) => r.widgets), n = B(
667
+ const e = Ne((r) => r.widgets), n = j(
668
668
  () => e.map(({ commandId: r, ...a }) => ({
669
669
  ...a,
670
670
  onClick: a.onClick ?? (r ? () => te.executeCommand(r) : void 0)
671
671
  })),
672
672
  [e]
673
673
  );
674
- return /* @__PURE__ */ o(zt, { ...t, widgets: n });
675
- }, Ft = ({
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
680
  prompt: a = "$",
681
681
  title: s = "Terminal",
682
- className: i
682
+ className: l
683
683
  }) => {
684
- const [d, l] = R(""), c = F(null), y = F(null);
685
- O(() => {
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 x = (h) => {
689
- if (h.key !== "Enter") return;
690
- const T = d.trim();
691
- T && (e == null || e(T), 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__ */ p(
693
+ return /* @__PURE__ */ b(
694
694
  "div",
695
695
  {
696
696
  style: { height: r },
697
- className: L(
697
+ className: A(
698
698
  "bg-card border-t border-border flex flex-col shrink-0 font-mono text-xs",
699
- i
699
+ l
700
700
  ),
701
701
  children: [
702
- /* @__PURE__ */ p("div", { className: "h-8 flex items-center justify-between px-3 border-b border-border/50 shrink-0", children: [
703
- /* @__PURE__ */ p("div", { className: "flex items-center space-x-2 text-muted-foreground", children: [
704
- /* @__PURE__ */ o(Re, { 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__ */ p("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 te = new It(), _e = (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(ze, { size: 14 })
715
+ children: /* @__PURE__ */ o(Fe, { size: 14 })
716
716
  }
717
717
  ),
718
718
  /* @__PURE__ */ o(
@@ -722,7 +722,7 @@ const te = new It(), _e = (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(V, { size: 14 })
725
+ children: /* @__PURE__ */ o(Q, { size: 14 })
726
726
  }
727
727
  )
728
728
  ] })
@@ -730,28 +730,28 @@ const te = new It(), _e = (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 h;
739
- return (h = y.current) == null ? void 0 : h.focus();
738
+ var u;
739
+ return (u = g.current) == null ? void 0 : u.focus();
740
740
  },
741
- children: t.map((h, T) => /* @__PURE__ */ o("div", { className: "whitespace-pre-wrap break-all text-foreground/90", children: h }, T))
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__ */ p("div", { className: "flex items-center px-3 py-2 border-t border-border/50 shrink-0", children: [
744
+ /* @__PURE__ */ b("div", { className: "flex items-center px-3 py-2 border-t border-border/50 shrink-0", children: [
745
745
  /* @__PURE__ */ o("span", { className: "text-primary mr-2 select-none", children: a }),
746
746
  /* @__PURE__ */ o(
747
747
  "input",
748
748
  {
749
- ref: y,
749
+ ref: g,
750
750
  type: "text",
751
751
  "aria-label": `${s} input`,
752
752
  value: d,
753
- onChange: (h) => l(h.target.value),
754
- onKeyDown: x,
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 te = new It(), _e = (t) => t.map((e) => {
761
761
  ]
762
762
  }
763
763
  );
764
- }, ne = J((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
- })), _t = [
771
+ })), jt = [
772
772
  "Available commands:",
773
773
  " help — show this message",
774
774
  " clear — clear the terminal"
775
- ], Ut = ({
775
+ ], Bt = ({
776
776
  onCommand: t,
777
777
  ...e
778
778
  }) => {
779
- const n = ne((l) => l.isOpen), r = ne((l) => l.history), a = ne((l) => l.setOpen), s = ne((l) => l.addHistory), i = ne((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
- Ft,
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
- i();
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
- _t.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
798
  onClose: () => a(!1)
799
799
  }
800
800
  ) : null;
801
801
  };
802
- class jt {
802
+ class Ht {
803
803
  constructor() {
804
- Q(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 jt {
823
823
  return Array.from(this.components.keys());
824
824
  }
825
825
  }
826
- const Bt = new jt(), X = {
826
+ const Wt = new Ht(), V = {
827
827
  global: { tabEnableClose: !0, tabSetEnableMaximize: !1, tabSetEnableDivide: !0 },
828
828
  borders: [
829
829
  {
@@ -849,45 +849,45 @@ const Bt = new jt(), X = {
849
849
  }
850
850
  ]
851
851
  }
852
- }, Ce = "nexus-shell-layout", Ht = J((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(Ce);
856
+ const r = localStorage.getItem(Se);
857
857
  if (r) {
858
858
  const a = JSON.parse(r);
859
- n = W.fromJson(a);
860
- const s = /* @__PURE__ */ new Set(["dialogue-library", "argument-inspector"]), i = [];
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()) && i.push(l.getId());
863
+ const c = d;
864
+ s.has(c.getComponent()) && l.push(c.getId());
865
865
  }
866
- }), i.forEach((d) => {
866
+ }), l.forEach((d) => {
867
867
  n.doAction(re.deleteTab(d));
868
868
  });
869
869
  } else
870
- n = W.fromJson(X);
870
+ n = G.fromJson(V);
871
871
  } catch (r) {
872
- console.warn("Failed to load layout from storage, using default", r), n = W.fromJson(X);
872
+ console.warn("Failed to load layout from storage, using default", r), n = G.fromJson(V);
873
873
  }
874
874
  else
875
- n = W.fromJson(X);
875
+ n = G.fromJson(V);
876
876
  return {
877
877
  model: n,
878
878
  dirtyTabs: /* @__PURE__ */ new Set(),
879
- storageKey: Ce,
879
+ storageKey: Se,
880
880
  disableLocalStorage: !1,
881
881
  initLayout: (r, a) => {
882
882
  let s;
883
883
  if (r && Object.keys(r).length > 0)
884
884
  try {
885
- s = W.fromJson(r);
886
- } catch (i) {
887
- console.warn("Failed to parse init layout json, using default", i), s = W.fromJson(X);
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 = W.fromJson(X);
890
+ s = G.fromJson(V);
891
891
  t({ model: s, disableLocalStorage: a || !1 });
892
892
  },
893
893
  setModel: (r) => {
@@ -904,82 +904,82 @@ const Bt = new jt(), X = {
904
904
  let s;
905
905
  if (typeof window < "u")
906
906
  try {
907
- const i = localStorage.getItem(r);
908
- i ? s = W.fromJson(JSON.parse(i)) : s = W.fromJson(a || X);
909
- } catch (i) {
910
- console.warn("Failed to load layout from storage for key", r, i), s = W.fromJson(a || X);
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 = W.fromJson(a || X);
913
+ s = G.fromJson(a || V);
914
914
  t({ storageKey: r, model: s });
915
915
  },
916
916
  setTabDirty: (r, a) => {
917
917
  t((s) => {
918
- const i = new Set(s.dirtyTabs);
919
- return a ? i.add(r) : i.delete(r), { dirtyTabs: i };
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
923
  addTab: (r, a, s) => {
924
- const i = e().model, d = i.getActiveTabset();
925
- let l = d == null ? void 0 : d.getId();
926
- if (!l)
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 x = i.getFirstTabSet();
929
- l = x == null ? void 0 : x.getId();
930
- } catch (x) {
931
- console.warn("Failed to get first tabset fallback", x);
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 y = { ...{}, ...s };
933
+ const g = { ...{}, ...s };
934
934
  if (["nexus-dashboard", "nexus-docs"].includes(r)) {
935
- let x = null;
936
- if (i.visitNodes((h) => {
937
- if (h.getType() === "tab") {
938
- const T = h;
939
- T.getComponent() === r && (x = T.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
- }), x) {
942
- i.doAction(re.selectTab(x));
941
+ }), h) {
942
+ l.doAction(re.selectTab(h));
943
943
  return;
944
944
  }
945
945
  }
946
- if (y.mapId) {
947
- let x = null;
948
- if (i.visitNodes((h) => {
949
- var T;
950
- if (h.getType() === "tab") {
951
- const E = h;
952
- ((T = E.getConfig()) == null ? void 0 : T.mapId) === y.mapId && (x = 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
- }), x) {
955
- i.doAction(re.selectTab(x));
954
+ }), h) {
955
+ l.doAction(re.selectTab(h));
956
956
  return;
957
957
  }
958
958
  }
959
- if (y.projectId) {
960
- let x = null;
961
- if (i.visitNodes((h) => {
962
- var T;
963
- if (h.getType() === "tab") {
964
- const E = h;
965
- ((T = E.getConfig()) == null ? void 0 : T.projectId) === y.projectId && (x = 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
- }), x) {
968
- i.doAction(re.selectTab(x));
967
+ }), h) {
968
+ l.doAction(re.selectTab(h));
969
969
  return;
970
970
  }
971
971
  }
972
- l && i.doAction(
972
+ c && l.doAction(
973
973
  re.addNode(
974
- { type: "tab", component: r, name: a || r, config: y },
975
- l,
976
- et.CENTER,
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
- }), je = J((t, e) => ({
982
+ }), He = q((t, e) => ({
983
983
  isOpen: !1,
984
984
  type: "alert",
985
985
  title: "",
@@ -999,100 +999,100 @@ const Bt = new jt(), X = {
999
999
  const { resolve: r } = e();
1000
1000
  r && r(n), t({ isOpen: !1, resolve: null });
1001
1001
  }
1002
- })), Sr = ({
1002
+ })), Or = ({
1003
1003
  panels: t,
1004
1004
  slashCommands: e,
1005
1005
  menuConfig: n,
1006
1006
  statusBarConfig: r,
1007
1007
  title: a,
1008
1008
  rightMenuBarContent: s,
1009
- centerMenuBarContent: i,
1009
+ centerMenuBarContent: l,
1010
1010
  layoutModel: d,
1011
- initialLayoutJson: l,
1012
- disableLocalStorage: c = !1,
1013
- onLayoutChange: y
1011
+ initialLayoutJson: c,
1012
+ disableLocalStorage: i = !1,
1013
+ onLayoutChange: g
1014
1014
  }) => {
1015
- const { model: x, setModel: h, initLayout: T, isTabDirty: E, setTabDirty: g } = Ht(), m = oe((M) => M.theme), b = G((M) => M.setPanels), N = ae((M) => M.setSlashCommands), w = we((M) => M.setWidgets);
1016
- O(() => {
1017
- t && b(t);
1018
- }, [t, b]), O(() => {
1019
- e && N(e);
1020
- }, [e, N]), O(() => {
1021
- n && ve.setMenus(n);
1022
- }, [n]), O(() => {
1023
- r && w(r);
1024
- }, [r, w]), O(() => {
1025
- d || !l && !c || T(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 f = (M) => {
1027
+ const f = (I) => {
1028
1028
  try {
1029
- const A = M.getComponent(), C = M.getConfig() || {}, S = A ? Bt.get(A) : void 0;
1030
- return S ? /* @__PURE__ */ o(S, { node: M, ...C }) : /* @__PURE__ */ p("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
- A
1032
+ M
1033
1033
  ] });
1034
- } catch (A) {
1035
- return console.error("Error in component factory:", A), /* @__PURE__ */ p("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
- A instanceof Error ? A.message : "Unknown error"
1037
+ M instanceof Error ? M.message : "Unknown error"
1038
1038
  ] });
1039
1039
  }
1040
- }, D = (M) => {
1041
- if (M.type !== re.DELETE_TAB) return M;
1042
- const A = x.getNodeById(M.data.node);
1043
- if (!A || !E(A.getId())) return M;
1044
- je.getState().openConfirm(
1045
- `Tab "${A.getName()}" has unsaved changes. Are you sure you want to close it?`
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
1046
  ).then((C) => {
1047
- C && (g(A.getId(), !1), x.doAction(M));
1047
+ C && (y(M.getId(), !1), h.doAction(I));
1048
1048
  });
1049
1049
  };
1050
- return /* @__PURE__ */ p(
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-${m}`,
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
- Lt,
1056
+ At,
1057
1057
  {
1058
1058
  title: a,
1059
- center: i,
1059
+ center: l,
1060
1060
  right: s
1061
1061
  }
1062
1062
  ),
1063
- /* @__PURE__ */ p("div", { className: "flex-1 flex overflow-hidden", children: [
1064
- /* @__PURE__ */ o(wt, {}),
1065
- /* @__PURE__ */ o(Pt, {}),
1066
- /* @__PURE__ */ p("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
- tt,
1068
+ nt,
1069
1069
  {
1070
- model: d || x,
1070
+ model: d || h,
1071
1071
  factory: f,
1072
- onModelChange: (M) => {
1073
- d || h(M), y == null || y(M.toJson());
1072
+ onModelChange: (I) => {
1073
+ d || u(I), g == null || g(I.toJson());
1074
1074
  },
1075
- onAction: D
1075
+ onAction: S
1076
1076
  }
1077
1077
  ) }),
1078
- /* @__PURE__ */ o(Ut, {})
1078
+ /* @__PURE__ */ o(Bt, {})
1079
1079
  ] }),
1080
- /* @__PURE__ */ o(Ct, {})
1080
+ /* @__PURE__ */ o(Dt, {})
1081
1081
  ] }),
1082
1082
  /* @__PURE__ */ o(Kt, {})
1083
1083
  ]
1084
1084
  }
1085
1085
  );
1086
- }, Be = ie.map((t) => ({
1086
+ }, We = ie.map((t) => ({
1087
1087
  id: `theme.${t.id}`,
1088
1088
  label: `Preferences: ${t.label} Theme`,
1089
1089
  execute: () => oe.getState().setTheme(t.id)
1090
- })), Ir = [
1090
+ })), $r = [
1091
1091
  "view.toggleTerminal",
1092
1092
  "view.toggleChat",
1093
1093
  "view.toggleSidebar",
1094
- ...Be.map((t) => t.id)
1095
- ], Wt = [
1094
+ ...We.map((t) => t.id)
1095
+ ], Yt = [
1096
1096
  {
1097
1097
  id: "view.toggleTerminal",
1098
1098
  label: "View: Toggle Terminal",
@@ -1102,7 +1102,7 @@ const Bt = new jt(), X = {
1102
1102
  {
1103
1103
  id: "view.toggleChat",
1104
1104
  label: "View: Toggle Chat",
1105
- execute: () => xe.getState().toggleChat()
1105
+ execute: () => be.getState().toggleChat()
1106
1106
  },
1107
1107
  {
1108
1108
  id: "view.toggleSidebar",
@@ -1110,12 +1110,12 @@ const Bt = new jt(), X = {
1110
1110
  keybinding: "Control+b",
1111
1111
  execute: () => {
1112
1112
  var r;
1113
- const { activeSidebar: t, panels: e, setActiveSidebar: n } = G.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
- ...Be
1118
- ], Gt = {
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" },
@@ -1130,28 +1130,28 @@ const Bt = new jt(), X = {
1130
1130
  }))
1131
1131
  }
1132
1132
  ]
1133
- }, Lr = (t = {}) => {
1133
+ }, Rr = (t = {}) => {
1134
1134
  const {
1135
1135
  panels: e,
1136
1136
  menus: n,
1137
1137
  commands: r,
1138
1138
  statusBar: a,
1139
1139
  slashCommands: s,
1140
- defaultCommands: i = !0,
1140
+ defaultCommands: l = !0,
1141
1141
  defaultMenus: d = !0
1142
1142
  } = t;
1143
- i && Wt.forEach((c) => te.registerCommand(c)), r == null || r.forEach((c) => te.registerCommand(c));
1144
- const l = {
1145
- ...i && d ? Gt : {},
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 && ve.setMenus(l), e && G.getState().setPanels(e), a && we.getState().setWidgets(a), s && ae.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 Yt {
1150
+ class Xt {
1151
1151
  constructor() {
1152
- Q(this, "plugins", /* @__PURE__ */ new Map());
1153
- Q(this, "loaders", /* @__PURE__ */ new Map());
1154
- Q(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 Yt {
1210
1210
  return Array.from(this.plugins.values());
1211
1211
  }
1212
1212
  }
1213
- const Mr = new Yt(), De = "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
- }, Z = J((t) => {
1220
- let e = { ...Se };
1219
+ }, ee = q((t) => {
1220
+ let e = { ...Le };
1221
1221
  if (typeof window < "u")
1222
1222
  try {
1223
1223
  const r = localStorage.getItem(De);
1224
- r && (e = { ...Se, ...JSON.parse(r) });
1224
+ r && (e = { ...Le, ...JSON.parse(r) });
1225
1225
  } catch (r) {
1226
1226
  console.error("Failed to parse saved user profile:", r);
1227
1227
  }
@@ -1257,12 +1257,12 @@ const Mr = new Yt(), De = "nexus-shell-user-profile", Se = {
1257
1257
  return n(a), { customAvatar: "" };
1258
1258
  })
1259
1259
  };
1260
- }), Ar = () => {
1261
- O(() => {
1260
+ }), zr = () => {
1261
+ P(() => {
1262
1262
  const t = (e) => {
1263
1263
  const n = te.getCommands();
1264
1264
  for (const r of n)
1265
- if (r.keybinding && Jt(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 Mr = new Yt(), De = "nexus-shell-user-profile", Se = {
1270
1270
  return window.addEventListener("keydown", t), () => window.removeEventListener("keydown", t);
1271
1271
  }, []);
1272
1272
  };
1273
- function Jt(t, e) {
1274
- var h;
1275
- const n = e.split("+"), r = (h = n.pop()) == null ? void 0 : h.toLowerCase(), a = n.includes("Control") || n.includes("Ctrl"), s = n.includes("Shift"), i = n.includes("Alt"), d = n.includes("Meta") || n.includes("Cmd"), l = t.ctrlKey, c = t.shiftKey, y = t.altKey, x = t.metaKey;
1276
- return t.key.toLowerCase() === r && l === a && c === s && y === i && x === 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 Xt = (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
- }, qt = ({
1281
+ }, Qt = ({
1282
1282
  open: t,
1283
1283
  commands: e,
1284
1284
  onSelect: n,
1285
1285
  onClose: r,
1286
1286
  inline: a = !1,
1287
1287
  placeholder: s = "Type a command to run…",
1288
- filter: i = Xt,
1288
+ filter: l = Vt,
1289
1289
  className: d
1290
1290
  }) => {
1291
- const [l, c] = R(""), [y, x] = R(0), h = F(null), T = B(
1292
- () => e.filter((g) => i(g, l)),
1293
- [e, l, i]
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 (O(() => {
1296
- var g;
1297
- t && (c(""), x(0), (g = h.current) == null || g.focus());
1298
- }, [t]), O(() => {
1299
- x(0);
1300
- }, [l]), !t) return null;
1301
- const E = (g) => {
1302
- g.key === "ArrowDown" ? (g.preventDefault(), x((m) => T.length ? (m + 1) % T.length : 0)) : g.key === "ArrowUp" ? (g.preventDefault(), x(
1303
- (m) => T.length ? (m - 1 + T.length) % T.length : 0
1304
- )) : g.key === "Enter" ? (g.preventDefault(), T[y] && n(T[y])) : g.key === "Escape" && (g.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
1309
  onClick: a ? void 0 : r,
1310
- className: L(
1310
+ className: A(
1311
1311
  "z-[100] flex items-start justify-center",
1312
1312
  a ? "relative w-full max-w-xl" : "fixed inset-0 pt-[10vh] bg-black/50 backdrop-blur-sm"
1313
1313
  ),
1314
- children: /* @__PURE__ */ p(
1314
+ children: /* @__PURE__ */ b(
1315
1315
  "div",
1316
1316
  {
1317
1317
  role: "dialog",
1318
1318
  "aria-modal": !a,
1319
1319
  "aria-label": "Command Palette",
1320
- onClick: (g) => g.stopPropagation(),
1321
- className: L(
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__ */ p("div", { className: "flex items-center px-4 border-b", children: [
1327
- /* @__PURE__ */ o(ue, { 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: h,
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: (g) => c(g.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 Xt = (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: T.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." }) : T.map((g, m) => /* @__PURE__ */ p(
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": m === y,
1356
- onClick: () => n(g),
1357
- onMouseEnter: () => x(m),
1358
- className: L(
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
- m === y ? "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: g.label }),
1364
- g.keybinding && /* @__PURE__ */ o("span", { className: "text-[10px] text-muted-foreground bg-muted px-1.5 py-0.5 rounded border border-border/50", children: g.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
- g.id
1367
+ y.id
1368
1368
  ))
1369
1369
  }
1370
1370
  ),
1371
- /* @__PURE__ */ p("div", { className: "px-4 py-2 border-t bg-muted/30 flex justify-between items-center text-[10px] text-muted-foreground", children: [
1372
- /* @__PURE__ */ p("div", { className: "flex gap-3", children: [
1373
- /* @__PURE__ */ p("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__ */ p("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__ */ p("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,19 +1389,19 @@ const Xt = (t, e) => {
1389
1389
  )
1390
1390
  }
1391
1391
  );
1392
- }, $r = ({
1392
+ }, _r = ({
1393
1393
  shortcutKey: t = "p",
1394
1394
  ...e
1395
1395
  }) => {
1396
- const [n, r] = R(!1);
1397
- return O(() => {
1396
+ const [n, r] = $(!1);
1397
+ return P(() => {
1398
1398
  if (t === null) return;
1399
1399
  const a = (s) => {
1400
- (s.metaKey || s.ctrlKey) && s.shiftKey && s.key.toLowerCase() === t && (s.preventDefault(), r((i) => !i));
1400
+ (s.metaKey || s.ctrlKey) && s.shiftKey && s.key.toLowerCase() === t && (s.preventDefault(), r((l) => !l));
1401
1401
  };
1402
1402
  return window.addEventListener("keydown", a), () => window.removeEventListener("keydown", a);
1403
1403
  }, [t]), /* @__PURE__ */ o(
1404
- qt,
1404
+ Qt,
1405
1405
  {
1406
1406
  ...e,
1407
1407
  open: n,
@@ -1412,76 +1412,76 @@ const Xt = (t, e) => {
1412
1412
  onClose: () => r(!1)
1413
1413
  }
1414
1414
  );
1415
- }, Vt = {
1416
- alert: ct,
1417
- confirm: lt,
1418
- prompt: it
1419
- }, Qt = {
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
- }, Zt = ({
1423
+ }, tr = ({
1424
1424
  open: t,
1425
1425
  type: e = "alert",
1426
1426
  title: n,
1427
1427
  message: r,
1428
1428
  defaultValue: a = "",
1429
1429
  onConfirm: s,
1430
- onCancel: i,
1430
+ onCancel: l,
1431
1431
  confirmLabel: d,
1432
- cancelLabel: l = "Cancel",
1433
- placeholder: c = "Enter value…",
1434
- className: y
1432
+ cancelLabel: c = "Cancel",
1433
+ placeholder: i = "Enter value…",
1434
+ className: g
1435
1435
  }) => {
1436
- const [x, h] = R(a), T = F(null);
1437
- if (O(() => {
1438
- if (!t || (h(a), e !== "prompt")) return;
1439
- const b = window.setTimeout(() => {
1440
- var N, w;
1441
- (N = T.current) == null || N.focus(), (w = T.current) == null || w.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, a]), O(() => {
1443
+ return () => window.clearTimeout(v);
1444
+ }, [t, e, a]), P(() => {
1445
1445
  if (!t) return;
1446
- const b = (N) => {
1447
- N.key === "Escape" && (N.preventDefault(), i == null || i());
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, i]), !t) return null;
1451
- const E = () => s == null ? void 0 : s(e === "prompt" ? x : void 0), g = (b) => {
1452
- b.key === "Enter" && (b.preventDefault(), E());
1453
- }, m = Vt[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: i,
1459
- children: /* @__PURE__ */ p(
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: g,
1467
- className: L(
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
- y
1469
+ g
1470
1470
  ),
1471
1471
  children: [
1472
1472
  /* @__PURE__ */ o(
1473
1473
  "button",
1474
1474
  {
1475
1475
  type: "button",
1476
- onClick: i,
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(V, { size: 18 })
1479
+ children: /* @__PURE__ */ o(Q, { size: 18 })
1480
1480
  }
1481
1481
  ),
1482
- /* @__PURE__ */ p("div", { className: "flex items-start space-x-4 mb-4", children: [
1483
- /* @__PURE__ */ o("div", { className: L("p-2 bg-muted rounded-full shrink-0", Qt[e]), children: /* @__PURE__ */ o(m, { size: 24 }) }),
1484
- /* @__PURE__ */ p("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 Xt = (t, e) => {
1489
1489
  e === "prompt" && /* @__PURE__ */ o("div", { className: "mt-2 mb-4", children: /* @__PURE__ */ o(
1490
1490
  "input",
1491
1491
  {
1492
- ref: T,
1492
+ ref: w,
1493
1493
  type: "text",
1494
1494
  "aria-label": n,
1495
- value: x,
1496
- placeholder: c,
1497
- onChange: (b) => h(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__ */ p("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: i,
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,10 +1524,10 @@ const Xt = (t, e) => {
1524
1524
  )
1525
1525
  }
1526
1526
  );
1527
- }, Or = (t) => {
1528
- const { isOpen: e, type: n, title: r, message: a, defaultValue: s, close: i } = je();
1527
+ }, Fr = (t) => {
1528
+ const { isOpen: e, type: n, title: r, message: a, defaultValue: s, close: l } = He();
1529
1529
  return /* @__PURE__ */ o(
1530
- Zt,
1530
+ tr,
1531
1531
  {
1532
1532
  ...t,
1533
1533
  open: e,
@@ -1535,21 +1535,21 @@ const Xt = (t, e) => {
1535
1535
  title: r,
1536
1536
  message: a,
1537
1537
  defaultValue: s,
1538
- onConfirm: (c) => {
1539
- n === "prompt" ? i(c ?? "") : n === "confirm" ? i(!0) : i();
1538
+ onConfirm: (i) => {
1539
+ n === "prompt" ? l(i ?? "") : n === "confirm" ? l(!0) : l();
1540
1540
  },
1541
1541
  onCancel: () => {
1542
- n === "prompt" ? i(null) : n === "confirm" ? i(!1) : i();
1542
+ n === "prompt" ? l(null) : n === "confirm" ? l(!1) : l();
1543
1543
  }
1544
1544
  }
1545
1545
  );
1546
- }, er = ie.map((t) => ({
1546
+ }, rr = ie.map((t) => ({
1547
1547
  id: t.id,
1548
1548
  label: t.shortLabel
1549
- })), tr = ({
1549
+ })), nr = ({
1550
1550
  value: t,
1551
1551
  onChange: e,
1552
- options: n = er,
1552
+ options: n = rr,
1553
1553
  className: r,
1554
1554
  "aria-label": a = "Theme"
1555
1555
  }) => /* @__PURE__ */ o(
@@ -1557,7 +1557,7 @@ const Xt = (t, e) => {
1557
1557
  {
1558
1558
  role: "radiogroup",
1559
1559
  "aria-label": a,
1560
- className: L(
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 Xt = (t, e) => {
1567
1567
  role: "radio",
1568
1568
  "aria-checked": t === s.id,
1569
1569
  onClick: () => e(s.id),
1570
- className: L(
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 Xt = (t, e) => {
1576
1576
  s.id
1577
1577
  ))
1578
1578
  }
1579
- ), Rr = (t) => {
1579
+ ), Kr = (t) => {
1580
1580
  const e = oe((r) => r.theme), n = oe((r) => r.setTheme);
1581
- return /* @__PURE__ */ o(tr, { ...t, value: e, onChange: n });
1582
- }, rr = ({
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
1587
  onClick: a,
1588
1588
  showName: s = !0,
1589
- className: i
1589
+ className: l
1590
1590
  }) => {
1591
- const { name: d, role: l, email: c, avatarUrl: y } = t, [x, h] = R(!1), [T, E] = R(!1), [g, m] = R(d), [b, N] = R(l ?? ""), w = F(null), f = F(null);
1592
- O(() => {
1593
- x && (m(d), N(l ?? ""), E(!1));
1594
- }, [x, d, l]), O(() => {
1595
- if (!x) return;
1596
- const C = (S) => {
1597
- w.current && !w.current.contains(S.target) && h(!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
1599
  return document.addEventListener("mousedown", C), () => document.removeEventListener("mousedown", C);
1600
- }, [x]);
1601
- const D = (C) => {
1602
- C.preventDefault(), n == null || n({ name: g, role: b }), E(!1);
1603
- }, M = (C) => {
1604
- var u;
1605
- const S = (u = C.target.files) == null ? void 0 : u[0];
1606
- S && (r == null || r(S)), C.target.value = "";
1607
- }, A = (C) => y ? /* @__PURE__ */ o("img", { src: y, alt: d, className: "w-full h-full object-cover" }) : /* @__PURE__ */ o(Oe, { size: C, className: "text-muted-foreground" });
1608
- return /* @__PURE__ */ p("div", { ref: w, className: "relative inline-block text-left", children: [
1609
- /* @__PURE__ */ p(
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: () => a ? a() : h((C) => !C),
1613
+ onClick: () => a ? a() : u((C) => !C),
1614
1614
  "aria-haspopup": a ? void 0 : "menu",
1615
- "aria-expanded": a ? void 0 : x,
1615
+ "aria-expanded": a ? void 0 : h,
1616
1616
  "aria-label": "User Profile Menu",
1617
- className: L(
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
- x && (s ? "bg-accent/60 border-border/40" : "border-primary/50 text-foreground ring-1 ring-primary/20"),
1621
- i
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: L(
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: A(s ? 13 : 12)
1631
+ children: M(s ? 13 : 12)
1632
1632
  }
1633
1633
  ),
1634
- s && /* @__PURE__ */ p("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
  }
@@ -1643,77 +1643,77 @@ const Xt = (t, e) => {
1643
1643
  {
1644
1644
  type: "file",
1645
1645
  ref: f,
1646
- onChange: M,
1646
+ onChange: I,
1647
1647
  accept: "image/*",
1648
1648
  "aria-label": "Upload avatar",
1649
1649
  className: "hidden"
1650
1650
  }
1651
1651
  ),
1652
- x && /* @__PURE__ */ o(
1652
+ h && /* @__PURE__ */ o(
1653
1653
  "div",
1654
1654
  {
1655
1655
  role: "menu",
1656
- className: L(
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: T ? /* @__PURE__ */ p("form", { onSubmit: D, 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__ */ p("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: g,
1670
- onChange: (C) => m(C.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__ */ p("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: (C) => N(C.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__ */ p("div", { className: "flex gap-1.5 mt-1 justify-end", children: [
1690
- /* @__PURE__ */ p(
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(V, { size: 10 }),
1697
+ /* @__PURE__ */ o(Q, { size: 10 }),
1698
1698
  " Cancel"
1699
1699
  ]
1700
1700
  }
1701
1701
  ),
1702
- /* @__PURE__ */ p(
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(dt, { size: 10 }),
1708
+ /* @__PURE__ */ o(ft, { size: 10 }),
1709
1709
  " Save"
1710
1710
  ]
1711
1711
  }
1712
1712
  )
1713
1713
  ] })
1714
- ] }) : /* @__PURE__ */ p(Ae, { children: [
1715
- /* @__PURE__ */ p("div", { className: "p-2 flex items-center gap-3 border-b border-border/40 pb-2.5 mb-1", children: [
1716
- /* @__PURE__ */ p(
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: () => {
@@ -1721,52 +1721,52 @@ const Xt = (t, e) => {
1721
1721
  return r && ((C = f.current) == null ? void 0 : C.click());
1722
1722
  },
1723
1723
  title: r ? "Upload avatar image" : void 0,
1724
- className: L(
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
- A(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(ut, { 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__ */ p("div", { className: "flex flex-col min-w-0 leading-normal flex-1", children: [
1735
- /* @__PURE__ */ p("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(ft, { 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
1753
  e.map((C) => {
1754
- const S = C.icon;
1755
- return /* @__PURE__ */ p(
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
- C.onSelect(), h(!1);
1761
+ C.onSelect(), u(!1);
1762
1762
  },
1763
- className: L(
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
1765
  C.destructive ? "text-destructive hover:bg-destructive/10" : "hover:bg-accent/60 hover:text-accent-foreground",
1766
1766
  C.divider && "border-t border-border/20 pt-2 mt-1"
1767
1767
  ),
1768
1768
  children: [
1769
- S && /* @__PURE__ */ o(S, { size: 12, className: "opacity-70" }),
1769
+ D && /* @__PURE__ */ o(D, { size: 12, className: "opacity-70" }),
1770
1770
  C.label
1771
1771
  ]
1772
1772
  },
@@ -1777,38 +1777,38 @@ const Xt = (t, e) => {
1777
1777
  }
1778
1778
  )
1779
1779
  ] });
1780
- }, Pr = (t) => {
1781
- const e = Z((c) => c.name), n = Z((c) => c.role), r = Z((c) => c.email), a = Z((c) => c.avatarUrl), s = Z((c) => c.customAvatar), i = Z((c) => c.updateProfile), d = Z((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
- rr,
1783
+ or,
1784
1784
  {
1785
1785
  ...t,
1786
1786
  profile: { name: e, role: n, email: r, avatarUrl: s || a },
1787
- onProfileChange: i,
1788
- onAvatarChange: (c) => {
1789
- const y = new FileReader();
1790
- y.onloadend = () => {
1791
- typeof y.result == "string" && d(y.result);
1792
- }, y.readAsDataURL(c);
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
- }, zr = ({ title: t, subtitle: e, icon: n, className: r }) => /* @__PURE__ */ p("div", { className: L("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__ */ p("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
- ] }), nr = ({ x: t, y: e, items: n, onClose: r, className: a }) => {
1802
+ ] }), sr = ({ x: t, y: e, items: n, onClose: r, className: a }) => {
1803
1803
  const s = F(null);
1804
- return O(() => {
1805
- const i = (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", i), document.addEventListener("keydown", d), () => {
1811
- document.removeEventListener("mousedown", i), 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 Xt = (t, e) => {
1816
1816
  ref: s,
1817
1817
  role: "menu",
1818
1818
  style: { top: e, left: t },
1819
- className: L(
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
1821
  a
1822
1822
  ),
1823
- children: n.map((i, d) => /* @__PURE__ */ p(ge.Fragment, { children: [
1824
- i.divider && /* @__PURE__ */ o("div", { className: "h-[1px] bg-border my-1" }),
1825
- /* @__PURE__ */ p(
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: i.disabled ? void 0 : 0,
1830
- "aria-disabled": i.disabled,
1829
+ tabIndex: l.disabled ? void 0 : 0,
1830
+ "aria-disabled": l.disabled,
1831
1831
  onClick: () => {
1832
- i.disabled || (i.onClick(), r());
1832
+ l.disabled || (l.onClick(), r());
1833
1833
  },
1834
- onKeyDown: (l) => {
1835
- i.disabled || l.key !== "Enter" && l.key !== " " || (l.preventDefault(), i.onClick(), r());
1834
+ onKeyDown: (c) => {
1835
+ l.disabled || c.key !== "Enter" && c.key !== " " || (c.preventDefault(), l.onClick(), r());
1836
1836
  },
1837
- className: L(
1837
+ className: A(
1838
1838
  "px-3 py-1.5 text-xs flex items-center focus:outline-none",
1839
- i.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
- i.icon && /* @__PURE__ */ o("span", { className: "mr-2 opacity-70", children: i.icon }),
1843
- /* @__PURE__ */ o("span", { children: i.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
- ] }, `${i.label}-${d}`))
1847
+ ] }, `${l.label}-${d}`))
1848
1848
  }
1849
1849
  );
1850
- }, Kr = ({
1850
+ }, Br = ({
1851
1851
  columns: t,
1852
1852
  data: e,
1853
1853
  onRowClick: n,
1854
1854
  selectedRowId: r,
1855
1855
  rowKey: a = "id",
1856
1856
  virtualized: s = !0,
1857
- showFilter: i = !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 [y, x] = R(""), [h, T] = R(null), [E, g] = R(-1), m = F(null);
1863
- O(() => {
1864
- g(-1);
1865
- }, [y, h]);
1866
- const b = B(() => {
1867
- if (!y) return e;
1868
- const u = y.toLowerCase();
1869
- return e.filter((k) => Object.values(k).some((I) => I == null ? !1 : String(I).toLowerCase().includes(u)));
1870
- }, [e, y]), N = B(() => {
1871
- if (!h) return b;
1872
- const { key: u, direction: k } = h;
1873
- return [...b].sort((I, z) => {
1874
- const _ = I[u], K = z[u];
1875
- if (_ === K) return 0;
1876
- if (_ == null) return 1;
1877
- if (K == null) return -1;
1878
- const j = Number(_), v = Number(K);
1879
- if (!isNaN(j) && !isNaN(v))
1880
- return k === "asc" ? j - v : v - j;
1881
- const P = String(_).toLowerCase(), $ = String(K).toLowerCase();
1882
- return k === "asc" ? P.localeCompare($) : $.localeCompare(P);
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, h]), w = (u, k) => {
1885
- k !== !1 && T((I) => !I || I.key !== u ? { key: u, direction: "asc" } : I.direction === "asc" ? { key: u, direction: "desc" } : null);
1886
- }, f = (u) => {
1887
- if (!(N.length === 0 || d)) {
1888
- if (u.key === "ArrowDown")
1889
- u.preventDefault(), g((k) => {
1890
- const I = k + 1;
1891
- return I >= N.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 (u.key === "ArrowUp")
1894
- u.preventDefault(), g((k) => {
1895
- const I = k - 1;
1896
- return I < 0 ? N.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 ((u.key === "Enter" || u.key === " ") && (u.preventDefault(), E >= 0 && E < N.length)) {
1899
- const k = N[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
- }, D = (u) => u.sortable === !1 ? null : (h == null ? void 0 : h.key) !== u.key ? /* @__PURE__ */ o(mt, { size: 14, className: "text-muted-foreground/60 ml-1.5 opacity-0 group-hover:opacity-100 transition-opacity" }) : h.direction === "asc" ? /* @__PURE__ */ o(ze, { size: 14, className: "text-primary ml-1.5" }) : /* @__PURE__ */ o(Fe, { size: 14, className: "text-primary ml-1.5" }), M = () => /* @__PURE__ */ o("tr", { role: "row", className: "border-b border-border bg-muted/30 select-none", children: t.map((u) => /* @__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": (h == null ? void 0 : h.key) === u.key ? h.direction === "asc" ? "ascending" : "descending" : "none",
1908
- className: L(
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
- u.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: u.width },
1913
- onClick: () => w(u.key, u.sortable),
1914
- children: /* @__PURE__ */ p("div", { className: "flex items-center", children: [
1915
- /* @__PURE__ */ o("span", { children: u.header }),
1916
- D(u)
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
- u.key
1920
- )) }), A = (u, k) => {
1921
- const I = r !== void 0 && u[a] === 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(u),
1928
- className: L(
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((_) => {
1934
- const K = u[_.key];
1935
- return /* @__PURE__ */ o("td", { role: "gridcell", className: "p-3 align-middle truncate max-w-xs", children: _.render ? _.render(K, u) : K != null ? String(K) : "" }, _.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(u[a] || k)
1938
+ String(m[a] || T)
1939
1939
  );
1940
- }, C = B(() => ({
1941
- Table: (u) => /* @__PURE__ */ o(
1940
+ }, C = j(() => ({
1941
+ Table: (m) => /* @__PURE__ */ o(
1942
1942
  "table",
1943
1943
  {
1944
- ...u,
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((u, k) => /* @__PURE__ */ o("thead", { ref: k, ...u, 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((u, k) => /* @__PURE__ */ o("tbody", { ref: k, ...u })),
1951
- TableRow: ({ item: u, context: k, ...I }) => {
1952
- if (!k || !u) return /* @__PURE__ */ o("tr", { ...I });
1953
- const z = k.selectedRowId !== void 0 && u[k.rowKey] === k.selectedRowId, _ = 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, u);
1959
+ var _;
1960
+ return (_ = T.onRowClick) == null ? void 0 : _.call(T, m);
1961
1961
  },
1962
- className: L(
1962
+ className: A(
1963
1963
  "border-b border-border/40 hover:bg-accent/40 transition-colors cursor-pointer text-sm outline-none",
1964
- z && "bg-primary/10 text-primary hover:bg-primary/15 font-medium border-l-2 border-l-primary",
1965
- _ && "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
- }), []), S = () => d ? /* @__PURE__ */ p("div", { className: "flex flex-col items-center justify-center h-64 space-y-3", children: [
1970
+ }), []), D = () => d ? /* @__PURE__ */ b("div", { className: "flex flex-col items-center justify-center h-64 space-y-3", children: [
1971
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
- ] }) : N.length === 0 ? /* @__PURE__ */ p("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
- xt,
1977
+ yt,
1978
1978
  {
1979
- data: N,
1979
+ data: k,
1980
1980
  context: {
1981
1981
  selectedRowId: r,
1982
- focusedIndex: E,
1982
+ focusedIndex: N,
1983
1983
  rowKey: a,
1984
1984
  onRowClick: n
1985
1985
  },
1986
1986
  components: C,
1987
- fixedHeaderContent: M,
1988
- itemContent: (u, k) => /* @__PURE__ */ o(Ae, { children: t.map((I) => {
1989
- const z = k[I.key];
1990
- return /* @__PURE__ */ o("td", { role: "gridcell", className: "p-3 align-middle truncate max-w-xs", children: I.render ? I.render(z, k) : z != null ? String(z) : "" }, I.key);
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__ */ p("table", { role: "grid", className: "w-full border-collapse text-left bg-background text-foreground", children: [
1994
- /* @__PURE__ */ o("thead", { children: M() }),
1995
- /* @__PURE__ */ o("tbody", { children: N.map((u, k) => A(u, 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__ */ p(
1997
+ return /* @__PURE__ */ b(
1998
1998
  "div",
1999
1999
  {
2000
- ref: m,
2000
+ ref: p,
2001
2001
  role: "region",
2002
2002
  "aria-label": "Data Grid",
2003
2003
  tabIndex: 0,
2004
2004
  onKeyDown: f,
2005
- className: L(
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
- i && /* @__PURE__ */ p("div", { className: "flex items-center justify-between p-3 border-b border-border bg-muted/20", children: [
2011
- /* @__PURE__ */ p("div", { className: "relative flex-1 max-w-sm", children: [
2012
- /* @__PURE__ */ o(ue, { 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: y,
2020
- onChange: (u) => x(u.target.value)
2019
+ value: g,
2020
+ onChange: (m) => h(m.target.value)
2021
2021
  }
2022
2022
  ),
2023
- y && /* @__PURE__ */ o(
2023
+ g && /* @__PURE__ */ o(
2024
2024
  "button",
2025
2025
  {
2026
- onClick: () => x(""),
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(V, { size: 12 })
2029
+ children: /* @__PURE__ */ o(Q, { size: 12 })
2030
2030
  }
2031
2031
  )
2032
2032
  ] }),
2033
- /* @__PURE__ */ p("div", { className: "text-[11px] text-muted-foreground font-medium ml-4", children: [
2034
- N.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
- S()
2040
+ D()
2041
2041
  ]
2042
2042
  }
2043
2043
  );
2044
- }, Fr = ({
2044
+ }, Hr = ({
2045
2045
  results: t,
2046
2046
  onQueryChange: e,
2047
2047
  onSelect: n,
2048
2048
  categories: r,
2049
2049
  placeholder: a = "Search…",
2050
2050
  debounceMs: s = 200,
2051
- className: i
2051
+ className: l
2052
2052
  }) => {
2053
- const [d, l] = R(""), [c, y] = R(!1), [x, h] = R(0), T = F(null), E = F(null), g = B(() => r || [...new Set(t.map((w) => w.category))], [r, t]), m = B(
2054
- () => g.flatMap((w) => t.filter((f) => f.category === w)),
2055
- [g, 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
- O(() => {
2058
- const w = (f) => {
2059
- T.current && !T.current.contains(f.target) && y(!1);
2057
+ P(() => {
2058
+ const x = (f) => {
2059
+ w.current && !w.current.contains(f.target) && g(!1);
2060
2060
  };
2061
- return document.addEventListener("mousedown", w), () => document.removeEventListener("mousedown", w);
2062
- }, []), O(() => {
2061
+ return document.addEventListener("mousedown", x), () => document.removeEventListener("mousedown", x);
2062
+ }, []), P(() => {
2063
2063
  if (!e) return;
2064
- const w = window.setTimeout(() => e(d), s);
2065
- return () => window.clearTimeout(w);
2066
- }, [d, s, e]), O(() => {
2067
- h(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 = (w) => {
2070
- n(w), y(!1), l("");
2071
- }, N = (w) => {
2069
+ const v = (x) => {
2070
+ n(x), g(!1), c("");
2071
+ }, k = (x) => {
2072
2072
  var f;
2073
- if (!c) {
2074
- (w.key === "ArrowDown" || w.key === "Enter") && y(!0);
2073
+ if (!i) {
2074
+ (x.key === "ArrowDown" || x.key === "Enter") && g(!0);
2075
2075
  return;
2076
2076
  }
2077
- w.key === "ArrowDown" ? (w.preventDefault(), h((D) => m.length ? (D + 1) % m.length : 0)) : w.key === "ArrowUp" ? (w.preventDefault(), h(
2078
- (D) => m.length ? (D - 1 + m.length) % m.length : 0
2079
- )) : w.key === "Enter" ? (w.preventDefault(), m[x] && b(m[x])) : w.key === "Escape" && (w.preventDefault(), y(!1), (f = E.current) == null || f.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__ */ p("div", { ref: T, className: L("relative w-full", i), children: [
2082
- /* @__PURE__ */ p("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
- ue,
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 Xt = (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,
2096
+ "aria-expanded": i,
2097
2097
  "aria-label": a,
2098
2098
  value: d,
2099
2099
  placeholder: a,
2100
- onChange: (w) => {
2101
- l(w.target.value), y(!0);
2100
+ onChange: (x) => {
2101
+ c(x.target.value), g(!0);
2102
2102
  },
2103
- onFocus: () => y(!0),
2104
- onKeyDown: N,
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,72 +2110,72 @@ const Xt = (t, e) => {
2110
2110
  {
2111
2111
  type: "button",
2112
2112
  onClick: () => {
2113
- var w;
2114
- l(""), (w = E.current) == null || w.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(V, { size: 11 })
2118
+ children: /* @__PURE__ */ o(Q, { size: 11 })
2119
2119
  }
2120
2120
  )
2121
2121
  ] }),
2122
- c && d.trim() && /* @__PURE__ */ p(
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: m.length === 0 ? /* @__PURE__ */ p("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
- ] }) : g.map((w) => {
2133
- const f = t.filter((D) => D.category === w);
2134
- return f.length === 0 ? null : /* @__PURE__ */ p("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: w }),
2136
- f.map((D) => {
2137
- const M = D.icon, A = m.indexOf(D), C = A === x;
2138
- return /* @__PURE__ */ p(
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
2142
  "aria-selected": C,
2143
- onClick: () => b(D),
2144
- onMouseEnter: () => h(A),
2145
- className: L(
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
2147
  C ? "bg-accent text-accent-foreground border-primary" : "border-transparent hover:bg-accent/40"
2148
2148
  ),
2149
2149
  children: [
2150
- M && /* @__PURE__ */ o(
2150
+ I && /* @__PURE__ */ o(
2151
2151
  "div",
2152
2152
  {
2153
- className: L(
2153
+ className: A(
2154
2154
  "mt-0.5 p-1 rounded bg-muted/50",
2155
2155
  C && "bg-background text-primary"
2156
2156
  ),
2157
- children: /* @__PURE__ */ o(M, { size: 12 })
2157
+ children: /* @__PURE__ */ o(I, { size: 12 })
2158
2158
  }
2159
2159
  ),
2160
- /* @__PURE__ */ p("div", { className: "flex-1 min-w-0", children: [
2161
- /* @__PURE__ */ o("div", { className: "text-xs font-medium truncate", children: D.title }),
2162
- D.description && /* @__PURE__ */ o("div", { className: "text-[10px] text-muted-foreground truncate mt-0.5", children: D.description })
2160
+ /* @__PURE__ */ b("div", { className: "flex-1 min-w-0", children: [
2161
+ /* @__PURE__ */ o("div", { className: "text-xs font-medium truncate", children: S.title }),
2162
+ S.description && /* @__PURE__ */ o("div", { className: "text-[10px] text-muted-foreground truncate mt-0.5", children: S.description })
2163
2163
  ] })
2164
2164
  ]
2165
2165
  },
2166
- `${D.category}-${D.id}`
2166
+ `${S.category}-${S.id}`
2167
2167
  );
2168
2168
  })
2169
- ] }, w);
2169
+ ] }, x);
2170
2170
  }) }),
2171
- m.length > 0 && /* @__PURE__ */ p("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__ */ p("div", { className: "flex space-x-2", children: [
2173
- /* @__PURE__ */ p("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__ */ p("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 Xt = (t, e) => {
2187
2187
  }
2188
2188
  )
2189
2189
  ] });
2190
- }, _r = ({
2190
+ }, Wr = ({
2191
2191
  placeholder: t = "Search...",
2192
2192
  onSearch: e,
2193
2193
  results: n,
2194
2194
  onSelect: r,
2195
2195
  suggestions: a = [],
2196
2196
  loading: s = !1,
2197
- className: i
2197
+ className: l
2198
2198
  }) => {
2199
- const [d, l] = R(""), [c, y] = R(!1), [x, h] = R(-1), T = F(null);
2200
- O(() => {
2201
- const m = 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(m);
2204
+ return () => clearTimeout(p);
2205
2205
  }, [d, e]);
2206
- const E = a.filter(
2207
- (m) => m.toLowerCase().includes(d.toLowerCase()) && m.toLowerCase() !== d.toLowerCase()
2208
- ), g = (m) => {
2209
- c && E.length > 0 && (m.key === "ArrowDown" ? (m.preventDefault(), h((b) => (b + 1) % E.length)) : m.key === "ArrowUp" ? (m.preventDefault(), h((b) => (b - 1 + E.length) % E.length)) : m.key === "Enter" && x >= 0 && (m.preventDefault(), l(E[x]), y(!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__ */ p("div", { ref: T, className: L("flex flex-col h-full bg-background", i), children: [
2212
- /* @__PURE__ */ p("div", { className: "p-3 border-b border-border/50", children: [
2213
- /* @__PURE__ */ p("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(ue, { 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 Xt = (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: (m) => {
2223
- l(m.target.value), y(!0), h(-1);
2222
+ onChange: (p) => {
2223
+ c(p.target.value), g(!0), u(-1);
2224
2224
  },
2225
- onKeyDown: g,
2226
- onFocus: () => y(!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(V, { 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((m, b) => /* @__PURE__ */ p(
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: L(
2243
+ className: A(
2244
2244
  "px-3 py-1.5 text-xs cursor-pointer flex items-center space-x-2",
2245
- b === x ? "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(m), y(!1);
2248
+ c(p), g(!1);
2249
2249
  },
2250
2250
  children: [
2251
- /* @__PURE__ */ o(pt, { size: 12, className: "text-muted-foreground" }),
2252
- /* @__PURE__ */ o("span", { children: m })
2251
+ /* @__PURE__ */ o(gt, { size: 12, className: "text-muted-foreground" }),
2252
+ /* @__PURE__ */ o("span", { children: p })
2253
2253
  ]
2254
2254
  },
2255
- m
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((m) => {
2259
- const b = m.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(m),
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__ */ p("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__ */ p("div", { className: "flex-1 min-w-0", children: [
2268
- /* @__PURE__ */ p("div", { className: "flex items-center justify-between", children: [
2269
- /* @__PURE__ */ o("span", { className: "text-xs font-medium truncate", children: m.title }),
2270
- m.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: m.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
- m.description && /* @__PURE__ */ o("p", { className: "text-[11px] text-muted-foreground truncate mt-0.5", children: m.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
- m.id
2276
+ p.id
2277
2277
  );
2278
2278
  }) }) })
2279
2279
  ] });
2280
- }, He = (t, e = 0) => t.reduce((n, r) => (n.push({ ...r, level: e }), r.isOpen && r.children && n.push(...He(r.children, e + 1)), n), []), or = (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
- }, Ur = ({
2284
+ }, Gr = ({
2285
2285
  data: t,
2286
2286
  onToggle: e,
2287
2287
  onActivate: n,
2288
2288
  onMoveNode: r,
2289
2289
  actions: a = [],
2290
2290
  indent: s = 12,
2291
- virtualized: i = !0,
2291
+ virtualized: l = !0,
2292
2292
  "aria-label": d = "Tree",
2293
- className: l
2293
+ className: c
2294
2294
  }) => {
2295
- const [c, y] = R(null), [x, h] = R(null), T = B(() => He(t), [t]);
2296
- O(() => {
2297
- h(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 = a.filter(
2300
- (b) => !b.showFor || c && b.showFor.some((N) => c.scopes.includes(N))
2301
- ).map((b) => ({
2302
- label: b.label,
2303
- icon: b.icon,
2304
- divider: b.divider,
2305
- onClick: () => c && b.onSelect(c.context)
2306
- })), g = (b, N) => {
2307
- a.length !== 0 && (b.preventDefault(), b.stopPropagation(), y({
2308
- x: b.clientX,
2309
- y: b.clientY,
2310
- scopes: or(N),
2311
- context: { nodeId: (N == null ? void 0 : N.id) ?? null, node: N }
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
- }, m = (b) => {
2314
- const N = T[b], w = !!N.isBranch;
2315
- return /* @__PURE__ */ p(
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": w ? !!N.isOpen : void 0,
2320
- "aria-level": N.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
2323
  onDragStart: (f) => {
2324
- f.dataTransfer.setData("text/plain", N.id), f.dataTransfer.effectAllowed = "move";
2324
+ f.dataTransfer.setData("text/plain", k.id), f.dataTransfer.effectAllowed = "move";
2325
2325
  },
2326
2326
  onDragOver: (f) => {
2327
- w && (f.preventDefault(), h(N.id));
2327
+ x && (f.preventDefault(), u(k.id));
2328
2328
  },
2329
- onDragLeave: () => h(null),
2329
+ onDragLeave: () => u(null),
2330
2330
  onDrop: (f) => {
2331
- f.preventDefault(), h(null);
2332
- const D = f.dataTransfer.getData("text/plain");
2333
- D && D !== N.id && w && (r == null || r(D, N.id));
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: () => w && (e == null ? void 0 : e(N)),
2336
- onDoubleClick: () => n == null ? void 0 : n(N),
2335
+ onClick: () => x && (e == null ? void 0 : e(k)),
2336
+ onDoubleClick: () => n == null ? void 0 : n(k),
2337
2337
  onKeyDown: (f) => {
2338
- f.key === "Enter" && (f.preventDefault(), w ? e == null || e(N) : n == null || n(N));
2338
+ f.key === "Enter" && (f.preventDefault(), x ? e == null || e(k) : n == null || n(k));
2339
2339
  },
2340
- onContextMenu: (f) => g(f, N),
2341
- style: { paddingLeft: `${N.level * s + 8}px` },
2342
- className: L(
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
- x === N.id && "bg-primary/20 ring-1 ring-primary/50 rounded-sm",
2346
- N.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: w && (N.isOpen ? /* @__PURE__ */ o(Fe, { size: 14 }) : /* @__PURE__ */ o(Pe, { size: 14 })) }),
2350
- N.icon && /* @__PURE__ */ o("div", { className: "mr-2 flex items-center shrink-0", children: N.icon }),
2351
- /* @__PURE__ */ o("span", { className: "truncate", children: N.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
- N.id
2354
+ k.id
2355
2355
  );
2356
2356
  };
2357
- return /* @__PURE__ */ p(
2357
+ return /* @__PURE__ */ b(
2358
2358
  "div",
2359
2359
  {
2360
2360
  role: "tree",
2361
2361
  "aria-label": d,
2362
- className: L("h-full w-full bg-muted/30", l),
2363
- onContextMenu: (b) => g(b, null),
2362
+ className: A("h-full w-full bg-muted/30", c),
2363
+ onContextMenu: (v) => y(v, null),
2364
2364
  children: [
2365
- i ? /* @__PURE__ */ o(
2366
- bt,
2365
+ l ? /* @__PURE__ */ o(
2366
+ vt,
2367
2367
  {
2368
2368
  style: { height: "100%" },
2369
- totalCount: T.length,
2370
- itemContent: m
2369
+ totalCount: w.length,
2370
+ itemContent: p
2371
2371
  }
2372
- ) : /* @__PURE__ */ o("div", { className: "h-full overflow-auto", children: T.map((b, N) => m(N)) }),
2373
- c && E.length > 0 && /* @__PURE__ */ o(
2374
- nr,
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: () => y(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
- }, de = { width: 180, height: 72 }, We = { 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) ?? de.width,
2391
- height: ((n = t.size) == null ? void 0 : n.height) ?? de.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
- }, Y = (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
- }), jr = (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
2402
  }), Ie = (t, e, n) => {
2403
- const r = be(e, t);
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
- }, ye = (t, e = 0.1, n = 4) => Math.min(n, Math.max(e, t)), Le = (t, e) => {
2410
- const n = Y(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,25 +2418,25 @@ const Xt = (t, e) => {
2418
2418
  case "right":
2419
2419
  return { x: t.x + t.width, y: n.y };
2420
2420
  }
2421
- }, sr = (t, e) => {
2422
- const n = Y(t), r = Y(e), a = r.x - n.x, s = r.y - n.y;
2421
+ }, ir = (t, e) => {
2422
+ const n = X(t), r = X(e), a = r.x - n.x, s = r.y - n.y;
2423
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
- }, Ge = (t) => {
2424
+ }, Je = (t) => {
2425
2425
  if (t.length === 0) return null;
2426
- const e = t.map(q), n = Math.min(...e.map((i) => i.x)), r = Math.min(...e.map((i) => i.y)), a = Math.max(...e.map((i) => i.x + i.width)), s = Math.max(...e.map((i) => i.y + i.height));
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
2427
  return { x: n, y: r, width: a - n, height: s - r };
2428
- }, ar = (t, e) => ({
2428
+ }, lr = (t, e) => ({
2429
2429
  // Written as a subtraction rather than `-viewport.x / scale` so a pan of zero
2430
2430
  // yields +0 rather than -0, which otherwise leaks into equality checks.
2431
2431
  x: (0 - t.x) / t.scale,
2432
2432
  y: (0 - t.y) / t.scale,
2433
2433
  width: e.width / t.scale,
2434
2434
  height: e.height / t.scale
2435
- }), Me = (t, e, n) => ({
2435
+ }), Ae = (t, e, n) => ({
2436
2436
  scale: n,
2437
2437
  x: e.width / 2 - t.x * n,
2438
2438
  y: e.height / 2 - t.y * n
2439
- }), ir = (t, e) => {
2439
+ }), cr = (t, e) => {
2440
2440
  const n = Math.min(t.x, e.x), r = Math.min(t.y, e.y);
2441
2441
  return {
2442
2442
  x: n,
@@ -2444,224 +2444,224 @@ const Xt = (t, e) => {
2444
2444
  width: Math.max(t.x + t.width, e.x + e.width) - n,
2445
2445
  height: Math.max(t.y + t.height, e.y + e.height) - r
2446
2446
  };
2447
- }, lr = (t, e, n = 48) => {
2448
- const r = Ge(t);
2449
- if (!r || e.width === 0 || e.height === 0) return We;
2450
- const a = ye(
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(
2451
2451
  Math.min(
2452
2452
  (e.width - n * 2) / Math.max(r.width, 1),
2453
2453
  (e.height - n * 2) / Math.max(r.height, 1)
2454
2454
  )
2455
- ), s = Y(r);
2455
+ ), s = X(r);
2456
2456
  return {
2457
2457
  scale: a,
2458
2458
  x: e.width / 2 - s.x * a,
2459
2459
  y: e.height / 2 - s.y * a
2460
2460
  };
2461
- }, Ye = {
2461
+ }, Xe = {
2462
2462
  up: { x: 0, y: -1 },
2463
2463
  down: { x: 0, y: 1 },
2464
2464
  left: { x: -1, y: 0 },
2465
2465
  right: { x: 1, y: 0 }
2466
- }, he = (t, e, n) => {
2466
+ }, ge = (t, e, n) => {
2467
2467
  const r = t.find((d) => d.id === e);
2468
2468
  if (!r) return null;
2469
- const a = Y(q(r)), s = Ye[n];
2470
- let i = null;
2469
+ const a = X(H(r)), s = Xe[n];
2470
+ let l = null;
2471
2471
  for (const d of t) {
2472
2472
  if (d.id === e) continue;
2473
- const l = Y(q(d)), c = l.x - a.x, y = l.y - a.y, x = c * s.x + y * s.y;
2474
- if (x <= 0) continue;
2475
- const h = Math.abs(c * s.y - y * s.x);
2476
- if (h > x * 2) continue;
2477
- const T = x + h * 2;
2478
- (!i || T < i.score) && (i = { node: d, score: T });
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 });
2479
2479
  }
2480
- return (i == null ? void 0 : i.node) ?? null;
2481
- }, cr = (t, e, n, r = 64) => {
2482
- const a = t.find((c) => c.id === e);
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
2483
  if (!a) return { x: 0, y: 0 };
2484
- const s = q(a), i = Ye[n], d = {
2485
- x: i.x * (s.width + r),
2486
- y: i.y * (s.height + r)
2484
+ const s = H(a), l = Xe[n], d = {
2485
+ x: l.x * (s.width + r),
2486
+ y: l.y * (s.height + r)
2487
2487
  };
2488
- let l = { x: s.x + d.x, y: s.y + d.y };
2489
- for (let c = 0; c < 24; c += 1) {
2490
- const y = { ...l, width: s.width, height: s.height };
2491
- if (!t.some((h) => dr(q(h), y))) break;
2492
- l = i.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 };
2493
2493
  }
2494
- return l;
2495
- }, dr = (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, Br = (t, e) => t.filter((n) => n.source === e || n.target === e), Hr = (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(
2496
2496
  (r) => r.source === e && r.target === n || r.source === n && r.target === e
2497
- ), Wr = (t, e, n) => ({
2497
+ ), qr = (t, e, n) => ({
2498
2498
  nodes: t.filter((r) => r.id !== n),
2499
2499
  edges: e.filter((r) => r.source !== n && r.target !== n)
2500
- }), Gr = (t, e) => {
2500
+ }), Vr = (t, e) => {
2501
2501
  let n = e.length + 1;
2502
2502
  const r = new Set(e.map((a) => a.id));
2503
2503
  for (; r.has(`${t}-${n}`); ) n += 1;
2504
2504
  return `${t}-${n}`;
2505
- }, ur = Qe(
2505
+ }, mr = et(
2506
2506
  ({
2507
2507
  children: t,
2508
2508
  overlay: e,
2509
2509
  viewport: n,
2510
- defaultViewport: r = We,
2510
+ defaultViewport: r = Ye,
2511
2511
  onViewportChange: a,
2512
2512
  onSizeChange: s,
2513
- onCanvasClick: i,
2513
+ onCanvasClick: l,
2514
2514
  onCanvasDoubleClick: d,
2515
- onCanvasContextMenu: l,
2516
- onDrop: c,
2517
- grid: y = !0,
2518
- gridSize: x = 24,
2519
- minScale: h = 0.1,
2520
- maxScale: T = 4,
2521
- pannable: E = !0,
2522
- zoomable: g = !0,
2523
- "aria-label": m = "Graph canvas",
2524
- className: b
2525
- }, N) => {
2526
- const w = F(null), [f, D] = R(r), [M, A] = R(!1), [C, S] = R(!1), u = n ?? f, k = F(u);
2527
- k.current = u;
2528
- const I = ee(
2529
- (v) => {
2530
- n || D(v), a == null || a(v);
2515
+ onCanvasContextMenu: c,
2516
+ onDrop: i,
2517
+ grid: g = !0,
2518
+ gridSize: h = 24,
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);
2531
2531
  },
2532
2532
  [n, a]
2533
- ), z = ee((v) => {
2534
- var $;
2535
- const P = ($ = w.current) == null ? void 0 : $.getBoundingClientRect();
2536
- return P ? { x: v.x - P.left, y: v.y - P.top } : v;
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;
2537
2537
  }, []);
2538
- O(() => {
2539
- const v = w.current;
2540
- if (!v || !s) return;
2541
- const P = () => {
2542
- const U = v.getBoundingClientRect();
2538
+ P(() => {
2539
+ const E = x.current;
2540
+ if (!E || !s) return;
2541
+ const z = () => {
2542
+ const U = E.getBoundingClientRect();
2543
2543
  s({ width: U.width, height: U.height });
2544
2544
  };
2545
- P();
2546
- const $ = new ResizeObserver(P);
2547
- return $.observe(v), () => $.disconnect();
2548
- }, [s]), O(() => {
2549
- const v = w.current;
2550
- if (!v || !g) return;
2551
- const P = ($) => {
2552
- $.preventDefault();
2553
- const U = k.current, H = z({ x: $.clientX, y: $.clientY }), le = $.ctrlKey ? 0.01 : 2e-3, ce = ye(
2554
- U.scale * Math.exp(-$.deltaY * le),
2555
- h,
2556
- T
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
2557
2557
  );
2558
- I(Ie(U, H, ce));
2558
+ L(Ie(U, W, ce));
2559
2559
  };
2560
- return v.addEventListener("wheel", P, { passive: !1 }), () => v.removeEventListener("wheel", P);
2561
- }, [g, h, T, I, z]), O(() => {
2562
- if (!E) return;
2563
- const v = ($) => {
2564
- var H;
2565
- if ($.code !== "Space") return;
2566
- const U = $.target;
2567
- U != null && U.closest('input, textarea, [contenteditable="true"]') || (H = w.current) != null && H.contains(document.activeElement) && ($.preventDefault(), S(!0));
2568
- }, P = ($) => {
2569
- $.code === "Space" && S(!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);
2570
2570
  };
2571
- return window.addEventListener("keydown", v), window.addEventListener("keyup", P), () => {
2572
- window.removeEventListener("keydown", v), window.removeEventListener("keyup", P);
2571
+ return window.addEventListener("keydown", E), window.addEventListener("keyup", z), () => {
2572
+ window.removeEventListener("keydown", E), window.removeEventListener("keyup", z);
2573
2573
  };
2574
- }, [E]);
2575
- const _ = (v) => {
2576
- if (!E) return;
2577
- const P = v.target === v.currentTarget, $ = v.button === 1;
2578
- if (!P && !$ && !C || v.button !== 0 && !$) return;
2579
- v.preventDefault(), A(!0);
2580
- const U = { x: v.clientX, y: v.clientY }, H = { ...k.current }, le = (Ne) => {
2581
- I({
2582
- ...H,
2583
- x: H.x + (Ne.clientX - U.x),
2584
- y: H.y + (Ne.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)
2585
2585
  });
2586
2586
  }, ce = () => {
2587
- A(!1), window.removeEventListener("pointermove", le), window.removeEventListener("pointerup", ce);
2587
+ M(!1), window.removeEventListener("pointermove", le), window.removeEventListener("pointerup", ce);
2588
2588
  };
2589
2589
  window.addEventListener("pointermove", le), window.addEventListener("pointerup", ce);
2590
2590
  };
2591
- Ze(
2592
- N,
2591
+ tt(
2592
+ k,
2593
2593
  () => ({
2594
- getViewport: () => k.current,
2595
- setViewport: I,
2596
- fitTo: (v, P) => {
2594
+ getViewport: () => T.current,
2595
+ setViewport: L,
2596
+ fitTo: (E, z) => {
2597
2597
  var U;
2598
- const $ = (U = w.current) == null ? void 0 : U.getBoundingClientRect();
2599
- $ && I(lr(v, { width: $.width, height: $.height }, P));
2598
+ const R = (U = x.current) == null ? void 0 : U.getBoundingClientRect();
2599
+ R && L(dr(E, { width: R.width, height: R.height }, z));
2600
2600
  },
2601
- zoomBy: (v) => {
2602
- var H;
2603
- const P = (H = w.current) == null ? void 0 : H.getBoundingClientRect();
2604
- if (!P) return;
2605
- const $ = { x: P.width / 2, y: P.height / 2 }, U = ye(
2606
- k.current.scale * v,
2607
- h,
2608
- T
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
2609
2609
  );
2610
- I(Ie(k.current, $, U));
2610
+ L(Ie(T.current, R, U));
2611
2611
  },
2612
- clientToGraph: (v) => be(z(v), k.current),
2612
+ clientToGraph: (E) => ye(O(E), T.current),
2613
2613
  getSize: () => {
2614
- var P;
2615
- const v = (P = w.current) == null ? void 0 : P.getBoundingClientRect();
2616
- return { width: (v == null ? void 0 : v.width) ?? 0, height: (v == null ? void 0 : v.height) ?? 0 };
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 };
2617
2617
  },
2618
2618
  focus: () => {
2619
- var v;
2620
- return (v = w.current) == null ? void 0 : v.focus();
2619
+ var E;
2620
+ return (E = x.current) == null ? void 0 : E.focus();
2621
2621
  }
2622
2622
  }),
2623
- [I, h, T, z]
2623
+ [L, u, w, O]
2624
2624
  );
2625
- const K = (v) => be(z({ x: v.clientX, y: v.clientY }), u), j = (v) => v.target === v.currentTarget;
2626
- return /* @__PURE__ */ p(
2625
+ const _ = (E) => ye(O({ x: E.clientX, y: E.clientY }), m), B = (E) => E.target === E.currentTarget;
2626
+ return /* @__PURE__ */ b(
2627
2627
  "div",
2628
2628
  {
2629
- ref: w,
2629
+ ref: x,
2630
2630
  role: "application",
2631
- "aria-label": m,
2631
+ "aria-label": p,
2632
2632
  tabIndex: 0,
2633
- onPointerDown: _,
2634
- onClick: (v) => j(v) && (i == null ? void 0 : i(K(v), v)),
2635
- onDoubleClick: (v) => j(v) && (d == null ? void 0 : d(K(v), v)),
2636
- onContextMenu: (v) => {
2637
- !l || !j(v) || (v.preventDefault(), l(K(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));
2638
2638
  },
2639
- onDragOver: (v) => {
2640
- c && (v.preventDefault(), v.dataTransfer.dropEffect = "copy");
2639
+ onDragOver: (E) => {
2640
+ i && (E.preventDefault(), E.dataTransfer.dropEffect = "copy");
2641
2641
  },
2642
- onDrop: (v) => {
2643
- c && (v.preventDefault(), c(K(v), v));
2642
+ onDrop: (E) => {
2643
+ i && (E.preventDefault(), i(_(E), E));
2644
2644
  },
2645
- style: y ? {
2645
+ style: g ? {
2646
2646
  // The grid is painted on the element rather than inside the
2647
2647
  // transformed layer, so it can be infinite without needing a
2648
2648
  // giant element behind it.
2649
2649
  backgroundImage: "radial-gradient(circle, hsl(var(--border)) 1px, transparent 1px)",
2650
- backgroundSize: `${x * u.scale}px ${x * u.scale}px`,
2651
- backgroundPosition: `${u.x}px ${u.y}px`
2650
+ backgroundSize: `${h * m.scale}px ${h * m.scale}px`,
2651
+ backgroundPosition: `${m.x}px ${m.y}px`
2652
2652
  } : void 0,
2653
- className: L(
2653
+ className: A(
2654
2654
  "relative w-full h-full overflow-hidden bg-background outline-none",
2655
2655
  "focus-visible:ring-1 focus-visible:ring-ring focus-visible:ring-inset",
2656
- C || M ? "cursor-grabbing" : "cursor-grab",
2657
- b
2656
+ C || I ? "cursor-grabbing" : "cursor-grab",
2657
+ v
2658
2658
  ),
2659
2659
  children: [
2660
2660
  /* @__PURE__ */ o(
2661
2661
  "div",
2662
2662
  {
2663
2663
  style: {
2664
- transform: `translate(${u.x}px, ${u.y}px) scale(${u.scale})`,
2664
+ transform: `translate(${m.x}px, ${m.y}px) scale(${m.scale})`,
2665
2665
  transformOrigin: "0 0",
2666
2666
  willChange: "transform"
2667
2667
  },
@@ -2675,93 +2675,93 @@ const Xt = (t, e) => {
2675
2675
  );
2676
2676
  }
2677
2677
  );
2678
- ur.displayName = "GraphCanvas";
2679
- const fr = ["top", "right", "bottom", "left"], mr = {
2678
+ mr.displayName = "GraphCanvas";
2679
+ const hr = ["top", "right", "bottom", "left"], pr = {
2680
2680
  top: "left-1/2 -translate-x-1/2 -top-1.5",
2681
2681
  bottom: "left-1/2 -translate-x-1/2 -bottom-1.5",
2682
2682
  left: "top-1/2 -translate-y-1/2 -left-1.5",
2683
2683
  right: "top-1/2 -translate-y-1/2 -right-1.5"
2684
- }, Yr = ({
2684
+ }, Qr = ({
2685
2685
  node: t,
2686
2686
  children: e,
2687
2687
  onMove: n,
2688
2688
  onMoveEnd: r,
2689
2689
  onSelect: a,
2690
2690
  onActivate: s,
2691
- onContextMenu: i,
2691
+ onContextMenu: l,
2692
2692
  onConnectStart: d,
2693
- onConnectEnd: l,
2694
- selected: c = !1,
2695
- focused: y = !1,
2696
- ports: x = !0,
2697
- draggable: h = !0,
2698
- className: T
2693
+ onConnectEnd: c,
2694
+ selected: i = !1,
2695
+ focused: g = !1,
2696
+ ports: h = !0,
2697
+ draggable: u = !0,
2698
+ className: w
2699
2699
  }) => {
2700
- var N, w;
2701
- const E = F(!1), g = ((N = t.size) == null ? void 0 : N.width) ?? de.width, m = ((w = t.size) == null ? void 0 : w.height) ?? de.height, b = (f) => {
2702
- if (!h || !n || f.button !== 0 || f.nativeEvent.shiftKey) return;
2703
- f.stopPropagation(), E.current = !1;
2704
- const D = { x: f.clientX, y: f.clientY }, M = { ...t.position }, A = pr(f.currentTarget);
2705
- let C = M;
2706
- const S = (k) => {
2707
- const I = (k.clientX - D.x) / A, z = (k.clientY - D.y) / A;
2708
- (Math.abs(I) > 1 || Math.abs(z) > 1) && (E.current = !0), C = { x: M.x + I, y: M.y + z }, n(t.id, C);
2709
- }, u = () => {
2710
- E.current && (r == null || r(t.id, C)), window.removeEventListener("pointermove", S), window.removeEventListener("pointerup", u);
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);
2711
2711
  };
2712
- window.addEventListener("pointermove", S), window.addEventListener("pointerup", u);
2712
+ window.addEventListener("pointermove", D), window.addEventListener("pointerup", m);
2713
2713
  };
2714
- return /* @__PURE__ */ p(
2714
+ return /* @__PURE__ */ b(
2715
2715
  "div",
2716
2716
  {
2717
2717
  "data-graph-node": t.id,
2718
2718
  role: "button",
2719
2719
  tabIndex: -1,
2720
- "aria-pressed": c,
2720
+ "aria-pressed": i,
2721
2721
  style: {
2722
2722
  position: "absolute",
2723
2723
  left: t.position.x,
2724
2724
  top: t.position.y,
2725
- width: g,
2726
- height: m
2725
+ width: y,
2726
+ height: p
2727
2727
  },
2728
- onPointerDown: b,
2728
+ onPointerDown: v,
2729
2729
  onClick: (f) => {
2730
- f.stopPropagation(), E.current || a == null || a(t.id, f);
2730
+ f.stopPropagation(), N.current || a == null || a(t.id, f);
2731
2731
  },
2732
2732
  onDoubleClick: (f) => {
2733
2733
  f.stopPropagation(), s == null || s(t.id);
2734
2734
  },
2735
2735
  onContextMenu: (f) => {
2736
- i && (f.preventDefault(), f.stopPropagation(), i(t.id, { x: f.clientX, y: f.clientY }, f));
2736
+ l && (f.preventDefault(), f.stopPropagation(), l(t.id, { x: f.clientX, y: f.clientY }, f));
2737
2737
  },
2738
- onPointerUp: () => l == null ? void 0 : l(t.id),
2739
- className: L(
2738
+ onPointerUp: () => c == null ? void 0 : c(t.id),
2739
+ className: A(
2740
2740
  "group rounded-lg border bg-card text-card-foreground shadow-sm select-none",
2741
2741
  "flex flex-col overflow-hidden transition-shadow",
2742
- h && n && "cursor-grab active:cursor-grabbing",
2743
- c ? "border-primary shadow-md" : "border-border",
2742
+ u && n && "cursor-grab active:cursor-grabbing",
2743
+ i ? "border-primary shadow-md" : "border-border",
2744
2744
  // Focus is the keyboard cursor: it must be visible even when the node
2745
2745
  // is also selected, so it gets a ring rather than a border change.
2746
- y && "ring-2 ring-ring ring-offset-1 ring-offset-background",
2747
- T
2746
+ g && "ring-2 ring-ring ring-offset-1 ring-offset-background",
2747
+ w
2748
2748
  ),
2749
2749
  children: [
2750
2750
  e,
2751
- x && d && fr.map((f) => /* @__PURE__ */ o(
2751
+ h && d && hr.map((f) => /* @__PURE__ */ o(
2752
2752
  "button",
2753
2753
  {
2754
2754
  type: "button",
2755
2755
  tabIndex: -1,
2756
2756
  "aria-label": `Connect from ${f}`,
2757
- onPointerDown: (D) => {
2758
- D.stopPropagation(), d(t.id, f);
2757
+ onPointerDown: (S) => {
2758
+ S.stopPropagation(), d(t.id, f);
2759
2759
  },
2760
- className: L(
2760
+ className: A(
2761
2761
  "absolute w-3 h-3 rounded-full border-2 border-background bg-primary",
2762
2762
  "opacity-0 group-hover:opacity-100 focus-visible:opacity-100 transition-opacity",
2763
- y && "opacity-100",
2764
- mr[f]
2763
+ g && "opacity-100",
2764
+ pr[f]
2765
2765
  )
2766
2766
  },
2767
2767
  f
@@ -2769,7 +2769,7 @@ const fr = ["top", "right", "bottom", "left"], mr = {
2769
2769
  ]
2770
2770
  }
2771
2771
  );
2772
- }, pr = (t) => {
2772
+ }, gr = (t) => {
2773
2773
  let e = t.parentElement;
2774
2774
  for (; e; ) {
2775
2775
  const n = window.getComputedStyle(e).transform;
@@ -2780,60 +2780,60 @@ const fr = ["top", "right", "bottom", "left"], mr = {
2780
2780
  e = e.parentElement;
2781
2781
  }
2782
2782
  return 1;
2783
- }, hr = (t, e, n, r) => {
2783
+ }, xr = (t, e, n, r) => {
2784
2784
  if (r === "straight")
2785
2785
  return `M ${t.x} ${t.y} L ${e.x} ${e.y}`;
2786
2786
  const a = n === "left" || n === "right";
2787
2787
  if (r === "smoothstep") {
2788
- const c = a ? (t.x + e.x) / 2 : (t.y + e.y) / 2;
2789
- return a ? `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}`;
2790
2790
  }
2791
- const s = Math.hypot(e.x - t.x, e.y - t.y), i = Math.min(Math.max(s / 2, 24), 160), d = a ? { x: t.x + (n === "right" ? i : -i), y: t.y } : { x: t.x, y: t.y + (n === "bottom" ? i : -i) }, l = a ? { x: e.x - (n === "right" ? i : -i), y: e.y } : { x: e.x, y: e.y - (n === "bottom" ? i : -i) };
2792
- return `M ${t.x} ${t.y} C ${d.x} ${d.y}, ${l.x} ${l.y}, ${e.x} ${e.y}`;
2793
- }, 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 = ({
2794
2794
  edge: t,
2795
2795
  source: e,
2796
2796
  target: n,
2797
2797
  routing: r = "bezier",
2798
2798
  selected: a = !1,
2799
2799
  arrow: s = !0,
2800
- onSelect: i,
2800
+ onSelect: l,
2801
2801
  onContextMenu: d,
2802
- className: l
2802
+ className: c
2803
2803
  }) => {
2804
- const c = q(e), y = q(n), x = sr(c, y), h = Le(c, x.source), T = Le(y, x.target), E = hr(h, T, x.source, r), g = { x: (h.x + T.x) / 2, y: (h.y + T.y) / 2 }, m = !!(i || d);
2805
- return /* @__PURE__ */ p(
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(
2806
2806
  "g",
2807
2807
  {
2808
2808
  "data-graph-edge": t.id,
2809
- className: L(m && "cursor-pointer"),
2810
- onClick: (b) => {
2811
- i && (b.stopPropagation(), i(t.id, b));
2809
+ className: A(p && "cursor-pointer"),
2810
+ onClick: (v) => {
2811
+ l && (v.stopPropagation(), l(t.id, v));
2812
2812
  },
2813
- onContextMenu: (b) => {
2814
- 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));
2815
2815
  },
2816
2816
  children: [
2817
- m && /* @__PURE__ */ o("path", { d: E, fill: "none", stroke: "transparent", strokeWidth: 16 }),
2817
+ p && /* @__PURE__ */ o("path", { d: N, fill: "none", stroke: "transparent", strokeWidth: 16 }),
2818
2818
  /* @__PURE__ */ o(
2819
2819
  "path",
2820
2820
  {
2821
- d: E,
2821
+ d: N,
2822
2822
  fill: "none",
2823
2823
  strokeWidth: a ? 2.5 : 1.5,
2824
2824
  markerEnd: s ? "url(#nexus-graph-arrow)" : void 0,
2825
- className: L(
2825
+ className: A(
2826
2826
  "transition-[stroke]",
2827
2827
  a ? "stroke-primary" : "stroke-border",
2828
- l
2828
+ c
2829
2829
  )
2830
2830
  }
2831
2831
  ),
2832
2832
  t.label && /* @__PURE__ */ o(
2833
2833
  "text",
2834
2834
  {
2835
- x: g.x,
2836
- y: g.y,
2835
+ x: y.x,
2836
+ y: y.y,
2837
2837
  textAnchor: "middle",
2838
2838
  dominantBaseline: "middle",
2839
2839
  className: "fill-muted-foreground text-[10px] font-medium select-none",
@@ -2844,14 +2844,14 @@ const fr = ["top", "right", "bottom", "left"], mr = {
2844
2844
  ]
2845
2845
  }
2846
2846
  );
2847
- }, Xr = ({ children: t, className: e }) => /* @__PURE__ */ p(
2847
+ }, en = ({ children: t, className: e }) => /* @__PURE__ */ b(
2848
2848
  "svg",
2849
2849
  {
2850
2850
  style: { position: "absolute", left: -5e4, top: -5e4, overflow: "visible" },
2851
2851
  width: 1e5,
2852
2852
  height: 1e5,
2853
2853
  viewBox: "-50000 -50000 100000 100000",
2854
- className: L("pointer-events-none [&_g]:pointer-events-auto", e),
2854
+ className: A("pointer-events-none [&_g]:pointer-events-auto", e),
2855
2855
  children: [
2856
2856
  /* @__PURE__ */ o("defs", { children: /* @__PURE__ */ o(
2857
2857
  "marker",
@@ -2869,7 +2869,7 @@ const fr = ["top", "right", "bottom", "left"], mr = {
2869
2869
  t
2870
2870
  ]
2871
2871
  }
2872
- ), qr = {
2872
+ ), tn = {
2873
2873
  /** Move focus to the nearest node in a direction. */
2874
2874
  moveFocus: ["ArrowUp", "ArrowDown", "ArrowLeft", "ArrowRight"],
2875
2875
  /** Create a connected node in a direction. */
@@ -2884,268 +2884,268 @@ const fr = ["top", "right", "bottom", "left"], mr = {
2884
2884
  connect: "c",
2885
2885
  /** Nudge the focused node. Held with the arrow keys. */
2886
2886
  nudgeModifier: "shiftKey"
2887
- }, gr = {
2887
+ }, br = {
2888
2888
  ArrowUp: "up",
2889
2889
  ArrowDown: "down",
2890
2890
  ArrowLeft: "left",
2891
2891
  ArrowRight: "right"
2892
- }, Vr = ({
2892
+ }, rn = ({
2893
2893
  nodes: t,
2894
2894
  edges: e,
2895
2895
  focusedId: n,
2896
2896
  defaultFocusedId: r = null,
2897
2897
  onFocusChange: a,
2898
2898
  targetRef: s,
2899
- nudgeDistance: i = 16,
2899
+ nudgeDistance: l = 16,
2900
2900
  disabled: d = !1,
2901
- onCreateNode: l,
2902
- onConnect: c,
2903
- onDeleteNode: y,
2904
- onMoveNode: x,
2905
- onEditNode: h
2901
+ onCreateNode: c,
2902
+ onConnect: i,
2903
+ onDeleteNode: g,
2904
+ onMoveNode: h,
2905
+ onEditNode: u
2906
2906
  }) => {
2907
- const [T, E] = R(
2907
+ const [w, N] = $(
2908
2908
  r
2909
- ), [g, m] = R(null), [b, N] = R(null), w = n !== void 0 ? n : T, f = ee(
2909
+ ), [y, p] = $(null), [v, k] = $(null), x = n !== void 0 ? n : w, f = Y(
2910
2910
  (C) => {
2911
- n === void 0 && E(C), a == null || a(C);
2911
+ n === void 0 && N(C), a == null || a(C);
2912
2912
  },
2913
2913
  [n, a]
2914
- ), D = F({
2914
+ ), S = F({
2915
2915
  nodes: t,
2916
2916
  edges: e,
2917
- focusedId: w,
2918
- editingId: g,
2919
- connectingFrom: b
2917
+ focusedId: x,
2918
+ editingId: y,
2919
+ connectingFrom: v
2920
2920
  });
2921
- D.current = { nodes: t, edges: e, focusedId: w, editingId: g, connectingFrom: b };
2922
- const M = ee(
2921
+ S.current = { nodes: t, edges: e, focusedId: x, editingId: y, connectingFrom: v };
2922
+ const I = Y(
2923
2923
  (C) => {
2924
- const { nodes: S, focusedId: u } = D.current;
2925
- if (S.length === 0) return;
2926
- if (!u) {
2927
- f(S[0].id);
2924
+ const { nodes: D, focusedId: m } = S.current;
2925
+ if (D.length === 0) return;
2926
+ if (!m) {
2927
+ f(D[0].id);
2928
2928
  return;
2929
2929
  }
2930
- const k = he(S, u, C);
2931
- k && f(k.id);
2930
+ const T = ge(D, m, C);
2931
+ T && f(T.id);
2932
2932
  },
2933
2933
  [f]
2934
- ), A = ee(
2934
+ ), M = Y(
2935
2935
  (C = "right") => {
2936
- const { nodes: S, focusedId: u } = D.current;
2937
- if (!l) return;
2938
- const k = u ? cr(S, u, C) : { x: 0, y: 0 }, I = l(k, { from: u ?? void 0, direction: C });
2939
- I && (u && (c == null || c(u, I)), f(I), m(I));
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));
2940
2940
  },
2941
- [l, c, f]
2941
+ [c, i, f]
2942
2942
  );
2943
- return O(() => {
2943
+ return P(() => {
2944
2944
  if (d) return;
2945
2945
  const C = s.current;
2946
2946
  if (!C) return;
2947
- const S = (u) => {
2948
- const { focusedId: k, editingId: I, connectingFrom: z } = D.current;
2949
- if (I) {
2950
- u.key === "Escape" && (u.preventDefault(), m(null));
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));
2951
2951
  return;
2952
2952
  }
2953
- const _ = u.target;
2954
- if (_ != null && _.closest('input, textarea, select, [contenteditable="true"]')) return;
2955
- const K = gr[u.key];
2956
- if (K) {
2957
- u.preventDefault();
2958
- const j = D.current.nodes.find((v) => v.id === k);
2959
- if (u.shiftKey && j && x) {
2960
- const v = {
2961
- up: { x: 0, y: -i },
2962
- down: { x: 0, y: i },
2963
- left: { x: -i, y: 0 },
2964
- right: { x: i, y: 0 }
2965
- }[K];
2966
- x(j.id, {
2967
- x: j.position.x + v.x,
2968
- y: j.position.y + v.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
2969
2969
  });
2970
2970
  return;
2971
2971
  }
2972
- M(K);
2972
+ I(_);
2973
2973
  return;
2974
2974
  }
2975
- switch (u.key) {
2975
+ switch (m.key) {
2976
2976
  case "Tab": {
2977
- if (!l) return;
2978
- u.preventDefault(), A(u.shiftKey ? "left" : "right");
2977
+ if (!c) return;
2978
+ m.preventDefault(), M(m.shiftKey ? "left" : "right");
2979
2979
  return;
2980
2980
  }
2981
2981
  case "Enter": {
2982
- if (!k) return;
2983
- if (u.preventDefault(), z && z !== k) {
2984
- c == null || c(z, k), N(null);
2982
+ if (!T) return;
2983
+ if (m.preventDefault(), O && O !== T) {
2984
+ i == null || i(O, T), k(null);
2985
2985
  return;
2986
2986
  }
2987
- h == null || h(k), m(k);
2987
+ u == null || u(T), p(T);
2988
2988
  return;
2989
2989
  }
2990
2990
  case "Escape": {
2991
- u.preventDefault(), z ? N(null) : f(null);
2991
+ m.preventDefault(), O ? k(null) : f(null);
2992
2992
  return;
2993
2993
  }
2994
2994
  case "Delete":
2995
2995
  case "Backspace": {
2996
- if (!k || !y) return;
2997
- u.preventDefault();
2998
- const j = D.current.nodes.filter((P) => P.id !== k), v = he(D.current.nodes, k, "left") ?? he(D.current.nodes, k, "right") ?? j[0] ?? null;
2999
- y(k), f((v == null ? void 0 : v.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);
3000
3000
  return;
3001
3001
  }
3002
3002
  case "c":
3003
3003
  case "C": {
3004
- if (!k || !c || u.metaKey || u.ctrlKey) return;
3005
- u.preventDefault(), N(z === k ? null : k);
3004
+ if (!T || !i || m.metaKey || m.ctrlKey) return;
3005
+ m.preventDefault(), k(O === T ? null : T);
3006
3006
  return;
3007
3007
  }
3008
3008
  }
3009
3009
  };
3010
- return C.addEventListener("keydown", S), () => C.removeEventListener("keydown", S);
3010
+ return C.addEventListener("keydown", D), () => C.removeEventListener("keydown", D);
3011
3011
  }, [
3012
3012
  d,
3013
3013
  s,
3014
+ I,
3014
3015
  M,
3015
- A,
3016
+ l,
3016
3017
  i,
3017
3018
  c,
3018
- l,
3019
- y,
3019
+ g,
3020
+ u,
3020
3021
  h,
3021
- x,
3022
3022
  f
3023
- ]), O(() => {
3024
- w && !t.some((C) => C.id === w) && f(null), g && !t.some((C) => C.id === g) && m(null), b && !t.some((C) => C.id === b) && N(null);
3025
- }, [t, w, g, b, f]), B(
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(
3026
3026
  () => ({
3027
- focusedId: w,
3027
+ focusedId: x,
3028
3028
  setFocusedId: f,
3029
- editingId: g,
3030
- setEditingId: m,
3031
- connectingFrom: b,
3032
- setConnectingFrom: N,
3033
- moveFocus: M,
3034
- createConnected: A
3029
+ editingId: y,
3030
+ setEditingId: p,
3031
+ connectingFrom: v,
3032
+ setConnectingFrom: k,
3033
+ moveFocus: I,
3034
+ createConnected: M
3035
3035
  }),
3036
- [w, f, g, b, M, A]
3036
+ [x, f, y, v, I, M]
3037
3037
  );
3038
- }, Qr = ({
3038
+ }, nn = ({
3039
3039
  nodes: t,
3040
3040
  viewport: e,
3041
3041
  canvasSize: n,
3042
3042
  onViewportChange: r,
3043
3043
  width: a = 180,
3044
3044
  height: s = 120,
3045
- nodeColor: i,
3045
+ nodeColor: l,
3046
3046
  highlightIds: d,
3047
- padding: l = 8,
3048
- panDistance: c = 80,
3049
- "aria-label": y = "Graph minimap",
3050
- className: x
3047
+ padding: c = 8,
3048
+ panDistance: i = 80,
3049
+ "aria-label": g = "Graph minimap",
3050
+ className: h
3051
3051
  }) => {
3052
- const h = F(null), T = B(() => new Set(d ?? []), [d]), E = ar(e, n), g = B(() => {
3053
- const S = Ge(t);
3054
- return S ? ir(S, E) : E;
3055
- }, [t, E.x, E.y, E.width, E.height]), m = Math.min(
3056
- (a - l * 2) / Math.max(g.width, 1),
3057
- (s - l * 2) / Math.max(g.height, 1)
3058
- ), b = {
3059
- x: (a - g.width * m) / 2 - g.x * m,
3060
- y: (s - g.height * m) / 2 - g.y * m
3061
- }, N = (S) => ({
3062
- x: S.x * m + b.x,
3063
- y: S.y * m + b.y
3064
- }), w = (S) => ({
3065
- x: (S.x - b.x) / m,
3066
- y: (S.y - b.y) / m
3067
- }), f = ee(
3068
- (S) => {
3069
- var I;
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
3070
  if (!r) return;
3071
- const u = (I = h.current) == null ? void 0 : I.getBoundingClientRect();
3072
- if (!u) return;
3073
- const k = w({ x: S.x - u.left, y: S.y - u.top });
3074
- r(Me(k, n, e.scale));
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
3075
  },
3076
- [r, n, e.scale, m, b.x, b.y]
3077
- ), D = (S) => {
3078
- var I;
3079
- if (!r || S.button !== 0) return;
3080
- S.preventDefault(), (I = h.current) == null || I.focus(), f({ x: S.clientX, y: S.clientY });
3081
- const u = (z) => f({ x: z.clientX, y: z.clientY }), k = () => {
3082
- window.removeEventListener("pointermove", u), window.removeEventListener("pointerup", k);
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
3083
  };
3084
- window.addEventListener("pointermove", u), window.addEventListener("pointerup", k);
3085
- }, M = (S) => {
3084
+ window.addEventListener("pointermove", m), window.addEventListener("pointerup", T);
3085
+ }, I = (D) => {
3086
3086
  if (!r) return;
3087
- const u = {
3088
- ArrowUp: { x: 0, y: -c },
3089
- ArrowDown: { x: 0, y: c },
3090
- ArrowLeft: { x: -c, y: 0 },
3091
- ArrowRight: { x: c, y: 0 }
3092
- }[S.key];
3093
- if (!u) return;
3094
- S.preventDefault();
3095
- const k = Y(E);
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
3096
  r(
3097
- Me({ x: k.x + u.x, y: k.y + u.y }, n, e.scale)
3097
+ Ae({ x: T.x + m.x, y: T.y + m.y }, n, e.scale)
3098
3098
  );
3099
- }, A = {
3100
- x: N(E).x,
3101
- y: N(E).y,
3102
- width: E.width * m,
3103
- height: E.height * m
3099
+ }, M = {
3100
+ x: k(N).x,
3101
+ y: k(N).y,
3102
+ width: N.width * p,
3103
+ height: N.height * p
3104
3104
  }, C = !!r;
3105
3105
  return /* @__PURE__ */ o(
3106
3106
  "div",
3107
3107
  {
3108
- ref: h,
3108
+ ref: u,
3109
3109
  role: C ? "slider" : "img",
3110
- "aria-label": y,
3111
- "aria-valuetext": t.length === 0 ? "Empty graph" : `${t.length} nodes, viewing around ${Math.round(Y(E).x)}, ${Math.round(Y(E).y)}`,
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
3112
  tabIndex: C ? 0 : void 0,
3113
- onPointerDown: D,
3114
- onKeyDown: M,
3113
+ onPointerDown: S,
3114
+ onKeyDown: I,
3115
3115
  style: { width: a, height: s },
3116
- className: L(
3116
+ className: A(
3117
3117
  "rounded-lg border border-border bg-card/90 backdrop-blur-sm shadow-sm overflow-hidden",
3118
3118
  "focus:outline-none focus-visible:ring-2 focus-visible:ring-ring",
3119
3119
  C && "cursor-pointer",
3120
- x
3120
+ h
3121
3121
  ),
3122
- children: /* @__PURE__ */ p("svg", { width: a, height: s, className: "block", children: [
3123
- t.map((S) => {
3124
- const u = q(S), k = N(u), I = T.has(S.id);
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
3125
  return /* @__PURE__ */ o(
3126
3126
  "rect",
3127
3127
  {
3128
- x: k.x,
3129
- y: k.y,
3130
- width: Math.max(u.width * m, 2),
3131
- height: Math.max(u.height * m, 2),
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
3132
  rx: 1,
3133
- fill: I || i == null ? void 0 : i(S),
3134
- className: L(
3135
- !i && !I && "fill-muted-foreground/50",
3136
- I && "fill-primary"
3133
+ fill: L || l == null ? void 0 : l(D),
3134
+ className: A(
3135
+ !l && !L && "fill-muted-foreground/50",
3136
+ L && "fill-primary"
3137
3137
  )
3138
3138
  },
3139
- S.id
3139
+ D.id
3140
3140
  );
3141
3141
  }),
3142
3142
  n.width > 0 && /* @__PURE__ */ o(
3143
3143
  "rect",
3144
3144
  {
3145
- x: A.x,
3146
- y: A.y,
3147
- width: Math.max(A.width, 4),
3148
- height: Math.max(A.height, 4),
3145
+ x: M.x,
3146
+ y: M.y,
3147
+ width: Math.max(M.width, 4),
3148
+ height: Math.max(M.height, 4),
3149
3149
  rx: 2,
3150
3150
  className: "fill-primary/10 stroke-primary",
3151
3151
  strokeWidth: 1.5
@@ -3154,68 +3154,207 @@ const fr = ["top", "right", "bottom", "left"], mr = {
3154
3154
  ] })
3155
3155
  }
3156
3156
  );
3157
- }, Je = "application/x-nexus-graph-node", Zr = ({
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 = ({
3158
3297
  items: t,
3159
3298
  onSelect: e,
3160
3299
  onDragStart: n,
3161
3300
  orientation: r = "auto",
3162
3301
  onOrientationChange: a,
3163
3302
  iconOnly: s = !1,
3164
- className: i,
3303
+ className: l,
3165
3304
  "aria-label": d = "Node palette"
3166
3305
  }) => {
3167
- const l = F(null), [c, y] = R("horizontal"), x = r === "auto" ? c : r, h = F(a);
3168
- h.current = a;
3169
- const T = ee(() => {
3170
- const g = l.current;
3171
- if (!g) return;
3172
- const m = [...g.querySelectorAll("[data-palette-item]")];
3173
- if (m.length === 0) return;
3174
- const b = window.getComputedStyle(g), N = parseFloat(b.gap) || 0, w = (parseFloat(b.paddingLeft) || 0) + (parseFloat(b.paddingRight) || 0), f = m.reduce((S, u) => S + u.offsetWidth, 0) + N * (m.length - 1) + w, D = m.reduce((S, u) => S + u.offsetHeight, 0) + N * (m.length - 1) + w, M = xr(g);
3175
- if (!M) return;
3176
- const A = 4, C = f <= M.width + A ? "horizontal" : D <= M.height + A ? "vertical" : "horizontal";
3177
- y((S) => {
3178
- var u;
3179
- return S === C ? S : ((u = h.current) == null || u.call(h, C), C);
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);
3180
3319
  });
3181
3320
  }, []);
3182
- O(() => {
3321
+ P(() => {
3183
3322
  if (r !== "auto") return;
3184
- const g = l.current;
3185
- if (!g) return;
3186
- T();
3187
- const m = new ResizeObserver(T);
3188
- m.observe(g);
3189
- const b = Xe(g);
3190
- return b && b !== g && m.observe(b), () => m.disconnect();
3191
- }, [r, T, t.length]);
3192
- const E = x === "vertical";
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";
3193
3332
  return /* @__PURE__ */ o(
3194
3333
  "div",
3195
3334
  {
3196
- ref: l,
3335
+ ref: c,
3197
3336
  role: "toolbar",
3198
3337
  "aria-label": d,
3199
- "aria-orientation": x,
3200
- "data-orientation": x,
3201
- className: L(
3338
+ "aria-orientation": h,
3339
+ "data-orientation": h,
3340
+ className: A(
3202
3341
  "flex gap-1.5 p-1.5 rounded-lg border border-border bg-card/90 backdrop-blur-sm shadow-sm",
3203
- E ? "flex-col items-stretch" : "flex-wrap items-center",
3204
- i
3342
+ N ? "flex-col items-stretch" : "flex-wrap items-center",
3343
+ l
3205
3344
  ),
3206
- children: t.map((g) => /* @__PURE__ */ p(
3345
+ children: t.map((y) => /* @__PURE__ */ b(
3207
3346
  "button",
3208
3347
  {
3209
3348
  type: "button",
3210
3349
  "data-palette-item": !0,
3211
3350
  draggable: !0,
3212
- title: g.description ?? (s ? g.label : void 0),
3213
- "aria-label": s ? g.label : void 0,
3214
- onDragStart: (m) => {
3215
- m.dataTransfer.setData(Je, g.kind), m.dataTransfer.setData("text/plain", g.label), m.dataTransfer.effectAllowed = "copy", n == null || n(g);
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);
3216
3355
  },
3217
- onClick: () => e == null ? void 0 : e(g),
3218
- className: L(
3356
+ onClick: () => e == null ? void 0 : e(y),
3357
+ className: A(
3219
3358
  "flex items-center gap-1.5 rounded-md text-xs font-medium",
3220
3359
  "border border-border bg-background text-foreground",
3221
3360
  "hover:bg-accent hover:text-accent-foreground transition-colors",
@@ -3223,18 +3362,18 @@ const fr = ["top", "right", "bottom", "left"], mr = {
3223
3362
  "focus:outline-none focus-visible:ring-2 focus-visible:ring-ring",
3224
3363
  s ? "p-2 justify-center" : "px-2.5 py-1.5",
3225
3364
  // A column reads better left-aligned; a row centres naturally.
3226
- E && !s && "justify-start"
3365
+ N && !s && "justify-start"
3227
3366
  ),
3228
3367
  children: [
3229
- g.icon,
3230
- !s && g.label
3368
+ y.icon,
3369
+ !s && y.label
3231
3370
  ]
3232
3371
  },
3233
- g.kind
3372
+ y.kind
3234
3373
  ))
3235
3374
  }
3236
3375
  );
3237
- }, Xe = (t) => {
3376
+ }, Ve = (t) => {
3238
3377
  let e = t.parentElement;
3239
3378
  for (let n = 0; e && n < 6; n += 1) {
3240
3379
  const r = e.getBoundingClientRect(), a = t.getBoundingClientRect();
@@ -3242,99 +3381,104 @@ const fr = ["top", "right", "bottom", "left"], mr = {
3242
3381
  e = e.parentElement;
3243
3382
  }
3244
3383
  return null;
3245
- }, xr = (t) => {
3246
- const e = Xe(t);
3384
+ }, Nr = (t) => {
3385
+ const e = Ve(t);
3247
3386
  if (!e) return null;
3248
3387
  const n = window.getComputedStyle(e), r = e.getBoundingClientRect();
3249
3388
  return {
3250
3389
  width: r.width - (parseFloat(n.paddingLeft) || 0) - (parseFloat(n.paddingRight) || 0),
3251
3390
  height: r.height - (parseFloat(n.paddingTop) || 0) - (parseFloat(n.paddingBottom) || 0)
3252
3391
  };
3253
- }, en = (t) => t.dataTransfer.getData(Je) || null;
3392
+ }, an = (t) => t.dataTransfer.getData(qe) || null;
3254
3393
  export {
3255
- vt as ActivityBar,
3256
- zr as AppTitle,
3394
+ Nt as ActivityBar,
3395
+ jr as AppTitle,
3396
+ wr as BUILT_IN_LAYOUTS,
3257
3397
  ie as BUNDLED_THEMES,
3258
- Mt as BUNDLED_THEME_CLASSES,
3259
- kt as ChatPane,
3260
- qt as CommandPalette,
3261
- It as CommandRegistry,
3262
- wt as ConnectedActivityBar,
3263
- Ct as ConnectedChatPane,
3264
- $r as ConnectedCommandPalette,
3265
- Lt as ConnectedMenuBar,
3266
- Or as ConnectedModal,
3267
- Pt as ConnectedSidebarPane,
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,
3268
3408
  Kt as ConnectedStatusBar,
3269
- Ut as ConnectedTerminalPane,
3270
- Rr as ConnectedThemeSwitcher,
3271
- Pr as ConnectedUserProfile,
3272
- nr as ContextMenu,
3273
- Ir as DEFAULT_COMMAND_IDS,
3274
- qr as DEFAULT_GRAPH_KEYS,
3275
- de as DEFAULT_NODE_SIZE,
3276
- Ot as DEFAULT_SETTINGS_THEMES,
3277
- er as DEFAULT_THEME_OPTIONS,
3278
- Kr as DataGrid,
3279
- Je as GRAPH_NODE_MIME,
3280
- ur as GraphCanvas,
3281
- Jr as GraphEdge,
3282
- Xr as GraphEdgeLayer,
3283
- Qr as GraphMiniMap,
3284
- Yr as GraphNode,
3285
- We as IDENTITY_VIEWPORT,
3286
- Dt as MenuBar,
3287
- St as MenuRegistry,
3288
- Zt as Modal,
3289
- Sr as NexusWorkspaceShell,
3290
- Zr as NodePalette,
3291
- Fr as QuickSearch,
3292
- _r as SearchWidget,
3293
- Rt as SettingsPanel,
3294
- Sr as ShellLayout,
3295
- me as SidebarPane,
3296
- zt as StatusBar,
3297
- Ft as TerminalPane,
3298
- tr as ThemeSwitcher,
3299
- Ur as TreeWidget,
3300
- rr as UserProfile,
3301
- Me as centerOn,
3302
- ye as clampScale,
3303
- L as cn,
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,
3304
3445
  te as commandRegistry,
3305
- Bt as componentRegistry,
3306
- hr as edgePath,
3307
- Br as edgesOf,
3308
- he as findNeighbour,
3309
- lr as fitViewport,
3310
- Ge as graphBounds,
3311
- Lr as initializeShell,
3312
- Hr as isConnected,
3313
- ve as menuRegistry,
3314
- Gr as nextId,
3315
- q as nodeRect,
3316
- cr as placeRelativeTo,
3317
- Mr as pluginRegistry,
3318
- Le as portPoint,
3319
- en as readPaletteDrag,
3320
- Y as rectCenter,
3321
- Wr as removeNode,
3322
- sr as resolvePorts,
3323
- At as themeClass,
3324
- be as toGraphSpace,
3325
- jr as toScreenSpace,
3326
- ir as unionRect,
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,
3327
3470
  ae as useChatStore,
3328
- Vr as useGraphKeyboard,
3329
- Ar as useKeyboardShortcuts,
3330
- Ht as useLayoutStore,
3331
- je as useModalStore,
3332
- xe as useRightSidebarStore,
3333
- G as useSidebarStore,
3334
- we as useStatusBarStore,
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,
3335
3479
  ne as useTerminalStore,
3336
3480
  oe as useThemeStore,
3337
- Z as useUserProfileStore,
3338
- ar as viewportRect,
3481
+ ee as useUserProfileStore,
3482
+ lr as viewportRect,
3339
3483
  Ie as zoomAt
3340
3484
  };