@lifo-sh/core 0.4.6 → 0.5.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 (86) hide show
  1. package/dist/{awk-BFrGImnt.js → awk-CC_Qo0hQ.js} +1 -1
  2. package/dist/base64-BBckAmkE.js +72 -0
  3. package/dist/{basename-MGz8cBxd.js → basename-BIICW06y.js} +1 -1
  4. package/dist/{cat-BnEyWWFr.js → cat-Jv35D4BV.js} +1 -1
  5. package/dist/{chmod-CdrI3hZV.js → chmod-Bh-u8XOr.js} +1 -1
  6. package/dist/{chown-7yY3iC6J.js → chown-Dv7xfl2a.js} +1 -1
  7. package/dist/commands/registry.d.ts.map +1 -1
  8. package/dist/commands/system/fastfetch.d.ts +4 -0
  9. package/dist/commands/system/fastfetch.d.ts.map +1 -0
  10. package/dist/commands/system/logout.d.ts +5 -0
  11. package/dist/commands/system/logout.d.ts.map +1 -0
  12. package/dist/commands/system/man.d.ts.map +1 -1
  13. package/dist/commands/system/sha256sum.d.ts +4 -0
  14. package/dist/commands/system/sha256sum.d.ts.map +1 -0
  15. package/dist/commands/system/sl.d.ts +4 -0
  16. package/dist/commands/system/sl.d.ts.map +1 -0
  17. package/dist/commands/system/whoami.d.ts.map +1 -1
  18. package/dist/commands/text/base64.d.ts +4 -0
  19. package/dist/commands/text/base64.d.ts.map +1 -0
  20. package/dist/commands/text/less.d.ts +4 -0
  21. package/dist/commands/text/less.d.ts.map +1 -0
  22. package/dist/commands/text/nano.d.ts +4 -0
  23. package/dist/commands/text/nano.d.ts.map +1 -0
  24. package/dist/commands/text/seq.d.ts +4 -0
  25. package/dist/commands/text/seq.d.ts.map +1 -0
  26. package/dist/commands/text/strings.d.ts +4 -0
  27. package/dist/commands/text/strings.d.ts.map +1 -0
  28. package/dist/commands/text/tac.d.ts +4 -0
  29. package/dist/commands/text/tac.d.ts.map +1 -0
  30. package/dist/commands/types.d.ts +1 -0
  31. package/dist/commands/types.d.ts.map +1 -1
  32. package/dist/{cp-7dOXCu3Q.js → cp-CB-sGTRH.js} +1 -1
  33. package/dist/{cut-vn4vxL9L.js → cut-B79kgCm4.js} +1 -1
  34. package/dist/{diff-DnKPewP-.js → diff-D5Ej-JEe.js} +1 -1
  35. package/dist/{dirname-B3ciBZhS.js → dirname-w2Y6csox.js} +1 -1
  36. package/dist/{du-i2qiYYnL.js → du-UupzdKc_.js} +1 -1
  37. package/dist/fastfetch-aPM9Z3ym.js +310 -0
  38. package/dist/{file-Dd6iLk05.js → file-DOl4Wjtc.js} +1 -1
  39. package/dist/{find-Cz4GdaPT.js → find-C0T-P7sl.js} +1 -1
  40. package/dist/{grep-DYSAPbxr.js → grep-Blwrv9k5.js} +1 -1
  41. package/dist/{gunzip-BHAbNGHO.js → gunzip-R7EtgP15.js} +1 -1
  42. package/dist/{gzip-JLrrHn6u.js → gzip-BxF7M1np.js} +1 -1
  43. package/dist/{head-bFamSv7p.js → head-CJwcsX18.js} +1 -1
  44. package/dist/{index-BVIfyOAv.js → index-BjKSFBDg.js} +392 -330
  45. package/dist/index.d.ts +1 -0
  46. package/dist/index.d.ts.map +1 -1
  47. package/dist/index.js +32 -31
  48. package/dist/kernel/index.d.ts.map +1 -1
  49. package/dist/less-B0gFLJ_7.js +230 -0
  50. package/dist/{ls-BSsn2qVd.js → ls-YnhMRefh.js} +1 -1
  51. package/dist/{man-CJ5pI0_W.js → man-Dg26tZ-a.js} +19 -6
  52. package/dist/{mkdir-CF_ugDtu.js → mkdir-DY1P3Jxj.js} +1 -1
  53. package/dist/{mktemp-CaEiJi87.js → mktemp-BRzo2c8y.js} +1 -1
  54. package/dist/{mv-BSS_QQM-.js → mv-bH08L-F_.js} +1 -1
  55. package/dist/nano-CueO2oS0.js +304 -0
  56. package/dist/{nl-D30ka89P.js → nl-D26SSOD4.js} +1 -1
  57. package/dist/{realpath-BWqrTa-J.js → realpath-BH29Lem_.js} +1 -1
  58. package/dist/{rev-Cfja5xbl.js → rev-ySwmRf_K.js} +1 -1
  59. package/dist/{rm-DUR35EZn.js → rm-D7iWUUE2.js} +1 -1
  60. package/dist/{rmdir-DXjx17-Z.js → rmdir-BLtdNjt1.js} +1 -1
  61. package/dist/{sed-YKJ5wcuu.js → sed-DwBPYYFb.js} +1 -1
  62. package/dist/seq-B01YKIbO.js +37 -0
  63. package/dist/sha256sum-DED6ePiU.js +64 -0
  64. package/dist/shell/Shell.d.ts +1 -0
  65. package/dist/shell/Shell.d.ts.map +1 -1
  66. package/dist/shell/interpreter.d.ts.map +1 -1
  67. package/dist/shell/terminal-stdin.d.ts +4 -0
  68. package/dist/shell/terminal-stdin.d.ts.map +1 -1
  69. package/dist/sl-Dv4iPBN6.js +138 -0
  70. package/dist/{sort-C2sQ841N.js → sort-OXqZY83v.js} +1 -1
  71. package/dist/{stat-gLLpq3JZ.js → stat-BvwNpE5B.js} +1 -1
  72. package/dist/strings-BesRwUt_.js +42 -0
  73. package/dist/tac-D4BMSdj9.js +31 -0
  74. package/dist/{tail-FnC8M40k.js → tail-xVmLkzJK.js} +1 -1
  75. package/dist/{tar-tfiT1iFt.js → tar-BHRJ0-4j.js} +1 -1
  76. package/dist/{tee-CoymtuKa.js → tee-DxygINEJ.js} +1 -1
  77. package/dist/{touch-C4pyouV6.js → touch-DCb9Qn5q.js} +1 -1
  78. package/dist/{tree-DfPczgli.js → tree-4QpgsnA0.js} +1 -1
  79. package/dist/{uniq-Dhsoj7Lk.js → uniq-xmgE0zRj.js} +1 -1
  80. package/dist/{unzip-CqIKZ8NK.js → unzip-CDKcoB0B.js} +1 -1
  81. package/dist/{wc-DBPO6xRf.js → wc-B-jNRfLa.js} +1 -1
  82. package/dist/{wget-CYImxeOz.js → wget-CO-45JoL.js} +1 -1
  83. package/dist/whoami-Y18wqme3.js +25 -0
  84. package/dist/{zip-TPdwPkrA.js → zip-Cu1DzbAu.js} +1 -1
  85. package/package.json +2 -2
  86. package/dist/whoami-B1237V5e.js +0 -8
