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