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