@prozilla-os/terminal 1.0.1 → 1.0.2
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/dist/assets/main.css +1 -0
- package/dist/cat-D7jaxwX3.js +17 -0
- package/dist/cat-D7jaxwX3.js.map +1 -0
- package/dist/cd-dBbWy_6c.js +14 -0
- package/dist/cd-dBbWy_6c.js.map +1 -0
- package/dist/clear-DtYBxmDr.js +14 -0
- package/dist/clear-DtYBxmDr.js.map +1 -0
- package/dist/cmatrix-rPy0d9Qt.js +59 -0
- package/dist/cmatrix-rPy0d9Qt.js.map +1 -0
- package/dist/command-nBL1aO7T.js +43 -0
- package/dist/command-nBL1aO7T.js.map +1 -0
- package/dist/compgen-BDZekcp1.js +14 -0
- package/dist/compgen-BDZekcp1.js.map +1 -0
- package/dist/cowsay-BqminmDW.js +50 -0
- package/dist/cowsay-BqminmDW.js.map +1 -0
- package/dist/dir-BlrznBqV.js +11 -0
- package/dist/dir-BlrznBqV.js.map +1 -0
- package/dist/echo-PyZ6XYF6.js +11 -0
- package/dist/echo-PyZ6XYF6.js.map +1 -0
- package/dist/exit-CizX3N_u.js +11 -0
- package/dist/exit-CizX3N_u.js.map +1 -0
- package/dist/fortune-DNnPar5a.js +59 -0
- package/dist/fortune-DNnPar5a.js.map +1 -0
- package/dist/help-Bj19kBqx.js +18 -0
- package/dist/help-Bj19kBqx.js.map +1 -0
- package/dist/hostname-BBOQWx6L.js +11 -0
- package/dist/hostname-BBOQWx6L.js.map +1 -0
- package/dist/lolcat-DtXOVEIh.js +36 -0
- package/dist/lolcat-DtXOVEIh.js.map +1 -0
- package/dist/ls-DiXv7los.js +19 -0
- package/dist/ls-DiXv7los.js.map +1 -0
- package/dist/main-B0XCFHus.js +904 -0
- package/dist/main-B0XCFHus.js.map +1 -0
- package/dist/main.d.ts +11 -0
- package/dist/main.js +6 -0
- package/dist/main.js.map +1 -0
- package/dist/make-Bg6DStEK.js +10 -0
- package/dist/make-Bg6DStEK.js.map +1 -0
- package/dist/man-CvHWF3E_.js +48 -0
- package/dist/man-CvHWF3E_.js.map +1 -0
- package/dist/mkdir-BTSAC1PK.js +11 -0
- package/dist/mkdir-BTSAC1PK.js.map +1 -0
- package/dist/neofetch-BDZJVYlF.js +39 -0
- package/dist/neofetch-BDZJVYlF.js.map +1 -0
- package/dist/pwd-CSapfDtw.js +11 -0
- package/dist/pwd-CSapfDtw.js.map +1 -0
- package/dist/reboot-Bwxhoa8q.js +11 -0
- package/dist/reboot-Bwxhoa8q.js.map +1 -0
- package/dist/reload-C-07Q8ce.js +11 -0
- package/dist/reload-C-07Q8ce.js.map +1 -0
- package/dist/rev-C8qQIyj_.js +11 -0
- package/dist/rev-C8qQIyj_.js.map +1 -0
- package/dist/rm-CenNYCS_.js +13 -0
- package/dist/rm-CenNYCS_.js.map +1 -0
- package/dist/rmdir-7-udpooP.js +12 -0
- package/dist/rmdir-7-udpooP.js.map +1 -0
- package/dist/sl-B5Yqxs1W.js +167 -0
- package/dist/sl-B5Yqxs1W.js.map +1 -0
- package/dist/touch-BcjKUZ_T.js +20 -0
- package/dist/touch-BcjKUZ_T.js.map +1 -0
- package/dist/uptime-BYmCcOUM.js +11 -0
- package/dist/uptime-BYmCcOUM.js.map +1 -0
- package/dist/whatis-DLaPchWe.js +14 -0
- package/dist/whatis-DLaPchWe.js.map +1 -0
- package/dist/whoami-CQNGmqxL.js +11 -0
- package/dist/whoami-CQNGmqxL.js.map +1 -0
- package/package.json +16 -6
- package/src/components/Ansi.tsx +0 -174
- package/src/components/InputLine.tsx +0 -55
- package/src/components/OutputLine.tsx +0 -17
- package/src/components/Terminal.module.css +0 -126
- package/src/components/Terminal.tsx +0 -369
- package/src/constants/terminal.const.ts +0 -43
- package/src/core/_utils/terminal.utils.ts +0 -10
- package/src/core/command.ts +0 -95
- package/src/core/commands/cat.ts +0 -33
- package/src/core/commands/cd.ts +0 -20
- package/src/core/commands/clear.ts +0 -15
- package/src/core/commands/cmatrix.ts +0 -101
- package/src/core/commands/compgen.ts +0 -14
- package/src/core/commands/cowsay.ts +0 -108
- package/src/core/commands/dir.ts +0 -15
- package/src/core/commands/echo.ts +0 -10
- package/src/core/commands/exit.ts +0 -11
- package/src/core/commands/fortune.ts +0 -63
- package/src/core/commands/help.ts +0 -28
- package/src/core/commands/hostname.ts +0 -10
- package/src/core/commands/lolcat.ts +0 -54
- package/src/core/commands/ls.ts +0 -31
- package/src/core/commands/make.ts +0 -9
- package/src/core/commands/man.ts +0 -86
- package/src/core/commands/mkdir.ts +0 -17
- package/src/core/commands/neofetch.ts +0 -69
- package/src/core/commands/pwd.ts +0 -15
- package/src/core/commands/reboot.ts +0 -11
- package/src/core/commands/reload.ts +0 -11
- package/src/core/commands/rev.ts +0 -10
- package/src/core/commands/rm.ts +0 -21
- package/src/core/commands/rmdir.ts +0 -19
- package/src/core/commands/sl.ts +0 -220
- package/src/core/commands/touch.ts +0 -27
- package/src/core/commands/uptime.ts +0 -10
- package/src/core/commands/whatis.ts +0 -22
- package/src/core/commands/whoami.ts +0 -10
- package/src/core/commands.ts +0 -52
- package/src/core/stream.ts +0 -38
- package/src/index.ts +0 -7
|
@@ -0,0 +1,904 @@
|
|
|
1
|
+
import './assets/main.css';var Pe = Object.defineProperty;
|
|
2
|
+
var Me = (e, t, n) => t in e ? Pe(e, t, { enumerable: !0, configurable: !0, writable: !0, value: n }) : e[t] = n;
|
|
3
|
+
var W = (e, t, n) => Me(e, typeof t != "symbol" ? t + "" : t, n);
|
|
4
|
+
import { ANSI as b, EventEmitter as De, useSystemManager as He, useVirtualRoot as Re, useSettingsManager as je, clamp as xe, removeFromArray as pe, App as Fe } from "@prozilla-os/core";
|
|
5
|
+
import { jsx as L, jsxs as Z } from "react/jsx-runtime";
|
|
6
|
+
import * as z from "react";
|
|
7
|
+
import { forwardRef as Je, useState as S, useRef as de, useEffect as q } from "react";
|
|
8
|
+
const Ve = "_Terminal_1l267_1", We = "_Prefix_1l267_51", qe = "_Input_1l267_63", ze = "_Output_1l267_63", Ge = "_blink_1l267_1", N = {
|
|
9
|
+
Terminal: Ve,
|
|
10
|
+
Prefix: We,
|
|
11
|
+
Input: qe,
|
|
12
|
+
Output: ze,
|
|
13
|
+
"Input-container": "_Input-container_1l267_93",
|
|
14
|
+
blink: Ge,
|
|
15
|
+
"ansi-black-fg": "_ansi-black-fg_1l267_197",
|
|
16
|
+
"ansi-red-fg": "_ansi-red-fg_1l267_199",
|
|
17
|
+
"ansi-green-fg": "_ansi-green-fg_1l267_201",
|
|
18
|
+
"ansi-yellow-fg": "_ansi-yellow-fg_1l267_203",
|
|
19
|
+
"ansi-blue-fg": "_ansi-blue-fg_1l267_205",
|
|
20
|
+
"ansi-magenta-fg": "_ansi-magenta-fg_1l267_207",
|
|
21
|
+
"ansi-cyan-fg": "_ansi-cyan-fg_1l267_209",
|
|
22
|
+
"ansi-white-fg": "_ansi-white-fg_1l267_211",
|
|
23
|
+
"ansi-bright-black-fg": "_ansi-bright-black-fg_1l267_215",
|
|
24
|
+
"ansi-bright-red-fg": "_ansi-bright-red-fg_1l267_217",
|
|
25
|
+
"ansi-bright-green-fg": "_ansi-bright-green-fg_1l267_219",
|
|
26
|
+
"ansi-bright-yellow-fg": "_ansi-bright-yellow-fg_1l267_221",
|
|
27
|
+
"ansi-bright-blue-fg": "_ansi-bright-blue-fg_1l267_223",
|
|
28
|
+
"ansi-bright-magenta-fg": "_ansi-bright-magenta-fg_1l267_225",
|
|
29
|
+
"ansi-bright-cyan-fg": "_ansi-bright-cyan-fg_1l267_227",
|
|
30
|
+
"ansi-bright-white-fg": "_ansi-bright-white-fg_1l267_229",
|
|
31
|
+
"ansi-black-bg": "_ansi-black-bg_1l267_233",
|
|
32
|
+
"ansi-red-bg": "_ansi-red-bg_1l267_235",
|
|
33
|
+
"ansi-green-bg": "_ansi-green-bg_1l267_237",
|
|
34
|
+
"ansi-yellow-bg": "_ansi-yellow-bg_1l267_239",
|
|
35
|
+
"ansi-blue-bg": "_ansi-blue-bg_1l267_241",
|
|
36
|
+
"ansi-magenta-bg": "_ansi-magenta-bg_1l267_243",
|
|
37
|
+
"ansi-cyan-bg": "_ansi-cyan-bg_1l267_245",
|
|
38
|
+
"ansi-white-bg": "_ansi-white-bg_1l267_247",
|
|
39
|
+
"ansi-dim": "_ansi-dim_1l267_251"
|
|
40
|
+
};
|
|
41
|
+
function Be(e) {
|
|
42
|
+
return e && e.__esModule && Object.prototype.hasOwnProperty.call(e, "default") ? e.default : e;
|
|
43
|
+
}
|
|
44
|
+
var _e = /* @__PURE__ */ function() {
|
|
45
|
+
function e(t, n) {
|
|
46
|
+
for (var s = 0; s < n.length; s++) {
|
|
47
|
+
var f = n[s];
|
|
48
|
+
f.enumerable = f.enumerable || !1, f.configurable = !0, "value" in f && (f.writable = !0), Object.defineProperty(t, f.key, f);
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
return function(t, n, s) {
|
|
52
|
+
return n && e(t.prototype, n), s && e(t, s), t;
|
|
53
|
+
};
|
|
54
|
+
}();
|
|
55
|
+
function Ke(e, t) {
|
|
56
|
+
if (!(e instanceof t))
|
|
57
|
+
throw new TypeError("Cannot call a class as a function");
|
|
58
|
+
}
|
|
59
|
+
var A = [[{ color: "0, 0, 0", class: "ansi-black" }, { color: "187, 0, 0", class: "ansi-red" }, { color: "0, 187, 0", class: "ansi-green" }, { color: "187, 187, 0", class: "ansi-yellow" }, { color: "0, 0, 187", class: "ansi-blue" }, { color: "187, 0, 187", class: "ansi-magenta" }, { color: "0, 187, 187", class: "ansi-cyan" }, { color: "255,255,255", class: "ansi-white" }], [{ color: "85, 85, 85", class: "ansi-bright-black" }, { color: "255, 85, 85", class: "ansi-bright-red" }, { color: "0, 255, 0", class: "ansi-bright-green" }, { color: "255, 255, 85", class: "ansi-bright-yellow" }, { color: "85, 85, 255", class: "ansi-bright-blue" }, { color: "255, 85, 255", class: "ansi-bright-magenta" }, { color: "85, 255, 255", class: "ansi-bright-cyan" }, { color: "255, 255, 255", class: "ansi-bright-white" }]], Xe = function() {
|
|
60
|
+
_e(e, null, [{
|
|
61
|
+
key: "escapeForHtml",
|
|
62
|
+
/**
|
|
63
|
+
* Anser.escapeForHtml
|
|
64
|
+
* Escape the input HTML.
|
|
65
|
+
*
|
|
66
|
+
* This does the minimum escaping of text to make it compliant with HTML.
|
|
67
|
+
* In particular, the '&','<', and '>' characters are escaped. This should
|
|
68
|
+
* be run prior to `ansiToHtml`.
|
|
69
|
+
*
|
|
70
|
+
* @name Anser.escapeForHtml
|
|
71
|
+
* @function
|
|
72
|
+
* @param {String} txt The input text (containing the ANSI snippets).
|
|
73
|
+
* @returns {String} The escaped html.
|
|
74
|
+
*/
|
|
75
|
+
value: function(n) {
|
|
76
|
+
return new e().escapeForHtml(n);
|
|
77
|
+
}
|
|
78
|
+
/**
|
|
79
|
+
* Anser.linkify
|
|
80
|
+
* Adds the links in the HTML.
|
|
81
|
+
*
|
|
82
|
+
* This replaces any links in the text with anchor tags that display the
|
|
83
|
+
* link. The links should have at least one whitespace character
|
|
84
|
+
* surrounding it. Also, you should apply this after you have run
|
|
85
|
+
* `ansiToHtml` on the text.
|
|
86
|
+
*
|
|
87
|
+
* @name Anser.linkify
|
|
88
|
+
* @function
|
|
89
|
+
* @param {String} txt The input text.
|
|
90
|
+
* @returns {String} The HTML containing the <a> tags (unescaped).
|
|
91
|
+
*/
|
|
92
|
+
}, {
|
|
93
|
+
key: "linkify",
|
|
94
|
+
value: function(n) {
|
|
95
|
+
return new e().linkify(n);
|
|
96
|
+
}
|
|
97
|
+
/**
|
|
98
|
+
* Anser.ansiToHtml
|
|
99
|
+
* This replaces ANSI terminal escape codes with SPAN tags that wrap the
|
|
100
|
+
* content.
|
|
101
|
+
*
|
|
102
|
+
* This function only interprets ANSI SGR (Select Graphic Rendition) codes
|
|
103
|
+
* that can be represented in HTML.
|
|
104
|
+
* For example, cursor movement codes are ignored and hidden from output.
|
|
105
|
+
* The default style uses colors that are very close to the prescribed
|
|
106
|
+
* standard. The standard assumes that the text will have a black
|
|
107
|
+
* background. These colors are set as inline styles on the SPAN tags.
|
|
108
|
+
*
|
|
109
|
+
* Another option is to set `use_classes: true` in the options argument.
|
|
110
|
+
* This will instead set classes on the spans so the colors can be set via
|
|
111
|
+
* CSS. The class names used are of the format `ansi-*-fg/bg` and
|
|
112
|
+
* `ansi-bright-*-fg/bg` where `*` is the color name,
|
|
113
|
+
* i.e black/red/green/yellow/blue/magenta/cyan/white.
|
|
114
|
+
*
|
|
115
|
+
* @name Anser.ansiToHtml
|
|
116
|
+
* @function
|
|
117
|
+
* @param {String} txt The input text.
|
|
118
|
+
* @param {Object} options The options passed to the ansiToHTML method.
|
|
119
|
+
* @returns {String} The HTML output.
|
|
120
|
+
*/
|
|
121
|
+
}, {
|
|
122
|
+
key: "ansiToHtml",
|
|
123
|
+
value: function(n, s) {
|
|
124
|
+
return new e().ansiToHtml(n, s);
|
|
125
|
+
}
|
|
126
|
+
/**
|
|
127
|
+
* Anser.ansiToJson
|
|
128
|
+
* Converts ANSI input into JSON output.
|
|
129
|
+
*
|
|
130
|
+
* @name Anser.ansiToJson
|
|
131
|
+
* @function
|
|
132
|
+
* @param {String} txt The input text.
|
|
133
|
+
* @param {Object} options The options passed to the ansiToHTML method.
|
|
134
|
+
* @returns {String} The HTML output.
|
|
135
|
+
*/
|
|
136
|
+
}, {
|
|
137
|
+
key: "ansiToJson",
|
|
138
|
+
value: function(n, s) {
|
|
139
|
+
return new e().ansiToJson(n, s);
|
|
140
|
+
}
|
|
141
|
+
/**
|
|
142
|
+
* Anser.ansiToText
|
|
143
|
+
* Converts ANSI input into text output.
|
|
144
|
+
*
|
|
145
|
+
* @name Anser.ansiToText
|
|
146
|
+
* @function
|
|
147
|
+
* @param {String} txt The input text.
|
|
148
|
+
* @returns {String} The text output.
|
|
149
|
+
*/
|
|
150
|
+
}, {
|
|
151
|
+
key: "ansiToText",
|
|
152
|
+
value: function(n) {
|
|
153
|
+
return new e().ansiToText(n);
|
|
154
|
+
}
|
|
155
|
+
/**
|
|
156
|
+
* Anser
|
|
157
|
+
* The `Anser` class.
|
|
158
|
+
*
|
|
159
|
+
* @name Anser
|
|
160
|
+
* @function
|
|
161
|
+
* @returns {Anser}
|
|
162
|
+
*/
|
|
163
|
+
}]);
|
|
164
|
+
function e() {
|
|
165
|
+
Ke(this, e), this.fg = this.bg = this.fg_truecolor = this.bg_truecolor = null, this.bright = 0, this.decorations = [];
|
|
166
|
+
}
|
|
167
|
+
return _e(e, [{
|
|
168
|
+
key: "setupPalette",
|
|
169
|
+
value: function() {
|
|
170
|
+
this.PALETTE_COLORS = [];
|
|
171
|
+
for (var n = 0; n < 2; ++n)
|
|
172
|
+
for (var s = 0; s < 8; ++s)
|
|
173
|
+
this.PALETTE_COLORS.push(A[n][s].color);
|
|
174
|
+
for (var f = [0, 95, 135, 175, 215, 255], y = function(a, v, k) {
|
|
175
|
+
return f[a] + ", " + f[v] + ", " + f[k];
|
|
176
|
+
}, i = 0; i < 6; ++i)
|
|
177
|
+
for (var u = 0; u < 6; ++u)
|
|
178
|
+
for (var c = 0; c < 6; ++c)
|
|
179
|
+
this.PALETTE_COLORS.push(y(i, u, c));
|
|
180
|
+
for (var o = 8, r = 0; r < 24; ++r, o += 10)
|
|
181
|
+
this.PALETTE_COLORS.push(y(o, o, o));
|
|
182
|
+
}
|
|
183
|
+
/**
|
|
184
|
+
* escapeForHtml
|
|
185
|
+
* Escapes the input text.
|
|
186
|
+
*
|
|
187
|
+
* @name escapeForHtml
|
|
188
|
+
* @function
|
|
189
|
+
* @param {String} txt The input text.
|
|
190
|
+
* @returns {String} The escpaed HTML output.
|
|
191
|
+
*/
|
|
192
|
+
}, {
|
|
193
|
+
key: "escapeForHtml",
|
|
194
|
+
value: function(n) {
|
|
195
|
+
return n.replace(/[&<>\"]/gm, function(s) {
|
|
196
|
+
return s == "&" ? "&" : s == '"' ? """ : s == "<" ? "<" : s == ">" ? ">" : "";
|
|
197
|
+
});
|
|
198
|
+
}
|
|
199
|
+
/**
|
|
200
|
+
* linkify
|
|
201
|
+
* Adds HTML link elements.
|
|
202
|
+
*
|
|
203
|
+
* @name linkify
|
|
204
|
+
* @function
|
|
205
|
+
* @param {String} txt The input text.
|
|
206
|
+
* @returns {String} The HTML output containing link elements.
|
|
207
|
+
*/
|
|
208
|
+
}, {
|
|
209
|
+
key: "linkify",
|
|
210
|
+
value: function(n) {
|
|
211
|
+
return n.replace(/(https?:\/\/[^\s]+)/gm, function(s) {
|
|
212
|
+
return '<a href="' + s + '">' + s + "</a>";
|
|
213
|
+
});
|
|
214
|
+
}
|
|
215
|
+
/**
|
|
216
|
+
* ansiToHtml
|
|
217
|
+
* Converts ANSI input into HTML output.
|
|
218
|
+
*
|
|
219
|
+
* @name ansiToHtml
|
|
220
|
+
* @function
|
|
221
|
+
* @param {String} txt The input text.
|
|
222
|
+
* @param {Object} options The options passed ot the `process` method.
|
|
223
|
+
* @returns {String} The HTML output.
|
|
224
|
+
*/
|
|
225
|
+
}, {
|
|
226
|
+
key: "ansiToHtml",
|
|
227
|
+
value: function(n, s) {
|
|
228
|
+
return this.process(n, s, !0);
|
|
229
|
+
}
|
|
230
|
+
/**
|
|
231
|
+
* ansiToJson
|
|
232
|
+
* Converts ANSI input into HTML output.
|
|
233
|
+
*
|
|
234
|
+
* @name ansiToJson
|
|
235
|
+
* @function
|
|
236
|
+
* @param {String} txt The input text.
|
|
237
|
+
* @param {Object} options The options passed ot the `process` method.
|
|
238
|
+
* @returns {String} The JSON output.
|
|
239
|
+
*/
|
|
240
|
+
}, {
|
|
241
|
+
key: "ansiToJson",
|
|
242
|
+
value: function(n, s) {
|
|
243
|
+
return s = s || {}, s.json = !0, s.clearLine = !1, this.process(n, s, !0);
|
|
244
|
+
}
|
|
245
|
+
/**
|
|
246
|
+
* ansiToText
|
|
247
|
+
* Converts ANSI input into HTML output.
|
|
248
|
+
*
|
|
249
|
+
* @name ansiToText
|
|
250
|
+
* @function
|
|
251
|
+
* @param {String} txt The input text.
|
|
252
|
+
* @returns {String} The text output.
|
|
253
|
+
*/
|
|
254
|
+
}, {
|
|
255
|
+
key: "ansiToText",
|
|
256
|
+
value: function(n) {
|
|
257
|
+
return this.process(n, {}, !1);
|
|
258
|
+
}
|
|
259
|
+
/**
|
|
260
|
+
* process
|
|
261
|
+
* Processes the input.
|
|
262
|
+
*
|
|
263
|
+
* @name process
|
|
264
|
+
* @function
|
|
265
|
+
* @param {String} txt The input text.
|
|
266
|
+
* @param {Object} options An object passed to `processChunk` method, extended with:
|
|
267
|
+
*
|
|
268
|
+
* - `json` (Boolean): If `true`, the result will be an object.
|
|
269
|
+
* - `use_classes` (Boolean): If `true`, HTML classes will be appended to the HTML output.
|
|
270
|
+
*
|
|
271
|
+
* @param {Boolean} markup
|
|
272
|
+
*/
|
|
273
|
+
}, {
|
|
274
|
+
key: "process",
|
|
275
|
+
value: function(n, s, f) {
|
|
276
|
+
var y = this, i = this, u = n.split(/\033\[/), c = u.shift();
|
|
277
|
+
s == null && (s = {}), s.clearLine = /\r/.test(n);
|
|
278
|
+
var o = u.map(function(d) {
|
|
279
|
+
return y.processChunk(d, s, f);
|
|
280
|
+
});
|
|
281
|
+
if (s && s.json) {
|
|
282
|
+
var r = i.processChunkJson("");
|
|
283
|
+
return r.content = c, r.clearLine = s.clearLine, o.unshift(r), s.remove_empty && (o = o.filter(function(d) {
|
|
284
|
+
return !d.isEmpty();
|
|
285
|
+
})), o;
|
|
286
|
+
} else
|
|
287
|
+
o.unshift(c);
|
|
288
|
+
return o.join("");
|
|
289
|
+
}
|
|
290
|
+
/**
|
|
291
|
+
* processChunkJson
|
|
292
|
+
* Processes the current chunk into json output.
|
|
293
|
+
*
|
|
294
|
+
* @name processChunkJson
|
|
295
|
+
* @function
|
|
296
|
+
* @param {String} text The input text.
|
|
297
|
+
* @param {Object} options An object containing the following fields:
|
|
298
|
+
*
|
|
299
|
+
* - `json` (Boolean): If `true`, the result will be an object.
|
|
300
|
+
* - `use_classes` (Boolean): If `true`, HTML classes will be appended to the HTML output.
|
|
301
|
+
*
|
|
302
|
+
* @param {Boolean} markup If false, the colors will not be parsed.
|
|
303
|
+
* @return {Object} The result object:
|
|
304
|
+
*
|
|
305
|
+
* - `content` (String): The text.
|
|
306
|
+
* - `fg` (String|null): The foreground color.
|
|
307
|
+
* - `bg` (String|null): The background color.
|
|
308
|
+
* - `fg_truecolor` (String|null): The foreground true color (if 16m color is enabled).
|
|
309
|
+
* - `bg_truecolor` (String|null): The background true color (if 16m color is enabled).
|
|
310
|
+
* - `clearLine` (Boolean): `true` if a carriageReturn \r was fount at end of line.
|
|
311
|
+
* - `was_processed` (Bolean): `true` if the colors were processed, `false` otherwise.
|
|
312
|
+
* - `isEmpty` (Function): A function returning `true` if the content is empty, or `false` otherwise.
|
|
313
|
+
*
|
|
314
|
+
*/
|
|
315
|
+
}, {
|
|
316
|
+
key: "processChunkJson",
|
|
317
|
+
value: function(n, s, f) {
|
|
318
|
+
s = typeof s > "u" ? {} : s;
|
|
319
|
+
var y = s.use_classes = typeof s.use_classes < "u" && s.use_classes, i = s.key = y ? "class" : "color", u = {
|
|
320
|
+
content: n,
|
|
321
|
+
fg: null,
|
|
322
|
+
bg: null,
|
|
323
|
+
fg_truecolor: null,
|
|
324
|
+
bg_truecolor: null,
|
|
325
|
+
isInverted: !1,
|
|
326
|
+
clearLine: s.clearLine,
|
|
327
|
+
decoration: null,
|
|
328
|
+
decorations: [],
|
|
329
|
+
was_processed: !1,
|
|
330
|
+
isEmpty: function() {
|
|
331
|
+
return !u.content;
|
|
332
|
+
}
|
|
333
|
+
}, c = n.match(/^([!\x3c-\x3f]*)([\d;]*)([\x20-\x2c]*[\x40-\x7e])([\s\S]*)/m);
|
|
334
|
+
if (!c) return u;
|
|
335
|
+
u.content = c[4];
|
|
336
|
+
var o = c[2].split(";");
|
|
337
|
+
if (c[1] !== "" || c[3] !== "m" || !f)
|
|
338
|
+
return u;
|
|
339
|
+
for (var r = this; o.length > 0; ) {
|
|
340
|
+
var d = o.shift(), a = parseInt(d);
|
|
341
|
+
if (isNaN(a) || a === 0)
|
|
342
|
+
r.fg = r.bg = null, r.decorations = [];
|
|
343
|
+
else if (a === 1)
|
|
344
|
+
r.decorations.push("bold");
|
|
345
|
+
else if (a === 2)
|
|
346
|
+
r.decorations.push("dim");
|
|
347
|
+
else if (a === 3)
|
|
348
|
+
r.decorations.push("italic");
|
|
349
|
+
else if (a === 4)
|
|
350
|
+
r.decorations.push("underline");
|
|
351
|
+
else if (a === 5)
|
|
352
|
+
r.decorations.push("blink");
|
|
353
|
+
else if (a === 7)
|
|
354
|
+
r.decorations.push("reverse");
|
|
355
|
+
else if (a === 8)
|
|
356
|
+
r.decorations.push("hidden");
|
|
357
|
+
else if (a === 9)
|
|
358
|
+
r.decorations.push("strikethrough");
|
|
359
|
+
else if (a === 21)
|
|
360
|
+
r.removeDecoration("bold");
|
|
361
|
+
else if (a === 22)
|
|
362
|
+
r.removeDecoration("bold"), r.removeDecoration("dim");
|
|
363
|
+
else if (a === 23)
|
|
364
|
+
r.removeDecoration("italic");
|
|
365
|
+
else if (a === 24)
|
|
366
|
+
r.removeDecoration("underline");
|
|
367
|
+
else if (a === 25)
|
|
368
|
+
r.removeDecoration("blink");
|
|
369
|
+
else if (a === 27)
|
|
370
|
+
r.removeDecoration("reverse");
|
|
371
|
+
else if (a === 28)
|
|
372
|
+
r.removeDecoration("hidden");
|
|
373
|
+
else if (a === 29)
|
|
374
|
+
r.removeDecoration("strikethrough");
|
|
375
|
+
else if (a === 39)
|
|
376
|
+
r.fg = null;
|
|
377
|
+
else if (a === 49)
|
|
378
|
+
r.bg = null;
|
|
379
|
+
else if (a >= 30 && a < 38)
|
|
380
|
+
r.fg = A[0][a % 10][i];
|
|
381
|
+
else if (a >= 90 && a < 98)
|
|
382
|
+
r.fg = A[1][a % 10][i];
|
|
383
|
+
else if (a >= 40 && a < 48)
|
|
384
|
+
r.bg = A[0][a % 10][i];
|
|
385
|
+
else if (a >= 100 && a < 108)
|
|
386
|
+
r.bg = A[1][a % 10][i];
|
|
387
|
+
else if (a === 38 || a === 48) {
|
|
388
|
+
var v = a === 38;
|
|
389
|
+
if (o.length >= 1) {
|
|
390
|
+
var k = o.shift();
|
|
391
|
+
if (k === "5" && o.length >= 1) {
|
|
392
|
+
var g = parseInt(o.shift());
|
|
393
|
+
if (g >= 0 && g <= 255)
|
|
394
|
+
if (!y)
|
|
395
|
+
this.PALETTE_COLORS || r.setupPalette(), v ? r.fg = this.PALETTE_COLORS[g] : r.bg = this.PALETTE_COLORS[g];
|
|
396
|
+
else {
|
|
397
|
+
var E = g >= 16 ? "ansi-palette-" + g : A[g > 7 ? 1 : 0][g % 8].class;
|
|
398
|
+
v ? r.fg = E : r.bg = E;
|
|
399
|
+
}
|
|
400
|
+
} else if (k === "2" && o.length >= 3) {
|
|
401
|
+
var $ = parseInt(o.shift()), M = parseInt(o.shift()), D = parseInt(o.shift());
|
|
402
|
+
if ($ >= 0 && $ <= 255 && M >= 0 && M <= 255 && D >= 0 && D <= 255) {
|
|
403
|
+
var T = $ + ", " + M + ", " + D;
|
|
404
|
+
y ? v ? (r.fg = "ansi-truecolor", r.fg_truecolor = T) : (r.bg = "ansi-truecolor", r.bg_truecolor = T) : v ? r.fg = T : r.bg = T;
|
|
405
|
+
}
|
|
406
|
+
}
|
|
407
|
+
}
|
|
408
|
+
}
|
|
409
|
+
}
|
|
410
|
+
return r.fg === null && r.bg === null && r.decorations.length === 0 || (u.fg = r.fg, u.bg = r.bg, u.fg_truecolor = r.fg_truecolor, u.bg_truecolor = r.bg_truecolor, u.decorations = r.decorations, u.decoration = r.decorations.slice(-1).pop() || null, u.was_processed = !0), u;
|
|
411
|
+
}
|
|
412
|
+
/**
|
|
413
|
+
* processChunk
|
|
414
|
+
* Processes the current chunk of text.
|
|
415
|
+
*
|
|
416
|
+
* @name processChunk
|
|
417
|
+
* @function
|
|
418
|
+
* @param {String} text The input text.
|
|
419
|
+
* @param {Object} options An object containing the following fields:
|
|
420
|
+
*
|
|
421
|
+
* - `json` (Boolean): If `true`, the result will be an object.
|
|
422
|
+
* - `use_classes` (Boolean): If `true`, HTML classes will be appended to the HTML output.
|
|
423
|
+
*
|
|
424
|
+
* @param {Boolean} markup If false, the colors will not be parsed.
|
|
425
|
+
* @return {Object|String} The result (object if `json` is wanted back or string otherwise).
|
|
426
|
+
*/
|
|
427
|
+
}, {
|
|
428
|
+
key: "processChunk",
|
|
429
|
+
value: function(n, s, f) {
|
|
430
|
+
var y = this;
|
|
431
|
+
s = s || {};
|
|
432
|
+
var i = this.processChunkJson(n, s, f), u = s.use_classes;
|
|
433
|
+
if (i.decorations = i.decorations.filter(function(v) {
|
|
434
|
+
if (v === "reverse") {
|
|
435
|
+
i.fg || (i.fg = A[0][7][u ? "class" : "color"]), i.bg || (i.bg = A[0][0][u ? "class" : "color"]);
|
|
436
|
+
var k = i.fg;
|
|
437
|
+
i.fg = i.bg, i.bg = k;
|
|
438
|
+
var g = i.fg_truecolor;
|
|
439
|
+
return i.fg_truecolor = i.bg_truecolor, i.bg_truecolor = g, i.isInverted = !0, !1;
|
|
440
|
+
}
|
|
441
|
+
return !0;
|
|
442
|
+
}), s.json)
|
|
443
|
+
return i;
|
|
444
|
+
if (i.isEmpty())
|
|
445
|
+
return "";
|
|
446
|
+
if (!i.was_processed)
|
|
447
|
+
return i.content;
|
|
448
|
+
var c = [], o = [], r = [], d = {}, a = function(k) {
|
|
449
|
+
var g = [], E = void 0;
|
|
450
|
+
for (E in k)
|
|
451
|
+
k.hasOwnProperty(E) && g.push("data-" + E + '="' + y.escapeForHtml(k[E]) + '"');
|
|
452
|
+
return g.length > 0 ? " " + g.join(" ") : "";
|
|
453
|
+
};
|
|
454
|
+
return i.isInverted && (d["ansi-is-inverted"] = "true"), i.fg && (u ? (c.push(i.fg + "-fg"), i.fg_truecolor !== null && (d["ansi-truecolor-fg"] = i.fg_truecolor, i.fg_truecolor = null)) : c.push("color:rgb(" + i.fg + ")")), i.bg && (u ? (c.push(i.bg + "-bg"), i.bg_truecolor !== null && (d["ansi-truecolor-bg"] = i.bg_truecolor, i.bg_truecolor = null)) : c.push("background-color:rgb(" + i.bg + ")")), i.decorations.forEach(function(v) {
|
|
455
|
+
if (u) {
|
|
456
|
+
o.push("ansi-" + v);
|
|
457
|
+
return;
|
|
458
|
+
}
|
|
459
|
+
v === "bold" ? o.push("font-weight:bold") : v === "dim" ? o.push("opacity:0.5") : v === "italic" ? o.push("font-style:italic") : v === "hidden" ? o.push("visibility:hidden") : v === "strikethrough" ? r.push("line-through") : r.push(v);
|
|
460
|
+
}), r.length && o.push("text-decoration:" + r.join(" ")), u ? '<span class="' + c.concat(o).join(" ") + '"' + a(d) + ">" + i.content + "</span>" : '<span style="' + c.concat(o).join(";") + '"' + a(d) + ">" + i.content + "</span>";
|
|
461
|
+
}
|
|
462
|
+
}, {
|
|
463
|
+
key: "removeDecoration",
|
|
464
|
+
value: function(n) {
|
|
465
|
+
var s = this.decorations.indexOf(n);
|
|
466
|
+
s >= 0 && this.decorations.splice(s, 1);
|
|
467
|
+
}
|
|
468
|
+
}]), e;
|
|
469
|
+
}(), Qe = Xe;
|
|
470
|
+
const Ue = /* @__PURE__ */ Be(Qe);
|
|
471
|
+
var te = { exports: {} };
|
|
472
|
+
function se(e) {
|
|
473
|
+
if (!e) return "";
|
|
474
|
+
if (!/\r/.test(e)) return e;
|
|
475
|
+
for (e = e.replace(/\r+\n/gm, `
|
|
476
|
+
`); /\r./.test(e); )
|
|
477
|
+
e = e.replace(/^([^\r\n]*)\r+([^\r\n]+)/gm, function(t, n, s) {
|
|
478
|
+
return s + n.slice(s.length);
|
|
479
|
+
});
|
|
480
|
+
return e;
|
|
481
|
+
}
|
|
482
|
+
function Ye(e) {
|
|
483
|
+
for (var t = 0, n = 0; n < e.length; n++)
|
|
484
|
+
e[t].length <= e[n].length && (t = n);
|
|
485
|
+
return t;
|
|
486
|
+
}
|
|
487
|
+
function be(e) {
|
|
488
|
+
if (!/\r/.test(e)) return e;
|
|
489
|
+
for (var t = e.split("\r"), n = []; t.length > 0; ) {
|
|
490
|
+
var s = Ye(t);
|
|
491
|
+
n.push(t[s]), t = t.slice(s + 1);
|
|
492
|
+
}
|
|
493
|
+
return n.join("\r");
|
|
494
|
+
}
|
|
495
|
+
function Ze(e) {
|
|
496
|
+
if (!e) return "";
|
|
497
|
+
if (!/\r/.test(e)) return e;
|
|
498
|
+
if (!/\n/.test(e)) return be(e);
|
|
499
|
+
e = e.replace(/\r+\n/gm, `
|
|
500
|
+
`);
|
|
501
|
+
var t = e.lastIndexOf(`
|
|
502
|
+
`);
|
|
503
|
+
return se(e.slice(0, t)) + `
|
|
504
|
+
` + be(e.slice(t + 1));
|
|
505
|
+
}
|
|
506
|
+
te.exports = se;
|
|
507
|
+
var et = te.exports.escapeCarriageReturn = se;
|
|
508
|
+
te.exports.escapeCarriageReturnSafe = Ze;
|
|
509
|
+
function tt(e, t) {
|
|
510
|
+
return e = et(it(e)), Ue.ansiToJson(e, {
|
|
511
|
+
json: !0,
|
|
512
|
+
remove_empty: !0,
|
|
513
|
+
use_classes: t
|
|
514
|
+
});
|
|
515
|
+
}
|
|
516
|
+
function st(e) {
|
|
517
|
+
const t = [];
|
|
518
|
+
return e.bg && t.push(N[`${e.bg}-bg`]), e.fg && t.push(N[`${e.fg}-fg`]), e.decoration && t.push(N[`ansi-${e.decoration}`]), t.length === 0 ? null : t.join(" ");
|
|
519
|
+
}
|
|
520
|
+
function nt(e) {
|
|
521
|
+
const t = {};
|
|
522
|
+
switch (e.bg && (t.backgroundColor = `rgb(${e.bg})`), e.fg && (t.color = `rgb(${e.fg})`), e.decoration) {
|
|
523
|
+
case "bold":
|
|
524
|
+
t.fontWeight = "bold";
|
|
525
|
+
break;
|
|
526
|
+
case "dim":
|
|
527
|
+
t.opacity = "0.5";
|
|
528
|
+
break;
|
|
529
|
+
case "italic":
|
|
530
|
+
t.fontStyle = "italic";
|
|
531
|
+
break;
|
|
532
|
+
case "hidden":
|
|
533
|
+
t.visibility = "hidden";
|
|
534
|
+
break;
|
|
535
|
+
case "strikethrough":
|
|
536
|
+
t.textDecoration = "line-through";
|
|
537
|
+
break;
|
|
538
|
+
case "underline":
|
|
539
|
+
t.textDecoration = "underline";
|
|
540
|
+
break;
|
|
541
|
+
case "blink":
|
|
542
|
+
t.textDecoration = "blink";
|
|
543
|
+
break;
|
|
544
|
+
}
|
|
545
|
+
return t;
|
|
546
|
+
}
|
|
547
|
+
function rt(e, t, n, s) {
|
|
548
|
+
const f = t ? null : nt(n), y = t ? st(n) : null;
|
|
549
|
+
if (!e)
|
|
550
|
+
return z.createElement(
|
|
551
|
+
"pre",
|
|
552
|
+
{ style: f, key: s, className: y },
|
|
553
|
+
n.content
|
|
554
|
+
);
|
|
555
|
+
const i = [], u = /(\s|^)(https?:\/\/(?:www\.|(?!www))[^\s.]+\.[^\s]{2,}|www\.[^\s]+\.[^\s]{2,})/g;
|
|
556
|
+
let c = 0, o;
|
|
557
|
+
for (; (o = u.exec(n.content)) !== null; ) {
|
|
558
|
+
const [, r, d] = o, a = o.index + r.length;
|
|
559
|
+
a > c && i.push(n.content.substring(c, a));
|
|
560
|
+
const v = d.startsWith("www.") ? `http://${d}` : d;
|
|
561
|
+
i.push(
|
|
562
|
+
z.createElement(
|
|
563
|
+
"a",
|
|
564
|
+
{
|
|
565
|
+
key: c,
|
|
566
|
+
href: v,
|
|
567
|
+
target: "_blank"
|
|
568
|
+
},
|
|
569
|
+
`${d}`
|
|
570
|
+
)
|
|
571
|
+
), c = u.lastIndex;
|
|
572
|
+
}
|
|
573
|
+
return c < n.content.length && i.push(n.content.substring(c)), z.createElement("span", { style: f, key: s, className: y }, i);
|
|
574
|
+
}
|
|
575
|
+
function ke(e) {
|
|
576
|
+
const { className: t, useClasses: n, children: s, linkify: f } = e;
|
|
577
|
+
return z.createElement(
|
|
578
|
+
"code",
|
|
579
|
+
{ className: t },
|
|
580
|
+
tt(s ?? "", n ?? !1).map(
|
|
581
|
+
// eslint-disable-next-line @typescript-eslint/no-unsafe-argument
|
|
582
|
+
rt.bind(null, f ?? !1, n ?? !1)
|
|
583
|
+
)
|
|
584
|
+
);
|
|
585
|
+
}
|
|
586
|
+
function it(e) {
|
|
587
|
+
let t = e;
|
|
588
|
+
do
|
|
589
|
+
e = t, t = e.replace(/[^\n]\x08/gm, "");
|
|
590
|
+
while (t.length < e.length);
|
|
591
|
+
return e;
|
|
592
|
+
}
|
|
593
|
+
const ve = Je(({ text: e }, t) => {
|
|
594
|
+
const n = e == null ? void 0 : e.split(`
|
|
595
|
+
`);
|
|
596
|
+
return /* @__PURE__ */ L("div", { ref: t, children: n == null ? void 0 : n.map(
|
|
597
|
+
(s, f) => /* @__PURE__ */ L(ke, { className: N.Output, useClasses: !0, children: s === "" ? " " : s }, f)
|
|
598
|
+
) });
|
|
599
|
+
});
|
|
600
|
+
function at({ value: e, prefix: t, onChange: n, onKeyUp: s, onKeyDown: f, inputRef: y }) {
|
|
601
|
+
const [i, u] = S(0), c = () => {
|
|
602
|
+
var r;
|
|
603
|
+
const o = (r = y.current) == null ? void 0 : r.selectionStart;
|
|
604
|
+
o != null && u(o);
|
|
605
|
+
};
|
|
606
|
+
return /* @__PURE__ */ Z("span", { className: N.Input, children: [
|
|
607
|
+
t && /* @__PURE__ */ L(ke, { className: N.Prefix, useClasses: !0, children: t }),
|
|
608
|
+
/* @__PURE__ */ Z("span", { className: N["Input-container"], style: { "--cursor-offset": i }, children: [
|
|
609
|
+
/* @__PURE__ */ L("span", { "aria-hidden": "true", children: e }),
|
|
610
|
+
/* @__PURE__ */ L(
|
|
611
|
+
"input",
|
|
612
|
+
{
|
|
613
|
+
id: "input",
|
|
614
|
+
value: e,
|
|
615
|
+
"aria-label": "Command input",
|
|
616
|
+
onChange: (o) => {
|
|
617
|
+
n(o), c();
|
|
618
|
+
},
|
|
619
|
+
ref: y,
|
|
620
|
+
onKeyUp: (o) => {
|
|
621
|
+
s == null || s(o);
|
|
622
|
+
},
|
|
623
|
+
onKeyDown: (o) => {
|
|
624
|
+
f == null || f(o), c();
|
|
625
|
+
},
|
|
626
|
+
onClick: c,
|
|
627
|
+
onTouchEnd: c,
|
|
628
|
+
onSelect: c,
|
|
629
|
+
onCut: c,
|
|
630
|
+
onCopy: c,
|
|
631
|
+
onPaste: c,
|
|
632
|
+
spellCheck: !1,
|
|
633
|
+
autoComplete: "off",
|
|
634
|
+
autoFocus: !0
|
|
635
|
+
}
|
|
636
|
+
)
|
|
637
|
+
] })
|
|
638
|
+
] });
|
|
639
|
+
}
|
|
640
|
+
const U = "user", Y = "prozilla-os", ht = 50, ye = `${b.fg.cyan + b.decoration.dim}$APP_NAME - Made by Prozilla${b.reset}
|
|
641
|
+
${b.decoration.dim}Type 'help' for a list of commands.${b.reset}
|
|
642
|
+
`, C = b.fg.cyan, mt = `
|
|
643
|
+
:.
|
|
644
|
+
-==.
|
|
645
|
+
.=====:
|
|
646
|
+
---::..:=======-.
|
|
647
|
+
:===+=----------::..
|
|
648
|
+
=+=---------------:..
|
|
649
|
+
--------------------:.
|
|
650
|
+
.:-+=----${b.fg.white}*###*${C}--${b.fg.white}*####=${C}---.
|
|
651
|
+
:==+----${b.fg.white}#%+${C}-${b.fg.white}+%#${C}-${b.fg.white}##%*+${C}----:.
|
|
652
|
+
.=----${b.fg.white}#%+${C}-${b.fg.white}+%#${C}-${b.fg.white}*+${C}-${b.fg.white}%#+${C}---:.
|
|
653
|
+
==----${b.fg.white}*###*${C}--${b.fg.white}*###*${C}----.
|
|
654
|
+
==+-------------------:.
|
|
655
|
+
...::---------------:.
|
|
656
|
+
.::---------::..
|
|
657
|
+
....::... `, ot = {
|
|
658
|
+
new: "new",
|
|
659
|
+
start: "start",
|
|
660
|
+
stop: "stop"
|
|
661
|
+
};
|
|
662
|
+
class P extends De {
|
|
663
|
+
constructor() {
|
|
664
|
+
super(...arguments);
|
|
665
|
+
W(this, "enabled", !1);
|
|
666
|
+
}
|
|
667
|
+
start(n) {
|
|
668
|
+
return this.enabled ? this : (n == null || n(this), this.enabled = !0, this.emit("start"), this);
|
|
669
|
+
}
|
|
670
|
+
stop() {
|
|
671
|
+
return this.enabled ? (this.enabled = !1, this.emit("stop"), this) : this;
|
|
672
|
+
}
|
|
673
|
+
send(n) {
|
|
674
|
+
return this.enabled && this.emit("new", n), this;
|
|
675
|
+
}
|
|
676
|
+
}
|
|
677
|
+
W(P, "EVENT_NAMES", ot);
|
|
678
|
+
function F(e, t) {
|
|
679
|
+
return `${b.fg.red}${e}: ${t}${b.reset}`;
|
|
680
|
+
}
|
|
681
|
+
function pt(e) {
|
|
682
|
+
return e.replace(/\u001b\[([0-9]+)m/gm, "");
|
|
683
|
+
}
|
|
684
|
+
let G = [];
|
|
685
|
+
const we = /* @__PURE__ */ Object.assign({ "./commands/cat.ts": () => import("./cat-D7jaxwX3.js"), "./commands/cd.ts": () => import("./cd-dBbWy_6c.js"), "./commands/clear.ts": () => import("./clear-DtYBxmDr.js"), "./commands/cmatrix.ts": () => import("./cmatrix-rPy0d9Qt.js"), "./commands/compgen.ts": () => import("./compgen-BDZekcp1.js"), "./commands/cowsay.ts": () => import("./cowsay-BqminmDW.js"), "./commands/dir.ts": () => import("./dir-BlrznBqV.js"), "./commands/echo.ts": () => import("./echo-PyZ6XYF6.js"), "./commands/exit.ts": () => import("./exit-CizX3N_u.js"), "./commands/fortune.ts": () => import("./fortune-DNnPar5a.js"), "./commands/help.ts": () => import("./help-Bj19kBqx.js"), "./commands/hostname.ts": () => import("./hostname-BBOQWx6L.js"), "./commands/lolcat.ts": () => import("./lolcat-DtXOVEIh.js"), "./commands/ls.ts": () => import("./ls-DiXv7los.js"), "./commands/make.ts": () => import("./make-Bg6DStEK.js"), "./commands/man.ts": () => import("./man-CvHWF3E_.js"), "./commands/mkdir.ts": () => import("./mkdir-BTSAC1PK.js"), "./commands/neofetch.ts": () => import("./neofetch-BDZJVYlF.js"), "./commands/pwd.ts": () => import("./pwd-CSapfDtw.js"), "./commands/reboot.ts": () => import("./reboot-Bwxhoa8q.js"), "./commands/reload.ts": () => import("./reload-C-07Q8ce.js"), "./commands/rev.ts": () => import("./rev-C8qQIyj_.js"), "./commands/rm.ts": () => import("./rm-CenNYCS_.js"), "./commands/rmdir.ts": () => import("./rmdir-7-udpooP.js"), "./commands/sl.ts": () => import("./sl-B5Yqxs1W.js"), "./commands/touch.ts": () => import("./touch-BcjKUZ_T.js"), "./commands/uptime.ts": () => import("./uptime-BYmCcOUM.js"), "./commands/whatis.ts": () => import("./whatis-DLaPchWe.js"), "./commands/whoami.ts": () => import("./whoami-CQNGmqxL.js") }), Ce = () => {
|
|
686
|
+
G = [];
|
|
687
|
+
for (const e in we)
|
|
688
|
+
we[e]().then((t) => {
|
|
689
|
+
const n = Object.keys(t)[0], s = t[n];
|
|
690
|
+
s.setName(n.toLowerCase()), G.push(s);
|
|
691
|
+
});
|
|
692
|
+
};
|
|
693
|
+
Ce();
|
|
694
|
+
const B = class B {
|
|
695
|
+
static find(t) {
|
|
696
|
+
let n = null;
|
|
697
|
+
return this.COMMANDS.forEach((s) => {
|
|
698
|
+
if (s.name === t) {
|
|
699
|
+
n = s;
|
|
700
|
+
return;
|
|
701
|
+
}
|
|
702
|
+
}), n;
|
|
703
|
+
}
|
|
704
|
+
static search(t) {
|
|
705
|
+
return this.COMMANDS.filter((s) => {
|
|
706
|
+
var f;
|
|
707
|
+
return (f = s.name) == null ? void 0 : f.match(t);
|
|
708
|
+
});
|
|
709
|
+
}
|
|
710
|
+
static reload() {
|
|
711
|
+
Ce(), B.COMMANDS = G;
|
|
712
|
+
}
|
|
713
|
+
};
|
|
714
|
+
W(B, "COMMANDS", G);
|
|
715
|
+
let ee = B;
|
|
716
|
+
function lt({ app: e, path: t, input: n, setTitle: s, close: f, active: y, focus: i }) {
|
|
717
|
+
const u = He(), [c, o] = S(0), [r, d] = S(n ?? ""), [a, v] = S([{
|
|
718
|
+
text: e ? ye.replace("$APP_NAME", e.name) : ye,
|
|
719
|
+
isInput: !1
|
|
720
|
+
}]), k = Re(), [g, E] = S(k == null ? void 0 : k.navigate(t ?? "~")), $ = de(null), [M, D] = S(0), [T, K] = S(null), [X, ne] = S(null), H = de(null), [re, ie] = S(!1), Ee = je();
|
|
721
|
+
q(() => {
|
|
722
|
+
g != null && (s == null || s(`${U}@${Y}: ${g.root ? "/" : g.path}`));
|
|
723
|
+
}, [g == null ? void 0 : g.path, g == null ? void 0 : g.root, s]), q(() => {
|
|
724
|
+
!$.current || !y || $.current.focus();
|
|
725
|
+
}, [$, y]);
|
|
726
|
+
const ae = () => {
|
|
727
|
+
H.current.scrollTop = H.current.scrollHeight;
|
|
728
|
+
};
|
|
729
|
+
q(() => {
|
|
730
|
+
re || H.current == null || X == null || (ae(), ie(!0));
|
|
731
|
+
}, [re, X, H]), q(() => {
|
|
732
|
+
H.current == null || T != null || ae();
|
|
733
|
+
}, [r]);
|
|
734
|
+
const oe = `${b.fg.cyan + U}@${Y + b.reset}:${b.fg.blue + (g != null && g.root || g == null ? "/" : g == null ? void 0 : g.path) + b.reset}$ `, le = a, Q = (l) => {
|
|
735
|
+
le.push(l), v(le);
|
|
736
|
+
}, J = (l) => {
|
|
737
|
+
Q({
|
|
738
|
+
text: l,
|
|
739
|
+
isInput: !1
|
|
740
|
+
});
|
|
741
|
+
}, $e = (l, p) => {
|
|
742
|
+
K(l), ie(!1);
|
|
743
|
+
const h = (_) => {
|
|
744
|
+
y && (_.ctrlKey || _.metaKey) && _.key === "c" && l.stop();
|
|
745
|
+
};
|
|
746
|
+
let m = null;
|
|
747
|
+
l.on(P.EVENT_NAMES.new, (_) => {
|
|
748
|
+
(async () => {
|
|
749
|
+
let w = _;
|
|
750
|
+
for (const I of p)
|
|
751
|
+
w instanceof P || (w = await ce(w ? `${I} ${w}` : I));
|
|
752
|
+
if (w instanceof P) {
|
|
753
|
+
l.stop(), J(b.fg.red + "Stream failed");
|
|
754
|
+
return;
|
|
755
|
+
}
|
|
756
|
+
m = w, ne(w);
|
|
757
|
+
})();
|
|
758
|
+
}), l.on(P.EVENT_NAMES.stop, () => {
|
|
759
|
+
document.removeEventListener("keydown", h), J(m), K(null), ne(null);
|
|
760
|
+
}), document.addEventListener("keydown", h);
|
|
761
|
+
}, ce = async (l) => {
|
|
762
|
+
var ge;
|
|
763
|
+
const p = l.indexOf(" ") + 1, h = p <= 0 ? "" : l.substr(p), m = Date.now();
|
|
764
|
+
if (l = l.trim(), l === "") return;
|
|
765
|
+
const _ = l.match(/(?:[^\s"]+|"[^"]*")+/g);
|
|
766
|
+
if (_ == null) return;
|
|
767
|
+
_[0].toLowerCase() === "sudo" && _.length >= 2 && _.shift();
|
|
768
|
+
const w = (ge = _.shift()) == null ? void 0 : ge.toLowerCase();
|
|
769
|
+
if (w == null) return;
|
|
770
|
+
const I = ee.find(w);
|
|
771
|
+
if (!I) return F(w, "Command not found");
|
|
772
|
+
const R = [], fe = {};
|
|
773
|
+
if (_.filter((O) => O.startsWith("-")).forEach((O) => {
|
|
774
|
+
const he = (x) => {
|
|
775
|
+
if (R.includes(x))
|
|
776
|
+
return;
|
|
777
|
+
R.push(x);
|
|
778
|
+
const j = I.getOption(R[R.length - 1]);
|
|
779
|
+
if (j != null && j.isInput) {
|
|
780
|
+
const me = _[_.indexOf(O) + 1];
|
|
781
|
+
fe[j.short] = me, pe(me, _);
|
|
782
|
+
}
|
|
783
|
+
};
|
|
784
|
+
if (O.startsWith("--")) {
|
|
785
|
+
const x = O.substring(2).toLowerCase();
|
|
786
|
+
he(x);
|
|
787
|
+
} else
|
|
788
|
+
O.substring(1).split("").forEach((j) => {
|
|
789
|
+
he(j);
|
|
790
|
+
});
|
|
791
|
+
pe(O, _);
|
|
792
|
+
}), I.requireArgs && _.length === 0)
|
|
793
|
+
return F(w, `Incorrect usage: ${w} requires at least 1 argument`);
|
|
794
|
+
if (I.requireOptions && R.length === 0)
|
|
795
|
+
return F(w, `Incorrect usage: ${w} requires at least 1 option`);
|
|
796
|
+
let V = null;
|
|
797
|
+
try {
|
|
798
|
+
if (V = await I.execute(_, {
|
|
799
|
+
promptOutput: J,
|
|
800
|
+
pushHistory: Q,
|
|
801
|
+
virtualRoot: k,
|
|
802
|
+
currentDirectory: g,
|
|
803
|
+
setCurrentDirectory: E,
|
|
804
|
+
username: U,
|
|
805
|
+
hostname: Y,
|
|
806
|
+
rawInputValue: h,
|
|
807
|
+
options: R,
|
|
808
|
+
exit: f,
|
|
809
|
+
inputs: fe,
|
|
810
|
+
timestamp: m,
|
|
811
|
+
settingsManager: Ee,
|
|
812
|
+
systemManager: u,
|
|
813
|
+
app: e
|
|
814
|
+
}), V == null)
|
|
815
|
+
return F(w, "Command failed");
|
|
816
|
+
if (!V.blank)
|
|
817
|
+
return V;
|
|
818
|
+
} catch (O) {
|
|
819
|
+
return console.error(O), F(w, "Command failed");
|
|
820
|
+
}
|
|
821
|
+
}, Oe = () => {
|
|
822
|
+
d(""), D(0);
|
|
823
|
+
}, Se = async (l) => {
|
|
824
|
+
Q({
|
|
825
|
+
text: oe + l,
|
|
826
|
+
isInput: !0,
|
|
827
|
+
value: l
|
|
828
|
+
});
|
|
829
|
+
let p = l.split(" | ");
|
|
830
|
+
const h = [];
|
|
831
|
+
let m = null;
|
|
832
|
+
for (const _ of p)
|
|
833
|
+
m instanceof P || (m = await ce(m ? `${_} ${m}` : _), h.push(_));
|
|
834
|
+
Oe(), p = p.filter((_) => !h.includes(_)), m && (m instanceof P ? $e(m, p) : J(`${m}
|
|
835
|
+
`));
|
|
836
|
+
}, ue = (l) => {
|
|
837
|
+
const p = a.filter(({ isInput: m }) => m), h = xe(M + l, 0, p.length);
|
|
838
|
+
if (h === M) {
|
|
839
|
+
l < 0 && d("");
|
|
840
|
+
return;
|
|
841
|
+
}
|
|
842
|
+
d(h === 0 ? "" : p[p.length - h].value ?? ""), D(h);
|
|
843
|
+
}, Te = (l) => {
|
|
844
|
+
const p = l.target.value, { key: h } = l;
|
|
845
|
+
h === "Enter" ? (Se(p), o((m) => m + 1)) : h === "ArrowUp" ? (l.preventDefault(), ue(1)) : h === "ArrowDown" ? (l.preventDefault(), ue(-1)) : !T && (l.ctrlKey || l.metaKey) && h === "c" && d((m) => m + "^C");
|
|
846
|
+
}, Ie = (l) => {
|
|
847
|
+
const p = l.target.value;
|
|
848
|
+
return d(p);
|
|
849
|
+
}, Ae = () => {
|
|
850
|
+
const l = a.slice(-16);
|
|
851
|
+
let p = 0;
|
|
852
|
+
return l.forEach((h, m) => {
|
|
853
|
+
h.clear && (p = m + 1);
|
|
854
|
+
}), l.slice(p).map(({ text: h }, m) => /* @__PURE__ */ L(ve, { text: h }, m));
|
|
855
|
+
}, Le = (l) => {
|
|
856
|
+
var p, h;
|
|
857
|
+
i == null || i(l), l.button === 2 && (l.preventDefault(), (h = (p = navigator.clipboard).readText) == null || h.call(p).then((m) => {
|
|
858
|
+
d(r + m);
|
|
859
|
+
}).catch((m) => {
|
|
860
|
+
console.error(m);
|
|
861
|
+
}));
|
|
862
|
+
}, Ne = (l) => {
|
|
863
|
+
l.preventDefault();
|
|
864
|
+
};
|
|
865
|
+
return /* @__PURE__ */ Z(
|
|
866
|
+
"div",
|
|
867
|
+
{
|
|
868
|
+
ref: H,
|
|
869
|
+
className: N.Terminal,
|
|
870
|
+
onMouseDown: Le,
|
|
871
|
+
onContextMenu: Ne,
|
|
872
|
+
onClick: (l) => {
|
|
873
|
+
var p, h;
|
|
874
|
+
((p = window.getSelection()) == null ? void 0 : p.toString()) === "" && (l.preventDefault(), (h = $.current) == null || h.focus());
|
|
875
|
+
},
|
|
876
|
+
children: [
|
|
877
|
+
Ae(),
|
|
878
|
+
T ? /* @__PURE__ */ L(ve, { text: X ?? "" }) : /* @__PURE__ */ L(
|
|
879
|
+
at,
|
|
880
|
+
{
|
|
881
|
+
value: r,
|
|
882
|
+
prefix: oe,
|
|
883
|
+
onKeyDown: Te,
|
|
884
|
+
onChange: Ie,
|
|
885
|
+
inputRef: $
|
|
886
|
+
},
|
|
887
|
+
c
|
|
888
|
+
)
|
|
889
|
+
]
|
|
890
|
+
}
|
|
891
|
+
);
|
|
892
|
+
}
|
|
893
|
+
const dt = new Fe("Terminal", "terminal", lt).setIconUrl("https://os.prozilla.dev/assets/apps/icons/terminal.svg");
|
|
894
|
+
export {
|
|
895
|
+
C as A,
|
|
896
|
+
ee as C,
|
|
897
|
+
ht as M,
|
|
898
|
+
P as S,
|
|
899
|
+
mt as a,
|
|
900
|
+
F as f,
|
|
901
|
+
pt as r,
|
|
902
|
+
dt as t
|
|
903
|
+
};
|
|
904
|
+
//# sourceMappingURL=main-B0XCFHus.js.map
|