@aiquants/directory-tree 3.6.0 → 3.7.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,73 +1,73 @@
1
- import or, { useRef as ue, useEffect as me, useCallback as W, memo as Ze, useState as ce, useMemo as Z, useLayoutEffect as lr, Fragment as ir, useTransition as cr } from "react";
2
- import { VirtualScroll as dr, ScrollBar as ur } from "@aiquants/virtualscroll";
1
+ import xr, { useRef as ne, useEffect as me, useCallback as F, memo as ot, useState as ce, useMemo as Z, useLayoutEffect as br, Fragment as vr, useTransition as gr } from "react";
2
+ import { VirtualScroll as wr, ScrollBar as kr } from "@aiquants/virtualscroll";
3
3
  import { twMerge as _ } from "tailwind-merge";
4
- import { FolderIcon as mr, ChevronDownIcon as fr, ChevronRightIcon as hr } from "@heroicons/react/24/solid";
5
- import { FileMd as kt, FilePdf as Nt, FileXls as Et, FileCsv as It, FileDoc as jt, FilePpt as Tt, FileImage as Ct, FileAudio as Rt, FileVideo as Pt, FileZip as _t, FileCode as At, FileText as Mt, FileIcon as pr } from "@phosphor-icons/react";
6
- var De = { exports: {} }, Te = {};
7
- var Ot;
8
- function yr() {
9
- if (Ot) return Te;
10
- Ot = 1;
4
+ import { FolderIcon as Sr, ChevronDownIcon as Ir, ChevronRightIcon as Er } from "@heroicons/react/24/solid";
5
+ import { FileMd as Mt, FilePdf as Dt, FileXls as Ot, FileCsv as Ft, FileDoc as Lt, FilePpt as $t, FileImage as Ht, FileAudio as Wt, FileVideo as Bt, FileZip as zt, FileCode as Yt, FileText as Gt, FileIcon as Nr } from "@phosphor-icons/react";
6
+ var ze = { exports: {} }, Ce = {};
7
+ var Vt;
8
+ function jr() {
9
+ if (Vt) return Ce;
10
+ Vt = 1;
11
11
  var e = /* @__PURE__ */ Symbol.for("react.transitional.element"), t = /* @__PURE__ */ Symbol.for("react.fragment");
12
- function a(n, r, o) {
13
- var l = null;
14
- if (o !== void 0 && (l = "" + o), r.key !== void 0 && (l = "" + r.key), "key" in r) {
15
- o = {};
12
+ function a(n, r, l) {
13
+ var c = null;
14
+ if (l !== void 0 && (c = "" + l), r.key !== void 0 && (c = "" + r.key), "key" in r) {
15
+ l = {};
16
16
  for (var u in r)
17
- u !== "key" && (o[u] = r[u]);
18
- } else o = r;
19
- return r = o.ref, {
17
+ u !== "key" && (l[u] = r[u]);
18
+ } else l = r;
19
+ return r = l.ref, {
20
20
  $$typeof: e,
21
21
  type: n,
22
- key: l,
22
+ key: c,
23
23
  ref: r !== void 0 ? r : null,
24
- props: o
24
+ props: l
25
25
  };
26
26
  }
27
- return Te.Fragment = t, Te.jsx = a, Te.jsxs = a, Te;
27
+ return Ce.Fragment = t, Ce.jsx = a, Ce.jsxs = a, Ce;
28
28
  }
29
- var Ce = {};
30
- var Ft;
31
- function xr() {
32
- return Ft || (Ft = 1, process.env.NODE_ENV !== "production" && (function() {
29
+ var _e = {};
30
+ var Ut;
31
+ function Rr() {
32
+ return Ut || (Ut = 1, process.env.NODE_ENV !== "production" && (function() {
33
33
  function e(s) {
34
34
  if (s == null) return null;
35
35
  if (typeof s == "function")
36
- return s.$$typeof === H ? null : s.displayName || s.name || null;
36
+ return s.$$typeof === $ ? null : s.displayName || s.name || null;
37
37
  if (typeof s == "string") return s;
38
38
  switch (s) {
39
- case x:
39
+ case y:
40
40
  return "Fragment";
41
- case I:
41
+ case R:
42
42
  return "Profiler";
43
43
  case k:
44
44
  return "StrictMode";
45
- case D:
45
+ case L:
46
46
  return "Suspense";
47
- case C:
47
+ case P:
48
48
  return "SuspenseList";
49
- case F:
49
+ case Q:
50
50
  return "Activity";
51
51
  }
52
52
  if (typeof s == "object")
53
53
  switch (typeof s.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
  ), s.$$typeof) {
56
- case m:
56
+ case f:
57
57
  return "Portal";
58
- case w:
58
+ case S:
59
59
  return s.displayName || "Context";
60
60
  case N:
61
61
  return (s._context.displayName || "Context") + ".Consumer";
62
- case h:
63
- var p = s.render;
64
- return s = s.displayName, s || (s = p.displayName || p.name || "", s = s !== "" ? "ForwardRef(" + s + ")" : "ForwardRef"), s;
65
- case M:
66
- return p = s.displayName || null, p !== null ? p : e(s.type) || "Memo";
67
- case J:
68
- p = s._payload, s = s._init;
62
+ case p:
63
+ var m = s.render;
64
+ return s = s.displayName, s || (s = m.displayName || m.name || "", s = s !== "" ? "ForwardRef(" + s + ")" : "ForwardRef"), s;
65
+ case O:
66
+ return m = s.displayName || null, m !== null ? m : e(s.type) || "Memo";
67
+ case K:
68
+ m = s._payload, s = s._init;
69
69
  try {
70
- return e(s(p));
70
+ return e(s(m));
71
71
  } catch {
72
72
  }
73
73
  }
@@ -79,74 +79,74 @@ function xr() {
79
79
  function a(s) {
80
80
  try {
81
81
  t(s);
82
- var p = !1;
82
+ var m = !1;
83
83
  } catch {
84
- p = !0;
84
+ m = !0;
85
85
  }
86
- if (p) {
87
- p = console;
88
- var y = p.error, j = typeof Symbol == "function" && Symbol.toStringTag && s[Symbol.toStringTag] || s.constructor.name || "Object";
89
- return y.call(
90
- p,
86
+ if (m) {
87
+ m = console;
88
+ var T = m.error, A = typeof Symbol == "function" && Symbol.toStringTag && s[Symbol.toStringTag] || s.constructor.name || "Object";
89
+ return T.call(
90
+ m,
91
91
  "The provided key is an unsupported type %s. This value must be coerced to a string before using it here.",
92
- j
92
+ A
93
93
  ), t(s);
94
94
  }
95
95
  }
96
96
  function n(s) {
97
- if (s === x) return "<>";
98
- if (typeof s == "object" && s !== null && s.$$typeof === J)
97
+ if (s === y) return "<>";
98
+ if (typeof s == "object" && s !== null && s.$$typeof === K)
99
99
  return "<...>";
100
100
  try {
101
- var p = e(s);
102
- return p ? "<" + p + ">" : "<...>";
101
+ var m = e(s);
102
+ return m ? "<" + m + ">" : "<...>";
103
103
  } catch {
104
104
  return "<...>";
105
105
  }
106
106
  }
107
107
  function r() {
108
- var s = q.A;
108
+ var s = J.A;
109
109
  return s === null ? null : s.getOwner();
110
110
  }
111
- function o() {
111
+ function l() {
112
112
  return Error("react-stack-top-frame");
113
113
  }
114
- function l(s) {
115
- if (K.call(s, "key")) {
116
- var p = Object.getOwnPropertyDescriptor(s, "key").get;
117
- if (p && p.isReactWarning) return !1;
114
+ function c(s) {
115
+ if (ee.call(s, "key")) {
116
+ var m = Object.getOwnPropertyDescriptor(s, "key").get;
117
+ if (m && m.isReactWarning) return !1;
118
118
  }
119
119
  return s.key !== void 0;
120
120
  }
121
- function u(s, p) {
122
- function y() {
121
+ function u(s, m) {
122
+ function T() {
123
123
  B || (B = !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
- p
125
+ m
126
126
  ));
127
127
  }
128
- y.isReactWarning = !0, Object.defineProperty(s, "key", {
129
- get: y,
128
+ T.isReactWarning = !0, Object.defineProperty(s, "key", {
129
+ get: T,
130
130
  configurable: !0
131
131
  });
132
132
  }
133
- function E() {
133
+ function j() {
134
134
  var s = e(this.type);
135
- return Y[s] || (Y[s] = !0, console.error(
135
+ return G[s] || (G[s] = !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
  )), s = this.props.ref, s !== void 0 ? s : null;
138
138
  }
139
- function b(s, p, y, j, L, G) {
140
- var P = y.ref;
139
+ function v(s, m, T, A, se, le) {
140
+ var b = T.ref;
141
141
  return s = {
142
- $$typeof: S,
142
+ $$typeof: E,
143
143
  type: s,
144
- key: p,
145
- props: y,
146
- _owner: j
147
- }, (P !== void 0 ? P : null) !== null ? Object.defineProperty(s, "ref", {
144
+ key: m,
145
+ props: T,
146
+ _owner: A
147
+ }, (b !== void 0 ? b : null) !== null ? Object.defineProperty(s, "ref", {
148
148
  enumerable: !1,
149
- get: E
149
+ get: j
150
150
  }) : Object.defineProperty(s, "ref", { enumerable: !1, value: null }), s._store = {}, Object.defineProperty(s._store, "validated", {
151
151
  configurable: !1,
152
152
  enumerable: !1,
@@ -161,109 +161,109 @@ function xr() {
161
161
  configurable: !1,
162
162
  enumerable: !1,
163
163
  writable: !0,
164
- value: L
164
+ value: se
165
165
  }), Object.defineProperty(s, "_debugTask", {
166
166
  configurable: !1,
167
167
  enumerable: !1,
168
168
  writable: !0,
169
- value: G
169
+ value: le
170
170
  }), Object.freeze && (Object.freeze(s.props), Object.freeze(s)), s;
171
171
  }
172
- function d(s, p, y, j, L, G) {
173
- var P = p.children;
174
- if (P !== void 0)
175
- if (j)
176
- if (R(P)) {
177
- for (j = 0; j < P.length; j++)
178
- f(P[j]);
179
- Object.freeze && Object.freeze(P);
172
+ function d(s, m, T, A, se, le) {
173
+ var b = m.children;
174
+ if (b !== void 0)
175
+ if (A)
176
+ if (I(b)) {
177
+ for (A = 0; A < b.length; A++)
178
+ h(b[A]);
179
+ Object.freeze && Object.freeze(b);
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(P);
185
- if (K.call(p, "key")) {
186
- P = e(s);
187
- var Q = Object.keys(p).filter(function(oe) {
188
- return oe !== "key";
184
+ else h(b);
185
+ if (ee.call(m, "key")) {
186
+ b = e(s);
187
+ var z = Object.keys(m).filter(function(V) {
188
+ return V !== "key";
189
189
  });
190
- j = 0 < Q.length ? "{key: someKey, " + Q.join(": ..., ") + ": ...}" : "{key: someKey}", A[P + j] || (Q = 0 < Q.length ? "{" + Q.join(": ..., ") + ": ...}" : "{}", console.error(
190
+ A = 0 < z.length ? "{key: someKey, " + z.join(": ..., ") + ": ...}" : "{key: someKey}", C[b + A] || (z = 0 < z.length ? "{" + z.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
- j,
198
- P,
199
- Q,
200
- P
201
- ), A[P + j] = !0);
197
+ A,
198
+ b,
199
+ z,
200
+ b
201
+ ), C[b + A] = !0);
202
202
  }
203
- if (P = null, y !== void 0 && (a(y), P = "" + y), l(p) && (a(p.key), P = "" + p.key), "key" in p) {
204
- y = {};
205
- for (var re in p)
206
- re !== "key" && (y[re] = p[re]);
207
- } else y = p;
208
- return P && u(
209
- y,
203
+ if (b = null, T !== void 0 && (a(T), b = "" + T), c(m) && (a(m.key), b = "" + m.key), "key" in m) {
204
+ T = {};
205
+ for (var H in m)
206
+ H !== "key" && (T[H] = m[H]);
207
+ } else T = m;
208
+ return b && u(
209
+ T,
210
210
  typeof s == "function" ? s.displayName || s.name || "Unknown" : s
211
- ), b(
211
+ ), v(
212
212
  s,
213
- P,
214
- y,
213
+ b,
214
+ T,
215
215
  r(),
216
- L,
217
- G
216
+ se,
217
+ le
218
218
  );
219
219
  }
220
- function f(s) {
221
- g(s) ? s._store && (s._store.validated = 1) : typeof s == "object" && s !== null && s.$$typeof === J && (s._payload.status === "fulfilled" ? g(s._payload.value) && s._payload.value._store && (s._payload.value._store.validated = 1) : s._store && (s._store.validated = 1));
220
+ function h(s) {
221
+ g(s) ? s._store && (s._store.validated = 1) : typeof s == "object" && s !== null && s.$$typeof === K && (s._payload.status === "fulfilled" ? g(s._payload.value) && s._payload.value._store && (s._payload.value._store.validated = 1) : s._store && (s._store.validated = 1));
222
222
  }
223
223
  function g(s) {
224
- return typeof s == "object" && s !== null && s.$$typeof === S;
224
+ return typeof s == "object" && s !== null && s.$$typeof === E;
225
225
  }
226
- var v = or, S = /* @__PURE__ */ Symbol.for("react.transitional.element"), m = /* @__PURE__ */ Symbol.for("react.portal"), x = /* @__PURE__ */ Symbol.for("react.fragment"), k = /* @__PURE__ */ Symbol.for("react.strict_mode"), I = /* @__PURE__ */ Symbol.for("react.profiler"), N = /* @__PURE__ */ Symbol.for("react.consumer"), w = /* @__PURE__ */ Symbol.for("react.context"), h = /* @__PURE__ */ Symbol.for("react.forward_ref"), D = /* @__PURE__ */ Symbol.for("react.suspense"), C = /* @__PURE__ */ Symbol.for("react.suspense_list"), M = /* @__PURE__ */ Symbol.for("react.memo"), J = /* @__PURE__ */ Symbol.for("react.lazy"), F = /* @__PURE__ */ Symbol.for("react.activity"), H = /* @__PURE__ */ Symbol.for("react.client.reference"), q = v.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE, K = Object.prototype.hasOwnProperty, R = Array.isArray, z = console.createTask ? console.createTask : function() {
226
+ var w = xr, E = /* @__PURE__ */ Symbol.for("react.transitional.element"), f = /* @__PURE__ */ Symbol.for("react.portal"), y = /* @__PURE__ */ Symbol.for("react.fragment"), k = /* @__PURE__ */ Symbol.for("react.strict_mode"), R = /* @__PURE__ */ Symbol.for("react.profiler"), N = /* @__PURE__ */ Symbol.for("react.consumer"), S = /* @__PURE__ */ Symbol.for("react.context"), p = /* @__PURE__ */ Symbol.for("react.forward_ref"), L = /* @__PURE__ */ Symbol.for("react.suspense"), P = /* @__PURE__ */ Symbol.for("react.suspense_list"), O = /* @__PURE__ */ Symbol.for("react.memo"), K = /* @__PURE__ */ Symbol.for("react.lazy"), Q = /* @__PURE__ */ Symbol.for("react.activity"), $ = /* @__PURE__ */ Symbol.for("react.client.reference"), J = w.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE, ee = Object.prototype.hasOwnProperty, I = Array.isArray, Y = console.createTask ? console.createTask : function() {
227
227
  return null;
228
228
  };
229
- v = {
229
+ w = {
230
230
  react_stack_bottom_frame: function(s) {
231
231
  return s();
232
232
  }
233
233
  };
234
- var B, Y = {}, ae = v.react_stack_bottom_frame.bind(
235
- v,
236
- o
237
- )(), te = z(n(o)), A = {};
238
- Ce.Fragment = x, Ce.jsx = function(s, p, y) {
239
- var j = 1e4 > q.recentlyCreatedOwnerStacks++;
234
+ var B, G = {}, de = w.react_stack_bottom_frame.bind(
235
+ w,
236
+ l
237
+ )(), ue = Y(n(l)), C = {};
238
+ _e.Fragment = y, _e.jsx = function(s, m, T) {
239
+ var A = 1e4 > J.recentlyCreatedOwnerStacks++;
240
240
  return d(
241
241
  s,
242
- p,
243
- y,
242
+ m,
243
+ T,
244
244
  !1,
245
- j ? Error("react-stack-top-frame") : ae,
246
- j ? z(n(s)) : te
245
+ A ? Error("react-stack-top-frame") : de,
246
+ A ? Y(n(s)) : ue
247
247
  );
248
- }, Ce.jsxs = function(s, p, y) {
249
- var j = 1e4 > q.recentlyCreatedOwnerStacks++;
248
+ }, _e.jsxs = function(s, m, T) {
249
+ var A = 1e4 > J.recentlyCreatedOwnerStacks++;
250
250
  return d(
251
251
  s,
252
- p,
253
- y,
252
+ m,
253
+ T,
254
254
  !0,
255
- j ? Error("react-stack-top-frame") : ae,
256
- j ? z(n(s)) : te
255
+ A ? Error("react-stack-top-frame") : de,
256
+ A ? Y(n(s)) : ue
257
257
  );
258
258
  };
259
- })()), Ce;
259
+ })()), _e;
260
260
  }
261
- var Dt;
262
- function br() {
263
- return Dt || (Dt = 1, process.env.NODE_ENV === "production" ? De.exports = yr() : De.exports = xr()), De.exports;
261
+ var Xt;
262
+ function Tr() {
263
+ return Xt || (Xt = 1, process.env.NODE_ENV === "production" ? ze.exports = jr() : ze.exports = Rr()), ze.exports;
264
264
  }
265
- var i = br();
266
- const Le = 18, $e = 12, Lt = 10, O = {
265
+ var i = Tr();
266
+ const Ye = 18, Ge = 12, Jt = 10, D = {
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",
@@ -282,14 +282,14 @@ const Le = 18, $e = 12, Lt = 10, O = {
282
282
  name: _("directory-tree-name overflow-hidden text-ellipsis whitespace-nowrap ml-1 text-xs font-normal", "text-gray-700", "dark:text-gray-200"),
283
283
  nameDirectory: "directory-tree-name--directory font-medium",
284
284
  nameSelected: _("directory-tree-name--selected text-blue-800 font-semibold", "dark:text-blue-300")
285
- }, ge = (e) => {
285
+ }, Ee = (e) => {
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
- }, Bt = ({ isDirectory: e, isExpanded: t, showExpandIcons: a, useCanvasExpandIcons: n, expandIconSize: r }) => {
290
- const o = r ? { width: r, height: r } : void 0, l = r ? "" : "h-4 w-4";
291
- return !(a && e) || n ? /* @__PURE__ */ i.jsx("span", { className: l, style: o, "aria-hidden": "true" }) : t ? /* @__PURE__ */ i.jsx(fr, { className: l, style: o }) : /* @__PURE__ */ i.jsx(hr, { className: l, style: o });
292
- }, Je = (e, t) => {
289
+ }, Qt = ({ isDirectory: e, isExpanded: t, showExpandIcons: a, useCanvasExpandIcons: n, expandIconSize: r }) => {
290
+ const l = r ? { width: r, height: r } : void 0, c = r ? "" : "h-4 w-4";
291
+ return !(a && e) || n ? /* @__PURE__ */ i.jsx("span", { className: c, style: l, "aria-hidden": "true" }) : t ? /* @__PURE__ */ i.jsx(Ir, { className: c, style: l }) : /* @__PURE__ */ i.jsx(Er, { className: c, style: l });
292
+ }, st = (e, t) => {
293
293
  if (e == null || typeof e == "boolean") return null;
294
294
  if (typeof e == "function")
295
295
  return console.warn(`[DirectoryTree] Function returned by renderer for "${t}". Return a node.`), null;
@@ -297,7 +297,7 @@ const Le = 18, $e = 12, Lt = 10, O = {
297
297
  if ("then" in e)
298
298
  return console.warn(`[DirectoryTree] Promise returned for "${t}". Not supported.`), null;
299
299
  if (Array.isArray(e)) {
300
- const n = e.map((r) => Je(r, t)).filter(Boolean);
300
+ const n = e.map((r) => st(r, t)).filter(Boolean);
301
301
  return n.length ? n : null;
302
302
  }
303
303
  const a = e.type;
@@ -305,559 +305,570 @@ const Le = 18, $e = 12, Lt = 10, O = {
305
305
  return console.warn(`[DirectoryTree] Lazy component for "${t}". Not supported.`), null;
306
306
  }
307
307
  return e;
308
- }, vr = (e, t, a) => {
309
- const n = (t || (a ? ge(a) : "")).toLowerCase(), r = (e || "").toLowerCase();
308
+ }, Pr = (e, t, a) => {
309
+ const n = (t || (a ? Ee(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(kt, { className: "h-4 w-4 text-sky-500 dark:text-sky-400" });
312
+ return /* @__PURE__ */ i.jsx(Mt, { className: "h-4 w-4 text-sky-500 dark:text-sky-400" });
313
313
  if (r === "application/pdf")
314
- return /* @__PURE__ */ i.jsx(Nt, { className: "h-4 w-4 text-red-500 dark:text-red-400" });
314
+ return /* @__PURE__ */ i.jsx(Dt, { 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(Et, { className: "h-4 w-4 text-emerald-600 dark:text-emerald-400" });
316
+ return /* @__PURE__ */ i.jsx(Ot, { 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(It, { className: "h-4 w-4 text-emerald-600 dark:text-emerald-400" });
318
+ return /* @__PURE__ */ i.jsx(Ft, { 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(jt, { className: "h-4 w-4 text-blue-600 dark:text-blue-400" });
320
+ return /* @__PURE__ */ i.jsx(Lt, { 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(Tt, { className: "h-4 w-4 text-orange-500 dark:text-orange-400" });
322
+ return /* @__PURE__ */ i.jsx($t, { className: "h-4 w-4 text-orange-500 dark:text-orange-400" });
323
323
  if (r.startsWith("image/"))
324
- return /* @__PURE__ */ i.jsx(Ct, { className: "h-4 w-4 text-teal-500 dark:text-teal-400" });
324
+ return /* @__PURE__ */ i.jsx(Ht, { className: "h-4 w-4 text-teal-500 dark:text-teal-400" });
325
325
  if (r.startsWith("audio/"))
326
- return /* @__PURE__ */ i.jsx(Rt, { className: "h-4 w-4 text-pink-500 dark:text-pink-400" });
326
+ return /* @__PURE__ */ i.jsx(Wt, { className: "h-4 w-4 text-pink-500 dark:text-pink-400" });
327
327
  if (r.startsWith("video/"))
328
- return /* @__PURE__ */ i.jsx(Pt, { className: "h-4 w-4 text-violet-500 dark:text-violet-400" });
328
+ return /* @__PURE__ */ i.jsx(Bt, { 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(_t, { className: "h-4 w-4 text-amber-500 dark:text-amber-400" });
330
+ return /* @__PURE__ */ i.jsx(zt, { 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(At, { className: "h-4 w-4 text-purple-500 dark:text-purple-400" });
332
+ return /* @__PURE__ */ i.jsx(Yt, { className: "h-4 w-4 text-purple-500 dark:text-purple-400" });
333
333
  if (r.startsWith("text/"))
334
- return /* @__PURE__ */ i.jsx(Mt, { className: "h-4 w-4 text-gray-500 dark:text-gray-400" });
334
+ return /* @__PURE__ */ i.jsx(Gt, { className: "h-4 w-4 text-gray-500 dark:text-gray-400" });
335
335
  }
336
336
  if (n) {
337
337
  if (n === "md" || n === "markdown" || n === "mdx")
338
- return /* @__PURE__ */ i.jsx(kt, { className: "h-4 w-4 text-sky-500 dark:text-sky-400" });
338
+ return /* @__PURE__ */ i.jsx(Mt, { className: "h-4 w-4 text-sky-500 dark:text-sky-400" });
339
339
  if (n === "pdf")
340
- return /* @__PURE__ */ i.jsx(Nt, { className: "h-4 w-4 text-red-500 dark:text-red-400" });
340
+ return /* @__PURE__ */ i.jsx(Dt, { className: "h-4 w-4 text-red-500 dark:text-red-400" });
341
341
  if (["xls", "xlsx", "xlsm", "xlsb", "ods"].includes(n))
342
- return /* @__PURE__ */ i.jsx(Et, { className: "h-4 w-4 text-emerald-600 dark:text-emerald-400" });
342
+ return /* @__PURE__ */ i.jsx(Ot, { className: "h-4 w-4 text-emerald-600 dark:text-emerald-400" });
343
343
  if (["csv", "tsv"].includes(n))
344
- return /* @__PURE__ */ i.jsx(It, { className: "h-4 w-4 text-emerald-600 dark:text-emerald-400" });
344
+ return /* @__PURE__ */ i.jsx(Ft, { className: "h-4 w-4 text-emerald-600 dark:text-emerald-400" });
345
345
  if (["doc", "docx", "rtf", "odt"].includes(n))
346
- return /* @__PURE__ */ i.jsx(jt, { className: "h-4 w-4 text-blue-600 dark:text-blue-400" });
346
+ return /* @__PURE__ */ i.jsx(Lt, { className: "h-4 w-4 text-blue-600 dark:text-blue-400" });
347
347
  if (["ppt", "pptx", "odp"].includes(n))
348
- return /* @__PURE__ */ i.jsx(Tt, { className: "h-4 w-4 text-orange-500 dark:text-orange-400" });
348
+ return /* @__PURE__ */ i.jsx($t, { 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(n))
350
- return /* @__PURE__ */ i.jsx(Ct, { className: "h-4 w-4 text-teal-500 dark:text-teal-400" });
350
+ return /* @__PURE__ */ i.jsx(Ht, { 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(n))
352
- return /* @__PURE__ */ i.jsx(At, { className: "h-4 w-4 text-purple-500 dark:text-purple-400" });
352
+ return /* @__PURE__ */ i.jsx(Yt, { className: "h-4 w-4 text-purple-500 dark:text-purple-400" });
353
353
  if (["mp3", "wav", "ogg", "m4a", "flac", "aac", "wma"].includes(n))
354
- return /* @__PURE__ */ i.jsx(Rt, { className: "h-4 w-4 text-pink-500 dark:text-pink-400" });
354
+ return /* @__PURE__ */ i.jsx(Wt, { className: "h-4 w-4 text-pink-500 dark:text-pink-400" });
355
355
  if (["mp4", "webm", "mov", "avi", "mkv", "wmv", "flv"].includes(n))
356
- return /* @__PURE__ */ i.jsx(Pt, { className: "h-4 w-4 text-violet-500 dark:text-violet-400" });
356
+ return /* @__PURE__ */ i.jsx(Bt, { className: "h-4 w-4 text-violet-500 dark:text-violet-400" });
357
357
  if (["zip", "tar", "gz", "7z", "rar", "tgz", "bz2"].includes(n))
358
- return /* @__PURE__ */ i.jsx(_t, { className: "h-4 w-4 text-amber-500 dark:text-amber-400" });
358
+ return /* @__PURE__ */ i.jsx(zt, { className: "h-4 w-4 text-amber-500 dark:text-amber-400" });
359
359
  if (["txt", "log"].includes(n))
360
- return /* @__PURE__ */ i.jsx(Mt, { className: "h-4 w-4 text-gray-500 dark:text-gray-400" });
360
+ return /* @__PURE__ */ i.jsx(Gt, { className: "h-4 w-4 text-gray-500 dark:text-gray-400" });
361
361
  }
362
- return /* @__PURE__ */ i.jsx(pr, { className: "h-4 w-4 text-gray-400 dark:text-gray-400" });
363
- }, zt = (e, t) => {
364
- const { entry: a, isDirectory: n, isExpanded: r, extension: o, mimeType: l } = e;
362
+ return /* @__PURE__ */ i.jsx(Nr, { className: "h-4 w-4 text-gray-400 dark:text-gray-400" });
363
+ }, er = (e, t) => {
364
+ const { entry: a, isDirectory: n, isExpanded: r, extension: l, mimeType: c } = e;
365
365
  let u;
366
- const E = l || a.mimeType;
367
- return a.icon !== void 0 ? u = a.icon : n ? u = r && t?.directoryExpanded || t?.directory || /* @__PURE__ */ i.jsx(mr, { className: "h-4 w-4" }) : o && t?.fileByExtension?.[o] ? u = t.fileByExtension[o] : u = t?.file || vr(E, o, a.name), Je(typeof u == "function" ? u(e) : u, a.absolutePath);
368
- }, gr = (e) => e.replace(/([a-z0-9])([A-Z])/g, "$1-$2").toLowerCase(), Yt = (e) => {
366
+ const j = c || a.mimeType;
367
+ return a.icon !== void 0 ? u = a.icon : n ? u = r && t?.directoryExpanded || t?.directory || /* @__PURE__ */ i.jsx(Sr, { className: "h-4 w-4" }) : l && t?.fileByExtension?.[l] ? u = t.fileByExtension[l] : u = t?.file || Pr(j, l, a.name), st(typeof u == "function" ? u(e) : u, a.absolutePath);
368
+ }, Cr = (e) => e.replace(/([a-z0-9])([A-Z])/g, "$1-$2").toLowerCase(), tr = (e) => {
369
369
  if (!e)
370
370
  return;
371
371
  const t = Object.entries(e).filter(([, a]) => a != null);
372
372
  if (t.length !== 0)
373
- return Object.fromEntries(t.map(([a, n]) => [`data-${gr(a)}`, String(n)]));
374
- }, wr = 500, Gt = ({ entry: e, isDirectory: t, isExpanded: a, isItemSelected: n, selectionMode: r, onSelectionChange: o, onEntryClick: l, toggleDirectory: u, onToggleDirectoryRecursive: E }) => {
375
- const b = ue(null);
373
+ return Object.fromEntries(t.map(([a, n]) => [`data-${Cr(a)}`, String(n)]));
374
+ }, _r = 500, rr = ({ entry: e, isDirectory: t, isExpanded: a, isItemSelected: n, selectionMode: r, onSelectionChange: l, onEntryClick: c, toggleDirectory: u, onToggleDirectoryRecursive: j }) => {
375
+ const v = ne(null);
376
376
  return me(
377
377
  () => () => {
378
- b.current && window.clearTimeout(b.current);
378
+ v.current && window.clearTimeout(v.current);
379
379
  },
380
380
  []
381
- ), W(
381
+ ), F(
382
382
  (d) => {
383
- d.stopPropagation(), r !== "none" && !t && o && o(e, !n);
384
- let f = !1;
385
- l({
383
+ d.stopPropagation(), r !== "none" && !t && l && l(e, !n);
384
+ let h = !1;
385
+ c({
386
386
  entry: e,
387
387
  isDirectory: t,
388
388
  isExpanded: a,
389
389
  preventDefault: () => {
390
- f = !0;
390
+ h = !0;
391
391
  }
392
- }), !(!t || f) && (b.current ? (window.clearTimeout(b.current), b.current = null, E(e)) : b.current = window.setTimeout(() => {
393
- u(e.absolutePath), b.current = null;
394
- }, wr));
392
+ }), !(!t || h) && (v.current ? (window.clearTimeout(v.current), v.current = null, j(e)) : v.current = window.setTimeout(() => {
393
+ u(e.absolutePath), v.current = null;
394
+ }, _r));
395
395
  },
396
- [t, e, a, E, u, l, r, o, n]
396
+ [t, e, a, j, u, c, r, l, n]
397
397
  );
398
- }, Vt = (e) => e === "right" ? "dt-grid-cell--right" : e === "center" ? "dt-grid-cell--center" : "", $t = (e, t) => e.children !== void 0 && t(e.absolutePath), Ut = (e, t) => ({
398
+ }, nr = (e) => e === "right" ? "dt-grid-cell--right" : e === "center" ? "dt-grid-cell--center" : "", qt = (e, t) => e.children !== void 0 && t(e.absolutePath), sr = (e, t) => ({
399
399
  width: e,
400
400
  gridTemplateColumns: t
401
- }), Xt = Ze(
401
+ }), ar = ot(
402
402
  ({
403
403
  entry: e,
404
404
  indentLevel: t,
405
405
  positionInSet: a,
406
406
  setSize: n,
407
407
  rowIndex: r,
408
- isSelectedForAria: o,
409
- rowHeight: l,
408
+ isSelectedForAria: l,
409
+ rowHeight: c,
410
410
  isDirOpen: u,
411
- columns: E,
412
- numericTemplate: b,
411
+ columns: j,
412
+ numericTemplate: v,
413
413
  numericTotal: d,
414
- nameWidth: f,
414
+ nameWidth: h,
415
415
  rowClassName: g,
416
- selection: { onEntryClick: v, selectedPath: S, mode: m = "none", selectedItems: x, onSelectionChange: k },
417
- expansion: { toggleDirectory: I, onToggleDirectoryRecursive: N },
418
- visual: { iconOverrides: w, showExpandIcons: h = !0, showDirectoryIcons: D = !0, showFileIcons: C = !0, useCanvasExpandIcons: M = !1, expandIconSize: J, indentSize: F = $e, highlightStyles: H }
416
+ selection: { onEntryClick: w, selectedPath: E, mode: f = "none", selectedItems: y, onSelectionChange: k },
417
+ expansion: { toggleDirectory: R, onToggleDirectoryRecursive: N },
418
+ visual: { iconOverrides: S, showExpandIcons: p = !0, showDirectoryIcons: L = !0, showFileIcons: P = !0, useCanvasExpandIcons: O = !1, expandIconSize: K, indentSize: Q = Ge, highlightStyles: $ }
419
419
  }) => {
420
- const [q, K] = ce(!1), R = e.children !== void 0, z = R && u(e.absolutePath), B = e.absolutePath === S, Y = !R && !!x?.has(e.absolutePath), ae = R ? void 0 : ge(e.name) || ge(e.relativePath) || ge(e.absolutePath), te = Gt({ entry: e, isDirectory: R, isExpanded: z, isItemSelected: Y, selectionMode: m, onSelectionChange: k, onEntryClick: v, toggleDirectory: I, onToggleDirectoryRecursive: N }), A = q ? H?.hoverClassName !== void 0 ? H.hoverClassName : O.entryHover : "", s = (() => {
421
- if (R) {
422
- if (B) return H?.directorySelectedClassName !== void 0 ? H.directorySelectedClassName : O.entrySelected;
423
- } else if (B || Y)
424
- return H?.itemSelectedClassName !== void 0 ? H.itemSelectedClassName : _(B && O.entrySelected, Y && O.entryItemSelected);
420
+ const [J, ee] = ce(!1), I = e.children !== void 0, Y = I && u(e.absolutePath), B = e.absolutePath === E, G = !I && !!y?.has(e.absolutePath), de = I ? void 0 : Ee(e.name) || Ee(e.relativePath) || Ee(e.absolutePath), ue = rr({ entry: e, isDirectory: I, isExpanded: Y, isItemSelected: G, selectionMode: f, onSelectionChange: k, onEntryClick: w, toggleDirectory: R, onToggleDirectoryRecursive: N }), C = J ? $?.hoverClassName !== void 0 ? $.hoverClassName : D.entryHover : "", s = (() => {
421
+ if (I) {
422
+ if (B) return $?.directorySelectedClassName !== void 0 ? $.directorySelectedClassName : D.entrySelected;
423
+ } else if (B || G)
424
+ return $?.itemSelectedClassName !== void 0 ? $.itemSelectedClassName : _(B && D.entrySelected, G && D.entryItemSelected);
425
425
  return "";
426
- })(), p = typeof g == "function" ? g(e) : g, y = _("dt-grid-row cursor-pointer select-none", A, s, p, e.className), j = _(O.expandIcon, (B || Y) && O.expandIconSelected), L = _(O.typeIcon, (B || Y) && O.typeIconSelected), G = _("dt-grid-name-label ml-1", "text-gray-700 dark:text-gray-200", R && O.nameDirectory, (B || Y) && O.nameSelected), P = Bt({ isDirectory: R, isExpanded: z, showExpandIcons: h, useCanvasExpandIcons: M, expandIconSize: J }), Q = (R ? D : C) ? zt({ entry: e, isDirectory: R, isExpanded: z, isSelected: B, isItemSelected: Y, extension: ae, mimeType: e.mimeType }, w) : null, re = { indentLevel: t, isDirectory: R, isExpanded: z }, [oe, ...we] = E, xe = oe?.render ? oe.render(e, re) : e.label ?? e.name, be = {
427
- ...q ? H?.hoverStyle : {},
428
- ...R && B ? H?.directorySelectedStyle : {},
429
- ...!R && (B || Y) ? H?.itemSelectedStyle : {}
426
+ })(), m = typeof g == "function" ? g(e) : g, T = _("dt-grid-row cursor-pointer select-none", C, s, m, e.className), A = _(D.expandIcon, (B || G) && D.expandIconSelected), se = _(D.typeIcon, (B || G) && D.typeIconSelected), le = _("dt-grid-name-label ml-1", "text-gray-700 dark:text-gray-200", I && D.nameDirectory, (B || G) && D.nameSelected), b = Qt({ isDirectory: I, isExpanded: Y, showExpandIcons: p, useCanvasExpandIcons: O, expandIconSize: K }), z = (I ? L : P) ? er({ entry: e, isDirectory: I, isExpanded: Y, isSelected: B, isItemSelected: G, extension: de, mimeType: e.mimeType }, S) : null, H = { indentLevel: t, isDirectory: I, isExpanded: Y }, [V, ...Ne] = j, ye = V?.render ? V.render(e, H) : e.label ?? e.name, ge = {
427
+ ...J ? $?.hoverStyle : {},
428
+ ...I && B ? $?.directorySelectedStyle : {},
429
+ ...!I && (B || G) ? $?.itemSelectedStyle : {}
430
430
  };
431
431
  return /* @__PURE__ */ i.jsxs(
432
432
  "div",
433
433
  {
434
- className: y,
435
- style: { height: l, ...be, ...e.style },
434
+ className: T,
435
+ style: { height: c, ...ge, ...e.style },
436
436
  role: "row",
437
- "aria-expanded": R ? z : void 0,
437
+ "aria-expanded": I ? Y : void 0,
438
438
  "aria-level": t + 1,
439
439
  "aria-posinset": a,
440
440
  "aria-setsize": n,
441
441
  "aria-rowindex": r,
442
- "aria-selected": m === "none" ? void 0 : o,
443
- ...Yt(e.data),
444
- "data-entry-type": R ? "directory" : "file",
445
- "data-entry-expanded": R ? String(z) : void 0,
442
+ "aria-selected": f === "none" ? void 0 : l,
443
+ ...tr(e.data),
444
+ "data-entry-type": I ? "directory" : "file",
445
+ "data-entry-expanded": I ? String(Y) : void 0,
446
446
  "data-entry-selected": B ? "true" : void 0,
447
- "data-entry-item-selected": Y ? "true" : void 0,
448
- onClick: te,
449
- onMouseEnter: () => K(!0),
450
- onMouseLeave: () => K(!1),
451
- onKeyDown: (ee) => ee.key === "Enter" && te(ee),
447
+ "data-entry-item-selected": G ? "true" : void 0,
448
+ onClick: ue,
449
+ onMouseEnter: () => ee(!0),
450
+ onMouseLeave: () => ee(!1),
451
+ onKeyDown: (ae) => ae.key === "Enter" && ue(ae),
452
452
  tabIndex: 0,
453
453
  children: [
454
- /* @__PURE__ */ i.jsxs("div", { className: _("dt-grid-name-cell", oe?.className), role: "gridcell", style: { width: f, paddingLeft: Math.max(0, t * F) }, children: [
455
- (h || M) && /* @__PURE__ */ i.jsx("span", { className: j, children: P }),
456
- (R ? D : C) && /* @__PURE__ */ i.jsx("span", { className: L, children: Q }),
457
- /* @__PURE__ */ i.jsx("span", { className: G, children: xe })
454
+ /* @__PURE__ */ i.jsxs("div", { className: _("dt-grid-name-cell", V?.className), role: "gridcell", style: { width: h, paddingLeft: Math.max(0, t * Q) }, children: [
455
+ (p || O) && /* @__PURE__ */ i.jsx("span", { className: A, children: b }),
456
+ (I ? L : P) && /* @__PURE__ */ i.jsx("span", { className: se, children: z }),
457
+ /* @__PURE__ */ i.jsx("span", { className: le, children: ye })
458
458
  ] }),
459
- we.length > 0 && /* @__PURE__ */ i.jsx("div", { className: "dt-grid-numeric-viewport", children: /* @__PURE__ */ i.jsx("div", { className: "dt-grid-numeric-track", style: Ut(d, b), children: we.map((ee) => /* @__PURE__ */ i.jsx("div", { className: _("dt-grid-cell", Vt(ee.align), ee.className), role: "gridcell", children: ee.render ? ee.render(e, re) : null }, ee.key)) }) })
459
+ Ne.length > 0 && /* @__PURE__ */ i.jsx("div", { className: "dt-grid-numeric-viewport", children: /* @__PURE__ */ i.jsx("div", { className: "dt-grid-numeric-track", style: sr(d, v), children: Ne.map((ae) => /* @__PURE__ */ i.jsx("div", { className: _("dt-grid-cell", nr(ae.align), ae.className), role: "gridcell", children: ae.render ? ae.render(e, H) : null }, ae.key)) }) })
460
460
  ]
461
461
  }
462
462
  );
463
463
  },
464
464
  (e, t) => {
465
465
  if (e.entry !== t.entry) return !1;
466
- const a = $t(e.entry, e.isDirOpen), n = $t(t.entry, t.isDirOpen);
466
+ const a = qt(e.entry, e.isDirOpen), n = qt(t.entry, t.isDirOpen);
467
467
  return e.indentLevel === t.indentLevel && e.positionInSet === t.positionInSet && e.setSize === t.setSize && e.rowIndex === t.rowIndex && e.isSelectedForAria === t.isSelectedForAria && e.rowHeight === t.rowHeight && a === 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;
468
468
  }
469
469
  );
470
- Xt.displayName = "DirectoryTreeGridRow";
471
- const Jt = ({
470
+ ar.displayName = "DirectoryTreeGridRow";
471
+ const or = ({
472
472
  kind: e,
473
473
  columns: t,
474
474
  numericTemplate: a,
475
475
  numericTotal: n,
476
476
  nameWidth: r,
477
- scrollBarWidth: o,
478
- className: l,
477
+ scrollBarWidth: l,
478
+ className: c,
479
479
  nameContent: u,
480
- renderCell: E
480
+ renderCell: j
481
481
  }) => {
482
- const [, ...b] = t, d = e === "header" ? "dt-grid-name-header" : "dt-grid-name-footer", f = e === "header" ? "dt-grid-header" : "dt-grid-footer", g = e === "header" ? "columnheader" : "gridcell";
483
- return /* @__PURE__ */ i.jsxs("div", { className: _(f, "text-gray-600 dark:text-gray-300", l), role: "row", children: [
482
+ const [, ...v] = t, d = e === "header" ? "dt-grid-name-header" : "dt-grid-name-footer", h = e === "header" ? "dt-grid-header" : "dt-grid-footer", g = e === "header" ? "columnheader" : "gridcell";
483
+ return /* @__PURE__ */ i.jsxs("div", { className: _(h, "text-gray-600 dark:text-gray-300", c), role: "row", children: [
484
484
  /* @__PURE__ */ i.jsx("div", { className: _(d, "px-1", t[0]?.className), role: g, style: { width: r }, children: u }),
485
- b.length > 0 && /* @__PURE__ */ i.jsx("div", { className: "dt-grid-numeric-viewport", children: /* @__PURE__ */ i.jsx("div", { className: "dt-grid-numeric-track", style: Ut(n, a), children: b.map((v) => /* @__PURE__ */ i.jsx("div", { className: _("dt-grid-cell", Vt(v.align), v.className), role: g, children: E(v) }, v.key)) }) }),
486
- /* @__PURE__ */ i.jsx("div", { className: "dt-grid-scrollbar-spacer", style: { width: o }, "aria-hidden": "true" })
485
+ v.length > 0 && /* @__PURE__ */ i.jsx("div", { className: "dt-grid-numeric-viewport", children: /* @__PURE__ */ i.jsx("div", { className: "dt-grid-numeric-track", style: sr(n, a), children: v.map((w) => /* @__PURE__ */ i.jsx("div", { className: _("dt-grid-cell", nr(w.align), w.className), role: g, children: j(w) }, w.key)) }) }),
486
+ /* @__PURE__ */ i.jsx("div", { className: "dt-grid-scrollbar-spacer", style: { width: l }, "aria-hidden": "true" })
487
487
  ] });
488
- }, Sr = ({ columns: e, className: t, ...a }) => /* @__PURE__ */ i.jsx(Jt, { kind: "header", columns: e, className: t, nameContent: e[0]?.header ?? null, renderCell: (n) => n.header ?? null, ...a }), Ht = (e, t) => typeof e == "function" ? e(t) : e ?? null, kr = ({ columns: e, allEntries: t, className: a, ...n }) => /* @__PURE__ */ i.jsx(Jt, { kind: "footer", columns: e, className: a, nameContent: Ht(e[0]?.footer, t), renderCell: (r) => Ht(r.footer, t), ...n }), Nr = 240, qt = 96, Zt = 12, qe = (e, t) => {
488
+ }, Ar = ({ columns: e, className: t, ...a }) => /* @__PURE__ */ i.jsx(or, { kind: "header", columns: e, className: t, nameContent: e[0]?.header ?? null, renderCell: (n) => n.header ?? null, ...a }), Zt = (e, t) => typeof e == "function" ? e(t) : e ?? null, Mr = ({ columns: e, allEntries: t, className: a, ...n }) => /* @__PURE__ */ i.jsx(or, { kind: "footer", columns: e, className: a, nameContent: Zt(e[0]?.footer, t), renderCell: (r) => Zt(r.footer, t), ...n }), Dr = 240, lr = 96, ir = 12, at = (e, t) => {
489
489
  const a = e?.width;
490
490
  return typeof a == "number" && Number.isFinite(a) && a > 0 ? a : t;
491
- }, Er = (e) => e.slice(1).map((t) => `${qe(t, qt)}px`).join(" "), Ir = ({ measuredWidth: e, columns: t, scrollBarWidth: a = Zt }) => {
492
- const n = qe(t[0], Nr), r = t.slice(1).reduce((E, b) => E + qe(b, qt), 0), o = Number.isFinite(e) && e > 0 ? e : 0, l = Math.max(0, o - n - Math.max(0, a)), u = Math.max(0, r - l);
493
- return { nameWidth: n, numericTotal: r, numericVisible: l, maxHScroll: u };
494
- }, Xe = (e, t) => !Number.isFinite(e) || e < 0 ? 0 : e > t ? t : e, jr = (e) => {
491
+ }, Or = (e) => e.slice(1).map((t) => `${at(t, lr)}px`).join(" "), Fr = ({ measuredWidth: e, columns: t, scrollBarWidth: a = ir }) => {
492
+ const n = at(t[0], Dr), r = t.slice(1).reduce((j, v) => j + at(v, lr), 0), l = Number.isFinite(e) && e > 0 ? e : 0, c = Math.max(0, l - n - Math.max(0, a)), u = Math.max(0, r - c);
493
+ return { nameWidth: n, numericTotal: r, numericVisible: c, maxHScroll: u };
494
+ }, nt = (e, t) => !Number.isFinite(e) || e < 0 ? 0 : e > t ? t : e, Lr = (e) => {
495
495
  const t = [], a = (n) => {
496
496
  for (const r of n)
497
497
  t.push(r), r.children && r.children.length > 0 && a(r.children);
498
498
  };
499
499
  return a(e), t;
500
- }, Tr = (e, t) => {
500
+ }, $r = (e, t) => {
501
501
  const a = e.length - 1;
502
502
  if (a <= 0) return 0;
503
- let n = 0, r = a - 1, o = 0;
503
+ let n = 0, r = a - 1, l = 0;
504
504
  for (; n <= r; ) {
505
- const l = n + r >>> 1;
506
- e[l] <= t ? (o = l, n = l + 1) : r = l - 1;
505
+ const c = n + r >>> 1;
506
+ e[c] <= t ? (l = c, n = c + 1) : r = c - 1;
507
507
  }
508
- return o;
509
- }, Cr = (e, t, a) => {
508
+ return l;
509
+ }, Hr = (e, t, a) => {
510
510
  if (a <= 0 || e.length === 0 || t.length !== e.length + 1)
511
511
  return null;
512
- const n = Tr(t, a), r = e[n];
512
+ const n = $r(t, a), r = e[n];
513
513
  return r ? {
514
514
  path: r.entry.absolutePath,
515
515
  offsetInViewport: a - t[n]
516
516
  } : null;
517
- }, Rr = (e, t, a) => {
517
+ }, Wr = (e, t, a) => {
518
518
  if (t.length === 0 || a.length !== t.length + 1)
519
519
  return null;
520
520
  for (let n = 0; n < t.length; n++)
521
521
  if (t[n].entry.absolutePath === e.path)
522
522
  return Math.max(0, a[n] + e.offsetInViewport);
523
523
  return null;
524
- }, Pr = (e, t, a) => {
524
+ }, Br = (e, t, a) => {
525
525
  const n = [];
526
526
  for (let r = t; r < a; r++) {
527
- const o = e[r];
528
- if (!(!o || o.length === 0))
529
- for (const l of o)
530
- n.push(l);
527
+ const l = e[r];
528
+ if (!(!l || l.length === 0))
529
+ for (const c of l)
530
+ n.push(c);
531
531
  }
532
532
  return n;
533
- }, _r = (e, t, a) => {
533
+ }, zr = (e, t, a) => {
534
534
  const n = [];
535
535
  for (let r = t; r < a; r++) {
536
- const o = e[r];
537
- if (!(!o || o.length === 0))
538
- for (const l of o)
539
- n.push(l);
536
+ const l = e[r];
537
+ if (!(!l || l.length === 0))
538
+ for (const c of l)
539
+ n.push(c);
540
540
  }
541
541
  return n;
542
- }, Ar = (e, t, a, n) => {
543
- const r = Math.max(1, Math.floor(t * n)), o = Math.max(1, Math.floor(a * n));
544
- (e.width !== r || e.height !== o) && (e.width = r, e.height = o);
545
- const l = e.style;
546
- l.width !== `${t}px` && (l.width = `${t}px`), l.height !== `${a}px` && (l.height = `${a}px`);
547
- }, Mr = (e, t, a) => {
542
+ }, Yr = (e, t, a, n) => {
543
+ const r = Math.max(1, Math.floor(t * n)), l = Math.max(1, Math.floor(a * n));
544
+ (e.width !== r || e.height !== l) && (e.width = r, e.height = l);
545
+ const c = e.style;
546
+ c.width !== `${t}px` && (c.width = `${t}px`), c.height !== `${a}px` && (c.height = `${a}px`);
547
+ }, Gr = (e, t, a) => {
548
548
  e.lineWidth = a, e.beginPath();
549
549
  for (const n of t)
550
550
  e.moveTo(n.x1, n.y1), e.lineTo(n.x2, n.y2);
551
551
  e.stroke();
552
- }, Or = (e, t) => {
552
+ }, Vr = (e, t) => {
553
553
  const a = /^#([0-9a-f]{3}|[0-9a-f]{6})$/i.exec(e.trim());
554
554
  if (!a)
555
555
  return null;
556
556
  let n = a[1];
557
557
  n.length === 3 && (n = n.split("").map((u) => u + u).join(""));
558
- const r = Number.parseInt(n.slice(0, 2), 16), o = Number.parseInt(n.slice(2, 4), 16), l = Number.parseInt(n.slice(4, 6), 16);
559
- return `rgba(${r}, ${o}, ${l}, ${t})`;
560
- }, Fr = (e, t, a, n) => {
558
+ const r = Number.parseInt(n.slice(0, 2), 16), l = Number.parseInt(n.slice(2, 4), 16), c = Number.parseInt(n.slice(4, 6), 16);
559
+ return `rgba(${r}, ${l}, ${c}, ${t})`;
560
+ }, Ur = (e, t, a, n) => {
561
561
  if (t.length === 0)
562
562
  return;
563
- const r = Or(a, 0.14), o = e.strokeStyle, l = e.fillStyle, u = e.lineWidth, E = e.lineCap, b = e.lineJoin;
563
+ const r = Vr(a, 0.14), l = e.strokeStyle, c = e.fillStyle, u = e.lineWidth, j = e.lineCap, v = e.lineJoin;
564
564
  e.strokeStyle = a, e.lineCap = "round", e.lineJoin = "round";
565
565
  for (const d of t) {
566
- const f = n ?? d.size, g = Math.max(0, f / 2), v = Math.max(1, Math.round(f * 0.08)), S = Math.max(1, Math.round(f * 0.14)), m = Math.max(0, g - v * 0.8), x = Math.max(0, m * 0.55);
567
- r && (e.fillStyle = r, e.beginPath(), e.arc(d.centerX, d.centerY, m, 0, Math.PI * 2), e.fill()), e.lineWidth = v, e.beginPath(), e.arc(d.centerX, d.centerY, Math.max(0, g - v * 0.3), 0, Math.PI * 2), e.stroke(), e.lineWidth = S, e.beginPath(), e.moveTo(d.centerX - x, d.centerY), e.lineTo(d.centerX + x, d.centerY), e.stroke(), d.isExpanded || (e.beginPath(), e.moveTo(d.centerX, d.centerY - x), e.lineTo(d.centerX, d.centerY + x), e.stroke());
566
+ const h = n ?? d.size, g = Math.max(0, h / 2), w = Math.max(1, Math.round(h * 0.08)), E = Math.max(1, Math.round(h * 0.14)), f = Math.max(0, g - w * 0.8), y = Math.max(0, f * 0.55);
567
+ r && (e.fillStyle = r, e.beginPath(), e.arc(d.centerX, d.centerY, f, 0, Math.PI * 2), e.fill()), e.lineWidth = w, e.beginPath(), e.arc(d.centerX, d.centerY, Math.max(0, g - w * 0.3), 0, Math.PI * 2), e.stroke(), e.lineWidth = E, e.beginPath(), e.moveTo(d.centerX - y, d.centerY), e.lineTo(d.centerX + y, d.centerY), e.stroke(), d.isExpanded || (e.beginPath(), e.moveTo(d.centerX, d.centerY - y), e.lineTo(d.centerX, d.centerY + y), e.stroke());
568
568
  }
569
- e.strokeStyle = o, e.fillStyle = l, e.lineWidth = u, e.lineCap = E, e.lineJoin = b;
570
- }, Kt = Ze(({ segmentsByItem: e, glyphsByItem: t, itemHeight: a, width: n, viewportHeight: r, scrollPosition: o, color: l = "#a0aec0", strokeWidth: u = 1, renderStartIndex: E, renderEndIndex: b, lookaheadEndIndex: d, devicePixelRatio: f, expandGlyphColor: g, expandGlyphSize: v }) => {
571
- const S = ue(null), m = ue(null), x = ue({
569
+ e.strokeStyle = l, e.fillStyle = c, e.lineWidth = u, e.lineCap = j, e.lineJoin = v;
570
+ }, cr = ot(({ segmentsByItem: e, glyphsByItem: t, itemHeight: a, width: n, viewportHeight: r, scrollPosition: l, color: c = "#a0aec0", strokeWidth: u = 1, renderStartIndex: j, renderEndIndex: v, lookaheadEndIndex: d, devicePixelRatio: h, expandGlyphColor: g, expandGlyphSize: w }) => {
571
+ const E = ne(null), f = ne(null), y = ne({
572
572
  segmentsByItem: e,
573
573
  glyphsByItem: t,
574
574
  itemHeight: a,
575
575
  width: n,
576
576
  viewportHeight: r,
577
- scrollPosition: o,
578
- color: l,
577
+ scrollPosition: l,
578
+ color: c,
579
579
  strokeWidth: u,
580
- renderStartIndex: E,
581
- renderEndIndex: b,
580
+ renderStartIndex: j,
581
+ renderEndIndex: v,
582
582
  lookaheadEndIndex: d,
583
- devicePixelRatio: f,
583
+ devicePixelRatio: h,
584
584
  expandGlyphColor: g,
585
- expandGlyphSize: v
586
- }), k = W(() => {
587
- m.current = null;
588
- const N = S.current;
585
+ expandGlyphSize: w
586
+ }), k = F(() => {
587
+ f.current = null;
588
+ const N = E.current;
589
589
  if (!N)
590
590
  return;
591
- const w = N.getContext("2d");
592
- if (!w)
591
+ const S = N.getContext("2d");
592
+ if (!S)
593
593
  return;
594
- const h = x.current;
595
- if (h.width <= 0 || h.viewportHeight <= 0) {
596
- w.clearRect(0, 0, N.width, N.height);
594
+ const p = y.current;
595
+ if (p.width <= 0 || p.viewportHeight <= 0) {
596
+ S.clearRect(0, 0, N.width, N.height);
597
597
  return;
598
598
  }
599
- const D = Number.isFinite(h.devicePixelRatio ?? NaN) ? h.devicePixelRatio : typeof window < "u" && window.devicePixelRatio || 1;
600
- Ar(N, h.width, h.viewportHeight, D);
601
- const C = h.segmentsByItem.length, M = typeof h.renderStartIndex == "number" && Number.isFinite(h.renderStartIndex) ? Math.max(0, Math.floor(h.renderStartIndex)) : Math.max(0, Math.floor(h.scrollPosition / h.itemHeight)), J = Math.min(C, Math.ceil((h.scrollPosition + h.viewportHeight) / h.itemHeight)), F = (() => {
602
- if (typeof h.renderEndIndex == "number" && Number.isFinite(h.renderEndIndex)) {
603
- const R = Math.floor(h.renderEndIndex);
604
- return Math.max(Math.min(C, R + 1), M);
599
+ const L = Number.isFinite(p.devicePixelRatio ?? NaN) ? p.devicePixelRatio : typeof window < "u" && window.devicePixelRatio || 1;
600
+ Yr(N, p.width, p.viewportHeight, L);
601
+ const P = p.segmentsByItem.length, O = typeof p.renderStartIndex == "number" && Number.isFinite(p.renderStartIndex) ? Math.max(0, Math.floor(p.renderStartIndex)) : Math.max(0, Math.floor(p.scrollPosition / p.itemHeight)), K = Math.min(P, Math.ceil((p.scrollPosition + p.viewportHeight) / p.itemHeight)), Q = (() => {
602
+ if (typeof p.renderEndIndex == "number" && Number.isFinite(p.renderEndIndex)) {
603
+ const I = Math.floor(p.renderEndIndex);
604
+ return Math.max(Math.min(P, I + 1), O);
605
605
  }
606
- return Math.max(J, M);
607
- })(), H = (() => {
608
- if (typeof h.lookaheadEndIndex == "number" && Number.isFinite(h.lookaheadEndIndex)) {
609
- const R = Math.floor(h.lookaheadEndIndex), z = Math.min(C, R + 1);
610
- return Math.max(z, F);
606
+ return Math.max(K, O);
607
+ })(), $ = (() => {
608
+ if (typeof p.lookaheadEndIndex == "number" && Number.isFinite(p.lookaheadEndIndex)) {
609
+ const I = Math.floor(p.lookaheadEndIndex), Y = Math.min(P, I + 1);
610
+ return Math.max(Y, Q);
611
611
  }
612
- return Math.max(J, F);
613
- })(), q = Pr(h.segmentsByItem, M, H), K = _r(h.glyphsByItem, M, H);
614
- w.save(), w.scale(D, D), w.clearRect(0, 0, h.width, h.viewportHeight), w.translate(0, -h.scrollPosition), w.strokeStyle = h.color, Mr(w, q, h.strokeWidth), Fr(w, K, h.expandGlyphColor ?? h.color, h.expandGlyphSize), w.restore();
615
- }, []), I = W(() => {
616
- m.current === null && (m.current = window.requestAnimationFrame(k));
612
+ return Math.max(K, Q);
613
+ })(), J = Br(p.segmentsByItem, O, $), ee = zr(p.glyphsByItem, O, $);
614
+ S.save(), S.scale(L, L), S.clearRect(0, 0, p.width, p.viewportHeight), S.translate(0, -p.scrollPosition), S.strokeStyle = p.color, Gr(S, J, p.strokeWidth), Ur(S, ee, p.expandGlyphColor ?? p.color, p.expandGlyphSize), S.restore();
615
+ }, []), R = F(() => {
616
+ f.current === null && (f.current = window.requestAnimationFrame(k));
617
617
  }, [k]);
618
618
  return me(() => {
619
- x.current = {
619
+ y.current = {
620
620
  segmentsByItem: e,
621
621
  glyphsByItem: t,
622
622
  itemHeight: a,
623
623
  width: n,
624
624
  viewportHeight: r,
625
- scrollPosition: o,
626
- color: l,
625
+ scrollPosition: l,
626
+ color: c,
627
627
  strokeWidth: u,
628
- renderStartIndex: E,
629
- renderEndIndex: b,
628
+ renderStartIndex: j,
629
+ renderEndIndex: v,
630
630
  lookaheadEndIndex: d,
631
- devicePixelRatio: f,
631
+ devicePixelRatio: h,
632
632
  expandGlyphColor: g,
633
- expandGlyphSize: v
634
- }, I();
635
- }, [e, t, a, n, r, o, l, u, E, b, d, f, g, v, I]), me(() => () => {
636
- m.current !== null && (window.cancelAnimationFrame(m.current), m.current = null);
637
- }, []), /* @__PURE__ */ i.jsx("canvas", { ref: S, className: "pointer-events-none absolute top-0 left-0 z-0" });
633
+ expandGlyphSize: w
634
+ }, R();
635
+ }, [e, t, a, n, r, l, c, u, j, v, d, h, g, w, R]), me(() => () => {
636
+ f.current !== null && (window.cancelAnimationFrame(f.current), f.current = null);
637
+ }, []), /* @__PURE__ */ i.jsx("canvas", { ref: E, className: "pointer-events-none absolute top-0 left-0 z-0" });
638
638
  });
639
- Kt.displayName = "TreeLineCanvas";
640
- const Dr = {
639
+ cr.displayName = "TreeLineCanvas";
640
+ const Xr = {
641
641
  msOverflowStyle: "none",
642
642
  scrollbarWidth: "none"
643
- }, Lr = () => {
643
+ }, Jr = () => {
644
644
  let e = document.getElementById("directory-tree-webkit-scrollbar-hide");
645
645
  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));
646
- }, $r = (e, t, a, n, r) => {
647
- const o = [], l = [];
646
+ }, qr = (e, t, a, n, r) => {
647
+ const l = [], c = [];
648
648
  let u = 0;
649
- const E = (b, d, f) => {
650
- const g = r ? [...b].sort(r) : b;
651
- for (let v = 0; v < g.length; v++) {
652
- const S = g[v], m = v === g.length - 1, x = [...f, m], k = S.children !== void 0, I = k && t(S.absolutePath, S.relativePath);
653
- let N = d, w = x, h = f;
654
- n && (N = d - 1, w = x.slice(1), h = f.slice(1)), o.push({ entry: S, indentLevel: N, depth: d, positionInSet: v + 1, setSize: g.length, parentIsLast: w }), a && (N > u && (u = N), l.push({
655
- id: S.absolutePath,
656
- name: S.name,
657
- absolutePath: S.absolutePath,
649
+ const j = (v, d, h) => {
650
+ const g = r ? [...v].sort(r) : v;
651
+ for (let w = 0; w < g.length; w++) {
652
+ const E = g[w], f = w === g.length - 1, y = [...h, f], k = E.children !== void 0, R = k && t(E.absolutePath, E.relativePath);
653
+ let N = d, S = y, p = h;
654
+ n && (N = d - 1, S = y.slice(1), p = h.slice(1)), l.push({ entry: E, indentLevel: N, depth: d, positionInSet: w + 1, setSize: g.length, parentIsLast: S }), a && (N > u && (u = N), c.push({
655
+ id: E.absolutePath,
656
+ name: E.name,
657
+ absolutePath: E.absolutePath,
658
658
  indentLevel: N,
659
- isLastChild: m,
659
+ isLastChild: f,
660
660
  isDirectory: k,
661
- isExpanded: I,
662
- ancestorIsLast: [...h],
661
+ isExpanded: R,
662
+ ancestorIsLast: [...p],
663
663
  hideLines: n && d === 0
664
- })), k && I && S.children && E(S.children, d + 1, x);
664
+ })), k && R && E.children && j(E.children, d + 1, y);
665
665
  }
666
666
  };
667
- return E(e, 0, []), { flatItems: o, lineItems: l, maxIndent: u };
668
- }, Wt = (e, t) => {
667
+ return j(e, 0, []), { flatItems: l, lineItems: c, maxIndent: u };
668
+ }, Kt = (e, t) => {
669
669
  const a = e.length - 1;
670
670
  if (a <= 0) return 0;
671
- let n = 0, r = a - 1, o = 0;
671
+ let n = 0, r = a - 1, l = 0;
672
672
  for (; n <= r; ) {
673
- const l = n + r >>> 1;
674
- e[l] <= t ? (o = l, n = l + 1) : r = l - 1;
673
+ const c = n + r >>> 1;
674
+ e[c] <= t ? (l = c, n = c + 1) : r = c - 1;
675
675
  }
676
- return o;
677
- }, Hr = (e, t, a, n, r, o) => {
678
- const l = n?.renderStart ?? Math.max(0, Wt(o, r)), u = t > 0 ? Wt(o, r + t) + a : l + a, E = e > 0 ? Math.min(e - 1, Math.max(l, u)) : l, b = n?.renderEnd ?? E, d = e > 0 ? Math.min(e - 1, b + a) : b;
679
- return { renderStart: l, renderEnd: b, lookaheadEnd: d };
680
- }, Wr = (e, t, a, n, r, o) => {
676
+ return l;
677
+ }, Zr = (e, t, a, n, r, l) => {
678
+ const c = n?.renderStart ?? Math.max(0, Kt(l, r)), u = t > 0 ? Kt(l, r + t) + a : c + a, j = e > 0 ? Math.min(e - 1, Math.max(c, u)) : c, v = n?.renderEnd ?? j, d = e > 0 ? Math.min(e - 1, v + a) : v;
679
+ return { renderStart: c, renderEnd: v, lookaheadEnd: d };
680
+ }, Kr = (e, t, a, n, r, l) => {
681
681
  if (e.length === 0)
682
682
  return { segmentsByItem: [], glyphsByItem: [] };
683
- const l = Array.from({ length: e.length }, () => []), u = Array.from({ length: e.length }, () => []), E = (d) => r ? typeof o == "number" && Number.isFinite(o) && o > 0 ? o : Math.max(8, Math.min(n * 0.9, d * 0.7)) : 0, b = 3;
683
+ const c = Array.from({ length: e.length }, () => []), u = Array.from({ length: e.length }, () => []), j = (d) => r ? typeof l == "number" && Number.isFinite(l) && l > 0 ? l : Math.max(8, Math.min(n * 0.9, d * 0.7)) : 0, v = 3;
684
684
  for (let d = 0; d < e.length; d++) {
685
- const f = e[d];
686
- if (f.hideLines)
685
+ const h = e[d];
686
+ if (h.hideLines)
687
687
  continue;
688
- const g = [], v = t[d] ?? 0, S = a[d] ?? 0, m = S + v / 2, x = E(v), k = x > 0 ? x / 2 + 2 : n / 1.5;
689
- for (let w = 0; w < f.indentLevel; w++) {
690
- if (f.ancestorIsLast[w] ?? !1)
688
+ const g = [], w = t[d] ?? 0, E = a[d] ?? 0, f = E + w / 2, y = j(w), k = y > 0 ? y / 2 + 2 : n / 1.5;
689
+ for (let S = 0; S < h.indentLevel; S++) {
690
+ if (h.ancestorIsLast[S] ?? !1)
691
691
  continue;
692
- let D = !1;
693
- for (let C = d; C < e.length; C++) {
694
- const M = e[C];
695
- if (M.indentLevel > w && M.ancestorIsLast.length > w && !M.ancestorIsLast[w]) {
696
- D = !0;
692
+ let L = !1;
693
+ for (let P = d; P < e.length; P++) {
694
+ const O = e[P];
695
+ if (O.indentLevel > S && O.ancestorIsLast.length > S && !O.ancestorIsLast[S]) {
696
+ L = !0;
697
697
  break;
698
698
  }
699
- if (C > d && M.indentLevel === w)
699
+ if (P > d && O.indentLevel === S)
700
700
  break;
701
701
  }
702
- if (D) {
703
- const C = w * n + n / 2 + b;
702
+ if (L) {
703
+ const P = S * n + n / 2 + v;
704
704
  g.push({
705
- key: `${f.id}-ancestor-${w}`,
706
- x1: C,
707
- y1: S,
708
- x2: C,
709
- y2: S + v,
705
+ key: `${h.id}-ancestor-${S}`,
706
+ x1: P,
707
+ y1: E,
708
+ x2: P,
709
+ y2: E + w,
710
710
  itemIndex: d
711
711
  });
712
712
  }
713
713
  }
714
- const I = f.indentLevel * n, N = I + n / 2 + b;
715
- if (f.isDirectory ? g.push({
716
- key: `${f.id}-connector-top`,
714
+ const R = h.indentLevel * n, N = R + n / 2 + v;
715
+ if (h.isDirectory ? g.push({
716
+ key: `${h.id}-connector-top`,
717
717
  x1: N,
718
- y1: S,
718
+ y1: E,
719
719
  x2: N,
720
- y2: m - k,
720
+ y2: f - k,
721
721
  itemIndex: d
722
722
  }) : g.push({
723
- key: `${f.id}-connector-top`,
723
+ key: `${h.id}-connector-top`,
724
724
  x1: N,
725
- y1: S,
725
+ y1: E,
726
726
  x2: N,
727
- y2: m,
727
+ y2: f,
728
728
  itemIndex: d
729
- }), !f.isDirectory && f.isLastChild && g.push({
730
- key: `${f.id}-connector-horizontal`,
729
+ }), !h.isDirectory && h.isLastChild && g.push({
730
+ key: `${h.id}-connector-horizontal`,
731
731
  x1: N,
732
- y1: m,
733
- x2: I + n + b,
734
- y2: m,
732
+ y1: f,
733
+ x2: R + n + v,
734
+ y2: f,
735
735
  itemIndex: d
736
- }), f.isLastChild || (f.isDirectory ? g.push({
737
- key: `${f.id}-connector-bottom`,
736
+ }), h.isLastChild || (h.isDirectory ? g.push({
737
+ key: `${h.id}-connector-bottom`,
738
738
  x1: N,
739
- y1: m + k,
739
+ y1: f + k,
740
740
  x2: N,
741
- y2: S + v,
741
+ y2: E + w,
742
742
  itemIndex: d
743
743
  }) : g.push({
744
- key: `${f.id}-connector-bottom`,
744
+ key: `${h.id}-connector-bottom`,
745
745
  x1: N,
746
- y1: m,
746
+ y1: f,
747
747
  x2: N,
748
- y2: S + v,
748
+ y2: E + w,
749
749
  itemIndex: d
750
- })), l[d] = g, r && f.isDirectory) {
751
- const w = x, h = N, D = m;
750
+ })), c[d] = g, r && h.isDirectory) {
751
+ const S = y, p = N, L = f;
752
752
  u[d] = [
753
753
  {
754
- key: `${f.id}-glyph`,
754
+ key: `${h.id}-glyph`,
755
755
  itemIndex: d,
756
- centerX: h,
757
- centerY: D,
758
- size: w,
759
- isExpanded: f.isExpanded
756
+ centerX: p,
757
+ centerY: L,
758
+ size: S,
759
+ isExpanded: h.isExpanded
760
760
  }
761
761
  ];
762
762
  }
763
763
  }
764
- return { segmentsByItem: l, glyphsByItem: u };
765
- }, Ke = Ze(
764
+ return { segmentsByItem: c, glyphsByItem: u };
765
+ }, lt = ot(
766
766
  ({
767
767
  entry: e,
768
768
  indentLevel: t,
769
769
  depth: a,
770
770
  positionInSet: n,
771
771
  setSize: r,
772
- isSelectedForAria: o,
773
- rowHeight: l,
774
- isDirOpen: u,
775
- parentIsLast: E,
776
- renderChildren: b = !0,
777
- expansion: { toggleDirectory: d, onToggleDirectoryRecursive: f },
778
- selection: { onEntryClick: g, selectedPath: v, mode: S = "none", selectedItems: m, onSelectionChange: x },
772
+ isSelectedForAria: l,
773
+ flatIndex: c,
774
+ isActive: u,
775
+ registerRowRef: j,
776
+ onNavigationKeyDown: v,
777
+ rowHeight: d,
778
+ isDirOpen: h,
779
+ parentIsLast: g,
780
+ renderChildren: w = !0,
781
+ expansion: { toggleDirectory: E, onToggleDirectoryRecursive: f },
782
+ selection: { onEntryClick: y, selectedPath: k, mode: R = "none", selectedItems: N, onSelectionChange: S },
779
783
  visual: {
780
- iconOverrides: k,
781
- showExpandIcons: I = !0,
782
- showDirectoryIcons: N = !0,
783
- showFileIcons: w = !0,
784
- useCanvasExpandIcons: h = !1,
785
- expandIconSize: D,
786
- typeIconSize: C,
787
- fontSize: M,
788
- indentSize: J = $e,
789
- highlightStyles: F,
790
- entryClassName: H,
791
- entryStyle: q,
792
- nameClassName: K,
793
- nameStyle: R,
794
- directoryNameClassName: z,
795
- directoryNameStyle: B,
796
- fileNameClassName: Y,
797
- fileNameStyle: ae
784
+ iconOverrides: p,
785
+ showExpandIcons: L = !0,
786
+ showDirectoryIcons: P = !0,
787
+ showFileIcons: O = !0,
788
+ useCanvasExpandIcons: K = !1,
789
+ expandIconSize: Q,
790
+ typeIconSize: $,
791
+ fontSize: J,
792
+ indentSize: ee = Ge,
793
+ highlightStyles: I,
794
+ entryClassName: Y,
795
+ entryStyle: B,
796
+ nameClassName: G,
797
+ nameStyle: de,
798
+ directoryNameClassName: ue,
799
+ directoryNameStyle: C,
800
+ fileNameClassName: s,
801
+ fileNameStyle: m
798
802
  }
799
803
  }) => {
800
- const [te, A] = ce(null), [s, p] = ce(!1), y = e.children !== void 0, j = y && u(e.absolutePath), L = e.absolutePath === v, G = !y && m?.has(e.absolutePath), P = y ? void 0 : ge(e.name) || ge(e.relativePath) || ge(e.absolutePath);
804
+ const [T, A] = ce(null), [se, le] = ce(!1), b = e.children !== void 0, z = b && h(e.absolutePath), H = e.absolutePath === k, V = !b && N?.has(e.absolutePath), Ne = b ? void 0 : Ee(e.name) || Ee(e.relativePath) || Ee(e.absolutePath);
801
805
  me(() => {
802
- A(j && e.children ? e.children : null);
803
- }, [j, e.children]);
804
- const Q = Gt({ entry: e, isDirectory: y, isExpanded: j, isItemSelected: !!G, selectionMode: S, onSelectionChange: x, onEntryClick: g, toggleDirectory: d, onToggleDirectoryRecursive: f }), re = s ? F?.hoverClassName !== void 0 ? F.hoverClassName : O.entryHover : "", oe = (() => {
805
- if (y) {
806
- if (L)
807
- return F?.directorySelectedClassName !== void 0 ? F.directorySelectedClassName : O.entrySelected;
808
- } else if (L || G)
809
- return F?.itemSelectedClassName !== void 0 ? F.itemSelectedClassName : _(L && O.entrySelected, G && O.entryItemSelected);
806
+ A(z && e.children ? e.children : null);
807
+ }, [z, e.children]);
808
+ const ye = rr({ entry: e, isDirectory: b, isExpanded: z, isItemSelected: !!V, selectionMode: R, onSelectionChange: S, onEntryClick: y, toggleDirectory: E, onToggleDirectoryRecursive: f }), ge = se ? I?.hoverClassName !== void 0 ? I.hoverClassName : D.entryHover : "", ae = (() => {
809
+ if (b) {
810
+ if (H)
811
+ return I?.directorySelectedClassName !== void 0 ? I.directorySelectedClassName : D.entrySelected;
812
+ } else if (H || V)
813
+ return I?.itemSelectedClassName !== void 0 ? I.itemSelectedClassName : _(H && D.entrySelected, V && D.entryItemSelected);
810
814
  return "";
811
- })(), we = _(O.entry, re, oe, H, e.className), xe = _(O.expandIcon, (L || G) && O.expandIconSelected), be = _(O.typeIcon, (L || G) && O.typeIconSelected), ee = _(O.name, K, y && O.nameDirectory, y && z, !y && Y, (L || G) && O.nameSelected), He = Bt({ isDirectory: y, isExpanded: j, showExpandIcons: I, useCanvasExpandIcons: h, expandIconSize: D }), Se = (y ? N : w) ? zt({ entry: e, isDirectory: y, isExpanded: j, isSelected: L, isItemSelected: !!G, extension: P, mimeType: e.mimeType }, k) : null, Re = {
812
- ...s ? F?.hoverStyle : {},
813
- ...y && L ? F?.directorySelectedStyle : {},
814
- ...!y && (L || G) ? F?.itemSelectedStyle : {}
815
- }, Pe = Yt(e.data), _e = C ? { width: C, height: C } : void 0, je = M ? { fontSize: typeof M == "number" ? `${M}px` : M } : void 0;
816
- return /* @__PURE__ */ i.jsxs(ir, { children: [
815
+ })(), Ve = _(D.entry, ge, ae, Y, e.className), je = _(D.expandIcon, (H || V) && D.expandIconSelected), Ae = _(D.typeIcon, (H || V) && D.typeIconSelected), Me = _(D.name, G, b && D.nameDirectory, b && ue, !b && s, (H || V) && D.nameSelected), De = Qt({ isDirectory: b, isExpanded: z, showExpandIcons: L, useCanvasExpandIcons: K, expandIconSize: Q }), Oe = (b ? P : O) ? er({ entry: e, isDirectory: b, isExpanded: z, isSelected: H, isItemSelected: !!V, extension: Ne, mimeType: e.mimeType }, p) : null, Fe = {
816
+ ...se ? I?.hoverStyle : {},
817
+ ...b && H ? I?.directorySelectedStyle : {},
818
+ ...!b && (H || V) ? I?.itemSelectedStyle : {}
819
+ }, ie = tr(e.data), Le = $ ? { width: $, height: $ } : void 0, he = J ? { fontSize: typeof J == "number" ? `${J}px` : J } : void 0;
820
+ return /* @__PURE__ */ i.jsxs(vr, { children: [
817
821
  /* @__PURE__ */ i.jsxs(
818
822
  "div",
819
823
  {
820
- className: we,
824
+ className: Ve,
821
825
  style: {
822
- paddingLeft: `${Math.max(0, t * J)}px`,
823
- transform: t < 0 ? `translateX(${t * J}px)` : void 0,
824
- width: t < 0 ? `calc(100% + ${Math.abs(t * J)}px)` : void 0,
825
- height: `${l}px`,
826
- ...je,
827
- ...Re,
828
- ...q,
826
+ paddingLeft: `${Math.max(0, t * ee)}px`,
827
+ transform: t < 0 ? `translateX(${t * ee}px)` : void 0,
828
+ width: t < 0 ? `calc(100% + ${Math.abs(t * ee)}px)` : void 0,
829
+ height: `${d}px`,
830
+ ...he,
831
+ ...Fe,
832
+ ...B,
829
833
  ...e.style
830
834
  },
831
- ...Pe,
832
- "data-entry-type": y ? "directory" : "file",
833
- "data-entry-expanded": y ? String(j) : void 0,
834
- "data-entry-selected": L ? "true" : void 0,
835
- "data-entry-item-selected": G ? "true" : void 0,
836
- onClick: Q,
837
- onMouseEnter: () => p(!0),
838
- onMouseLeave: () => p(!1),
839
- onKeyDown: (le) => le.key === "Enter" && Q(le),
840
- tabIndex: 0,
835
+ ...ie,
836
+ "data-entry-type": b ? "directory" : "file",
837
+ "data-entry-expanded": b ? String(z) : void 0,
838
+ "data-entry-selected": H ? "true" : void 0,
839
+ "data-entry-item-selected": V ? "true" : void 0,
840
+ onClick: ye,
841
+ onMouseEnter: () => le(!0),
842
+ onMouseLeave: () => le(!1),
843
+ ref: (te) => j(c, te),
844
+ onKeyDown: (te) => {
845
+ if (te.key === "Enter" || te.key === " ") {
846
+ te.preventDefault(), ye(te);
847
+ return;
848
+ }
849
+ v(te, c);
850
+ },
851
+ tabIndex: u ? 0 : -1,
841
852
  role: "treeitem",
842
- "aria-expanded": y ? j : void 0,
853
+ "aria-expanded": b ? z : void 0,
843
854
  "aria-level": a + 1,
844
855
  "aria-posinset": n,
845
856
  "aria-setsize": r,
846
- "aria-selected": S === "none" ? void 0 : o,
847
- "aria-label": `${e.name} (${y ? "directory" : "file"})`,
857
+ "aria-selected": R === "none" ? void 0 : l,
858
+ "aria-label": `${e.name} (${b ? "directory" : "file"})`,
848
859
  children: [
849
- (I || h) && /* @__PURE__ */ i.jsx("span", { className: xe, children: He }),
850
- (y ? N : w) && /* @__PURE__ */ i.jsx("span", { className: be, style: _e, children: Se }),
860
+ (L || K) && /* @__PURE__ */ i.jsx("span", { className: je, children: De }),
861
+ (b ? P : O) && /* @__PURE__ */ i.jsx("span", { className: Ae, style: Le, children: Oe }),
851
862
  /* @__PURE__ */ i.jsx(
852
863
  "span",
853
864
  {
854
- className: ee,
865
+ className: Me,
855
866
  style: {
856
- ...je,
857
- ...R,
858
- ...y ? B : ae
867
+ ...he,
868
+ ...de,
869
+ ...b ? C : m
859
870
  },
860
- "data-entry-type": y ? "directory" : "file",
871
+ "data-entry-type": b ? "directory" : "file",
861
872
  "data-entry-role": "name",
862
873
  children: e.label ?? e.name
863
874
  }
@@ -865,487 +876,557 @@ const Dr = {
865
876
  ]
866
877
  }
867
878
  ),
868
- j && te && b && /* @__PURE__ */ i.jsx("fieldset", { children: te.map((le, ne) => /* @__PURE__ */ i.jsx(
869
- Ke,
879
+ z && T && w && /* @__PURE__ */ i.jsx("fieldset", { children: T.map((te, oe) => /* @__PURE__ */ i.jsx(
880
+ lt,
870
881
  {
871
- entry: le,
882
+ entry: te,
872
883
  indentLevel: t + 1,
873
884
  depth: a + 1,
874
- positionInSet: ne + 1,
875
- setSize: te.length,
876
- isSelectedForAria: S === "single" ? le.absolutePath === v : !!m?.has(le.absolutePath),
877
- rowHeight: l,
878
- isDirOpen: u,
879
- parentIsLast: [...E, ne === te.length - 1],
880
- expansion: { toggleDirectory: d, onToggleDirectoryRecursive: f },
881
- selection: { onEntryClick: g, selectedPath: v, mode: S, selectedItems: m, onSelectionChange: x },
885
+ positionInSet: oe + 1,
886
+ setSize: T.length,
887
+ isSelectedForAria: !!N?.has(te.absolutePath),
888
+ flatIndex: -1,
889
+ isActive: !1,
890
+ registerRowRef: j,
891
+ onNavigationKeyDown: v,
892
+ rowHeight: d,
893
+ isDirOpen: h,
894
+ parentIsLast: [...g, oe === T.length - 1],
895
+ expansion: { toggleDirectory: E, onToggleDirectoryRecursive: f },
896
+ selection: { onEntryClick: y, selectedPath: k, mode: R, selectedItems: N, onSelectionChange: S },
882
897
  visual: {
883
- iconOverrides: k,
884
- showExpandIcons: I,
885
- showDirectoryIcons: N,
886
- showFileIcons: w,
887
- useCanvasExpandIcons: h,
888
- expandIconSize: D,
889
- highlightStyles: F,
890
- entryClassName: H,
891
- entryStyle: q,
892
- nameClassName: K,
893
- nameStyle: R,
894
- directoryNameClassName: z,
895
- directoryNameStyle: B,
896
- fileNameClassName: Y,
897
- fileNameStyle: ae
898
+ iconOverrides: p,
899
+ showExpandIcons: L,
900
+ showDirectoryIcons: P,
901
+ showFileIcons: O,
902
+ useCanvasExpandIcons: K,
903
+ expandIconSize: Q,
904
+ highlightStyles: I,
905
+ entryClassName: Y,
906
+ entryStyle: B,
907
+ nameClassName: G,
908
+ nameStyle: de,
909
+ directoryNameClassName: ue,
910
+ directoryNameStyle: C,
911
+ fileNameClassName: s,
912
+ fileNameStyle: m
898
913
  }
899
914
  },
900
- le.absolutePath
915
+ te.absolutePath
901
916
  )) })
902
917
  ] }, e.absolutePath);
903
918
  },
904
919
  (e, t) => {
905
920
  if (e.entry !== t.entry) return !1;
906
- const a = e.entry.children !== void 0, n = t.entry.children !== void 0, r = a && e.isDirOpen(e.entry.absolutePath), o = n && t.isDirOpen(t.entry.absolutePath);
921
+ const a = e.entry.children !== void 0, n = t.entry.children !== void 0, r = a && e.isDirOpen(e.entry.absolutePath), l = n && t.isDirOpen(t.entry.absolutePath);
907
922
  return e.indentLevel === t.indentLevel && // 位置情報は aria として描画されるため、変化したら再描画が必要
908
- e.depth === t.depth && e.positionInSet === t.positionInSet && e.setSize === t.setSize && e.isSelectedForAria === t.isSelectedForAria && 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]);
923
+ e.depth === t.depth && e.positionInSet === t.positionInSet && e.setSize === t.setSize && e.isSelectedForAria === t.isSelectedForAria && e.flatIndex === t.flatIndex && e.isActive === t.isActive && e.rowHeight === t.rowHeight && r === 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((c, u) => c === t.parentIsLast[u]);
909
924
  }
910
925
  );
911
- Ke.displayName = "DirectoryEntryItem";
912
- const Qt = (e) => {
926
+ lt.displayName = "DirectoryEntryItem";
927
+ const dr = (e) => {
913
928
  const t = [];
914
929
  if (e.children)
915
930
  for (const a of e.children)
916
- a.type === "directory" && (t.push(a.absolutePath), t.push(...Qt(a)));
931
+ a.type === "directory" && (t.push(a.absolutePath), t.push(...dr(a)));
917
932
  return t;
918
- }, Ur = ({
933
+ }, sn = ({
919
934
  entries: e,
920
- expansion: { toggle: t, isExpanded: a, expandMultiple: n, collapseMultiple: r, isPending: o, alwaysExpanded: l = !1, doubleClickAction: u = "recursive" },
921
- selection: { onEntryClick: E, selectedPath: b, mode: d = "none", selectedItems: f, onSelectionChange: g },
935
+ expansion: { toggle: t, isExpanded: a, expandMultiple: n, collapseMultiple: r, isPending: l, alwaysExpanded: c = !1, doubleClickAction: u = "recursive" },
936
+ selection: { onEntryClick: j, selectedPath: v, mode: d = "none", selectedItems: h, onSelectionChange: g },
922
937
  visual: {
923
- className: v,
924
- style: S,
925
- ariaLabel: m,
926
- ariaLabelledBy: x,
938
+ className: w,
939
+ style: E,
940
+ ariaLabel: f,
941
+ ariaLabelledBy: y,
927
942
  lineColor: k = "#A0AEC0",
928
- showTreeLines: I = !0,
943
+ showTreeLines: R = !0,
929
944
  showExpandIcons: N = !0,
930
- showDirectoryIcons: w = !0,
931
- showFileIcons: h = !0,
932
- iconOverrides: D,
933
- expandIconSize: C,
934
- itemHeight: M = Le,
935
- removeRootIndent: J = !1,
936
- highlightStyles: F,
937
- entryClassName: H,
938
- entryStyle: q,
939
- nameClassName: K,
940
- nameStyle: R,
941
- directoryNameClassName: z,
945
+ showDirectoryIcons: S = !0,
946
+ showFileIcons: p = !0,
947
+ iconOverrides: L,
948
+ expandIconSize: P,
949
+ itemHeight: O = Ye,
950
+ removeRootIndent: K = !1,
951
+ highlightStyles: Q,
952
+ entryClassName: $,
953
+ entryStyle: J,
954
+ nameClassName: ee,
955
+ nameStyle: I,
956
+ directoryNameClassName: Y,
942
957
  directoryNameStyle: B,
943
- fileNameClassName: Y,
944
- fileNameStyle: ae
958
+ fileNameClassName: G,
959
+ fileNameStyle: de
945
960
  } = {},
946
- virtualScroll: te,
947
- grid: A,
961
+ virtualScroll: ue,
962
+ grid: C,
948
963
  sort: s
949
964
  }) => {
950
- const p = A !== void 0, [y, j] = ce(!1), L = ue(null), G = ue(null), P = ue(null), [Q, re] = ce(0), [oe, we] = ce(0), [xe, be] = ce(0), [ee, He] = ce(null), {
951
- overscanCount: Se = 15,
952
- className: Re,
953
- background: Pe,
954
- onScroll: _e,
955
- onRangeChange: je,
956
- initialScrollIndex: le,
957
- initialScrollOffset: ne,
958
- callbackThrottleMs: Qe = 5,
959
- contentInsets: ke,
960
- onItemFocus: et,
961
- viewportHeightOverride: ie,
962
- scrollBarOptions: We,
963
- behaviorOptions: tt,
964
- preserveScrollAnchor: rt = !1,
965
- getItemKey: er,
965
+ const m = C !== void 0, [T, A] = ce(!1), se = ne(null), le = ne(null), b = ne(null), [z, H] = ce(0), [V, Ne] = ce(0), [ye, ge] = ce(0), [ae, Ve] = ce(null), {
966
+ overscanCount: je = 15,
967
+ className: Ae,
968
+ background: Me,
969
+ onScroll: De,
970
+ onRangeChange: Oe,
971
+ initialScrollIndex: Fe,
972
+ initialScrollOffset: ie,
973
+ callbackThrottleMs: Le = 5,
974
+ contentInsets: he,
975
+ onItemFocus: te,
976
+ viewportHeightOverride: oe,
977
+ scrollBarOptions: Ue,
978
+ behaviorOptions: it,
979
+ preserveScrollAnchor: ct = !1,
980
+ getItemKey: ur,
966
981
  // 素通しの pass-through。型で受け付けているものは実際に転送する
967
982
  // (`role="tree"` は本コンポーネント自身のコンテナに付くため contentProps とは別要素で衝突しない)
968
- testId: nt,
969
- contentProps: st
970
- } = te ?? {}, [Ae, Be] = ce(typeof ne == "number" ? ne : 0), ze = ue(typeof ne == "number" ? ne : 0), at = W(
971
- (c, T) => {
972
- ze.current = c, Be(c), _e?.(c, T);
983
+ testId: dt,
984
+ contentProps: Xe
985
+ } = ue ?? {}, ut = Z(() => m ? { role: "rowgroup", ...Xe } : Xe, [m, Xe]), [$e, Je] = ce(typeof ie == "number" ? ie : 0), qe = ne(typeof ie == "number" ? ie : 0), ft = F(
986
+ (o, x) => {
987
+ qe.current = o, Je(o), De?.(o, x);
973
988
  },
974
- [_e]
975
- ), ot = W(
976
- (c) => {
977
- const { renderingStartIndex: T, renderingEndIndex: $ } = c;
978
- He((X) => X && X.renderStart === T && X.renderEnd === $ ? X : { renderStart: T, renderEnd: $ }), je?.(c);
989
+ [De]
990
+ ), mt = F(
991
+ (o) => {
992
+ const { renderingStartIndex: x, renderingEndIndex: M } = o;
993
+ Ve((W) => W && W.renderStart === x && W.renderEnd === M ? W : { renderStart: x, renderEnd: M }), Oe?.(o);
979
994
  },
980
- [je]
995
+ [Oe]
981
996
  );
982
997
  me(() => {
983
- typeof ne == "number" && Be(ne);
984
- }, [ne]), me(() => {
985
- j(!0), Lr();
998
+ typeof ie == "number" && Je(ie);
999
+ }, [ie]), me(() => {
1000
+ A(!0), Jr();
986
1001
  }, []), me(() => {
987
- const c = L.current, T = p ? G.current : c, $ = () => {
988
- if (c) {
989
- const se = c.clientWidth;
990
- we((de) => Math.abs(de - se) > 1 ? se : de);
1002
+ const o = se.current, x = m ? le.current : o, M = () => {
1003
+ if (o) {
1004
+ const X = o.clientWidth;
1005
+ Ne((re) => Math.abs(re - X) > 1 ? X : re);
991
1006
  }
992
- if (typeof ie == "number")
993
- re((se) => Math.abs(se - ie) > 1 ? ie : se);
994
- else if (T) {
995
- const se = T.clientHeight;
996
- re((de) => Math.abs(de - se) > 1 ? se : de);
1007
+ if (typeof oe == "number")
1008
+ H((X) => Math.abs(X - oe) > 1 ? oe : X);
1009
+ else if (x) {
1010
+ const X = x.clientHeight;
1011
+ H((re) => Math.abs(re - X) > 1 ? X : re);
997
1012
  }
998
1013
  };
999
- if (!(c || T)) return re(0);
1000
- $();
1001
- const X = new ResizeObserver($);
1002
- return c && X.observe(c), T && T !== c && X.observe(T), () => X.disconnect();
1003
- }, [ie, p]);
1004
- const fe = typeof ie == "number" ? ie : Q, he = W((c) => l || (y ? a(c) : !1), [y, a, l]), lt = _(O.container, o && O.containerPending, v), it = Z(
1014
+ if (!(o || x)) return H(0);
1015
+ M();
1016
+ const W = new ResizeObserver(M);
1017
+ return o && W.observe(o), x && x !== o && W.observe(x), () => W.disconnect();
1018
+ }, [oe, m]);
1019
+ const xe = typeof oe == "number" ? oe : z, fe = F((o) => c || (T ? a(o) : !1), [T, a, c]), ht = _(D.container, l && D.containerPending, w), pt = Z(
1005
1020
  () => ({
1006
- ...Dr,
1007
- ...S ?? {},
1008
- ...typeof ie == "number" ? { height: ie, minHeight: ie } : {}
1021
+ ...Xr,
1022
+ ...E ?? {},
1023
+ ...typeof oe == "number" ? { height: oe, minHeight: oe } : {}
1009
1024
  }),
1010
- [S, ie]
1011
- ), Ye = W(
1012
- (c, T) => {
1013
- const $ = [c.absolutePath, ...Qt(c)], X = T || u;
1014
- if ($.every((Ie) => he(Ie))) return r($);
1015
- if ($.every((Ie) => !he(Ie)) || X === "recursive") return n($);
1016
- if (X === "toggle") return r($);
1017
- console.warn(`[DirectoryTree] Unknown double click action: ${X}. No action taken.`);
1025
+ [E, oe]
1026
+ ), Ze = F(
1027
+ (o, x) => {
1028
+ const M = [o.absolutePath, ...dr(o)], W = x || u;
1029
+ if (M.every((pe) => fe(pe))) return r(M);
1030
+ if (M.every((pe) => !fe(pe)) || W === "recursive") return n(M);
1031
+ if (W === "toggle") return r(M);
1032
+ console.warn(`[DirectoryTree] Unknown double click action: ${W}. No action taken.`);
1018
1033
  },
1019
- [he, n, r, u]
1020
- ), ct = p ? !1 : J, { flatItems: dt, lineItems: Ge, maxIndent: ut } = Z(() => $r(e, he, I, ct, s), [e, he, I, ct, s]), V = Z(
1021
- () => dt.map((c, T) => {
1022
- const $ = typeof M == "function" ? M(c.entry, T) : M;
1023
- return { ...c, rowHeight: Number.isFinite($) && $ > 0 ? $ : Le };
1034
+ [fe, n, r, u]
1035
+ ), yt = m ? !1 : K, { flatItems: we, lineItems: Ke, maxIndent: xt } = Z(() => qr(e, fe, R, yt, s), [e, fe, R, yt, s]), U = Z(
1036
+ () => we.map((o, x) => {
1037
+ const M = typeof O == "function" ? O(o.entry, x) : O;
1038
+ return { ...o, rowHeight: Number.isFinite(M) && M > 0 ? M : Ye };
1024
1039
  }),
1025
- [dt, M]
1026
- ), pe = Z(() => V.map((c) => c.rowHeight), [V]), ve = Z(() => {
1027
- const c = new Array(pe.length + 1);
1028
- c[0] = 0;
1029
- for (let T = 0; T < pe.length; T++)
1030
- c[T + 1] = c[T] + pe[T];
1031
- return c;
1032
- }, [pe]), mt = W((c) => V[c]?.rowHeight ?? Le, [V]), tr = W((c) => V[c]?.entry.absolutePath ?? c, [V]), ft = er ?? tr, Me = Z(
1033
- () => !I || Ge.length === 0 ? { segmentsByItem: [], glyphsByItem: [] } : Wr(Ge, pe, ve, $e, I, C ?? Lt),
1034
- [Ge, pe, ve, I, C]
1035
- ), Oe = Z(() => !I || e.length === 0 ? 0 : (ut + 2) * $e, [e.length, ut, I]), { renderStart: ht, renderEnd: pt, lookaheadEnd: yt } = Z(
1036
- () => Hr(V.length, fe, Se, ee, Ae, ve),
1037
- [V.length, fe, Se, ee, Ae, ve]
1038
- ), Ve = Z(() => !I || Oe <= 0 || fe <= 0 || Me.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: Oe, height: fe }, children: /* @__PURE__ */ i.jsx(
1039
- Kt,
1040
+ [we, O]
1041
+ ), be = Z(() => U.map((o) => o.rowHeight), [U]), ke = Z(() => {
1042
+ const o = new Array(be.length + 1);
1043
+ o[0] = 0;
1044
+ for (let x = 0; x < be.length; x++)
1045
+ o[x + 1] = o[x] + be[x];
1046
+ return o;
1047
+ }, [be]), bt = F((o) => U[o]?.rowHeight ?? Ye, [U]), fr = F((o) => U[o]?.entry.absolutePath ?? o, [U]), vt = ur ?? fr, gt = ne(we);
1048
+ gt.current = we;
1049
+ const wt = ne(fe);
1050
+ wt.current = fe;
1051
+ const Qe = ne(t);
1052
+ Qe.current = t;
1053
+ const [kt, St] = ce(0), et = ne(/* @__PURE__ */ new Map()), tt = ne(null), It = F((o, x) => {
1054
+ x ? (et.current.set(o, x), tt.current === o && (tt.current = null, x.focus())) : et.current.delete(o);
1055
+ }, []), Se = F((o) => {
1056
+ St(o);
1057
+ const x = et.current.get(o);
1058
+ if (x) {
1059
+ x.focus();
1060
+ return;
1061
+ }
1062
+ tt.current = o, b.current?.scrollToIndex(o);
1063
+ }, []);
1064
+ me(() => {
1065
+ St((o) => we.length === 0 ? 0 : Math.min(o, we.length - 1));
1066
+ }, [we.length]);
1067
+ const Et = F(
1068
+ (o, x) => {
1069
+ const M = gt.current, W = M.length - 1;
1070
+ if (W < 0) return;
1071
+ const X = M[x], re = X?.entry.children !== void 0, pe = re && wt.current(X.entry.absolutePath);
1072
+ switch (o.key) {
1073
+ case "ArrowDown":
1074
+ o.preventDefault(), Se(Math.min(x + 1, W));
1075
+ break;
1076
+ case "ArrowUp":
1077
+ o.preventDefault(), Se(Math.max(x - 1, 0));
1078
+ break;
1079
+ case "Home":
1080
+ o.preventDefault(), Se(0);
1081
+ break;
1082
+ case "End":
1083
+ o.preventDefault(), Se(W);
1084
+ break;
1085
+ case "ArrowRight":
1086
+ o.preventDefault(), re && !pe ? Qe.current(X.entry.absolutePath) : re && x < W && Se(x + 1);
1087
+ break;
1088
+ case "ArrowLeft": {
1089
+ if (o.preventDefault(), re && pe) {
1090
+ Qe.current(X.entry.absolutePath);
1091
+ break;
1092
+ }
1093
+ const Pe = X?.depth ?? 0;
1094
+ for (let Ie = x - 1; Ie >= 0; Ie--)
1095
+ if (M[Ie].depth < Pe) {
1096
+ Se(Ie);
1097
+ break;
1098
+ }
1099
+ break;
1100
+ }
1101
+ }
1102
+ },
1103
+ [Se]
1104
+ ), He = Z(
1105
+ () => !R || Ke.length === 0 ? { segmentsByItem: [], glyphsByItem: [] } : Kr(Ke, be, ke, Ge, R, P ?? Jt),
1106
+ [Ke, be, ke, R, P]
1107
+ ), We = Z(() => !R || e.length === 0 ? 0 : (xt + 2) * Ge, [e.length, xt, R]), { renderStart: Nt, renderEnd: jt, lookaheadEnd: Rt } = Z(
1108
+ () => Zr(U.length, xe, je, ae, $e, ke),
1109
+ [U.length, xe, je, ae, $e, ke]
1110
+ ), rt = Z(() => !R || We <= 0 || xe <= 0 || He.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: We, height: xe }, children: /* @__PURE__ */ i.jsx(
1111
+ cr,
1040
1112
  {
1041
- segmentsByItem: Me.segmentsByItem,
1042
- glyphsByItem: Me.glyphsByItem,
1043
- itemHeight: pe[0] ?? Le,
1044
- width: Oe,
1045
- viewportHeight: fe,
1046
- scrollPosition: Ae,
1113
+ segmentsByItem: He.segmentsByItem,
1114
+ glyphsByItem: He.glyphsByItem,
1115
+ itemHeight: be[0] ?? Ye,
1116
+ width: We,
1117
+ viewportHeight: xe,
1118
+ scrollPosition: $e,
1047
1119
  color: k,
1048
1120
  expandGlyphColor: k,
1049
- expandGlyphSize: C ?? Lt,
1050
- renderStartIndex: ht,
1051
- renderEndIndex: pt,
1052
- lookaheadEndIndex: yt
1121
+ expandGlyphSize: P ?? Jt,
1122
+ renderStartIndex: Nt,
1123
+ renderEndIndex: jt,
1124
+ lookaheadEndIndex: Rt
1053
1125
  }
1054
- ) }) }), [Oe, fe, ht, pt, yt, Ae, Me, k, I, C, pe]), xt = W((c) => V[c], [V]), bt = ue(null);
1055
- lr(() => {
1056
- const c = bt.current;
1057
- if (bt.current = { items: V, offsets: ve }, !rt || !c || c.items === V)
1126
+ ) }) }), [We, xe, Nt, jt, Rt, $e, He, k, R, P, be]), Tt = F((o) => U[o], [U]), Pt = ne(null);
1127
+ br(() => {
1128
+ const o = Pt.current;
1129
+ if (Pt.current = { items: U, offsets: ke }, !ct || !o || o.items === U)
1058
1130
  return;
1059
- const T = P.current, $ = typeof ke == "number" ? ke : ke?.top ?? 0, X = T ? T.getScrollPosition() : ze.current, se = X - $, de = Cr(c.items, c.offsets, se);
1060
- if (!de)
1131
+ const x = b.current, M = typeof he == "number" ? he : he?.top ?? 0, W = x ? x.getScrollPosition() : qe.current, X = W - M, re = Hr(o.items, o.offsets, X);
1132
+ if (!re)
1061
1133
  return;
1062
- const Ie = Rr(de, V, ve);
1063
- if (Ie === null)
1134
+ const pe = Wr(re, U, ke);
1135
+ if (pe === null)
1064
1136
  return;
1065
- const Ue = Ie + $;
1066
- if (Math.abs(Ue - X) < 1)
1137
+ const Pe = pe + M;
1138
+ if (Math.abs(Pe - W) < 1)
1067
1139
  return;
1068
- const St = T?.scrollTo(Ue) ?? Ue;
1069
- ze.current = St, Be(St);
1070
- }, [V, ve, rt, ke]);
1071
- const ye = A?.columns, Ne = A?.scrollBarWidth ?? We?.width ?? Zt, U = Z(() => ye ? Ir({ measuredWidth: oe, columns: ye, scrollBarWidth: Ne }) : null, [ye, oe, Ne]), Fe = Z(() => ye ? Er(ye) : "", [ye]), rr = Z(() => A?.showFooter && ye ? jr(e) : [], [A?.showFooter, ye, e]), Ee = U?.maxHScroll ?? 0;
1140
+ const Ie = x?.scrollTo(Pe) ?? Pe;
1141
+ qe.current = Ie, Je(Ie);
1142
+ }, [U, ke, ct, he]);
1143
+ const ve = C?.columns, Re = C?.scrollBarWidth ?? Ue?.width ?? ir, q = Z(() => ve ? Fr({ measuredWidth: V, columns: ve, scrollBarWidth: Re }) : null, [ve, V, Re]), Be = Z(() => ve ? Or(ve) : "", [ve]), mr = Z(() => C?.showFooter && ve ? Lr(e) : [], [C?.showFooter, ve, e]), Te = q?.maxHScroll ?? 0;
1072
1144
  me(() => {
1073
- be((c) => Xe(c, Ee));
1074
- }, [Ee]);
1075
- const vt = W((c) => be((T) => Xe(T + c, Ee)), [Ee]), gt = Z(
1076
- () => ({ iconOverrides: D, showExpandIcons: N, showDirectoryIcons: w, showFileIcons: h, useCanvasExpandIcons: I, expandIconSize: C, highlightStyles: F }),
1077
- [D, N, w, h, I, C, F]
1078
- ), wt = Z(
1145
+ ge((o) => nt(o, Te));
1146
+ }, [Te]);
1147
+ const Ct = F((o) => ge((x) => nt(x + o, Te)), [Te]), _t = Z(
1148
+ () => ({ iconOverrides: L, showExpandIcons: N, showDirectoryIcons: S, showFileIcons: p, useCanvasExpandIcons: R, expandIconSize: P, highlightStyles: Q }),
1149
+ [L, N, S, p, R, P, Q]
1150
+ ), At = Z(
1079
1151
  () => /* @__PURE__ */ i.jsx(
1080
- dr,
1152
+ wr,
1081
1153
  {
1082
- ref: P,
1083
- itemCount: V.length,
1084
- getItem: xt,
1085
- getItemHeight: mt,
1086
- getItemKey: ft,
1087
- testId: nt,
1088
- contentProps: st,
1089
- viewportSize: fe,
1090
- overscanCount: Se,
1091
- onScroll: at,
1092
- onRangeChange: ot,
1093
- className: Re,
1094
- onWheelHorizontal: p ? vt : void 0,
1154
+ ref: b,
1155
+ itemCount: U.length,
1156
+ getItem: Tt,
1157
+ getItemHeight: bt,
1158
+ getItemKey: vt,
1159
+ testId: dt,
1160
+ contentProps: ut,
1161
+ viewportSize: xe,
1162
+ overscanCount: je,
1163
+ onScroll: ft,
1164
+ onRangeChange: mt,
1165
+ className: Ae,
1166
+ onWheelHorizontal: m ? Ct : void 0,
1095
1167
  background: /* @__PURE__ */ i.jsxs(i.Fragment, { children: [
1096
- p && U ? (
1168
+ m && q ? (
1097
1169
  // Clip the connector-line canvas to the frozen name column so deep trees never bleed into the numeric region.
1098
- /* @__PURE__ */ i.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: Ve })
1099
- ) : Ve,
1100
- Pe
1170
+ /* @__PURE__ */ i.jsx("div", { className: "pointer-events-none absolute top-0 left-0 z-0 h-full overflow-hidden", style: { width: q.nameWidth }, "aria-hidden": "true", children: rt })
1171
+ ) : rt,
1172
+ Me
1101
1173
  ] }),
1102
- initialScrollIndex: le,
1103
- initialScrollOffset: ne,
1104
- onItemFocus: et,
1105
- callbackThrottleMs: Qe,
1106
- contentInsets: ke,
1107
- scrollBarOptions: We,
1108
- behaviorOptions: tt,
1109
- children: (c, T) => c ? p && A && U ? /* @__PURE__ */ i.jsx(
1110
- Xt,
1174
+ initialScrollIndex: Fe,
1175
+ initialScrollOffset: ie,
1176
+ onItemFocus: te,
1177
+ callbackThrottleMs: Le,
1178
+ contentInsets: he,
1179
+ scrollBarOptions: Ue,
1180
+ behaviorOptions: it,
1181
+ children: (o, x) => o ? m && C && q ? /* @__PURE__ */ i.jsx(
1182
+ ar,
1111
1183
  {
1112
- entry: c.entry,
1113
- indentLevel: c.indentLevel,
1114
- positionInSet: c.positionInSet,
1115
- setSize: c.setSize,
1116
- rowIndex: T + (A.showHeader ?? !0 ? 2 : 1),
1117
- isSelectedForAria: d === "single" ? c.entry.absolutePath === b : !!f?.has(c.entry.absolutePath),
1118
- rowHeight: c.rowHeight,
1119
- isDirOpen: he,
1120
- columns: A.columns,
1121
- numericTemplate: Fe,
1122
- numericTotal: U.numericTotal,
1123
- nameWidth: U.nameWidth,
1124
- rowClassName: A.rowClassName,
1125
- selection: { onEntryClick: E, selectedPath: b ?? null, mode: d, selectedItems: f, onSelectionChange: g },
1126
- expansion: { toggleDirectory: t, onToggleDirectoryRecursive: Ye },
1127
- visual: gt
1184
+ entry: o.entry,
1185
+ indentLevel: o.indentLevel,
1186
+ positionInSet: o.positionInSet,
1187
+ setSize: o.setSize,
1188
+ rowIndex: x + (C.showHeader ?? !0 ? 2 : 1),
1189
+ isSelectedForAria: !!h?.has(o.entry.absolutePath),
1190
+ rowHeight: o.rowHeight,
1191
+ isDirOpen: fe,
1192
+ columns: C.columns,
1193
+ numericTemplate: Be,
1194
+ numericTotal: q.numericTotal,
1195
+ nameWidth: q.nameWidth,
1196
+ rowClassName: C.rowClassName,
1197
+ selection: { onEntryClick: j, selectedPath: v ?? null, mode: d, selectedItems: h, onSelectionChange: g },
1198
+ expansion: { toggleDirectory: t, onToggleDirectoryRecursive: Ze },
1199
+ visual: _t
1128
1200
  },
1129
- c.entry.absolutePath
1201
+ o.entry.absolutePath
1130
1202
  ) : /* @__PURE__ */ i.jsx(
1131
- Ke,
1203
+ lt,
1132
1204
  {
1133
- entry: c.entry,
1134
- indentLevel: c.indentLevel,
1135
- depth: c.depth,
1136
- positionInSet: c.positionInSet,
1137
- setSize: c.setSize,
1138
- isSelectedForAria: d === "single" ? c.entry.absolutePath === b : !!f?.has(c.entry.absolutePath),
1139
- rowHeight: c.rowHeight,
1140
- isDirOpen: he,
1141
- parentIsLast: c.parentIsLast,
1205
+ entry: o.entry,
1206
+ indentLevel: o.indentLevel,
1207
+ depth: o.depth,
1208
+ positionInSet: o.positionInSet,
1209
+ setSize: o.setSize,
1210
+ isSelectedForAria: !!h?.has(o.entry.absolutePath),
1211
+ flatIndex: x,
1212
+ isActive: x === kt,
1213
+ registerRowRef: It,
1214
+ onNavigationKeyDown: Et,
1215
+ rowHeight: o.rowHeight,
1216
+ isDirOpen: fe,
1217
+ parentIsLast: o.parentIsLast,
1142
1218
  renderChildren: !1,
1143
- expansion: { toggleDirectory: t, onToggleDirectoryRecursive: Ye },
1144
- selection: { onEntryClick: E, selectedPath: b ?? null, mode: d, selectedItems: f, onSelectionChange: g },
1219
+ expansion: { toggleDirectory: t, onToggleDirectoryRecursive: Ze },
1220
+ selection: { onEntryClick: j, selectedPath: v ?? null, mode: d, selectedItems: h, onSelectionChange: g },
1145
1221
  visual: {
1146
- iconOverrides: D,
1222
+ iconOverrides: L,
1147
1223
  showExpandIcons: N,
1148
- showDirectoryIcons: w,
1149
- showFileIcons: h,
1150
- useCanvasExpandIcons: I,
1151
- expandIconSize: C,
1152
- highlightStyles: F,
1153
- entryClassName: H,
1154
- entryStyle: q,
1155
- nameClassName: K,
1156
- nameStyle: R,
1157
- directoryNameClassName: z,
1224
+ showDirectoryIcons: S,
1225
+ showFileIcons: p,
1226
+ useCanvasExpandIcons: R,
1227
+ expandIconSize: P,
1228
+ highlightStyles: Q,
1229
+ entryClassName: $,
1230
+ entryStyle: J,
1231
+ nameClassName: ee,
1232
+ nameStyle: I,
1233
+ directoryNameClassName: Y,
1158
1234
  directoryNameStyle: B,
1159
- fileNameClassName: Y,
1160
- fileNameStyle: ae
1235
+ fileNameClassName: G,
1236
+ fileNameStyle: de
1161
1237
  }
1162
1238
  },
1163
- c.entry.absolutePath
1239
+ o.entry.absolutePath
1164
1240
  ) : null
1165
1241
  }
1166
1242
  ),
1167
1243
  [
1168
- V.length,
1169
- xt,
1170
- mt,
1171
- ft,
1172
- nt,
1173
- st,
1174
- fe,
1175
- Se,
1176
- at,
1177
- ot,
1178
- Re,
1179
- p,
1244
+ U.length,
1245
+ Tt,
1246
+ bt,
1180
1247
  vt,
1181
- U,
1182
- Ve,
1183
- Pe,
1184
- le,
1185
- ne,
1186
- et,
1187
- Qe,
1188
- ke,
1189
- We,
1190
- tt,
1191
- A,
1248
+ dt,
1249
+ ut,
1250
+ kt,
1251
+ It,
1252
+ Et,
1253
+ xe,
1254
+ je,
1255
+ ft,
1256
+ mt,
1257
+ Ae,
1258
+ m,
1259
+ Ct,
1260
+ q,
1261
+ rt,
1262
+ Me,
1192
1263
  Fe,
1264
+ ie,
1265
+ te,
1266
+ Le,
1193
1267
  he,
1194
- E,
1195
- b,
1268
+ Ue,
1269
+ it,
1270
+ C,
1271
+ Be,
1272
+ fe,
1273
+ j,
1274
+ v,
1196
1275
  d,
1197
- f,
1276
+ h,
1198
1277
  g,
1199
1278
  t,
1200
- Ye,
1201
- gt,
1202
- D,
1279
+ Ze,
1280
+ _t,
1281
+ L,
1203
1282
  N,
1204
- w,
1205
- h,
1206
- I,
1207
- C,
1208
- F,
1209
- H,
1210
- q,
1211
- K,
1283
+ S,
1284
+ p,
1212
1285
  R,
1213
- z,
1214
- B,
1286
+ P,
1287
+ Q,
1288
+ $,
1289
+ J,
1290
+ ee,
1291
+ I,
1215
1292
  Y,
1216
- ae
1293
+ B,
1294
+ G,
1295
+ de
1217
1296
  ]
1218
1297
  );
1219
- if (!(A && U))
1220
- return /* @__PURE__ */ i.jsx("div", { ref: L, className: lt, style: it, role: "tree", "aria-label": x ? void 0 : m, "aria-labelledby": x, "aria-multiselectable": d === "multiple" ? !0 : void 0, children: wt });
1221
- const nr = A.showHeader ?? !0, sr = A.showFooter ?? !1, ar = { ...it, "--dt-hscroll": `${xe}px` };
1298
+ if (!(C && q))
1299
+ return /* @__PURE__ */ i.jsx("div", { ref: se, className: ht, style: pt, role: "tree", "aria-label": y ? void 0 : f, "aria-labelledby": y, "aria-multiselectable": d === "multiple" ? !0 : void 0, children: At });
1300
+ const hr = C.showHeader ?? !0, pr = C.showFooter ?? !1, yr = { ...pt, "--dt-hscroll": `${ye}px` };
1222
1301
  return /* @__PURE__ */ i.jsxs(
1223
1302
  "div",
1224
1303
  {
1225
- ref: L,
1226
- className: _(lt, "dt-grid"),
1227
- style: ar,
1304
+ ref: se,
1305
+ className: _(ht, "dt-grid"),
1306
+ style: yr,
1228
1307
  role: "treegrid",
1229
- "aria-label": x ? void 0 : m,
1230
- "aria-labelledby": x,
1308
+ "aria-label": y ? void 0 : f,
1309
+ "aria-labelledby": y,
1231
1310
  "aria-multiselectable": d === "multiple" ? !0 : void 0,
1232
- "aria-rowcount": V.length + (A.showHeader ?? !0 ? 1 : 0),
1311
+ "aria-rowcount": U.length + (C.showHeader ?? !0 ? 1 : 0),
1233
1312
  children: [
1234
- nr && /* @__PURE__ */ i.jsx(Sr, { columns: A.columns, numericTemplate: Fe, numericTotal: U.numericTotal, nameWidth: U.nameWidth, scrollBarWidth: Ne, className: A.headerClassName }),
1235
- /* @__PURE__ */ i.jsx("div", { ref: G, className: "dt-grid-body", children: wt }),
1236
- Ee > 0 && /* @__PURE__ */ i.jsxs("div", { className: "dt-grid-hscrollbar-row", children: [
1237
- /* @__PURE__ */ i.jsx("div", { className: "dt-grid-scrollbar-spacer", style: { width: U.nameWidth }, "aria-hidden": "true" }),
1313
+ hr && // biome-ignore lint/a11y/useSemanticElements: 仮想スクロールの treegrid は絶対配置行を使うため native table 要素にできない。ARIA ロールで意味を提供する
1314
+ /* @__PURE__ */ i.jsx("div", { role: "rowgroup", children: /* @__PURE__ */ i.jsx(Ar, { columns: C.columns, numericTemplate: Be, numericTotal: q.numericTotal, nameWidth: q.nameWidth, scrollBarWidth: Re, className: C.headerClassName }) }),
1315
+ /* @__PURE__ */ i.jsx("div", { ref: le, className: "dt-grid-body", children: At }),
1316
+ Te > 0 && /* @__PURE__ */ i.jsxs("div", { className: "dt-grid-hscrollbar-row", children: [
1317
+ /* @__PURE__ */ i.jsx("div", { className: "dt-grid-scrollbar-spacer", style: { width: q.nameWidth }, "aria-hidden": "true" }),
1238
1318
  /* @__PURE__ */ i.jsx(
1239
- ur,
1319
+ kr,
1240
1320
  {
1241
1321
  horizontal: !0,
1242
- contentSize: U.numericTotal,
1243
- viewportSize: U.numericVisible,
1244
- scrollPosition: xe,
1245
- scrollBarWidth: Ne,
1246
- onScroll: (c) => {
1247
- const T = typeof c == "function" ? c(xe) : c, $ = Xe(T, Ee);
1248
- return be($), $;
1322
+ contentSize: q.numericTotal,
1323
+ viewportSize: q.numericVisible,
1324
+ scrollPosition: ye,
1325
+ scrollBarWidth: Re,
1326
+ onScroll: (o) => {
1327
+ const x = typeof o == "function" ? o(ye) : o, M = nt(x, Te);
1328
+ return ge(M), M;
1249
1329
  }
1250
1330
  }
1251
1331
  ),
1252
- /* @__PURE__ */ i.jsx("div", { className: "dt-grid-scrollbar-spacer", style: { width: Ne }, "aria-hidden": "true" })
1332
+ /* @__PURE__ */ i.jsx("div", { className: "dt-grid-scrollbar-spacer", style: { width: Re }, "aria-hidden": "true" })
1253
1333
  ] }),
1254
- sr && /* @__PURE__ */ i.jsx(kr, { columns: A.columns, numericTemplate: Fe, numericTotal: U.numericTotal, nameWidth: U.nameWidth, scrollBarWidth: Ne, allEntries: rr, className: A.footerClassName })
1334
+ pr && // biome-ignore lint/a11y/useSemanticElements: 同上 (フッタ行も絶対配置レイアウトの一部)
1335
+ /* @__PURE__ */ i.jsx("div", { role: "rowgroup", children: /* @__PURE__ */ i.jsx(Mr, { columns: C.columns, numericTemplate: Be, numericTotal: q.numericTotal, nameWidth: q.nameWidth, scrollBarWidth: Re, allEntries: mr, className: C.footerClassName }) })
1255
1336
  ]
1256
1337
  }
1257
1338
  );
1258
- }, Xr = ({ initialExpanded: e = /* @__PURE__ */ new Set(), storageKey: t } = {}) => {
1259
- const [a, n] = cr(), [r, o] = ce(() => {
1339
+ }, an = ({ initialExpanded: e = /* @__PURE__ */ new Set(), storageKey: t } = {}) => {
1340
+ const [a, n] = gr(), [r, l] = ce(() => {
1260
1341
  if (typeof window < "u" && t)
1261
1342
  try {
1262
- const m = window.localStorage.getItem(t);
1263
- if (m) {
1264
- const x = JSON.parse(m);
1265
- return new Set(x);
1343
+ const f = window.localStorage.getItem(t);
1344
+ if (f) {
1345
+ const y = JSON.parse(f);
1346
+ return new Set(y);
1266
1347
  }
1267
- } catch (m) {
1268
- console.error("[useDirectoryTreeState] Error reading from localStorage", m);
1348
+ } catch (f) {
1349
+ console.error("[useDirectoryTreeState] Error reading from localStorage", f);
1269
1350
  }
1270
1351
  return e;
1271
- }), l = W((m) => {
1352
+ }), c = F((f) => {
1272
1353
  n(() => {
1273
- o((x) => {
1274
- const k = new Set(x);
1275
- return m(k), k;
1354
+ l((y) => {
1355
+ const k = new Set(y);
1356
+ return f(k), k;
1276
1357
  });
1277
1358
  });
1278
- }, []), u = W(
1279
- (m, x) => {
1280
- l((k) => {
1281
- for (const I of m)
1282
- x(k, I);
1359
+ }, []), u = F(
1360
+ (f, y) => {
1361
+ c((k) => {
1362
+ for (const R of f)
1363
+ y(k, R);
1283
1364
  });
1284
1365
  },
1285
- [l]
1366
+ [c]
1286
1367
  );
1287
1368
  me(() => {
1288
1369
  if (t && typeof window < "u")
1289
1370
  try {
1290
1371
  window.localStorage.setItem(t, JSON.stringify(Array.from(r)));
1291
- } catch (m) {
1292
- console.warn(`Error setting localStorage key "${t}":`, m);
1372
+ } catch (f) {
1373
+ console.warn(`Error setting localStorage key "${t}":`, f);
1293
1374
  }
1294
1375
  }, [r, t]);
1295
- const E = W(
1296
- (m) => {
1297
- u([m], (x, k) => {
1298
- x.has(k) ? x.delete(k) : x.add(k);
1376
+ const j = F(
1377
+ (f) => {
1378
+ u([f], (y, k) => {
1379
+ y.has(k) ? y.delete(k) : y.add(k);
1299
1380
  });
1300
1381
  },
1301
1382
  [u]
1302
- ), b = W(
1303
- (m) => {
1304
- u([m], (x, k) => {
1305
- x.add(k);
1383
+ ), v = F(
1384
+ (f) => {
1385
+ u([f], (y, k) => {
1386
+ y.add(k);
1306
1387
  });
1307
1388
  },
1308
1389
  [u]
1309
- ), d = W(
1310
- (m) => {
1311
- u([m], (x, k) => {
1312
- x.delete(k);
1390
+ ), d = F(
1391
+ (f) => {
1392
+ u([f], (y, k) => {
1393
+ y.delete(k);
1313
1394
  });
1314
1395
  },
1315
1396
  [u]
1316
- ), f = W(
1317
- (m) => {
1318
- u(m, (x, k) => {
1319
- x.delete(k);
1397
+ ), h = F(
1398
+ (f) => {
1399
+ u(f, (y, k) => {
1400
+ y.delete(k);
1320
1401
  });
1321
1402
  },
1322
1403
  [u]
1323
- ), g = W(
1324
- (m) => {
1325
- u(m, (x, k) => {
1326
- x.add(k);
1404
+ ), g = F(
1405
+ (f) => {
1406
+ u(f, (y, k) => {
1407
+ y.add(k);
1327
1408
  });
1328
1409
  },
1329
1410
  [u]
1330
- ), v = W(() => {
1331
- l((m) => {
1332
- m.clear();
1411
+ ), w = F(() => {
1412
+ c((f) => {
1413
+ f.clear();
1333
1414
  });
1334
- }, [l]), S = W((m) => r.has(m), [r]);
1415
+ }, [c]), E = F((f) => r.has(f), [r]);
1335
1416
  return {
1336
1417
  expanded: r,
1337
- toggle: E,
1338
- expand: b,
1418
+ toggle: j,
1419
+ expand: v,
1339
1420
  collapse: d,
1340
- collapseMultiple: f,
1421
+ collapseMultiple: h,
1341
1422
  expandMultiple: g,
1342
- collapseAll: v,
1343
- isExpanded: S,
1423
+ collapseAll: w,
1424
+ isExpanded: E,
1344
1425
  isPending: a
1345
1426
  };
1346
1427
  };
1347
1428
  export {
1348
- Ur as DirectoryTree,
1349
- O as directoryTreeClasses,
1350
- Xr as useDirectoryTreeState
1429
+ sn as DirectoryTree,
1430
+ D as directoryTreeClasses,
1431
+ an as useDirectoryTreeState
1351
1432
  };