@aiquants/directory-tree 3.3.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,295 +1,295 @@
1
- import Zt, { useRef as ce, useEffect as de, useCallback as W, memo as ze, useState as se, useMemo as q, useLayoutEffect as Qt, Fragment as Kt, useTransition as er } from "react";
2
- import { VirtualScroll as tr, ScrollBar as rr } from "@aiquants/virtualscroll";
3
- import { twMerge as M } from "tailwind-merge";
4
- import { FolderIcon as nr, ChevronDownIcon as sr, ChevronRightIcon as ar } from "@heroicons/react/24/solid";
5
- import { FileMd as xt, FilePdf as vt, FileXls as bt, FileCsv as gt, FileDoc as wt, FilePpt as kt, FileImage as Nt, FileAudio as Et, FileVideo as It, FileZip as St, FileCode as jt, FileText as Tt, FileIcon as or } from "@phosphor-icons/react";
6
- var Me = { exports: {} }, Ee = {};
7
- var Rt;
8
- function lr() {
9
- if (Rt) return Ee;
10
- Rt = 1;
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 d in r)
17
- d !== "key" && (o[d] = r[d]);
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
25
25
  };
26
26
  }
27
- return Ee.Fragment = t, Ee.jsx = a, Ee.jsxs = a, Ee;
27
+ return Ie.Fragment = t, Ie.jsx = a, Ie.jsxs = a, Ie;
28
28
  }
