@prozilla-os/terminal 1.1.21 → 1.1.24
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/main.d.ts +1602 -64
- package/dist/main.js +744 -7
- package/dist/main.js.map +1 -1
- package/package.json +9 -8
- package/dist/chunks/cat-DGK7wWrK.js +0 -16
- package/dist/chunks/cat-DGK7wWrK.js.map +0 -1
- package/dist/chunks/cd-DvjkW_6o.js +0 -15
- package/dist/chunks/cd-DvjkW_6o.js.map +0 -1
- package/dist/chunks/clear-BF9eb1Dq.js +0 -14
- package/dist/chunks/clear-BF9eb1Dq.js.map +0 -1
- package/dist/chunks/cmatrix-VYovsHQW.js +0 -59
- package/dist/chunks/cmatrix-VYovsHQW.js.map +0 -1
- package/dist/chunks/compgen-3TwdgHm_.js +0 -13
- package/dist/chunks/compgen-3TwdgHm_.js.map +0 -1
- package/dist/chunks/cowsay-IfArfPSJ.js +0 -49
- package/dist/chunks/cowsay-IfArfPSJ.js.map +0 -1
- package/dist/chunks/dir-B_Ipo5xb.js +0 -11
- package/dist/chunks/dir-B_Ipo5xb.js.map +0 -1
- package/dist/chunks/echo-DX-Ar2Ut.js +0 -11
- package/dist/chunks/echo-DX-Ar2Ut.js.map +0 -1
- package/dist/chunks/eval-C7InkmFY.js +0 -14
- package/dist/chunks/eval-C7InkmFY.js.map +0 -1
- package/dist/chunks/exit-D7PPqtiE.js +0 -11
- package/dist/chunks/exit-D7PPqtiE.js.map +0 -1
- package/dist/chunks/fortune-zyxpnYNP.js +0 -59
- package/dist/chunks/fortune-zyxpnYNP.js.map +0 -1
- package/dist/chunks/help-BEgNbwLL.js +0 -17
- package/dist/chunks/help-BEgNbwLL.js.map +0 -1
- package/dist/chunks/history-l0sNRNKZ.js +0 -2
- package/dist/chunks/history-l0sNRNKZ.js.map +0 -1
- package/dist/chunks/hostname-DU1lQde2.js +0 -11
- package/dist/chunks/hostname-DU1lQde2.js.map +0 -1
- package/dist/chunks/lolcat-5-mBWD9l.js +0 -35
- package/dist/chunks/lolcat-5-mBWD9l.js.map +0 -1
- package/dist/chunks/ls-DnkSPHVM.js +0 -18
- package/dist/chunks/ls-DnkSPHVM.js.map +0 -1
- package/dist/chunks/main-CXiltWT-.js +0 -957
- package/dist/chunks/main-CXiltWT-.js.map +0 -1
- package/dist/chunks/make-DqVQDThH.js +0 -9
- package/dist/chunks/make-DqVQDThH.js.map +0 -1
- package/dist/chunks/man-D_hBUTDt.js +0 -47
- package/dist/chunks/man-D_hBUTDt.js.map +0 -1
- package/dist/chunks/mkdir-BCvMrPTX.js +0 -11
- package/dist/chunks/mkdir-BCvMrPTX.js.map +0 -1
- package/dist/chunks/neofetch-BFHOITJj.js +0 -40
- package/dist/chunks/neofetch-BFHOITJj.js.map +0 -1
- package/dist/chunks/pwd-C21tQanw.js +0 -11
- package/dist/chunks/pwd-C21tQanw.js.map +0 -1
- package/dist/chunks/reboot-C2t7a3Av.js +0 -11
- package/dist/chunks/reboot-C2t7a3Av.js.map +0 -1
- package/dist/chunks/reload-C9o_dGZw.js +0 -10
- package/dist/chunks/reload-C9o_dGZw.js.map +0 -1
- package/dist/chunks/rev-CBibYebM.js +0 -11
- package/dist/chunks/rev-CBibYebM.js.map +0 -1
- package/dist/chunks/rm-ChTrwld4.js +0 -12
- package/dist/chunks/rm-ChTrwld4.js.map +0 -1
- package/dist/chunks/rmdir-CUM4xt2w.js +0 -11
- package/dist/chunks/rmdir-CUM4xt2w.js.map +0 -1
- package/dist/chunks/sl-DrATMkz6.js +0 -166
- package/dist/chunks/sl-DrATMkz6.js.map +0 -1
- package/dist/chunks/touch-CqBIAjMe.js +0 -19
- package/dist/chunks/touch-CqBIAjMe.js.map +0 -1
- package/dist/chunks/uptime-xM-0FRzA.js +0 -11
- package/dist/chunks/uptime-xM-0FRzA.js.map +0 -1
- package/dist/chunks/whatis-vXemLo9m.js +0 -13
- package/dist/chunks/whatis-vXemLo9m.js.map +0 -1
- package/dist/chunks/whoami-CnUR69yX.js +0 -11
- package/dist/chunks/whoami-CnUR69yX.js.map +0 -1
package/dist/main.js
CHANGED
|
@@ -1,10 +1,747 @@
|
|
|
1
|
-
(function(){"use strict";try{if(typeof document<"u"){var
|
|
2
|
-
import {
|
|
1
|
+
(function(){"use strict";try{if(typeof document<"u"){var e=document.createElement("style");e.appendChild(document.createTextNode('._Terminal_cqg7e_1{--char-width: .585rem;display:flex;flex-direction:column;align-items:flex-start;padding:.5rem;overflow:auto;height:100%;cursor:text}._Terminal_cqg7e_1 *{font-family:var(--mono-font-family);letter-spacing:-.03em}._Terminal_cqg7e_1 p,._Terminal_cqg7e_1 pre{margin:0;height:1.25rem;line-height:inherit;font-size:inherit;letter-spacing:inherit}._Prefix_cqg7e_26{display:flex;width:max-content;white-space:nowrap}._Input_cqg7e_32,._Output_cqg7e_32{display:flex;flex-direction:row;align-items:center;width:100%;line-height:1.25rem;font-size:1rem;text-align:start;white-space:pre}._Input_cqg7e_32{height:1.25rem}._Input-container_cqg7e_47{--cursor-width: var(--char-width);--cursor-offset: 0;position:relative;height:100%;width:fit-content}._Input-container_cqg7e_47:after{content:"";position:absolute;top:0;left:calc(var(--cursor-offset) * var(--char-width) * .9746124950079872);width:var(--cursor-width);height:100%;background-color:var(--foreground-color-0);animation:_blink_cqg7e_1 1s step-end infinite}._Input-container_cqg7e_47 input{color:transparent;position:absolute;left:0;width:100%;padding:0;background:none;border:none;outline:none;font-size:inherit;caret-color:transparent}@keyframes _blink_cqg7e_1{0%,to{background-color:transparent}50%{background-color:var(--foreground-color-0)}}._Input_cqg7e_32 label{position:absolute;width:100%;height:100%;top:0;left:0;cursor:text}._ansi-black-fg_cqg7e_99{color:var(--black-2)}._ansi-red-fg_cqg7e_100{color:var(--red-0)}._ansi-green-fg_cqg7e_101{color:var(--green-0)}._ansi-yellow-fg_cqg7e_102{color:var(--yellow-0)}._ansi-blue-fg_cqg7e_103{color:var(--blue-0)}._ansi-magenta-fg_cqg7e_104{color:var(--purple-0)}._ansi-cyan-fg_cqg7e_105{color:var(--cyan-0)}._ansi-white-fg_cqg7e_106{color:var(--foreground-color-0)}._ansi-bright-black-fg_cqg7e_108{color:var(--black-2)}._ansi-bright-red-fg_cqg7e_109{color:var(--red-0)}._ansi-bright-green-fg_cqg7e_110{color:var(--green-0)}._ansi-bright-yellow-fg_cqg7e_111{color:var(--yellow-0)}._ansi-bright-blue-fg_cqg7e_112{color:var(--blue-0)}._ansi-bright-magenta-fg_cqg7e_113{color:var(--purple-0)}._ansi-bright-cyan-fg_cqg7e_114{color:var(--cyan-0)}._ansi-bright-white-fg_cqg7e_115{color:var(--foreground-color-0)}._ansi-black-bg_cqg7e_117{background-color:var(--black-2)}._ansi-red-bg_cqg7e_118{background-color:var(--red-0)}._ansi-green-bg_cqg7e_119{background-color:var(--green-0)}._ansi-yellow-bg_cqg7e_120{background-color:var(--yellow-0)}._ansi-blue-bg_cqg7e_121{background-color:var(--blue-0)}._ansi-magenta-bg_cqg7e_122{background-color:var(--purple-0)}._ansi-cyan-bg_cqg7e_123{background-color:var(--cyan-0)}._ansi-white-bg_cqg7e_124{background-color:var(--foreground-color-0)}._ansi-dim_cqg7e_126{opacity:.65}')),document.head.appendChild(e)}}catch(r){console.error("vite-plugin-css-injected-by-js",r)}})();
|
|
2
|
+
import { useShell as M, USERNAME as z, HOSTNAME as B, App as J, AppsConfig as K, CommandsManager as U } from "@prozilla-os/core";
|
|
3
|
+
import { jsx as k, jsxs as I, Fragment as W } from "react/jsx-runtime";
|
|
4
|
+
import * as L from "react";
|
|
5
|
+
import { forwardRef as Z, useState as $, useRef as R, useLayoutEffect as V, useEffect as E } from "react";
|
|
6
|
+
import { Vector2 as G } from "@prozilla-os/shared";
|
|
7
|
+
const Q = "_Terminal_cqg7e_1", X = "_Prefix_cqg7e_26", Y = "_Input_cqg7e_32", ee = "_Output_cqg7e_32", te = "_blink_cqg7e_1", C = {
|
|
8
|
+
Terminal: Q,
|
|
9
|
+
Prefix: X,
|
|
10
|
+
Input: Y,
|
|
11
|
+
Output: ee,
|
|
12
|
+
"Input-container": "_Input-container_cqg7e_47",
|
|
13
|
+
blink: te,
|
|
14
|
+
"ansi-black-fg": "_ansi-black-fg_cqg7e_99",
|
|
15
|
+
"ansi-red-fg": "_ansi-red-fg_cqg7e_100",
|
|
16
|
+
"ansi-green-fg": "_ansi-green-fg_cqg7e_101",
|
|
17
|
+
"ansi-yellow-fg": "_ansi-yellow-fg_cqg7e_102",
|
|
18
|
+
"ansi-blue-fg": "_ansi-blue-fg_cqg7e_103",
|
|
19
|
+
"ansi-magenta-fg": "_ansi-magenta-fg_cqg7e_104",
|
|
20
|
+
"ansi-cyan-fg": "_ansi-cyan-fg_cqg7e_105",
|
|
21
|
+
"ansi-white-fg": "_ansi-white-fg_cqg7e_106",
|
|
22
|
+
"ansi-bright-black-fg": "_ansi-bright-black-fg_cqg7e_108",
|
|
23
|
+
"ansi-bright-red-fg": "_ansi-bright-red-fg_cqg7e_109",
|
|
24
|
+
"ansi-bright-green-fg": "_ansi-bright-green-fg_cqg7e_110",
|
|
25
|
+
"ansi-bright-yellow-fg": "_ansi-bright-yellow-fg_cqg7e_111",
|
|
26
|
+
"ansi-bright-blue-fg": "_ansi-bright-blue-fg_cqg7e_112",
|
|
27
|
+
"ansi-bright-magenta-fg": "_ansi-bright-magenta-fg_cqg7e_113",
|
|
28
|
+
"ansi-bright-cyan-fg": "_ansi-bright-cyan-fg_cqg7e_114",
|
|
29
|
+
"ansi-bright-white-fg": "_ansi-bright-white-fg_cqg7e_115",
|
|
30
|
+
"ansi-black-bg": "_ansi-black-bg_cqg7e_117",
|
|
31
|
+
"ansi-red-bg": "_ansi-red-bg_cqg7e_118",
|
|
32
|
+
"ansi-green-bg": "_ansi-green-bg_cqg7e_119",
|
|
33
|
+
"ansi-yellow-bg": "_ansi-yellow-bg_cqg7e_120",
|
|
34
|
+
"ansi-blue-bg": "_ansi-blue-bg_cqg7e_121",
|
|
35
|
+
"ansi-magenta-bg": "_ansi-magenta-bg_cqg7e_122",
|
|
36
|
+
"ansi-cyan-bg": "_ansi-cyan-bg_cqg7e_123",
|
|
37
|
+
"ansi-white-bg": "_ansi-white-bg_cqg7e_124",
|
|
38
|
+
"ansi-dim": "_ansi-dim_cqg7e_126"
|
|
39
|
+
};
|
|
40
|
+
function re(s) {
|
|
41
|
+
return s && s.__esModule && Object.prototype.hasOwnProperty.call(s, "default") ? s.default : s;
|
|
42
|
+
}
|
|
43
|
+
var P, j;
|
|
44
|
+
function ne() {
|
|
45
|
+
if (j) return P;
|
|
46
|
+
j = 1;
|
|
47
|
+
const s = [
|
|
48
|
+
[
|
|
49
|
+
{ color: "0, 0, 0", class: "ansi-black" },
|
|
50
|
+
{ color: "187, 0, 0", class: "ansi-red" },
|
|
51
|
+
{ color: "0, 187, 0", class: "ansi-green" },
|
|
52
|
+
{ color: "187, 187, 0", class: "ansi-yellow" },
|
|
53
|
+
{ color: "0, 0, 187", class: "ansi-blue" },
|
|
54
|
+
{ color: "187, 0, 187", class: "ansi-magenta" },
|
|
55
|
+
{ color: "0, 187, 187", class: "ansi-cyan" },
|
|
56
|
+
{ color: "255,255,255", class: "ansi-white" }
|
|
57
|
+
],
|
|
58
|
+
[
|
|
59
|
+
{ color: "85, 85, 85", class: "ansi-bright-black" },
|
|
60
|
+
{ color: "255, 85, 85", class: "ansi-bright-red" },
|
|
61
|
+
{ color: "0, 255, 0", class: "ansi-bright-green" },
|
|
62
|
+
{ color: "255, 255, 85", class: "ansi-bright-yellow" },
|
|
63
|
+
{ color: "85, 85, 255", class: "ansi-bright-blue" },
|
|
64
|
+
{ color: "255, 85, 255", class: "ansi-bright-magenta" },
|
|
65
|
+
{ color: "85, 255, 255", class: "ansi-bright-cyan" },
|
|
66
|
+
{ color: "255, 255, 255", class: "ansi-bright-white" }
|
|
67
|
+
]
|
|
68
|
+
], o = /(https?:\/\/(?:[A-Za-z0-9#;/?:@=+$',_.!~*()[\]-]|&|%[A-Fa-f0-9]{2})+)/gm;
|
|
69
|
+
class g {
|
|
70
|
+
/**
|
|
71
|
+
* Anser.escapeForHtml
|
|
72
|
+
* Escape the input HTML.
|
|
73
|
+
*
|
|
74
|
+
* This does the minimum escaping of text to make it compliant with HTML.
|
|
75
|
+
* In particular, the '&','<', and '>' characters are escaped. This should
|
|
76
|
+
* be run prior to `ansiToHtml`.
|
|
77
|
+
*
|
|
78
|
+
* @name Anser.escapeForHtml
|
|
79
|
+
* @function
|
|
80
|
+
* @param {String} txt The input text (containing the ANSI snippets).
|
|
81
|
+
* @returns {String} The escaped html.
|
|
82
|
+
*/
|
|
83
|
+
static escapeForHtml(r) {
|
|
84
|
+
return new g().escapeForHtml(r);
|
|
85
|
+
}
|
|
86
|
+
/**
|
|
87
|
+
* Anser.linkify
|
|
88
|
+
* Adds the links in the HTML.
|
|
89
|
+
*
|
|
90
|
+
* This replaces any links in the text with anchor tags that display the
|
|
91
|
+
* link. You should apply this after you have run `ansiToHtml` on the text.
|
|
92
|
+
*
|
|
93
|
+
* @name Anser.linkify
|
|
94
|
+
* @function
|
|
95
|
+
* @param {String} txt The input text.
|
|
96
|
+
* @returns {String} The HTML containing the <a> tags (unescaped).
|
|
97
|
+
*/
|
|
98
|
+
static linkify(r) {
|
|
99
|
+
return new g().linkify(r);
|
|
100
|
+
}
|
|
101
|
+
/**
|
|
102
|
+
* Anser.ansiToHtml
|
|
103
|
+
* This replaces ANSI terminal escape codes with SPAN tags that wrap the
|
|
104
|
+
* content.
|
|
105
|
+
*
|
|
106
|
+
* This function only interprets ANSI SGR (Select Graphic Rendition) codes
|
|
107
|
+
* that can be represented in HTML.
|
|
108
|
+
* For example, cursor movement codes are ignored and hidden from output.
|
|
109
|
+
* The default style uses colors that are very close to the prescribed
|
|
110
|
+
* standard. The standard assumes that the text will have a black
|
|
111
|
+
* background. These colors are set as inline styles on the SPAN tags.
|
|
112
|
+
*
|
|
113
|
+
* Another option is to set `use_classes: true` in the options argument.
|
|
114
|
+
* This will instead set classes on the spans so the colors can be set via
|
|
115
|
+
* CSS. The class names used are of the format `ansi-*-fg/bg` and
|
|
116
|
+
* `ansi-bright-*-fg/bg` where `*` is the color name,
|
|
117
|
+
* i.e black/red/green/yellow/blue/magenta/cyan/white.
|
|
118
|
+
*
|
|
119
|
+
* @name Anser.ansiToHtml
|
|
120
|
+
* @function
|
|
121
|
+
* @param {String} txt The input text.
|
|
122
|
+
* @param {Object} options The options passed to the ansiToHTML method.
|
|
123
|
+
* @returns {String} The HTML output.
|
|
124
|
+
*/
|
|
125
|
+
static ansiToHtml(r, t) {
|
|
126
|
+
return new g().ansiToHtml(r, t);
|
|
127
|
+
}
|
|
128
|
+
/**
|
|
129
|
+
* Anser.ansiToJson
|
|
130
|
+
* Converts ANSI input into JSON output.
|
|
131
|
+
*
|
|
132
|
+
* @name Anser.ansiToJson
|
|
133
|
+
* @function
|
|
134
|
+
* @param {String} txt The input text.
|
|
135
|
+
* @param {Object} options The options passed to the ansiToHTML method.
|
|
136
|
+
* @returns {String} The HTML output.
|
|
137
|
+
*/
|
|
138
|
+
static ansiToJson(r, t) {
|
|
139
|
+
return new g().ansiToJson(r, t);
|
|
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
|
+
static ansiToText(r) {
|
|
151
|
+
return new g().ansiToText(r);
|
|
152
|
+
}
|
|
153
|
+
/**
|
|
154
|
+
* Anser
|
|
155
|
+
* The `Anser` class.
|
|
156
|
+
*
|
|
157
|
+
* @name Anser
|
|
158
|
+
* @function
|
|
159
|
+
* @returns {Anser}
|
|
160
|
+
*/
|
|
161
|
+
constructor() {
|
|
162
|
+
this.fg = this.bg = this.fg_truecolor = this.bg_truecolor = null, this.bright = 0, this.decorations = [];
|
|
163
|
+
}
|
|
164
|
+
/**
|
|
165
|
+
* setupPalette
|
|
166
|
+
* Sets up the palette.
|
|
167
|
+
*
|
|
168
|
+
* @name setupPalette
|
|
169
|
+
* @function
|
|
170
|
+
*/
|
|
171
|
+
setupPalette() {
|
|
172
|
+
this.PALETTE_COLORS = [];
|
|
173
|
+
for (let e = 0; e < 2; ++e)
|
|
174
|
+
for (let l = 0; l < 8; ++l)
|
|
175
|
+
this.PALETTE_COLORS.push(s[e][l].color);
|
|
176
|
+
let r = [0, 95, 135, 175, 215, 255], t = (e, l, a) => r[e] + ", " + r[l] + ", " + r[a];
|
|
177
|
+
for (let e = 0; e < 6; ++e)
|
|
178
|
+
for (let l = 0; l < 6; ++l)
|
|
179
|
+
for (let a = 0; a < 6; ++a)
|
|
180
|
+
this.PALETTE_COLORS.push(t(e, l, a));
|
|
181
|
+
let h = 8;
|
|
182
|
+
for (let e = 0; e < 24; ++e, h += 10)
|
|
183
|
+
this.PALETTE_COLORS.push(h + ", " + h + ", " + h);
|
|
184
|
+
}
|
|
185
|
+
/**
|
|
186
|
+
* escapeForHtml
|
|
187
|
+
* Escapes the input text.
|
|
188
|
+
*
|
|
189
|
+
* @name escapeForHtml
|
|
190
|
+
* @function
|
|
191
|
+
* @param {String} txt The input text.
|
|
192
|
+
* @returns {String} The escpaed HTML output.
|
|
193
|
+
*/
|
|
194
|
+
escapeForHtml(r) {
|
|
195
|
+
return r.replace(
|
|
196
|
+
/[&<>\"]/gm,
|
|
197
|
+
(t) => t == "&" ? "&" : t == '"' ? """ : t == "<" ? "<" : t == ">" ? ">" : ""
|
|
198
|
+
);
|
|
199
|
+
}
|
|
200
|
+
/**
|
|
201
|
+
* linkify
|
|
202
|
+
* Adds HTML link elements.
|
|
203
|
+
*
|
|
204
|
+
* @name linkify
|
|
205
|
+
* @function
|
|
206
|
+
* @param {String} txt The input text.
|
|
207
|
+
* @returns {String} The HTML output containing link elements.
|
|
208
|
+
*/
|
|
209
|
+
linkify(r) {
|
|
210
|
+
return r.replace(o, (t) => `<a href="${t}">${t}</a>`);
|
|
211
|
+
}
|
|
212
|
+
/**
|
|
213
|
+
* ansiToHtml
|
|
214
|
+
* Converts ANSI input into HTML output.
|
|
215
|
+
*
|
|
216
|
+
* @name ansiToHtml
|
|
217
|
+
* @function
|
|
218
|
+
* @param {String} txt The input text.
|
|
219
|
+
* @param {Object} options The options passed ot the `process` method.
|
|
220
|
+
* @returns {String} The HTML output.
|
|
221
|
+
*/
|
|
222
|
+
ansiToHtml(r, t) {
|
|
223
|
+
return this.process(r, t, !0);
|
|
224
|
+
}
|
|
225
|
+
/**
|
|
226
|
+
* ansiToJson
|
|
227
|
+
* Converts ANSI input into HTML output.
|
|
228
|
+
*
|
|
229
|
+
* @name ansiToJson
|
|
230
|
+
* @function
|
|
231
|
+
* @param {String} txt The input text.
|
|
232
|
+
* @param {Object} options The options passed ot the `process` method.
|
|
233
|
+
* @returns {String} The JSON output.
|
|
234
|
+
*/
|
|
235
|
+
ansiToJson(r, t) {
|
|
236
|
+
return t = t || {}, t.json = !0, t.clearLine = !1, this.process(r, t, !0);
|
|
237
|
+
}
|
|
238
|
+
/**
|
|
239
|
+
* ansiToText
|
|
240
|
+
* Converts ANSI input into HTML output.
|
|
241
|
+
*
|
|
242
|
+
* @name ansiToText
|
|
243
|
+
* @function
|
|
244
|
+
* @param {String} txt The input text.
|
|
245
|
+
* @returns {String} The text output.
|
|
246
|
+
*/
|
|
247
|
+
ansiToText(r) {
|
|
248
|
+
return this.process(r, {}, !1);
|
|
249
|
+
}
|
|
250
|
+
/**
|
|
251
|
+
* process
|
|
252
|
+
* Processes the input.
|
|
253
|
+
*
|
|
254
|
+
* @name process
|
|
255
|
+
* @function
|
|
256
|
+
* @param {String} txt The input text.
|
|
257
|
+
* @param {Object} options An object passed to `processChunk` method, extended with:
|
|
258
|
+
*
|
|
259
|
+
* - `json` (Boolean): If `true`, the result will be an object.
|
|
260
|
+
* - `use_classes` (Boolean): If `true`, HTML classes will be appended to the HTML output.
|
|
261
|
+
*
|
|
262
|
+
* @param {Boolean} markup
|
|
263
|
+
*/
|
|
264
|
+
process(r, t, h) {
|
|
265
|
+
let e = this, l = r.split(/\033\[/), a = l.shift();
|
|
266
|
+
t == null && (t = {}), t.clearLine = /\r/.test(r);
|
|
267
|
+
let c = l.map((p) => this.processChunk(p, t, h));
|
|
268
|
+
if (t && t.json) {
|
|
269
|
+
let p = e.processChunkJson("");
|
|
270
|
+
return p.content = a, p.clearLine = t.clearLine, c.unshift(p), t.remove_empty && (c = c.filter((n) => !n.isEmpty())), c;
|
|
271
|
+
} else
|
|
272
|
+
c.unshift(a);
|
|
273
|
+
return c.join("");
|
|
274
|
+
}
|
|
275
|
+
/**
|
|
276
|
+
* processChunkJson
|
|
277
|
+
* Processes the current chunk into json output.
|
|
278
|
+
*
|
|
279
|
+
* @name processChunkJson
|
|
280
|
+
* @function
|
|
281
|
+
* @param {String} text The input text.
|
|
282
|
+
* @param {Object} options An object containing the following fields:
|
|
283
|
+
*
|
|
284
|
+
* - `json` (Boolean): If `true`, the result will be an object.
|
|
285
|
+
* - `use_classes` (Boolean): If `true`, HTML classes will be appended to the HTML output.
|
|
286
|
+
*
|
|
287
|
+
* @param {Boolean} markup If false, the colors will not be parsed.
|
|
288
|
+
* @return {Object} The result object:
|
|
289
|
+
*
|
|
290
|
+
* - `content` (String): The text.
|
|
291
|
+
* - `fg` (String|null): The foreground color.
|
|
292
|
+
* - `bg` (String|null): The background color.
|
|
293
|
+
* - `fg_truecolor` (String|null): The foreground true color (if 16m color is enabled).
|
|
294
|
+
* - `bg_truecolor` (String|null): The background true color (if 16m color is enabled).
|
|
295
|
+
* - `clearLine` (Boolean): `true` if a carriageReturn \r was fount at end of line.
|
|
296
|
+
* - `was_processed` (Bolean): `true` if the colors were processed, `false` otherwise.
|
|
297
|
+
* - `isEmpty` (Function): A function returning `true` if the content is empty, or `false` otherwise.
|
|
298
|
+
*
|
|
299
|
+
*/
|
|
300
|
+
processChunkJson(r, t, h) {
|
|
301
|
+
t = typeof t > "u" ? {} : t;
|
|
302
|
+
let e = t.use_classes = typeof t.use_classes < "u" && t.use_classes, l = t.key = e ? "class" : "color", a = {
|
|
303
|
+
content: r,
|
|
304
|
+
fg: null,
|
|
305
|
+
bg: null,
|
|
306
|
+
fg_truecolor: null,
|
|
307
|
+
bg_truecolor: null,
|
|
308
|
+
isInverted: !1,
|
|
309
|
+
clearLine: t.clearLine,
|
|
310
|
+
decoration: null,
|
|
311
|
+
decorations: [],
|
|
312
|
+
was_processed: !1,
|
|
313
|
+
isEmpty: () => !a.content
|
|
314
|
+
}, c = r.match(/^([!\x3c-\x3f]*)([\d;]*)([\x20-\x2c]*[\x40-\x7e])([\s\S]*)/m);
|
|
315
|
+
if (!c) return a;
|
|
316
|
+
a.content = c[4];
|
|
317
|
+
let p = c[2].split(";");
|
|
318
|
+
if (c[1] !== "" || c[3] !== "m" || !h)
|
|
319
|
+
return a;
|
|
320
|
+
let n = this;
|
|
321
|
+
for (; p.length > 0; ) {
|
|
322
|
+
let u = p.shift(), i = parseInt(u);
|
|
323
|
+
if (isNaN(i) || i === 0)
|
|
324
|
+
n.fg = n.bg = null, n.decorations = [];
|
|
325
|
+
else if (i === 1)
|
|
326
|
+
n.decorations.push("bold");
|
|
327
|
+
else if (i === 2)
|
|
328
|
+
n.decorations.push("dim");
|
|
329
|
+
else if (i === 3)
|
|
330
|
+
n.decorations.push("italic");
|
|
331
|
+
else if (i === 4)
|
|
332
|
+
n.decorations.push("underline");
|
|
333
|
+
else if (i === 5)
|
|
334
|
+
n.decorations.push("blink");
|
|
335
|
+
else if (i === 7)
|
|
336
|
+
n.decorations.push("reverse");
|
|
337
|
+
else if (i === 8)
|
|
338
|
+
n.decorations.push("hidden");
|
|
339
|
+
else if (i === 9)
|
|
340
|
+
n.decorations.push("strikethrough");
|
|
341
|
+
else if (i === 21)
|
|
342
|
+
n.removeDecoration("bold");
|
|
343
|
+
else if (i === 22)
|
|
344
|
+
n.removeDecoration("bold"), n.removeDecoration("dim");
|
|
345
|
+
else if (i === 23)
|
|
346
|
+
n.removeDecoration("italic");
|
|
347
|
+
else if (i === 24)
|
|
348
|
+
n.removeDecoration("underline");
|
|
349
|
+
else if (i === 25)
|
|
350
|
+
n.removeDecoration("blink");
|
|
351
|
+
else if (i === 27)
|
|
352
|
+
n.removeDecoration("reverse");
|
|
353
|
+
else if (i === 28)
|
|
354
|
+
n.removeDecoration("hidden");
|
|
355
|
+
else if (i === 29)
|
|
356
|
+
n.removeDecoration("strikethrough");
|
|
357
|
+
else if (i === 39)
|
|
358
|
+
n.fg = null;
|
|
359
|
+
else if (i === 49)
|
|
360
|
+
n.bg = null;
|
|
361
|
+
else if (i >= 30 && i < 38)
|
|
362
|
+
n.fg = s[0][i % 10][l];
|
|
363
|
+
else if (i >= 90 && i < 98)
|
|
364
|
+
n.fg = s[1][i % 10][l];
|
|
365
|
+
else if (i >= 40 && i < 48)
|
|
366
|
+
n.bg = s[0][i % 10][l];
|
|
367
|
+
else if (i >= 100 && i < 108)
|
|
368
|
+
n.bg = s[1][i % 10][l];
|
|
369
|
+
else if (i === 38 || i === 48) {
|
|
370
|
+
let m = i === 38;
|
|
371
|
+
if (p.length >= 1) {
|
|
372
|
+
let y = p.shift();
|
|
373
|
+
if (y === "5" && p.length >= 1) {
|
|
374
|
+
let b = parseInt(p.shift());
|
|
375
|
+
if (b >= 0 && b <= 255)
|
|
376
|
+
if (!e)
|
|
377
|
+
this.PALETTE_COLORS || n.setupPalette(), m ? n.fg = this.PALETTE_COLORS[b] : n.bg = this.PALETTE_COLORS[b];
|
|
378
|
+
else {
|
|
379
|
+
let v = b >= 16 ? "ansi-palette-" + b : s[b > 7 ? 1 : 0][b % 8].class;
|
|
380
|
+
m ? n.fg = v : n.bg = v;
|
|
381
|
+
}
|
|
382
|
+
} else if (y === "2" && p.length >= 3) {
|
|
383
|
+
let b = parseInt(p.shift()), v = parseInt(p.shift()), T = parseInt(p.shift());
|
|
384
|
+
if (b >= 0 && b <= 255 && v >= 0 && v <= 255 && T >= 0 && T <= 255) {
|
|
385
|
+
let f = b + ", " + v + ", " + T;
|
|
386
|
+
e ? m ? (n.fg = "ansi-truecolor", n.fg_truecolor = f) : (n.bg = "ansi-truecolor", n.bg_truecolor = f) : m ? n.fg = f : n.bg = f;
|
|
387
|
+
}
|
|
388
|
+
}
|
|
389
|
+
}
|
|
390
|
+
}
|
|
391
|
+
}
|
|
392
|
+
return n.fg === null && n.bg === null && n.decorations.length === 0 || (a.fg = n.fg, a.bg = n.bg, a.fg_truecolor = n.fg_truecolor, a.bg_truecolor = n.bg_truecolor, a.decorations = n.decorations, a.decoration = n.decorations.slice(-1).pop() || null, a.was_processed = !0), a;
|
|
393
|
+
}
|
|
394
|
+
/**
|
|
395
|
+
* processChunk
|
|
396
|
+
* Processes the current chunk of text.
|
|
397
|
+
*
|
|
398
|
+
* @name processChunk
|
|
399
|
+
* @function
|
|
400
|
+
* @param {String} text The input text.
|
|
401
|
+
* @param {Object} options An object containing the following fields:
|
|
402
|
+
*
|
|
403
|
+
* - `json` (Boolean): If `true`, the result will be an object.
|
|
404
|
+
* - `use_classes` (Boolean): If `true`, HTML classes will be appended to the HTML output.
|
|
405
|
+
*
|
|
406
|
+
* @param {Boolean} markup If false, the colors will not be parsed.
|
|
407
|
+
* @return {Object|String} The result (object if `json` is wanted back or string otherwise).
|
|
408
|
+
*/
|
|
409
|
+
processChunk(r, t, h) {
|
|
410
|
+
t = t || {};
|
|
411
|
+
let e = this.processChunkJson(r, t, h), l = t.use_classes;
|
|
412
|
+
if (e.decorations = e.decorations.filter((i) => {
|
|
413
|
+
if (i === "reverse") {
|
|
414
|
+
e.fg || (e.fg = s[0][7][l ? "class" : "color"]), e.bg || (e.bg = s[0][0][l ? "class" : "color"]);
|
|
415
|
+
let m = e.fg;
|
|
416
|
+
e.fg = e.bg, e.bg = m;
|
|
417
|
+
let y = e.fg_truecolor;
|
|
418
|
+
return e.fg_truecolor = e.bg_truecolor, e.bg_truecolor = y, e.isInverted = !0, !1;
|
|
419
|
+
}
|
|
420
|
+
return !0;
|
|
421
|
+
}), t.json)
|
|
422
|
+
return e;
|
|
423
|
+
if (e.isEmpty())
|
|
424
|
+
return "";
|
|
425
|
+
if (!e.was_processed)
|
|
426
|
+
return e.content;
|
|
427
|
+
let a = [], c = [], p = [], n = {}, u = (i) => {
|
|
428
|
+
let m = [], y;
|
|
429
|
+
for (y in i)
|
|
430
|
+
i.hasOwnProperty(y) && m.push("data-" + y + '="' + this.escapeForHtml(i[y]) + '"');
|
|
431
|
+
return m.length > 0 ? " " + m.join(" ") : "";
|
|
432
|
+
};
|
|
433
|
+
return e.isInverted && (n["ansi-is-inverted"] = "true"), e.fg && (l ? (a.push(e.fg + "-fg"), e.fg_truecolor !== null && (n["ansi-truecolor-fg"] = e.fg_truecolor, e.fg_truecolor = null)) : a.push("color:rgb(" + e.fg + ")")), e.bg && (l ? (a.push(e.bg + "-bg"), e.bg_truecolor !== null && (n["ansi-truecolor-bg"] = e.bg_truecolor, e.bg_truecolor = null)) : a.push("background-color:rgb(" + e.bg + ")")), e.decorations.forEach((i) => {
|
|
434
|
+
if (l) {
|
|
435
|
+
c.push("ansi-" + i);
|
|
436
|
+
return;
|
|
437
|
+
}
|
|
438
|
+
i === "bold" ? c.push("font-weight:bold") : i === "dim" ? c.push("opacity:0.5") : i === "italic" ? c.push("font-style:italic") : i === "hidden" ? c.push("visibility:hidden") : i === "strikethrough" ? p.push("line-through") : p.push(i);
|
|
439
|
+
}), p.length && c.push("text-decoration:" + p.join(" ")), l ? '<span class="' + a.concat(c).join(" ") + '"' + u(n) + ">" + e.content + "</span>" : '<span style="' + a.concat(c).join(";") + '"' + u(n) + ">" + e.content + "</span>";
|
|
440
|
+
}
|
|
441
|
+
removeDecoration(r) {
|
|
442
|
+
const t = this.decorations.indexOf(r);
|
|
443
|
+
t >= 0 && this.decorations.splice(t, 1);
|
|
444
|
+
}
|
|
445
|
+
}
|
|
446
|
+
return P = g, P;
|
|
447
|
+
}
|
|
448
|
+
var se = ne();
|
|
449
|
+
const ie = /* @__PURE__ */ re(se);
|
|
450
|
+
var q = { exports: {} }, N;
|
|
451
|
+
function le() {
|
|
452
|
+
if (N) return q.exports;
|
|
453
|
+
N = 1;
|
|
454
|
+
function s(r) {
|
|
455
|
+
if (!r) return "";
|
|
456
|
+
if (!/\r/.test(r)) return r;
|
|
457
|
+
for (r = r.replace(/\r+\n/gm, `
|
|
458
|
+
`); /\r./.test(r); )
|
|
459
|
+
r = r.replace(/^([^\r\n]*)\r+([^\r\n]+)/gm, function(t, h, e) {
|
|
460
|
+
return e + h.slice(e.length);
|
|
461
|
+
});
|
|
462
|
+
return r;
|
|
463
|
+
}
|
|
464
|
+
function o(r) {
|
|
465
|
+
for (var t = 0, h = 0; h < r.length; h++)
|
|
466
|
+
r[t].length <= r[h].length && (t = h);
|
|
467
|
+
return t;
|
|
468
|
+
}
|
|
469
|
+
function g(r) {
|
|
470
|
+
if (!/\r/.test(r)) return r;
|
|
471
|
+
for (var t = r.split("\r"), h = []; t.length > 0; ) {
|
|
472
|
+
var e = o(t);
|
|
473
|
+
h.push(t[e]), t = t.slice(e + 1);
|
|
474
|
+
}
|
|
475
|
+
return h.join("\r");
|
|
476
|
+
}
|
|
477
|
+
function d(r) {
|
|
478
|
+
if (!r) return "";
|
|
479
|
+
if (!/\r/.test(r)) return r;
|
|
480
|
+
if (!/\n/.test(r)) return g(r);
|
|
481
|
+
r = r.replace(/\r+\n/gm, `
|
|
482
|
+
`);
|
|
483
|
+
var t = r.lastIndexOf(`
|
|
484
|
+
`);
|
|
485
|
+
return s(r.slice(0, t)) + `
|
|
486
|
+
` + g(r.slice(t + 1));
|
|
487
|
+
}
|
|
488
|
+
return q.exports = s, q.exports.escapeCarriageReturn = s, q.exports.escapeCarriageReturnSafe = d, q.exports;
|
|
489
|
+
}
|
|
490
|
+
var oe = le();
|
|
491
|
+
function ae(s, o) {
|
|
492
|
+
return s = oe.escapeCarriageReturn(ge(s)), ie.ansiToJson(s, {
|
|
493
|
+
json: !0,
|
|
494
|
+
// eslint-disable-next-line @typescript-eslint/naming-convention
|
|
495
|
+
remove_empty: !0,
|
|
496
|
+
// eslint-disable-next-line @typescript-eslint/naming-convention
|
|
497
|
+
use_classes: o
|
|
498
|
+
});
|
|
499
|
+
}
|
|
500
|
+
function ce(s) {
|
|
501
|
+
const o = [];
|
|
502
|
+
return s.bg && o.push(C[`${s.bg}-bg`]), s.fg && o.push(C[`${s.fg}-fg`]), s.decoration && o.push(C[`ansi-${s.decoration}`]), o.length === 0 ? null : o.join(" ");
|
|
503
|
+
}
|
|
504
|
+
function ue(s) {
|
|
505
|
+
const o = {};
|
|
506
|
+
switch (s.bg && (o.backgroundColor = `rgb(${s.bg})`), s.fg && (o.color = `rgb(${s.fg})`), s.decoration) {
|
|
507
|
+
case "bold":
|
|
508
|
+
o.fontWeight = "bold";
|
|
509
|
+
break;
|
|
510
|
+
case "dim":
|
|
511
|
+
o.opacity = "0.5";
|
|
512
|
+
break;
|
|
513
|
+
case "italic":
|
|
514
|
+
o.fontStyle = "italic";
|
|
515
|
+
break;
|
|
516
|
+
case "hidden":
|
|
517
|
+
o.visibility = "hidden";
|
|
518
|
+
break;
|
|
519
|
+
case "strikethrough":
|
|
520
|
+
o.textDecoration = "line-through";
|
|
521
|
+
break;
|
|
522
|
+
case "underline":
|
|
523
|
+
o.textDecoration = "underline";
|
|
524
|
+
break;
|
|
525
|
+
case "blink":
|
|
526
|
+
o.textDecoration = "blink";
|
|
527
|
+
break;
|
|
528
|
+
}
|
|
529
|
+
return o;
|
|
530
|
+
}
|
|
531
|
+
function fe(s, o, g, d) {
|
|
532
|
+
const r = o ? null : ue(g), t = o ? ce(g) : null;
|
|
533
|
+
if (!s)
|
|
534
|
+
return L.createElement(
|
|
535
|
+
"pre",
|
|
536
|
+
{ style: r, key: d, className: t },
|
|
537
|
+
g.content
|
|
538
|
+
);
|
|
539
|
+
const h = [], e = /(\s|^)(https?:\/\/(?:www\.|(?!www))[^\s.]+\.[^\s]{2,}|www\.[^\s]+\.[^\s]{2,})/g;
|
|
540
|
+
let l = 0, a;
|
|
541
|
+
for (; (a = e.exec(g.content)) !== null; ) {
|
|
542
|
+
const [, c, p] = a, n = a.index + c.length;
|
|
543
|
+
n > l && h.push(g.content.substring(l, n));
|
|
544
|
+
const u = p.startsWith("www.") ? `http://${p}` : p;
|
|
545
|
+
h.push(
|
|
546
|
+
L.createElement(
|
|
547
|
+
"a",
|
|
548
|
+
{
|
|
549
|
+
key: l,
|
|
550
|
+
href: u,
|
|
551
|
+
target: "_blank"
|
|
552
|
+
},
|
|
553
|
+
`${p}`
|
|
554
|
+
)
|
|
555
|
+
), l = e.lastIndex;
|
|
556
|
+
}
|
|
557
|
+
return l < g.content.length && h.push(g.content.substring(l)), L.createElement("span", { style: r, key: d, className: t }, h);
|
|
558
|
+
}
|
|
559
|
+
function F(s) {
|
|
560
|
+
const { className: o, useClasses: g, children: d, linkify: r } = s;
|
|
561
|
+
return L.createElement(
|
|
562
|
+
"code",
|
|
563
|
+
{ className: o },
|
|
564
|
+
ae(d ?? "", g ?? !1).map(
|
|
565
|
+
fe.bind(null, r ?? !1, g ?? !1)
|
|
566
|
+
)
|
|
567
|
+
);
|
|
568
|
+
}
|
|
569
|
+
function ge(s) {
|
|
570
|
+
let o = s;
|
|
571
|
+
do
|
|
572
|
+
s = o, o = s.replace(/[^\n]\x08/gm, "");
|
|
573
|
+
while (o.length < s.length);
|
|
574
|
+
return s;
|
|
575
|
+
}
|
|
576
|
+
const A = Z(({ text: s }, o) => {
|
|
577
|
+
const g = s?.split(`
|
|
578
|
+
`);
|
|
579
|
+
return /* @__PURE__ */ k("div", { ref: o, children: g?.map(
|
|
580
|
+
(d, r) => /* @__PURE__ */ k(F, { className: C.Output, useClasses: !0, children: d === "" ? " " : d }, r)
|
|
581
|
+
) });
|
|
582
|
+
});
|
|
583
|
+
function he({ value: s, prefix: o, onChange: g, onKeyUp: d, onKeyDown: r, inputRef: t }) {
|
|
584
|
+
const [h, e] = $(0), l = R(null);
|
|
585
|
+
V(() => {
|
|
586
|
+
const c = t.current;
|
|
587
|
+
c && l.current !== null ? (c.setSelectionRange(l.current, l.current), e(l.current), l.current = null) : c && c.selectionStart !== null && e(c.selectionStart);
|
|
588
|
+
}, [s, t]);
|
|
589
|
+
const a = () => {
|
|
590
|
+
const c = t.current?.selectionStart;
|
|
591
|
+
c != null && e(c);
|
|
592
|
+
};
|
|
593
|
+
return /* @__PURE__ */ I("span", { className: C.Input, children: [
|
|
594
|
+
o && /* @__PURE__ */ k(F, { className: C.Prefix, useClasses: !0, children: o }),
|
|
595
|
+
/* @__PURE__ */ I("span", { className: C["Input-container"], style: { "--cursor-offset": h }, children: [
|
|
596
|
+
/* @__PURE__ */ k("span", { "aria-hidden": "true", children: s }),
|
|
597
|
+
/* @__PURE__ */ k(
|
|
598
|
+
"input",
|
|
599
|
+
{
|
|
600
|
+
id: "input",
|
|
601
|
+
value: s,
|
|
602
|
+
"aria-label": "Command input",
|
|
603
|
+
onChange: (c) => {
|
|
604
|
+
l.current = c.target.selectionStart, g(c);
|
|
605
|
+
},
|
|
606
|
+
ref: t,
|
|
607
|
+
onKeyUp: d,
|
|
608
|
+
onKeyDown: (c) => {
|
|
609
|
+
r?.(c), a();
|
|
610
|
+
},
|
|
611
|
+
onClick: a,
|
|
612
|
+
onSelect: a,
|
|
613
|
+
spellCheck: !1,
|
|
614
|
+
autoComplete: "off",
|
|
615
|
+
autoFocus: !0
|
|
616
|
+
}
|
|
617
|
+
)
|
|
618
|
+
] })
|
|
619
|
+
] });
|
|
620
|
+
}
|
|
621
|
+
function pe({ app: s, path: o, input: g, setTitle: d, close: r, active: t, focus: h }) {
|
|
622
|
+
const e = R(null), l = R(null), a = R(G.ZERO), [c, p] = $(0), [n, u] = M({
|
|
623
|
+
app: s,
|
|
624
|
+
path: o,
|
|
625
|
+
input: g,
|
|
626
|
+
exit: r,
|
|
627
|
+
sizeRef: a
|
|
628
|
+
});
|
|
629
|
+
E(() => {
|
|
630
|
+
d?.(`${z}@${B}: ${u.workingDirectory.root ? "/" : u.workingDirectory.path}`);
|
|
631
|
+
}, [u.workingDirectory.path, u.workingDirectory.root, d]), E(() => {
|
|
632
|
+
t && (u.stream ? e.current?.focus() : l.current?.focus());
|
|
633
|
+
}, [t, u.stream]), E(() => {
|
|
634
|
+
if (l.current && !u.stream) {
|
|
635
|
+
const f = u.line.length;
|
|
636
|
+
l.current.setSelectionRange(f, f);
|
|
637
|
+
}
|
|
638
|
+
}, [u.historyOffset]);
|
|
639
|
+
const i = () => {
|
|
640
|
+
e.current && (e.current.scrollTop = e.current.scrollHeight);
|
|
641
|
+
};
|
|
642
|
+
E(() => {
|
|
643
|
+
i();
|
|
644
|
+
}, [u.history.length, u.line, u.ttyBuffer]), E(() => {
|
|
645
|
+
if (!e.current) return;
|
|
646
|
+
const f = () => {
|
|
647
|
+
if (!e.current) return;
|
|
648
|
+
const w = getComputedStyle(e.current), S = parseFloat(w.fontSize), x = 0.585 * S, O = 1.25 * S, { width: D, height: H } = e.current.getBoundingClientRect();
|
|
649
|
+
a.current.set(
|
|
650
|
+
Math.ceil(D / x),
|
|
651
|
+
Math.ceil(H / O)
|
|
652
|
+
);
|
|
653
|
+
}, _ = new ResizeObserver(f);
|
|
654
|
+
return _.observe(e.current), f(), () => _.disconnect();
|
|
655
|
+
}, []);
|
|
656
|
+
const m = (f) => {
|
|
657
|
+
const { key: _ } = f;
|
|
658
|
+
if ((f.ctrlKey || f.metaKey) && _ === "c" && !f.shiftKey) {
|
|
659
|
+
f.preventDefault(), n.interrupt();
|
|
660
|
+
return;
|
|
661
|
+
}
|
|
662
|
+
if (!u.stream)
|
|
663
|
+
if (_ === "Tab")
|
|
664
|
+
f.preventDefault(), n.autoComplete();
|
|
665
|
+
else if (_ === "Enter") {
|
|
666
|
+
const w = f.target.value;
|
|
667
|
+
n.run(w), p((S) => S + 1);
|
|
668
|
+
} else _ === "ArrowUp" ? (f.preventDefault(), n.historySearch(1)) : _ === "ArrowDown" && (f.preventDefault(), n.historySearch(-1));
|
|
669
|
+
}, y = (f) => {
|
|
670
|
+
n.setLine(f.target.value);
|
|
671
|
+
}, b = () => {
|
|
672
|
+
if (u.isUsingAltScreen)
|
|
673
|
+
return u.ttyBuffer ? /* @__PURE__ */ k(A, { text: u.ttyBuffer }) : null;
|
|
674
|
+
let f = 0;
|
|
675
|
+
for (let _ = u.history.length - 1; _ >= 0; _--)
|
|
676
|
+
if (u.history[_].clear) {
|
|
677
|
+
f = _ + 1;
|
|
678
|
+
break;
|
|
679
|
+
}
|
|
680
|
+
return /* @__PURE__ */ I(W, { children: [
|
|
681
|
+
u.history.slice(f).map(
|
|
682
|
+
(_, w) => /* @__PURE__ */ k(A, { text: _.text }, w)
|
|
683
|
+
),
|
|
684
|
+
u.ttyBuffer && /* @__PURE__ */ k(A, { text: u.ttyBuffer })
|
|
685
|
+
] });
|
|
686
|
+
}, v = (f) => {
|
|
687
|
+
h?.(f), f.button === 2 && (f.preventDefault(), navigator.clipboard.readText().then((_) => {
|
|
688
|
+
const w = l.current;
|
|
689
|
+
if (!w) return;
|
|
690
|
+
const S = w.selectionStart ?? u.line.length, x = w.selectionEnd ?? u.line.length;
|
|
691
|
+
n.setLine((D) => D.substring(0, S) + _ + D.substring(x));
|
|
692
|
+
const O = S + _.length;
|
|
693
|
+
setTimeout(() => {
|
|
694
|
+
w.focus(), w.setSelectionRange(O, O);
|
|
695
|
+
}, 0);
|
|
696
|
+
}).catch((_) => {
|
|
697
|
+
console.error(_);
|
|
698
|
+
}));
|
|
699
|
+
}, T = (f) => {
|
|
700
|
+
f.preventDefault();
|
|
701
|
+
};
|
|
702
|
+
return /* @__PURE__ */ I(
|
|
703
|
+
"div",
|
|
704
|
+
{
|
|
705
|
+
ref: e,
|
|
706
|
+
tabIndex: 0,
|
|
707
|
+
className: C.Terminal,
|
|
708
|
+
onKeyDown: m,
|
|
709
|
+
onMouseDown: v,
|
|
710
|
+
onContextMenu: T,
|
|
711
|
+
onClick: (f) => {
|
|
712
|
+
window.getSelection()?.toString() === "" && (f.preventDefault(), u.stream ? e.current?.focus() : l.current?.focus());
|
|
713
|
+
},
|
|
714
|
+
children: [
|
|
715
|
+
/* @__PURE__ */ k("div", { className: C.History, children: b() }),
|
|
716
|
+
!u.isUsingAltScreen && (u.stream ? null : /* @__PURE__ */ k(
|
|
717
|
+
he,
|
|
718
|
+
{
|
|
719
|
+
value: u.line,
|
|
720
|
+
prefix: u.prompt,
|
|
721
|
+
onChange: y,
|
|
722
|
+
inputRef: l
|
|
723
|
+
},
|
|
724
|
+
c
|
|
725
|
+
))
|
|
726
|
+
]
|
|
727
|
+
}
|
|
728
|
+
);
|
|
729
|
+
}
|
|
730
|
+
class _e extends J {
|
|
731
|
+
constructor() {
|
|
732
|
+
super("Terminal", "terminal", pe), this.setIconUrl("https://os.prozilla.dev/assets/apps/icons/terminal.svg"), this.setRole(K.APP_ROLES.terminal), this.setCategory("Utilities & tools");
|
|
733
|
+
}
|
|
734
|
+
addCommands(o) {
|
|
735
|
+
return o.forEach((g) => this.addCommand(g)), this;
|
|
736
|
+
}
|
|
737
|
+
addCommand(o) {
|
|
738
|
+
return U.addCommand(o), this;
|
|
739
|
+
}
|
|
740
|
+
}
|
|
741
|
+
const de = new _e();
|
|
742
|
+
de.setMetadata({ name: "@prozilla-os/terminal", version: "1.1.23", author: "Prozilla" });
|
|
3
743
|
export {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
e as Stream,
|
|
7
|
-
n as TerminalApp,
|
|
8
|
-
o as terminal
|
|
744
|
+
_e as TerminalApp,
|
|
745
|
+
de as terminal
|
|
9
746
|
};
|
|
10
747
|
//# sourceMappingURL=main.js.map
|