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