29
- var Ie = {};
30
- var Ct;
31
- function ir() {
32
- return Ct || (Ct = 1, process.env.NODE_ENV !== "production" && (function() {
33
- function e(n) {
34
- if (n == null) return null;
35
- if (typeof n == "function")
36
- return n.$$typeof === B ? 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 T:
45
+ case O:
46
46
  return "Suspense";
47
- case R:
47
+ case D:
48
48
  return "SuspenseList";
49
- case C:
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 u:
55
+ ), s.$$typeof) {
56
+ case f:
57
57
  return "Portal";
58
- case w:
59
- return n.displayName || "Context";
58
+ case b:
59
+ return s.displayName || "Context";
60
60
  case N:
61
- return (n._context.displayName || "Context") + ".Consumer";
61
+ return (s._context.displayName || "Context") + ".Consumer";
62
62
  case p:
63
- var h = n.render;
64
- return n = n.displayName, n || (n = h.displayName || h.name || "", n = n !== "" ? "ForwardRef(" + n + ")" : "ForwardRef"), n;
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 h = n.displayName || null, h !== null ? h : e(n.type) || "Memo";
67
- case V:
68
- h = 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(h));
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 h = !1;
81
+ t(s);
82
+ var u = !1;
83
83
  } catch {
84
- h = !0;
84
+ u = !0;
85
85
  }
86
- if (h) {
87
- h = console;
88
- var S = h.error, _ = typeof Symbol == "function" && Symbol.toStringTag && n[Symbol.toStringTag] || n.constructor.name || "Object";
89
- return S.call(
90
- h,
86
+ if (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 === V)
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 h = e(n);
102
- return h ? "<" + h + ">" : "<...>";
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 (H.call(n, "key")) {
116
- var h = Object.getOwnPropertyDescriptor(n, "key").get;
117
- if (h && h.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 d(n, h) {
122
- function S() {
123
- ae || (ae = !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
- h
125
+ u
126
126
  ));
127
127
  }
128
- S.isReactWarning = !0, Object.defineProperty(n, "key", {
129
- get: S,
128
+ w.isReactWarning = !0, Object.defineProperty(s, "key", {
129
+ get: w,
130
130
  configurable: !0
131
131
  });
132
132
  }
133
- function g() {
134
- var n = e(this.type);
135
- return oe[n] || (oe[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, h, S, _, ee, Q) {
140
- var P = S.ref;
141
- return n = {
142
- $$typeof: I,
143
- type: n,
144
- key: h,
145
- props: S,
146
- _owner: _
147
- }, (P !== void 0 ? P : 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: g
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: ee
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: Q
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, h, S, _, ee, Q) {
173
- var P = h.children;
174
- if (P !== void 0)
175
- if (_)
176
- if (Z(P)) {
177
- for (_ = 0; _ < P.length; _++)
178
- y(P[_]);
179
- Object.freeze && Object.freeze(P);
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(P);
185
- if (H.call(h, "key")) {
186
- P = e(n);
187
- var K = Object.keys(h).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}", Y[P + _] || (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
- P,
199
- K,
200
- P
201
- ), Y[P + _] = !0);
197
+ E,
198
+ T,
199
+ V,
200
+ T
201
+ ), G[T + E] = !0);
202
202
  }
203
- if (P = null, S !== void 0 && (a(S), P = "" + S), l(h) && (a(h.key), P = "" + h.key), "key" in h) {
204
- S = {};
205
- for (var te in h)
206
- te !== "key" && (S[te] = h[te]);
207
- } else S = h;
208
- return P && d(
209
- S,
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
- P,
214
- S,
212
+ s,
213
+ T,
214
+ w,
215
215
  r(),
216
- ee,
217
- Q
216
+ B,
217
+ le
218
218
  );
219
219
  }
220
- function y(n) {
221
- b(n) ? n._store && (n._store.validated = 1) : typeof n == "object" && n !== null && n.$$typeof === V && (n._payload.status === "fulfilled" ? b(n._payload.value) && n._payload.value._store && (n._payload.value._store.validated = 1) : n._store && (n._store.validated = 1));
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 b(n) {
224
- return typeof n == "object" && n !== null && n.$$typeof === I;
223
+ function k(s) {
224
+ return typeof s == "object" && s !== null && s.$$typeof === S;
225
225
  }
226
- var k = Zt, I = /* @__PURE__ */ Symbol.for("react.transitional.element"), u = /* @__PURE__ */ Symbol.for("react.portal"), f = /* @__PURE__ */ Symbol.for("react.fragment"), v = /* @__PURE__ */ Symbol.for("react.strict_mode"), D = /* @__PURE__ */ Symbol.for("react.profiler"), N = /* @__PURE__ */ Symbol.for("react.consumer"), w = /* @__PURE__ */ Symbol.for("react.context"), p = /* @__PURE__ */ Symbol.for("react.forward_ref"), T = /* @__PURE__ */ Symbol.for("react.suspense"), R = /* @__PURE__ */ Symbol.for("react.suspense_list"), L = /* @__PURE__ */ Symbol.for("react.memo"), V = /* @__PURE__ */ Symbol.for("react.lazy"), C = /* @__PURE__ */ Symbol.for("react.activity"), B = /* @__PURE__ */ Symbol.for("react.client.reference"), F = k.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE, H = Object.prototype.hasOwnProperty, Z = Array.isArray, U = console.createTask ? console.createTask : function() {
226
+ var g = 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
- k = {
230
- react_stack_bottom_frame: function(n) {
231
- return n();
229
+ g = {
230
+ react_stack_bottom_frame: function(s) {
231
+ return s();
232
232
  }
233
233
  };
234
- var ae, oe = {}, A = k.react_stack_bottom_frame.bind(
235
- k,
234
+ var te, re = {}, P = g.react_stack_bottom_frame.bind(
235
+ g,
236
236
  o
237
- )(), E = U(s(o)), Y = {};
238
- Ie.Fragment = f, Ie.jsx = function(n, h, S) {
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
- h,
243
- S,
241
+ s,
242
+ u,
243
+ w,
244
244
  !1,
245
- _ ? Error("react-stack-top-frame") : A,
246
- _ ? U(s(n)) : E
245
+ E ? Error("react-stack-top-frame") : P,
246
+ E ? $(n(s)) : oe
247
247
  );
248
- }, Ie.jsxs = function(n, h, S) {
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
- h,
253
- S,
251
+ s,
252
+ u,
253
+ w,
254
254
  !0,
255
- _ ? Error("react-stack-top-frame") : A,
256
- _ ? U(s(n)) : E
255
+ E ? Error("react-stack-top-frame") : P,
256
+ E ? $(n(s)) : oe
257
257
  );
258
258
  };
259
- })()), Ie;
259
+ })()), je;
260
260
  }
261
- var _t;
262
- function cr() {
263
- return _t || (_t = 1, process.env.NODE_ENV === "production" ? Me.exports = lr() : Me.exports = ir()), Me.exports;
261
+ var 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 = cr();
266
- const Ae = 18, Oe = 12, Pt = 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
- }, Dt = ({ 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(sr, { className: l, style: o }) : /* @__PURE__ */ i.jsx(ar, { 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, Pt = 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
- }, dr = (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(xt, { 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(vt, { 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(bt, { 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(gt, { 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(wt, { 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(kt, { 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(Nt, { 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(Et, { 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(It, { 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(St, { 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(jt, { 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(Tt, { 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(xt, { className: "h-4 w-4 text-sky-500 dark:text-sky-400" });
339
- if (s === "pdf")
340
- return /* @__PURE__ */ i.jsx(vt, { 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(bt, { className: "h-4 w-4 text-emerald-600 dark:text-emerald-400" });
343
- if (["csv", "tsv"].includes(s))
344
- return /* @__PURE__ */ i.jsx(gt, { 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(wt, { className: "h-4 w-4 text-blue-600 dark:text-blue-400" });
347
- if (["ppt", "pptx", "odp"].includes(s))
348
- return /* @__PURE__ */ i.jsx(kt, { className: "h-4 w-4 text-orange-500 dark:text-orange-400" });
349
- if (["png", "jpg", "jpeg", "gif", "svg", "webp", "ico", "bmp", "tiff", "avif"].includes(s))
350
- return /* @__PURE__ */ i.jsx(Nt, { className: "h-4 w-4 text-teal-500 dark:text-teal-400" });
351
- if (["js", "mjs", "cjs", "ts", "tsx", "jsx", "json", "html", "htm", "css", "scss", "py", "go", "rs", "c", "cpp", "h", "hpp", "sh", "bash", "yaml", "yml", "sql", "xml", "toml"].includes(s))
352
- return /* @__PURE__ */ i.jsx(jt, { className: "h-4 w-4 text-purple-500 dark:text-purple-400" });
353
- if (["mp3", "wav", "ogg", "m4a", "flac", "aac", "wma"].includes(s))
354
- return /* @__PURE__ */ i.jsx(Et, { className: "h-4 w-4 text-pink-500 dark:text-pink-400" });
355
- if (["mp4", "webm", "mov", "avi", "mkv", "wmv", "flv"].includes(s))
356
- return /* @__PURE__ */ i.jsx(It, { className: "h-4 w-4 text-violet-500 dark:text-violet-400" });
357
- if (["zip", "tar", "gz", "7z", "rar", "tgz", "bz2"].includes(s))
358
- return /* @__PURE__ */ i.jsx(St, { className: "h-4 w-4 text-amber-500 dark:text-amber-400" });
359
- if (["txt", "log"].includes(s))
360
- return /* @__PURE__ */ i.jsx(Tt, { 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(or, { className: "h-4 w-4 text-gray-400 dark:text-gray-400" });
363
- }, Lt = (e, t) => {
364
- const { entry: a, isDirectory: s, isExpanded: r, extension: o, mimeType: l } = e;
365
- let d;
366
- const g = l || a.mimeType;
367
- return a.icon !== void 0 ? d = a.icon : s ? d = r && t?.directoryExpanded || t?.directory || /* @__PURE__ */ i.jsx(nr, { className: "h-4 w-4" }) : o && t?.fileByExtension?.[o] ? d = t.fileByExtension[o] : d = t?.file || dr(g, o, a.name), Ve(typeof d == "function" ? d(e) : d, a.absolutePath);
368
- }, ur = 500, Ft = ({ entry: e, isDirectory: t, isExpanded: a, isItemSelected: s, selectionMode: r, onSelectionChange: o, onEntryClick: l, toggleDirectory: d, onToggleDirectoryRecursive: g }) => {
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
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,456 +389,469 @@ const Ae = 18, Oe = 12, Pt = 10, O = {
383
389
  preventDefault: () => {
384
390
  y = !0;
385
391
  }
386
- }), !(!t || y) && (x.current ? (window.clearTimeout(x.current), x.current = null, g(e)) : x.current = window.setTimeout(() => {
387
- d(e.absolutePath), x.current = null;
388
- }, ur));
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, g, d, l, r, o, s]
396
+ [t, e, a, I, m, l, r, o, n]
391
397
  );
392
- }, $t = (e) => e === "right" ? "dt-grid-cell--right" : e === "center" ? "dt-grid-cell--center" : "", Mt = (e, t) => e.children !== void 0 && t(e.absolutePath), Ht = (e, t) => ({
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
- }), Wt = 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: d,
405
- rowClassName: g,
406
- selection: { onEntryClick: x, selectedPath: c, mode: y = "none", selectedItems: b, onSelectionChange: k },
407
- expansion: { toggleDirectory: I, onToggleDirectoryRecursive: u },
408
- visual: { iconOverrides: f, showExpandIcons: v = !0, showDirectoryIcons: D = !0, showFileIcons: N = !0, useCanvasExpandIcons: w = !1, expandIconSize: p, indentSize: T = Oe, highlightStyles: R }
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, V] = se(!1), C = e.children !== void 0, B = C && s(e.absolutePath), F = e.absolutePath === c, H = !C && !!b?.has(e.absolutePath), Z = C ? void 0 : xe(e.name) || xe(e.relativePath) || xe(e.absolutePath), U = Ft({ entry: e, isDirectory: C, isExpanded: B, isItemSelected: H, selectionMode: y, onSelectionChange: k, onEntryClick: x, toggleDirectory: I, onToggleDirectoryRecursive: u }), ae = L ? R?.hoverClassName !== void 0 ? R.hoverClassName : O.entryHover : "", oe = (() => {
411
- if (C) {
412
- if (F) return R?.directorySelectedClassName !== void 0 ? R.directorySelectedClassName : O.entrySelected;
413
- } else if (F || H)
414
- return R?.itemSelectedClassName !== void 0 ? R.itemSelectedClassName : M(F && O.entrySelected, H && O.entryItemSelected);
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 g == "function" ? g(e) : g, E = M("dt-grid-row cursor-pointer select-none", ae, oe, A, e.className), Y = M(O.expandIcon, (F || H) && O.expandIconSelected), n = M(O.typeIcon, (F || H) && O.typeIconSelected), h = M("dt-grid-name-label ml-1", "text-gray-700 dark:text-gray-200", C && O.nameDirectory, (F || H) && O.nameSelected), S = Dt({ isDirectory: C, isExpanded: B, showExpandIcons: v, useCanvasExpandIcons: w, expandIconSize: p }), _ = (C ? D : N) ? Lt({ entry: e, isDirectory: C, isExpanded: B, isSelected: F, isItemSelected: H, extension: Z, mimeType: e.mimeType }, f) : null, ee = { indentLevel: t, isDirectory: C, isExpanded: B }, [Q, ...P] = r, K = Q?.render ? Q.render(e, ee) : e.label ?? e.name, te = {
417
- ...L ? R?.hoverStyle : {},
418
- ...C && F ? R?.directorySelectedStyle : {},
419
- ...!C && (F || H) ? R?.itemSelectedStyle : {}
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: E,
425
- style: { height: a, ...te, ...e.style },
432
+ className: s,
433
+ style: { height: r, ...ye, ...e.style },
426
434
  role: "row",
427
- "aria-expanded": C ? B : void 0,
435
+ "aria-expanded": R ? z : void 0,
428
436
  "aria-level": t + 1,
429
- "data-entry-type": C ? "directory" : "file",
430
- "data-entry-expanded": C ? String(B) : 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": H ? "true" : void 0,
433
- onClick: U,
434
- onMouseEnter: () => V(!0),
435
- onMouseLeave: () => V(!1),
436
- onKeyDown: (G) => G.key === "Enter" && U(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", Q?.className), role: "gridcell", style: { width: d, paddingLeft: Math.max(0, t * T) }, children: [
440
- (v || w) && /* @__PURE__ */ i.jsx("span", { className: Y, children: S }),
441
- (C ? D : N) && /* @__PURE__ */ i.jsx("span", { className: n, children: _ }),
442
- /* @__PURE__ */ i.jsx("span", { className: h, children: K })
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
- P.length > 0 && /* @__PURE__ */ i.jsx("div", { className: "dt-grid-numeric-viewport", children: /* @__PURE__ */ i.jsx("div", { className: "dt-grid-numeric-track", style: Ht(l, o), children: P.map((G) => /* @__PURE__ */ i.jsx("div", { className: M("dt-grid-cell", $t(G.align), G.className), role: "gridcell", children: G.render ? G.render(e, ee) : null }, G.key)) }) })
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 = Mt(e.entry, e.isDirOpen), s = Mt(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
- Wt.displayName = "DirectoryTreeGridRow";
456
- const Bt = ({
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: d,
465
- renderCell: g
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", b = 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: b, style: { width: r }, children: d }),
470
- x.length > 0 && /* @__PURE__ */ i.jsx("div", { className: "dt-grid-numeric-viewport", children: /* @__PURE__ */ i.jsx("div", { className: "dt-grid-numeric-track", style: Ht(s, a), children: x.map((k) => /* @__PURE__ */ i.jsx("div", { className: M("dt-grid-cell", $t(k.align), k.className), role: b, children: g(k) }, k.key)) }) }),
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
- }, mr = ({ columns: e, className: t, ...a }) => /* @__PURE__ */ i.jsx(Bt, { kind: "header", columns: e, className: t, nameContent: e[0]?.header ?? null, renderCell: (s) => s.header ?? null, ...a }), At = (e, t) => typeof e == "function" ? e(t) : e ?? null, fr = ({ columns: e, allEntries: t, className: a, ...s }) => /* @__PURE__ */ i.jsx(Bt, { kind: "footer", columns: e, className: a, nameContent: At(e[0]?.footer, t), renderCell: (r) => At(r.footer, t), ...s }), hr = 240, Yt = 96, Gt = 12, Ue = (e, t) => {
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
- }, pr = (e) => e.slice(1).map((t) => `${Ue(t, Yt)}px`).join(" "), yr = ({ measuredWidth: e, columns: t, scrollBarWidth: a = Gt }) => {
477
- const s = Ue(t[0], hr), r = t.slice(1).reduce((g, x) => g + Ue(x, Yt), 0), o = Number.isFinite(e) && e > 0 ? e : 0, l = Math.max(0, o - s - Math.max(0, a)), d = Math.max(0, r - l);
478
- return { nameWidth: s, numericTotal: r, numericVisible: l, maxHScroll: d };
479
- }, Ge = (e, t) => !Number.isFinite(e) || e < 0 ? 0 : e > t ? t : e, xr = (e) => {
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
- }, vr = (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
- }, br = (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 = vr(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
- }, gr = (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
- }, wr = (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
- }, kr = (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
- }, Nr = (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
- }, Er = (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
- }, Ir = (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((d) => d + d).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
- }, Sr = (e, t, a, s) => {
556
+ }, Mr = (e, t, a, n) => {
546
557
  if (t.length === 0)
547
558
  return;
548
- const r = Ir(a, 0.14), o = e.strokeStyle, l = e.fillStyle, d = e.lineWidth, g = 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, b = Math.max(0, y / 2), k = Math.max(1, Math.round(y * 0.08)), I = Math.max(1, Math.round(y * 0.14)), u = Math.max(0, b - k * 0.8), f = Math.max(0, u * 0.55);
552
- r && (e.fillStyle = r, e.beginPath(), e.arc(c.centerX, c.centerY, u, 0, Math.PI * 2), e.fill()), e.lineWidth = k, e.beginPath(), e.arc(c.centerX, c.centerY, Math.max(0, b - k * 0.3), 0, Math.PI * 2), e.stroke(), e.lineWidth = I, e.beginPath(), e.moveTo(c.centerX - f, c.centerY), e.lineTo(c.centerX + f, c.centerY), e.stroke(), c.isExpanded || (e.beginPath(), e.moveTo(c.centerX, c.centerY - f), e.lineTo(c.centerX, c.centerY + f), e.stroke());
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 = d, e.lineCap = g, e.lineJoin = x;
555
- }, Vt = ze(({ segmentsByItem: e, glyphsByItem: t, itemHeight: a, width: s, viewportHeight: r, scrollPosition: o, color: l = "#a0aec0", strokeWidth: d = 1, renderStartIndex: g, renderEndIndex: x, lookaheadEndIndex: c, devicePixelRatio: y, expandGlyphColor: b, expandGlyphSize: k }) => {
556
- const I = ce(null), u = ce(null), f = ce({
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: d,
565
- renderStartIndex: g,
575
+ strokeWidth: m,
576
+ renderStartIndex: I,
566
577
  renderEndIndex: x,
567
578
  lookaheadEndIndex: c,
568
579
  devicePixelRatio: y,
569
- expandGlyphColor: b,
570
- expandGlyphSize: k
580
+ expandGlyphColor: k,
581
+ expandGlyphSize: g
571
582
  }), v = W(() => {
572
- u.current = null;
573
- const N = I.current;
583
+ f.current = null;
584
+ const N = S.current;
574
585
  if (!N)
575
586
  return;
576
- const w = N.getContext("2d");
577
- if (!w)
587
+ const b = N.getContext("2d");
588
+ if (!b)
578
589
  return;
579
- const p = f.current;
590
+ const p = h.current;
580
591
  if (p.width <= 0 || p.viewportHeight <= 0) {
581
- w.clearRect(0, 0, N.width, N.height);
592
+ b.clearRect(0, 0, N.width, N.height);
582
593
  return;
583
594
  }
584
- const T = Number.isFinite(p.devicePixelRatio ?? NaN) ? p.devicePixelRatio : typeof window < "u" && window.devicePixelRatio || 1;
585
- Nr(N, p.width, p.viewportHeight, T);
586
- const R = p.segmentsByItem.length, L = typeof p.renderStartIndex == "number" && Number.isFinite(p.renderStartIndex) ? Math.max(0, Math.floor(p.renderStartIndex)) : Math.max(0, Math.floor(p.scrollPosition / p.itemHeight)), V = Math.min(R, Math.ceil((p.scrollPosition + p.viewportHeight) / p.itemHeight)), C = (() => {
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 = (() => {
587
598
  if (typeof p.renderEndIndex == "number" && Number.isFinite(p.renderEndIndex)) {
588
- const Z = Math.floor(p.renderEndIndex);
589
- return Math.max(Math.min(R, Z + 1), L);
599
+ const F = Math.floor(p.renderEndIndex);
600
+ return Math.max(Math.min(D, F + 1), L);
590
601
  }
591
- return Math.max(V, L);
592
- })(), B = (() => {
602
+ return Math.max(j, L);
603
+ })(), K = (() => {
593
604
  if (typeof p.lookaheadEndIndex == "number" && Number.isFinite(p.lookaheadEndIndex)) {
594
- const Z = Math.floor(p.lookaheadEndIndex), U = Math.min(R, Z + 1);
595
- return Math.max(U, C);
605
+ const F = Math.floor(p.lookaheadEndIndex), $ = Math.min(D, F + 1);
606
+ return Math.max($, Z);
596
607
  }
597
- return Math.max(V, C);
598
- })(), F = wr(p.segmentsByItem, L, B), H = kr(p.glyphsByItem, L, B);
599
- w.save(), w.scale(T, T), w.clearRect(0, 0, p.width, p.viewportHeight), w.translate(0, -p.scrollPosition), w.strokeStyle = p.color, Er(w, F, p.strokeWidth), Sr(w, H, p.expandGlyphColor ?? p.color, p.expandGlyphSize), w.restore();
600
- }, []), D = W(() => {
601
- u.current === null && (u.current = window.requestAnimationFrame(v));
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: d,
613
- renderStartIndex: g,
623
+ strokeWidth: m,
624
+ renderStartIndex: I,
614
625
  renderEndIndex: x,
615
626
  lookaheadEndIndex: c,
616
627
  devicePixelRatio: y,
617
- expandGlyphColor: b,
618
- expandGlyphSize: k
619
- }, D();
620
- }, [e, t, a, s, r, o, l, d, g, x, c, y, b, k, D]), de(() => () => {
621
- u.current !== null && (window.cancelAnimationFrame(u.current), u.current = null);
622
- }, []), /* @__PURE__ */ i.jsx("canvas", { ref: I, className: "pointer-events-none absolute top-0 left-0 z-0" });
628
+ expandGlyphColor: k,
629
+ expandGlyphSize: g
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
- Vt.displayName = "TreeLineCanvas";
625
- const jr = {
635
+ qt.displayName = "TreeLineCanvas";
636
+ const Or = {
626
637
  msOverflowStyle: "none",
627
638
  scrollbarWidth: "none"
628
- }, Tr = () => {
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
- }, Rr = (e, t, a, s) => {
632
- const r = [], o = [];
633
- let l = 0;
634
- const d = (g, x, c) => {
635
- for (let y = 0; y < g.length; y++) {
636
- const b = g[y], k = y === g.length - 1, I = [...c, k], u = b.children !== void 0, f = u && t(b.absolutePath, b.relativePath);
637
- let v = x, D = I, N = c;
638
- s && (v = x - 1, D = I.slice(1), N = c.slice(1)), r.push({ entry: b, indentLevel: v, parentIsLast: D }), a && (v > l && (l = v), o.push({
639
- id: b.absolutePath,
640
- name: b.name,
641
- absolutePath: b.absolutePath,
642
- indentLevel: v,
643
- isLastChild: k,
644
- isDirectory: u,
645
- isExpanded: f,
646
- ancestorIsLast: [...N],
647
- hideLines: s && x === 0
648
- })), u && f && b.children && d(b.children, x + 1, I);
642
+ }, Lr = (e, t, a, n, r) => {
643
+ const o = [], l = [];
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,
654
+ indentLevel: N,
655
+ isLastChild: f,
656
+ isDirectory: v,
657
+ isExpanded: M,
658
+ ancestorIsLast: [...p],
659
+ hideLines: n && c === 0
660
+ })), v && M && S.children && I(S.children, c + 1, h);
649
661
  }
650
662
  };
651
- return d(e, 0, []), { flatItems: r, lineItems: o, maxIndent: l };
652
- }, Ot = (e, t) => {
663
+ return I(e, 0, []), { flatItems: o, lineItems: l, maxIndent: m };
664
+ }, $t = (e, t) => {
653
665
  const a = e.length - 1;
654
666
  if (a <= 0) return 0;
655
- let s = 0, r = a - 1, o = 0;
656
- for (; s <= r; ) {
657
- const l = s + r >>> 1;
658
- 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;
659
671
  }
660
672
  return o;
661
- }, Cr = (e, t, a, s, r, o) => {
662
- const l = s?.renderStart ?? Math.max(0, Ot(o, r)), d = t > 0 ? Ot(o, r + t) + a : l + a, g = e > 0 ? Math.min(e - 1, Math.max(l, d)) : l, x = s?.renderEnd ?? g, c = e > 0 ? Math.min(e - 1, x + a) : x;
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;
663
675
  return { renderStart: l, renderEnd: x, lookaheadEnd: c };
664
- }, _r = (e, t, a, s, r, o) => {
676
+ }, $r = (e, t, a, n, r, o) => {
665
677
  if (e.length === 0)
666
678
  return { segmentsByItem: [], glyphsByItem: [] };
667
- const l = Array.from({ length: e.length }, () => []), d = Array.from({ length: e.length }, () => []), g = (c) => r ? typeof o == "number" && Number.isFinite(o) && o > 0 ? o : Math.max(8, Math.min(s * 0.9, c * 0.7)) : 0, x = 3;
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;
668
680
  for (let c = 0; c < e.length; c++) {
669
681
  const y = e[c];
670
682
  if (y.hideLines)
671
683
  continue;
672
- const b = [], k = t[c] ?? 0, I = a[c] ?? 0, u = I + k / 2, f = g(k), v = f > 0 ? f / 2 + 2 : s / 1.5;
673
- for (let w = 0; w < y.indentLevel; w++) {
674
- if (y.ancestorIsLast[w] ?? !1)
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;
685
+ for (let b = 0; b < y.indentLevel; b++) {
686
+ if (y.ancestorIsLast[b] ?? !1)
675
687
  continue;
676
- let T = !1;
677
- for (let R = c; R < e.length; R++) {
678
- const L = e[R];
679
- if (L.indentLevel > w && L.ancestorIsLast.length > w && !L.ancestorIsLast[w]) {
680
- T = !0;
688
+ let O = !1;
689
+ for (let D = c; D < e.length; D++) {
690
+ const L = e[D];
691
+ if (L.indentLevel > b && L.ancestorIsLast.length > b && !L.ancestorIsLast[b]) {
692
+ O = !0;
681
693
  break;
682
694
  }
683
- if (R > c && L.indentLevel === w)
695
+ if (D > c && L.indentLevel === b)
684
696
  break;
685
697
  }
686
- if (T) {
687
- const R = w * s + s / 2 + x;
688
- b.push({
689
- key: `${y.id}-ancestor-${w}`,
690
- x1: R,
691
- y1: I,
692
- x2: R,
693
- y2: I + k,
698
+ if (O) {
699
+ const D = b * n + n / 2 + x;
700
+ k.push({
701
+ key: `${y.id}-ancestor-${b}`,
702
+ x1: D,
703
+ y1: S,
704
+ x2: D,
705
+ y2: S + g,
694
706
  itemIndex: c
695
707
  });
696
708
  }
697
709
  }
698
- const D = y.indentLevel * s, N = D + s / 2 + x;
699
- if (y.isDirectory ? b.push({
710
+ const M = y.indentLevel * n, N = M + n / 2 + x;
711
+ if (y.isDirectory ? k.push({
700
712
  key: `${y.id}-connector-top`,
701
713
  x1: N,
702
- y1: I,
714
+ y1: S,
703
715
  x2: N,
704
- y2: u - v,
716
+ y2: f - v,
705
717
  itemIndex: c
706
- }) : b.push({
718
+ }) : k.push({
707
719
  key: `${y.id}-connector-top`,
708
720
  x1: N,
709
- y1: I,
721
+ y1: S,
710
722
  x2: N,
711
- y2: u,
723
+ y2: f,
712
724
  itemIndex: c
713
- }), !y.isDirectory && y.isLastChild && b.push({
725
+ }), !y.isDirectory && y.isLastChild && k.push({
714
726
  key: `${y.id}-connector-horizontal`,
715
727
  x1: N,
716
- y1: u,
717
- x2: D + s + x,
718
- y2: u,
728
+ y1: f,
729
+ x2: M + n + x,
730
+ y2: f,
719
731
  itemIndex: c
720
- }), y.isLastChild || (y.isDirectory ? b.push({
732
+ }), y.isLastChild || (y.isDirectory ? k.push({
721
733
  key: `${y.id}-connector-bottom`,
722
734
  x1: N,
723
- y1: u + v,
735
+ y1: f + v,
724
736
  x2: N,
725
- y2: I + k,
737
+ y2: S + g,
726
738
  itemIndex: c
727
- }) : b.push({
739
+ }) : k.push({
728
740
  key: `${y.id}-connector-bottom`,
729
741
  x1: N,
730
- y1: u,
742
+ y1: f,
731
743
  x2: N,
732
- y2: I + k,
744
+ y2: S + g,
733
745
  itemIndex: c
734
- })), l[c] = b, r && y.isDirectory) {
735
- const w = f, p = N, T = u;
736
- d[c] = [
746
+ })), l[c] = k, r && y.isDirectory) {
747
+ const b = h, p = N, O = f;
748
+ m[c] = [
737
749
  {
738
750
  key: `${y.id}-glyph`,
739
751
  itemIndex: c,
740
752
  centerX: p,
741
- centerY: T,
742
- size: w,
753
+ centerY: O,
754
+ size: b,
743
755
  isExpanded: y.isExpanded
744
756
  }
745
757
  ];
746
758
  }
747
759
  }
748
- return { segmentsByItem: l, glyphsByItem: d };
749
- }, Xe = ze(
760
+ return { segmentsByItem: l, glyphsByItem: m };
761
+ }, Ze = qe(
750
762
  ({
751
763
  entry: e,
752
764
  indentLevel: t,
753
- rowHeight: a,
754
- isDirOpen: s,
755
- parentIsLast: r,
756
- renderChildren: o = !0,
757
- expansion: { toggleDirectory: l, onToggleDirectoryRecursive: d },
758
- selection: { onEntryClick: g, selectedPath: x, mode: c = "none", selectedItems: y, onSelectionChange: b },
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 },
759
774
  visual: {
760
- iconOverrides: k,
761
- showExpandIcons: I = !0,
762
- showDirectoryIcons: u = !0,
763
- showFileIcons: f = !0,
764
- useCanvasExpandIcons: v = !1,
765
- expandIconSize: D,
766
- typeIconSize: N,
767
- fontSize: w,
768
- indentSize: p = Oe,
769
- highlightStyles: T,
770
- entryClassName: R,
771
- entryStyle: L,
772
- nameClassName: V,
773
- nameStyle: C,
774
- directoryNameClassName: B,
775
- directoryNameStyle: F,
776
- fileNameClassName: H,
777
- fileNameStyle: Z
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,
784
+ highlightStyles: j,
785
+ entryClassName: Z,
786
+ entryStyle: K,
787
+ nameClassName: R,
788
+ nameStyle: z,
789
+ directoryNameClassName: F,
790
+ directoryNameStyle: $,
791
+ fileNameClassName: te,
792
+ fileNameStyle: re
778
793
  }
779
794
  }) => {
780
- const [U, ae] = se(null), [oe, A] = se(!1), E = e.children !== void 0, Y = E && s(e.absolutePath), n = e.absolutePath === x, h = !E && y?.has(e.absolutePath), S = E ? void 0 : xe(e.name) || xe(e.relativePath) || xe(e.absolutePath);
781
- de(() => {
782
- ae(Y && e.children ? e.children : null);
783
- }, [Y, e.children]);
784
- const _ = Ft({ entry: e, isDirectory: E, isExpanded: Y, isItemSelected: !!h, selectionMode: c, onSelectionChange: b, onEntryClick: g, toggleDirectory: l, onToggleDirectoryRecursive: d }), ee = oe ? T?.hoverClassName !== void 0 ? T.hoverClassName : O.entryHover : "", Q = (() => {
785
- if (E) {
786
- if (n)
787
- return T?.directorySelectedClassName !== void 0 ? T.directorySelectedClassName : O.entrySelected;
788
- } else if (n || h)
789
- return T?.itemSelectedClassName !== void 0 ? T.itemSelectedClassName : M(n && O.entrySelected, h && O.entryItemSelected);
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);
790
805
  return "";
791
- })(), P = M(O.entry, ee, Q, R, e.className), K = M(O.expandIcon, (n || h) && O.expandIconSelected), te = M(O.typeIcon, (n || h) && O.typeIconSelected), G = M(O.name, V, E && O.nameDirectory, E && B, !E && H, (n || h) && O.nameSelected), Se = Dt({ isDirectory: E, isExpanded: Y, showExpandIcons: I, useCanvasExpandIcons: v, expandIconSize: D }), De = (E ? u : f) ? Lt({ entry: e, isDirectory: E, isExpanded: Y, isSelected: n, isItemSelected: !!h, extension: S, mimeType: e.mimeType }, k) : null, ve = {
792
- ...oe ? T?.hoverStyle : {},
793
- ...E && n ? T?.directorySelectedStyle : {},
794
- ...!E && (n || h) ? T?.itemSelectedStyle : {}
795
- }, je = N ? { width: N, height: N } : void 0, Ne = w ? { fontSize: typeof w == "number" ? `${w}px` : w } : void 0;
796
- return /* @__PURE__ */ i.jsxs(Kt, { children: [
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: [
797
812
  /* @__PURE__ */ i.jsxs(
798
813
  "div",
799
814
  {
800
- className: P,
815
+ className: ie,
801
816
  style: {
802
- paddingLeft: `${Math.max(0, t * p)}px`,
803
- transform: t < 0 ? `translateX(${t * p}px)` : void 0,
804
- width: t < 0 ? `calc(100% + ${Math.abs(t * p)}px)` : void 0,
805
- height: `${a}px`,
806
- ...Ne,
807
- ...ve,
808
- ...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,
809
824
  ...e.style
810
825
  },
811
- "data-entry-type": E ? "directory" : "file",
812
- "data-entry-expanded": E ? String(Y) : void 0,
813
- "data-entry-selected": n ? "true" : void 0,
814
- "data-entry-item-selected": h ? "true" : void 0,
815
- onClick: _,
816
- onMouseEnter: () => A(!0),
817
- onMouseLeave: () => A(!1),
818
- 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),
819
835
  tabIndex: 0,
820
836
  role: "treeitem",
821
- "aria-expanded": E ? Y : void 0,
822
- "aria-label": `${e.name} (${E ? "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"})`,
823
842
  children: [
824
- (I || v) && /* @__PURE__ */ i.jsx("span", { className: K, children: Se }),
825
- (E ? u : f) && /* @__PURE__ */ i.jsx("span", { className: te, style: je, children: De }),
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 }),
826
845
  /* @__PURE__ */ i.jsx(
827
846
  "span",
828
847
  {
829
- className: G,
848
+ className: $e,
830
849
  style: {
831
- ...Ne,
832
- ...C,
833
- ...E ? F : Z
850
+ ...Se,
851
+ ...z,
852
+ ...u ? $ : re
834
853
  },
835
- "data-entry-type": E ? "directory" : "file",
854
+ "data-entry-type": u ? "directory" : "file",
836
855
  "data-entry-role": "name",
837
856
  children: e.label ?? e.name
838
857
  }
@@ -840,447 +859,468 @@ const jr = {
840
859
  ]
841
860
  }
842
861
  ),
843
- Y && U && o && /* @__PURE__ */ i.jsx("fieldset", { children: U.map((ue, Te) => /* @__PURE__ */ i.jsx(
844
- Xe,
862
+ w && P && I && /* @__PURE__ */ i.jsx("fieldset", { children: P.map((U, Ee) => /* @__PURE__ */ i.jsx(
863
+ Ze,
845
864
  {
846
- entry: ue,
865
+ entry: U,
847
866
  indentLevel: t + 1,
848
- rowHeight: a,
849
- isDirOpen: s,
850
- parentIsLast: [...r, Te === U.length - 1],
851
- expansion: { toggleDirectory: l, onToggleDirectoryRecursive: d },
852
- selection: { onEntryClick: g, selectedPath: x, mode: c, selectedItems: y, onSelectionChange: b },
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 },
853
875
  visual: {
854
- iconOverrides: k,
855
- showExpandIcons: I,
856
- showDirectoryIcons: u,
857
- showFileIcons: f,
858
- useCanvasExpandIcons: v,
859
- expandIconSize: D,
860
- highlightStyles: T,
861
- entryClassName: R,
862
- entryStyle: L,
863
- nameClassName: V,
864
- nameStyle: C,
865
- directoryNameClassName: B,
866
- directoryNameStyle: F,
867
- fileNameClassName: H,
868
- fileNameStyle: Z
876
+ iconOverrides: h,
877
+ showExpandIcons: v,
878
+ showDirectoryIcons: M,
879
+ showFileIcons: N,
880
+ useCanvasExpandIcons: b,
881
+ expandIconSize: p,
882
+ highlightStyles: j,
883
+ entryClassName: Z,
884
+ entryStyle: K,
885
+ nameClassName: R,
886
+ nameStyle: z,
887
+ directoryNameClassName: F,
888
+ directoryNameStyle: $,
889
+ fileNameClassName: te,
890
+ fileNameStyle: re
869
891
  }
870
892
  },
871
- ue.absolutePath
893
+ U.absolutePath
872
894
  )) })
873
895
  ] }, e.absolutePath);
874
896
  },
875
897
  (e, t) => {
876
898
  if (e.entry !== t.entry) return !1;
877
- const a = e.entry.children !== void 0, s = t.entry.children !== void 0, r = a && e.isDirOpen(e.entry.absolutePath), o = s && t.isDirOpen(t.entry.absolutePath);
878
- return e.indentLevel === t.indentLevel && e.rowHeight === t.rowHeight && r === o && e.selection.selectedPath === t.selection.selectedPath && e.selection.mode === t.selection.mode && e.selection.selectedItems === t.selection.selectedItems && e.visual.iconOverrides === t.visual.iconOverrides && e.visual.showExpandIcons === t.visual.showExpandIcons && e.visual.showDirectoryIcons === t.visual.showDirectoryIcons && e.visual.showFileIcons === t.visual.showFileIcons && e.visual.useCanvasExpandIcons === t.visual.useCanvasExpandIcons && e.visual.expandIconSize === t.visual.expandIconSize && e.visual.highlightStyles === t.visual.highlightStyles && e.visual.entryClassName === t.visual.entryClassName && e.visual.entryStyle === t.visual.entryStyle && e.visual.nameClassName === t.visual.nameClassName && e.visual.nameStyle === t.visual.nameStyle && e.visual.directoryNameClassName === t.visual.directoryNameClassName && e.visual.directoryNameStyle === t.visual.directoryNameStyle && e.visual.fileNameClassName === t.visual.fileNameClassName && e.visual.fileNameStyle === t.visual.fileNameStyle && e.parentIsLast.length === t.parentIsLast.length && e.parentIsLast.every((l, d) => l === t.parentIsLast[d]);
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]);
879
902
  }
880
903
  );
881
- Xe.displayName = "DirectoryEntryItem";
882
- const Ut = (e) => {
904
+ Ze.displayName = "DirectoryEntryItem";
905
+ const Zt = (e) => {
883
906
  const t = [];
884
907
  if (e.children)
885
908
  for (const a of e.children)
886
- a.type === "directory" && (t.push(a.absolutePath), t.push(...Ut(a)));
909
+ a.type === "directory" && (t.push(a.absolutePath), t.push(...Zt(a)));
887
910
  return t;
888
- }, Lr = ({
911
+ }, Gr = ({
889
912
  entries: e,
890
- expansion: { toggle: t, isExpanded: a, expandMultiple: s, collapseMultiple: r, isPending: o, alwaysExpanded: l = !1, doubleClickAction: d = "recursive" },
891
- selection: { onEntryClick: g, selectedPath: x, mode: c = "none", selectedItems: y, onSelectionChange: b },
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 },
892
915
  visual: {
893
- className: k,
894
- style: I,
895
- lineColor: u = "#A0AEC0",
896
- showTreeLines: f = !0,
916
+ className: g,
917
+ style: S,
918
+ lineColor: f = "#A0AEC0",
919
+ showTreeLines: h = !0,
897
920
  showExpandIcons: v = !0,
898
- showDirectoryIcons: D = !0,
921
+ showDirectoryIcons: M = !0,
899
922
  showFileIcons: N = !0,
900
- iconOverrides: w,
923
+ iconOverrides: b,
901
924
  expandIconSize: p,
902
- itemHeight: T = Ae,
903
- removeRootIndent: R = !1,
925
+ itemHeight: O = Le,
926
+ removeRootIndent: D = !1,
904
927
  highlightStyles: L,
905
- entryClassName: V,
906
- entryStyle: C,
907
- nameClassName: B,
908
- nameStyle: F,
909
- directoryNameClassName: H,
910
- directoryNameStyle: Z,
911
- fileNameClassName: U,
912
- fileNameStyle: ae
928
+ entryClassName: j,
929
+ entryStyle: Z,
930
+ nameClassName: K,
931
+ nameStyle: R,
932
+ directoryNameClassName: z,
933
+ directoryNameStyle: F,
934
+ fileNameClassName: $,
935
+ fileNameStyle: te
913
936
  } = {},
914
- virtualScroll: oe,
915
- grid: A
937
+ virtualScroll: re,
938
+ grid: P,
939
+ sort: oe
916
940
  }) => {
917
- const E = A !== void 0, [Y, n] = se(!1), h = ce(null), S = ce(null), _ = ce(null), [ee, Q] = se(0), [P, K] = se(0), [te, G] = se(0), [Se, De] = se(null), {
918
- overscanCount: ve = 15,
919
- className: je,
920
- background: Ne,
921
- onScroll: ue,
922
- onRangeChange: Te,
923
- initialScrollIndex: Je,
924
- initialScrollOffset: le,
925
- callbackThrottleMs: qe = 5,
926
- contentInsets: be,
927
- onItemFocus: Ze,
928
- viewportHeightOverride: ne,
929
- scrollBarOptions: Le,
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,
951
+ onItemFocus: Ke,
952
+ viewportHeightOverride: se,
953
+ scrollBarOptions: He,
930
954
  behaviorOptions: Qe,
931
- preserveScrollAnchor: Ke = !1
932
- } = oe ?? {}, [Re, Fe] = se(typeof le == "number" ? le : 0), $e = ce(typeof le == "number" ? le : 0), et = W(
933
- (m, j) => {
934
- $e.current = m, Fe(m), ue?.(m, j);
955
+ preserveScrollAnchor: et = !1,
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);
935
964
  },
936
- [ue]
937
- ), tt = W(
938
- (m) => {
939
- const { renderingStartIndex: j, renderingEndIndex: $ } = m;
940
- De((X) => X && X.renderStart === j && X.renderEnd === $ ? X : { renderStart: j, renderEnd: $ }), Te?.(m);
965
+ [Re]
966
+ ), st = W(
967
+ (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);
941
970
  },
942
- [Te]
971
+ [Pe]
943
972
  );
944
- de(() => {
945
- typeof le == "number" && Fe(le);
946
- }, [le]), de(() => {
947
- n(!0), Tr();
948
- }, []), de(() => {
949
- const m = h.current, j = E ? S.current : m, $ = () => {
950
- if (m) {
951
- const re = m.clientWidth;
952
- K((ie) => Math.abs(ie - re) > 1 ? re : ie);
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 = () => {
979
+ if (d) {
980
+ const ee = d.clientWidth;
981
+ ne((ce) => Math.abs(ce - ee) > 1 ? ee : ce);
953
982
  }
954
- if (typeof ne == "number")
955
- Q((re) => Math.abs(re - ne) > 1 ? ne : re);
956
- else if (j) {
957
- const re = j.clientHeight;
958
- Q((ie) => Math.abs(ie - re) > 1 ? re : ie);
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);
959
988
  }
960
989
  };
961
- if (!(m || j)) return Q(0);
962
- $();
963
- const X = new ResizeObserver($);
964
- return m && X.observe(m), j && j !== m && X.observe(j), () => X.disconnect();
965
- }, [ne, E]);
966
- const me = typeof ne == "number" ? ne : ee, fe = W((m) => l || (Y ? a(m) : !1), [Y, a, l]), rt = M(O.container, o && O.containerPending, k), nt = q(
990
+ if (!(d || C)) return T(0);
991
+ H();
992
+ const J = new ResizeObserver(H);
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(
967
996
  () => ({
968
- ...jr,
969
- ...I ?? {},
970
- ...typeof ne == "number" ? { height: ne, minHeight: ne } : {}
997
+ ...Or,
998
+ ...S ?? {},
999
+ ...typeof se == "number" ? { height: se, minHeight: se } : {}
971
1000
  }),
972
- [I, ne]
973
- ), He = W(
974
- (m, j) => {
975
- const $ = [m.absolutePath, ...Ut(m)], X = j || d;
976
- if ($.every((ke) => fe(ke))) return r($);
977
- if ($.every((ke) => !fe(ke)) || X === "recursive") return s($);
978
- if (X === "toggle") return r($);
979
- console.warn(`[DirectoryTree] Unknown double click action: ${X}. No action taken.`);
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);
1007
+ if (J === "toggle") return r(H);
1008
+ console.warn(`[DirectoryTree] Unknown double click action: ${J}. No action taken.`);
980
1009
  },
981
- [fe, s, r, d]
982
- ), st = E ? !1 : R, { flatItems: at, lineItems: We, maxIndent: ot } = q(() => Rr(e, fe, f, st), [e, fe, f, st]), J = q(
983
- () => at.map((m, j) => {
984
- const $ = typeof T == "function" ? T(m.entry, j) : T;
985
- return { ...m, rowHeight: Number.isFinite($) && $ > 0 ? $ : Ae };
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 };
986
1015
  }),
987
- [at, T]
988
- ), he = q(() => J.map((m) => m.rowHeight), [J]), ye = q(() => {
989
- const m = new Array(he.length + 1);
990
- m[0] = 0;
991
- for (let j = 0; j < he.length; j++)
992
- m[j + 1] = m[j] + he[j];
993
- return m;
994
- }, [he]), lt = W((m) => J[m]?.rowHeight ?? Ae, [J]), Ce = q(
995
- () => !f || We.length === 0 ? { segmentsByItem: [], glyphsByItem: [] } : _r(We, he, ye, Oe, f, p ?? Pt),
996
- [We, he, ye, f, p]
997
- ), _e = q(() => !f || e.length === 0 ? 0 : (ot + 2) * Oe, [e.length, ot, f]), { renderStart: it, renderEnd: ct, lookaheadEnd: dt } = q(
998
- () => Cr(J.length, me, ve, Se, Re, ye),
999
- [J.length, me, ve, Se, Re, ye]
1000
- ), Be = q(() => !f || _e <= 0 || me <= 0 || Ce.segmentsByItem.length === 0 ? null : /* @__PURE__ */ i.jsx("div", { className: "pointer-events-none absolute inset-0 z-0", "aria-hidden": "true", children: /* @__PURE__ */ i.jsx("div", { className: "absolute top-0 left-0", style: { width: _e, height: me }, children: /* @__PURE__ */ i.jsx(
1001
- Vt,
1016
+ [it, O]
1017
+ ), he = q(() => Y.map((d) => d.rowHeight), [Y]), xe = q(() => {
1018
+ const d = new Array(he.length + 1);
1019
+ d[0] = 0;
1020
+ for (let C = 0; C < he.length; C++)
1021
+ d[C + 1] = d[C] + he[C];
1022
+ return d;
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,
1002
1031
  {
1003
- segmentsByItem: Ce.segmentsByItem,
1004
- glyphsByItem: Ce.glyphsByItem,
1005
- itemHeight: he[0] ?? Ae,
1006
- width: _e,
1032
+ segmentsByItem: Ae.segmentsByItem,
1033
+ glyphsByItem: Ae.glyphsByItem,
1034
+ itemHeight: he[0] ?? Le,
1035
+ width: Me,
1007
1036
  viewportHeight: me,
1008
- scrollPosition: Re,
1009
- color: u,
1010
- expandGlyphColor: u,
1011
- expandGlyphSize: p ?? Pt,
1012
- renderStartIndex: it,
1013
- renderEndIndex: ct,
1014
- lookaheadEndIndex: dt
1037
+ scrollPosition: _e,
1038
+ color: f,
1039
+ expandGlyphColor: f,
1040
+ expandGlyphSize: p ?? Dt,
1041
+ renderStartIndex: mt,
1042
+ renderEndIndex: ft,
1043
+ lookaheadEndIndex: ht
1015
1044
  }
1016
- ) }) }), [_e, me, it, ct, dt, Re, Ce, u, f, p, he]), ut = W((m) => J[m], [J]), mt = ce(null);
1017
- Qt(() => {
1018
- const m = mt.current;
1019
- if (mt.current = { items: J, offsets: ye }, !Ke || !m || m.items === J)
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)
1020
1049
  return;
1021
- const j = _.current, $ = typeof be == "number" ? be : be?.top ?? 0, X = j ? j.getScrollPosition() : $e.current, re = X - $, ie = br(m.items, m.offsets, re);
1022
- 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)
1023
1052
  return;
1024
- const ke = gr(ie, J, ye);
1025
- if (ke === null)
1053
+ const Ne = Tr(ce, Y, xe);
1054
+ if (Ne === null)
1026
1055
  return;
1027
- const Ye = ke + $;
1028
- if (Math.abs(Ye - X) < 1)
1056
+ const Ve = Ne + H;
1057
+ if (Math.abs(Ve - J) < 1)
1029
1058
  return;
1030
- const yt = j?.scrollTo(Ye) ?? Ye;
1031
- $e.current = yt, Fe(yt);
1032
- }, [J, ye, Ke, be]);
1033
- const pe = A?.columns, ge = A?.scrollBarWidth ?? Le?.width ?? Gt, z = q(() => pe ? yr({ measuredWidth: P, columns: pe, scrollBarWidth: ge }) : null, [pe, P, ge]), Pe = q(() => pe ? pr(pe) : "", [pe]), zt = q(() => A?.showFooter && pe ? xr(e) : [], [A?.showFooter, pe, e]), we = z?.maxHScroll ?? 0;
1034
- de(() => {
1035
- G((m) => Ge(m, we));
1036
- }, [we]);
1037
- const ft = W((m) => G((j) => Ge(j + m, we)), [we]), ht = q(
1038
- () => ({ iconOverrides: w, showExpandIcons: v, showDirectoryIcons: D, showFileIcons: N, useCanvasExpandIcons: f, expandIconSize: p, highlightStyles: L }),
1039
- [w, v, D, N, f, p, L]
1040
- ), pt = q(
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(
1041
1070
  () => /* @__PURE__ */ i.jsx(
1042
- tr,
1071
+ ir,
1043
1072
  {
1044
- ref: _,
1045
- itemCount: J.length,
1046
- getItem: ut,
1047
- getItemHeight: lt,
1073
+ ref: B,
1074
+ itemCount: Y.length,
1075
+ getItem: pt,
1076
+ getItemHeight: dt,
1077
+ getItemKey: ut,
1078
+ testId: tt,
1079
+ contentProps: rt,
1048
1080
  viewportSize: me,
1049
- overscanCount: ve,
1050
- onScroll: et,
1051
- onRangeChange: tt,
1052
- className: je,
1053
- onWheelHorizontal: E ? ft : void 0,
1081
+ overscanCount: be,
1082
+ onScroll: nt,
1083
+ onRangeChange: st,
1084
+ className: Te,
1085
+ onWheelHorizontal: G ? xt : void 0,
1054
1086
  background: /* @__PURE__ */ i.jsxs(i.Fragment, { children: [
1055
- E && z ? (
1087
+ G && X ? (
1056
1088
  // Clip the connector-line canvas to the frozen name column so deep trees never bleed into the numeric region.
1057
- /* @__PURE__ */ i.jsx("div", { className: "pointer-events-none absolute top-0 left-0 z-0 h-full overflow-hidden", style: { width: z.nameWidth }, "aria-hidden": "true", children: Be })
1058
- ) : Be,
1059
- Ne
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
1060
1092
  ] }),
1061
- initialScrollIndex: Je,
1062
- initialScrollOffset: le,
1063
- onItemFocus: Ze,
1064
- callbackThrottleMs: qe,
1065
- contentInsets: be,
1066
- scrollBarOptions: Le,
1093
+ initialScrollIndex: Se,
1094
+ initialScrollOffset: U,
1095
+ onItemFocus: Ke,
1096
+ callbackThrottleMs: Ee,
1097
+ contentInsets: ge,
1098
+ scrollBarOptions: He,
1067
1099
  behaviorOptions: Qe,
1068
- children: (m) => m ? E && A && z ? /* @__PURE__ */ i.jsx(
1069
- Wt,
1100
+ children: (d) => d ? G && P && X ? /* @__PURE__ */ i.jsx(
1101
+ Vt,
1070
1102
  {
1071
- entry: m.entry,
1072
- indentLevel: m.indentLevel,
1073
- rowHeight: m.rowHeight,
1103
+ entry: d.entry,
1104
+ indentLevel: d.indentLevel,
1105
+ positionInSet: d.positionInSet,
1106
+ setSize: d.setSize,
1107
+ rowHeight: d.rowHeight,
1074
1108
  isDirOpen: fe,
1075
- columns: A.columns,
1076
- numericTemplate: Pe,
1077
- numericTotal: z.numericTotal,
1078
- nameWidth: z.nameWidth,
1079
- rowClassName: A.rowClassName,
1080
- selection: { onEntryClick: g, selectedPath: x ?? null, mode: c, selectedItems: y, onSelectionChange: b },
1081
- expansion: { toggleDirectory: t, onToggleDirectoryRecursive: He },
1082
- visual: ht
1109
+ columns: P.columns,
1110
+ numericTemplate: Oe,
1111
+ numericTotal: X.numericTotal,
1112
+ nameWidth: X.nameWidth,
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
1083
1117
  },
1084
- m.entry.absolutePath
1118
+ d.entry.absolutePath
1085
1119
  ) : /* @__PURE__ */ i.jsx(
1086
- Xe,
1120
+ Ze,
1087
1121
  {
1088
- entry: m.entry,
1089
- indentLevel: m.indentLevel,
1090
- rowHeight: m.rowHeight,
1122
+ entry: d.entry,
1123
+ indentLevel: d.indentLevel,
1124
+ depth: d.depth,
1125
+ positionInSet: d.positionInSet,
1126
+ setSize: d.setSize,
1127
+ rowHeight: d.rowHeight,
1091
1128
  isDirOpen: fe,
1092
- parentIsLast: m.parentIsLast,
1129
+ parentIsLast: d.parentIsLast,
1093
1130
  renderChildren: !1,
1094
- expansion: { toggleDirectory: t, onToggleDirectoryRecursive: He },
1095
- selection: { onEntryClick: g, selectedPath: x ?? null, mode: c, selectedItems: y, onSelectionChange: b },
1131
+ expansion: { toggleDirectory: t, onToggleDirectoryRecursive: ze },
1132
+ selection: { onEntryClick: I, selectedPath: x ?? null, mode: c, selectedItems: y, onSelectionChange: k },
1096
1133
  visual: {
1097
- iconOverrides: w,
1134
+ iconOverrides: b,
1098
1135
  showExpandIcons: v,
1099
- showDirectoryIcons: D,
1136
+ showDirectoryIcons: M,
1100
1137
  showFileIcons: N,
1101
- useCanvasExpandIcons: f,
1138
+ useCanvasExpandIcons: h,
1102
1139
  expandIconSize: p,
1103
1140
  highlightStyles: L,
1104
- entryClassName: V,
1105
- entryStyle: C,
1106
- nameClassName: B,
1107
- nameStyle: F,
1108
- directoryNameClassName: H,
1109
- directoryNameStyle: Z,
1110
- fileNameClassName: U,
1111
- fileNameStyle: ae
1141
+ entryClassName: j,
1142
+ entryStyle: Z,
1143
+ nameClassName: K,
1144
+ nameStyle: R,
1145
+ directoryNameClassName: z,
1146
+ directoryNameStyle: F,
1147
+ fileNameClassName: $,
1148
+ fileNameStyle: te
1112
1149
  }
1113
1150
  },
1114
- m.entry.absolutePath
1151
+ d.entry.absolutePath
1115
1152
  ) : null
1116
1153
  }
1117
1154
  ),
1118
1155
  [
1119
- J.length,
1156
+ Y.length,
1157
+ pt,
1158
+ dt,
1120
1159
  ut,
1121
- lt,
1122
- me,
1123
- ve,
1124
- et,
1125
1160
  tt,
1126
- je,
1127
- E,
1128
- ft,
1129
- z,
1130
- Be,
1131
- Ne,
1132
- Je,
1133
- le,
1134
- Ze,
1135
- qe,
1161
+ rt,
1162
+ me,
1136
1163
  be,
1137
- Le,
1164
+ nt,
1165
+ st,
1166
+ Te,
1167
+ G,
1168
+ xt,
1169
+ X,
1170
+ Ge,
1171
+ Ce,
1172
+ Se,
1173
+ U,
1174
+ Ke,
1175
+ Ee,
1176
+ ge,
1177
+ He,
1138
1178
  Qe,
1139
- A,
1140
- Pe,
1179
+ P,
1180
+ Oe,
1141
1181
  fe,
1142
- g,
1182
+ I,
1143
1183
  x,
1144
1184
  c,
1145
1185
  y,
1146
- b,
1186
+ k,
1147
1187
  t,
1148
- He,
1149
- ht,
1150
- w,
1188
+ ze,
1189
+ vt,
1190
+ b,
1151
1191
  v,
1152
- D,
1192
+ M,
1153
1193
  N,
1154
- f,
1194
+ h,
1155
1195
  p,
1156
1196
  L,
1157
- V,
1158
- C,
1159
- B,
1160
- F,
1161
- H,
1197
+ j,
1162
1198
  Z,
1163
- U,
1164
- ae
1199
+ K,
1200
+ R,
1201
+ z,
1202
+ F,
1203
+ $,
1204
+ te
1165
1205
  ]
1166
1206
  );
1167
- if (!(A && z))
1168
- return /* @__PURE__ */ i.jsx("div", { ref: h, className: rt, style: nt, role: "tree", children: pt });
1169
- const Xt = A.showHeader ?? !0, Jt = A.showFooter ?? !1, qt = { ...nt, "--dt-hscroll": `${te}px` };
1170
- return /* @__PURE__ */ i.jsxs("div", { ref: h, className: M(rt, "dt-grid"), style: qt, role: "treegrid", children: [
1171
- Xt && /* @__PURE__ */ i.jsx(mr, { columns: A.columns, numericTemplate: Pe, numericTotal: z.numericTotal, nameWidth: z.nameWidth, scrollBarWidth: ge, className: A.headerClassName }),
1172
- /* @__PURE__ */ i.jsx("div", { ref: S, className: "dt-grid-body", children: pt }),
1173
- we > 0 && /* @__PURE__ */ i.jsxs("div", { className: "dt-grid-hscrollbar-row", children: [
1174
- /* @__PURE__ */ i.jsx("div", { className: "dt-grid-scrollbar-spacer", style: { width: z.nameWidth }, "aria-hidden": "true" }),
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: [
1214
+ /* @__PURE__ */ i.jsx("div", { className: "dt-grid-scrollbar-spacer", style: { width: X.nameWidth }, "aria-hidden": "true" }),
1175
1215
  /* @__PURE__ */ i.jsx(
1176
- rr,
1216
+ cr,
1177
1217
  {
1178
1218
  horizontal: !0,
1179
- contentSize: z.numericTotal,
1180
- viewportSize: z.numericVisible,
1181
- scrollPosition: te,
1182
- scrollBarWidth: ge,
1183
- onScroll: (m) => {
1184
- const j = typeof m == "function" ? m(te) : m, $ = Ge(j, we);
1185
- return G($), $;
1219
+ contentSize: X.numericTotal,
1220
+ viewportSize: X.numericVisible,
1221
+ scrollPosition: ie,
1222
+ scrollBarWidth: we,
1223
+ onScroll: (d) => {
1224
+ const C = typeof d == "function" ? d(ie) : d, H = Ue(C, ke);
1225
+ return ye(H), H;
1186
1226
  }
1187
1227
  }
1188
1228
  ),
1189
- /* @__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" })
1190
1230
  ] }),
1191
- Jt && /* @__PURE__ */ i.jsx(fr, { columns: A.columns, numericTemplate: Pe, numericTotal: z.numericTotal, nameWidth: z.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 })
1192
1232
  ] });
1193
- }, Fr = ({ initialExpanded: e = /* @__PURE__ */ new Set(), storageKey: t } = {}) => {
1194
- const [a, s] = er(), [r, o] = se(() => {
1233
+ }, Vr = ({ initialExpanded: e = /* @__PURE__ */ new Set(), storageKey: t } = {}) => {
1234
+ const [a, n] = lr(), [r, o] = ae(() => {
1195
1235
  if (typeof window < "u" && t)
1196
1236
  try {
1197
- const u = window.localStorage.getItem(t);
1198
- if (u) {
1199
- const f = JSON.parse(u);
1200
- 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);
1201
1241
  }
1202
- } catch (u) {
1203
- console.error("[useDirectoryTreeState] Error reading from localStorage", u);
1242
+ } catch (f) {
1243
+ console.error("[useDirectoryTreeState] Error reading from localStorage", f);
1204
1244
  }
1205
1245
  return e;
1206
- }), l = W((u) => {
1207
- s(() => {
1208
- o((f) => {
1209
- const v = new Set(f);
1210
- return u(v), v;
1246
+ }), l = W((f) => {
1247
+ n(() => {
1248
+ o((h) => {
1249
+ const v = new Set(h);
1250
+ return f(v), v;
1211
1251
  });
1212
1252
  });
1213
- }, []), d = W(
1214
- (u, f) => {
1253
+ }, []), m = W(
1254
+ (f, h) => {
1215
1255
  l((v) => {
1216
- for (const D of u)
1217
- f(v, D);
1256
+ for (const M of f)
1257
+ h(v, M);
1218
1258
  });
1219
1259
  },
1220
1260
  [l]
1221
1261
  );
1222
- de(() => {
1262
+ ue(() => {
1223
1263
  if (t && typeof window < "u")
1224
1264
  try {
1225
1265
  window.localStorage.setItem(t, JSON.stringify(Array.from(r)));
1226
- } catch (u) {
1227
- console.warn(`Error setting localStorage key "${t}":`, u);
1266
+ } catch (f) {
1267
+ console.warn(`Error setting localStorage key "${t}":`, f);
1228
1268
  }
1229
1269
  }, [r, t]);
1230
- const g = W(
1231
- (u) => {
1232
- d([u], (f, v) => {
1233
- 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);
1234
1274
  });
1235
1275
  },
1236
- [d]
1276
+ [m]
1237
1277
  ), x = W(
1238
- (u) => {
1239
- d([u], (f, v) => {
1240
- f.add(v);
1278
+ (f) => {
1279
+ m([f], (h, v) => {
1280
+ h.add(v);
1241
1281
  });
1242
1282
  },
1243
- [d]
1283
+ [m]
1244
1284
  ), c = W(
1245
- (u) => {
1246
- d([u], (f, v) => {
1247
- f.delete(v);
1285
+ (f) => {
1286
+ m([f], (h, v) => {
1287
+ h.delete(v);
1248
1288
  });
1249
1289
  },
1250
- [d]
1290
+ [m]
1251
1291
  ), y = W(
1252
- (u) => {
1253
- d(u, (f, v) => {
1254
- f.delete(v);
1292
+ (f) => {
1293
+ m(f, (h, v) => {
1294
+ h.delete(v);
1255
1295
  });
1256
1296
  },
1257
- [d]
1258
- ), b = W(
1259
- (u) => {
1260
- d(u, (f, v) => {
1261
- f.add(v);
1297
+ [m]
1298
+ ), k = W(
1299
+ (f) => {
1300
+ m(f, (h, v) => {
1301
+ h.add(v);
1262
1302
  });
1263
1303
  },
1264
- [d]
1265
- ), k = W(() => {
1266
- l((u) => {
1267
- u.clear();
1304
+ [m]
1305
+ ), g = W(() => {
1306
+ l((f) => {
1307
+ f.clear();
1268
1308
  });
1269
- }, [l]), I = W((u) => r.has(u), [r]);
1309
+ }, [l]), S = W((f) => r.has(f), [r]);
1270
1310
  return {
1271
1311
  expanded: r,
1272
- toggle: g,
1312
+ toggle: I,
1273
1313
  expand: x,
1274
1314
  collapse: c,
1275
1315
  collapseMultiple: y,
1276
- expandMultiple: b,
1277
- collapseAll: k,
1278
- isExpanded: I,
1316
+ expandMultiple: k,
1317
+ collapseAll: g,
1318
+ isExpanded: S,
1279
1319
  isPending: a
1280
1320
  };
1281
1321
  };
1282
1322
  export {
1283
- Lr as DirectoryTree,
1284
- O as directoryTreeClasses,
1285
- Fr as useDirectoryTreeState
1323
+ Gr as DirectoryTree,
1324
+ A as directoryTreeClasses,
1325
+ Vr as useDirectoryTreeState
1286
1326
  };