citadel_cli 1.0.0
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/LICENSE +21 -0
- package/README.md +337 -0
- package/dist/.vite/manifest.json +12 -0
- package/dist/citadel.css +1 -0
- package/dist/citadel.es.js +3039 -0
- package/dist/citadel.umd.js +1015 -0
- package/dist/command_examples/basic-commands.d.ts +83 -0
- package/dist/dist/styles.css +789 -0
- package/dist/index.d.ts +2 -0
- package/dist/src/App.d.ts +4 -0
- package/dist/src/__test-utils__/factories.d.ts +21 -0
- package/dist/src/components/Citadel/Citadel.d.ts +11 -0
- package/dist/src/components/Citadel/Cursor.d.ts +9 -0
- package/dist/src/components/Citadel/__tests__/Citadel.test.d.ts +1 -0
- package/dist/src/components/Citadel/commands/history-commands.d.ts +2 -0
- package/dist/src/components/Citadel/components/AvailableCommands.d.ts +9 -0
- package/dist/src/components/Citadel/components/CommandInput.d.ts +10 -0
- package/dist/src/components/Citadel/components/CommandOutput.d.ts +8 -0
- package/dist/src/components/Citadel/components/CommandOutputLine.d.ts +9 -0
- package/dist/src/components/Citadel/components/Spinner.d.ts +2 -0
- package/dist/src/components/Citadel/components/__tests__/AvailableCommands.test.d.ts +1 -0
- package/dist/src/components/Citadel/components/__tests__/CommandInput.test.d.ts +1 -0
- package/dist/src/components/Citadel/components/__tests__/CommandOutput.test.d.ts +1 -0
- package/dist/src/components/Citadel/components/__tests__/CommandOutputLine.test.d.ts +1 -0
- package/dist/src/components/Citadel/components/__tests__/Spinner.test.d.ts +1 -0
- package/dist/src/components/Citadel/config/CitadelConfigContext.d.ts +11 -0
- package/dist/src/components/Citadel/config/__tests__/CitadelConfigContext.test.d.ts +1 -0
- package/dist/src/components/Citadel/config/defaults.d.ts +26 -0
- package/dist/src/components/Citadel/config/types.d.ts +56 -0
- package/dist/src/components/Citadel/hooks/__tests__/useCitadelState.test.d.ts +1 -0
- package/dist/src/components/Citadel/hooks/__tests__/useCommandHistory.test.d.ts +1 -0
- package/dist/src/components/Citadel/hooks/__tests__/useCommandParser.test.d.ts +1 -0
- package/dist/src/components/Citadel/hooks/__tests__/useCommandTrie.test.d.ts +1 -0
- package/dist/src/components/Citadel/hooks/useCitadelState.d.ts +6 -0
- package/dist/src/components/Citadel/hooks/useCommandHistory.d.ts +17 -0
- package/dist/src/components/Citadel/hooks/useCommandParser.d.ts +19 -0
- package/dist/src/components/Citadel/hooks/useCommandTrie.d.ts +2 -0
- package/dist/src/components/Citadel/hooks/useGlobalShortcut.d.ts +8 -0
- package/dist/src/components/Citadel/hooks/useSlideAnimation.d.ts +14 -0
- package/dist/src/components/Citadel/index.d.ts +2 -0
- package/dist/src/components/Citadel/services/HistoryService.d.ts +15 -0
- package/dist/src/components/Citadel/storage/BaseStorage.d.ts +25 -0
- package/dist/src/components/Citadel/storage/LocalStorage.d.ts +12 -0
- package/dist/src/components/Citadel/storage/MemoryStorage.d.ts +12 -0
- package/dist/src/components/Citadel/storage/StorageFactory.d.ts +9 -0
- package/dist/src/components/Citadel/storage/__tests__/LocalStorage.test.d.ts +1 -0
- package/dist/src/components/Citadel/storage/__tests__/MemoryStorage.test.d.ts +1 -0
- package/dist/src/components/Citadel/types/__tests__/command-trie.test.d.ts +1 -0
- package/dist/src/components/Citadel/types/command-context.d.ts +4 -0
- package/dist/src/components/Citadel/types/command-results.d.ts +41 -0
- package/dist/src/components/Citadel/types/command-trie.d.ts +238 -0
- package/dist/src/components/Citadel/types/cursor.d.ts +26 -0
- package/dist/src/components/Citadel/types/help-command.d.ts +3 -0
- package/dist/src/components/Citadel/types/index.d.ts +3 -0
- package/dist/src/components/Citadel/types/state.d.ts +40 -0
- package/dist/src/components/Citadel/types/storage.d.ts +44 -0
- package/dist/src/components/Citadel/utils/keySimulation.d.ts +2 -0
- package/dist/src/index.d.ts +4 -0
- package/dist/src/main.d.ts +1 -0
- package/dist/src/test/setup.d.ts +1 -0
- package/package.json +73 -0
|
@@ -0,0 +1,3039 @@
|
|
|
1
|
+
var Wn = Object.defineProperty;
|
|
2
|
+
var Vn = (r, n, t) => n in r ? Wn(r, n, { enumerable: !0, configurable: !0, writable: !0, value: t }) : r[n] = t;
|
|
3
|
+
var A = (r, n, t) => Vn(r, typeof n != "symbol" ? n + "" : n, t);
|
|
4
|
+
import fe, { useEffect as $, useMemo as ie, createContext as Kn, useContext as Re, useState as Y, useCallback as j, useRef as J } from "react";
|
|
5
|
+
import Bn from "react-dom";
|
|
6
|
+
var Se = { exports: {} }, re = {};
|
|
7
|
+
/**
|
|
8
|
+
* @license React
|
|
9
|
+
* react-jsx-runtime.production.min.js
|
|
10
|
+
*
|
|
11
|
+
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
12
|
+
*
|
|
13
|
+
* This source code is licensed under the MIT license found in the
|
|
14
|
+
* LICENSE file in the root directory of this source tree.
|
|
15
|
+
*/
|
|
16
|
+
var Ze;
|
|
17
|
+
function qn() {
|
|
18
|
+
if (Ze) return re;
|
|
19
|
+
Ze = 1;
|
|
20
|
+
var r = fe, n = Symbol.for("react.element"), t = Symbol.for("react.fragment"), o = Object.prototype.hasOwnProperty, i = r.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner, a = { key: !0, ref: !0, __self: !0, __source: !0 };
|
|
21
|
+
function l(d, h, w) {
|
|
22
|
+
var m, p = {}, u = null, y = null;
|
|
23
|
+
w !== void 0 && (u = "" + w), h.key !== void 0 && (u = "" + h.key), h.ref !== void 0 && (y = h.ref);
|
|
24
|
+
for (m in h) o.call(h, m) && !a.hasOwnProperty(m) && (p[m] = h[m]);
|
|
25
|
+
if (d && d.defaultProps) for (m in h = d.defaultProps, h) p[m] === void 0 && (p[m] = h[m]);
|
|
26
|
+
return { $$typeof: n, type: d, key: u, ref: y, props: p, _owner: i.current };
|
|
27
|
+
}
|
|
28
|
+
return re.Fragment = t, re.jsx = l, re.jsxs = l, re;
|
|
29
|
+
}
|
|
30
|
+
var oe = {};
|
|
31
|
+
/**
|
|
32
|
+
* @license React
|
|
33
|
+
* react-jsx-runtime.development.js
|
|
34
|
+
*
|
|
35
|
+
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
36
|
+
*
|
|
37
|
+
* This source code is licensed under the MIT license found in the
|
|
38
|
+
* LICENSE file in the root directory of this source tree.
|
|
39
|
+
*/
|
|
40
|
+
var Qe;
|
|
41
|
+
function Jn() {
|
|
42
|
+
return Qe || (Qe = 1, process.env.NODE_ENV !== "production" && function() {
|
|
43
|
+
var r = fe, n = Symbol.for("react.element"), t = Symbol.for("react.portal"), o = Symbol.for("react.fragment"), i = Symbol.for("react.strict_mode"), a = Symbol.for("react.profiler"), l = Symbol.for("react.provider"), d = Symbol.for("react.context"), h = Symbol.for("react.forward_ref"), w = Symbol.for("react.suspense"), m = Symbol.for("react.suspense_list"), p = Symbol.for("react.memo"), u = Symbol.for("react.lazy"), y = Symbol.for("react.offscreen"), v = Symbol.iterator, b = "@@iterator";
|
|
44
|
+
function C(e) {
|
|
45
|
+
if (e === null || typeof e != "object")
|
|
46
|
+
return null;
|
|
47
|
+
var s = v && e[v] || e[b];
|
|
48
|
+
return typeof s == "function" ? s : null;
|
|
49
|
+
}
|
|
50
|
+
var f = r.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;
|
|
51
|
+
function _(e) {
|
|
52
|
+
{
|
|
53
|
+
for (var s = arguments.length, c = new Array(s > 1 ? s - 1 : 0), x = 1; x < s; x++)
|
|
54
|
+
c[x - 1] = arguments[x];
|
|
55
|
+
S("error", e, c);
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
function S(e, s, c) {
|
|
59
|
+
{
|
|
60
|
+
var x = f.ReactDebugCurrentFrame, R = x.getStackAddendum();
|
|
61
|
+
R !== "" && (s += "%s", c = c.concat([R]));
|
|
62
|
+
var N = c.map(function(E) {
|
|
63
|
+
return String(E);
|
|
64
|
+
});
|
|
65
|
+
N.unshift("Warning: " + s), Function.prototype.apply.call(console[e], console, N);
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
var I = !1, T = !1, D = !1, U = !1, Z = !1, Q;
|
|
69
|
+
Q = Symbol.for("react.module.reference");
|
|
70
|
+
function pn(e) {
|
|
71
|
+
return !!(typeof e == "string" || typeof e == "function" || e === o || e === a || Z || e === i || e === w || e === m || U || e === y || I || T || D || typeof e == "object" && e !== null && (e.$$typeof === u || e.$$typeof === p || e.$$typeof === l || e.$$typeof === d || e.$$typeof === h || // This needs to include all possible module reference object
|
|
72
|
+
// types supported by any Flight configuration anywhere since
|
|
73
|
+
// we don't know which Flight build this will end up being used
|
|
74
|
+
// with.
|
|
75
|
+
e.$$typeof === Q || e.getModuleId !== void 0));
|
|
76
|
+
}
|
|
77
|
+
function gn(e, s, c) {
|
|
78
|
+
var x = e.displayName;
|
|
79
|
+
if (x)
|
|
80
|
+
return x;
|
|
81
|
+
var R = s.displayName || s.name || "";
|
|
82
|
+
return R !== "" ? c + "(" + R + ")" : c;
|
|
83
|
+
}
|
|
84
|
+
function Te(e) {
|
|
85
|
+
return e.displayName || "Context";
|
|
86
|
+
}
|
|
87
|
+
function M(e) {
|
|
88
|
+
if (e == null)
|
|
89
|
+
return null;
|
|
90
|
+
if (typeof e.tag == "number" && _("Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."), typeof e == "function")
|
|
91
|
+
return e.displayName || e.name || null;
|
|
92
|
+
if (typeof e == "string")
|
|
93
|
+
return e;
|
|
94
|
+
switch (e) {
|
|
95
|
+
case o:
|
|
96
|
+
return "Fragment";
|
|
97
|
+
case t:
|
|
98
|
+
return "Portal";
|
|
99
|
+
case a:
|
|
100
|
+
return "Profiler";
|
|
101
|
+
case i:
|
|
102
|
+
return "StrictMode";
|
|
103
|
+
case w:
|
|
104
|
+
return "Suspense";
|
|
105
|
+
case m:
|
|
106
|
+
return "SuspenseList";
|
|
107
|
+
}
|
|
108
|
+
if (typeof e == "object")
|
|
109
|
+
switch (e.$$typeof) {
|
|
110
|
+
case d:
|
|
111
|
+
var s = e;
|
|
112
|
+
return Te(s) + ".Consumer";
|
|
113
|
+
case l:
|
|
114
|
+
var c = e;
|
|
115
|
+
return Te(c._context) + ".Provider";
|
|
116
|
+
case h:
|
|
117
|
+
return gn(e, e.render, "ForwardRef");
|
|
118
|
+
case p:
|
|
119
|
+
var x = e.displayName || null;
|
|
120
|
+
return x !== null ? x : M(e.type) || "Memo";
|
|
121
|
+
case u: {
|
|
122
|
+
var R = e, N = R._payload, E = R._init;
|
|
123
|
+
try {
|
|
124
|
+
return M(E(N));
|
|
125
|
+
} catch {
|
|
126
|
+
return null;
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
}
|
|
130
|
+
return null;
|
|
131
|
+
}
|
|
132
|
+
var W = Object.assign, ee = 0, Ne, Ie, Ae, Pe, Oe, De, ze;
|
|
133
|
+
function Le() {
|
|
134
|
+
}
|
|
135
|
+
Le.__reactDisabledLog = !0;
|
|
136
|
+
function wn() {
|
|
137
|
+
{
|
|
138
|
+
if (ee === 0) {
|
|
139
|
+
Ne = console.log, Ie = console.info, Ae = console.warn, Pe = console.error, Oe = console.group, De = console.groupCollapsed, ze = console.groupEnd;
|
|
140
|
+
var e = {
|
|
141
|
+
configurable: !0,
|
|
142
|
+
enumerable: !0,
|
|
143
|
+
value: Le,
|
|
144
|
+
writable: !0
|
|
145
|
+
};
|
|
146
|
+
Object.defineProperties(console, {
|
|
147
|
+
info: e,
|
|
148
|
+
log: e,
|
|
149
|
+
warn: e,
|
|
150
|
+
error: e,
|
|
151
|
+
group: e,
|
|
152
|
+
groupCollapsed: e,
|
|
153
|
+
groupEnd: e
|
|
154
|
+
});
|
|
155
|
+
}
|
|
156
|
+
ee++;
|
|
157
|
+
}
|
|
158
|
+
}
|
|
159
|
+
function bn() {
|
|
160
|
+
{
|
|
161
|
+
if (ee--, ee === 0) {
|
|
162
|
+
var e = {
|
|
163
|
+
configurable: !0,
|
|
164
|
+
enumerable: !0,
|
|
165
|
+
writable: !0
|
|
166
|
+
};
|
|
167
|
+
Object.defineProperties(console, {
|
|
168
|
+
log: W({}, e, {
|
|
169
|
+
value: Ne
|
|
170
|
+
}),
|
|
171
|
+
info: W({}, e, {
|
|
172
|
+
value: Ie
|
|
173
|
+
}),
|
|
174
|
+
warn: W({}, e, {
|
|
175
|
+
value: Ae
|
|
176
|
+
}),
|
|
177
|
+
error: W({}, e, {
|
|
178
|
+
value: Pe
|
|
179
|
+
}),
|
|
180
|
+
group: W({}, e, {
|
|
181
|
+
value: Oe
|
|
182
|
+
}),
|
|
183
|
+
groupCollapsed: W({}, e, {
|
|
184
|
+
value: De
|
|
185
|
+
}),
|
|
186
|
+
groupEnd: W({}, e, {
|
|
187
|
+
value: ze
|
|
188
|
+
})
|
|
189
|
+
});
|
|
190
|
+
}
|
|
191
|
+
ee < 0 && _("disabledDepth fell below zero. This is a bug in React. Please file an issue.");
|
|
192
|
+
}
|
|
193
|
+
}
|
|
194
|
+
var pe = f.ReactCurrentDispatcher, ge;
|
|
195
|
+
function se(e, s, c) {
|
|
196
|
+
{
|
|
197
|
+
if (ge === void 0)
|
|
198
|
+
try {
|
|
199
|
+
throw Error();
|
|
200
|
+
} catch (R) {
|
|
201
|
+
var x = R.stack.trim().match(/\n( *(at )?)/);
|
|
202
|
+
ge = x && x[1] || "";
|
|
203
|
+
}
|
|
204
|
+
return `
|
|
205
|
+
` + ge + e;
|
|
206
|
+
}
|
|
207
|
+
}
|
|
208
|
+
var we = !1, le;
|
|
209
|
+
{
|
|
210
|
+
var vn = typeof WeakMap == "function" ? WeakMap : Map;
|
|
211
|
+
le = new vn();
|
|
212
|
+
}
|
|
213
|
+
function Fe(e, s) {
|
|
214
|
+
if (!e || we)
|
|
215
|
+
return "";
|
|
216
|
+
{
|
|
217
|
+
var c = le.get(e);
|
|
218
|
+
if (c !== void 0)
|
|
219
|
+
return c;
|
|
220
|
+
}
|
|
221
|
+
var x;
|
|
222
|
+
we = !0;
|
|
223
|
+
var R = Error.prepareStackTrace;
|
|
224
|
+
Error.prepareStackTrace = void 0;
|
|
225
|
+
var N;
|
|
226
|
+
N = pe.current, pe.current = null, wn();
|
|
227
|
+
try {
|
|
228
|
+
if (s) {
|
|
229
|
+
var E = function() {
|
|
230
|
+
throw Error();
|
|
231
|
+
};
|
|
232
|
+
if (Object.defineProperty(E.prototype, "props", {
|
|
233
|
+
set: function() {
|
|
234
|
+
throw Error();
|
|
235
|
+
}
|
|
236
|
+
}), typeof Reflect == "object" && Reflect.construct) {
|
|
237
|
+
try {
|
|
238
|
+
Reflect.construct(E, []);
|
|
239
|
+
} catch (L) {
|
|
240
|
+
x = L;
|
|
241
|
+
}
|
|
242
|
+
Reflect.construct(e, [], E);
|
|
243
|
+
} else {
|
|
244
|
+
try {
|
|
245
|
+
E.call();
|
|
246
|
+
} catch (L) {
|
|
247
|
+
x = L;
|
|
248
|
+
}
|
|
249
|
+
e.call(E.prototype);
|
|
250
|
+
}
|
|
251
|
+
} else {
|
|
252
|
+
try {
|
|
253
|
+
throw Error();
|
|
254
|
+
} catch (L) {
|
|
255
|
+
x = L;
|
|
256
|
+
}
|
|
257
|
+
e();
|
|
258
|
+
}
|
|
259
|
+
} catch (L) {
|
|
260
|
+
if (L && x && typeof L.stack == "string") {
|
|
261
|
+
for (var k = L.stack.split(`
|
|
262
|
+
`), z = x.stack.split(`
|
|
263
|
+
`), P = k.length - 1, O = z.length - 1; P >= 1 && O >= 0 && k[P] !== z[O]; )
|
|
264
|
+
O--;
|
|
265
|
+
for (; P >= 1 && O >= 0; P--, O--)
|
|
266
|
+
if (k[P] !== z[O]) {
|
|
267
|
+
if (P !== 1 || O !== 1)
|
|
268
|
+
do
|
|
269
|
+
if (P--, O--, O < 0 || k[P] !== z[O]) {
|
|
270
|
+
var H = `
|
|
271
|
+
` + k[P].replace(" at new ", " at ");
|
|
272
|
+
return e.displayName && H.includes("<anonymous>") && (H = H.replace("<anonymous>", e.displayName)), typeof e == "function" && le.set(e, H), H;
|
|
273
|
+
}
|
|
274
|
+
while (P >= 1 && O >= 0);
|
|
275
|
+
break;
|
|
276
|
+
}
|
|
277
|
+
}
|
|
278
|
+
} finally {
|
|
279
|
+
we = !1, pe.current = N, bn(), Error.prepareStackTrace = R;
|
|
280
|
+
}
|
|
281
|
+
var q = e ? e.displayName || e.name : "", V = q ? se(q) : "";
|
|
282
|
+
return typeof e == "function" && le.set(e, V), V;
|
|
283
|
+
}
|
|
284
|
+
function yn(e, s, c) {
|
|
285
|
+
return Fe(e, !1);
|
|
286
|
+
}
|
|
287
|
+
function xn(e) {
|
|
288
|
+
var s = e.prototype;
|
|
289
|
+
return !!(s && s.isReactComponent);
|
|
290
|
+
}
|
|
291
|
+
function ce(e, s, c) {
|
|
292
|
+
if (e == null)
|
|
293
|
+
return "";
|
|
294
|
+
if (typeof e == "function")
|
|
295
|
+
return Fe(e, xn(e));
|
|
296
|
+
if (typeof e == "string")
|
|
297
|
+
return se(e);
|
|
298
|
+
switch (e) {
|
|
299
|
+
case w:
|
|
300
|
+
return se("Suspense");
|
|
301
|
+
case m:
|
|
302
|
+
return se("SuspenseList");
|
|
303
|
+
}
|
|
304
|
+
if (typeof e == "object")
|
|
305
|
+
switch (e.$$typeof) {
|
|
306
|
+
case h:
|
|
307
|
+
return yn(e.render);
|
|
308
|
+
case p:
|
|
309
|
+
return ce(e.type, s, c);
|
|
310
|
+
case u: {
|
|
311
|
+
var x = e, R = x._payload, N = x._init;
|
|
312
|
+
try {
|
|
313
|
+
return ce(N(R), s, c);
|
|
314
|
+
} catch {
|
|
315
|
+
}
|
|
316
|
+
}
|
|
317
|
+
}
|
|
318
|
+
return "";
|
|
319
|
+
}
|
|
320
|
+
var ne = Object.prototype.hasOwnProperty, $e = {}, Ue = f.ReactDebugCurrentFrame;
|
|
321
|
+
function de(e) {
|
|
322
|
+
if (e) {
|
|
323
|
+
var s = e._owner, c = ce(e.type, e._source, s ? s.type : null);
|
|
324
|
+
Ue.setExtraStackFrame(c);
|
|
325
|
+
} else
|
|
326
|
+
Ue.setExtraStackFrame(null);
|
|
327
|
+
}
|
|
328
|
+
function Cn(e, s, c, x, R) {
|
|
329
|
+
{
|
|
330
|
+
var N = Function.call.bind(ne);
|
|
331
|
+
for (var E in e)
|
|
332
|
+
if (N(e, E)) {
|
|
333
|
+
var k = void 0;
|
|
334
|
+
try {
|
|
335
|
+
if (typeof e[E] != "function") {
|
|
336
|
+
var z = Error((x || "React class") + ": " + c + " type `" + E + "` is invalid; it must be a function, usually from the `prop-types` package, but received `" + typeof e[E] + "`.This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`.");
|
|
337
|
+
throw z.name = "Invariant Violation", z;
|
|
338
|
+
}
|
|
339
|
+
k = e[E](s, E, x, c, null, "SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED");
|
|
340
|
+
} catch (P) {
|
|
341
|
+
k = P;
|
|
342
|
+
}
|
|
343
|
+
k && !(k instanceof Error) && (de(R), _("%s: type specification of %s `%s` is invalid; the type checker function must return `null` or an `Error` but returned a %s. You may have forgotten to pass an argument to the type checker creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and shape all require an argument).", x || "React class", c, E, typeof k), de(null)), k instanceof Error && !(k.message in $e) && ($e[k.message] = !0, de(R), _("Failed %s type: %s", c, k.message), de(null));
|
|
344
|
+
}
|
|
345
|
+
}
|
|
346
|
+
}
|
|
347
|
+
var _n = Array.isArray;
|
|
348
|
+
function be(e) {
|
|
349
|
+
return _n(e);
|
|
350
|
+
}
|
|
351
|
+
function Sn(e) {
|
|
352
|
+
{
|
|
353
|
+
var s = typeof Symbol == "function" && Symbol.toStringTag, c = s && e[Symbol.toStringTag] || e.constructor.name || "Object";
|
|
354
|
+
return c;
|
|
355
|
+
}
|
|
356
|
+
}
|
|
357
|
+
function kn(e) {
|
|
358
|
+
try {
|
|
359
|
+
return He(e), !1;
|
|
360
|
+
} catch {
|
|
361
|
+
return !0;
|
|
362
|
+
}
|
|
363
|
+
}
|
|
364
|
+
function He(e) {
|
|
365
|
+
return "" + e;
|
|
366
|
+
}
|
|
367
|
+
function Me(e) {
|
|
368
|
+
if (kn(e))
|
|
369
|
+
return _("The provided key is an unsupported type %s. This value must be coerced to a string before before using it here.", Sn(e)), He(e);
|
|
370
|
+
}
|
|
371
|
+
var te = f.ReactCurrentOwner, En = {
|
|
372
|
+
key: !0,
|
|
373
|
+
ref: !0,
|
|
374
|
+
__self: !0,
|
|
375
|
+
__source: !0
|
|
376
|
+
}, Ye, We, ve;
|
|
377
|
+
ve = {};
|
|
378
|
+
function Rn(e) {
|
|
379
|
+
if (ne.call(e, "ref")) {
|
|
380
|
+
var s = Object.getOwnPropertyDescriptor(e, "ref").get;
|
|
381
|
+
if (s && s.isReactWarning)
|
|
382
|
+
return !1;
|
|
383
|
+
}
|
|
384
|
+
return e.ref !== void 0;
|
|
385
|
+
}
|
|
386
|
+
function jn(e) {
|
|
387
|
+
if (ne.call(e, "key")) {
|
|
388
|
+
var s = Object.getOwnPropertyDescriptor(e, "key").get;
|
|
389
|
+
if (s && s.isReactWarning)
|
|
390
|
+
return !1;
|
|
391
|
+
}
|
|
392
|
+
return e.key !== void 0;
|
|
393
|
+
}
|
|
394
|
+
function Tn(e, s) {
|
|
395
|
+
if (typeof e.ref == "string" && te.current && s && te.current.stateNode !== s) {
|
|
396
|
+
var c = M(te.current.type);
|
|
397
|
+
ve[c] || (_('Component "%s" contains the string ref "%s". Support for string refs will be removed in a future major release. This case cannot be automatically converted to an arrow function. We ask you to manually fix this case by using useRef() or createRef() instead. Learn more about using refs safely here: https://reactjs.org/link/strict-mode-string-ref', M(te.current.type), e.ref), ve[c] = !0);
|
|
398
|
+
}
|
|
399
|
+
}
|
|
400
|
+
function Nn(e, s) {
|
|
401
|
+
{
|
|
402
|
+
var c = function() {
|
|
403
|
+
Ye || (Ye = !0, _("%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://reactjs.org/link/special-props)", s));
|
|
404
|
+
};
|
|
405
|
+
c.isReactWarning = !0, Object.defineProperty(e, "key", {
|
|
406
|
+
get: c,
|
|
407
|
+
configurable: !0
|
|
408
|
+
});
|
|
409
|
+
}
|
|
410
|
+
}
|
|
411
|
+
function In(e, s) {
|
|
412
|
+
{
|
|
413
|
+
var c = function() {
|
|
414
|
+
We || (We = !0, _("%s: `ref` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://reactjs.org/link/special-props)", s));
|
|
415
|
+
};
|
|
416
|
+
c.isReactWarning = !0, Object.defineProperty(e, "ref", {
|
|
417
|
+
get: c,
|
|
418
|
+
configurable: !0
|
|
419
|
+
});
|
|
420
|
+
}
|
|
421
|
+
}
|
|
422
|
+
var An = function(e, s, c, x, R, N, E) {
|
|
423
|
+
var k = {
|
|
424
|
+
// This tag allows us to uniquely identify this as a React Element
|
|
425
|
+
$$typeof: n,
|
|
426
|
+
// Built-in properties that belong on the element
|
|
427
|
+
type: e,
|
|
428
|
+
key: s,
|
|
429
|
+
ref: c,
|
|
430
|
+
props: E,
|
|
431
|
+
// Record the component responsible for creating this element.
|
|
432
|
+
_owner: N
|
|
433
|
+
};
|
|
434
|
+
return k._store = {}, Object.defineProperty(k._store, "validated", {
|
|
435
|
+
configurable: !1,
|
|
436
|
+
enumerable: !1,
|
|
437
|
+
writable: !0,
|
|
438
|
+
value: !1
|
|
439
|
+
}), Object.defineProperty(k, "_self", {
|
|
440
|
+
configurable: !1,
|
|
441
|
+
enumerable: !1,
|
|
442
|
+
writable: !1,
|
|
443
|
+
value: x
|
|
444
|
+
}), Object.defineProperty(k, "_source", {
|
|
445
|
+
configurable: !1,
|
|
446
|
+
enumerable: !1,
|
|
447
|
+
writable: !1,
|
|
448
|
+
value: R
|
|
449
|
+
}), Object.freeze && (Object.freeze(k.props), Object.freeze(k)), k;
|
|
450
|
+
};
|
|
451
|
+
function Pn(e, s, c, x, R) {
|
|
452
|
+
{
|
|
453
|
+
var N, E = {}, k = null, z = null;
|
|
454
|
+
c !== void 0 && (Me(c), k = "" + c), jn(s) && (Me(s.key), k = "" + s.key), Rn(s) && (z = s.ref, Tn(s, R));
|
|
455
|
+
for (N in s)
|
|
456
|
+
ne.call(s, N) && !En.hasOwnProperty(N) && (E[N] = s[N]);
|
|
457
|
+
if (e && e.defaultProps) {
|
|
458
|
+
var P = e.defaultProps;
|
|
459
|
+
for (N in P)
|
|
460
|
+
E[N] === void 0 && (E[N] = P[N]);
|
|
461
|
+
}
|
|
462
|
+
if (k || z) {
|
|
463
|
+
var O = typeof e == "function" ? e.displayName || e.name || "Unknown" : e;
|
|
464
|
+
k && Nn(E, O), z && In(E, O);
|
|
465
|
+
}
|
|
466
|
+
return An(e, k, z, R, x, te.current, E);
|
|
467
|
+
}
|
|
468
|
+
}
|
|
469
|
+
var ye = f.ReactCurrentOwner, Ve = f.ReactDebugCurrentFrame;
|
|
470
|
+
function B(e) {
|
|
471
|
+
if (e) {
|
|
472
|
+
var s = e._owner, c = ce(e.type, e._source, s ? s.type : null);
|
|
473
|
+
Ve.setExtraStackFrame(c);
|
|
474
|
+
} else
|
|
475
|
+
Ve.setExtraStackFrame(null);
|
|
476
|
+
}
|
|
477
|
+
var xe;
|
|
478
|
+
xe = !1;
|
|
479
|
+
function Ce(e) {
|
|
480
|
+
return typeof e == "object" && e !== null && e.$$typeof === n;
|
|
481
|
+
}
|
|
482
|
+
function Ke() {
|
|
483
|
+
{
|
|
484
|
+
if (ye.current) {
|
|
485
|
+
var e = M(ye.current.type);
|
|
486
|
+
if (e)
|
|
487
|
+
return `
|
|
488
|
+
|
|
489
|
+
Check the render method of \`` + e + "`.";
|
|
490
|
+
}
|
|
491
|
+
return "";
|
|
492
|
+
}
|
|
493
|
+
}
|
|
494
|
+
function On(e) {
|
|
495
|
+
return "";
|
|
496
|
+
}
|
|
497
|
+
var Be = {};
|
|
498
|
+
function Dn(e) {
|
|
499
|
+
{
|
|
500
|
+
var s = Ke();
|
|
501
|
+
if (!s) {
|
|
502
|
+
var c = typeof e == "string" ? e : e.displayName || e.name;
|
|
503
|
+
c && (s = `
|
|
504
|
+
|
|
505
|
+
Check the top-level render call using <` + c + ">.");
|
|
506
|
+
}
|
|
507
|
+
return s;
|
|
508
|
+
}
|
|
509
|
+
}
|
|
510
|
+
function qe(e, s) {
|
|
511
|
+
{
|
|
512
|
+
if (!e._store || e._store.validated || e.key != null)
|
|
513
|
+
return;
|
|
514
|
+
e._store.validated = !0;
|
|
515
|
+
var c = Dn(s);
|
|
516
|
+
if (Be[c])
|
|
517
|
+
return;
|
|
518
|
+
Be[c] = !0;
|
|
519
|
+
var x = "";
|
|
520
|
+
e && e._owner && e._owner !== ye.current && (x = " It was passed a child from " + M(e._owner.type) + "."), B(e), _('Each child in a list should have a unique "key" prop.%s%s See https://reactjs.org/link/warning-keys for more information.', c, x), B(null);
|
|
521
|
+
}
|
|
522
|
+
}
|
|
523
|
+
function Je(e, s) {
|
|
524
|
+
{
|
|
525
|
+
if (typeof e != "object")
|
|
526
|
+
return;
|
|
527
|
+
if (be(e))
|
|
528
|
+
for (var c = 0; c < e.length; c++) {
|
|
529
|
+
var x = e[c];
|
|
530
|
+
Ce(x) && qe(x, s);
|
|
531
|
+
}
|
|
532
|
+
else if (Ce(e))
|
|
533
|
+
e._store && (e._store.validated = !0);
|
|
534
|
+
else if (e) {
|
|
535
|
+
var R = C(e);
|
|
536
|
+
if (typeof R == "function" && R !== e.entries)
|
|
537
|
+
for (var N = R.call(e), E; !(E = N.next()).done; )
|
|
538
|
+
Ce(E.value) && qe(E.value, s);
|
|
539
|
+
}
|
|
540
|
+
}
|
|
541
|
+
}
|
|
542
|
+
function zn(e) {
|
|
543
|
+
{
|
|
544
|
+
var s = e.type;
|
|
545
|
+
if (s == null || typeof s == "string")
|
|
546
|
+
return;
|
|
547
|
+
var c;
|
|
548
|
+
if (typeof s == "function")
|
|
549
|
+
c = s.propTypes;
|
|
550
|
+
else if (typeof s == "object" && (s.$$typeof === h || // Note: Memo only checks outer props here.
|
|
551
|
+
// Inner props are checked in the reconciler.
|
|
552
|
+
s.$$typeof === p))
|
|
553
|
+
c = s.propTypes;
|
|
554
|
+
else
|
|
555
|
+
return;
|
|
556
|
+
if (c) {
|
|
557
|
+
var x = M(s);
|
|
558
|
+
Cn(c, e.props, "prop", x, e);
|
|
559
|
+
} else if (s.PropTypes !== void 0 && !xe) {
|
|
560
|
+
xe = !0;
|
|
561
|
+
var R = M(s);
|
|
562
|
+
_("Component %s declared `PropTypes` instead of `propTypes`. Did you misspell the property assignment?", R || "Unknown");
|
|
563
|
+
}
|
|
564
|
+
typeof s.getDefaultProps == "function" && !s.getDefaultProps.isReactClassApproved && _("getDefaultProps is only used on classic React.createClass definitions. Use a static property named `defaultProps` instead.");
|
|
565
|
+
}
|
|
566
|
+
}
|
|
567
|
+
function Ln(e) {
|
|
568
|
+
{
|
|
569
|
+
for (var s = Object.keys(e.props), c = 0; c < s.length; c++) {
|
|
570
|
+
var x = s[c];
|
|
571
|
+
if (x !== "children" && x !== "key") {
|
|
572
|
+
B(e), _("Invalid prop `%s` supplied to `React.Fragment`. React.Fragment can only have `key` and `children` props.", x), B(null);
|
|
573
|
+
break;
|
|
574
|
+
}
|
|
575
|
+
}
|
|
576
|
+
e.ref !== null && (B(e), _("Invalid attribute `ref` supplied to `React.Fragment`."), B(null));
|
|
577
|
+
}
|
|
578
|
+
}
|
|
579
|
+
var Ge = {};
|
|
580
|
+
function Xe(e, s, c, x, R, N) {
|
|
581
|
+
{
|
|
582
|
+
var E = pn(e);
|
|
583
|
+
if (!E) {
|
|
584
|
+
var k = "";
|
|
585
|
+
(e === void 0 || typeof e == "object" && e !== null && Object.keys(e).length === 0) && (k += " You likely forgot to export your component from the file it's defined in, or you might have mixed up default and named imports.");
|
|
586
|
+
var z = On();
|
|
587
|
+
z ? k += z : k += Ke();
|
|
588
|
+
var P;
|
|
589
|
+
e === null ? P = "null" : be(e) ? P = "array" : e !== void 0 && e.$$typeof === n ? (P = "<" + (M(e.type) || "Unknown") + " />", k = " Did you accidentally export a JSX literal instead of a component?") : P = typeof e, _("React.jsx: type is invalid -- expected a string (for built-in components) or a class/function (for composite components) but got: %s.%s", P, k);
|
|
590
|
+
}
|
|
591
|
+
var O = Pn(e, s, c, R, N);
|
|
592
|
+
if (O == null)
|
|
593
|
+
return O;
|
|
594
|
+
if (E) {
|
|
595
|
+
var H = s.children;
|
|
596
|
+
if (H !== void 0)
|
|
597
|
+
if (x)
|
|
598
|
+
if (be(H)) {
|
|
599
|
+
for (var q = 0; q < H.length; q++)
|
|
600
|
+
Je(H[q], e);
|
|
601
|
+
Object.freeze && Object.freeze(H);
|
|
602
|
+
} else
|
|
603
|
+
_("React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead.");
|
|
604
|
+
else
|
|
605
|
+
Je(H, e);
|
|
606
|
+
}
|
|
607
|
+
if (ne.call(s, "key")) {
|
|
608
|
+
var V = M(e), L = Object.keys(s).filter(function(Yn) {
|
|
609
|
+
return Yn !== "key";
|
|
610
|
+
}), _e = L.length > 0 ? "{key: someKey, " + L.join(": ..., ") + ": ...}" : "{key: someKey}";
|
|
611
|
+
if (!Ge[V + _e]) {
|
|
612
|
+
var Mn = L.length > 0 ? "{" + L.join(": ..., ") + ": ...}" : "{}";
|
|
613
|
+
_(`A props object containing a "key" prop is being spread into JSX:
|
|
614
|
+
let props = %s;
|
|
615
|
+
<%s {...props} />
|
|
616
|
+
React keys must be passed directly to JSX without using spread:
|
|
617
|
+
let props = %s;
|
|
618
|
+
<%s key={someKey} {...props} />`, _e, V, Mn, V), Ge[V + _e] = !0;
|
|
619
|
+
}
|
|
620
|
+
}
|
|
621
|
+
return e === o ? Ln(O) : zn(O), O;
|
|
622
|
+
}
|
|
623
|
+
}
|
|
624
|
+
function Fn(e, s, c) {
|
|
625
|
+
return Xe(e, s, c, !0);
|
|
626
|
+
}
|
|
627
|
+
function $n(e, s, c) {
|
|
628
|
+
return Xe(e, s, c, !1);
|
|
629
|
+
}
|
|
630
|
+
var Un = $n, Hn = Fn;
|
|
631
|
+
oe.Fragment = o, oe.jsx = Un, oe.jsxs = Hn;
|
|
632
|
+
}()), oe;
|
|
633
|
+
}
|
|
634
|
+
process.env.NODE_ENV === "production" ? Se.exports = qn() : Se.exports = Jn();
|
|
635
|
+
var g = Se.exports, ke, ue = Bn;
|
|
636
|
+
if (process.env.NODE_ENV === "production")
|
|
637
|
+
ke = ue.createRoot, ue.hydrateRoot;
|
|
638
|
+
else {
|
|
639
|
+
var en = ue.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;
|
|
640
|
+
ke = function(r, n) {
|
|
641
|
+
en.usingClientEntryPoint = !0;
|
|
642
|
+
try {
|
|
643
|
+
return ue.createRoot(r, n);
|
|
644
|
+
} finally {
|
|
645
|
+
en.usingClientEntryPoint = !1;
|
|
646
|
+
}
|
|
647
|
+
};
|
|
648
|
+
}
|
|
649
|
+
const Gn = ({ onOpen: r, onClose: n, isVisible: t, showCitadelKey: o }) => {
|
|
650
|
+
$(() => {
|
|
651
|
+
const i = (a) => {
|
|
652
|
+
var l, d;
|
|
653
|
+
!t && a.key === o && !["input", "textarea"].includes(((d = (l = a.target) == null ? void 0 : l.tagName) == null ? void 0 : d.toLowerCase()) || "") && (a.preventDefault(), r()), t && a.key === "Escape" && (a.preventDefault(), n());
|
|
654
|
+
};
|
|
655
|
+
return document.addEventListener("keydown", i), () => document.removeEventListener("keydown", i);
|
|
656
|
+
}, [r, n, t, o]);
|
|
657
|
+
}, Xn = "_container_141sr_3", Zn = "_innerContainer_141sr_19", Qn = "_inputSection_141sr_28", et = "_resizeHandle_141sr_35", nt = "_citadel_slideUp_141sr_64", tt = "_citadel_slideDown_141sr_68", nn = {
|
|
658
|
+
container: Xn,
|
|
659
|
+
innerContainer: Zn,
|
|
660
|
+
inputSection: Qn,
|
|
661
|
+
resizeHandle: et,
|
|
662
|
+
citadel_slideUp: nt,
|
|
663
|
+
citadel_slideDown: tt
|
|
664
|
+
}, rt = (r) => {
|
|
665
|
+
const { isVisible: n, isClosing: t, onAnimationComplete: o } = r, i = ie(() => n ? t ? nn.slideDown : nn.slideUp : "", [n, t]);
|
|
666
|
+
return $(() => {
|
|
667
|
+
if (o) {
|
|
668
|
+
const l = setTimeout(() => {
|
|
669
|
+
o();
|
|
670
|
+
}, 200);
|
|
671
|
+
return () => clearTimeout(l);
|
|
672
|
+
}
|
|
673
|
+
}, [t, o]), {
|
|
674
|
+
style: ie(() => ({
|
|
675
|
+
opacity: n ? 1 : 0,
|
|
676
|
+
transform: n ? "translateY(0)" : t ? "translateY(100%)" : "translateY(-100%)",
|
|
677
|
+
transition: "opacity 200ms ease-in-out, transform 200ms ease-in-out"
|
|
678
|
+
}), [n, t]),
|
|
679
|
+
animationClass: i
|
|
680
|
+
};
|
|
681
|
+
}, F = {
|
|
682
|
+
commandTimeoutMs: 1e4,
|
|
683
|
+
includeHelpCommand: !0,
|
|
684
|
+
maxHeight: "80vh",
|
|
685
|
+
minHeight: "200",
|
|
686
|
+
outputFontSize: "text-xs",
|
|
687
|
+
resetStateOnHide: !1,
|
|
688
|
+
showCitadelKey: ".",
|
|
689
|
+
cursorType: "bbs",
|
|
690
|
+
cursorColor: "var(--cursor-color, #fff)",
|
|
691
|
+
cursorSpeed: 530,
|
|
692
|
+
storage: {
|
|
693
|
+
type: "localStorage",
|
|
694
|
+
maxCommands: 100
|
|
695
|
+
}
|
|
696
|
+
};
|
|
697
|
+
class ln {
|
|
698
|
+
constructor(n) {
|
|
699
|
+
A(this, "config");
|
|
700
|
+
this.config = {
|
|
701
|
+
type: "localStorage",
|
|
702
|
+
maxCommands: 100,
|
|
703
|
+
...n
|
|
704
|
+
};
|
|
705
|
+
}
|
|
706
|
+
/**
|
|
707
|
+
* Add a command to history, enforcing storage limits
|
|
708
|
+
*/
|
|
709
|
+
async addCommand(n) {
|
|
710
|
+
const t = await this.getCommands();
|
|
711
|
+
for (t.push(n); t.length > this.config.maxCommands; )
|
|
712
|
+
t.shift();
|
|
713
|
+
await this.saveCommands(t);
|
|
714
|
+
}
|
|
715
|
+
}
|
|
716
|
+
class ot extends ln {
|
|
717
|
+
constructor(t) {
|
|
718
|
+
super(t);
|
|
719
|
+
A(this, "storageKey", "citadel_command_history");
|
|
720
|
+
}
|
|
721
|
+
async getCommands() {
|
|
722
|
+
try {
|
|
723
|
+
const t = window.localStorage.getItem(this.storageKey);
|
|
724
|
+
return t ? JSON.parse(t) : [];
|
|
725
|
+
} catch (t) {
|
|
726
|
+
return console.warn("Failed to load commands from localStorage:", t), [];
|
|
727
|
+
}
|
|
728
|
+
}
|
|
729
|
+
async clear() {
|
|
730
|
+
try {
|
|
731
|
+
window.localStorage.removeItem(this.storageKey);
|
|
732
|
+
} catch (t) {
|
|
733
|
+
console.warn("Failed to clear localStorage:", t);
|
|
734
|
+
}
|
|
735
|
+
}
|
|
736
|
+
async saveCommands(t) {
|
|
737
|
+
try {
|
|
738
|
+
const o = t.map((i) => ({
|
|
739
|
+
inputs: Array.isArray(i.inputs) ? [...i.inputs] : [],
|
|
740
|
+
timestamp: i.timestamp
|
|
741
|
+
}));
|
|
742
|
+
window.localStorage.setItem(this.storageKey, JSON.stringify(o));
|
|
743
|
+
} catch (o) {
|
|
744
|
+
throw console.warn("Failed to save commands to localStorage:", o), o;
|
|
745
|
+
}
|
|
746
|
+
}
|
|
747
|
+
}
|
|
748
|
+
class at extends ln {
|
|
749
|
+
constructor(t) {
|
|
750
|
+
super(t);
|
|
751
|
+
A(this, "commands", []);
|
|
752
|
+
}
|
|
753
|
+
async getCommands() {
|
|
754
|
+
return this.commands.map((t) => ({
|
|
755
|
+
inputs: Array.isArray(t.inputs) ? [...t.inputs] : [],
|
|
756
|
+
timestamp: t.timestamp
|
|
757
|
+
}));
|
|
758
|
+
}
|
|
759
|
+
async clear() {
|
|
760
|
+
this.commands = [];
|
|
761
|
+
}
|
|
762
|
+
async saveCommands(t) {
|
|
763
|
+
this.commands = t.map((o) => ({
|
|
764
|
+
inputs: Array.isArray(o.inputs) ? [...o.inputs] : [],
|
|
765
|
+
timestamp: o.timestamp
|
|
766
|
+
}));
|
|
767
|
+
}
|
|
768
|
+
}
|
|
769
|
+
const K = class K {
|
|
770
|
+
constructor() {
|
|
771
|
+
A(this, "currentStorage");
|
|
772
|
+
}
|
|
773
|
+
static getInstance() {
|
|
774
|
+
return K.instance || (K.instance = new K()), K.instance;
|
|
775
|
+
}
|
|
776
|
+
initializeStorage(n) {
|
|
777
|
+
if (!this.currentStorage)
|
|
778
|
+
try {
|
|
779
|
+
this.currentStorage = new ot(n);
|
|
780
|
+
} catch (t) {
|
|
781
|
+
console.warn("Failed to create storage, falling back to memory storage:", t), this.currentStorage = new at(n);
|
|
782
|
+
}
|
|
783
|
+
}
|
|
784
|
+
getStorage() {
|
|
785
|
+
if (!this.currentStorage)
|
|
786
|
+
throw new Error("Storage not initialized. Call initializeStorage first.");
|
|
787
|
+
return this.currentStorage;
|
|
788
|
+
}
|
|
789
|
+
};
|
|
790
|
+
A(K, "instance");
|
|
791
|
+
let me = K;
|
|
792
|
+
function cn(r, n = []) {
|
|
793
|
+
const t = {};
|
|
794
|
+
for (const [o, i] of Object.entries(r)) {
|
|
795
|
+
const a = [...n, o], l = a.join("."), d = {
|
|
796
|
+
description: i.description,
|
|
797
|
+
handler: i.handler,
|
|
798
|
+
argument: i.argument
|
|
799
|
+
};
|
|
800
|
+
(d.handler || d.argument || d.description) && (t[l] = {
|
|
801
|
+
description: d.description || `${l} command`,
|
|
802
|
+
...d.handler && { handler: d.handler },
|
|
803
|
+
...d.argument && { argument: d.argument }
|
|
804
|
+
});
|
|
805
|
+
const h = Object.keys(i).filter(
|
|
806
|
+
(w) => typeof i[w] == "object" && w !== "argument" && !["description", "handler"].includes(w)
|
|
807
|
+
);
|
|
808
|
+
if (h.length > 0) {
|
|
809
|
+
const w = h.reduce((m, p) => (m[p] = i[p], m), {});
|
|
810
|
+
Object.assign(t, cn(w, a));
|
|
811
|
+
}
|
|
812
|
+
}
|
|
813
|
+
return t;
|
|
814
|
+
}
|
|
815
|
+
const he = Kn({ config: F }), it = ({ config: r = F, commands: n, children: t }) => {
|
|
816
|
+
const [o, i] = fe.useState(), a = {
|
|
817
|
+
...F,
|
|
818
|
+
...r,
|
|
819
|
+
// Ensure nested objects are properly merged
|
|
820
|
+
storage: {
|
|
821
|
+
...F.storage,
|
|
822
|
+
...r.storage
|
|
823
|
+
},
|
|
824
|
+
// Ensure explicit values from config take precedence
|
|
825
|
+
cursorType: r.cursorType ?? F.cursorType,
|
|
826
|
+
cursorColor: r.cursorColor ?? F.cursorColor,
|
|
827
|
+
cursorSpeed: r.cursorSpeed ?? F.cursorSpeed,
|
|
828
|
+
showCitadelKey: r.showCitadelKey || "."
|
|
829
|
+
};
|
|
830
|
+
$(() => {
|
|
831
|
+
me.getInstance().initializeStorage(
|
|
832
|
+
a.storage ?? F.storage
|
|
833
|
+
), i(me.getInstance().getStorage());
|
|
834
|
+
}, []);
|
|
835
|
+
const l = n ? cn(n) : void 0, d = {
|
|
836
|
+
config: a,
|
|
837
|
+
commands: l,
|
|
838
|
+
storage: o
|
|
839
|
+
};
|
|
840
|
+
return /* @__PURE__ */ g.jsx(he.Provider, { value: d, children: t });
|
|
841
|
+
}, G = () => {
|
|
842
|
+
const r = Re(he);
|
|
843
|
+
if (r === void 0)
|
|
844
|
+
throw new Error("useCitadelConfig must be used within a CitadelConfigProvider");
|
|
845
|
+
return r.config;
|
|
846
|
+
}, st = () => {
|
|
847
|
+
const r = Re(he);
|
|
848
|
+
if (r === void 0)
|
|
849
|
+
throw new Error("useCitadelCommands must be used within a CitadelConfigProvider");
|
|
850
|
+
return r.commands;
|
|
851
|
+
}, dn = () => {
|
|
852
|
+
const r = Re(he);
|
|
853
|
+
if (r === void 0)
|
|
854
|
+
throw new Error("useCitadelStorage must be used within a CitadelConfigProvider");
|
|
855
|
+
return r.storage;
|
|
856
|
+
};
|
|
857
|
+
var ae = /* @__PURE__ */ ((r) => (r.Pending = "pending", r.Success = "success", r.Failure = "failure", r.Timeout = "timeout", r))(ae || {});
|
|
858
|
+
class X {
|
|
859
|
+
constructor(n = Date.now()) {
|
|
860
|
+
A(this, "_status", "pending");
|
|
861
|
+
this.timestamp = n;
|
|
862
|
+
}
|
|
863
|
+
get status() {
|
|
864
|
+
return this._status;
|
|
865
|
+
}
|
|
866
|
+
markSuccess() {
|
|
867
|
+
this._status = "success";
|
|
868
|
+
}
|
|
869
|
+
markFailure() {
|
|
870
|
+
this._status = "failure";
|
|
871
|
+
}
|
|
872
|
+
markTimeout() {
|
|
873
|
+
this._status = "timeout";
|
|
874
|
+
}
|
|
875
|
+
}
|
|
876
|
+
class It extends X {
|
|
877
|
+
constructor(n, t) {
|
|
878
|
+
super(t), this.data = n;
|
|
879
|
+
}
|
|
880
|
+
render() {
|
|
881
|
+
return /* @__PURE__ */ g.jsx("pre", { className: "text-gray-200", children: JSON.stringify(this.data, null, 2) });
|
|
882
|
+
}
|
|
883
|
+
}
|
|
884
|
+
class un extends X {
|
|
885
|
+
constructor(n, t) {
|
|
886
|
+
super(t), this.text = n;
|
|
887
|
+
}
|
|
888
|
+
render() {
|
|
889
|
+
return /* @__PURE__ */ g.jsx("div", { className: "text-gray-200 whitespace-pre font-mono", children: this.text });
|
|
890
|
+
}
|
|
891
|
+
}
|
|
892
|
+
class lt extends X {
|
|
893
|
+
constructor(n, t) {
|
|
894
|
+
super(t), this.error = n, this.markFailure();
|
|
895
|
+
}
|
|
896
|
+
render() {
|
|
897
|
+
return /* @__PURE__ */ g.jsx("div", { className: "mt-1 text-red-400", children: this.error });
|
|
898
|
+
}
|
|
899
|
+
}
|
|
900
|
+
class ct extends X {
|
|
901
|
+
render() {
|
|
902
|
+
return /* @__PURE__ */ g.jsx("div", { className: "text-gray-400", children: "..." });
|
|
903
|
+
}
|
|
904
|
+
}
|
|
905
|
+
class At extends X {
|
|
906
|
+
constructor(n, t = "", o) {
|
|
907
|
+
super(o), this.imageUrl = n, this.altText = t;
|
|
908
|
+
}
|
|
909
|
+
render() {
|
|
910
|
+
return /* @__PURE__ */ g.jsx("div", { className: "my-2", children: /* @__PURE__ */ g.jsx(
|
|
911
|
+
"img",
|
|
912
|
+
{
|
|
913
|
+
src: this.imageUrl,
|
|
914
|
+
alt: this.altText,
|
|
915
|
+
className: "max-w-[400px] max-h-[300px] h-auto rounded-lg object-contain"
|
|
916
|
+
}
|
|
917
|
+
) });
|
|
918
|
+
}
|
|
919
|
+
}
|
|
920
|
+
class dt {
|
|
921
|
+
constructor(n, t) {
|
|
922
|
+
A(this, "timestamp");
|
|
923
|
+
A(this, "command");
|
|
924
|
+
A(this, "result");
|
|
925
|
+
this.command = n, this.timestamp = Date.now(), this.result = t ?? new ct();
|
|
926
|
+
}
|
|
927
|
+
}
|
|
928
|
+
const je = async (r) => new un("");
|
|
929
|
+
class Ee {
|
|
930
|
+
/**
|
|
931
|
+
* Creates a new CommandNode representing a command the user can enter. From a
|
|
932
|
+
* high level, a command is one or more words followed by an optional
|
|
933
|
+
* argument, and with an optional handler.
|
|
934
|
+
*
|
|
935
|
+
* @param params Configuration parameters for the node
|
|
936
|
+
* @param params.fullPath Complete path from root to this node (e.g., ['service', 'deploy'])
|
|
937
|
+
* @param params.description Human-readable description of the command
|
|
938
|
+
* @param params.parent Optional parent node in the command hierarchy
|
|
939
|
+
* @param params.handler Optional async function to execute when command is invoked
|
|
940
|
+
* @param params.argument Optional argument definition for the command
|
|
941
|
+
* @throws {Error} If fullPath is empty or undefined
|
|
942
|
+
*
|
|
943
|
+
*/
|
|
944
|
+
constructor(n) {
|
|
945
|
+
A(this, "_fullPath");
|
|
946
|
+
A(this, "_description");
|
|
947
|
+
A(this, "_children");
|
|
948
|
+
A(this, "_argument");
|
|
949
|
+
A(this, "_handler");
|
|
950
|
+
A(this, "_parent");
|
|
951
|
+
A(this, "_signature");
|
|
952
|
+
if (!n.fullPath || n.fullPath.length === 0)
|
|
953
|
+
throw new Error("Command path cannot be empty");
|
|
954
|
+
this._fullPath = n.fullPath, this._description = n.description, this._children = /* @__PURE__ */ new Map(), this._argument = n.argument, this._handler = n.handler || je, this._parent = n.parent;
|
|
955
|
+
}
|
|
956
|
+
/**
|
|
957
|
+
* Gets the name of this command (last segment of the path)
|
|
958
|
+
*/
|
|
959
|
+
get name() {
|
|
960
|
+
return this._fullPath[this._fullPath.length - 1];
|
|
961
|
+
}
|
|
962
|
+
/**
|
|
963
|
+
* Whether this is a leaf node (has no children)
|
|
964
|
+
*/
|
|
965
|
+
get isLeaf() {
|
|
966
|
+
return this._children.size === 0;
|
|
967
|
+
}
|
|
968
|
+
/**
|
|
969
|
+
* Whether this command has a handler
|
|
970
|
+
*/
|
|
971
|
+
get hasHandler() {
|
|
972
|
+
return this._handler !== void 0;
|
|
973
|
+
}
|
|
974
|
+
/**
|
|
975
|
+
* Whether this command requires an argument
|
|
976
|
+
*/
|
|
977
|
+
get requiresArgument() {
|
|
978
|
+
return this._argument !== void 0;
|
|
979
|
+
}
|
|
980
|
+
/**
|
|
981
|
+
* Gets the parent node if it exists
|
|
982
|
+
*/
|
|
983
|
+
get parent() {
|
|
984
|
+
return this._parent;
|
|
985
|
+
}
|
|
986
|
+
/**
|
|
987
|
+
* Gets the command's signature
|
|
988
|
+
*/
|
|
989
|
+
get signature() {
|
|
990
|
+
return this._signature;
|
|
991
|
+
}
|
|
992
|
+
/**
|
|
993
|
+
* Sets the signature for this command based on the current command trie state
|
|
994
|
+
* @param trie The command trie to use for signature generation
|
|
995
|
+
*/
|
|
996
|
+
setSignature(n) {
|
|
997
|
+
const t = n.buildSignatureForCommand(this);
|
|
998
|
+
this._signature = t.signature.join("");
|
|
999
|
+
}
|
|
1000
|
+
/**
|
|
1001
|
+
* Gets the map of child commands
|
|
1002
|
+
*/
|
|
1003
|
+
get children() {
|
|
1004
|
+
return this._children;
|
|
1005
|
+
}
|
|
1006
|
+
/**
|
|
1007
|
+
* Whether this command has any children
|
|
1008
|
+
*/
|
|
1009
|
+
get hasChildren() {
|
|
1010
|
+
return this._children.size > 0;
|
|
1011
|
+
}
|
|
1012
|
+
/**
|
|
1013
|
+
* Adds a child command
|
|
1014
|
+
*/
|
|
1015
|
+
addChild(n, t) {
|
|
1016
|
+
this._children.set(n, t);
|
|
1017
|
+
}
|
|
1018
|
+
/**
|
|
1019
|
+
* Gets a child command by name
|
|
1020
|
+
*/
|
|
1021
|
+
getChild(n) {
|
|
1022
|
+
return this._children.get(n);
|
|
1023
|
+
}
|
|
1024
|
+
/**
|
|
1025
|
+
* Gets the full path from root to this command
|
|
1026
|
+
*/
|
|
1027
|
+
get fullPath() {
|
|
1028
|
+
return this._fullPath;
|
|
1029
|
+
}
|
|
1030
|
+
/**
|
|
1031
|
+
* Gets the command's description
|
|
1032
|
+
*/
|
|
1033
|
+
get description() {
|
|
1034
|
+
return this._description;
|
|
1035
|
+
}
|
|
1036
|
+
/**
|
|
1037
|
+
* Gets the command's argument definition if it exists
|
|
1038
|
+
*/
|
|
1039
|
+
get argument() {
|
|
1040
|
+
return this._argument;
|
|
1041
|
+
}
|
|
1042
|
+
/**
|
|
1043
|
+
* Sets the command's argument definition
|
|
1044
|
+
*/
|
|
1045
|
+
set argument(n) {
|
|
1046
|
+
this._argument = n;
|
|
1047
|
+
}
|
|
1048
|
+
/**
|
|
1049
|
+
* Gets the command's handler
|
|
1050
|
+
*/
|
|
1051
|
+
get handler() {
|
|
1052
|
+
return this._handler;
|
|
1053
|
+
}
|
|
1054
|
+
/**
|
|
1055
|
+
* Sets the command's handler
|
|
1056
|
+
*/
|
|
1057
|
+
set handler(n) {
|
|
1058
|
+
this._handler = n;
|
|
1059
|
+
}
|
|
1060
|
+
}
|
|
1061
|
+
class ut {
|
|
1062
|
+
/**
|
|
1063
|
+
* Creates a new CommandTrie instance.
|
|
1064
|
+
*/
|
|
1065
|
+
constructor() {
|
|
1066
|
+
A(this, "_root");
|
|
1067
|
+
this._root = new Ee({
|
|
1068
|
+
fullPath: ["ROOT"],
|
|
1069
|
+
description: "Root command node"
|
|
1070
|
+
});
|
|
1071
|
+
}
|
|
1072
|
+
/**
|
|
1073
|
+
* Adds a new command to the trie.
|
|
1074
|
+
*
|
|
1075
|
+
* @param params Parameters for the command.
|
|
1076
|
+
* @param params.path The path segments for the command (e.g., ['service', 'deploy'])
|
|
1077
|
+
* @param params.description Description of what the command does
|
|
1078
|
+
* @param params.handler Optional function to execute when command is invoked
|
|
1079
|
+
* @param params.argument Optional argument definition for the command
|
|
1080
|
+
* @throws {Error} If attempting to add a duplicate leaf command or a subcommand to a leaf
|
|
1081
|
+
*
|
|
1082
|
+
*/
|
|
1083
|
+
addCommand(n) {
|
|
1084
|
+
const { path: t, description: o, handler: i, argument: a } = n;
|
|
1085
|
+
if (!(t != null && t.length))
|
|
1086
|
+
throw new Error("Command path cannot be empty");
|
|
1087
|
+
let l = this._root;
|
|
1088
|
+
const d = t.length - 1;
|
|
1089
|
+
for (let h = 0; h < t.length; h++) {
|
|
1090
|
+
const w = t[h], m = h === d, p = t.slice(0, h + 1), u = l.children;
|
|
1091
|
+
if (u.has(w)) {
|
|
1092
|
+
const y = u.get(w);
|
|
1093
|
+
if (m && y.isLeaf)
|
|
1094
|
+
throw new Error(`Duplicate command: ${t.join(" ")}`);
|
|
1095
|
+
if (!m && y.isLeaf)
|
|
1096
|
+
throw new Error(`Cannot add subcommand to leaf command: ${t.slice(0, h + 1).join(" ")}`);
|
|
1097
|
+
l = y;
|
|
1098
|
+
} else {
|
|
1099
|
+
const y = new Ee({
|
|
1100
|
+
description: m ? o : `${w} commands`,
|
|
1101
|
+
fullPath: p,
|
|
1102
|
+
parent: l,
|
|
1103
|
+
handler: m ? i : void 0,
|
|
1104
|
+
argument: m ? a : void 0
|
|
1105
|
+
});
|
|
1106
|
+
l.addChild(w, y), l = y, this.setSignatures();
|
|
1107
|
+
}
|
|
1108
|
+
}
|
|
1109
|
+
}
|
|
1110
|
+
/**
|
|
1111
|
+
* Retrieves a command from the trie.
|
|
1112
|
+
*
|
|
1113
|
+
* @param path The path of the command.
|
|
1114
|
+
* @returns The command node or undefined if not found.
|
|
1115
|
+
*/
|
|
1116
|
+
getCommand(n) {
|
|
1117
|
+
let t = this._root;
|
|
1118
|
+
for (const o of n) {
|
|
1119
|
+
const a = t.children.get(o);
|
|
1120
|
+
if (!a)
|
|
1121
|
+
return;
|
|
1122
|
+
t = a;
|
|
1123
|
+
}
|
|
1124
|
+
return t;
|
|
1125
|
+
}
|
|
1126
|
+
/**
|
|
1127
|
+
* Gets command completions for a given path.
|
|
1128
|
+
*
|
|
1129
|
+
* @param path The path to get completions for.
|
|
1130
|
+
* @returns An array of completion strings.
|
|
1131
|
+
*/
|
|
1132
|
+
getCompletions(n) {
|
|
1133
|
+
let t = this._root;
|
|
1134
|
+
for (const l of n.slice(0, -1)) {
|
|
1135
|
+
const h = t.children.get(l);
|
|
1136
|
+
if (!h)
|
|
1137
|
+
return [];
|
|
1138
|
+
t = h;
|
|
1139
|
+
}
|
|
1140
|
+
const o = n[n.length - 1] || "", i = [], a = t.children;
|
|
1141
|
+
if (n.length > 0) {
|
|
1142
|
+
const l = a.get(o);
|
|
1143
|
+
if (l)
|
|
1144
|
+
return l.children.forEach((d, h) => {
|
|
1145
|
+
i.push(h);
|
|
1146
|
+
}), i;
|
|
1147
|
+
}
|
|
1148
|
+
return a.forEach((l, d) => {
|
|
1149
|
+
d.startsWith(o) && i.push(d);
|
|
1150
|
+
}), i;
|
|
1151
|
+
}
|
|
1152
|
+
/**
|
|
1153
|
+
* Executes a command with the given path and arguments.
|
|
1154
|
+
* @param path The command path
|
|
1155
|
+
* @param args Arguments to pass to the command handler
|
|
1156
|
+
* @returns The command result or undefined if command not found
|
|
1157
|
+
* @throws Error if command validation fails
|
|
1158
|
+
*/
|
|
1159
|
+
async executeCommand(n, t = []) {
|
|
1160
|
+
var a;
|
|
1161
|
+
const o = this.getCommand(n);
|
|
1162
|
+
if (!o)
|
|
1163
|
+
return;
|
|
1164
|
+
if (!o.hasHandler)
|
|
1165
|
+
throw new Error(`Command '${n.join(" ")}' is not executable`);
|
|
1166
|
+
if (o.requiresArgument && t.length === 0)
|
|
1167
|
+
throw new Error(`Command '${n.join(" ")}' requires argument: ${(a = o.argument) == null ? void 0 : a.name}`);
|
|
1168
|
+
const i = o.handler;
|
|
1169
|
+
if (!i)
|
|
1170
|
+
throw new Error(`Command '${n.join(" ")}' has no handler`);
|
|
1171
|
+
return await i(t);
|
|
1172
|
+
}
|
|
1173
|
+
/**
|
|
1174
|
+
* Gets the root commands in the trie.
|
|
1175
|
+
*
|
|
1176
|
+
* @returns An array of root command nodes.
|
|
1177
|
+
*/
|
|
1178
|
+
getRootCommands() {
|
|
1179
|
+
return Array.from(this._root.children.values());
|
|
1180
|
+
}
|
|
1181
|
+
/**
|
|
1182
|
+
* Gets the leaf commands in the trie.
|
|
1183
|
+
*
|
|
1184
|
+
* @returns An array of leaf command nodes.
|
|
1185
|
+
*/
|
|
1186
|
+
getLeafCommands() {
|
|
1187
|
+
const n = [], t = (o) => {
|
|
1188
|
+
o.isLeaf ? n.push(o) : o.children.forEach((i) => {
|
|
1189
|
+
t(i);
|
|
1190
|
+
});
|
|
1191
|
+
};
|
|
1192
|
+
return this._root.children.forEach((o) => {
|
|
1193
|
+
t(o);
|
|
1194
|
+
}), n;
|
|
1195
|
+
}
|
|
1196
|
+
/**
|
|
1197
|
+
* Retrieves a command using its unique signature.
|
|
1198
|
+
* A signature is the minimal sequence of prefixes that uniquely identifies a command.
|
|
1199
|
+
*
|
|
1200
|
+
* @param signature Array of minimal prefixes that uniquely identify the command
|
|
1201
|
+
* @returns The matching command node or undefined if not found
|
|
1202
|
+
*
|
|
1203
|
+
* @example
|
|
1204
|
+
* // Will match 'image random cat' command
|
|
1205
|
+
* getCommandBySignature(['i', 'r', 'c'])
|
|
1206
|
+
* // Will match 'user show' command (not ambiguous with 'user status')
|
|
1207
|
+
* getCommandBySignature(['u', 'sh'])
|
|
1208
|
+
*/
|
|
1209
|
+
getCommandBySignature(n) {
|
|
1210
|
+
if (!n.signature.length) return;
|
|
1211
|
+
let t = this._root;
|
|
1212
|
+
for (const o of n.signature) {
|
|
1213
|
+
if (!o) return;
|
|
1214
|
+
const i = Array.from(t.children.entries()).filter(([a]) => a.toLowerCase().startsWith(o.toLowerCase()));
|
|
1215
|
+
if (i.length === 0)
|
|
1216
|
+
return;
|
|
1217
|
+
if (i.length > 1) {
|
|
1218
|
+
const a = i.find(
|
|
1219
|
+
([l]) => l.toLowerCase() === o.toLowerCase()
|
|
1220
|
+
);
|
|
1221
|
+
if (!a)
|
|
1222
|
+
return;
|
|
1223
|
+
t = a[1];
|
|
1224
|
+
} else
|
|
1225
|
+
t = i[0][1];
|
|
1226
|
+
}
|
|
1227
|
+
return t === this._root ? void 0 : t;
|
|
1228
|
+
}
|
|
1229
|
+
/**
|
|
1230
|
+
* Generates a minimal unique signature for a command node.
|
|
1231
|
+
* The signature consists of the shortest prefixes that uniquely identify each segment
|
|
1232
|
+
* in the path from root to this node.
|
|
1233
|
+
*
|
|
1234
|
+
* @param command The command node to generate a signature for
|
|
1235
|
+
* @returns Array of minimal prefixes that uniquely identify the command
|
|
1236
|
+
*
|
|
1237
|
+
* @example
|
|
1238
|
+
* // For commands: ['image', 'random', 'cat'] and ['image', 'random', 'dog']
|
|
1239
|
+
* buildSignatureForCommand(catCommand) // returns ['i', 'r', 'c']
|
|
1240
|
+
* // For commands: ['user', 'show'] and ['user', 'status']
|
|
1241
|
+
* buildSignatureForCommand(showCommand) // returns ['u', 'sh']
|
|
1242
|
+
*/
|
|
1243
|
+
buildSignatureForCommand(n) {
|
|
1244
|
+
if (!n || n === this._root)
|
|
1245
|
+
return { signature: [] };
|
|
1246
|
+
const t = [];
|
|
1247
|
+
let o = n;
|
|
1248
|
+
const i = [];
|
|
1249
|
+
for (; o && o !== this._root; )
|
|
1250
|
+
i.unshift(o), o = o.parent;
|
|
1251
|
+
o = this._root;
|
|
1252
|
+
for (const a of i) {
|
|
1253
|
+
const l = a.name, d = Array.from(o.children.keys());
|
|
1254
|
+
let h = 1, w = !1;
|
|
1255
|
+
for (; h <= l.length; ) {
|
|
1256
|
+
const m = l.slice(0, h), p = m.toLowerCase(), u = d.filter(
|
|
1257
|
+
(y) => y.toLowerCase().startsWith(p)
|
|
1258
|
+
);
|
|
1259
|
+
if (u.length === 1 && u[0].toLowerCase() === l.toLowerCase()) {
|
|
1260
|
+
t.push(m), w = !0;
|
|
1261
|
+
break;
|
|
1262
|
+
}
|
|
1263
|
+
h++;
|
|
1264
|
+
}
|
|
1265
|
+
w || t.push(l), o = a;
|
|
1266
|
+
}
|
|
1267
|
+
return { signature: t };
|
|
1268
|
+
}
|
|
1269
|
+
/**
|
|
1270
|
+
* Validates the command trie structure for common errors.
|
|
1271
|
+
*
|
|
1272
|
+
* Performs the following validations:
|
|
1273
|
+
* 1. Checks for duplicate command paths
|
|
1274
|
+
* 2. Ensures non-leaf nodes (nodes with children) use NoopHandler
|
|
1275
|
+
* 3. Ensures non-leaf nodes don't have arguments
|
|
1276
|
+
* 4. Verifies all nodes have a handler (either custom or NoopHandler)
|
|
1277
|
+
* 5. Validates command path uniqueness
|
|
1278
|
+
*
|
|
1279
|
+
* @returns An object containing:
|
|
1280
|
+
* - isValid: boolean indicating if the trie is valid
|
|
1281
|
+
* - errors: array of error messages describing any validation failures
|
|
1282
|
+
*
|
|
1283
|
+
* @example
|
|
1284
|
+
* ```typescript
|
|
1285
|
+
* const result = commandTrie.validate();
|
|
1286
|
+
* if (!result.isValid) {
|
|
1287
|
+
* console.error('Command trie validation failed:');
|
|
1288
|
+
* result.errors.forEach(error => console.error(error));
|
|
1289
|
+
* }
|
|
1290
|
+
* ```
|
|
1291
|
+
*/
|
|
1292
|
+
/**
|
|
1293
|
+
* Updates signatures for all nodes in the trie
|
|
1294
|
+
*/
|
|
1295
|
+
setSignatures() {
|
|
1296
|
+
const n = (t) => {
|
|
1297
|
+
t !== this._root && t.setSignature(this), t.children.forEach((o) => n(o));
|
|
1298
|
+
};
|
|
1299
|
+
n(this._root);
|
|
1300
|
+
}
|
|
1301
|
+
validate() {
|
|
1302
|
+
const n = [], t = /* @__PURE__ */ new Set(), o = (i) => {
|
|
1303
|
+
if (i === this._root)
|
|
1304
|
+
return;
|
|
1305
|
+
const a = i.fullPath.join(" ");
|
|
1306
|
+
t.has(a) && n.push(`Duplicate command path: ${a}`), t.add(a), i.handler || n.push(`Command missing handler: ${a}`);
|
|
1307
|
+
const l = i.children;
|
|
1308
|
+
l.size > 0 && (i.handler !== je && n.push(`Non-leaf command should use NoopHandler: ${a}`), i.argument && n.push(`Non-leaf command cannot have argument: ${a}`), l.forEach((d) => {
|
|
1309
|
+
o(d);
|
|
1310
|
+
}));
|
|
1311
|
+
};
|
|
1312
|
+
return this._root.children.forEach((i) => {
|
|
1313
|
+
o(i);
|
|
1314
|
+
}), {
|
|
1315
|
+
isValid: n.length === 0,
|
|
1316
|
+
errors: n
|
|
1317
|
+
};
|
|
1318
|
+
}
|
|
1319
|
+
}
|
|
1320
|
+
const mt = (r, n) => {
|
|
1321
|
+
const t = async function(o) {
|
|
1322
|
+
const i = r.getLeafCommands().filter((a) => a.name !== "help").map((a) => {
|
|
1323
|
+
var d;
|
|
1324
|
+
return `${a.fullPath.join(" ") + (a.requiresArgument ? ` <${(d = a.argument) == null ? void 0 : d.name}>` : "")} - ${a.description}`;
|
|
1325
|
+
}).sort();
|
|
1326
|
+
return n.includeHelpCommand && i.push("help - Show available commands"), new un(
|
|
1327
|
+
i.length > 0 ? `Available Commands:
|
|
1328
|
+
` + i.join(`
|
|
1329
|
+
`) : "No commands available yet. Add some commands to get started!"
|
|
1330
|
+
);
|
|
1331
|
+
};
|
|
1332
|
+
return ["help", new Ee({
|
|
1333
|
+
fullPath: ["help"],
|
|
1334
|
+
description: "Show available commands",
|
|
1335
|
+
handler: t
|
|
1336
|
+
})];
|
|
1337
|
+
}, mn = () => {
|
|
1338
|
+
const r = G(), n = st();
|
|
1339
|
+
return ie(() => {
|
|
1340
|
+
const o = new ut();
|
|
1341
|
+
if (r.includeHelpCommand) {
|
|
1342
|
+
const [i, a] = mt(o, r);
|
|
1343
|
+
o.addCommand({
|
|
1344
|
+
path: [i],
|
|
1345
|
+
description: a.description,
|
|
1346
|
+
handler: a.handler,
|
|
1347
|
+
argument: a.argument
|
|
1348
|
+
});
|
|
1349
|
+
}
|
|
1350
|
+
return n && Object.entries(n).forEach(([i, a]) => {
|
|
1351
|
+
o.addCommand({
|
|
1352
|
+
path: i.split("."),
|
|
1353
|
+
...a
|
|
1354
|
+
});
|
|
1355
|
+
}), o;
|
|
1356
|
+
}, [r.includeHelpCommand, n]);
|
|
1357
|
+
};
|
|
1358
|
+
function ft() {
|
|
1359
|
+
const r = dn(), [n, t] = Y({
|
|
1360
|
+
commands: [],
|
|
1361
|
+
position: null,
|
|
1362
|
+
savedInput: null
|
|
1363
|
+
});
|
|
1364
|
+
$(() => {
|
|
1365
|
+
if (!r) return;
|
|
1366
|
+
(async () => {
|
|
1367
|
+
try {
|
|
1368
|
+
const m = await r.getCommands();
|
|
1369
|
+
t((p) => ({
|
|
1370
|
+
...p,
|
|
1371
|
+
commands: m
|
|
1372
|
+
}));
|
|
1373
|
+
} catch (m) {
|
|
1374
|
+
console.warn("Failed to load command history:", m);
|
|
1375
|
+
}
|
|
1376
|
+
})();
|
|
1377
|
+
}, [r]);
|
|
1378
|
+
const o = j(async (w) => {
|
|
1379
|
+
if (r)
|
|
1380
|
+
try {
|
|
1381
|
+
await r.addCommand(w), t((m) => ({
|
|
1382
|
+
...m,
|
|
1383
|
+
commands: [...m.commands, w],
|
|
1384
|
+
position: null,
|
|
1385
|
+
savedInput: null
|
|
1386
|
+
}));
|
|
1387
|
+
} catch (m) {
|
|
1388
|
+
console.warn("Failed to save command to history:", m);
|
|
1389
|
+
}
|
|
1390
|
+
}, [r]), i = j(() => n.commands, [n.commands]), a = j((w, m) => {
|
|
1391
|
+
if (n.commands.length === 0)
|
|
1392
|
+
return { command: null, position: null };
|
|
1393
|
+
n.position === null && w === "up" && t((u) => ({
|
|
1394
|
+
...u,
|
|
1395
|
+
savedInput: m
|
|
1396
|
+
}));
|
|
1397
|
+
let p = null;
|
|
1398
|
+
if (w === "up" ? n.position === null ? p = n.commands.length - 1 : n.position > 0 ? p = n.position - 1 : p = 0 : n.position === null || n.position >= n.commands.length - 1 ? p = null : p = n.position + 1, t((u) => ({
|
|
1399
|
+
...u,
|
|
1400
|
+
position: p
|
|
1401
|
+
})), p === null && n.savedInput) {
|
|
1402
|
+
const u = {
|
|
1403
|
+
inputs: n.savedInput.split(" ").filter(Boolean),
|
|
1404
|
+
timestamp: Date.now()
|
|
1405
|
+
};
|
|
1406
|
+
return t((y) => ({
|
|
1407
|
+
...y,
|
|
1408
|
+
savedInput: null
|
|
1409
|
+
})), { command: u, position: null };
|
|
1410
|
+
}
|
|
1411
|
+
return {
|
|
1412
|
+
command: p !== null ? n.commands[p] : null,
|
|
1413
|
+
position: p
|
|
1414
|
+
};
|
|
1415
|
+
}, [n]), l = j((w) => {
|
|
1416
|
+
t((m) => ({
|
|
1417
|
+
...m,
|
|
1418
|
+
savedInput: w
|
|
1419
|
+
}));
|
|
1420
|
+
}, []), d = j(async () => {
|
|
1421
|
+
try {
|
|
1422
|
+
if (!r) return;
|
|
1423
|
+
await r.clear(), t({
|
|
1424
|
+
commands: [],
|
|
1425
|
+
position: null,
|
|
1426
|
+
savedInput: null
|
|
1427
|
+
});
|
|
1428
|
+
} catch (w) {
|
|
1429
|
+
console.warn("Failed to clear command history:", w);
|
|
1430
|
+
}
|
|
1431
|
+
}, [r]);
|
|
1432
|
+
return [n, {
|
|
1433
|
+
addCommand: o,
|
|
1434
|
+
getCommands: i,
|
|
1435
|
+
navigateHistory: a,
|
|
1436
|
+
saveInput: l,
|
|
1437
|
+
clear: d
|
|
1438
|
+
}];
|
|
1439
|
+
}
|
|
1440
|
+
function fn({ commandTrie: r } = {}) {
|
|
1441
|
+
const [n, t] = Y("idle"), o = mn(), i = r || o, a = j((b, C) => b ? C.filter((f) => f.name.toLowerCase().startsWith(b.toLowerCase())) : C, []), l = j((b, C) => {
|
|
1442
|
+
const f = a(b, C);
|
|
1443
|
+
return f.length === 1 ? f[0].name : null;
|
|
1444
|
+
}, [a]), d = j((b) => b != null && b.hasChildren ? Array.from(b.children.values()) : i.getRootCommands(), [i]), h = j((b, C) => a(b, C).length > 0, [a]), w = j((b, C, f) => {
|
|
1445
|
+
i.getCommand(b) && (C.executeCommand(b, f || void 0), C.setCurrentInput(""), C.setIsEnteringArg(!1), t("idle"));
|
|
1446
|
+
}, [i]), m = j((b, C, f) => {
|
|
1447
|
+
if (f.setCurrentInput(b), !C.isEnteringArg) {
|
|
1448
|
+
const _ = d(C.currentNode), S = l(b, _);
|
|
1449
|
+
if (S && S !== b) {
|
|
1450
|
+
const I = [...C.commandStack, S], T = i.getCommand(I);
|
|
1451
|
+
T && (f.setCommandStack(I), f.setCurrentInput(""), f.setCurrentNode(T), !T.hasChildren && T.argument ? (f.setIsEnteringArg(!0), t("entering_argument")) : (f.setIsEnteringArg(!1), t("idle")));
|
|
1452
|
+
}
|
|
1453
|
+
}
|
|
1454
|
+
}, [d, l, i]), p = j((b, C, f) => {
|
|
1455
|
+
const { commandStack: _, currentInput: S, isEnteringArg: I, currentNode: T } = C;
|
|
1456
|
+
switch (b.key) {
|
|
1457
|
+
case "Tab":
|
|
1458
|
+
if (b.preventDefault(), !I && S) {
|
|
1459
|
+
const D = d(T), U = l(S, D);
|
|
1460
|
+
U && f.setCurrentInput(U);
|
|
1461
|
+
}
|
|
1462
|
+
return;
|
|
1463
|
+
case "Backspace":
|
|
1464
|
+
if (S === "" && (b.preventDefault(), _.length > 0)) {
|
|
1465
|
+
const D = _.slice(0, -1), U = D.length > 0 ? i.getCommand(D) : void 0;
|
|
1466
|
+
f.setCommandStack(D), f.setCurrentNode(U), f.setIsEnteringArg(!1), t("entering_command");
|
|
1467
|
+
}
|
|
1468
|
+
return;
|
|
1469
|
+
case "Enter":
|
|
1470
|
+
if (b.preventDefault(), I && (T != null && T.handler))
|
|
1471
|
+
S.trim() && w(_, f, [S.trim()]);
|
|
1472
|
+
else if (!I && S) {
|
|
1473
|
+
const D = d(T), U = a(S, D);
|
|
1474
|
+
if (U.length === 1) {
|
|
1475
|
+
const Z = U[0], Q = [..._, Z.name];
|
|
1476
|
+
Z.argument ? (f.setCommandStack(Q), f.setCurrentNode(Z), f.setCurrentInput(""), f.setIsEnteringArg(!0), t("entering_argument")) : w(Q, f, void 0);
|
|
1477
|
+
}
|
|
1478
|
+
} else T && !T.argument && w(_, f, void 0);
|
|
1479
|
+
return;
|
|
1480
|
+
}
|
|
1481
|
+
if (!I && !(T != null && T.argument)) {
|
|
1482
|
+
const D = d(T);
|
|
1483
|
+
if (!h(S + b.key, D)) {
|
|
1484
|
+
b.preventDefault();
|
|
1485
|
+
return;
|
|
1486
|
+
}
|
|
1487
|
+
}
|
|
1488
|
+
}, [
|
|
1489
|
+
d,
|
|
1490
|
+
l,
|
|
1491
|
+
a,
|
|
1492
|
+
w,
|
|
1493
|
+
i,
|
|
1494
|
+
h
|
|
1495
|
+
]), u = j(async (b, C, f) => {
|
|
1496
|
+
y(f);
|
|
1497
|
+
let _ = [], S;
|
|
1498
|
+
for (const I of b.inputs) {
|
|
1499
|
+
const T = {
|
|
1500
|
+
...C,
|
|
1501
|
+
commandStack: _,
|
|
1502
|
+
currentNode: S
|
|
1503
|
+
};
|
|
1504
|
+
if (S != null && S.argument)
|
|
1505
|
+
f.setIsEnteringArg(!0), f.setCurrentInput(I);
|
|
1506
|
+
else {
|
|
1507
|
+
const D = v(I, T);
|
|
1508
|
+
D && (_ = [..._, D], f.setCommandStack(_), S = i.getCommand(_), f.setCurrentNode(S));
|
|
1509
|
+
}
|
|
1510
|
+
}
|
|
1511
|
+
}, [m]), y = j((b) => {
|
|
1512
|
+
b.setCurrentInput(""), b.setCommandStack([]), b.setCurrentNode(void 0), b.setIsEnteringArg(!1);
|
|
1513
|
+
}, []), v = (b, C) => {
|
|
1514
|
+
const f = d(C.currentNode);
|
|
1515
|
+
return l(b, f) || "";
|
|
1516
|
+
};
|
|
1517
|
+
return {
|
|
1518
|
+
handleInputChange: m,
|
|
1519
|
+
handleKeyDown: p,
|
|
1520
|
+
executeCommand: w,
|
|
1521
|
+
inputState: n,
|
|
1522
|
+
replayCommand: u,
|
|
1523
|
+
// Expose internal functions for testing
|
|
1524
|
+
findMatchingCommands: a,
|
|
1525
|
+
getAutocompleteSuggestion: l,
|
|
1526
|
+
getAvailableNodes: d,
|
|
1527
|
+
isValidCommandInput: h
|
|
1528
|
+
};
|
|
1529
|
+
}
|
|
1530
|
+
const ht = () => {
|
|
1531
|
+
const r = mn(), n = G(), [t, o] = ft(), { replayCommand: i } = fn(), [a, l] = Y({
|
|
1532
|
+
commandStack: [],
|
|
1533
|
+
currentInput: "",
|
|
1534
|
+
isEnteringArg: !1,
|
|
1535
|
+
currentNode: void 0,
|
|
1536
|
+
output: [],
|
|
1537
|
+
validation: { isValid: !0 },
|
|
1538
|
+
history: t
|
|
1539
|
+
}), d = dn();
|
|
1540
|
+
$(() => {
|
|
1541
|
+
}, [d]), $(() => {
|
|
1542
|
+
l((u) => ({
|
|
1543
|
+
...u,
|
|
1544
|
+
history: t
|
|
1545
|
+
}));
|
|
1546
|
+
}, [t]);
|
|
1547
|
+
const h = j(async (u, y) => {
|
|
1548
|
+
const v = r.getCommand(u);
|
|
1549
|
+
if (!v || !v.isLeaf) return;
|
|
1550
|
+
const b = new dt([...u, ...y || []]);
|
|
1551
|
+
l((C) => ({
|
|
1552
|
+
...C,
|
|
1553
|
+
output: [...C.output, b]
|
|
1554
|
+
})), l((C) => ({
|
|
1555
|
+
...C,
|
|
1556
|
+
commandStack: [],
|
|
1557
|
+
currentInput: "",
|
|
1558
|
+
isEnteringArg: !1,
|
|
1559
|
+
currentNode: void 0,
|
|
1560
|
+
validation: { isValid: !0 }
|
|
1561
|
+
}));
|
|
1562
|
+
try {
|
|
1563
|
+
const C = new Promise((S, I) => {
|
|
1564
|
+
setTimeout(() => {
|
|
1565
|
+
I(new Error("Request timed out"));
|
|
1566
|
+
}, n.commandTimeoutMs);
|
|
1567
|
+
}), f = await Promise.race([
|
|
1568
|
+
v.handler(y || []),
|
|
1569
|
+
C
|
|
1570
|
+
]);
|
|
1571
|
+
if (!(f instanceof X))
|
|
1572
|
+
throw new Error(
|
|
1573
|
+
`The ${v.fullPath.join(".")} command returned an invalid result type. Commands must return an instance of a CommandResult.
|
|
1574
|
+
For example:
|
|
1575
|
+
return new JsonCommandResult({ text: "Hello World" });
|
|
1576
|
+
Check the definition of the ${v.fullPath.join(".")} command and update the return type.`
|
|
1577
|
+
);
|
|
1578
|
+
f.markSuccess();
|
|
1579
|
+
const _ = {
|
|
1580
|
+
inputs: [...v.fullPath, ...y || []],
|
|
1581
|
+
timestamp: Date.now()
|
|
1582
|
+
};
|
|
1583
|
+
try {
|
|
1584
|
+
await o.addCommand(_), l((S) => ({
|
|
1585
|
+
...S,
|
|
1586
|
+
output: S.output.map(
|
|
1587
|
+
(I) => I.timestamp === b.timestamp ? { ...I, result: f } : I
|
|
1588
|
+
)
|
|
1589
|
+
}));
|
|
1590
|
+
} catch (S) {
|
|
1591
|
+
console.warn("Failed to save command to history:", S), l((I) => ({
|
|
1592
|
+
...I,
|
|
1593
|
+
output: I.output.map(
|
|
1594
|
+
(T) => T.timestamp === b.timestamp ? { ...T, result: f } : T
|
|
1595
|
+
)
|
|
1596
|
+
}));
|
|
1597
|
+
}
|
|
1598
|
+
} catch (C) {
|
|
1599
|
+
const f = new lt(
|
|
1600
|
+
C instanceof Error ? C.message : "Unknown error"
|
|
1601
|
+
);
|
|
1602
|
+
f.markSuccess(), l((_) => ({
|
|
1603
|
+
..._,
|
|
1604
|
+
output: _.output.map(
|
|
1605
|
+
(S) => S.timestamp === b.timestamp ? { ...S, result: f } : S
|
|
1606
|
+
)
|
|
1607
|
+
}));
|
|
1608
|
+
}
|
|
1609
|
+
}, [r, n.commandTimeoutMs, o, a]), w = j((u) => {
|
|
1610
|
+
const { key: y } = u;
|
|
1611
|
+
switch (y) {
|
|
1612
|
+
case "ArrowUp":
|
|
1613
|
+
u.preventDefault();
|
|
1614
|
+
const { command: v } = o.navigateHistory("up", a.currentInput);
|
|
1615
|
+
v && i(v, a, m);
|
|
1616
|
+
break;
|
|
1617
|
+
case "ArrowDown":
|
|
1618
|
+
u.preventDefault();
|
|
1619
|
+
const { command: b } = o.navigateHistory("down", a.currentInput);
|
|
1620
|
+
b && i(b, a, m);
|
|
1621
|
+
break;
|
|
1622
|
+
case "Enter":
|
|
1623
|
+
if (u.preventDefault(), a.history.position !== null) {
|
|
1624
|
+
const C = a.history.commands[a.history.position];
|
|
1625
|
+
h([...C.inputs]), l((f) => ({
|
|
1626
|
+
...f,
|
|
1627
|
+
history: {
|
|
1628
|
+
...f.history,
|
|
1629
|
+
position: null,
|
|
1630
|
+
savedInput: null
|
|
1631
|
+
}
|
|
1632
|
+
}));
|
|
1633
|
+
}
|
|
1634
|
+
break;
|
|
1635
|
+
case "Escape":
|
|
1636
|
+
if (u.preventDefault(), a.history.position !== null) {
|
|
1637
|
+
const C = a.history.savedInput || "";
|
|
1638
|
+
l((f) => ({
|
|
1639
|
+
...f,
|
|
1640
|
+
currentInput: C,
|
|
1641
|
+
history: {
|
|
1642
|
+
...f.history,
|
|
1643
|
+
position: null,
|
|
1644
|
+
savedInput: null
|
|
1645
|
+
}
|
|
1646
|
+
}));
|
|
1647
|
+
}
|
|
1648
|
+
break;
|
|
1649
|
+
}
|
|
1650
|
+
}, [a.currentInput, a.history, o, h]);
|
|
1651
|
+
$(() => (window.addEventListener("keydown", w), () => window.removeEventListener("keydown", w)), [w]);
|
|
1652
|
+
const m = {
|
|
1653
|
+
setCommandStack: j((u) => {
|
|
1654
|
+
l((y) => ({
|
|
1655
|
+
...y,
|
|
1656
|
+
commandStack: u,
|
|
1657
|
+
currentNode: r.getCommand(u)
|
|
1658
|
+
}));
|
|
1659
|
+
}, [r]),
|
|
1660
|
+
setCurrentInput: j((u) => {
|
|
1661
|
+
l((y) => ({ ...y, currentInput: u }));
|
|
1662
|
+
}, []),
|
|
1663
|
+
setIsEnteringArg: j((u) => {
|
|
1664
|
+
l((y) => ({ ...y, isEnteringArg: u }));
|
|
1665
|
+
}, []),
|
|
1666
|
+
setCurrentNode: j((u) => {
|
|
1667
|
+
l((y) => ({ ...y, currentNode: u }));
|
|
1668
|
+
}, []),
|
|
1669
|
+
addOutput: j((u) => {
|
|
1670
|
+
l((y) => ({
|
|
1671
|
+
...y,
|
|
1672
|
+
output: [...y.output, u]
|
|
1673
|
+
}));
|
|
1674
|
+
}, []),
|
|
1675
|
+
setValidation: j((u) => {
|
|
1676
|
+
l((y) => ({ ...y, validation: u }));
|
|
1677
|
+
}, []),
|
|
1678
|
+
executeCommand: h,
|
|
1679
|
+
executeHistoryCommand: j(async (u) => {
|
|
1680
|
+
const v = a.history.commands[u];
|
|
1681
|
+
if (!v) {
|
|
1682
|
+
console.warn(`No command found at history index ${u}`);
|
|
1683
|
+
return;
|
|
1684
|
+
}
|
|
1685
|
+
await i(v, a, m);
|
|
1686
|
+
}, [a.history.commands, h]),
|
|
1687
|
+
clearHistory: j(async () => {
|
|
1688
|
+
try {
|
|
1689
|
+
await o.clear();
|
|
1690
|
+
} catch (u) {
|
|
1691
|
+
console.warn("Failed to clear history:", u);
|
|
1692
|
+
}
|
|
1693
|
+
}, [o])
|
|
1694
|
+
}, p = j(() => a.currentNode && a.currentNode.children ? Array.from(a.currentNode.children.values()) : r.getRootCommands(), [a.currentNode, r]);
|
|
1695
|
+
return { state: a, actions: m, getAvailableCommands: p };
|
|
1696
|
+
}, pt = {
|
|
1697
|
+
blink: {
|
|
1698
|
+
character: "▋",
|
|
1699
|
+
speed: 530,
|
|
1700
|
+
color: "#fff"
|
|
1701
|
+
},
|
|
1702
|
+
spin: {
|
|
1703
|
+
character: "⠋",
|
|
1704
|
+
speed: 120,
|
|
1705
|
+
color: "#fff"
|
|
1706
|
+
},
|
|
1707
|
+
solid: {
|
|
1708
|
+
character: "▋",
|
|
1709
|
+
speed: 0,
|
|
1710
|
+
color: "#fff"
|
|
1711
|
+
},
|
|
1712
|
+
bbs: {
|
|
1713
|
+
character: "|",
|
|
1714
|
+
speed: 120,
|
|
1715
|
+
color: "#fff"
|
|
1716
|
+
}
|
|
1717
|
+
}, tn = ["⠋", "⠙", "⠹", "⠸", "⠼", "⠴", "⠦", "⠧", "⠇", "⠏"], rn = ["|", "/", "-", "\\"], gt = ({
|
|
1718
|
+
style: r = { type: "blink" },
|
|
1719
|
+
isValid: n = !0,
|
|
1720
|
+
errorMessage: t
|
|
1721
|
+
}) => {
|
|
1722
|
+
const o = ie(() => ({
|
|
1723
|
+
...pt[r.type],
|
|
1724
|
+
...r
|
|
1725
|
+
}), [r]), [i, a] = Y(!0), [l, d] = Y(0);
|
|
1726
|
+
$(() => {
|
|
1727
|
+
if (o.speed === 0) return;
|
|
1728
|
+
const m = setInterval(() => {
|
|
1729
|
+
o.type === "blink" ? a((p) => !p) : ["spin", "bbs"].includes(o.type) && d((p) => (p + 1) % (o.type === "bbs" ? rn.length : tn.length));
|
|
1730
|
+
}, o.speed);
|
|
1731
|
+
return () => clearInterval(m);
|
|
1732
|
+
}, [o.type, o.speed]);
|
|
1733
|
+
const h = ie(() => ({
|
|
1734
|
+
color: n ? o.color : "#ff4444",
|
|
1735
|
+
transition: "color 0.15s ease-in-out"
|
|
1736
|
+
}), [n, o.color]), w = () => !n && t ? "✗" : ["spin", "bbs"].includes(o.type) ? (o.type === "bbs" ? rn : tn)[l] : o.type === "solid" || i ? o.character : " ";
|
|
1737
|
+
return /* @__PURE__ */ g.jsx("div", { className: "relative inline-block", children: /* @__PURE__ */ g.jsx(
|
|
1738
|
+
"span",
|
|
1739
|
+
{
|
|
1740
|
+
className: `command-cursor ${n ? "" : "animate-shake"}`,
|
|
1741
|
+
style: h,
|
|
1742
|
+
title: t,
|
|
1743
|
+
children: w()
|
|
1744
|
+
}
|
|
1745
|
+
) });
|
|
1746
|
+
}, wt = "_invalidInput_e9b9w_12", bt = "_shake_e9b9w_1", vt = "_flashBorder_e9b9w_1", yt = {
|
|
1747
|
+
invalidInput: wt,
|
|
1748
|
+
shake: bt,
|
|
1749
|
+
flashBorder: vt
|
|
1750
|
+
}, xt = ({
|
|
1751
|
+
state: r,
|
|
1752
|
+
actions: n,
|
|
1753
|
+
availableCommands: t
|
|
1754
|
+
}) => {
|
|
1755
|
+
var u, y;
|
|
1756
|
+
const o = J(null), { handleKeyDown: i, handleInputChange: a } = fn(), [l, d] = Y(!1), h = G(), w = (v) => {
|
|
1757
|
+
var C, f;
|
|
1758
|
+
const b = v.key === "Backspace" || v.key === "Escape" || v.key === "Tab" || v.key === "Shift" || v.key === "Control" || v.key === "Alt" || v.key === "Meta" || v.key === "ArrowLeft" || v.key === "ArrowRight" || v.key === "ArrowUp" || v.key === "ArrowDown" || v.key === "Enter";
|
|
1759
|
+
if (!b && !r.isEnteringArg && !((C = r.currentNode) != null && C.hasChildren) && r.currentNode && !r.currentNode.requiresArgument && !r.currentNode.handler) {
|
|
1760
|
+
v.preventDefault();
|
|
1761
|
+
return;
|
|
1762
|
+
}
|
|
1763
|
+
if (!b && !r.isEnteringArg && !((f = r.currentNode) != null && f.requiresArgument)) {
|
|
1764
|
+
const _ = r.currentNode ? Array.from(r.currentNode.children.values()) : t, S = (r.currentInput + v.key).toLowerCase();
|
|
1765
|
+
if (!_.some(
|
|
1766
|
+
(T) => T.name.toLowerCase().startsWith(S)
|
|
1767
|
+
)) {
|
|
1768
|
+
d(!0), setTimeout(() => d(!1), 300), v.preventDefault();
|
|
1769
|
+
return;
|
|
1770
|
+
}
|
|
1771
|
+
}
|
|
1772
|
+
i(v.nativeEvent, r, n);
|
|
1773
|
+
}, m = (v) => {
|
|
1774
|
+
a(v.target.value, r, n);
|
|
1775
|
+
}, p = (v) => {
|
|
1776
|
+
v.preventDefault();
|
|
1777
|
+
const b = v.clipboardData.getData("text");
|
|
1778
|
+
a(b, r, n);
|
|
1779
|
+
};
|
|
1780
|
+
return $(() => {
|
|
1781
|
+
o.current && o.current.focus();
|
|
1782
|
+
}, []), $(() => {
|
|
1783
|
+
o.current && o.current.focus();
|
|
1784
|
+
}, [r.commandStack]), /* @__PURE__ */ g.jsxs("div", { className: "flex flex-col w-full bg-gray-900 rounded-lg p-4", children: [
|
|
1785
|
+
/* @__PURE__ */ g.jsxs("div", { className: "flex items-center gap-2", children: [
|
|
1786
|
+
/* @__PURE__ */ g.jsx("div", { className: "text-gray-400 font-mono", children: ">" }),
|
|
1787
|
+
/* @__PURE__ */ g.jsxs("div", { className: "flex-1 font-mono flex items-center", children: [
|
|
1788
|
+
/* @__PURE__ */ g.jsxs("span", { className: "text-blue-400 whitespace-pre", "data-testid": "user-input-area", children: [
|
|
1789
|
+
r.commandStack.join(" "),
|
|
1790
|
+
r.commandStack.length > 0 && " "
|
|
1791
|
+
] }),
|
|
1792
|
+
/* @__PURE__ */ g.jsxs("div", { className: "relative flex-1", children: [
|
|
1793
|
+
/* @__PURE__ */ g.jsx(
|
|
1794
|
+
"input",
|
|
1795
|
+
{
|
|
1796
|
+
ref: o,
|
|
1797
|
+
type: "text",
|
|
1798
|
+
role: "textbox",
|
|
1799
|
+
value: r.currentInput,
|
|
1800
|
+
onChange: m,
|
|
1801
|
+
onKeyDown: w,
|
|
1802
|
+
onPaste: p,
|
|
1803
|
+
"data-testid": "citadel-command-input",
|
|
1804
|
+
className: `w-full bg-transparent outline-none text-gray-200 caret-transparent ${l ? yt.invalidInput : ""}`,
|
|
1805
|
+
spellCheck: !1,
|
|
1806
|
+
autoComplete: "off",
|
|
1807
|
+
placeholder: r.isEnteringArg ? (y = (u = r.currentNode) == null ? void 0 : u.argument) == null ? void 0 : y.name : ""
|
|
1808
|
+
}
|
|
1809
|
+
),
|
|
1810
|
+
/* @__PURE__ */ g.jsx(
|
|
1811
|
+
"div",
|
|
1812
|
+
{
|
|
1813
|
+
className: "absolute top-0 pointer-events-none",
|
|
1814
|
+
style: {
|
|
1815
|
+
left: `${r.currentInput.length}ch`,
|
|
1816
|
+
transition: "left 0.05s ease-out"
|
|
1817
|
+
},
|
|
1818
|
+
children: /* @__PURE__ */ g.jsx(
|
|
1819
|
+
gt,
|
|
1820
|
+
{
|
|
1821
|
+
style: {
|
|
1822
|
+
type: h.cursorType ?? F.cursorType,
|
|
1823
|
+
color: h.cursorColor || F.cursorColor,
|
|
1824
|
+
speed: h.cursorSpeed || F.cursorSpeed
|
|
1825
|
+
},
|
|
1826
|
+
isValid: !l && r.validation.isValid,
|
|
1827
|
+
errorMessage: r.validation.message
|
|
1828
|
+
}
|
|
1829
|
+
)
|
|
1830
|
+
}
|
|
1831
|
+
)
|
|
1832
|
+
] })
|
|
1833
|
+
] })
|
|
1834
|
+
] }),
|
|
1835
|
+
r.validation.message && /* @__PURE__ */ g.jsx("div", { className: `mt-2 text-sm ${r.validation.isValid ? "text-green-500" : "text-red-500"}`, children: r.validation.message })
|
|
1836
|
+
] });
|
|
1837
|
+
}, Ct = () => /* @__PURE__ */ g.jsx(
|
|
1838
|
+
"div",
|
|
1839
|
+
{
|
|
1840
|
+
"data-testid": "spinner",
|
|
1841
|
+
className: "animate-spin rounded-full h-4 w-4 border-2 border-gray-300 border-t-gray-600"
|
|
1842
|
+
}
|
|
1843
|
+
), _t = ({
|
|
1844
|
+
command: r,
|
|
1845
|
+
timestamp: n,
|
|
1846
|
+
status: t
|
|
1847
|
+
}) => /* @__PURE__ */ g.jsxs("div", { className: "flex items-center gap-2 font-mono text-sm", children: [
|
|
1848
|
+
/* @__PURE__ */ g.jsxs("span", { className: "text-gray-200", children: [
|
|
1849
|
+
"> ",
|
|
1850
|
+
r
|
|
1851
|
+
] }),
|
|
1852
|
+
/* @__PURE__ */ g.jsx("span", { className: "text-gray-400", children: "·" }),
|
|
1853
|
+
/* @__PURE__ */ g.jsx("span", { className: "text-gray-500", children: n }),
|
|
1854
|
+
t === ae.Pending && /* @__PURE__ */ g.jsx(Ct, {}),
|
|
1855
|
+
t === ae.Success && /* @__PURE__ */ g.jsx(
|
|
1856
|
+
"div",
|
|
1857
|
+
{
|
|
1858
|
+
"data-testid": "success-indicator",
|
|
1859
|
+
className: "w-4 h-4 rounded-full bg-green-500"
|
|
1860
|
+
}
|
|
1861
|
+
),
|
|
1862
|
+
(t === ae.Timeout || t === ae.Failure) && /* @__PURE__ */ g.jsx(
|
|
1863
|
+
"div",
|
|
1864
|
+
{
|
|
1865
|
+
"data-testid": "error-indicator",
|
|
1866
|
+
className: "w-4 h-4 rounded-full bg-red-500"
|
|
1867
|
+
}
|
|
1868
|
+
)
|
|
1869
|
+
] }), St = ({ output: r, outputRef: n }) => {
|
|
1870
|
+
const t = G(), o = j(() => {
|
|
1871
|
+
if (n.current) {
|
|
1872
|
+
const i = n.current;
|
|
1873
|
+
requestAnimationFrame(() => {
|
|
1874
|
+
i.scrollTop = i.scrollHeight;
|
|
1875
|
+
});
|
|
1876
|
+
}
|
|
1877
|
+
}, [n]);
|
|
1878
|
+
return $(() => {
|
|
1879
|
+
if (o(), n.current) {
|
|
1880
|
+
const i = n.current.getElementsByTagName("img"), a = i[i.length - 1];
|
|
1881
|
+
if (a && !a.complete)
|
|
1882
|
+
return a.addEventListener("load", o), () => a.removeEventListener("load", o);
|
|
1883
|
+
}
|
|
1884
|
+
}, [r, o]), /* @__PURE__ */ g.jsx(
|
|
1885
|
+
"div",
|
|
1886
|
+
{
|
|
1887
|
+
ref: n,
|
|
1888
|
+
className: "h-full overflow-y-auto border border-gray-700 rounded-lg p-3 text-left",
|
|
1889
|
+
children: r.map((i, a) => /* @__PURE__ */ g.jsxs("div", { className: "mb-4 last:mb-0", children: [
|
|
1890
|
+
/* @__PURE__ */ g.jsx(
|
|
1891
|
+
_t,
|
|
1892
|
+
{
|
|
1893
|
+
command: i.command.join(" "),
|
|
1894
|
+
timestamp: new Date(i.timestamp).toLocaleTimeString(),
|
|
1895
|
+
status: i.result.status
|
|
1896
|
+
}
|
|
1897
|
+
),
|
|
1898
|
+
/* @__PURE__ */ g.jsx("pre", { className: `text-gray-200 whitespace-pre font-mono ${t.outputFontSize}`, children: i.result.render() })
|
|
1899
|
+
] }, a))
|
|
1900
|
+
}
|
|
1901
|
+
);
|
|
1902
|
+
}, kt = ({
|
|
1903
|
+
state: r,
|
|
1904
|
+
availableCommands: n
|
|
1905
|
+
}) => {
|
|
1906
|
+
var h, w;
|
|
1907
|
+
const t = G(), o = !r.isEnteringArg && n.length > 0, i = "h-12 mt-2 border-t border-gray-700 px-4", a = "text-gray-300 pt-2", l = ((h = r.currentNode) == null ? void 0 : h.isLeaf) && r.currentNode.handler === je && !r.currentNode.requiresArgument, d = fe.useMemo(() => {
|
|
1908
|
+
if (!r.commandStack.length && t.includeHelpCommand) {
|
|
1909
|
+
const m = n.filter((u) => u.name !== "help"), p = n.find((u) => u.name === "help");
|
|
1910
|
+
return [...m, ...p ? [p] : []];
|
|
1911
|
+
}
|
|
1912
|
+
return n;
|
|
1913
|
+
}, [n, r.commandStack, t.includeHelpCommand]);
|
|
1914
|
+
return /* @__PURE__ */ g.jsx("div", { className: i, "data-testid": "available-commands", children: l ? /* @__PURE__ */ g.jsx("div", { className: a, children: r.currentNode ? /* @__PURE__ */ g.jsxs(g.Fragment, { children: [
|
|
1915
|
+
/* @__PURE__ */ g.jsx("span", { className: "text-blue-400", children: r.currentNode.name }),
|
|
1916
|
+
/* @__PURE__ */ g.jsxs("span", { className: "text-gray-400 ml-2", children: [
|
|
1917
|
+
"- ",
|
|
1918
|
+
r.currentNode.description
|
|
1919
|
+
] })
|
|
1920
|
+
] }) : null }) : o ? /* @__PURE__ */ g.jsx("div", { className: a, children: /* @__PURE__ */ g.jsx("div", { className: "flex flex-wrap gap-2", children: d.map((m) => {
|
|
1921
|
+
const p = d.reduce((u, y) => {
|
|
1922
|
+
if (y.name === m.name) return u;
|
|
1923
|
+
let v = 0;
|
|
1924
|
+
for (; v < m.name.length && v < y.name.length && m.name[v].toLowerCase() === y.name[v].toLowerCase(); )
|
|
1925
|
+
v++;
|
|
1926
|
+
return Math.max(u, v + 1);
|
|
1927
|
+
}, 1);
|
|
1928
|
+
return /* @__PURE__ */ g.jsx(
|
|
1929
|
+
"div",
|
|
1930
|
+
{
|
|
1931
|
+
className: "px-2 py-1 rounded bg-gray-800 mr-2 last:mr-0",
|
|
1932
|
+
children: /* @__PURE__ */ g.jsxs("span", { className: "font-mono text-white", children: [
|
|
1933
|
+
/* @__PURE__ */ g.jsx("strong", { className: "underline", children: m.name.slice(0, p) }),
|
|
1934
|
+
m.name.slice(p)
|
|
1935
|
+
] })
|
|
1936
|
+
},
|
|
1937
|
+
m.fullPath.join(".")
|
|
1938
|
+
);
|
|
1939
|
+
}) }) }) : /* @__PURE__ */ g.jsx("div", { className: a, children: (w = r.currentNode) == null ? void 0 : w.description }) });
|
|
1940
|
+
}, on = `:host {
|
|
1941
|
+
--citadel-bg: rgb(17, 24, 39);
|
|
1942
|
+
--citadel-text: rgba(255, 255, 255, 0.87);
|
|
1943
|
+
--citadel-border: rgb(55, 65, 81);
|
|
1944
|
+
--citadel-accent: #646cff;
|
|
1945
|
+
--citadel-accent-hover: #535bf2;
|
|
1946
|
+
--citadel-min-height: 200px;
|
|
1947
|
+
--citadel-max-height: 80vh;
|
|
1948
|
+
--citadel-default-height: 33vh;
|
|
1949
|
+
--citadel-error: rgb(239, 68, 68);
|
|
1950
|
+
|
|
1951
|
+
height: var(--citadel-default-height);
|
|
1952
|
+
max-height: var(--citadel-max-height);
|
|
1953
|
+
min-height: var(--citadel-min-height);
|
|
1954
|
+
width: 100%;
|
|
1955
|
+
|
|
1956
|
+
position: fixed;
|
|
1957
|
+
bottom: 0;
|
|
1958
|
+
left: 0;
|
|
1959
|
+
right: 0;
|
|
1960
|
+
overflow: hidden;
|
|
1961
|
+
|
|
1962
|
+
pointer-events: auto;
|
|
1963
|
+
font-synthesis: none;
|
|
1964
|
+
text-rendering: optimizeLegibility;
|
|
1965
|
+
-webkit-font-smoothing: antialiased;
|
|
1966
|
+
-moz-osx-font-smoothing: grayscale;
|
|
1967
|
+
}
|
|
1968
|
+
|
|
1969
|
+
button {
|
|
1970
|
+
border-radius: 8px;
|
|
1971
|
+
border: 1px solid transparent;
|
|
1972
|
+
padding: 0.6em 1.2em;
|
|
1973
|
+
font-size: 1em;
|
|
1974
|
+
font-weight: 500;
|
|
1975
|
+
font-family: inherit;
|
|
1976
|
+
background-color: #1a1a1a;
|
|
1977
|
+
cursor: pointer;
|
|
1978
|
+
transition: border-color 0.25s;
|
|
1979
|
+
}
|
|
1980
|
+
|
|
1981
|
+
button:hover {
|
|
1982
|
+
border-color: var(--citadel-accent);
|
|
1983
|
+
}
|
|
1984
|
+
|
|
1985
|
+
button:focus,
|
|
1986
|
+
button:focus-visible {
|
|
1987
|
+
outline: 4px auto -webkit-focus-ring-color;
|
|
1988
|
+
}
|
|
1989
|
+
|
|
1990
|
+
a {
|
|
1991
|
+
font-weight: 500;
|
|
1992
|
+
color: var(--citadel-accent);
|
|
1993
|
+
text-decoration: inherit;
|
|
1994
|
+
}
|
|
1995
|
+
|
|
1996
|
+
a:hover {
|
|
1997
|
+
color: var(--citadel-accent-hover);
|
|
1998
|
+
}
|
|
1999
|
+
|
|
2000
|
+
.flex-1 { flex: 1 1 0%; }
|
|
2001
|
+
.flex-shrink-0 { flex-shrink: 0; }
|
|
2002
|
+
.min-h-0 { min-height: 0px; }
|
|
2003
|
+
.pt-3 { padding-top: 0.75rem; }
|
|
2004
|
+
.px-4 { padding-left: 1rem; padding-right: 1rem; }
|
|
2005
|
+
|
|
2006
|
+
.h-full {
|
|
2007
|
+
height: 100%;
|
|
2008
|
+
}
|
|
2009
|
+
.overflow-y-auto {
|
|
2010
|
+
overflow-y: auto;
|
|
2011
|
+
}
|
|
2012
|
+
.border {
|
|
2013
|
+
border-width: 1px;
|
|
2014
|
+
}
|
|
2015
|
+
.border-gray-700 {
|
|
2016
|
+
--tw-border-opacity: 1;
|
|
2017
|
+
border-color: rgb(55 65 81 / var(--tw-border-opacity, 1));
|
|
2018
|
+
}
|
|
2019
|
+
.rounded-lg {
|
|
2020
|
+
border-radius: 0.5rem;
|
|
2021
|
+
}
|
|
2022
|
+
.p-3 {
|
|
2023
|
+
padding: 0.75rem;
|
|
2024
|
+
}
|
|
2025
|
+
.text-left {
|
|
2026
|
+
text-align: left;
|
|
2027
|
+
}
|
|
2028
|
+
|
|
2029
|
+
`, an = `/* Keep only component-specific styles here */
|
|
2030
|
+
|
|
2031
|
+
.container {
|
|
2032
|
+
position: fixed;
|
|
2033
|
+
height: var(--citadel-default-height);
|
|
2034
|
+
min-height: var(--citadel-min-height);
|
|
2035
|
+
max-height: var(--citadel-max-height);
|
|
2036
|
+
background-color: var(--citadel-bg);
|
|
2037
|
+
overflow: hidden;
|
|
2038
|
+
width: 100%;
|
|
2039
|
+
box-sizing: border-box;
|
|
2040
|
+
margin: 0;
|
|
2041
|
+
padding: 0;
|
|
2042
|
+
bottom: 0;
|
|
2043
|
+
left: 0;
|
|
2044
|
+
right: 0;
|
|
2045
|
+
}
|
|
2046
|
+
|
|
2047
|
+
.innerContainer {
|
|
2048
|
+
height: 100%;
|
|
2049
|
+
width: 100%;
|
|
2050
|
+
display: flex;
|
|
2051
|
+
flex-direction: column;
|
|
2052
|
+
margin: 0;
|
|
2053
|
+
padding: 0;
|
|
2054
|
+
}
|
|
2055
|
+
|
|
2056
|
+
.inputSection {
|
|
2057
|
+
border-top: 1px solid var(--citadel-border);
|
|
2058
|
+
padding: 1rem;
|
|
2059
|
+
margin: 0;
|
|
2060
|
+
box-sizing: border-box;
|
|
2061
|
+
}
|
|
2062
|
+
|
|
2063
|
+
.resizeHandle {
|
|
2064
|
+
width: 100%;
|
|
2065
|
+
height: 6px;
|
|
2066
|
+
background: transparent;
|
|
2067
|
+
cursor: ns-resize;
|
|
2068
|
+
position: absolute;
|
|
2069
|
+
top: -3px;
|
|
2070
|
+
left: 0;
|
|
2071
|
+
right: 0;
|
|
2072
|
+
z-index: 10;
|
|
2073
|
+
user-select: none;
|
|
2074
|
+
-webkit-user-select: none;
|
|
2075
|
+
pointer-events: all;
|
|
2076
|
+
}
|
|
2077
|
+
|
|
2078
|
+
.resizeHandle:hover {
|
|
2079
|
+
background: rgba(255, 255, 255, 0.1);
|
|
2080
|
+
}
|
|
2081
|
+
|
|
2082
|
+
@keyframes citadel_slideUp {
|
|
2083
|
+
from { transform: translateY(100%); }
|
|
2084
|
+
to { transform: translateY(0); }
|
|
2085
|
+
}
|
|
2086
|
+
|
|
2087
|
+
@keyframes citadel_slideDown {
|
|
2088
|
+
from { transform: translateY(0); }
|
|
2089
|
+
to { transform: translateY(100%); }
|
|
2090
|
+
}
|
|
2091
|
+
|
|
2092
|
+
.citadel_slideUp {
|
|
2093
|
+
animation: citadel_slideUp 0.2s ease-out forwards;
|
|
2094
|
+
}
|
|
2095
|
+
|
|
2096
|
+
.citadel_slideDown {
|
|
2097
|
+
animation: citadel_slideDown 0.2s ease-out forwards;
|
|
2098
|
+
}
|
|
2099
|
+
`, sn = `@tailwind base;
|
|
2100
|
+
@tailwind components;
|
|
2101
|
+
@tailwind utilities;
|
|
2102
|
+
`, Et = `*, ::before, ::after {
|
|
2103
|
+
--tw-border-spacing-x: 0;
|
|
2104
|
+
--tw-border-spacing-y: 0;
|
|
2105
|
+
--tw-translate-x: 0;
|
|
2106
|
+
--tw-translate-y: 0;
|
|
2107
|
+
--tw-rotate: 0;
|
|
2108
|
+
--tw-skew-x: 0;
|
|
2109
|
+
--tw-skew-y: 0;
|
|
2110
|
+
--tw-scale-x: 1;
|
|
2111
|
+
--tw-scale-y: 1;
|
|
2112
|
+
--tw-pan-x: ;
|
|
2113
|
+
--tw-pan-y: ;
|
|
2114
|
+
--tw-pinch-zoom: ;
|
|
2115
|
+
--tw-scroll-snap-strictness: proximity;
|
|
2116
|
+
--tw-gradient-from-position: ;
|
|
2117
|
+
--tw-gradient-via-position: ;
|
|
2118
|
+
--tw-gradient-to-position: ;
|
|
2119
|
+
--tw-ordinal: ;
|
|
2120
|
+
--tw-slashed-zero: ;
|
|
2121
|
+
--tw-numeric-figure: ;
|
|
2122
|
+
--tw-numeric-spacing: ;
|
|
2123
|
+
--tw-numeric-fraction: ;
|
|
2124
|
+
--tw-ring-inset: ;
|
|
2125
|
+
--tw-ring-offset-width: 0px;
|
|
2126
|
+
--tw-ring-offset-color: #fff;
|
|
2127
|
+
--tw-ring-color: rgb(59 130 246 / 0.5);
|
|
2128
|
+
--tw-ring-offset-shadow: 0 0 #0000;
|
|
2129
|
+
--tw-ring-shadow: 0 0 #0000;
|
|
2130
|
+
--tw-shadow: 0 0 #0000;
|
|
2131
|
+
--tw-shadow-colored: 0 0 #0000;
|
|
2132
|
+
--tw-blur: ;
|
|
2133
|
+
--tw-brightness: ;
|
|
2134
|
+
--tw-contrast: ;
|
|
2135
|
+
--tw-grayscale: ;
|
|
2136
|
+
--tw-hue-rotate: ;
|
|
2137
|
+
--tw-invert: ;
|
|
2138
|
+
--tw-saturate: ;
|
|
2139
|
+
--tw-sepia: ;
|
|
2140
|
+
--tw-drop-shadow: ;
|
|
2141
|
+
--tw-backdrop-blur: ;
|
|
2142
|
+
--tw-backdrop-brightness: ;
|
|
2143
|
+
--tw-backdrop-contrast: ;
|
|
2144
|
+
--tw-backdrop-grayscale: ;
|
|
2145
|
+
--tw-backdrop-hue-rotate: ;
|
|
2146
|
+
--tw-backdrop-invert: ;
|
|
2147
|
+
--tw-backdrop-opacity: ;
|
|
2148
|
+
--tw-backdrop-saturate: ;
|
|
2149
|
+
--tw-backdrop-sepia: ;
|
|
2150
|
+
--tw-contain-size: ;
|
|
2151
|
+
--tw-contain-layout: ;
|
|
2152
|
+
--tw-contain-paint: ;
|
|
2153
|
+
--tw-contain-style: ;
|
|
2154
|
+
}
|
|
2155
|
+
|
|
2156
|
+
::backdrop {
|
|
2157
|
+
--tw-border-spacing-x: 0;
|
|
2158
|
+
--tw-border-spacing-y: 0;
|
|
2159
|
+
--tw-translate-x: 0;
|
|
2160
|
+
--tw-translate-y: 0;
|
|
2161
|
+
--tw-rotate: 0;
|
|
2162
|
+
--tw-skew-x: 0;
|
|
2163
|
+
--tw-skew-y: 0;
|
|
2164
|
+
--tw-scale-x: 1;
|
|
2165
|
+
--tw-scale-y: 1;
|
|
2166
|
+
--tw-pan-x: ;
|
|
2167
|
+
--tw-pan-y: ;
|
|
2168
|
+
--tw-pinch-zoom: ;
|
|
2169
|
+
--tw-scroll-snap-strictness: proximity;
|
|
2170
|
+
--tw-gradient-from-position: ;
|
|
2171
|
+
--tw-gradient-via-position: ;
|
|
2172
|
+
--tw-gradient-to-position: ;
|
|
2173
|
+
--tw-ordinal: ;
|
|
2174
|
+
--tw-slashed-zero: ;
|
|
2175
|
+
--tw-numeric-figure: ;
|
|
2176
|
+
--tw-numeric-spacing: ;
|
|
2177
|
+
--tw-numeric-fraction: ;
|
|
2178
|
+
--tw-ring-inset: ;
|
|
2179
|
+
--tw-ring-offset-width: 0px;
|
|
2180
|
+
--tw-ring-offset-color: #fff;
|
|
2181
|
+
--tw-ring-color: rgb(59 130 246 / 0.5);
|
|
2182
|
+
--tw-ring-offset-shadow: 0 0 #0000;
|
|
2183
|
+
--tw-ring-shadow: 0 0 #0000;
|
|
2184
|
+
--tw-shadow: 0 0 #0000;
|
|
2185
|
+
--tw-shadow-colored: 0 0 #0000;
|
|
2186
|
+
--tw-blur: ;
|
|
2187
|
+
--tw-brightness: ;
|
|
2188
|
+
--tw-contrast: ;
|
|
2189
|
+
--tw-grayscale: ;
|
|
2190
|
+
--tw-hue-rotate: ;
|
|
2191
|
+
--tw-invert: ;
|
|
2192
|
+
--tw-saturate: ;
|
|
2193
|
+
--tw-sepia: ;
|
|
2194
|
+
--tw-drop-shadow: ;
|
|
2195
|
+
--tw-backdrop-blur: ;
|
|
2196
|
+
--tw-backdrop-brightness: ;
|
|
2197
|
+
--tw-backdrop-contrast: ;
|
|
2198
|
+
--tw-backdrop-grayscale: ;
|
|
2199
|
+
--tw-backdrop-hue-rotate: ;
|
|
2200
|
+
--tw-backdrop-invert: ;
|
|
2201
|
+
--tw-backdrop-opacity: ;
|
|
2202
|
+
--tw-backdrop-saturate: ;
|
|
2203
|
+
--tw-backdrop-sepia: ;
|
|
2204
|
+
--tw-contain-size: ;
|
|
2205
|
+
--tw-contain-layout: ;
|
|
2206
|
+
--tw-contain-paint: ;
|
|
2207
|
+
--tw-contain-style: ;
|
|
2208
|
+
}/*
|
|
2209
|
+
! tailwindcss v3.4.15 | MIT License | https://tailwindcss.com
|
|
2210
|
+
*//*
|
|
2211
|
+
1. Prevent padding and border from affecting element width. (https://github.com/mozdevs/cssremedy/issues/4)
|
|
2212
|
+
2. Allow adding a border to an element by just adding a border-width. (https://github.com/tailwindcss/tailwindcss/pull/116)
|
|
2213
|
+
*/
|
|
2214
|
+
|
|
2215
|
+
*,
|
|
2216
|
+
::before,
|
|
2217
|
+
::after {
|
|
2218
|
+
box-sizing: border-box; /* 1 */
|
|
2219
|
+
border-width: 0; /* 2 */
|
|
2220
|
+
border-style: solid; /* 2 */
|
|
2221
|
+
border-color: #e5e7eb; /* 2 */
|
|
2222
|
+
}
|
|
2223
|
+
|
|
2224
|
+
::before,
|
|
2225
|
+
::after {
|
|
2226
|
+
--tw-content: '';
|
|
2227
|
+
}
|
|
2228
|
+
|
|
2229
|
+
/*
|
|
2230
|
+
1. Use a consistent sensible line-height in all browsers.
|
|
2231
|
+
2. Prevent adjustments of font size after orientation changes in iOS.
|
|
2232
|
+
3. Use a more readable tab size.
|
|
2233
|
+
4. Use the user's configured \`sans\` font-family by default.
|
|
2234
|
+
5. Use the user's configured \`sans\` font-feature-settings by default.
|
|
2235
|
+
6. Use the user's configured \`sans\` font-variation-settings by default.
|
|
2236
|
+
7. Disable tap highlights on iOS
|
|
2237
|
+
*/
|
|
2238
|
+
|
|
2239
|
+
html,
|
|
2240
|
+
:host {
|
|
2241
|
+
line-height: 1.5; /* 1 */
|
|
2242
|
+
-webkit-text-size-adjust: 100%; /* 2 */
|
|
2243
|
+
-moz-tab-size: 4; /* 3 */
|
|
2244
|
+
-o-tab-size: 4;
|
|
2245
|
+
tab-size: 4; /* 3 */
|
|
2246
|
+
font-family: ui-sans-serif, system-ui, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji"; /* 4 */
|
|
2247
|
+
font-feature-settings: normal; /* 5 */
|
|
2248
|
+
font-variation-settings: normal; /* 6 */
|
|
2249
|
+
-webkit-tap-highlight-color: transparent; /* 7 */
|
|
2250
|
+
}
|
|
2251
|
+
|
|
2252
|
+
/*
|
|
2253
|
+
1. Remove the margin in all browsers.
|
|
2254
|
+
2. Inherit line-height from \`html\` so users can set them as a class directly on the \`html\` element.
|
|
2255
|
+
*/
|
|
2256
|
+
|
|
2257
|
+
body {
|
|
2258
|
+
margin: 0; /* 1 */
|
|
2259
|
+
line-height: inherit; /* 2 */
|
|
2260
|
+
}
|
|
2261
|
+
|
|
2262
|
+
/*
|
|
2263
|
+
1. Add the correct height in Firefox.
|
|
2264
|
+
2. Correct the inheritance of border color in Firefox. (https://bugzilla.mozilla.org/show_bug.cgi?id=190655)
|
|
2265
|
+
3. Ensure horizontal rules are visible by default.
|
|
2266
|
+
*/
|
|
2267
|
+
|
|
2268
|
+
hr {
|
|
2269
|
+
height: 0; /* 1 */
|
|
2270
|
+
color: inherit; /* 2 */
|
|
2271
|
+
border-top-width: 1px; /* 3 */
|
|
2272
|
+
}
|
|
2273
|
+
|
|
2274
|
+
/*
|
|
2275
|
+
Add the correct text decoration in Chrome, Edge, and Safari.
|
|
2276
|
+
*/
|
|
2277
|
+
|
|
2278
|
+
abbr:where([title]) {
|
|
2279
|
+
-webkit-text-decoration: underline dotted;
|
|
2280
|
+
text-decoration: underline dotted;
|
|
2281
|
+
}
|
|
2282
|
+
|
|
2283
|
+
/*
|
|
2284
|
+
Remove the default font size and weight for headings.
|
|
2285
|
+
*/
|
|
2286
|
+
|
|
2287
|
+
h1,
|
|
2288
|
+
h2,
|
|
2289
|
+
h3,
|
|
2290
|
+
h4,
|
|
2291
|
+
h5,
|
|
2292
|
+
h6 {
|
|
2293
|
+
font-size: inherit;
|
|
2294
|
+
font-weight: inherit;
|
|
2295
|
+
}
|
|
2296
|
+
|
|
2297
|
+
/*
|
|
2298
|
+
Reset links to optimize for opt-in styling instead of opt-out.
|
|
2299
|
+
*/
|
|
2300
|
+
|
|
2301
|
+
a {
|
|
2302
|
+
color: inherit;
|
|
2303
|
+
text-decoration: inherit;
|
|
2304
|
+
}
|
|
2305
|
+
|
|
2306
|
+
/*
|
|
2307
|
+
Add the correct font weight in Edge and Safari.
|
|
2308
|
+
*/
|
|
2309
|
+
|
|
2310
|
+
b,
|
|
2311
|
+
strong {
|
|
2312
|
+
font-weight: bolder;
|
|
2313
|
+
}
|
|
2314
|
+
|
|
2315
|
+
/*
|
|
2316
|
+
1. Use the user's configured \`mono\` font-family by default.
|
|
2317
|
+
2. Use the user's configured \`mono\` font-feature-settings by default.
|
|
2318
|
+
3. Use the user's configured \`mono\` font-variation-settings by default.
|
|
2319
|
+
4. Correct the odd \`em\` font sizing in all browsers.
|
|
2320
|
+
*/
|
|
2321
|
+
|
|
2322
|
+
code,
|
|
2323
|
+
kbd,
|
|
2324
|
+
samp,
|
|
2325
|
+
pre {
|
|
2326
|
+
font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace; /* 1 */
|
|
2327
|
+
font-feature-settings: normal; /* 2 */
|
|
2328
|
+
font-variation-settings: normal; /* 3 */
|
|
2329
|
+
font-size: 1em; /* 4 */
|
|
2330
|
+
}
|
|
2331
|
+
|
|
2332
|
+
/*
|
|
2333
|
+
Add the correct font size in all browsers.
|
|
2334
|
+
*/
|
|
2335
|
+
|
|
2336
|
+
small {
|
|
2337
|
+
font-size: 80%;
|
|
2338
|
+
}
|
|
2339
|
+
|
|
2340
|
+
/*
|
|
2341
|
+
Prevent \`sub\` and \`sup\` elements from affecting the line height in all browsers.
|
|
2342
|
+
*/
|
|
2343
|
+
|
|
2344
|
+
sub,
|
|
2345
|
+
sup {
|
|
2346
|
+
font-size: 75%;
|
|
2347
|
+
line-height: 0;
|
|
2348
|
+
position: relative;
|
|
2349
|
+
vertical-align: baseline;
|
|
2350
|
+
}
|
|
2351
|
+
|
|
2352
|
+
sub {
|
|
2353
|
+
bottom: -0.25em;
|
|
2354
|
+
}
|
|
2355
|
+
|
|
2356
|
+
sup {
|
|
2357
|
+
top: -0.5em;
|
|
2358
|
+
}
|
|
2359
|
+
|
|
2360
|
+
/*
|
|
2361
|
+
1. Remove text indentation from table contents in Chrome and Safari. (https://bugs.chromium.org/p/chromium/issues/detail?id=999088, https://bugs.webkit.org/show_bug.cgi?id=201297)
|
|
2362
|
+
2. Correct table border color inheritance in all Chrome and Safari. (https://bugs.chromium.org/p/chromium/issues/detail?id=935729, https://bugs.webkit.org/show_bug.cgi?id=195016)
|
|
2363
|
+
3. Remove gaps between table borders by default.
|
|
2364
|
+
*/
|
|
2365
|
+
|
|
2366
|
+
table {
|
|
2367
|
+
text-indent: 0; /* 1 */
|
|
2368
|
+
border-color: inherit; /* 2 */
|
|
2369
|
+
border-collapse: collapse; /* 3 */
|
|
2370
|
+
}
|
|
2371
|
+
|
|
2372
|
+
/*
|
|
2373
|
+
1. Change the font styles in all browsers.
|
|
2374
|
+
2. Remove the margin in Firefox and Safari.
|
|
2375
|
+
3. Remove default padding in all browsers.
|
|
2376
|
+
*/
|
|
2377
|
+
|
|
2378
|
+
button,
|
|
2379
|
+
input,
|
|
2380
|
+
optgroup,
|
|
2381
|
+
select,
|
|
2382
|
+
textarea {
|
|
2383
|
+
font-family: inherit; /* 1 */
|
|
2384
|
+
font-feature-settings: inherit; /* 1 */
|
|
2385
|
+
font-variation-settings: inherit; /* 1 */
|
|
2386
|
+
font-size: 100%; /* 1 */
|
|
2387
|
+
font-weight: inherit; /* 1 */
|
|
2388
|
+
line-height: inherit; /* 1 */
|
|
2389
|
+
letter-spacing: inherit; /* 1 */
|
|
2390
|
+
color: inherit; /* 1 */
|
|
2391
|
+
margin: 0; /* 2 */
|
|
2392
|
+
padding: 0; /* 3 */
|
|
2393
|
+
}
|
|
2394
|
+
|
|
2395
|
+
/*
|
|
2396
|
+
Remove the inheritance of text transform in Edge and Firefox.
|
|
2397
|
+
*/
|
|
2398
|
+
|
|
2399
|
+
button,
|
|
2400
|
+
select {
|
|
2401
|
+
text-transform: none;
|
|
2402
|
+
}
|
|
2403
|
+
|
|
2404
|
+
/*
|
|
2405
|
+
1. Correct the inability to style clickable types in iOS and Safari.
|
|
2406
|
+
2. Remove default button styles.
|
|
2407
|
+
*/
|
|
2408
|
+
|
|
2409
|
+
button,
|
|
2410
|
+
input:where([type='button']),
|
|
2411
|
+
input:where([type='reset']),
|
|
2412
|
+
input:where([type='submit']) {
|
|
2413
|
+
-webkit-appearance: button; /* 1 */
|
|
2414
|
+
background-color: transparent; /* 2 */
|
|
2415
|
+
background-image: none; /* 2 */
|
|
2416
|
+
}
|
|
2417
|
+
|
|
2418
|
+
/*
|
|
2419
|
+
Use the modern Firefox focus style for all focusable elements.
|
|
2420
|
+
*/
|
|
2421
|
+
|
|
2422
|
+
:-moz-focusring {
|
|
2423
|
+
outline: auto;
|
|
2424
|
+
}
|
|
2425
|
+
|
|
2426
|
+
/*
|
|
2427
|
+
Remove the additional \`:invalid\` styles in Firefox. (https://github.com/mozilla/gecko-dev/blob/2f9eacd9d3d995c937b4251a5557d95d494c9be1/layout/style/res/forms.css#L728-L737)
|
|
2428
|
+
*/
|
|
2429
|
+
|
|
2430
|
+
:-moz-ui-invalid {
|
|
2431
|
+
box-shadow: none;
|
|
2432
|
+
}
|
|
2433
|
+
|
|
2434
|
+
/*
|
|
2435
|
+
Add the correct vertical alignment in Chrome and Firefox.
|
|
2436
|
+
*/
|
|
2437
|
+
|
|
2438
|
+
progress {
|
|
2439
|
+
vertical-align: baseline;
|
|
2440
|
+
}
|
|
2441
|
+
|
|
2442
|
+
/*
|
|
2443
|
+
Correct the cursor style of increment and decrement buttons in Safari.
|
|
2444
|
+
*/
|
|
2445
|
+
|
|
2446
|
+
::-webkit-inner-spin-button,
|
|
2447
|
+
::-webkit-outer-spin-button {
|
|
2448
|
+
height: auto;
|
|
2449
|
+
}
|
|
2450
|
+
|
|
2451
|
+
/*
|
|
2452
|
+
1. Correct the odd appearance in Chrome and Safari.
|
|
2453
|
+
2. Correct the outline style in Safari.
|
|
2454
|
+
*/
|
|
2455
|
+
|
|
2456
|
+
[type='search'] {
|
|
2457
|
+
-webkit-appearance: textfield; /* 1 */
|
|
2458
|
+
outline-offset: -2px; /* 2 */
|
|
2459
|
+
}
|
|
2460
|
+
|
|
2461
|
+
/*
|
|
2462
|
+
Remove the inner padding in Chrome and Safari on macOS.
|
|
2463
|
+
*/
|
|
2464
|
+
|
|
2465
|
+
::-webkit-search-decoration {
|
|
2466
|
+
-webkit-appearance: none;
|
|
2467
|
+
}
|
|
2468
|
+
|
|
2469
|
+
/*
|
|
2470
|
+
1. Correct the inability to style clickable types in iOS and Safari.
|
|
2471
|
+
2. Change font properties to \`inherit\` in Safari.
|
|
2472
|
+
*/
|
|
2473
|
+
|
|
2474
|
+
::-webkit-file-upload-button {
|
|
2475
|
+
-webkit-appearance: button; /* 1 */
|
|
2476
|
+
font: inherit; /* 2 */
|
|
2477
|
+
}
|
|
2478
|
+
|
|
2479
|
+
/*
|
|
2480
|
+
Add the correct display in Chrome and Safari.
|
|
2481
|
+
*/
|
|
2482
|
+
|
|
2483
|
+
summary {
|
|
2484
|
+
display: list-item;
|
|
2485
|
+
}
|
|
2486
|
+
|
|
2487
|
+
/*
|
|
2488
|
+
Removes the default spacing and border for appropriate elements.
|
|
2489
|
+
*/
|
|
2490
|
+
|
|
2491
|
+
blockquote,
|
|
2492
|
+
dl,
|
|
2493
|
+
dd,
|
|
2494
|
+
h1,
|
|
2495
|
+
h2,
|
|
2496
|
+
h3,
|
|
2497
|
+
h4,
|
|
2498
|
+
h5,
|
|
2499
|
+
h6,
|
|
2500
|
+
hr,
|
|
2501
|
+
figure,
|
|
2502
|
+
p,
|
|
2503
|
+
pre {
|
|
2504
|
+
margin: 0;
|
|
2505
|
+
}
|
|
2506
|
+
|
|
2507
|
+
fieldset {
|
|
2508
|
+
margin: 0;
|
|
2509
|
+
padding: 0;
|
|
2510
|
+
}
|
|
2511
|
+
|
|
2512
|
+
legend {
|
|
2513
|
+
padding: 0;
|
|
2514
|
+
}
|
|
2515
|
+
|
|
2516
|
+
ol,
|
|
2517
|
+
ul,
|
|
2518
|
+
menu {
|
|
2519
|
+
list-style: none;
|
|
2520
|
+
margin: 0;
|
|
2521
|
+
padding: 0;
|
|
2522
|
+
}
|
|
2523
|
+
|
|
2524
|
+
/*
|
|
2525
|
+
Reset default styling for dialogs.
|
|
2526
|
+
*/
|
|
2527
|
+
dialog {
|
|
2528
|
+
padding: 0;
|
|
2529
|
+
}
|
|
2530
|
+
|
|
2531
|
+
/*
|
|
2532
|
+
Prevent resizing textareas horizontally by default.
|
|
2533
|
+
*/
|
|
2534
|
+
|
|
2535
|
+
textarea {
|
|
2536
|
+
resize: vertical;
|
|
2537
|
+
}
|
|
2538
|
+
|
|
2539
|
+
/*
|
|
2540
|
+
1. Reset the default placeholder opacity in Firefox. (https://github.com/tailwindlabs/tailwindcss/issues/3300)
|
|
2541
|
+
2. Set the default placeholder color to the user's configured gray 400 color.
|
|
2542
|
+
*/
|
|
2543
|
+
|
|
2544
|
+
input::-moz-placeholder, textarea::-moz-placeholder {
|
|
2545
|
+
opacity: 1; /* 1 */
|
|
2546
|
+
color: #9ca3af; /* 2 */
|
|
2547
|
+
}
|
|
2548
|
+
|
|
2549
|
+
input::placeholder,
|
|
2550
|
+
textarea::placeholder {
|
|
2551
|
+
opacity: 1; /* 1 */
|
|
2552
|
+
color: #9ca3af; /* 2 */
|
|
2553
|
+
}
|
|
2554
|
+
|
|
2555
|
+
/*
|
|
2556
|
+
Set the default cursor for buttons.
|
|
2557
|
+
*/
|
|
2558
|
+
|
|
2559
|
+
button,
|
|
2560
|
+
[role="button"] {
|
|
2561
|
+
cursor: pointer;
|
|
2562
|
+
}
|
|
2563
|
+
|
|
2564
|
+
/*
|
|
2565
|
+
Make sure disabled buttons don't get the pointer cursor.
|
|
2566
|
+
*/
|
|
2567
|
+
:disabled {
|
|
2568
|
+
cursor: default;
|
|
2569
|
+
}
|
|
2570
|
+
|
|
2571
|
+
/*
|
|
2572
|
+
1. Make replaced elements \`display: block\` by default. (https://github.com/mozdevs/cssremedy/issues/14)
|
|
2573
|
+
2. Add \`vertical-align: middle\` to align replaced elements more sensibly by default. (https://github.com/jensimmons/cssremedy/issues/14#issuecomment-634934210)
|
|
2574
|
+
This can trigger a poorly considered lint error in some tools but is included by design.
|
|
2575
|
+
*/
|
|
2576
|
+
|
|
2577
|
+
img,
|
|
2578
|
+
svg,
|
|
2579
|
+
video,
|
|
2580
|
+
canvas,
|
|
2581
|
+
audio,
|
|
2582
|
+
iframe,
|
|
2583
|
+
embed,
|
|
2584
|
+
object {
|
|
2585
|
+
display: block; /* 1 */
|
|
2586
|
+
vertical-align: middle; /* 2 */
|
|
2587
|
+
}
|
|
2588
|
+
|
|
2589
|
+
/*
|
|
2590
|
+
Constrain images and videos to the parent width and preserve their intrinsic aspect ratio. (https://github.com/mozdevs/cssremedy/issues/14)
|
|
2591
|
+
*/
|
|
2592
|
+
|
|
2593
|
+
img,
|
|
2594
|
+
video {
|
|
2595
|
+
max-width: 100%;
|
|
2596
|
+
height: auto;
|
|
2597
|
+
}
|
|
2598
|
+
|
|
2599
|
+
/* Make elements with the HTML hidden attribute stay hidden by default */
|
|
2600
|
+
[hidden]:where(:not([hidden="until-found"])) {
|
|
2601
|
+
display: none;
|
|
2602
|
+
}
|
|
2603
|
+
.container {
|
|
2604
|
+
width: 100%;
|
|
2605
|
+
}
|
|
2606
|
+
.pointer-events-none {
|
|
2607
|
+
pointer-events: none;
|
|
2608
|
+
}
|
|
2609
|
+
.visible {
|
|
2610
|
+
visibility: visible;
|
|
2611
|
+
}
|
|
2612
|
+
.static {
|
|
2613
|
+
position: static;
|
|
2614
|
+
}
|
|
2615
|
+
.fixed {
|
|
2616
|
+
position: fixed;
|
|
2617
|
+
}
|
|
2618
|
+
.absolute {
|
|
2619
|
+
position: absolute;
|
|
2620
|
+
}
|
|
2621
|
+
.relative {
|
|
2622
|
+
position: relative;
|
|
2623
|
+
}
|
|
2624
|
+
.top-0 {
|
|
2625
|
+
top: 0px;
|
|
2626
|
+
}
|
|
2627
|
+
.my-2 {
|
|
2628
|
+
margin-top: 0.5rem;
|
|
2629
|
+
margin-bottom: 0.5rem;
|
|
2630
|
+
}
|
|
2631
|
+
.mb-4 {
|
|
2632
|
+
margin-bottom: 1rem;
|
|
2633
|
+
}
|
|
2634
|
+
.ml-2 {
|
|
2635
|
+
margin-left: 0.5rem;
|
|
2636
|
+
}
|
|
2637
|
+
.mr-2 {
|
|
2638
|
+
margin-right: 0.5rem;
|
|
2639
|
+
}
|
|
2640
|
+
.mt-1 {
|
|
2641
|
+
margin-top: 0.25rem;
|
|
2642
|
+
}
|
|
2643
|
+
.mt-2 {
|
|
2644
|
+
margin-top: 0.5rem;
|
|
2645
|
+
}
|
|
2646
|
+
.block {
|
|
2647
|
+
display: block;
|
|
2648
|
+
}
|
|
2649
|
+
.inline-block {
|
|
2650
|
+
display: inline-block;
|
|
2651
|
+
}
|
|
2652
|
+
.flex {
|
|
2653
|
+
display: flex;
|
|
2654
|
+
}
|
|
2655
|
+
.hidden {
|
|
2656
|
+
display: none;
|
|
2657
|
+
}
|
|
2658
|
+
.h-12 {
|
|
2659
|
+
height: 3rem;
|
|
2660
|
+
}
|
|
2661
|
+
.h-4 {
|
|
2662
|
+
height: 1rem;
|
|
2663
|
+
}
|
|
2664
|
+
.h-auto {
|
|
2665
|
+
height: auto;
|
|
2666
|
+
}
|
|
2667
|
+
.h-full {
|
|
2668
|
+
height: 100%;
|
|
2669
|
+
}
|
|
2670
|
+
.max-h-\\[300px\\] {
|
|
2671
|
+
max-height: 300px;
|
|
2672
|
+
}
|
|
2673
|
+
.min-h-0 {
|
|
2674
|
+
min-height: 0px;
|
|
2675
|
+
}
|
|
2676
|
+
.min-h-screen {
|
|
2677
|
+
min-height: 100vh;
|
|
2678
|
+
}
|
|
2679
|
+
.w-4 {
|
|
2680
|
+
width: 1rem;
|
|
2681
|
+
}
|
|
2682
|
+
.w-full {
|
|
2683
|
+
width: 100%;
|
|
2684
|
+
}
|
|
2685
|
+
.max-w-\\[400px\\] {
|
|
2686
|
+
max-width: 400px;
|
|
2687
|
+
}
|
|
2688
|
+
.flex-1 {
|
|
2689
|
+
flex: 1 1 0%;
|
|
2690
|
+
}
|
|
2691
|
+
.flex-shrink-0 {
|
|
2692
|
+
flex-shrink: 0;
|
|
2693
|
+
}
|
|
2694
|
+
.transform {
|
|
2695
|
+
transform: translate(var(--tw-translate-x), var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y));
|
|
2696
|
+
}
|
|
2697
|
+
@keyframes spin {
|
|
2698
|
+
|
|
2699
|
+
to {
|
|
2700
|
+
transform: rotate(360deg);
|
|
2701
|
+
}
|
|
2702
|
+
}
|
|
2703
|
+
.animate-spin {
|
|
2704
|
+
animation: spin 1s linear infinite;
|
|
2705
|
+
}
|
|
2706
|
+
.flex-col {
|
|
2707
|
+
flex-direction: column;
|
|
2708
|
+
}
|
|
2709
|
+
.flex-wrap {
|
|
2710
|
+
flex-wrap: wrap;
|
|
2711
|
+
}
|
|
2712
|
+
.items-center {
|
|
2713
|
+
align-items: center;
|
|
2714
|
+
}
|
|
2715
|
+
.justify-center {
|
|
2716
|
+
justify-content: center;
|
|
2717
|
+
}
|
|
2718
|
+
.gap-2 {
|
|
2719
|
+
gap: 0.5rem;
|
|
2720
|
+
}
|
|
2721
|
+
.overflow-y-auto {
|
|
2722
|
+
overflow-y: auto;
|
|
2723
|
+
}
|
|
2724
|
+
.whitespace-pre {
|
|
2725
|
+
white-space: pre;
|
|
2726
|
+
}
|
|
2727
|
+
.rounded {
|
|
2728
|
+
border-radius: 0.25rem;
|
|
2729
|
+
}
|
|
2730
|
+
.rounded-full {
|
|
2731
|
+
border-radius: 9999px;
|
|
2732
|
+
}
|
|
2733
|
+
.rounded-lg {
|
|
2734
|
+
border-radius: 0.5rem;
|
|
2735
|
+
}
|
|
2736
|
+
.border {
|
|
2737
|
+
border-width: 1px;
|
|
2738
|
+
}
|
|
2739
|
+
.border-2 {
|
|
2740
|
+
border-width: 2px;
|
|
2741
|
+
}
|
|
2742
|
+
.border-t {
|
|
2743
|
+
border-top-width: 1px;
|
|
2744
|
+
}
|
|
2745
|
+
.border-gray-300 {
|
|
2746
|
+
--tw-border-opacity: 1;
|
|
2747
|
+
border-color: rgb(209 213 219 / var(--tw-border-opacity, 1));
|
|
2748
|
+
}
|
|
2749
|
+
.border-gray-700 {
|
|
2750
|
+
--tw-border-opacity: 1;
|
|
2751
|
+
border-color: rgb(55 65 81 / var(--tw-border-opacity, 1));
|
|
2752
|
+
}
|
|
2753
|
+
.border-t-gray-600 {
|
|
2754
|
+
--tw-border-opacity: 1;
|
|
2755
|
+
border-top-color: rgb(75 85 99 / var(--tw-border-opacity, 1));
|
|
2756
|
+
}
|
|
2757
|
+
.bg-gray-100 {
|
|
2758
|
+
--tw-bg-opacity: 1;
|
|
2759
|
+
background-color: rgb(243 244 246 / var(--tw-bg-opacity, 1));
|
|
2760
|
+
}
|
|
2761
|
+
.bg-gray-800 {
|
|
2762
|
+
--tw-bg-opacity: 1;
|
|
2763
|
+
background-color: rgb(31 41 55 / var(--tw-bg-opacity, 1));
|
|
2764
|
+
}
|
|
2765
|
+
.bg-gray-900 {
|
|
2766
|
+
--tw-bg-opacity: 1;
|
|
2767
|
+
background-color: rgb(17 24 39 / var(--tw-bg-opacity, 1));
|
|
2768
|
+
}
|
|
2769
|
+
.bg-green-500 {
|
|
2770
|
+
--tw-bg-opacity: 1;
|
|
2771
|
+
background-color: rgb(34 197 94 / var(--tw-bg-opacity, 1));
|
|
2772
|
+
}
|
|
2773
|
+
.bg-red-500 {
|
|
2774
|
+
--tw-bg-opacity: 1;
|
|
2775
|
+
background-color: rgb(239 68 68 / var(--tw-bg-opacity, 1));
|
|
2776
|
+
}
|
|
2777
|
+
.bg-transparent {
|
|
2778
|
+
background-color: transparent;
|
|
2779
|
+
}
|
|
2780
|
+
.bg-white {
|
|
2781
|
+
--tw-bg-opacity: 1;
|
|
2782
|
+
background-color: rgb(255 255 255 / var(--tw-bg-opacity, 1));
|
|
2783
|
+
}
|
|
2784
|
+
.object-contain {
|
|
2785
|
+
-o-object-fit: contain;
|
|
2786
|
+
object-fit: contain;
|
|
2787
|
+
}
|
|
2788
|
+
.p-3 {
|
|
2789
|
+
padding: 0.75rem;
|
|
2790
|
+
}
|
|
2791
|
+
.p-4 {
|
|
2792
|
+
padding: 1rem;
|
|
2793
|
+
}
|
|
2794
|
+
.p-6 {
|
|
2795
|
+
padding: 1.5rem;
|
|
2796
|
+
}
|
|
2797
|
+
.px-2 {
|
|
2798
|
+
padding-left: 0.5rem;
|
|
2799
|
+
padding-right: 0.5rem;
|
|
2800
|
+
}
|
|
2801
|
+
.px-4 {
|
|
2802
|
+
padding-left: 1rem;
|
|
2803
|
+
padding-right: 1rem;
|
|
2804
|
+
}
|
|
2805
|
+
.py-1 {
|
|
2806
|
+
padding-top: 0.25rem;
|
|
2807
|
+
padding-bottom: 0.25rem;
|
|
2808
|
+
}
|
|
2809
|
+
.pt-2 {
|
|
2810
|
+
padding-top: 0.5rem;
|
|
2811
|
+
}
|
|
2812
|
+
.pt-3 {
|
|
2813
|
+
padding-top: 0.75rem;
|
|
2814
|
+
}
|
|
2815
|
+
.text-left {
|
|
2816
|
+
text-align: left;
|
|
2817
|
+
}
|
|
2818
|
+
.font-mono {
|
|
2819
|
+
font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
|
|
2820
|
+
}
|
|
2821
|
+
.text-base {
|
|
2822
|
+
font-size: 1rem;
|
|
2823
|
+
line-height: 1.5rem;
|
|
2824
|
+
}
|
|
2825
|
+
.text-lg {
|
|
2826
|
+
font-size: 1.125rem;
|
|
2827
|
+
line-height: 1.75rem;
|
|
2828
|
+
}
|
|
2829
|
+
.text-sm {
|
|
2830
|
+
font-size: 0.875rem;
|
|
2831
|
+
line-height: 1.25rem;
|
|
2832
|
+
}
|
|
2833
|
+
.text-xs {
|
|
2834
|
+
font-size: 0.75rem;
|
|
2835
|
+
line-height: 1rem;
|
|
2836
|
+
}
|
|
2837
|
+
.text-blue-400 {
|
|
2838
|
+
--tw-text-opacity: 1;
|
|
2839
|
+
color: rgb(96 165 250 / var(--tw-text-opacity, 1));
|
|
2840
|
+
}
|
|
2841
|
+
.text-gray-200 {
|
|
2842
|
+
--tw-text-opacity: 1;
|
|
2843
|
+
color: rgb(229 231 235 / var(--tw-text-opacity, 1));
|
|
2844
|
+
}
|
|
2845
|
+
.text-gray-300 {
|
|
2846
|
+
--tw-text-opacity: 1;
|
|
2847
|
+
color: rgb(209 213 219 / var(--tw-text-opacity, 1));
|
|
2848
|
+
}
|
|
2849
|
+
.text-gray-400 {
|
|
2850
|
+
--tw-text-opacity: 1;
|
|
2851
|
+
color: rgb(156 163 175 / var(--tw-text-opacity, 1));
|
|
2852
|
+
}
|
|
2853
|
+
.text-gray-500 {
|
|
2854
|
+
--tw-text-opacity: 1;
|
|
2855
|
+
color: rgb(107 114 128 / var(--tw-text-opacity, 1));
|
|
2856
|
+
}
|
|
2857
|
+
.text-gray-700 {
|
|
2858
|
+
--tw-text-opacity: 1;
|
|
2859
|
+
color: rgb(55 65 81 / var(--tw-text-opacity, 1));
|
|
2860
|
+
}
|
|
2861
|
+
.text-green-500 {
|
|
2862
|
+
--tw-text-opacity: 1;
|
|
2863
|
+
color: rgb(34 197 94 / var(--tw-text-opacity, 1));
|
|
2864
|
+
}
|
|
2865
|
+
.text-red-400 {
|
|
2866
|
+
--tw-text-opacity: 1;
|
|
2867
|
+
color: rgb(248 113 113 / var(--tw-text-opacity, 1));
|
|
2868
|
+
}
|
|
2869
|
+
.text-red-500 {
|
|
2870
|
+
--tw-text-opacity: 1;
|
|
2871
|
+
color: rgb(239 68 68 / var(--tw-text-opacity, 1));
|
|
2872
|
+
}
|
|
2873
|
+
.text-white {
|
|
2874
|
+
--tw-text-opacity: 1;
|
|
2875
|
+
color: rgb(255 255 255 / var(--tw-text-opacity, 1));
|
|
2876
|
+
}
|
|
2877
|
+
.underline {
|
|
2878
|
+
text-decoration-line: underline;
|
|
2879
|
+
}
|
|
2880
|
+
.caret-transparent {
|
|
2881
|
+
caret-color: transparent;
|
|
2882
|
+
}
|
|
2883
|
+
.shadow {
|
|
2884
|
+
--tw-shadow: 0 1px 3px 0 rgb(0 0 0 / 0.1), 0 1px 2px -1px rgb(0 0 0 / 0.1);
|
|
2885
|
+
--tw-shadow-colored: 0 1px 3px 0 var(--tw-shadow-color), 0 1px 2px -1px var(--tw-shadow-color);
|
|
2886
|
+
box-shadow: var(--tw-ring-offset-shadow, 0 0 #0000), var(--tw-ring-shadow, 0 0 #0000), var(--tw-shadow);
|
|
2887
|
+
}
|
|
2888
|
+
.shadow-lg {
|
|
2889
|
+
--tw-shadow: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
|
|
2890
|
+
--tw-shadow-colored: 0 10px 15px -3px var(--tw-shadow-color), 0 4px 6px -4px var(--tw-shadow-color);
|
|
2891
|
+
box-shadow: var(--tw-ring-offset-shadow, 0 0 #0000), var(--tw-ring-shadow, 0 0 #0000), var(--tw-shadow);
|
|
2892
|
+
}
|
|
2893
|
+
.outline-none {
|
|
2894
|
+
outline: 2px solid transparent;
|
|
2895
|
+
outline-offset: 2px;
|
|
2896
|
+
}
|
|
2897
|
+
.filter {
|
|
2898
|
+
filter: var(--tw-blur) var(--tw-brightness) var(--tw-contrast) var(--tw-grayscale) var(--tw-hue-rotate) var(--tw-invert) var(--tw-saturate) var(--tw-sepia) var(--tw-drop-shadow);
|
|
2899
|
+
}
|
|
2900
|
+
.transition {
|
|
2901
|
+
transition-property: color, background-color, border-color, text-decoration-color, fill, stroke, opacity, box-shadow, transform, filter, -webkit-backdrop-filter;
|
|
2902
|
+
transition-property: color, background-color, border-color, text-decoration-color, fill, stroke, opacity, box-shadow, transform, filter, backdrop-filter;
|
|
2903
|
+
transition-property: color, background-color, border-color, text-decoration-color, fill, stroke, opacity, box-shadow, transform, filter, backdrop-filter, -webkit-backdrop-filter;
|
|
2904
|
+
transition-timing-function: cubic-bezier(0.4, 0, 0.2, 1);
|
|
2905
|
+
transition-duration: 150ms;
|
|
2906
|
+
}
|
|
2907
|
+
.ease-in-out {
|
|
2908
|
+
transition-timing-function: cubic-bezier(0.4, 0, 0.2, 1);
|
|
2909
|
+
}
|
|
2910
|
+
.ease-out {
|
|
2911
|
+
transition-timing-function: cubic-bezier(0, 0, 0.2, 1);
|
|
2912
|
+
}
|
|
2913
|
+
.last\\:mb-0:last-child {
|
|
2914
|
+
margin-bottom: 0px;
|
|
2915
|
+
}
|
|
2916
|
+
.last\\:mr-0:last-child {
|
|
2917
|
+
margin-right: 0px;
|
|
2918
|
+
}
|
|
2919
|
+
`, Pt = ({
|
|
2920
|
+
config: r = F,
|
|
2921
|
+
commands: n = {},
|
|
2922
|
+
containerId: t = null
|
|
2923
|
+
}) => ($(() => {
|
|
2924
|
+
const o = new hn(n, r), i = t ? document.getElementById(t) : document.body;
|
|
2925
|
+
return i ? i.appendChild(o) : (console.warn(`Container with id "${t}" not found, falling back to body`), document.body.appendChild(o)), () => {
|
|
2926
|
+
var a;
|
|
2927
|
+
(a = o.parentElement) == null || a.removeChild(o);
|
|
2928
|
+
};
|
|
2929
|
+
}, [n, t]), null);
|
|
2930
|
+
class hn extends HTMLElement {
|
|
2931
|
+
constructor(t, o) {
|
|
2932
|
+
super();
|
|
2933
|
+
A(this, "shadow");
|
|
2934
|
+
A(this, "root", null);
|
|
2935
|
+
A(this, "commands");
|
|
2936
|
+
A(this, "config");
|
|
2937
|
+
this.shadow = this.attachShadow({ mode: "open" }), this.commands = t, this.config = o;
|
|
2938
|
+
}
|
|
2939
|
+
connectedCallback() {
|
|
2940
|
+
try {
|
|
2941
|
+
const o = [on, an, sn, Et].map((i) => {
|
|
2942
|
+
const a = new CSSStyleSheet();
|
|
2943
|
+
return a.replaceSync(i), a;
|
|
2944
|
+
});
|
|
2945
|
+
this.shadow.adoptedStyleSheets = [...o];
|
|
2946
|
+
} catch {
|
|
2947
|
+
const i = [on, an, sn].join(`
|
|
2948
|
+
`), a = document.createElement("style");
|
|
2949
|
+
a.textContent = i, this.shadow.appendChild(a);
|
|
2950
|
+
}
|
|
2951
|
+
const t = document.createElement("div");
|
|
2952
|
+
t.id = "citadel-root", this.shadow.appendChild(t), this.root = ke(t), this.root.render(
|
|
2953
|
+
/* @__PURE__ */ g.jsx(it, { config: this.config || F, commands: this.commands, children: /* @__PURE__ */ g.jsx(Rt, {}) })
|
|
2954
|
+
);
|
|
2955
|
+
}
|
|
2956
|
+
// disconnectedCallback() {
|
|
2957
|
+
// if (this.root) {
|
|
2958
|
+
// this.root.unmount();
|
|
2959
|
+
// this.root = null;
|
|
2960
|
+
// }
|
|
2961
|
+
// }
|
|
2962
|
+
}
|
|
2963
|
+
customElements.define("citadel-element", hn);
|
|
2964
|
+
const Rt = () => {
|
|
2965
|
+
const [r, n] = Y(!1), [t, o] = Y(!1), [i, a] = Y(null), l = J(null), d = J(null), h = J(!1), w = J(0), m = J(0), p = G(), { state: u, actions: y, getAvailableCommands: v } = ht(), b = j((S) => {
|
|
2966
|
+
d.current && (h.current = !0, w.current = S.clientY, m.current = d.current.offsetHeight, document.documentElement.style.userSelect = "none", document.documentElement.style.webkitUserSelect = "none", document.documentElement.style.mozUserSelect = "none", document.documentElement.style.msUserSelect = "none", document.addEventListener("mousemove", C), document.addEventListener("mouseup", f));
|
|
2967
|
+
}, []), C = j((S) => {
|
|
2968
|
+
var U;
|
|
2969
|
+
if (!h.current) return;
|
|
2970
|
+
const I = S.clientY - w.current, T = (U = p.maxHeight) != null && U.endsWith("vh") ? window.innerHeight * parseInt(p.maxHeight, 10) / 100 : parseInt(p.maxHeight || "80vh", 10), D = Math.min(
|
|
2971
|
+
Math.max(m.current - I, parseInt(p.minHeight || "200", 10)),
|
|
2972
|
+
T
|
|
2973
|
+
);
|
|
2974
|
+
d.current && (d.current.style.height = `${D}px`, d.current.style.bottom = "0", a(D));
|
|
2975
|
+
}, [p.maxHeight]), f = j(() => {
|
|
2976
|
+
h.current = !1, document.documentElement.style.userSelect = "", document.documentElement.style.webkitUserSelect = "", document.documentElement.style.mozUserSelect = "", document.documentElement.style.msUserSelect = "", document.removeEventListener("mousemove", C), document.removeEventListener("mouseup", f);
|
|
2977
|
+
}, []);
|
|
2978
|
+
$(() => () => {
|
|
2979
|
+
document.removeEventListener("mousemove", C), document.removeEventListener("mouseup", f);
|
|
2980
|
+
}, [C, f]), Gn({
|
|
2981
|
+
onOpen: () => n(!0),
|
|
2982
|
+
onClose: () => o(!0),
|
|
2983
|
+
isVisible: r,
|
|
2984
|
+
showCitadelKey: p.showCitadelKey || "."
|
|
2985
|
+
});
|
|
2986
|
+
const _ = j(() => {
|
|
2987
|
+
t && (n(!1), o(!1));
|
|
2988
|
+
}, [t]);
|
|
2989
|
+
return rt({
|
|
2990
|
+
isVisible: r,
|
|
2991
|
+
isClosing: t,
|
|
2992
|
+
onAnimationComplete: _
|
|
2993
|
+
}), r ? /* @__PURE__ */ g.jsxs(
|
|
2994
|
+
"div",
|
|
2995
|
+
{
|
|
2996
|
+
ref: d,
|
|
2997
|
+
className: `container ${r ? "citadel_slideUp" : ""} ${t ? "citadel_slideDown" : ""}`,
|
|
2998
|
+
style: {
|
|
2999
|
+
...i ? { height: `${i}px` } : void 0,
|
|
3000
|
+
maxHeight: p.maxHeight
|
|
3001
|
+
},
|
|
3002
|
+
children: [
|
|
3003
|
+
/* @__PURE__ */ g.jsx("div", { className: "resizeHandle", onMouseDown: b }),
|
|
3004
|
+
/* @__PURE__ */ g.jsxs("div", { className: "innerContainer", children: [
|
|
3005
|
+
/* @__PURE__ */ g.jsx("div", { className: "flex-1 min-h-0 pt-3 px-4", children: /* @__PURE__ */ g.jsx(St, { output: u.output, outputRef: l }) }),
|
|
3006
|
+
/* @__PURE__ */ g.jsxs("div", { children: [
|
|
3007
|
+
/* @__PURE__ */ g.jsx(
|
|
3008
|
+
xt,
|
|
3009
|
+
{
|
|
3010
|
+
state: u,
|
|
3011
|
+
actions: y,
|
|
3012
|
+
availableCommands: v()
|
|
3013
|
+
}
|
|
3014
|
+
),
|
|
3015
|
+
/* @__PURE__ */ g.jsx(
|
|
3016
|
+
kt,
|
|
3017
|
+
{
|
|
3018
|
+
state: u,
|
|
3019
|
+
availableCommands: v()
|
|
3020
|
+
}
|
|
3021
|
+
)
|
|
3022
|
+
] })
|
|
3023
|
+
] })
|
|
3024
|
+
]
|
|
3025
|
+
}
|
|
3026
|
+
) : null;
|
|
3027
|
+
};
|
|
3028
|
+
export {
|
|
3029
|
+
Pt as Citadel,
|
|
3030
|
+
X as CommandResult,
|
|
3031
|
+
ae as CommandStatus,
|
|
3032
|
+
pt as DEFAULT_CURSOR_CONFIGS,
|
|
3033
|
+
lt as ErrorCommandResult,
|
|
3034
|
+
At as ImageCommandResult,
|
|
3035
|
+
It as JsonCommandResult,
|
|
3036
|
+
dt as OutputItem,
|
|
3037
|
+
ct as PendingCommandResult,
|
|
3038
|
+
un as TextCommandResult
|
|
3039
|
+
};
|