@aiquants/directory-tree 3.4.0 → 3.5.0

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