@aiquants/directory-tree 3.1.2 → 3.1.4

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