citadel_cli 1.1.0 → 1.1.3
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 +825 -812
- package/dist/citadel.umd.js +30 -15
- 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,8 +1,8 @@
|
|
|
1
|
-
var
|
|
2
|
-
var
|
|
3
|
-
var
|
|
4
|
-
import
|
|
5
|
-
import
|
|
1
|
+
var Xn = Object.defineProperty;
|
|
2
|
+
var Qn = (o, n, t) => n in o ? Xn(o, n, { enumerable: !0, configurable: !0, writable: !0, value: t }) : o[n] = t;
|
|
3
|
+
var A = (o, n, t) => Qn(o, typeof n != "symbol" ? n + "" : n, t);
|
|
4
|
+
import Q, { useEffect as z, useMemo as be, createContext as Zn, useContext as ve, useState as Y, useCallback as R, useReducer as et, useRef as X } from "react";
|
|
5
|
+
import nt from "react-dom";
|
|
6
6
|
var Te = { exports: {} }, ae = {};
|
|
7
7
|
/**
|
|
8
8
|
* @license React
|
|
@@ -14,18 +14,18 @@ var Te = { exports: {} }, ae = {};
|
|
|
14
14
|
* LICENSE file in the root directory of this source tree.
|
|
15
15
|
*/
|
|
16
16
|
var on;
|
|
17
|
-
function
|
|
17
|
+
function tt() {
|
|
18
18
|
if (on) return ae;
|
|
19
19
|
on = 1;
|
|
20
|
-
var o =
|
|
21
|
-
function
|
|
22
|
-
var
|
|
23
|
-
|
|
24
|
-
for (
|
|
25
|
-
if (
|
|
26
|
-
return { $$typeof: n, type:
|
|
20
|
+
var o = Q, n = Symbol.for("react.element"), t = Symbol.for("react.fragment"), r = Object.prototype.hasOwnProperty, a = o.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner, i = { key: !0, ref: !0, __self: !0, __source: !0 };
|
|
21
|
+
function u(f, c, m) {
|
|
22
|
+
var h, b = {}, _ = null, S = null;
|
|
23
|
+
m !== void 0 && (_ = "" + m), c.key !== void 0 && (_ = "" + c.key), c.ref !== void 0 && (S = c.ref);
|
|
24
|
+
for (h in c) r.call(c, h) && !i.hasOwnProperty(h) && (b[h] = c[h]);
|
|
25
|
+
if (f && f.defaultProps) for (h in c = f.defaultProps, c) b[h] === void 0 && (b[h] = c[h]);
|
|
26
|
+
return { $$typeof: n, type: f, key: _, ref: S, props: b, _owner: a.current };
|
|
27
27
|
}
|
|
28
|
-
return ae.Fragment = t, ae.jsx =
|
|
28
|
+
return ae.Fragment = t, ae.jsx = u, ae.jsxs = u, ae;
|
|
29
29
|
}
|
|
30
30
|
var se = {};
|
|
31
31
|
/**
|
|
@@ -38,56 +38,56 @@ var se = {};
|
|
|
38
38
|
* LICENSE file in the root directory of this source tree.
|
|
39
39
|
*/
|
|
40
40
|
var an;
|
|
41
|
-
function
|
|
41
|
+
function rt() {
|
|
42
42
|
return an || (an = 1, process.env.NODE_ENV !== "production" && function() {
|
|
43
|
-
var o =
|
|
44
|
-
function
|
|
43
|
+
var o = Q, n = Symbol.for("react.element"), t = Symbol.for("react.portal"), r = Symbol.for("react.fragment"), a = Symbol.for("react.strict_mode"), i = Symbol.for("react.profiler"), u = Symbol.for("react.provider"), f = Symbol.for("react.context"), c = Symbol.for("react.forward_ref"), m = Symbol.for("react.suspense"), h = Symbol.for("react.suspense_list"), b = Symbol.for("react.memo"), _ = Symbol.for("react.lazy"), S = Symbol.for("react.offscreen"), U = Symbol.iterator, I = "@@iterator";
|
|
44
|
+
function d(e) {
|
|
45
45
|
if (e === null || typeof e != "object")
|
|
46
46
|
return null;
|
|
47
|
-
var
|
|
48
|
-
return typeof
|
|
47
|
+
var s = U && e[U] || e[I];
|
|
48
|
+
return typeof s == "function" ? s : null;
|
|
49
49
|
}
|
|
50
|
-
var
|
|
51
|
-
function
|
|
50
|
+
var y = o.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;
|
|
51
|
+
function w(e) {
|
|
52
52
|
{
|
|
53
|
-
for (var
|
|
54
|
-
l[
|
|
55
|
-
|
|
53
|
+
for (var s = arguments.length, l = new Array(s > 1 ? s - 1 : 0), g = 1; g < s; g++)
|
|
54
|
+
l[g - 1] = arguments[g];
|
|
55
|
+
N("error", e, l);
|
|
56
56
|
}
|
|
57
57
|
}
|
|
58
|
-
function
|
|
58
|
+
function N(e, s, l) {
|
|
59
59
|
{
|
|
60
|
-
var
|
|
61
|
-
|
|
62
|
-
var
|
|
63
|
-
return String(
|
|
60
|
+
var g = y.ReactDebugCurrentFrame, C = g.getStackAddendum();
|
|
61
|
+
C !== "" && (s += "%s", l = l.concat([C]));
|
|
62
|
+
var E = l.map(function(x) {
|
|
63
|
+
return String(x);
|
|
64
64
|
});
|
|
65
|
-
|
|
65
|
+
E.unshift("Warning: " + s), Function.prototype.apply.call(console[e], console, E);
|
|
66
66
|
}
|
|
67
67
|
}
|
|
68
|
-
var
|
|
69
|
-
|
|
70
|
-
function
|
|
71
|
-
return !!(typeof e == "string" || typeof e == "function" || e === r || e ===
|
|
68
|
+
var k = !1, j = !1, P = !1, $ = !1, L = !1, ee;
|
|
69
|
+
ee = Symbol.for("react.module.reference");
|
|
70
|
+
function de(e) {
|
|
71
|
+
return !!(typeof e == "string" || typeof e == "function" || e === r || e === i || L || e === a || e === m || e === h || $ || e === S || k || j || P || typeof e == "object" && e !== null && (e.$$typeof === _ || e.$$typeof === b || e.$$typeof === u || e.$$typeof === f || e.$$typeof === c || // This needs to include all possible module reference object
|
|
72
72
|
// types supported by any Flight configuration anywhere since
|
|
73
73
|
// we don't know which Flight build this will end up being used
|
|
74
74
|
// with.
|
|
75
|
-
e.$$typeof ===
|
|
75
|
+
e.$$typeof === ee || e.getModuleId !== void 0));
|
|
76
76
|
}
|
|
77
|
-
function
|
|
78
|
-
var
|
|
79
|
-
if (
|
|
80
|
-
return
|
|
81
|
-
var
|
|
82
|
-
return
|
|
77
|
+
function ne(e, s, l) {
|
|
78
|
+
var g = e.displayName;
|
|
79
|
+
if (g)
|
|
80
|
+
return g;
|
|
81
|
+
var C = s.displayName || s.name || "";
|
|
82
|
+
return C !== "" ? l + "(" + C + ")" : l;
|
|
83
83
|
}
|
|
84
84
|
function De(e) {
|
|
85
85
|
return e.displayName || "Context";
|
|
86
86
|
}
|
|
87
|
-
function
|
|
87
|
+
function V(e) {
|
|
88
88
|
if (e == null)
|
|
89
89
|
return null;
|
|
90
|
-
if (typeof e.tag == "number" &&
|
|
90
|
+
if (typeof e.tag == "number" && w("Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."), typeof e == "function")
|
|
91
91
|
return e.displayName || e.name || null;
|
|
92
92
|
if (typeof e == "string")
|
|
93
93
|
return e;
|
|
@@ -96,32 +96,32 @@ function ot() {
|
|
|
96
96
|
return "Fragment";
|
|
97
97
|
case t:
|
|
98
98
|
return "Portal";
|
|
99
|
-
case s:
|
|
100
|
-
return "Profiler";
|
|
101
99
|
case i:
|
|
100
|
+
return "Profiler";
|
|
101
|
+
case a:
|
|
102
102
|
return "StrictMode";
|
|
103
|
-
case
|
|
103
|
+
case m:
|
|
104
104
|
return "Suspense";
|
|
105
|
-
case
|
|
105
|
+
case h:
|
|
106
106
|
return "SuspenseList";
|
|
107
107
|
}
|
|
108
108
|
if (typeof e == "object")
|
|
109
109
|
switch (e.$$typeof) {
|
|
110
|
-
case
|
|
111
|
-
var
|
|
112
|
-
return De(
|
|
113
|
-
case
|
|
110
|
+
case f:
|
|
111
|
+
var s = e;
|
|
112
|
+
return De(s) + ".Consumer";
|
|
113
|
+
case u:
|
|
114
114
|
var l = e;
|
|
115
115
|
return De(l._context) + ".Provider";
|
|
116
|
-
case
|
|
117
|
-
return
|
|
118
|
-
case
|
|
119
|
-
var
|
|
120
|
-
return
|
|
121
|
-
case
|
|
122
|
-
var
|
|
116
|
+
case c:
|
|
117
|
+
return ne(e, e.render, "ForwardRef");
|
|
118
|
+
case b:
|
|
119
|
+
var g = e.displayName || null;
|
|
120
|
+
return g !== null ? g : V(e.type) || "Memo";
|
|
121
|
+
case _: {
|
|
122
|
+
var C = e, E = C._payload, x = C._init;
|
|
123
123
|
try {
|
|
124
|
-
return
|
|
124
|
+
return V(x(E));
|
|
125
125
|
} catch {
|
|
126
126
|
return null;
|
|
127
127
|
}
|
|
@@ -129,18 +129,18 @@ function ot() {
|
|
|
129
129
|
}
|
|
130
130
|
return null;
|
|
131
131
|
}
|
|
132
|
-
var
|
|
133
|
-
function
|
|
132
|
+
var K = Object.assign, te = 0, ze, Fe, Ue, He, Me, $e, We;
|
|
133
|
+
function Le() {
|
|
134
134
|
}
|
|
135
|
-
|
|
135
|
+
Le.__reactDisabledLog = !0;
|
|
136
136
|
function En() {
|
|
137
137
|
{
|
|
138
138
|
if (te === 0) {
|
|
139
|
-
ze = console.log, Fe = console.info, Ue = console.warn,
|
|
139
|
+
ze = console.log, Fe = console.info, Ue = console.warn, He = console.error, Me = console.group, $e = console.groupCollapsed, We = console.groupEnd;
|
|
140
140
|
var e = {
|
|
141
141
|
configurable: !0,
|
|
142
142
|
enumerable: !0,
|
|
143
|
-
value:
|
|
143
|
+
value: Le,
|
|
144
144
|
writable: !0
|
|
145
145
|
};
|
|
146
146
|
Object.defineProperties(console, {
|
|
@@ -165,196 +165,196 @@ function ot() {
|
|
|
165
165
|
writable: !0
|
|
166
166
|
};
|
|
167
167
|
Object.defineProperties(console, {
|
|
168
|
-
log:
|
|
168
|
+
log: K({}, e, {
|
|
169
169
|
value: ze
|
|
170
170
|
}),
|
|
171
|
-
info:
|
|
171
|
+
info: K({}, e, {
|
|
172
172
|
value: Fe
|
|
173
173
|
}),
|
|
174
|
-
warn:
|
|
174
|
+
warn: K({}, e, {
|
|
175
175
|
value: Ue
|
|
176
176
|
}),
|
|
177
|
-
error:
|
|
178
|
-
value:
|
|
177
|
+
error: K({}, e, {
|
|
178
|
+
value: He
|
|
179
179
|
}),
|
|
180
|
-
group:
|
|
180
|
+
group: K({}, e, {
|
|
181
181
|
value: Me
|
|
182
182
|
}),
|
|
183
|
-
groupCollapsed:
|
|
184
|
-
value:
|
|
183
|
+
groupCollapsed: K({}, e, {
|
|
184
|
+
value: $e
|
|
185
185
|
}),
|
|
186
|
-
groupEnd:
|
|
186
|
+
groupEnd: K({}, e, {
|
|
187
187
|
value: We
|
|
188
188
|
})
|
|
189
189
|
});
|
|
190
190
|
}
|
|
191
|
-
te < 0 &&
|
|
191
|
+
te < 0 && w("disabledDepth fell below zero. This is a bug in React. Please file an issue.");
|
|
192
192
|
}
|
|
193
193
|
}
|
|
194
|
-
var Ce =
|
|
195
|
-
function me(e,
|
|
194
|
+
var Ce = y.ReactCurrentDispatcher, Se;
|
|
195
|
+
function me(e, s, l) {
|
|
196
196
|
{
|
|
197
197
|
if (Se === void 0)
|
|
198
198
|
try {
|
|
199
199
|
throw Error();
|
|
200
|
-
} catch (
|
|
201
|
-
var
|
|
202
|
-
Se =
|
|
200
|
+
} catch (C) {
|
|
201
|
+
var g = C.stack.trim().match(/\n( *(at )?)/);
|
|
202
|
+
Se = g && g[1] || "";
|
|
203
203
|
}
|
|
204
204
|
return `
|
|
205
205
|
` + Se + e;
|
|
206
206
|
}
|
|
207
207
|
}
|
|
208
|
-
var
|
|
208
|
+
var Ee = !1, pe;
|
|
209
209
|
{
|
|
210
|
-
var
|
|
211
|
-
pe = new
|
|
210
|
+
var _n = typeof WeakMap == "function" ? WeakMap : Map;
|
|
211
|
+
pe = new _n();
|
|
212
212
|
}
|
|
213
|
-
function
|
|
214
|
-
if (!e ||
|
|
213
|
+
function Ye(e, s) {
|
|
214
|
+
if (!e || Ee)
|
|
215
215
|
return "";
|
|
216
216
|
{
|
|
217
217
|
var l = pe.get(e);
|
|
218
218
|
if (l !== void 0)
|
|
219
219
|
return l;
|
|
220
220
|
}
|
|
221
|
-
var
|
|
222
|
-
|
|
223
|
-
var
|
|
221
|
+
var g;
|
|
222
|
+
Ee = !0;
|
|
223
|
+
var C = Error.prepareStackTrace;
|
|
224
224
|
Error.prepareStackTrace = void 0;
|
|
225
|
-
var
|
|
226
|
-
|
|
225
|
+
var E;
|
|
226
|
+
E = Ce.current, Ce.current = null, En();
|
|
227
227
|
try {
|
|
228
|
-
if (
|
|
229
|
-
var
|
|
228
|
+
if (s) {
|
|
229
|
+
var x = function() {
|
|
230
230
|
throw Error();
|
|
231
231
|
};
|
|
232
|
-
if (Object.defineProperty(
|
|
232
|
+
if (Object.defineProperty(x.prototype, "props", {
|
|
233
233
|
set: function() {
|
|
234
234
|
throw Error();
|
|
235
235
|
}
|
|
236
236
|
}), typeof Reflect == "object" && Reflect.construct) {
|
|
237
237
|
try {
|
|
238
|
-
Reflect.construct(
|
|
239
|
-
} catch (
|
|
240
|
-
|
|
238
|
+
Reflect.construct(x, []);
|
|
239
|
+
} catch (H) {
|
|
240
|
+
g = H;
|
|
241
241
|
}
|
|
242
|
-
Reflect.construct(e, [],
|
|
242
|
+
Reflect.construct(e, [], x);
|
|
243
243
|
} else {
|
|
244
244
|
try {
|
|
245
|
-
|
|
246
|
-
} catch (
|
|
247
|
-
|
|
245
|
+
x.call();
|
|
246
|
+
} catch (H) {
|
|
247
|
+
g = H;
|
|
248
248
|
}
|
|
249
|
-
e.call(
|
|
249
|
+
e.call(x.prototype);
|
|
250
250
|
}
|
|
251
251
|
} else {
|
|
252
252
|
try {
|
|
253
253
|
throw Error();
|
|
254
|
-
} catch (
|
|
255
|
-
|
|
254
|
+
} catch (H) {
|
|
255
|
+
g = H;
|
|
256
256
|
}
|
|
257
257
|
e();
|
|
258
258
|
}
|
|
259
|
-
} catch (
|
|
260
|
-
if (
|
|
261
|
-
for (var
|
|
262
|
-
`), F =
|
|
263
|
-
`),
|
|
264
|
-
|
|
265
|
-
for (;
|
|
266
|
-
if (
|
|
267
|
-
if (
|
|
259
|
+
} catch (H) {
|
|
260
|
+
if (H && g && typeof H.stack == "string") {
|
|
261
|
+
for (var v = H.stack.split(`
|
|
262
|
+
`), F = g.stack.split(`
|
|
263
|
+
`), T = v.length - 1, O = F.length - 1; T >= 1 && O >= 0 && v[T] !== F[O]; )
|
|
264
|
+
O--;
|
|
265
|
+
for (; T >= 1 && O >= 0; T--, O--)
|
|
266
|
+
if (v[T] !== F[O]) {
|
|
267
|
+
if (T !== 1 || O !== 1)
|
|
268
268
|
do
|
|
269
|
-
if (
|
|
269
|
+
if (T--, O--, O < 0 || v[T] !== F[O]) {
|
|
270
270
|
var W = `
|
|
271
|
-
` +
|
|
271
|
+
` + v[T].replace(" at new ", " at ");
|
|
272
272
|
return e.displayName && W.includes("<anonymous>") && (W = W.replace("<anonymous>", e.displayName)), typeof e == "function" && pe.set(e, W), W;
|
|
273
273
|
}
|
|
274
|
-
while (
|
|
274
|
+
while (T >= 1 && O >= 0);
|
|
275
275
|
break;
|
|
276
276
|
}
|
|
277
277
|
}
|
|
278
278
|
} finally {
|
|
279
|
-
|
|
279
|
+
Ee = !1, Ce.current = E, kn(), Error.prepareStackTrace = C;
|
|
280
280
|
}
|
|
281
|
-
var
|
|
282
|
-
return typeof e == "function" && pe.set(e,
|
|
281
|
+
var G = e ? e.displayName || e.name : "", B = G ? me(G) : "";
|
|
282
|
+
return typeof e == "function" && pe.set(e, B), B;
|
|
283
283
|
}
|
|
284
|
-
function
|
|
285
|
-
return
|
|
284
|
+
function Rn(e, s, l) {
|
|
285
|
+
return Ye(e, !1);
|
|
286
286
|
}
|
|
287
|
-
function
|
|
288
|
-
var
|
|
289
|
-
return !!(
|
|
287
|
+
function jn(e) {
|
|
288
|
+
var s = e.prototype;
|
|
289
|
+
return !!(s && s.isReactComponent);
|
|
290
290
|
}
|
|
291
|
-
function fe(e,
|
|
291
|
+
function fe(e, s, l) {
|
|
292
292
|
if (e == null)
|
|
293
293
|
return "";
|
|
294
294
|
if (typeof e == "function")
|
|
295
|
-
return
|
|
295
|
+
return Ye(e, jn(e));
|
|
296
296
|
if (typeof e == "string")
|
|
297
297
|
return me(e);
|
|
298
298
|
switch (e) {
|
|
299
|
-
case
|
|
299
|
+
case m:
|
|
300
300
|
return me("Suspense");
|
|
301
|
-
case
|
|
301
|
+
case h:
|
|
302
302
|
return me("SuspenseList");
|
|
303
303
|
}
|
|
304
304
|
if (typeof e == "object")
|
|
305
305
|
switch (e.$$typeof) {
|
|
306
|
-
case
|
|
307
|
-
return
|
|
308
|
-
case
|
|
309
|
-
return fe(e.type,
|
|
310
|
-
case
|
|
311
|
-
var
|
|
306
|
+
case c:
|
|
307
|
+
return Rn(e.render);
|
|
308
|
+
case b:
|
|
309
|
+
return fe(e.type, s, l);
|
|
310
|
+
case _: {
|
|
311
|
+
var g = e, C = g._payload, E = g._init;
|
|
312
312
|
try {
|
|
313
|
-
return fe(
|
|
313
|
+
return fe(E(C), s, l);
|
|
314
314
|
} catch {
|
|
315
315
|
}
|
|
316
316
|
}
|
|
317
317
|
}
|
|
318
318
|
return "";
|
|
319
319
|
}
|
|
320
|
-
var re = Object.prototype.hasOwnProperty, Ve = {}, Ke =
|
|
321
|
-
function
|
|
320
|
+
var re = Object.prototype.hasOwnProperty, Ve = {}, Ke = y.ReactDebugCurrentFrame;
|
|
321
|
+
function he(e) {
|
|
322
322
|
if (e) {
|
|
323
|
-
var
|
|
323
|
+
var s = e._owner, l = fe(e.type, e._source, s ? s.type : null);
|
|
324
324
|
Ke.setExtraStackFrame(l);
|
|
325
325
|
} else
|
|
326
326
|
Ke.setExtraStackFrame(null);
|
|
327
327
|
}
|
|
328
|
-
function
|
|
328
|
+
function An(e, s, l, g, C) {
|
|
329
329
|
{
|
|
330
|
-
var
|
|
331
|
-
for (var
|
|
332
|
-
if (
|
|
333
|
-
var
|
|
330
|
+
var E = Function.call.bind(re);
|
|
331
|
+
for (var x in e)
|
|
332
|
+
if (E(e, x)) {
|
|
333
|
+
var v = void 0;
|
|
334
334
|
try {
|
|
335
|
-
if (typeof e[
|
|
336
|
-
var F = Error((
|
|
335
|
+
if (typeof e[x] != "function") {
|
|
336
|
+
var F = Error((g || "React class") + ": " + l + " type `" + x + "` is invalid; it must be a function, usually from the `prop-types` package, but received `" + typeof e[x] + "`.This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`.");
|
|
337
337
|
throw F.name = "Invariant Violation", F;
|
|
338
338
|
}
|
|
339
|
-
|
|
340
|
-
} catch (
|
|
341
|
-
|
|
339
|
+
v = e[x](s, x, g, l, null, "SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED");
|
|
340
|
+
} catch (T) {
|
|
341
|
+
v = T;
|
|
342
342
|
}
|
|
343
|
-
|
|
343
|
+
v && !(v instanceof Error) && (he(C), w("%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).", g || "React class", l, x, typeof v), he(null)), v instanceof Error && !(v.message in Ve) && (Ve[v.message] = !0, he(C), w("Failed %s type: %s", l, v.message), he(null));
|
|
344
344
|
}
|
|
345
345
|
}
|
|
346
346
|
}
|
|
347
|
-
var
|
|
348
|
-
function
|
|
349
|
-
return
|
|
347
|
+
var Pn = Array.isArray;
|
|
348
|
+
function ke(e) {
|
|
349
|
+
return Pn(e);
|
|
350
350
|
}
|
|
351
|
-
function
|
|
351
|
+
function Tn(e) {
|
|
352
352
|
{
|
|
353
|
-
var
|
|
353
|
+
var s = typeof Symbol == "function" && Symbol.toStringTag, l = s && e[Symbol.toStringTag] || e.constructor.name || "Object";
|
|
354
354
|
return l;
|
|
355
355
|
}
|
|
356
356
|
}
|
|
357
|
-
function
|
|
357
|
+
function On(e) {
|
|
358
358
|
try {
|
|
359
359
|
return Be(e), !1;
|
|
360
360
|
} catch {
|
|
@@ -365,42 +365,42 @@ function ot() {
|
|
|
365
365
|
return "" + e;
|
|
366
366
|
}
|
|
367
367
|
function qe(e) {
|
|
368
|
-
if (
|
|
369
|
-
return
|
|
368
|
+
if (On(e))
|
|
369
|
+
return w("The provided key is an unsupported type %s. This value must be coerced to a string before before using it here.", Tn(e)), Be(e);
|
|
370
370
|
}
|
|
371
|
-
var oe =
|
|
371
|
+
var oe = y.ReactCurrentOwner, Nn = {
|
|
372
372
|
key: !0,
|
|
373
373
|
ref: !0,
|
|
374
374
|
__self: !0,
|
|
375
375
|
__source: !0
|
|
376
|
-
}, Je, Ge,
|
|
377
|
-
|
|
378
|
-
function
|
|
376
|
+
}, Je, Ge, _e;
|
|
377
|
+
_e = {};
|
|
378
|
+
function In(e) {
|
|
379
379
|
if (re.call(e, "ref")) {
|
|
380
|
-
var
|
|
381
|
-
if (
|
|
380
|
+
var s = Object.getOwnPropertyDescriptor(e, "ref").get;
|
|
381
|
+
if (s && s.isReactWarning)
|
|
382
382
|
return !1;
|
|
383
383
|
}
|
|
384
384
|
return e.ref !== void 0;
|
|
385
385
|
}
|
|
386
|
-
function
|
|
386
|
+
function Dn(e) {
|
|
387
387
|
if (re.call(e, "key")) {
|
|
388
|
-
var
|
|
389
|
-
if (
|
|
388
|
+
var s = Object.getOwnPropertyDescriptor(e, "key").get;
|
|
389
|
+
if (s && s.isReactWarning)
|
|
390
390
|
return !1;
|
|
391
391
|
}
|
|
392
392
|
return e.key !== void 0;
|
|
393
393
|
}
|
|
394
|
-
function
|
|
395
|
-
if (typeof e.ref == "string" && oe.current &&
|
|
396
|
-
var l =
|
|
397
|
-
|
|
394
|
+
function zn(e, s) {
|
|
395
|
+
if (typeof e.ref == "string" && oe.current && s && oe.current.stateNode !== s) {
|
|
396
|
+
var l = V(oe.current.type);
|
|
397
|
+
_e[l] || (w('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', V(oe.current.type), e.ref), _e[l] = !0);
|
|
398
398
|
}
|
|
399
399
|
}
|
|
400
|
-
function
|
|
400
|
+
function Fn(e, s) {
|
|
401
401
|
{
|
|
402
402
|
var l = function() {
|
|
403
|
-
Je || (Je = !0,
|
|
403
|
+
Je || (Je = !0, w("%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://reactjs.org/link/special-props)", s));
|
|
404
404
|
};
|
|
405
405
|
l.isReactWarning = !0, Object.defineProperty(e, "key", {
|
|
406
406
|
get: l,
|
|
@@ -408,10 +408,10 @@ function ot() {
|
|
|
408
408
|
});
|
|
409
409
|
}
|
|
410
410
|
}
|
|
411
|
-
function
|
|
411
|
+
function Un(e, s) {
|
|
412
412
|
{
|
|
413
413
|
var l = function() {
|
|
414
|
-
Ge || (Ge = !0,
|
|
414
|
+
Ge || (Ge = !0, w("%s: `ref` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://reactjs.org/link/special-props)", s));
|
|
415
415
|
};
|
|
416
416
|
l.isReactWarning = !0, Object.defineProperty(e, "ref", {
|
|
417
417
|
get: l,
|
|
@@ -419,57 +419,57 @@ function ot() {
|
|
|
419
419
|
});
|
|
420
420
|
}
|
|
421
421
|
}
|
|
422
|
-
var
|
|
423
|
-
var
|
|
422
|
+
var Hn = function(e, s, l, g, C, E, x) {
|
|
423
|
+
var v = {
|
|
424
424
|
// This tag allows us to uniquely identify this as a React Element
|
|
425
425
|
$$typeof: n,
|
|
426
426
|
// Built-in properties that belong on the element
|
|
427
427
|
type: e,
|
|
428
|
-
key:
|
|
428
|
+
key: s,
|
|
429
429
|
ref: l,
|
|
430
|
-
props:
|
|
430
|
+
props: x,
|
|
431
431
|
// Record the component responsible for creating this element.
|
|
432
|
-
_owner:
|
|
432
|
+
_owner: E
|
|
433
433
|
};
|
|
434
|
-
return
|
|
434
|
+
return v._store = {}, Object.defineProperty(v._store, "validated", {
|
|
435
435
|
configurable: !1,
|
|
436
436
|
enumerable: !1,
|
|
437
437
|
writable: !0,
|
|
438
438
|
value: !1
|
|
439
|
-
}), Object.defineProperty(
|
|
439
|
+
}), Object.defineProperty(v, "_self", {
|
|
440
440
|
configurable: !1,
|
|
441
441
|
enumerable: !1,
|
|
442
442
|
writable: !1,
|
|
443
|
-
value:
|
|
444
|
-
}), Object.defineProperty(
|
|
443
|
+
value: g
|
|
444
|
+
}), Object.defineProperty(v, "_source", {
|
|
445
445
|
configurable: !1,
|
|
446
446
|
enumerable: !1,
|
|
447
447
|
writable: !1,
|
|
448
|
-
value:
|
|
449
|
-
}), Object.freeze && (Object.freeze(
|
|
448
|
+
value: C
|
|
449
|
+
}), Object.freeze && (Object.freeze(v.props), Object.freeze(v)), v;
|
|
450
450
|
};
|
|
451
|
-
function
|
|
451
|
+
function Mn(e, s, l, g, C) {
|
|
452
452
|
{
|
|
453
|
-
var
|
|
454
|
-
l !== void 0 && (qe(l),
|
|
455
|
-
for (
|
|
456
|
-
re.call(
|
|
453
|
+
var E, x = {}, v = null, F = null;
|
|
454
|
+
l !== void 0 && (qe(l), v = "" + l), Dn(s) && (qe(s.key), v = "" + s.key), In(s) && (F = s.ref, zn(s, C));
|
|
455
|
+
for (E in s)
|
|
456
|
+
re.call(s, E) && !Nn.hasOwnProperty(E) && (x[E] = s[E]);
|
|
457
457
|
if (e && e.defaultProps) {
|
|
458
|
-
var
|
|
459
|
-
for (
|
|
460
|
-
|
|
458
|
+
var T = e.defaultProps;
|
|
459
|
+
for (E in T)
|
|
460
|
+
x[E] === void 0 && (x[E] = T[E]);
|
|
461
461
|
}
|
|
462
|
-
if (
|
|
463
|
-
var
|
|
464
|
-
|
|
462
|
+
if (v || F) {
|
|
463
|
+
var O = typeof e == "function" ? e.displayName || e.name || "Unknown" : e;
|
|
464
|
+
v && Fn(x, O), F && Un(x, O);
|
|
465
465
|
}
|
|
466
|
-
return
|
|
466
|
+
return Hn(e, v, F, C, g, oe.current, x);
|
|
467
467
|
}
|
|
468
468
|
}
|
|
469
|
-
var Re =
|
|
470
|
-
function
|
|
469
|
+
var Re = y.ReactCurrentOwner, Xe = y.ReactDebugCurrentFrame;
|
|
470
|
+
function J(e) {
|
|
471
471
|
if (e) {
|
|
472
|
-
var
|
|
472
|
+
var s = e._owner, l = fe(e.type, e._source, s ? s.type : null);
|
|
473
473
|
Xe.setExtraStackFrame(l);
|
|
474
474
|
} else
|
|
475
475
|
Xe.setExtraStackFrame(null);
|
|
@@ -482,7 +482,7 @@ function ot() {
|
|
|
482
482
|
function Qe() {
|
|
483
483
|
{
|
|
484
484
|
if (Re.current) {
|
|
485
|
-
var e =
|
|
485
|
+
var e = V(Re.current.type);
|
|
486
486
|
if (e)
|
|
487
487
|
return `
|
|
488
488
|
|
|
@@ -491,184 +491,184 @@ Check the render method of \`` + e + "`.";
|
|
|
491
491
|
return "";
|
|
492
492
|
}
|
|
493
493
|
}
|
|
494
|
-
function
|
|
494
|
+
function $n(e) {
|
|
495
495
|
return "";
|
|
496
496
|
}
|
|
497
497
|
var Ze = {};
|
|
498
|
-
function
|
|
498
|
+
function Wn(e) {
|
|
499
499
|
{
|
|
500
|
-
var
|
|
501
|
-
if (!
|
|
500
|
+
var s = Qe();
|
|
501
|
+
if (!s) {
|
|
502
502
|
var l = typeof e == "string" ? e : e.displayName || e.name;
|
|
503
|
-
l && (
|
|
503
|
+
l && (s = `
|
|
504
504
|
|
|
505
505
|
Check the top-level render call using <` + l + ">.");
|
|
506
506
|
}
|
|
507
|
-
return
|
|
507
|
+
return s;
|
|
508
508
|
}
|
|
509
509
|
}
|
|
510
|
-
function en(e,
|
|
510
|
+
function en(e, s) {
|
|
511
511
|
{
|
|
512
512
|
if (!e._store || e._store.validated || e.key != null)
|
|
513
513
|
return;
|
|
514
514
|
e._store.validated = !0;
|
|
515
|
-
var l =
|
|
515
|
+
var l = Wn(s);
|
|
516
516
|
if (Ze[l])
|
|
517
517
|
return;
|
|
518
518
|
Ze[l] = !0;
|
|
519
|
-
var
|
|
520
|
-
e && e._owner && e._owner !== Re.current && (
|
|
519
|
+
var g = "";
|
|
520
|
+
e && e._owner && e._owner !== Re.current && (g = " It was passed a child from " + V(e._owner.type) + "."), J(e), w('Each child in a list should have a unique "key" prop.%s%s See https://reactjs.org/link/warning-keys for more information.', l, g), J(null);
|
|
521
521
|
}
|
|
522
522
|
}
|
|
523
|
-
function nn(e,
|
|
523
|
+
function nn(e, s) {
|
|
524
524
|
{
|
|
525
525
|
if (typeof e != "object")
|
|
526
526
|
return;
|
|
527
|
-
if (
|
|
527
|
+
if (ke(e))
|
|
528
528
|
for (var l = 0; l < e.length; l++) {
|
|
529
|
-
var
|
|
530
|
-
Ae(
|
|
529
|
+
var g = e[l];
|
|
530
|
+
Ae(g) && en(g, s);
|
|
531
531
|
}
|
|
532
532
|
else if (Ae(e))
|
|
533
533
|
e._store && (e._store.validated = !0);
|
|
534
534
|
else if (e) {
|
|
535
|
-
var
|
|
536
|
-
if (typeof
|
|
537
|
-
for (var
|
|
538
|
-
Ae(
|
|
535
|
+
var C = d(e);
|
|
536
|
+
if (typeof C == "function" && C !== e.entries)
|
|
537
|
+
for (var E = C.call(e), x; !(x = E.next()).done; )
|
|
538
|
+
Ae(x.value) && en(x.value, s);
|
|
539
539
|
}
|
|
540
540
|
}
|
|
541
541
|
}
|
|
542
542
|
function Ln(e) {
|
|
543
543
|
{
|
|
544
|
-
var
|
|
545
|
-
if (
|
|
544
|
+
var s = e.type;
|
|
545
|
+
if (s == null || typeof s == "string")
|
|
546
546
|
return;
|
|
547
547
|
var l;
|
|
548
|
-
if (typeof
|
|
549
|
-
l =
|
|
550
|
-
else if (typeof
|
|
548
|
+
if (typeof s == "function")
|
|
549
|
+
l = s.propTypes;
|
|
550
|
+
else if (typeof s == "object" && (s.$$typeof === c || // Note: Memo only checks outer props here.
|
|
551
551
|
// Inner props are checked in the reconciler.
|
|
552
|
-
|
|
553
|
-
l =
|
|
552
|
+
s.$$typeof === b))
|
|
553
|
+
l = s.propTypes;
|
|
554
554
|
else
|
|
555
555
|
return;
|
|
556
556
|
if (l) {
|
|
557
|
-
var
|
|
558
|
-
|
|
559
|
-
} else if (
|
|
557
|
+
var g = V(s);
|
|
558
|
+
An(l, e.props, "prop", g, e);
|
|
559
|
+
} else if (s.PropTypes !== void 0 && !je) {
|
|
560
560
|
je = !0;
|
|
561
|
-
var
|
|
562
|
-
|
|
561
|
+
var C = V(s);
|
|
562
|
+
w("Component %s declared `PropTypes` instead of `propTypes`. Did you misspell the property assignment?", C || "Unknown");
|
|
563
563
|
}
|
|
564
|
-
typeof
|
|
564
|
+
typeof s.getDefaultProps == "function" && !s.getDefaultProps.isReactClassApproved && w("getDefaultProps is only used on classic React.createClass definitions. Use a static property named `defaultProps` instead.");
|
|
565
565
|
}
|
|
566
566
|
}
|
|
567
|
-
function
|
|
567
|
+
function Yn(e) {
|
|
568
568
|
{
|
|
569
|
-
for (var
|
|
570
|
-
var
|
|
571
|
-
if (
|
|
572
|
-
|
|
569
|
+
for (var s = Object.keys(e.props), l = 0; l < s.length; l++) {
|
|
570
|
+
var g = s[l];
|
|
571
|
+
if (g !== "children" && g !== "key") {
|
|
572
|
+
J(e), w("Invalid prop `%s` supplied to `React.Fragment`. React.Fragment can only have `key` and `children` props.", g), J(null);
|
|
573
573
|
break;
|
|
574
574
|
}
|
|
575
575
|
}
|
|
576
|
-
e.ref !== null && (
|
|
576
|
+
e.ref !== null && (J(e), w("Invalid attribute `ref` supplied to `React.Fragment`."), J(null));
|
|
577
577
|
}
|
|
578
578
|
}
|
|
579
579
|
var tn = {};
|
|
580
|
-
function rn(e,
|
|
580
|
+
function rn(e, s, l, g, C, E) {
|
|
581
581
|
{
|
|
582
|
-
var
|
|
583
|
-
if (!
|
|
584
|
-
var
|
|
585
|
-
(e === void 0 || typeof e == "object" && e !== null && Object.keys(e).length === 0) && (
|
|
586
|
-
var F =
|
|
587
|
-
F ?
|
|
588
|
-
var
|
|
589
|
-
e === null ?
|
|
582
|
+
var x = de(e);
|
|
583
|
+
if (!x) {
|
|
584
|
+
var v = "";
|
|
585
|
+
(e === void 0 || typeof e == "object" && e !== null && Object.keys(e).length === 0) && (v += " 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 = $n();
|
|
587
|
+
F ? v += F : v += Qe();
|
|
588
|
+
var T;
|
|
589
|
+
e === null ? T = "null" : ke(e) ? T = "array" : e !== void 0 && e.$$typeof === n ? (T = "<" + (V(e.type) || "Unknown") + " />", v = " Did you accidentally export a JSX literal instead of a component?") : T = typeof e, w("React.jsx: type is invalid -- expected a string (for built-in components) or a class/function (for composite components) but got: %s.%s", T, v);
|
|
590
590
|
}
|
|
591
|
-
var
|
|
592
|
-
if (
|
|
593
|
-
return
|
|
594
|
-
if (
|
|
595
|
-
var W =
|
|
591
|
+
var O = Mn(e, s, l, C, E);
|
|
592
|
+
if (O == null)
|
|
593
|
+
return O;
|
|
594
|
+
if (x) {
|
|
595
|
+
var W = s.children;
|
|
596
596
|
if (W !== void 0)
|
|
597
|
-
if (
|
|
598
|
-
if (
|
|
599
|
-
for (var
|
|
600
|
-
nn(W[
|
|
597
|
+
if (g)
|
|
598
|
+
if (ke(W)) {
|
|
599
|
+
for (var G = 0; G < W.length; G++)
|
|
600
|
+
nn(W[G], e);
|
|
601
601
|
Object.freeze && Object.freeze(W);
|
|
602
602
|
} else
|
|
603
|
-
|
|
603
|
+
w("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
604
|
else
|
|
605
605
|
nn(W, e);
|
|
606
606
|
}
|
|
607
|
-
if (re.call(
|
|
608
|
-
var
|
|
609
|
-
return
|
|
610
|
-
}), Pe =
|
|
611
|
-
if (!tn[
|
|
612
|
-
var
|
|
613
|
-
|
|
607
|
+
if (re.call(s, "key")) {
|
|
608
|
+
var B = V(e), H = Object.keys(s).filter(function(Gn) {
|
|
609
|
+
return Gn !== "key";
|
|
610
|
+
}), Pe = H.length > 0 ? "{key: someKey, " + H.join(": ..., ") + ": ...}" : "{key: someKey}";
|
|
611
|
+
if (!tn[B + Pe]) {
|
|
612
|
+
var Jn = H.length > 0 ? "{" + H.join(": ..., ") + ": ...}" : "{}";
|
|
613
|
+
w(`A props object containing a "key" prop is being spread into JSX:
|
|
614
614
|
let props = %s;
|
|
615
615
|
<%s {...props} />
|
|
616
616
|
React keys must be passed directly to JSX without using spread:
|
|
617
617
|
let props = %s;
|
|
618
|
-
<%s key={someKey} {...props} />`, Pe,
|
|
618
|
+
<%s key={someKey} {...props} />`, Pe, B, Jn, B), tn[B + Pe] = !0;
|
|
619
619
|
}
|
|
620
620
|
}
|
|
621
|
-
return e === r ?
|
|
621
|
+
return e === r ? Yn(O) : Ln(O), O;
|
|
622
622
|
}
|
|
623
623
|
}
|
|
624
|
-
function
|
|
625
|
-
return rn(e,
|
|
624
|
+
function Vn(e, s, l) {
|
|
625
|
+
return rn(e, s, l, !0);
|
|
626
626
|
}
|
|
627
|
-
function
|
|
628
|
-
return rn(e,
|
|
627
|
+
function Kn(e, s, l) {
|
|
628
|
+
return rn(e, s, l, !1);
|
|
629
629
|
}
|
|
630
|
-
var
|
|
631
|
-
se.Fragment = r, se.jsx =
|
|
630
|
+
var Bn = Kn, qn = Vn;
|
|
631
|
+
se.Fragment = r, se.jsx = Bn, se.jsxs = qn;
|
|
632
632
|
}()), se;
|
|
633
633
|
}
|
|
634
|
-
process.env.NODE_ENV === "production" ? Te.exports =
|
|
635
|
-
var
|
|
634
|
+
process.env.NODE_ENV === "production" ? Te.exports = tt() : Te.exports = rt();
|
|
635
|
+
var p = Te.exports, Oe, ge = nt;
|
|
636
636
|
if (process.env.NODE_ENV === "production")
|
|
637
|
-
Oe =
|
|
637
|
+
Oe = ge.createRoot, ge.hydrateRoot;
|
|
638
638
|
else {
|
|
639
|
-
var sn =
|
|
639
|
+
var sn = ge.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;
|
|
640
640
|
Oe = function(o, n) {
|
|
641
641
|
sn.usingClientEntryPoint = !0;
|
|
642
642
|
try {
|
|
643
|
-
return
|
|
643
|
+
return ge.createRoot(o, n);
|
|
644
644
|
} finally {
|
|
645
645
|
sn.usingClientEntryPoint = !1;
|
|
646
646
|
}
|
|
647
647
|
};
|
|
648
648
|
}
|
|
649
|
-
const
|
|
650
|
-
|
|
651
|
-
const
|
|
652
|
-
var
|
|
653
|
-
!t &&
|
|
649
|
+
const ot = ({ onOpen: o, onClose: n, isVisible: t, showCitadelKey: r }) => {
|
|
650
|
+
z(() => {
|
|
651
|
+
const a = (i) => {
|
|
652
|
+
var u, f;
|
|
653
|
+
!t && i.key === r && !["input", "textarea"].includes(((f = (u = i.target) == null ? void 0 : u.tagName) == null ? void 0 : f.toLowerCase()) || "") && (i.preventDefault(), o()), t && i.key === "Escape" && (i.preventDefault(), n());
|
|
654
654
|
};
|
|
655
|
-
return document.addEventListener("keydown",
|
|
655
|
+
return document.addEventListener("keydown", a), () => document.removeEventListener("keydown", a);
|
|
656
656
|
}, [o, n, t, r]);
|
|
657
|
-
},
|
|
658
|
-
container:
|
|
659
|
-
innerContainer:
|
|
660
|
-
inputSection:
|
|
661
|
-
resizeHandle:
|
|
662
|
-
citadel_slideUp:
|
|
663
|
-
citadel_slideDown:
|
|
664
|
-
},
|
|
665
|
-
const { isVisible: n, isClosing: t, onAnimationComplete: r } = o,
|
|
666
|
-
return
|
|
657
|
+
}, at = "_container_141sr_3", st = "_innerContainer_141sr_19", it = "_inputSection_141sr_28", lt = "_resizeHandle_141sr_35", ct = "_citadel_slideUp_141sr_64", ut = "_citadel_slideDown_141sr_68", ln = {
|
|
658
|
+
container: at,
|
|
659
|
+
innerContainer: st,
|
|
660
|
+
inputSection: it,
|
|
661
|
+
resizeHandle: lt,
|
|
662
|
+
citadel_slideUp: ct,
|
|
663
|
+
citadel_slideDown: ut
|
|
664
|
+
}, dt = (o) => {
|
|
665
|
+
const { isVisible: n, isClosing: t, onAnimationComplete: r } = o, a = be(() => n ? t ? ln.slideDown : ln.slideUp : "", [n, t]);
|
|
666
|
+
return z(() => {
|
|
667
667
|
if (r) {
|
|
668
|
-
const
|
|
668
|
+
const u = setTimeout(() => {
|
|
669
669
|
r();
|
|
670
670
|
}, 200);
|
|
671
|
-
return () => clearTimeout(
|
|
671
|
+
return () => clearTimeout(u);
|
|
672
672
|
}
|
|
673
673
|
}, [t, r]), {
|
|
674
674
|
style: be(() => ({
|
|
@@ -676,13 +676,13 @@ const at = ({ onOpen: o, onClose: n, isVisible: t, showCitadelKey: r }) => {
|
|
|
676
676
|
transform: n ? "translateY(0)" : t ? "translateY(100%)" : "translateY(-100%)",
|
|
677
677
|
transition: "opacity 200ms ease-in-out, transform 200ms ease-in-out"
|
|
678
678
|
}), [n, t]),
|
|
679
|
-
animationClass:
|
|
679
|
+
animationClass: a
|
|
680
680
|
};
|
|
681
681
|
};
|
|
682
682
|
var ie = /* @__PURE__ */ ((o) => (o.Pending = "pending", o.Success = "success", o.Failure = "failure", o.Timeout = "timeout", o))(ie || {});
|
|
683
|
-
class
|
|
683
|
+
class Z {
|
|
684
684
|
constructor(n = Date.now()) {
|
|
685
|
-
|
|
685
|
+
A(this, "_status", "pending");
|
|
686
686
|
this.timestamp = n;
|
|
687
687
|
}
|
|
688
688
|
get status() {
|
|
@@ -698,41 +698,41 @@ class ee {
|
|
|
698
698
|
this._status = "timeout";
|
|
699
699
|
}
|
|
700
700
|
}
|
|
701
|
-
class
|
|
701
|
+
class Ht extends Z {
|
|
702
702
|
constructor(n, t) {
|
|
703
703
|
super(t), this.data = n;
|
|
704
704
|
}
|
|
705
705
|
render() {
|
|
706
|
-
return /* @__PURE__ */
|
|
706
|
+
return /* @__PURE__ */ p.jsx("pre", { className: "text-gray-200", children: JSON.stringify(this.data, null, 2) });
|
|
707
707
|
}
|
|
708
708
|
}
|
|
709
|
-
class
|
|
709
|
+
class hn extends Z {
|
|
710
710
|
constructor(n, t) {
|
|
711
711
|
super(t), this.text = n;
|
|
712
712
|
}
|
|
713
713
|
render() {
|
|
714
|
-
return /* @__PURE__ */
|
|
714
|
+
return /* @__PURE__ */ p.jsx("div", { className: "text-gray-200 whitespace-pre font-mono", children: this.text });
|
|
715
715
|
}
|
|
716
716
|
}
|
|
717
|
-
class
|
|
717
|
+
class mt extends Z {
|
|
718
718
|
constructor(n, t) {
|
|
719
719
|
super(t), this.error = n, this.markFailure();
|
|
720
720
|
}
|
|
721
721
|
render() {
|
|
722
|
-
return /* @__PURE__ */
|
|
722
|
+
return /* @__PURE__ */ p.jsx("div", { className: "mt-1 text-red-400", children: this.error });
|
|
723
723
|
}
|
|
724
724
|
}
|
|
725
|
-
class
|
|
725
|
+
class pt extends Z {
|
|
726
726
|
render() {
|
|
727
|
-
return /* @__PURE__ */
|
|
727
|
+
return /* @__PURE__ */ p.jsx("div", { className: "text-gray-400", children: "..." });
|
|
728
728
|
}
|
|
729
729
|
}
|
|
730
|
-
class
|
|
730
|
+
class Mt extends Z {
|
|
731
731
|
constructor(n, t = "", r) {
|
|
732
732
|
super(r), this.imageUrl = n, this.altText = t;
|
|
733
733
|
}
|
|
734
734
|
render() {
|
|
735
|
-
return /* @__PURE__ */
|
|
735
|
+
return /* @__PURE__ */ p.jsx("div", { className: "my-2", children: /* @__PURE__ */ p.jsx(
|
|
736
736
|
"img",
|
|
737
737
|
{
|
|
738
738
|
src: this.imageUrl,
|
|
@@ -742,16 +742,16 @@ class Lt extends ee {
|
|
|
742
742
|
) });
|
|
743
743
|
}
|
|
744
744
|
}
|
|
745
|
-
const
|
|
746
|
-
const
|
|
747
|
-
return
|
|
748
|
-
|
|
749
|
-
` +
|
|
745
|
+
const ft = (o) => async function() {
|
|
746
|
+
const n = o.commands.filter((t) => t.fullPath[0] !== "help").map((t) => `${t.segments.map((a) => a.type === "argument" ? `<${a.name}>` : a.name).join(" ")} - ${t.description}`).sort();
|
|
747
|
+
return n.push("help - Show available commands"), new hn(
|
|
748
|
+
n.length > 0 ? `Available Commands:
|
|
749
|
+
` + n.join(`
|
|
750
750
|
`) : "No commands available yet. Add some commands to get started!"
|
|
751
751
|
);
|
|
752
752
|
};
|
|
753
753
|
var we = /* @__PURE__ */ ((o) => (o[o.NONE = 0] = "NONE", o[o.ERROR = 1] = "ERROR", o[o.WARN = 2] = "WARN", o[o.INFO = 3] = "INFO", o[o.DEBUG = 4] = "DEBUG", o[o.TRACE = 5] = "TRACE", o))(we || {});
|
|
754
|
-
class
|
|
754
|
+
class D {
|
|
755
755
|
static configure(n) {
|
|
756
756
|
this.level = n.level, this.prefix = n.prefix || "[Citadel]";
|
|
757
757
|
}
|
|
@@ -771,7 +771,7 @@ class N {
|
|
|
771
771
|
this.level >= 1 && console.error(this.prefix, ...n);
|
|
772
772
|
}
|
|
773
773
|
}
|
|
774
|
-
|
|
774
|
+
A(D, "level", 0), A(D, "prefix", "");
|
|
775
775
|
const M = {
|
|
776
776
|
commandTimeoutMs: 1e4,
|
|
777
777
|
cursorColor: "var(--cursor-color, #fff)",
|
|
@@ -790,9 +790,9 @@ const M = {
|
|
|
790
790
|
maxCommands: 100
|
|
791
791
|
}
|
|
792
792
|
};
|
|
793
|
-
class
|
|
793
|
+
class gn {
|
|
794
794
|
constructor(n) {
|
|
795
|
-
|
|
795
|
+
A(this, "config");
|
|
796
796
|
this.config = {
|
|
797
797
|
type: "localStorage",
|
|
798
798
|
maxCommands: 100,
|
|
@@ -809,17 +809,17 @@ class hn {
|
|
|
809
809
|
await this.saveCommands(t);
|
|
810
810
|
}
|
|
811
811
|
}
|
|
812
|
-
class ht extends
|
|
812
|
+
class ht extends gn {
|
|
813
813
|
constructor(t) {
|
|
814
814
|
super(t);
|
|
815
|
-
|
|
815
|
+
A(this, "storageKey", "citadel_command_history");
|
|
816
816
|
}
|
|
817
817
|
async getStoredCommands() {
|
|
818
818
|
try {
|
|
819
819
|
const t = window.localStorage.getItem(this.storageKey);
|
|
820
|
-
return t ? JSON.parse(t).map((
|
|
821
|
-
commandSegments:
|
|
822
|
-
timestamp:
|
|
820
|
+
return t ? JSON.parse(t).map((a) => ({
|
|
821
|
+
commandSegments: a.commandSegments || [],
|
|
822
|
+
timestamp: a.timestamp
|
|
823
823
|
})) : [];
|
|
824
824
|
} catch (t) {
|
|
825
825
|
return console.warn("Failed to load commands from localStorage:", t), [];
|
|
@@ -834,9 +834,9 @@ class ht extends hn {
|
|
|
834
834
|
}
|
|
835
835
|
async saveCommands(t) {
|
|
836
836
|
try {
|
|
837
|
-
const r = t.map((
|
|
838
|
-
commandSegments: Array.isArray(
|
|
839
|
-
timestamp:
|
|
837
|
+
const r = t.map((a) => ({
|
|
838
|
+
commandSegments: Array.isArray(a.commandSegments) ? [...a.commandSegments] : [],
|
|
839
|
+
timestamp: a.timestamp
|
|
840
840
|
}));
|
|
841
841
|
window.localStorage.setItem(this.storageKey, JSON.stringify(r));
|
|
842
842
|
} catch (r) {
|
|
@@ -844,10 +844,10 @@ class ht extends hn {
|
|
|
844
844
|
}
|
|
845
845
|
}
|
|
846
846
|
}
|
|
847
|
-
class
|
|
847
|
+
class gt extends gn {
|
|
848
848
|
constructor(t) {
|
|
849
849
|
super(t);
|
|
850
|
-
|
|
850
|
+
A(this, "storedCommands", []);
|
|
851
851
|
}
|
|
852
852
|
async getStoredCommands() {
|
|
853
853
|
return this.storedCommands.map((t) => ({
|
|
@@ -865,19 +865,19 @@ class bt extends hn {
|
|
|
865
865
|
}));
|
|
866
866
|
}
|
|
867
867
|
}
|
|
868
|
-
const
|
|
868
|
+
const q = class q {
|
|
869
869
|
constructor() {
|
|
870
|
-
|
|
870
|
+
A(this, "currentStorage");
|
|
871
871
|
}
|
|
872
872
|
static getInstance() {
|
|
873
|
-
return
|
|
873
|
+
return q.instance || (q.instance = new q()), q.instance;
|
|
874
874
|
}
|
|
875
875
|
initializeStorage(n) {
|
|
876
876
|
if (!this.currentStorage)
|
|
877
877
|
try {
|
|
878
878
|
this.currentStorage = new ht(n);
|
|
879
879
|
} catch (t) {
|
|
880
|
-
console.warn("Failed to create storage, falling back to memory storage:", t), this.currentStorage = new
|
|
880
|
+
console.warn("Failed to create storage, falling back to memory storage:", t), this.currentStorage = new gt(n);
|
|
881
881
|
}
|
|
882
882
|
}
|
|
883
883
|
getStorage() {
|
|
@@ -886,9 +886,9 @@ const J = class J {
|
|
|
886
886
|
return this.currentStorage;
|
|
887
887
|
}
|
|
888
888
|
};
|
|
889
|
-
|
|
890
|
-
let ye =
|
|
891
|
-
const bn = async (
|
|
889
|
+
A(q, "instance");
|
|
890
|
+
let ye = q;
|
|
891
|
+
const bn = async () => new hn("");
|
|
892
892
|
class Ne {
|
|
893
893
|
constructor(n, t, r) {
|
|
894
894
|
this.type = n, this.name = t, this.description = r;
|
|
@@ -902,22 +902,22 @@ class wn extends Ne {
|
|
|
902
902
|
super("null", ">null<", "Empty segment");
|
|
903
903
|
}
|
|
904
904
|
}
|
|
905
|
-
class
|
|
905
|
+
class bt extends Ne {
|
|
906
906
|
constructor(n, t) {
|
|
907
907
|
super("word", n, t);
|
|
908
908
|
}
|
|
909
909
|
}
|
|
910
|
-
class
|
|
911
|
-
constructor(n, t, r,
|
|
912
|
-
super("argument", n, t), this.value = r, this.valid =
|
|
910
|
+
class wt extends Ne {
|
|
911
|
+
constructor(n, t, r, a) {
|
|
912
|
+
super("argument", n, t), this.value = r, this.valid = a;
|
|
913
913
|
}
|
|
914
914
|
}
|
|
915
|
-
class
|
|
915
|
+
class yt {
|
|
916
916
|
constructor(n, t, r = bn) {
|
|
917
|
-
|
|
918
|
-
|
|
917
|
+
A(this, "_segments");
|
|
918
|
+
A(this, "_description");
|
|
919
919
|
// Used by `Help` command, etc.
|
|
920
|
-
|
|
920
|
+
A(this, "_handler");
|
|
921
921
|
this._segments = n, this._description = t, this._handler = r;
|
|
922
922
|
}
|
|
923
923
|
get segments() {
|
|
@@ -944,7 +944,7 @@ class vt {
|
|
|
944
944
|
}
|
|
945
945
|
class Ie {
|
|
946
946
|
constructor() {
|
|
947
|
-
|
|
947
|
+
A(this, "_commands", []);
|
|
948
948
|
}
|
|
949
949
|
get commands() {
|
|
950
950
|
return this._commands;
|
|
@@ -959,17 +959,17 @@ class Ie {
|
|
|
959
959
|
addCommand(n, t, r = bn) {
|
|
960
960
|
if (n === void 0 || n.length === 0)
|
|
961
961
|
throw new Error("Command path cannot be empty");
|
|
962
|
-
const
|
|
963
|
-
const
|
|
964
|
-
(
|
|
965
|
-
).join(" "),
|
|
966
|
-
(
|
|
962
|
+
const a = new yt(n, t, r), i = this._commands.find((u) => {
|
|
963
|
+
const f = u.segments.map(
|
|
964
|
+
(m) => m.type === "argument" ? "*" : m.name
|
|
965
|
+
).join(" "), c = n.map(
|
|
966
|
+
(m) => m.type === "argument" ? "*" : m.name
|
|
967
967
|
).join(" ");
|
|
968
|
-
return
|
|
968
|
+
return f === c;
|
|
969
969
|
});
|
|
970
|
-
if (
|
|
971
|
-
throw new Error(`Duplicate commands: '${
|
|
972
|
-
this._commands.push(
|
|
970
|
+
if (i)
|
|
971
|
+
throw new Error(`Duplicate commands: '${i.fullPath_s}' and '${a.fullPath_s}'`);
|
|
972
|
+
this._commands.push(a);
|
|
973
973
|
}
|
|
974
974
|
/**
|
|
975
975
|
* Retrieves a command from the registry for the given path.
|
|
@@ -979,21 +979,21 @@ class Ie {
|
|
|
979
979
|
*/
|
|
980
980
|
getCommand(n) {
|
|
981
981
|
return this._commands.find((t) => {
|
|
982
|
-
const r = t.fullPath.join(" "),
|
|
983
|
-
return r ===
|
|
982
|
+
const r = t.fullPath.join(" "), a = n.join(" ");
|
|
983
|
+
return r === a;
|
|
984
984
|
});
|
|
985
985
|
}
|
|
986
986
|
commandExistsForPath(n) {
|
|
987
987
|
const t = this._commands.map(
|
|
988
|
-
(
|
|
989
|
-
(
|
|
988
|
+
(a) => a.segments.map(
|
|
989
|
+
(i) => i.type === "argument" ? "*" : i.name
|
|
990
990
|
).join(" ")
|
|
991
|
-
), r = n.map((
|
|
992
|
-
(
|
|
993
|
-
var
|
|
994
|
-
return ((
|
|
991
|
+
), r = n.map((a, i) => this._commands.some(
|
|
992
|
+
(f) => {
|
|
993
|
+
var c;
|
|
994
|
+
return ((c = f.segments[i]) == null ? void 0 : c.type) === "argument";
|
|
995
995
|
}
|
|
996
|
-
) ? "*" :
|
|
996
|
+
) ? "*" : a).join(" ");
|
|
997
997
|
return t.includes(r);
|
|
998
998
|
}
|
|
999
999
|
/**
|
|
@@ -1013,29 +1013,29 @@ class Ie {
|
|
|
1013
1013
|
* @returns An array of completion strings.
|
|
1014
1014
|
*/
|
|
1015
1015
|
getCompletions(n) {
|
|
1016
|
-
if (
|
|
1017
|
-
const
|
|
1018
|
-
return
|
|
1019
|
-
(
|
|
1016
|
+
if (D.debug("[getCompletions] path: ", n), !n.length) {
|
|
1017
|
+
const i = this._commands.map((c) => c.segments[0]), u = (c, m) => c.type === m.type && c.name === m.name;
|
|
1018
|
+
return i.filter(
|
|
1019
|
+
(c, m, h) => m === h.findIndex((b) => u(b, c))
|
|
1020
1020
|
);
|
|
1021
1021
|
}
|
|
1022
1022
|
const t = n.length;
|
|
1023
|
-
return this._commands.filter((
|
|
1024
|
-
const
|
|
1025
|
-
if (
|
|
1023
|
+
return this._commands.filter((i) => {
|
|
1024
|
+
const u = i.segments;
|
|
1025
|
+
if (u.length <= t - 1)
|
|
1026
1026
|
return !1;
|
|
1027
|
-
for (let
|
|
1028
|
-
const
|
|
1029
|
-
if (!(
|
|
1027
|
+
for (let f = 0; f < t; f++) {
|
|
1028
|
+
const c = n[f], m = u[f];
|
|
1029
|
+
if (!(c === "*" && m.type === "argument") && c !== m.name)
|
|
1030
1030
|
return !1;
|
|
1031
1031
|
}
|
|
1032
1032
|
return !0;
|
|
1033
|
-
}).filter((
|
|
1034
|
-
const
|
|
1035
|
-
return new
|
|
1033
|
+
}).filter((i) => i.segments.length > t).map((i) => {
|
|
1034
|
+
const u = i.segments[t], f = u.type === "argument" ? wt : bt;
|
|
1035
|
+
return new f(u.name, u.description);
|
|
1036
1036
|
}).filter(
|
|
1037
|
-
(
|
|
1038
|
-
(
|
|
1037
|
+
(i, u, f) => u === f.findIndex(
|
|
1038
|
+
(c) => c.type === i.type && c.name === i.name
|
|
1039
1039
|
)
|
|
1040
1040
|
);
|
|
1041
1041
|
}
|
|
@@ -1045,9 +1045,9 @@ class Ie {
|
|
|
1045
1045
|
}
|
|
1046
1046
|
class yn {
|
|
1047
1047
|
constructor() {
|
|
1048
|
-
|
|
1049
|
-
|
|
1050
|
-
|
|
1048
|
+
A(this, "segments", []);
|
|
1049
|
+
A(this, "nullSegment", new wn());
|
|
1050
|
+
A(this, "observers", []);
|
|
1051
1051
|
}
|
|
1052
1052
|
subscribe(n) {
|
|
1053
1053
|
this.observers.push(n);
|
|
@@ -1130,12 +1130,12 @@ class yn {
|
|
|
1130
1130
|
return [...this.segments];
|
|
1131
1131
|
}
|
|
1132
1132
|
}
|
|
1133
|
-
const
|
|
1133
|
+
const vt = {
|
|
1134
1134
|
config: M,
|
|
1135
1135
|
commands: new Ie(),
|
|
1136
1136
|
segmentStack: new yn()
|
|
1137
|
-
}, le =
|
|
1138
|
-
const [r,
|
|
1137
|
+
}, le = Zn(vt), xt = ({ config: o = M, commandRegistry: n, children: t }) => {
|
|
1138
|
+
const [r, a] = Q.useState(), i = {
|
|
1139
1139
|
...M,
|
|
1140
1140
|
...o,
|
|
1141
1141
|
// Ensure nested objects are properly merged
|
|
@@ -1149,27 +1149,27 @@ const xt = {
|
|
|
1149
1149
|
cursorSpeed: o.cursorSpeed ?? M.cursorSpeed,
|
|
1150
1150
|
showCitadelKey: o.showCitadelKey || "."
|
|
1151
1151
|
};
|
|
1152
|
-
|
|
1152
|
+
z(() => {
|
|
1153
1153
|
ye.getInstance().initializeStorage(
|
|
1154
|
-
|
|
1155
|
-
),
|
|
1156
|
-
}, []),
|
|
1157
|
-
if (n &&
|
|
1158
|
-
const
|
|
1154
|
+
i.storage ?? M.storage
|
|
1155
|
+
), a(ye.getInstance().getStorage());
|
|
1156
|
+
}, []), z(() => {
|
|
1157
|
+
if (n && i.includeHelpCommand && !n.commandExistsForPath(["help"])) {
|
|
1158
|
+
const f = ft(n);
|
|
1159
1159
|
n.addCommand(
|
|
1160
1160
|
[{ type: "word", name: "help" }],
|
|
1161
1161
|
"Show available commands",
|
|
1162
|
-
|
|
1162
|
+
f
|
|
1163
1163
|
);
|
|
1164
1164
|
}
|
|
1165
|
-
}, [n,
|
|
1166
|
-
const
|
|
1167
|
-
config:
|
|
1165
|
+
}, [n, i.includeHelpCommand]);
|
|
1166
|
+
const u = {
|
|
1167
|
+
config: i,
|
|
1168
1168
|
commands: n || new Ie(),
|
|
1169
1169
|
storage: r,
|
|
1170
1170
|
segmentStack: new yn()
|
|
1171
1171
|
};
|
|
1172
|
-
return /* @__PURE__ */
|
|
1172
|
+
return /* @__PURE__ */ p.jsx(le.Provider, { value: u, children: t });
|
|
1173
1173
|
}, ce = () => {
|
|
1174
1174
|
const o = ve(le);
|
|
1175
1175
|
if (o === void 0)
|
|
@@ -1191,28 +1191,15 @@ const xt = {
|
|
|
1191
1191
|
throw new Error("useSegmentStack must be used within a CitadelConfigProvider");
|
|
1192
1192
|
return o.segmentStack;
|
|
1193
1193
|
};
|
|
1194
|
-
class
|
|
1194
|
+
class Ct {
|
|
1195
1195
|
constructor(n, t) {
|
|
1196
|
-
|
|
1197
|
-
|
|
1198
|
-
|
|
1199
|
-
this.command = n.toArray().map((r) => r.type === "argument" ? r.value || "" : r.name), this.timestamp = Date.now(), this.result = t ?? new
|
|
1196
|
+
A(this, "timestamp");
|
|
1197
|
+
A(this, "command");
|
|
1198
|
+
A(this, "result");
|
|
1199
|
+
this.command = n.toArray().map((r) => r.type === "argument" ? r.value || "" : r.name), this.timestamp = Date.now(), this.result = t ?? new pt();
|
|
1200
1200
|
}
|
|
1201
1201
|
}
|
|
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) {
|
|
1202
|
+
function St(o) {
|
|
1216
1203
|
return {
|
|
1217
1204
|
commandSegments: o,
|
|
1218
1205
|
timestamp: Date.now()
|
|
@@ -1222,159 +1209,159 @@ function xn() {
|
|
|
1222
1209
|
const o = vn(), [n, t] = Y({
|
|
1223
1210
|
storedCommands: [],
|
|
1224
1211
|
position: null
|
|
1225
|
-
}), r =
|
|
1212
|
+
}), r = R(async (f) => {
|
|
1226
1213
|
if (o)
|
|
1227
1214
|
try {
|
|
1228
|
-
const
|
|
1229
|
-
await o.addStoredCommand(
|
|
1230
|
-
...
|
|
1231
|
-
storedCommands: [...
|
|
1215
|
+
const c = St(f);
|
|
1216
|
+
await o.addStoredCommand(c), t((m) => ({
|
|
1217
|
+
...m,
|
|
1218
|
+
storedCommands: [...m.storedCommands, c],
|
|
1232
1219
|
position: null
|
|
1233
1220
|
}));
|
|
1234
|
-
} catch (
|
|
1235
|
-
console.warn("Failed to save command to history:",
|
|
1221
|
+
} catch (c) {
|
|
1222
|
+
console.warn("Failed to save command to history:", c);
|
|
1236
1223
|
}
|
|
1237
|
-
}, [o]),
|
|
1238
|
-
|
|
1224
|
+
}, [o]), a = R(async () => o ? await o.getStoredCommands() : [], [o]);
|
|
1225
|
+
z(() => {
|
|
1239
1226
|
if (!o) return;
|
|
1240
1227
|
(async () => {
|
|
1241
1228
|
try {
|
|
1242
|
-
const
|
|
1243
|
-
return t((
|
|
1244
|
-
...
|
|
1245
|
-
storedCommands:
|
|
1246
|
-
})),
|
|
1247
|
-
} catch (
|
|
1248
|
-
console.warn("Failed to load command history:",
|
|
1229
|
+
const c = await o.getStoredCommands();
|
|
1230
|
+
return t((m) => ({
|
|
1231
|
+
...m,
|
|
1232
|
+
storedCommands: c
|
|
1233
|
+
})), c;
|
|
1234
|
+
} catch (c) {
|
|
1235
|
+
console.warn("Failed to load command history:", c);
|
|
1249
1236
|
}
|
|
1250
1237
|
})();
|
|
1251
1238
|
}, [o]);
|
|
1252
|
-
const
|
|
1253
|
-
if ((await
|
|
1239
|
+
const i = R(async (f) => {
|
|
1240
|
+
if ((await a()).length === 0)
|
|
1254
1241
|
return { segments: null, position: null };
|
|
1255
|
-
let
|
|
1256
|
-
return
|
|
1257
|
-
...
|
|
1258
|
-
position:
|
|
1259
|
-
})),
|
|
1242
|
+
let m = null;
|
|
1243
|
+
return f === "up" ? n.position === null ? m = n.storedCommands.length - 1 : n.position > 0 ? m = n.position - 1 : m = 0 : n.position === null || n.position >= n.storedCommands.length - 1 ? m = null : m = n.position + 1, t((b) => ({
|
|
1244
|
+
...b,
|
|
1245
|
+
position: m
|
|
1246
|
+
})), m === null ? {
|
|
1260
1247
|
segments: [],
|
|
1261
1248
|
position: null
|
|
1262
1249
|
} : {
|
|
1263
|
-
segments:
|
|
1264
|
-
position:
|
|
1250
|
+
segments: m !== null ? n.storedCommands[m].commandSegments : null,
|
|
1251
|
+
position: m
|
|
1265
1252
|
};
|
|
1266
|
-
}, [n,
|
|
1253
|
+
}, [n, a]), u = R(async () => {
|
|
1267
1254
|
try {
|
|
1268
1255
|
if (!o) return;
|
|
1269
1256
|
await o.clear(), t({
|
|
1270
1257
|
storedCommands: [],
|
|
1271
1258
|
position: null
|
|
1272
1259
|
});
|
|
1273
|
-
} catch (
|
|
1274
|
-
console.warn("Failed to clear command history:",
|
|
1260
|
+
} catch (f) {
|
|
1261
|
+
console.warn("Failed to clear command history:", f);
|
|
1275
1262
|
}
|
|
1276
1263
|
}, [o]);
|
|
1277
1264
|
return {
|
|
1278
1265
|
history: n,
|
|
1279
1266
|
addStoredCommand: r,
|
|
1280
|
-
getStoredCommands:
|
|
1281
|
-
navigateHistory:
|
|
1282
|
-
clear:
|
|
1267
|
+
getStoredCommands: a,
|
|
1268
|
+
navigateHistory: i,
|
|
1269
|
+
clear: u
|
|
1283
1270
|
};
|
|
1284
1271
|
}
|
|
1285
1272
|
const Cn = () => {
|
|
1286
|
-
const o = ce(), n = xe(), t = xn(), r = ue(),
|
|
1273
|
+
const o = ce(), n = xe(), t = xn(), r = ue(), a = vn(), [i, u] = Y({
|
|
1287
1274
|
currentInput: "",
|
|
1288
1275
|
isEnteringArg: !1,
|
|
1289
1276
|
output: [],
|
|
1290
1277
|
history: {
|
|
1291
1278
|
commands: [],
|
|
1292
1279
|
position: null,
|
|
1293
|
-
storage:
|
|
1280
|
+
storage: a
|
|
1294
1281
|
}
|
|
1295
1282
|
});
|
|
1296
|
-
|
|
1297
|
-
}, [
|
|
1298
|
-
|
|
1299
|
-
...
|
|
1283
|
+
z(() => {
|
|
1284
|
+
}, [a]), z(() => {
|
|
1285
|
+
u((h) => ({
|
|
1286
|
+
...h,
|
|
1300
1287
|
history: {
|
|
1301
1288
|
commands: t.history.storedCommands,
|
|
1302
1289
|
position: t.history.position,
|
|
1303
|
-
storage:
|
|
1290
|
+
storage: a
|
|
1304
1291
|
}
|
|
1305
1292
|
}));
|
|
1306
|
-
}, [t.history,
|
|
1307
|
-
const
|
|
1308
|
-
setCurrentInput:
|
|
1309
|
-
|
|
1293
|
+
}, [t.history, a]);
|
|
1294
|
+
const f = {
|
|
1295
|
+
setCurrentInput: R((h) => {
|
|
1296
|
+
D.debug("[CitadelActions] setCurrentInput: ", h), u((b) => ({ ...b, currentInput: h }));
|
|
1310
1297
|
}, []),
|
|
1311
|
-
setIsEnteringArg:
|
|
1312
|
-
|
|
1298
|
+
setIsEnteringArg: R((h) => {
|
|
1299
|
+
D.debug("[CitadelActions] setIsEnteringArg: ", h), u((b) => ({ ...b, isEnteringArg: h }));
|
|
1313
1300
|
}, []),
|
|
1314
|
-
addOutput:
|
|
1315
|
-
|
|
1316
|
-
...
|
|
1317
|
-
output: [...
|
|
1301
|
+
addOutput: R((h) => {
|
|
1302
|
+
D.debug("[CitadelActions]addOutput: ", h), u((b) => ({
|
|
1303
|
+
...b,
|
|
1304
|
+
output: [...b.output, h]
|
|
1318
1305
|
}));
|
|
1319
1306
|
}, []),
|
|
1320
|
-
executeCommand:
|
|
1321
|
-
const
|
|
1322
|
-
if (!
|
|
1323
|
-
console.error("[CitadelActions][executeCommand] Cannot execute command because no command was found for the given path: ",
|
|
1307
|
+
executeCommand: R(async () => {
|
|
1308
|
+
const h = r.path(), b = n.getCommand(h);
|
|
1309
|
+
if (!b) {
|
|
1310
|
+
console.error("[CitadelActions][executeCommand] Cannot execute command because no command was found for the given path: ", h);
|
|
1324
1311
|
return;
|
|
1325
1312
|
}
|
|
1326
|
-
const
|
|
1327
|
-
|
|
1328
|
-
...
|
|
1329
|
-
output: [...
|
|
1313
|
+
const _ = new Ct(r);
|
|
1314
|
+
u((S) => ({
|
|
1315
|
+
...S,
|
|
1316
|
+
output: [...S.output, _]
|
|
1330
1317
|
}));
|
|
1331
1318
|
try {
|
|
1332
|
-
const
|
|
1319
|
+
const S = new Promise((d, y) => {
|
|
1333
1320
|
setTimeout(() => {
|
|
1334
|
-
|
|
1321
|
+
y(new Error("Request timed out"));
|
|
1335
1322
|
}, o.commandTimeoutMs);
|
|
1336
|
-
}),
|
|
1337
|
-
|
|
1338
|
-
|
|
1323
|
+
}), U = r.arguments.map((d) => d.value || ""), I = await Promise.race([
|
|
1324
|
+
b.handler(U),
|
|
1325
|
+
S
|
|
1339
1326
|
]);
|
|
1340
|
-
if (!(
|
|
1327
|
+
if (!(I instanceof Z))
|
|
1341
1328
|
throw new Error(
|
|
1342
|
-
`The ${
|
|
1329
|
+
`The ${h.join(".")} command returned an invalid result type. Commands must return an instance of a CommandResult.
|
|
1343
1330
|
For example:
|
|
1344
1331
|
return new JsonCommandResult({ text: "Hello World" });
|
|
1345
|
-
Check the definition of the ${
|
|
1332
|
+
Check the definition of the ${h.join(".")} command and update the return type for its handler.`
|
|
1346
1333
|
);
|
|
1347
|
-
|
|
1348
|
-
...
|
|
1349
|
-
output:
|
|
1350
|
-
(
|
|
1334
|
+
I.markSuccess(), u((d) => ({
|
|
1335
|
+
...d,
|
|
1336
|
+
output: d.output.map(
|
|
1337
|
+
(y) => y.timestamp === _.timestamp ? { ...y, result: I } : y
|
|
1351
1338
|
)
|
|
1352
1339
|
}));
|
|
1353
|
-
} catch (
|
|
1354
|
-
const
|
|
1355
|
-
|
|
1340
|
+
} catch (S) {
|
|
1341
|
+
const U = new mt(
|
|
1342
|
+
S instanceof Error ? S.message : "Unknown error"
|
|
1356
1343
|
);
|
|
1357
|
-
|
|
1358
|
-
...
|
|
1359
|
-
output:
|
|
1360
|
-
(
|
|
1344
|
+
U.markFailure(), u((I) => ({
|
|
1345
|
+
...I,
|
|
1346
|
+
output: I.output.map(
|
|
1347
|
+
(d) => d.timestamp === _.timestamp ? { ...d, result: U } : d
|
|
1361
1348
|
)
|
|
1362
1349
|
}));
|
|
1363
1350
|
}
|
|
1364
|
-
}, [n, o.commandTimeoutMs,
|
|
1365
|
-
clearHistory:
|
|
1351
|
+
}, [n, o.commandTimeoutMs, r]),
|
|
1352
|
+
clearHistory: R(async () => {
|
|
1366
1353
|
try {
|
|
1367
1354
|
await t.clear();
|
|
1368
|
-
} catch (
|
|
1369
|
-
console.warn("Failed to clear history:",
|
|
1355
|
+
} catch (h) {
|
|
1356
|
+
console.warn("Failed to clear history:", h);
|
|
1370
1357
|
}
|
|
1371
1358
|
}, [t])
|
|
1372
|
-
},
|
|
1359
|
+
}, c = R(() => n.getCompletions_s(r.path()), [r, n]), m = R(() => n.getCompletions(r.path()), [r, n]);
|
|
1373
1360
|
return {
|
|
1374
|
-
state:
|
|
1375
|
-
actions:
|
|
1376
|
-
getAvailableCommands_s:
|
|
1377
|
-
getAvailableCommandSegments:
|
|
1361
|
+
state: i,
|
|
1362
|
+
actions: f,
|
|
1363
|
+
getAvailableCommands_s: c,
|
|
1364
|
+
getAvailableCommandSegments: m
|
|
1378
1365
|
};
|
|
1379
1366
|
}, Et = {
|
|
1380
1367
|
blink: {
|
|
@@ -1405,393 +1392,414 @@ Check the definition of the ${g.join(".")} command and update the return type fo
|
|
|
1405
1392
|
const r = be(() => ({
|
|
1406
1393
|
...Et[o.type],
|
|
1407
1394
|
...o
|
|
1408
|
-
}), [o]), [
|
|
1409
|
-
|
|
1395
|
+
}), [o]), [a, i] = Y(!0), [u, f] = Y(0);
|
|
1396
|
+
z(() => {
|
|
1410
1397
|
if (r.speed === 0) return;
|
|
1411
|
-
const
|
|
1412
|
-
r.type === "blink" ?
|
|
1398
|
+
const h = setInterval(() => {
|
|
1399
|
+
r.type === "blink" ? i((b) => !b) : ["spin", "bbs"].includes(r.type) && f((b) => (b + 1) % (r.type === "bbs" ? un.length : cn.length));
|
|
1413
1400
|
}, r.speed);
|
|
1414
|
-
return () => clearInterval(
|
|
1401
|
+
return () => clearInterval(h);
|
|
1415
1402
|
}, [r.type, r.speed]);
|
|
1416
|
-
const
|
|
1403
|
+
const c = be(() => ({
|
|
1417
1404
|
color: n ? r.color : "#ff4444",
|
|
1418
1405
|
transition: "color 0.15s ease-in-out"
|
|
1419
|
-
}), [n, r.color]),
|
|
1420
|
-
return /* @__PURE__ */
|
|
1406
|
+
}), [n, r.color]), m = () => !n && t ? "✗" : ["spin", "bbs"].includes(r.type) ? (r.type === "bbs" ? un : cn)[u] : r.type === "solid" || a ? r.character : " ";
|
|
1407
|
+
return /* @__PURE__ */ p.jsx("div", { className: "relative inline-block", children: /* @__PURE__ */ p.jsx(
|
|
1421
1408
|
"span",
|
|
1422
1409
|
{
|
|
1423
1410
|
className: `command-cursor ${n ? "" : "animate-shake"}`,
|
|
1424
|
-
style:
|
|
1411
|
+
style: c,
|
|
1425
1412
|
title: t,
|
|
1426
|
-
children:
|
|
1413
|
+
children: m()
|
|
1427
1414
|
}
|
|
1428
1415
|
) });
|
|
1429
1416
|
};
|
|
1430
|
-
function
|
|
1417
|
+
function _t(o, n) {
|
|
1431
1418
|
switch (n.type) {
|
|
1432
1419
|
case "set":
|
|
1433
|
-
return
|
|
1420
|
+
return D.debug(`[inputStateReducer] InputState changing from ${o} to ${n.state}`), n.state;
|
|
1434
1421
|
default:
|
|
1435
1422
|
return o;
|
|
1436
1423
|
}
|
|
1437
1424
|
}
|
|
1438
|
-
const
|
|
1439
|
-
const { state: o } = Cn(), n = xe(), t = xn(), r = ue(),
|
|
1440
|
-
|
|
1441
|
-
},
|
|
1442
|
-
const
|
|
1443
|
-
return
|
|
1444
|
-
},
|
|
1445
|
-
if (!
|
|
1446
|
-
const
|
|
1447
|
-
const
|
|
1448
|
-
return (
|
|
1425
|
+
const Rt = () => {
|
|
1426
|
+
const { state: o } = Cn(), n = xe(), t = xn(), r = ue(), [a, i] = et(_t, "idle"), u = (d) => {
|
|
1427
|
+
i({ type: "set", state: d });
|
|
1428
|
+
}, f = R(() => {
|
|
1429
|
+
const y = n.getCompletions(r.path())[0] || r.nullSegment;
|
|
1430
|
+
return D.debug("[getNextExpectedSegment] ", y), y;
|
|
1431
|
+
}, [n, r]), c = R(() => n.getCompletions_s(r.path()).map((y) => n.getCommand([...r.path(), y])).filter((y) => y !== void 0), [n, r]), m = R((d, y) => {
|
|
1432
|
+
if (!d) return y;
|
|
1433
|
+
const w = y.reduce((k, j) => {
|
|
1434
|
+
const P = f();
|
|
1435
|
+
return (P == null ? void 0 : P.type) === "word" && k.set(P.name, j), k;
|
|
1449
1436
|
}, /* @__PURE__ */ new Map());
|
|
1450
|
-
return Array.from(
|
|
1451
|
-
const
|
|
1452
|
-
return
|
|
1437
|
+
return Array.from(w.values()).filter(() => {
|
|
1438
|
+
const k = f();
|
|
1439
|
+
return k.type !== "word" ? !1 : k.name.toLowerCase().startsWith(d.toLowerCase());
|
|
1453
1440
|
});
|
|
1454
|
-
}, []),
|
|
1455
|
-
const
|
|
1456
|
-
(
|
|
1441
|
+
}, [f]), h = R((d) => {
|
|
1442
|
+
const w = n.getCompletions(r.path()).filter((N) => N.type === "word").filter(
|
|
1443
|
+
(N) => N.name.toLowerCase().startsWith(d.toLowerCase())
|
|
1457
1444
|
);
|
|
1458
|
-
return
|
|
1459
|
-
}, [
|
|
1460
|
-
const
|
|
1461
|
-
return
|
|
1462
|
-
(
|
|
1445
|
+
return w.length === 1 ? w[0] : r.nullSegment;
|
|
1446
|
+
}, [n, r]), b = R((d) => {
|
|
1447
|
+
const y = r.path(), w = n.getCompletions(y);
|
|
1448
|
+
return w.length === 0 && d ? !1 : w.some((k) => k.type === "argument") ? !0 : w.some(
|
|
1449
|
+
(k) => k.type === "word" && k.name.toLowerCase().startsWith(d.toLowerCase())
|
|
1463
1450
|
);
|
|
1464
|
-
}, [n]),
|
|
1465
|
-
|
|
1466
|
-
const
|
|
1467
|
-
return !
|
|
1468
|
-
}, [
|
|
1451
|
+
}, [n, r]), _ = R((d) => {
|
|
1452
|
+
D.debug("[tryAutoComplete] input: ", d);
|
|
1453
|
+
const y = h(d);
|
|
1454
|
+
return !y || y.name === d ? new wn() : (D.debug("[tryAutoComplete] result: ", y), y);
|
|
1455
|
+
}, [h]), S = R((d, y) => {
|
|
1469
1456
|
if (o.history.position === null) {
|
|
1470
|
-
if (
|
|
1471
|
-
const
|
|
1472
|
-
if (
|
|
1473
|
-
if (
|
|
1474
|
-
const
|
|
1475
|
-
if (
|
|
1476
|
-
const
|
|
1477
|
-
|
|
1457
|
+
if (y.setCurrentInput(d), D.debug("[useCommandParser][handleInputChange] newValue: ", d), a === "entering_argument") {
|
|
1458
|
+
const w = dn(d);
|
|
1459
|
+
if (w.isQuoted)
|
|
1460
|
+
if (w.isComplete) {
|
|
1461
|
+
const N = f();
|
|
1462
|
+
if (N.type === "argument") {
|
|
1463
|
+
const k = N;
|
|
1464
|
+
k.value = d.trim() || "", D.debug("[useCommandParser][handleInputChange][entering_command] pushing: ", k), r.push(k), y.setCurrentInput(""), u("idle");
|
|
1478
1465
|
return;
|
|
1479
1466
|
}
|
|
1480
1467
|
} else
|
|
1481
1468
|
return;
|
|
1482
|
-
else if (
|
|
1483
|
-
const
|
|
1484
|
-
|
|
1469
|
+
else if (w.isComplete) {
|
|
1470
|
+
const N = f();
|
|
1471
|
+
N.value = d.trim() || "", D.debug("[useCommandParser][handleInputChange][entering_command] pushing: ", N), r.push(N), y.setCurrentInput(""), u("idle");
|
|
1485
1472
|
return;
|
|
1486
1473
|
} else
|
|
1487
1474
|
return;
|
|
1488
1475
|
}
|
|
1489
|
-
if (
|
|
1490
|
-
const
|
|
1491
|
-
if (
|
|
1492
|
-
|
|
1476
|
+
if (a == "entering_command") {
|
|
1477
|
+
const w = _(d);
|
|
1478
|
+
if (w.type === "word") {
|
|
1479
|
+
D.debug("[useCommandParser][handleInputChange][entering_command] pushing: ", w), r.push(w), y.setCurrentInput(""), u("idle");
|
|
1493
1480
|
return;
|
|
1494
1481
|
}
|
|
1495
1482
|
}
|
|
1496
1483
|
}
|
|
1497
|
-
}, [
|
|
1498
|
-
|
|
1499
|
-
|
|
1500
|
-
|
|
1501
|
-
|
|
1502
|
-
|
|
1503
|
-
|
|
1504
|
-
|
|
1505
|
-
|
|
1484
|
+
}, [_, o, f, a, r]), U = R((d) => {
|
|
1485
|
+
d.setCurrentInput(""), d.setIsEnteringArg(!1), r.clear(), u("idle");
|
|
1486
|
+
}, [r]), I = R((d, y, w) => {
|
|
1487
|
+
if (!(d.key === "Backspace" || d.key === "Enter" || d.key === "ArrowUp" || d.key === "ArrowDown" || d.key === "ArrowLeft" || d.key === "ArrowRight" || d.key === "Escape" || d.key === "Delete" || d.key === "Home" || d.key === "End" || d.key.length === 1))
|
|
1488
|
+
return !0;
|
|
1489
|
+
const { currentInput: k, isEnteringArg: j } = y, P = dn(k);
|
|
1490
|
+
switch (d.key) {
|
|
1491
|
+
case "Backspace":
|
|
1492
|
+
return k === "" && (d.preventDefault(), r.size() > 0 && r.pop(), u("idle")), !0;
|
|
1506
1493
|
case "Enter": {
|
|
1507
|
-
if (
|
|
1508
|
-
return;
|
|
1509
|
-
if (
|
|
1510
|
-
const
|
|
1511
|
-
|
|
1494
|
+
if (d.preventDefault(), P.isQuoted && !P.isComplete)
|
|
1495
|
+
return !0;
|
|
1496
|
+
if (a === "entering_argument") {
|
|
1497
|
+
const L = f();
|
|
1498
|
+
L.value = k, D.debug("[handleKeyDown][Enter]['entering_argument'] pushing: ", L), r.push(L);
|
|
1512
1499
|
}
|
|
1513
|
-
|
|
1514
|
-
return;
|
|
1515
|
-
}
|
|
1516
|
-
case "ArrowUp": {
|
|
1517
|
-
c.preventDefault();
|
|
1518
|
-
const H = await t.navigateHistory("up", r.toArray());
|
|
1519
|
-
H.segments && (r.clear(), r.pushAll(H.segments), E.setCurrentInput(""));
|
|
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;
|
|
1500
|
+
return D.debug("[handleKeyDown][Enter] calling actions.executeCommand. segmentStack: ", r), w.executeCommand(), t.addStoredCommand(r.toArray()), U(w), !0;
|
|
1527
1501
|
}
|
|
1528
|
-
|
|
1529
|
-
|
|
1530
|
-
const
|
|
1531
|
-
|
|
1532
|
-
|
|
1533
|
-
|
|
1534
|
-
|
|
1502
|
+
case "ArrowUp":
|
|
1503
|
+
return d.preventDefault(), (async () => {
|
|
1504
|
+
const $ = await t.navigateHistory("up", r.toArray());
|
|
1505
|
+
return $.segments && (r.clear(), r.pushAll($.segments), w.setCurrentInput("")), !0;
|
|
1506
|
+
})();
|
|
1507
|
+
case "ArrowDown":
|
|
1508
|
+
return d.preventDefault(), (async () => {
|
|
1509
|
+
const $ = await t.navigateHistory("down", r.toArray());
|
|
1510
|
+
return $.segments && (r.clear(), r.pushAll($.segments), w.setCurrentInput("")), !0;
|
|
1511
|
+
})();
|
|
1512
|
+
default: {
|
|
1513
|
+
if (!j && d.key.length === 1) {
|
|
1514
|
+
const $ = k + d.key;
|
|
1515
|
+
if (!b($))
|
|
1516
|
+
return d.preventDefault(), !1;
|
|
1535
1517
|
}
|
|
1518
|
+
return !0;
|
|
1519
|
+
}
|
|
1536
1520
|
}
|
|
1537
1521
|
}, [
|
|
1538
|
-
|
|
1539
|
-
|
|
1522
|
+
a,
|
|
1523
|
+
b,
|
|
1540
1524
|
f,
|
|
1541
|
-
|
|
1542
|
-
|
|
1543
|
-
|
|
1544
|
-
|
|
1545
|
-
]), U = A((c) => {
|
|
1546
|
-
c.setCurrentInput(""), c.setIsEnteringArg(!1), r.clear(), d("idle");
|
|
1547
|
-
}, []);
|
|
1525
|
+
t,
|
|
1526
|
+
U,
|
|
1527
|
+
r
|
|
1528
|
+
]);
|
|
1548
1529
|
return {
|
|
1549
|
-
handleInputChange:
|
|
1550
|
-
handleKeyDown:
|
|
1551
|
-
inputState:
|
|
1552
|
-
setInputStateWithLogging:
|
|
1530
|
+
handleInputChange: S,
|
|
1531
|
+
handleKeyDown: I,
|
|
1532
|
+
inputState: a,
|
|
1533
|
+
setInputStateWithLogging: u,
|
|
1553
1534
|
// Expose internal functions for testing
|
|
1554
|
-
findMatchingCommands:
|
|
1555
|
-
getAutocompleteSuggestion:
|
|
1556
|
-
getAvailableNodes:
|
|
1557
|
-
getNextExpectedSegment:
|
|
1558
|
-
isValidCommandInput:
|
|
1535
|
+
findMatchingCommands: m,
|
|
1536
|
+
getAutocompleteSuggestion: h,
|
|
1537
|
+
getAvailableNodes: c,
|
|
1538
|
+
getNextExpectedSegment: f,
|
|
1539
|
+
isValidCommandInput: b
|
|
1559
1540
|
};
|
|
1560
1541
|
};
|
|
1561
1542
|
function dn(o) {
|
|
1562
1543
|
const n = [];
|
|
1563
|
-
let t = "", r = !1,
|
|
1564
|
-
for (let
|
|
1565
|
-
const
|
|
1566
|
-
(
|
|
1544
|
+
let t = "", r = !1, a;
|
|
1545
|
+
for (let i = 0; i < o.length; i++) {
|
|
1546
|
+
const u = o[i];
|
|
1547
|
+
(u === '"' || u === "'") && (!r || u === a) ? r ? (n.push(t), t = "", r = !1, a = void 0) : (t && (n.push(t), t = ""), r = !0, a = u) : !r && u === " " ? t && (n.push(t), t = "") : t += u;
|
|
1567
1548
|
}
|
|
1568
1549
|
return {
|
|
1569
1550
|
words: n,
|
|
1570
1551
|
currentWord: t,
|
|
1571
1552
|
isQuoted: r,
|
|
1572
|
-
quoteChar:
|
|
1553
|
+
quoteChar: a,
|
|
1573
1554
|
isComplete: !r && !t
|
|
1574
1555
|
};
|
|
1575
1556
|
}
|
|
1576
|
-
const
|
|
1577
|
-
|
|
1578
|
-
|
|
1579
|
-
|
|
1580
|
-
|
|
1557
|
+
const jt = () => {
|
|
1558
|
+
const o = ue(), [n, t] = Y(0);
|
|
1559
|
+
return z(() => {
|
|
1560
|
+
const r = {
|
|
1561
|
+
update: () => {
|
|
1562
|
+
t((a) => a + 1);
|
|
1563
|
+
}
|
|
1564
|
+
};
|
|
1565
|
+
return o.subscribe(r), () => {
|
|
1566
|
+
o.unsubscribe(r);
|
|
1567
|
+
};
|
|
1568
|
+
}, [o]), n;
|
|
1569
|
+
}, At = ({
|
|
1581
1570
|
state: o,
|
|
1582
1571
|
actions: n
|
|
1583
1572
|
}) => {
|
|
1584
|
-
const t =
|
|
1585
|
-
handleKeyDown:
|
|
1586
|
-
handleInputChange:
|
|
1587
|
-
inputState:
|
|
1588
|
-
setInputStateWithLogging:
|
|
1589
|
-
getNextExpectedSegment:
|
|
1590
|
-
} =
|
|
1591
|
-
|
|
1592
|
-
|
|
1593
|
-
|
|
1594
|
-
|
|
1595
|
-
|
|
1596
|
-
|
|
1597
|
-
|
|
1573
|
+
const t = X(null), r = xe(), a = ue(), {
|
|
1574
|
+
handleKeyDown: i,
|
|
1575
|
+
handleInputChange: u,
|
|
1576
|
+
inputState: f,
|
|
1577
|
+
setInputStateWithLogging: c,
|
|
1578
|
+
getNextExpectedSegment: m
|
|
1579
|
+
} = Rt(), [h, b] = Y(!1), _ = ce(), S = jt(), U = async (j) => {
|
|
1580
|
+
const P = i(j, o, n);
|
|
1581
|
+
await Promise.resolve(P) === !1 && (b(!0), setTimeout(() => b(!1), 500));
|
|
1582
|
+
}, I = (j) => {
|
|
1583
|
+
u(j.target.value, n);
|
|
1584
|
+
}, d = (j) => {
|
|
1585
|
+
j.preventDefault();
|
|
1586
|
+
const P = j.clipboardData.getData("text");
|
|
1587
|
+
u(P, n);
|
|
1598
1588
|
};
|
|
1599
|
-
|
|
1600
|
-
t.current && t.current.focus(),
|
|
1601
|
-
}, []),
|
|
1602
|
-
if (
|
|
1603
|
-
const
|
|
1604
|
-
let
|
|
1605
|
-
switch (
|
|
1589
|
+
z(() => {
|
|
1590
|
+
t.current && t.current.focus(), f !== "entering_command" && c("entering_command");
|
|
1591
|
+
}, [f, c]), z(() => {
|
|
1592
|
+
if (f !== "idle") return;
|
|
1593
|
+
const j = m();
|
|
1594
|
+
let P = "idle";
|
|
1595
|
+
switch (j.type) {
|
|
1606
1596
|
case "word":
|
|
1607
|
-
|
|
1597
|
+
P = "entering_command", n.setIsEnteringArg(!1);
|
|
1608
1598
|
break;
|
|
1609
1599
|
case "argument":
|
|
1610
|
-
|
|
1600
|
+
P = "entering_argument", n.setIsEnteringArg(!0);
|
|
1611
1601
|
break;
|
|
1612
1602
|
}
|
|
1613
|
-
|
|
1614
|
-
}, [
|
|
1615
|
-
const [
|
|
1616
|
-
|
|
1617
|
-
const
|
|
1618
|
-
|
|
1619
|
-
const
|
|
1620
|
-
if (
|
|
1621
|
-
|
|
1622
|
-
return /* @__PURE__ */
|
|
1623
|
-
/* @__PURE__ */
|
|
1624
|
-
|
|
1603
|
+
c(P);
|
|
1604
|
+
}, [S, f, m, c, n]);
|
|
1605
|
+
const [y, w] = Y([]);
|
|
1606
|
+
z(() => {
|
|
1607
|
+
const j = [], P = a.toArray().map((L, ee) => {
|
|
1608
|
+
j.push(L.name);
|
|
1609
|
+
const de = r.hasNextSegment(j);
|
|
1610
|
+
if (L.type === "argument") {
|
|
1611
|
+
const ne = L;
|
|
1612
|
+
return /* @__PURE__ */ p.jsxs(Q.Fragment, { children: [
|
|
1613
|
+
/* @__PURE__ */ p.jsx("span", { className: "text-gray-200 whitespace-pre", children: ne.value }),
|
|
1614
|
+
ee < a.size() && de && /* @__PURE__ */ p.jsx("span", { className: "text-gray-200 whitespace-pre", children: " " })
|
|
1625
1615
|
] }, "arg-" + ne.name + ne.value);
|
|
1626
1616
|
}
|
|
1627
|
-
return /* @__PURE__ */
|
|
1628
|
-
/* @__PURE__ */
|
|
1629
|
-
|
|
1630
|
-
] }, "word-" +
|
|
1617
|
+
return /* @__PURE__ */ p.jsxs(Q.Fragment, { children: [
|
|
1618
|
+
/* @__PURE__ */ p.jsx("span", { className: "text-blue-400 whitespace-pre", children: L.name }),
|
|
1619
|
+
ee < a.size() && de && /* @__PURE__ */ p.jsx("span", { className: "text-blue-400 whitespace-pre", children: " " })
|
|
1620
|
+
] }, "word-" + L.name);
|
|
1631
1621
|
});
|
|
1632
|
-
|
|
1633
|
-
}, [
|
|
1634
|
-
const [
|
|
1635
|
-
return
|
|
1636
|
-
const
|
|
1637
|
-
|
|
1638
|
-
}, [
|
|
1639
|
-
/* @__PURE__ */
|
|
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
|
-
|
|
1622
|
+
w([/* @__PURE__ */ p.jsx("div", { className: "flex items-center gap-1", "data-testid": "user-input-area", children: P }, "{segmentStackVersion}")]);
|
|
1623
|
+
}, [S, r, a]);
|
|
1624
|
+
const [N, k] = Y("");
|
|
1625
|
+
return z(() => {
|
|
1626
|
+
const j = m();
|
|
1627
|
+
j.type === "argument" ? k(j.name) : k("");
|
|
1628
|
+
}, [S, m]), /* @__PURE__ */ p.jsxs("div", { className: "flex flex-col w-full bg-gray-900 rounded-lg p-4", children: [
|
|
1629
|
+
/* @__PURE__ */ p.jsx("style", { children: `
|
|
1630
|
+
@keyframes shake {
|
|
1631
|
+
0%, 100% { transform: translateX(0); }
|
|
1632
|
+
25% { transform: translateX(-4px); }
|
|
1633
|
+
75% { transform: translateX(4px); }
|
|
1634
|
+
}
|
|
1635
|
+
@keyframes flashBorder {
|
|
1636
|
+
0%, 100% { border-color: transparent; }
|
|
1637
|
+
50% { border-color: rgb(239, 68, 68); }
|
|
1638
|
+
}
|
|
1639
|
+
.invalid-input-animation {
|
|
1640
|
+
animation: shake 0.2s ease-in-out, flashBorder 0.3s ease-in-out;
|
|
1641
|
+
border-width: 1px;
|
|
1642
|
+
border-style: solid;
|
|
1643
|
+
}
|
|
1644
|
+
` }),
|
|
1645
|
+
/* @__PURE__ */ p.jsxs("div", { className: "flex items-center gap-2", children: [
|
|
1646
|
+
/* @__PURE__ */ p.jsx("div", { className: "text-gray-400 font-mono", children: ">" }),
|
|
1647
|
+
/* @__PURE__ */ p.jsxs("div", { className: "flex-1 font-mono flex items-center", children: [
|
|
1648
|
+
y,
|
|
1649
|
+
/* @__PURE__ */ p.jsxs("div", { className: "relative flex-1", children: [
|
|
1650
|
+
/* @__PURE__ */ p.jsx(
|
|
1651
|
+
"input",
|
|
1652
|
+
{
|
|
1653
|
+
ref: t,
|
|
1654
|
+
type: "text",
|
|
1655
|
+
role: "textbox",
|
|
1656
|
+
value: o.currentInput,
|
|
1657
|
+
onChange: I,
|
|
1658
|
+
onKeyDown: U,
|
|
1659
|
+
onPaste: d,
|
|
1660
|
+
"data-testid": "citadel-command-input",
|
|
1661
|
+
className: `w-full bg-transparent outline-none text-gray-200 caret-transparent ${h ? "invalid-input-animation" : ""}`,
|
|
1662
|
+
spellCheck: !1,
|
|
1663
|
+
autoComplete: "off",
|
|
1664
|
+
placeholder: N
|
|
1665
|
+
}
|
|
1666
|
+
),
|
|
1667
|
+
/* @__PURE__ */ p.jsx(
|
|
1668
|
+
"div",
|
|
1669
|
+
{
|
|
1670
|
+
className: "absolute top-0 pointer-events-none",
|
|
1671
|
+
style: {
|
|
1672
|
+
left: `${o.currentInput.length}ch`,
|
|
1673
|
+
transition: "left 0.05s ease-out"
|
|
1674
|
+
},
|
|
1675
|
+
children: /* @__PURE__ */ p.jsx(
|
|
1676
|
+
kt,
|
|
1677
|
+
{
|
|
1678
|
+
style: {
|
|
1679
|
+
type: _.cursorType ?? M.cursorType,
|
|
1680
|
+
color: _.cursorColor || M.cursorColor,
|
|
1681
|
+
speed: _.cursorSpeed || M.cursorSpeed
|
|
1682
|
+
}
|
|
1675
1683
|
}
|
|
1676
|
-
|
|
1677
|
-
|
|
1678
|
-
|
|
1679
|
-
)
|
|
1684
|
+
)
|
|
1685
|
+
}
|
|
1686
|
+
)
|
|
1687
|
+
] })
|
|
1680
1688
|
] })
|
|
1681
1689
|
] })
|
|
1682
|
-
] })
|
|
1683
|
-
},
|
|
1690
|
+
] });
|
|
1691
|
+
}, Pt = () => /* @__PURE__ */ p.jsx(
|
|
1684
1692
|
"div",
|
|
1685
1693
|
{
|
|
1686
1694
|
"data-testid": "spinner",
|
|
1687
1695
|
className: "animate-spin rounded-full h-4 w-4 border-2 border-gray-300 border-t-gray-600"
|
|
1688
1696
|
}
|
|
1689
|
-
),
|
|
1697
|
+
), Tt = ({
|
|
1690
1698
|
command: o,
|
|
1691
1699
|
timestamp: n,
|
|
1692
1700
|
status: t
|
|
1693
|
-
}) => /* @__PURE__ */
|
|
1694
|
-
/* @__PURE__ */
|
|
1701
|
+
}) => /* @__PURE__ */ p.jsxs("div", { className: "flex items-center gap-2 font-mono text-sm", children: [
|
|
1702
|
+
/* @__PURE__ */ p.jsxs("span", { className: "text-gray-200", children: [
|
|
1695
1703
|
"> ",
|
|
1696
|
-
o.split(" ").map((r,
|
|
1697
|
-
const
|
|
1698
|
-
return /* @__PURE__ */
|
|
1704
|
+
o.split(" ").map((r, a) => {
|
|
1705
|
+
const i = r.startsWith("<") && r.endsWith(">");
|
|
1706
|
+
return /* @__PURE__ */ p.jsxs(
|
|
1699
1707
|
"span",
|
|
1700
1708
|
{
|
|
1701
|
-
className:
|
|
1709
|
+
className: i ? "text-green-400" : "text-gray-200",
|
|
1702
1710
|
children: [
|
|
1703
|
-
|
|
1711
|
+
a > 0 ? " " : "",
|
|
1704
1712
|
r
|
|
1705
1713
|
]
|
|
1706
1714
|
},
|
|
1707
|
-
|
|
1715
|
+
a
|
|
1708
1716
|
);
|
|
1709
1717
|
})
|
|
1710
1718
|
] }),
|
|
1711
|
-
/* @__PURE__ */
|
|
1712
|
-
/* @__PURE__ */
|
|
1713
|
-
t === ie.Pending && /* @__PURE__ */
|
|
1714
|
-
t === ie.Success && /* @__PURE__ */
|
|
1719
|
+
/* @__PURE__ */ p.jsx("span", { className: "text-gray-400", children: "·" }),
|
|
1720
|
+
/* @__PURE__ */ p.jsx("span", { className: "text-gray-500", children: n }),
|
|
1721
|
+
t === ie.Pending && /* @__PURE__ */ p.jsx(Pt, {}),
|
|
1722
|
+
t === ie.Success && /* @__PURE__ */ p.jsx(
|
|
1715
1723
|
"div",
|
|
1716
1724
|
{
|
|
1717
1725
|
"data-testid": "success-indicator",
|
|
1718
1726
|
className: "w-4 h-4 rounded-full bg-green-500"
|
|
1719
1727
|
}
|
|
1720
1728
|
),
|
|
1721
|
-
(t === ie.Timeout || t === ie.Failure) && /* @__PURE__ */
|
|
1729
|
+
(t === ie.Timeout || t === ie.Failure) && /* @__PURE__ */ p.jsx(
|
|
1722
1730
|
"div",
|
|
1723
1731
|
{
|
|
1724
1732
|
"data-testid": "success-indicator",
|
|
1725
1733
|
className: "w-4 h-4 rounded-full bg-red-500"
|
|
1726
1734
|
}
|
|
1727
1735
|
)
|
|
1728
|
-
] }),
|
|
1729
|
-
const t = ce(), r =
|
|
1736
|
+
] }), Ot = ({ output: o, outputRef: n }) => {
|
|
1737
|
+
const t = ce(), r = R(() => {
|
|
1730
1738
|
if (n.current) {
|
|
1731
|
-
const
|
|
1739
|
+
const a = n.current;
|
|
1732
1740
|
requestAnimationFrame(() => {
|
|
1733
|
-
|
|
1741
|
+
a.scrollTop = a.scrollHeight;
|
|
1734
1742
|
});
|
|
1735
1743
|
}
|
|
1736
1744
|
}, [n]);
|
|
1737
|
-
return
|
|
1745
|
+
return z(() => {
|
|
1738
1746
|
if (r(), n.current) {
|
|
1739
|
-
const
|
|
1740
|
-
if (
|
|
1741
|
-
return
|
|
1747
|
+
const a = n.current.getElementsByTagName("img"), i = a[a.length - 1];
|
|
1748
|
+
if (i && !i.complete)
|
|
1749
|
+
return i.addEventListener("load", r), () => i.removeEventListener("load", r);
|
|
1742
1750
|
}
|
|
1743
|
-
}, [o, r]), /* @__PURE__ */
|
|
1751
|
+
}, [o, r, n]), /* @__PURE__ */ p.jsx(
|
|
1744
1752
|
"div",
|
|
1745
1753
|
{
|
|
1746
1754
|
ref: n,
|
|
1747
1755
|
className: "h-full overflow-y-auto border border-gray-700 rounded-lg p-3 text-left",
|
|
1748
|
-
children: o.map((
|
|
1749
|
-
/* @__PURE__ */
|
|
1750
|
-
|
|
1756
|
+
children: o.map((a, i) => /* @__PURE__ */ p.jsxs("div", { className: "mb-4 last:mb-0", children: [
|
|
1757
|
+
/* @__PURE__ */ p.jsx(
|
|
1758
|
+
Tt,
|
|
1751
1759
|
{
|
|
1752
|
-
command:
|
|
1753
|
-
timestamp: new Date(
|
|
1754
|
-
status:
|
|
1760
|
+
command: a.command.join(" "),
|
|
1761
|
+
timestamp: new Date(a.timestamp).toLocaleTimeString(),
|
|
1762
|
+
status: a.result.status
|
|
1755
1763
|
}
|
|
1756
1764
|
),
|
|
1757
|
-
/* @__PURE__ */
|
|
1758
|
-
] },
|
|
1765
|
+
/* @__PURE__ */ p.jsx("pre", { className: `text-gray-200 whitespace-pre font-mono ${t.outputFontSize}`, children: a.result.render() })
|
|
1766
|
+
] }, i))
|
|
1759
1767
|
}
|
|
1760
1768
|
);
|
|
1761
|
-
},
|
|
1762
|
-
const o = xe(), n = ce(), t = ue(), r =
|
|
1763
|
-
|
|
1764
|
-
const
|
|
1769
|
+
}, Nt = () => {
|
|
1770
|
+
const o = xe(), n = ce(), t = ue(), r = "h-12 mt-2 border-t border-gray-700 px-4", a = "text-gray-300 pt-2", i = o.getCompletions(t.path());
|
|
1771
|
+
D.debug("[AvailableCommands] nextCommandSegments: ", i);
|
|
1772
|
+
const u = Q.useMemo(() => {
|
|
1765
1773
|
if (n.includeHelpCommand) {
|
|
1766
|
-
const
|
|
1767
|
-
return [...
|
|
1774
|
+
const m = i.filter((b) => b.name !== "help"), h = i.find((b) => b.name === "help");
|
|
1775
|
+
return [...m, ...h ? [h] : []];
|
|
1768
1776
|
}
|
|
1769
|
-
return
|
|
1770
|
-
}, [
|
|
1771
|
-
return /* @__PURE__ */
|
|
1772
|
-
/* @__PURE__ */
|
|
1773
|
-
|
|
1777
|
+
return i;
|
|
1778
|
+
}, [i, n.includeHelpCommand]), f = i.some((m) => m.type === "argument"), c = i[0];
|
|
1779
|
+
return /* @__PURE__ */ p.jsx("div", { className: r, "data-testid": "available-commands", children: /* @__PURE__ */ p.jsx("div", { className: a, children: f ? i.length > 0 ? /* @__PURE__ */ p.jsxs(p.Fragment, { children: [
|
|
1780
|
+
/* @__PURE__ */ p.jsx("span", { className: "text-blue-400", children: c.name }),
|
|
1781
|
+
c.description && /* @__PURE__ */ p.jsxs("span", { className: "text-gray-400 ml-2", children: [
|
|
1774
1782
|
"- ",
|
|
1775
|
-
|
|
1783
|
+
c.description
|
|
1776
1784
|
] })
|
|
1777
|
-
] }) : null : /* @__PURE__ */
|
|
1778
|
-
const
|
|
1779
|
-
if (
|
|
1780
|
-
let
|
|
1781
|
-
for (;
|
|
1782
|
-
|
|
1783
|
-
return Math.max(
|
|
1785
|
+
] }) : null : /* @__PURE__ */ p.jsx("div", { className: "flex flex-wrap gap-2", children: u == null ? void 0 : u.map((m) => {
|
|
1786
|
+
const h = u == null ? void 0 : u.reduce((b, _) => {
|
|
1787
|
+
if (_ === m) return b;
|
|
1788
|
+
let S = 0;
|
|
1789
|
+
for (; S < m.name.length && S < _.name.length && m.name[S].toLowerCase() === _.name[S].toLowerCase(); )
|
|
1790
|
+
S++;
|
|
1791
|
+
return Math.max(b, S + 1);
|
|
1784
1792
|
}, 1);
|
|
1785
|
-
return /* @__PURE__ */
|
|
1793
|
+
return /* @__PURE__ */ p.jsx(
|
|
1786
1794
|
"div",
|
|
1787
1795
|
{
|
|
1788
1796
|
className: "px-2 py-1 rounded bg-gray-800 mr-2 last:mr-0",
|
|
1789
|
-
children: /* @__PURE__ */
|
|
1790
|
-
/* @__PURE__ */
|
|
1791
|
-
|
|
1797
|
+
children: /* @__PURE__ */ p.jsxs("span", { className: "font-mono text-white", children: [
|
|
1798
|
+
/* @__PURE__ */ p.jsx("strong", { className: "underline", children: m.name.slice(0, h) }),
|
|
1799
|
+
m.name.slice(h)
|
|
1792
1800
|
] })
|
|
1793
1801
|
},
|
|
1794
|
-
|
|
1802
|
+
m.name
|
|
1795
1803
|
);
|
|
1796
1804
|
}) }) }) });
|
|
1797
1805
|
}, mn = `:host {
|
|
@@ -1956,7 +1964,7 @@ a:hover {
|
|
|
1956
1964
|
`, fn = `@tailwind base;
|
|
1957
1965
|
@tailwind components;
|
|
1958
1966
|
@tailwind utilities;
|
|
1959
|
-
`,
|
|
1967
|
+
`, It = `*, ::before, ::after {
|
|
1960
1968
|
--tw-border-spacing-x: 0;
|
|
1961
1969
|
--tw-border-spacing-y: 0;
|
|
1962
1970
|
--tw-translate-x: 0;
|
|
@@ -2773,92 +2781,96 @@ video {
|
|
|
2773
2781
|
.last\\:mr-0:last-child {
|
|
2774
2782
|
margin-right: 0px;
|
|
2775
2783
|
}
|
|
2776
|
-
`,
|
|
2784
|
+
`, $t = ({
|
|
2777
2785
|
config: o = M,
|
|
2778
2786
|
commandRegistry: n = new Ie(),
|
|
2779
2787
|
containerId: t = null
|
|
2780
|
-
}) => (
|
|
2781
|
-
|
|
2788
|
+
}) => (z(() => {
|
|
2789
|
+
D.configure({
|
|
2782
2790
|
level: o.logLevel || M.logLevel || we.ERROR,
|
|
2783
2791
|
prefix: "[Citadel]"
|
|
2784
2792
|
});
|
|
2785
|
-
const r = new Sn(n, o),
|
|
2786
|
-
return
|
|
2787
|
-
var
|
|
2788
|
-
(
|
|
2793
|
+
const r = new Sn(n, o), a = t ? document.getElementById(t) : document.body;
|
|
2794
|
+
return a ? a.appendChild(r) : (console.warn(`Container with id "${t}" not found, falling back to body`), document.body.appendChild(r)), () => {
|
|
2795
|
+
var i;
|
|
2796
|
+
(i = r.parentElement) == null || i.removeChild(r);
|
|
2789
2797
|
};
|
|
2790
|
-
}, [n, t]), null);
|
|
2798
|
+
}, [n, t, o]), null);
|
|
2791
2799
|
class Sn extends HTMLElement {
|
|
2792
2800
|
constructor(t, r) {
|
|
2793
2801
|
super();
|
|
2794
|
-
|
|
2795
|
-
|
|
2796
|
-
|
|
2797
|
-
|
|
2798
|
-
this.shadow = this.attachShadow({ mode: "open" }), this.
|
|
2802
|
+
A(this, "shadow");
|
|
2803
|
+
A(this, "root", null);
|
|
2804
|
+
A(this, "commandRegistry");
|
|
2805
|
+
A(this, "config");
|
|
2806
|
+
this.shadow = this.attachShadow({ mode: "open" }), this.commandRegistry = t, this.config = r;
|
|
2799
2807
|
}
|
|
2800
2808
|
connectedCallback() {
|
|
2801
2809
|
try {
|
|
2802
|
-
const r = [mn, pn, fn,
|
|
2803
|
-
const
|
|
2804
|
-
return
|
|
2810
|
+
const r = [mn, pn, fn, It].map((a) => {
|
|
2811
|
+
const i = new CSSStyleSheet();
|
|
2812
|
+
return i.replaceSync(a), i;
|
|
2805
2813
|
});
|
|
2806
2814
|
this.shadow.adoptedStyleSheets = [...r];
|
|
2807
2815
|
} catch {
|
|
2808
|
-
const
|
|
2809
|
-
`),
|
|
2810
|
-
|
|
2816
|
+
const r = [mn, pn, fn].join(`
|
|
2817
|
+
`), a = document.createElement("style");
|
|
2818
|
+
a.textContent = r, this.shadow.appendChild(a);
|
|
2811
2819
|
}
|
|
2812
2820
|
const t = document.createElement("div");
|
|
2813
2821
|
t.id = "citadel-root", this.shadow.appendChild(t), this.root = Oe(t), this.root.render(
|
|
2814
|
-
/* @__PURE__ */
|
|
2822
|
+
/* @__PURE__ */ p.jsx(xt, { config: this.config || M, commandRegistry: this.commandRegistry, children: /* @__PURE__ */ p.jsx(Dt, {}) })
|
|
2815
2823
|
);
|
|
2816
2824
|
}
|
|
2817
|
-
// disconnectedCallback() {
|
|
2818
|
-
// if (this.root) {
|
|
2819
|
-
// this.root.unmount();
|
|
2820
|
-
// this.root = null;
|
|
2821
|
-
// }
|
|
2822
|
-
// }
|
|
2823
2825
|
}
|
|
2824
2826
|
customElements.define("citadel-element", Sn);
|
|
2825
|
-
const
|
|
2826
|
-
const [o, n] = Y(!1), [t, r] = Y(!1),
|
|
2827
|
-
|
|
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({
|
|
2827
|
+
const Dt = () => {
|
|
2828
|
+
const [o, n] = Y(!1), [t, r] = Y(!1), a = ce(), [i, u] = Y(() => a.initialHeight || null), f = X(null), c = X(null), m = X(!1), h = X(0), b = X(0), { state: _, actions: S } = Cn();
|
|
2829
|
+
ot({
|
|
2834
2830
|
onOpen: () => n(!0),
|
|
2835
2831
|
onClose: () => r(!0),
|
|
2836
2832
|
isVisible: o,
|
|
2837
|
-
showCitadelKey:
|
|
2833
|
+
showCitadelKey: a.showCitadelKey || "."
|
|
2838
2834
|
});
|
|
2839
|
-
const U =
|
|
2835
|
+
const U = R((w) => {
|
|
2836
|
+
c.current && (m.current = !0, h.current = w.clientY, b.current = c.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", I), document.addEventListener("mouseup", d));
|
|
2837
|
+
}, []), I = R((w) => {
|
|
2838
|
+
var P;
|
|
2839
|
+
if (!m.current) return;
|
|
2840
|
+
const N = w.clientY - h.current, k = (P = a.maxHeight) != null && P.endsWith("vh") ? window.innerHeight * parseInt(a.maxHeight, 10) / 100 : parseInt(a.maxHeight || "80vh", 10), j = Math.min(
|
|
2841
|
+
Math.max(b.current - N, parseInt(a.minHeight || "200", 10)),
|
|
2842
|
+
k
|
|
2843
|
+
);
|
|
2844
|
+
c.current && (c.current.style.height = `${j}px`, c.current.style.bottom = "0", u(`${j}px`));
|
|
2845
|
+
}, [a.maxHeight, a.minHeight]), d = R(() => {
|
|
2846
|
+
m.current = !1, document.documentElement.style.userSelect = "", document.documentElement.style.webkitUserSelect = "", document.documentElement.style.mozUserSelect = "", document.documentElement.style.msUserSelect = "", document.removeEventListener("mousemove", I), document.removeEventListener("mouseup", d);
|
|
2847
|
+
}, [I]);
|
|
2848
|
+
z(() => () => {
|
|
2849
|
+
document.removeEventListener("mousemove", I), document.removeEventListener("mouseup", d);
|
|
2850
|
+
}, [I, d]);
|
|
2851
|
+
const y = R(() => {
|
|
2840
2852
|
t && (n(!1), r(!1));
|
|
2841
2853
|
}, [t]);
|
|
2842
|
-
return
|
|
2854
|
+
return dt({
|
|
2843
2855
|
isVisible: o,
|
|
2844
2856
|
isClosing: t,
|
|
2845
|
-
onAnimationComplete:
|
|
2846
|
-
}), o ? /* @__PURE__ */
|
|
2857
|
+
onAnimationComplete: y
|
|
2858
|
+
}), o ? /* @__PURE__ */ p.jsxs(
|
|
2847
2859
|
"div",
|
|
2848
2860
|
{
|
|
2849
|
-
ref:
|
|
2861
|
+
ref: c,
|
|
2850
2862
|
className: `container ${o ? "citadel_slideUp" : ""} ${t ? "citadel_slideDown" : ""}`,
|
|
2851
2863
|
style: {
|
|
2852
|
-
...
|
|
2853
|
-
maxHeight:
|
|
2864
|
+
...i ? { height: i } : void 0,
|
|
2865
|
+
maxHeight: a.maxHeight
|
|
2854
2866
|
},
|
|
2855
2867
|
children: [
|
|
2856
|
-
/* @__PURE__ */
|
|
2857
|
-
/* @__PURE__ */
|
|
2858
|
-
/* @__PURE__ */
|
|
2859
|
-
/* @__PURE__ */
|
|
2860
|
-
/* @__PURE__ */
|
|
2861
|
-
/* @__PURE__ */
|
|
2868
|
+
/* @__PURE__ */ p.jsx("div", { className: "resizeHandle", onMouseDown: U }),
|
|
2869
|
+
/* @__PURE__ */ p.jsxs("div", { className: "innerContainer", children: [
|
|
2870
|
+
/* @__PURE__ */ p.jsx("div", { className: "flex-1 min-h-0 pt-3 px-4", children: /* @__PURE__ */ p.jsx(Ot, { output: _.output, outputRef: f }) }),
|
|
2871
|
+
/* @__PURE__ */ p.jsxs("div", { children: [
|
|
2872
|
+
/* @__PURE__ */ p.jsx(At, { state: _, actions: S }),
|
|
2873
|
+
/* @__PURE__ */ p.jsx(Nt, {})
|
|
2862
2874
|
] })
|
|
2863
2875
|
] })
|
|
2864
2876
|
]
|
|
@@ -2866,14 +2878,15 @@ const $t = () => {
|
|
|
2866
2878
|
) : null;
|
|
2867
2879
|
};
|
|
2868
2880
|
export {
|
|
2869
|
-
|
|
2870
|
-
|
|
2881
|
+
$t as Citadel,
|
|
2882
|
+
Ie as CommandRegistry,
|
|
2883
|
+
Z as CommandResult,
|
|
2871
2884
|
ie as CommandStatus,
|
|
2872
2885
|
Et as DEFAULT_CURSOR_CONFIGS,
|
|
2873
|
-
|
|
2874
|
-
|
|
2875
|
-
|
|
2876
|
-
|
|
2877
|
-
|
|
2878
|
-
|
|
2886
|
+
mt as ErrorCommandResult,
|
|
2887
|
+
Mt as ImageCommandResult,
|
|
2888
|
+
Ht as JsonCommandResult,
|
|
2889
|
+
Ct as OutputItem,
|
|
2890
|
+
pt as PendingCommandResult,
|
|
2891
|
+
hn as TextCommandResult
|
|
2879
2892
|
};
|