citadel_cli 1.1.0 → 1.1.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +17 -19
- package/dist/App.d.ts +2 -0
- package/dist/citadel.css +1 -1
- package/dist/citadel.es.js +760 -1386
- package/dist/citadel.umd.js +18 -38
- package/dist/{src/components → components}/Citadel/Citadel.d.ts +1 -1
- package/dist/{src/components → components}/Citadel/config/CitadelConfigContext.d.ts +9 -5
- package/dist/components/Citadel/config/hooks.d.ts +4 -0
- package/dist/{src/components → components}/Citadel/hooks/useCommandParser.d.ts +1 -1
- package/dist/{src/components → components}/Citadel/types/command-registry.d.ts +5 -1
- package/dist/{src/components → components}/Citadel/types/command-results.d.ts +2 -2
- package/dist/{src/components → components}/Citadel/types/help-command.d.ts +1 -1
- package/dist/{src/components → components}/Citadel/utils/logger.d.ts +5 -5
- package/dist/index.d.ts +4 -2
- package/package.json +10 -3
- package/dist/command_examples/basic-commands.d.ts +0 -2
- package/dist/dist/styles.css +0 -789
- package/dist/src/App.d.ts +0 -4
- package/dist/src/components/Citadel/commands/history-commands.d.ts +0 -2
- package/dist/src/components/Citadel/hooks/__tests__/useCommandTrie.test.d.ts +0 -1
- package/dist/src/components/Citadel/hooks/useCommandTrie.d.ts +0 -2
- package/dist/src/components/Citadel/types/__tests__/command-trie.test.d.ts +0 -1
- package/dist/src/components/Citadel/types/command-context.d.ts +0 -4
- package/dist/src/components/Citadel/types/command-trie.d.ts +0 -84
- package/dist/src/components/Citadel/utils/keySimulation.d.ts +0 -2
- package/dist/src/index.d.ts +0 -3
- /package/dist/{src/__test-utils__ → __test-utils__}/factories.d.ts +0 -0
- /package/dist/{src/components → components}/Citadel/Cursor.d.ts +0 -0
- /package/dist/{src/components → components}/Citadel/__tests__/Citadel.test.d.ts +0 -0
- /package/dist/{src/components → components}/Citadel/components/AvailableCommands.d.ts +0 -0
- /package/dist/{src/components → components}/Citadel/components/CommandInput.d.ts +0 -0
- /package/dist/{src/components → components}/Citadel/components/CommandOutput.d.ts +0 -0
- /package/dist/{src/components → components}/Citadel/components/CommandOutputLine.d.ts +0 -0
- /package/dist/{src/components → components}/Citadel/components/Spinner.d.ts +0 -0
- /package/dist/{src/components → components}/Citadel/components/__tests__/AvailableCommands.test.d.ts +0 -0
- /package/dist/{src/components → components}/Citadel/components/__tests__/CommandInput.test.d.ts +0 -0
- /package/dist/{src/components → components}/Citadel/components/__tests__/CommandOutput.test.d.ts +0 -0
- /package/dist/{src/components → components}/Citadel/components/__tests__/CommandOutputLine.test.d.ts +0 -0
- /package/dist/{src/components → components}/Citadel/components/__tests__/Spinner.test.d.ts +0 -0
- /package/dist/{src/components → components}/Citadel/config/__tests__/CitadelConfigContext.test.d.ts +0 -0
- /package/dist/{src/components → components}/Citadel/config/defaults.d.ts +0 -0
- /package/dist/{src/components → components}/Citadel/config/types.d.ts +0 -0
- /package/dist/{src/components → components}/Citadel/hooks/__tests__/useCitadelState.test.d.ts +0 -0
- /package/dist/{src/components → components}/Citadel/hooks/__tests__/useCommandHistory.test.d.ts +0 -0
- /package/dist/{src/components → components}/Citadel/hooks/__tests__/useCommandParser.test.d.ts +0 -0
- /package/dist/{src/components → components}/Citadel/hooks/useCitadelState.d.ts +0 -0
- /package/dist/{src/components → components}/Citadel/hooks/useCommandHistory.d.ts +0 -0
- /package/dist/{src/components → components}/Citadel/hooks/useGlobalShortcut.d.ts +0 -0
- /package/dist/{src/components → components}/Citadel/hooks/useSegmentStack.d.ts +0 -0
- /package/dist/{src/components → components}/Citadel/hooks/useSegmentStackVersion.d.ts +0 -0
- /package/dist/{src/components → components}/Citadel/hooks/useSlideAnimation.d.ts +0 -0
- /package/dist/{src/components → components}/Citadel/index.d.ts +0 -0
- /package/dist/{src/components → components}/Citadel/services/HistoryService.d.ts +0 -0
- /package/dist/{src/components → components}/Citadel/storage/BaseStorage.d.ts +0 -0
- /package/dist/{src/components → components}/Citadel/storage/LocalStorage.d.ts +0 -0
- /package/dist/{src/components → components}/Citadel/storage/MemoryStorage.d.ts +0 -0
- /package/dist/{src/components → components}/Citadel/storage/StorageFactory.d.ts +0 -0
- /package/dist/{src/components → components}/Citadel/storage/__tests__/LocalStorage.test.d.ts +0 -0
- /package/dist/{src/components → components}/Citadel/storage/__tests__/MemoryStorage.test.d.ts +0 -0
- /package/dist/{src/components → components}/Citadel/types/__tests__/command-registry.test.d.ts +0 -0
- /package/dist/{src/components → components}/Citadel/types/__tests__/segment-stack.test.d.ts +0 -0
- /package/dist/{src/components → components}/Citadel/types/cursor.d.ts +0 -0
- /package/dist/{src/components → components}/Citadel/types/index.d.ts +0 -0
- /package/dist/{src/components → components}/Citadel/types/segment-stack.d.ts +0 -0
- /package/dist/{src/components → components}/Citadel/types/state.d.ts +0 -0
- /package/dist/{src/components → components}/Citadel/types/storage.d.ts +0 -0
- /package/dist/{src/main.d.ts → main.d.ts} +0 -0
- /package/dist/{src/test → test}/setup.d.ts +0 -0
package/dist/citadel.es.js
CHANGED
|
@@ -1,689 +1,47 @@
|
|
|
1
|
-
var
|
|
2
|
-
var
|
|
3
|
-
var
|
|
4
|
-
import
|
|
5
|
-
import
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
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 on;
|
|
17
|
-
function rt() {
|
|
18
|
-
if (on) return ae;
|
|
19
|
-
on = 1;
|
|
20
|
-
var o = Z, n = Symbol.for("react.element"), t = Symbol.for("react.fragment"), r = Object.prototype.hasOwnProperty, i = o.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner, s = { key: !0, ref: !0, __self: !0, __source: !0 };
|
|
21
|
-
function p(d, u, f) {
|
|
22
|
-
var w, g = {}, v = null, O = null;
|
|
23
|
-
f !== void 0 && (v = "" + f), u.key !== void 0 && (v = "" + u.key), u.ref !== void 0 && (O = u.ref);
|
|
24
|
-
for (w in u) r.call(u, w) && !s.hasOwnProperty(w) && (g[w] = u[w]);
|
|
25
|
-
if (d && d.defaultProps) for (w in u = d.defaultProps, u) g[w] === void 0 && (g[w] = u[w]);
|
|
26
|
-
return { $$typeof: n, type: d, key: v, ref: O, props: g, _owner: i.current };
|
|
27
|
-
}
|
|
28
|
-
return ae.Fragment = t, ae.jsx = p, ae.jsxs = p, ae;
|
|
29
|
-
}
|
|
30
|
-
var se = {};
|
|
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 an;
|
|
41
|
-
function ot() {
|
|
42
|
-
return an || (an = 1, process.env.NODE_ENV !== "production" && function() {
|
|
43
|
-
var o = Z, n = Symbol.for("react.element"), t = Symbol.for("react.portal"), r = Symbol.for("react.fragment"), i = Symbol.for("react.strict_mode"), s = Symbol.for("react.profiler"), p = Symbol.for("react.provider"), d = Symbol.for("react.context"), u = Symbol.for("react.forward_ref"), f = Symbol.for("react.suspense"), w = Symbol.for("react.suspense_list"), g = Symbol.for("react.memo"), v = Symbol.for("react.lazy"), O = Symbol.for("react.offscreen"), k = Symbol.iterator, D = "@@iterator";
|
|
44
|
-
function U(e) {
|
|
45
|
-
if (e === null || typeof e != "object")
|
|
46
|
-
return null;
|
|
47
|
-
var a = k && e[k] || e[D];
|
|
48
|
-
return typeof a == "function" ? a : null;
|
|
49
|
-
}
|
|
50
|
-
var c = o.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;
|
|
51
|
-
function h(e) {
|
|
52
|
-
{
|
|
53
|
-
for (var a = arguments.length, l = new Array(a > 1 ? a - 1 : 0), b = 1; b < a; b++)
|
|
54
|
-
l[b - 1] = arguments[b];
|
|
55
|
-
E("error", e, l);
|
|
56
|
-
}
|
|
57
|
-
}
|
|
58
|
-
function E(e, a, l) {
|
|
59
|
-
{
|
|
60
|
-
var b = c.ReactDebugCurrentFrame, S = b.getStackAddendum();
|
|
61
|
-
S !== "" && (a += "%s", l = l.concat([S]));
|
|
62
|
-
var _ = l.map(function(C) {
|
|
63
|
-
return String(C);
|
|
64
|
-
});
|
|
65
|
-
_.unshift("Warning: " + a), Function.prototype.apply.call(console[e], console, _);
|
|
66
|
-
}
|
|
67
|
-
}
|
|
68
|
-
var x = !1, R = !1, V = !1, z = !1, H = !1, K;
|
|
69
|
-
K = Symbol.for("react.module.reference");
|
|
70
|
-
function ne(e) {
|
|
71
|
-
return !!(typeof e == "string" || typeof e == "function" || e === r || e === s || H || e === i || e === f || e === w || z || e === O || x || R || V || typeof e == "object" && e !== null && (e.$$typeof === v || e.$$typeof === g || e.$$typeof === p || e.$$typeof === d || e.$$typeof === u || // 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 === K || e.getModuleId !== void 0));
|
|
76
|
-
}
|
|
77
|
-
function _n(e, a, l) {
|
|
78
|
-
var b = e.displayName;
|
|
79
|
-
if (b)
|
|
80
|
-
return b;
|
|
81
|
-
var S = a.displayName || a.name || "";
|
|
82
|
-
return S !== "" ? l + "(" + S + ")" : l;
|
|
83
|
-
}
|
|
84
|
-
function De(e) {
|
|
85
|
-
return e.displayName || "Context";
|
|
86
|
-
}
|
|
87
|
-
function L(e) {
|
|
88
|
-
if (e == null)
|
|
89
|
-
return null;
|
|
90
|
-
if (typeof e.tag == "number" && h("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 r:
|
|
96
|
-
return "Fragment";
|
|
97
|
-
case t:
|
|
98
|
-
return "Portal";
|
|
99
|
-
case s:
|
|
100
|
-
return "Profiler";
|
|
101
|
-
case i:
|
|
102
|
-
return "StrictMode";
|
|
103
|
-
case f:
|
|
104
|
-
return "Suspense";
|
|
105
|
-
case w:
|
|
106
|
-
return "SuspenseList";
|
|
107
|
-
}
|
|
108
|
-
if (typeof e == "object")
|
|
109
|
-
switch (e.$$typeof) {
|
|
110
|
-
case d:
|
|
111
|
-
var a = e;
|
|
112
|
-
return De(a) + ".Consumer";
|
|
113
|
-
case p:
|
|
114
|
-
var l = e;
|
|
115
|
-
return De(l._context) + ".Provider";
|
|
116
|
-
case u:
|
|
117
|
-
return _n(e, e.render, "ForwardRef");
|
|
118
|
-
case g:
|
|
119
|
-
var b = e.displayName || null;
|
|
120
|
-
return b !== null ? b : L(e.type) || "Memo";
|
|
121
|
-
case v: {
|
|
122
|
-
var S = e, _ = S._payload, C = S._init;
|
|
123
|
-
try {
|
|
124
|
-
return L(C(_));
|
|
125
|
-
} catch {
|
|
126
|
-
return null;
|
|
127
|
-
}
|
|
128
|
-
}
|
|
129
|
-
}
|
|
130
|
-
return null;
|
|
131
|
-
}
|
|
132
|
-
var B = Object.assign, te = 0, ze, Fe, Ue, $e, Me, He, We;
|
|
133
|
-
function Ye() {
|
|
134
|
-
}
|
|
135
|
-
Ye.__reactDisabledLog = !0;
|
|
136
|
-
function En() {
|
|
137
|
-
{
|
|
138
|
-
if (te === 0) {
|
|
139
|
-
ze = console.log, Fe = console.info, Ue = console.warn, $e = console.error, Me = console.group, He = console.groupCollapsed, We = console.groupEnd;
|
|
140
|
-
var e = {
|
|
141
|
-
configurable: !0,
|
|
142
|
-
enumerable: !0,
|
|
143
|
-
value: Ye,
|
|
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
|
-
te++;
|
|
157
|
-
}
|
|
158
|
-
}
|
|
159
|
-
function kn() {
|
|
160
|
-
{
|
|
161
|
-
if (te--, te === 0) {
|
|
162
|
-
var e = {
|
|
163
|
-
configurable: !0,
|
|
164
|
-
enumerable: !0,
|
|
165
|
-
writable: !0
|
|
166
|
-
};
|
|
167
|
-
Object.defineProperties(console, {
|
|
168
|
-
log: B({}, e, {
|
|
169
|
-
value: ze
|
|
170
|
-
}),
|
|
171
|
-
info: B({}, e, {
|
|
172
|
-
value: Fe
|
|
173
|
-
}),
|
|
174
|
-
warn: B({}, e, {
|
|
175
|
-
value: Ue
|
|
176
|
-
}),
|
|
177
|
-
error: B({}, e, {
|
|
178
|
-
value: $e
|
|
179
|
-
}),
|
|
180
|
-
group: B({}, e, {
|
|
181
|
-
value: Me
|
|
182
|
-
}),
|
|
183
|
-
groupCollapsed: B({}, e, {
|
|
184
|
-
value: He
|
|
185
|
-
}),
|
|
186
|
-
groupEnd: B({}, e, {
|
|
187
|
-
value: We
|
|
188
|
-
})
|
|
189
|
-
});
|
|
190
|
-
}
|
|
191
|
-
te < 0 && h("disabledDepth fell below zero. This is a bug in React. Please file an issue.");
|
|
192
|
-
}
|
|
193
|
-
}
|
|
194
|
-
var Ce = c.ReactCurrentDispatcher, Se;
|
|
195
|
-
function me(e, a, l) {
|
|
196
|
-
{
|
|
197
|
-
if (Se === void 0)
|
|
198
|
-
try {
|
|
199
|
-
throw Error();
|
|
200
|
-
} catch (S) {
|
|
201
|
-
var b = S.stack.trim().match(/\n( *(at )?)/);
|
|
202
|
-
Se = b && b[1] || "";
|
|
203
|
-
}
|
|
204
|
-
return `
|
|
205
|
-
` + Se + e;
|
|
206
|
-
}
|
|
207
|
-
}
|
|
208
|
-
var _e = !1, pe;
|
|
209
|
-
{
|
|
210
|
-
var Rn = typeof WeakMap == "function" ? WeakMap : Map;
|
|
211
|
-
pe = new Rn();
|
|
212
|
-
}
|
|
213
|
-
function Le(e, a) {
|
|
214
|
-
if (!e || _e)
|
|
215
|
-
return "";
|
|
216
|
-
{
|
|
217
|
-
var l = pe.get(e);
|
|
218
|
-
if (l !== void 0)
|
|
219
|
-
return l;
|
|
220
|
-
}
|
|
221
|
-
var b;
|
|
222
|
-
_e = !0;
|
|
223
|
-
var S = Error.prepareStackTrace;
|
|
224
|
-
Error.prepareStackTrace = void 0;
|
|
225
|
-
var _;
|
|
226
|
-
_ = Ce.current, Ce.current = null, En();
|
|
227
|
-
try {
|
|
228
|
-
if (a) {
|
|
229
|
-
var C = function() {
|
|
230
|
-
throw Error();
|
|
231
|
-
};
|
|
232
|
-
if (Object.defineProperty(C.prototype, "props", {
|
|
233
|
-
set: function() {
|
|
234
|
-
throw Error();
|
|
235
|
-
}
|
|
236
|
-
}), typeof Reflect == "object" && Reflect.construct) {
|
|
237
|
-
try {
|
|
238
|
-
Reflect.construct(C, []);
|
|
239
|
-
} catch ($) {
|
|
240
|
-
b = $;
|
|
241
|
-
}
|
|
242
|
-
Reflect.construct(e, [], C);
|
|
243
|
-
} else {
|
|
244
|
-
try {
|
|
245
|
-
C.call();
|
|
246
|
-
} catch ($) {
|
|
247
|
-
b = $;
|
|
248
|
-
}
|
|
249
|
-
e.call(C.prototype);
|
|
250
|
-
}
|
|
251
|
-
} else {
|
|
252
|
-
try {
|
|
253
|
-
throw Error();
|
|
254
|
-
} catch ($) {
|
|
255
|
-
b = $;
|
|
256
|
-
}
|
|
257
|
-
e();
|
|
258
|
-
}
|
|
259
|
-
} catch ($) {
|
|
260
|
-
if ($ && b && typeof $.stack == "string") {
|
|
261
|
-
for (var y = $.stack.split(`
|
|
262
|
-
`), F = b.stack.split(`
|
|
263
|
-
`), P = y.length - 1, T = F.length - 1; P >= 1 && T >= 0 && y[P] !== F[T]; )
|
|
264
|
-
T--;
|
|
265
|
-
for (; P >= 1 && T >= 0; P--, T--)
|
|
266
|
-
if (y[P] !== F[T]) {
|
|
267
|
-
if (P !== 1 || T !== 1)
|
|
268
|
-
do
|
|
269
|
-
if (P--, T--, T < 0 || y[P] !== F[T]) {
|
|
270
|
-
var W = `
|
|
271
|
-
` + y[P].replace(" at new ", " at ");
|
|
272
|
-
return e.displayName && W.includes("<anonymous>") && (W = W.replace("<anonymous>", e.displayName)), typeof e == "function" && pe.set(e, W), W;
|
|
273
|
-
}
|
|
274
|
-
while (P >= 1 && T >= 0);
|
|
275
|
-
break;
|
|
276
|
-
}
|
|
277
|
-
}
|
|
278
|
-
} finally {
|
|
279
|
-
_e = !1, Ce.current = _, kn(), Error.prepareStackTrace = S;
|
|
280
|
-
}
|
|
281
|
-
var X = e ? e.displayName || e.name : "", q = X ? me(X) : "";
|
|
282
|
-
return typeof e == "function" && pe.set(e, q), q;
|
|
283
|
-
}
|
|
284
|
-
function jn(e, a, l) {
|
|
285
|
-
return Le(e, !1);
|
|
286
|
-
}
|
|
287
|
-
function An(e) {
|
|
288
|
-
var a = e.prototype;
|
|
289
|
-
return !!(a && a.isReactComponent);
|
|
290
|
-
}
|
|
291
|
-
function fe(e, a, l) {
|
|
292
|
-
if (e == null)
|
|
293
|
-
return "";
|
|
294
|
-
if (typeof e == "function")
|
|
295
|
-
return Le(e, An(e));
|
|
296
|
-
if (typeof e == "string")
|
|
297
|
-
return me(e);
|
|
298
|
-
switch (e) {
|
|
299
|
-
case f:
|
|
300
|
-
return me("Suspense");
|
|
301
|
-
case w:
|
|
302
|
-
return me("SuspenseList");
|
|
303
|
-
}
|
|
304
|
-
if (typeof e == "object")
|
|
305
|
-
switch (e.$$typeof) {
|
|
306
|
-
case u:
|
|
307
|
-
return jn(e.render);
|
|
308
|
-
case g:
|
|
309
|
-
return fe(e.type, a, l);
|
|
310
|
-
case v: {
|
|
311
|
-
var b = e, S = b._payload, _ = b._init;
|
|
312
|
-
try {
|
|
313
|
-
return fe(_(S), a, l);
|
|
314
|
-
} catch {
|
|
315
|
-
}
|
|
316
|
-
}
|
|
317
|
-
}
|
|
318
|
-
return "";
|
|
319
|
-
}
|
|
320
|
-
var re = Object.prototype.hasOwnProperty, Ve = {}, Ke = c.ReactDebugCurrentFrame;
|
|
321
|
-
function ge(e) {
|
|
322
|
-
if (e) {
|
|
323
|
-
var a = e._owner, l = fe(e.type, e._source, a ? a.type : null);
|
|
324
|
-
Ke.setExtraStackFrame(l);
|
|
325
|
-
} else
|
|
326
|
-
Ke.setExtraStackFrame(null);
|
|
327
|
-
}
|
|
328
|
-
function Pn(e, a, l, b, S) {
|
|
329
|
-
{
|
|
330
|
-
var _ = Function.call.bind(re);
|
|
331
|
-
for (var C in e)
|
|
332
|
-
if (_(e, C)) {
|
|
333
|
-
var y = void 0;
|
|
334
|
-
try {
|
|
335
|
-
if (typeof e[C] != "function") {
|
|
336
|
-
var F = Error((b || "React class") + ": " + l + " type `" + C + "` is invalid; it must be a function, usually from the `prop-types` package, but received `" + typeof e[C] + "`.This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`.");
|
|
337
|
-
throw F.name = "Invariant Violation", F;
|
|
338
|
-
}
|
|
339
|
-
y = e[C](a, C, b, l, null, "SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED");
|
|
340
|
-
} catch (P) {
|
|
341
|
-
y = P;
|
|
342
|
-
}
|
|
343
|
-
y && !(y instanceof Error) && (ge(S), h("%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).", b || "React class", l, C, typeof y), ge(null)), y instanceof Error && !(y.message in Ve) && (Ve[y.message] = !0, ge(S), h("Failed %s type: %s", l, y.message), ge(null));
|
|
344
|
-
}
|
|
345
|
-
}
|
|
346
|
-
}
|
|
347
|
-
var Tn = Array.isArray;
|
|
348
|
-
function Ee(e) {
|
|
349
|
-
return Tn(e);
|
|
350
|
-
}
|
|
351
|
-
function On(e) {
|
|
352
|
-
{
|
|
353
|
-
var a = typeof Symbol == "function" && Symbol.toStringTag, l = a && e[Symbol.toStringTag] || e.constructor.name || "Object";
|
|
354
|
-
return l;
|
|
355
|
-
}
|
|
356
|
-
}
|
|
357
|
-
function Nn(e) {
|
|
358
|
-
try {
|
|
359
|
-
return Be(e), !1;
|
|
360
|
-
} catch {
|
|
361
|
-
return !0;
|
|
362
|
-
}
|
|
363
|
-
}
|
|
364
|
-
function Be(e) {
|
|
365
|
-
return "" + e;
|
|
366
|
-
}
|
|
367
|
-
function qe(e) {
|
|
368
|
-
if (Nn(e))
|
|
369
|
-
return h("The provided key is an unsupported type %s. This value must be coerced to a string before before using it here.", On(e)), Be(e);
|
|
370
|
-
}
|
|
371
|
-
var oe = c.ReactCurrentOwner, In = {
|
|
372
|
-
key: !0,
|
|
373
|
-
ref: !0,
|
|
374
|
-
__self: !0,
|
|
375
|
-
__source: !0
|
|
376
|
-
}, Je, Ge, ke;
|
|
377
|
-
ke = {};
|
|
378
|
-
function Dn(e) {
|
|
379
|
-
if (re.call(e, "ref")) {
|
|
380
|
-
var a = Object.getOwnPropertyDescriptor(e, "ref").get;
|
|
381
|
-
if (a && a.isReactWarning)
|
|
382
|
-
return !1;
|
|
383
|
-
}
|
|
384
|
-
return e.ref !== void 0;
|
|
385
|
-
}
|
|
386
|
-
function zn(e) {
|
|
387
|
-
if (re.call(e, "key")) {
|
|
388
|
-
var a = Object.getOwnPropertyDescriptor(e, "key").get;
|
|
389
|
-
if (a && a.isReactWarning)
|
|
390
|
-
return !1;
|
|
391
|
-
}
|
|
392
|
-
return e.key !== void 0;
|
|
393
|
-
}
|
|
394
|
-
function Fn(e, a) {
|
|
395
|
-
if (typeof e.ref == "string" && oe.current && a && oe.current.stateNode !== a) {
|
|
396
|
-
var l = L(oe.current.type);
|
|
397
|
-
ke[l] || (h('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', L(oe.current.type), e.ref), ke[l] = !0);
|
|
398
|
-
}
|
|
399
|
-
}
|
|
400
|
-
function Un(e, a) {
|
|
401
|
-
{
|
|
402
|
-
var l = function() {
|
|
403
|
-
Je || (Je = !0, h("%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)", a));
|
|
404
|
-
};
|
|
405
|
-
l.isReactWarning = !0, Object.defineProperty(e, "key", {
|
|
406
|
-
get: l,
|
|
407
|
-
configurable: !0
|
|
408
|
-
});
|
|
409
|
-
}
|
|
410
|
-
}
|
|
411
|
-
function $n(e, a) {
|
|
412
|
-
{
|
|
413
|
-
var l = function() {
|
|
414
|
-
Ge || (Ge = !0, h("%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)", a));
|
|
415
|
-
};
|
|
416
|
-
l.isReactWarning = !0, Object.defineProperty(e, "ref", {
|
|
417
|
-
get: l,
|
|
418
|
-
configurable: !0
|
|
419
|
-
});
|
|
420
|
-
}
|
|
421
|
-
}
|
|
422
|
-
var Mn = function(e, a, l, b, S, _, C) {
|
|
423
|
-
var y = {
|
|
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: a,
|
|
429
|
-
ref: l,
|
|
430
|
-
props: C,
|
|
431
|
-
// Record the component responsible for creating this element.
|
|
432
|
-
_owner: _
|
|
433
|
-
};
|
|
434
|
-
return y._store = {}, Object.defineProperty(y._store, "validated", {
|
|
435
|
-
configurable: !1,
|
|
436
|
-
enumerable: !1,
|
|
437
|
-
writable: !0,
|
|
438
|
-
value: !1
|
|
439
|
-
}), Object.defineProperty(y, "_self", {
|
|
440
|
-
configurable: !1,
|
|
441
|
-
enumerable: !1,
|
|
442
|
-
writable: !1,
|
|
443
|
-
value: b
|
|
444
|
-
}), Object.defineProperty(y, "_source", {
|
|
445
|
-
configurable: !1,
|
|
446
|
-
enumerable: !1,
|
|
447
|
-
writable: !1,
|
|
448
|
-
value: S
|
|
449
|
-
}), Object.freeze && (Object.freeze(y.props), Object.freeze(y)), y;
|
|
450
|
-
};
|
|
451
|
-
function Hn(e, a, l, b, S) {
|
|
452
|
-
{
|
|
453
|
-
var _, C = {}, y = null, F = null;
|
|
454
|
-
l !== void 0 && (qe(l), y = "" + l), zn(a) && (qe(a.key), y = "" + a.key), Dn(a) && (F = a.ref, Fn(a, S));
|
|
455
|
-
for (_ in a)
|
|
456
|
-
re.call(a, _) && !In.hasOwnProperty(_) && (C[_] = a[_]);
|
|
457
|
-
if (e && e.defaultProps) {
|
|
458
|
-
var P = e.defaultProps;
|
|
459
|
-
for (_ in P)
|
|
460
|
-
C[_] === void 0 && (C[_] = P[_]);
|
|
461
|
-
}
|
|
462
|
-
if (y || F) {
|
|
463
|
-
var T = typeof e == "function" ? e.displayName || e.name || "Unknown" : e;
|
|
464
|
-
y && Un(C, T), F && $n(C, T);
|
|
465
|
-
}
|
|
466
|
-
return Mn(e, y, F, S, b, oe.current, C);
|
|
467
|
-
}
|
|
468
|
-
}
|
|
469
|
-
var Re = c.ReactCurrentOwner, Xe = c.ReactDebugCurrentFrame;
|
|
470
|
-
function G(e) {
|
|
471
|
-
if (e) {
|
|
472
|
-
var a = e._owner, l = fe(e.type, e._source, a ? a.type : null);
|
|
473
|
-
Xe.setExtraStackFrame(l);
|
|
474
|
-
} else
|
|
475
|
-
Xe.setExtraStackFrame(null);
|
|
476
|
-
}
|
|
477
|
-
var je;
|
|
478
|
-
je = !1;
|
|
479
|
-
function Ae(e) {
|
|
480
|
-
return typeof e == "object" && e !== null && e.$$typeof === n;
|
|
481
|
-
}
|
|
482
|
-
function Qe() {
|
|
483
|
-
{
|
|
484
|
-
if (Re.current) {
|
|
485
|
-
var e = L(Re.current.type);
|
|
486
|
-
if (e)
|
|
487
|
-
return `
|
|
488
|
-
|
|
489
|
-
Check the render method of \`` + e + "`.";
|
|
490
|
-
}
|
|
491
|
-
return "";
|
|
492
|
-
}
|
|
493
|
-
}
|
|
494
|
-
function Wn(e) {
|
|
495
|
-
return "";
|
|
496
|
-
}
|
|
497
|
-
var Ze = {};
|
|
498
|
-
function Yn(e) {
|
|
499
|
-
{
|
|
500
|
-
var a = Qe();
|
|
501
|
-
if (!a) {
|
|
502
|
-
var l = typeof e == "string" ? e : e.displayName || e.name;
|
|
503
|
-
l && (a = `
|
|
504
|
-
|
|
505
|
-
Check the top-level render call using <` + l + ">.");
|
|
506
|
-
}
|
|
507
|
-
return a;
|
|
508
|
-
}
|
|
509
|
-
}
|
|
510
|
-
function en(e, a) {
|
|
511
|
-
{
|
|
512
|
-
if (!e._store || e._store.validated || e.key != null)
|
|
513
|
-
return;
|
|
514
|
-
e._store.validated = !0;
|
|
515
|
-
var l = Yn(a);
|
|
516
|
-
if (Ze[l])
|
|
517
|
-
return;
|
|
518
|
-
Ze[l] = !0;
|
|
519
|
-
var b = "";
|
|
520
|
-
e && e._owner && e._owner !== Re.current && (b = " It was passed a child from " + L(e._owner.type) + "."), G(e), h('Each child in a list should have a unique "key" prop.%s%s See https://reactjs.org/link/warning-keys for more information.', l, b), G(null);
|
|
521
|
-
}
|
|
522
|
-
}
|
|
523
|
-
function nn(e, a) {
|
|
524
|
-
{
|
|
525
|
-
if (typeof e != "object")
|
|
526
|
-
return;
|
|
527
|
-
if (Ee(e))
|
|
528
|
-
for (var l = 0; l < e.length; l++) {
|
|
529
|
-
var b = e[l];
|
|
530
|
-
Ae(b) && en(b, a);
|
|
531
|
-
}
|
|
532
|
-
else if (Ae(e))
|
|
533
|
-
e._store && (e._store.validated = !0);
|
|
534
|
-
else if (e) {
|
|
535
|
-
var S = U(e);
|
|
536
|
-
if (typeof S == "function" && S !== e.entries)
|
|
537
|
-
for (var _ = S.call(e), C; !(C = _.next()).done; )
|
|
538
|
-
Ae(C.value) && en(C.value, a);
|
|
539
|
-
}
|
|
540
|
-
}
|
|
541
|
-
}
|
|
542
|
-
function Ln(e) {
|
|
543
|
-
{
|
|
544
|
-
var a = e.type;
|
|
545
|
-
if (a == null || typeof a == "string")
|
|
546
|
-
return;
|
|
547
|
-
var l;
|
|
548
|
-
if (typeof a == "function")
|
|
549
|
-
l = a.propTypes;
|
|
550
|
-
else if (typeof a == "object" && (a.$$typeof === u || // Note: Memo only checks outer props here.
|
|
551
|
-
// Inner props are checked in the reconciler.
|
|
552
|
-
a.$$typeof === g))
|
|
553
|
-
l = a.propTypes;
|
|
554
|
-
else
|
|
555
|
-
return;
|
|
556
|
-
if (l) {
|
|
557
|
-
var b = L(a);
|
|
558
|
-
Pn(l, e.props, "prop", b, e);
|
|
559
|
-
} else if (a.PropTypes !== void 0 && !je) {
|
|
560
|
-
je = !0;
|
|
561
|
-
var S = L(a);
|
|
562
|
-
h("Component %s declared `PropTypes` instead of `propTypes`. Did you misspell the property assignment?", S || "Unknown");
|
|
563
|
-
}
|
|
564
|
-
typeof a.getDefaultProps == "function" && !a.getDefaultProps.isReactClassApproved && h("getDefaultProps is only used on classic React.createClass definitions. Use a static property named `defaultProps` instead.");
|
|
565
|
-
}
|
|
566
|
-
}
|
|
567
|
-
function Vn(e) {
|
|
568
|
-
{
|
|
569
|
-
for (var a = Object.keys(e.props), l = 0; l < a.length; l++) {
|
|
570
|
-
var b = a[l];
|
|
571
|
-
if (b !== "children" && b !== "key") {
|
|
572
|
-
G(e), h("Invalid prop `%s` supplied to `React.Fragment`. React.Fragment can only have `key` and `children` props.", b), G(null);
|
|
573
|
-
break;
|
|
574
|
-
}
|
|
575
|
-
}
|
|
576
|
-
e.ref !== null && (G(e), h("Invalid attribute `ref` supplied to `React.Fragment`."), G(null));
|
|
577
|
-
}
|
|
578
|
-
}
|
|
579
|
-
var tn = {};
|
|
580
|
-
function rn(e, a, l, b, S, _) {
|
|
581
|
-
{
|
|
582
|
-
var C = ne(e);
|
|
583
|
-
if (!C) {
|
|
584
|
-
var y = "";
|
|
585
|
-
(e === void 0 || typeof e == "object" && e !== null && Object.keys(e).length === 0) && (y += " 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 F = Wn();
|
|
587
|
-
F ? y += F : y += Qe();
|
|
588
|
-
var P;
|
|
589
|
-
e === null ? P = "null" : Ee(e) ? P = "array" : e !== void 0 && e.$$typeof === n ? (P = "<" + (L(e.type) || "Unknown") + " />", y = " Did you accidentally export a JSX literal instead of a component?") : P = typeof e, h("React.jsx: type is invalid -- expected a string (for built-in components) or a class/function (for composite components) but got: %s.%s", P, y);
|
|
590
|
-
}
|
|
591
|
-
var T = Hn(e, a, l, S, _);
|
|
592
|
-
if (T == null)
|
|
593
|
-
return T;
|
|
594
|
-
if (C) {
|
|
595
|
-
var W = a.children;
|
|
596
|
-
if (W !== void 0)
|
|
597
|
-
if (b)
|
|
598
|
-
if (Ee(W)) {
|
|
599
|
-
for (var X = 0; X < W.length; X++)
|
|
600
|
-
nn(W[X], e);
|
|
601
|
-
Object.freeze && Object.freeze(W);
|
|
602
|
-
} else
|
|
603
|
-
h("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
|
-
nn(W, e);
|
|
606
|
-
}
|
|
607
|
-
if (re.call(a, "key")) {
|
|
608
|
-
var q = L(e), $ = Object.keys(a).filter(function(Xn) {
|
|
609
|
-
return Xn !== "key";
|
|
610
|
-
}), Pe = $.length > 0 ? "{key: someKey, " + $.join(": ..., ") + ": ...}" : "{key: someKey}";
|
|
611
|
-
if (!tn[q + Pe]) {
|
|
612
|
-
var Gn = $.length > 0 ? "{" + $.join(": ..., ") + ": ...}" : "{}";
|
|
613
|
-
h(`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} />`, Pe, q, Gn, q), tn[q + Pe] = !0;
|
|
619
|
-
}
|
|
620
|
-
}
|
|
621
|
-
return e === r ? Vn(T) : Ln(T), T;
|
|
622
|
-
}
|
|
623
|
-
}
|
|
624
|
-
function Kn(e, a, l) {
|
|
625
|
-
return rn(e, a, l, !0);
|
|
626
|
-
}
|
|
627
|
-
function Bn(e, a, l) {
|
|
628
|
-
return rn(e, a, l, !1);
|
|
629
|
-
}
|
|
630
|
-
var qn = Bn, Jn = Kn;
|
|
631
|
-
se.Fragment = r, se.jsx = qn, se.jsxs = Jn;
|
|
632
|
-
}()), se;
|
|
633
|
-
}
|
|
634
|
-
process.env.NODE_ENV === "production" ? Te.exports = rt() : Te.exports = ot();
|
|
635
|
-
var m = Te.exports, Oe, he = tt;
|
|
636
|
-
if (process.env.NODE_ENV === "production")
|
|
637
|
-
Oe = he.createRoot, he.hydrateRoot;
|
|
638
|
-
else {
|
|
639
|
-
var sn = he.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;
|
|
640
|
-
Oe = function(o, n) {
|
|
641
|
-
sn.usingClientEntryPoint = !0;
|
|
642
|
-
try {
|
|
643
|
-
return he.createRoot(o, n);
|
|
644
|
-
} finally {
|
|
645
|
-
sn.usingClientEntryPoint = !1;
|
|
646
|
-
}
|
|
647
|
-
};
|
|
648
|
-
}
|
|
649
|
-
const at = ({ onOpen: o, onClose: n, isVisible: t, showCitadelKey: r }) => {
|
|
650
|
-
I(() => {
|
|
651
|
-
const i = (s) => {
|
|
652
|
-
var p, d;
|
|
653
|
-
!t && s.key === r && !["input", "textarea"].includes(((d = (p = s.target) == null ? void 0 : p.tagName) == null ? void 0 : d.toLowerCase()) || "") && (s.preventDefault(), o()), t && s.key === "Escape" && (s.preventDefault(), n());
|
|
1
|
+
var pe = Object.defineProperty;
|
|
2
|
+
var ge = (r, e, n) => e in r ? pe(r, e, { enumerable: !0, configurable: !0, writable: !0, value: n }) : r[e] = n;
|
|
3
|
+
var b = (r, e, n) => ge(r, typeof e != "symbol" ? e + "" : e, n);
|
|
4
|
+
import { jsx as m, jsxs as N, Fragment as he } from "react/jsx-runtime";
|
|
5
|
+
import L, { useEffect as _, useMemo as V, createContext as fe, useContext as Y, useState as R, useCallback as w, useReducer as we, useRef as U } from "react";
|
|
6
|
+
import { createRoot as be } from "react-dom/client";
|
|
7
|
+
const ye = ({ onOpen: r, onClose: e, isVisible: n, showCitadelKey: t }) => {
|
|
8
|
+
_(() => {
|
|
9
|
+
const o = (s) => {
|
|
10
|
+
var i, c;
|
|
11
|
+
!n && s.key === t && !["input", "textarea"].includes(((c = (i = s.target) == null ? void 0 : i.tagName) == null ? void 0 : c.toLowerCase()) || "") && (s.preventDefault(), r()), n && s.key === "Escape" && (s.preventDefault(), e());
|
|
654
12
|
};
|
|
655
|
-
return document.addEventListener("keydown",
|
|
656
|
-
}, [
|
|
657
|
-
},
|
|
658
|
-
container:
|
|
659
|
-
innerContainer:
|
|
660
|
-
inputSection:
|
|
661
|
-
resizeHandle:
|
|
662
|
-
citadel_slideUp:
|
|
663
|
-
citadel_slideDown:
|
|
664
|
-
},
|
|
665
|
-
const { isVisible:
|
|
666
|
-
return
|
|
667
|
-
if (
|
|
668
|
-
const
|
|
669
|
-
|
|
13
|
+
return document.addEventListener("keydown", o), () => document.removeEventListener("keydown", o);
|
|
14
|
+
}, [r, e, n, t]);
|
|
15
|
+
}, xe = "_container_141sr_3", ve = "_innerContainer_141sr_19", Ce = "_inputSection_141sr_28", Se = "_resizeHandle_141sr_35", ke = "_citadel_slideUp_141sr_64", Ee = "_citadel_slideDown_141sr_68", Q = {
|
|
16
|
+
container: xe,
|
|
17
|
+
innerContainer: ve,
|
|
18
|
+
inputSection: Ce,
|
|
19
|
+
resizeHandle: Se,
|
|
20
|
+
citadel_slideUp: ke,
|
|
21
|
+
citadel_slideDown: Ee
|
|
22
|
+
}, Ne = (r) => {
|
|
23
|
+
const { isVisible: e, isClosing: n, onAnimationComplete: t } = r, o = V(() => e ? n ? Q.slideDown : Q.slideUp : "", [e, n]);
|
|
24
|
+
return _(() => {
|
|
25
|
+
if (t) {
|
|
26
|
+
const i = setTimeout(() => {
|
|
27
|
+
t();
|
|
670
28
|
}, 200);
|
|
671
|
-
return () => clearTimeout(
|
|
29
|
+
return () => clearTimeout(i);
|
|
672
30
|
}
|
|
673
|
-
}, [
|
|
674
|
-
style:
|
|
675
|
-
opacity:
|
|
676
|
-
transform:
|
|
31
|
+
}, [n, t]), {
|
|
32
|
+
style: V(() => ({
|
|
33
|
+
opacity: e ? 1 : 0,
|
|
34
|
+
transform: e ? "translateY(0)" : n ? "translateY(100%)" : "translateY(-100%)",
|
|
677
35
|
transition: "opacity 200ms ease-in-out, transform 200ms ease-in-out"
|
|
678
|
-
}), [
|
|
679
|
-
animationClass:
|
|
36
|
+
}), [e, n]),
|
|
37
|
+
animationClass: o
|
|
680
38
|
};
|
|
681
39
|
};
|
|
682
|
-
var
|
|
683
|
-
class
|
|
684
|
-
constructor(
|
|
685
|
-
|
|
686
|
-
this.timestamp =
|
|
40
|
+
var M = /* @__PURE__ */ ((r) => (r.Pending = "pending", r.Success = "success", r.Failure = "failure", r.Timeout = "timeout", r))(M || {});
|
|
41
|
+
class F {
|
|
42
|
+
constructor(e = Date.now()) {
|
|
43
|
+
b(this, "_status", "pending");
|
|
44
|
+
this.timestamp = e;
|
|
687
45
|
}
|
|
688
46
|
get status() {
|
|
689
47
|
return this._status;
|
|
@@ -698,41 +56,41 @@ class ee {
|
|
|
698
56
|
this._status = "timeout";
|
|
699
57
|
}
|
|
700
58
|
}
|
|
701
|
-
class
|
|
702
|
-
constructor(
|
|
703
|
-
super(
|
|
59
|
+
class nn extends F {
|
|
60
|
+
constructor(e, n) {
|
|
61
|
+
super(n), this.data = e;
|
|
704
62
|
}
|
|
705
63
|
render() {
|
|
706
|
-
return /* @__PURE__ */ m
|
|
64
|
+
return /* @__PURE__ */ m("pre", { className: "text-gray-200", children: JSON.stringify(this.data, null, 2) });
|
|
707
65
|
}
|
|
708
66
|
}
|
|
709
|
-
class
|
|
710
|
-
constructor(
|
|
711
|
-
super(
|
|
67
|
+
class oe extends F {
|
|
68
|
+
constructor(e, n) {
|
|
69
|
+
super(n), this.text = e;
|
|
712
70
|
}
|
|
713
71
|
render() {
|
|
714
|
-
return /* @__PURE__ */ m
|
|
72
|
+
return /* @__PURE__ */ m("div", { className: "text-gray-200 whitespace-pre font-mono", children: this.text });
|
|
715
73
|
}
|
|
716
74
|
}
|
|
717
|
-
class
|
|
718
|
-
constructor(
|
|
719
|
-
super(
|
|
75
|
+
class _e extends F {
|
|
76
|
+
constructor(e, n) {
|
|
77
|
+
super(n), this.error = e, this.markFailure();
|
|
720
78
|
}
|
|
721
79
|
render() {
|
|
722
|
-
return /* @__PURE__ */ m
|
|
80
|
+
return /* @__PURE__ */ m("div", { className: "mt-1 text-red-400", children: this.error });
|
|
723
81
|
}
|
|
724
82
|
}
|
|
725
|
-
class
|
|
83
|
+
class Ae extends F {
|
|
726
84
|
render() {
|
|
727
|
-
return /* @__PURE__ */ m
|
|
85
|
+
return /* @__PURE__ */ m("div", { className: "text-gray-400", children: "..." });
|
|
728
86
|
}
|
|
729
87
|
}
|
|
730
|
-
class
|
|
731
|
-
constructor(
|
|
732
|
-
super(
|
|
88
|
+
class tn extends F {
|
|
89
|
+
constructor(e, n = "", t) {
|
|
90
|
+
super(t), this.imageUrl = e, this.altText = n;
|
|
733
91
|
}
|
|
734
92
|
render() {
|
|
735
|
-
return /* @__PURE__ */ m
|
|
93
|
+
return /* @__PURE__ */ m("div", { className: "my-2", children: /* @__PURE__ */ m(
|
|
736
94
|
"img",
|
|
737
95
|
{
|
|
738
96
|
src: this.imageUrl,
|
|
@@ -742,44 +100,44 @@ class Lt extends ee {
|
|
|
742
100
|
) });
|
|
743
101
|
}
|
|
744
102
|
}
|
|
745
|
-
const
|
|
746
|
-
const
|
|
747
|
-
return
|
|
748
|
-
|
|
749
|
-
` +
|
|
103
|
+
const ze = (r) => async function() {
|
|
104
|
+
const e = r.commands.filter((n) => n.fullPath[0] !== "help").map((n) => `${n.segments.map((o) => o.type === "argument" ? `<${o.name}>` : o.name).join(" ")} - ${n.description}`).sort();
|
|
105
|
+
return e.push("help - Show available commands"), new oe(
|
|
106
|
+
e.length > 0 ? `Available Commands:
|
|
107
|
+
` + e.join(`
|
|
750
108
|
`) : "No commands available yet. Add some commands to get started!"
|
|
751
109
|
);
|
|
752
110
|
};
|
|
753
|
-
var
|
|
754
|
-
class
|
|
755
|
-
static configure(
|
|
756
|
-
this.level =
|
|
111
|
+
var W = /* @__PURE__ */ ((r) => (r[r.NONE = 0] = "NONE", r[r.ERROR = 1] = "ERROR", r[r.WARN = 2] = "WARN", r[r.INFO = 3] = "INFO", r[r.DEBUG = 4] = "DEBUG", r[r.TRACE = 5] = "TRACE", r))(W || {});
|
|
112
|
+
class C {
|
|
113
|
+
static configure(e) {
|
|
114
|
+
this.level = e.level, this.prefix = e.prefix || "[Citadel]";
|
|
757
115
|
}
|
|
758
|
-
static trace(...
|
|
759
|
-
this.level >= 5 && process.env.NODE_ENV !== "production" && console.trace(this.prefix, ...
|
|
116
|
+
static trace(...e) {
|
|
117
|
+
this.level >= 5 && process.env.NODE_ENV !== "production" && console.trace(this.prefix, ...e);
|
|
760
118
|
}
|
|
761
|
-
static debug(...
|
|
762
|
-
this.level >= 4 && process.env.NODE_ENV !== "production" && console.debug(this.prefix, ...
|
|
119
|
+
static debug(...e) {
|
|
120
|
+
this.level >= 4 && process.env.NODE_ENV !== "production" && console.debug(this.prefix, ...e);
|
|
763
121
|
}
|
|
764
|
-
static info(...
|
|
765
|
-
this.level >= 3 && console.info(this.prefix, ...
|
|
122
|
+
static info(...e) {
|
|
123
|
+
this.level >= 3 && console.info(this.prefix, ...e);
|
|
766
124
|
}
|
|
767
|
-
static warn(...
|
|
768
|
-
this.level >= 2 && console.warn(this.prefix, ...
|
|
125
|
+
static warn(...e) {
|
|
126
|
+
this.level >= 2 && console.warn(this.prefix, ...e);
|
|
769
127
|
}
|
|
770
|
-
static error(...
|
|
771
|
-
this.level >= 1 && console.error(this.prefix, ...
|
|
128
|
+
static error(...e) {
|
|
129
|
+
this.level >= 1 && console.error(this.prefix, ...e);
|
|
772
130
|
}
|
|
773
131
|
}
|
|
774
|
-
|
|
775
|
-
const
|
|
132
|
+
b(C, "level", 0), b(C, "prefix", "");
|
|
133
|
+
const A = {
|
|
776
134
|
commandTimeoutMs: 1e4,
|
|
777
135
|
cursorColor: "var(--cursor-color, #fff)",
|
|
778
136
|
cursorSpeed: 530,
|
|
779
137
|
cursorType: "blink",
|
|
780
138
|
includeHelpCommand: !0,
|
|
781
139
|
initialHeight: "40vh",
|
|
782
|
-
logLevel: process.env.NODE_ENV === "production" ?
|
|
140
|
+
logLevel: process.env.NODE_ENV === "production" ? W.ERROR : W.DEBUG,
|
|
783
141
|
maxHeight: "80vh",
|
|
784
142
|
minHeight: "200",
|
|
785
143
|
outputFontSize: "0.875rem",
|
|
@@ -790,94 +148,94 @@ const M = {
|
|
|
790
148
|
maxCommands: 100
|
|
791
149
|
}
|
|
792
150
|
};
|
|
793
|
-
class
|
|
794
|
-
constructor(
|
|
795
|
-
|
|
151
|
+
class se {
|
|
152
|
+
constructor(e) {
|
|
153
|
+
b(this, "config");
|
|
796
154
|
this.config = {
|
|
797
155
|
type: "localStorage",
|
|
798
156
|
maxCommands: 100,
|
|
799
|
-
...
|
|
157
|
+
...e
|
|
800
158
|
};
|
|
801
159
|
}
|
|
802
160
|
/**
|
|
803
161
|
* Add a command to history, enforcing storage limits
|
|
804
162
|
*/
|
|
805
|
-
async addStoredCommand(
|
|
806
|
-
const
|
|
807
|
-
for (
|
|
808
|
-
|
|
809
|
-
await this.saveCommands(
|
|
163
|
+
async addStoredCommand(e) {
|
|
164
|
+
const n = await this.getStoredCommands();
|
|
165
|
+
for (n.push(e); n.length > this.config.maxCommands; )
|
|
166
|
+
n.shift();
|
|
167
|
+
await this.saveCommands(n);
|
|
810
168
|
}
|
|
811
169
|
}
|
|
812
|
-
class
|
|
813
|
-
constructor(
|
|
814
|
-
super(
|
|
815
|
-
|
|
170
|
+
class Ie extends se {
|
|
171
|
+
constructor(n) {
|
|
172
|
+
super(n);
|
|
173
|
+
b(this, "storageKey", "citadel_command_history");
|
|
816
174
|
}
|
|
817
175
|
async getStoredCommands() {
|
|
818
176
|
try {
|
|
819
|
-
const
|
|
820
|
-
return
|
|
821
|
-
commandSegments:
|
|
822
|
-
timestamp:
|
|
177
|
+
const n = window.localStorage.getItem(this.storageKey);
|
|
178
|
+
return n ? JSON.parse(n).map((o) => ({
|
|
179
|
+
commandSegments: o.commandSegments || [],
|
|
180
|
+
timestamp: o.timestamp
|
|
823
181
|
})) : [];
|
|
824
|
-
} catch (
|
|
825
|
-
return console.warn("Failed to load commands from localStorage:",
|
|
182
|
+
} catch (n) {
|
|
183
|
+
return console.warn("Failed to load commands from localStorage:", n), [];
|
|
826
184
|
}
|
|
827
185
|
}
|
|
828
186
|
async clear() {
|
|
829
187
|
try {
|
|
830
188
|
window.localStorage.removeItem(this.storageKey);
|
|
831
|
-
} catch (
|
|
832
|
-
console.warn("Failed to clear localStorage:",
|
|
189
|
+
} catch (n) {
|
|
190
|
+
console.warn("Failed to clear localStorage:", n);
|
|
833
191
|
}
|
|
834
192
|
}
|
|
835
|
-
async saveCommands(
|
|
193
|
+
async saveCommands(n) {
|
|
836
194
|
try {
|
|
837
|
-
const
|
|
838
|
-
commandSegments: Array.isArray(
|
|
839
|
-
timestamp:
|
|
195
|
+
const t = n.map((o) => ({
|
|
196
|
+
commandSegments: Array.isArray(o.commandSegments) ? [...o.commandSegments] : [],
|
|
197
|
+
timestamp: o.timestamp
|
|
840
198
|
}));
|
|
841
|
-
window.localStorage.setItem(this.storageKey, JSON.stringify(
|
|
842
|
-
} catch (
|
|
843
|
-
throw console.warn("Failed to save commands to localStorage:",
|
|
199
|
+
window.localStorage.setItem(this.storageKey, JSON.stringify(t));
|
|
200
|
+
} catch (t) {
|
|
201
|
+
throw console.warn("Failed to save commands to localStorage:", t), t;
|
|
844
202
|
}
|
|
845
203
|
}
|
|
846
204
|
}
|
|
847
|
-
class
|
|
848
|
-
constructor(
|
|
849
|
-
super(
|
|
850
|
-
|
|
205
|
+
class Re extends se {
|
|
206
|
+
constructor(n) {
|
|
207
|
+
super(n);
|
|
208
|
+
b(this, "storedCommands", []);
|
|
851
209
|
}
|
|
852
210
|
async getStoredCommands() {
|
|
853
|
-
return this.storedCommands.map((
|
|
854
|
-
commandSegments: Array.isArray(
|
|
855
|
-
timestamp:
|
|
211
|
+
return this.storedCommands.map((n) => ({
|
|
212
|
+
commandSegments: Array.isArray(n.commandSegments) ? [...n.commandSegments] : [],
|
|
213
|
+
timestamp: n.timestamp
|
|
856
214
|
}));
|
|
857
215
|
}
|
|
858
216
|
async clear() {
|
|
859
217
|
this.storedCommands = [];
|
|
860
218
|
}
|
|
861
|
-
async saveCommands(
|
|
862
|
-
this.storedCommands =
|
|
863
|
-
commandSegments: Array.isArray(
|
|
864
|
-
timestamp:
|
|
219
|
+
async saveCommands(n) {
|
|
220
|
+
this.storedCommands = n.map((t) => ({
|
|
221
|
+
commandSegments: Array.isArray(t.commandSegments) ? [...t.commandSegments] : [],
|
|
222
|
+
timestamp: t.timestamp
|
|
865
223
|
}));
|
|
866
224
|
}
|
|
867
225
|
}
|
|
868
|
-
const
|
|
226
|
+
const D = class D {
|
|
869
227
|
constructor() {
|
|
870
|
-
|
|
228
|
+
b(this, "currentStorage");
|
|
871
229
|
}
|
|
872
230
|
static getInstance() {
|
|
873
|
-
return
|
|
231
|
+
return D.instance || (D.instance = new D()), D.instance;
|
|
874
232
|
}
|
|
875
|
-
initializeStorage(
|
|
233
|
+
initializeStorage(e) {
|
|
876
234
|
if (!this.currentStorage)
|
|
877
235
|
try {
|
|
878
|
-
this.currentStorage = new
|
|
879
|
-
} catch (
|
|
880
|
-
console.warn("Failed to create storage, falling back to memory storage:",
|
|
236
|
+
this.currentStorage = new Ie(e);
|
|
237
|
+
} catch (n) {
|
|
238
|
+
console.warn("Failed to create storage, falling back to memory storage:", n), this.currentStorage = new Re(e);
|
|
881
239
|
}
|
|
882
240
|
}
|
|
883
241
|
getStorage() {
|
|
@@ -886,39 +244,39 @@ const J = class J {
|
|
|
886
244
|
return this.currentStorage;
|
|
887
245
|
}
|
|
888
246
|
};
|
|
889
|
-
|
|
890
|
-
let
|
|
891
|
-
const
|
|
892
|
-
class
|
|
893
|
-
constructor(n, t
|
|
894
|
-
this.type =
|
|
247
|
+
b(D, "instance");
|
|
248
|
+
let q = D;
|
|
249
|
+
const ae = async () => new oe("");
|
|
250
|
+
class G {
|
|
251
|
+
constructor(e, n, t) {
|
|
252
|
+
this.type = e, this.name = n, this.description = t;
|
|
895
253
|
}
|
|
896
254
|
toString() {
|
|
897
255
|
return this.name;
|
|
898
256
|
}
|
|
899
257
|
}
|
|
900
|
-
class
|
|
258
|
+
class ie extends G {
|
|
901
259
|
constructor() {
|
|
902
260
|
super("null", ">null<", "Empty segment");
|
|
903
261
|
}
|
|
904
262
|
}
|
|
905
|
-
class
|
|
906
|
-
constructor(
|
|
907
|
-
super("word",
|
|
263
|
+
class Pe extends G {
|
|
264
|
+
constructor(e, n) {
|
|
265
|
+
super("word", e, n);
|
|
908
266
|
}
|
|
909
267
|
}
|
|
910
|
-
class
|
|
911
|
-
constructor(n, t,
|
|
912
|
-
super("argument",
|
|
268
|
+
class He extends G {
|
|
269
|
+
constructor(e, n, t, o) {
|
|
270
|
+
super("argument", e, n), this.value = t, this.valid = o;
|
|
913
271
|
}
|
|
914
272
|
}
|
|
915
|
-
class
|
|
916
|
-
constructor(n, t
|
|
917
|
-
|
|
918
|
-
|
|
273
|
+
class De {
|
|
274
|
+
constructor(e, n, t = ae) {
|
|
275
|
+
b(this, "_segments");
|
|
276
|
+
b(this, "_description");
|
|
919
277
|
// Used by `Help` command, etc.
|
|
920
|
-
|
|
921
|
-
this._segments =
|
|
278
|
+
b(this, "_handler");
|
|
279
|
+
this._segments = e, this._description = n, this._handler = t;
|
|
922
280
|
}
|
|
923
281
|
get segments() {
|
|
924
282
|
return this._segments;
|
|
@@ -930,21 +288,21 @@ class vt {
|
|
|
930
288
|
return this._handler;
|
|
931
289
|
}
|
|
932
290
|
get hasArguments() {
|
|
933
|
-
return this.segments.some((
|
|
291
|
+
return this.segments.some((e) => e.type === "argument");
|
|
934
292
|
}
|
|
935
293
|
get fullPath() {
|
|
936
|
-
return this.segments.map((
|
|
294
|
+
return this.segments.map((e) => e.name);
|
|
937
295
|
}
|
|
938
296
|
get fullPath_s() {
|
|
939
297
|
return this.fullPath.join(" ");
|
|
940
298
|
}
|
|
941
|
-
equals(
|
|
942
|
-
return this.fullPath.join(" ") ===
|
|
299
|
+
equals(e) {
|
|
300
|
+
return this.fullPath.join(" ") === e.fullPath.join(" ");
|
|
943
301
|
}
|
|
944
302
|
}
|
|
945
|
-
class
|
|
303
|
+
class J {
|
|
946
304
|
constructor() {
|
|
947
|
-
|
|
305
|
+
b(this, "_commands", []);
|
|
948
306
|
}
|
|
949
307
|
get commands() {
|
|
950
308
|
return this._commands;
|
|
@@ -956,20 +314,20 @@ class Ie {
|
|
|
956
314
|
* @throws {Error} If attempting to add a duplicate leaf command or a subcommand to a leaf
|
|
957
315
|
*
|
|
958
316
|
*/
|
|
959
|
-
addCommand(n, t
|
|
960
|
-
if (
|
|
317
|
+
addCommand(e, n, t = ae) {
|
|
318
|
+
if (e === void 0 || e.length === 0)
|
|
961
319
|
throw new Error("Command path cannot be empty");
|
|
962
|
-
const
|
|
963
|
-
const
|
|
964
|
-
(
|
|
965
|
-
).join(" "),
|
|
966
|
-
(
|
|
320
|
+
const o = new De(e, n, t), s = this._commands.find((i) => {
|
|
321
|
+
const c = i.segments.map(
|
|
322
|
+
(l) => l.type === "argument" ? "*" : l.name
|
|
323
|
+
).join(" "), d = e.map(
|
|
324
|
+
(l) => l.type === "argument" ? "*" : l.name
|
|
967
325
|
).join(" ");
|
|
968
|
-
return
|
|
326
|
+
return c === d;
|
|
969
327
|
});
|
|
970
328
|
if (s)
|
|
971
|
-
throw new Error(`Duplicate commands: '${s.fullPath_s}' and '${
|
|
972
|
-
this._commands.push(
|
|
329
|
+
throw new Error(`Duplicate commands: '${s.fullPath_s}' and '${o.fullPath_s}'`);
|
|
330
|
+
this._commands.push(o);
|
|
973
331
|
}
|
|
974
332
|
/**
|
|
975
333
|
* Retrieves a command from the registry for the given path.
|
|
@@ -977,24 +335,27 @@ class Ie {
|
|
|
977
335
|
* @param path The path of the command.
|
|
978
336
|
* @returns The command node or undefined if not found.
|
|
979
337
|
*/
|
|
980
|
-
getCommand(
|
|
981
|
-
return this._commands.find((
|
|
982
|
-
const
|
|
983
|
-
|
|
338
|
+
getCommand(e) {
|
|
339
|
+
return this._commands.find((n) => {
|
|
340
|
+
const t = n.fullPath.join(" "), o = e.join(" ");
|
|
341
|
+
if (t === o)
|
|
342
|
+
return !0;
|
|
343
|
+
const i = n.segments.filter((c) => c.type === "word").map((c) => c.name);
|
|
344
|
+
return i.length === e.length && i.join(" ") === o;
|
|
984
345
|
});
|
|
985
346
|
}
|
|
986
|
-
commandExistsForPath(
|
|
987
|
-
const
|
|
988
|
-
(
|
|
347
|
+
commandExistsForPath(e) {
|
|
348
|
+
const n = this._commands.map(
|
|
349
|
+
(o) => o.segments.map(
|
|
989
350
|
(s) => s.type === "argument" ? "*" : s.name
|
|
990
351
|
).join(" ")
|
|
991
|
-
),
|
|
992
|
-
(
|
|
993
|
-
var
|
|
994
|
-
return ((
|
|
352
|
+
), t = e.map((o, s) => this._commands.some(
|
|
353
|
+
(c) => {
|
|
354
|
+
var d;
|
|
355
|
+
return ((d = c.segments[s]) == null ? void 0 : d.type) === "argument";
|
|
995
356
|
}
|
|
996
|
-
) ? "*" :
|
|
997
|
-
return
|
|
357
|
+
) ? "*" : o).join(" ");
|
|
358
|
+
return n.includes(t);
|
|
998
359
|
}
|
|
999
360
|
/**
|
|
1000
361
|
* Gets possible matches for a given path.
|
|
@@ -1003,8 +364,8 @@ class Ie {
|
|
|
1003
364
|
* @returns An array of completion strings.
|
|
1004
365
|
*/
|
|
1005
366
|
// used by AvailableCommands
|
|
1006
|
-
getCompletions_s(
|
|
1007
|
-
return this.getCompletions(
|
|
367
|
+
getCompletions_s(e) {
|
|
368
|
+
return this.getCompletions(e).map((n) => n.name);
|
|
1008
369
|
}
|
|
1009
370
|
/**
|
|
1010
371
|
* Gets an array of segments reachable from a given path
|
|
@@ -1012,51 +373,51 @@ class Ie {
|
|
|
1012
373
|
* @param path The path to get completions for.
|
|
1013
374
|
* @returns An array of completion strings.
|
|
1014
375
|
*/
|
|
1015
|
-
getCompletions(
|
|
1016
|
-
if (
|
|
1017
|
-
const s = this._commands.map((
|
|
376
|
+
getCompletions(e) {
|
|
377
|
+
if (C.debug("[getCompletions] path: ", e), !e.length) {
|
|
378
|
+
const s = this._commands.map((d) => d.segments[0]), i = (d, l) => d.type === l.type && d.name === l.name;
|
|
1018
379
|
return s.filter(
|
|
1019
|
-
(
|
|
380
|
+
(d, l, u) => l === u.findIndex((p) => i(p, d))
|
|
1020
381
|
);
|
|
1021
382
|
}
|
|
1022
|
-
const
|
|
383
|
+
const n = e.length;
|
|
1023
384
|
return this._commands.filter((s) => {
|
|
1024
|
-
const
|
|
1025
|
-
if (
|
|
385
|
+
const i = s.segments;
|
|
386
|
+
if (i.length <= n - 1)
|
|
1026
387
|
return !1;
|
|
1027
|
-
for (let
|
|
1028
|
-
const
|
|
1029
|
-
if (!(
|
|
388
|
+
for (let c = 0; c < n; c++) {
|
|
389
|
+
const d = e[c], l = i[c];
|
|
390
|
+
if (!(d === "*" && l.type === "argument") && d !== l.name)
|
|
1030
391
|
return !1;
|
|
1031
392
|
}
|
|
1032
393
|
return !0;
|
|
1033
|
-
}).filter((s) => s.segments.length >
|
|
1034
|
-
const
|
|
1035
|
-
return new
|
|
394
|
+
}).filter((s) => s.segments.length > n).map((s) => {
|
|
395
|
+
const i = s.segments[n], c = i.type === "argument" ? He : Pe;
|
|
396
|
+
return new c(i.name, i.description);
|
|
1036
397
|
}).filter(
|
|
1037
|
-
(s,
|
|
1038
|
-
(
|
|
398
|
+
(s, i, c) => i === c.findIndex(
|
|
399
|
+
(d) => d.type === s.type && d.name === s.name
|
|
1039
400
|
)
|
|
1040
401
|
);
|
|
1041
402
|
}
|
|
1042
|
-
hasNextSegment(
|
|
1043
|
-
return this.getCompletions(
|
|
403
|
+
hasNextSegment(e) {
|
|
404
|
+
return this.getCompletions(e).length > 0;
|
|
1044
405
|
}
|
|
1045
406
|
}
|
|
1046
|
-
class
|
|
407
|
+
class le {
|
|
1047
408
|
constructor() {
|
|
1048
|
-
|
|
1049
|
-
|
|
1050
|
-
|
|
409
|
+
b(this, "segments", []);
|
|
410
|
+
b(this, "nullSegment", new ie());
|
|
411
|
+
b(this, "observers", []);
|
|
1051
412
|
}
|
|
1052
|
-
subscribe(
|
|
1053
|
-
this.observers.push(
|
|
413
|
+
subscribe(e) {
|
|
414
|
+
this.observers.push(e);
|
|
1054
415
|
}
|
|
1055
|
-
unsubscribe(
|
|
1056
|
-
this.observers = this.observers.filter((
|
|
416
|
+
unsubscribe(e) {
|
|
417
|
+
this.observers = this.observers.filter((n) => n !== e);
|
|
1057
418
|
}
|
|
1058
419
|
notifyObservers() {
|
|
1059
|
-
this.observers.forEach((
|
|
420
|
+
this.observers.forEach((e) => e.update());
|
|
1060
421
|
}
|
|
1061
422
|
/**
|
|
1062
423
|
* Clears all segments from the stack
|
|
@@ -1067,22 +428,22 @@ class yn {
|
|
|
1067
428
|
/**
|
|
1068
429
|
* Pushes a new segment onto the stack
|
|
1069
430
|
*/
|
|
1070
|
-
push(
|
|
1071
|
-
this.segments.push(
|
|
431
|
+
push(e) {
|
|
432
|
+
this.segments.push(e), this.notifyObservers();
|
|
1072
433
|
}
|
|
1073
434
|
/**
|
|
1074
435
|
* Pushes an array of segments onto the stack
|
|
1075
436
|
*/
|
|
1076
|
-
pushAll(
|
|
1077
|
-
|
|
437
|
+
pushAll(e) {
|
|
438
|
+
e.forEach((n) => this.push(n));
|
|
1078
439
|
}
|
|
1079
440
|
/**
|
|
1080
441
|
* Removes and returns the top segment from the stack
|
|
1081
442
|
* Returns NullSegment if stack is empty
|
|
1082
443
|
*/
|
|
1083
444
|
pop() {
|
|
1084
|
-
const
|
|
1085
|
-
return this.notifyObservers(),
|
|
445
|
+
const e = this.segments.pop() || this.nullSegment;
|
|
446
|
+
return this.notifyObservers(), e;
|
|
1086
447
|
}
|
|
1087
448
|
/**
|
|
1088
449
|
* Returns the top segment without removing it
|
|
@@ -1107,21 +468,21 @@ class yn {
|
|
|
1107
468
|
* Returns true if any segment in the stack is an argument
|
|
1108
469
|
*/
|
|
1109
470
|
get hasArguments() {
|
|
1110
|
-
return this.segments.some((
|
|
471
|
+
return this.segments.some((e) => e.type === "argument");
|
|
1111
472
|
}
|
|
1112
473
|
/**
|
|
1113
474
|
* Returns all argument segments in the stack
|
|
1114
475
|
*/
|
|
1115
476
|
get arguments() {
|
|
1116
477
|
return this.segments.filter(
|
|
1117
|
-
(
|
|
478
|
+
(e) => e.type === "argument"
|
|
1118
479
|
);
|
|
1119
480
|
}
|
|
1120
481
|
/**
|
|
1121
482
|
* Returns the command path as an array of segment names
|
|
1122
483
|
*/
|
|
1123
484
|
path() {
|
|
1124
|
-
return this.segments.map((
|
|
485
|
+
return this.segments.map((e) => e.name);
|
|
1125
486
|
}
|
|
1126
487
|
/**
|
|
1127
488
|
* Returns a copy of the internal segments array
|
|
@@ -1130,253 +491,240 @@ class yn {
|
|
|
1130
491
|
return [...this.segments];
|
|
1131
492
|
}
|
|
1132
493
|
}
|
|
1133
|
-
const
|
|
1134
|
-
config:
|
|
1135
|
-
commands: new
|
|
1136
|
-
segmentStack: new
|
|
1137
|
-
},
|
|
1138
|
-
const [
|
|
1139
|
-
...
|
|
1140
|
-
...
|
|
494
|
+
const Ue = {
|
|
495
|
+
config: A,
|
|
496
|
+
commands: new J(),
|
|
497
|
+
segmentStack: new le()
|
|
498
|
+
}, O = fe(Ue), Fe = ({ config: r = A, commandRegistry: e, children: n }) => {
|
|
499
|
+
const [t, o] = L.useState(), s = {
|
|
500
|
+
...A,
|
|
501
|
+
...r,
|
|
1141
502
|
// Ensure nested objects are properly merged
|
|
1142
503
|
storage: {
|
|
1143
|
-
...
|
|
1144
|
-
...
|
|
504
|
+
...A.storage,
|
|
505
|
+
...r.storage
|
|
1145
506
|
},
|
|
1146
507
|
// Ensure explicit values from config take precedence
|
|
1147
|
-
cursorType:
|
|
1148
|
-
cursorColor:
|
|
1149
|
-
cursorSpeed:
|
|
1150
|
-
showCitadelKey:
|
|
508
|
+
cursorType: r.cursorType ?? A.cursorType,
|
|
509
|
+
cursorColor: r.cursorColor ?? A.cursorColor,
|
|
510
|
+
cursorSpeed: r.cursorSpeed ?? A.cursorSpeed,
|
|
511
|
+
showCitadelKey: r.showCitadelKey || "."
|
|
1151
512
|
};
|
|
1152
|
-
|
|
1153
|
-
|
|
1154
|
-
s.storage ??
|
|
1155
|
-
),
|
|
1156
|
-
}, []),
|
|
1157
|
-
if (
|
|
1158
|
-
const
|
|
1159
|
-
|
|
513
|
+
_(() => {
|
|
514
|
+
q.getInstance().initializeStorage(
|
|
515
|
+
s.storage ?? A.storage
|
|
516
|
+
), o(q.getInstance().getStorage());
|
|
517
|
+
}, []), _(() => {
|
|
518
|
+
if (e && s.includeHelpCommand && !e.commandExistsForPath(["help"])) {
|
|
519
|
+
const c = ze(e);
|
|
520
|
+
e.addCommand(
|
|
1160
521
|
[{ type: "word", name: "help" }],
|
|
1161
522
|
"Show available commands",
|
|
1162
|
-
|
|
523
|
+
c
|
|
1163
524
|
);
|
|
1164
525
|
}
|
|
1165
|
-
}, [
|
|
1166
|
-
const
|
|
526
|
+
}, [e, s.includeHelpCommand]);
|
|
527
|
+
const i = {
|
|
1167
528
|
config: s,
|
|
1168
|
-
commands:
|
|
1169
|
-
storage:
|
|
1170
|
-
segmentStack: new
|
|
529
|
+
commands: e || new J(),
|
|
530
|
+
storage: t,
|
|
531
|
+
segmentStack: new le()
|
|
1171
532
|
};
|
|
1172
|
-
return /* @__PURE__ */ m
|
|
1173
|
-
},
|
|
1174
|
-
const
|
|
1175
|
-
if (
|
|
533
|
+
return /* @__PURE__ */ m(O.Provider, { value: i, children: n });
|
|
534
|
+
}, $ = () => {
|
|
535
|
+
const r = Y(O);
|
|
536
|
+
if (r === void 0)
|
|
1176
537
|
throw new Error("useCitadelConfig must be used within a CitadelConfigProvider");
|
|
1177
|
-
return
|
|
1178
|
-
},
|
|
1179
|
-
const
|
|
1180
|
-
if (
|
|
538
|
+
return r.config;
|
|
539
|
+
}, B = () => {
|
|
540
|
+
const r = Y(O);
|
|
541
|
+
if (r === void 0)
|
|
1181
542
|
throw new Error("useCitadelCommands must be used within a CitadelConfigProvider");
|
|
1182
|
-
return
|
|
1183
|
-
},
|
|
1184
|
-
const
|
|
1185
|
-
if (
|
|
543
|
+
return r.commands;
|
|
544
|
+
}, ce = () => {
|
|
545
|
+
const r = Y(O);
|
|
546
|
+
if (r === void 0)
|
|
1186
547
|
throw new Error("useCitadelStorage must be used within a CitadelConfigProvider");
|
|
1187
|
-
return
|
|
1188
|
-
},
|
|
1189
|
-
const
|
|
1190
|
-
if (
|
|
548
|
+
return r.storage;
|
|
549
|
+
}, K = () => {
|
|
550
|
+
const r = Y(O);
|
|
551
|
+
if (r === void 0)
|
|
1191
552
|
throw new Error("useSegmentStack must be used within a CitadelConfigProvider");
|
|
1192
|
-
return
|
|
553
|
+
return r.segmentStack;
|
|
1193
554
|
};
|
|
1194
|
-
class
|
|
1195
|
-
constructor(
|
|
1196
|
-
|
|
1197
|
-
|
|
1198
|
-
|
|
1199
|
-
this.command =
|
|
555
|
+
class Te {
|
|
556
|
+
constructor(e, n) {
|
|
557
|
+
b(this, "timestamp");
|
|
558
|
+
b(this, "command");
|
|
559
|
+
b(this, "result");
|
|
560
|
+
this.command = e.toArray().map((t) => t.type === "argument" ? t.value || "" : t.name), this.timestamp = Date.now(), this.result = n ?? new Ae();
|
|
1200
561
|
}
|
|
1201
562
|
}
|
|
1202
|
-
|
|
1203
|
-
const o = ue(), [n, t] = Y(0);
|
|
1204
|
-
return I(() => {
|
|
1205
|
-
const r = {
|
|
1206
|
-
update: () => {
|
|
1207
|
-
t((i) => i + 1);
|
|
1208
|
-
}
|
|
1209
|
-
};
|
|
1210
|
-
return o.subscribe(r), () => {
|
|
1211
|
-
o.unsubscribe(r);
|
|
1212
|
-
};
|
|
1213
|
-
}, [o]), n;
|
|
1214
|
-
};
|
|
1215
|
-
function _t(o) {
|
|
563
|
+
function je(r) {
|
|
1216
564
|
return {
|
|
1217
|
-
commandSegments:
|
|
565
|
+
commandSegments: r,
|
|
1218
566
|
timestamp: Date.now()
|
|
1219
567
|
};
|
|
1220
568
|
}
|
|
1221
|
-
function
|
|
1222
|
-
const
|
|
569
|
+
function de() {
|
|
570
|
+
const r = ce(), [e, n] = R({
|
|
1223
571
|
storedCommands: [],
|
|
1224
572
|
position: null
|
|
1225
|
-
}),
|
|
1226
|
-
if (
|
|
573
|
+
}), t = w(async (c) => {
|
|
574
|
+
if (r)
|
|
1227
575
|
try {
|
|
1228
|
-
const
|
|
1229
|
-
await
|
|
1230
|
-
...
|
|
1231
|
-
storedCommands: [...
|
|
576
|
+
const d = je(c);
|
|
577
|
+
await r.addStoredCommand(d), n((l) => ({
|
|
578
|
+
...l,
|
|
579
|
+
storedCommands: [...l.storedCommands, d],
|
|
1232
580
|
position: null
|
|
1233
581
|
}));
|
|
1234
|
-
} catch (
|
|
1235
|
-
console.warn("Failed to save command to history:",
|
|
582
|
+
} catch (d) {
|
|
583
|
+
console.warn("Failed to save command to history:", d);
|
|
1236
584
|
}
|
|
1237
|
-
}, [
|
|
1238
|
-
|
|
1239
|
-
if (!
|
|
585
|
+
}, [r]), o = w(async () => r ? await r.getStoredCommands() : [], [r]);
|
|
586
|
+
_(() => {
|
|
587
|
+
if (!r) return;
|
|
1240
588
|
(async () => {
|
|
1241
589
|
try {
|
|
1242
|
-
const
|
|
1243
|
-
return
|
|
1244
|
-
...
|
|
1245
|
-
storedCommands:
|
|
1246
|
-
})),
|
|
1247
|
-
} catch (
|
|
1248
|
-
console.warn("Failed to load command history:",
|
|
590
|
+
const d = await r.getStoredCommands();
|
|
591
|
+
return n((l) => ({
|
|
592
|
+
...l,
|
|
593
|
+
storedCommands: d
|
|
594
|
+
})), d;
|
|
595
|
+
} catch (d) {
|
|
596
|
+
console.warn("Failed to load command history:", d);
|
|
1249
597
|
}
|
|
1250
598
|
})();
|
|
1251
|
-
}, [
|
|
1252
|
-
const s =
|
|
1253
|
-
if ((await
|
|
599
|
+
}, [r]);
|
|
600
|
+
const s = w(async (c) => {
|
|
601
|
+
if ((await o()).length === 0)
|
|
1254
602
|
return { segments: null, position: null };
|
|
1255
|
-
let
|
|
1256
|
-
return
|
|
1257
|
-
...
|
|
1258
|
-
position:
|
|
1259
|
-
})),
|
|
603
|
+
let l = null;
|
|
604
|
+
return c === "up" ? e.position === null ? l = e.storedCommands.length - 1 : e.position > 0 ? l = e.position - 1 : l = 0 : e.position === null || e.position >= e.storedCommands.length - 1 ? l = null : l = e.position + 1, n((p) => ({
|
|
605
|
+
...p,
|
|
606
|
+
position: l
|
|
607
|
+
})), l === null ? {
|
|
1260
608
|
segments: [],
|
|
1261
609
|
position: null
|
|
1262
610
|
} : {
|
|
1263
|
-
segments:
|
|
1264
|
-
position:
|
|
611
|
+
segments: l !== null ? e.storedCommands[l].commandSegments : null,
|
|
612
|
+
position: l
|
|
1265
613
|
};
|
|
1266
|
-
}, [
|
|
614
|
+
}, [e, o]), i = w(async () => {
|
|
1267
615
|
try {
|
|
1268
|
-
if (!
|
|
1269
|
-
await
|
|
616
|
+
if (!r) return;
|
|
617
|
+
await r.clear(), n({
|
|
1270
618
|
storedCommands: [],
|
|
1271
619
|
position: null
|
|
1272
620
|
});
|
|
1273
|
-
} catch (
|
|
1274
|
-
console.warn("Failed to clear command history:",
|
|
621
|
+
} catch (c) {
|
|
622
|
+
console.warn("Failed to clear command history:", c);
|
|
1275
623
|
}
|
|
1276
|
-
}, [
|
|
624
|
+
}, [r]);
|
|
1277
625
|
return {
|
|
1278
|
-
history:
|
|
1279
|
-
addStoredCommand:
|
|
1280
|
-
getStoredCommands:
|
|
626
|
+
history: e,
|
|
627
|
+
addStoredCommand: t,
|
|
628
|
+
getStoredCommands: o,
|
|
1281
629
|
navigateHistory: s,
|
|
1282
|
-
clear:
|
|
630
|
+
clear: i
|
|
1283
631
|
};
|
|
1284
632
|
}
|
|
1285
|
-
const
|
|
1286
|
-
const
|
|
633
|
+
const me = () => {
|
|
634
|
+
const r = $(), e = B(), n = de(), t = K(), o = ce(), [s, i] = R({
|
|
1287
635
|
currentInput: "",
|
|
1288
636
|
isEnteringArg: !1,
|
|
1289
637
|
output: [],
|
|
1290
638
|
history: {
|
|
1291
639
|
commands: [],
|
|
1292
640
|
position: null,
|
|
1293
|
-
storage:
|
|
641
|
+
storage: o
|
|
1294
642
|
}
|
|
1295
643
|
});
|
|
1296
|
-
|
|
1297
|
-
}, [
|
|
1298
|
-
|
|
1299
|
-
...
|
|
644
|
+
_(() => {
|
|
645
|
+
}, [o]), _(() => {
|
|
646
|
+
i((u) => ({
|
|
647
|
+
...u,
|
|
1300
648
|
history: {
|
|
1301
|
-
commands:
|
|
1302
|
-
position:
|
|
1303
|
-
storage:
|
|
649
|
+
commands: n.history.storedCommands,
|
|
650
|
+
position: n.history.position,
|
|
651
|
+
storage: o
|
|
1304
652
|
}
|
|
1305
653
|
}));
|
|
1306
|
-
}, [
|
|
1307
|
-
const
|
|
1308
|
-
setCurrentInput:
|
|
1309
|
-
|
|
654
|
+
}, [n.history, o]);
|
|
655
|
+
const c = {
|
|
656
|
+
setCurrentInput: w((u) => {
|
|
657
|
+
C.debug("[CitadelActions] setCurrentInput: ", u), i((p) => ({ ...p, currentInput: u }));
|
|
1310
658
|
}, []),
|
|
1311
|
-
setIsEnteringArg:
|
|
1312
|
-
|
|
659
|
+
setIsEnteringArg: w((u) => {
|
|
660
|
+
C.debug("[CitadelActions] setIsEnteringArg: ", u), i((p) => ({ ...p, isEnteringArg: u }));
|
|
1313
661
|
}, []),
|
|
1314
|
-
addOutput:
|
|
1315
|
-
|
|
1316
|
-
...
|
|
1317
|
-
output: [...
|
|
662
|
+
addOutput: w((u) => {
|
|
663
|
+
C.debug("[CitadelActions]addOutput: ", u), i((p) => ({
|
|
664
|
+
...p,
|
|
665
|
+
output: [...p.output, u]
|
|
1318
666
|
}));
|
|
1319
667
|
}, []),
|
|
1320
|
-
executeCommand:
|
|
1321
|
-
const
|
|
1322
|
-
if (!
|
|
1323
|
-
console.error("[CitadelActions][executeCommand] Cannot execute command because no command was found for the given path: ",
|
|
668
|
+
executeCommand: w(async () => {
|
|
669
|
+
const u = t.path(), p = e.getCommand(u);
|
|
670
|
+
if (!p) {
|
|
671
|
+
console.error("[CitadelActions][executeCommand] Cannot execute command because no command was found for the given path: ", u);
|
|
1324
672
|
return;
|
|
1325
673
|
}
|
|
1326
|
-
const
|
|
1327
|
-
|
|
1328
|
-
...
|
|
1329
|
-
output: [...
|
|
674
|
+
const S = new Te(t);
|
|
675
|
+
i((y) => ({
|
|
676
|
+
...y,
|
|
677
|
+
output: [...y.output, S]
|
|
1330
678
|
}));
|
|
1331
679
|
try {
|
|
1332
|
-
const
|
|
680
|
+
const y = new Promise((a, g) => {
|
|
1333
681
|
setTimeout(() => {
|
|
1334
|
-
|
|
1335
|
-
},
|
|
1336
|
-
}),
|
|
1337
|
-
|
|
1338
|
-
|
|
682
|
+
g(new Error("Request timed out"));
|
|
683
|
+
}, r.commandTimeoutMs);
|
|
684
|
+
}), z = t.arguments.map((a) => a.value || ""), E = await Promise.race([
|
|
685
|
+
p.handler(z),
|
|
686
|
+
y
|
|
1339
687
|
]);
|
|
1340
|
-
if (!(
|
|
688
|
+
if (!(E instanceof F))
|
|
1341
689
|
throw new Error(
|
|
1342
|
-
`The ${
|
|
690
|
+
`The ${u.join(".")} command returned an invalid result type. Commands must return an instance of a CommandResult.
|
|
1343
691
|
For example:
|
|
1344
692
|
return new JsonCommandResult({ text: "Hello World" });
|
|
1345
|
-
Check the definition of the ${
|
|
693
|
+
Check the definition of the ${u.join(".")} command and update the return type for its handler.`
|
|
1346
694
|
);
|
|
1347
|
-
|
|
1348
|
-
...
|
|
1349
|
-
output:
|
|
1350
|
-
(
|
|
695
|
+
E.markSuccess(), i((a) => ({
|
|
696
|
+
...a,
|
|
697
|
+
output: a.output.map(
|
|
698
|
+
(g) => g.timestamp === S.timestamp ? { ...g, result: E } : g
|
|
1351
699
|
)
|
|
1352
700
|
}));
|
|
1353
|
-
} catch (
|
|
1354
|
-
const
|
|
1355
|
-
|
|
701
|
+
} catch (y) {
|
|
702
|
+
const z = new _e(
|
|
703
|
+
y instanceof Error ? y.message : "Unknown error"
|
|
1356
704
|
);
|
|
1357
|
-
|
|
1358
|
-
...
|
|
1359
|
-
output:
|
|
1360
|
-
(
|
|
705
|
+
z.markFailure(), i((E) => ({
|
|
706
|
+
...E,
|
|
707
|
+
output: E.output.map(
|
|
708
|
+
(a) => a.timestamp === S.timestamp ? { ...a, result: z } : a
|
|
1361
709
|
)
|
|
1362
710
|
}));
|
|
1363
711
|
}
|
|
1364
|
-
}, [
|
|
1365
|
-
clearHistory:
|
|
712
|
+
}, [e, r.commandTimeoutMs, t]),
|
|
713
|
+
clearHistory: w(async () => {
|
|
1366
714
|
try {
|
|
1367
|
-
await
|
|
1368
|
-
} catch (
|
|
1369
|
-
console.warn("Failed to clear history:",
|
|
715
|
+
await n.clear();
|
|
716
|
+
} catch (u) {
|
|
717
|
+
console.warn("Failed to clear history:", u);
|
|
1370
718
|
}
|
|
1371
|
-
}, [
|
|
1372
|
-
},
|
|
719
|
+
}, [n])
|
|
720
|
+
}, d = w(() => e.getCompletions_s(t.path()), [t, e]), l = w(() => e.getCompletions(t.path()), [t, e]);
|
|
1373
721
|
return {
|
|
1374
|
-
state:
|
|
1375
|
-
actions:
|
|
1376
|
-
getAvailableCommands_s:
|
|
1377
|
-
getAvailableCommandSegments:
|
|
722
|
+
state: s,
|
|
723
|
+
actions: c,
|
|
724
|
+
getAvailableCommands_s: d,
|
|
725
|
+
getAvailableCommandSegments: l
|
|
1378
726
|
};
|
|
1379
|
-
},
|
|
727
|
+
}, Me = {
|
|
1380
728
|
blink: {
|
|
1381
729
|
character: "▋",
|
|
1382
730
|
speed: 530,
|
|
@@ -1397,404 +745,424 @@ Check the definition of the ${g.join(".")} command and update the return type fo
|
|
|
1397
745
|
speed: 120,
|
|
1398
746
|
color: "#fff"
|
|
1399
747
|
}
|
|
1400
|
-
},
|
|
1401
|
-
style:
|
|
1402
|
-
isValid:
|
|
1403
|
-
errorMessage:
|
|
748
|
+
}, X = ["⠋", "⠙", "⠹", "⠸", "⠼", "⠴", "⠦", "⠧", "⠇", "⠏"], Z = ["|", "/", "-", "\\"], Oe = ({
|
|
749
|
+
style: r = { type: "blink" },
|
|
750
|
+
isValid: e = !0,
|
|
751
|
+
errorMessage: n
|
|
1404
752
|
}) => {
|
|
1405
|
-
const
|
|
1406
|
-
...
|
|
1407
|
-
...
|
|
1408
|
-
}), [
|
|
1409
|
-
|
|
1410
|
-
if (
|
|
1411
|
-
const
|
|
1412
|
-
|
|
1413
|
-
},
|
|
1414
|
-
return () => clearInterval(
|
|
1415
|
-
}, [
|
|
1416
|
-
const
|
|
1417
|
-
color:
|
|
753
|
+
const t = V(() => ({
|
|
754
|
+
...Me[r.type],
|
|
755
|
+
...r
|
|
756
|
+
}), [r]), [o, s] = R(!0), [i, c] = R(0);
|
|
757
|
+
_(() => {
|
|
758
|
+
if (t.speed === 0) return;
|
|
759
|
+
const u = setInterval(() => {
|
|
760
|
+
t.type === "blink" ? s((p) => !p) : ["spin", "bbs"].includes(t.type) && c((p) => (p + 1) % (t.type === "bbs" ? Z.length : X.length));
|
|
761
|
+
}, t.speed);
|
|
762
|
+
return () => clearInterval(u);
|
|
763
|
+
}, [t.type, t.speed]);
|
|
764
|
+
const d = V(() => ({
|
|
765
|
+
color: e ? t.color : "#ff4444",
|
|
1418
766
|
transition: "color 0.15s ease-in-out"
|
|
1419
|
-
}), [
|
|
1420
|
-
return /* @__PURE__ */ m
|
|
767
|
+
}), [e, t.color]);
|
|
768
|
+
return /* @__PURE__ */ m("div", { className: "relative inline-block", children: /* @__PURE__ */ m(
|
|
1421
769
|
"span",
|
|
1422
770
|
{
|
|
1423
|
-
className: `command-cursor ${
|
|
1424
|
-
style:
|
|
1425
|
-
title:
|
|
1426
|
-
children:
|
|
771
|
+
className: `command-cursor ${e ? "" : "animate-shake"}`,
|
|
772
|
+
style: d,
|
|
773
|
+
title: n,
|
|
774
|
+
children: !e && n ? "✗" : ["spin", "bbs"].includes(t.type) ? (t.type === "bbs" ? Z : X)[i] : t.type === "solid" || o ? t.character : " "
|
|
1427
775
|
}
|
|
1428
776
|
) });
|
|
1429
777
|
};
|
|
1430
|
-
function
|
|
1431
|
-
switch (
|
|
778
|
+
function $e(r, e) {
|
|
779
|
+
switch (e.type) {
|
|
1432
780
|
case "set":
|
|
1433
|
-
return
|
|
781
|
+
return C.debug(`[inputStateReducer] InputState changing from ${r} to ${e.state}`), e.state;
|
|
1434
782
|
default:
|
|
1435
|
-
return
|
|
1436
|
-
}
|
|
1437
|
-
}
|
|
1438
|
-
const
|
|
1439
|
-
const { state:
|
|
1440
|
-
|
|
1441
|
-
},
|
|
1442
|
-
const
|
|
1443
|
-
return
|
|
1444
|
-
},
|
|
1445
|
-
if (!
|
|
1446
|
-
const
|
|
1447
|
-
const
|
|
1448
|
-
return (
|
|
783
|
+
return r;
|
|
784
|
+
}
|
|
785
|
+
}
|
|
786
|
+
const Ke = () => {
|
|
787
|
+
const { state: r } = me(), e = B(), n = de(), t = K(), [o, s] = we($e, "idle"), i = (a) => {
|
|
788
|
+
s({ type: "set", state: a });
|
|
789
|
+
}, c = w(() => {
|
|
790
|
+
const g = e.getCompletions(t.path())[0] || t.nullSegment;
|
|
791
|
+
return C.debug("[getNextExpectedSegment] ", g), g;
|
|
792
|
+
}, [e, t]), d = w(() => e.getCompletions_s(t.path()).map((g) => e.getCommand([...t.path(), g])).filter((g) => g !== void 0), [e, t]), l = w((a, g) => {
|
|
793
|
+
if (!a) return g;
|
|
794
|
+
const h = g.reduce((f, x) => {
|
|
795
|
+
const v = c();
|
|
796
|
+
return (v == null ? void 0 : v.type) === "word" && f.set(v.name, x), f;
|
|
1449
797
|
}, /* @__PURE__ */ new Map());
|
|
1450
|
-
return Array.from(
|
|
1451
|
-
const
|
|
1452
|
-
return
|
|
798
|
+
return Array.from(h.values()).filter(() => {
|
|
799
|
+
const f = c();
|
|
800
|
+
return f.type !== "word" ? !1 : f.name.toLowerCase().startsWith(a.toLowerCase());
|
|
1453
801
|
});
|
|
1454
|
-
}, []),
|
|
1455
|
-
const
|
|
1456
|
-
(
|
|
802
|
+
}, [c]), u = w((a) => {
|
|
803
|
+
const h = e.getCompletions(t.path()).filter((k) => k.type === "word").filter(
|
|
804
|
+
(k) => k.name.toLowerCase().startsWith(a.toLowerCase())
|
|
1457
805
|
);
|
|
1458
|
-
return
|
|
1459
|
-
}, [
|
|
1460
|
-
const
|
|
1461
|
-
return
|
|
1462
|
-
(
|
|
806
|
+
return h.length === 1 ? h[0] : t.nullSegment;
|
|
807
|
+
}, [e, t]), p = w((a) => {
|
|
808
|
+
const g = t.path(), h = e.getCompletions(g);
|
|
809
|
+
return h.length === 0 && a ? !1 : h.some((f) => f.type === "argument") ? !0 : h.some(
|
|
810
|
+
(f) => f.type === "word" && f.name.toLowerCase().startsWith(a.toLowerCase())
|
|
1463
811
|
);
|
|
1464
|
-
}, [
|
|
1465
|
-
|
|
1466
|
-
const
|
|
1467
|
-
return !
|
|
1468
|
-
}, [
|
|
1469
|
-
if (
|
|
1470
|
-
if (
|
|
1471
|
-
const
|
|
1472
|
-
if (
|
|
1473
|
-
if (
|
|
1474
|
-
const
|
|
1475
|
-
if (
|
|
1476
|
-
const
|
|
1477
|
-
|
|
812
|
+
}, [e, t]), S = w((a) => {
|
|
813
|
+
C.debug("[tryAutoComplete] input: ", a);
|
|
814
|
+
const g = u(a);
|
|
815
|
+
return !g || g.name === a ? new ie() : (C.debug("[tryAutoComplete] result: ", g), g);
|
|
816
|
+
}, [u]), y = w((a, g) => {
|
|
817
|
+
if (r.history.position === null) {
|
|
818
|
+
if (g.setCurrentInput(a), C.debug("[useCommandParser][handleInputChange] newValue: ", a), o === "entering_argument") {
|
|
819
|
+
const h = ee(a);
|
|
820
|
+
if (h.isQuoted)
|
|
821
|
+
if (h.isComplete) {
|
|
822
|
+
const k = c();
|
|
823
|
+
if (k.type === "argument") {
|
|
824
|
+
const f = k;
|
|
825
|
+
f.value = a.trim() || "", C.debug("[useCommandParser][handleInputChange][entering_command] pushing: ", f), t.push(f), g.setCurrentInput(""), i("idle");
|
|
1478
826
|
return;
|
|
1479
827
|
}
|
|
1480
828
|
} else
|
|
1481
829
|
return;
|
|
1482
|
-
else if (
|
|
1483
|
-
const
|
|
1484
|
-
|
|
830
|
+
else if (h.isComplete) {
|
|
831
|
+
const k = c();
|
|
832
|
+
k.value = a.trim() || "", C.debug("[useCommandParser][handleInputChange][entering_command] pushing: ", k), t.push(k), g.setCurrentInput(""), i("idle");
|
|
1485
833
|
return;
|
|
1486
834
|
} else
|
|
1487
835
|
return;
|
|
1488
836
|
}
|
|
1489
|
-
if (
|
|
1490
|
-
const
|
|
1491
|
-
if (
|
|
1492
|
-
|
|
837
|
+
if (o == "entering_command") {
|
|
838
|
+
const h = S(a);
|
|
839
|
+
if (h.type === "word") {
|
|
840
|
+
C.debug("[useCommandParser][handleInputChange][entering_command] pushing: ", h), t.push(h), g.setCurrentInput(""), i("idle");
|
|
1493
841
|
return;
|
|
1494
842
|
}
|
|
1495
843
|
}
|
|
1496
844
|
}
|
|
1497
|
-
}, [
|
|
1498
|
-
|
|
1499
|
-
|
|
1500
|
-
|
|
1501
|
-
|
|
1502
|
-
|
|
1503
|
-
|
|
1504
|
-
|
|
1505
|
-
|
|
845
|
+
}, [S, r, c, o, t]), z = w((a) => {
|
|
846
|
+
a.setCurrentInput(""), a.setIsEnteringArg(!1), t.clear(), i("idle");
|
|
847
|
+
}, [t]), E = w((a, g, h) => {
|
|
848
|
+
if (!(a.key === "Backspace" || a.key === "Enter" || a.key === "ArrowUp" || a.key === "ArrowDown" || a.key === "ArrowLeft" || a.key === "ArrowRight" || a.key === "Escape" || a.key === "Delete" || a.key === "Home" || a.key === "End" || a.key.length === 1))
|
|
849
|
+
return !0;
|
|
850
|
+
const { currentInput: f, isEnteringArg: x } = g, v = ee(f);
|
|
851
|
+
switch (a.key) {
|
|
852
|
+
case "Backspace":
|
|
853
|
+
return f === "" && (a.preventDefault(), t.size() > 0 && t.pop(), i("idle")), !0;
|
|
1506
854
|
case "Enter": {
|
|
1507
|
-
if (
|
|
1508
|
-
return;
|
|
1509
|
-
if (
|
|
1510
|
-
const
|
|
1511
|
-
|
|
855
|
+
if (a.preventDefault(), v.isQuoted && !v.isComplete)
|
|
856
|
+
return !0;
|
|
857
|
+
if (o === "entering_argument" || x && f.trim()) {
|
|
858
|
+
const H = c();
|
|
859
|
+
H.value = f, C.debug("[handleKeyDown][Enter]['entering_argument'] pushing: ", H), t.push(H);
|
|
1512
860
|
}
|
|
1513
|
-
|
|
1514
|
-
|
|
1515
|
-
|
|
1516
|
-
|
|
1517
|
-
|
|
1518
|
-
|
|
1519
|
-
|
|
1520
|
-
return;
|
|
1521
|
-
}
|
|
1522
|
-
case "ArrowDown": {
|
|
1523
|
-
c.preventDefault();
|
|
1524
|
-
const H = await t.navigateHistory("down", r.toArray());
|
|
1525
|
-
H.segments && (r.clear(), r.pushAll(H.segments), E.setCurrentInput(""));
|
|
1526
|
-
return;
|
|
861
|
+
const I = t.path(), P = e.getCommand(I);
|
|
862
|
+
if (P) {
|
|
863
|
+
const T = P.segments.filter((j) => j.type === "argument"), H = t.arguments;
|
|
864
|
+
if (T.length > H.length)
|
|
865
|
+
return !1;
|
|
866
|
+
}
|
|
867
|
+
return C.debug("[handleKeyDown][Enter] calling actions.executeCommand. segmentStack: ", t), h.executeCommand(), n.addStoredCommand(t.toArray()), z(h), !0;
|
|
1527
868
|
}
|
|
1528
|
-
|
|
1529
|
-
|
|
1530
|
-
const
|
|
1531
|
-
|
|
1532
|
-
|
|
1533
|
-
|
|
1534
|
-
|
|
869
|
+
case "ArrowUp":
|
|
870
|
+
return a.preventDefault(), (async () => {
|
|
871
|
+
const I = await n.navigateHistory("up", t.toArray());
|
|
872
|
+
return I.segments && (t.clear(), t.pushAll(I.segments), h.setCurrentInput("")), !0;
|
|
873
|
+
})();
|
|
874
|
+
case "ArrowDown":
|
|
875
|
+
return a.preventDefault(), (async () => {
|
|
876
|
+
const I = await n.navigateHistory("down", t.toArray());
|
|
877
|
+
return I.segments && (t.clear(), t.pushAll(I.segments), h.setCurrentInput("")), !0;
|
|
878
|
+
})();
|
|
879
|
+
default: {
|
|
880
|
+
if (!x && a.key.length === 1) {
|
|
881
|
+
const I = f + a.key;
|
|
882
|
+
if (!p(I))
|
|
883
|
+
return a.preventDefault(), !1;
|
|
1535
884
|
}
|
|
885
|
+
return !0;
|
|
886
|
+
}
|
|
1536
887
|
}
|
|
1537
888
|
}, [
|
|
889
|
+
o,
|
|
890
|
+
p,
|
|
891
|
+
c,
|
|
1538
892
|
n,
|
|
1539
|
-
|
|
1540
|
-
|
|
1541
|
-
|
|
1542
|
-
s,
|
|
1543
|
-
v,
|
|
1544
|
-
i
|
|
1545
|
-
]), U = A((c) => {
|
|
1546
|
-
c.setCurrentInput(""), c.setIsEnteringArg(!1), r.clear(), d("idle");
|
|
1547
|
-
}, []);
|
|
893
|
+
z,
|
|
894
|
+
t
|
|
895
|
+
]);
|
|
1548
896
|
return {
|
|
1549
|
-
handleInputChange:
|
|
1550
|
-
handleKeyDown:
|
|
1551
|
-
inputState:
|
|
1552
|
-
setInputStateWithLogging:
|
|
897
|
+
handleInputChange: y,
|
|
898
|
+
handleKeyDown: E,
|
|
899
|
+
inputState: o,
|
|
900
|
+
setInputStateWithLogging: i,
|
|
1553
901
|
// Expose internal functions for testing
|
|
1554
|
-
findMatchingCommands:
|
|
1555
|
-
getAutocompleteSuggestion:
|
|
1556
|
-
getAvailableNodes:
|
|
1557
|
-
getNextExpectedSegment:
|
|
1558
|
-
isValidCommandInput:
|
|
902
|
+
findMatchingCommands: l,
|
|
903
|
+
getAutocompleteSuggestion: u,
|
|
904
|
+
getAvailableNodes: d,
|
|
905
|
+
getNextExpectedSegment: c,
|
|
906
|
+
isValidCommandInput: p
|
|
1559
907
|
};
|
|
1560
908
|
};
|
|
1561
|
-
function
|
|
1562
|
-
const
|
|
1563
|
-
let
|
|
1564
|
-
for (let s = 0; s <
|
|
1565
|
-
const
|
|
1566
|
-
(
|
|
909
|
+
function ee(r) {
|
|
910
|
+
const e = [];
|
|
911
|
+
let n = "", t = !1, o;
|
|
912
|
+
for (let s = 0; s < r.length; s++) {
|
|
913
|
+
const i = r[s];
|
|
914
|
+
(i === '"' || i === "'") && (!t || i === o) ? t ? (e.push(n), n = "", t = !1, o = void 0) : (n && (e.push(n), n = ""), t = !0, o = i) : !t && i === " " ? n && (e.push(n), n = "") : n += i;
|
|
1567
915
|
}
|
|
1568
916
|
return {
|
|
1569
|
-
words:
|
|
1570
|
-
currentWord:
|
|
1571
|
-
isQuoted:
|
|
1572
|
-
quoteChar:
|
|
1573
|
-
isComplete: !
|
|
917
|
+
words: e,
|
|
918
|
+
currentWord: n,
|
|
919
|
+
isQuoted: t,
|
|
920
|
+
quoteChar: o,
|
|
921
|
+
isComplete: !t && !n
|
|
1574
922
|
};
|
|
1575
923
|
}
|
|
1576
|
-
const
|
|
1577
|
-
|
|
1578
|
-
|
|
1579
|
-
|
|
1580
|
-
|
|
1581
|
-
|
|
1582
|
-
|
|
924
|
+
const Le = () => {
|
|
925
|
+
const r = K(), [e, n] = R(0);
|
|
926
|
+
return _(() => {
|
|
927
|
+
const t = {
|
|
928
|
+
update: () => {
|
|
929
|
+
n((o) => o + 1);
|
|
930
|
+
}
|
|
931
|
+
};
|
|
932
|
+
return r.subscribe(t), () => {
|
|
933
|
+
r.unsubscribe(t);
|
|
934
|
+
};
|
|
935
|
+
}, [r]), e;
|
|
936
|
+
}, Ve = ({
|
|
937
|
+
state: r,
|
|
938
|
+
actions: e
|
|
1583
939
|
}) => {
|
|
1584
|
-
const
|
|
940
|
+
const n = U(null), t = B(), o = K(), {
|
|
1585
941
|
handleKeyDown: s,
|
|
1586
|
-
handleInputChange:
|
|
1587
|
-
inputState:
|
|
1588
|
-
setInputStateWithLogging:
|
|
1589
|
-
getNextExpectedSegment:
|
|
1590
|
-
} =
|
|
1591
|
-
s(x,
|
|
1592
|
-
|
|
1593
|
-
|
|
1594
|
-
|
|
942
|
+
handleInputChange: i,
|
|
943
|
+
inputState: c,
|
|
944
|
+
setInputStateWithLogging: d,
|
|
945
|
+
getNextExpectedSegment: l
|
|
946
|
+
} = Ke(), [u, p] = R(!1), S = $(), y = Le(), z = async (x) => {
|
|
947
|
+
const v = s(x, r, e);
|
|
948
|
+
await Promise.resolve(v) === !1 && (p(!0), setTimeout(() => p(!1), 500));
|
|
949
|
+
}, E = (x) => {
|
|
950
|
+
i(x.target.value, e);
|
|
951
|
+
}, a = (x) => {
|
|
1595
952
|
x.preventDefault();
|
|
1596
|
-
const
|
|
1597
|
-
|
|
953
|
+
const v = x.clipboardData.getData("text");
|
|
954
|
+
i(v, e);
|
|
1598
955
|
};
|
|
1599
|
-
|
|
1600
|
-
|
|
1601
|
-
}, []),
|
|
1602
|
-
if (
|
|
1603
|
-
const x =
|
|
1604
|
-
let
|
|
956
|
+
_(() => {
|
|
957
|
+
n.current && n.current.focus(), c !== "entering_command" && d("entering_command");
|
|
958
|
+
}, [c, d]), _(() => {
|
|
959
|
+
if (c !== "idle") return;
|
|
960
|
+
const x = l();
|
|
961
|
+
let v = "idle";
|
|
1605
962
|
switch (x.type) {
|
|
1606
963
|
case "word":
|
|
1607
|
-
|
|
964
|
+
v = "entering_command", e.setIsEnteringArg(!1);
|
|
1608
965
|
break;
|
|
1609
966
|
case "argument":
|
|
1610
|
-
|
|
967
|
+
v = "entering_argument", e.setIsEnteringArg(!0);
|
|
1611
968
|
break;
|
|
1612
969
|
}
|
|
1613
|
-
|
|
1614
|
-
}, [
|
|
1615
|
-
const [
|
|
1616
|
-
|
|
1617
|
-
const x = [],
|
|
1618
|
-
x.push(
|
|
1619
|
-
const
|
|
1620
|
-
if (
|
|
1621
|
-
|
|
1622
|
-
return /* @__PURE__ */
|
|
1623
|
-
/* @__PURE__ */ m
|
|
1624
|
-
|
|
1625
|
-
] }, "arg-" +
|
|
970
|
+
d(v);
|
|
971
|
+
}, [y, c, l, d, e]);
|
|
972
|
+
const [g, h] = R([]);
|
|
973
|
+
_(() => {
|
|
974
|
+
const x = [], v = o.toArray().map((P, T) => {
|
|
975
|
+
x.push(P.name);
|
|
976
|
+
const H = t.hasNextSegment(x);
|
|
977
|
+
if (P.type === "argument") {
|
|
978
|
+
const j = P;
|
|
979
|
+
return /* @__PURE__ */ N(L.Fragment, { children: [
|
|
980
|
+
/* @__PURE__ */ m("span", { className: "text-gray-200 whitespace-pre", children: j.value }),
|
|
981
|
+
T < o.size() && H && /* @__PURE__ */ m("span", { className: "text-gray-200 whitespace-pre", children: " " })
|
|
982
|
+
] }, "arg-" + j.name + j.value);
|
|
1626
983
|
}
|
|
1627
|
-
return /* @__PURE__ */
|
|
1628
|
-
/* @__PURE__ */ m
|
|
1629
|
-
|
|
1630
|
-
] }, "word-" +
|
|
984
|
+
return /* @__PURE__ */ N(L.Fragment, { children: [
|
|
985
|
+
/* @__PURE__ */ m("span", { className: "text-blue-400 whitespace-pre", children: P.name }),
|
|
986
|
+
T < o.size() && H && /* @__PURE__ */ m("span", { className: "text-blue-400 whitespace-pre", children: " " })
|
|
987
|
+
] }, "word-" + P.name);
|
|
1631
988
|
});
|
|
1632
|
-
|
|
1633
|
-
}, [
|
|
1634
|
-
const [
|
|
1635
|
-
return
|
|
1636
|
-
const x =
|
|
1637
|
-
x.type === "argument" ?
|
|
1638
|
-
}, [
|
|
1639
|
-
/* @__PURE__ */ m
|
|
1640
|
-
|
|
1641
|
-
|
|
1642
|
-
|
|
1643
|
-
|
|
1644
|
-
|
|
1645
|
-
|
|
1646
|
-
|
|
1647
|
-
|
|
1648
|
-
|
|
1649
|
-
|
|
1650
|
-
|
|
1651
|
-
|
|
1652
|
-
|
|
1653
|
-
|
|
1654
|
-
|
|
1655
|
-
|
|
1656
|
-
|
|
1657
|
-
|
|
1658
|
-
|
|
1659
|
-
|
|
1660
|
-
|
|
1661
|
-
|
|
1662
|
-
|
|
1663
|
-
|
|
1664
|
-
|
|
1665
|
-
|
|
1666
|
-
|
|
1667
|
-
|
|
1668
|
-
|
|
1669
|
-
|
|
1670
|
-
|
|
1671
|
-
|
|
1672
|
-
|
|
1673
|
-
|
|
1674
|
-
|
|
989
|
+
h([/* @__PURE__ */ m("div", { className: "flex items-center gap-1", "data-testid": "user-input-area", children: v }, "{segmentStackVersion}")]);
|
|
990
|
+
}, [y, t, o]);
|
|
991
|
+
const [k, f] = R("");
|
|
992
|
+
return _(() => {
|
|
993
|
+
const x = l();
|
|
994
|
+
x.type === "argument" ? f(x.name) : f("");
|
|
995
|
+
}, [y, l]), /* @__PURE__ */ N("div", { className: "flex flex-col w-full bg-gray-900 rounded-lg p-4", children: [
|
|
996
|
+
/* @__PURE__ */ m("style", { children: `
|
|
997
|
+
@keyframes subtleGlow {
|
|
998
|
+
0%, 100% { box-shadow: 0 0 0 rgba(239, 68, 68, 0); }
|
|
999
|
+
50% { box-shadow: 0 0 8px rgba(239, 68, 68, 0.6); }
|
|
1000
|
+
}
|
|
1001
|
+
.invalid-input-animation {
|
|
1002
|
+
animation: subtleGlow 0.4s ease-in-out;
|
|
1003
|
+
}
|
|
1004
|
+
` }),
|
|
1005
|
+
/* @__PURE__ */ N("div", { className: "flex items-center gap-2", children: [
|
|
1006
|
+
/* @__PURE__ */ m("div", { className: "text-gray-400 font-mono", children: ">" }),
|
|
1007
|
+
/* @__PURE__ */ N("div", { className: "flex-1 font-mono flex items-center", children: [
|
|
1008
|
+
g,
|
|
1009
|
+
/* @__PURE__ */ N("div", { className: "relative flex-1", children: [
|
|
1010
|
+
/* @__PURE__ */ m(
|
|
1011
|
+
"input",
|
|
1012
|
+
{
|
|
1013
|
+
ref: n,
|
|
1014
|
+
type: "text",
|
|
1015
|
+
role: "textbox",
|
|
1016
|
+
value: r.currentInput,
|
|
1017
|
+
onChange: E,
|
|
1018
|
+
onKeyDown: z,
|
|
1019
|
+
onPaste: a,
|
|
1020
|
+
"data-testid": "citadel-command-input",
|
|
1021
|
+
className: `w-full bg-transparent outline-none text-gray-200 caret-transparent ${u ? "invalid-input-animation" : ""}`,
|
|
1022
|
+
spellCheck: !1,
|
|
1023
|
+
autoComplete: "off",
|
|
1024
|
+
placeholder: k
|
|
1025
|
+
}
|
|
1026
|
+
),
|
|
1027
|
+
/* @__PURE__ */ m(
|
|
1028
|
+
"div",
|
|
1029
|
+
{
|
|
1030
|
+
className: "absolute top-0 pointer-events-none",
|
|
1031
|
+
style: {
|
|
1032
|
+
left: `${r.currentInput.length}ch`,
|
|
1033
|
+
transition: "left 0.05s ease-out"
|
|
1034
|
+
},
|
|
1035
|
+
children: /* @__PURE__ */ m(
|
|
1036
|
+
Oe,
|
|
1037
|
+
{
|
|
1038
|
+
style: {
|
|
1039
|
+
type: S.cursorType ?? A.cursorType,
|
|
1040
|
+
color: S.cursorColor || A.cursorColor,
|
|
1041
|
+
speed: S.cursorSpeed || A.cursorSpeed
|
|
1042
|
+
}
|
|
1675
1043
|
}
|
|
1676
|
-
|
|
1677
|
-
|
|
1678
|
-
|
|
1679
|
-
)
|
|
1044
|
+
)
|
|
1045
|
+
}
|
|
1046
|
+
)
|
|
1047
|
+
] })
|
|
1680
1048
|
] })
|
|
1681
1049
|
] })
|
|
1682
|
-
] })
|
|
1683
|
-
},
|
|
1050
|
+
] });
|
|
1051
|
+
}, We = () => /* @__PURE__ */ m(
|
|
1684
1052
|
"div",
|
|
1685
1053
|
{
|
|
1686
1054
|
"data-testid": "spinner",
|
|
1687
1055
|
className: "animate-spin rounded-full h-4 w-4 border-2 border-gray-300 border-t-gray-600"
|
|
1688
1056
|
}
|
|
1689
|
-
),
|
|
1690
|
-
command:
|
|
1691
|
-
timestamp:
|
|
1692
|
-
status:
|
|
1693
|
-
}) => /* @__PURE__ */
|
|
1694
|
-
/* @__PURE__ */
|
|
1057
|
+
), qe = ({
|
|
1058
|
+
command: r,
|
|
1059
|
+
timestamp: e,
|
|
1060
|
+
status: n
|
|
1061
|
+
}) => /* @__PURE__ */ N("div", { className: "flex items-center gap-2 font-mono text-sm", children: [
|
|
1062
|
+
/* @__PURE__ */ N("span", { className: "text-gray-200", children: [
|
|
1695
1063
|
"> ",
|
|
1696
|
-
|
|
1697
|
-
const s =
|
|
1698
|
-
return /* @__PURE__ */
|
|
1064
|
+
r.split(" ").map((t, o) => {
|
|
1065
|
+
const s = t.startsWith("<") && t.endsWith(">");
|
|
1066
|
+
return /* @__PURE__ */ N(
|
|
1699
1067
|
"span",
|
|
1700
1068
|
{
|
|
1701
1069
|
className: s ? "text-green-400" : "text-gray-200",
|
|
1702
1070
|
children: [
|
|
1703
|
-
|
|
1704
|
-
|
|
1071
|
+
o > 0 ? " " : "",
|
|
1072
|
+
t
|
|
1705
1073
|
]
|
|
1706
1074
|
},
|
|
1707
|
-
|
|
1075
|
+
o
|
|
1708
1076
|
);
|
|
1709
1077
|
})
|
|
1710
1078
|
] }),
|
|
1711
|
-
/* @__PURE__ */ m
|
|
1712
|
-
/* @__PURE__ */ m
|
|
1713
|
-
|
|
1714
|
-
|
|
1079
|
+
/* @__PURE__ */ m("span", { className: "text-gray-400", children: "·" }),
|
|
1080
|
+
/* @__PURE__ */ m("span", { className: "text-gray-500", children: e }),
|
|
1081
|
+
n === M.Pending && /* @__PURE__ */ m(We, {}),
|
|
1082
|
+
n === M.Success && /* @__PURE__ */ m(
|
|
1715
1083
|
"div",
|
|
1716
1084
|
{
|
|
1717
1085
|
"data-testid": "success-indicator",
|
|
1718
1086
|
className: "w-4 h-4 rounded-full bg-green-500"
|
|
1719
1087
|
}
|
|
1720
1088
|
),
|
|
1721
|
-
(
|
|
1089
|
+
(n === M.Timeout || n === M.Failure) && /* @__PURE__ */ m(
|
|
1722
1090
|
"div",
|
|
1723
1091
|
{
|
|
1724
1092
|
"data-testid": "success-indicator",
|
|
1725
1093
|
className: "w-4 h-4 rounded-full bg-red-500"
|
|
1726
1094
|
}
|
|
1727
1095
|
)
|
|
1728
|
-
] }),
|
|
1729
|
-
const
|
|
1730
|
-
if (
|
|
1731
|
-
const
|
|
1096
|
+
] }), Ye = ({ output: r, outputRef: e }) => {
|
|
1097
|
+
const n = $(), t = w(() => {
|
|
1098
|
+
if (e.current) {
|
|
1099
|
+
const o = e.current;
|
|
1732
1100
|
requestAnimationFrame(() => {
|
|
1733
|
-
|
|
1101
|
+
o.scrollTop = o.scrollHeight;
|
|
1734
1102
|
});
|
|
1735
1103
|
}
|
|
1736
|
-
}, [
|
|
1737
|
-
return
|
|
1738
|
-
if (
|
|
1739
|
-
const
|
|
1104
|
+
}, [e]);
|
|
1105
|
+
return _(() => {
|
|
1106
|
+
if (t(), e.current) {
|
|
1107
|
+
const o = e.current.getElementsByTagName("img"), s = o[o.length - 1];
|
|
1740
1108
|
if (s && !s.complete)
|
|
1741
|
-
return s.addEventListener("load",
|
|
1109
|
+
return s.addEventListener("load", t), () => s.removeEventListener("load", t);
|
|
1742
1110
|
}
|
|
1743
|
-
}, [
|
|
1111
|
+
}, [r, t, e]), /* @__PURE__ */ m(
|
|
1744
1112
|
"div",
|
|
1745
1113
|
{
|
|
1746
|
-
ref:
|
|
1114
|
+
ref: e,
|
|
1747
1115
|
className: "h-full overflow-y-auto border border-gray-700 rounded-lg p-3 text-left",
|
|
1748
|
-
children:
|
|
1749
|
-
/* @__PURE__ */ m
|
|
1750
|
-
|
|
1116
|
+
children: r.map((o, s) => /* @__PURE__ */ N("div", { className: "mb-4 last:mb-0", children: [
|
|
1117
|
+
/* @__PURE__ */ m(
|
|
1118
|
+
qe,
|
|
1751
1119
|
{
|
|
1752
|
-
command:
|
|
1753
|
-
timestamp: new Date(
|
|
1754
|
-
status:
|
|
1120
|
+
command: o.command.join(" "),
|
|
1121
|
+
timestamp: new Date(o.timestamp).toLocaleTimeString(),
|
|
1122
|
+
status: o.result.status
|
|
1755
1123
|
}
|
|
1756
1124
|
),
|
|
1757
|
-
/* @__PURE__ */ m
|
|
1125
|
+
/* @__PURE__ */ m("pre", { className: `text-gray-200 whitespace-pre font-mono ${n.outputFontSize}`, children: o.result.render() })
|
|
1758
1126
|
] }, s))
|
|
1759
1127
|
}
|
|
1760
1128
|
);
|
|
1761
|
-
},
|
|
1762
|
-
const
|
|
1763
|
-
|
|
1764
|
-
const
|
|
1765
|
-
if (
|
|
1766
|
-
const
|
|
1767
|
-
return [...
|
|
1129
|
+
}, Be = () => {
|
|
1130
|
+
const r = B(), e = $(), n = K(), t = "h-12 mt-2 border-t border-gray-700 px-4", o = "text-gray-300 pt-2", s = r.getCompletions(n.path());
|
|
1131
|
+
C.debug("[AvailableCommands] nextCommandSegments: ", s);
|
|
1132
|
+
const i = L.useMemo(() => {
|
|
1133
|
+
if (e.includeHelpCommand) {
|
|
1134
|
+
const l = s.filter((p) => p.name !== "help"), u = s.find((p) => p.name === "help");
|
|
1135
|
+
return [...l, ...u ? [u] : []];
|
|
1768
1136
|
}
|
|
1769
|
-
return
|
|
1770
|
-
}, [
|
|
1771
|
-
return /* @__PURE__ */ m
|
|
1772
|
-
/* @__PURE__ */ m
|
|
1773
|
-
|
|
1137
|
+
return s;
|
|
1138
|
+
}, [s, e.includeHelpCommand]), c = s.some((l) => l.type === "argument"), d = s[0];
|
|
1139
|
+
return /* @__PURE__ */ m("div", { className: t, "data-testid": "available-commands", children: /* @__PURE__ */ m("div", { className: o, children: c ? s.length > 0 ? /* @__PURE__ */ N(he, { children: [
|
|
1140
|
+
/* @__PURE__ */ m("span", { className: "text-blue-400", children: d.name }),
|
|
1141
|
+
d.description && /* @__PURE__ */ N("span", { className: "text-gray-400 ml-2", children: [
|
|
1774
1142
|
"- ",
|
|
1775
|
-
|
|
1143
|
+
d.description
|
|
1776
1144
|
] })
|
|
1777
|
-
] }) : null : /* @__PURE__ */ m
|
|
1778
|
-
const
|
|
1779
|
-
if (
|
|
1780
|
-
let
|
|
1781
|
-
for (;
|
|
1782
|
-
|
|
1783
|
-
return Math.max(
|
|
1145
|
+
] }) : null : /* @__PURE__ */ m("div", { className: "flex flex-wrap gap-2", children: i == null ? void 0 : i.map((l) => {
|
|
1146
|
+
const u = i == null ? void 0 : i.reduce((p, S) => {
|
|
1147
|
+
if (S === l) return p;
|
|
1148
|
+
let y = 0;
|
|
1149
|
+
for (; y < l.name.length && y < S.name.length && l.name[y].toLowerCase() === S.name[y].toLowerCase(); )
|
|
1150
|
+
y++;
|
|
1151
|
+
return Math.max(p, y + 1);
|
|
1784
1152
|
}, 1);
|
|
1785
|
-
return /* @__PURE__ */ m
|
|
1153
|
+
return /* @__PURE__ */ m(
|
|
1786
1154
|
"div",
|
|
1787
1155
|
{
|
|
1788
1156
|
className: "px-2 py-1 rounded bg-gray-800 mr-2 last:mr-0",
|
|
1789
|
-
children: /* @__PURE__ */
|
|
1790
|
-
/* @__PURE__ */ m
|
|
1791
|
-
|
|
1157
|
+
children: /* @__PURE__ */ N("span", { className: "font-mono text-white", children: [
|
|
1158
|
+
/* @__PURE__ */ m("strong", { className: "underline", children: l.name.slice(0, u) }),
|
|
1159
|
+
l.name.slice(u)
|
|
1792
1160
|
] })
|
|
1793
1161
|
},
|
|
1794
|
-
|
|
1162
|
+
l.name
|
|
1795
1163
|
);
|
|
1796
1164
|
}) }) }) });
|
|
1797
|
-
},
|
|
1165
|
+
}, ne = `:host {
|
|
1798
1166
|
--citadel-bg: rgb(17, 24, 39);
|
|
1799
1167
|
--citadel-text: rgba(255, 255, 255, 0.87);
|
|
1800
1168
|
--citadel-border: rgb(55, 65, 81);
|
|
@@ -1814,6 +1182,7 @@ const At = "_invalidInput_e9b9w_12", Pt = "_shake_e9b9w_1", Tt = "_flashBorder_e
|
|
|
1814
1182
|
bottom: 0;
|
|
1815
1183
|
left: 0;
|
|
1816
1184
|
right: 0;
|
|
1185
|
+
z-index: 2147483647; /* Maximum z-index value */
|
|
1817
1186
|
overflow: hidden;
|
|
1818
1187
|
|
|
1819
1188
|
pointer-events: auto;
|
|
@@ -1883,7 +1252,7 @@ a:hover {
|
|
|
1883
1252
|
text-align: left;
|
|
1884
1253
|
}
|
|
1885
1254
|
|
|
1886
|
-
`,
|
|
1255
|
+
`, te = `/* Keep only component-specific styles here */
|
|
1887
1256
|
|
|
1888
1257
|
.container {
|
|
1889
1258
|
position: fixed;
|
|
@@ -1953,10 +1322,10 @@ a:hover {
|
|
|
1953
1322
|
.citadel_slideDown {
|
|
1954
1323
|
animation: citadel_slideDown 0.2s ease-out forwards;
|
|
1955
1324
|
}
|
|
1956
|
-
`,
|
|
1325
|
+
`, re = `@tailwind base;
|
|
1957
1326
|
@tailwind components;
|
|
1958
1327
|
@tailwind utilities;
|
|
1959
|
-
`,
|
|
1328
|
+
`, Ge = `*, ::before, ::after {
|
|
1960
1329
|
--tw-border-spacing-x: 0;
|
|
1961
1330
|
--tw-border-spacing-y: 0;
|
|
1962
1331
|
--tw-translate-x: 0;
|
|
@@ -2773,92 +2142,96 @@ video {
|
|
|
2773
2142
|
.last\\:mr-0:last-child {
|
|
2774
2143
|
margin-right: 0px;
|
|
2775
2144
|
}
|
|
2776
|
-
`,
|
|
2777
|
-
config:
|
|
2778
|
-
commandRegistry:
|
|
2779
|
-
containerId:
|
|
2780
|
-
}) => (
|
|
2781
|
-
|
|
2782
|
-
level:
|
|
2145
|
+
`, rn = ({
|
|
2146
|
+
config: r = A,
|
|
2147
|
+
commandRegistry: e = new J(),
|
|
2148
|
+
containerId: n = null
|
|
2149
|
+
}) => (_(() => {
|
|
2150
|
+
C.configure({
|
|
2151
|
+
level: r.logLevel || A.logLevel || W.ERROR,
|
|
2783
2152
|
prefix: "[Citadel]"
|
|
2784
2153
|
});
|
|
2785
|
-
const
|
|
2786
|
-
return
|
|
2154
|
+
const t = new ue(e, r), o = n ? document.getElementById(n) : document.body;
|
|
2155
|
+
return o ? o.appendChild(t) : (console.warn(`Container with id "${n}" not found, falling back to body`), document.body.appendChild(t)), () => {
|
|
2787
2156
|
var s;
|
|
2788
|
-
(s =
|
|
2157
|
+
(s = t.parentElement) == null || s.removeChild(t);
|
|
2789
2158
|
};
|
|
2790
|
-
}, [n,
|
|
2791
|
-
class
|
|
2792
|
-
constructor(
|
|
2159
|
+
}, [e, n, r]), null);
|
|
2160
|
+
class ue extends HTMLElement {
|
|
2161
|
+
constructor(n, t) {
|
|
2793
2162
|
super();
|
|
2794
|
-
|
|
2795
|
-
|
|
2796
|
-
|
|
2797
|
-
|
|
2798
|
-
this.shadow = this.attachShadow({ mode: "open" }), this.
|
|
2163
|
+
b(this, "shadow");
|
|
2164
|
+
b(this, "root", null);
|
|
2165
|
+
b(this, "commandRegistry");
|
|
2166
|
+
b(this, "config");
|
|
2167
|
+
this.shadow = this.attachShadow({ mode: "open" }), this.commandRegistry = n, this.config = t;
|
|
2799
2168
|
}
|
|
2800
2169
|
connectedCallback() {
|
|
2801
2170
|
try {
|
|
2802
|
-
const
|
|
2171
|
+
const t = [ne, te, re, Ge].map((o) => {
|
|
2803
2172
|
const s = new CSSStyleSheet();
|
|
2804
|
-
return s.replaceSync(
|
|
2173
|
+
return s.replaceSync(o), s;
|
|
2805
2174
|
});
|
|
2806
|
-
this.shadow.adoptedStyleSheets = [...
|
|
2175
|
+
this.shadow.adoptedStyleSheets = [...t];
|
|
2807
2176
|
} catch {
|
|
2808
|
-
const
|
|
2809
|
-
`),
|
|
2810
|
-
|
|
2177
|
+
const t = [ne, te, re].join(`
|
|
2178
|
+
`), o = document.createElement("style");
|
|
2179
|
+
o.textContent = t, this.shadow.appendChild(o);
|
|
2811
2180
|
}
|
|
2812
|
-
const
|
|
2813
|
-
|
|
2814
|
-
/* @__PURE__ */ m
|
|
2181
|
+
const n = document.createElement("div");
|
|
2182
|
+
n.id = "citadel-root", this.shadow.appendChild(n), this.root = be(n), this.root.render(
|
|
2183
|
+
/* @__PURE__ */ m(Fe, { config: this.config || A, commandRegistry: this.commandRegistry, children: /* @__PURE__ */ m(Je, {}) })
|
|
2815
2184
|
);
|
|
2816
2185
|
}
|
|
2817
|
-
|
|
2818
|
-
|
|
2819
|
-
|
|
2820
|
-
|
|
2821
|
-
|
|
2822
|
-
|
|
2823
|
-
|
|
2824
|
-
|
|
2825
|
-
|
|
2826
|
-
const [o, n] = Y(!1), [t, r] = Y(!1), i = ce(), [s, p] = Y(() => i.initialHeight || null), d = Q(null), u = Q(null), f = Q(!1), w = Q(0), g = Q(0), { state: v, actions: O } = Cn(), k = A((c) => {
|
|
2827
|
-
u.current && (f.current = !0, w.current = c.clientY, g.current = u.current.offsetHeight, document.documentElement.style.userSelect = "none", document.documentElement.style.webkitUserSelect = "none", document.documentElement.style.mozUserSelect = "none", document.documentElement.style.msUserSelect = "none", document.addEventListener("mouseup", D));
|
|
2828
|
-
}, []), D = A(() => {
|
|
2829
|
-
f.current = !1, document.documentElement.style.userSelect = "", document.documentElement.style.webkitUserSelect = "", document.documentElement.style.mozUserSelect = "", document.documentElement.style.msUserSelect = "", document.removeEventListener("mouseup", D);
|
|
2830
|
-
}, []);
|
|
2831
|
-
I(() => () => {
|
|
2832
|
-
document.removeEventListener("mouseup", D);
|
|
2833
|
-
}, [D]), at({
|
|
2834
|
-
onOpen: () => n(!0),
|
|
2835
|
-
onClose: () => r(!0),
|
|
2836
|
-
isVisible: o,
|
|
2837
|
-
showCitadelKey: i.showCitadelKey || "."
|
|
2186
|
+
}
|
|
2187
|
+
customElements.define("citadel-element", ue);
|
|
2188
|
+
const Je = () => {
|
|
2189
|
+
const [r, e] = R(!1), [n, t] = R(!1), o = $(), [s, i] = R(() => o.initialHeight || null), c = U(null), d = U(null), l = U(!1), u = U(0), p = U(0), { state: S, actions: y } = me();
|
|
2190
|
+
ye({
|
|
2191
|
+
onOpen: () => e(!0),
|
|
2192
|
+
onClose: () => t(!0),
|
|
2193
|
+
isVisible: r,
|
|
2194
|
+
showCitadelKey: o.showCitadelKey || "."
|
|
2838
2195
|
});
|
|
2839
|
-
const
|
|
2840
|
-
|
|
2841
|
-
}, [
|
|
2842
|
-
|
|
2843
|
-
|
|
2844
|
-
|
|
2845
|
-
|
|
2846
|
-
|
|
2196
|
+
const z = w((h) => {
|
|
2197
|
+
d.current && (l.current = !0, u.current = h.clientY, p.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", E), document.addEventListener("mouseup", a));
|
|
2198
|
+
}, []), E = w((h) => {
|
|
2199
|
+
var v;
|
|
2200
|
+
if (!l.current) return;
|
|
2201
|
+
const k = h.clientY - u.current, f = (v = o.maxHeight) != null && v.endsWith("vh") ? window.innerHeight * parseInt(o.maxHeight, 10) / 100 : parseInt(o.maxHeight || "80vh", 10), x = Math.min(
|
|
2202
|
+
Math.max(p.current - k, parseInt(o.minHeight || "200", 10)),
|
|
2203
|
+
f
|
|
2204
|
+
);
|
|
2205
|
+
d.current && (d.current.style.height = `${x}px`, d.current.style.bottom = "0", i(`${x}px`));
|
|
2206
|
+
}, [o.maxHeight, o.minHeight]), a = w(() => {
|
|
2207
|
+
l.current = !1, document.documentElement.style.userSelect = "", document.documentElement.style.webkitUserSelect = "", document.documentElement.style.mozUserSelect = "", document.documentElement.style.msUserSelect = "", document.removeEventListener("mousemove", E), document.removeEventListener("mouseup", a);
|
|
2208
|
+
}, [E]);
|
|
2209
|
+
_(() => () => {
|
|
2210
|
+
document.removeEventListener("mousemove", E), document.removeEventListener("mouseup", a);
|
|
2211
|
+
}, [E, a]);
|
|
2212
|
+
const g = w(() => {
|
|
2213
|
+
n && (e(!1), t(!1));
|
|
2214
|
+
}, [n]);
|
|
2215
|
+
return Ne({
|
|
2216
|
+
isVisible: r,
|
|
2217
|
+
isClosing: n,
|
|
2218
|
+
onAnimationComplete: g
|
|
2219
|
+
}), r ? /* @__PURE__ */ N(
|
|
2847
2220
|
"div",
|
|
2848
2221
|
{
|
|
2849
|
-
ref:
|
|
2850
|
-
className: `container ${
|
|
2222
|
+
ref: d,
|
|
2223
|
+
className: `container ${r ? "citadel_slideUp" : ""} ${n ? "citadel_slideDown" : ""}`,
|
|
2851
2224
|
style: {
|
|
2852
2225
|
...s ? { height: s } : void 0,
|
|
2853
|
-
maxHeight:
|
|
2226
|
+
maxHeight: o.maxHeight
|
|
2854
2227
|
},
|
|
2855
2228
|
children: [
|
|
2856
|
-
/* @__PURE__ */ m
|
|
2857
|
-
/* @__PURE__ */
|
|
2858
|
-
/* @__PURE__ */ m
|
|
2859
|
-
/* @__PURE__ */
|
|
2860
|
-
/* @__PURE__ */ m
|
|
2861
|
-
/* @__PURE__ */ m
|
|
2229
|
+
/* @__PURE__ */ m("div", { className: "resizeHandle", onMouseDown: z }),
|
|
2230
|
+
/* @__PURE__ */ N("div", { className: "innerContainer", children: [
|
|
2231
|
+
/* @__PURE__ */ m("div", { className: "flex-1 min-h-0 pt-3 px-4", children: /* @__PURE__ */ m(Ye, { output: S.output, outputRef: c }) }),
|
|
2232
|
+
/* @__PURE__ */ N("div", { children: [
|
|
2233
|
+
/* @__PURE__ */ m(Ve, { state: S, actions: y }),
|
|
2234
|
+
/* @__PURE__ */ m(Be, {})
|
|
2862
2235
|
] })
|
|
2863
2236
|
] })
|
|
2864
2237
|
]
|
|
@@ -2866,14 +2239,15 @@ const $t = () => {
|
|
|
2866
2239
|
) : null;
|
|
2867
2240
|
};
|
|
2868
2241
|
export {
|
|
2869
|
-
|
|
2870
|
-
|
|
2871
|
-
|
|
2872
|
-
|
|
2873
|
-
|
|
2874
|
-
|
|
2875
|
-
|
|
2876
|
-
|
|
2877
|
-
|
|
2878
|
-
|
|
2242
|
+
rn as Citadel,
|
|
2243
|
+
J as CommandRegistry,
|
|
2244
|
+
F as CommandResult,
|
|
2245
|
+
M as CommandStatus,
|
|
2246
|
+
Me as DEFAULT_CURSOR_CONFIGS,
|
|
2247
|
+
_e as ErrorCommandResult,
|
|
2248
|
+
tn as ImageCommandResult,
|
|
2249
|
+
nn as JsonCommandResult,
|
|
2250
|
+
Te as OutputItem,
|
|
2251
|
+
Ae as PendingCommandResult,
|
|
2252
|
+
oe as TextCommandResult
|
|
2879
2253
|
};
|