@aiquants/directory-tree 3.3.0 → 3.4.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.
package/dist/index.js CHANGED
@@ -1,20 +1,20 @@
1
- import Zt, { useRef as ce, useEffect as de, useCallback as W, memo as ze, useState as se, useMemo as q, useLayoutEffect as Qt, Fragment as Kt, useTransition as er } from "react";
2
- import { VirtualScroll as tr, ScrollBar as rr } from "@aiquants/virtualscroll";
1
+ import tr, { useRef as ce, useEffect as de, useCallback as B, memo as ze, useState as ne, useMemo as q, useLayoutEffect as rr, Fragment as nr, useTransition as sr } from "react";
2
+ import { VirtualScroll as ar, ScrollBar as or } from "@aiquants/virtualscroll";
3
3
  import { twMerge as M } from "tailwind-merge";
4
- import { FolderIcon as nr, ChevronDownIcon as sr, ChevronRightIcon as ar } from "@heroicons/react/24/solid";
5
- import { FileMd as xt, FilePdf as vt, FileXls as bt, FileCsv as gt, FileDoc as wt, FilePpt as kt, FileImage as Nt, FileAudio as Et, FileVideo as It, FileZip as St, FileCode as jt, FileText as Tt, FileIcon as or } from "@phosphor-icons/react";
6
- var Me = { exports: {} }, Ee = {};
7
- var Rt;
8
- function lr() {
9
- if (Rt) return Ee;
10
- Rt = 1;
4
+ import { FolderIcon as lr, ChevronDownIcon as ir, ChevronRightIcon as cr } from "@heroicons/react/24/solid";
5
+ import { FileMd as bt, FilePdf as gt, FileXls as wt, FileCsv as kt, FileDoc as Nt, FilePpt as Et, FileImage as It, FileAudio as St, FileVideo as jt, FileZip as Tt, FileCode as Rt, FileText as Ct, FileIcon as dr } from "@phosphor-icons/react";
6
+ var Me = { exports: {} }, Ie = {};
7
+ var Pt;
8
+ function ur() {
9
+ if (Pt) return Ie;
10
+ Pt = 1;
11
11
  var e = /* @__PURE__ */ Symbol.for("react.transitional.element"), t = /* @__PURE__ */ Symbol.for("react.fragment");
12
12
  function a(s, r, o) {
13
13
  var l = null;
14
14
  if (o !== void 0 && (l = "" + o), r.key !== void 0 && (l = "" + r.key), "key" in r) {
15
15
  o = {};
16
- for (var d in r)
17
- d !== "key" && (o[d] = r[d]);
16
+ for (var u in r)
17
+ u !== "key" && (o[u] = r[u]);
18
18
  } else o = r;
19
19
  return r = o.ref, {
20
20
  $$typeof: e,
@@ -24,16 +24,16 @@ function lr() {
24
24
  props: o
25
25
  };
26
26
  }
27
- return Ee.Fragment = t, Ee.jsx = a, Ee.jsxs = a, Ee;
27
+ return Ie.Fragment = t, Ie.jsx = a, Ie.jsxs = a, Ie;
28
28
  }
29
- var Ie = {};
30
- var Ct;
31
- function ir() {
32
- return Ct || (Ct = 1, process.env.NODE_ENV !== "production" && (function() {
29
+ var Se = {};
30
+ var _t;
31
+ function mr() {
32
+ return _t || (_t = 1, process.env.NODE_ENV !== "production" && (function() {
33
33
  function e(n) {
34
34
  if (n == null) return null;
35
35
  if (typeof n == "function")
36
- return n.$$typeof === B ? null : n.displayName || n.name || null;
36
+ return n.$$typeof === Y ? null : n.displayName || n.name || null;
37
37
  if (typeof n == "string") return n;
38
38
  switch (n) {
39
39
  case f:
@@ -42,32 +42,32 @@ function ir() {
42
42
  return "Profiler";
43
43
  case v:
44
44
  return "StrictMode";
45
- case T:
45
+ case j:
46
46
  return "Suspense";
47
- case R:
47
+ case T:
48
48
  return "SuspenseList";
49
- case C:
49
+ case P:
50
50
  return "Activity";
51
51
  }
52
52
  if (typeof n == "object")
53
53
  switch (typeof n.tag == "number" && console.error(
54
54
  "Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."
55
55
  ), n.$$typeof) {
56
- case u:
56
+ case m:
57
57
  return "Portal";
58
- case w:
58
+ case b:
59
59
  return n.displayName || "Context";
60
60
  case N:
61
61
  return (n._context.displayName || "Context") + ".Consumer";
62
- case p:
63
- var h = n.render;
64
- return n = n.displayName, n || (n = h.displayName || h.name || "", n = n !== "" ? "ForwardRef(" + n + ")" : "ForwardRef"), n;
62
+ case h:
63
+ var p = n.render;
64
+ return n = n.displayName, n || (n = p.displayName || p.name || "", n = n !== "" ? "ForwardRef(" + n + ")" : "ForwardRef"), n;
65
65
  case L:
66
- return h = n.displayName || null, h !== null ? h : e(n.type) || "Memo";
67
- case V:
68
- h = n._payload, n = n._init;
66
+ return p = n.displayName || null, p !== null ? p : e(n.type) || "Memo";
67
+ case U:
68
+ p = n._payload, n = n._init;
69
69
  try {
70
- return e(n(h));
70
+ return e(n(p));
71
71
  } catch {
72
72
  }
73
73
  }
@@ -79,15 +79,15 @@ function ir() {
79
79
  function a(n) {
80
80
  try {
81
81
  t(n);
82
- var h = !1;
82
+ var p = !1;
83
83
  } catch {
84
- h = !0;
84
+ p = !0;
85
85
  }
86
- if (h) {
87
- h = console;
88
- var S = h.error, _ = typeof Symbol == "function" && Symbol.toStringTag && n[Symbol.toStringTag] || n.constructor.name || "Object";
89
- return S.call(
90
- h,
86
+ if (p) {
87
+ p = console;
88
+ var I = p.error, _ = typeof Symbol == "function" && Symbol.toStringTag && n[Symbol.toStringTag] || n.constructor.name || "Object";
89
+ return I.call(
90
+ p,
91
91
  "The provided key is an unsupported type %s. This value must be coerced to a string before using it here.",
92
92
  _
93
93
  ), t(n);
@@ -95,11 +95,11 @@ function ir() {
95
95
  }
96
96
  function s(n) {
97
97
  if (n === f) return "<>";
98
- if (typeof n == "object" && n !== null && n.$$typeof === V)
98
+ if (typeof n == "object" && n !== null && n.$$typeof === U)
99
99
  return "<...>";
100
100
  try {
101
- var h = e(n);
102
- return h ? "<" + h + ">" : "<...>";
101
+ var p = e(n);
102
+ return p ? "<" + p + ">" : "<...>";
103
103
  } catch {
104
104
  return "<...>";
105
105
  }
@@ -112,41 +112,41 @@ function ir() {
112
112
  return Error("react-stack-top-frame");
113
113
  }
114
114
  function l(n) {
115
- if (H.call(n, "key")) {
116
- var h = Object.getOwnPropertyDescriptor(n, "key").get;
117
- if (h && h.isReactWarning) return !1;
115
+ if (W.call(n, "key")) {
116
+ var p = Object.getOwnPropertyDescriptor(n, "key").get;
117
+ if (p && p.isReactWarning) return !1;
118
118
  }
119
119
  return n.key !== void 0;
120
120
  }
121
- function d(n, h) {
122
- function S() {
123
- ae || (ae = !0, console.error(
121
+ function u(n, p) {
122
+ function I() {
123
+ se || (se = !0, console.error(
124
124
  "%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://react.dev/link/special-props)",
125
- h
125
+ p
126
126
  ));
127
127
  }
128
- S.isReactWarning = !0, Object.defineProperty(n, "key", {
129
- get: S,
128
+ I.isReactWarning = !0, Object.defineProperty(n, "key", {
129
+ get: I,
130
130
  configurable: !0
131
131
  });
132
132
  }
133
- function g() {
133
+ function w() {
134
134
  var n = e(this.type);
135
- return oe[n] || (oe[n] = !0, console.error(
135
+ return ae[n] || (ae[n] = !0, console.error(
136
136
  "Accessing element.ref was removed in React 19. ref is now a regular prop. It will be removed from the JSX Element type in a future release."
137
137
  )), n = this.props.ref, n !== void 0 ? n : null;
138
138
  }
139
- function x(n, h, S, _, ee, Q) {
140
- var P = S.ref;
139
+ function x(n, p, I, _, Q, ee) {
140
+ var C = I.ref;
141
141
  return n = {
142
- $$typeof: I,
142
+ $$typeof: k,
143
143
  type: n,
144
- key: h,
145
- props: S,
144
+ key: p,
145
+ props: I,
146
146
  _owner: _
147
- }, (P !== void 0 ? P : null) !== null ? Object.defineProperty(n, "ref", {
147
+ }, (C !== void 0 ? C : null) !== null ? Object.defineProperty(n, "ref", {
148
148
  enumerable: !1,
149
- get: g
149
+ get: w
150
150
  }) : Object.defineProperty(n, "ref", { enumerable: !1, value: null }), n._store = {}, Object.defineProperty(n._store, "validated", {
151
151
  configurable: !1,
152
152
  enumerable: !1,
@@ -161,33 +161,33 @@ function ir() {
161
161
  configurable: !1,
162
162
  enumerable: !1,
163
163
  writable: !0,
164
- value: ee
164
+ value: Q
165
165
  }), Object.defineProperty(n, "_debugTask", {
166
166
  configurable: !1,
167
167
  enumerable: !1,
168
168
  writable: !0,
169
- value: Q
169
+ value: ee
170
170
  }), Object.freeze && (Object.freeze(n.props), Object.freeze(n)), n;
171
171
  }
172
- function c(n, h, S, _, ee, Q) {
173
- var P = h.children;
174
- if (P !== void 0)
172
+ function c(n, p, I, _, Q, ee) {
173
+ var C = p.children;
174
+ if (C !== void 0)
175
175
  if (_)
176
- if (Z(P)) {
177
- for (_ = 0; _ < P.length; _++)
178
- y(P[_]);
179
- Object.freeze && Object.freeze(P);
176
+ if (Z(C)) {
177
+ for (_ = 0; _ < C.length; _++)
178
+ y(C[_]);
179
+ Object.freeze && Object.freeze(C);
180
180
  } else
181
181
  console.error(
182
182
  "React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead."
183
183
  );
184
- else y(P);
185
- if (H.call(h, "key")) {
186
- P = e(n);
187
- var K = Object.keys(h).filter(function(G) {
184
+ else y(C);
185
+ if (W.call(p, "key")) {
186
+ C = e(n);
187
+ var K = Object.keys(p).filter(function(G) {
188
188
  return G !== "key";
189
189
  });
190
- _ = 0 < K.length ? "{key: someKey, " + K.join(": ..., ") + ": ...}" : "{key: someKey}", Y[P + _] || (K = 0 < K.length ? "{" + K.join(": ..., ") + ": ...}" : "{}", console.error(
190
+ _ = 0 < K.length ? "{key: someKey, " + K.join(": ..., ") + ": ...}" : "{key: someKey}", $[C + _] || (K = 0 < K.length ? "{" + K.join(": ..., ") + ": ...}" : "{}", console.error(
191
191
  `A props object containing a "key" prop is being spread into JSX:
192
192
  let props = %s;
193
193
  <%s {...props} />
@@ -195,75 +195,75 @@ React keys must be passed directly to JSX without using spread:
195
195
  let props = %s;
196
196
  <%s key={someKey} {...props} />`,
197
197
  _,
198
- P,
198
+ C,
199
199
  K,
200
- P
201
- ), Y[P + _] = !0);
200
+ C
201
+ ), $[C + _] = !0);
202
202
  }
203
- if (P = null, S !== void 0 && (a(S), P = "" + S), l(h) && (a(h.key), P = "" + h.key), "key" in h) {
204
- S = {};
205
- for (var te in h)
206
- te !== "key" && (S[te] = h[te]);
207
- } else S = h;
208
- return P && d(
209
- S,
203
+ if (C = null, I !== void 0 && (a(I), C = "" + I), l(p) && (a(p.key), C = "" + p.key), "key" in p) {
204
+ I = {};
205
+ for (var oe in p)
206
+ oe !== "key" && (I[oe] = p[oe]);
207
+ } else I = p;
208
+ return C && u(
209
+ I,
210
210
  typeof n == "function" ? n.displayName || n.name || "Unknown" : n
211
211
  ), x(
212
212
  n,
213
- P,
214
- S,
213
+ C,
214
+ I,
215
215
  r(),
216
- ee,
217
- Q
216
+ Q,
217
+ ee
218
218
  );
219
219
  }
220
220
  function y(n) {
221
- b(n) ? n._store && (n._store.validated = 1) : typeof n == "object" && n !== null && n.$$typeof === V && (n._payload.status === "fulfilled" ? b(n._payload.value) && n._payload.value._store && (n._payload.value._store.validated = 1) : n._store && (n._store.validated = 1));
221
+ E(n) ? n._store && (n._store.validated = 1) : typeof n == "object" && n !== null && n.$$typeof === U && (n._payload.status === "fulfilled" ? E(n._payload.value) && n._payload.value._store && (n._payload.value._store.validated = 1) : n._store && (n._store.validated = 1));
222
222
  }
223
- function b(n) {
224
- return typeof n == "object" && n !== null && n.$$typeof === I;
223
+ function E(n) {
224
+ return typeof n == "object" && n !== null && n.$$typeof === k;
225
225
  }
226
- var k = Zt, I = /* @__PURE__ */ Symbol.for("react.transitional.element"), u = /* @__PURE__ */ Symbol.for("react.portal"), f = /* @__PURE__ */ Symbol.for("react.fragment"), v = /* @__PURE__ */ Symbol.for("react.strict_mode"), D = /* @__PURE__ */ Symbol.for("react.profiler"), N = /* @__PURE__ */ Symbol.for("react.consumer"), w = /* @__PURE__ */ Symbol.for("react.context"), p = /* @__PURE__ */ Symbol.for("react.forward_ref"), T = /* @__PURE__ */ Symbol.for("react.suspense"), R = /* @__PURE__ */ Symbol.for("react.suspense_list"), L = /* @__PURE__ */ Symbol.for("react.memo"), V = /* @__PURE__ */ Symbol.for("react.lazy"), C = /* @__PURE__ */ Symbol.for("react.activity"), B = /* @__PURE__ */ Symbol.for("react.client.reference"), F = k.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE, H = Object.prototype.hasOwnProperty, Z = Array.isArray, U = console.createTask ? console.createTask : function() {
226
+ var g = tr, k = /* @__PURE__ */ Symbol.for("react.transitional.element"), m = /* @__PURE__ */ Symbol.for("react.portal"), f = /* @__PURE__ */ Symbol.for("react.fragment"), v = /* @__PURE__ */ Symbol.for("react.strict_mode"), D = /* @__PURE__ */ Symbol.for("react.profiler"), N = /* @__PURE__ */ Symbol.for("react.consumer"), b = /* @__PURE__ */ Symbol.for("react.context"), h = /* @__PURE__ */ Symbol.for("react.forward_ref"), j = /* @__PURE__ */ Symbol.for("react.suspense"), T = /* @__PURE__ */ Symbol.for("react.suspense_list"), L = /* @__PURE__ */ Symbol.for("react.memo"), U = /* @__PURE__ */ Symbol.for("react.lazy"), P = /* @__PURE__ */ Symbol.for("react.activity"), Y = /* @__PURE__ */ Symbol.for("react.client.reference"), F = g.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE, W = Object.prototype.hasOwnProperty, Z = Array.isArray, z = console.createTask ? console.createTask : function() {
227
227
  return null;
228
228
  };
229
- k = {
229
+ g = {
230
230
  react_stack_bottom_frame: function(n) {
231
231
  return n();
232
232
  }
233
233
  };
234
- var ae, oe = {}, A = k.react_stack_bottom_frame.bind(
235
- k,
234
+ var se, ae = {}, A = g.react_stack_bottom_frame.bind(
235
+ g,
236
236
  o
237
- )(), E = U(s(o)), Y = {};
238
- Ie.Fragment = f, Ie.jsx = function(n, h, S) {
237
+ )(), R = z(s(o)), $ = {};
238
+ Se.Fragment = f, Se.jsx = function(n, p, I) {
239
239
  var _ = 1e4 > F.recentlyCreatedOwnerStacks++;
240
240
  return c(
241
241
  n,
242
- h,
243
- S,
242
+ p,
243
+ I,
244
244
  !1,
245
245
  _ ? Error("react-stack-top-frame") : A,
246
- _ ? U(s(n)) : E
246
+ _ ? z(s(n)) : R
247
247
  );
248
- }, Ie.jsxs = function(n, h, S) {
248
+ }, Se.jsxs = function(n, p, I) {
249
249
  var _ = 1e4 > F.recentlyCreatedOwnerStacks++;
250
250
  return c(
251
251
  n,
252
- h,
253
- S,
252
+ p,
253
+ I,
254
254
  !0,
255
255
  _ ? Error("react-stack-top-frame") : A,
256
- _ ? U(s(n)) : E
256
+ _ ? z(s(n)) : R
257
257
  );
258
258
  };
259
- })()), Ie;
259
+ })()), Se;
260
260
  }
261
- var _t;
262
- function cr() {
263
- return _t || (_t = 1, process.env.NODE_ENV === "production" ? Me.exports = lr() : Me.exports = ir()), Me.exports;
261
+ var Mt;
262
+ function fr() {
263
+ return Mt || (Mt = 1, process.env.NODE_ENV === "production" ? Me.exports = ur() : Me.exports = mr()), Me.exports;
264
264
  }
265
- var i = cr();
266
- const Ae = 18, Oe = 12, Pt = 10, O = {
265
+ var i = fr();
266
+ const Ae = 18, Oe = 12, At = 10, O = {
267
267
  container: "directory-tree-container relative h-full transition-opacity duration-300 overflow-y-hidden pb-[3px] pr-[2px]",
268
268
  containerPending: "opacity-70",
269
269
  entry: "directory-tree-entry flex items-center cursor-pointer relative select-none text-xs leading-tight py-0.5",
@@ -286,9 +286,9 @@ const Ae = 18, Oe = 12, Pt = 10, O = {
286
286
  if (!e) return "";
287
287
  const t = e.split("?")[0].split("#")[0].split("/").pop() || e, a = t.lastIndexOf(".");
288
288
  return a <= 0 ? "" : t.slice(a + 1).toLowerCase();
289
- }, Dt = ({ isDirectory: e, isExpanded: t, showExpandIcons: a, useCanvasExpandIcons: s, expandIconSize: r }) => {
289
+ }, Ft = ({ isDirectory: e, isExpanded: t, showExpandIcons: a, useCanvasExpandIcons: s, expandIconSize: r }) => {
290
290
  const o = r ? { width: r, height: r } : void 0, l = r ? "" : "h-4 w-4";
291
- return !(a && e) || s ? /* @__PURE__ */ i.jsx("span", { className: l, style: o, "aria-hidden": "true" }) : t ? /* @__PURE__ */ i.jsx(sr, { className: l, style: o }) : /* @__PURE__ */ i.jsx(ar, { className: l, style: o });
291
+ return !(a && e) || s ? /* @__PURE__ */ i.jsx("span", { className: l, style: o, "aria-hidden": "true" }) : t ? /* @__PURE__ */ i.jsx(ir, { className: l, style: o }) : /* @__PURE__ */ i.jsx(cr, { className: l, style: o });
292
292
  }, Ve = (e, t) => {
293
293
  if (e == null || typeof e == "boolean") return null;
294
294
  if (typeof e == "function")
@@ -305,74 +305,74 @@ const Ae = 18, Oe = 12, Pt = 10, O = {
305
305
  return console.warn(`[DirectoryTree] Lazy component for "${t}". Not supported.`), null;
306
306
  }
307
307
  return e;
308
- }, dr = (e, t, a) => {
308
+ }, hr = (e, t, a) => {
309
309
  const s = (t || (a ? xe(a) : "")).toLowerCase(), r = (e || "").toLowerCase();
310
310
  if (r && r !== "application/octet-stream") {
311
311
  if (r === "text/markdown" || r === "text/x-markdown")
312
- return /* @__PURE__ */ i.jsx(xt, { className: "h-4 w-4 text-sky-500 dark:text-sky-400" });
312
+ return /* @__PURE__ */ i.jsx(bt, { className: "h-4 w-4 text-sky-500 dark:text-sky-400" });
313
313
  if (r === "application/pdf")
314
- return /* @__PURE__ */ i.jsx(vt, { className: "h-4 w-4 text-red-500 dark:text-red-400" });
314
+ return /* @__PURE__ */ i.jsx(gt, { className: "h-4 w-4 text-red-500 dark:text-red-400" });
315
315
  if (r.includes("excel") || r.includes("spreadsheet") || r.includes("google-apps.spreadsheet"))
316
- return /* @__PURE__ */ i.jsx(bt, { className: "h-4 w-4 text-emerald-600 dark:text-emerald-400" });
316
+ return /* @__PURE__ */ i.jsx(wt, { className: "h-4 w-4 text-emerald-600 dark:text-emerald-400" });
317
317
  if (r === "text/csv" || r === "text/tab-separated-values")
318
- return /* @__PURE__ */ i.jsx(gt, { className: "h-4 w-4 text-emerald-600 dark:text-emerald-400" });
318
+ return /* @__PURE__ */ i.jsx(kt, { className: "h-4 w-4 text-emerald-600 dark:text-emerald-400" });
319
319
  if (r.includes("word") || r.includes("msword") || r.includes("wordprocessingml") || r.includes("google-apps.document") || r === "application/rtf")
320
- return /* @__PURE__ */ i.jsx(wt, { className: "h-4 w-4 text-blue-600 dark:text-blue-400" });
320
+ return /* @__PURE__ */ i.jsx(Nt, { className: "h-4 w-4 text-blue-600 dark:text-blue-400" });
321
321
  if (r.includes("powerpoint") || r.includes("presentation") || r.includes("google-apps.presentation"))
322
- return /* @__PURE__ */ i.jsx(kt, { className: "h-4 w-4 text-orange-500 dark:text-orange-400" });
322
+ return /* @__PURE__ */ i.jsx(Et, { className: "h-4 w-4 text-orange-500 dark:text-orange-400" });
323
323
  if (r.startsWith("image/"))
324
- return /* @__PURE__ */ i.jsx(Nt, { className: "h-4 w-4 text-teal-500 dark:text-teal-400" });
324
+ return /* @__PURE__ */ i.jsx(It, { className: "h-4 w-4 text-teal-500 dark:text-teal-400" });
325
325
  if (r.startsWith("audio/"))
326
- return /* @__PURE__ */ i.jsx(Et, { className: "h-4 w-4 text-pink-500 dark:text-pink-400" });
326
+ return /* @__PURE__ */ i.jsx(St, { className: "h-4 w-4 text-pink-500 dark:text-pink-400" });
327
327
  if (r.startsWith("video/"))
328
- return /* @__PURE__ */ i.jsx(It, { className: "h-4 w-4 text-violet-500 dark:text-violet-400" });
328
+ return /* @__PURE__ */ i.jsx(jt, { className: "h-4 w-4 text-violet-500 dark:text-violet-400" });
329
329
  if (r.includes("zip") || r.includes("tar") || r.includes("compressed") || r.includes("archive"))
330
- return /* @__PURE__ */ i.jsx(St, { className: "h-4 w-4 text-amber-500 dark:text-amber-400" });
330
+ return /* @__PURE__ */ i.jsx(Tt, { className: "h-4 w-4 text-amber-500 dark:text-amber-400" });
331
331
  if (r === "application/json" || r.includes("javascript") || r.includes("typescript") || r.includes("xml") || r.startsWith("text/html") || r.startsWith("text/css") || r.includes("x-python") || r.includes("x-sh") || r.includes("x-go") || r.includes("x-rust"))
332
- return /* @__PURE__ */ i.jsx(jt, { className: "h-4 w-4 text-purple-500 dark:text-purple-400" });
332
+ return /* @__PURE__ */ i.jsx(Rt, { className: "h-4 w-4 text-purple-500 dark:text-purple-400" });
333
333
  if (r.startsWith("text/"))
334
- return /* @__PURE__ */ i.jsx(Tt, { className: "h-4 w-4 text-gray-500 dark:text-gray-400" });
334
+ return /* @__PURE__ */ i.jsx(Ct, { className: "h-4 w-4 text-gray-500 dark:text-gray-400" });
335
335
  }
336
336
  if (s) {
337
337
  if (s === "md" || s === "markdown" || s === "mdx")
338
- return /* @__PURE__ */ i.jsx(xt, { className: "h-4 w-4 text-sky-500 dark:text-sky-400" });
338
+ return /* @__PURE__ */ i.jsx(bt, { className: "h-4 w-4 text-sky-500 dark:text-sky-400" });
339
339
  if (s === "pdf")
340
- return /* @__PURE__ */ i.jsx(vt, { className: "h-4 w-4 text-red-500 dark:text-red-400" });
340
+ return /* @__PURE__ */ i.jsx(gt, { className: "h-4 w-4 text-red-500 dark:text-red-400" });
341
341
  if (["xls", "xlsx", "xlsm", "xlsb", "ods"].includes(s))
342
- return /* @__PURE__ */ i.jsx(bt, { className: "h-4 w-4 text-emerald-600 dark:text-emerald-400" });
342
+ return /* @__PURE__ */ i.jsx(wt, { className: "h-4 w-4 text-emerald-600 dark:text-emerald-400" });
343
343
  if (["csv", "tsv"].includes(s))
344
- return /* @__PURE__ */ i.jsx(gt, { className: "h-4 w-4 text-emerald-600 dark:text-emerald-400" });
344
+ return /* @__PURE__ */ i.jsx(kt, { className: "h-4 w-4 text-emerald-600 dark:text-emerald-400" });
345
345
  if (["doc", "docx", "rtf", "odt"].includes(s))
346
- return /* @__PURE__ */ i.jsx(wt, { className: "h-4 w-4 text-blue-600 dark:text-blue-400" });
346
+ return /* @__PURE__ */ i.jsx(Nt, { className: "h-4 w-4 text-blue-600 dark:text-blue-400" });
347
347
  if (["ppt", "pptx", "odp"].includes(s))
348
- return /* @__PURE__ */ i.jsx(kt, { className: "h-4 w-4 text-orange-500 dark:text-orange-400" });
348
+ return /* @__PURE__ */ i.jsx(Et, { className: "h-4 w-4 text-orange-500 dark:text-orange-400" });
349
349
  if (["png", "jpg", "jpeg", "gif", "svg", "webp", "ico", "bmp", "tiff", "avif"].includes(s))
350
- return /* @__PURE__ */ i.jsx(Nt, { className: "h-4 w-4 text-teal-500 dark:text-teal-400" });
350
+ return /* @__PURE__ */ i.jsx(It, { className: "h-4 w-4 text-teal-500 dark:text-teal-400" });
351
351
  if (["js", "mjs", "cjs", "ts", "tsx", "jsx", "json", "html", "htm", "css", "scss", "py", "go", "rs", "c", "cpp", "h", "hpp", "sh", "bash", "yaml", "yml", "sql", "xml", "toml"].includes(s))
352
- return /* @__PURE__ */ i.jsx(jt, { className: "h-4 w-4 text-purple-500 dark:text-purple-400" });
352
+ return /* @__PURE__ */ i.jsx(Rt, { className: "h-4 w-4 text-purple-500 dark:text-purple-400" });
353
353
  if (["mp3", "wav", "ogg", "m4a", "flac", "aac", "wma"].includes(s))
354
- return /* @__PURE__ */ i.jsx(Et, { className: "h-4 w-4 text-pink-500 dark:text-pink-400" });
354
+ return /* @__PURE__ */ i.jsx(St, { className: "h-4 w-4 text-pink-500 dark:text-pink-400" });
355
355
  if (["mp4", "webm", "mov", "avi", "mkv", "wmv", "flv"].includes(s))
356
- return /* @__PURE__ */ i.jsx(It, { className: "h-4 w-4 text-violet-500 dark:text-violet-400" });
356
+ return /* @__PURE__ */ i.jsx(jt, { className: "h-4 w-4 text-violet-500 dark:text-violet-400" });
357
357
  if (["zip", "tar", "gz", "7z", "rar", "tgz", "bz2"].includes(s))
358
- return /* @__PURE__ */ i.jsx(St, { className: "h-4 w-4 text-amber-500 dark:text-amber-400" });
358
+ return /* @__PURE__ */ i.jsx(Tt, { className: "h-4 w-4 text-amber-500 dark:text-amber-400" });
359
359
  if (["txt", "log"].includes(s))
360
- return /* @__PURE__ */ i.jsx(Tt, { className: "h-4 w-4 text-gray-500 dark:text-gray-400" });
360
+ return /* @__PURE__ */ i.jsx(Ct, { className: "h-4 w-4 text-gray-500 dark:text-gray-400" });
361
361
  }
362
- return /* @__PURE__ */ i.jsx(or, { className: "h-4 w-4 text-gray-400 dark:text-gray-400" });
363
- }, Lt = (e, t) => {
362
+ return /* @__PURE__ */ i.jsx(dr, { className: "h-4 w-4 text-gray-400 dark:text-gray-400" });
363
+ }, $t = (e, t) => {
364
364
  const { entry: a, isDirectory: s, isExpanded: r, extension: o, mimeType: l } = e;
365
- let d;
366
- const g = l || a.mimeType;
367
- return a.icon !== void 0 ? d = a.icon : s ? d = r && t?.directoryExpanded || t?.directory || /* @__PURE__ */ i.jsx(nr, { className: "h-4 w-4" }) : o && t?.fileByExtension?.[o] ? d = t.fileByExtension[o] : d = t?.file || dr(g, o, a.name), Ve(typeof d == "function" ? d(e) : d, a.absolutePath);
368
- }, ur = 500, Ft = ({ entry: e, isDirectory: t, isExpanded: a, isItemSelected: s, selectionMode: r, onSelectionChange: o, onEntryClick: l, toggleDirectory: d, onToggleDirectoryRecursive: g }) => {
365
+ let u;
366
+ const w = l || a.mimeType;
367
+ return a.icon !== void 0 ? u = a.icon : s ? u = r && t?.directoryExpanded || t?.directory || /* @__PURE__ */ i.jsx(lr, { className: "h-4 w-4" }) : o && t?.fileByExtension?.[o] ? u = t.fileByExtension[o] : u = t?.file || hr(w, o, a.name), Ve(typeof u == "function" ? u(e) : u, a.absolutePath);
368
+ }, pr = 500, Ht = ({ entry: e, isDirectory: t, isExpanded: a, isItemSelected: s, selectionMode: r, onSelectionChange: o, onEntryClick: l, toggleDirectory: u, onToggleDirectoryRecursive: w }) => {
369
369
  const x = ce(null);
370
370
  return de(
371
371
  () => () => {
372
372
  x.current && window.clearTimeout(x.current);
373
373
  },
374
374
  []
375
- ), W(
375
+ ), B(
376
376
  (c) => {
377
377
  c.stopPropagation(), r !== "none" && !t && o && o(e, !s);
378
378
  let y = !1;
@@ -383,16 +383,16 @@ const Ae = 18, Oe = 12, Pt = 10, O = {
383
383
  preventDefault: () => {
384
384
  y = !0;
385
385
  }
386
- }), !(!t || y) && (x.current ? (window.clearTimeout(x.current), x.current = null, g(e)) : x.current = window.setTimeout(() => {
387
- d(e.absolutePath), x.current = null;
388
- }, ur));
386
+ }), !(!t || y) && (x.current ? (window.clearTimeout(x.current), x.current = null, w(e)) : x.current = window.setTimeout(() => {
387
+ u(e.absolutePath), x.current = null;
388
+ }, pr));
389
389
  },
390
- [t, e, a, g, d, l, r, o, s]
390
+ [t, e, a, w, u, l, r, o, s]
391
391
  );
392
- }, $t = (e) => e === "right" ? "dt-grid-cell--right" : e === "center" ? "dt-grid-cell--center" : "", Mt = (e, t) => e.children !== void 0 && t(e.absolutePath), Ht = (e, t) => ({
392
+ }, Wt = (e) => e === "right" ? "dt-grid-cell--right" : e === "center" ? "dt-grid-cell--center" : "", Ot = (e, t) => e.children !== void 0 && t(e.absolutePath), Bt = (e, t) => ({
393
393
  width: e,
394
394
  gridTemplateColumns: t
395
- }), Wt = ze(
395
+ }), Yt = ze(
396
396
  ({
397
397
  entry: e,
398
398
  indentLevel: t,
@@ -401,59 +401,59 @@ const Ae = 18, Oe = 12, Pt = 10, O = {
401
401
  columns: r,
402
402
  numericTemplate: o,
403
403
  numericTotal: l,
404
- nameWidth: d,
405
- rowClassName: g,
406
- selection: { onEntryClick: x, selectedPath: c, mode: y = "none", selectedItems: b, onSelectionChange: k },
407
- expansion: { toggleDirectory: I, onToggleDirectoryRecursive: u },
408
- visual: { iconOverrides: f, showExpandIcons: v = !0, showDirectoryIcons: D = !0, showFileIcons: N = !0, useCanvasExpandIcons: w = !1, expandIconSize: p, indentSize: T = Oe, highlightStyles: R }
404
+ nameWidth: u,
405
+ rowClassName: w,
406
+ selection: { onEntryClick: x, selectedPath: c, mode: y = "none", selectedItems: E, onSelectionChange: g },
407
+ expansion: { toggleDirectory: k, onToggleDirectoryRecursive: m },
408
+ visual: { iconOverrides: f, showExpandIcons: v = !0, showDirectoryIcons: D = !0, showFileIcons: N = !0, useCanvasExpandIcons: b = !1, expandIconSize: h, indentSize: j = Oe, highlightStyles: T }
409
409
  }) => {
410
- const [L, V] = se(!1), C = e.children !== void 0, B = C && s(e.absolutePath), F = e.absolutePath === c, H = !C && !!b?.has(e.absolutePath), Z = C ? void 0 : xe(e.name) || xe(e.relativePath) || xe(e.absolutePath), U = Ft({ entry: e, isDirectory: C, isExpanded: B, isItemSelected: H, selectionMode: y, onSelectionChange: k, onEntryClick: x, toggleDirectory: I, onToggleDirectoryRecursive: u }), ae = L ? R?.hoverClassName !== void 0 ? R.hoverClassName : O.entryHover : "", oe = (() => {
411
- if (C) {
412
- if (F) return R?.directorySelectedClassName !== void 0 ? R.directorySelectedClassName : O.entrySelected;
413
- } else if (F || H)
414
- return R?.itemSelectedClassName !== void 0 ? R.itemSelectedClassName : M(F && O.entrySelected, H && O.entryItemSelected);
410
+ const [L, U] = ne(!1), P = e.children !== void 0, Y = P && s(e.absolutePath), F = e.absolutePath === c, W = !P && !!E?.has(e.absolutePath), Z = P ? void 0 : xe(e.name) || xe(e.relativePath) || xe(e.absolutePath), z = Ht({ entry: e, isDirectory: P, isExpanded: Y, isItemSelected: W, selectionMode: y, onSelectionChange: g, onEntryClick: x, toggleDirectory: k, onToggleDirectoryRecursive: m }), se = L ? T?.hoverClassName !== void 0 ? T.hoverClassName : O.entryHover : "", ae = (() => {
411
+ if (P) {
412
+ if (F) return T?.directorySelectedClassName !== void 0 ? T.directorySelectedClassName : O.entrySelected;
413
+ } else if (F || W)
414
+ return T?.itemSelectedClassName !== void 0 ? T.itemSelectedClassName : M(F && O.entrySelected, W && O.entryItemSelected);
415
415
  return "";
416
- })(), A = typeof g == "function" ? g(e) : g, E = M("dt-grid-row cursor-pointer select-none", ae, oe, A, e.className), Y = M(O.expandIcon, (F || H) && O.expandIconSelected), n = M(O.typeIcon, (F || H) && O.typeIconSelected), h = M("dt-grid-name-label ml-1", "text-gray-700 dark:text-gray-200", C && O.nameDirectory, (F || H) && O.nameSelected), S = Dt({ isDirectory: C, isExpanded: B, showExpandIcons: v, useCanvasExpandIcons: w, expandIconSize: p }), _ = (C ? D : N) ? Lt({ entry: e, isDirectory: C, isExpanded: B, isSelected: F, isItemSelected: H, extension: Z, mimeType: e.mimeType }, f) : null, ee = { indentLevel: t, isDirectory: C, isExpanded: B }, [Q, ...P] = r, K = Q?.render ? Q.render(e, ee) : e.label ?? e.name, te = {
417
- ...L ? R?.hoverStyle : {},
418
- ...C && F ? R?.directorySelectedStyle : {},
419
- ...!C && (F || H) ? R?.itemSelectedStyle : {}
416
+ })(), A = typeof w == "function" ? w(e) : w, R = M("dt-grid-row cursor-pointer select-none", se, ae, A, e.className), $ = M(O.expandIcon, (F || W) && O.expandIconSelected), n = M(O.typeIcon, (F || W) && O.typeIconSelected), p = M("dt-grid-name-label ml-1", "text-gray-700 dark:text-gray-200", P && O.nameDirectory, (F || W) && O.nameSelected), I = Ft({ isDirectory: P, isExpanded: Y, showExpandIcons: v, useCanvasExpandIcons: b, expandIconSize: h }), _ = (P ? D : N) ? $t({ entry: e, isDirectory: P, isExpanded: Y, isSelected: F, isItemSelected: W, extension: Z, mimeType: e.mimeType }, f) : null, Q = { indentLevel: t, isDirectory: P, isExpanded: Y }, [ee, ...C] = r, K = ee?.render ? ee.render(e, Q) : e.label ?? e.name, oe = {
417
+ ...L ? T?.hoverStyle : {},
418
+ ...P && F ? T?.directorySelectedStyle : {},
419
+ ...!P && (F || W) ? T?.itemSelectedStyle : {}
420
420
  };
421
421
  return /* @__PURE__ */ i.jsxs(
422
422
  "div",
423
423
  {
424
- className: E,
425
- style: { height: a, ...te, ...e.style },
424
+ className: R,
425
+ style: { height: a, ...oe, ...e.style },
426
426
  role: "row",
427
- "aria-expanded": C ? B : void 0,
427
+ "aria-expanded": P ? Y : void 0,
428
428
  "aria-level": t + 1,
429
- "data-entry-type": C ? "directory" : "file",
430
- "data-entry-expanded": C ? String(B) : void 0,
429
+ "data-entry-type": P ? "directory" : "file",
430
+ "data-entry-expanded": P ? String(Y) : void 0,
431
431
  "data-entry-selected": F ? "true" : void 0,
432
- "data-entry-item-selected": H ? "true" : void 0,
433
- onClick: U,
434
- onMouseEnter: () => V(!0),
435
- onMouseLeave: () => V(!1),
436
- onKeyDown: (G) => G.key === "Enter" && U(G),
432
+ "data-entry-item-selected": W ? "true" : void 0,
433
+ onClick: z,
434
+ onMouseEnter: () => U(!0),
435
+ onMouseLeave: () => U(!1),
436
+ onKeyDown: (G) => G.key === "Enter" && z(G),
437
437
  tabIndex: 0,
438
438
  children: [
439
- /* @__PURE__ */ i.jsxs("div", { className: M("dt-grid-name-cell", Q?.className), role: "gridcell", style: { width: d, paddingLeft: Math.max(0, t * T) }, children: [
440
- (v || w) && /* @__PURE__ */ i.jsx("span", { className: Y, children: S }),
441
- (C ? D : N) && /* @__PURE__ */ i.jsx("span", { className: n, children: _ }),
442
- /* @__PURE__ */ i.jsx("span", { className: h, children: K })
439
+ /* @__PURE__ */ i.jsxs("div", { className: M("dt-grid-name-cell", ee?.className), role: "gridcell", style: { width: u, paddingLeft: Math.max(0, t * j) }, children: [
440
+ (v || b) && /* @__PURE__ */ i.jsx("span", { className: $, children: I }),
441
+ (P ? D : N) && /* @__PURE__ */ i.jsx("span", { className: n, children: _ }),
442
+ /* @__PURE__ */ i.jsx("span", { className: p, children: K })
443
443
  ] }),
444
- P.length > 0 && /* @__PURE__ */ i.jsx("div", { className: "dt-grid-numeric-viewport", children: /* @__PURE__ */ i.jsx("div", { className: "dt-grid-numeric-track", style: Ht(l, o), children: P.map((G) => /* @__PURE__ */ i.jsx("div", { className: M("dt-grid-cell", $t(G.align), G.className), role: "gridcell", children: G.render ? G.render(e, ee) : null }, G.key)) }) })
444
+ C.length > 0 && /* @__PURE__ */ i.jsx("div", { className: "dt-grid-numeric-viewport", children: /* @__PURE__ */ i.jsx("div", { className: "dt-grid-numeric-track", style: Bt(l, o), children: C.map((G) => /* @__PURE__ */ i.jsx("div", { className: M("dt-grid-cell", Wt(G.align), G.className), role: "gridcell", children: G.render ? G.render(e, Q) : null }, G.key)) }) })
445
445
  ]
446
446
  }
447
447
  );
448
448
  },
449
449
  (e, t) => {
450
450
  if (e.entry !== t.entry) return !1;
451
- const a = Mt(e.entry, e.isDirOpen), s = Mt(t.entry, t.isDirOpen);
451
+ const a = Ot(e.entry, e.isDirOpen), s = Ot(t.entry, t.isDirOpen);
452
452
  return e.indentLevel === t.indentLevel && e.rowHeight === t.rowHeight && a === s && e.columns === t.columns && e.numericTemplate === t.numericTemplate && e.numericTotal === t.numericTotal && e.nameWidth === t.nameWidth && e.rowClassName === t.rowClassName && e.selection.selectedPath === t.selection.selectedPath && e.selection.mode === t.selection.mode && e.selection.selectedItems === t.selection.selectedItems && e.visual === t.visual;
453
453
  }
454
454
  );
455
- Wt.displayName = "DirectoryTreeGridRow";
456
- const Bt = ({
455
+ Yt.displayName = "DirectoryTreeGridRow";
456
+ const Gt = ({
457
457
  kind: e,
458
458
  columns: t,
459
459
  numericTemplate: a,
@@ -461,28 +461,28 @@ const Bt = ({
461
461
  nameWidth: r,
462
462
  scrollBarWidth: o,
463
463
  className: l,
464
- nameContent: d,
465
- renderCell: g
464
+ nameContent: u,
465
+ renderCell: w
466
466
  }) => {
467
- const [, ...x] = t, c = e === "header" ? "dt-grid-name-header" : "dt-grid-name-footer", y = e === "header" ? "dt-grid-header" : "dt-grid-footer", b = e === "header" ? "columnheader" : "gridcell";
467
+ const [, ...x] = t, c = e === "header" ? "dt-grid-name-header" : "dt-grid-name-footer", y = e === "header" ? "dt-grid-header" : "dt-grid-footer", E = e === "header" ? "columnheader" : "gridcell";
468
468
  return /* @__PURE__ */ i.jsxs("div", { className: M(y, "text-gray-600 dark:text-gray-300", l), role: "row", children: [
469
- /* @__PURE__ */ i.jsx("div", { className: M(c, "px-1", t[0]?.className), role: b, style: { width: r }, children: d }),
470
- x.length > 0 && /* @__PURE__ */ i.jsx("div", { className: "dt-grid-numeric-viewport", children: /* @__PURE__ */ i.jsx("div", { className: "dt-grid-numeric-track", style: Ht(s, a), children: x.map((k) => /* @__PURE__ */ i.jsx("div", { className: M("dt-grid-cell", $t(k.align), k.className), role: b, children: g(k) }, k.key)) }) }),
469
+ /* @__PURE__ */ i.jsx("div", { className: M(c, "px-1", t[0]?.className), role: E, style: { width: r }, children: u }),
470
+ x.length > 0 && /* @__PURE__ */ i.jsx("div", { className: "dt-grid-numeric-viewport", children: /* @__PURE__ */ i.jsx("div", { className: "dt-grid-numeric-track", style: Bt(s, a), children: x.map((g) => /* @__PURE__ */ i.jsx("div", { className: M("dt-grid-cell", Wt(g.align), g.className), role: E, children: w(g) }, g.key)) }) }),
471
471
  /* @__PURE__ */ i.jsx("div", { className: "dt-grid-scrollbar-spacer", style: { width: o }, "aria-hidden": "true" })
472
472
  ] });
473
- }, mr = ({ columns: e, className: t, ...a }) => /* @__PURE__ */ i.jsx(Bt, { kind: "header", columns: e, className: t, nameContent: e[0]?.header ?? null, renderCell: (s) => s.header ?? null, ...a }), At = (e, t) => typeof e == "function" ? e(t) : e ?? null, fr = ({ columns: e, allEntries: t, className: a, ...s }) => /* @__PURE__ */ i.jsx(Bt, { kind: "footer", columns: e, className: a, nameContent: At(e[0]?.footer, t), renderCell: (r) => At(r.footer, t), ...s }), hr = 240, Yt = 96, Gt = 12, Ue = (e, t) => {
473
+ }, yr = ({ columns: e, className: t, ...a }) => /* @__PURE__ */ i.jsx(Gt, { kind: "header", columns: e, className: t, nameContent: e[0]?.header ?? null, renderCell: (s) => s.header ?? null, ...a }), Dt = (e, t) => typeof e == "function" ? e(t) : e ?? null, xr = ({ columns: e, allEntries: t, className: a, ...s }) => /* @__PURE__ */ i.jsx(Gt, { kind: "footer", columns: e, className: a, nameContent: Dt(e[0]?.footer, t), renderCell: (r) => Dt(r.footer, t), ...s }), vr = 240, Vt = 96, Ut = 12, Ue = (e, t) => {
474
474
  const a = e?.width;
475
475
  return typeof a == "number" && Number.isFinite(a) && a > 0 ? a : t;
476
- }, pr = (e) => e.slice(1).map((t) => `${Ue(t, Yt)}px`).join(" "), yr = ({ measuredWidth: e, columns: t, scrollBarWidth: a = Gt }) => {
477
- const s = Ue(t[0], hr), r = t.slice(1).reduce((g, x) => g + Ue(x, Yt), 0), o = Number.isFinite(e) && e > 0 ? e : 0, l = Math.max(0, o - s - Math.max(0, a)), d = Math.max(0, r - l);
478
- return { nameWidth: s, numericTotal: r, numericVisible: l, maxHScroll: d };
479
- }, Ge = (e, t) => !Number.isFinite(e) || e < 0 ? 0 : e > t ? t : e, xr = (e) => {
476
+ }, br = (e) => e.slice(1).map((t) => `${Ue(t, Vt)}px`).join(" "), gr = ({ measuredWidth: e, columns: t, scrollBarWidth: a = Ut }) => {
477
+ const s = Ue(t[0], vr), r = t.slice(1).reduce((w, x) => w + Ue(x, Vt), 0), o = Number.isFinite(e) && e > 0 ? e : 0, l = Math.max(0, o - s - Math.max(0, a)), u = Math.max(0, r - l);
478
+ return { nameWidth: s, numericTotal: r, numericVisible: l, maxHScroll: u };
479
+ }, Ge = (e, t) => !Number.isFinite(e) || e < 0 ? 0 : e > t ? t : e, wr = (e) => {
480
480
  const t = [], a = (s) => {
481
481
  for (const r of s)
482
482
  t.push(r), r.children && r.children.length > 0 && a(r.children);
483
483
  };
484
484
  return a(e), t;
485
- }, vr = (e, t) => {
485
+ }, kr = (e, t) => {
486
486
  const a = e.length - 1;
487
487
  if (a <= 0) return 0;
488
488
  let s = 0, r = a - 1, o = 0;
@@ -491,22 +491,22 @@ const Bt = ({
491
491
  e[l] <= t ? (o = l, s = l + 1) : r = l - 1;
492
492
  }
493
493
  return o;
494
- }, br = (e, t, a) => {
494
+ }, Nr = (e, t, a) => {
495
495
  if (a <= 0 || e.length === 0 || t.length !== e.length + 1)
496
496
  return null;
497
- const s = vr(t, a), r = e[s];
497
+ const s = kr(t, a), r = e[s];
498
498
  return r ? {
499
499
  path: r.entry.absolutePath,
500
500
  offsetInViewport: a - t[s]
501
501
  } : null;
502
- }, gr = (e, t, a) => {
502
+ }, Er = (e, t, a) => {
503
503
  if (t.length === 0 || a.length !== t.length + 1)
504
504
  return null;
505
505
  for (let s = 0; s < t.length; s++)
506
506
  if (t[s].entry.absolutePath === e.path)
507
507
  return Math.max(0, a[s] + e.offsetInViewport);
508
508
  return null;
509
- }, wr = (e, t, a) => {
509
+ }, Ir = (e, t, a) => {
510
510
  const s = [];
511
511
  for (let r = t; r < a; r++) {
512
512
  const o = e[r];
@@ -515,7 +515,7 @@ const Bt = ({
515
515
  s.push(l);
516
516
  }
517
517
  return s;
518
- }, kr = (e, t, a) => {
518
+ }, Sr = (e, t, a) => {
519
519
  const s = [];
520
520
  for (let r = t; r < a; r++) {
521
521
  const o = e[r];
@@ -524,36 +524,36 @@ const Bt = ({
524
524
  s.push(l);
525
525
  }
526
526
  return s;
527
- }, Nr = (e, t, a, s) => {
527
+ }, jr = (e, t, a, s) => {
528
528
  const r = Math.max(1, Math.floor(t * s)), o = Math.max(1, Math.floor(a * s));
529
529
  (e.width !== r || e.height !== o) && (e.width = r, e.height = o);
530
530
  const l = e.style;
531
531
  l.width !== `${t}px` && (l.width = `${t}px`), l.height !== `${a}px` && (l.height = `${a}px`);
532
- }, Er = (e, t, a) => {
532
+ }, Tr = (e, t, a) => {
533
533
  e.lineWidth = a, e.beginPath();
534
534
  for (const s of t)
535
535
  e.moveTo(s.x1, s.y1), e.lineTo(s.x2, s.y2);
536
536
  e.stroke();
537
- }, Ir = (e, t) => {
537
+ }, Rr = (e, t) => {
538
538
  const a = /^#([0-9a-f]{3}|[0-9a-f]{6})$/i.exec(e.trim());
539
539
  if (!a)
540
540
  return null;
541
541
  let s = a[1];
542
- s.length === 3 && (s = s.split("").map((d) => d + d).join(""));
542
+ s.length === 3 && (s = s.split("").map((u) => u + u).join(""));
543
543
  const r = Number.parseInt(s.slice(0, 2), 16), o = Number.parseInt(s.slice(2, 4), 16), l = Number.parseInt(s.slice(4, 6), 16);
544
544
  return `rgba(${r}, ${o}, ${l}, ${t})`;
545
- }, Sr = (e, t, a, s) => {
545
+ }, Cr = (e, t, a, s) => {
546
546
  if (t.length === 0)
547
547
  return;
548
- const r = Ir(a, 0.14), o = e.strokeStyle, l = e.fillStyle, d = e.lineWidth, g = e.lineCap, x = e.lineJoin;
548
+ const r = Rr(a, 0.14), o = e.strokeStyle, l = e.fillStyle, u = e.lineWidth, w = e.lineCap, x = e.lineJoin;
549
549
  e.strokeStyle = a, e.lineCap = "round", e.lineJoin = "round";
550
550
  for (const c of t) {
551
- const y = s ?? c.size, b = Math.max(0, y / 2), k = Math.max(1, Math.round(y * 0.08)), I = Math.max(1, Math.round(y * 0.14)), u = Math.max(0, b - k * 0.8), f = Math.max(0, u * 0.55);
552
- r && (e.fillStyle = r, e.beginPath(), e.arc(c.centerX, c.centerY, u, 0, Math.PI * 2), e.fill()), e.lineWidth = k, e.beginPath(), e.arc(c.centerX, c.centerY, Math.max(0, b - k * 0.3), 0, Math.PI * 2), e.stroke(), e.lineWidth = I, e.beginPath(), e.moveTo(c.centerX - f, c.centerY), e.lineTo(c.centerX + f, c.centerY), e.stroke(), c.isExpanded || (e.beginPath(), e.moveTo(c.centerX, c.centerY - f), e.lineTo(c.centerX, c.centerY + f), e.stroke());
551
+ const y = s ?? c.size, E = Math.max(0, y / 2), g = Math.max(1, Math.round(y * 0.08)), k = Math.max(1, Math.round(y * 0.14)), m = Math.max(0, E - g * 0.8), f = Math.max(0, m * 0.55);
552
+ r && (e.fillStyle = r, e.beginPath(), e.arc(c.centerX, c.centerY, m, 0, Math.PI * 2), e.fill()), e.lineWidth = g, e.beginPath(), e.arc(c.centerX, c.centerY, Math.max(0, E - g * 0.3), 0, Math.PI * 2), e.stroke(), e.lineWidth = k, e.beginPath(), e.moveTo(c.centerX - f, c.centerY), e.lineTo(c.centerX + f, c.centerY), e.stroke(), c.isExpanded || (e.beginPath(), e.moveTo(c.centerX, c.centerY - f), e.lineTo(c.centerX, c.centerY + f), e.stroke());
553
553
  }
554
- e.strokeStyle = o, e.fillStyle = l, e.lineWidth = d, e.lineCap = g, e.lineJoin = x;
555
- }, Vt = ze(({ segmentsByItem: e, glyphsByItem: t, itemHeight: a, width: s, viewportHeight: r, scrollPosition: o, color: l = "#a0aec0", strokeWidth: d = 1, renderStartIndex: g, renderEndIndex: x, lookaheadEndIndex: c, devicePixelRatio: y, expandGlyphColor: b, expandGlyphSize: k }) => {
556
- const I = ce(null), u = ce(null), f = ce({
554
+ e.strokeStyle = o, e.fillStyle = l, e.lineWidth = u, e.lineCap = w, e.lineJoin = x;
555
+ }, zt = ze(({ segmentsByItem: e, glyphsByItem: t, itemHeight: a, width: s, viewportHeight: r, scrollPosition: o, color: l = "#a0aec0", strokeWidth: u = 1, renderStartIndex: w, renderEndIndex: x, lookaheadEndIndex: c, devicePixelRatio: y, expandGlyphColor: E, expandGlyphSize: g }) => {
556
+ const k = ce(null), m = ce(null), f = ce({
557
557
  segmentsByItem: e,
558
558
  glyphsByItem: t,
559
559
  itemHeight: a,
@@ -561,44 +561,44 @@ const Bt = ({
561
561
  viewportHeight: r,
562
562
  scrollPosition: o,
563
563
  color: l,
564
- strokeWidth: d,
565
- renderStartIndex: g,
564
+ strokeWidth: u,
565
+ renderStartIndex: w,
566
566
  renderEndIndex: x,
567
567
  lookaheadEndIndex: c,
568
568
  devicePixelRatio: y,
569
- expandGlyphColor: b,
570
- expandGlyphSize: k
571
- }), v = W(() => {
572
- u.current = null;
573
- const N = I.current;
569
+ expandGlyphColor: E,
570
+ expandGlyphSize: g
571
+ }), v = B(() => {
572
+ m.current = null;
573
+ const N = k.current;
574
574
  if (!N)
575
575
  return;
576
- const w = N.getContext("2d");
577
- if (!w)
576
+ const b = N.getContext("2d");
577
+ if (!b)
578
578
  return;
579
- const p = f.current;
580
- if (p.width <= 0 || p.viewportHeight <= 0) {
581
- w.clearRect(0, 0, N.width, N.height);
579
+ const h = f.current;
580
+ if (h.width <= 0 || h.viewportHeight <= 0) {
581
+ b.clearRect(0, 0, N.width, N.height);
582
582
  return;
583
583
  }
584
- const T = Number.isFinite(p.devicePixelRatio ?? NaN) ? p.devicePixelRatio : typeof window < "u" && window.devicePixelRatio || 1;
585
- Nr(N, p.width, p.viewportHeight, T);
586
- const R = p.segmentsByItem.length, L = typeof p.renderStartIndex == "number" && Number.isFinite(p.renderStartIndex) ? Math.max(0, Math.floor(p.renderStartIndex)) : Math.max(0, Math.floor(p.scrollPosition / p.itemHeight)), V = Math.min(R, Math.ceil((p.scrollPosition + p.viewportHeight) / p.itemHeight)), C = (() => {
587
- if (typeof p.renderEndIndex == "number" && Number.isFinite(p.renderEndIndex)) {
588
- const Z = Math.floor(p.renderEndIndex);
589
- return Math.max(Math.min(R, Z + 1), L);
584
+ const j = Number.isFinite(h.devicePixelRatio ?? NaN) ? h.devicePixelRatio : typeof window < "u" && window.devicePixelRatio || 1;
585
+ jr(N, h.width, h.viewportHeight, j);
586
+ const T = h.segmentsByItem.length, L = typeof h.renderStartIndex == "number" && Number.isFinite(h.renderStartIndex) ? Math.max(0, Math.floor(h.renderStartIndex)) : Math.max(0, Math.floor(h.scrollPosition / h.itemHeight)), U = Math.min(T, Math.ceil((h.scrollPosition + h.viewportHeight) / h.itemHeight)), P = (() => {
587
+ if (typeof h.renderEndIndex == "number" && Number.isFinite(h.renderEndIndex)) {
588
+ const Z = Math.floor(h.renderEndIndex);
589
+ return Math.max(Math.min(T, Z + 1), L);
590
590
  }
591
- return Math.max(V, L);
592
- })(), B = (() => {
593
- if (typeof p.lookaheadEndIndex == "number" && Number.isFinite(p.lookaheadEndIndex)) {
594
- const Z = Math.floor(p.lookaheadEndIndex), U = Math.min(R, Z + 1);
595
- return Math.max(U, C);
591
+ return Math.max(U, L);
592
+ })(), Y = (() => {
593
+ if (typeof h.lookaheadEndIndex == "number" && Number.isFinite(h.lookaheadEndIndex)) {
594
+ const Z = Math.floor(h.lookaheadEndIndex), z = Math.min(T, Z + 1);
595
+ return Math.max(z, P);
596
596
  }
597
- return Math.max(V, C);
598
- })(), F = wr(p.segmentsByItem, L, B), H = kr(p.glyphsByItem, L, B);
599
- w.save(), w.scale(T, T), w.clearRect(0, 0, p.width, p.viewportHeight), w.translate(0, -p.scrollPosition), w.strokeStyle = p.color, Er(w, F, p.strokeWidth), Sr(w, H, p.expandGlyphColor ?? p.color, p.expandGlyphSize), w.restore();
600
- }, []), D = W(() => {
601
- u.current === null && (u.current = window.requestAnimationFrame(v));
597
+ return Math.max(U, P);
598
+ })(), F = Ir(h.segmentsByItem, L, Y), W = Sr(h.glyphsByItem, L, Y);
599
+ b.save(), b.scale(j, j), b.clearRect(0, 0, h.width, h.viewportHeight), b.translate(0, -h.scrollPosition), b.strokeStyle = h.color, Tr(b, F, h.strokeWidth), Cr(b, W, h.expandGlyphColor ?? h.color, h.expandGlyphSize), b.restore();
600
+ }, []), D = B(() => {
601
+ m.current === null && (m.current = window.requestAnimationFrame(v));
602
602
  }, [v]);
603
603
  return de(() => {
604
604
  f.current = {
@@ -609,47 +609,48 @@ const Bt = ({
609
609
  viewportHeight: r,
610
610
  scrollPosition: o,
611
611
  color: l,
612
- strokeWidth: d,
613
- renderStartIndex: g,
612
+ strokeWidth: u,
613
+ renderStartIndex: w,
614
614
  renderEndIndex: x,
615
615
  lookaheadEndIndex: c,
616
616
  devicePixelRatio: y,
617
- expandGlyphColor: b,
618
- expandGlyphSize: k
617
+ expandGlyphColor: E,
618
+ expandGlyphSize: g
619
619
  }, D();
620
- }, [e, t, a, s, r, o, l, d, g, x, c, y, b, k, D]), de(() => () => {
621
- u.current !== null && (window.cancelAnimationFrame(u.current), u.current = null);
622
- }, []), /* @__PURE__ */ i.jsx("canvas", { ref: I, className: "pointer-events-none absolute top-0 left-0 z-0" });
620
+ }, [e, t, a, s, r, o, l, u, w, x, c, y, E, g, D]), de(() => () => {
621
+ m.current !== null && (window.cancelAnimationFrame(m.current), m.current = null);
622
+ }, []), /* @__PURE__ */ i.jsx("canvas", { ref: k, className: "pointer-events-none absolute top-0 left-0 z-0" });
623
623
  });
624
- Vt.displayName = "TreeLineCanvas";
625
- const jr = {
624
+ zt.displayName = "TreeLineCanvas";
625
+ const Pr = {
626
626
  msOverflowStyle: "none",
627
627
  scrollbarWidth: "none"
628
- }, Tr = () => {
628
+ }, _r = () => {
629
629
  let e = document.getElementById("directory-tree-webkit-scrollbar-hide");
630
630
  e || (e = document.createElement("style"), e.id = "directory-tree-webkit-scrollbar-hide", e.textContent = ".directory-tree-container::-webkit-scrollbar { display: none; }", document.head.appendChild(e));
631
- }, Rr = (e, t, a, s) => {
632
- const r = [], o = [];
633
- let l = 0;
634
- const d = (g, x, c) => {
635
- for (let y = 0; y < g.length; y++) {
636
- const b = g[y], k = y === g.length - 1, I = [...c, k], u = b.children !== void 0, f = u && t(b.absolutePath, b.relativePath);
637
- let v = x, D = I, N = c;
638
- s && (v = x - 1, D = I.slice(1), N = c.slice(1)), r.push({ entry: b, indentLevel: v, parentIsLast: D }), a && (v > l && (l = v), o.push({
639
- id: b.absolutePath,
640
- name: b.name,
641
- absolutePath: b.absolutePath,
642
- indentLevel: v,
643
- isLastChild: k,
644
- isDirectory: u,
645
- isExpanded: f,
646
- ancestorIsLast: [...N],
647
- hideLines: s && x === 0
648
- })), u && f && b.children && d(b.children, x + 1, I);
631
+ }, Mr = (e, t, a, s, r) => {
632
+ const o = [], l = [];
633
+ let u = 0;
634
+ const w = (x, c, y) => {
635
+ const E = r ? [...x].sort(r) : x;
636
+ for (let g = 0; g < E.length; g++) {
637
+ const k = E[g], m = g === E.length - 1, f = [...y, m], v = k.children !== void 0, D = v && t(k.absolutePath, k.relativePath);
638
+ let N = c, b = f, h = y;
639
+ s && (N = c - 1, b = f.slice(1), h = y.slice(1)), o.push({ entry: k, indentLevel: N, parentIsLast: b }), a && (N > u && (u = N), l.push({
640
+ id: k.absolutePath,
641
+ name: k.name,
642
+ absolutePath: k.absolutePath,
643
+ indentLevel: N,
644
+ isLastChild: m,
645
+ isDirectory: v,
646
+ isExpanded: D,
647
+ ancestorIsLast: [...h],
648
+ hideLines: s && c === 0
649
+ })), v && D && k.children && w(k.children, c + 1, f);
649
650
  }
650
651
  };
651
- return d(e, 0, []), { flatItems: r, lineItems: o, maxIndent: l };
652
- }, Ot = (e, t) => {
652
+ return w(e, 0, []), { flatItems: o, lineItems: l, maxIndent: u };
653
+ }, Lt = (e, t) => {
653
654
  const a = e.length - 1;
654
655
  if (a <= 0) return 0;
655
656
  let s = 0, r = a - 1, o = 0;
@@ -658,94 +659,94 @@ const jr = {
658
659
  e[l] <= t ? (o = l, s = l + 1) : r = l - 1;
659
660
  }
660
661
  return o;
661
- }, Cr = (e, t, a, s, r, o) => {
662
- const l = s?.renderStart ?? Math.max(0, Ot(o, r)), d = t > 0 ? Ot(o, r + t) + a : l + a, g = e > 0 ? Math.min(e - 1, Math.max(l, d)) : l, x = s?.renderEnd ?? g, c = e > 0 ? Math.min(e - 1, x + a) : x;
662
+ }, Ar = (e, t, a, s, r, o) => {
663
+ const l = s?.renderStart ?? Math.max(0, Lt(o, r)), u = t > 0 ? Lt(o, r + t) + a : l + a, w = e > 0 ? Math.min(e - 1, Math.max(l, u)) : l, x = s?.renderEnd ?? w, c = e > 0 ? Math.min(e - 1, x + a) : x;
663
664
  return { renderStart: l, renderEnd: x, lookaheadEnd: c };
664
- }, _r = (e, t, a, s, r, o) => {
665
+ }, Or = (e, t, a, s, r, o) => {
665
666
  if (e.length === 0)
666
667
  return { segmentsByItem: [], glyphsByItem: [] };
667
- const l = Array.from({ length: e.length }, () => []), d = Array.from({ length: e.length }, () => []), g = (c) => r ? typeof o == "number" && Number.isFinite(o) && o > 0 ? o : Math.max(8, Math.min(s * 0.9, c * 0.7)) : 0, x = 3;
668
+ const l = Array.from({ length: e.length }, () => []), u = Array.from({ length: e.length }, () => []), w = (c) => r ? typeof o == "number" && Number.isFinite(o) && o > 0 ? o : Math.max(8, Math.min(s * 0.9, c * 0.7)) : 0, x = 3;
668
669
  for (let c = 0; c < e.length; c++) {
669
670
  const y = e[c];
670
671
  if (y.hideLines)
671
672
  continue;
672
- const b = [], k = t[c] ?? 0, I = a[c] ?? 0, u = I + k / 2, f = g(k), v = f > 0 ? f / 2 + 2 : s / 1.5;
673
- for (let w = 0; w < y.indentLevel; w++) {
674
- if (y.ancestorIsLast[w] ?? !1)
673
+ const E = [], g = t[c] ?? 0, k = a[c] ?? 0, m = k + g / 2, f = w(g), v = f > 0 ? f / 2 + 2 : s / 1.5;
674
+ for (let b = 0; b < y.indentLevel; b++) {
675
+ if (y.ancestorIsLast[b] ?? !1)
675
676
  continue;
676
- let T = !1;
677
- for (let R = c; R < e.length; R++) {
678
- const L = e[R];
679
- if (L.indentLevel > w && L.ancestorIsLast.length > w && !L.ancestorIsLast[w]) {
680
- T = !0;
677
+ let j = !1;
678
+ for (let T = c; T < e.length; T++) {
679
+ const L = e[T];
680
+ if (L.indentLevel > b && L.ancestorIsLast.length > b && !L.ancestorIsLast[b]) {
681
+ j = !0;
681
682
  break;
682
683
  }
683
- if (R > c && L.indentLevel === w)
684
+ if (T > c && L.indentLevel === b)
684
685
  break;
685
686
  }
686
- if (T) {
687
- const R = w * s + s / 2 + x;
688
- b.push({
689
- key: `${y.id}-ancestor-${w}`,
690
- x1: R,
691
- y1: I,
692
- x2: R,
693
- y2: I + k,
687
+ if (j) {
688
+ const T = b * s + s / 2 + x;
689
+ E.push({
690
+ key: `${y.id}-ancestor-${b}`,
691
+ x1: T,
692
+ y1: k,
693
+ x2: T,
694
+ y2: k + g,
694
695
  itemIndex: c
695
696
  });
696
697
  }
697
698
  }
698
699
  const D = y.indentLevel * s, N = D + s / 2 + x;
699
- if (y.isDirectory ? b.push({
700
+ if (y.isDirectory ? E.push({
700
701
  key: `${y.id}-connector-top`,
701
702
  x1: N,
702
- y1: I,
703
+ y1: k,
703
704
  x2: N,
704
- y2: u - v,
705
+ y2: m - v,
705
706
  itemIndex: c
706
- }) : b.push({
707
+ }) : E.push({
707
708
  key: `${y.id}-connector-top`,
708
709
  x1: N,
709
- y1: I,
710
+ y1: k,
710
711
  x2: N,
711
- y2: u,
712
+ y2: m,
712
713
  itemIndex: c
713
- }), !y.isDirectory && y.isLastChild && b.push({
714
+ }), !y.isDirectory && y.isLastChild && E.push({
714
715
  key: `${y.id}-connector-horizontal`,
715
716
  x1: N,
716
- y1: u,
717
+ y1: m,
717
718
  x2: D + s + x,
718
- y2: u,
719
+ y2: m,
719
720
  itemIndex: c
720
- }), y.isLastChild || (y.isDirectory ? b.push({
721
+ }), y.isLastChild || (y.isDirectory ? E.push({
721
722
  key: `${y.id}-connector-bottom`,
722
723
  x1: N,
723
- y1: u + v,
724
+ y1: m + v,
724
725
  x2: N,
725
- y2: I + k,
726
+ y2: k + g,
726
727
  itemIndex: c
727
- }) : b.push({
728
+ }) : E.push({
728
729
  key: `${y.id}-connector-bottom`,
729
730
  x1: N,
730
- y1: u,
731
+ y1: m,
731
732
  x2: N,
732
- y2: I + k,
733
+ y2: k + g,
733
734
  itemIndex: c
734
- })), l[c] = b, r && y.isDirectory) {
735
- const w = f, p = N, T = u;
736
- d[c] = [
735
+ })), l[c] = E, r && y.isDirectory) {
736
+ const b = f, h = N, j = m;
737
+ u[c] = [
737
738
  {
738
739
  key: `${y.id}-glyph`,
739
740
  itemIndex: c,
740
- centerX: p,
741
- centerY: T,
742
- size: w,
741
+ centerX: h,
742
+ centerY: j,
743
+ size: b,
743
744
  isExpanded: y.isExpanded
744
745
  }
745
746
  ];
746
747
  }
747
748
  }
748
- return { segmentsByItem: l, glyphsByItem: d };
749
+ return { segmentsByItem: l, glyphsByItem: u };
749
750
  }, Xe = ze(
750
751
  ({
751
752
  entry: e,
@@ -754,85 +755,85 @@ const jr = {
754
755
  isDirOpen: s,
755
756
  parentIsLast: r,
756
757
  renderChildren: o = !0,
757
- expansion: { toggleDirectory: l, onToggleDirectoryRecursive: d },
758
- selection: { onEntryClick: g, selectedPath: x, mode: c = "none", selectedItems: y, onSelectionChange: b },
758
+ expansion: { toggleDirectory: l, onToggleDirectoryRecursive: u },
759
+ selection: { onEntryClick: w, selectedPath: x, mode: c = "none", selectedItems: y, onSelectionChange: E },
759
760
  visual: {
760
- iconOverrides: k,
761
- showExpandIcons: I = !0,
762
- showDirectoryIcons: u = !0,
761
+ iconOverrides: g,
762
+ showExpandIcons: k = !0,
763
+ showDirectoryIcons: m = !0,
763
764
  showFileIcons: f = !0,
764
765
  useCanvasExpandIcons: v = !1,
765
766
  expandIconSize: D,
766
767
  typeIconSize: N,
767
- fontSize: w,
768
- indentSize: p = Oe,
769
- highlightStyles: T,
770
- entryClassName: R,
768
+ fontSize: b,
769
+ indentSize: h = Oe,
770
+ highlightStyles: j,
771
+ entryClassName: T,
771
772
  entryStyle: L,
772
- nameClassName: V,
773
- nameStyle: C,
774
- directoryNameClassName: B,
773
+ nameClassName: U,
774
+ nameStyle: P,
775
+ directoryNameClassName: Y,
775
776
  directoryNameStyle: F,
776
- fileNameClassName: H,
777
+ fileNameClassName: W,
777
778
  fileNameStyle: Z
778
779
  }
779
780
  }) => {
780
- const [U, ae] = se(null), [oe, A] = se(!1), E = e.children !== void 0, Y = E && s(e.absolutePath), n = e.absolutePath === x, h = !E && y?.has(e.absolutePath), S = E ? void 0 : xe(e.name) || xe(e.relativePath) || xe(e.absolutePath);
781
+ const [z, se] = ne(null), [ae, A] = ne(!1), R = e.children !== void 0, $ = R && s(e.absolutePath), n = e.absolutePath === x, p = !R && y?.has(e.absolutePath), I = R ? void 0 : xe(e.name) || xe(e.relativePath) || xe(e.absolutePath);
781
782
  de(() => {
782
- ae(Y && e.children ? e.children : null);
783
- }, [Y, e.children]);
784
- const _ = Ft({ entry: e, isDirectory: E, isExpanded: Y, isItemSelected: !!h, selectionMode: c, onSelectionChange: b, onEntryClick: g, toggleDirectory: l, onToggleDirectoryRecursive: d }), ee = oe ? T?.hoverClassName !== void 0 ? T.hoverClassName : O.entryHover : "", Q = (() => {
785
- if (E) {
783
+ se($ && e.children ? e.children : null);
784
+ }, [$, e.children]);
785
+ const _ = Ht({ entry: e, isDirectory: R, isExpanded: $, isItemSelected: !!p, selectionMode: c, onSelectionChange: E, onEntryClick: w, toggleDirectory: l, onToggleDirectoryRecursive: u }), Q = ae ? j?.hoverClassName !== void 0 ? j.hoverClassName : O.entryHover : "", ee = (() => {
786
+ if (R) {
786
787
  if (n)
787
- return T?.directorySelectedClassName !== void 0 ? T.directorySelectedClassName : O.entrySelected;
788
- } else if (n || h)
789
- return T?.itemSelectedClassName !== void 0 ? T.itemSelectedClassName : M(n && O.entrySelected, h && O.entryItemSelected);
788
+ return j?.directorySelectedClassName !== void 0 ? j.directorySelectedClassName : O.entrySelected;
789
+ } else if (n || p)
790
+ return j?.itemSelectedClassName !== void 0 ? j.itemSelectedClassName : M(n && O.entrySelected, p && O.entryItemSelected);
790
791
  return "";
791
- })(), P = M(O.entry, ee, Q, R, e.className), K = M(O.expandIcon, (n || h) && O.expandIconSelected), te = M(O.typeIcon, (n || h) && O.typeIconSelected), G = M(O.name, V, E && O.nameDirectory, E && B, !E && H, (n || h) && O.nameSelected), Se = Dt({ isDirectory: E, isExpanded: Y, showExpandIcons: I, useCanvasExpandIcons: v, expandIconSize: D }), De = (E ? u : f) ? Lt({ entry: e, isDirectory: E, isExpanded: Y, isSelected: n, isItemSelected: !!h, extension: S, mimeType: e.mimeType }, k) : null, ve = {
792
- ...oe ? T?.hoverStyle : {},
793
- ...E && n ? T?.directorySelectedStyle : {},
794
- ...!E && (n || h) ? T?.itemSelectedStyle : {}
795
- }, je = N ? { width: N, height: N } : void 0, Ne = w ? { fontSize: typeof w == "number" ? `${w}px` : w } : void 0;
796
- return /* @__PURE__ */ i.jsxs(Kt, { children: [
792
+ })(), C = M(O.entry, Q, ee, T, e.className), K = M(O.expandIcon, (n || p) && O.expandIconSelected), oe = M(O.typeIcon, (n || p) && O.typeIconSelected), G = M(O.name, U, R && O.nameDirectory, R && Y, !R && W, (n || p) && O.nameSelected), Ne = Ft({ isDirectory: R, isExpanded: $, showExpandIcons: k, useCanvasExpandIcons: v, expandIconSize: D }), je = (R ? m : f) ? $t({ entry: e, isDirectory: R, isExpanded: $, isSelected: n, isItemSelected: !!p, extension: I, mimeType: e.mimeType }, g) : null, De = {
793
+ ...ae ? j?.hoverStyle : {},
794
+ ...R && n ? j?.directorySelectedStyle : {},
795
+ ...!R && (n || p) ? j?.itemSelectedStyle : {}
796
+ }, ve = N ? { width: N, height: N } : void 0, Ee = b ? { fontSize: typeof b == "number" ? `${b}px` : b } : void 0;
797
+ return /* @__PURE__ */ i.jsxs(nr, { children: [
797
798
  /* @__PURE__ */ i.jsxs(
798
799
  "div",
799
800
  {
800
- className: P,
801
+ className: C,
801
802
  style: {
802
- paddingLeft: `${Math.max(0, t * p)}px`,
803
- transform: t < 0 ? `translateX(${t * p}px)` : void 0,
804
- width: t < 0 ? `calc(100% + ${Math.abs(t * p)}px)` : void 0,
803
+ paddingLeft: `${Math.max(0, t * h)}px`,
804
+ transform: t < 0 ? `translateX(${t * h}px)` : void 0,
805
+ width: t < 0 ? `calc(100% + ${Math.abs(t * h)}px)` : void 0,
805
806
  height: `${a}px`,
806
- ...Ne,
807
- ...ve,
807
+ ...Ee,
808
+ ...De,
808
809
  ...L,
809
810
  ...e.style
810
811
  },
811
- "data-entry-type": E ? "directory" : "file",
812
- "data-entry-expanded": E ? String(Y) : void 0,
812
+ "data-entry-type": R ? "directory" : "file",
813
+ "data-entry-expanded": R ? String($) : void 0,
813
814
  "data-entry-selected": n ? "true" : void 0,
814
- "data-entry-item-selected": h ? "true" : void 0,
815
+ "data-entry-item-selected": p ? "true" : void 0,
815
816
  onClick: _,
816
817
  onMouseEnter: () => A(!0),
817
818
  onMouseLeave: () => A(!1),
818
819
  onKeyDown: (ue) => ue.key === "Enter" && _(ue),
819
820
  tabIndex: 0,
820
821
  role: "treeitem",
821
- "aria-expanded": E ? Y : void 0,
822
- "aria-label": `${e.name} (${E ? "directory" : "file"})`,
822
+ "aria-expanded": R ? $ : void 0,
823
+ "aria-label": `${e.name} (${R ? "directory" : "file"})`,
823
824
  children: [
824
- (I || v) && /* @__PURE__ */ i.jsx("span", { className: K, children: Se }),
825
- (E ? u : f) && /* @__PURE__ */ i.jsx("span", { className: te, style: je, children: De }),
825
+ (k || v) && /* @__PURE__ */ i.jsx("span", { className: K, children: Ne }),
826
+ (R ? m : f) && /* @__PURE__ */ i.jsx("span", { className: oe, style: ve, children: je }),
826
827
  /* @__PURE__ */ i.jsx(
827
828
  "span",
828
829
  {
829
830
  className: G,
830
831
  style: {
831
- ...Ne,
832
- ...C,
833
- ...E ? F : Z
832
+ ...Ee,
833
+ ...P,
834
+ ...R ? F : Z
834
835
  },
835
- "data-entry-type": E ? "directory" : "file",
836
+ "data-entry-type": R ? "directory" : "file",
836
837
  "data-entry-role": "name",
837
838
  children: e.label ?? e.name
838
839
  }
@@ -840,31 +841,31 @@ const jr = {
840
841
  ]
841
842
  }
842
843
  ),
843
- Y && U && o && /* @__PURE__ */ i.jsx("fieldset", { children: U.map((ue, Te) => /* @__PURE__ */ i.jsx(
844
+ $ && z && o && /* @__PURE__ */ i.jsx("fieldset", { children: z.map((ue, Te) => /* @__PURE__ */ i.jsx(
844
845
  Xe,
845
846
  {
846
847
  entry: ue,
847
848
  indentLevel: t + 1,
848
849
  rowHeight: a,
849
850
  isDirOpen: s,
850
- parentIsLast: [...r, Te === U.length - 1],
851
- expansion: { toggleDirectory: l, onToggleDirectoryRecursive: d },
852
- selection: { onEntryClick: g, selectedPath: x, mode: c, selectedItems: y, onSelectionChange: b },
851
+ parentIsLast: [...r, Te === z.length - 1],
852
+ expansion: { toggleDirectory: l, onToggleDirectoryRecursive: u },
853
+ selection: { onEntryClick: w, selectedPath: x, mode: c, selectedItems: y, onSelectionChange: E },
853
854
  visual: {
854
- iconOverrides: k,
855
- showExpandIcons: I,
856
- showDirectoryIcons: u,
855
+ iconOverrides: g,
856
+ showExpandIcons: k,
857
+ showDirectoryIcons: m,
857
858
  showFileIcons: f,
858
859
  useCanvasExpandIcons: v,
859
860
  expandIconSize: D,
860
- highlightStyles: T,
861
- entryClassName: R,
861
+ highlightStyles: j,
862
+ entryClassName: T,
862
863
  entryStyle: L,
863
- nameClassName: V,
864
- nameStyle: C,
865
- directoryNameClassName: B,
864
+ nameClassName: U,
865
+ nameStyle: P,
866
+ directoryNameClassName: Y,
866
867
  directoryNameStyle: F,
867
- fileNameClassName: H,
868
+ fileNameClassName: W,
868
869
  fileNameStyle: Z
869
870
  }
870
871
  },
@@ -875,345 +876,349 @@ const jr = {
875
876
  (e, t) => {
876
877
  if (e.entry !== t.entry) return !1;
877
878
  const a = e.entry.children !== void 0, s = t.entry.children !== void 0, r = a && e.isDirOpen(e.entry.absolutePath), o = s && t.isDirOpen(t.entry.absolutePath);
878
- return e.indentLevel === t.indentLevel && e.rowHeight === t.rowHeight && r === o && e.selection.selectedPath === t.selection.selectedPath && e.selection.mode === t.selection.mode && e.selection.selectedItems === t.selection.selectedItems && e.visual.iconOverrides === t.visual.iconOverrides && e.visual.showExpandIcons === t.visual.showExpandIcons && e.visual.showDirectoryIcons === t.visual.showDirectoryIcons && e.visual.showFileIcons === t.visual.showFileIcons && e.visual.useCanvasExpandIcons === t.visual.useCanvasExpandIcons && e.visual.expandIconSize === t.visual.expandIconSize && e.visual.highlightStyles === t.visual.highlightStyles && e.visual.entryClassName === t.visual.entryClassName && e.visual.entryStyle === t.visual.entryStyle && e.visual.nameClassName === t.visual.nameClassName && e.visual.nameStyle === t.visual.nameStyle && e.visual.directoryNameClassName === t.visual.directoryNameClassName && e.visual.directoryNameStyle === t.visual.directoryNameStyle && e.visual.fileNameClassName === t.visual.fileNameClassName && e.visual.fileNameStyle === t.visual.fileNameStyle && e.parentIsLast.length === t.parentIsLast.length && e.parentIsLast.every((l, d) => l === t.parentIsLast[d]);
879
+ return e.indentLevel === t.indentLevel && e.rowHeight === t.rowHeight && r === o && e.selection.selectedPath === t.selection.selectedPath && e.selection.mode === t.selection.mode && e.selection.selectedItems === t.selection.selectedItems && e.visual.iconOverrides === t.visual.iconOverrides && e.visual.showExpandIcons === t.visual.showExpandIcons && e.visual.showDirectoryIcons === t.visual.showDirectoryIcons && e.visual.showFileIcons === t.visual.showFileIcons && e.visual.useCanvasExpandIcons === t.visual.useCanvasExpandIcons && e.visual.expandIconSize === t.visual.expandIconSize && e.visual.highlightStyles === t.visual.highlightStyles && e.visual.entryClassName === t.visual.entryClassName && e.visual.entryStyle === t.visual.entryStyle && e.visual.nameClassName === t.visual.nameClassName && e.visual.nameStyle === t.visual.nameStyle && e.visual.directoryNameClassName === t.visual.directoryNameClassName && e.visual.directoryNameStyle === t.visual.directoryNameStyle && e.visual.fileNameClassName === t.visual.fileNameClassName && e.visual.fileNameStyle === t.visual.fileNameStyle && e.parentIsLast.length === t.parentIsLast.length && e.parentIsLast.every((l, u) => l === t.parentIsLast[u]);
879
880
  }
880
881
  );
881
882
  Xe.displayName = "DirectoryEntryItem";
882
- const Ut = (e) => {
883
+ const Xt = (e) => {
883
884
  const t = [];
884
885
  if (e.children)
885
886
  for (const a of e.children)
886
- a.type === "directory" && (t.push(a.absolutePath), t.push(...Ut(a)));
887
+ a.type === "directory" && (t.push(a.absolutePath), t.push(...Xt(a)));
887
888
  return t;
888
- }, Lr = ({
889
+ }, Wr = ({
889
890
  entries: e,
890
- expansion: { toggle: t, isExpanded: a, expandMultiple: s, collapseMultiple: r, isPending: o, alwaysExpanded: l = !1, doubleClickAction: d = "recursive" },
891
- selection: { onEntryClick: g, selectedPath: x, mode: c = "none", selectedItems: y, onSelectionChange: b },
891
+ expansion: { toggle: t, isExpanded: a, expandMultiple: s, collapseMultiple: r, isPending: o, alwaysExpanded: l = !1, doubleClickAction: u = "recursive" },
892
+ selection: { onEntryClick: w, selectedPath: x, mode: c = "none", selectedItems: y, onSelectionChange: E },
892
893
  visual: {
893
- className: k,
894
- style: I,
895
- lineColor: u = "#A0AEC0",
894
+ className: g,
895
+ style: k,
896
+ lineColor: m = "#A0AEC0",
896
897
  showTreeLines: f = !0,
897
898
  showExpandIcons: v = !0,
898
899
  showDirectoryIcons: D = !0,
899
900
  showFileIcons: N = !0,
900
- iconOverrides: w,
901
- expandIconSize: p,
902
- itemHeight: T = Ae,
903
- removeRootIndent: R = !1,
901
+ iconOverrides: b,
902
+ expandIconSize: h,
903
+ itemHeight: j = Ae,
904
+ removeRootIndent: T = !1,
904
905
  highlightStyles: L,
905
- entryClassName: V,
906
- entryStyle: C,
907
- nameClassName: B,
906
+ entryClassName: U,
907
+ entryStyle: P,
908
+ nameClassName: Y,
908
909
  nameStyle: F,
909
- directoryNameClassName: H,
910
+ directoryNameClassName: W,
910
911
  directoryNameStyle: Z,
911
- fileNameClassName: U,
912
- fileNameStyle: ae
912
+ fileNameClassName: z,
913
+ fileNameStyle: se
913
914
  } = {},
914
- virtualScroll: oe,
915
- grid: A
915
+ virtualScroll: ae,
916
+ grid: A,
917
+ sort: R
916
918
  }) => {
917
- const E = A !== void 0, [Y, n] = se(!1), h = ce(null), S = ce(null), _ = ce(null), [ee, Q] = se(0), [P, K] = se(0), [te, G] = se(0), [Se, De] = se(null), {
919
+ const $ = A !== void 0, [n, p] = ne(!1), I = ce(null), _ = ce(null), Q = ce(null), [ee, C] = ne(0), [K, oe] = ne(0), [G, Ne] = ne(0), [je, De] = ne(null), {
918
920
  overscanCount: ve = 15,
919
- className: je,
920
- background: Ne,
921
- onScroll: ue,
922
- onRangeChange: Te,
923
- initialScrollIndex: Je,
921
+ className: Ee,
922
+ background: ue,
923
+ onScroll: Te,
924
+ onRangeChange: Je,
925
+ initialScrollIndex: qe,
924
926
  initialScrollOffset: le,
925
- callbackThrottleMs: qe = 5,
927
+ callbackThrottleMs: Ze = 5,
926
928
  contentInsets: be,
927
- onItemFocus: Ze,
928
- viewportHeightOverride: ne,
929
+ onItemFocus: Ke,
930
+ viewportHeightOverride: re,
929
931
  scrollBarOptions: Le,
930
932
  behaviorOptions: Qe,
931
- preserveScrollAnchor: Ke = !1
932
- } = oe ?? {}, [Re, Fe] = se(typeof le == "number" ? le : 0), $e = ce(typeof le == "number" ? le : 0), et = W(
933
- (m, j) => {
934
- $e.current = m, Fe(m), ue?.(m, j);
935
- },
936
- [ue]
937
- ), tt = W(
938
- (m) => {
939
- const { renderingStartIndex: j, renderingEndIndex: $ } = m;
940
- De((X) => X && X.renderStart === j && X.renderEnd === $ ? X : { renderStart: j, renderEnd: $ }), Te?.(m);
933
+ preserveScrollAnchor: et = !1,
934
+ getItemKey: Jt
935
+ } = ae ?? {}, [Re, Fe] = ne(typeof le == "number" ? le : 0), $e = ce(typeof le == "number" ? le : 0), tt = B(
936
+ (d, S) => {
937
+ $e.current = d, Fe(d), Te?.(d, S);
941
938
  },
942
939
  [Te]
940
+ ), rt = B(
941
+ (d) => {
942
+ const { renderingStartIndex: S, renderingEndIndex: H } = d;
943
+ De((J) => J && J.renderStart === S && J.renderEnd === H ? J : { renderStart: S, renderEnd: H }), Je?.(d);
944
+ },
945
+ [Je]
943
946
  );
944
947
  de(() => {
945
948
  typeof le == "number" && Fe(le);
946
949
  }, [le]), de(() => {
947
- n(!0), Tr();
950
+ p(!0), _r();
948
951
  }, []), de(() => {
949
- const m = h.current, j = E ? S.current : m, $ = () => {
950
- if (m) {
951
- const re = m.clientWidth;
952
- K((ie) => Math.abs(ie - re) > 1 ? re : ie);
952
+ const d = I.current, S = $ ? _.current : d, H = () => {
953
+ if (d) {
954
+ const te = d.clientWidth;
955
+ oe((ie) => Math.abs(ie - te) > 1 ? te : ie);
953
956
  }
954
- if (typeof ne == "number")
955
- Q((re) => Math.abs(re - ne) > 1 ? ne : re);
956
- else if (j) {
957
- const re = j.clientHeight;
958
- Q((ie) => Math.abs(ie - re) > 1 ? re : ie);
957
+ if (typeof re == "number")
958
+ C((te) => Math.abs(te - re) > 1 ? re : te);
959
+ else if (S) {
960
+ const te = S.clientHeight;
961
+ C((ie) => Math.abs(ie - te) > 1 ? te : ie);
959
962
  }
960
963
  };
961
- if (!(m || j)) return Q(0);
962
- $();
963
- const X = new ResizeObserver($);
964
- return m && X.observe(m), j && j !== m && X.observe(j), () => X.disconnect();
965
- }, [ne, E]);
966
- const me = typeof ne == "number" ? ne : ee, fe = W((m) => l || (Y ? a(m) : !1), [Y, a, l]), rt = M(O.container, o && O.containerPending, k), nt = q(
964
+ if (!(d || S)) return C(0);
965
+ H();
966
+ const J = new ResizeObserver(H);
967
+ return d && J.observe(d), S && S !== d && J.observe(S), () => J.disconnect();
968
+ }, [re, $]);
969
+ const me = typeof re == "number" ? re : ee, fe = B((d) => l || (n ? a(d) : !1), [n, a, l]), nt = M(O.container, o && O.containerPending, g), st = q(
967
970
  () => ({
968
- ...jr,
969
- ...I ?? {},
970
- ...typeof ne == "number" ? { height: ne, minHeight: ne } : {}
971
+ ...Pr,
972
+ ...k ?? {},
973
+ ...typeof re == "number" ? { height: re, minHeight: re } : {}
971
974
  }),
972
- [I, ne]
973
- ), He = W(
974
- (m, j) => {
975
- const $ = [m.absolutePath, ...Ut(m)], X = j || d;
976
- if ($.every((ke) => fe(ke))) return r($);
977
- if ($.every((ke) => !fe(ke)) || X === "recursive") return s($);
978
- if (X === "toggle") return r($);
979
- console.warn(`[DirectoryTree] Unknown double click action: ${X}. No action taken.`);
975
+ [k, re]
976
+ ), He = B(
977
+ (d, S) => {
978
+ const H = [d.absolutePath, ...Xt(d)], J = S || u;
979
+ if (H.every((ke) => fe(ke))) return r(H);
980
+ if (H.every((ke) => !fe(ke)) || J === "recursive") return s(H);
981
+ if (J === "toggle") return r(H);
982
+ console.warn(`[DirectoryTree] Unknown double click action: ${J}. No action taken.`);
980
983
  },
981
- [fe, s, r, d]
982
- ), st = E ? !1 : R, { flatItems: at, lineItems: We, maxIndent: ot } = q(() => Rr(e, fe, f, st), [e, fe, f, st]), J = q(
983
- () => at.map((m, j) => {
984
- const $ = typeof T == "function" ? T(m.entry, j) : T;
985
- return { ...m, rowHeight: Number.isFinite($) && $ > 0 ? $ : Ae };
984
+ [fe, s, r, u]
985
+ ), at = $ ? !1 : T, { flatItems: ot, lineItems: We, maxIndent: lt } = q(() => Mr(e, fe, f, at, R), [e, fe, f, at, R]), V = q(
986
+ () => ot.map((d, S) => {
987
+ const H = typeof j == "function" ? j(d.entry, S) : j;
988
+ return { ...d, rowHeight: Number.isFinite(H) && H > 0 ? H : Ae };
986
989
  }),
987
- [at, T]
988
- ), he = q(() => J.map((m) => m.rowHeight), [J]), ye = q(() => {
989
- const m = new Array(he.length + 1);
990
- m[0] = 0;
991
- for (let j = 0; j < he.length; j++)
992
- m[j + 1] = m[j] + he[j];
993
- return m;
994
- }, [he]), lt = W((m) => J[m]?.rowHeight ?? Ae, [J]), Ce = q(
995
- () => !f || We.length === 0 ? { segmentsByItem: [], glyphsByItem: [] } : _r(We, he, ye, Oe, f, p ?? Pt),
996
- [We, he, ye, f, p]
997
- ), _e = q(() => !f || e.length === 0 ? 0 : (ot + 2) * Oe, [e.length, ot, f]), { renderStart: it, renderEnd: ct, lookaheadEnd: dt } = q(
998
- () => Cr(J.length, me, ve, Se, Re, ye),
999
- [J.length, me, ve, Se, Re, ye]
1000
- ), Be = q(() => !f || _e <= 0 || me <= 0 || Ce.segmentsByItem.length === 0 ? null : /* @__PURE__ */ i.jsx("div", { className: "pointer-events-none absolute inset-0 z-0", "aria-hidden": "true", children: /* @__PURE__ */ i.jsx("div", { className: "absolute top-0 left-0", style: { width: _e, height: me }, children: /* @__PURE__ */ i.jsx(
1001
- Vt,
990
+ [ot, j]
991
+ ), he = q(() => V.map((d) => d.rowHeight), [V]), ye = q(() => {
992
+ const d = new Array(he.length + 1);
993
+ d[0] = 0;
994
+ for (let S = 0; S < he.length; S++)
995
+ d[S + 1] = d[S] + he[S];
996
+ return d;
997
+ }, [he]), it = B((d) => V[d]?.rowHeight ?? Ae, [V]), qt = B((d) => V[d]?.entry.absolutePath ?? d, [V]), ct = Jt ?? qt, Ce = q(
998
+ () => !f || We.length === 0 ? { segmentsByItem: [], glyphsByItem: [] } : Or(We, he, ye, Oe, f, h ?? At),
999
+ [We, he, ye, f, h]
1000
+ ), Pe = q(() => !f || e.length === 0 ? 0 : (lt + 2) * Oe, [e.length, lt, f]), { renderStart: dt, renderEnd: ut, lookaheadEnd: mt } = q(
1001
+ () => Ar(V.length, me, ve, je, Re, ye),
1002
+ [V.length, me, ve, je, Re, ye]
1003
+ ), Be = q(() => !f || Pe <= 0 || me <= 0 || Ce.segmentsByItem.length === 0 ? null : /* @__PURE__ */ i.jsx("div", { className: "pointer-events-none absolute inset-0 z-0", "aria-hidden": "true", children: /* @__PURE__ */ i.jsx("div", { className: "absolute top-0 left-0", style: { width: Pe, height: me }, children: /* @__PURE__ */ i.jsx(
1004
+ zt,
1002
1005
  {
1003
1006
  segmentsByItem: Ce.segmentsByItem,
1004
1007
  glyphsByItem: Ce.glyphsByItem,
1005
1008
  itemHeight: he[0] ?? Ae,
1006
- width: _e,
1009
+ width: Pe,
1007
1010
  viewportHeight: me,
1008
1011
  scrollPosition: Re,
1009
- color: u,
1010
- expandGlyphColor: u,
1011
- expandGlyphSize: p ?? Pt,
1012
- renderStartIndex: it,
1013
- renderEndIndex: ct,
1014
- lookaheadEndIndex: dt
1012
+ color: m,
1013
+ expandGlyphColor: m,
1014
+ expandGlyphSize: h ?? At,
1015
+ renderStartIndex: dt,
1016
+ renderEndIndex: ut,
1017
+ lookaheadEndIndex: mt
1015
1018
  }
1016
- ) }) }), [_e, me, it, ct, dt, Re, Ce, u, f, p, he]), ut = W((m) => J[m], [J]), mt = ce(null);
1017
- Qt(() => {
1018
- const m = mt.current;
1019
- if (mt.current = { items: J, offsets: ye }, !Ke || !m || m.items === J)
1019
+ ) }) }), [Pe, me, dt, ut, mt, Re, Ce, m, f, h, he]), ft = B((d) => V[d], [V]), ht = ce(null);
1020
+ rr(() => {
1021
+ const d = ht.current;
1022
+ if (ht.current = { items: V, offsets: ye }, !et || !d || d.items === V)
1020
1023
  return;
1021
- const j = _.current, $ = typeof be == "number" ? be : be?.top ?? 0, X = j ? j.getScrollPosition() : $e.current, re = X - $, ie = br(m.items, m.offsets, re);
1024
+ const S = Q.current, H = typeof be == "number" ? be : be?.top ?? 0, J = S ? S.getScrollPosition() : $e.current, te = J - H, ie = Nr(d.items, d.offsets, te);
1022
1025
  if (!ie)
1023
1026
  return;
1024
- const ke = gr(ie, J, ye);
1027
+ const ke = Er(ie, V, ye);
1025
1028
  if (ke === null)
1026
1029
  return;
1027
- const Ye = ke + $;
1028
- if (Math.abs(Ye - X) < 1)
1030
+ const Ye = ke + H;
1031
+ if (Math.abs(Ye - J) < 1)
1029
1032
  return;
1030
- const yt = j?.scrollTo(Ye) ?? Ye;
1031
- $e.current = yt, Fe(yt);
1032
- }, [J, ye, Ke, be]);
1033
- const pe = A?.columns, ge = A?.scrollBarWidth ?? Le?.width ?? Gt, z = q(() => pe ? yr({ measuredWidth: P, columns: pe, scrollBarWidth: ge }) : null, [pe, P, ge]), Pe = q(() => pe ? pr(pe) : "", [pe]), zt = q(() => A?.showFooter && pe ? xr(e) : [], [A?.showFooter, pe, e]), we = z?.maxHScroll ?? 0;
1033
+ const vt = S?.scrollTo(Ye) ?? Ye;
1034
+ $e.current = vt, Fe(vt);
1035
+ }, [V, ye, et, be]);
1036
+ const pe = A?.columns, ge = A?.scrollBarWidth ?? Le?.width ?? Ut, X = q(() => pe ? gr({ measuredWidth: K, columns: pe, scrollBarWidth: ge }) : null, [pe, K, ge]), _e = q(() => pe ? br(pe) : "", [pe]), Zt = q(() => A?.showFooter && pe ? wr(e) : [], [A?.showFooter, pe, e]), we = X?.maxHScroll ?? 0;
1034
1037
  de(() => {
1035
- G((m) => Ge(m, we));
1038
+ Ne((d) => Ge(d, we));
1036
1039
  }, [we]);
1037
- const ft = W((m) => G((j) => Ge(j + m, we)), [we]), ht = q(
1038
- () => ({ iconOverrides: w, showExpandIcons: v, showDirectoryIcons: D, showFileIcons: N, useCanvasExpandIcons: f, expandIconSize: p, highlightStyles: L }),
1039
- [w, v, D, N, f, p, L]
1040
- ), pt = q(
1040
+ const pt = B((d) => Ne((S) => Ge(S + d, we)), [we]), yt = q(
1041
+ () => ({ iconOverrides: b, showExpandIcons: v, showDirectoryIcons: D, showFileIcons: N, useCanvasExpandIcons: f, expandIconSize: h, highlightStyles: L }),
1042
+ [b, v, D, N, f, h, L]
1043
+ ), xt = q(
1041
1044
  () => /* @__PURE__ */ i.jsx(
1042
- tr,
1045
+ ar,
1043
1046
  {
1044
- ref: _,
1045
- itemCount: J.length,
1046
- getItem: ut,
1047
- getItemHeight: lt,
1047
+ ref: Q,
1048
+ itemCount: V.length,
1049
+ getItem: ft,
1050
+ getItemHeight: it,
1051
+ getItemKey: ct,
1048
1052
  viewportSize: me,
1049
1053
  overscanCount: ve,
1050
- onScroll: et,
1051
- onRangeChange: tt,
1052
- className: je,
1053
- onWheelHorizontal: E ? ft : void 0,
1054
+ onScroll: tt,
1055
+ onRangeChange: rt,
1056
+ className: Ee,
1057
+ onWheelHorizontal: $ ? pt : void 0,
1054
1058
  background: /* @__PURE__ */ i.jsxs(i.Fragment, { children: [
1055
- E && z ? (
1059
+ $ && X ? (
1056
1060
  // Clip the connector-line canvas to the frozen name column so deep trees never bleed into the numeric region.
1057
- /* @__PURE__ */ i.jsx("div", { className: "pointer-events-none absolute top-0 left-0 z-0 h-full overflow-hidden", style: { width: z.nameWidth }, "aria-hidden": "true", children: Be })
1061
+ /* @__PURE__ */ i.jsx("div", { className: "pointer-events-none absolute top-0 left-0 z-0 h-full overflow-hidden", style: { width: X.nameWidth }, "aria-hidden": "true", children: Be })
1058
1062
  ) : Be,
1059
- Ne
1063
+ ue
1060
1064
  ] }),
1061
- initialScrollIndex: Je,
1065
+ initialScrollIndex: qe,
1062
1066
  initialScrollOffset: le,
1063
- onItemFocus: Ze,
1064
- callbackThrottleMs: qe,
1067
+ onItemFocus: Ke,
1068
+ callbackThrottleMs: Ze,
1065
1069
  contentInsets: be,
1066
1070
  scrollBarOptions: Le,
1067
1071
  behaviorOptions: Qe,
1068
- children: (m) => m ? E && A && z ? /* @__PURE__ */ i.jsx(
1069
- Wt,
1072
+ children: (d) => d ? $ && A && X ? /* @__PURE__ */ i.jsx(
1073
+ Yt,
1070
1074
  {
1071
- entry: m.entry,
1072
- indentLevel: m.indentLevel,
1073
- rowHeight: m.rowHeight,
1075
+ entry: d.entry,
1076
+ indentLevel: d.indentLevel,
1077
+ rowHeight: d.rowHeight,
1074
1078
  isDirOpen: fe,
1075
1079
  columns: A.columns,
1076
- numericTemplate: Pe,
1077
- numericTotal: z.numericTotal,
1078
- nameWidth: z.nameWidth,
1080
+ numericTemplate: _e,
1081
+ numericTotal: X.numericTotal,
1082
+ nameWidth: X.nameWidth,
1079
1083
  rowClassName: A.rowClassName,
1080
- selection: { onEntryClick: g, selectedPath: x ?? null, mode: c, selectedItems: y, onSelectionChange: b },
1084
+ selection: { onEntryClick: w, selectedPath: x ?? null, mode: c, selectedItems: y, onSelectionChange: E },
1081
1085
  expansion: { toggleDirectory: t, onToggleDirectoryRecursive: He },
1082
- visual: ht
1086
+ visual: yt
1083
1087
  },
1084
- m.entry.absolutePath
1088
+ d.entry.absolutePath
1085
1089
  ) : /* @__PURE__ */ i.jsx(
1086
1090
  Xe,
1087
1091
  {
1088
- entry: m.entry,
1089
- indentLevel: m.indentLevel,
1090
- rowHeight: m.rowHeight,
1092
+ entry: d.entry,
1093
+ indentLevel: d.indentLevel,
1094
+ rowHeight: d.rowHeight,
1091
1095
  isDirOpen: fe,
1092
- parentIsLast: m.parentIsLast,
1096
+ parentIsLast: d.parentIsLast,
1093
1097
  renderChildren: !1,
1094
1098
  expansion: { toggleDirectory: t, onToggleDirectoryRecursive: He },
1095
- selection: { onEntryClick: g, selectedPath: x ?? null, mode: c, selectedItems: y, onSelectionChange: b },
1099
+ selection: { onEntryClick: w, selectedPath: x ?? null, mode: c, selectedItems: y, onSelectionChange: E },
1096
1100
  visual: {
1097
- iconOverrides: w,
1101
+ iconOverrides: b,
1098
1102
  showExpandIcons: v,
1099
1103
  showDirectoryIcons: D,
1100
1104
  showFileIcons: N,
1101
1105
  useCanvasExpandIcons: f,
1102
- expandIconSize: p,
1106
+ expandIconSize: h,
1103
1107
  highlightStyles: L,
1104
- entryClassName: V,
1105
- entryStyle: C,
1106
- nameClassName: B,
1108
+ entryClassName: U,
1109
+ entryStyle: P,
1110
+ nameClassName: Y,
1107
1111
  nameStyle: F,
1108
- directoryNameClassName: H,
1112
+ directoryNameClassName: W,
1109
1113
  directoryNameStyle: Z,
1110
- fileNameClassName: U,
1111
- fileNameStyle: ae
1114
+ fileNameClassName: z,
1115
+ fileNameStyle: se
1112
1116
  }
1113
1117
  },
1114
- m.entry.absolutePath
1118
+ d.entry.absolutePath
1115
1119
  ) : null
1116
1120
  }
1117
1121
  ),
1118
1122
  [
1119
- J.length,
1120
- ut,
1121
- lt,
1123
+ V.length,
1124
+ ft,
1125
+ it,
1126
+ ct,
1122
1127
  me,
1123
1128
  ve,
1124
- et,
1125
1129
  tt,
1126
- je,
1127
- E,
1128
- ft,
1129
- z,
1130
+ rt,
1131
+ Ee,
1132
+ $,
1133
+ pt,
1134
+ X,
1130
1135
  Be,
1131
- Ne,
1132
- Je,
1136
+ ue,
1137
+ qe,
1133
1138
  le,
1139
+ Ke,
1134
1140
  Ze,
1135
- qe,
1136
1141
  be,
1137
1142
  Le,
1138
1143
  Qe,
1139
1144
  A,
1140
- Pe,
1145
+ _e,
1141
1146
  fe,
1142
- g,
1147
+ w,
1143
1148
  x,
1144
1149
  c,
1145
1150
  y,
1146
- b,
1151
+ E,
1147
1152
  t,
1148
1153
  He,
1149
- ht,
1150
- w,
1154
+ yt,
1155
+ b,
1151
1156
  v,
1152
1157
  D,
1153
1158
  N,
1154
1159
  f,
1155
- p,
1160
+ h,
1156
1161
  L,
1157
- V,
1158
- C,
1159
- B,
1162
+ U,
1163
+ P,
1164
+ Y,
1160
1165
  F,
1161
- H,
1166
+ W,
1162
1167
  Z,
1163
- U,
1164
- ae
1168
+ z,
1169
+ se
1165
1170
  ]
1166
1171
  );
1167
- if (!(A && z))
1168
- return /* @__PURE__ */ i.jsx("div", { ref: h, className: rt, style: nt, role: "tree", children: pt });
1169
- const Xt = A.showHeader ?? !0, Jt = A.showFooter ?? !1, qt = { ...nt, "--dt-hscroll": `${te}px` };
1170
- return /* @__PURE__ */ i.jsxs("div", { ref: h, className: M(rt, "dt-grid"), style: qt, role: "treegrid", children: [
1171
- Xt && /* @__PURE__ */ i.jsx(mr, { columns: A.columns, numericTemplate: Pe, numericTotal: z.numericTotal, nameWidth: z.nameWidth, scrollBarWidth: ge, className: A.headerClassName }),
1172
- /* @__PURE__ */ i.jsx("div", { ref: S, className: "dt-grid-body", children: pt }),
1172
+ if (!(A && X))
1173
+ return /* @__PURE__ */ i.jsx("div", { ref: I, className: nt, style: st, role: "tree", children: xt });
1174
+ const Kt = A.showHeader ?? !0, Qt = A.showFooter ?? !1, er = { ...st, "--dt-hscroll": `${G}px` };
1175
+ return /* @__PURE__ */ i.jsxs("div", { ref: I, className: M(nt, "dt-grid"), style: er, role: "treegrid", children: [
1176
+ Kt && /* @__PURE__ */ i.jsx(yr, { columns: A.columns, numericTemplate: _e, numericTotal: X.numericTotal, nameWidth: X.nameWidth, scrollBarWidth: ge, className: A.headerClassName }),
1177
+ /* @__PURE__ */ i.jsx("div", { ref: _, className: "dt-grid-body", children: xt }),
1173
1178
  we > 0 && /* @__PURE__ */ i.jsxs("div", { className: "dt-grid-hscrollbar-row", children: [
1174
- /* @__PURE__ */ i.jsx("div", { className: "dt-grid-scrollbar-spacer", style: { width: z.nameWidth }, "aria-hidden": "true" }),
1179
+ /* @__PURE__ */ i.jsx("div", { className: "dt-grid-scrollbar-spacer", style: { width: X.nameWidth }, "aria-hidden": "true" }),
1175
1180
  /* @__PURE__ */ i.jsx(
1176
- rr,
1181
+ or,
1177
1182
  {
1178
1183
  horizontal: !0,
1179
- contentSize: z.numericTotal,
1180
- viewportSize: z.numericVisible,
1181
- scrollPosition: te,
1184
+ contentSize: X.numericTotal,
1185
+ viewportSize: X.numericVisible,
1186
+ scrollPosition: G,
1182
1187
  scrollBarWidth: ge,
1183
- onScroll: (m) => {
1184
- const j = typeof m == "function" ? m(te) : m, $ = Ge(j, we);
1185
- return G($), $;
1188
+ onScroll: (d) => {
1189
+ const S = typeof d == "function" ? d(G) : d, H = Ge(S, we);
1190
+ return Ne(H), H;
1186
1191
  }
1187
1192
  }
1188
1193
  ),
1189
1194
  /* @__PURE__ */ i.jsx("div", { className: "dt-grid-scrollbar-spacer", style: { width: ge }, "aria-hidden": "true" })
1190
1195
  ] }),
1191
- Jt && /* @__PURE__ */ i.jsx(fr, { columns: A.columns, numericTemplate: Pe, numericTotal: z.numericTotal, nameWidth: z.nameWidth, scrollBarWidth: ge, allEntries: zt, className: A.footerClassName })
1196
+ Qt && /* @__PURE__ */ i.jsx(xr, { columns: A.columns, numericTemplate: _e, numericTotal: X.numericTotal, nameWidth: X.nameWidth, scrollBarWidth: ge, allEntries: Zt, className: A.footerClassName })
1192
1197
  ] });
1193
- }, Fr = ({ initialExpanded: e = /* @__PURE__ */ new Set(), storageKey: t } = {}) => {
1194
- const [a, s] = er(), [r, o] = se(() => {
1198
+ }, Br = ({ initialExpanded: e = /* @__PURE__ */ new Set(), storageKey: t } = {}) => {
1199
+ const [a, s] = sr(), [r, o] = ne(() => {
1195
1200
  if (typeof window < "u" && t)
1196
1201
  try {
1197
- const u = window.localStorage.getItem(t);
1198
- if (u) {
1199
- const f = JSON.parse(u);
1202
+ const m = window.localStorage.getItem(t);
1203
+ if (m) {
1204
+ const f = JSON.parse(m);
1200
1205
  return new Set(f);
1201
1206
  }
1202
- } catch (u) {
1203
- console.error("[useDirectoryTreeState] Error reading from localStorage", u);
1207
+ } catch (m) {
1208
+ console.error("[useDirectoryTreeState] Error reading from localStorage", m);
1204
1209
  }
1205
1210
  return e;
1206
- }), l = W((u) => {
1211
+ }), l = B((m) => {
1207
1212
  s(() => {
1208
1213
  o((f) => {
1209
1214
  const v = new Set(f);
1210
- return u(v), v;
1215
+ return m(v), v;
1211
1216
  });
1212
1217
  });
1213
- }, []), d = W(
1214
- (u, f) => {
1218
+ }, []), u = B(
1219
+ (m, f) => {
1215
1220
  l((v) => {
1216
- for (const D of u)
1221
+ for (const D of m)
1217
1222
  f(v, D);
1218
1223
  });
1219
1224
  },
@@ -1223,64 +1228,64 @@ const Ut = (e) => {
1223
1228
  if (t && typeof window < "u")
1224
1229
  try {
1225
1230
  window.localStorage.setItem(t, JSON.stringify(Array.from(r)));
1226
- } catch (u) {
1227
- console.warn(`Error setting localStorage key "${t}":`, u);
1231
+ } catch (m) {
1232
+ console.warn(`Error setting localStorage key "${t}":`, m);
1228
1233
  }
1229
1234
  }, [r, t]);
1230
- const g = W(
1231
- (u) => {
1232
- d([u], (f, v) => {
1235
+ const w = B(
1236
+ (m) => {
1237
+ u([m], (f, v) => {
1233
1238
  f.has(v) ? f.delete(v) : f.add(v);
1234
1239
  });
1235
1240
  },
1236
- [d]
1237
- ), x = W(
1238
- (u) => {
1239
- d([u], (f, v) => {
1241
+ [u]
1242
+ ), x = B(
1243
+ (m) => {
1244
+ u([m], (f, v) => {
1240
1245
  f.add(v);
1241
1246
  });
1242
1247
  },
1243
- [d]
1244
- ), c = W(
1245
- (u) => {
1246
- d([u], (f, v) => {
1248
+ [u]
1249
+ ), c = B(
1250
+ (m) => {
1251
+ u([m], (f, v) => {
1247
1252
  f.delete(v);
1248
1253
  });
1249
1254
  },
1250
- [d]
1251
- ), y = W(
1252
- (u) => {
1253
- d(u, (f, v) => {
1255
+ [u]
1256
+ ), y = B(
1257
+ (m) => {
1258
+ u(m, (f, v) => {
1254
1259
  f.delete(v);
1255
1260
  });
1256
1261
  },
1257
- [d]
1258
- ), b = W(
1259
- (u) => {
1260
- d(u, (f, v) => {
1262
+ [u]
1263
+ ), E = B(
1264
+ (m) => {
1265
+ u(m, (f, v) => {
1261
1266
  f.add(v);
1262
1267
  });
1263
1268
  },
1264
- [d]
1265
- ), k = W(() => {
1266
- l((u) => {
1267
- u.clear();
1269
+ [u]
1270
+ ), g = B(() => {
1271
+ l((m) => {
1272
+ m.clear();
1268
1273
  });
1269
- }, [l]), I = W((u) => r.has(u), [r]);
1274
+ }, [l]), k = B((m) => r.has(m), [r]);
1270
1275
  return {
1271
1276
  expanded: r,
1272
- toggle: g,
1277
+ toggle: w,
1273
1278
  expand: x,
1274
1279
  collapse: c,
1275
1280
  collapseMultiple: y,
1276
- expandMultiple: b,
1277
- collapseAll: k,
1278
- isExpanded: I,
1281
+ expandMultiple: E,
1282
+ collapseAll: g,
1283
+ isExpanded: k,
1279
1284
  isPending: a
1280
1285
  };
1281
1286
  };
1282
1287
  export {
1283
- Lr as DirectoryTree,
1288
+ Wr as DirectoryTree,
1284
1289
  O as directoryTreeClasses,
1285
- Fr as useDirectoryTreeState
1290
+ Br as useDirectoryTreeState
1286
1291
  };