@lifo-sh/core 0.1.0

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.
Files changed (305) hide show
  1. package/dist/archive-D220So0m.js +192 -0
  2. package/dist/args-CG6b9cZt.js +43 -0
  3. package/dist/awk-rMPdpM91.js +118 -0
  4. package/dist/basename-C33A_Zse.js +12 -0
  5. package/dist/bc-BYiKVTNg.js +200 -0
  6. package/dist/cal-DPULSAhj.js +56 -0
  7. package/dist/cat-Crmqa4-2.js +29 -0
  8. package/dist/chmod-CcGyvoCX.js +56 -0
  9. package/dist/chown-CErsnGQX.js +28 -0
  10. package/dist/commands/archive/gunzip.d.ts +4 -0
  11. package/dist/commands/archive/gunzip.d.ts.map +1 -0
  12. package/dist/commands/archive/gzip.d.ts +4 -0
  13. package/dist/commands/archive/gzip.d.ts.map +1 -0
  14. package/dist/commands/archive/tar.d.ts +4 -0
  15. package/dist/commands/archive/tar.d.ts.map +1 -0
  16. package/dist/commands/archive/unzip.d.ts +4 -0
  17. package/dist/commands/archive/unzip.d.ts.map +1 -0
  18. package/dist/commands/archive/zip.d.ts +4 -0
  19. package/dist/commands/archive/zip.d.ts.map +1 -0
  20. package/dist/commands/fs/basename.d.ts +4 -0
  21. package/dist/commands/fs/basename.d.ts.map +1 -0
  22. package/dist/commands/fs/cat.d.ts +4 -0
  23. package/dist/commands/fs/cat.d.ts.map +1 -0
  24. package/dist/commands/fs/chmod.d.ts +4 -0
  25. package/dist/commands/fs/chmod.d.ts.map +1 -0
  26. package/dist/commands/fs/chown.d.ts +4 -0
  27. package/dist/commands/fs/chown.d.ts.map +1 -0
  28. package/dist/commands/fs/cp.d.ts +4 -0
  29. package/dist/commands/fs/cp.d.ts.map +1 -0
  30. package/dist/commands/fs/df.d.ts +4 -0
  31. package/dist/commands/fs/df.d.ts.map +1 -0
  32. package/dist/commands/fs/dirname.d.ts +4 -0
  33. package/dist/commands/fs/dirname.d.ts.map +1 -0
  34. package/dist/commands/fs/du.d.ts +4 -0
  35. package/dist/commands/fs/du.d.ts.map +1 -0
  36. package/dist/commands/fs/file.d.ts +4 -0
  37. package/dist/commands/fs/file.d.ts.map +1 -0
  38. package/dist/commands/fs/find.d.ts +4 -0
  39. package/dist/commands/fs/find.d.ts.map +1 -0
  40. package/dist/commands/fs/ln.d.ts +4 -0
  41. package/dist/commands/fs/ln.d.ts.map +1 -0
  42. package/dist/commands/fs/ls.d.ts +4 -0
  43. package/dist/commands/fs/ls.d.ts.map +1 -0
  44. package/dist/commands/fs/mkdir.d.ts +4 -0
  45. package/dist/commands/fs/mkdir.d.ts.map +1 -0
  46. package/dist/commands/fs/mktemp.d.ts +4 -0
  47. package/dist/commands/fs/mktemp.d.ts.map +1 -0
  48. package/dist/commands/fs/mv.d.ts +4 -0
  49. package/dist/commands/fs/mv.d.ts.map +1 -0
  50. package/dist/commands/fs/realpath.d.ts +4 -0
  51. package/dist/commands/fs/realpath.d.ts.map +1 -0
  52. package/dist/commands/fs/rm.d.ts +4 -0
  53. package/dist/commands/fs/rm.d.ts.map +1 -0
  54. package/dist/commands/fs/rmdir.d.ts +4 -0
  55. package/dist/commands/fs/rmdir.d.ts.map +1 -0
  56. package/dist/commands/fs/stat.d.ts +4 -0
  57. package/dist/commands/fs/stat.d.ts.map +1 -0
  58. package/dist/commands/fs/touch.d.ts +4 -0
  59. package/dist/commands/fs/touch.d.ts.map +1 -0
  60. package/dist/commands/fs/tree.d.ts +4 -0
  61. package/dist/commands/fs/tree.d.ts.map +1 -0
  62. package/dist/commands/index.d.ts +3 -0
  63. package/dist/commands/index.d.ts.map +1 -0
  64. package/dist/commands/io/printf.d.ts +4 -0
  65. package/dist/commands/io/printf.d.ts.map +1 -0
  66. package/dist/commands/io/tee.d.ts +4 -0
  67. package/dist/commands/io/tee.d.ts.map +1 -0
  68. package/dist/commands/io/xargs.d.ts +4 -0
  69. package/dist/commands/io/xargs.d.ts.map +1 -0
  70. package/dist/commands/io/yes.d.ts +4 -0
  71. package/dist/commands/io/yes.d.ts.map +1 -0
  72. package/dist/commands/net/curl.d.ts +6 -0
  73. package/dist/commands/net/curl.d.ts.map +1 -0
  74. package/dist/commands/net/dig.d.ts +4 -0
  75. package/dist/commands/net/dig.d.ts.map +1 -0
  76. package/dist/commands/net/ping.d.ts +4 -0
  77. package/dist/commands/net/ping.d.ts.map +1 -0
  78. package/dist/commands/net/wget.d.ts +4 -0
  79. package/dist/commands/net/wget.d.ts.map +1 -0
  80. package/dist/commands/registry.d.ts +13 -0
  81. package/dist/commands/registry.d.ts.map +1 -0
  82. package/dist/commands/system/bc.d.ts +4 -0
  83. package/dist/commands/system/bc.d.ts.map +1 -0
  84. package/dist/commands/system/cal.d.ts +4 -0
  85. package/dist/commands/system/cal.d.ts.map +1 -0
  86. package/dist/commands/system/date.d.ts +4 -0
  87. package/dist/commands/system/date.d.ts.map +1 -0
  88. package/dist/commands/system/env.d.ts +4 -0
  89. package/dist/commands/system/env.d.ts.map +1 -0
  90. package/dist/commands/system/free.d.ts +4 -0
  91. package/dist/commands/system/free.d.ts.map +1 -0
  92. package/dist/commands/system/help.d.ts +4 -0
  93. package/dist/commands/system/help.d.ts.map +1 -0
  94. package/dist/commands/system/hostname.d.ts +4 -0
  95. package/dist/commands/system/hostname.d.ts.map +1 -0
  96. package/dist/commands/system/kill.d.ts +4 -0
  97. package/dist/commands/system/kill.d.ts.map +1 -0
  98. package/dist/commands/system/man.d.ts +4 -0
  99. package/dist/commands/system/man.d.ts.map +1 -0
  100. package/dist/commands/system/node.d.ts +6 -0
  101. package/dist/commands/system/node.d.ts.map +1 -0
  102. package/dist/commands/system/pkg.d.ts +4 -0
  103. package/dist/commands/system/pkg.d.ts.map +1 -0
  104. package/dist/commands/system/ps.d.ts +4 -0
  105. package/dist/commands/system/ps.d.ts.map +1 -0
  106. package/dist/commands/system/sleep.d.ts +4 -0
  107. package/dist/commands/system/sleep.d.ts.map +1 -0
  108. package/dist/commands/system/top.d.ts +4 -0
  109. package/dist/commands/system/top.d.ts.map +1 -0
  110. package/dist/commands/system/uname.d.ts +4 -0
  111. package/dist/commands/system/uname.d.ts.map +1 -0
  112. package/dist/commands/system/uptime.d.ts +4 -0
  113. package/dist/commands/system/uptime.d.ts.map +1 -0
  114. package/dist/commands/system/watch.d.ts +4 -0
  115. package/dist/commands/system/watch.d.ts.map +1 -0
  116. package/dist/commands/system/which.d.ts +4 -0
  117. package/dist/commands/system/which.d.ts.map +1 -0
  118. package/dist/commands/system/whoami.d.ts +4 -0
  119. package/dist/commands/system/whoami.d.ts.map +1 -0
  120. package/dist/commands/text/awk.d.ts +4 -0
  121. package/dist/commands/text/awk.d.ts.map +1 -0
  122. package/dist/commands/text/cut.d.ts +4 -0
  123. package/dist/commands/text/cut.d.ts.map +1 -0
  124. package/dist/commands/text/diff.d.ts +4 -0
  125. package/dist/commands/text/diff.d.ts.map +1 -0
  126. package/dist/commands/text/grep.d.ts +4 -0
  127. package/dist/commands/text/grep.d.ts.map +1 -0
  128. package/dist/commands/text/head.d.ts +4 -0
  129. package/dist/commands/text/head.d.ts.map +1 -0
  130. package/dist/commands/text/nl.d.ts +4 -0
  131. package/dist/commands/text/nl.d.ts.map +1 -0
  132. package/dist/commands/text/rev.d.ts +4 -0
  133. package/dist/commands/text/rev.d.ts.map +1 -0
  134. package/dist/commands/text/sed.d.ts +4 -0
  135. package/dist/commands/text/sed.d.ts.map +1 -0
  136. package/dist/commands/text/sort.d.ts +4 -0
  137. package/dist/commands/text/sort.d.ts.map +1 -0
  138. package/dist/commands/text/tail.d.ts +4 -0
  139. package/dist/commands/text/tail.d.ts.map +1 -0
  140. package/dist/commands/text/tr.d.ts +4 -0
  141. package/dist/commands/text/tr.d.ts.map +1 -0
  142. package/dist/commands/text/uniq.d.ts +4 -0
  143. package/dist/commands/text/uniq.d.ts.map +1 -0
  144. package/dist/commands/text/wc.d.ts +4 -0
  145. package/dist/commands/text/wc.d.ts.map +1 -0
  146. package/dist/commands/types.d.ts +20 -0
  147. package/dist/commands/types.d.ts.map +1 -0
  148. package/dist/cp-CpjwiLUF.js +19 -0
  149. package/dist/cut-GfN8py4j.js +60 -0
  150. package/dist/date-C8NB8v8G.js +86 -0
  151. package/dist/df-CeZb4WOr.js +34 -0
  152. package/dist/diff-2wbVWmCT.js +129 -0
  153. package/dist/dig-BEJ8Ky96.js +69 -0
  154. package/dist/dirname-C5L53RA2.js +13 -0
  155. package/dist/du-B0shJpEL.js +77 -0
  156. package/dist/env-DXzvDKsN.js +9 -0
  157. package/dist/file-C2epVYvH.js +70 -0
  158. package/dist/find-DA-rpvsC.js +36 -0
  159. package/dist/free-DAxE4b2U.js +23 -0
  160. package/dist/grep-Bynq2w2E.js +140 -0
  161. package/dist/gunzip-B9b1Vph1.js +48 -0
  162. package/dist/gzip-CkXnPp5J.js +58 -0
  163. package/dist/head-DZJVLF1k.js +48 -0
  164. package/dist/hostname-BxU2S3nT.js +8 -0
  165. package/dist/index-Be1wosKt.js +6028 -0
  166. package/dist/index.d.ts +25 -0
  167. package/dist/index.d.ts.map +1 -0
  168. package/dist/index.js +51 -0
  169. package/dist/kernel/index.d.ts +25 -0
  170. package/dist/kernel/index.d.ts.map +1 -0
  171. package/dist/kernel/persistence/PersistenceManager.d.ts +10 -0
  172. package/dist/kernel/persistence/PersistenceManager.d.ts.map +1 -0
  173. package/dist/kernel/persistence/serializer.d.ts +13 -0
  174. package/dist/kernel/persistence/serializer.d.ts.map +1 -0
  175. package/dist/kernel/samples.d.ts +3 -0
  176. package/dist/kernel/samples.d.ts.map +1 -0
  177. package/dist/kernel/vfs/VFS.d.ts +36 -0
  178. package/dist/kernel/vfs/VFS.d.ts.map +1 -0
  179. package/dist/kernel/vfs/index.d.ts +4 -0
  180. package/dist/kernel/vfs/index.d.ts.map +1 -0
  181. package/dist/kernel/vfs/providers/DevProvider.d.ts +11 -0
  182. package/dist/kernel/vfs/providers/DevProvider.d.ts.map +1 -0
  183. package/dist/kernel/vfs/providers/ProcProvider.d.ts +14 -0
  184. package/dist/kernel/vfs/providers/ProcProvider.d.ts.map +1 -0
  185. package/dist/kernel/vfs/types.d.ts +43 -0
  186. package/dist/kernel/vfs/types.d.ts.map +1 -0
  187. package/dist/ln-Bf3f3jVA.js +11 -0
  188. package/dist/ls-CSeazevv.js +106 -0
  189. package/dist/man-CJ5pI0_W.js +122 -0
  190. package/dist/mkdir-B7p8krsP.js +27 -0
  191. package/dist/mktemp-88Nhvd7h.js +31 -0
  192. package/dist/mv-DRVvz9oK.js +19 -0
  193. package/dist/nl-G2vK3rR3.js +48 -0
  194. package/dist/node-compat/buffer.d.ts +17 -0
  195. package/dist/node-compat/buffer.d.ts.map +1 -0
  196. package/dist/node-compat/child_process.d.ts +10 -0
  197. package/dist/node-compat/child_process.d.ts.map +1 -0
  198. package/dist/node-compat/console.d.ts +21 -0
  199. package/dist/node-compat/console.d.ts.map +1 -0
  200. package/dist/node-compat/crypto.d.ts +17 -0
  201. package/dist/node-compat/crypto.d.ts.map +1 -0
  202. package/dist/node-compat/events.d.ts +19 -0
  203. package/dist/node-compat/events.d.ts.map +1 -0
  204. package/dist/node-compat/fs.d.ts +113 -0
  205. package/dist/node-compat/fs.d.ts.map +1 -0
  206. package/dist/node-compat/http.d.ts +87 -0
  207. package/dist/node-compat/http.d.ts.map +1 -0
  208. package/dist/node-compat/index.d.ts +19 -0
  209. package/dist/node-compat/index.d.ts.map +1 -0
  210. package/dist/node-compat/os.d.ts +39 -0
  211. package/dist/node-compat/os.d.ts.map +1 -0
  212. package/dist/node-compat/path.d.ts +58 -0
  213. package/dist/node-compat/path.d.ts.map +1 -0
  214. package/dist/node-compat/process.d.ts +62 -0
  215. package/dist/node-compat/process.d.ts.map +1 -0
  216. package/dist/node-compat/stream.d.ts +36 -0
  217. package/dist/node-compat/stream.d.ts.map +1 -0
  218. package/dist/node-compat/timers.d.ts +16 -0
  219. package/dist/node-compat/timers.d.ts.map +1 -0
  220. package/dist/node-compat/url.d.ts +53 -0
  221. package/dist/node-compat/url.d.ts.map +1 -0
  222. package/dist/node-compat/util.d.ts +27 -0
  223. package/dist/node-compat/util.d.ts.map +1 -0
  224. package/dist/ping-DtVEwwda.js +50 -0
  225. package/dist/pkg/PackageManager.d.ts +19 -0
  226. package/dist/pkg/PackageManager.d.ts.map +1 -0
  227. package/dist/pkg/loader.d.ts +4 -0
  228. package/dist/pkg/loader.d.ts.map +1 -0
  229. package/dist/printf-Cc2o7KZx.js +70 -0
  230. package/dist/realpath-C-kisl-F.js +24 -0
  231. package/dist/rev-9puwegeh.js +34 -0
  232. package/dist/rm-BXSq9iqP.js +37 -0
  233. package/dist/rmdir-CWgZ6q8D.js +35 -0
  234. package/dist/sandbox/HeadlessTerminal.d.ts +17 -0
  235. package/dist/sandbox/HeadlessTerminal.d.ts.map +1 -0
  236. package/dist/sandbox/Sandbox.d.ts +36 -0
  237. package/dist/sandbox/Sandbox.d.ts.map +1 -0
  238. package/dist/sandbox/SandboxCommands.d.ts +18 -0
  239. package/dist/sandbox/SandboxCommands.d.ts.map +1 -0
  240. package/dist/sandbox/SandboxFs.d.ts +38 -0
  241. package/dist/sandbox/SandboxFs.d.ts.map +1 -0
  242. package/dist/sandbox/index.d.ts +3 -0
  243. package/dist/sandbox/index.d.ts.map +1 -0
  244. package/dist/sandbox/types.d.ts +72 -0
  245. package/dist/sandbox/types.d.ts.map +1 -0
  246. package/dist/sed-BRxd2DlZ.js +90 -0
  247. package/dist/shell/Shell.d.ts +84 -0
  248. package/dist/shell/Shell.d.ts.map +1 -0
  249. package/dist/shell/completer.d.ts +19 -0
  250. package/dist/shell/completer.d.ts.map +1 -0
  251. package/dist/shell/expander.d.ts +20 -0
  252. package/dist/shell/expander.d.ts.map +1 -0
  253. package/dist/shell/history.d.ts +22 -0
  254. package/dist/shell/history.d.ts.map +1 -0
  255. package/dist/shell/interpreter.d.ts +67 -0
  256. package/dist/shell/interpreter.d.ts.map +1 -0
  257. package/dist/shell/jobs.d.ts +21 -0
  258. package/dist/shell/jobs.d.ts.map +1 -0
  259. package/dist/shell/lexer.d.ts +3 -0
  260. package/dist/shell/lexer.d.ts.map +1 -0
  261. package/dist/shell/parser.d.ts +7 -0
  262. package/dist/shell/parser.d.ts.map +1 -0
  263. package/dist/shell/pipe.d.ts +12 -0
  264. package/dist/shell/pipe.d.ts.map +1 -0
  265. package/dist/shell/terminal-stdin.d.ts +22 -0
  266. package/dist/shell/terminal-stdin.d.ts.map +1 -0
  267. package/dist/shell/test-builtin.d.ts +8 -0
  268. package/dist/shell/test-builtin.d.ts.map +1 -0
  269. package/dist/shell/types.d.ts +109 -0
  270. package/dist/shell/types.d.ts.map +1 -0
  271. package/dist/sleep-B4C3fZiR.js +19 -0
  272. package/dist/sort-B7K83hAD.js +59 -0
  273. package/dist/stat-C0qs7xMV.js +29 -0
  274. package/dist/tail-CYBTYnn3.js +47 -0
  275. package/dist/tar-mMS7gfb-.js +121 -0
  276. package/dist/tee-B8bXFHbI.js +17 -0
  277. package/dist/terminal/Terminal.d.ts +13 -0
  278. package/dist/terminal/Terminal.d.ts.map +1 -0
  279. package/dist/touch-CdAHKfLv.js +23 -0
  280. package/dist/tr-DsCiwSIu.js +60 -0
  281. package/dist/tree-BiWLXiUu.js +46 -0
  282. package/dist/uname-BCn8HlJD.js +37 -0
  283. package/dist/uniq-BZMOwoCc.js +51 -0
  284. package/dist/unzip-DP4I991d.js +82 -0
  285. package/dist/uptime-CgBJegqU.js +8 -0
  286. package/dist/utils/archive.d.ts +22 -0
  287. package/dist/utils/archive.d.ts.map +1 -0
  288. package/dist/utils/args.d.ts +12 -0
  289. package/dist/utils/args.d.ts.map +1 -0
  290. package/dist/utils/colors.d.ts +27 -0
  291. package/dist/utils/colors.d.ts.map +1 -0
  292. package/dist/utils/encoding.d.ts +4 -0
  293. package/dist/utils/encoding.d.ts.map +1 -0
  294. package/dist/utils/glob.d.ts +12 -0
  295. package/dist/utils/glob.d.ts.map +1 -0
  296. package/dist/utils/path.d.ts +12 -0
  297. package/dist/utils/path.d.ts.map +1 -0
  298. package/dist/wc-CpE5K4ZI.js +60 -0
  299. package/dist/wget-DIPI0-I3.js +53 -0
  300. package/dist/which-D3u0cwyh.js +105 -0
  301. package/dist/whoami-B1237V5e.js +8 -0
  302. package/dist/xargs-DfbCRFFd.js +35 -0
  303. package/dist/yes-DXEyHHD2.js +10 -0
  304. package/dist/zip-B_gQ6LXC.js +34 -0
  305. package/package.json +34 -0