@@ -138,7 +138,7 @@ function ks(s) {
138
138
  function lo(s) {
139
139
  return ks(s) !== "text";
140
140
  }
141
- const A = {
141
+ const F = {
142
142
  ENOENT: "ENOENT",
143
143
  EEXIST: "EEXIST",
144
144
  ENOTDIR: "ENOTDIR",
@@ -146,7 +146,7 @@ const A = {
146
146
  ENOTEMPTY: "ENOTEMPTY",
147
147
  EINVAL: "EINVAL"
148
148
  };
149
- class _ extends Error {
149
+ class T extends Error {
150
150
  constructor(t, r) {
151
151
  super(`${t}: ${r}`);
152
152
  m(this, "code");
@@ -252,7 +252,7 @@ class uo {
252
252
  }
253
253
  }
254
254
  const Rs = 1 * 1024 * 1024, Rt = 256 * 1024;
255
- class Ts {
255
+ class _s {
256
256
  constructor(e = 64 * 1024 * 1024) {
257
257
  m(this, "cache", /* @__PURE__ */ new Map());
258
258
  m(this, "accessCounter", 0);
@@ -391,10 +391,10 @@ class oe {
391
391
  return r || (r = [], this._events.set(e, r)), r.unshift(t), this;
392
392
  }
393
393
  }
394
- function Te(s) {
394
+ function _e(s) {
395
395
  return typeof s.unlink == "function" && typeof s.mkdir == "function" && typeof s.rmdir == "function" && typeof s.rename == "function" && typeof s.copyFile == "function";
396
396
  }
397
- class _s {
397
+ class Ts {
398
398
  constructor(e) {
399
399
  m(this, "root");
400
400
  /**
@@ -406,7 +406,7 @@ class _s {
406
406
  m(this, "onChange");
407
407
  /** Content store for chunked large files. Optional -- without it all data stays inline. */
408
408
  m(this, "contentStore");
409
- this.root = this.createNode("directory", ""), this.contentStore = e ?? new Ts();
409
+ this.root = this.createNode("directory", ""), this.contentStore = e ?? new _s();
410
410
  }
411
411
  watch(e, t) {
412
412
  if (typeof e == "function") {
@@ -437,7 +437,7 @@ class _s {
437
437
  unmount(e) {
438
438
  const t = this.toAbsolute(e), r = this.mounts.findIndex((n) => n.path === t);
439
439
  if (r === -1)
440
- throw new _(A.EINVAL, `'${e}': not mounted`);
440
+ throw new T(F.EINVAL, `'${e}': not mounted`);
441
441
  this.mounts.splice(r, 1);
442
442
  }
443
443
  /**
@@ -483,10 +483,10 @@ class _s {
483
483
  let n = this.root;
484
484
  for (const i of r) {
485
485
  if (n.type !== "directory")
486
- throw new _(A.ENOTDIR, `'${e}': not a directory`);
486
+ throw new T(F.ENOTDIR, `'${e}': not a directory`);
487
487
  const o = n.children.get(i);
488
488
  if (!o)
489
- throw new _(A.ENOENT, `'${e}': no such file or directory`);
489
+ throw new T(F.ENOENT, `'${e}': no such file or directory`);
490
490
  n = o;
491
491
  }
492
492
  return n;
@@ -494,7 +494,7 @@ class _s {
494
494
  resolveParent(e) {
495
495
  const t = this.toAbsolute(e), r = te(t), n = xe(t), i = this.resolveNode(r);
496
496
  if (i.type !== "directory")
497
- throw new _(A.ENOTDIR, `'${r}': not a directory`);
497
+ throw new T(F.ENOTDIR, `'${r}': not a directory`);
498
498
  return { parent: i, name: n };
499
499
  }
500
500
  toAbsolute(e) {
@@ -506,7 +506,7 @@ class _s {
506
506
  if (t) return t.provider.readFile(t.subpath);
507
507
  const r = this.resolveNode(e);
508
508
  if (r.type === "directory")
509
- throw new _(A.EISDIR, `'${e}': is a directory`);
509
+ throw new T(F.EISDIR, `'${e}': is a directory`);
510
510
  if (r.chunks) {
511
511
  const n = this.contentStore.loadChunked(r.chunks);
512
512
  return n || new Uint8Array(0);
@@ -524,12 +524,12 @@ class _s {
524
524
  r.provider.writeFile(r.subpath, t);
525
525
  return;
526
526
  }
527
- throw new _(A.EINVAL, `'${e}': read-only virtual filesystem`);
527
+ throw new T(F.EINVAL, `'${e}': read-only virtual filesystem`);
528
528
  }
529
529
  const n = typeof t == "string" ? ge(t) : t, i = this.toAbsolute(e), { parent: o, name: a } = this.resolveParent(e), c = Ss(a), l = o.children.get(a);
530
530
  if (l) {
531
531
  if (l.type === "directory")
532
- throw new _(A.EISDIR, `'${e}': is a directory`);
532
+ throw new T(F.EISDIR, `'${e}': is a directory`);
533
533
  l.chunks && this.contentStore.deleteChunked(l.chunks), this.applyFileContent(l, n), l.mtime = Date.now(), l.mime = c, this.notify({ type: "modify", path: i, fileType: "file" });
534
534
  } else {
535
535
  const d = this.createNode("file", a);
@@ -547,7 +547,7 @@ class _s {
547
547
  try {
548
548
  const n = this.resolveNode(e);
549
549
  if (n.type === "directory")
550
- throw new _(A.EISDIR, `'${e}': is a directory`);
550
+ throw new T(F.EISDIR, `'${e}': is a directory`);
551
551
  if (n.chunks) {
552
552
  const i = this.contentStore.loadChunked(n.chunks) ?? new Uint8Array(0), o = new Uint8Array(i.byteLength + r.byteLength);
553
553
  o.set(i, 0), o.set(r, i.byteLength), this.contentStore.deleteChunked(n.chunks), this.applyFileContent(n, o);
@@ -557,7 +557,7 @@ class _s {
557
557
  }
558
558
  n.mtime = Date.now(), this.notify({ type: "modify", path: this.toAbsolute(e), fileType: "file" });
559
559
  } catch (n) {
560
- if (n instanceof _ && n.code === "ENOENT")
560
+ if (n instanceof T && n.code === "ENOENT")
561
561
  this.writeFile(e, r);
562
562
  else
563
563
  throw n;
@@ -587,38 +587,38 @@ class _s {
587
587
  unlink(e) {
588
588
  const t = this.toAbsolute(e), r = this.getProvider(e);
589
589
  if (r) {
590
- if (Te(r.provider)) {
590
+ if (_e(r.provider)) {
591
591
  r.provider.unlink(r.subpath);
592
592
  return;
593
593
  }
594
- throw new _(A.EINVAL, `'${e}': read-only virtual filesystem`);
594
+ throw new T(F.EINVAL, `'${e}': read-only virtual filesystem`);
595
595
  }
596
596
  const { parent: n, name: i } = this.resolveParent(e), o = n.children.get(i);
597
597
  if (!o)
598
- throw new _(A.ENOENT, `'${e}': no such file or directory`);
598
+ throw new T(F.ENOENT, `'${e}': no such file or directory`);
599
599
  if (o.type === "directory")
600
- throw new _(A.EISDIR, `'${e}': is a directory`);
600
+ throw new T(F.EISDIR, `'${e}': is a directory`);
601
601
  o.chunks && this.contentStore.deleteChunked(o.chunks), n.children.delete(i), this.notify({ type: "delete", path: t, fileType: "file" });
602
602
  }
603
603
  rename(e, t) {
604
604
  const r = this.toAbsolute(e), n = this.toAbsolute(t), i = this.getProvider(e), o = this.getProvider(t);
605
- if (i && o && i.provider === o.provider && Te(i.provider)) {
605
+ if (i && o && i.provider === o.provider && _e(i.provider)) {
606
606
  i.provider.rename(i.subpath, o.subpath);
607
607
  return;
608
608
  }
609
609
  if (i)
610
- throw new _(A.EINVAL, `'${e}': cannot rename across mount boundaries`);
610
+ throw new T(F.EINVAL, `'${e}': cannot rename across mount boundaries`);
611
611
  const { parent: a, name: c } = this.resolveParent(e), l = a.children.get(c);
612
612
  if (!l)
613
- throw new _(A.ENOENT, `'${e}': no such file or directory`);
613
+ throw new T(F.ENOENT, `'${e}': no such file or directory`);
614
614
  if (o)
615
- throw new _(A.EINVAL, `'${t}': cannot rename across mount boundaries`);
615
+ throw new T(F.EINVAL, `'${t}': cannot rename across mount boundaries`);
616
616
  const { parent: d, name: h } = this.resolveParent(t);
617
617
  l.name = h, l.mtime = Date.now(), d.children.set(h, l), a.children.delete(c), this.notify({ type: "rename", path: n, oldPath: r, fileType: l.type });
618
618
  }
619
619
  copyFile(e, t) {
620
620
  const r = this.getProvider(e), n = this.getProvider(t);
621
- if (r && n && r.provider === n.provider && Te(r.provider)) {
621
+ if (r && n && r.provider === n.provider && _e(r.provider)) {
622
622
  r.provider.copyFile(r.subpath, n.subpath);
623
623
  return;
624
624
  }
@@ -630,7 +630,7 @@ class _s {
630
630
  const t = this.resolveNode(e);
631
631
  t.mtime = Date.now(), this.notify({ type: "modify", path: this.toAbsolute(e), fileType: t.type });
632
632
  } catch (t) {
633
- if (t instanceof _ && t.code === "ENOENT")
633
+ if (t instanceof T && t.code === "ENOENT")
634
634
  this.writeFile(e, "");
635
635
  else
636
636
  throw t;
@@ -640,11 +640,11 @@ class _s {
640
640
  mkdir(e, t) {
641
641
  const r = this.getProvider(e);
642
642
  if (r) {
643
- if (Te(r.provider)) {
643
+ if (_e(r.provider)) {
644
644
  r.provider.mkdir(r.subpath, t);
645
645
  return;
646
646
  }
647
- throw new _(A.EINVAL, `'${e}': read-only virtual filesystem`);
647
+ throw new T(F.EINVAL, `'${e}': read-only virtual filesystem`);
648
648
  }
649
649
  if (t != null && t.recursive) {
650
650
  const l = this.toAbsolute(e).split("/").filter(Boolean);
@@ -655,33 +655,33 @@ class _s {
655
655
  if (!g)
656
656
  g = this.createNode("directory", f), d.children.set(f, g), this.notify({ type: "create", path: h, fileType: "directory" });
657
657
  else if (g.type !== "directory")
658
- throw new _(A.ENOTDIR, `'${f}': not a directory`);
658
+ throw new T(F.ENOTDIR, `'${f}': not a directory`);
659
659
  d = g;
660
660
  }
661
661
  return;
662
662
  }
663
663
  const n = this.toAbsolute(e), { parent: i, name: o } = this.resolveParent(e);
664
664
  if (i.children.has(o))
665
- throw new _(A.EEXIST, `'${e}': file exists`);
665
+ throw new T(F.EEXIST, `'${e}': file exists`);
666
666
  const a = this.createNode("directory", o);
667
667
  i.children.set(o, a), this.notify({ type: "create", path: n, fileType: "directory" });
668
668
  }
669
669
  rmdir(e) {
670
670
  const t = this.toAbsolute(e), r = this.getProvider(e);
671
671
  if (r) {
672
- if (Te(r.provider)) {
672
+ if (_e(r.provider)) {
673
673
  r.provider.rmdir(r.subpath);
674
674
  return;
675
675
  }
676
- throw new _(A.EINVAL, `'${e}': read-only virtual filesystem`);
676
+ throw new T(F.EINVAL, `'${e}': read-only virtual filesystem`);
677
677
  }
678
678
  const { parent: n, name: i } = this.resolveParent(e), o = n.children.get(i);
679
679
  if (!o)
680
- throw new _(A.ENOENT, `'${e}': no such file or directory`);
680
+ throw new T(F.ENOENT, `'${e}': no such file or directory`);
681
681
  if (o.type !== "directory")
682
- throw new _(A.ENOTDIR, `'${e}': not a directory`);
682
+ throw new T(F.ENOTDIR, `'${e}': not a directory`);
683
683
  if (o.children.size > 0)
684
- throw new _(A.ENOTEMPTY, `'${e}': directory not empty`);
684
+ throw new T(F.ENOTEMPTY, `'${e}': directory not empty`);
685
685
  n.children.delete(i), this.notify({ type: "delete", path: t, fileType: "directory" });
686
686
  }
687
687
  readdir(e) {
@@ -689,7 +689,7 @@ class _s {
689
689
  if (t) return t.provider.readdir(t.subpath);
690
690
  const r = this.resolveNode(e);
691
691
  if (r.type !== "directory")
692
- throw new _(A.ENOTDIR, `'${e}': not a directory`);
692
+ throw new T(F.ENOTDIR, `'${e}': not a directory`);
693
693
  const n = Array.from(r.children.values()).map((a) => ({
694
694
  name: a.name,
695
695
  type: a.type
@@ -709,7 +709,7 @@ class _s {
709
709
  });
710
710
  const r = this.resolveNode(e);
711
711
  if (r.type !== "directory")
712
- throw new _(A.ENOTDIR, `'${e}': not a directory`);
712
+ throw new T(F.ENOTDIR, `'${e}': not a directory`);
713
713
  return Array.from(r.children.values()).map((n) => {
714
714
  const i = {
715
715
  name: n.name,
@@ -728,7 +728,7 @@ class _s {
728
728
  rmdirRecursive(e) {
729
729
  const t = this.resolveNode(e);
730
730
  if (t.type !== "directory")
731
- throw new _(A.ENOTDIR, `'${e}': not a directory`);
731
+ throw new T(F.ENOTDIR, `'${e}': not a directory`);
732
732
  const r = this.toAbsolute(e);
733
733
  for (const n of t.children.values()) {
734
734
  const i = r === "/" ? `/${n.name}` : `${r}/${n.name}`;
@@ -751,7 +751,7 @@ class Ps {
751
751
  if (o !== ".")
752
752
  if (o === "..") {
753
753
  if (n.length === 0)
754
- throw new _(A.EINVAL, `path '${e}' escapes mount root`);
754
+ throw new T(F.EINVAL, `path '${e}' escapes mount root`);
755
755
  n.pop();
756
756
  } else
757
757
  n.push(o);
@@ -760,7 +760,7 @@ class Ps {
760
760
  }
761
761
  assertWritable() {
762
762
  if (this.readOnly)
763
- throw new _(A.EINVAL, "filesystem is mounted read-only");
763
+ throw new T(F.EINVAL, "filesystem is mounted read-only");
764
764
  }
765
765
  // ─── Read operations ───
766
766
  readFile(e) {
@@ -862,9 +862,9 @@ class Ps {
862
862
  }
863
863
  // ─── Error mapping ───
864
864
  wrapError(e, t) {
865
- if (e instanceof _) return e;
865
+ if (e instanceof T) return e;
866
866
  const r = e instanceof Error ? e.message : String(e), n = e == null ? void 0 : e.code;
867
- return n === "ENOENT" ? new _(A.ENOENT, `'${t}': ${r}`) : n === "EEXIST" ? new _(A.EEXIST, `'${t}': ${r}`) : n === "EISDIR" ? new _(A.EISDIR, `'${t}': ${r}`) : n === "ENOTDIR" ? new _(A.ENOTDIR, `'${t}': ${r}`) : n === "ENOTEMPTY" ? new _(A.ENOTEMPTY, `'${t}': ${r}`) : new _(A.EINVAL, `'${t}': ${r}`);
867
+ return n === "ENOENT" ? new T(F.ENOENT, `'${t}': ${r}`) : n === "EEXIST" ? new T(F.EEXIST, `'${t}': ${r}`) : n === "EISDIR" ? new T(F.EISDIR, `'${t}': ${r}`) : n === "ENOTDIR" ? new T(F.ENOTDIR, `'${t}': ${r}`) : n === "ENOTEMPTY" ? new T(F.ENOTEMPTY, `'${t}': ${r}`) : new T(F.EINVAL, `'${t}': ${r}`);
868
868
  }
869
869
  }
870
870
  class Is {
@@ -924,7 +924,7 @@ class Is {
924
924
  return this.getNetInfo();
925
925
  const r = this.generators.get(t);
926
926
  if (!r)
927
- throw new _(A.ENOENT, `'/proc${e}': no such file`);
927
+ throw new T(F.ENOENT, `'/proc${e}': no such file`);
928
928
  return r();
929
929
  }
930
930
  readFile(e) {
@@ -940,7 +940,7 @@ class Is {
940
940
  }
941
941
  stat(e) {
942
942
  if (!this.exists(e))
943
- throw new _(A.ENOENT, `'/proc${e}': no such file`);
943
+ throw new T(F.ENOENT, `'/proc${e}': no such file`);
944
944
  return e === "/" || e === "/net" ? { type: "directory", size: 0, ctime: 0, mtime: Date.now(), mode: 365 } : {
945
945
  type: "file",
946
946
  size: this.generate(e).length,
@@ -958,7 +958,7 @@ class Is {
958
958
  }
959
959
  if (e === "/net")
960
960
  return [{ name: "info", type: "file" }];
961
- throw new _(A.ENOTDIR, `'/proc${e}': not a directory`);
961
+ throw new T(F.ENOTDIR, `'/proc${e}': not a directory`);
962
962
  }
963
963
  }
964
964
  const ot = ["null", "zero", "random", "urandom", "clipboard"];
@@ -980,7 +980,7 @@ class Ns {
980
980
  case "clipboard":
981
981
  return ge(this.clipboardCache);
982
982
  default:
983
- throw new _(A.ENOENT, `'/dev${e}': no such device`);
983
+ throw new T(F.ENOENT, `'/dev${e}': no such device`);
984
984
  }
985
985
  }
986
986
  readFileString(e) {
@@ -997,7 +997,7 @@ class Ns {
997
997
  case "clipboard":
998
998
  return this.clipboardCache;
999
999
  default:
1000
- throw new _(A.ENOENT, `'/dev${e}': no such device`);
1000
+ throw new T(F.ENOENT, `'/dev${e}': no such device`);
1001
1001
  }
1002
1002
  }
1003
1003
  writeFile(e, t) {
@@ -1012,7 +1012,7 @@ class Ns {
1012
1012
  return;
1013
1013
  }
1014
1014
  default:
1015
- throw new _(A.EINVAL, `'/dev${e}': cannot write to device`);
1015
+ throw new T(F.EINVAL, `'/dev${e}': cannot write to device`);
1016
1016
  }
1017
1017
  }
1018
1018
  exists(e) {
@@ -1022,17 +1022,17 @@ class Ns {
1022
1022
  }
1023
1023
  stat(e) {
1024
1024
  if (!this.exists(e))
1025
- throw new _(A.ENOENT, `'/dev${e}': no such device`);
1025
+ throw new T(F.ENOENT, `'/dev${e}': no such device`);
1026
1026
  return e === "/" ? { type: "directory", size: ot.length, ctime: 0, mtime: 0, mode: 493 } : { type: "file", size: 0, ctime: 0, mtime: 0, mode: 438 };
1027
1027
  }
1028
1028
  readdir(e) {
1029
1029
  if (e === "/")
1030
1030
  return ot.map((t) => ({ name: t, type: "file" }));
1031
- throw new _(A.ENOTDIR, `'/dev${e}': not a directory`);
1031
+ throw new T(F.ENOTDIR, `'/dev${e}': not a directory`);
1032
1032
  }
1033
1033
  }
1034
- const As = ["proc", "dev"];
1035
- function Fs(s) {
1034
+ const Fs = ["proc", "dev"];
1035
+ function As(s) {
1036
1036
  let e = "";
1037
1037
  for (let t = 0; t < s.length; t++)
1038
1038
  e += String.fromCharCode(s[t]);
@@ -1056,11 +1056,11 @@ function nr(s, e) {
1056
1056
  mt: s.mtime,
1057
1057
  m: s.mode
1058
1058
  };
1059
- return s.chunks && s.chunks.length > 0 ? (n.ch = s.chunks.map((i) => ({ h: i.hash, s: i.size })), s.storedSize !== void 0 && (n.sz = s.storedSize)) : s.data.length > 0 && (n.d = Fs(s.data)), s.mime && (n.mi = s.mime), s.blobRef && (n.br = s.blobRef), n;
1059
+ return s.chunks && s.chunks.length > 0 ? (n.ch = s.chunks.map((i) => ({ h: i.hash, s: i.size })), s.storedSize !== void 0 && (n.sz = s.storedSize)) : s.data.length > 0 && (n.d = As(s.data)), s.mime && (n.mi = s.mime), s.blobRef && (n.br = s.blobRef), n;
1060
1060
  }
1061
1061
  const t = [];
1062
1062
  for (const [n, i] of s.children)
1063
- e && As.includes(n) || t.push(nr(i, !1));
1063
+ e && Fs.includes(n) || t.push(nr(i, !1));
1064
1064
  const r = {
1065
1065
  t: "d",
1066
1066
  n: s.name,
@@ -1070,7 +1070,7 @@ function nr(s, e) {
1070
1070
  };
1071
1071
  return t.length > 0 && (r.c = t), r;
1072
1072
  }
1073
- function Bs(s) {
1073
+ function zs(s) {
1074
1074
  return ir(s);
1075
1075
  }
1076
1076
  function ir(s) {
@@ -1091,7 +1091,7 @@ function ir(s) {
1091
1091
  };
1092
1092
  return s.mi && (t.mime = s.mi), s.br && (t.blobRef = s.br), s.ch && (t.chunks = s.ch.map((r) => ({ hash: r.h, size: r.s }))), s.sz !== void 0 && (t.storedSize = s.sz), t;
1093
1093
  }
1094
- const zs = 1e3;
1094
+ const Bs = 1e3;
1095
1095
  class Ms {
1096
1096
  constructor(e) {
1097
1097
  m(this, "timer", null);
@@ -1105,7 +1105,7 @@ class Ms {
1105
1105
  const e = await this.backend.loadTree();
1106
1106
  if (e)
1107
1107
  try {
1108
- return Bs(e);
1108
+ return zs(e);
1109
1109
  } catch {
1110
1110
  return null;
1111
1111
  }
@@ -1125,10 +1125,10 @@ class Ms {
1125
1125
  this.timer && clearTimeout(this.timer), this.timer = setTimeout(() => {
1126
1126
  this.save(e).catch(() => {
1127
1127
  }), this.timer = null;
1128
- }, zs);
1128
+ }, Bs);
1129
1129
  }
1130
1130
  }
1131
- const Ds = "lifo", ve = "filesystem", Tt = "root";
1131
+ const Ds = "lifo", ve = "filesystem", _t = "root";
1132
1132
  class Ws {
1133
1133
  constructor() {
1134
1134
  m(this, "db", null);
@@ -1150,7 +1150,7 @@ class Ws {
1150
1150
  async loadTree() {
1151
1151
  return this.db ? new Promise((e) => {
1152
1152
  try {
1153
- const n = this.db.transaction(ve, "readonly").objectStore(ve).get(Tt);
1153
+ const n = this.db.transaction(ve, "readonly").objectStore(ve).get(_t);
1154
1154
  n.onsuccess = () => {
1155
1155
  n.result ? e(n.result) : e(null);
1156
1156
  }, n.onerror = () => e(null);
@@ -1164,7 +1164,7 @@ class Ws {
1164
1164
  return new Promise((t) => {
1165
1165
  try {
1166
1166
  const r = this.db.transaction(ve, "readwrite");
1167
- r.objectStore(ve).put(e, Tt), r.oncomplete = () => t(), r.onerror = () => t();
1167
+ r.objectStore(ve).put(e, _t), r.oncomplete = () => t(), r.onerror = () => t();
1168
1168
  } catch {
1169
1169
  t();
1170
1170
  }
@@ -2128,20 +2128,32 @@ echo "Done."
2128
2128
  \x1B[2mExplore examples: ls ~/examples/scripts\x1B[0m
2129
2129
  `, Vs = `export PATH=/usr/bin:/bin
2130
2130
  export EDITOR=nano
2131
- `, Gs = `# Aliases
2131
+ `, Gs = `# ~/.liforc - Lifo shell configuration
2132
+ # This file is sourced on shell startup. Edit it to customize your shell.
2133
+ # Changes take effect on next shell start (refresh the page).
2134
+
2135
+ # ─── Aliases ───
2132
2136
  alias ll='ls -la'
2133
2137
  alias la='ls -a'
2134
2138
  alias l='ls -1'
2135
2139
  alias ..='cd ..'
2140
+ alias ...='cd ../..'
2136
2141
  alias cls='clear'
2137
2142
  alias h='history'
2143
+ alias q='exit'
2144
+ alias md='mkdir -p'
2145
+ alias rd='rmdir'
2146
+
2147
+ # ─── Environment ───
2148
+ export EDITOR=nano
2149
+ export PAGER=less
2138
2150
  `;
2139
2151
  class Zs {
2140
2152
  constructor(e) {
2141
2153
  m(this, "vfs");
2142
2154
  m(this, "portRegistry", /* @__PURE__ */ new Map());
2143
2155
  m(this, "persistence");
2144
- this.vfs = new _s(), this.persistence = new Ms(
2156
+ this.vfs = new Ts(), this.persistence = new Ms(
2145
2157
  e ?? new Ws()
2146
2158
  );
2147
2159
  }
@@ -2176,8 +2188,14 @@ class Zs {
2176
2188
  this.vfs.mkdir(t, { recursive: !0 });
2177
2189
  } catch {
2178
2190
  }
2179
- this.vfs.writeFile("/etc/motd", Hs), this.vfs.writeFile("/etc/hostname", `lifo
2180
- `), this.vfs.exists("/etc/profile") || this.vfs.writeFile("/etc/profile", Vs), this.vfs.exists("/home/user/.bashrc") || this.vfs.writeFile("/home/user/.bashrc", Gs), Us(this.vfs);
2191
+ if (this.vfs.writeFile("/etc/motd", Hs), this.vfs.writeFile("/etc/hostname", `lifo
2192
+ `), this.vfs.exists("/etc/profile") || this.vfs.writeFile("/etc/profile", Vs), this.vfs.exists("/home/user/.bashrc") && !this.vfs.exists("/home/user/.liforc"))
2193
+ try {
2194
+ const t = this.vfs.readFileString("/home/user/.bashrc");
2195
+ this.vfs.writeFile("/home/user/.liforc", t);
2196
+ } catch {
2197
+ }
2198
+ this.vfs.exists("/home/user/.liforc") || this.vfs.writeFile("/home/user/.liforc", Gs), Us(this.vfs);
2181
2199
  }
2182
2200
  getDefaultEnv() {
2183
2201
  return {
@@ -2210,14 +2228,14 @@ function Lo(s) {
2210
2228
  function Ro(s) {
2211
2229
  return Ks + s + ee;
2212
2230
  }
2213
- function To(s) {
2231
+ function _o(s) {
2214
2232
  return Ie + s + ee;
2215
2233
  }
2216
- function _o(s) {
2234
+ function To(s) {
2217
2235
  return Js + s + ee;
2218
2236
  }
2219
2237
  var b = /* @__PURE__ */ ((s) => (s[s.Word = 0] = "Word", s[s.Pipe = 1] = "Pipe", s[s.And = 2] = "And", s[s.Or = 3] = "Or", s[s.Semi = 4] = "Semi", s[s.Amp = 5] = "Amp", s[s.RedirectOut = 6] = "RedirectOut", s[s.RedirectAppend = 7] = "RedirectAppend", s[s.RedirectIn = 8] = "RedirectIn", s[s.RedirectErr = 9] = "RedirectErr", s[s.RedirectErrAppend = 10] = "RedirectErrAppend", s[s.RedirectAll = 11] = "RedirectAll", s[s.DoubleSemi = 12] = "DoubleSemi", s[s.LParen = 13] = "LParen", s[s.RParen = 14] = "RParen", s[s.Newline = 15] = "Newline", s[s.EOF = 16] = "EOF", s))(b || {});
2220
- function _t(s) {
2238
+ function Tt(s) {
2221
2239
  const e = [];
2222
2240
  let t = 0;
2223
2241
  for (; t < s.length; ) {
@@ -2683,13 +2701,13 @@ function an(s, e, t) {
2683
2701
  return r < s.length && s[r] === "]" && r++, { matched: n ? !i : i, end: r };
2684
2702
  }
2685
2703
  function cn(s, e, t) {
2686
- if (!At(s))
2704
+ if (!Ft(s))
2687
2705
  return [s];
2688
2706
  const n = (s.startsWith("/") ? s : D(e, s)).split("/").filter(Boolean), i = s.startsWith("/");
2689
2707
  let o = ["/"];
2690
2708
  for (const c of n) {
2691
2709
  const l = [];
2692
- if (At(c))
2710
+ if (Ft(c))
2693
2711
  for (const d of o)
2694
2712
  try {
2695
2713
  const h = t.readdir(d);
@@ -2718,10 +2736,10 @@ function cn(s, e, t) {
2718
2736
  }
2719
2737
  return a.sort();
2720
2738
  }
2721
- function At(s) {
2739
+ function Ft(s) {
2722
2740
  return s.includes("*") || s.includes("?") || s.includes("[");
2723
2741
  }
2724
- async function Ft(s, e) {
2742
+ async function At(s, e) {
2725
2743
  const t = [];
2726
2744
  for (const r of s) {
2727
2745
  const n = await or(r, e);
@@ -2733,7 +2751,7 @@ async function Ft(s, e) {
2733
2751
  }
2734
2752
  return t;
2735
2753
  }
2736
- async function _e(s, e) {
2754
+ async function Te(s, e) {
2737
2755
  return or(s, e);
2738
2756
  }
2739
2757
  async function or(s, e) {
@@ -3291,7 +3309,7 @@ class wn {
3291
3309
  }
3292
3310
  async executeLine(e, t) {
3293
3311
  try {
3294
- const r = _t(e), n = Nt(r);
3312
+ const r = Tt(e), n = Nt(r);
3295
3313
  return await this.executeScript(n, t);
3296
3314
  } catch (r) {
3297
3315
  if (r instanceof he || r instanceof ue || r instanceof at)
@@ -3373,7 +3391,7 @@ class wn {
3373
3391
  const r = this.createExpandContext();
3374
3392
  let n = 0, i;
3375
3393
  if (e.words !== null)
3376
- i = await Ft(e.words, r);
3394
+ i = await At(e.words, r);
3377
3395
  else {
3378
3396
  const o = this.config.env["@"] ?? "";
3379
3397
  i = o ? o.split(" ") : [];
@@ -3433,11 +3451,11 @@ class wn {
3433
3451
  return this.lastExitCode = r, r;
3434
3452
  }
3435
3453
  async executeCase(e, t) {
3436
- const r = this.createExpandContext(), n = await _e(e.word, r);
3454
+ const r = this.createExpandContext(), n = await Te(e.word, r);
3437
3455
  let i = 0;
3438
3456
  for (const o of e.items)
3439
3457
  for (const a of o.patterns) {
3440
- const c = await _e(a, r);
3458
+ const c = await Te(a, r);
3441
3459
  if (de(c, n))
3442
3460
  return i = await this.executeCompoundList(o.body, t), this.lastExitCode = i, i;
3443
3461
  }
@@ -3458,10 +3476,10 @@ class wn {
3458
3476
  }
3459
3477
  async executeSimpleCommand(e, t, r, n) {
3460
3478
  var k, P;
3461
- const i = this.createExpandContext(), o = await Ft(e.words, i);
3479
+ const i = this.createExpandContext(), o = await At(e.words, i);
3462
3480
  if (o.length === 0 && e.assignments.length > 0) {
3463
3481
  for (const L of e.assignments) {
3464
- const I = await _e(L.value, i);
3482
+ const I = await Te(L.value, i);
3465
3483
  this.config.env[L.name] = I;
3466
3484
  }
3467
3485
  return 0;
@@ -3478,7 +3496,7 @@ class wn {
3478
3496
  }
3479
3497
  const d = {};
3480
3498
  for (const L of e.assignments) {
3481
- const I = await _e(L.value, i);
3499
+ const I = await Te(L.value, i);
3482
3500
  d[L.name] = this.config.env[L.name], this.config.env[L.name] = I;
3483
3501
  }
3484
3502
  let h = r ?? this.config.defaultStdout ?? {
@@ -3487,7 +3505,7 @@ class wn {
3487
3505
  write: (L) => this.config.writeToTerminal(L)
3488
3506
  }, g = t;
3489
3507
  for (const L of e.redirections) {
3490
- const I = await _e(L.target, i), S = D(this.config.getCwd(), I);
3508
+ const I = await Te(L.target, i), S = D(this.config.getCwd(), I);
3491
3509
  switch (L.operator) {
3492
3510
  case ">":
3493
3511
  this.config.vfs.writeFile(S, ""), h = this.createFileWriter(S);
@@ -3545,12 +3563,15 @@ class wn {
3545
3563
  stdout: h,
3546
3564
  stderr: f,
3547
3565
  signal: j,
3548
- stdin: g
3566
+ stdin: g,
3567
+ setRawMode: n ? (E) => {
3568
+ n.rawMode = E;
3569
+ } : void 0
3549
3570
  };
3550
3571
  try {
3551
3572
  N = await S(v);
3552
- } catch (x) {
3553
- x instanceof Error && x.name === "AbortError" ? N = 130 : (f.write(`${a}: ${x instanceof Error ? x.message : String(x)}
3573
+ } catch (E) {
3574
+ E instanceof Error && E.name === "AbortError" ? N = 130 : (f.write(`${a}: ${E instanceof Error ? E.message : String(E)}
3554
3575
  `), N = 1);
3555
3576
  }
3556
3577
  }
@@ -3591,7 +3612,7 @@ class wn {
3591
3612
  write: (o) => {
3592
3613
  t += o;
3593
3614
  }
3594
- }, n = _t(e), i = Nt(n);
3615
+ }, n = Tt(e), i = Nt(n);
3595
3616
  for (const o of i.lists)
3596
3617
  for (const a of o.entries)
3597
3618
  for (const c of a.pipeline.commands)
@@ -3630,7 +3651,7 @@ class wn {
3630
3651
  };
3631
3652
  }
3632
3653
  }
3633
- const Ot = "/home/user/.bash_history", Bt = 1e3;
3654
+ const Ot = "/home/user/.bash_history", zt = 1e3;
3634
3655
  class yn {
3635
3656
  constructor(e) {
3636
3657
  m(this, "entries", []);
@@ -3656,7 +3677,7 @@ class yn {
3656
3677
  }
3657
3678
  add(e) {
3658
3679
  const t = e.trim();
3659
- t && (this.entries.length > 0 && this.entries[this.entries.length - 1] === t || (this.entries.push(t), this.entries.length > Bt && (this.entries = this.entries.slice(-Bt)), this.save()));
3680
+ t && (this.entries.length > 0 && this.entries[this.entries.length - 1] === t || (this.entries.push(t), this.entries.length > zt && (this.entries = this.entries.slice(-zt)), this.save()));
3660
3681
  }
3661
3682
  /**
3662
3683
  * Expand history references:
@@ -3783,9 +3804,9 @@ function Sn(s, e) {
3783
3804
  if (t === "" || t.endsWith("|") || t.endsWith("&&") || t.endsWith("||") || t.endsWith(";"))
3784
3805
  return "command";
3785
3806
  const r = t.split(/\s+/).filter(Boolean);
3786
- return r.length > 0 && r[r.length - 1] === "cd" && zt(t) === "cd" || zt(t) === "cd" ? "directory" : "file";
3807
+ return r.length > 0 && r[r.length - 1] === "cd" && Bt(t) === "cd" || Bt(t) === "cd" ? "directory" : "file";
3787
3808
  }
3788
- function zt(s) {
3809
+ function Bt(s) {
3789
3810
  const e = s.split(/\|{1,2}|&&|;/), r = e[e.length - 1].trim().split(/\s+/).filter(Boolean);
3790
3811
  return r.length > 0 ? r[0] : null;
3791
3812
  }
@@ -3883,7 +3904,7 @@ function pt(s, e, t) {
3883
3904
  if (r === "-n" && e + 1 < s.length)
3884
3905
  return { value: s[e + 1].length > 0, pos: e + 2 };
3885
3906
  if (r.startsWith("-") && r.length === 2 && e + 1 < s.length) {
3886
- const n = r[1], i = s[e + 1], o = Tn(n, i, t);
3907
+ const n = r[1], i = s[e + 1], o = _n(n, i, t);
3887
3908
  if (o !== null)
3888
3909
  return { value: o, pos: e + 2 };
3889
3910
  }
@@ -3914,7 +3935,7 @@ function pt(s, e, t) {
3914
3935
  }
3915
3936
  return { value: r.length > 0, pos: e + 1 };
3916
3937
  }
3917
- function Tn(s, e, t) {
3938
+ function _n(s, e, t) {
3918
3939
  switch (s) {
3919
3940
  case "e":
3920
3941
  return t.exists(e);
@@ -3961,11 +3982,19 @@ class Wt {
3961
3982
  m(this, "closed", !1);
3962
3983
  m(this, "resolver", null);
3963
3984
  m(this, "_waiting", !1);
3985
+ m(this, "_rawMode", !1);
3964
3986
  }
3965
3987
  /** True when a command has called read() and is waiting for input. */
3966
3988
  get isWaiting() {
3967
3989
  return this._waiting;
3968
3990
  }
3991
+ /** When true, the shell should bypass line editing and feed raw keypresses. */
3992
+ get rawMode() {
3993
+ return this._rawMode;
3994
+ }
3995
+ set rawMode(e) {
3996
+ this._rawMode = e;
3997
+ }
3969
3998
  /** Shell calls this on Enter (with line + '\n'). */
3970
3999
  feed(e) {
3971
4000
  if (!this.closed)
@@ -3999,7 +4028,7 @@ class Wt {
3999
4028
  return e.join("");
4000
4029
  }
4001
4030
  }
4002
- class _n {
4031
+ class Tn {
4003
4032
  constructor(e, t, r, n) {
4004
4033
  m(this, "terminal");
4005
4034
  m(this, "vfs");
@@ -4103,7 +4132,23 @@ class _n {
4103
4132
  }
4104
4133
  }
4105
4134
  start() {
4106
- this.terminal.onData((e) => this.handleInput(e)), this.printPrompt();
4135
+ this.terminal.onData((e) => this.handleInput(e)), this.sourceRcFiles().then(() => {
4136
+ this.printPrompt();
4137
+ });
4138
+ }
4139
+ async sourceRcFiles() {
4140
+ const e = this.env.HOME ?? "/home/user";
4141
+ await this.sourceFile("/etc/profile");
4142
+ const t = [
4143
+ `${e}/.liforc`,
4144
+ `${e}/.bashrc`,
4145
+ `${e}/.profile`
4146
+ ];
4147
+ for (const r of t)
4148
+ if (this.vfs.exists(r)) {
4149
+ await this.sourceFile(r);
4150
+ break;
4151
+ }
4107
4152
  }
4108
4153
  printPrompt() {
4109
4154
  const e = this.jobTable.collectDone();
@@ -4117,7 +4162,11 @@ class _n {
4117
4162
  this.terminal.write(`${Ie}${dt}${n}@${i}${ee}:${Ie}${ft}${r}${ee}$ `);
4118
4163
  }
4119
4164
  handleInput(e) {
4120
- var t, r, n;
4165
+ var t, r, n, i;
4166
+ if (this.running && ((t = this.terminalStdin) != null && t.rawMode)) {
4167
+ this.terminalStdin.feed(e);
4168
+ return;
4169
+ }
4121
4170
  if (e === "\x1B[D") {
4122
4171
  this.moveCursorLeft();
4123
4172
  return;
@@ -4143,7 +4192,7 @@ class _n {
4143
4192
  return;
4144
4193
  }
4145
4194
  if (e === "") {
4146
- this.running && this.abortController ? ((t = this.terminalStdin) == null || t.close(), this.stdinLineBuffer = "", this.stdinCursorPos = 0, this.abortController.abort()) : (this.terminal.write(`^C\r
4195
+ this.running && this.abortController ? ((r = this.terminalStdin) == null || r.close(), this.stdinLineBuffer = "", this.stdinCursorPos = 0, this.abortController.abort()) : (this.terminal.write(`^C\r
4147
4196
  `), this.lineBuffer = "", this.cursorPos = 0, this.printPrompt());
4148
4197
  return;
4149
4198
  }
@@ -4155,14 +4204,14 @@ class _n {
4155
4204
  return;
4156
4205
  }
4157
4206
  if (e === "") {
4158
- if (this.running && ((r = this.terminalStdin) != null && r.isWaiting)) {
4207
+ if (this.running && ((n = this.terminalStdin) != null && n.isWaiting)) {
4159
4208
  this.stdinCursorPos > 0 && this.terminal.write(`\x1B[${this.stdinCursorPos}D`), this.terminal.write("\x1B[K"), this.stdinLineBuffer = "", this.stdinCursorPos = 0;
4160
4209
  return;
4161
4210
  }
4162
4211
  this.clearLine(), this.lineBuffer = "", this.cursorPos = 0;
4163
4212
  return;
4164
4213
  }
4165
- if (this.running && ((n = this.terminalStdin) != null && n.isWaiting)) {
4214
+ if (this.running && ((i = this.terminalStdin) != null && i.isWaiting)) {
4166
4215
  this.handleStdinInput(e);
4167
4216
  return;
4168
4217
  }
@@ -4174,27 +4223,27 @@ class _n {
4174
4223
  if (this.tabCount = 0, e === "\r") {
4175
4224
  this.terminal.write(`\r
4176
4225
  `);
4177
- const i = this.lineBuffer.trim();
4178
- this.lineBuffer = "", this.cursorPos = 0, this.historyIndex = -1, i ? (this.history.push(i), this.executeLine(i)) : this.printPrompt();
4226
+ const o = this.lineBuffer.trim();
4227
+ this.lineBuffer = "", this.cursorPos = 0, this.historyIndex = -1, o ? (this.history.push(o), this.executeLine(o)) : this.printPrompt();
4179
4228
  return;
4180
4229
  }
4181
4230
  if (e === "" || e === "\b") {
4182
4231
  if (this.cursorPos > 0) {
4183
- const i = this.lineBuffer.slice(0, this.cursorPos - 1), o = this.lineBuffer.slice(this.cursorPos);
4184
- this.lineBuffer = i + o, this.cursorPos--, this.redrawLine();
4232
+ const o = this.lineBuffer.slice(0, this.cursorPos - 1), a = this.lineBuffer.slice(this.cursorPos);
4233
+ this.lineBuffer = o + a, this.cursorPos--, this.redrawLine();
4185
4234
  }
4186
4235
  return;
4187
4236
  }
4188
4237
  if (e === "\x1B[3~") {
4189
4238
  if (this.cursorPos < this.lineBuffer.length) {
4190
- const i = this.lineBuffer.slice(0, this.cursorPos), o = this.lineBuffer.slice(this.cursorPos + 1);
4191
- this.lineBuffer = i + o, this.redrawLine();
4239
+ const o = this.lineBuffer.slice(0, this.cursorPos), a = this.lineBuffer.slice(this.cursorPos + 1);
4240
+ this.lineBuffer = o + a, this.redrawLine();
4192
4241
  }
4193
4242
  return;
4194
4243
  }
4195
4244
  if (e >= " ") {
4196
- const i = this.lineBuffer.slice(0, this.cursorPos), o = this.lineBuffer.slice(this.cursorPos);
4197
- this.lineBuffer = i + e + o, this.cursorPos += e.length, this.redrawLine();
4245
+ const o = this.lineBuffer.slice(0, this.cursorPos), a = this.lineBuffer.slice(this.cursorPos);
4246
+ this.lineBuffer = o + e + a, this.cursorPos += e.length, this.redrawLine();
4198
4247
  }
4199
4248
  }
4200
4249
  }
@@ -4340,7 +4389,7 @@ class _n {
4340
4389
  return this.vfs.stat(n).type !== "directory" ? (t.write(`cd: ${r}: Not a directory
4341
4390
  `), 1) : (this.env.OLDPWD = this.cwd, this.cwd = n, 0);
4342
4391
  } catch (i) {
4343
- if (i instanceof _)
4392
+ if (i instanceof T)
4344
4393
  return t.write(`cd: ${r}: ${i.message}
4345
4394
  `), 1;
4346
4395
  throw i;
@@ -4529,7 +4578,7 @@ class Pn {
4529
4578
  }
4530
4579
  function In() {
4531
4580
  const s = new Pn();
4532
- return s.registerLazy("ls", () => import("./ls-BSsn2qVd.js")), s.registerLazy("cat", () => import("./cat-BnEyWWFr.js")), s.registerLazy("mkdir", () => import("./mkdir-CF_ugDtu.js")), s.registerLazy("rm", () => import("./rm-DUR35EZn.js")), s.registerLazy("cp", () => import("./cp-7dOXCu3Q.js")), s.registerLazy("mv", () => import("./mv-BSS_QQM-.js")), s.registerLazy("touch", () => import("./touch-C4pyouV6.js")), s.registerLazy("find", () => import("./find-Cz4GdaPT.js")), s.registerLazy("tree", () => import("./tree-DfPczgli.js")), s.registerLazy("stat", () => import("./stat-gLLpq3JZ.js")), s.registerLazy("ln", () => import("./ln-Bf3f3jVA.js")), s.registerLazy("du", () => import("./du-i2qiYYnL.js")), s.registerLazy("df", () => import("./df-CeZb4WOr.js")), s.registerLazy("chmod", () => import("./chmod-CdrI3hZV.js")), s.registerLazy("file", () => import("./file-Dd6iLk05.js")), s.registerLazy("grep", () => import("./grep-DYSAPbxr.js")), s.registerLazy("head", () => import("./head-bFamSv7p.js")), s.registerLazy("tail", () => import("./tail-FnC8M40k.js")), s.registerLazy("wc", () => import("./wc-DBPO6xRf.js")), s.registerLazy("sort", () => import("./sort-C2sQ841N.js")), s.registerLazy("uniq", () => import("./uniq-Dhsoj7Lk.js")), s.registerLazy("cut", () => import("./cut-vn4vxL9L.js")), s.registerLazy("tr", () => import("./tr-DsCiwSIu.js")), s.registerLazy("sed", () => import("./sed-YKJ5wcuu.js")), s.registerLazy("awk", () => import("./awk-BFrGImnt.js")), s.registerLazy("tee", () => import("./tee-CoymtuKa.js")), s.registerLazy("xargs", () => import("./xargs-DfbCRFFd.js")), s.registerLazy("yes", () => import("./yes-DXEyHHD2.js")), s.registerLazy("printf", () => import("./printf-Cc2o7KZx.js")), s.registerLazy("env", () => import("./env-DXzvDKsN.js")), s.registerLazy("uname", () => import("./uname-BCn8HlJD.js")), s.registerLazy("date", () => import("./date-C8NB8v8G.js")), s.registerLazy("sleep", () => import("./sleep-B4C3fZiR.js")), s.registerLazy("uptime", () => import("./uptime-CgBJegqU.js")), s.registerLazy("whoami", () => import("./whoami-B1237V5e.js")), s.registerLazy("hostname", () => import("./hostname-BxU2S3nT.js")), s.registerLazy("free", () => import("./free-DAxE4b2U.js")), s.registerLazy("which", () => import("./which-D3u0cwyh.js")), s.registerLazy("curl", () => Promise.resolve().then(() => mi)), s.registerLazy("wget", () => import("./wget-CYImxeOz.js")), s.registerLazy("ping", () => import("./ping-DtVEwwda.js")), s.registerLazy("dig", () => import("./dig-BEJ8Ky96.js")), s.registerLazy("tar", () => import("./tar-tfiT1iFt.js")), s.registerLazy("gzip", () => import("./gzip-JLrrHn6u.js")), s.registerLazy("gunzip", () => import("./gunzip-BHAbNGHO.js")), s.registerLazy("zip", () => import("./zip-TPdwPkrA.js")), s.registerLazy("unzip", () => import("./unzip-CqIKZ8NK.js")), s.registerLazy("node", () => Promise.resolve().then(() => Gr)), s.registerLazy("rmdir", () => import("./rmdir-DXjx17-Z.js")), s.registerLazy("realpath", () => import("./realpath-BWqrTa-J.js")), s.registerLazy("basename", () => import("./basename-MGz8cBxd.js")), s.registerLazy("dirname", () => import("./dirname-B3ciBZhS.js")), s.registerLazy("mktemp", () => import("./mktemp-CaEiJi87.js")), s.registerLazy("chown", () => import("./chown-7yY3iC6J.js")), s.registerLazy("diff", () => import("./diff-DnKPewP-.js")), s.registerLazy("nl", () => import("./nl-D30ka89P.js")), s.registerLazy("rev", () => import("./rev-Cfja5xbl.js")), s.registerLazy("cal", () => import("./cal-DPULSAhj.js")), s.registerLazy("bc", () => import("./bc-BYiKVTNg.js")), s.registerLazy("man", () => import("./man-CJ5pI0_W.js")), s;
4581
+ return s.registerLazy("ls", () => import("./ls-YnhMRefh.js")), s.registerLazy("cat", () => import("./cat-Jv35D4BV.js")), s.registerLazy("mkdir", () => import("./mkdir-DY1P3Jxj.js")), s.registerLazy("rm", () => import("./rm-D7iWUUE2.js")), s.registerLazy("cp", () => import("./cp-CB-sGTRH.js")), s.registerLazy("mv", () => import("./mv-bH08L-F_.js")), s.registerLazy("touch", () => import("./touch-DCb9Qn5q.js")), s.registerLazy("find", () => import("./find-C0T-P7sl.js")), s.registerLazy("tree", () => import("./tree-4QpgsnA0.js")), s.registerLazy("stat", () => import("./stat-BvwNpE5B.js")), s.registerLazy("ln", () => import("./ln-Bf3f3jVA.js")), s.registerLazy("du", () => import("./du-UupzdKc_.js")), s.registerLazy("df", () => import("./df-CeZb4WOr.js")), s.registerLazy("chmod", () => import("./chmod-Bh-u8XOr.js")), s.registerLazy("file", () => import("./file-DOl4Wjtc.js")), s.registerLazy("grep", () => import("./grep-Blwrv9k5.js")), s.registerLazy("head", () => import("./head-CJwcsX18.js")), s.registerLazy("tail", () => import("./tail-xVmLkzJK.js")), s.registerLazy("wc", () => import("./wc-B-jNRfLa.js")), s.registerLazy("sort", () => import("./sort-OXqZY83v.js")), s.registerLazy("uniq", () => import("./uniq-xmgE0zRj.js")), s.registerLazy("cut", () => import("./cut-B79kgCm4.js")), s.registerLazy("tr", () => import("./tr-DsCiwSIu.js")), s.registerLazy("sed", () => import("./sed-DwBPYYFb.js")), s.registerLazy("awk", () => import("./awk-CC_Qo0hQ.js")), s.registerLazy("tee", () => import("./tee-DxygINEJ.js")), s.registerLazy("xargs", () => import("./xargs-DfbCRFFd.js")), s.registerLazy("yes", () => import("./yes-DXEyHHD2.js")), s.registerLazy("printf", () => import("./printf-Cc2o7KZx.js")), s.registerLazy("env", () => import("./env-DXzvDKsN.js")), s.registerLazy("uname", () => import("./uname-BCn8HlJD.js")), s.registerLazy("date", () => import("./date-C8NB8v8G.js")), s.registerLazy("sleep", () => import("./sleep-B4C3fZiR.js")), s.registerLazy("uptime", () => import("./uptime-CgBJegqU.js")), s.registerLazy("whoami", () => import("./whoami-Y18wqme3.js")), s.registerLazy("hostname", () => import("./hostname-BxU2S3nT.js")), s.registerLazy("free", () => import("./free-DAxE4b2U.js")), s.registerLazy("which", () => import("./which-D3u0cwyh.js")), s.registerLazy("curl", () => Promise.resolve().then(() => mi)), s.registerLazy("wget", () => import("./wget-CO-45JoL.js")), s.registerLazy("ping", () => import("./ping-DtVEwwda.js")), s.registerLazy("dig", () => import("./dig-BEJ8Ky96.js")), s.registerLazy("tar", () => import("./tar-BHRJ0-4j.js")), s.registerLazy("gzip", () => import("./gzip-BxF7M1np.js")), s.registerLazy("gunzip", () => import("./gunzip-R7EtgP15.js")), s.registerLazy("zip", () => import("./zip-Cu1DzbAu.js")), s.registerLazy("unzip", () => import("./unzip-CDKcoB0B.js")), s.registerLazy("node", () => Promise.resolve().then(() => Gr)), s.registerLazy("rmdir", () => import("./rmdir-BLtdNjt1.js")), s.registerLazy("realpath", () => import("./realpath-BH29Lem_.js")), s.registerLazy("basename", () => import("./basename-BIICW06y.js")), s.registerLazy("dirname", () => import("./dirname-w2Y6csox.js")), s.registerLazy("mktemp", () => import("./mktemp-BRzo2c8y.js")), s.registerLazy("chown", () => import("./chown-Dv7xfl2a.js")), s.registerLazy("diff", () => import("./diff-D5Ej-JEe.js")), s.registerLazy("nl", () => import("./nl-D26SSOD4.js")), s.registerLazy("rev", () => import("./rev-ySwmRf_K.js")), s.registerLazy("nano", () => import("./nano-CueO2oS0.js")), s.registerLazy("less", () => import("./less-B0gFLJ_7.js")), s.registerLazy("tac", () => import("./tac-D4BMSdj9.js")), s.registerLazy("seq", () => import("./seq-B01YKIbO.js")), s.registerLazy("base64", () => import("./base64-BBckAmkE.js")), s.registerLazy("strings", () => import("./strings-BesRwUt_.js")), s.registerLazy("cal", () => import("./cal-DPULSAhj.js")), s.registerLazy("bc", () => import("./bc-BYiKVTNg.js")), s.registerLazy("man", () => import("./man-Dg26tZ-a.js")), s.registerLazy("sha256sum", () => import("./sha256sum-DED6ePiU.js")), s.registerLazy("sl", () => import("./sl-Dv4iPBN6.js")), s.registerLazy("fastfetch", () => import("./fastfetch-aPM9Z3ym.js")), s.registerLazy("neofetch", () => import("./fastfetch-aPM9Z3ym.js")), s;
4533
4582
  }
4534
4583
  function Nn(s) {
4535
4584
  return async (e) => {
@@ -4547,7 +4596,7 @@ function Nn(s) {
4547
4596
  `), 0;
4548
4597
  };
4549
4598
  }
4550
- function An(s) {
4599
+ function Fn(s) {
4551
4600
  return async (e) => {
4552
4601
  const t = /* @__PURE__ */ new Date(), r = String(t.getHours()).padStart(2, "0"), n = String(t.getMinutes()).padStart(2, "0"), i = String(t.getSeconds()).padStart(2, "0"), o = typeof performance < "u" ? performance.now() : 0, a = Math.floor(o / 6e4), c = typeof navigator < "u" && navigator.hardwareConcurrency || 1, l = typeof performance < "u" ? performance.memory : void 0, d = l ? Math.round(l.jsHeapSizeLimit / (1024 * 1024)) : 256, h = l ? Math.round(l.usedJSHeapSize / (1024 * 1024)) : 16, f = d - h, g = s.list(), N = g.filter((I) => I.status === "running").length, k = g.filter((I) => I.status === "stopped").length, P = g.length + 2;
4553
4602
  e.stdout.write(`top - ${r}:${n}:${i} up ${a} min, 1 user
@@ -4568,7 +4617,7 @@ function An(s) {
4568
4617
  `), 0;
4569
4618
  };
4570
4619
  }
4571
- const Fn = {
4620
+ const An = {
4572
4621
  HUP: 1,
4573
4622
  INT: 2,
4574
4623
  QUIT: 3,
@@ -4610,7 +4659,7 @@ function jn(s) {
4610
4659
  r = 1;
4611
4660
  const o = parseInt(i, 10);
4612
4661
  if (!(!isNaN(o) && Ut[o])) {
4613
- if (Fn[i.toUpperCase()] === void 0) return e.stderr.write(`kill: invalid signal: ${i}
4662
+ if (An[i.toUpperCase()] === void 0) return e.stderr.write(`kill: invalid signal: ${i}
4614
4663
  `), 1;
4615
4664
  }
4616
4665
  }
@@ -4699,7 +4748,7 @@ function On(s) {
4699
4748
  });
4700
4749
  };
4701
4750
  }
4702
- const Bn = [
4751
+ const zn = [
4703
4752
  "cd",
4704
4753
  "pwd",
4705
4754
  "echo",
@@ -4716,8 +4765,8 @@ const Bn = [
4716
4765
  ".",
4717
4766
  "alias",
4718
4767
  "unalias"
4719
- ], zn = {
4720
- "Shell builtins": Bn,
4768
+ ], Bn = {
4769
+ "Shell builtins": zn,
4721
4770
  "File system": [
4722
4771
  "ls",
4723
4772
  "cat",
@@ -4786,7 +4835,7 @@ function Mn(s) {
4786
4835
  `), e.stdout.write(`==================
4787
4836
 
4788
4837
  `);
4789
- for (const [t, r] of Object.entries(zn)) {
4838
+ for (const [t, r] of Object.entries(Bn)) {
4790
4839
  e.stdout.write(`${t}:
4791
4840
  `);
4792
4841
  const n = 6;
@@ -4975,7 +5024,7 @@ function Ht(s, e) {
4975
5024
  }
4976
5025
  function f(p, u) {
4977
5026
  const w = U(e, p);
4978
- return s.readdir(w).map((T) => T.name);
5027
+ return s.readdir(w).map((_) => _.name);
4979
5028
  }
4980
5029
  function g(p) {
4981
5030
  const u = U(e, p);
@@ -5009,40 +5058,40 @@ function Ht(s, e) {
5009
5058
  return u;
5010
5059
  }
5011
5060
  function v(p, u) {
5012
- const w = U(e, p), $ = s.readFile(w), T = u ?? 0;
5013
- T >= $.length || s.writeFile(w, $.slice(0, T));
5061
+ const w = U(e, p), $ = s.readFile(w), _ = u ?? 0;
5062
+ _ >= $.length || s.writeFile(w, $.slice(0, _));
5014
5063
  }
5015
- function x(p, u, w) {
5016
- const $ = U(e, p), T = Hn(u ?? "r");
5017
- if (T & me && (s.exists($) || s.writeFile($, "")), T & Ve && s.writeFile($, ""), !s.exists($))
5064
+ function E(p, u, w) {
5065
+ const $ = U(e, p), _ = Hn(u ?? "r");
5066
+ if (_ & me && (s.exists($) || s.writeFile($, "")), _ & Ve && s.writeFile($, ""), !s.exists($))
5018
5067
  throw ct("open", $);
5019
- const F = r++;
5020
- return t.set(F, {
5068
+ const A = r++;
5069
+ return t.set(A, {
5021
5070
  path: $,
5022
- position: T & Ne ? s.readFile($).length : 0,
5071
+ position: _ & Ne ? s.readFile($).length : 0,
5023
5072
  flags: typeof u == "string" ? u : "r",
5024
5073
  closed: !1
5025
- }), F;
5074
+ }), A;
5026
5075
  }
5027
5076
  function y(p) {
5028
5077
  const u = n(p);
5029
5078
  u.closed = !0, t.delete(p);
5030
5079
  }
5031
- function E(p, u, w, $, T) {
5032
- const F = n(p), B = s.readFile(F.path), H = T !== null ? T : F.position, se = Math.max(0, B.length - H), ce = Math.min($, se);
5033
- return ce === 0 ? 0 : (u.set(B.subarray(H, H + ce), w), T === null && (F.position = H + ce), ce);
5080
+ function x(p, u, w, $, _) {
5081
+ const A = n(p), z = s.readFile(A.path), H = _ !== null ? _ : A.position, se = Math.max(0, z.length - H), ce = Math.min($, se);
5082
+ return ce === 0 ? 0 : (u.set(z.subarray(H, H + ce), w), _ === null && (A.position = H + ce), ce);
5034
5083
  }
5035
- function R(p, u, w, $, T) {
5036
- const F = n(p);
5037
- let B, H;
5084
+ function R(p, u, w, $, _) {
5085
+ const A = n(p);
5086
+ let z, H;
5038
5087
  if (typeof u == "string")
5039
- B = ge(u), H = typeof w == "number" ? w : F.position;
5088
+ z = ge(u), H = typeof w == "number" ? w : A.position;
5040
5089
  else {
5041
5090
  const nt = w ?? 0, gs = typeof $ == "number" ? $ : u.length - nt;
5042
- B = u.subarray(nt, nt + gs), H = T ?? F.position;
5091
+ z = u.subarray(nt, nt + gs), H = _ ?? A.position;
5043
5092
  }
5044
- const se = s.readFile(F.path), ce = H + B.length, ms = Math.max(se.length, ce), st = new Uint8Array(ms);
5045
- return st.set(se, 0), st.set(B, H), s.writeFile(F.path, st), F.position = ce, B.length;
5093
+ const se = s.readFile(A.path), ce = H + z.length, ms = Math.max(se.length, ce), st = new Uint8Array(ms);
5094
+ return st.set(se, 0), st.set(z, H), s.writeFile(A.path, st), A.position = ce, z.length;
5046
5095
  }
5047
5096
  function O(p) {
5048
5097
  const u = n(p);
@@ -5052,7 +5101,7 @@ function Ht(s, e) {
5052
5101
  const w = n(p);
5053
5102
  v(w.path, u);
5054
5103
  }
5055
- function z(p) {
5104
+ function B(p) {
5056
5105
  }
5057
5106
  function pe(p) {
5058
5107
  }
@@ -5069,7 +5118,7 @@ function Ht(s, e) {
5069
5118
  const w = p();
5070
5119
  u(null, w);
5071
5120
  } catch (w) {
5072
- if (w instanceof _)
5121
+ if (w instanceof T)
5073
5122
  u(Un(w, "", ""));
5074
5123
  else if (w.code)
5075
5124
  u(w);
@@ -5079,8 +5128,8 @@ function Ht(s, e) {
5079
5128
  });
5080
5129
  }
5081
5130
  function J(p, u, w) {
5082
- const $ = typeof u == "function" ? u : w, T = typeof u == "function" ? void 0 : u;
5083
- q(() => i(p, T), $);
5131
+ const $ = typeof u == "function" ? u : w, _ = typeof u == "function" ? void 0 : u;
5132
+ q(() => i(p, _), $);
5084
5133
  }
5085
5134
  function Le(p, u, w, $) {
5086
5135
  q(() => o(p, u), typeof w == "function" ? w : $);
@@ -5092,8 +5141,8 @@ function Ht(s, e) {
5092
5141
  q(() => d(p), u);
5093
5142
  }
5094
5143
  function G(p, u, w) {
5095
- const $ = typeof u == "function" ? u : w, T = typeof u == "function" ? void 0 : u;
5096
- q(() => h(p, T), $);
5144
+ const $ = typeof u == "function" ? u : w, _ = typeof u == "function" ? void 0 : u;
5145
+ q(() => h(p, _), $);
5097
5146
  }
5098
5147
  function ae(p, u, w) {
5099
5148
  q(() => f(p), typeof u == "function" ? u : w);
@@ -5105,8 +5154,8 @@ function Ht(s, e) {
5105
5154
  q(() => k(p, u), w);
5106
5155
  }
5107
5156
  function We(p, u, w) {
5108
- const $ = typeof u == "function" ? u : w, T = typeof u == "function" ? void 0 : u;
5109
- q(() => S(p, T), $);
5157
+ const $ = typeof u == "function" ? u : w, _ = typeof u == "function" ? void 0 : u;
5158
+ q(() => S(p, _), $);
5110
5159
  }
5111
5160
  function as(p, u) {
5112
5161
  queueMicrotask(() => {
@@ -5114,14 +5163,14 @@ function Ht(s, e) {
5114
5163
  });
5115
5164
  }
5116
5165
  function cs(p, u, w, $) {
5117
- let T, F, B;
5118
- typeof u == "function" ? (T = u, F = "r") : typeof w == "function" ? (T = w, F = u) : (T = $, F = u, B = w), q(() => x(p, F, B), T);
5166
+ let _, A, z;
5167
+ typeof u == "function" ? (_ = u, A = "r") : typeof w == "function" ? (_ = w, A = u) : (_ = $, A = u, z = w), q(() => E(p, A, z), _);
5119
5168
  }
5120
5169
  function ls(p, u) {
5121
5170
  q(() => y(p), u);
5122
5171
  }
5123
- function hs(p, u, w, $, T, F) {
5124
- q(() => E(p, u, w, $, T), F);
5172
+ function hs(p, u, w, $, _, A) {
5173
+ q(() => x(p, u, w, $, _), A);
5125
5174
  }
5126
5175
  function us(p, u) {
5127
5176
  q(() => O(p), u);
@@ -5130,42 +5179,42 @@ function Ht(s, e) {
5130
5179
  const w = U(e, p), $ = new Ke();
5131
5180
  return queueMicrotask(() => {
5132
5181
  try {
5133
- const T = s.readFile(w), F = (u == null ? void 0 : u.start) ?? 0, B = (u == null ? void 0 : u.end) !== void 0 ? u.end + 1 : T.length, H = T.subarray(F, B);
5182
+ const _ = s.readFile(w), A = (u == null ? void 0 : u.start) ?? 0, z = (u == null ? void 0 : u.end) !== void 0 ? u.end + 1 : _.length, H = _.subarray(A, z);
5134
5183
  u != null && u.encoding, $.push(Oe(H)), $.push(null);
5135
- } catch (T) {
5136
- $.emit("error", T);
5184
+ } catch (_) {
5185
+ $.emit("error", _);
5137
5186
  }
5138
5187
  }), $;
5139
5188
  }
5140
5189
  function fs(p, u) {
5141
- const w = U(e, p), $ = (u == null ? void 0 : u.flags) ?? "w", T = [];
5190
+ const w = U(e, p), $ = (u == null ? void 0 : u.flags) ?? "w", _ = [];
5142
5191
  if ($.includes("w"))
5143
5192
  try {
5144
5193
  s.writeFile(w, "");
5145
5194
  } catch {
5146
5195
  }
5147
- const F = new $t();
5148
- return F.write = (B, H, se) => {
5149
- T.push(B);
5196
+ const A = new $t();
5197
+ return A.write = (z, H, se) => {
5198
+ _.push(z);
5150
5199
  try {
5151
- $.includes("a") ? s.appendFile(w, B) : s.writeFile(w, T.join(""));
5200
+ $.includes("a") ? s.appendFile(w, z) : s.writeFile(w, _.join(""));
5152
5201
  } catch (ce) {
5153
- return F.emit("error", ce), !1;
5202
+ return A.emit("error", ce), !1;
5154
5203
  }
5155
5204
  return se && se(), !0;
5156
- }, F.end = (B) => {
5157
- B && F.write(B), F.emit("finish"), F.emit("close");
5158
- }, F;
5205
+ }, A.end = (z) => {
5206
+ z && A.write(z), A.emit("finish"), A.emit("close");
5207
+ }, A;
5159
5208
  }
5160
5209
  function ps(p, u, w) {
5161
- const $ = U(e, p), T = typeof u == "function" ? u : w, F = new oe(), B = s.onChange;
5210
+ const $ = U(e, p), _ = typeof u == "function" ? u : w, A = new oe(), z = s.onChange;
5162
5211
  return s.onChange = () => {
5163
- B == null || B();
5212
+ z == null || z();
5164
5213
  const H = "change", se = xe($);
5165
- T && T(H, se), F.emit("change", H, se);
5166
- }, F.close = () => {
5167
- s.onChange = B;
5168
- }, F;
5214
+ _ && _(H, se), A.emit("change", H, se);
5215
+ }, A.close = () => {
5216
+ s.onChange = z;
5217
+ }, A;
5169
5218
  }
5170
5219
  return {
5171
5220
  // Sync
@@ -5186,13 +5235,13 @@ function Ht(s, e) {
5186
5235
  accessSync: S,
5187
5236
  realpathSync: j,
5188
5237
  truncateSync: v,
5189
- openSync: x,
5238
+ openSync: E,
5190
5239
  closeSync: y,
5191
- readSync: E,
5240
+ readSync: x,
5192
5241
  writeSync: R,
5193
5242
  fstatSync: O,
5194
5243
  ftruncateSync: Z,
5195
- fsyncSync: z,
5244
+ fsyncSync: B,
5196
5245
  fdatasyncSync: pe,
5197
5246
  symlinkSync: X,
5198
5247
  linkSync: le,
@@ -5240,19 +5289,19 @@ function Ht(s, e) {
5240
5289
  chown: async (p, u, w) => {
5241
5290
  },
5242
5291
  open: async (p, u, w) => {
5243
- const $ = x(p, u);
5292
+ const $ = E(p, u);
5244
5293
  return {
5245
5294
  fd: $,
5246
5295
  close: async () => y($),
5247
- read: async (T, F, B, H) => ({
5248
- bytesRead: E($, T, F, B, H),
5249
- buffer: T
5296
+ read: async (_, A, z, H) => ({
5297
+ bytesRead: x($, _, A, z, H),
5298
+ buffer: _
5250
5299
  }),
5251
- write: async (T) => ({
5252
- bytesWritten: R($, T)
5300
+ write: async (_) => ({
5301
+ bytesWritten: R($, _)
5253
5302
  }),
5254
5303
  stat: async () => O($),
5255
- truncate: async (T) => Z($, T)
5304
+ truncate: async (_) => Z($, _)
5256
5305
  };
5257
5306
  },
5258
5307
  rm: async (p, u) => {
@@ -5260,7 +5309,7 @@ function Ht(s, e) {
5260
5309
  try {
5261
5310
  s.stat(w).type === "directory" ? u != null && u.recursive ? s.rmdirRecursive(w) : s.rmdir(w) : s.unlink(w);
5262
5311
  } catch ($) {
5263
- if (u != null && u.force && $ instanceof _ && $.code === "ENOENT") return;
5312
+ if (u != null && u.force && $ instanceof T && $.code === "ENOENT") return;
5264
5313
  throw $;
5265
5314
  }
5266
5315
  }
@@ -5378,7 +5427,7 @@ class kt extends Error {
5378
5427
  this.name = "ProcessExitError", this.exitCode = t;
5379
5428
  }
5380
5429
  }
5381
- function Be(s) {
5430
+ function ze(s) {
5382
5431
  const e = Date.now();
5383
5432
  return {
5384
5433
  argv: ["/usr/bin/node", ...s.argv],
@@ -5681,7 +5730,7 @@ class M extends Uint8Array {
5681
5730
  }
5682
5731
  function K(s, ...e) {
5683
5732
  if (typeof s != "string")
5684
- return [s, ...e].map((n) => Ae(n)).join(" ");
5733
+ return [s, ...e].map((n) => Fe(n)).join(" ");
5685
5734
  let t = 0, r = s.replace(/%([sdjoO%])/g, (n, i) => {
5686
5735
  if (i === "%") return "%";
5687
5736
  if (t >= e.length) return n;
@@ -5699,16 +5748,16 @@ function K(s, ...e) {
5699
5748
  }
5700
5749
  case "o":
5701
5750
  case "O":
5702
- return Ae(o);
5751
+ return Fe(o);
5703
5752
  default:
5704
5753
  return n;
5705
5754
  }
5706
5755
  });
5707
5756
  for (; t < e.length; )
5708
- r += " " + Ae(e[t++]);
5757
+ r += " " + Fe(e[t++]);
5709
5758
  return r;
5710
5759
  }
5711
- function Ae(s, e) {
5760
+ function Fe(s, e) {
5712
5761
  const t = (e == null ? void 0 : e.depth) ?? 2;
5713
5762
  return gt(s, t);
5714
5763
  }
@@ -5755,13 +5804,13 @@ function yr() {
5755
5804
  isArray: Array.isArray
5756
5805
  };
5757
5806
  }
5758
- const Yn = { format: K, inspect: Ae, promisify: mr, inherits: gr, deprecate: wr, types: yr }, Xn = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
5807
+ const Yn = { format: K, inspect: Fe, promisify: mr, inherits: gr, deprecate: wr, types: yr }, Xn = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
5759
5808
  __proto__: null,
5760
5809
  default: Yn,
5761
5810
  deprecate: wr,
5762
5811
  format: K,
5763
5812
  inherits: gr,
5764
- inspect: Ae,
5813
+ inspect: Fe,
5765
5814
  promisify: mr,
5766
5815
  types: yr
5767
5816
  }, Symbol.toStringTag, { value: "Module" }));
@@ -6052,10 +6101,10 @@ function Rr(s) {
6052
6101
  const e = M.alloc(s);
6053
6102
  return crypto.getRandomValues(e), e;
6054
6103
  }
6055
- function Tr() {
6104
+ function _r() {
6056
6105
  return crypto.randomUUID();
6057
6106
  }
6058
- function _r(s) {
6107
+ function Tr(s) {
6059
6108
  const t = {
6060
6109
  sha1: "SHA-1",
6061
6110
  "sha-1": "SHA-1",
@@ -6090,13 +6139,13 @@ function Pr(s, e) {
6090
6139
  const t = e - s, r = new Uint32Array(1);
6091
6140
  return crypto.getRandomValues(r), s + r[0] % t;
6092
6141
  }
6093
- const ii = { randomBytes: Rr, randomUUID: Tr, createHash: _r, randomInt: Pr }, oi = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
6142
+ const ii = { randomBytes: Rr, randomUUID: _r, createHash: Tr, randomInt: Pr }, oi = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
6094
6143
  __proto__: null,
6095
- createHash: _r,
6144
+ createHash: Tr,
6096
6145
  default: ii,
6097
6146
  randomBytes: Rr,
6098
6147
  randomInt: Pr,
6099
- randomUUID: Tr
6148
+ randomUUID: _r
6100
6149
  }, Symbol.toStringTag, { value: "Module" }));
6101
6150
  async function ai(s, e, t) {
6102
6151
  const r = t === "compress" ? new CompressionStream(e) : new DecompressionStream(e), n = r.writable.getWriter();
@@ -6121,8 +6170,8 @@ function we(s, e) {
6121
6170
  ai(a, s, e).then((c) => i(null, c)).catch((c) => i(c instanceof Error ? c : new Error(String(c))));
6122
6171
  };
6123
6172
  }
6124
- const Ir = we("gzip", "compress"), Nr = we("gzip", "decompress"), Ar = we("deflate", "compress"), Fr = we("deflate", "decompress"), jr = we("deflate-raw", "compress"), Or = we("deflate-raw", "decompress"), Br = we("gzip", "decompress");
6125
- function zr() {
6173
+ const Ir = we("gzip", "compress"), Nr = we("gzip", "decompress"), Fr = we("deflate", "compress"), Ar = we("deflate", "decompress"), jr = we("deflate-raw", "compress"), Or = we("deflate-raw", "decompress"), zr = we("gzip", "decompress");
6174
+ function Br() {
6126
6175
  throw new Error("zlib sync operations are not supported in Lifo");
6127
6176
  }
6128
6177
  function Mr() {
@@ -6155,12 +6204,12 @@ const Ur = {
6155
6204
  }, ci = {
6156
6205
  gzip: Ir,
6157
6206
  gunzip: Nr,
6158
- deflate: Ar,
6159
- inflate: Fr,
6207
+ deflate: Fr,
6208
+ inflate: Ar,
6160
6209
  deflateRaw: jr,
6161
6210
  inflateRaw: Or,
6162
- unzip: Br,
6163
- gzipSync: zr,
6211
+ unzip: zr,
6212
+ gzipSync: Br,
6164
6213
  gunzipSync: Mr,
6165
6214
  deflateSync: Dr,
6166
6215
  inflateSync: Wr,
@@ -6169,17 +6218,17 @@ const Ur = {
6169
6218
  __proto__: null,
6170
6219
  constants: Ur,
6171
6220
  default: ci,
6172
- deflate: Ar,
6221
+ deflate: Fr,
6173
6222
  deflateRaw: jr,
6174
6223
  deflateSync: Dr,
6175
6224
  gunzip: Nr,
6176
6225
  gunzipSync: Mr,
6177
6226
  gzip: Ir,
6178
- gzipSync: zr,
6179
- inflate: Fr,
6227
+ gzipSync: Br,
6228
+ inflate: Ar,
6180
6229
  inflateRaw: Or,
6181
6230
  inflateSync: Wr,
6182
- unzip: Br
6231
+ unzip: zr
6183
6232
  }, Symbol.toStringTag, { value: "Module" }));
6184
6233
  class qr {
6185
6234
  constructor(e) {
@@ -6211,7 +6260,7 @@ function wt(s) {
6211
6260
  "fs/promises": () => Ht(s.vfs, s.cwd).promises,
6212
6261
  path: () => Gn,
6213
6262
  os: () => Zn(s.env),
6214
- process: () => Be({
6263
+ process: () => ze({
6215
6264
  argv: s.argv,
6216
6265
  env: s.env,
6217
6266
  cwd: s.cwd,
@@ -6377,11 +6426,11 @@ function Hr(s) {
6377
6426
  const v = D(e.cwd, e.args[0]);
6378
6427
  try {
6379
6428
  t = e.vfs.readFileString(v);
6380
- } catch (x) {
6381
- if (x instanceof _)
6382
- return e.stderr.write(`node: ${e.args[0]}: ${x.message}
6429
+ } catch (E) {
6430
+ if (E instanceof T)
6431
+ return e.stderr.write(`node: ${e.args[0]}: ${E.message}
6383
6432
  `), 1;
6384
- throw x;
6433
+ throw E;
6385
6434
  }
6386
6435
  r = v, n = e.args.slice(1);
6387
6436
  } else
@@ -6408,8 +6457,8 @@ function Hr(s) {
6408
6457
  if (v.startsWith("./") || v.startsWith("../") || v.startsWith("/")) {
6409
6458
  const y = d(v, i);
6410
6459
  if (y) {
6411
- const E = c.get(y.path);
6412
- if (E) return E;
6460
+ const x = c.get(y.path);
6461
+ if (x) return x;
6413
6462
  if (y.path.endsWith(".json")) {
6414
6463
  const O = e.vfs.readFileString(y.path), Z = JSON.parse(O);
6415
6464
  return c.set(y.path, Z), Z;
@@ -6419,21 +6468,21 @@ function Hr(s) {
6419
6468
  }
6420
6469
  throw new Error(`Cannot find module '${v}'`);
6421
6470
  }
6422
- const x = h(v, i);
6423
- if (x) {
6424
- const y = c.get(x.path);
6471
+ const E = h(v, i);
6472
+ if (E) {
6473
+ const y = c.get(E.path);
6425
6474
  if (y) return y;
6426
- if (x.path.endsWith(".json")) {
6427
- const R = e.vfs.readFileString(x.path), O = JSON.parse(R);
6428
- return c.set(x.path, O), O;
6475
+ if (E.path.endsWith(".json")) {
6476
+ const R = e.vfs.readFileString(E.path), O = JSON.parse(R);
6477
+ return c.set(E.path, O), O;
6429
6478
  }
6430
- const E = e.vfs.readFileString(x.path);
6431
- return g(E, x.path, x.path);
6479
+ const x = e.vfs.readFileString(E.path);
6480
+ return g(x, E.path, E.path);
6432
6481
  }
6433
6482
  throw new Error(`Cannot find module '${v}'`);
6434
6483
  }
6435
- function d(v, x) {
6436
- const y = D(x, v);
6484
+ function d(v, E) {
6485
+ const y = D(E, v);
6437
6486
  if (e.vfs.exists(y))
6438
6487
  try {
6439
6488
  if (e.vfs.stat(y).type === "file") return { path: y };
@@ -6443,21 +6492,21 @@ function Hr(s) {
6443
6492
  }
6444
6493
  return !je(y) && e.vfs.exists(y + ".js") ? { path: y + ".js" } : !je(y) && e.vfs.exists(y + ".json") ? { path: y + ".json" } : null;
6445
6494
  }
6446
- function h(v, x) {
6447
- let y, E = null;
6495
+ function h(v, E) {
6496
+ let y, x = null;
6448
6497
  if (v.startsWith("@")) {
6449
- const z = v.split("/");
6450
- if (z.length < 2) return null;
6451
- y = z[0] + "/" + z[1], z.length > 2 && (E = z.slice(2).join("/"));
6498
+ const B = v.split("/");
6499
+ if (B.length < 2) return null;
6500
+ y = B[0] + "/" + B[1], B.length > 2 && (x = B.slice(2).join("/"));
6452
6501
  } else {
6453
- const z = v.indexOf("/");
6454
- z !== -1 ? (y = v.slice(0, z), E = v.slice(z + 1)) : y = v;
6502
+ const B = v.indexOf("/");
6503
+ B !== -1 ? (y = v.slice(0, B), x = v.slice(B + 1)) : y = v;
6455
6504
  }
6456
- let R = x;
6505
+ let R = E;
6457
6506
  for (; ; ) {
6458
- const z = C(R, "node_modules", y);
6459
- if (e.vfs.exists(z)) {
6460
- const X = f(z, E);
6507
+ const B = C(R, "node_modules", y);
6508
+ if (e.vfs.exists(B)) {
6509
+ const X = f(B, x);
6461
6510
  if (X) return X;
6462
6511
  }
6463
6512
  const pe = te(R);
@@ -6466,19 +6515,19 @@ function Hr(s) {
6466
6515
  }
6467
6516
  const O = C("/usr/lib/node_modules", y);
6468
6517
  if (e.vfs.exists(O)) {
6469
- const z = f(O, E);
6470
- if (z) return z;
6518
+ const B = f(O, x);
6519
+ if (B) return B;
6471
6520
  }
6472
6521
  const Z = C("/usr/share/pkg/node_modules", y);
6473
6522
  if (e.vfs.exists(Z)) {
6474
- const z = f(Z, E);
6475
- if (z) return z;
6523
+ const B = f(Z, x);
6524
+ if (B) return B;
6476
6525
  }
6477
6526
  return null;
6478
6527
  }
6479
- function f(v, x) {
6480
- if (x)
6481
- return d("./" + x, v);
6528
+ function f(v, E) {
6529
+ if (E)
6530
+ return d("./" + E, v);
6482
6531
  const y = C(v, "package.json");
6483
6532
  if (e.vfs.exists(y))
6484
6533
  try {
@@ -6489,13 +6538,13 @@ function Hr(s) {
6489
6538
  }
6490
6539
  } catch {
6491
6540
  }
6492
- const E = C(v, "index.js");
6493
- return e.vfs.exists(E) ? { path: E } : null;
6541
+ const x = C(v, "index.js");
6542
+ return e.vfs.exists(x) ? { path: x } : null;
6494
6543
  }
6495
- function g(v, x, y) {
6496
- const E = te(x), R = { exports: {} }, O = R.exports;
6544
+ function g(v, E, y) {
6545
+ const x = te(E), R = { exports: {} }, O = R.exports;
6497
6546
  y && c.set(y, O);
6498
- const Z = { ...o }, z = wt(Z), pe = Be({
6547
+ const Z = { ...o }, B = wt(Z), pe = ze({
6499
6548
  argv: o.argv,
6500
6549
  env: o.env,
6501
6550
  cwd: o.cwd,
@@ -6503,14 +6552,14 @@ function Hr(s) {
6503
6552
  stderr: e.stderr
6504
6553
  }), X = Ze(e.stdout, e.stderr);
6505
6554
  function le(V) {
6506
- if (z[V]) {
6555
+ if (B[V]) {
6507
6556
  const G = c.get(V);
6508
6557
  if (G) return G;
6509
- const ae = z[V]();
6558
+ const ae = B[V]();
6510
6559
  return c.set(V, ae), ae;
6511
6560
  }
6512
6561
  if (V.startsWith("./") || V.startsWith("../") || V.startsWith("/")) {
6513
- const G = d(V, E);
6562
+ const G = d(V, x);
6514
6563
  if (G) {
6515
6564
  const ae = c.get(G.path);
6516
6565
  if (ae) return ae;
@@ -6523,7 +6572,7 @@ function Hr(s) {
6523
6572
  }
6524
6573
  throw new Error(`Cannot find module '${V}'`);
6525
6574
  }
6526
- const re = h(V, E);
6575
+ const re = h(V, x);
6527
6576
  if (re) {
6528
6577
  const G = c.get(re.path);
6529
6578
  if (G) return G;
@@ -6543,8 +6592,8 @@ ${Jt(v)}
6543
6592
  O,
6544
6593
  le,
6545
6594
  R,
6546
- x,
6547
6595
  E,
6596
+ x,
6548
6597
  X,
6549
6598
  pe,
6550
6599
  M,
@@ -6555,7 +6604,7 @@ ${Jt(v)}
6555
6604
  Le
6556
6605
  ), y && R.exports !== O && c.set(y, R.exports), R.exports;
6557
6606
  }
6558
- const N = Be({
6607
+ const N = ze({
6559
6608
  argv: o.argv,
6560
6609
  env: o.env,
6561
6610
  cwd: o.cwd,
@@ -6580,10 +6629,10 @@ ${Jt(t)}
6580
6629
  globalThis.clearInterval,
6581
6630
  I
6582
6631
  );
6583
- const x = c.get("http"), y = x == null ? void 0 : x[br];
6632
+ const E = c.get("http"), y = E == null ? void 0 : E[br];
6584
6633
  if (y && y.length > 0) {
6585
- const E = y.map((R) => R.getPromise()).filter((R) => R !== null);
6586
- if (E.length > 0) {
6634
+ const x = y.map((R) => R.getPromise()).filter((R) => R !== null);
6635
+ if (x.length > 0) {
6587
6636
  const R = new Promise((O) => {
6588
6637
  if (e.signal.aborted) {
6589
6638
  O();
@@ -6592,7 +6641,7 @@ ${Jt(t)}
6592
6641
  e.signal.addEventListener("abort", () => O(), { once: !0 });
6593
6642
  });
6594
6643
  if (await Promise.race([
6595
- Promise.all(E),
6644
+ Promise.all(x),
6596
6645
  R
6597
6646
  ]), e.signal.aborted)
6598
6647
  for (const O of [...y])
@@ -6918,7 +6967,7 @@ function No(s, e, t) {
6918
6967
  }
6919
6968
  return r;
6920
6969
  }
6921
- const Ee = "/usr/lib/node_modules", ze = "/usr/bin", bi = "https://registry.npmjs.org", $i = "10.0.0";
6970
+ const Ee = "/usr/lib/node_modules", Be = "/usr/bin", bi = "https://registry.npmjs.org", $i = "10.0.0";
6922
6971
  function et(s) {
6923
6972
  return s.NPM_REGISTRY || bi;
6924
6973
  }
@@ -7064,11 +7113,11 @@ async function Je(s, e, t, r, n, i, o, a, c, l, d) {
7064
7113
  const L = D(h, P);
7065
7114
  Ci(l, k, L);
7066
7115
  try {
7067
- r.mkdir(ze, { recursive: !0 });
7116
+ r.mkdir(Be, { recursive: !0 });
7068
7117
  } catch {
7069
7118
  }
7070
7119
  r.writeFile(
7071
- C(ze, k),
7120
+ C(Be, k),
7072
7121
  `#!/usr/bin/env node
7073
7122
  require('${L}');
7074
7123
  `
@@ -7133,7 +7182,7 @@ async function Ri(s) {
7133
7182
  `), s.stdout.write(JSON.stringify(r, null, 2) + `
7134
7183
  `), 0;
7135
7184
  }
7136
- async function Ti(s, e) {
7185
+ async function _i(s, e) {
7137
7186
  const t = s.args.slice(1);
7138
7187
  let r = !1, n = !1;
7139
7188
  const i = [];
@@ -7148,7 +7197,7 @@ async function Ti(s, e) {
7148
7197
  } catch {
7149
7198
  }
7150
7199
  try {
7151
- s.vfs.mkdir(ze, { recursive: !0 });
7200
+ s.vfs.mkdir(Be, { recursive: !0 });
7152
7201
  } catch {
7153
7202
  }
7154
7203
  }
@@ -7231,7 +7280,7 @@ async function Ti(s, e) {
7231
7280
  added ${c} package${c !== 1 ? "s" : ""} in ${d}s
7232
7281
  `), 0;
7233
7282
  }
7234
- async function _i(s, e) {
7283
+ async function Ti(s, e) {
7235
7284
  const t = s.args.slice(1);
7236
7285
  let r = !1;
7237
7286
  const n = [];
@@ -7253,7 +7302,7 @@ async function _i(s, e) {
7253
7302
  const c = JSON.parse(s.vfs.readFileString(C(a, "package.json")));
7254
7303
  for (const l of Object.keys(Lt(c)))
7255
7304
  try {
7256
- s.vfs.unlink(C(ze, l));
7305
+ s.vfs.unlink(C(Be, l));
7257
7306
  } catch {
7258
7307
  }
7259
7308
  } catch {
@@ -7416,7 +7465,7 @@ async function Ni(s) {
7416
7465
  }
7417
7466
  return 0;
7418
7467
  }
7419
- function Ai(s, e) {
7468
+ function Fi(s, e) {
7420
7469
  return async (t) => {
7421
7470
  const r = t.args[0];
7422
7471
  if (!r || r === "--help" || r === "-h")
@@ -7427,12 +7476,12 @@ function Ai(s, e) {
7427
7476
  case "install":
7428
7477
  case "i":
7429
7478
  case "add":
7430
- return Ti(t, s);
7479
+ return _i(t, s);
7431
7480
  case "uninstall":
7432
7481
  case "remove":
7433
7482
  case "rm":
7434
7483
  case "un":
7435
- return _i(t);
7484
+ return Ti(t);
7436
7485
  case "list":
7437
7486
  case "ls":
7438
7487
  return Pi(t);
@@ -7460,14 +7509,14 @@ function Ai(s, e) {
7460
7509
  }
7461
7510
  };
7462
7511
  }
7463
- async function Fi(s, e, t) {
7512
+ async function Ai(s, e, t) {
7464
7513
  const r = et(e.env), n = Date.now(), i = /* @__PURE__ */ new Set();
7465
7514
  try {
7466
7515
  e.vfs.mkdir(Ee, { recursive: !0 });
7467
7516
  } catch {
7468
7517
  }
7469
7518
  try {
7470
- e.vfs.mkdir(ze, { recursive: !0 });
7519
+ e.vfs.mkdir(Be, { recursive: !0 });
7471
7520
  } catch {
7472
7521
  }
7473
7522
  try {
@@ -7535,10 +7584,10 @@ function Kt(s) {
7535
7584
  }
7536
7585
  return s;
7537
7586
  }
7538
- function Bi(s) {
7587
+ function zi(s) {
7539
7588
  return /(?:^|\n)\s*(?:import\s|export\s)/m.test(s);
7540
7589
  }
7541
- function zi(s, e) {
7590
+ function Bi(s, e) {
7542
7591
  let t = s.replace(
7543
7592
  /(from\s+)(["'])([^"'./][^"']*)\2/g,
7544
7593
  (r, n, i, o) => `${n}${i}${e}/${o}${i}`
@@ -7551,12 +7600,12 @@ function zi(s, e) {
7551
7600
  function tt(s, e) {
7552
7601
  return async (t) => {
7553
7602
  const r = e.readFileString(s), n = Oi(t);
7554
- return Bi(r) ? Di(r, t, n) : Wi(r, s, e, t, n);
7603
+ return zi(r) ? Di(r, t, n) : Wi(r, s, e, t, n);
7555
7604
  };
7556
7605
  }
7557
- const Fe = globalThis;
7606
+ const Ae = globalThis;
7558
7607
  var tr, rr, sr;
7559
- const yt = typeof Fe.process < "u" && typeof ((tr = Fe.process) == null ? void 0 : tr.versions) < "u" && typeof ((sr = (rr = Fe.process) == null ? void 0 : rr.versions) == null ? void 0 : sr.node) == "string";
7608
+ const yt = typeof Ae.process < "u" && typeof ((tr = Ae.process) == null ? void 0 : tr.versions) < "u" && typeof ((sr = (rr = Ae.process) == null ? void 0 : rr.versions) == null ? void 0 : sr.node) == "string";
7560
7609
  let er = !1;
7561
7610
  async function Mi() {
7562
7611
  if (!(er || !yt))
@@ -7586,17 +7635,17 @@ async function Mi() {
7586
7635
  " return nextLoad(url, context);",
7587
7636
  "}"
7588
7637
  ].join(`
7589
- `), n = Fe.Buffer.from(t, "utf-8").toString("base64");
7638
+ `), n = Ae.Buffer.from(t, "utf-8").toString("base64");
7590
7639
  e.register(`data:text/javascript;base64,${n}`), er = !0;
7591
7640
  } catch {
7592
7641
  }
7593
7642
  }
7594
7643
  async function Di(s, e, t) {
7595
- const r = ss(e.env), n = zi(s, r);
7644
+ const r = ss(e.env), n = Bi(s, r);
7596
7645
  yt && await Mi();
7597
7646
  let i, o = !1;
7598
7647
  if (yt)
7599
- i = `data:text/javascript;base64,${typeof btoa == "function" ? btoa(unescape(encodeURIComponent(n))) : Fe.Buffer.from(n, "utf-8").toString("base64")}`;
7648
+ i = `data:text/javascript;base64,${typeof btoa == "function" ? btoa(unescape(encodeURIComponent(n))) : Ae.Buffer.from(n, "utf-8").toString("base64")}`;
7600
7649
  else {
7601
7650
  const a = new Blob([n], { type: "application/javascript" });
7602
7651
  i = URL.createObjectURL(a), o = !0;
@@ -7636,19 +7685,19 @@ function Wi(s, e, t, r, n) {
7636
7685
  return c.set(S, v), v;
7637
7686
  }
7638
7687
  if (S.startsWith("./") || S.startsWith("../") || S.startsWith("/")) {
7639
- const v = D(i, S), x = [v, v + ".js", v + ".json"];
7640
- for (const E of x)
7641
- if (t.exists(E)) {
7642
- if (E.endsWith(".json")) {
7643
- const Z = JSON.parse(t.readFileString(E));
7688
+ const v = D(i, S), E = [v, v + ".js", v + ".json"];
7689
+ for (const x of E)
7690
+ if (t.exists(x)) {
7691
+ if (x.endsWith(".json")) {
7692
+ const Z = JSON.parse(t.readFileString(x));
7644
7693
  return c.set(S, Z), Z;
7645
7694
  }
7646
- const R = t.readFileString(E), O = f(R, E);
7695
+ const R = t.readFileString(x), O = f(R, x);
7647
7696
  return c.set(S, O), O;
7648
7697
  }
7649
7698
  const y = C(v, "index.js");
7650
7699
  if (t.exists(y)) {
7651
- const E = t.readFileString(y), R = f(E, y);
7700
+ const x = t.readFileString(y), R = f(x, y);
7652
7701
  return c.set(S, R), R;
7653
7702
  }
7654
7703
  throw new Error(`Cannot find module '${S}'`);
@@ -7660,34 +7709,34 @@ function Wi(s, e, t, r, n) {
7660
7709
  const y = JSON.parse(t.readFileString(j));
7661
7710
  return c.set(j, y), y;
7662
7711
  }
7663
- const v = t.readFileString(j), x = f(v, j);
7664
- return c.set(j, x), x;
7712
+ const v = t.readFileString(j), E = f(v, j);
7713
+ return c.set(j, E), E;
7665
7714
  }
7666
7715
  throw new Error(`Cannot find module '${S}'`);
7667
7716
  }
7668
7717
  function d(S, j) {
7669
- let v, x = null;
7718
+ let v, E = null;
7670
7719
  if (S.startsWith("@")) {
7671
- const E = S.split("/");
7672
- if (E.length < 2) return null;
7673
- v = E[0] + "/" + E[1], E.length > 2 && (x = E.slice(2).join("/"));
7720
+ const x = S.split("/");
7721
+ if (x.length < 2) return null;
7722
+ v = x[0] + "/" + x[1], x.length > 2 && (E = x.slice(2).join("/"));
7674
7723
  } else {
7675
- const E = S.indexOf("/");
7676
- E !== -1 ? (v = S.slice(0, E), x = S.slice(E + 1)) : v = S;
7724
+ const x = S.indexOf("/");
7725
+ x !== -1 ? (v = S.slice(0, x), E = S.slice(x + 1)) : v = S;
7677
7726
  }
7678
7727
  let y = j;
7679
7728
  for (; ; ) {
7680
- const E = C(y, "node_modules", v);
7681
- if (t.exists(E))
7682
- return h(E, x);
7729
+ const x = C(y, "node_modules", v);
7730
+ if (t.exists(x))
7731
+ return h(x, E);
7683
7732
  const R = te(y);
7684
7733
  if (R === y) break;
7685
7734
  y = R;
7686
7735
  }
7687
- for (const E of ["/usr/lib/node_modules", "/usr/share/pkg/node_modules"]) {
7688
- const R = C(E, v);
7736
+ for (const x of ["/usr/lib/node_modules", "/usr/share/pkg/node_modules"]) {
7737
+ const R = C(x, v);
7689
7738
  if (t.exists(R))
7690
- return h(R, x);
7739
+ return h(R, E);
7691
7740
  }
7692
7741
  return null;
7693
7742
  }
@@ -7696,25 +7745,25 @@ function Wi(s, e, t, r, n) {
7696
7745
  const y = D(S, j);
7697
7746
  for (const R of [y, y + ".js", y + ".json"])
7698
7747
  if (t.exists(R)) return R;
7699
- const E = C(y, "index.js");
7700
- return t.exists(E) ? E : null;
7748
+ const x = C(y, "index.js");
7749
+ return t.exists(x) ? x : null;
7701
7750
  }
7702
7751
  const v = C(S, "package.json");
7703
7752
  if (t.exists(v))
7704
7753
  try {
7705
7754
  const y = JSON.parse(t.readFileString(v));
7706
7755
  if (y.main) {
7707
- const E = D(S, y.main);
7708
- for (const R of [E, E + ".js"])
7756
+ const x = D(S, y.main);
7757
+ for (const R of [x, x + ".js"])
7709
7758
  if (t.exists(R)) return R;
7710
7759
  }
7711
7760
  } catch {
7712
7761
  }
7713
- const x = C(S, "index.js");
7714
- return t.exists(x) ? x : null;
7762
+ const E = C(S, "index.js");
7763
+ return t.exists(E) ? E : null;
7715
7764
  }
7716
7765
  function f(S, j) {
7717
- const v = te(j), x = { exports: {} }, y = x.exports, E = Be({
7766
+ const v = te(j), E = { exports: {} }, y = E.exports, x = ze({
7718
7767
  argv: o.argv,
7719
7768
  env: o.env,
7720
7769
  cwd: o.cwd,
@@ -7744,26 +7793,26 @@ function Wi(s, e, t, r, n) {
7744
7793
  }
7745
7794
  return l(X);
7746
7795
  }
7747
- const z = `(function(exports,require,module,__filename,__dirname,console,process,Buffer,setTimeout,setInterval,clearTimeout,clearInterval,global){
7796
+ const B = `(function(exports,require,module,__filename,__dirname,console,process,Buffer,setTimeout,setInterval,clearTimeout,clearInterval,global){
7748
7797
  ${Kt(S)}
7749
7798
  })`;
7750
- return new Function("return " + z)()(
7799
+ return new Function("return " + B)()(
7751
7800
  y,
7752
7801
  O,
7753
- x,
7802
+ E,
7754
7803
  j,
7755
7804
  v,
7756
7805
  R,
7757
- E,
7806
+ x,
7758
7807
  M,
7759
7808
  globalThis.setTimeout,
7760
7809
  globalThis.setInterval,
7761
7810
  globalThis.clearTimeout,
7762
7811
  globalThis.clearInterval,
7763
7812
  {}
7764
- ), x.exports !== y ? x.exports : y;
7813
+ ), E.exports !== y ? E.exports : y;
7765
7814
  }
7766
- const g = Be({
7815
+ const g = ze({
7767
7816
  argv: o.argv,
7768
7817
  env: o.env,
7769
7818
  cwd: o.cwd,
@@ -7887,7 +7936,7 @@ async function Gi(s, e) {
7887
7936
  const r = t.startsWith("lifo-pkg-") ? t : `lifo-pkg-${t}`;
7888
7937
  s.stdout.write(`Installing ${r} globally...
7889
7938
  `);
7890
- const n = await Fi(r, s, e);
7939
+ const n = await Ai(r, s, e);
7891
7940
  if (n !== 0) return n;
7892
7941
  const i = C(ie, r), o = Ce(s.vfs, i);
7893
7942
  if (o)
@@ -8386,15 +8435,15 @@ class os {
8386
8435
  `).replace(/\n/g, `\r
8387
8436
  `));
8388
8437
  } else e != null && e.terminal && typeof e.terminal == "object" ? (o = e.terminal, a = !0) : o = new so();
8389
- const c = new _n(o, t.vfs, r, i), l = c.getJobTable();
8390
- r.register("ps", Nn(l)), r.register("top", An(l)), r.register("kill", jn(l)), r.register("watch", On(r)), r.register("help", Mn()), r.register("node", Vr(t.portRegistry)), r.register("curl", Jr(t.portRegistry));
8438
+ const c = new Tn(o, t.vfs, r, i), l = c.getJobTable();
8439
+ r.register("ps", Nn(l)), r.register("top", Fn(l)), r.register("kill", jn(l)), r.register("watch", On(r)), r.register("help", Mn()), r.register("node", Vr(t.portRegistry)), r.register("curl", Jr(t.portRegistry));
8391
8440
  const d = async (k, P) => (await c.execute(k, {
8392
8441
  cwd: P.cwd,
8393
8442
  env: P.env,
8394
8443
  onStdout: (I) => P.stdout.write(I),
8395
8444
  onStderr: (I) => P.stderr.write(I)
8396
8445
  })).exitCode;
8397
- r.register("npm", Ai(r, d)), r.register("lifo", eo(r)), await c.sourceFile("/etc/profile"), await c.sourceFile(i.HOME + "/.bashrc"), e != null && e.cwd && c.setCwd(e.cwd), a && (c.start(), o.focus());
8446
+ r.register("npm", Fi(r, d)), r.register("lifo", eo(r)), await c.sourceFile("/etc/profile"), await c.sourceFile(i.HOME + "/.bashrc"), e != null && e.cwd && c.setCwd(e.cwd), a && (c.start(), o.focus());
8398
8447
  const h = () => c.getCwd(), f = new vt(t.vfs, h), g = new ro(c, r), N = new os(t, c, g, f, i);
8399
8448
  if (e != null && e.mounts)
8400
8449
  for (const k of e.mounts)
@@ -8493,13 +8542,25 @@ function io(s, e) {
8493
8542
  for (const n of t)
8494
8543
  r += "/" + n, s.exists(r) || s.mkdir(r, { recursive: !0 });
8495
8544
  }
8545
+ function Fo(s, e) {
8546
+ return async (t) => {
8547
+ try {
8548
+ s(), t.env.LIFO_TOKEN = "", t.stdout.write(`Logged out.
8549
+ `), e();
8550
+ } catch {
8551
+ t.stdout.write(`Not logged in.
8552
+ `);
8553
+ }
8554
+ return 0;
8555
+ };
8556
+ }
8496
8557
  export {
8497
- To as $,
8558
+ _o as $,
8498
8559
  uo as A,
8499
8560
  Ie as B,
8500
8561
  Rt as C,
8501
8562
  Js as D,
8502
- A as E,
8563
+ F as E,
8503
8564
  Ws as F,
8504
8565
  dt as G,
8505
8566
  so as H,
@@ -8515,10 +8576,10 @@ export {
8515
8576
  ee as R,
8516
8577
  Ys as S,
8517
8578
  os as T,
8518
- _n as U,
8519
- _ as V,
8579
+ Tn as U,
8580
+ T as V,
8520
8581
  mo as W,
8521
- _s as X,
8582
+ Ts as X,
8522
8583
  go as Y,
8523
8584
  Xs as Z,
8524
8585
  Co as _,
@@ -8530,26 +8591,27 @@ export {
8530
8591
  jn as a4,
8531
8592
  tt as a5,
8532
8593
  eo as a6,
8533
- wt as a7,
8534
- Vr as a8,
8535
- Ai as a9,
8536
- Nn as aa,
8537
- An as ab,
8538
- On as ac,
8539
- Ro as ad,
8540
- _o as ae,
8541
- ks as af,
8542
- Eo as ag,
8543
- bt as ah,
8544
- C as ai,
8545
- Ui as aj,
8546
- Hi as ak,
8547
- Lo as al,
8548
- fe as am,
8549
- Ce as an,
8550
- ko as ao,
8551
- qi as ap,
8552
- xo as aq,
8594
+ Fo as a7,
8595
+ wt as a8,
8596
+ Vr as a9,
8597
+ Fi as aa,
8598
+ Nn as ab,
8599
+ Fn as ac,
8600
+ On as ad,
8601
+ Ro as ae,
8602
+ To as af,
8603
+ ks as ag,
8604
+ Eo as ah,
8605
+ bt as ai,
8606
+ C as aj,
8607
+ Ui as ak,
8608
+ Hi as al,
8609
+ Lo as am,
8610
+ fe as an,
8611
+ Ce as ao,
8612
+ ko as ap,
8613
+ qi as aq,
8614
+ xo as ar,
8553
8615
  xe as b,
8554
8616
  Ss as c,
8555
8617
  No as d,
@@ -8574,5 +8636,5 @@ export {
8574
8636
  Rs as w,
8575
8637
  Ks as x,
8576
8638
  Pn as y,
8577
- Ts as z
8639
+ _s as z
8578
8640
  };