@dotdirfm/ui 0.1.5 → 0.1.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/dotdir.mjs CHANGED
@@ -3006,18 +3006,6 @@ function _t() {
3006
3006
  n.preventDefault(), n.stopPropagation(), t((e) => !e);
3007
3007
  return;
3008
3008
  }
3009
- if (!e) {
3010
- if (n.target.closest(`.${U["terminal-container"]}`)) {
3011
- let e = n.metaKey || n.ctrlKey, t = e && [
3012
- "c",
3013
- "d",
3014
- "z",
3015
- "v"
3016
- ].includes(n.key.toLowerCase());
3017
- if (!e || t) return;
3018
- }
3019
- H.handleKeyboardEvent(n);
3020
- }
3021
3009
  };
3022
3010
  return window.addEventListener("keydown", n, !0), () => window.removeEventListener("keydown", n, !0);
3023
3011
  }, [e]), {
@@ -3309,18 +3297,27 @@ function zt() {
3309
3297
  It.clear();
3310
3298
  }
3311
3299
  //#endregion
3312
- //#region lib/styleHost.ts
3300
+ //#region lib/fileListHandlers.ts
3313
3301
  var Bt = null;
3314
3302
  function Vt(e) {
3315
3303
  Bt = e;
3316
3304
  }
3317
- function Ht() {
3318
- return Bt ?? document.documentElement;
3305
+ function J() {
3306
+ return Bt;
3319
3307
  }
3308
+ //#endregion
3309
+ //#region lib/styleHost.ts
3310
+ var Ht = null;
3320
3311
  function Ut(e) {
3312
+ Ht = e;
3313
+ }
3314
+ function Wt() {
3315
+ return Ht ?? document.documentElement;
3316
+ }
3317
+ function Gt(e) {
3321
3318
  return e.includes("\0");
3322
3319
  }
3323
- function Wt(e) {
3320
+ function Kt(e) {
3324
3321
  let t = e.lastIndexOf("\0");
3325
3322
  if (t < 0) throw Error("Not a container path: " + JSON.stringify(e));
3326
3323
  let n = e.slice(0, t), r = e.slice(t + 1);
@@ -3329,25 +3326,25 @@ function Wt(e) {
3329
3326
  innerPath: r.startsWith("/") ? r : "/" + r
3330
3327
  };
3331
3328
  }
3332
- function Gt(e, t) {
3329
+ function qt(e, t) {
3333
3330
  let n = t.startsWith("/") ? t : "/" + t;
3334
3331
  return n.length > 1 && n.endsWith("/") && (n = n.slice(0, -1)), e + "\0" + n;
3335
3332
  }
3336
3333
  //#endregion
3337
3334
  //#region lib/utils/vfs.ts
3338
- function Kt(e) {
3335
+ function Jt(e) {
3339
3336
  return e.split("/").map((e) => encodeURIComponent(e)).join("/");
3340
3337
  }
3341
- function qt(e) {
3338
+ function Yt(e) {
3342
3339
  return e.replace(/\\/g, "/").replace(/(^|\/)([A-Za-z]):(?=\/|$)/g, "$1$2/");
3343
3340
  }
3344
- function Jt(e) {
3341
+ function Xt(e) {
3345
3342
  let t = e.startsWith("/") ? e : `/${e}`;
3346
- return "__TAURI_INTERNALS__" in window ? typeof navigator < "u" && /Windows/i.test(navigator.userAgent) ? `http://vfs.localhost${Kt(qt(t))}` : `vfs://vfs${Kt(t)}` : `${window.location.origin}/vfs/${Kt(t.replace(/^\/+/, ""))}`;
3343
+ return "__TAURI_INTERNALS__" in window ? typeof navigator < "u" && /Windows/i.test(navigator.userAgent) ? `http://vfs.localhost${Jt(Yt(t))}` : `vfs://vfs${Jt(t)}` : `${window.location.origin}/vfs/${Jt(t.replace(/^\/+/, ""))}`;
3347
3344
  }
3348
3345
  //#endregion
3349
3346
  //#region lib/viewerEditorRegistry.ts
3350
- function Yt(e, t) {
3347
+ function Zt(e, t) {
3351
3348
  if (e === "*" || e === "*.*") return !0;
3352
3349
  if (e.startsWith("*.")) {
3353
3350
  let n = e.slice(1);
@@ -3355,14 +3352,14 @@ function Yt(e, t) {
3355
3352
  }
3356
3353
  return t.toLowerCase() === e.toLowerCase();
3357
3354
  }
3358
- function Xt(e, t) {
3359
- return e.some((e) => Yt(e, t));
3355
+ function Qt(e, t) {
3356
+ return e.some((e) => Zt(e, t));
3360
3357
  }
3361
- function Zt(e, t) {
3362
- let n = e.filter((e) => Xt(e.contribution.patterns, t));
3358
+ function $t(e, t) {
3359
+ let n = e.filter((e) => Qt(e.contribution.patterns, t));
3363
3360
  return n.length === 0 ? null : (n.sort((e, t) => (t.contribution.priority ?? 0) - (e.contribution.priority ?? 0)), n[0]);
3364
3361
  }
3365
- var Qt = class {
3362
+ var en = class {
3366
3363
  entries = [];
3367
3364
  listeners = /* @__PURE__ */ new Set();
3368
3365
  clear() {
@@ -3375,7 +3372,7 @@ var Qt = class {
3375
3372
  });
3376
3373
  }
3377
3374
  resolve(e) {
3378
- return Zt(this.entries, e);
3375
+ return $t(this.entries, e);
3379
3376
  }
3380
3377
  getAll() {
3381
3378
  return this.entries;
@@ -3388,7 +3385,7 @@ var Qt = class {
3388
3385
  notifyListeners() {
3389
3386
  for (let e of this.listeners) e();
3390
3387
  }
3391
- }, $t = class {
3388
+ }, tn = class {
3392
3389
  entries = [];
3393
3390
  listeners = /* @__PURE__ */ new Set();
3394
3391
  clear() {
@@ -3401,7 +3398,7 @@ var Qt = class {
3401
3398
  });
3402
3399
  }
3403
3400
  resolve(e) {
3404
- return Zt(this.entries, e);
3401
+ return $t(this.entries, e);
3405
3402
  }
3406
3403
  getAll() {
3407
3404
  return this.entries;
@@ -3414,7 +3411,7 @@ var Qt = class {
3414
3411
  notifyListeners() {
3415
3412
  for (let e of this.listeners) e();
3416
3413
  }
3417
- }, en = class {
3414
+ }, nn = class {
3418
3415
  entries = [];
3419
3416
  listeners = /* @__PURE__ */ new Set();
3420
3417
  clear() {
@@ -3427,7 +3424,7 @@ var Qt = class {
3427
3424
  });
3428
3425
  }
3429
3426
  resolve(e) {
3430
- return Zt(this.entries, e);
3427
+ return $t(this.entries, e);
3431
3428
  }
3432
3429
  onChange(e) {
3433
3430
  return this.listeners.add(e), () => {
@@ -3437,19 +3434,19 @@ var Qt = class {
3437
3434
  notifyListeners() {
3438
3435
  for (let e of this.listeners) e();
3439
3436
  }
3440
- }, tn = new Qt(), nn = new $t(), rn = new en();
3441
- function an(e) {
3442
- tn.clear(), nn.clear(), rn.clear();
3437
+ }, rn = new en(), an = new tn(), on = new nn();
3438
+ function sn(e) {
3439
+ rn.clear(), an.clear(), on.clear();
3443
3440
  for (let t of e) {
3444
- if (t.viewers) for (let e of t.viewers) tn.register(e, t.dirPath);
3445
- if (t.editors) for (let e of t.editors) nn.register(e, t.dirPath);
3446
- if (t.fsProviders) for (let e of t.fsProviders) rn.register(e, t.dirPath);
3441
+ if (t.viewers) for (let e of t.viewers) rn.register(e, t.dirPath);
3442
+ if (t.editors) for (let e of t.editors) an.register(e, t.dirPath);
3443
+ if (t.fsProviders) for (let e of t.fsProviders) on.register(e, t.dirPath);
3447
3444
  }
3448
- tn.notifyListeners(), nn.notifyListeners(), rn.notifyListeners();
3445
+ rn.notifyListeners(), an.notifyListeners(), on.notifyListeners();
3449
3446
  }
3450
3447
  //#endregion
3451
3448
  //#region lib/vscodeColorTheme.ts
3452
- var on = [
3449
+ var cn = [
3453
3450
  {
3454
3451
  cssVar: "--bg",
3455
3452
  keys: ["editor.background"]
@@ -3548,12 +3545,12 @@ var on = [
3548
3545
  keys: ["activityBarBadge.foreground"]
3549
3546
  }
3550
3547
  ];
3551
- async function sn(e, t, n = 3) {
3548
+ async function ln(e, t, n = 3) {
3552
3549
  let r = S(await Nt(e, t), void 0, { allowTrailingComma: !0 });
3553
3550
  if (r.include && n > 0) {
3554
3551
  let i = K(G(t), r.include);
3555
3552
  try {
3556
- let t = await sn(e, i, n - 1);
3553
+ let t = await ln(e, i, n - 1);
3557
3554
  r.colors = {
3558
3555
  ...t.colors,
3559
3556
  ...r.colors
@@ -3562,56 +3559,47 @@ async function sn(e, t, n = 3) {
3562
3559
  }
3563
3560
  return r;
3564
3561
  }
3565
- var cn = [], ln = 0, un = null, dn = [];
3566
- function fn() {
3567
- return un;
3562
+ var un = [], dn = 0, fn = null, pn = [];
3563
+ function mn() {
3564
+ return fn;
3568
3565
  }
3569
- function pn(e) {
3570
- return dn.push(e), () => {
3571
- dn = dn.filter((t) => t !== e);
3566
+ function hn(e) {
3567
+ return pn.push(e), () => {
3568
+ pn = pn.filter((t) => t !== e);
3572
3569
  };
3573
3570
  }
3574
- function mn() {
3575
- if (un) for (let e of dn) e(un);
3571
+ function gn() {
3572
+ if (fn) for (let e of pn) e(fn);
3576
3573
  }
3577
- function hn(e) {
3578
- gn();
3579
- let t = Ht().style;
3580
- for (let n of on) for (let r of n.keys) {
3574
+ function _n(e) {
3575
+ vn();
3576
+ let t = Wt().style;
3577
+ for (let n of cn) for (let r of n.keys) {
3581
3578
  let i = e[r];
3582
3579
  if (i) {
3583
- t.setProperty(n.cssVar, i), cn.push(n.cssVar);
3580
+ t.setProperty(n.cssVar, i), un.push(n.cssVar);
3584
3581
  break;
3585
3582
  }
3586
3583
  }
3587
3584
  }
3588
- function gn() {
3589
- ln++;
3590
- let e = Ht().style;
3591
- for (let t of cn) e.removeProperty(t);
3592
- cn = [];
3593
- let t = un !== null;
3594
- if (un = null, t) for (let e of dn) e({ kind: Ht().dataset.theme === "light" ? "light" : "dark" });
3585
+ function vn() {
3586
+ dn++;
3587
+ let e = Wt().style;
3588
+ for (let t of un) e.removeProperty(t);
3589
+ un = [];
3590
+ let t = fn !== null;
3591
+ if (fn = null, t) for (let e of pn) e({ kind: Wt().dataset.theme === "light" ? "light" : "dark" });
3595
3592
  }
3596
- function _n(e) {
3593
+ function yn(e) {
3597
3594
  return e === "vs" || e === "hc-light" ? "light" : "dark";
3598
3595
  }
3599
- async function vn(e, t, n) {
3600
- let r = ++ln, i = await sn(e, t);
3601
- return r === ln ? (i.colors && hn(i.colors), un = {
3602
- kind: n ? _n(n) : i.type === "light" ? "light" : "dark",
3596
+ async function bn(e, t, n) {
3597
+ let r = ++dn, i = await ln(e, t);
3598
+ return r === dn ? (i.colors && _n(i.colors), fn = {
3599
+ kind: n ? yn(n) : i.type === "light" ? "light" : "dark",
3603
3600
  colors: i.colors,
3604
3601
  tokenColors: i.tokenColors
3605
- }, mn(), i) : i;
3606
- }
3607
- //#endregion
3608
- //#region lib/fileListHandlers.ts
3609
- var yn = null;
3610
- function bn(e) {
3611
- yn = e;
3612
- }
3613
- function J() {
3614
- return yn;
3602
+ }, gn(), i) : i;
3615
3603
  }
3616
3604
  //#endregion
3617
3605
  //#region lib/styles/viewers.module.css
@@ -3625,7 +3613,7 @@ var xn = {
3625
3613
  //#endregion
3626
3614
  //#region lib/components/ExtensionContainer.tsx
3627
3615
  async function Sn(e, t, n, r) {
3628
- let { containerFile: i, innerPath: a } = Wt(t), o = rn.resolve(q(i));
3616
+ let { containerFile: i, innerPath: a } = Kt(t), o = on.resolve(q(i));
3629
3617
  if (!o) throw Error(`No fsProvider registered for "${q(i)}"`);
3630
3618
  if (o.contribution.runtime === "backend" && e.fsProvider) {
3631
3619
  let t = K(o.extensionDirPath, o.contribution.entry);
@@ -3638,7 +3626,7 @@ async function Sn(e, t, n, r) {
3638
3626
  function Cn(e) {
3639
3627
  let { extensionDirPath: t, entry: n, kind: r, props: a, onClose: s, className: c, style: l, active: f } = e, h = ke(), g = u(null), [_, v] = d(null), [y, b] = d(!0), x = u(s);
3640
3628
  x.current = s;
3641
- let S = r === "viewer" && !!a.inline, C = r === "editor" || r === "viewer" && !S, w = u(null), T = u(!1), E = u(!1);
3629
+ let S = r === "viewer" && !!a.inline, C = r === "viewer" && !S, w = u(null), T = u(!1), E = u(!1);
3642
3630
  o(() => {
3643
3631
  S && (w.current = document.activeElement, T.current = !1, E.current = !1);
3644
3632
  }, [S]), o(() => {
@@ -3704,11 +3692,11 @@ function Cn(e) {
3704
3692
  let M = i(() => ({
3705
3693
  async readFile(e) {
3706
3694
  let t = W(e);
3707
- return Ut(t) ? Sn(h, t, 0, 64 * 1024 * 1024) : h.fs.readFile(t);
3695
+ return Gt(t) ? Sn(h, t, 0, 64 * 1024 * 1024) : h.fs.readFile(t);
3708
3696
  },
3709
3697
  async readFileRange(e, t, n) {
3710
3698
  let r = W(e);
3711
- if (Ut(r)) return Sn(h, r, t, n);
3699
+ if (Gt(r)) return Sn(h, r, t, n);
3712
3700
  let i = D.current, a = i;
3713
3701
  if (!a || a.path !== r) {
3714
3702
  if (i) try {
@@ -3725,7 +3713,7 @@ function Cn(e) {
3725
3713
  },
3726
3714
  async readFileText(e) {
3727
3715
  let t = W(e);
3728
- if (Ut(t)) {
3716
+ if (Gt(t)) {
3729
3717
  let t = await this.readFile(e);
3730
3718
  return new TextDecoder().decode(t);
3731
3719
  }
@@ -3733,7 +3721,7 @@ function Cn(e) {
3733
3721
  },
3734
3722
  async statFile(e) {
3735
3723
  let t = W(e);
3736
- if (Ut(t)) return {
3724
+ if (Gt(t)) return {
3737
3725
  size: (await Sn(h, t, 0, 64 * 1024 * 1024)).byteLength,
3738
3726
  mtimeMs: 0
3739
3727
  };
@@ -3762,10 +3750,10 @@ function Cn(e) {
3762
3750
  return h.theme.get();
3763
3751
  },
3764
3752
  getColorTheme() {
3765
- return fn();
3753
+ return mn();
3766
3754
  },
3767
3755
  onThemeChange(e) {
3768
- let t = pn(e);
3756
+ let t = hn(e);
3769
3757
  return () => t();
3770
3758
  },
3771
3759
  onClose() {
@@ -3793,7 +3781,7 @@ function Cn(e) {
3793
3781
  }), []), N = i(() => {
3794
3782
  let e = {};
3795
3783
  try {
3796
- let t = getComputedStyle(Ht());
3784
+ let t = getComputedStyle(Wt());
3797
3785
  for (let n = 0; n < t.length; n++) {
3798
3786
  let r = t[n];
3799
3787
  if (!r || !r.startsWith("--")) continue;
@@ -3809,7 +3797,7 @@ function Cn(e) {
3809
3797
  b(!0), v(null);
3810
3798
  let o = M(), s = i.contentWindow;
3811
3799
  if (!s) return;
3812
- let c = W(n.replace(/^\.\//, "")) || "index.js", l = K(t, c), u = Jt(l), d = /\.mjs(?:\?|$)/i.test(c), f = 1, p = /* @__PURE__ */ new Map(), m = /* @__PURE__ */ new Map(), _ = /* @__PURE__ */ new Map(), y = /* @__PURE__ */ new Map(), x = (t) => {
3800
+ let c = W(n.replace(/^\.\//, "")) || "index.js", l = K(t, c), u = Xt(l), d = /\.mjs(?:\?|$)/i.test(c), f = 1, p = /* @__PURE__ */ new Map(), m = /* @__PURE__ */ new Map(), _ = /* @__PURE__ */ new Map(), y = /* @__PURE__ */ new Map(), x = (t) => {
3813
3801
  if (t.source !== s) return;
3814
3802
  let n = t.data;
3815
3803
  if (!(!n || typeof n != "object")) {
@@ -3974,7 +3962,7 @@ function Cn(e) {
3974
3962
  themeVars: N()
3975
3963
  }, "*");
3976
3964
  } catch {}
3977
- }, E = pn(() => C()), k = !1, j = async () => {
3965
+ }, E = hn(() => C()), k = !1, j = async () => {
3978
3966
  if (k) return;
3979
3967
  k = !0, O.current = a.filePath;
3980
3968
  let t;
@@ -4063,7 +4051,7 @@ function Cn(e) {
4063
4051
  _
4064
4052
  ]
4065
4053
  });
4066
- let F = Jt(`/_ext/${G(K(t, W(n.replace(/^\.\//, "")) || "index.js")).replace(/^\//, "")}/`);
4054
+ let F = Xt(`/_ext/${G(K(t, W(n.replace(/^\.\//, "")) || "index.js")).replace(/^\//, "")}/`);
4067
4055
  return /* @__PURE__ */ m("div", {
4068
4056
  className: c,
4069
4057
  style: {
@@ -4100,16 +4088,33 @@ function Cn(e) {
4100
4088
  });
4101
4089
  }
4102
4090
  function wn({ extensionDirPath: e, entry: t, filePath: n, fileName: r, fileSize: a, inline: s, visible: c, onClose: d, onExecuteCommand: f }) {
4103
- let h = u(!1), g = c ?? !0, _ = i(() => {
4104
- requestAnimationFrame(() => {
4105
- J()?.focus();
4106
- });
4107
- }, []), v = i(() => {
4108
- d(), _();
4109
- }, [d, _]);
4091
+ let h = u(!1), g = u(null), _ = c ?? !0, v = i(() => {
4092
+ A.set("panel");
4093
+ let e = (t = 0) => {
4094
+ let n = g.current;
4095
+ if (n && n.isConnected) try {
4096
+ n.focus({ preventScroll: !0 });
4097
+ return;
4098
+ } catch {
4099
+ try {
4100
+ n.focus();
4101
+ return;
4102
+ } catch {}
4103
+ }
4104
+ let r = J();
4105
+ if (r) {
4106
+ r.focus();
4107
+ return;
4108
+ }
4109
+ t < 2 && requestAnimationFrame(() => e(t + 1));
4110
+ };
4111
+ requestAnimationFrame(() => e());
4112
+ }, []), y = i(() => {
4113
+ d(), v();
4114
+ }, [d, v]);
4110
4115
  o(() => {
4111
4116
  if (!s) {
4112
- if (g) h.current ||= (A.push("viewer"), !0);
4117
+ if (_) h.current ||= (g.current = document.activeElement, A.push("viewer"), !0);
4113
4118
  else if (h.current) {
4114
4119
  try {
4115
4120
  A.pop("viewer");
@@ -4117,7 +4122,7 @@ function wn({ extensionDirPath: e, entry: t, filePath: n, fileName: r, fileSize:
4117
4122
  h.current = !1;
4118
4123
  }
4119
4124
  }
4120
- }, [s, g]), o(() => () => {
4125
+ }, [s, _]), o(() => () => {
4121
4126
  if (h.current) {
4122
4127
  try {
4123
4128
  A.pop("viewer");
@@ -4125,7 +4130,7 @@ function wn({ extensionDirPath: e, entry: t, filePath: n, fileName: r, fileSize:
4125
4130
  h.current = !1;
4126
4131
  }
4127
4132
  }, []);
4128
- let y = l(() => ({
4133
+ let b = l(() => ({
4129
4134
  filePath: n,
4130
4135
  fileName: r,
4131
4136
  fileSize: a,
@@ -4135,7 +4140,7 @@ function wn({ extensionDirPath: e, entry: t, filePath: n, fileName: r, fileSize:
4135
4140
  r,
4136
4141
  a,
4137
4142
  s
4138
- ]), b = /* @__PURE__ */ m("div", {
4143
+ ]), x = /* @__PURE__ */ m("div", {
4139
4144
  style: {
4140
4145
  display: "flex",
4141
4146
  alignItems: "center",
@@ -4158,7 +4163,7 @@ function wn({ extensionDirPath: e, entry: t, filePath: n, fileName: r, fileSize:
4158
4163
  }), /* @__PURE__ */ p("button", {
4159
4164
  type: "button",
4160
4165
  title: "Close (Esc)",
4161
- onClick: v,
4166
+ onClick: y,
4162
4167
  style: {
4163
4168
  background: "transparent",
4164
4169
  border: "none",
@@ -4171,13 +4176,13 @@ function wn({ extensionDirPath: e, entry: t, filePath: n, fileName: r, fileSize:
4171
4176
  "aria-label": "Close",
4172
4177
  children: "×"
4173
4178
  })]
4174
- }), x = /* @__PURE__ */ p(Cn, {
4179
+ }), S = /* @__PURE__ */ p(Cn, {
4175
4180
  kind: "viewer",
4176
4181
  extensionDirPath: e,
4177
4182
  entry: t,
4178
- props: y,
4179
- active: g,
4180
- onClose: v,
4183
+ props: b,
4184
+ active: _,
4185
+ onClose: y,
4181
4186
  onExecuteCommand: f,
4182
4187
  style: {
4183
4188
  width: "100%",
@@ -4196,11 +4201,11 @@ function wn({ extensionDirPath: e, entry: t, filePath: n, fileName: r, fileSize:
4196
4201
  flex: 1,
4197
4202
  minHeight: 0
4198
4203
  },
4199
- children: x
4204
+ children: S
4200
4205
  })
4201
4206
  }) : /* @__PURE__ */ p("div", {
4202
4207
  className: xn["file-viewer-overlay"],
4203
- style: { display: g ? "flex" : "none" },
4208
+ style: { display: _ ? "flex" : "none" },
4204
4209
  children: /* @__PURE__ */ m("div", {
4205
4210
  className: xn["file-viewer"],
4206
4211
  style: {
@@ -4208,35 +4213,52 @@ function wn({ extensionDirPath: e, entry: t, filePath: n, fileName: r, fileSize:
4208
4213
  flexDirection: "column",
4209
4214
  padding: 0
4210
4215
  },
4211
- children: [b, /* @__PURE__ */ p("div", {
4216
+ children: [x, /* @__PURE__ */ p("div", {
4212
4217
  style: {
4213
4218
  flex: 1,
4214
4219
  minHeight: 0
4215
4220
  },
4216
- children: x
4221
+ children: S
4217
4222
  })]
4218
4223
  })
4219
4224
  });
4220
4225
  }
4221
4226
  function Tn({ extensionDirPath: e, entry: t, filePath: n, fileName: r, langId: a, visible: s, onClose: c, onDirtyChange: h, languages: g, grammars: _ }) {
4222
- let [v, y] = d(a), b = u(!1), x = s ?? !0, S = i(() => {
4223
- requestAnimationFrame(() => {
4224
- J()?.focus();
4225
- });
4226
- }, []), C = i(() => {
4227
- c(), S();
4228
- }, [c, S]);
4227
+ let [v, y] = d(a), b = u(!1), x = u(null), S = s ?? !0, C = i(() => {
4228
+ A.set("panel");
4229
+ let e = (t = 0) => {
4230
+ let n = x.current;
4231
+ if (n && n.isConnected) try {
4232
+ n.focus({ preventScroll: !0 });
4233
+ return;
4234
+ } catch {
4235
+ try {
4236
+ n.focus();
4237
+ return;
4238
+ } catch {}
4239
+ }
4240
+ let r = J();
4241
+ if (r) {
4242
+ r.focus();
4243
+ return;
4244
+ }
4245
+ t < 2 && requestAnimationFrame(() => e(t + 1));
4246
+ };
4247
+ requestAnimationFrame(() => e());
4248
+ }, []), w = i(() => {
4249
+ c(), C();
4250
+ }, [c, C]);
4229
4251
  o(() => {
4230
4252
  y(a);
4231
4253
  }, [a]), o(() => {
4232
- if (x) b.current ||= (A.push("editor"), !0);
4254
+ if (S) b.current ||= (x.current = document.activeElement, A.push("editor"), !0);
4233
4255
  else if (b.current) {
4234
4256
  try {
4235
4257
  A.pop("editor");
4236
4258
  } catch {}
4237
4259
  b.current = !1;
4238
4260
  }
4239
- }, [x]), o(() => () => {
4261
+ }, [S]), o(() => () => {
4240
4262
  if (b.current) {
4241
4263
  try {
4242
4264
  A.pop("editor");
@@ -4244,7 +4266,7 @@ function Tn({ extensionDirPath: e, entry: t, filePath: n, fileName: r, langId: a
4244
4266
  b.current = !1;
4245
4267
  }
4246
4268
  }, []);
4247
- let w = l(() => ({
4269
+ let T = l(() => ({
4248
4270
  filePath: n,
4249
4271
  fileName: r,
4250
4272
  langId: v,
@@ -4259,16 +4281,16 @@ function Tn({ extensionDirPath: e, entry: t, filePath: n, fileName: r, langId: a
4259
4281
  e,
4260
4282
  g,
4261
4283
  _
4262
- ]), T = (e) => {
4284
+ ]), E = (e) => {
4263
4285
  let t = e.target.value;
4264
4286
  y(t);
4265
- }, E = l(() => {
4287
+ }, D = l(() => {
4266
4288
  let e = g ?? [], t = /* @__PURE__ */ new Set();
4267
4289
  return e.filter((e) => t.has(e.id) ? !1 : (t.add(e.id), !0));
4268
- }, [g]), D = E.length > 0;
4290
+ }, [g]), O = D.length > 0;
4269
4291
  return /* @__PURE__ */ p("div", {
4270
4292
  className: xn["file-editor-overlay"],
4271
- style: { display: x ? "flex" : "none" },
4293
+ style: { display: S ? "flex" : "none" },
4272
4294
  children: /* @__PURE__ */ m("div", {
4273
4295
  className: xn["file-editor"],
4274
4296
  style: {
@@ -4298,14 +4320,14 @@ function Tn({ extensionDirPath: e, entry: t, filePath: n, fileName: r, langId: a
4298
4320
  title: r,
4299
4321
  children: r
4300
4322
  }),
4301
- D && /* @__PURE__ */ m(f, { children: [/* @__PURE__ */ p("label", {
4323
+ O && /* @__PURE__ */ m(f, { children: [/* @__PURE__ */ p("label", {
4302
4324
  htmlFor: "editor-lang-select",
4303
4325
  style: { whiteSpace: "nowrap" },
4304
4326
  children: "Language:"
4305
4327
  }), /* @__PURE__ */ m("select", {
4306
4328
  id: "editor-lang-select",
4307
4329
  value: v,
4308
- onChange: T,
4330
+ onChange: E,
4309
4331
  style: {
4310
4332
  minWidth: 120,
4311
4333
  padding: "2px 6px"
@@ -4313,7 +4335,7 @@ function Tn({ extensionDirPath: e, entry: t, filePath: n, fileName: r, langId: a
4313
4335
  children: [/* @__PURE__ */ p("option", {
4314
4336
  value: "plaintext",
4315
4337
  children: "Plain Text"
4316
- }), E.map((e) => /* @__PURE__ */ p("option", {
4338
+ }), D.map((e) => /* @__PURE__ */ p("option", {
4317
4339
  value: e.id,
4318
4340
  children: e.aliases?.[0] ?? e.id
4319
4341
  }, e.id))]
@@ -4321,7 +4343,7 @@ function Tn({ extensionDirPath: e, entry: t, filePath: n, fileName: r, langId: a
4321
4343
  /* @__PURE__ */ p("button", {
4322
4344
  type: "button",
4323
4345
  title: "Close (Esc)",
4324
- onClick: C,
4346
+ onClick: w,
4325
4347
  style: {
4326
4348
  background: "transparent",
4327
4349
  border: "none",
@@ -4344,9 +4366,9 @@ function Tn({ extensionDirPath: e, entry: t, filePath: n, fileName: r, langId: a
4344
4366
  kind: "editor",
4345
4367
  extensionDirPath: e,
4346
4368
  entry: t,
4347
- props: w,
4348
- active: x,
4349
- onClose: C,
4369
+ props: T,
4370
+ active: S,
4371
+ onClose: w,
4350
4372
  onDirtyChange: h,
4351
4373
  style: {
4352
4374
  width: "100%",
@@ -5976,7 +5998,7 @@ var yi = r(function({ currentPath: e, parentNode: t, entries: n, onNavigate: r,
5976
5998
  ]);
5977
5999
  let ye = i(() => {
5978
6000
  let e = V.current[L.current], t = e?.entry.type === "file", n = t && e != null && !!e.entry.meta.executable, r = e?.entry.name ?? "";
5979
- H.beginBatch(), H.setContext("listItemIsFile", t), H.setContext("listItemIsFolder", !t && e != null), H.setContext("listItemIsExecutable", n), H.setContext("listItemHasViewer", t && tn.resolve(r) !== null), H.setContext("listItemHasEditor", t && nn.resolve(r) !== null), H.endBatch();
6001
+ H.beginBatch(), H.setContext("listItemIsFile", t), H.setContext("listItemIsFolder", !t && e != null), H.setContext("listItemIsExecutable", n), H.setContext("listItemHasViewer", t && rn.resolve(r) !== null), H.setContext("listItemHasEditor", t && an.resolve(r) !== null), H.endBatch();
5980
6002
  }, []);
5981
6003
  o(() => {
5982
6004
  s && ye();
@@ -5987,12 +6009,12 @@ var yi = r(function({ currentPath: e, parentNode: t, entries: n, onNavigate: r,
5987
6009
  ye
5988
6010
  ]), o(() => {
5989
6011
  if (!s) return;
5990
- let e = tn.onChange(ye), t = nn.onChange(ye);
6012
+ let e = rn.onChange(ye), t = an.onChange(ye);
5991
6013
  return () => {
5992
6014
  e(), t();
5993
6015
  };
5994
6016
  }, [s, ye]), o(() => {
5995
- if (s) return bn({
6017
+ if (s) return Vt({
5996
6018
  focus: () => {
5997
6019
  _.current?.focus({ preventScroll: !0 });
5998
6020
  },
@@ -6133,7 +6155,7 @@ var yi = r(function({ currentPath: e, parentNode: t, entries: n, onNavigate: r,
6133
6155
  let n = (e.entry.path ?? "").split("\0")[0], r = /^[a-zA-Z0-9._+/:-]+$/.test(n) ? n : JSON.stringify(n);
6134
6156
  t.pasteToCommandLine(r);
6135
6157
  })
6136
- }), () => bn(null);
6158
+ }), () => Vt(null);
6137
6159
  }, [
6138
6160
  s,
6139
6161
  R,
@@ -6508,7 +6530,7 @@ function Wi({ side: e, panel: t, onRememberExpectedTerminalCwd: n, selectionKey:
6508
6530
  }, T.id) : T?.type === "preview" ? (() => {
6509
6531
  let e = T;
6510
6532
  if (e.type !== "preview") return null;
6511
- let t = tn.resolve(e.name);
6533
+ let t = rn.resolve(e.name);
6512
6534
  return t ? /* @__PURE__ */ p(wn, {
6513
6535
  extensionDirPath: t.extensionDirPath,
6514
6536
  entry: t.contribution.entry,
@@ -7179,8 +7201,8 @@ function ha({ settingsLoaded: e, onRefreshPanels: t }) {
7179
7201
  v.current = t;
7180
7202
  let x = u([]), S = u([]), C = u(!1);
7181
7203
  o(() => {
7182
- let e = s ? Jn(x.current, s) : null, t = e ? _n(e.theme.uiTheme) : c === "light" || c === "high-contrast-light" ? "light" : "dark";
7183
- Ht().dataset.theme = t, h(t);
7204
+ let e = s ? Jn(x.current, s) : null, t = e ? yn(e.theme.uiTheme) : c === "light" || c === "high-contrast-light" ? "light" : "dark";
7205
+ Wt().dataset.theme = t, h(t);
7184
7206
  }, [c, s]);
7185
7207
  let w = i(async (e, t) => {
7186
7208
  if (!t) return;
@@ -7200,10 +7222,10 @@ function ha({ settingsLoaded: e, onRefreshPanels: t }) {
7200
7222
  v.current();
7201
7223
  })();
7202
7224
  }, [a, w]), o(() => {
7203
- if (C.current) if (!s) gn();
7225
+ if (C.current) if (!s) vn();
7204
7226
  else {
7205
7227
  let e = Jn(x.current, s);
7206
- e && vn(n, e.theme.jsonPath, e.theme.uiTheme).catch(() => gn());
7228
+ e && bn(n, e.theme.jsonPath, e.theme.uiTheme).catch(() => vn());
7207
7229
  }
7208
7230
  }, [s]), o(() => {
7209
7231
  if (!e) return;
@@ -7221,19 +7243,19 @@ function ha({ settingsLoaded: e, onRefreshPanels: t }) {
7221
7243
  n?.vscodeIconThemePath ? await m("vscode", n.vscodeIconThemePath) : n?.iconThemeFssPath ? await m("fss") : await m("none");
7222
7244
  }, a = async (e, t) => {
7223
7245
  if (!t) {
7224
- gn();
7246
+ vn();
7225
7247
  return;
7226
7248
  }
7227
7249
  let r = Jn(e, t);
7228
7250
  if (r) {
7229
- let e = _n(r.theme.uiTheme);
7230
- Ht().dataset.theme = e, h(e);
7251
+ let e = yn(r.theme.uiTheme);
7252
+ Wt().dataset.theme = e, h(e);
7231
7253
  try {
7232
- await vn(n, r.theme.jsonPath, r.theme.uiTheme);
7254
+ await bn(n, r.theme.jsonPath, r.theme.uiTheme);
7233
7255
  } catch (e) {
7234
- console.warn("[ExtHost] Failed to load color theme:", t, e), gn();
7256
+ console.warn("[ExtHost] Failed to load color theme:", t, e), vn();
7235
7257
  }
7236
- } else gn();
7258
+ } else vn();
7237
7259
  }, o = (e) => {
7238
7260
  for (let e of S.current) try {
7239
7261
  e();
@@ -7254,7 +7276,7 @@ function ha({ settingsLoaded: e, onRefreshPanels: t }) {
7254
7276
  }
7255
7277
  }, s = r.onLoaded((e) => {
7256
7278
  (async () => {
7257
- if (x.current = e, l(e), an(e), zt(), n.fsProvider) {
7279
+ if (x.current = e, l(e), sn(e), zt(), n.fsProvider) {
7258
7280
  for (let t of e) for (let e of t.fsProviders ?? []) if (e.runtime === "backend") {
7259
7281
  let r = K(t.dirPath, e.entry);
7260
7282
  n.fsProvider.load(r).catch(() => {});
@@ -7379,8 +7401,8 @@ function _a(e, t, n, r) {
7379
7401
  destPath: o,
7380
7402
  onConfirm: async (e, t) => {
7381
7403
  try {
7382
- if (r.some((e) => Ut(e))) {
7383
- if (!r.every((e) => Ut(e))) throw Error("Cannot copy files from archives and local files in the same operation");
7404
+ if (r.some((e) => Gt(e))) {
7405
+ if (!r.every((e) => Gt(e))) throw Error("Cannot copy files from archives and local files in the same operation");
7384
7406
  let e = {
7385
7407
  type: "copyProgress",
7386
7408
  bytesCopied: 0,
@@ -7393,7 +7415,7 @@ function _a(e, t, n, r) {
7393
7415
  f.current = e, a(e);
7394
7416
  let n = [];
7395
7417
  for (let e of r) {
7396
- let { containerFile: t, innerPath: r } = Wt(e), i = rn.resolve(q(t));
7418
+ let { containerFile: t, innerPath: r } = Kt(e), i = on.resolve(q(t));
7397
7419
  if (!i) throw Error(`No fsProvider registered for "${q(t)}"`);
7398
7420
  let a = null, o = null;
7399
7421
  i.contribution.runtime === "backend" && l.fsProvider ? a = K(i.extensionDirPath, i.contribution.entry) : o = await Rt(l, i.extensionDirPath, i.contribution.entry), (await ga(async (e) => a ? l.fsProvider.listEntries(a, t, e) : (await o.listEntries(t, e)).map((e) => ({
@@ -8466,8 +8488,8 @@ function $a(e) {
8466
8488
  n.current.leftRef.current.cancelNavigation(), n.current.rightRef.current.cancelNavigation();
8467
8489
  })), e.push(H.registerCommand("dotdir.goToParent", () => {
8468
8490
  let { leftRef: e, rightRef: t } = n.current, r = g.current === "left" ? e.current : t.current, i = r.currentPath;
8469
- if (Ut(i)) {
8470
- let { containerFile: e, innerPath: t } = Wt(i);
8491
+ if (Gt(i)) {
8492
+ let { containerFile: e, innerPath: t } = Kt(i);
8471
8493
  if (t === "/" || t === "") {
8472
8494
  r.navigateTo(G(e), !1, q(e));
8473
8495
  return;
@@ -8653,8 +8675,8 @@ function co(e) {
8653
8675
  p.current = i, f.current = setTimeout(() => c(!0), 300);
8654
8676
  try {
8655
8677
  let n = (async () => {
8656
- if (v.current = e, Ut(e)) {
8657
- let { containerFile: n, innerPath: o } = Wt(e), s = rn.resolve(q(n));
8678
+ if (v.current = e, Gt(e)) {
8679
+ let { containerFile: n, innerPath: o } = Kt(e), s = on.resolve(q(n));
8658
8680
  if (!s) throw Error(`No fsProvider registered for "${q(n)}"`);
8659
8681
  let c;
8660
8682
  if (s.contribution.runtime === "backend" && t.fsProvider) {
@@ -8688,7 +8710,7 @@ function co(e) {
8688
8710
  nlink: 1,
8689
8711
  entryKind: e.type === "directory" ? "directory" : "file"
8690
8712
  },
8691
- path: Gt(n, t),
8713
+ path: qt(n, t),
8692
8714
  parent: l
8693
8715
  });
8694
8716
  }),
@@ -9190,7 +9212,7 @@ function Mo({ widget: e }) {
9190
9212
  H.setContext("dialogOpen", h !== null);
9191
9213
  }, [h]);
9192
9214
  let lt = i((e, t, n) => {
9193
- if (rn.resolve(q(e))) {
9215
+ if (on.resolve(q(e))) {
9194
9216
  Qe.current(e + "\0");
9195
9217
  return;
9196
9218
  }
@@ -9258,7 +9280,7 @@ function Mo({ widget: e }) {
9258
9280
  index: i,
9259
9281
  total: r.length
9260
9282
  };
9261
- }, [O, ht]), yt = O ? tn.resolve(O.name) : null, bt = j ? nn.resolve(j.name) : null;
9283
+ }, [O, ht]), yt = O ? rn.resolve(O.name) : null, bt = j ? an.resolve(j.name) : null;
9262
9284
  o(() => {
9263
9285
  yt && P((e) => e?.dirPath === yt.extensionDirPath && e?.entry === yt.contribution.entry ? e : {
9264
9286
  dirPath: yt.extensionDirPath,
@@ -9484,13 +9506,12 @@ function Mo({ widget: e }) {
9484
9506
  message: "No viewer extension found for this file type. Install viewer extensions (e.g. Image Viewer, File Viewer) from the extensions panel.",
9485
9507
  onClose: () => k(null)
9486
9508
  }),
9487
- N && /* @__PURE__ */ p(wn, {
9509
+ N && O && yt && /* @__PURE__ */ p(wn, {
9488
9510
  extensionDirPath: N.dirPath,
9489
9511
  entry: N.entry,
9490
- filePath: O?.path ?? "",
9491
- fileName: O?.name ?? "",
9492
- fileSize: O?.size ?? 0,
9493
- visible: O != null && yt != null,
9512
+ filePath: O.path,
9513
+ fileName: O.name,
9514
+ fileSize: O.size,
9494
9515
  onClose: () => k(null),
9495
9516
  onExecuteCommand: vt
9496
9517
  }, `viewer:${N.dirPath}:${N.entry}`),
@@ -9499,7 +9520,7 @@ function Mo({ widget: e }) {
9499
9520
  message: "No editor extension found for this file type. Install an editor extension (e.g. Monaco Editor) from the extensions panel.",
9500
9521
  onClose: () => M(null)
9501
9522
  }),
9502
- I && (() => {
9523
+ I && j && bt && (() => {
9503
9524
  let e = ge.flatMap((e) => e.languages ?? []), t = ge.flatMap((e) => e.grammarRefs ?? []).map((e) => ({
9504
9525
  contribution: e.contribution,
9505
9526
  path: e.path
@@ -9507,10 +9528,9 @@ function Mo({ widget: e }) {
9507
9528
  return /* @__PURE__ */ p(Tn, {
9508
9529
  extensionDirPath: I.dirPath,
9509
9530
  entry: I.entry,
9510
- filePath: j?.path ?? "",
9511
- fileName: j?.name ?? "",
9512
- langId: j?.langId ?? "plaintext",
9513
- visible: j != null && bt != null,
9531
+ filePath: j.path,
9532
+ fileName: j.name,
9533
+ langId: j.langId,
9514
9534
  onClose: () => M(null),
9515
9535
  languages: e,
9516
9536
  grammars: t
@@ -9533,8 +9553,8 @@ function No({ bridge: e, widget: t }) {
9533
9553
  H.registerContributions(je);
9534
9554
  }, []), o(() => {
9535
9555
  let e = n.current;
9536
- if (e) return Vt(e), () => {
9537
- n.current === e && Vt(null);
9556
+ if (e) return Ut(e), () => {
9557
+ n.current === e && Ut(null);
9538
9558
  };
9539
9559
  }, []), /* @__PURE__ */ p("div", {
9540
9560
  ref: n,