nexus-shell 0.2.4 → 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 +5 -0
- 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/index.d.ts +2 -0
- package/dist/lib/graph.d.ts +144 -0
- package/dist/nexus-shell.es.js +1967 -1278
- package/dist/nexus-shell.umd.js +1 -1
- package/dist/style.css +1 -1
- package/package.json +1 -1
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 =
|
|
21
|
-
activeId:
|
|
22
|
-
onSelect:
|
|
23
|
-
className:
|
|
16
|
+
const gt = [
|
|
17
|
+
{ id: "settings", label: "Settings", icon: Qe }
|
|
18
|
+
], ht = ({
|
|
19
|
+
items: t = [],
|
|
20
|
+
bottomItems: e = gt,
|
|
21
|
+
activeId: n = null,
|
|
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":
|
|
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
|
-
|
|
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:
|
|
81
|
-
activeId:
|
|
82
|
-
onSelect:
|
|
79
|
+
...t,
|
|
80
|
+
items: i,
|
|
81
|
+
activeId: n,
|
|
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
|
-
slashCommands:
|
|
97
|
-
onSlashCommand:
|
|
98
|
-
onClose:
|
|
96
|
+
slashCommands: n = [],
|
|
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 Qe = [
|
|
|
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: [...
|
|
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
|
|
279
|
-
return
|
|
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
|
-
title:
|
|
304
|
-
center:
|
|
305
|
-
right:
|
|
303
|
+
title: n,
|
|
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
|
-
|
|
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
|
-
registerMenu(e,
|
|
406
|
-
var
|
|
407
|
-
this.menus.has(e) || this.menus.set(e, []), (
|
|
405
|
+
registerMenu(e, n) {
|
|
406
|
+
var r;
|
|
407
|
+
this.menus.has(e) || this.menus.set(e, []), (r = this.menus.get(e)) == null || r.push(n);
|
|
408
408
|
}
|
|
409
409
|
setMenus(e) {
|
|
410
410
|
this.menus = new Map(Object.entries(e));
|
|
@@ -414,15 +414,15 @@ class at {
|
|
|
414
414
|
}
|
|
415
415
|
getAllMenus() {
|
|
416
416
|
const e = {};
|
|
417
|
-
return this.menus.forEach((
|
|
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)) {
|
|
@@ -431,9 +431,9 @@ class lt {
|
|
|
431
431
|
}
|
|
432
432
|
this.commands.set(e.id, e);
|
|
433
433
|
}
|
|
434
|
-
executeCommand(e, ...
|
|
435
|
-
const
|
|
436
|
-
|
|
434
|
+
executeCommand(e, ...n) {
|
|
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,66 +442,66 @@ class lt {
|
|
|
442
442
|
return Array.from(this.commands.values());
|
|
443
443
|
}
|
|
444
444
|
}
|
|
445
|
-
const
|
|
446
|
-
var
|
|
445
|
+
const q = new Tt(), Ke = (t) => t.map((e) => {
|
|
446
|
+
var n;
|
|
447
447
|
return {
|
|
448
448
|
...e,
|
|
449
|
-
keybinding: e.keybinding ?? (e.commandId ? (
|
|
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
|
|
454
|
-
if (
|
|
455
|
-
const
|
|
456
|
-
if (
|
|
452
|
+
}), _e = (t, e) => {
|
|
453
|
+
for (const n of t) {
|
|
454
|
+
if (n.id === e) return n;
|
|
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
|
-
onClose:
|
|
475
|
-
width:
|
|
476
|
-
className:
|
|
477
|
-
}) => /* @__PURE__ */
|
|
474
|
+
onClose: n,
|
|
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
|
-
|
|
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
|
-
onClick:
|
|
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
|
-
),
|
|
504
|
+
), ae = [
|
|
505
505
|
{
|
|
506
506
|
id: "light",
|
|
507
507
|
label: "Light",
|
|
@@ -526,232 +526,232 @@ const J = new lt(), Se = (n) => n.map((e) => {
|
|
|
526
526
|
shortLabel: "TAMU",
|
|
527
527
|
description: "Aggie Maroon (#500000) on white."
|
|
528
528
|
}
|
|
529
|
-
],
|
|
530
|
-
light:
|
|
531
|
-
dark:
|
|
532
|
-
gt:
|
|
533
|
-
tamu:
|
|
534
|
-
},
|
|
535
|
-
id:
|
|
536
|
-
label:
|
|
537
|
-
icon:
|
|
538
|
-
})),
|
|
539
|
-
theme:
|
|
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,
|
|
540
540
|
onThemeChange: e,
|
|
541
|
-
themes:
|
|
542
|
-
className:
|
|
543
|
-
}) => /* @__PURE__ */
|
|
544
|
-
/* @__PURE__ */
|
|
545
|
-
/* @__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(
|
|
546
546
|
"div",
|
|
547
547
|
{
|
|
548
548
|
role: "radiogroup",
|
|
549
549
|
"aria-label": "Theme",
|
|
550
550
|
className: "grid grid-cols-1 gap-2",
|
|
551
|
-
children:
|
|
551
|
+
children: n.map(({ id: i, label: s, icon: a }) => /* @__PURE__ */ f(
|
|
552
552
|
"button",
|
|
553
553
|
{
|
|
554
554
|
type: "button",
|
|
555
555
|
role: "radio",
|
|
556
|
-
"aria-checked":
|
|
557
|
-
onClick: () => e(
|
|
558
|
-
className:
|
|
556
|
+
"aria-checked": t === i,
|
|
557
|
+
onClick: () => e(i),
|
|
558
|
+
className: D(
|
|
559
559
|
"flex items-center space-x-3 px-3 py-2 rounded-md border text-sm transition-all focus:outline-none focus:ring-2 focus:ring-ring",
|
|
560
|
-
|
|
560
|
+
t === i ? "bg-primary text-primary-foreground border-primary" : "bg-background hover:bg-accent border-border"
|
|
561
561
|
),
|
|
562
562
|
children: [
|
|
563
|
-
/* @__PURE__ */
|
|
564
|
-
/* @__PURE__ */
|
|
563
|
+
/* @__PURE__ */ o(a, { size: 16 }),
|
|
564
|
+
/* @__PURE__ */ o("span", { children: s })
|
|
565
565
|
]
|
|
566
566
|
},
|
|
567
|
-
|
|
567
|
+
i
|
|
568
568
|
))
|
|
569
569
|
}
|
|
570
570
|
)
|
|
571
|
-
] }) }),
|
|
572
|
-
const e = window.document.documentElement,
|
|
573
|
-
...
|
|
574
|
-
...Array.from(e.classList).filter((
|
|
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
575
|
];
|
|
576
|
-
e.classList.remove(...
|
|
577
|
-
},
|
|
578
|
-
const
|
|
579
|
-
return
|
|
580
|
-
theme:
|
|
581
|
-
setTheme: (
|
|
582
|
-
localStorage.setItem(
|
|
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), {
|
|
580
|
+
theme: n,
|
|
581
|
+
setTheme: (r) => {
|
|
582
|
+
localStorage.setItem(ke, r), Ce(r), t({ theme: r });
|
|
583
583
|
}
|
|
584
584
|
};
|
|
585
|
-
}),
|
|
586
|
-
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);
|
|
587
587
|
if (!e) return null;
|
|
588
|
-
const
|
|
588
|
+
const a = () => r(null);
|
|
589
589
|
if (e === "settings")
|
|
590
|
-
return /* @__PURE__ */
|
|
591
|
-
|
|
590
|
+
return /* @__PURE__ */ o(fe, { ...t, title: "Settings", onClose: a, children: /* @__PURE__ */ o(
|
|
591
|
+
Ot,
|
|
592
592
|
{
|
|
593
|
-
theme:
|
|
594
|
-
onThemeChange: (
|
|
593
|
+
theme: i,
|
|
594
|
+
onThemeChange: (c) => s(c)
|
|
595
595
|
}
|
|
596
596
|
) });
|
|
597
|
-
const
|
|
598
|
-
if (!
|
|
599
|
-
return /* @__PURE__ */
|
|
600
|
-
const
|
|
601
|
-
return /* @__PURE__ */
|
|
602
|
-
},
|
|
603
|
-
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 = [],
|
|
604
604
|
className: e,
|
|
605
|
-
"aria-label":
|
|
605
|
+
"aria-label": n = "Status Bar"
|
|
606
606
|
}) => {
|
|
607
|
-
const
|
|
608
|
-
left:
|
|
609
|
-
center:
|
|
610
|
-
right:
|
|
611
|
-
},
|
|
612
|
-
const
|
|
613
|
-
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(
|
|
614
614
|
"div",
|
|
615
615
|
{
|
|
616
616
|
onClick: s.onClick,
|
|
617
|
-
onKeyDown:
|
|
618
|
-
var
|
|
619
|
-
(
|
|
617
|
+
onKeyDown: d ? (l) => {
|
|
618
|
+
var c;
|
|
619
|
+
(l.key === "Enter" || l.key === " ") && (l.preventDefault(), (c = s.onClick) == null || c.call(s));
|
|
620
620
|
} : void 0,
|
|
621
|
-
role:
|
|
622
|
-
tabIndex:
|
|
623
|
-
className:
|
|
621
|
+
role: d ? "button" : void 0,
|
|
622
|
+
tabIndex: d ? 0 : void 0,
|
|
623
|
+
className: D(
|
|
624
624
|
"flex items-center space-x-1.5 px-2 py-0.5 rounded transition-colors h-full focus:outline-none",
|
|
625
|
-
|
|
625
|
+
d ? "cursor-pointer hover:bg-white/10 focus:ring-1 focus:ring-white" : "cursor-default",
|
|
626
626
|
s.className
|
|
627
627
|
),
|
|
628
628
|
children: [
|
|
629
|
-
|
|
630
|
-
s.label && /* @__PURE__ */
|
|
629
|
+
a && /* @__PURE__ */ o(a, { size: 12 }),
|
|
630
|
+
s.label && /* @__PURE__ */ o("span", { children: s.label })
|
|
631
631
|
]
|
|
632
632
|
},
|
|
633
633
|
s.id
|
|
634
634
|
);
|
|
635
635
|
};
|
|
636
|
-
return /* @__PURE__ */
|
|
636
|
+
return /* @__PURE__ */ f(
|
|
637
637
|
"footer",
|
|
638
638
|
{
|
|
639
639
|
role: "status",
|
|
640
|
-
"aria-label":
|
|
641
|
-
className:
|
|
640
|
+
"aria-label": n,
|
|
641
|
+
className: D(
|
|
642
642
|
"h-6 bg-primary text-primary-foreground text-[11px] flex items-center justify-between px-1 select-none shrink-0 border-t border-white/5",
|
|
643
643
|
e
|
|
644
644
|
),
|
|
645
645
|
children: [
|
|
646
|
-
/* @__PURE__ */
|
|
647
|
-
/* @__PURE__ */
|
|
648
|
-
/* @__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) })
|
|
649
649
|
]
|
|
650
650
|
}
|
|
651
651
|
);
|
|
652
|
-
},
|
|
652
|
+
}, ve = G((t) => ({
|
|
653
653
|
widgets: [],
|
|
654
|
-
setWidgets: (e) =>
|
|
655
|
-
addWidget: (e) =>
|
|
656
|
-
widgets: [...
|
|
657
|
-
(
|
|
654
|
+
setWidgets: (e) => t({ widgets: e }),
|
|
655
|
+
addWidget: (e) => t((n) => ({
|
|
656
|
+
widgets: [...n.widgets, e].sort(
|
|
657
|
+
(r, i) => (i.priority || 0) - (r.priority || 0)
|
|
658
658
|
)
|
|
659
659
|
})),
|
|
660
|
-
removeWidget: (e) =>
|
|
661
|
-
widgets:
|
|
660
|
+
removeWidget: (e) => t((n) => ({
|
|
661
|
+
widgets: n.widgets.filter((r) => r.id !== e)
|
|
662
662
|
})),
|
|
663
|
-
updateWidget: (e,
|
|
664
|
-
widgets:
|
|
663
|
+
updateWidget: (e, n) => t((r) => ({
|
|
664
|
+
widgets: r.widgets.map((i) => i.id === e ? { ...i, ...n } : i)
|
|
665
665
|
}))
|
|
666
|
-
})),
|
|
667
|
-
const e =
|
|
668
|
-
() => e.map(({ commandId:
|
|
669
|
-
...
|
|
670
|
-
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)
|
|
671
671
|
})),
|
|
672
672
|
[e]
|
|
673
673
|
);
|
|
674
|
-
return /* @__PURE__ */
|
|
675
|
-
},
|
|
676
|
-
history:
|
|
674
|
+
return /* @__PURE__ */ o(At, { ...t, widgets: n });
|
|
675
|
+
}, Pt = ({
|
|
676
|
+
history: t = [],
|
|
677
677
|
onCommand: e,
|
|
678
|
-
onClose:
|
|
679
|
-
height:
|
|
680
|
-
prompt:
|
|
678
|
+
onClose: n,
|
|
679
|
+
height: r = "250px",
|
|
680
|
+
prompt: i = "$",
|
|
681
681
|
title: s = "Terminal",
|
|
682
|
-
className:
|
|
682
|
+
className: a
|
|
683
683
|
}) => {
|
|
684
|
-
const [
|
|
685
|
-
|
|
686
|
-
|
|
687
|
-
}, [
|
|
688
|
-
const
|
|
689
|
-
if (
|
|
690
|
-
const
|
|
691
|
-
|
|
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(""));
|
|
692
692
|
};
|
|
693
|
-
return /* @__PURE__ */
|
|
693
|
+
return /* @__PURE__ */ f(
|
|
694
694
|
"div",
|
|
695
695
|
{
|
|
696
|
-
style: { height:
|
|
697
|
-
className:
|
|
696
|
+
style: { height: r },
|
|
697
|
+
className: D(
|
|
698
698
|
"bg-card border-t border-border flex flex-col shrink-0 font-mono text-xs",
|
|
699
|
-
|
|
699
|
+
a
|
|
700
700
|
),
|
|
701
701
|
children: [
|
|
702
|
-
/* @__PURE__ */
|
|
703
|
-
/* @__PURE__ */
|
|
704
|
-
/* @__PURE__ */
|
|
705
|
-
/* @__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 })
|
|
706
706
|
] }),
|
|
707
|
-
|
|
708
|
-
/* @__PURE__ */
|
|
707
|
+
n && /* @__PURE__ */ f("div", { className: "flex items-center space-x-1", children: [
|
|
708
|
+
/* @__PURE__ */ o(
|
|
709
709
|
"button",
|
|
710
710
|
{
|
|
711
711
|
type: "button",
|
|
712
|
-
onClick:
|
|
712
|
+
onClick: n,
|
|
713
713
|
"aria-label": "Collapse Terminal",
|
|
714
714
|
className: "p-1 rounded hover:bg-accent hover:text-foreground text-muted-foreground transition-colors focus:outline-none focus:ring-2 focus:ring-ring",
|
|
715
|
-
children: /* @__PURE__ */
|
|
715
|
+
children: /* @__PURE__ */ o(Pe, { size: 14 })
|
|
716
716
|
}
|
|
717
717
|
),
|
|
718
|
-
/* @__PURE__ */
|
|
718
|
+
/* @__PURE__ */ o(
|
|
719
719
|
"button",
|
|
720
720
|
{
|
|
721
721
|
type: "button",
|
|
722
|
-
onClick:
|
|
722
|
+
onClick: n,
|
|
723
723
|
"aria-label": "Close Terminal",
|
|
724
724
|
className: "p-1 rounded hover:bg-accent hover:text-foreground text-muted-foreground transition-colors focus:outline-none focus:ring-2 focus:ring-ring",
|
|
725
|
-
children: /* @__PURE__ */
|
|
725
|
+
children: /* @__PURE__ */ o(J, { size: 14 })
|
|
726
726
|
}
|
|
727
727
|
)
|
|
728
728
|
] })
|
|
729
729
|
] }),
|
|
730
|
-
/* @__PURE__ */
|
|
730
|
+
/* @__PURE__ */ o(
|
|
731
731
|
"div",
|
|
732
732
|
{
|
|
733
|
-
ref:
|
|
733
|
+
ref: c,
|
|
734
734
|
role: "log",
|
|
735
735
|
"aria-label": `${s} output`,
|
|
736
736
|
className: "flex-1 overflow-y-auto px-3 py-2 space-y-0.5",
|
|
737
737
|
onClick: () => {
|
|
738
|
-
var
|
|
739
|
-
return (
|
|
738
|
+
var m;
|
|
739
|
+
return (m = h.current) == null ? void 0 : m.focus();
|
|
740
740
|
},
|
|
741
|
-
children:
|
|
741
|
+
children: t.map((m, C) => /* @__PURE__ */ o("div", { className: "whitespace-pre-wrap break-all text-foreground/90", children: m }, C))
|
|
742
742
|
}
|
|
743
743
|
),
|
|
744
|
-
/* @__PURE__ */
|
|
745
|
-
/* @__PURE__ */
|
|
746
|
-
/* @__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(
|
|
747
747
|
"input",
|
|
748
748
|
{
|
|
749
|
-
ref:
|
|
749
|
+
ref: h,
|
|
750
750
|
type: "text",
|
|
751
751
|
"aria-label": `${s} input`,
|
|
752
|
-
value:
|
|
753
|
-
onChange: (
|
|
754
|
-
onKeyDown:
|
|
752
|
+
value: d,
|
|
753
|
+
onChange: (m) => l(m.target.value),
|
|
754
|
+
onKeyDown: g,
|
|
755
755
|
spellCheck: !1,
|
|
756
756
|
autoComplete: "off",
|
|
757
757
|
className: "flex-1 bg-transparent outline-none text-foreground placeholder:text-muted-foreground"
|
|
@@ -761,54 +761,54 @@ const J = new lt(), Se = (n) => n.map((e) => {
|
|
|
761
761
|
]
|
|
762
762
|
}
|
|
763
763
|
);
|
|
764
|
-
},
|
|
764
|
+
}, ee = G((t) => ({
|
|
765
765
|
isOpen: !1,
|
|
766
766
|
history: ["Welcome to Nexus Shell Terminal v0.1.0", 'Type "help" for a list of commands.'],
|
|
767
|
-
setOpen: (e) =>
|
|
768
|
-
toggle: () =>
|
|
769
|
-
addHistory: (e) =>
|
|
770
|
-
clearHistory: () =>
|
|
771
|
-
})),
|
|
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 = [
|
|
772
772
|
"Available commands:",
|
|
773
773
|
" help — show this message",
|
|
774
774
|
" clear — clear the terminal"
|
|
775
|
-
],
|
|
776
|
-
onCommand:
|
|
775
|
+
], Rt = ({
|
|
776
|
+
onCommand: t,
|
|
777
777
|
...e
|
|
778
778
|
}) => {
|
|
779
|
-
const
|
|
780
|
-
return
|
|
781
|
-
|
|
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,
|
|
782
782
|
{
|
|
783
783
|
...e,
|
|
784
|
-
history:
|
|
785
|
-
onCommand: (
|
|
786
|
-
s(`$ ${
|
|
787
|
-
const
|
|
788
|
-
if (
|
|
789
|
-
|
|
784
|
+
history: r,
|
|
785
|
+
onCommand: (l) => {
|
|
786
|
+
s(`$ ${l}`);
|
|
787
|
+
const c = l.toLowerCase();
|
|
788
|
+
if (c === "clear") {
|
|
789
|
+
a();
|
|
790
790
|
return;
|
|
791
791
|
}
|
|
792
|
-
if (
|
|
793
|
-
|
|
792
|
+
if (c === "help") {
|
|
793
|
+
zt.forEach(s);
|
|
794
794
|
return;
|
|
795
795
|
}
|
|
796
|
-
(
|
|
796
|
+
(t == null ? void 0 : t(l)) !== !0 && s(`command not found: ${l.split(" ")[0]}`);
|
|
797
797
|
},
|
|
798
|
-
onClose: () =>
|
|
798
|
+
onClose: () => i(!1)
|
|
799
799
|
}
|
|
800
800
|
) : null;
|
|
801
801
|
};
|
|
802
|
-
class
|
|
802
|
+
class Kt {
|
|
803
803
|
constructor() {
|
|
804
|
-
|
|
804
|
+
X(this, "components", /* @__PURE__ */ new Map());
|
|
805
805
|
}
|
|
806
806
|
/**
|
|
807
807
|
* Register a component with a unique ID.
|
|
808
808
|
* This ID is what you use in your FlexLayout models.
|
|
809
809
|
*/
|
|
810
|
-
register(e,
|
|
811
|
-
this.components.has(e) && console.warn(`Component with ID "${e}" is already registered.`), this.components.set(e,
|
|
810
|
+
register(e, n) {
|
|
811
|
+
this.components.has(e) && console.warn(`Component with ID "${e}" is already registered.`), this.components.set(e, n);
|
|
812
812
|
}
|
|
813
813
|
/**
|
|
814
814
|
* Retrieve a registered component by its ID.
|
|
@@ -823,7 +823,7 @@ class yt {
|
|
|
823
823
|
return Array.from(this.components.keys());
|
|
824
824
|
}
|
|
825
825
|
}
|
|
826
|
-
const
|
|
826
|
+
const _t = new Kt(), Y = {
|
|
827
827
|
global: { tabEnableClose: !0, tabSetEnableMaximize: !1, tabSetEnableDivide: !0 },
|
|
828
828
|
borders: [
|
|
829
829
|
{
|
|
@@ -849,273 +849,273 @@ const wt = new yt(), _ = {
|
|
|
849
849
|
}
|
|
850
850
|
]
|
|
851
851
|
}
|
|
852
|
-
},
|
|
853
|
-
let
|
|
852
|
+
}, Te = "nexus-shell-layout", Ut = G((t, e) => {
|
|
853
|
+
let n;
|
|
854
854
|
if (typeof window < "u")
|
|
855
855
|
try {
|
|
856
|
-
const
|
|
857
|
-
if (
|
|
858
|
-
const
|
|
859
|
-
|
|
860
|
-
const s = /* @__PURE__ */ new Set(["dialogue-library", "argument-inspector"]),
|
|
861
|
-
|
|
862
|
-
if (
|
|
863
|
-
const
|
|
864
|
-
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());
|
|
865
865
|
}
|
|
866
|
-
}),
|
|
867
|
-
|
|
866
|
+
}), a.forEach((d) => {
|
|
867
|
+
n.doAction(Z.deleteTab(d));
|
|
868
868
|
});
|
|
869
869
|
} else
|
|
870
|
-
|
|
871
|
-
} catch (
|
|
872
|
-
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);
|
|
873
873
|
}
|
|
874
874
|
else
|
|
875
|
-
|
|
875
|
+
n = B.fromJson(Y);
|
|
876
876
|
return {
|
|
877
|
-
model:
|
|
877
|
+
model: n,
|
|
878
878
|
dirtyTabs: /* @__PURE__ */ new Set(),
|
|
879
|
-
storageKey:
|
|
879
|
+
storageKey: Te,
|
|
880
880
|
disableLocalStorage: !1,
|
|
881
|
-
initLayout: (
|
|
881
|
+
initLayout: (r, i) => {
|
|
882
882
|
let s;
|
|
883
|
-
if (
|
|
883
|
+
if (r && Object.keys(r).length > 0)
|
|
884
884
|
try {
|
|
885
|
-
s =
|
|
886
|
-
} catch (
|
|
887
|
-
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);
|
|
888
888
|
}
|
|
889
889
|
else
|
|
890
|
-
s =
|
|
891
|
-
|
|
890
|
+
s = B.fromJson(Y);
|
|
891
|
+
t({ model: s, disableLocalStorage: i || !1 });
|
|
892
892
|
},
|
|
893
|
-
setModel: (
|
|
894
|
-
|
|
895
|
-
const
|
|
893
|
+
setModel: (r) => {
|
|
894
|
+
t({ model: r });
|
|
895
|
+
const i = e().storageKey;
|
|
896
896
|
if (typeof window < "u" && !e().disableLocalStorage)
|
|
897
897
|
try {
|
|
898
|
-
localStorage.setItem(
|
|
898
|
+
localStorage.setItem(i, JSON.stringify(r.toJson()));
|
|
899
899
|
} catch (s) {
|
|
900
900
|
console.error("Failed to save layout to storage", s);
|
|
901
901
|
}
|
|
902
902
|
},
|
|
903
|
-
setStorageKey: (
|
|
903
|
+
setStorageKey: (r, i) => {
|
|
904
904
|
let s;
|
|
905
905
|
if (typeof window < "u")
|
|
906
906
|
try {
|
|
907
|
-
const
|
|
908
|
-
|
|
909
|
-
} catch (
|
|
910
|
-
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);
|
|
911
911
|
}
|
|
912
912
|
else
|
|
913
|
-
s =
|
|
914
|
-
|
|
913
|
+
s = B.fromJson(i || Y);
|
|
914
|
+
t({ storageKey: r, model: s });
|
|
915
915
|
},
|
|
916
|
-
setTabDirty: (
|
|
917
|
-
|
|
918
|
-
const
|
|
919
|
-
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 };
|
|
920
920
|
});
|
|
921
921
|
},
|
|
922
|
-
isTabDirty: (
|
|
923
|
-
addTab: (
|
|
924
|
-
const
|
|
925
|
-
let
|
|
926
|
-
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)
|
|
927
927
|
try {
|
|
928
|
-
const
|
|
929
|
-
|
|
930
|
-
} catch (
|
|
931
|
-
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);
|
|
932
932
|
}
|
|
933
|
-
const
|
|
934
|
-
if (["nexus-dashboard", "nexus-docs"].includes(
|
|
935
|
-
let
|
|
936
|
-
if (
|
|
937
|
-
if (
|
|
938
|
-
const
|
|
939
|
-
|
|
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());
|
|
940
940
|
}
|
|
941
|
-
}),
|
|
942
|
-
|
|
941
|
+
}), g) {
|
|
942
|
+
a.doAction(Z.selectTab(g));
|
|
943
943
|
return;
|
|
944
944
|
}
|
|
945
945
|
}
|
|
946
|
-
if (
|
|
947
|
-
let
|
|
948
|
-
if (
|
|
949
|
-
var
|
|
950
|
-
if (
|
|
951
|
-
const
|
|
952
|
-
((
|
|
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());
|
|
953
953
|
}
|
|
954
|
-
}),
|
|
955
|
-
|
|
954
|
+
}), g) {
|
|
955
|
+
a.doAction(Z.selectTab(g));
|
|
956
956
|
return;
|
|
957
957
|
}
|
|
958
958
|
}
|
|
959
|
-
if (
|
|
960
|
-
let
|
|
961
|
-
if (
|
|
962
|
-
var
|
|
963
|
-
if (
|
|
964
|
-
const
|
|
965
|
-
((
|
|
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());
|
|
966
966
|
}
|
|
967
|
-
}),
|
|
968
|
-
|
|
967
|
+
}), g) {
|
|
968
|
+
a.doAction(Z.selectTab(g));
|
|
969
969
|
return;
|
|
970
970
|
}
|
|
971
971
|
}
|
|
972
|
-
|
|
973
|
-
|
|
974
|
-
{ type: "tab", component:
|
|
975
|
-
|
|
976
|
-
|
|
972
|
+
l && a.doAction(
|
|
973
|
+
Z.addNode(
|
|
974
|
+
{ type: "tab", component: r, name: i || r, config: h },
|
|
975
|
+
l,
|
|
976
|
+
Ve.CENTER,
|
|
977
977
|
-1
|
|
978
978
|
)
|
|
979
979
|
);
|
|
980
980
|
}
|
|
981
981
|
};
|
|
982
|
-
}),
|
|
982
|
+
}), Ue = G((t, e) => ({
|
|
983
983
|
isOpen: !1,
|
|
984
984
|
type: "alert",
|
|
985
985
|
title: "",
|
|
986
986
|
message: "",
|
|
987
987
|
defaultValue: "",
|
|
988
988
|
resolve: null,
|
|
989
|
-
openAlert: (
|
|
990
|
-
|
|
989
|
+
openAlert: (n, r = "Alert") => new Promise((i) => {
|
|
990
|
+
t({ isOpen: !0, type: "alert", title: r, message: n, defaultValue: "", resolve: i });
|
|
991
991
|
}),
|
|
992
|
-
openConfirm: (
|
|
993
|
-
|
|
992
|
+
openConfirm: (n, r = "Confirm") => new Promise((i) => {
|
|
993
|
+
t({ isOpen: !0, type: "confirm", title: r, message: n, defaultValue: "", resolve: i });
|
|
994
994
|
}),
|
|
995
|
-
openPrompt: (
|
|
996
|
-
|
|
995
|
+
openPrompt: (n, r = "", i = "Prompt") => new Promise((s) => {
|
|
996
|
+
t({ isOpen: !0, type: "prompt", title: i, message: n, defaultValue: r, resolve: s });
|
|
997
997
|
}),
|
|
998
|
-
close: (
|
|
999
|
-
const { resolve:
|
|
1000
|
-
|
|
998
|
+
close: (n = null) => {
|
|
999
|
+
const { resolve: r } = e();
|
|
1000
|
+
r && r(n), t({ isOpen: !1, resolve: null });
|
|
1001
1001
|
}
|
|
1002
|
-
})),
|
|
1003
|
-
panels:
|
|
1002
|
+
})), Nr = ({
|
|
1003
|
+
panels: t,
|
|
1004
1004
|
slashCommands: e,
|
|
1005
|
-
menuConfig:
|
|
1006
|
-
statusBarConfig:
|
|
1007
|
-
title:
|
|
1005
|
+
menuConfig: n,
|
|
1006
|
+
statusBarConfig: r,
|
|
1007
|
+
title: i,
|
|
1008
1008
|
rightMenuBarContent: s,
|
|
1009
|
-
centerMenuBarContent:
|
|
1010
|
-
layoutModel:
|
|
1011
|
-
initialLayoutJson:
|
|
1012
|
-
disableLocalStorage:
|
|
1013
|
-
onLayoutChange:
|
|
1009
|
+
centerMenuBarContent: a,
|
|
1010
|
+
layoutModel: d,
|
|
1011
|
+
initialLayoutJson: l,
|
|
1012
|
+
disableLocalStorage: c = !1,
|
|
1013
|
+
onLayoutChange: h
|
|
1014
1014
|
}) => {
|
|
1015
|
-
const { model:
|
|
1016
|
-
|
|
1017
|
-
|
|
1018
|
-
}, [
|
|
1019
|
-
e &&
|
|
1020
|
-
}, [e,
|
|
1021
|
-
|
|
1022
|
-
}, [
|
|
1023
|
-
|
|
1024
|
-
}, [
|
|
1025
|
-
|
|
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);
|
|
1026
1026
|
}, []);
|
|
1027
|
-
const
|
|
1027
|
+
const u = (L) => {
|
|
1028
1028
|
try {
|
|
1029
|
-
const
|
|
1030
|
-
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: [
|
|
1031
1031
|
"Unknown Component: ",
|
|
1032
|
-
|
|
1032
|
+
$
|
|
1033
1033
|
] });
|
|
1034
|
-
} catch (
|
|
1035
|
-
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: [
|
|
1036
1036
|
"Error rendering component: ",
|
|
1037
|
-
|
|
1037
|
+
$ instanceof Error ? $.message : "Unknown error"
|
|
1038
1038
|
] });
|
|
1039
1039
|
}
|
|
1040
|
-
},
|
|
1041
|
-
if (
|
|
1042
|
-
const
|
|
1043
|
-
if (
|
|
1044
|
-
|
|
1045
|
-
`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?`
|
|
1046
1046
|
).then((T) => {
|
|
1047
|
-
T && (w(
|
|
1047
|
+
T && (w($.getId(), !1), g.doAction(L));
|
|
1048
1048
|
});
|
|
1049
1049
|
};
|
|
1050
|
-
return /* @__PURE__ */
|
|
1050
|
+
return /* @__PURE__ */ f(
|
|
1051
1051
|
"div",
|
|
1052
1052
|
{
|
|
1053
|
-
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}`,
|
|
1054
1054
|
children: [
|
|
1055
|
-
/* @__PURE__ */
|
|
1056
|
-
|
|
1055
|
+
/* @__PURE__ */ o(
|
|
1056
|
+
Et,
|
|
1057
1057
|
{
|
|
1058
|
-
title:
|
|
1059
|
-
center:
|
|
1058
|
+
title: i,
|
|
1059
|
+
center: a,
|
|
1060
1060
|
right: s
|
|
1061
1061
|
}
|
|
1062
1062
|
),
|
|
1063
|
-
/* @__PURE__ */
|
|
1064
|
-
/* @__PURE__ */
|
|
1065
|
-
/* @__PURE__ */
|
|
1066
|
-
/* @__PURE__ */
|
|
1067
|
-
/* @__PURE__ */
|
|
1068
|
-
|
|
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,
|
|
1069
1069
|
{
|
|
1070
|
-
model:
|
|
1071
|
-
factory:
|
|
1072
|
-
onModelChange: (
|
|
1073
|
-
|
|
1070
|
+
model: d || g,
|
|
1071
|
+
factory: u,
|
|
1072
|
+
onModelChange: (L) => {
|
|
1073
|
+
d || m(L), h == null || h(L.toJson());
|
|
1074
1074
|
},
|
|
1075
|
-
onAction:
|
|
1075
|
+
onAction: S
|
|
1076
1076
|
}
|
|
1077
1077
|
) }),
|
|
1078
|
-
/* @__PURE__ */
|
|
1078
|
+
/* @__PURE__ */ o(Rt, {})
|
|
1079
1079
|
] }),
|
|
1080
|
-
/* @__PURE__ */
|
|
1080
|
+
/* @__PURE__ */ o(Nt, {})
|
|
1081
1081
|
] }),
|
|
1082
|
-
/* @__PURE__ */
|
|
1082
|
+
/* @__PURE__ */ o(Mt, {})
|
|
1083
1083
|
]
|
|
1084
1084
|
}
|
|
1085
1085
|
);
|
|
1086
|
-
},
|
|
1087
|
-
id: `theme.${
|
|
1088
|
-
label: `Preferences: ${
|
|
1089
|
-
execute: () =>
|
|
1090
|
-
})),
|
|
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 = [
|
|
1091
1091
|
"view.toggleTerminal",
|
|
1092
1092
|
"view.toggleChat",
|
|
1093
1093
|
"view.toggleSidebar",
|
|
1094
|
-
...
|
|
1095
|
-
],
|
|
1094
|
+
...Fe.map((t) => t.id)
|
|
1095
|
+
], Ft = [
|
|
1096
1096
|
{
|
|
1097
1097
|
id: "view.toggleTerminal",
|
|
1098
1098
|
label: "View: Toggle Terminal",
|
|
1099
1099
|
keybinding: "Control+`",
|
|
1100
|
-
execute: () =>
|
|
1100
|
+
execute: () => ee.getState().toggle()
|
|
1101
1101
|
},
|
|
1102
1102
|
{
|
|
1103
1103
|
id: "view.toggleChat",
|
|
1104
1104
|
label: "View: Toggle Chat",
|
|
1105
|
-
execute: () =>
|
|
1105
|
+
execute: () => he.getState().toggleChat()
|
|
1106
1106
|
},
|
|
1107
1107
|
{
|
|
1108
1108
|
id: "view.toggleSidebar",
|
|
1109
1109
|
label: "View: Toggle Sidebar",
|
|
1110
1110
|
keybinding: "Control+b",
|
|
1111
1111
|
execute: () => {
|
|
1112
|
-
var
|
|
1113
|
-
const { activeSidebar:
|
|
1114
|
-
|
|
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);
|
|
1115
1115
|
}
|
|
1116
1116
|
},
|
|
1117
|
-
...
|
|
1118
|
-
],
|
|
1117
|
+
...Fe
|
|
1118
|
+
], jt = {
|
|
1119
1119
|
View: [
|
|
1120
1120
|
{ id: "view.terminal", label: "Toggle Terminal", commandId: "view.toggleTerminal" },
|
|
1121
1121
|
{ id: "view.chat", label: "Toggle Chat", commandId: "view.toggleChat" },
|
|
@@ -1123,35 +1123,35 @@ const wt = new yt(), _ = {
|
|
|
1123
1123
|
{
|
|
1124
1124
|
id: "view.theme",
|
|
1125
1125
|
label: "Theme",
|
|
1126
|
-
submenu:
|
|
1127
|
-
id: `view.theme.${
|
|
1128
|
-
label:
|
|
1129
|
-
commandId: `theme.${
|
|
1126
|
+
submenu: ae.map((t) => ({
|
|
1127
|
+
id: `view.theme.${t.id}`,
|
|
1128
|
+
label: t.label,
|
|
1129
|
+
commandId: `theme.${t.id}`
|
|
1130
1130
|
}))
|
|
1131
1131
|
}
|
|
1132
1132
|
]
|
|
1133
|
-
},
|
|
1133
|
+
}, Cr = (t = {}) => {
|
|
1134
1134
|
const {
|
|
1135
1135
|
panels: e,
|
|
1136
|
-
menus:
|
|
1137
|
-
commands:
|
|
1138
|
-
statusBar:
|
|
1136
|
+
menus: n,
|
|
1137
|
+
commands: r,
|
|
1138
|
+
statusBar: i,
|
|
1139
1139
|
slashCommands: s,
|
|
1140
|
-
defaultCommands:
|
|
1141
|
-
defaultMenus:
|
|
1142
|
-
} =
|
|
1143
|
-
|
|
1144
|
-
const
|
|
1145
|
-
...
|
|
1146
|
-
...
|
|
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 : {},
|
|
1146
|
+
...n ?? {}
|
|
1147
1147
|
};
|
|
1148
|
-
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);
|
|
1149
1149
|
};
|
|
1150
|
-
class
|
|
1150
|
+
class Bt {
|
|
1151
1151
|
constructor() {
|
|
1152
|
-
|
|
1153
|
-
|
|
1154
|
-
|
|
1152
|
+
X(this, "plugins", /* @__PURE__ */ new Map());
|
|
1153
|
+
X(this, "loaders", /* @__PURE__ */ new Map());
|
|
1154
|
+
X(this, "statuses", /* @__PURE__ */ new Map());
|
|
1155
1155
|
}
|
|
1156
1156
|
registerPlugin(e) {
|
|
1157
1157
|
if (this.plugins.has(e.id)) {
|
|
@@ -1160,38 +1160,38 @@ class St {
|
|
|
1160
1160
|
}
|
|
1161
1161
|
this.plugins.set(e.id, e), this.statuses.set(e.id, "registered"), console.log(`Plugin ${e.name} (${e.id}) registered.`);
|
|
1162
1162
|
}
|
|
1163
|
-
registerLazyPlugin(e,
|
|
1163
|
+
registerLazyPlugin(e, n) {
|
|
1164
1164
|
if (this.loaders.has(e) || this.plugins.has(e)) {
|
|
1165
1165
|
console.warn(`Plugin ${e} is already registered or has a loader.`);
|
|
1166
1166
|
return;
|
|
1167
1167
|
}
|
|
1168
|
-
this.loaders.set(e,
|
|
1168
|
+
this.loaders.set(e, n), this.statuses.set(e, "inactive"), console.log(`Lazy plugin loader for ${e} registered.`);
|
|
1169
1169
|
}
|
|
1170
1170
|
async activatePlugin(e) {
|
|
1171
|
-
let
|
|
1172
|
-
if (!
|
|
1171
|
+
let n = this.plugins.get(e);
|
|
1172
|
+
if (!n && this.loaders.has(e))
|
|
1173
1173
|
try {
|
|
1174
|
-
|
|
1175
|
-
} catch (
|
|
1176
|
-
console.error(`Failed to load lazy plugin ${e}`,
|
|
1174
|
+
n = await this.loaders.get(e)(), this.plugins.set(e, n), this.statuses.set(e, "registered"), console.log(`Lazy plugin ${e} loaded.`);
|
|
1175
|
+
} catch (r) {
|
|
1176
|
+
console.error(`Failed to load lazy plugin ${e}`, r), this.statuses.set(e, "failed");
|
|
1177
1177
|
return;
|
|
1178
1178
|
}
|
|
1179
|
-
if (
|
|
1179
|
+
if (n)
|
|
1180
1180
|
try {
|
|
1181
|
-
this.statuses.set(e, "activating"),
|
|
1182
|
-
} catch (
|
|
1183
|
-
console.error(`Failed to activate plugin ${e}`,
|
|
1181
|
+
this.statuses.set(e, "activating"), n.activate(), this.statuses.set(e, "active"), console.log(`Plugin ${n.name} activated.`);
|
|
1182
|
+
} catch (r) {
|
|
1183
|
+
console.error(`Failed to activate plugin ${e}`, r), this.statuses.set(e, "failed");
|
|
1184
1184
|
}
|
|
1185
1185
|
else
|
|
1186
1186
|
console.warn(`Plugin ${e} not found for activation.`), this.statuses.set(e, "failed");
|
|
1187
1187
|
}
|
|
1188
1188
|
async deactivatePlugin(e) {
|
|
1189
|
-
const
|
|
1190
|
-
if (
|
|
1189
|
+
const n = this.plugins.get(e);
|
|
1190
|
+
if (n)
|
|
1191
1191
|
try {
|
|
1192
|
-
|
|
1193
|
-
} catch (
|
|
1194
|
-
console.error(`Failed to deactivate plugin ${e}`,
|
|
1192
|
+
n.deactivate(), this.statuses.set(e, "deactivated"), console.log(`Plugin ${n.name} deactivated.`);
|
|
1193
|
+
} catch (r) {
|
|
1194
|
+
console.error(`Failed to deactivate plugin ${e}`, r), this.statuses.set(e, "failed");
|
|
1195
1195
|
}
|
|
1196
1196
|
}
|
|
1197
1197
|
getPluginStatus(e) {
|
|
@@ -1199,8 +1199,8 @@ class St {
|
|
|
1199
1199
|
}
|
|
1200
1200
|
getPluginStatuses() {
|
|
1201
1201
|
const e = {};
|
|
1202
|
-
return this.statuses.forEach((
|
|
1203
|
-
e[
|
|
1202
|
+
return this.statuses.forEach((n, r) => {
|
|
1203
|
+
e[r] = n;
|
|
1204
1204
|
}), e;
|
|
1205
1205
|
}
|
|
1206
1206
|
getPlugin(e) {
|
|
@@ -1210,177 +1210,177 @@ class St {
|
|
|
1210
1210
|
return Array.from(this.plugins.values());
|
|
1211
1211
|
}
|
|
1212
1212
|
}
|
|
1213
|
-
const
|
|
1213
|
+
const Tr = new Bt(), Ee = "nexus-shell-user-profile", Se = {
|
|
1214
1214
|
name: "David Tech",
|
|
1215
1215
|
role: "Shell Architect",
|
|
1216
1216
|
email: "david@techmuch.io",
|
|
1217
1217
|
avatarUrl: "",
|
|
1218
1218
|
customAvatar: ""
|
|
1219
|
-
},
|
|
1220
|
-
let e = { ...
|
|
1219
|
+
}, V = G((t) => {
|
|
1220
|
+
let e = { ...Se };
|
|
1221
1221
|
if (typeof window < "u")
|
|
1222
1222
|
try {
|
|
1223
|
-
const
|
|
1224
|
-
|
|
1225
|
-
} catch (
|
|
1226
|
-
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);
|
|
1227
1227
|
}
|
|
1228
|
-
const
|
|
1228
|
+
const n = (r) => {
|
|
1229
1229
|
if (typeof window < "u")
|
|
1230
1230
|
try {
|
|
1231
1231
|
localStorage.setItem(
|
|
1232
|
-
|
|
1232
|
+
Ee,
|
|
1233
1233
|
JSON.stringify({
|
|
1234
|
-
name:
|
|
1235
|
-
role:
|
|
1236
|
-
email:
|
|
1237
|
-
avatarUrl:
|
|
1238
|
-
customAvatar:
|
|
1234
|
+
name: r.name,
|
|
1235
|
+
role: r.role,
|
|
1236
|
+
email: r.email,
|
|
1237
|
+
avatarUrl: r.avatarUrl,
|
|
1238
|
+
customAvatar: r.customAvatar
|
|
1239
1239
|
})
|
|
1240
1240
|
);
|
|
1241
|
-
} catch (
|
|
1242
|
-
console.error("Failed to save user profile:",
|
|
1241
|
+
} catch (i) {
|
|
1242
|
+
console.error("Failed to save user profile:", i);
|
|
1243
1243
|
}
|
|
1244
1244
|
};
|
|
1245
1245
|
return {
|
|
1246
1246
|
...e,
|
|
1247
|
-
updateProfile: (
|
|
1248
|
-
const s = { ...
|
|
1249
|
-
return
|
|
1247
|
+
updateProfile: (r) => t((i) => {
|
|
1248
|
+
const s = { ...i, ...r };
|
|
1249
|
+
return n(s), r;
|
|
1250
1250
|
}),
|
|
1251
|
-
setCustomAvatar: (
|
|
1252
|
-
const s = { ...
|
|
1253
|
-
return
|
|
1251
|
+
setCustomAvatar: (r) => t((i) => {
|
|
1252
|
+
const s = { ...i, customAvatar: r };
|
|
1253
|
+
return n(s), { customAvatar: r };
|
|
1254
1254
|
}),
|
|
1255
|
-
clearCustomAvatar: () =>
|
|
1256
|
-
const
|
|
1257
|
-
return
|
|
1255
|
+
clearCustomAvatar: () => t((r) => {
|
|
1256
|
+
const i = { ...r, customAvatar: "" };
|
|
1257
|
+
return n(i), { customAvatar: "" };
|
|
1258
1258
|
})
|
|
1259
1259
|
};
|
|
1260
|
-
}),
|
|
1261
|
-
|
|
1262
|
-
const
|
|
1263
|
-
const
|
|
1264
|
-
for (const
|
|
1265
|
-
if (
|
|
1266
|
-
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();
|
|
1267
1267
|
break;
|
|
1268
1268
|
}
|
|
1269
1269
|
};
|
|
1270
|
-
return window.addEventListener("keydown",
|
|
1270
|
+
return window.addEventListener("keydown", t), () => window.removeEventListener("keydown", t);
|
|
1271
1271
|
}, []);
|
|
1272
1272
|
};
|
|
1273
|
-
function
|
|
1274
|
-
var
|
|
1275
|
-
const
|
|
1276
|
-
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;
|
|
1277
1277
|
}
|
|
1278
|
-
const
|
|
1279
|
-
const
|
|
1280
|
-
return
|
|
1281
|
-
},
|
|
1282
|
-
open:
|
|
1278
|
+
const Wt = (t, e) => {
|
|
1279
|
+
const n = e.toLowerCase();
|
|
1280
|
+
return t.label.toLowerCase().includes(n) || t.id.toLowerCase().includes(n);
|
|
1281
|
+
}, Gt = ({
|
|
1282
|
+
open: t,
|
|
1283
1283
|
commands: e,
|
|
1284
|
-
onSelect:
|
|
1285
|
-
onClose:
|
|
1286
|
-
inline:
|
|
1284
|
+
onSelect: n,
|
|
1285
|
+
onClose: r,
|
|
1286
|
+
inline: i = !1,
|
|
1287
1287
|
placeholder: s = "Type a command to run…",
|
|
1288
|
-
filter:
|
|
1289
|
-
className:
|
|
1288
|
+
filter: a = Wt,
|
|
1289
|
+
className: d
|
|
1290
1290
|
}) => {
|
|
1291
|
-
const [
|
|
1292
|
-
() => e.filter((w) =>
|
|
1293
|
-
[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]
|
|
1294
1294
|
);
|
|
1295
|
-
if (
|
|
1295
|
+
if (z(() => {
|
|
1296
1296
|
var w;
|
|
1297
|
-
|
|
1298
|
-
}, [
|
|
1299
|
-
|
|
1300
|
-
}, [
|
|
1301
|
-
const
|
|
1302
|
-
w.key === "ArrowDown" ? (w.preventDefault(),
|
|
1303
|
-
(
|
|
1304
|
-
)) : 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());
|
|
1305
1305
|
};
|
|
1306
|
-
return /* @__PURE__ */
|
|
1306
|
+
return /* @__PURE__ */ o(
|
|
1307
1307
|
"div",
|
|
1308
1308
|
{
|
|
1309
|
-
onClick:
|
|
1310
|
-
className:
|
|
1309
|
+
onClick: i ? void 0 : r,
|
|
1310
|
+
className: D(
|
|
1311
1311
|
"z-[100] flex items-start justify-center",
|
|
1312
|
-
|
|
1312
|
+
i ? "relative w-full max-w-xl" : "fixed inset-0 pt-[10vh] bg-black/50 backdrop-blur-sm"
|
|
1313
1313
|
),
|
|
1314
|
-
children: /* @__PURE__ */
|
|
1314
|
+
children: /* @__PURE__ */ f(
|
|
1315
1315
|
"div",
|
|
1316
1316
|
{
|
|
1317
1317
|
role: "dialog",
|
|
1318
|
-
"aria-modal": !
|
|
1318
|
+
"aria-modal": !i,
|
|
1319
1319
|
"aria-label": "Command Palette",
|
|
1320
1320
|
onClick: (w) => w.stopPropagation(),
|
|
1321
|
-
className:
|
|
1321
|
+
className: D(
|
|
1322
1322
|
"w-full max-w-xl bg-popover text-popover-foreground border shadow-2xl rounded-xl overflow-hidden animate-in fade-in zoom-in duration-200",
|
|
1323
|
-
|
|
1323
|
+
d
|
|
1324
1324
|
),
|
|
1325
1325
|
children: [
|
|
1326
|
-
/* @__PURE__ */
|
|
1327
|
-
/* @__PURE__ */
|
|
1328
|
-
/* @__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(
|
|
1329
1329
|
"input",
|
|
1330
1330
|
{
|
|
1331
|
-
ref:
|
|
1331
|
+
ref: m,
|
|
1332
1332
|
type: "text",
|
|
1333
1333
|
role: "combobox",
|
|
1334
1334
|
"aria-expanded": !0,
|
|
1335
1335
|
"aria-controls": "command-palette-list",
|
|
1336
1336
|
"aria-label": "Command",
|
|
1337
1337
|
placeholder: s,
|
|
1338
|
-
value:
|
|
1339
|
-
onChange: (w) =>
|
|
1340
|
-
onKeyDown:
|
|
1338
|
+
value: l,
|
|
1339
|
+
onChange: (w) => c(w.target.value),
|
|
1340
|
+
onKeyDown: E,
|
|
1341
1341
|
className: "flex-1 h-14 bg-transparent outline-none text-base text-foreground placeholder:text-muted-foreground"
|
|
1342
1342
|
}
|
|
1343
1343
|
)
|
|
1344
1344
|
] }),
|
|
1345
|
-
/* @__PURE__ */
|
|
1345
|
+
/* @__PURE__ */ o(
|
|
1346
1346
|
"div",
|
|
1347
1347
|
{
|
|
1348
1348
|
id: "command-palette-list",
|
|
1349
1349
|
role: "listbox",
|
|
1350
1350
|
className: "max-h-[300px] overflow-y-auto py-2",
|
|
1351
|
-
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(
|
|
1352
1352
|
"div",
|
|
1353
1353
|
{
|
|
1354
1354
|
role: "option",
|
|
1355
|
-
"aria-selected":
|
|
1356
|
-
onClick: () =>
|
|
1357
|
-
onMouseEnter: () =>
|
|
1358
|
-
className:
|
|
1355
|
+
"aria-selected": y === h,
|
|
1356
|
+
onClick: () => n(w),
|
|
1357
|
+
onMouseEnter: () => g(y),
|
|
1358
|
+
className: D(
|
|
1359
1359
|
"px-4 py-2 cursor-pointer flex justify-between items-center text-sm",
|
|
1360
|
-
|
|
1360
|
+
y === h ? "bg-accent text-accent-foreground" : "hover:bg-accent/50"
|
|
1361
1361
|
),
|
|
1362
1362
|
children: [
|
|
1363
|
-
/* @__PURE__ */
|
|
1364
|
-
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 })
|
|
1365
1365
|
]
|
|
1366
1366
|
},
|
|
1367
1367
|
w.id
|
|
1368
1368
|
))
|
|
1369
1369
|
}
|
|
1370
1370
|
),
|
|
1371
|
-
/* @__PURE__ */
|
|
1372
|
-
/* @__PURE__ */
|
|
1373
|
-
/* @__PURE__ */
|
|
1374
|
-
/* @__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: "↑↓" }),
|
|
1375
1375
|
" to navigate"
|
|
1376
1376
|
] }),
|
|
1377
|
-
/* @__PURE__ */
|
|
1378
|
-
/* @__PURE__ */
|
|
1377
|
+
/* @__PURE__ */ f("span", { children: [
|
|
1378
|
+
/* @__PURE__ */ o("kbd", { className: "bg-muted px-1 rounded border", children: "Enter" }),
|
|
1379
1379
|
" to select"
|
|
1380
1380
|
] })
|
|
1381
1381
|
] }),
|
|
1382
|
-
/* @__PURE__ */
|
|
1383
|
-
/* @__PURE__ */
|
|
1382
|
+
/* @__PURE__ */ f("span", { children: [
|
|
1383
|
+
/* @__PURE__ */ o("kbd", { className: "bg-muted px-1 rounded border", children: "Esc" }),
|
|
1384
1384
|
" to close"
|
|
1385
1385
|
] })
|
|
1386
1386
|
] })
|
|
@@ -1389,133 +1389,133 @@ const Et = (n, e) => {
|
|
|
1389
1389
|
)
|
|
1390
1390
|
}
|
|
1391
1391
|
);
|
|
1392
|
-
},
|
|
1393
|
-
shortcutKey:
|
|
1392
|
+
}, Sr = ({
|
|
1393
|
+
shortcutKey: t = "p",
|
|
1394
1394
|
...e
|
|
1395
1395
|
}) => {
|
|
1396
|
-
const [
|
|
1397
|
-
return
|
|
1398
|
-
if (
|
|
1399
|
-
const
|
|
1400
|
-
(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));
|
|
1401
1401
|
};
|
|
1402
|
-
return window.addEventListener("keydown",
|
|
1403
|
-
}, [
|
|
1404
|
-
|
|
1402
|
+
return window.addEventListener("keydown", i), () => window.removeEventListener("keydown", i);
|
|
1403
|
+
}, [t]), /* @__PURE__ */ o(
|
|
1404
|
+
Gt,
|
|
1405
1405
|
{
|
|
1406
1406
|
...e,
|
|
1407
|
-
open:
|
|
1408
|
-
commands:
|
|
1409
|
-
onSelect: (
|
|
1410
|
-
|
|
1407
|
+
open: n,
|
|
1408
|
+
commands: q.getCommands(),
|
|
1409
|
+
onSelect: (i) => {
|
|
1410
|
+
i.execute(), r(!1);
|
|
1411
1411
|
},
|
|
1412
|
-
onClose: () =>
|
|
1412
|
+
onClose: () => r(!1)
|
|
1413
1413
|
}
|
|
1414
1414
|
);
|
|
1415
|
-
},
|
|
1416
|
-
alert:
|
|
1417
|
-
confirm:
|
|
1418
|
-
prompt:
|
|
1419
|
-
},
|
|
1415
|
+
}, Yt = {
|
|
1416
|
+
alert: st,
|
|
1417
|
+
confirm: ot,
|
|
1418
|
+
prompt: nt
|
|
1419
|
+
}, Jt = {
|
|
1420
1420
|
alert: "text-destructive",
|
|
1421
1421
|
confirm: "text-amber-500",
|
|
1422
1422
|
prompt: "text-blue-500"
|
|
1423
|
-
},
|
|
1424
|
-
open:
|
|
1423
|
+
}, Xt = ({
|
|
1424
|
+
open: t,
|
|
1425
1425
|
type: e = "alert",
|
|
1426
|
-
title:
|
|
1427
|
-
message:
|
|
1428
|
-
defaultValue:
|
|
1426
|
+
title: n,
|
|
1427
|
+
message: r,
|
|
1428
|
+
defaultValue: i = "",
|
|
1429
1429
|
onConfirm: s,
|
|
1430
|
-
onCancel:
|
|
1431
|
-
confirmLabel:
|
|
1432
|
-
cancelLabel:
|
|
1433
|
-
placeholder:
|
|
1434
|
-
className:
|
|
1430
|
+
onCancel: a,
|
|
1431
|
+
confirmLabel: d,
|
|
1432
|
+
cancelLabel: l = "Cancel",
|
|
1433
|
+
placeholder: c = "Enter value…",
|
|
1434
|
+
className: h
|
|
1435
1435
|
}) => {
|
|
1436
|
-
const [
|
|
1437
|
-
if (
|
|
1438
|
-
if (!
|
|
1439
|
-
const
|
|
1440
|
-
var
|
|
1441
|
-
(
|
|
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();
|
|
1442
1442
|
}, 50);
|
|
1443
|
-
return () => window.clearTimeout(
|
|
1444
|
-
}, [
|
|
1445
|
-
if (!
|
|
1446
|
-
const
|
|
1447
|
-
|
|
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());
|
|
1448
1448
|
};
|
|
1449
|
-
return document.addEventListener("keydown",
|
|
1450
|
-
}, [
|
|
1451
|
-
const
|
|
1452
|
-
|
|
1453
|
-
},
|
|
1454
|
-
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(
|
|
1455
1455
|
"div",
|
|
1456
1456
|
{
|
|
1457
1457
|
className: "fixed inset-0 z-50 flex items-center justify-center overflow-hidden bg-background/80 backdrop-blur-sm transition-all duration-300",
|
|
1458
|
-
onClick:
|
|
1459
|
-
children: /* @__PURE__ */
|
|
1458
|
+
onClick: a,
|
|
1459
|
+
children: /* @__PURE__ */ f(
|
|
1460
1460
|
"div",
|
|
1461
1461
|
{
|
|
1462
1462
|
role: "dialog",
|
|
1463
1463
|
"aria-modal": "true",
|
|
1464
|
-
"aria-label":
|
|
1465
|
-
onClick: (
|
|
1464
|
+
"aria-label": n,
|
|
1465
|
+
onClick: (b) => b.stopPropagation(),
|
|
1466
1466
|
onKeyDown: w,
|
|
1467
|
-
className:
|
|
1467
|
+
className: D(
|
|
1468
1468
|
"relative flex flex-col w-full max-w-md p-6 bg-card border border-border shadow-2xl rounded-2xl animate-in fade-in zoom-in-95 ring-1 ring-white/10",
|
|
1469
|
-
|
|
1469
|
+
h
|
|
1470
1470
|
),
|
|
1471
1471
|
children: [
|
|
1472
|
-
/* @__PURE__ */
|
|
1472
|
+
/* @__PURE__ */ o(
|
|
1473
1473
|
"button",
|
|
1474
1474
|
{
|
|
1475
1475
|
type: "button",
|
|
1476
|
-
onClick:
|
|
1476
|
+
onClick: a,
|
|
1477
1477
|
"aria-label": "Close",
|
|
1478
1478
|
className: "absolute top-4 right-4 p-1 rounded-full text-muted-foreground hover:bg-muted hover:text-foreground transition-colors focus:outline-none focus:ring-2 focus:ring-ring",
|
|
1479
|
-
children: /* @__PURE__ */
|
|
1479
|
+
children: /* @__PURE__ */ o(J, { size: 18 })
|
|
1480
1480
|
}
|
|
1481
1481
|
),
|
|
1482
|
-
/* @__PURE__ */
|
|
1483
|
-
/* @__PURE__ */
|
|
1484
|
-
/* @__PURE__ */
|
|
1485
|
-
/* @__PURE__ */
|
|
1486
|
-
|
|
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 })
|
|
1487
1487
|
] })
|
|
1488
1488
|
] }),
|
|
1489
|
-
e === "prompt" && /* @__PURE__ */
|
|
1489
|
+
e === "prompt" && /* @__PURE__ */ o("div", { className: "mt-2 mb-4", children: /* @__PURE__ */ o(
|
|
1490
1490
|
"input",
|
|
1491
1491
|
{
|
|
1492
|
-
ref:
|
|
1492
|
+
ref: C,
|
|
1493
1493
|
type: "text",
|
|
1494
|
-
"aria-label":
|
|
1495
|
-
value:
|
|
1496
|
-
placeholder:
|
|
1497
|
-
onChange: (
|
|
1494
|
+
"aria-label": n,
|
|
1495
|
+
value: g,
|
|
1496
|
+
placeholder: c,
|
|
1497
|
+
onChange: (b) => m(b.target.value),
|
|
1498
1498
|
className: "w-full bg-background border border-border rounded-lg px-4 py-2 text-sm focus:outline-none focus:ring-2 focus:ring-primary/50 transition-all placeholder:text-muted-foreground/50"
|
|
1499
1499
|
}
|
|
1500
1500
|
) }),
|
|
1501
|
-
/* @__PURE__ */
|
|
1502
|
-
e !== "alert" && /* @__PURE__ */
|
|
1501
|
+
/* @__PURE__ */ f("div", { className: "flex items-center justify-end space-x-3 mt-4", children: [
|
|
1502
|
+
e !== "alert" && /* @__PURE__ */ o(
|
|
1503
1503
|
"button",
|
|
1504
1504
|
{
|
|
1505
1505
|
type: "button",
|
|
1506
|
-
onClick:
|
|
1506
|
+
onClick: a,
|
|
1507
1507
|
className: "px-4 py-2 text-sm font-medium rounded-lg border border-border hover:bg-muted transition-colors focus:outline-none focus:ring-2 focus:ring-ring",
|
|
1508
|
-
children:
|
|
1508
|
+
children: l
|
|
1509
1509
|
}
|
|
1510
1510
|
),
|
|
1511
|
-
/* @__PURE__ */
|
|
1511
|
+
/* @__PURE__ */ o(
|
|
1512
1512
|
"button",
|
|
1513
1513
|
{
|
|
1514
1514
|
type: "button",
|
|
1515
|
-
onClick:
|
|
1515
|
+
onClick: E,
|
|
1516
1516
|
autoFocus: e !== "prompt",
|
|
1517
1517
|
className: "px-4 py-2 text-sm font-medium rounded-lg bg-primary text-primary-foreground hover:bg-primary/90 transition-colors focus:outline-none focus:ring-2 focus:ring-ring",
|
|
1518
|
-
children:
|
|
1518
|
+
children: d ?? (e === "alert" ? "OK" : "Confirm")
|
|
1519
1519
|
}
|
|
1520
1520
|
)
|
|
1521
1521
|
] })
|
|
@@ -1524,249 +1524,249 @@ const Et = (n, e) => {
|
|
|
1524
1524
|
)
|
|
1525
1525
|
}
|
|
1526
1526
|
);
|
|
1527
|
-
},
|
|
1528
|
-
const { isOpen: e, type:
|
|
1529
|
-
return /* @__PURE__ */
|
|
1530
|
-
|
|
1527
|
+
}, Dr = (t) => {
|
|
1528
|
+
const { isOpen: e, type: n, title: r, message: i, defaultValue: s, close: a } = Ue();
|
|
1529
|
+
return /* @__PURE__ */ o(
|
|
1530
|
+
Xt,
|
|
1531
1531
|
{
|
|
1532
|
-
...
|
|
1532
|
+
...t,
|
|
1533
1533
|
open: e,
|
|
1534
|
-
type:
|
|
1535
|
-
title:
|
|
1536
|
-
message:
|
|
1534
|
+
type: n,
|
|
1535
|
+
title: r,
|
|
1536
|
+
message: i,
|
|
1537
1537
|
defaultValue: s,
|
|
1538
|
-
onConfirm: (
|
|
1539
|
-
|
|
1538
|
+
onConfirm: (c) => {
|
|
1539
|
+
n === "prompt" ? a(c ?? "") : n === "confirm" ? a(!0) : a();
|
|
1540
1540
|
},
|
|
1541
1541
|
onCancel: () => {
|
|
1542
|
-
|
|
1542
|
+
n === "prompt" ? a(null) : n === "confirm" ? a(!1) : a();
|
|
1543
1543
|
}
|
|
1544
1544
|
}
|
|
1545
1545
|
);
|
|
1546
|
-
},
|
|
1547
|
-
id:
|
|
1548
|
-
label:
|
|
1549
|
-
})),
|
|
1550
|
-
value:
|
|
1546
|
+
}, Vt = ae.map((t) => ({
|
|
1547
|
+
id: t.id,
|
|
1548
|
+
label: t.shortLabel
|
|
1549
|
+
})), qt = ({
|
|
1550
|
+
value: t,
|
|
1551
1551
|
onChange: e,
|
|
1552
|
-
options:
|
|
1553
|
-
className:
|
|
1554
|
-
"aria-label":
|
|
1555
|
-
}) => /* @__PURE__ */
|
|
1552
|
+
options: n = Vt,
|
|
1553
|
+
className: r,
|
|
1554
|
+
"aria-label": i = "Theme"
|
|
1555
|
+
}) => /* @__PURE__ */ o(
|
|
1556
1556
|
"div",
|
|
1557
1557
|
{
|
|
1558
1558
|
role: "radiogroup",
|
|
1559
|
-
"aria-label":
|
|
1560
|
-
className:
|
|
1559
|
+
"aria-label": i,
|
|
1560
|
+
className: D(
|
|
1561
1561
|
"flex items-center border border-border rounded-lg p-0.5 bg-secondary/80 select-none",
|
|
1562
|
-
|
|
1562
|
+
r
|
|
1563
1563
|
),
|
|
1564
|
-
children:
|
|
1564
|
+
children: n.map((s) => /* @__PURE__ */ o(
|
|
1565
1565
|
"button",
|
|
1566
1566
|
{
|
|
1567
1567
|
role: "radio",
|
|
1568
|
-
"aria-checked":
|
|
1568
|
+
"aria-checked": t === s.id,
|
|
1569
1569
|
onClick: () => e(s.id),
|
|
1570
|
-
className:
|
|
1570
|
+
className: D(
|
|
1571
1571
|
"px-2.5 py-1 text-[9px] font-extrabold uppercase rounded-md transition-all font-mono cursor-pointer outline-none focus-visible:ring-1 focus-visible:ring-ring",
|
|
1572
|
-
|
|
1572
|
+
t === s.id ? "bg-primary text-primary-foreground shadow" : "text-muted-foreground hover:bg-accent hover:text-foreground"
|
|
1573
1573
|
),
|
|
1574
1574
|
children: s.label
|
|
1575
1575
|
},
|
|
1576
1576
|
s.id
|
|
1577
1577
|
))
|
|
1578
1578
|
}
|
|
1579
|
-
),
|
|
1580
|
-
const e =
|
|
1581
|
-
return /* @__PURE__ */
|
|
1582
|
-
},
|
|
1583
|
-
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,
|
|
1584
1584
|
actions: e = [],
|
|
1585
|
-
onProfileChange:
|
|
1586
|
-
onAvatarChange:
|
|
1587
|
-
onClick:
|
|
1585
|
+
onProfileChange: n,
|
|
1586
|
+
onAvatarChange: r,
|
|
1587
|
+
onClick: i,
|
|
1588
1588
|
showName: s = !0,
|
|
1589
|
-
className:
|
|
1589
|
+
className: a
|
|
1590
1590
|
}) => {
|
|
1591
|
-
const { name:
|
|
1592
|
-
|
|
1593
|
-
|
|
1594
|
-
}, [
|
|
1595
|
-
if (!
|
|
1596
|
-
const T = (
|
|
1597
|
-
|
|
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);
|
|
1598
1598
|
};
|
|
1599
1599
|
return document.addEventListener("mousedown", T), () => document.removeEventListener("mousedown", T);
|
|
1600
|
-
}, [
|
|
1601
|
-
const
|
|
1602
|
-
T.preventDefault(),
|
|
1603
|
-
},
|
|
1604
|
-
var
|
|
1605
|
-
const
|
|
1606
|
-
|
|
1607
|
-
},
|
|
1608
|
-
return /* @__PURE__ */
|
|
1609
|
-
/* @__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(
|
|
1610
1610
|
"button",
|
|
1611
1611
|
{
|
|
1612
1612
|
type: "button",
|
|
1613
|
-
onClick: () =>
|
|
1614
|
-
"aria-haspopup":
|
|
1615
|
-
"aria-expanded":
|
|
1613
|
+
onClick: () => i ? i() : m((T) => !T),
|
|
1614
|
+
"aria-haspopup": i ? void 0 : "menu",
|
|
1615
|
+
"aria-expanded": i ? void 0 : g,
|
|
1616
1616
|
"aria-label": "User Profile Menu",
|
|
1617
|
-
className:
|
|
1617
|
+
className: D(
|
|
1618
1618
|
"focus-visible:ring-2 focus-visible:ring-ring focus-visible:outline-none transition-all duration-200 select-none",
|
|
1619
1619
|
s ? "flex items-center space-x-2 px-2 py-1 rounded-md hover:bg-accent/50 hover:text-accent-foreground text-left cursor-pointer border border-transparent hover:border-border/30" : "w-7 h-7 rounded-full bg-secondary/80 border border-border flex items-center justify-center text-muted-foreground hover:text-foreground hover:bg-secondary cursor-pointer",
|
|
1620
|
-
|
|
1621
|
-
|
|
1620
|
+
g && (s ? "bg-accent/60 border-border/40" : "border-primary/50 text-foreground ring-1 ring-primary/20"),
|
|
1621
|
+
a
|
|
1622
1622
|
),
|
|
1623
1623
|
children: [
|
|
1624
|
-
/* @__PURE__ */
|
|
1624
|
+
/* @__PURE__ */ o(
|
|
1625
1625
|
"div",
|
|
1626
1626
|
{
|
|
1627
|
-
className:
|
|
1627
|
+
className: D(
|
|
1628
1628
|
"rounded-full overflow-hidden border border-border/50 bg-muted flex items-center justify-center shrink-0 shadow-sm",
|
|
1629
1629
|
s ? "w-6 h-6" : "w-full h-full"
|
|
1630
1630
|
),
|
|
1631
|
-
children:
|
|
1631
|
+
children: $(s ? 13 : 12)
|
|
1632
1632
|
}
|
|
1633
1633
|
),
|
|
1634
|
-
s && /* @__PURE__ */
|
|
1635
|
-
/* @__PURE__ */
|
|
1636
|
-
|
|
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 })
|
|
1637
1637
|
] })
|
|
1638
1638
|
]
|
|
1639
1639
|
}
|
|
1640
1640
|
),
|
|
1641
|
-
|
|
1641
|
+
r && /* @__PURE__ */ o(
|
|
1642
1642
|
"input",
|
|
1643
1643
|
{
|
|
1644
1644
|
type: "file",
|
|
1645
|
-
ref:
|
|
1646
|
-
onChange:
|
|
1645
|
+
ref: u,
|
|
1646
|
+
onChange: L,
|
|
1647
1647
|
accept: "image/*",
|
|
1648
1648
|
"aria-label": "Upload avatar",
|
|
1649
1649
|
className: "hidden"
|
|
1650
1650
|
}
|
|
1651
1651
|
),
|
|
1652
|
-
|
|
1652
|
+
g && /* @__PURE__ */ o(
|
|
1653
1653
|
"div",
|
|
1654
1654
|
{
|
|
1655
1655
|
role: "menu",
|
|
1656
|
-
className:
|
|
1656
|
+
className: D(
|
|
1657
1657
|
"absolute z-50 w-64 rounded-lg border border-border/50 bg-card text-card-foreground shadow-lg backdrop-blur-md p-2 flex flex-col gap-1 mt-1.5 animate-in fade-in slide-in-from-top-2 duration-150 origin-top-right",
|
|
1658
1658
|
s ? "left-0" : "right-0"
|
|
1659
1659
|
),
|
|
1660
|
-
children:
|
|
1661
|
-
/* @__PURE__ */
|
|
1662
|
-
/* @__PURE__ */
|
|
1663
|
-
/* @__PURE__ */
|
|
1664
|
-
/* @__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(
|
|
1665
1665
|
"input",
|
|
1666
1666
|
{
|
|
1667
1667
|
id: "profile-name",
|
|
1668
1668
|
type: "text",
|
|
1669
1669
|
value: w,
|
|
1670
|
-
onChange: (T) =>
|
|
1670
|
+
onChange: (T) => y(T.target.value),
|
|
1671
1671
|
required: !0,
|
|
1672
1672
|
className: "w-full px-2 py-1 text-xs border rounded bg-background focus:ring-1 focus:ring-primary focus:outline-none"
|
|
1673
1673
|
}
|
|
1674
1674
|
)
|
|
1675
1675
|
] }),
|
|
1676
|
-
/* @__PURE__ */
|
|
1677
|
-
/* @__PURE__ */
|
|
1678
|
-
/* @__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(
|
|
1679
1679
|
"input",
|
|
1680
1680
|
{
|
|
1681
1681
|
id: "profile-role",
|
|
1682
1682
|
type: "text",
|
|
1683
|
-
value:
|
|
1684
|
-
onChange: (T) =>
|
|
1683
|
+
value: b,
|
|
1684
|
+
onChange: (T) => x(T.target.value),
|
|
1685
1685
|
className: "w-full px-2 py-1 text-xs border rounded bg-background focus:ring-1 focus:ring-primary focus:outline-none"
|
|
1686
1686
|
}
|
|
1687
1687
|
)
|
|
1688
1688
|
] }),
|
|
1689
|
-
/* @__PURE__ */
|
|
1690
|
-
/* @__PURE__ */
|
|
1689
|
+
/* @__PURE__ */ f("div", { className: "flex gap-1.5 mt-1 justify-end", children: [
|
|
1690
|
+
/* @__PURE__ */ f(
|
|
1691
1691
|
"button",
|
|
1692
1692
|
{
|
|
1693
1693
|
type: "button",
|
|
1694
|
-
onClick: () =>
|
|
1694
|
+
onClick: () => E(!1),
|
|
1695
1695
|
className: "px-2 py-1 text-[10px] rounded hover:bg-accent text-muted-foreground flex items-center gap-1 border border-border/30",
|
|
1696
1696
|
children: [
|
|
1697
|
-
/* @__PURE__ */
|
|
1697
|
+
/* @__PURE__ */ o(J, { size: 10 }),
|
|
1698
1698
|
" Cancel"
|
|
1699
1699
|
]
|
|
1700
1700
|
}
|
|
1701
1701
|
),
|
|
1702
|
-
/* @__PURE__ */
|
|
1702
|
+
/* @__PURE__ */ f(
|
|
1703
1703
|
"button",
|
|
1704
1704
|
{
|
|
1705
1705
|
type: "submit",
|
|
1706
1706
|
className: "px-2 py-1 text-[10px] rounded bg-primary text-primary-foreground hover:bg-primary/95 flex items-center gap-1 font-semibold",
|
|
1707
1707
|
children: [
|
|
1708
|
-
/* @__PURE__ */
|
|
1708
|
+
/* @__PURE__ */ o(at, { size: 10 }),
|
|
1709
1709
|
" Save"
|
|
1710
1710
|
]
|
|
1711
1711
|
}
|
|
1712
1712
|
)
|
|
1713
1713
|
] })
|
|
1714
|
-
] }) : /* @__PURE__ */
|
|
1715
|
-
/* @__PURE__ */
|
|
1716
|
-
/* @__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(
|
|
1717
1717
|
"div",
|
|
1718
1718
|
{
|
|
1719
1719
|
onClick: () => {
|
|
1720
1720
|
var T;
|
|
1721
|
-
return
|
|
1721
|
+
return r && ((T = u.current) == null ? void 0 : T.click());
|
|
1722
1722
|
},
|
|
1723
|
-
title:
|
|
1724
|
-
className:
|
|
1723
|
+
title: r ? "Upload avatar image" : void 0,
|
|
1724
|
+
className: D(
|
|
1725
1725
|
"group relative w-12 h-12 rounded-full overflow-hidden border border-border/80 bg-muted flex items-center justify-center shrink-0 shadow-inner",
|
|
1726
|
-
|
|
1726
|
+
r && "cursor-pointer"
|
|
1727
1727
|
),
|
|
1728
1728
|
children: [
|
|
1729
|
-
|
|
1730
|
-
|
|
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" }) })
|
|
1731
1731
|
]
|
|
1732
1732
|
}
|
|
1733
1733
|
),
|
|
1734
|
-
/* @__PURE__ */
|
|
1735
|
-
/* @__PURE__ */
|
|
1736
|
-
/* @__PURE__ */
|
|
1737
|
-
|
|
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(
|
|
1738
1738
|
"button",
|
|
1739
1739
|
{
|
|
1740
1740
|
type: "button",
|
|
1741
|
-
onClick: () =>
|
|
1741
|
+
onClick: () => E(!0),
|
|
1742
1742
|
title: "Edit Profile",
|
|
1743
1743
|
"aria-label": "Edit Profile",
|
|
1744
1744
|
className: "p-1 text-muted-foreground hover:text-foreground hover:bg-accent/40 rounded transition-colors",
|
|
1745
|
-
children: /* @__PURE__ */
|
|
1745
|
+
children: /* @__PURE__ */ o(lt, { size: 10 })
|
|
1746
1746
|
}
|
|
1747
1747
|
)
|
|
1748
1748
|
] }),
|
|
1749
|
-
|
|
1750
|
-
|
|
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 })
|
|
1751
1751
|
] })
|
|
1752
1752
|
] }),
|
|
1753
1753
|
e.map((T) => {
|
|
1754
|
-
const
|
|
1755
|
-
return /* @__PURE__ */
|
|
1754
|
+
const O = T.icon;
|
|
1755
|
+
return /* @__PURE__ */ f(
|
|
1756
1756
|
"button",
|
|
1757
1757
|
{
|
|
1758
1758
|
type: "button",
|
|
1759
1759
|
role: "menuitem",
|
|
1760
1760
|
onClick: () => {
|
|
1761
|
-
T.onSelect(),
|
|
1761
|
+
T.onSelect(), m(!1);
|
|
1762
1762
|
},
|
|
1763
|
-
className:
|
|
1763
|
+
className: D(
|
|
1764
1764
|
"w-full px-2 py-1.5 text-left rounded-md text-[11px] font-medium flex items-center gap-2 cursor-pointer transition-colors",
|
|
1765
1765
|
T.destructive ? "text-destructive hover:bg-destructive/10" : "hover:bg-accent/60 hover:text-accent-foreground",
|
|
1766
1766
|
T.divider && "border-t border-border/20 pt-2 mt-1"
|
|
1767
1767
|
),
|
|
1768
1768
|
children: [
|
|
1769
|
-
|
|
1769
|
+
O && /* @__PURE__ */ o(O, { size: 12, className: "opacity-70" }),
|
|
1770
1770
|
T.label
|
|
1771
1771
|
]
|
|
1772
1772
|
},
|
|
@@ -1777,664 +1777,1353 @@ const Et = (n, e) => {
|
|
|
1777
1777
|
}
|
|
1778
1778
|
)
|
|
1779
1779
|
] });
|
|
1780
|
-
},
|
|
1781
|
-
const e =
|
|
1782
|
-
return /* @__PURE__ */
|
|
1783
|
-
|
|
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,
|
|
1784
1784
|
{
|
|
1785
|
-
...
|
|
1786
|
-
profile: { name: e, role:
|
|
1787
|
-
onProfileChange:
|
|
1788
|
-
onAvatarChange: (
|
|
1789
|
-
const
|
|
1790
|
-
|
|
1791
|
-
typeof
|
|
1792
|
-
},
|
|
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);
|
|
1793
1793
|
}
|
|
1794
1794
|
}
|
|
1795
1795
|
);
|
|
1796
|
-
},
|
|
1797
|
-
|
|
1798
|
-
/* @__PURE__ */
|
|
1799
|
-
/* @__PURE__ */
|
|
1800
|
-
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 })
|
|
1801
1801
|
] })
|
|
1802
|
-
] }),
|
|
1803
|
-
const s =
|
|
1804
|
-
return
|
|
1805
|
-
const
|
|
1806
|
-
s.current && !s.current.contains(
|
|
1807
|
-
},
|
|
1808
|
-
|
|
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();
|
|
1809
1809
|
};
|
|
1810
|
-
return document.addEventListener("mousedown",
|
|
1811
|
-
document.removeEventListener("mousedown",
|
|
1810
|
+
return document.addEventListener("mousedown", a), document.addEventListener("keydown", d), () => {
|
|
1811
|
+
document.removeEventListener("mousedown", a), document.removeEventListener("keydown", d);
|
|
1812
1812
|
};
|
|
1813
|
-
}, [
|
|
1813
|
+
}, [r]), /* @__PURE__ */ o(
|
|
1814
1814
|
"div",
|
|
1815
1815
|
{
|
|
1816
1816
|
ref: s,
|
|
1817
1817
|
role: "menu",
|
|
1818
|
-
style: { top: e, left:
|
|
1819
|
-
className:
|
|
1818
|
+
style: { top: e, left: t },
|
|
1819
|
+
className: D(
|
|
1820
1820
|
"fixed z-[1000] min-w-[160px] bg-popover text-popover-foreground border shadow-md rounded-md py-1 animate-in fade-in zoom-in-95 duration-100",
|
|
1821
|
-
|
|
1821
|
+
i
|
|
1822
1822
|
),
|
|
1823
|
-
children:
|
|
1824
|
-
|
|
1825
|
-
/* @__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(
|
|
1826
1826
|
"div",
|
|
1827
1827
|
{
|
|
1828
1828
|
role: "menuitem",
|
|
1829
|
-
tabIndex:
|
|
1830
|
-
"aria-disabled":
|
|
1829
|
+
tabIndex: a.disabled ? void 0 : 0,
|
|
1830
|
+
"aria-disabled": a.disabled,
|
|
1831
1831
|
onClick: () => {
|
|
1832
|
-
|
|
1832
|
+
a.disabled || (a.onClick(), r());
|
|
1833
1833
|
},
|
|
1834
|
-
onKeyDown: (
|
|
1835
|
-
|
|
1834
|
+
onKeyDown: (l) => {
|
|
1835
|
+
a.disabled || l.key !== "Enter" && l.key !== " " || (l.preventDefault(), a.onClick(), r());
|
|
1836
1836
|
},
|
|
1837
|
-
className:
|
|
1837
|
+
className: D(
|
|
1838
1838
|
"px-3 py-1.5 text-xs flex items-center focus:outline-none",
|
|
1839
|
-
|
|
1839
|
+
a.disabled ? "opacity-40 cursor-default" : "cursor-pointer hover:bg-accent hover:text-accent-foreground focus:bg-accent"
|
|
1840
1840
|
),
|
|
1841
1841
|
children: [
|
|
1842
|
-
|
|
1843
|
-
/* @__PURE__ */
|
|
1842
|
+
a.icon && /* @__PURE__ */ o("span", { className: "mr-2 opacity-70", children: a.icon }),
|
|
1843
|
+
/* @__PURE__ */ o("span", { children: a.label })
|
|
1844
1844
|
]
|
|
1845
1845
|
}
|
|
1846
1846
|
)
|
|
1847
|
-
] }, `${
|
|
1847
|
+
] }, `${a.label}-${d}`))
|
|
1848
1848
|
}
|
|
1849
1849
|
);
|
|
1850
|
-
},
|
|
1851
|
-
columns:
|
|
1850
|
+
}, $r = ({
|
|
1851
|
+
columns: t,
|
|
1852
1852
|
data: e,
|
|
1853
|
-
onRowClick:
|
|
1854
|
-
selectedRowId:
|
|
1855
|
-
rowKey:
|
|
1853
|
+
onRowClick: n,
|
|
1854
|
+
selectedRowId: r,
|
|
1855
|
+
rowKey: i = "id",
|
|
1856
1856
|
virtualized: s = !0,
|
|
1857
|
-
showFilter:
|
|
1858
|
-
loading:
|
|
1859
|
-
placeholder:
|
|
1860
|
-
className:
|
|
1857
|
+
showFilter: a = !0,
|
|
1858
|
+
loading: d = !1,
|
|
1859
|
+
placeholder: l = "No data available",
|
|
1860
|
+
className: c
|
|
1861
1861
|
}) => {
|
|
1862
|
-
const [
|
|
1863
|
-
|
|
1862
|
+
const [h, g] = P(""), [m, C] = P(null), [E, w] = P(-1), y = F(null);
|
|
1863
|
+
z(() => {
|
|
1864
1864
|
w(-1);
|
|
1865
|
-
}, [
|
|
1866
|
-
const
|
|
1867
|
-
if (!
|
|
1868
|
-
const
|
|
1869
|
-
return e.filter((
|
|
1870
|
-
}, [e,
|
|
1871
|
-
if (!
|
|
1872
|
-
const { key:
|
|
1873
|
-
return [...
|
|
1874
|
-
const
|
|
1875
|
-
if (
|
|
1876
|
-
if (
|
|
1877
|
-
if (
|
|
1878
|
-
const
|
|
1879
|
-
if (!isNaN(
|
|
1880
|
-
return
|
|
1881
|
-
const
|
|
1882
|
-
return
|
|
1865
|
+
}, [h, m]);
|
|
1866
|
+
const b = H(() => {
|
|
1867
|
+
if (!h) return e;
|
|
1868
|
+
const p = h.toLowerCase();
|
|
1869
|
+
return e.filter((k) => Object.values(k).some((I) => I == null ? !1 : String(I).toLowerCase().includes(p)));
|
|
1870
|
+
}, [e, h]), x = H(() => {
|
|
1871
|
+
if (!m) return b;
|
|
1872
|
+
const { key: p, direction: k } = m;
|
|
1873
|
+
return [...b].sort((I, _) => {
|
|
1874
|
+
const R = I[p], K = _[p];
|
|
1875
|
+
if (R === K) return 0;
|
|
1876
|
+
if (R == null) return 1;
|
|
1877
|
+
if (K == null) return -1;
|
|
1878
|
+
const v = Number(R), A = Number(K);
|
|
1879
|
+
if (!isNaN(v) && !isNaN(A))
|
|
1880
|
+
return k === "asc" ? v - A : A - v;
|
|
1881
|
+
const M = String(R).toLowerCase(), U = String(K).toLowerCase();
|
|
1882
|
+
return k === "asc" ? M.localeCompare(U) : U.localeCompare(M);
|
|
1883
1883
|
});
|
|
1884
|
-
}, [
|
|
1885
|
-
|
|
1886
|
-
},
|
|
1887
|
-
if (!(
|
|
1888
|
-
if (
|
|
1889
|
-
|
|
1890
|
-
const I =
|
|
1891
|
-
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;
|
|
1892
1892
|
});
|
|
1893
|
-
else if (
|
|
1894
|
-
|
|
1895
|
-
const I =
|
|
1896
|
-
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;
|
|
1897
1897
|
});
|
|
1898
|
-
else if ((
|
|
1899
|
-
const
|
|
1900
|
-
|
|
1898
|
+
else if ((p.key === "Enter" || p.key === " ") && (p.preventDefault(), E >= 0 && E < x.length)) {
|
|
1899
|
+
const k = x[E];
|
|
1900
|
+
n && n(k);
|
|
1901
1901
|
}
|
|
1902
1902
|
}
|
|
1903
|
-
},
|
|
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(
|
|
1904
1904
|
"th",
|
|
1905
1905
|
{
|
|
1906
1906
|
role: "columnheader",
|
|
1907
|
-
"aria-sort": (
|
|
1908
|
-
className:
|
|
1907
|
+
"aria-sort": (m == null ? void 0 : m.key) === p.key ? m.direction === "asc" ? "ascending" : "descending" : "none",
|
|
1908
|
+
className: D(
|
|
1909
1909
|
"p-3 text-xs font-semibold text-muted-foreground uppercase tracking-wider text-left transition-colors",
|
|
1910
|
-
|
|
1910
|
+
p.sortable !== !1 && "cursor-pointer hover:bg-accent/30 hover:text-foreground group"
|
|
1911
1911
|
),
|
|
1912
|
-
style: { width:
|
|
1913
|
-
onClick: () =>
|
|
1914
|
-
children: /* @__PURE__ */
|
|
1915
|
-
/* @__PURE__ */
|
|
1916
|
-
|
|
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)
|
|
1917
1917
|
] })
|
|
1918
1918
|
},
|
|
1919
|
-
|
|
1920
|
-
)) }),
|
|
1921
|
-
const I =
|
|
1922
|
-
return /* @__PURE__ */
|
|
1919
|
+
p.key
|
|
1920
|
+
)) }), $ = (p, k) => {
|
|
1921
|
+
const I = r !== void 0 && p[i] === r;
|
|
1922
|
+
return /* @__PURE__ */ o(
|
|
1923
1923
|
"tr",
|
|
1924
1924
|
{
|
|
1925
1925
|
role: "row",
|
|
1926
1926
|
"aria-selected": I,
|
|
1927
|
-
onClick: () =>
|
|
1928
|
-
className:
|
|
1927
|
+
onClick: () => n && n(p),
|
|
1928
|
+
className: D(
|
|
1929
1929
|
"border-b border-border/40 hover:bg-accent/40 transition-colors cursor-pointer text-sm outline-none",
|
|
1930
1930
|
I && "bg-primary/10 text-primary hover:bg-primary/15 font-medium border-l-2 border-l-primary",
|
|
1931
|
-
|
|
1931
|
+
E === k && "bg-accent/60 ring-1 ring-inset ring-ring"
|
|
1932
1932
|
),
|
|
1933
|
-
children:
|
|
1934
|
-
const
|
|
1935
|
-
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);
|
|
1936
1936
|
})
|
|
1937
1937
|
},
|
|
1938
|
-
String(
|
|
1938
|
+
String(p[i] || k)
|
|
1939
1939
|
);
|
|
1940
|
-
}, T =
|
|
1941
|
-
Table: (
|
|
1940
|
+
}, T = H(() => ({
|
|
1941
|
+
Table: (p) => /* @__PURE__ */ o(
|
|
1942
1942
|
"table",
|
|
1943
1943
|
{
|
|
1944
|
-
...
|
|
1944
|
+
...p,
|
|
1945
1945
|
role: "grid",
|
|
1946
1946
|
className: "w-full border-collapse text-left bg-background text-foreground"
|
|
1947
1947
|
}
|
|
1948
1948
|
),
|
|
1949
|
-
TableHead:
|
|
1950
|
-
TableBody:
|
|
1951
|
-
TableRow: ({ item:
|
|
1952
|
-
if (!
|
|
1953
|
-
const
|
|
1954
|
-
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(
|
|
1955
1955
|
"tr",
|
|
1956
1956
|
{
|
|
1957
1957
|
...I,
|
|
1958
1958
|
onClick: () => {
|
|
1959
|
-
var
|
|
1960
|
-
return (
|
|
1959
|
+
var K;
|
|
1960
|
+
return (K = k.onRowClick) == null ? void 0 : K.call(k, p);
|
|
1961
1961
|
},
|
|
1962
|
-
className:
|
|
1962
|
+
className: D(
|
|
1963
1963
|
"border-b border-border/40 hover:bg-accent/40 transition-colors cursor-pointer text-sm outline-none",
|
|
1964
|
-
|
|
1965
|
-
|
|
1964
|
+
_ && "bg-primary/10 text-primary hover:bg-primary/15 font-medium border-l-2 border-l-primary",
|
|
1965
|
+
R && "bg-accent/60 ring-1 ring-inset ring-ring"
|
|
1966
1966
|
)
|
|
1967
1967
|
}
|
|
1968
1968
|
);
|
|
1969
1969
|
}
|
|
1970
|
-
}), []),
|
|
1971
|
-
/* @__PURE__ */
|
|
1972
|
-
/* @__PURE__ */
|
|
1973
|
-
] }) :
|
|
1974
|
-
/* @__PURE__ */
|
|
1975
|
-
/* @__PURE__ */
|
|
1976
|
-
] }) : s ? /* @__PURE__ */
|
|
1977
|
-
|
|
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,
|
|
1978
1978
|
{
|
|
1979
|
-
data:
|
|
1979
|
+
data: x,
|
|
1980
1980
|
context: {
|
|
1981
|
-
selectedRowId:
|
|
1982
|
-
focusedIndex:
|
|
1983
|
-
rowKey:
|
|
1984
|
-
onRowClick:
|
|
1981
|
+
selectedRowId: r,
|
|
1982
|
+
focusedIndex: E,
|
|
1983
|
+
rowKey: i,
|
|
1984
|
+
onRowClick: n
|
|
1985
1985
|
},
|
|
1986
1986
|
components: T,
|
|
1987
|
-
fixedHeaderContent:
|
|
1988
|
-
itemContent: (
|
|
1989
|
-
const
|
|
1990
|
-
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);
|
|
1991
1991
|
}) })
|
|
1992
1992
|
}
|
|
1993
|
-
) }) : /* @__PURE__ */
|
|
1994
|
-
/* @__PURE__ */
|
|
1995
|
-
/* @__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)) })
|
|
1996
1996
|
] }) });
|
|
1997
|
-
return /* @__PURE__ */
|
|
1997
|
+
return /* @__PURE__ */ f(
|
|
1998
1998
|
"div",
|
|
1999
1999
|
{
|
|
2000
|
-
ref:
|
|
2000
|
+
ref: y,
|
|
2001
2001
|
role: "region",
|
|
2002
2002
|
"aria-label": "Data Grid",
|
|
2003
2003
|
tabIndex: 0,
|
|
2004
|
-
onKeyDown:
|
|
2005
|
-
className:
|
|
2004
|
+
onKeyDown: u,
|
|
2005
|
+
className: D(
|
|
2006
2006
|
"flex flex-col h-full bg-background border border-border rounded-lg shadow-sm overflow-hidden focus:outline-none focus:ring-1 focus:ring-ring focus:border-transparent",
|
|
2007
|
-
|
|
2007
|
+
c
|
|
2008
2008
|
),
|
|
2009
2009
|
children: [
|
|
2010
|
-
|
|
2011
|
-
/* @__PURE__ */
|
|
2012
|
-
/* @__PURE__ */
|
|
2013
|
-
/* @__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(
|
|
2014
2014
|
"input",
|
|
2015
2015
|
{
|
|
2016
2016
|
type: "text",
|
|
2017
2017
|
placeholder: "Filter table rows...",
|
|
2018
2018
|
className: "w-full bg-secondary/40 border border-border rounded-md pl-8 pr-7 py-1.5 text-xs text-foreground placeholder:text-muted-foreground focus:outline-none focus:ring-1 focus:ring-primary focus:border-transparent transition-all",
|
|
2019
|
-
value:
|
|
2020
|
-
onChange: (
|
|
2019
|
+
value: h,
|
|
2020
|
+
onChange: (p) => g(p.target.value)
|
|
2021
2021
|
}
|
|
2022
2022
|
),
|
|
2023
|
-
|
|
2023
|
+
h && /* @__PURE__ */ o(
|
|
2024
2024
|
"button",
|
|
2025
2025
|
{
|
|
2026
|
-
onClick: () =>
|
|
2026
|
+
onClick: () => g(""),
|
|
2027
2027
|
className: "absolute right-2 top-2.5 text-muted-foreground hover:text-foreground",
|
|
2028
2028
|
"aria-label": "Clear filter",
|
|
2029
|
-
children: /* @__PURE__ */
|
|
2029
|
+
children: /* @__PURE__ */ o(J, { size: 12 })
|
|
2030
2030
|
}
|
|
2031
2031
|
)
|
|
2032
2032
|
] }),
|
|
2033
|
-
/* @__PURE__ */
|
|
2034
|
-
|
|
2033
|
+
/* @__PURE__ */ f("div", { className: "text-[11px] text-muted-foreground font-medium ml-4", children: [
|
|
2034
|
+
x.length,
|
|
2035
2035
|
" of ",
|
|
2036
2036
|
e.length,
|
|
2037
2037
|
" records"
|
|
2038
2038
|
] })
|
|
2039
2039
|
] }),
|
|
2040
|
-
|
|
2040
|
+
O()
|
|
2041
2041
|
]
|
|
2042
2042
|
}
|
|
2043
2043
|
);
|
|
2044
|
-
},
|
|
2045
|
-
results:
|
|
2044
|
+
}, Ar = ({
|
|
2045
|
+
results: t,
|
|
2046
2046
|
onQueryChange: e,
|
|
2047
|
-
onSelect:
|
|
2048
|
-
categories:
|
|
2049
|
-
placeholder:
|
|
2047
|
+
onSelect: n,
|
|
2048
|
+
categories: r,
|
|
2049
|
+
placeholder: i = "Search…",
|
|
2050
2050
|
debounceMs: s = 200,
|
|
2051
|
-
className:
|
|
2051
|
+
className: a
|
|
2052
2052
|
}) => {
|
|
2053
|
-
const [
|
|
2054
|
-
() => w.flatMap((
|
|
2055
|
-
[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]
|
|
2056
2056
|
);
|
|
2057
|
-
|
|
2058
|
-
const
|
|
2059
|
-
|
|
2057
|
+
z(() => {
|
|
2058
|
+
const N = (u) => {
|
|
2059
|
+
C.current && !C.current.contains(u.target) && h(!1);
|
|
2060
2060
|
};
|
|
2061
|
-
return document.addEventListener("mousedown",
|
|
2062
|
-
}, []),
|
|
2061
|
+
return document.addEventListener("mousedown", N), () => document.removeEventListener("mousedown", N);
|
|
2062
|
+
}, []), z(() => {
|
|
2063
2063
|
if (!e) return;
|
|
2064
|
-
const
|
|
2065
|
-
return () => window.clearTimeout(
|
|
2066
|
-
}, [
|
|
2067
|
-
|
|
2068
|
-
}, [
|
|
2069
|
-
const
|
|
2070
|
-
|
|
2071
|
-
},
|
|
2072
|
-
var
|
|
2073
|
-
if (!
|
|
2074
|
-
(
|
|
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);
|
|
2075
2075
|
return;
|
|
2076
2076
|
}
|
|
2077
|
-
|
|
2078
|
-
(
|
|
2079
|
-
)) :
|
|
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());
|
|
2080
2080
|
};
|
|
2081
|
-
return /* @__PURE__ */
|
|
2082
|
-
/* @__PURE__ */
|
|
2083
|
-
/* @__PURE__ */
|
|
2084
|
-
|
|
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,
|
|
2085
2085
|
{
|
|
2086
2086
|
size: 13,
|
|
2087
2087
|
className: "absolute left-2.5 top-1/2 -translate-y-1/2 text-muted-foreground"
|
|
2088
2088
|
}
|
|
2089
2089
|
),
|
|
2090
|
-
/* @__PURE__ */
|
|
2090
|
+
/* @__PURE__ */ o(
|
|
2091
2091
|
"input",
|
|
2092
2092
|
{
|
|
2093
|
-
ref:
|
|
2093
|
+
ref: E,
|
|
2094
2094
|
type: "text",
|
|
2095
2095
|
role: "combobox",
|
|
2096
|
-
"aria-expanded":
|
|
2097
|
-
"aria-label":
|
|
2098
|
-
value:
|
|
2099
|
-
placeholder:
|
|
2100
|
-
onChange: (
|
|
2101
|
-
|
|
2096
|
+
"aria-expanded": c,
|
|
2097
|
+
"aria-label": i,
|
|
2098
|
+
value: d,
|
|
2099
|
+
placeholder: i,
|
|
2100
|
+
onChange: (N) => {
|
|
2101
|
+
l(N.target.value), h(!0);
|
|
2102
2102
|
},
|
|
2103
|
-
onFocus: () =>
|
|
2104
|
-
onKeyDown:
|
|
2103
|
+
onFocus: () => h(!0),
|
|
2104
|
+
onKeyDown: x,
|
|
2105
2105
|
className: "w-full h-7 pl-8 pr-7 bg-secondary/35 border border-border/40 rounded-md text-xs text-foreground placeholder:text-muted-foreground/75 focus:outline-none focus:ring-1 focus:ring-primary/40 focus:bg-background/95 focus:border-primary/50 transition-all font-sans"
|
|
2106
2106
|
}
|
|
2107
2107
|
),
|
|
2108
|
-
|
|
2108
|
+
d && /* @__PURE__ */ o(
|
|
2109
2109
|
"button",
|
|
2110
2110
|
{
|
|
2111
2111
|
type: "button",
|
|
2112
2112
|
onClick: () => {
|
|
2113
|
-
var
|
|
2114
|
-
|
|
2113
|
+
var N;
|
|
2114
|
+
l(""), (N = E.current) == null || N.focus();
|
|
2115
2115
|
},
|
|
2116
2116
|
"aria-label": "Clear search",
|
|
2117
2117
|
className: "absolute right-2 top-1/2 -translate-y-1/2 text-muted-foreground hover:text-foreground transition-colors",
|
|
2118
|
-
children: /* @__PURE__ */
|
|
2118
|
+
children: /* @__PURE__ */ o(J, { size: 11 })
|
|
2119
2119
|
}
|
|
2120
2120
|
)
|
|
2121
2121
|
] }),
|
|
2122
|
-
|
|
2122
|
+
c && d.trim() && /* @__PURE__ */ f(
|
|
2123
2123
|
"div",
|
|
2124
2124
|
{
|
|
2125
2125
|
role: "listbox",
|
|
2126
2126
|
className: "absolute right-0 md:left-0 mt-1.5 w-80 max-h-[380px] bg-popover text-popover-foreground border border-border shadow-lg rounded-lg overflow-hidden flex flex-col z-[100] animate-in fade-in-50 slide-in-from-top-1 duration-100",
|
|
2127
2127
|
children: [
|
|
2128
|
-
/* @__PURE__ */
|
|
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: [
|
|
2129
2129
|
'No results found matching "',
|
|
2130
|
-
|
|
2130
|
+
d,
|
|
2131
2131
|
'"'
|
|
2132
|
-
] }) : w.map((
|
|
2133
|
-
const
|
|
2134
|
-
return
|
|
2135
|
-
/* @__PURE__ */
|
|
2136
|
-
|
|
2137
|
-
const
|
|
2138
|
-
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(
|
|
2139
2139
|
"div",
|
|
2140
2140
|
{
|
|
2141
2141
|
role: "option",
|
|
2142
2142
|
"aria-selected": T,
|
|
2143
|
-
onClick: () =>
|
|
2144
|
-
onMouseEnter: () =>
|
|
2145
|
-
className:
|
|
2143
|
+
onClick: () => b(S),
|
|
2144
|
+
onMouseEnter: () => m($),
|
|
2145
|
+
className: D(
|
|
2146
2146
|
"px-3 py-2 cursor-pointer flex items-start space-x-2.5 transition-colors border-l-2",
|
|
2147
2147
|
T ? "bg-accent text-accent-foreground border-primary" : "border-transparent hover:bg-accent/40"
|
|
2148
2148
|
),
|
|
2149
2149
|
children: [
|
|
2150
|
-
|
|
2150
|
+
L && /* @__PURE__ */ o(
|
|
2151
2151
|
"div",
|
|
2152
2152
|
{
|
|
2153
|
-
className:
|
|
2153
|
+
className: D(
|
|
2154
2154
|
"mt-0.5 p-1 rounded bg-muted/50",
|
|
2155
2155
|
T && "bg-background text-primary"
|
|
2156
2156
|
),
|
|
2157
|
-
children: /* @__PURE__ */
|
|
2157
|
+
children: /* @__PURE__ */ o(L, { size: 12 })
|
|
2158
2158
|
}
|
|
2159
2159
|
),
|
|
2160
|
-
/* @__PURE__ */
|
|
2161
|
-
/* @__PURE__ */
|
|
2162
|
-
|
|
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 })
|
|
2163
2163
|
] })
|
|
2164
2164
|
]
|
|
2165
2165
|
},
|
|
2166
|
-
`${
|
|
2166
|
+
`${S.category}-${S.id}`
|
|
2167
2167
|
);
|
|
2168
2168
|
})
|
|
2169
|
-
] },
|
|
2169
|
+
] }, N);
|
|
2170
2170
|
}) }),
|
|
2171
|
-
|
|
2172
|
-
/* @__PURE__ */
|
|
2173
|
-
/* @__PURE__ */
|
|
2174
|
-
/* @__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: "↑↓" }),
|
|
2175
2175
|
" ",
|
|
2176
2176
|
"navigate"
|
|
2177
2177
|
] }),
|
|
2178
|
-
/* @__PURE__ */
|
|
2179
|
-
/* @__PURE__ */
|
|
2178
|
+
/* @__PURE__ */ f("span", { children: [
|
|
2179
|
+
/* @__PURE__ */ o("kbd", { className: "bg-muted px-1 rounded border border-border/60", children: "↵" }),
|
|
2180
2180
|
" ",
|
|
2181
2181
|
"select"
|
|
2182
2182
|
] })
|
|
2183
2183
|
] }),
|
|
2184
|
-
/* @__PURE__ */
|
|
2184
|
+
/* @__PURE__ */ o("span", { children: "ESC to close" })
|
|
2185
2185
|
] })
|
|
2186
2186
|
]
|
|
2187
2187
|
}
|
|
2188
2188
|
)
|
|
2189
2189
|
] });
|
|
2190
|
-
},
|
|
2191
|
-
placeholder:
|
|
2190
|
+
}, Mr = ({
|
|
2191
|
+
placeholder: t = "Search...",
|
|
2192
2192
|
onSearch: e,
|
|
2193
|
-
results:
|
|
2194
|
-
onSelect:
|
|
2195
|
-
suggestions:
|
|
2193
|
+
results: n,
|
|
2194
|
+
onSelect: r,
|
|
2195
|
+
suggestions: i = [],
|
|
2196
2196
|
loading: s = !1,
|
|
2197
|
-
className:
|
|
2197
|
+
className: a
|
|
2198
2198
|
}) => {
|
|
2199
|
-
const [
|
|
2200
|
-
|
|
2201
|
-
const
|
|
2202
|
-
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);
|
|
2203
2203
|
}, 300);
|
|
2204
|
-
return () => clearTimeout(
|
|
2205
|
-
}, [
|
|
2206
|
-
const
|
|
2207
|
-
(
|
|
2208
|
-
), w = (
|
|
2209
|
-
|
|
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)));
|
|
2210
2210
|
};
|
|
2211
|
-
return /* @__PURE__ */
|
|
2212
|
-
/* @__PURE__ */
|
|
2213
|
-
/* @__PURE__ */
|
|
2214
|
-
/* @__PURE__ */
|
|
2215
|
-
/* @__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(
|
|
2216
2216
|
"input",
|
|
2217
2217
|
{
|
|
2218
2218
|
type: "text",
|
|
2219
2219
|
className: "w-full bg-secondary/50 border border-border rounded-md pl-9 pr-8 py-2 text-sm text-foreground placeholder:text-muted-foreground focus:outline-none focus:ring-2 focus:ring-primary focus:border-transparent transition-all",
|
|
2220
|
-
placeholder:
|
|
2221
|
-
value:
|
|
2222
|
-
onChange: (
|
|
2223
|
-
|
|
2220
|
+
placeholder: t,
|
|
2221
|
+
value: d,
|
|
2222
|
+
onChange: (y) => {
|
|
2223
|
+
l(y.target.value), h(!0), m(-1);
|
|
2224
2224
|
},
|
|
2225
2225
|
onKeyDown: w,
|
|
2226
|
-
onFocus: () =>
|
|
2226
|
+
onFocus: () => h(!0)
|
|
2227
2227
|
}
|
|
2228
2228
|
),
|
|
2229
|
-
|
|
2229
|
+
d && /* @__PURE__ */ o(
|
|
2230
2230
|
"button",
|
|
2231
2231
|
{
|
|
2232
2232
|
onClick: () => {
|
|
2233
|
-
|
|
2233
|
+
l(""), e("");
|
|
2234
2234
|
},
|
|
2235
2235
|
className: "absolute right-2 top-2.5 text-muted-foreground hover:text-foreground",
|
|
2236
|
-
children: /* @__PURE__ */
|
|
2236
|
+
children: /* @__PURE__ */ o(J, { size: 14 })
|
|
2237
2237
|
}
|
|
2238
2238
|
)
|
|
2239
2239
|
] }),
|
|
2240
|
-
|
|
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(
|
|
2241
2241
|
"div",
|
|
2242
2242
|
{
|
|
2243
|
-
className:
|
|
2243
|
+
className: D(
|
|
2244
2244
|
"px-3 py-1.5 text-xs cursor-pointer flex items-center space-x-2",
|
|
2245
|
-
|
|
2245
|
+
b === g ? "bg-accent text-accent-foreground" : "hover:bg-accent/50"
|
|
2246
2246
|
),
|
|
2247
2247
|
onClick: () => {
|
|
2248
|
-
|
|
2248
|
+
l(y), h(!1);
|
|
2249
2249
|
},
|
|
2250
2250
|
children: [
|
|
2251
|
-
/* @__PURE__ */
|
|
2252
|
-
/* @__PURE__ */
|
|
2251
|
+
/* @__PURE__ */ o(dt, { size: 12, className: "text-muted-foreground" }),
|
|
2252
|
+
/* @__PURE__ */ o("span", { children: y })
|
|
2253
2253
|
]
|
|
2254
2254
|
},
|
|
2255
|
-
|
|
2255
|
+
y
|
|
2256
2256
|
)) })
|
|
2257
2257
|
] }),
|
|
2258
|
-
/* @__PURE__ */
|
|
2259
|
-
const
|
|
2260
|
-
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(
|
|
2261
2261
|
"div",
|
|
2262
2262
|
{
|
|
2263
|
-
onClick: () =>
|
|
2263
|
+
onClick: () => r(y),
|
|
2264
2264
|
className: "px-4 py-2 hover:bg-accent/50 cursor-pointer group transition-colors border-l-2 border-transparent hover:border-primary",
|
|
2265
|
-
children: /* @__PURE__ */
|
|
2266
|
-
|
|
2267
|
-
/* @__PURE__ */
|
|
2268
|
-
/* @__PURE__ */
|
|
2269
|
-
/* @__PURE__ */
|
|
2270
|
-
|
|
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 })
|
|
2271
2271
|
] }),
|
|
2272
|
-
|
|
2272
|
+
y.description && /* @__PURE__ */ o("p", { className: "text-[11px] text-muted-foreground truncate mt-0.5", children: y.description })
|
|
2273
2273
|
] })
|
|
2274
2274
|
] })
|
|
2275
2275
|
},
|
|
2276
|
-
|
|
2276
|
+
y.id
|
|
2277
2277
|
);
|
|
2278
2278
|
}) }) })
|
|
2279
2279
|
] });
|
|
2280
|
-
},
|
|
2281
|
-
if (!
|
|
2282
|
-
const e = [
|
|
2283
|
-
return
|
|
2284
|
-
},
|
|
2285
|
-
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,
|
|
2286
2286
|
onToggle: e,
|
|
2287
|
-
onActivate:
|
|
2288
|
-
onMoveNode:
|
|
2289
|
-
actions:
|
|
2287
|
+
onActivate: n,
|
|
2288
|
+
onMoveNode: r,
|
|
2289
|
+
actions: i = [],
|
|
2290
2290
|
indent: s = 12,
|
|
2291
|
-
virtualized:
|
|
2292
|
-
"aria-label":
|
|
2293
|
-
className:
|
|
2291
|
+
virtualized: a = !0,
|
|
2292
|
+
"aria-label": d = "Tree",
|
|
2293
|
+
className: l
|
|
2294
2294
|
}) => {
|
|
2295
|
-
const [
|
|
2296
|
-
|
|
2297
|
-
|
|
2298
|
-
}, [
|
|
2299
|
-
const
|
|
2300
|
-
(
|
|
2301
|
-
).map((
|
|
2302
|
-
label:
|
|
2303
|
-
icon:
|
|
2304
|
-
divider:
|
|
2305
|
-
onClick: () =>
|
|
2306
|
-
})), w = (
|
|
2307
|
-
|
|
2308
|
-
x:
|
|
2309
|
-
y:
|
|
2310
|
-
scopes:
|
|
2311
|
-
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 }
|
|
2312
2312
|
}));
|
|
2313
|
-
},
|
|
2314
|
-
const
|
|
2315
|
-
return /* @__PURE__ */
|
|
2313
|
+
}, y = (b) => {
|
|
2314
|
+
const x = C[b], N = !!x.isBranch;
|
|
2315
|
+
return /* @__PURE__ */ f(
|
|
2316
2316
|
"div",
|
|
2317
2317
|
{
|
|
2318
2318
|
role: "treeitem",
|
|
2319
|
-
"aria-expanded":
|
|
2320
|
-
"aria-level":
|
|
2319
|
+
"aria-expanded": N ? !!x.isOpen : void 0,
|
|
2320
|
+
"aria-level": x.level + 1,
|
|
2321
2321
|
tabIndex: 0,
|
|
2322
2322
|
draggable: !0,
|
|
2323
|
-
onDragStart: (
|
|
2324
|
-
|
|
2323
|
+
onDragStart: (u) => {
|
|
2324
|
+
u.dataTransfer.setData("text/plain", x.id), u.dataTransfer.effectAllowed = "move";
|
|
2325
2325
|
},
|
|
2326
|
-
onDragOver: (
|
|
2327
|
-
|
|
2326
|
+
onDragOver: (u) => {
|
|
2327
|
+
N && (u.preventDefault(), m(x.id));
|
|
2328
2328
|
},
|
|
2329
|
-
onDragLeave: () =>
|
|
2330
|
-
onDrop: (
|
|
2331
|
-
|
|
2332
|
-
const
|
|
2333
|
-
|
|
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));
|
|
2334
2334
|
},
|
|
2335
|
-
onClick: () =>
|
|
2336
|
-
onDoubleClick: () =>
|
|
2337
|
-
onKeyDown: (
|
|
2338
|
-
|
|
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));
|
|
2339
2339
|
},
|
|
2340
|
-
onContextMenu: (
|
|
2341
|
-
style: { paddingLeft: `${
|
|
2342
|
-
className:
|
|
2340
|
+
onContextMenu: (u) => w(u, x),
|
|
2341
|
+
style: { paddingLeft: `${x.level * s + 8}px` },
|
|
2342
|
+
className: D(
|
|
2343
2343
|
"flex items-center py-1 px-2 cursor-pointer hover:bg-accent hover:text-accent-foreground select-none text-xs",
|
|
2344
2344
|
"transition-colors duration-150 relative focus:outline-none focus:ring-1 focus:ring-ring",
|
|
2345
|
-
|
|
2346
|
-
|
|
2345
|
+
g === x.id && "bg-primary/20 ring-1 ring-primary/50 rounded-sm",
|
|
2346
|
+
x.className
|
|
2347
2347
|
),
|
|
2348
2348
|
children: [
|
|
2349
|
-
/* @__PURE__ */
|
|
2350
|
-
|
|
2351
|
-
/* @__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 })
|
|
2352
2352
|
]
|
|
2353
2353
|
},
|
|
2354
|
-
|
|
2354
|
+
x.id
|
|
2355
2355
|
);
|
|
2356
2356
|
};
|
|
2357
|
-
return /* @__PURE__ */
|
|
2357
|
+
return /* @__PURE__ */ f(
|
|
2358
2358
|
"div",
|
|
2359
2359
|
{
|
|
2360
2360
|
role: "tree",
|
|
2361
|
-
"aria-label":
|
|
2362
|
-
className:
|
|
2363
|
-
onContextMenu: (
|
|
2361
|
+
"aria-label": d,
|
|
2362
|
+
className: D("h-full w-full bg-muted/30", l),
|
|
2363
|
+
onContextMenu: (b) => w(b, null),
|
|
2364
2364
|
children: [
|
|
2365
|
-
|
|
2366
|
-
|
|
2365
|
+
a ? /* @__PURE__ */ o(
|
|
2366
|
+
pt,
|
|
2367
2367
|
{
|
|
2368
2368
|
style: { height: "100%" },
|
|
2369
|
-
totalCount:
|
|
2370
|
-
itemContent:
|
|
2369
|
+
totalCount: C.length,
|
|
2370
|
+
itemContent: y
|
|
2371
2371
|
}
|
|
2372
|
-
) : /* @__PURE__ */
|
|
2373
|
-
|
|
2374
|
-
|
|
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,
|
|
2375
2375
|
{
|
|
2376
|
-
x:
|
|
2377
|
-
y:
|
|
2378
|
-
items:
|
|
2379
|
-
onClose: () =>
|
|
2376
|
+
x: c.x,
|
|
2377
|
+
y: c.y,
|
|
2378
|
+
items: E,
|
|
2379
|
+
onClose: () => h(null)
|
|
2380
2380
|
}
|
|
2381
2381
|
)
|
|
2382
2382
|
]
|
|
2383
2383
|
}
|
|
2384
2384
|
);
|
|
2385
|
-
}
|
|
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;
|
|
2386
3047
|
export {
|
|
2387
|
-
|
|
2388
|
-
|
|
2389
|
-
|
|
2390
|
-
|
|
2391
|
-
|
|
2392
|
-
|
|
2393
|
-
|
|
2394
|
-
|
|
2395
|
-
|
|
2396
|
-
|
|
2397
|
-
|
|
2398
|
-
|
|
2399
|
-
|
|
2400
|
-
|
|
2401
|
-
|
|
2402
|
-
|
|
2403
|
-
|
|
2404
|
-
|
|
2405
|
-
|
|
2406
|
-
|
|
2407
|
-
|
|
2408
|
-
|
|
2409
|
-
|
|
2410
|
-
|
|
2411
|
-
|
|
2412
|
-
|
|
2413
|
-
|
|
2414
|
-
|
|
2415
|
-
|
|
2416
|
-
|
|
2417
|
-
|
|
2418
|
-
|
|
2419
|
-
|
|
2420
|
-
|
|
2421
|
-
|
|
2422
|
-
|
|
2423
|
-
|
|
2424
|
-
|
|
2425
|
-
|
|
2426
|
-
|
|
2427
|
-
|
|
2428
|
-
|
|
2429
|
-
|
|
2430
|
-
|
|
2431
|
-
Qt as
|
|
2432
|
-
|
|
2433
|
-
|
|
2434
|
-
|
|
2435
|
-
|
|
2436
|
-
|
|
2437
|
-
|
|
2438
|
-
|
|
2439
|
-
|
|
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
|
|
2440
3129
|
};
|