@bzync/rui 0.0.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/LICENSE +15 -0
- package/README.md +115 -0
- package/dist/autocomplete-CaysJRpk.cjs +1 -0
- package/dist/autocomplete-CfbfpcO4.js +453 -0
- package/dist/calendar-Bnld4G59.cjs +1 -0
- package/dist/calendar-CdICOROs.js +573 -0
- package/dist/charts-CxEy2c3M.js +1248 -0
- package/dist/charts-UDqS1BH1.cjs +1 -0
- package/dist/cn-BdjraxxU.cjs +1 -0
- package/dist/cn-DpgY2leY.js +1736 -0
- package/dist/component-styles-Ce56hn9T.js +16 -0
- package/dist/component-styles-TkZ7v6Ef.cjs +1 -0
- package/dist/components/accordion.cjs +1 -0
- package/dist/components/accordion.d.ts +22 -0
- package/dist/components/accordion.js +122 -0
- package/dist/components/alert.cjs +1 -0
- package/dist/components/alert.d.ts +13 -0
- package/dist/components/alert.js +165 -0
- package/dist/components/auth-backdrop.cjs +1 -0
- package/dist/components/auth-backdrop.d.ts +7 -0
- package/dist/components/auth-backdrop.js +10 -0
- package/dist/components/autocomplete/dropdown.d.ts +21 -0
- package/dist/components/autocomplete/icons.d.ts +8 -0
- package/dist/components/autocomplete/multi-trigger.d.ts +25 -0
- package/dist/components/autocomplete/single-trigger.d.ts +21 -0
- package/dist/components/autocomplete/types.d.ts +34 -0
- package/dist/components/autocomplete.cjs +1 -0
- package/dist/components/autocomplete.d.ts +5 -0
- package/dist/components/autocomplete.js +3 -0
- package/dist/components/avatar.cjs +1 -0
- package/dist/components/avatar.d.ts +17 -0
- package/dist/components/avatar.js +56 -0
- package/dist/components/badge.cjs +1 -0
- package/dist/components/badge.d.ts +12 -0
- package/dist/components/badge.js +32 -0
- package/dist/components/billing-interval-toggle.cjs +1 -0
- package/dist/components/billing-interval-toggle.d.ts +18 -0
- package/dist/components/billing-interval-toggle.js +39 -0
- package/dist/components/breadcrumb.cjs +1 -0
- package/dist/components/breadcrumb.d.ts +11 -0
- package/dist/components/breadcrumb.js +52 -0
- package/dist/components/button.cjs +1 -0
- package/dist/components/button.d.ts +17 -0
- package/dist/components/button.js +90 -0
- package/dist/components/calendar/month-view.d.ts +17 -0
- package/dist/components/calendar/types.d.ts +54 -0
- package/dist/components/calendar/week-view.d.ts +17 -0
- package/dist/components/calendar.cjs +1 -0
- package/dist/components/calendar.d.ts +3 -0
- package/dist/components/calendar.js +3 -0
- package/dist/components/callout.cjs +1 -0
- package/dist/components/callout.d.ts +9 -0
- package/dist/components/callout.js +131 -0
- package/dist/components/card.cjs +1 -0
- package/dist/components/card.d.ts +17 -0
- package/dist/components/card.js +59 -0
- package/dist/components/charts/bar-chart.d.ts +16 -0
- package/dist/components/charts/donut-chart.d.ts +10 -0
- package/dist/components/charts/funnel-chart.d.ts +8 -0
- package/dist/components/charts/gantt-chart.d.ts +15 -0
- package/dist/components/charts/heatmap-chart.d.ts +10 -0
- package/dist/components/charts/index.d.ts +11 -0
- package/dist/components/charts/line-chart.d.ts +16 -0
- package/dist/components/charts/multi-line-chart.d.ts +18 -0
- package/dist/components/charts/radar-chart.d.ts +13 -0
- package/dist/components/charts/scatter-chart.d.ts +24 -0
- package/dist/components/charts/shared.d.ts +15 -0
- package/dist/components/charts/waterfall-chart.d.ts +14 -0
- package/dist/components/charts.cjs +1 -0
- package/dist/components/charts.d.ts +2 -0
- package/dist/components/charts.js +2 -0
- package/dist/components/checkbox.cjs +1 -0
- package/dist/components/checkbox.d.ts +9 -0
- package/dist/components/checkbox.js +135 -0
- package/dist/components/code.cjs +7 -0
- package/dist/components/code.d.ts +23 -0
- package/dist/components/code.js +276 -0
- package/dist/components/command.cjs +1 -0
- package/dist/components/command.d.ts +29 -0
- package/dist/components/command.js +208 -0
- package/dist/components/confirm-dialog.cjs +1 -0
- package/dist/components/confirm-dialog.d.ts +14 -0
- package/dist/components/confirm-dialog.js +69 -0
- package/dist/components/copy-button.cjs +1 -0
- package/dist/components/copy-button.d.ts +8 -0
- package/dist/components/copy-button.js +87 -0
- package/dist/components/datatable/pagination-footer.d.ts +10 -0
- package/dist/components/datatable/rows-dropdown.d.ts +5 -0
- package/dist/components/datatable/skeleton-row.d.ts +3 -0
- package/dist/components/datatable/sort-icon.d.ts +4 -0
- package/dist/components/datatable/types.d.ts +30 -0
- package/dist/components/datatable.cjs +1 -0
- package/dist/components/datatable.d.ts +9 -0
- package/dist/components/datatable.js +3 -0
- package/dist/components/datepicker.cjs +1 -0
- package/dist/components/datepicker.d.ts +14 -0
- package/dist/components/datepicker.js +267 -0
- package/dist/components/drawer.cjs +1 -0
- package/dist/components/drawer.d.ts +18 -0
- package/dist/components/drawer.js +3 -0
- package/dist/components/dropdown-menu.cjs +1 -0
- package/dist/components/dropdown-menu.d.ts +26 -0
- package/dist/components/dropdown-menu.js +122 -0
- package/dist/components/empty-state.cjs +1 -0
- package/dist/components/empty-state.d.ts +10 -0
- package/dist/components/empty-state.js +68 -0
- package/dist/components/error-state.cjs +1 -0
- package/dist/components/error-state.d.ts +10 -0
- package/dist/components/error-state.js +80 -0
- package/dist/components/file-upload.cjs +1 -0
- package/dist/components/file-upload.d.ts +10 -0
- package/dist/components/file-upload.js +173 -0
- package/dist/components/form-field.cjs +1 -0
- package/dist/components/form-field.d.ts +10 -0
- package/dist/components/form-field.js +36 -0
- package/dist/components/info-button.cjs +1 -0
- package/dist/components/info-button.d.ts +4 -0
- package/dist/components/info-button.js +32 -0
- package/dist/components/input.cjs +1 -0
- package/dist/components/input.d.ts +19 -0
- package/dist/components/input.js +117 -0
- package/dist/components/kbd.cjs +1 -0
- package/dist/components/kbd.d.ts +6 -0
- package/dist/components/kbd.js +16 -0
- package/dist/components/label.cjs +1 -0
- package/dist/components/label.d.ts +6 -0
- package/dist/components/label.js +31 -0
- package/dist/components/layout.cjs +1 -0
- package/dist/components/layout.d.ts +51 -0
- package/dist/components/layout.js +117 -0
- package/dist/components/link.cjs +1 -0
- package/dist/components/link.d.ts +9 -0
- package/dist/components/link.js +48 -0
- package/dist/components/list.cjs +1 -0
- package/dist/components/list.d.ts +13 -0
- package/dist/components/list.js +46 -0
- package/dist/components/modal.cjs +1 -0
- package/dist/components/modal.d.ts +31 -0
- package/dist/components/modal.js +219 -0
- package/dist/components/navigation.cjs +1 -0
- package/dist/components/navigation.d.ts +42 -0
- package/dist/components/navigation.js +127 -0
- package/dist/components/number-input.cjs +1 -0
- package/dist/components/number-input.d.ts +16 -0
- package/dist/components/number-input.js +142 -0
- package/dist/components/otp-input.cjs +1 -0
- package/dist/components/otp-input.d.ts +13 -0
- package/dist/components/otp-input.js +71 -0
- package/dist/components/pagination.cjs +1 -0
- package/dist/components/pagination.d.ts +8 -0
- package/dist/components/pagination.js +77 -0
- package/dist/components/popover.cjs +1 -0
- package/dist/components/popover.d.ts +16 -0
- package/dist/components/popover.js +115 -0
- package/dist/components/progressbar.cjs +1 -0
- package/dist/components/progressbar.d.ts +15 -0
- package/dist/components/progressbar.js +108 -0
- package/dist/components/radio.cjs +1 -0
- package/dist/components/radio.d.ts +22 -0
- package/dist/components/radio.js +96 -0
- package/dist/components/richtext.cjs +1 -0
- package/dist/components/richtext.d.ts +10 -0
- package/dist/components/richtext.js +370 -0
- package/dist/components/select/option-list.d.ts +16 -0
- package/dist/components/select/select-multi.d.ts +2 -0
- package/dist/components/select/select-single.d.ts +2 -0
- package/dist/components/select/types.d.ts +54 -0
- package/dist/components/select/utils.d.ts +10 -0
- package/dist/components/select.cjs +1 -0
- package/dist/components/select.d.ts +3 -0
- package/dist/components/select.js +2 -0
- package/dist/components/seo.cjs +1 -0
- package/dist/components/seo.d.ts +45 -0
- package/dist/components/seo.js +64 -0
- package/dist/components/separator.cjs +1 -0
- package/dist/components/separator.d.ts +6 -0
- package/dist/components/separator.js +25 -0
- package/dist/components/skeleton.cjs +1 -0
- package/dist/components/skeleton.d.ts +37 -0
- package/dist/components/skeleton.js +146 -0
- package/dist/components/slider.cjs +1 -0
- package/dist/components/slider.d.ts +12 -0
- package/dist/components/slider.js +72 -0
- package/dist/components/snackbar.cjs +1 -0
- package/dist/components/snackbar.d.ts +35 -0
- package/dist/components/snackbar.js +220 -0
- package/dist/components/spinner.cjs +1 -0
- package/dist/components/spinner.d.ts +7 -0
- package/dist/components/spinner.js +31 -0
- package/dist/components/stat.cjs +1 -0
- package/dist/components/stat.d.ts +18 -0
- package/dist/components/stat.js +90 -0
- package/dist/components/status-dot.cjs +1 -0
- package/dist/components/status-dot.d.ts +10 -0
- package/dist/components/status-dot.js +29 -0
- package/dist/components/stepper.cjs +1 -0
- package/dist/components/stepper.d.ts +11 -0
- package/dist/components/stepper.js +67 -0
- package/dist/components/switch.cjs +1 -0
- package/dist/components/switch.d.ts +8 -0
- package/dist/components/switch.js +79 -0
- package/dist/components/table.cjs +1 -0
- package/dist/components/table.d.ts +12 -0
- package/dist/components/table.js +54 -0
- package/dist/components/tabs.cjs +1 -0
- package/dist/components/tabs.d.ts +22 -0
- package/dist/components/tabs.js +120 -0
- package/dist/components/tag.cjs +1 -0
- package/dist/components/tag.d.ts +12 -0
- package/dist/components/tag.js +58 -0
- package/dist/components/terminal/fs.d.ts +10 -0
- package/dist/components/terminal/shell-commands-sim.d.ts +5 -0
- package/dist/components/terminal/shell-commands.d.ts +16 -0
- package/dist/components/terminal/shell-run.d.ts +11 -0
- package/dist/components/terminal/terminal-block.d.ts +13 -0
- package/dist/components/terminal/terminal-emulator.d.ts +10 -0
- package/dist/components/terminal/types.d.ts +35 -0
- package/dist/components/terminal.cjs +1 -0
- package/dist/components/terminal.d.ts +2 -0
- package/dist/components/terminal.js +2 -0
- package/dist/components/textarea.cjs +1 -0
- package/dist/components/textarea.d.ts +13 -0
- package/dist/components/textarea.js +54 -0
- package/dist/components/theme-provider.cjs +1 -0
- package/dist/components/theme-provider.d.ts +89 -0
- package/dist/components/theme-provider.js +93 -0
- package/dist/components/theme-toggle.cjs +1 -0
- package/dist/components/theme-toggle.d.ts +9 -0
- package/dist/components/theme-toggle.js +4 -0
- package/dist/components/timeline.cjs +1 -0
- package/dist/components/timeline.d.ts +14 -0
- package/dist/components/timeline.js +54 -0
- package/dist/components/tooltip.cjs +1 -0
- package/dist/components/tooltip.d.ts +11 -0
- package/dist/components/tooltip.js +84 -0
- package/dist/components/tree.cjs +1 -0
- package/dist/components/tree.d.ts +16 -0
- package/dist/components/tree.js +92 -0
- package/dist/createLucideIcon-DDY8HuQR.js +42 -0
- package/dist/createLucideIcon-b_X_3fj-.cjs +1 -0
- package/dist/datatable-BB3v__r5.cjs +1 -0
- package/dist/datatable-DlBhUhuO.js +316 -0
- package/dist/drawer-Cbuh6qdL.cjs +1 -0
- package/dist/drawer-CqkVZT9Y.js +189 -0
- package/dist/focus-Dk1YWVPN.js +42 -0
- package/dist/focus-DmG6Ge7X.cjs +1 -0
- package/dist/index.cjs +1 -0
- package/dist/index.d.ts +70 -0
- package/dist/index.js +215 -0
- package/dist/lib/cn.d.ts +2 -0
- package/dist/lib/component-styles.d.ts +10 -0
- package/dist/select-Ch5fp1GT.js +461 -0
- package/dist/select-q0YCMhBP.cjs +1 -0
- package/dist/styles.css +3 -0
- package/dist/terminal-BOR2cFi1.js +1060 -0
- package/dist/terminal-CpraMs50.cjs +77 -0
- package/dist/theme-toggle-CnoiorKV.js +71 -0
- package/dist/theme-toggle-Dp1-24zH.cjs +1 -0
- package/dist/use-event-callback-DGkfO_uu.js +10 -0
- package/dist/use-event-callback-Du9_9eAi.cjs +1 -0
- package/dist/utils-CQ8pvCtk.js +72 -0
- package/dist/utils-DOFJTw8o.cjs +1 -0
- package/package.json +88 -0
|
@@ -0,0 +1,1060 @@
|
|
|
1
|
+
import { t as e } from "./cn-DpgY2leY.js";
|
|
2
|
+
import { useEffect as t, useRef as n, useState as r } from "react";
|
|
3
|
+
import { jsx as i, jsxs as a } from "react/jsx-runtime";
|
|
4
|
+
//#region src/components/terminal/terminal-block.tsx
|
|
5
|
+
var o = {
|
|
6
|
+
command: "text-gray-900 dark:text-slate-100",
|
|
7
|
+
output: "text-slate-700 dark:text-slate-300",
|
|
8
|
+
error: "text-red-600 dark:text-red-400",
|
|
9
|
+
success: "text-emerald-700 dark:text-emerald-400",
|
|
10
|
+
info: "text-sky-600 dark:text-sky-400",
|
|
11
|
+
muted: "text-slate-400 dark:text-slate-500"
|
|
12
|
+
};
|
|
13
|
+
function s({ lines: r, title: s = "Terminal", prompt: c = "$", className: l }) {
|
|
14
|
+
let u = n(null);
|
|
15
|
+
return t(() => {
|
|
16
|
+
u.current && (u.current.scrollTop = u.current.scrollHeight);
|
|
17
|
+
}, [r]), /* @__PURE__ */ a("div", {
|
|
18
|
+
className: e("rounded-xl overflow-hidden border border-black/10 dark:border-white/10 bg-gray-50 dark:bg-[#0e1117]", l),
|
|
19
|
+
children: [/* @__PURE__ */ i("div", {
|
|
20
|
+
className: "flex items-center px-4 py-2.5 border-b border-black/[0.07] dark:border-white/[0.07] bg-black/3 dark:bg-white/[0.03]",
|
|
21
|
+
children: /* @__PURE__ */ i("span", {
|
|
22
|
+
className: "flex-1 text-center text-xs text-slate-500 font-medium",
|
|
23
|
+
children: s
|
|
24
|
+
})
|
|
25
|
+
}), /* @__PURE__ */ i("div", {
|
|
26
|
+
ref: u,
|
|
27
|
+
className: "p-4 font-mono text-sm leading-6 overflow-y-auto max-h-80",
|
|
28
|
+
children: r.map((e, t) => {
|
|
29
|
+
let n = e.type ?? "output";
|
|
30
|
+
return /* @__PURE__ */ a("div", {
|
|
31
|
+
className: "whitespace-pre-wrap break-all",
|
|
32
|
+
children: [n === "command" && /* @__PURE__ */ i("span", {
|
|
33
|
+
className: "text-emerald-600 dark:text-emerald-500 mr-2 select-none",
|
|
34
|
+
children: e.prompt ?? c
|
|
35
|
+
}), /* @__PURE__ */ i("span", {
|
|
36
|
+
className: o[n],
|
|
37
|
+
children: e.text
|
|
38
|
+
})]
|
|
39
|
+
}, t);
|
|
40
|
+
})
|
|
41
|
+
})]
|
|
42
|
+
});
|
|
43
|
+
}
|
|
44
|
+
//#endregion
|
|
45
|
+
//#region src/components/terminal/fs.ts
|
|
46
|
+
function c(e, t = !1) {
|
|
47
|
+
return {
|
|
48
|
+
type: "file",
|
|
49
|
+
content: e,
|
|
50
|
+
permissions: t ? "-rwxr-xr-x" : "-rw-r--r--",
|
|
51
|
+
mtime: /* @__PURE__ */ new Date(),
|
|
52
|
+
executable: t
|
|
53
|
+
};
|
|
54
|
+
}
|
|
55
|
+
function l(e = {}) {
|
|
56
|
+
return {
|
|
57
|
+
type: "dir",
|
|
58
|
+
children: new Map(Object.entries(e)),
|
|
59
|
+
permissions: "drwxr-xr-x",
|
|
60
|
+
mtime: /* @__PURE__ */ new Date()
|
|
61
|
+
};
|
|
62
|
+
}
|
|
63
|
+
function u() {
|
|
64
|
+
return l({
|
|
65
|
+
home: l({ user: l({
|
|
66
|
+
".bashrc": c("# ~/.bashrc\nexport PS1='\\u@\\h:\\w\\$ '\nexport PATH=\"$HOME/bin:$PATH\"\nalias ll='ls -la'\nalias la='ls -A'\n"),
|
|
67
|
+
".bash_history": c("ls\npwd\ncd projects\nls -la\ncat README.md\ngit status\nnpm run dev\n"),
|
|
68
|
+
".profile": c("# ~/.profile\nif [ -f \"$HOME/.bashrc\" ]; then\n . \"$HOME/.bashrc\"\nfi\n"),
|
|
69
|
+
"README.md": c("# Home Directory\n\nWelcome! Try:\n ls -la\n cd projects\n cat README.md\n help\n"),
|
|
70
|
+
Desktop: l({}),
|
|
71
|
+
Documents: l({
|
|
72
|
+
"notes.txt": c("Meeting notes - 2026-06-05\n\n- Review infra setup\n- Deploy worker nodes\n- Update API docs\n"),
|
|
73
|
+
"todo.txt": c("[ ] Fix login bug\n[x] Deploy v1.2\n[ ] Write tests\n")
|
|
74
|
+
}),
|
|
75
|
+
projects: l({ "my-app": l({
|
|
76
|
+
"package.json": c("{\n \"name\": \"my-app\",\n \"version\": \"1.0.0\",\n \"scripts\": {\n \"dev\": \"next dev\",\n \"build\": \"next build\"\n },\n \"dependencies\": {\n \"next\": \"16.2.7\",\n \"react\": \"^19.0.0\"\n }\n}\n"),
|
|
77
|
+
"README.md": c("# my-app\n\n## Getting Started\n\n```bash\nnpm install\nnpm run dev\n```\n"),
|
|
78
|
+
src: l({
|
|
79
|
+
"index.ts": c("export default function main() {\n console.log(\"Hello, world!\")\n}\n"),
|
|
80
|
+
"utils.ts": c("export function greet(name: string) {\n return `Hello, ${name}!`\n}\n")
|
|
81
|
+
})
|
|
82
|
+
}) }),
|
|
83
|
+
Downloads: l({})
|
|
84
|
+
}) }),
|
|
85
|
+
etc: l({
|
|
86
|
+
hostname: c("ubuntu\n"),
|
|
87
|
+
"os-release": c("NAME=\"Ubuntu\"\nVERSION=\"24.04.1 LTS (Noble Numbat)\"\nID=ubuntu\nPRETTY_NAME=\"Ubuntu 24.04.1 LTS\"\nVERSION_ID=\"24.04\"\n"),
|
|
88
|
+
passwd: c("root:x:0:0:root:/root:/bin/bash\nuser:x:1000:1000:User,,,:/home/user:/bin/bash\n"),
|
|
89
|
+
shells: c("/bin/sh\n/bin/bash\n/usr/bin/bash\n/usr/bin/zsh\n")
|
|
90
|
+
}),
|
|
91
|
+
tmp: l({}),
|
|
92
|
+
usr: l({
|
|
93
|
+
bin: l({}),
|
|
94
|
+
local: l({ bin: l({}) })
|
|
95
|
+
}),
|
|
96
|
+
var: l({ log: l({ syslog: c("Jun 5 12:00:01 ubuntu systemd[1]: Started Daily apt upgrade.\nJun 5 12:01:00 ubuntu CRON[1234]: (root) CMD (run-parts /etc/cron.hourly)\n") }) }),
|
|
97
|
+
proc: l({}),
|
|
98
|
+
dev: l({})
|
|
99
|
+
});
|
|
100
|
+
}
|
|
101
|
+
function d(...e) {
|
|
102
|
+
let t = [];
|
|
103
|
+
for (let n of e) for (let e of n.split("/")) e === ".." ? t.pop() : e && e !== "." && t.push(e);
|
|
104
|
+
return "/" + t.join("/");
|
|
105
|
+
}
|
|
106
|
+
function f(e) {
|
|
107
|
+
return e.split("/").filter(Boolean);
|
|
108
|
+
}
|
|
109
|
+
function p(e, t) {
|
|
110
|
+
return !t || t === "~" ? `/home/${e.user}` : t.startsWith("~/") ? `/home/${e.user}/${t.slice(2)}` : t.startsWith("/") ? d(t) : d(`/${e.cwd.join("/")}`, t);
|
|
111
|
+
}
|
|
112
|
+
function m(e, t) {
|
|
113
|
+
let n = e;
|
|
114
|
+
for (let e of f(t)) {
|
|
115
|
+
if (n.type !== "dir") return null;
|
|
116
|
+
let t = n.children.get(e);
|
|
117
|
+
if (!t) return null;
|
|
118
|
+
n = t;
|
|
119
|
+
}
|
|
120
|
+
return n;
|
|
121
|
+
}
|
|
122
|
+
function h(e, t) {
|
|
123
|
+
let n = f(t), r = n.pop(), i = e;
|
|
124
|
+
for (let e of n) {
|
|
125
|
+
if (i.type !== "dir") return null;
|
|
126
|
+
let t = i.children.get(e);
|
|
127
|
+
if (!t) return null;
|
|
128
|
+
i = t;
|
|
129
|
+
}
|
|
130
|
+
return i.type === "dir" ? [i, r] : null;
|
|
131
|
+
}
|
|
132
|
+
function g(e) {
|
|
133
|
+
let t = "/" + e.cwd.join("/"), n = `/home/${e.user}`;
|
|
134
|
+
return t === n ? "~" : t.startsWith(n + "/") ? "~" + t.slice(n.length) : t || "/";
|
|
135
|
+
}
|
|
136
|
+
//#endregion
|
|
137
|
+
//#region src/components/terminal/shell-commands.ts
|
|
138
|
+
function _(e) {
|
|
139
|
+
let t = [], n = "", r = !1, i = !1;
|
|
140
|
+
for (let a of e) {
|
|
141
|
+
if (a === "'" && !i) {
|
|
142
|
+
r = !r;
|
|
143
|
+
continue;
|
|
144
|
+
}
|
|
145
|
+
if (a === "\"" && !r) {
|
|
146
|
+
i = !i;
|
|
147
|
+
continue;
|
|
148
|
+
}
|
|
149
|
+
a === " " && !r && !i ? n &&= (t.push(n), "") : n += a;
|
|
150
|
+
}
|
|
151
|
+
return n && t.push(n), t;
|
|
152
|
+
}
|
|
153
|
+
function v(e, t) {
|
|
154
|
+
return t.replace(/\$\{?([A-Z_][A-Z0-9_]*)\}?/gi, (t, n) => e.env[n] ?? "");
|
|
155
|
+
}
|
|
156
|
+
function y(e) {
|
|
157
|
+
return e.type === "dir" ? "font-bold text-sky-600 dark:text-sky-400" : e.executable ? "font-bold text-emerald-600 dark:text-emerald-500" : "text-slate-700 dark:text-slate-200";
|
|
158
|
+
}
|
|
159
|
+
function b(e) {
|
|
160
|
+
return e.toLocaleDateString("en-US", {
|
|
161
|
+
month: "short",
|
|
162
|
+
day: "2-digit"
|
|
163
|
+
}).replace(",", "") + " " + e.toLocaleTimeString("en-US", {
|
|
164
|
+
hour: "2-digit",
|
|
165
|
+
minute: "2-digit",
|
|
166
|
+
hour12: !1
|
|
167
|
+
});
|
|
168
|
+
}
|
|
169
|
+
function x(e) {
|
|
170
|
+
return { lines: [{ spans: [{
|
|
171
|
+
text: e,
|
|
172
|
+
cls: "text-red-500 dark:text-red-400"
|
|
173
|
+
}] }] };
|
|
174
|
+
}
|
|
175
|
+
function S(...e) {
|
|
176
|
+
return { lines: e.map((e) => ({ spans: [{ text: e }] })) };
|
|
177
|
+
}
|
|
178
|
+
function C(e, t) {
|
|
179
|
+
let n = !1, r = !1, i;
|
|
180
|
+
for (let e of t) e.startsWith("-") ? (e.includes("l") && (n = !0), (e.includes("a") || e.includes("A")) && (r = !0)) : i = e;
|
|
181
|
+
let a = i ? p(e, i) : "/" + e.cwd.join("/"), o = m(e.root, a);
|
|
182
|
+
if (!o) return x(`ls: cannot access '${i}': No such file or directory`);
|
|
183
|
+
if (o.type === "file") return { lines: [{ spans: [{
|
|
184
|
+
text: a.split("/").pop(),
|
|
185
|
+
cls: y(o)
|
|
186
|
+
}] }] };
|
|
187
|
+
let s = [...o.children.entries()].sort(([e], [t]) => e.localeCompare(t));
|
|
188
|
+
if (r || (s = s.filter(([e]) => !e.startsWith("."))), n) {
|
|
189
|
+
let e = [], t = s.reduce((e, [, t]) => e + (t.type === "file" ? t.content.length : 4096), 0);
|
|
190
|
+
if (e.push({ spans: [{
|
|
191
|
+
text: `total ${Math.ceil(t / 512)}`,
|
|
192
|
+
cls: "text-slate-500 dark:text-slate-500"
|
|
193
|
+
}] }), r) for (let t of [".", ".."]) e.push({ spans: [{
|
|
194
|
+
text: `drwxr-xr-x 2 user user 4096 ${b(/* @__PURE__ */ new Date())} `,
|
|
195
|
+
cls: "text-slate-500 dark:text-slate-500"
|
|
196
|
+
}, {
|
|
197
|
+
text: t,
|
|
198
|
+
cls: "font-bold text-sky-600 dark:text-sky-400"
|
|
199
|
+
}] });
|
|
200
|
+
for (let [t, n] of s) {
|
|
201
|
+
let r = n.type === "file" ? n.content.length : 4096;
|
|
202
|
+
e.push({ spans: [{
|
|
203
|
+
text: `${n.permissions} 1 user user ${String(r).padStart(6)} ${b(n.mtime)} `,
|
|
204
|
+
cls: "text-slate-500 dark:text-slate-500"
|
|
205
|
+
}, {
|
|
206
|
+
text: n.type === "dir" ? t + "/" : t,
|
|
207
|
+
cls: y(n)
|
|
208
|
+
}] });
|
|
209
|
+
}
|
|
210
|
+
return { lines: e };
|
|
211
|
+
}
|
|
212
|
+
let c = [];
|
|
213
|
+
for (let e = 0; e < s.length; e += 4) {
|
|
214
|
+
let t = [];
|
|
215
|
+
for (let n = 0; n < 4 && e + n < s.length; n++) {
|
|
216
|
+
let [r, i] = s[e + n], a = i.type === "dir" ? r + "/" : r;
|
|
217
|
+
t.push({
|
|
218
|
+
text: a,
|
|
219
|
+
cls: y(i)
|
|
220
|
+
}), n < 3 && e + n + 1 < s.length && t.push({ text: " ".repeat(Math.max(1, 20 - a.length)) });
|
|
221
|
+
}
|
|
222
|
+
c.push({ spans: t });
|
|
223
|
+
}
|
|
224
|
+
return { lines: c };
|
|
225
|
+
}
|
|
226
|
+
function w(e, t) {
|
|
227
|
+
let n = p(e, t[0] ?? "~"), r = m(e.root, n);
|
|
228
|
+
return r ? r.type === "dir" ? {
|
|
229
|
+
lines: [],
|
|
230
|
+
patch: { cwd: f(n) }
|
|
231
|
+
} : x(`bash: cd: ${t[0]}: Not a directory`) : x(`bash: cd: ${t[0]}: No such file or directory`);
|
|
232
|
+
}
|
|
233
|
+
function T(e, t) {
|
|
234
|
+
if (!t.length) return x("cat: missing operand");
|
|
235
|
+
let n = [];
|
|
236
|
+
for (let r of t) {
|
|
237
|
+
let t = m(e.root, p(e, r));
|
|
238
|
+
if (!t) {
|
|
239
|
+
n.push({ spans: [{
|
|
240
|
+
text: `cat: ${r}: No such file or directory`,
|
|
241
|
+
cls: "text-red-500 dark:text-red-400"
|
|
242
|
+
}] });
|
|
243
|
+
continue;
|
|
244
|
+
}
|
|
245
|
+
if (t.type === "dir") {
|
|
246
|
+
n.push({ spans: [{
|
|
247
|
+
text: `cat: ${r}: Is a directory`,
|
|
248
|
+
cls: "text-red-500 dark:text-red-400"
|
|
249
|
+
}] });
|
|
250
|
+
continue;
|
|
251
|
+
}
|
|
252
|
+
for (let e of t.content.split("\n")) n.push({ spans: [{ text: e }] });
|
|
253
|
+
}
|
|
254
|
+
return { lines: n };
|
|
255
|
+
}
|
|
256
|
+
function E(e, t) {
|
|
257
|
+
let n = [];
|
|
258
|
+
for (let r of t.filter((e) => !e.startsWith("-"))) {
|
|
259
|
+
let t = h(e.root, p(e, r));
|
|
260
|
+
if (!t) {
|
|
261
|
+
n.push({ spans: [{
|
|
262
|
+
text: `mkdir: cannot create directory '${r}': No such file or directory`,
|
|
263
|
+
cls: "text-red-500 dark:text-red-400"
|
|
264
|
+
}] });
|
|
265
|
+
continue;
|
|
266
|
+
}
|
|
267
|
+
let [i, a] = t;
|
|
268
|
+
if (i.children.has(a)) {
|
|
269
|
+
n.push({ spans: [{
|
|
270
|
+
text: `mkdir: cannot create directory '${r}': File exists`,
|
|
271
|
+
cls: "text-red-500 dark:text-red-400"
|
|
272
|
+
}] });
|
|
273
|
+
continue;
|
|
274
|
+
}
|
|
275
|
+
i.children.set(a, l());
|
|
276
|
+
}
|
|
277
|
+
return { lines: n };
|
|
278
|
+
}
|
|
279
|
+
function D(e, t) {
|
|
280
|
+
let n = [];
|
|
281
|
+
for (let r of t.filter((e) => !e.startsWith("-"))) {
|
|
282
|
+
let t = p(e, r), i = m(e.root, t);
|
|
283
|
+
if (i) {
|
|
284
|
+
i.mtime = /* @__PURE__ */ new Date();
|
|
285
|
+
continue;
|
|
286
|
+
}
|
|
287
|
+
let a = h(e.root, t);
|
|
288
|
+
if (!a) {
|
|
289
|
+
n.push({ spans: [{
|
|
290
|
+
text: `touch: cannot touch '${r}': No such file or directory`,
|
|
291
|
+
cls: "text-red-500 dark:text-red-400"
|
|
292
|
+
}] });
|
|
293
|
+
continue;
|
|
294
|
+
}
|
|
295
|
+
let [o, s] = a;
|
|
296
|
+
o.children.set(s, c(""));
|
|
297
|
+
}
|
|
298
|
+
return { lines: n };
|
|
299
|
+
}
|
|
300
|
+
function O(e, t) {
|
|
301
|
+
let n = !1, r = t.filter((e) => !e.startsWith("-") || (/r/i.test(e) && (n = !0), !1)), i = [];
|
|
302
|
+
for (let t of r) {
|
|
303
|
+
let r = m(e.root, p(e, t));
|
|
304
|
+
if (!r) {
|
|
305
|
+
i.push({ spans: [{
|
|
306
|
+
text: `rm: cannot remove '${t}': No such file or directory`,
|
|
307
|
+
cls: "text-red-500 dark:text-red-400"
|
|
308
|
+
}] });
|
|
309
|
+
continue;
|
|
310
|
+
}
|
|
311
|
+
if (r.type === "dir" && !n) {
|
|
312
|
+
i.push({ spans: [{
|
|
313
|
+
text: `rm: cannot remove '${t}': Is a directory`,
|
|
314
|
+
cls: "text-red-500 dark:text-red-400"
|
|
315
|
+
}] });
|
|
316
|
+
continue;
|
|
317
|
+
}
|
|
318
|
+
let a = h(e.root, p(e, t));
|
|
319
|
+
a && a[0].children.delete(a[1]);
|
|
320
|
+
}
|
|
321
|
+
return { lines: i };
|
|
322
|
+
}
|
|
323
|
+
function k(e, t, n) {
|
|
324
|
+
let r = n ? "mv" : "cp", i = t.filter((e) => !e.startsWith("-"));
|
|
325
|
+
if (i.length < 2) return x(`${r}: missing destination operand`);
|
|
326
|
+
let [a, o] = [p(e, i[0]), p(e, i[1])], s = m(e.root, a);
|
|
327
|
+
if (!s) return x(`${r}: cannot stat '${i[0]}': No such file or directory`);
|
|
328
|
+
if (s.type === "dir" && !n) return x(`cp: -r not specified; omitting directory '${i[0]}'`);
|
|
329
|
+
let c = o;
|
|
330
|
+
m(e.root, o)?.type === "dir" && (c = o + "/" + a.split("/").pop());
|
|
331
|
+
let l = h(e.root, c);
|
|
332
|
+
if (!l) return x(`${r}: cannot create '${i[1]}': No such file or directory`);
|
|
333
|
+
if (l[0].children.set(l[1], {
|
|
334
|
+
...s,
|
|
335
|
+
mtime: /* @__PURE__ */ new Date()
|
|
336
|
+
}), n) {
|
|
337
|
+
let t = h(e.root, a);
|
|
338
|
+
t && t[0].children.delete(t[1]);
|
|
339
|
+
}
|
|
340
|
+
return { lines: [] };
|
|
341
|
+
}
|
|
342
|
+
function A(e, t) {
|
|
343
|
+
let n = t.filter((e) => e.startsWith("-")), r = t.filter((e) => !e.startsWith("-"));
|
|
344
|
+
if (!r.length) return x("grep: missing pattern");
|
|
345
|
+
let [i, ...a] = r, o = n.some((e) => e.includes("i")), s = n.some((e) => e.includes("n")), c = n.some((e) => e.includes("v")), l = [];
|
|
346
|
+
for (let t of a) {
|
|
347
|
+
let n = m(e.root, p(e, t));
|
|
348
|
+
if (!n || n.type !== "file") {
|
|
349
|
+
l.push({ spans: [{
|
|
350
|
+
text: `grep: ${t}: No such file or directory`,
|
|
351
|
+
cls: "text-red-500 dark:text-red-400"
|
|
352
|
+
}] });
|
|
353
|
+
continue;
|
|
354
|
+
}
|
|
355
|
+
let r = new RegExp(i, o ? "gi" : "g");
|
|
356
|
+
n.content.split("\n").forEach((e, n) => {
|
|
357
|
+
let i = r.test(e);
|
|
358
|
+
if (c ? !i : i) {
|
|
359
|
+
let r = a.length > 1 ? `${t}:` : "";
|
|
360
|
+
l.push({ spans: [{ text: r + (s ? `${n + 1}:` : "") + e }] });
|
|
361
|
+
}
|
|
362
|
+
});
|
|
363
|
+
}
|
|
364
|
+
return { lines: l };
|
|
365
|
+
}
|
|
366
|
+
function j(e, t) {
|
|
367
|
+
let n = t[0] && !t[0].startsWith("-") ? p(e, t[0]) : "/" + e.cwd.join("/"), r = [];
|
|
368
|
+
function i(t) {
|
|
369
|
+
let n = m(e.root, t);
|
|
370
|
+
if (n && (r.push({ spans: [{ text: t }] }), n.type === "dir")) for (let [e] of n.children) i(t === "/" ? "/" + e : t + "/" + e);
|
|
371
|
+
}
|
|
372
|
+
return i(n), { lines: r };
|
|
373
|
+
}
|
|
374
|
+
function M(e, t) {
|
|
375
|
+
let n = t.filter((e) => e.startsWith("-")), r = t.filter((e) => !e.startsWith("-")), i = !n.length || n.some((e) => e.includes("l")), a = !n.length || n.some((e) => e.includes("w")), o = !n.length || n.some((e) => e.includes("c")), s = [];
|
|
376
|
+
for (let t of r) {
|
|
377
|
+
let n = m(e.root, p(e, t));
|
|
378
|
+
if (!n || n.type !== "file") {
|
|
379
|
+
s.push({ spans: [{
|
|
380
|
+
text: `wc: ${t}: No such file or directory`,
|
|
381
|
+
cls: "text-red-500 dark:text-red-400"
|
|
382
|
+
}] });
|
|
383
|
+
continue;
|
|
384
|
+
}
|
|
385
|
+
let r = n.content.split("\n").length - 1, c = n.content.trim().split(/\s+/).filter(Boolean).length, l = n.content.length, u = [];
|
|
386
|
+
i && u.push(String(r).padStart(4)), a && u.push(String(c).padStart(4)), o && u.push(String(l).padStart(4)), s.push({ spans: [{ text: u.join(" ") + " " + t }] });
|
|
387
|
+
}
|
|
388
|
+
return { lines: s };
|
|
389
|
+
}
|
|
390
|
+
function N(e, t, n) {
|
|
391
|
+
let r = 10, i = [];
|
|
392
|
+
for (let e = 0; e < t.length; e++) {
|
|
393
|
+
if (t[e] === "-n" && t[e + 1]) {
|
|
394
|
+
r = parseInt(t[++e]);
|
|
395
|
+
continue;
|
|
396
|
+
}
|
|
397
|
+
if (/^-\d+$/.test(t[e])) {
|
|
398
|
+
r = parseInt(t[e].slice(1));
|
|
399
|
+
continue;
|
|
400
|
+
}
|
|
401
|
+
i.push(t[e]);
|
|
402
|
+
}
|
|
403
|
+
let a = [];
|
|
404
|
+
for (let t of i) {
|
|
405
|
+
let i = m(e.root, p(e, t));
|
|
406
|
+
if (!i || i.type !== "file") {
|
|
407
|
+
a.push({ spans: [{
|
|
408
|
+
text: `${n ? "tail" : "head"}: cannot open '${t}': No such file or directory`,
|
|
409
|
+
cls: "text-red-500 dark:text-red-400"
|
|
410
|
+
}] });
|
|
411
|
+
continue;
|
|
412
|
+
}
|
|
413
|
+
let o = i.content.split("\n");
|
|
414
|
+
(n ? o.slice(-r) : o.slice(0, r)).forEach((e) => a.push({ spans: [{ text: e }] }));
|
|
415
|
+
}
|
|
416
|
+
return { lines: a };
|
|
417
|
+
}
|
|
418
|
+
//#endregion
|
|
419
|
+
//#region src/components/terminal/shell-commands-sim.ts
|
|
420
|
+
function P(e, t) {
|
|
421
|
+
let n = t[0];
|
|
422
|
+
if (!n) return S("usage: git [--version] [--help] <command> [<args>]", "", "Common commands: init clone status add commit push pull log diff branch checkout merge");
|
|
423
|
+
if (n === "status") return S("On branch main", "Your branch is up to date with 'origin/main'.", "", "nothing to commit, working tree clean");
|
|
424
|
+
if (n === "log") return { lines: [
|
|
425
|
+
{ spans: [{
|
|
426
|
+
text: "commit a3f8c1e9d2b74f6a1c8e3d5b9f2a7c4e8d1b3f5 (HEAD -> main)",
|
|
427
|
+
cls: "text-amber-600 dark:text-amber-400"
|
|
428
|
+
}] },
|
|
429
|
+
{ spans: [{ text: "Author: User <user@example.com>" }] },
|
|
430
|
+
{ spans: [{ text: "Date: Thu Jun 5 12:00:00 2026 +0000" }] },
|
|
431
|
+
{ spans: [{ text: "" }] },
|
|
432
|
+
{ spans: [{ text: " Initial commit" }] }
|
|
433
|
+
] };
|
|
434
|
+
if (n === "init") return S(`Initialized empty Git repository in ${g(e)}/.git/`);
|
|
435
|
+
if (n === "branch") return { lines: [{ spans: [{
|
|
436
|
+
text: "* main",
|
|
437
|
+
cls: "text-emerald-600 dark:text-emerald-500"
|
|
438
|
+
}] }] };
|
|
439
|
+
if (n === "diff") return S("(no changes)");
|
|
440
|
+
if (n === "add" || n === "checkout") return { lines: [] };
|
|
441
|
+
if (n === "commit") {
|
|
442
|
+
let e = t.indexOf("-m");
|
|
443
|
+
return S(`[main a3f8c1e] ${e === -1 ? "update" : t[e + 1]}`, " 1 file changed, 1 insertion(+)");
|
|
444
|
+
}
|
|
445
|
+
return n === "push" || n === "pull" ? S("Already up to date.") : n === "clone" ? S(`Cloning into '${(t[1] ?? "<url>").split("/").pop()?.replace(".git", "") ?? "repo"}'...`, "remote: Counting objects: 100% (42/42), done.", "Receiving objects: 100% (42/42), 12.34 KiB | 1.23 MiB/s, done.") : n === "--version" ? S("git version 2.43.0") : x(`git: '${n}' is not a git command. See 'git --help'.`);
|
|
446
|
+
}
|
|
447
|
+
function F(e) {
|
|
448
|
+
let t = e[0];
|
|
449
|
+
if (t === "update") return S("Get:1 http://archive.ubuntu.com/ubuntu noble InRelease [256 kB]", "Fetched 256 kB in 1s (256 kB/s)", "Reading package lists... Done", "Building dependency tree... Done", "2 packages can be upgraded.");
|
|
450
|
+
if (t === "upgrade") return S("Reading package lists... Done", "Building dependency tree... Done", "0 upgraded, 0 newly installed, 0 to remove and 2 not upgraded.");
|
|
451
|
+
if (t === "install") {
|
|
452
|
+
let t = e[1] ?? "";
|
|
453
|
+
return t ? S("Reading package lists... Done", `The following NEW packages will be installed:\n ${t}`, `Get:1 http://archive.ubuntu.com/ubuntu noble/universe amd64 ${t} 1.0.0-1 [128 kB]`, "Fetched 128 kB in 0s", `Setting up ${t} (1.0.0-1) ...`) : x("apt: package name required");
|
|
454
|
+
}
|
|
455
|
+
return t === "list" ? S("Listing... Done", "bash/noble,now 5.2.21-2ubuntu4 amd64 [installed]", "curl/noble,now 8.5.0 amd64 [installed]", "git/noble,now 1:2.43.0 amd64 [installed]", "nodejs/noble,now 18.19.0 amd64 [installed]", "python3/noble,now 3.12.3 amd64 [installed]") : S("Usage: apt [options] command", "", "Available commands:", " update, upgrade, install, remove, list, search, show");
|
|
456
|
+
}
|
|
457
|
+
function I(e) {
|
|
458
|
+
let t = e.find((e) => !e.startsWith("-")) ?? "google.com", n = e.indexOf("-c"), r = n === -1 ? 4 : Math.min(parseInt(e[n + 1] ?? "4"), 8), i = [{ spans: [{ text: `PING ${t} (142.250.185.46) 56(84) bytes of data.` }] }];
|
|
459
|
+
for (let e = 0; e < r; e++) {
|
|
460
|
+
let n = (12 + Math.random() * 8).toFixed(3);
|
|
461
|
+
i.push({ spans: [{ text: `64 bytes from ${t} (142.250.185.46): icmp_seq=${e + 1} ttl=115 time=${n} ms` }] });
|
|
462
|
+
}
|
|
463
|
+
return i.push({ spans: [{ text: "" }] }), i.push({ spans: [{ text: `--- ${t} ping statistics ---` }] }), i.push({ spans: [{ text: `${r} packets transmitted, ${r} received, 0% packet loss` }] }), i.push({ spans: [{ text: "rtt min/avg/max = 12.1/15.3/20.1 ms" }] }), { lines: i };
|
|
464
|
+
}
|
|
465
|
+
function L() {
|
|
466
|
+
return { lines: [
|
|
467
|
+
{ spans: [{
|
|
468
|
+
text: "Available commands:",
|
|
469
|
+
cls: "font-bold text-slate-700 dark:text-slate-200"
|
|
470
|
+
}] },
|
|
471
|
+
{ spans: [{ text: "" }] },
|
|
472
|
+
{ spans: [{
|
|
473
|
+
text: " File system: ",
|
|
474
|
+
cls: "text-sky-600 dark:text-sky-400"
|
|
475
|
+
}, { text: "ls cd pwd cat mkdir touch rm cp mv find" }] },
|
|
476
|
+
{ spans: [{
|
|
477
|
+
text: " Text tools: ",
|
|
478
|
+
cls: "text-sky-600 dark:text-sky-400"
|
|
479
|
+
}, { text: "echo grep wc head tail sort" }] },
|
|
480
|
+
{ spans: [{
|
|
481
|
+
text: " System: ",
|
|
482
|
+
cls: "text-sky-600 dark:text-sky-400"
|
|
483
|
+
}, { text: "whoami id uname hostname date uptime df free ps" }] },
|
|
484
|
+
{ spans: [{
|
|
485
|
+
text: " Environment: ",
|
|
486
|
+
cls: "text-sky-600 dark:text-sky-400"
|
|
487
|
+
}, { text: "env export unset which" }] },
|
|
488
|
+
{ spans: [{
|
|
489
|
+
text: " Network: ",
|
|
490
|
+
cls: "text-sky-600 dark:text-sky-400"
|
|
491
|
+
}, { text: "ping curl wget" }] },
|
|
492
|
+
{ spans: [{
|
|
493
|
+
text: " Packages: ",
|
|
494
|
+
cls: "text-sky-600 dark:text-sky-400"
|
|
495
|
+
}, { text: "apt apt-get" }] },
|
|
496
|
+
{ spans: [{
|
|
497
|
+
text: " Dev tools: ",
|
|
498
|
+
cls: "text-sky-600 dark:text-sky-400"
|
|
499
|
+
}, { text: "git node python3 npm" }] },
|
|
500
|
+
{ spans: [{
|
|
501
|
+
text: " Shell: ",
|
|
502
|
+
cls: "text-sky-600 dark:text-sky-400"
|
|
503
|
+
}, { text: "history clear sudo chmod alias" }] },
|
|
504
|
+
{ spans: [{ text: "" }] },
|
|
505
|
+
{ spans: [{
|
|
506
|
+
text: "Keyboard: ",
|
|
507
|
+
cls: "text-slate-500 dark:text-slate-500"
|
|
508
|
+
}, { text: "↑↓ history Tab complete Ctrl+C cancel Ctrl+L clear" }] }
|
|
509
|
+
] };
|
|
510
|
+
}
|
|
511
|
+
//#endregion
|
|
512
|
+
//#region src/components/terminal/shell-run.ts
|
|
513
|
+
function R(e, t) {
|
|
514
|
+
let [n, ...r] = _(v(e, t.trim()));
|
|
515
|
+
if (!n) return {
|
|
516
|
+
lines: [],
|
|
517
|
+
next: {
|
|
518
|
+
...e,
|
|
519
|
+
history: [...e.history, t].slice(-500)
|
|
520
|
+
}
|
|
521
|
+
};
|
|
522
|
+
let i;
|
|
523
|
+
switch (n) {
|
|
524
|
+
case "pwd":
|
|
525
|
+
i = S("/" + (e.cwd.join("/") || ""));
|
|
526
|
+
break;
|
|
527
|
+
case "ls":
|
|
528
|
+
i = C(e, r);
|
|
529
|
+
break;
|
|
530
|
+
case "cd":
|
|
531
|
+
i = w(e, r);
|
|
532
|
+
break;
|
|
533
|
+
case "echo":
|
|
534
|
+
i = S(r.filter((e) => e !== "-n" && e !== "-e").map((t) => v(e, t)).join(" "));
|
|
535
|
+
break;
|
|
536
|
+
case "cat":
|
|
537
|
+
i = T(e, r);
|
|
538
|
+
break;
|
|
539
|
+
case "mkdir":
|
|
540
|
+
i = E(e, r);
|
|
541
|
+
break;
|
|
542
|
+
case "touch":
|
|
543
|
+
i = D(e, r);
|
|
544
|
+
break;
|
|
545
|
+
case "rm":
|
|
546
|
+
i = O(e, r);
|
|
547
|
+
break;
|
|
548
|
+
case "cp":
|
|
549
|
+
i = k(e, r, !1);
|
|
550
|
+
break;
|
|
551
|
+
case "mv":
|
|
552
|
+
i = k(e, r, !0);
|
|
553
|
+
break;
|
|
554
|
+
case "clear":
|
|
555
|
+
i = {
|
|
556
|
+
lines: [],
|
|
557
|
+
clear: !0
|
|
558
|
+
};
|
|
559
|
+
break;
|
|
560
|
+
case "history":
|
|
561
|
+
i = { lines: e.history.map((e, t) => ({ spans: [{
|
|
562
|
+
text: ` ${String(t + 1).padStart(4)} `,
|
|
563
|
+
cls: "text-slate-500"
|
|
564
|
+
}, { text: e }] })) };
|
|
565
|
+
break;
|
|
566
|
+
case "grep":
|
|
567
|
+
i = A(e, r);
|
|
568
|
+
break;
|
|
569
|
+
case "find":
|
|
570
|
+
i = j(e, r);
|
|
571
|
+
break;
|
|
572
|
+
case "wc":
|
|
573
|
+
i = M(e, r);
|
|
574
|
+
break;
|
|
575
|
+
case "head":
|
|
576
|
+
i = N(e, r, !1);
|
|
577
|
+
break;
|
|
578
|
+
case "tail":
|
|
579
|
+
i = N(e, r, !0);
|
|
580
|
+
break;
|
|
581
|
+
case "sort": {
|
|
582
|
+
let t = r[0];
|
|
583
|
+
if (!t) {
|
|
584
|
+
i = x("sort: missing operand");
|
|
585
|
+
break;
|
|
586
|
+
}
|
|
587
|
+
let n = m(e.root, p(e, t));
|
|
588
|
+
if (!n || n.type !== "file") {
|
|
589
|
+
i = x(`sort: cannot read: ${t}`);
|
|
590
|
+
break;
|
|
591
|
+
}
|
|
592
|
+
i = { lines: n.content.split("\n").sort().map((e) => ({ spans: [{ text: e }] })) };
|
|
593
|
+
break;
|
|
594
|
+
}
|
|
595
|
+
case "whoami":
|
|
596
|
+
i = S(e.user);
|
|
597
|
+
break;
|
|
598
|
+
case "id":
|
|
599
|
+
i = S(`uid=1000(${e.user}) gid=1000(${e.user}) groups=1000(${e.user}),27(sudo),4(adm)`);
|
|
600
|
+
break;
|
|
601
|
+
case "uname":
|
|
602
|
+
i = S(r.includes("-a") ? `Linux ${e.hostname} 6.8.0-51-generic #52-Ubuntu SMP x86_64 GNU/Linux` : "Linux");
|
|
603
|
+
break;
|
|
604
|
+
case "hostname":
|
|
605
|
+
i = S(e.hostname);
|
|
606
|
+
break;
|
|
607
|
+
case "date":
|
|
608
|
+
i = S((/* @__PURE__ */ new Date()).toString());
|
|
609
|
+
break;
|
|
610
|
+
case "uptime": {
|
|
611
|
+
let t = Math.floor((Date.now() - e.startTime.getTime()) / 1e3);
|
|
612
|
+
i = S(` ${(/* @__PURE__ */ new Date()).toLocaleTimeString()} up ${Math.floor(t / 3600)}:${String(Math.floor(t % 3600 / 60)).padStart(2, "0")}, 1 user, load average: 0.08, 0.12, 0.09`);
|
|
613
|
+
break;
|
|
614
|
+
}
|
|
615
|
+
case "df":
|
|
616
|
+
i = { lines: [
|
|
617
|
+
{ spans: [{
|
|
618
|
+
text: "Filesystem Size Used Avail Use% Mounted on",
|
|
619
|
+
cls: "text-slate-500 dark:text-slate-500"
|
|
620
|
+
}] },
|
|
621
|
+
{ spans: [{ text: r.includes("-h") ? "/dev/sda1 79G 12G 63G 16% /" : "/dev/sda1 82636288 12582912 65901568 16% /" }] },
|
|
622
|
+
{ spans: [{ text: r.includes("-h") ? "tmpfs 7.8G 0 7.8G 0% /dev/shm" : "tmpfs 8133480 0 8133480 0% /dev/shm" }] }
|
|
623
|
+
] };
|
|
624
|
+
break;
|
|
625
|
+
case "free":
|
|
626
|
+
i = { lines: [
|
|
627
|
+
{ spans: [{
|
|
628
|
+
text: " total used free shared buff/cache available",
|
|
629
|
+
cls: "text-slate-500 dark:text-slate-500"
|
|
630
|
+
}] },
|
|
631
|
+
{ spans: [{ text: r.includes("-h") ? "Mem: 15Gi 3.1Gi 8.7Gi 310Mi 3.6Gi 11Gi" : "Mem: 16266960 3211264 8921088 318464 3682496 11502208" }] },
|
|
632
|
+
{ spans: [{ text: r.includes("-h") ? "Swap: 975Mi 0B 975Mi" : "Swap: 999420 0 999420" }] }
|
|
633
|
+
] };
|
|
634
|
+
break;
|
|
635
|
+
case "ps":
|
|
636
|
+
i = { lines: [
|
|
637
|
+
{ spans: [{
|
|
638
|
+
text: " PID TTY TIME CMD",
|
|
639
|
+
cls: "text-slate-500 dark:text-slate-500"
|
|
640
|
+
}] },
|
|
641
|
+
{ spans: [{ text: " 1234 pts/0 00:00:00 bash" }] },
|
|
642
|
+
{ spans: [{ text: " 5678 pts/0 00:00:00 ps" }] }
|
|
643
|
+
] };
|
|
644
|
+
break;
|
|
645
|
+
case "env":
|
|
646
|
+
i = { lines: Object.entries(e.env).map(([e, t]) => ({ spans: [
|
|
647
|
+
{
|
|
648
|
+
text: e,
|
|
649
|
+
cls: "text-sky-600 dark:text-sky-400"
|
|
650
|
+
},
|
|
651
|
+
{ text: "=" },
|
|
652
|
+
{
|
|
653
|
+
text: t,
|
|
654
|
+
cls: "text-emerald-600 dark:text-emerald-500"
|
|
655
|
+
}
|
|
656
|
+
] })) };
|
|
657
|
+
break;
|
|
658
|
+
case "export": {
|
|
659
|
+
let t = { ...e.env };
|
|
660
|
+
for (let n of r) {
|
|
661
|
+
let r = n.indexOf("=");
|
|
662
|
+
r > -1 && (t[n.slice(0, r)] = v(e, n.slice(r + 1)));
|
|
663
|
+
}
|
|
664
|
+
i = {
|
|
665
|
+
lines: [],
|
|
666
|
+
patch: { env: t }
|
|
667
|
+
};
|
|
668
|
+
break;
|
|
669
|
+
}
|
|
670
|
+
case "unset": {
|
|
671
|
+
let t = { ...e.env };
|
|
672
|
+
for (let e of r) delete t[e];
|
|
673
|
+
i = {
|
|
674
|
+
lines: [],
|
|
675
|
+
patch: { env: t }
|
|
676
|
+
};
|
|
677
|
+
break;
|
|
678
|
+
}
|
|
679
|
+
case "which": {
|
|
680
|
+
let e = {
|
|
681
|
+
bash: "/bin/bash",
|
|
682
|
+
ls: "/bin/ls",
|
|
683
|
+
cat: "/bin/cat",
|
|
684
|
+
echo: "/bin/echo",
|
|
685
|
+
rm: "/bin/rm",
|
|
686
|
+
cp: "/bin/cp",
|
|
687
|
+
mv: "/bin/mv",
|
|
688
|
+
mkdir: "/bin/mkdir",
|
|
689
|
+
touch: "/usr/bin/touch",
|
|
690
|
+
pwd: "/bin/pwd",
|
|
691
|
+
grep: "/bin/grep",
|
|
692
|
+
find: "/usr/bin/find",
|
|
693
|
+
sort: "/usr/bin/sort",
|
|
694
|
+
wc: "/usr/bin/wc",
|
|
695
|
+
head: "/usr/bin/head",
|
|
696
|
+
tail: "/usr/bin/tail",
|
|
697
|
+
date: "/bin/date",
|
|
698
|
+
hostname: "/bin/hostname",
|
|
699
|
+
uname: "/bin/uname",
|
|
700
|
+
whoami: "/usr/bin/whoami",
|
|
701
|
+
id: "/usr/bin/id",
|
|
702
|
+
env: "/usr/bin/env",
|
|
703
|
+
which: "/usr/bin/which",
|
|
704
|
+
python3: "/usr/bin/python3",
|
|
705
|
+
node: "/usr/bin/node",
|
|
706
|
+
npm: "/usr/bin/npm",
|
|
707
|
+
git: "/usr/bin/git",
|
|
708
|
+
curl: "/usr/bin/curl",
|
|
709
|
+
wget: "/usr/bin/wget",
|
|
710
|
+
apt: "/usr/bin/apt",
|
|
711
|
+
df: "/bin/df",
|
|
712
|
+
du: "/usr/bin/du",
|
|
713
|
+
free: "/usr/bin/free",
|
|
714
|
+
ps: "/bin/ps",
|
|
715
|
+
uptime: "/usr/bin/uptime",
|
|
716
|
+
chmod: "/bin/chmod",
|
|
717
|
+
chown: "/bin/chown",
|
|
718
|
+
sudo: "/usr/bin/sudo",
|
|
719
|
+
ping: "/bin/ping"
|
|
720
|
+
};
|
|
721
|
+
i = { lines: r.map((t) => ({ spans: [{
|
|
722
|
+
text: e[t] ?? "",
|
|
723
|
+
cls: e[t] ? void 0 : "text-red-500 dark:text-red-400"
|
|
724
|
+
}, { text: e[t] ? "" : `${t} not found` }] })).filter((e) => e.spans.some((e) => e.text)) };
|
|
725
|
+
break;
|
|
726
|
+
}
|
|
727
|
+
case "chmod":
|
|
728
|
+
i = { lines: [] };
|
|
729
|
+
break;
|
|
730
|
+
case "chown":
|
|
731
|
+
i = { lines: [] };
|
|
732
|
+
break;
|
|
733
|
+
case "sudo":
|
|
734
|
+
i = S(`[sudo] simulated — running as root: ${r.join(" ")}`);
|
|
735
|
+
break;
|
|
736
|
+
case "git":
|
|
737
|
+
i = P(e, r);
|
|
738
|
+
break;
|
|
739
|
+
case "apt":
|
|
740
|
+
case "apt-get":
|
|
741
|
+
i = F(r);
|
|
742
|
+
break;
|
|
743
|
+
case "snap":
|
|
744
|
+
i = S("snap: simulated snap package manager");
|
|
745
|
+
break;
|
|
746
|
+
case "node":
|
|
747
|
+
i = r.length ? x(`node: ${r[0]}: No such file`) : S("Welcome to Node.js v20.18.0.", "Type \".help\" for more information.", "> (REPL not supported in browser — run node <file.js>)");
|
|
748
|
+
break;
|
|
749
|
+
case "python3":
|
|
750
|
+
case "python":
|
|
751
|
+
i = r.length ? x(`python3: can't open file '${r[0]}'`) : S("Python 3.12.3 (main, Nov 6 2024) on linux", ">>> (REPL not supported in browser — run python3 <file.py>)");
|
|
752
|
+
break;
|
|
753
|
+
case "npm":
|
|
754
|
+
i = r[0] === "install" || r[0] === "i" ? S(`added ${+!!r[1]} packages in 0.5s`) : r[0] === "run" ? S(`> ${r[1]}`, "", `Running ${r[1]}...`) : x(`npm: unknown command: ${r[0] ?? "(none)"}`);
|
|
755
|
+
break;
|
|
756
|
+
case "ping":
|
|
757
|
+
i = I(r);
|
|
758
|
+
break;
|
|
759
|
+
case "curl":
|
|
760
|
+
i = r[0] ? S(`{"status":"ok","message":"Simulated response from ${r.find((e) => !e.startsWith("-")) ?? ""}"}`) : x("curl: try 'curl --help'");
|
|
761
|
+
break;
|
|
762
|
+
case "wget":
|
|
763
|
+
i = S(`--${(/* @__PURE__ */ new Date()).toISOString()}-- ${r[0] ?? ""}`, "Saving to: stdout", "100% [========================================]", "done.");
|
|
764
|
+
break;
|
|
765
|
+
case "man":
|
|
766
|
+
case "help":
|
|
767
|
+
i = L();
|
|
768
|
+
break;
|
|
769
|
+
case "less":
|
|
770
|
+
case "more":
|
|
771
|
+
i = r[0] ? T(e, r) : x(`usage: ${n} <file>`);
|
|
772
|
+
break;
|
|
773
|
+
case "vim":
|
|
774
|
+
case "vi":
|
|
775
|
+
case "nano":
|
|
776
|
+
case "emacs":
|
|
777
|
+
i = { lines: [{ spans: [{
|
|
778
|
+
text: `${n}: terminal editor not available in browser. Use cat to view files.`,
|
|
779
|
+
cls: "text-amber-600 dark:text-amber-400"
|
|
780
|
+
}] }] };
|
|
781
|
+
break;
|
|
782
|
+
case "top":
|
|
783
|
+
case "htop":
|
|
784
|
+
i = { lines: [{ spans: [{
|
|
785
|
+
text: "interactive monitor not supported. Try: ps aux",
|
|
786
|
+
cls: "text-amber-600 dark:text-amber-400"
|
|
787
|
+
}] }] };
|
|
788
|
+
break;
|
|
789
|
+
case "exit":
|
|
790
|
+
case "logout":
|
|
791
|
+
i = S("logout");
|
|
792
|
+
break;
|
|
793
|
+
case "alias":
|
|
794
|
+
i = S("alias ll='ls -la'", "alias la='ls -A'", "alias l='ls -CF'");
|
|
795
|
+
break;
|
|
796
|
+
case "type":
|
|
797
|
+
i = S(`${r[0] ?? ""} is a shell builtin`);
|
|
798
|
+
break;
|
|
799
|
+
case "true":
|
|
800
|
+
i = { lines: [] };
|
|
801
|
+
break;
|
|
802
|
+
case "false":
|
|
803
|
+
i = { lines: [] };
|
|
804
|
+
break;
|
|
805
|
+
case "sleep":
|
|
806
|
+
i = { lines: [] };
|
|
807
|
+
break;
|
|
808
|
+
case "":
|
|
809
|
+
i = { lines: [] };
|
|
810
|
+
break;
|
|
811
|
+
default: i = x(`${n}: command not found`);
|
|
812
|
+
}
|
|
813
|
+
let a = {
|
|
814
|
+
...e,
|
|
815
|
+
cwd: i.patch?.cwd ?? e.cwd,
|
|
816
|
+
env: i.patch?.env ?? e.env,
|
|
817
|
+
history: [...e.history, t.trim()].filter(Boolean).slice(-500)
|
|
818
|
+
};
|
|
819
|
+
return {
|
|
820
|
+
lines: i.lines,
|
|
821
|
+
next: a,
|
|
822
|
+
clear: i.clear
|
|
823
|
+
};
|
|
824
|
+
}
|
|
825
|
+
var z = /* @__PURE__ */ "ls.cd.pwd.cat.mkdir.touch.rm.cp.mv.find.echo.grep.wc.head.tail.sort.whoami.id.uname.hostname.date.uptime.df.free.ps.env.export.unset.which.chmod.chown.sudo.git.apt.apt-get.node.python3.npm.ping.curl.wget.man.help.less.more.vim.nano.top.exit.alias.true.false.sleep.history.clear.type.bash.sh.snap.yarn.pip.pip3.wget.source".split(".");
|
|
826
|
+
function B(e, t) {
|
|
827
|
+
let n = _(t);
|
|
828
|
+
if (n.length === 0 || n.length === 1 && !t.endsWith(" ")) {
|
|
829
|
+
let e = n[0] ?? "", r = z.filter((t) => t.startsWith(e));
|
|
830
|
+
return r.length === 1 ? {
|
|
831
|
+
value: r[0] + " ",
|
|
832
|
+
completions: []
|
|
833
|
+
} : r.length > 1 ? {
|
|
834
|
+
value: t,
|
|
835
|
+
completions: r
|
|
836
|
+
} : {
|
|
837
|
+
value: t,
|
|
838
|
+
completions: []
|
|
839
|
+
};
|
|
840
|
+
}
|
|
841
|
+
let r = n[n.length - 1] ?? "", i = r.includes("/") ? r.slice(0, r.lastIndexOf("/") + 1) : "", a = r.slice(i.length), o = i ? p(e, i) : "/" + e.cwd.join("/"), s = m(e.root, o);
|
|
842
|
+
if (!s || s.type !== "dir") return {
|
|
843
|
+
value: t,
|
|
844
|
+
completions: []
|
|
845
|
+
};
|
|
846
|
+
let c = [...s.children.keys()].filter((e) => e.startsWith(a));
|
|
847
|
+
if (c.length === 0) return {
|
|
848
|
+
value: t,
|
|
849
|
+
completions: []
|
|
850
|
+
};
|
|
851
|
+
if (c.length === 1) {
|
|
852
|
+
let e = c[0], t = s.children.get(e).type === "dir" ? "/" : " ", r = i + e + t;
|
|
853
|
+
return {
|
|
854
|
+
value: [...n.slice(0, -1), r].join(" "),
|
|
855
|
+
completions: []
|
|
856
|
+
};
|
|
857
|
+
}
|
|
858
|
+
return {
|
|
859
|
+
value: t,
|
|
860
|
+
completions: c
|
|
861
|
+
};
|
|
862
|
+
}
|
|
863
|
+
function V(e) {
|
|
864
|
+
return [
|
|
865
|
+
{
|
|
866
|
+
text: `${e.user}@${e.hostname}`,
|
|
867
|
+
cls: "font-bold text-emerald-600 dark:text-emerald-500"
|
|
868
|
+
},
|
|
869
|
+
{
|
|
870
|
+
text: ":",
|
|
871
|
+
cls: "text-slate-700 dark:text-slate-200"
|
|
872
|
+
},
|
|
873
|
+
{
|
|
874
|
+
text: g(e),
|
|
875
|
+
cls: "font-bold text-sky-600 dark:text-sky-400"
|
|
876
|
+
},
|
|
877
|
+
{
|
|
878
|
+
text: "$ ",
|
|
879
|
+
cls: "text-slate-700 dark:text-slate-200"
|
|
880
|
+
}
|
|
881
|
+
];
|
|
882
|
+
}
|
|
883
|
+
//#endregion
|
|
884
|
+
//#region src/components/terminal/terminal-emulator.tsx
|
|
885
|
+
function H({ title: o = "Terminal", user: s = "user", hostname: c = "ubuntu", className: l }) {
|
|
886
|
+
let d = () => ({
|
|
887
|
+
root: u(),
|
|
888
|
+
cwd: ["home", s],
|
|
889
|
+
env: {
|
|
890
|
+
HOME: `/home/${s}`,
|
|
891
|
+
USER: s,
|
|
892
|
+
SHELL: "/bin/bash",
|
|
893
|
+
TERM: "xterm-256color",
|
|
894
|
+
PATH: "/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin",
|
|
895
|
+
LANG: "en_US.UTF-8"
|
|
896
|
+
},
|
|
897
|
+
history: [],
|
|
898
|
+
user: s,
|
|
899
|
+
hostname: c,
|
|
900
|
+
startTime: /* @__PURE__ */ new Date()
|
|
901
|
+
}), [f, p] = r(!1), [m, h] = r(d), [g, _] = r([]), [v, y] = r(""), [b, x] = r(-1), [S, C] = r([]), [w, T] = r(!0), E = n(null), D = n(null), O = n(0);
|
|
902
|
+
t(() => {
|
|
903
|
+
p(!0);
|
|
904
|
+
}, []), t(() => {
|
|
905
|
+
let e = setInterval(() => T((e) => !e), 530);
|
|
906
|
+
return () => clearInterval(e);
|
|
907
|
+
}, []), t(() => {
|
|
908
|
+
D.current && (D.current.scrollTop = D.current.scrollHeight);
|
|
909
|
+
}, [g]);
|
|
910
|
+
function k(e) {
|
|
911
|
+
_((t) => [...t, ...e.map((e) => ({
|
|
912
|
+
id: O.current++,
|
|
913
|
+
spans: e
|
|
914
|
+
}))]);
|
|
915
|
+
}
|
|
916
|
+
function A() {
|
|
917
|
+
let e = v.trim();
|
|
918
|
+
if (C([]), k([[...V(m), { text: e }]]), !e) {
|
|
919
|
+
y("");
|
|
920
|
+
return;
|
|
921
|
+
}
|
|
922
|
+
let { lines: t, next: n, clear: r } = R(m, e);
|
|
923
|
+
if (h(n), x(-1), y(""), r) {
|
|
924
|
+
_([]);
|
|
925
|
+
return;
|
|
926
|
+
}
|
|
927
|
+
t.length && k(t.map((e) => e.spans));
|
|
928
|
+
}
|
|
929
|
+
function j(e) {
|
|
930
|
+
if (e.key === "Enter") {
|
|
931
|
+
A();
|
|
932
|
+
return;
|
|
933
|
+
}
|
|
934
|
+
if (e.key === "c" && e.ctrlKey) {
|
|
935
|
+
e.preventDefault(), k([[
|
|
936
|
+
...V(m),
|
|
937
|
+
{ text: v },
|
|
938
|
+
{
|
|
939
|
+
text: "^C",
|
|
940
|
+
cls: "text-slate-500"
|
|
941
|
+
}
|
|
942
|
+
]]), y(""), x(-1), C([]);
|
|
943
|
+
return;
|
|
944
|
+
}
|
|
945
|
+
if (e.key === "l" && e.ctrlKey) {
|
|
946
|
+
e.preventDefault(), _([]);
|
|
947
|
+
return;
|
|
948
|
+
}
|
|
949
|
+
if (e.key === "u" && e.ctrlKey) {
|
|
950
|
+
e.preventDefault(), y("");
|
|
951
|
+
return;
|
|
952
|
+
}
|
|
953
|
+
if (e.key === "ArrowUp") {
|
|
954
|
+
e.preventDefault();
|
|
955
|
+
let t = Math.min(b + 1, m.history.length - 1);
|
|
956
|
+
t >= 0 && (x(t), y(m.history[m.history.length - 1 - t] ?? ""));
|
|
957
|
+
return;
|
|
958
|
+
}
|
|
959
|
+
if (e.key === "ArrowDown") {
|
|
960
|
+
e.preventDefault();
|
|
961
|
+
let t = b - 1;
|
|
962
|
+
t < 0 ? (x(-1), y("")) : (x(t), y(m.history[m.history.length - 1 - t] ?? ""));
|
|
963
|
+
return;
|
|
964
|
+
}
|
|
965
|
+
if (e.key === "Tab") {
|
|
966
|
+
e.preventDefault();
|
|
967
|
+
let { value: t, completions: n } = B(m, v);
|
|
968
|
+
y(t), C(n.length > 1 ? n : []);
|
|
969
|
+
return;
|
|
970
|
+
}
|
|
971
|
+
C([]);
|
|
972
|
+
}
|
|
973
|
+
let M = V(m);
|
|
974
|
+
return f ? /* @__PURE__ */ a("div", {
|
|
975
|
+
className: e("rounded-xl overflow-hidden border border-black/10 dark:border-white/10 bg-white dark:bg-[#0e1117] shadow-sm dark:shadow-xl dark:shadow-black/20 cursor-text flex flex-col", l),
|
|
976
|
+
onClick: () => E.current?.focus(),
|
|
977
|
+
children: [
|
|
978
|
+
/* @__PURE__ */ i("div", {
|
|
979
|
+
className: "flex items-center px-4 py-2.5 border-b border-black/[0.07] dark:border-white/[0.07] bg-black/3 dark:bg-white/[0.03] shrink-0",
|
|
980
|
+
children: /* @__PURE__ */ i("span", {
|
|
981
|
+
className: "flex-1 text-center text-xs text-slate-500 font-medium",
|
|
982
|
+
children: o
|
|
983
|
+
})
|
|
984
|
+
}),
|
|
985
|
+
/* @__PURE__ */ a("div", {
|
|
986
|
+
ref: D,
|
|
987
|
+
className: "flex-1 overflow-y-auto p-4 font-mono text-sm leading-6 min-h-[200px] max-h-80",
|
|
988
|
+
children: [
|
|
989
|
+
g.length === 0 && /* @__PURE__ */ a("div", {
|
|
990
|
+
className: "text-slate-400 dark:text-slate-500 mb-2 select-none",
|
|
991
|
+
children: [/* @__PURE__ */ a("div", { children: [
|
|
992
|
+
"Ubuntu 24.04.1 LTS — type ",
|
|
993
|
+
/* @__PURE__ */ i("span", {
|
|
994
|
+
className: "text-sky-600 dark:text-sky-400",
|
|
995
|
+
children: "help"
|
|
996
|
+
}),
|
|
997
|
+
" for available commands"
|
|
998
|
+
] }), /* @__PURE__ */ i("div", { className: "h-2" })]
|
|
999
|
+
}),
|
|
1000
|
+
g.map((e) => /* @__PURE__ */ i("div", {
|
|
1001
|
+
className: "whitespace-pre-wrap break-all",
|
|
1002
|
+
children: e.spans.map((e, t) => /* @__PURE__ */ i("span", {
|
|
1003
|
+
className: e.cls,
|
|
1004
|
+
children: e.text
|
|
1005
|
+
}, t))
|
|
1006
|
+
}, e.id)),
|
|
1007
|
+
S.length > 0 && /* @__PURE__ */ i("div", {
|
|
1008
|
+
className: "flex flex-wrap gap-x-4 text-slate-500 dark:text-slate-500 mt-1",
|
|
1009
|
+
children: S.map((e) => /* @__PURE__ */ i("span", { children: e }, e))
|
|
1010
|
+
})
|
|
1011
|
+
]
|
|
1012
|
+
}),
|
|
1013
|
+
/* @__PURE__ */ a("div", {
|
|
1014
|
+
className: "px-4 py-3 border-t border-black/8 dark:border-white/6 flex items-center font-mono text-sm shrink-0",
|
|
1015
|
+
children: [M.map((t, n) => /* @__PURE__ */ i("span", {
|
|
1016
|
+
className: e("whitespace-pre", t.cls),
|
|
1017
|
+
children: t.text
|
|
1018
|
+
}, n)), /* @__PURE__ */ a("span", {
|
|
1019
|
+
className: "relative flex-1 flex items-center min-w-0",
|
|
1020
|
+
children: [
|
|
1021
|
+
/* @__PURE__ */ i("input", {
|
|
1022
|
+
ref: E,
|
|
1023
|
+
value: v,
|
|
1024
|
+
onChange: (e) => y(e.target.value),
|
|
1025
|
+
onKeyDown: j,
|
|
1026
|
+
className: "absolute inset-0 w-full bg-transparent text-transparent focus:outline-none caret-transparent",
|
|
1027
|
+
spellCheck: !1,
|
|
1028
|
+
autoCapitalize: "none",
|
|
1029
|
+
autoComplete: "off",
|
|
1030
|
+
autoCorrect: "off"
|
|
1031
|
+
}),
|
|
1032
|
+
/* @__PURE__ */ i("span", {
|
|
1033
|
+
className: "whitespace-pre text-slate-800 dark:text-slate-100 pointer-events-none select-none",
|
|
1034
|
+
children: v
|
|
1035
|
+
}),
|
|
1036
|
+
/* @__PURE__ */ i("span", {
|
|
1037
|
+
className: e("inline-block h-[1.1em] w-[2px] bg-slate-700 dark:bg-slate-300 shrink-0", w ? "opacity-100" : "opacity-0"),
|
|
1038
|
+
"aria-hidden": !0
|
|
1039
|
+
})
|
|
1040
|
+
]
|
|
1041
|
+
})]
|
|
1042
|
+
})
|
|
1043
|
+
]
|
|
1044
|
+
}) : /* @__PURE__ */ a("div", {
|
|
1045
|
+
className: e("rounded-xl overflow-hidden border border-black/10 dark:border-white/10 bg-white dark:bg-[#0e1117] shadow-sm dark:shadow-xl dark:shadow-black/20 flex flex-col", l),
|
|
1046
|
+
children: [
|
|
1047
|
+
/* @__PURE__ */ i("div", {
|
|
1048
|
+
className: "flex items-center px-4 py-2.5 border-b border-black/[0.07] dark:border-white/[0.07] bg-black/3 dark:bg-white/[0.03] shrink-0",
|
|
1049
|
+
children: /* @__PURE__ */ i("span", {
|
|
1050
|
+
className: "flex-1 text-center text-xs text-slate-500 font-medium",
|
|
1051
|
+
children: o
|
|
1052
|
+
})
|
|
1053
|
+
}),
|
|
1054
|
+
/* @__PURE__ */ i("div", { className: "flex-1 min-h-[200px] max-h-80" }),
|
|
1055
|
+
/* @__PURE__ */ i("div", { className: "px-4 py-3 border-t border-black/8 dark:border-white/6 shrink-0" })
|
|
1056
|
+
]
|
|
1057
|
+
});
|
|
1058
|
+
}
|
|
1059
|
+
//#endregion
|
|
1060
|
+
export { s as n, H as t };
|