@@ -0,0 +1,192 @@
1
+ import { r as x, d as C, c as U, f as A, h as L } from "./index-Be1wosKt.js";
2
+ const S = new Uint32Array(256);
3
+ for (let t = 0; t < 256; t++) {
4
+ let e = t;
5
+ for (let n = 0; n < 8; n++)
6
+ e = e & 1 ? 3988292384 ^ e >>> 1 : e >>> 1;
7
+ S[t] = e;
8
+ }
9
+ function F(t) {
10
+ let e = 4294967295;
11
+ for (let n = 0; n < t.length; n++)
12
+ e = S[(e ^ t[n]) & 255] ^ e >>> 8;
13
+ return (e ^ 4294967295) >>> 0;
14
+ }
15
+ async function I(t) {
16
+ const e = new CompressionStream("gzip"), n = e.writable.getWriter();
17
+ n.write(t), n.close();
18
+ const r = e.readable.getReader(), c = [];
19
+ for (; ; ) {
20
+ const { done: s, value: i } = await r.read();
21
+ if (s) break;
22
+ c.push(i);
23
+ }
24
+ return U(...c);
25
+ }
26
+ async function M(t) {
27
+ const e = new DecompressionStream("gzip"), n = e.writable.getWriter();
28
+ n.write(t), n.close();
29
+ const r = e.readable.getReader(), c = [];
30
+ for (; ; ) {
31
+ const { done: s, value: i } = await r.read();
32
+ if (s) break;
33
+ c.push(i);
34
+ }
35
+ return U(...c);
36
+ }
37
+ function w(t, e, n, r) {
38
+ const c = A(n);
39
+ t.set(c.subarray(0, r), e);
40
+ }
41
+ function f(t, e, n, r) {
42
+ const c = n.toString(8).padStart(r - 1, "0");
43
+ w(t, e, c, r - 1), t[e + r - 1] = 0;
44
+ }
45
+ function R(t) {
46
+ let e = 0;
47
+ for (let n = 0; n < 512; n++)
48
+ e += n >= 148 && n < 156 ? 32 : t[n];
49
+ return e;
50
+ }
51
+ function z(t, e, n) {
52
+ let r = e;
53
+ const c = e + n;
54
+ for (; r < c && t[r] !== 0; ) r++;
55
+ return L(t.subarray(e, r));
56
+ }
57
+ function D(t, e, n) {
58
+ const r = z(t, e, n).trim();
59
+ return r ? parseInt(r, 8) : 0;
60
+ }
61
+ function $(t) {
62
+ const e = [];
63
+ for (const n of t) {
64
+ const r = new Uint8Array(512);
65
+ let c = n.path;
66
+ n.type === "directory" && !c.endsWith("/") && (c += "/"), c.startsWith("/") && (c = c.slice(1)), w(r, 0, c, 100), f(r, 100, n.mode, 8), f(r, 108, 0, 8), f(r, 116, 0, 8), f(r, 124, n.data.length, 12), f(r, 136, Math.floor(n.mtime / 1e3), 12), r[156] = n.type === "directory" ? 53 : 48, w(r, 257, "ustar", 6), w(r, 263, "00", 2), w(r, 265, "user", 32), w(r, 297, "user", 32);
67
+ const s = R(r);
68
+ if (f(r, 148, s, 7), r[155] = 32, e.push(r), n.type === "file" && n.data.length > 0) {
69
+ const i = Math.ceil(n.data.length / 512) * 512, o = new Uint8Array(i);
70
+ o.set(n.data), e.push(o);
71
+ }
72
+ }
73
+ return e.push(new Uint8Array(1024)), U(...e);
74
+ }
75
+ function G(t) {
76
+ const e = [];
77
+ let n = 0;
78
+ for (; n + 512 <= t.length; ) {
79
+ const r = t.subarray(n, n + 512);
80
+ let c = !0;
81
+ for (let l = 0; l < 512; l++)
82
+ if (r[l] !== 0) {
83
+ c = !1;
84
+ break;
85
+ }
86
+ if (c) break;
87
+ let s = z(r, 0, 100);
88
+ const i = D(r, 100, 8), o = D(r, 124, 12), p = D(r, 136, 12) * 1e3, m = r[156] === 53 || s.endsWith("/");
89
+ s.endsWith("/") && (s = s.slice(0, -1)), n += 512;
90
+ let u = new Uint8Array(0);
91
+ o > 0 && (u = t.slice(n, n + o), n += Math.ceil(o / 512) * 512), e.push({
92
+ path: s,
93
+ data: u,
94
+ type: m ? "directory" : "file",
95
+ mode: i || (m ? 493 : 420),
96
+ mtime: p
97
+ });
98
+ }
99
+ return e;
100
+ }
101
+ function a(t, e, n) {
102
+ t[e] = n & 255, t[e + 1] = n >>> 8 & 255;
103
+ }
104
+ function y(t, e, n) {
105
+ t[e] = n & 255, t[e + 1] = n >>> 8 & 255, t[e + 2] = n >>> 16 & 255, t[e + 3] = n >>> 24 & 255;
106
+ }
107
+ function g(t, e) {
108
+ return t[e] | t[e + 1] << 8;
109
+ }
110
+ function k(t, e) {
111
+ return (t[e] | t[e + 1] << 8 | t[e + 2] << 16 | t[e + 3] << 24) >>> 0;
112
+ }
113
+ function b(t) {
114
+ const e = [], n = [];
115
+ let r = 0;
116
+ for (const o of t) {
117
+ let p = o.path;
118
+ p.startsWith("/") && (p = p.slice(1)), o.isDirectory && !p.endsWith("/") && (p += "/");
119
+ const d = A(p), m = o.isDirectory ? 0 : F(o.data), u = o.isDirectory ? 0 : o.data.length, l = new Uint8Array(30 + d.length);
120
+ y(l, 0, 67324752), a(l, 4, 20), a(l, 6, 0), a(l, 8, 0), a(l, 10, 0), a(l, 12, 0), y(l, 14, m), y(l, 18, u), y(l, 22, u), a(l, 26, d.length), a(l, 28, 0), l.set(d, 30), e.push(l), u > 0 && e.push(o.data);
121
+ const h = new Uint8Array(46 + d.length);
122
+ y(h, 0, 33639248), a(h, 4, 20), a(h, 6, 20), a(h, 8, 0), a(h, 10, 0), a(h, 12, 0), a(h, 14, 0), y(h, 16, m), y(h, 20, u), y(h, 24, u), a(h, 28, d.length), a(h, 30, 0), a(h, 32, 0), a(h, 34, 0), a(h, 36, 0), y(h, 38, o.isDirectory ? 16 : 0), y(h, 42, r), h.set(d, 46), n.push(h), r += 30 + d.length + u;
123
+ }
124
+ const c = r;
125
+ let s = 0;
126
+ for (const o of n)
127
+ e.push(o), s += o.length;
128
+ const i = new Uint8Array(22);
129
+ return y(i, 0, 101010256), a(i, 4, 0), a(i, 6, 0), a(i, 8, t.length), a(i, 10, t.length), y(i, 12, s), y(i, 16, c), a(i, 20, 0), e.push(i), U(...e);
130
+ }
131
+ function j(t) {
132
+ const e = [];
133
+ let n = -1;
134
+ for (let s = t.length - 22; s >= 0; s--)
135
+ if (k(t, s) === 101010256) {
136
+ n = s;
137
+ break;
138
+ }
139
+ if (n === -1) throw new Error("Invalid ZIP: EOCD not found");
140
+ const r = g(t, n + 10);
141
+ let c = k(t, n + 16);
142
+ for (let s = 0; s < r && k(t, c) === 33639248; s++) {
143
+ const i = g(t, c + 28), o = g(t, c + 30), p = g(t, c + 32), d = k(t, c + 42), m = t.subarray(c + 46, c + 46 + i);
144
+ let u = L(m);
145
+ const l = u.endsWith("/");
146
+ l && (u = u.slice(0, -1));
147
+ const h = g(t, d + 26), E = g(t, d + 28), O = k(t, d + 18), W = d + 30 + h + E, B = l ? new Uint8Array(0) : t.slice(W, W + O);
148
+ e.push({ path: u, data: B, isDirectory: l }), c += 46 + i + o + p;
149
+ }
150
+ return e;
151
+ }
152
+ function H(t, e, n) {
153
+ const r = [];
154
+ function c(s, i) {
155
+ const o = t.stat(s);
156
+ if (o.type === "directory") {
157
+ r.push({
158
+ path: s.slice(i.length) || s,
159
+ data: new Uint8Array(0),
160
+ type: "directory",
161
+ mode: o.mode,
162
+ mtime: o.mtime
163
+ });
164
+ const p = t.readdir(s);
165
+ for (const d of p) {
166
+ const m = s === "/" ? `/${d.name}` : `${s}/${d.name}`;
167
+ c(m, i);
168
+ }
169
+ } else
170
+ r.push({
171
+ path: s.slice(i.length) || s,
172
+ data: t.readFile(s),
173
+ type: "file",
174
+ mode: o.mode,
175
+ mtime: o.mtime
176
+ });
177
+ }
178
+ for (const s of n) {
179
+ const i = x(e, s), o = C(i), p = o === "/" ? "/" : o + "/";
180
+ c(i, p);
181
+ }
182
+ return r;
183
+ }
184
+ export {
185
+ $ as a,
186
+ I as b,
187
+ H as c,
188
+ M as d,
189
+ b as e,
190
+ j as f,
191
+ G as p
192
+ };
@@ -0,0 +1,43 @@
1
+ function g(c, i) {
2
+ const s = {}, f = [], a = {};
3
+ for (const [n, t] of Object.entries(i))
4
+ t.short && (a[t.short] = n), s[n] = t.type === "boolean" ? !1 : "";
5
+ let u = !1;
6
+ for (let n = 0; n < c.length; n++) {
7
+ const t = c[n];
8
+ if (u || !t.startsWith("-") || t === "-") {
9
+ f.push(t);
10
+ continue;
11
+ }
12
+ if (t === "--") {
13
+ u = !0;
14
+ continue;
15
+ }
16
+ if (t.startsWith("--")) {
17
+ const o = t.indexOf("=");
18
+ if (o !== -1) {
19
+ const e = t.slice(2, o), l = t.slice(o + 1);
20
+ e in i && (s[e] = i[e].type === "boolean" ? !0 : l);
21
+ } else {
22
+ const e = t.slice(2);
23
+ e in i && (i[e].type === "string" ? s[e] = c[++n] ?? "" : s[e] = !0);
24
+ }
25
+ continue;
26
+ }
27
+ const r = t.slice(1);
28
+ for (let o = 0; o < r.length; o++) {
29
+ const e = r[o], l = a[e];
30
+ if (l)
31
+ if (i[l].type === "string") {
32
+ const h = r.slice(o + 1);
33
+ s[l] = h || (c[++n] ?? "");
34
+ break;
35
+ } else
36
+ s[l] = !0;
37
+ }
38
+ }
39
+ return { flags: s, positional: f };
40
+ }
41
+ export {
42
+ g as p
43
+ };
@@ -0,0 +1,118 @@
1
+ import { r as E, V as N } from "./index-Be1wosKt.js";
2
+ function S(e) {
3
+ const a = [];
4
+ let t = e.trim();
5
+ for (; t.length > 0 && (t = t.trim(), t.length !== 0); ) {
6
+ let n = null, o = "";
7
+ if (t.startsWith("BEGIN"))
8
+ n = "BEGIN", t = t.slice(5).trim();
9
+ else if (t.startsWith("END"))
10
+ n = "END", t = t.slice(3).trim();
11
+ else if (t.startsWith("/")) {
12
+ const i = t.indexOf("/", 1);
13
+ if (i > 0) {
14
+ try {
15
+ n = new RegExp(t.slice(1, i));
16
+ } catch {
17
+ n = null;
18
+ }
19
+ t = t.slice(i + 1).trim();
20
+ }
21
+ }
22
+ if (t.startsWith("{")) {
23
+ let i = 0, l = 0;
24
+ for (; l < t.length; l++)
25
+ if (t[l] === "{") i++;
26
+ else if (t[l] === "}" && (i--, i === 0))
27
+ break;
28
+ o = t.slice(1, l).trim(), t = t.slice(l + 1).trim();
29
+ } else n === null && (o = t, t = "");
30
+ a.push({ pattern: n, action: o });
31
+ }
32
+ return a;
33
+ }
34
+ function m(e, a, t, n, o, i, l) {
35
+ const f = [], p = e.split(";").map((r) => r.trim()).filter(Boolean);
36
+ for (const r of p)
37
+ if (r === "print" || r === "print $0")
38
+ f.push(t);
39
+ else if (r.startsWith("print ")) {
40
+ const h = r.slice(6).trim().split(",").map((g) => g.trim()).map((g) => W(g, a, t, n, o, l));
41
+ f.push(h.join(" "));
42
+ }
43
+ return f.join(`
44
+ `);
45
+ }
46
+ function W(e, a, t, n, o, i) {
47
+ if (e = e.trim(), e.startsWith('"') && e.endsWith('"'))
48
+ return e.slice(1, -1).replace(/\\n/g, `
49
+ `).replace(/\\t/g, " ");
50
+ if (e.startsWith("$")) {
51
+ const l = e.slice(1);
52
+ if (l === "NF")
53
+ return a[o - 1] || "";
54
+ const f = parseInt(l, 10);
55
+ return f === 0 ? t : a[f - 1] || "";
56
+ }
57
+ return e === "NR" ? String(n) : e === "NF" ? String(o) : i.has(e) ? i.get(e) : e;
58
+ }
59
+ const k = async (e) => {
60
+ let a = /\s+/, t = " ", n = "";
61
+ const o = [];
62
+ for (let r = 0; r < e.args.length; r++) {
63
+ const s = e.args[r];
64
+ s === "-F" && r + 1 < e.args.length ? (t = e.args[++r], a = new RegExp(t.replace(/[.*+?^${}()|[\]\\]/g, "\\$&"))) : s.startsWith("-F") && s.length > 2 ? (t = s.slice(2), a = new RegExp(t.replace(/[.*+?^${}()|[\]\\]/g, "\\$&"))) : n ? o.push(s) : n = s;
65
+ }
66
+ if (!n)
67
+ return e.stderr.write(`awk: missing program
68
+ `), 1;
69
+ let i = "";
70
+ if (o.length === 0)
71
+ if (e.stdin)
72
+ i = await e.stdin.readAll();
73
+ else
74
+ return e.stderr.write(`awk: missing file operand
75
+ `), 1;
76
+ else
77
+ for (const r of o) {
78
+ const s = E(e.cwd, r);
79
+ try {
80
+ i += e.vfs.readFileString(s);
81
+ } catch (c) {
82
+ if (c instanceof N)
83
+ return e.stderr.write(`awk: ${r}: ${c.message}
84
+ `), 1;
85
+ throw c;
86
+ }
87
+ }
88
+ const l = S(n), f = i.replace(/\n$/, "").split(`
89
+ `), p = /* @__PURE__ */ new Map();
90
+ for (const r of l)
91
+ if (r.pattern === "BEGIN") {
92
+ const s = m(r.action, [], "", 0, 0, t, p);
93
+ s && e.stdout.write(s + `
94
+ `);
95
+ }
96
+ for (let r = 0; r < f.length; r++) {
97
+ const s = f[r], c = s.split(a).filter((u) => u !== ""), h = r + 1, g = c.length;
98
+ for (const u of l) {
99
+ if (u.pattern === "BEGIN" || u.pattern === "END") continue;
100
+ let d = !0;
101
+ if (u.pattern instanceof RegExp && (d = u.pattern.test(s)), d) {
102
+ const w = m(u.action, c, s, h, g, t, p);
103
+ w && e.stdout.write(w + `
104
+ `);
105
+ }
106
+ }
107
+ }
108
+ for (const r of l)
109
+ if (r.pattern === "END") {
110
+ const s = m(r.action, [], "", f.length, 0, t, p);
111
+ s && e.stdout.write(s + `
112
+ `);
113
+ }
114
+ return 0;
115
+ };
116
+ export {
117
+ k as default
118
+ };
@@ -0,0 +1,12 @@
1
+ import { b as a } from "./index-Be1wosKt.js";
2
+ const t = async (s) => {
3
+ if (s.args.length === 0)
4
+ return s.stderr.write(`basename: missing operand
5
+ `), 1;
6
+ const n = s.args[0], r = s.args[1];
7
+ return s.stdout.write(a(n, r) + `
8
+ `), 0;
9
+ };
10
+ export {
11
+ t as default
12
+ };
@@ -0,0 +1,200 @@
1
+ var c = Object.defineProperty;
2
+ var p = (s, e, t) => e in s ? c(s, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : s[e] = t;
3
+ var h = (s, e, t) => p(s, typeof e != "symbol" ? e + "" : e, t);
4
+ function u(s) {
5
+ const e = [];
6
+ let t = 0;
7
+ for (; t < s.length; ) {
8
+ const r = s[t];
9
+ if (r === " " || r === " ") {
10
+ t++;
11
+ continue;
12
+ }
13
+ if (r === `
14
+ `) {
15
+ e.push({ type: "newline", value: `
16
+ ` }), t++;
17
+ continue;
18
+ }
19
+ if (r >= "0" && r <= "9" || r === ".") {
20
+ let n = "";
21
+ for (; t < s.length && (s[t] >= "0" && s[t] <= "9" || s[t] === "."); )
22
+ n += s[t++];
23
+ e.push({ type: "number", value: n });
24
+ continue;
25
+ }
26
+ if (r >= "a" && r <= "z" || r >= "A" && r <= "Z" || r === "_") {
27
+ let n = "";
28
+ for (; t < s.length && (s[t] >= "a" && s[t] <= "z" || s[t] >= "A" && s[t] <= "Z" || s[t] >= "0" && s[t] <= "9" || s[t] === "_"); )
29
+ n += s[t++];
30
+ e.push({ type: "ident", value: n });
31
+ continue;
32
+ }
33
+ if ("+-*/%^()=".includes(r)) {
34
+ e.push({ type: r, value: r }), t++;
35
+ continue;
36
+ }
37
+ t++;
38
+ }
39
+ return e.push({ type: "eof", value: "" }), e;
40
+ }
41
+ class f {
42
+ constructor(e, t, r) {
43
+ h(this, "tokens");
44
+ h(this, "pos", 0);
45
+ h(this, "vars", {});
46
+ h(this, "scale", 0);
47
+ this.tokens = e, this.vars = t, this.scale = r;
48
+ }
49
+ getScale() {
50
+ return this.scale;
51
+ }
52
+ peek() {
53
+ return this.tokens[this.pos] || { type: "eof", value: "" };
54
+ }
55
+ advance() {
56
+ return this.tokens[this.pos++] || { type: "eof", value: "" };
57
+ }
58
+ expect(e) {
59
+ const t = this.advance();
60
+ if (t.type !== e)
61
+ throw new Error(`expected ${e}, got ${t.type}`);
62
+ return t;
63
+ }
64
+ // expression = assignment
65
+ parseExpression() {
66
+ return this.parseAssignment();
67
+ }
68
+ // assignment = ident '=' assignment | additive
69
+ parseAssignment() {
70
+ if (this.peek().type === "ident" && this.pos + 1 < this.tokens.length && this.tokens[this.pos + 1].type === "=") {
71
+ const e = this.advance().value;
72
+ this.advance();
73
+ const t = this.parseAssignment();
74
+ return e === "scale" ? this.scale = Math.floor(t) : this.vars[e] = t, t;
75
+ }
76
+ return this.parseAdditive();
77
+ }
78
+ // additive = multiplicative (('+' | '-') multiplicative)*
79
+ parseAdditive() {
80
+ let e = this.parseMultiplicative();
81
+ for (; this.peek().type === "+" || this.peek().type === "-"; ) {
82
+ const t = this.advance().type, r = this.parseMultiplicative();
83
+ e = t === "+" ? e + r : e - r;
84
+ }
85
+ return e;
86
+ }
87
+ // multiplicative = power (('*' | '/' | '%') power)*
88
+ parseMultiplicative() {
89
+ let e = this.parsePower();
90
+ for (; this.peek().type === "*" || this.peek().type === "/" || this.peek().type === "%"; ) {
91
+ const t = this.advance().type, r = this.parsePower();
92
+ if (t === "*") e = e * r;
93
+ else if (t === "/") {
94
+ if (r === 0) throw new Error("divide by zero");
95
+ e = e / r;
96
+ } else {
97
+ if (r === 0) throw new Error("divide by zero");
98
+ e = e % r;
99
+ }
100
+ }
101
+ return e;
102
+ }
103
+ // power = unary ('^' power)? (right-associative)
104
+ parsePower() {
105
+ const e = this.parseUnary();
106
+ if (this.peek().type === "^") {
107
+ this.advance();
108
+ const t = this.parsePower();
109
+ return Math.pow(e, t);
110
+ }
111
+ return e;
112
+ }
113
+ // unary = '-' unary | primary
114
+ parseUnary() {
115
+ return this.peek().type === "-" ? (this.advance(), -this.parseUnary()) : this.parsePrimary();
116
+ }
117
+ // primary = number | ident | ident '(' expr ')' | '(' expr ')'
118
+ parsePrimary() {
119
+ const e = this.peek();
120
+ if (e.type === "number")
121
+ return this.advance(), parseFloat(e.value);
122
+ if (e.type === "ident") {
123
+ if (this.advance(), this.peek().type === "(") {
124
+ this.advance();
125
+ const t = this.parseExpression();
126
+ if (this.expect(")"), e.value === "sqrt") {
127
+ if (t < 0) throw new Error("square root of negative number");
128
+ return Math.sqrt(t);
129
+ }
130
+ if (e.value === "length") return String(Math.floor(t)).length;
131
+ throw new Error(`unknown function: ${e.value}`);
132
+ }
133
+ return e.value === "scale" ? this.scale : this.vars[e.value] ?? 0;
134
+ }
135
+ if (e.type === "(") {
136
+ this.advance();
137
+ const t = this.parseExpression();
138
+ return this.expect(")"), t;
139
+ }
140
+ throw new Error(`unexpected token: ${e.type}`);
141
+ }
142
+ }
143
+ function d(s, e) {
144
+ if (e === 0) {
145
+ const t = s < 0 ? Math.ceil(s) : Math.floor(s);
146
+ return String(t);
147
+ }
148
+ return s.toFixed(e);
149
+ }
150
+ const y = async (s) => {
151
+ const e = {};
152
+ let t = 0;
153
+ const r = (n) => {
154
+ const i = n.trim();
155
+ if (!i || i.startsWith("#")) return null;
156
+ if (i === "quit") return "quit";
157
+ try {
158
+ const a = u(i), o = new f(a, e, t), l = o.parseExpression();
159
+ return t = o.getScale(), d(l, t);
160
+ } catch (a) {
161
+ return `error: ${a.message}`;
162
+ }
163
+ };
164
+ if (s.args.length >= 2 && s.args[0] === "-e") {
165
+ const n = s.args.slice(1).join(" "), i = r(n);
166
+ return i !== null && i !== "quit" && s.stdout.write(i + `
167
+ `), 0;
168
+ }
169
+ if (s.args.length > 0 && s.args[0] !== "-e") {
170
+ const n = s.args[0];
171
+ try {
172
+ const i = s.vfs.readFileString(n);
173
+ for (const a of i.split(`
174
+ `)) {
175
+ const o = r(a);
176
+ if (o === "quit") return 0;
177
+ o !== null && s.stdout.write(o + `
178
+ `);
179
+ }
180
+ return 0;
181
+ } catch {
182
+ return s.stderr.write(`bc: ${n}: No such file
183
+ `), 1;
184
+ }
185
+ }
186
+ if (s.stdin) {
187
+ const n = await s.stdin.readAll();
188
+ for (const i of n.split(`
189
+ `)) {
190
+ const a = r(i);
191
+ if (a === "quit") return 0;
192
+ a !== null && s.stdout.write(a + `
193
+ `);
194
+ }
195
+ }
196
+ return 0;
197
+ };
198
+ export {
199
+ y as default
200
+ };
@@ -0,0 +1,56 @@
1
+ const y = [
2
+ "January",
3
+ "February",
4
+ "March",
5
+ "April",
6
+ "May",
7
+ "June",
8
+ "July",
9
+ "August",
10
+ "September",
11
+ "October",
12
+ "November",
13
+ "December"
14
+ ];
15
+ function u(e, r, a) {
16
+ const t = /* @__PURE__ */ new Date(), n = a && t.getFullYear() === e && t.getMonth() === r, s = t.getDate(), h = `${y[r]} ${e}`, p = "Su Mo Tu We Th Fr Sa", l = [];
17
+ l.push(h.padStart(Math.floor((20 + h.length) / 2)).padEnd(20)), l.push(p);
18
+ const c = new Date(e, r, 1).getDay(), d = new Date(e, r + 1, 0).getDate();
19
+ let o = " ".repeat(c), g = c;
20
+ for (let i = 1; i <= d; i++) {
21
+ const f = String(i).padStart(2, " ");
22
+ n && i === s ? o += `\x1B[7m${f}\x1B[0m` : o += f, g++, g === 7 && i < d ? (l.push(o), o = "", g = 0) : i < d && (o += " ");
23
+ }
24
+ return o.length > 0 && l.push(o), l.join(`
25
+ `) + `
26
+ `;
27
+ }
28
+ const M = async (e) => {
29
+ const r = /* @__PURE__ */ new Date(), a = e.args.filter((t) => !t.startsWith("-"));
30
+ if (a.length === 0)
31
+ e.stdout.write(u(r.getFullYear(), r.getMonth(), !0));
32
+ else if (a.length === 1) {
33
+ const t = parseInt(a[0], 10);
34
+ if (isNaN(t) || t < 1)
35
+ return e.stderr.write(`cal: invalid argument: ${a[0]}
36
+ `), 1;
37
+ if (t > 12) {
38
+ const n = t;
39
+ for (let s = 0; s < 12; s++)
40
+ e.stdout.write(u(n, s, r.getFullYear() === n)), s < 11 && e.stdout.write(`
41
+ `);
42
+ } else
43
+ e.stdout.write(u(r.getFullYear(), t - 1, !0));
44
+ } else {
45
+ const t = parseInt(a[0], 10), n = parseInt(a[1], 10);
46
+ if (isNaN(t) || t < 1 || t > 12 || isNaN(n) || n < 1)
47
+ return e.stderr.write(`cal: invalid arguments
48
+ `), 1;
49
+ const s = r.getFullYear() === n && r.getMonth() === t - 1;
50
+ e.stdout.write(u(n, t - 1, s));
51
+ }
52
+ return 0;
53
+ };
54
+ export {
55
+ M as default
56
+ };
@@ -0,0 +1,29 @@
1
+ import { r as o, V as a } from "./index-Be1wosKt.js";
2
+ const d = async (r) => {
3
+ if (r.args.length === 0) {
4
+ if (r.stdin) {
5
+ const e = await r.stdin.readAll();
6
+ return r.stdout.write(e), 0;
7
+ }
8
+ return r.stderr.write(`cat: missing operand
9
+ `), 1;
10
+ }
11
+ let s = 0;
12
+ for (const e of r.args) {
13
+ const n = o(r.cwd, e);
14
+ try {
15
+ const t = r.vfs.readFileString(n);
16
+ r.stdout.write(t);
17
+ } catch (t) {
18
+ if (t instanceof a)
19
+ r.stderr.write(`cat: ${e}: ${t.message}
20
+ `), s = 1;
21
+ else
22
+ throw t;
23
+ }
24
+ }
25
+ return s;
26
+ };
27
+ export {
28
+ d as default
29
+ };