@aiquants/directory-tree 2.3.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,655 +1,749 @@
1
- import et, { memo as Ye, useRef as fe, useCallback as C, useEffect as oe, useState as ie, useMemo as ee, Fragment as tt, useTransition as rt } from "react";
2
- import { VirtualScroll as nt } from "@aiquants/virtualscroll";
3
- import { FolderIcon as ot, DocumentTextIcon as st, ChevronDownIcon as at, ChevronRightIcon as lt } from "@heroicons/react/24/solid";
4
- import { FileIcon as it } from "@phosphor-icons/react";
5
- import { twMerge as Y } from "tailwind-merge";
6
- var xe = { exports: {} }, me = {};
7
- var $e;
8
- function ct() {
9
- if ($e) return me;
10
- $e = 1;
11
- var e = /* @__PURE__ */ Symbol.for("react.transitional.element"), r = /* @__PURE__ */ Symbol.for("react.fragment");
12
- function a(n, o, l) {
13
- var s = null;
14
- if (l !== void 0 && (s = "" + l), o.key !== void 0 && (s = "" + o.key), "key" in o) {
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
15
  l = {};
16
- for (var m in o)
17
- m !== "key" && (l[m] = o[m]);
18
- } else l = o;
19
- return o = l.ref, {
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
21
  type: n,
22
- key: s,
23
- ref: o !== void 0 ? o : null,
22
+ key: a,
23
+ ref: s !== void 0 ? s : null,
24
24
  props: l
25
25
  };
26
26
  }
27
- return me.Fragment = r, me.jsx = a, me.jsxs = a, me;
27
+ return ge.Fragment = t, ge.jsx = o, ge.jsxs = o, ge;
28
28
  }
29
- var he = {};
30
- var De;
31
- function ut() {
32
- return De || (De = 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 === q ? null : t.displayName || t.name || null;
37
- if (typeof t == "string") return t;
38
- switch (t) {
39
- case u:
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 j:
41
+ case O:
42
42
  return "Profiler";
43
- case p:
43
+ case b:
44
44
  return "StrictMode";
45
- case P:
45
+ case R:
46
46
  return "Suspense";
47
- case T:
47
+ case $:
48
48
  return "SuspenseList";
49
- case U:
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 i:
55
+ ), r.$$typeof) {
56
+ case c:
57
57
  return "Portal";
58
- case g:
59
- return t.displayName || "Context";
60
- case v:
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 A:
66
- return f = t.displayName || null, f !== null ? f : e(t.type) || "Memo";
67
- case X:
68
- f = t._payload, t = t._init;
58
+ case S:
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 a(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, k = 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
- k
93
- ), r(t);
92
+ _
93
+ ), t(r);
94
94
  }
95
95
  }
96
- function n(t) {
97
- if (t === u) return "<>";
98
- if (typeof t == "object" && t !== null && t.$$typeof === X)
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 o() {
108
- var t = $.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
111
  function l() {
112
112
  return Error("react-stack-top-frame");
113
113
  }
114
- function s(t) {
115
- if (V.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 m(t, f) {
122
- function x() {
123
- se || (se = !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
- function R() {
134
- var t = e(this.type);
135
- return S[t] || (S[t] = !0, console.error(
133
+ function E() {
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 w(t, f, x, k, te, Q) {
140
- var _ = x.ref;
141
- return t = {
139
+ function v(r, p, T, _, q, Z) {
140
+ var j = T.ref;
141
+ return r = {
142
142
  $$typeof: I,
143
- type: t,
144
- key: f,
145
- props: x,
146
- _owner: k
147
- }, (_ !== void 0 ? _ : null) !== null ? Object.defineProperty(t, "ref", {
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
- get: R
150
- }) : Object.defineProperty(t, "ref", { enumerable: !1, value: null }), t._store = {}, Object.defineProperty(t._store, "validated", {
149
+ get: E
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: te
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: Q
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, k, te, Q) {
173
- var _ = f.children;
174
- if (_ !== void 0)
175
- if (k)
176
- if (Z(_)) {
177
- for (k = 0; k < _.length; k++)
178
- h(_[k]);
179
- Object.freeze && Object.freeze(_);
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 h(_);
185
- if (V.call(f, "key")) {
186
- _ = e(t);
187
- var J = Object.keys(f).filter(function(ce) {
188
- return ce !== "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
- k = 0 < J.length ? "{key: someKey, " + J.join(": ..., ") + ": ...}" : "{key: someKey}", O[_ + k] || (J = 0 < J.length ? "{" + J.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
- k,
198
197
  _,
199
- J,
200
- _
201
- ), O[_ + k] = !0);
198
+ j,
199
+ Q,
200
+ j
201
+ ), se[j + _] = !0);
202
202
  }
203
- if (_ = null, x !== void 0 && (a(x), _ = "" + x), s(f) && (a(f.key), _ = "" + f.key), "key" in f) {
204
- x = {};
205
- for (var re in f)
206
- re !== "key" && (x[re] = f[re]);
207
- } else x = f;
208
- return _ && m(
209
- x,
210
- typeof t == "function" ? t.displayName || t.name || "Unknown" : t
211
- ), w(
212
- t,
213
- _,
214
- x,
215
- o(),
216
- te,
217
- Q
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 h(t) {
221
- y(t) ? t._store && (t._store.validated = 1) : typeof t == "object" && t !== null && t.$$typeof === X && (t._payload.status === "fulfilled" ? y(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 y(t) {
224
- return typeof t == "object" && t !== null && t.$$typeof === I;
223
+ function g(r) {
224
+ return typeof r == "object" && r !== null && r.$$typeof === I;
225
225
  }
226
- var E = et, I = /* @__PURE__ */ Symbol.for("react.transitional.element"), i = /* @__PURE__ */ Symbol.for("react.portal"), u = /* @__PURE__ */ Symbol.for("react.fragment"), p = /* @__PURE__ */ Symbol.for("react.strict_mode"), j = /* @__PURE__ */ Symbol.for("react.profiler"), v = /* @__PURE__ */ Symbol.for("react.consumer"), g = /* @__PURE__ */ Symbol.for("react.context"), d = /* @__PURE__ */ Symbol.for("react.forward_ref"), P = /* @__PURE__ */ Symbol.for("react.suspense"), T = /* @__PURE__ */ Symbol.for("react.suspense_list"), A = /* @__PURE__ */ Symbol.for("react.memo"), X = /* @__PURE__ */ Symbol.for("react.lazy"), U = /* @__PURE__ */ Symbol.for("react.activity"), q = /* @__PURE__ */ Symbol.for("react.client.reference"), $ = E.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE, V = Object.prototype.hasOwnProperty, Z = 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
- E = {
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 se, S = {}, D = E.react_stack_bottom_frame.bind(
235
- E,
234
+ var C, U = {}, N = w.react_stack_bottom_frame.bind(
235
+ w,
236
236
  l
237
- )(), L = G(n(l)), O = {};
238
- he.Fragment = u, he.jsx = function(t, f, x) {
239
- var k = 1e4 > $.recentlyCreatedOwnerStacks++;
240
- return c(
241
- t,
242
- f,
243
- x,
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
- k ? Error("react-stack-top-frame") : D,
246
- k ? G(n(t)) : L
245
+ _ ? Error("react-stack-top-frame") : N,
246
+ _ ? J(n(r)) : H
247
247
  );
248
- }, he.jsxs = function(t, f, x) {
249
- var k = 1e4 > $.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
- k ? Error("react-stack-top-frame") : D,
256
- k ? G(n(t)) : L
255
+ _ ? Error("react-stack-top-frame") : N,
256
+ _ ? J(n(r)) : H
257
257
  );
258
258
  };
259
- })()), he;
259
+ })()), xe;
260
260
  }
261
- var Le;
262
- function dt() {
263
- return Le || (Le = 1, process.env.NODE_ENV === "production" ? xe.exports = ct() : xe.exports = ut()), xe.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 = dt();
266
- const ft = (e, r, a) => {
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;
302
+ }
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;
393
+ }
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) => {
267
426
  const n = [];
268
- for (let o = r; o < a; o++) {
269
- const l = e[o];
427
+ for (let s = t; s < o; s++) {
428
+ const l = e[s];
270
429
  if (!(!l || l.length === 0))
271
- for (const s of l)
272
- n.push(s);
430
+ for (const a of l)
431
+ n.push(a);
273
432
  }
274
433
  return n;
275
- }, mt = (e, r, a) => {
434
+ }, rr = (e, t, o) => {
276
435
  const n = [];
277
- for (let o = r; o < a; o++) {
278
- const l = e[o];
436
+ for (let s = t; s < o; s++) {
437
+ const l = e[s];
279
438
  if (!(!l || l.length === 0))
280
- for (const s of l)
281
- n.push(s);
439
+ for (const a of l)
440
+ n.push(a);
282
441
  }
283
442
  return n;
284
- }, ht = (e, r, a, n) => {
285
- const o = Math.max(1, Math.floor(r * n)), l = Math.max(1, Math.floor(a * n));
286
- (e.width !== o || e.height !== l) && (e.width = o, e.height = l);
287
- const s = e.style;
288
- s.width !== `${r}px` && (s.width = `${r}px`), s.height !== `${a}px` && (s.height = `${a}px`);
289
- }, yt = (e, r, a) => {
290
- e.lineWidth = a, e.beginPath();
291
- for (const n of r)
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) => {
449
+ e.lineWidth = o, e.beginPath();
450
+ for (const n of t)
292
451
  e.moveTo(n.x1, n.y1), e.lineTo(n.x2, n.y2);
293
452
  e.stroke();
294
- }, pt = (e, r) => {
295
- const a = /^#([0-9a-f]{3}|[0-9a-f]{6})$/i.exec(e.trim());
296
- if (!a)
453
+ }, or = (e, t) => {
454
+ const o = /^#([0-9a-f]{3}|[0-9a-f]{6})$/i.exec(e.trim());
455
+ if (!o)
297
456
  return null;
298
- let n = a[1];
457
+ let n = o[1];
299
458
  n.length === 3 && (n = n.split("").map((m) => m + m).join(""));
300
- const o = Number.parseInt(n.slice(0, 2), 16), l = Number.parseInt(n.slice(2, 4), 16), s = Number.parseInt(n.slice(4, 6), 16);
301
- return `rgba(${o}, ${l}, ${s}, ${r})`;
302
- }, bt = (e, r, a, n) => {
303
- if (r.length === 0)
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 o = pt(a, 0.14), l = e.strokeStyle, s = e.fillStyle, m = e.lineWidth, R = e.lineCap, w = e.lineJoin;
306
- e.strokeStyle = a, e.lineCap = "round", e.lineJoin = "round";
307
- for (const c of r) {
308
- const h = n ?? c.size, y = Math.max(0, h / 2), E = Math.max(1, Math.round(h * 0.08)), I = Math.max(1, Math.round(h * 0.14)), i = Math.max(0, y - E * 0.8), u = Math.max(0, i * 0.55);
309
- o && (e.fillStyle = o, e.beginPath(), e.arc(c.centerX, c.centerY, i, 0, Math.PI * 2), e.fill()), e.lineWidth = E, e.beginPath(), e.arc(c.centerX, c.centerY, Math.max(0, y - E * 0.3), 0, Math.PI * 2), e.stroke(), e.lineWidth = I, e.beginPath(), e.moveTo(c.centerX - u, c.centerY), e.lineTo(c.centerX + u, c.centerY), e.stroke(), c.isExpanded || (e.beginPath(), e.moveTo(c.centerX, c.centerY - u), e.lineTo(c.centerX, c.centerY + u), e.stroke());
464
+ const s = or(o, 0.14), l = e.strokeStyle, a = e.fillStyle, m = e.lineWidth, E = e.lineCap, v = e.lineJoin;
465
+ e.strokeStyle = o, e.lineCap = "round", e.lineJoin = "round";
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 = l, e.fillStyle = s, e.lineWidth = m, e.lineCap = R, e.lineJoin = w;
312
- }, Be = Ye(({ segmentsByItem: e, glyphsByItem: r, itemHeight: a, width: n, viewportHeight: o, scrollPosition: l, color: s = "#a0aec0", strokeWidth: m = 1, renderStartIndex: R, renderEndIndex: w, lookaheadEndIndex: c, devicePixelRatio: h, expandGlyphColor: y, expandGlyphSize: E }) => {
313
- const I = fe(null), i = fe(null), u = fe({
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,
316
- itemHeight: a,
474
+ glyphsByItem: t,
475
+ itemHeight: o,
317
476
  width: n,
318
- viewportHeight: o,
477
+ viewportHeight: s,
319
478
  scrollPosition: l,
320
- color: s,
479
+ color: a,
321
480
  strokeWidth: m,
322
- renderStartIndex: R,
323
- renderEndIndex: w,
324
- lookaheadEndIndex: c,
325
- devicePixelRatio: h,
326
- expandGlyphColor: y,
327
- expandGlyphSize: E
328
- }), p = C(() => {
329
- i.current = null;
330
- const v = I.current;
331
- if (!v)
481
+ renderStartIndex: E,
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 g = v.getContext("2d");
334
- if (!g)
492
+ const S = x.getContext("2d");
493
+ if (!S)
335
494
  return;
336
- const d = u.current;
337
- if (d.width <= 0 || d.viewportHeight <= 0) {
338
- g.clearRect(0, 0, v.width, v.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 P = Number.isFinite(d.devicePixelRatio ?? NaN) ? d.devicePixelRatio : typeof window < "u" && window.devicePixelRatio || 1;
342
- ht(v, d.width, d.viewportHeight, P);
343
- const T = d.segmentsByItem.length, A = typeof d.renderStartIndex == "number" && Number.isFinite(d.renderStartIndex) ? Math.max(0, Math.floor(d.renderStartIndex)) : Math.max(0, Math.floor(d.scrollPosition / d.itemHeight)), X = Math.min(T, Math.ceil((d.scrollPosition + d.viewportHeight) / d.itemHeight)), U = (() => {
344
- if (typeof d.renderEndIndex == "number" && Number.isFinite(d.renderEndIndex)) {
345
- const Z = Math.floor(d.renderEndIndex);
346
- return Math.max(Math.min(T, Z + 1), A);
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(X, A);
349
- })(), q = (() => {
350
- if (typeof d.lookaheadEndIndex == "number" && Number.isFinite(d.lookaheadEndIndex)) {
351
- const Z = Math.floor(d.lookaheadEndIndex), G = Math.min(T, Z + 1);
352
- return Math.max(G, U);
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(X, U);
355
- })(), $ = ft(d.segmentsByItem, A, q), V = mt(d.glyphsByItem, A, q);
356
- g.save(), g.scale(P, P), g.clearRect(0, 0, d.width, d.viewportHeight), g.translate(0, -d.scrollPosition), g.strokeStyle = d.color, yt(g, $, d.strokeWidth), bt(g, V, d.expandGlyphColor ?? d.color, d.expandGlyphSize), g.restore();
357
- }, []), j = C(() => {
358
- i.current === null && (i.current = window.requestAnimationFrame(p));
359
- }, [p]);
360
- return oe(() => {
361
- u.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,
364
- itemHeight: a,
522
+ glyphsByItem: t,
523
+ itemHeight: o,
365
524
  width: n,
366
- viewportHeight: o,
525
+ viewportHeight: s,
367
526
  scrollPosition: l,
368
- color: s,
527
+ color: a,
369
528
  strokeWidth: m,
370
- renderStartIndex: R,
371
- renderEndIndex: w,
372
- lookaheadEndIndex: c,
373
- devicePixelRatio: h,
374
- expandGlyphColor: y,
375
- expandGlyphSize: E
376
- }, j();
377
- }, [e, r, a, n, o, l, s, m, R, w, c, h, y, E, j]), oe(() => () => {
378
- i.current !== null && (window.cancelAnimationFrame(i.current), i.current = null);
379
- }, []), /* @__PURE__ */ N.jsx("canvas", { ref: I, className: "pointer-events-none absolute top-0 left-0 z-0" });
529
+ renderStartIndex: E,
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
- Be.displayName = "TreeLineCanvas";
382
- const W = {
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: Y("directory-tree-entry--hover hover:bg-gray-400/15", "dark:hover:bg-gray-200/10"),
388
- // 選択時のスタイル(ライト/ダークモード対応)
389
- entrySelected: Y("directory-tree-entry--selected bg-blue-400/10", "dark:bg-blue-400/15"),
390
- // アイテム選択時のスタイル(ライト/ダークモード対応)
391
- entryItemSelected: Y("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: Y("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: Y("directory-tree-expand-icon--selected text-blue-700", "dark:text-blue-400"),
395
- typeIcon: Y("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: Y("directory-tree-type-icon--selected text-blue-700", "dark:text-blue-400"),
397
- // テキストのスタイル
398
- name: Y("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: Y("directory-tree-name--selected text-blue-800 font-medium", "dark:text-blue-300")
401
- }, vt = {
540
+ Ct.displayName = "TreeLineCanvas";
541
+ const lr = {
402
542
  msOverflowStyle: "none",
403
543
  scrollbarWidth: "none"
404
- }, gt = () => {
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
- }, xt = (e, r, a, n) => {
408
- const o = [], l = [];
409
- let s = 0;
410
- const m = (R, w, c) => {
411
- for (let h = 0; h < R.length; h++) {
412
- const y = R[h], E = h === R.length - 1, I = [...c, E], i = y.children !== void 0, u = i && r(y.absolutePath, y.relativePath);
413
- let p = w, j = I, v = c;
414
- n && (p = w - 1, j = I.slice(1), v = c.slice(1)), o.push({ entry: y, indentLevel: p, parentIsLast: j }), a && (p > s && (s = p), l.push({
415
- id: y.absolutePath,
416
- name: y.name,
417
- absolutePath: y.absolutePath,
418
- indentLevel: p,
419
- isLastChild: E,
420
- isDirectory: i,
421
- isExpanded: u,
422
- ancestorIsLast: [...v],
423
- hideLines: n && w === 0
424
- })), i && u && y.children && m(y.children, w + 1, I);
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 m(e, 0, []), { flatItems: o, lineItems: l, maxIndent: s };
428
- }, Fe = (e, r) => {
429
- const a = e.length - 1;
430
- if (a <= 0) return 0;
431
- let n = 0, o = a - 1, l = 0;
432
- for (; n <= o; ) {
433
- const s = n + o >>> 1;
434
- e[s] <= r ? (l = s, n = s + 1) : o = s - 1;
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;
435
575
  }
436
576
  return l;
437
- }, Et = (e, r, a, n, o, l) => {
438
- const s = n?.renderStart ?? Math.max(0, Fe(l, o)), m = r > 0 ? Fe(l, o + r) + a : s + a, R = e > 0 ? Math.min(e - 1, Math.max(s, m)) : s, w = n?.renderEnd ?? R, c = e > 0 ? Math.min(e - 1, w + a) : w;
439
- return { renderStart: s, renderEnd: w, lookaheadEnd: c };
440
- }, It = ({ isDirectory: e, isExpanded: r, showExpandIcons: a, useCanvasExpandIcons: n, expandIconSize: o }) => {
441
- const l = o ? { width: o, height: o } : void 0, s = o ? "" : "h-4 w-4";
442
- return !(a && e) || n ? /* @__PURE__ */ N.jsx("span", { className: s, style: l, "aria-hidden": "true" }) : r ? /* @__PURE__ */ N.jsx(at, { className: s, style: l }) : /* @__PURE__ */ N.jsx(lt, { className: s, style: l });
443
- }, St = (e) => e.slice((e.lastIndexOf(".") - 1 >>> 0) + 2).toLowerCase(), wt = (e, r, a, n, o, 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) => {
444
581
  if (e.length === 0)
445
582
  return { segmentsByItem: [], glyphsByItem: [] };
446
- const s = Array.from({ length: e.length }, () => []), m = Array.from({ length: e.length }, () => []), R = (c) => o ? typeof l == "number" && Number.isFinite(l) && l > 0 ? l : Math.max(8, Math.min(n * 0.9, c * 0.7)) : 0, w = 3;
447
- for (let c = 0; c < e.length; c++) {
448
- const h = e[c];
449
- if (h.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)
450
587
  continue;
451
- const y = [], E = r[c] ?? 0, I = a[c] ?? 0, i = I + E / 2, u = R(E), p = u > 0 ? u / 2 + 2 : n / 1.5;
452
- for (let g = 0; g < h.indentLevel; g++) {
453
- if (h.ancestorIsLast[g] ?? !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)
454
591
  continue;
455
- let P = !1;
456
- for (let T = c; T < e.length; T++) {
457
- const A = e[T];
458
- if (A.indentLevel > g && A.ancestorIsLast.length > g && !A.ancestorIsLast[g]) {
459
- P = !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;
460
597
  break;
461
598
  }
462
- if (T > c && A.indentLevel === g)
599
+ if ($ > i && D.indentLevel === S)
463
600
  break;
464
601
  }
465
- if (P) {
466
- const T = g * n + n / 2 + w;
467
- y.push({
468
- key: `${h.id}-ancestor-${g}`,
469
- x1: T,
602
+ if (R) {
603
+ const $ = S * n + n / 2 + v;
604
+ g.push({
605
+ key: `${f.id}-ancestor-${S}`,
606
+ x1: $,
470
607
  y1: I,
471
- x2: T,
472
- y2: I + E,
473
- itemIndex: c
608
+ x2: $,
609
+ y2: I + w,
610
+ itemIndex: i
474
611
  });
475
612
  }
476
613
  }
477
- const j = h.indentLevel * n, v = j + n / 2 + w;
478
- if (h.isDirectory ? y.push({
479
- key: `${h.id}-connector-top`,
480
- x1: v,
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,
481
618
  y1: I,
482
- x2: v,
483
- y2: i - p,
484
- itemIndex: c
485
- }) : y.push({
486
- key: `${h.id}-connector-top`,
487
- x1: v,
619
+ x2: x,
620
+ y2: c - b,
621
+ itemIndex: i
622
+ }) : g.push({
623
+ key: `${f.id}-connector-top`,
624
+ x1: x,
488
625
  y1: I,
489
- x2: v,
490
- y2: i,
491
- itemIndex: c
492
- }), !h.isDirectory && h.isLastChild && y.push({
493
- key: `${h.id}-connector-horizontal`,
494
- x1: v,
495
- y1: i,
496
- x2: j + n + w,
497
- y2: i,
498
- itemIndex: c
499
- }), h.isLastChild || (h.isDirectory ? y.push({
500
- key: `${h.id}-connector-bottom`,
501
- x1: v,
502
- y1: i + p,
503
- x2: v,
504
- y2: I + E,
505
- itemIndex: c
506
- }) : y.push({
507
- key: `${h.id}-connector-bottom`,
508
- x1: v,
509
- y1: i,
510
- x2: v,
511
- y2: I + E,
512
- itemIndex: c
513
- })), s[c] = y, o && h.isDirectory) {
514
- const g = u, d = v, P = i;
515
- m[c] = [
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] = [
516
653
  {
517
- key: `${h.id}-glyph`,
518
- itemIndex: c,
519
- centerX: d,
520
- centerY: P,
521
- size: g,
522
- isExpanded: h.isExpanded
654
+ key: `${f.id}-glyph`,
655
+ itemIndex: i,
656
+ centerX: h,
657
+ centerY: R,
658
+ size: S,
659
+ isExpanded: f.isExpanded
523
660
  }
524
661
  ];
525
662
  }
526
663
  }
527
- return { segmentsByItem: s, glyphsByItem: m };
528
- }, Re = (e, r) => {
529
- if (e == null || typeof e == "boolean") return null;
530
- if (typeof e == "function")
531
- return console.warn(`[DirectoryTree] Function returned by renderer for "${r}". Return a node.`), null;
532
- if (typeof e == "object") {
533
- if ("then" in e)
534
- return console.warn(`[DirectoryTree] Promise returned for "${r}". Not supported.`), null;
535
- if (Array.isArray(e)) {
536
- const n = e.map((o) => Re(o, r)).filter(Boolean);
537
- return n.length ? n : null;
538
- }
539
- const a = e.type;
540
- if (a && a.$$typeof === /* @__PURE__ */ Symbol.for("react.lazy"))
541
- return console.warn(`[DirectoryTree] Lazy component for "${r}". Not supported.`), null;
542
- }
543
- return e;
544
- }, kt = (e, r) => {
545
- const { entry: a, isDirectory: n, isExpanded: o, extension: l } = e;
546
- let s;
547
- return a.icon !== void 0 ? s = a.icon : n ? s = o && r?.directoryExpanded || r?.directory || /* @__PURE__ */ N.jsx(ot, { className: "h-4 w-4" }) : l && r?.fileByExtension?.[l] ? s = r.fileByExtension[l] : s = r?.file || (l === "md" ? /* @__PURE__ */ N.jsx(st, { className: "h-4 w-4" }) : /* @__PURE__ */ N.jsx(it, { className: "h-4 w-4" })), Re(typeof s == "function" ? s(e) : s, a.absolutePath);
548
- }, _e = Ye(
664
+ return { segmentsByItem: a, glyphsByItem: m };
665
+ }, Fe = We(
549
666
  ({
550
667
  entry: e,
551
- indentLevel: r,
552
- rowHeight: a,
668
+ indentLevel: t,
669
+ rowHeight: o,
553
670
  isDirOpen: n,
554
- parentIsLast: o,
671
+ parentIsLast: s,
555
672
  renderChildren: l = !0,
556
- expansion: { toggleDirectory: s, onToggleDirectoryRecursive: m },
557
- selection: { onEntryClick: R, selectedPath: w, mode: c = "none", selectedItems: h, onSelectionChange: y },
673
+ expansion: { toggleDirectory: a, onToggleDirectoryRecursive: m },
674
+ selection: { onEntryClick: E, selectedPath: v, mode: i = "none", selectedItems: f, onSelectionChange: g },
558
675
  visual: {
559
- iconOverrides: E,
676
+ iconOverrides: w,
560
677
  showExpandIcons: I = !0,
561
- showDirectoryIcons: i = !0,
562
- showFileIcons: u = !0,
563
- useCanvasExpandIcons: p = !1,
564
- expandIconSize: j,
565
- highlightStyles: v,
566
- entryClassName: g,
567
- entryStyle: d,
568
- nameClassName: P,
569
- nameStyle: T,
570
- directoryNameClassName: A,
571
- directoryNameStyle: X,
572
- fileNameClassName: U,
573
- fileNameStyle: q
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
574
691
  }
575
692
  }) => {
576
- const $ = fe(null), [V, Z] = ie(null), [G, se] = ie(!1);
577
- oe(
578
- () => () => {
579
- $.current && window.clearTimeout($.current);
580
- },
581
- []
582
- );
583
- const S = e.children !== void 0, D = S && n(e.absolutePath), L = e.absolutePath === w, O = !S && h?.has(e.absolutePath), t = S ? void 0 : St(e.name);
584
- oe(() => {
585
- Z(D && e.children ? e.children : null);
586
- }, [D, e.children]);
587
- const f = C(
588
- (B) => {
589
- B.stopPropagation(), c !== "none" && !S && y && y(e, !O);
590
- let ue = !1;
591
- R({
592
- entry: e,
593
- isDirectory: S,
594
- isExpanded: D,
595
- preventDefault: () => {
596
- ue = !0;
597
- }
598
- }), !(!S || ue) && ($.current ? (window.clearTimeout($.current), $.current = null, m(e)) : $.current = window.setTimeout(() => {
599
- s(e.absolutePath), $.current = null;
600
- }, 500));
601
- },
602
- [S, e, D, m, s, R, c, y, O]
603
- ), x = G ? v?.hoverClassName !== void 0 ? v.hoverClassName : W.entryHover : "", k = (() => {
604
- if (S) {
605
- if (L)
606
- return v?.directorySelectedClassName !== void 0 ? v.directorySelectedClassName : W.entrySelected;
607
- } else if (L || O)
608
- return v?.itemSelectedClassName !== void 0 ? v.itemSelectedClassName : Y(L && W.entrySelected, O && W.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);
609
703
  return "";
610
- })(), te = Y(W.entry, x, k, g, e.className), Q = Y(W.expandIcon, (L || O) && W.expandIconSelected), _ = Y(W.typeIcon, (L || O) && W.typeIconSelected), J = Y(W.name, P, S && W.nameDirectory, S && A, !S && U, (L || O) && W.nameSelected), re = It({ isDirectory: S, isExpanded: D, showExpandIcons: I, useCanvasExpandIcons: p, expandIconSize: j }), ce = (S ? i : u) ? kt({ entry: e, isDirectory: S, isExpanded: D, isSelected: L, isItemSelected: !!O, extension: t }, E) : null, Ie = {
611
- ...G ? v?.hoverStyle : {},
612
- ...S && L ? v?.directorySelectedStyle : {},
613
- ...!S && (L || O) ? v?.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 : {}
614
708
  };
615
- return /* @__PURE__ */ N.jsxs(tt, { children: [
616
- /* @__PURE__ */ N.jsxs(
709
+ return /* @__PURE__ */ y.jsxs(Dt, { children: [
710
+ /* @__PURE__ */ y.jsxs(
617
711
  "div",
618
712
  {
619
- className: te,
713
+ className: _,
620
714
  style: {
621
- paddingLeft: `${Math.max(0, r * ye)}px`,
622
- transform: r < 0 ? `translateX(${r * ye}px)` : void 0,
623
- width: r < 0 ? `calc(100% + ${Math.abs(r * ye)}px)` : void 0,
624
- height: `${a}px`,
625
- ...Ie,
626
- ...d,
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,
627
721
  ...e.style
628
722
  },
629
- "data-entry-type": S ? "directory" : "file",
630
- "data-entry-expanded": S ? String(D) : void 0,
631
- "data-entry-selected": L ? "true" : void 0,
632
- "data-entry-item-selected": O ? "true" : void 0,
633
- onClick: f,
634
- onMouseEnter: () => se(!0),
635
- onMouseLeave: () => se(!1),
636
- onKeyDown: (B) => B.key === "Enter" && f(B),
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),
637
731
  tabIndex: 0,
638
732
  role: "treeitem",
639
- "aria-expanded": S ? D : void 0,
640
- "aria-label": `${e.name} (${S ? "directory" : "file"})`,
733
+ "aria-expanded": C ? U : void 0,
734
+ "aria-label": `${e.name} (${C ? "directory" : "file"})`,
641
735
  children: [
642
- (I || p) && /* @__PURE__ */ N.jsx("span", { className: Q, children: re }),
643
- (S ? i : u) && /* @__PURE__ */ N.jsx("span", { className: _, children: ce }),
644
- /* @__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(
645
739
  "span",
646
740
  {
647
- className: J,
741
+ className: j,
648
742
  style: {
649
- ...T,
650
- ...S ? X : q
743
+ ...$,
744
+ ...C ? k : W
651
745
  },
652
- "data-entry-type": S ? "directory" : "file",
746
+ "data-entry-type": C ? "directory" : "file",
653
747
  "data-entry-role": "name",
654
748
  children: e.label ?? e.name
655
749
  }
@@ -657,324 +751,429 @@ const W = {
657
751
  ]
658
752
  }
659
753
  ),
660
- D && V && l && /* @__PURE__ */ N.jsx("fieldset", { children: V.map((B, ue) => /* @__PURE__ */ N.jsx(
661
- _e,
754
+ U && L && l && /* @__PURE__ */ y.jsx("fieldset", { children: L.map((le, Ce) => /* @__PURE__ */ y.jsx(
755
+ Fe,
662
756
  {
663
- entry: B,
664
- indentLevel: r + 1,
665
- rowHeight: a,
757
+ entry: le,
758
+ indentLevel: t + 1,
759
+ rowHeight: o,
666
760
  isDirOpen: n,
667
- parentIsLast: [...o, ue === V.length - 1],
668
- expansion: { toggleDirectory: s, onToggleDirectoryRecursive: m },
669
- selection: { onEntryClick: R, selectedPath: w, mode: c, selectedItems: h, onSelectionChange: y },
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 },
670
764
  visual: {
671
- iconOverrides: E,
765
+ iconOverrides: w,
672
766
  showExpandIcons: I,
673
- showDirectoryIcons: i,
674
- showFileIcons: u,
675
- useCanvasExpandIcons: p,
676
- expandIconSize: j,
677
- highlightStyles: v,
678
- entryClassName: g,
679
- entryStyle: d,
680
- nameClassName: P,
681
- nameStyle: T,
682
- directoryNameClassName: A,
683
- directoryNameStyle: X,
684
- fileNameClassName: U,
685
- fileNameStyle: q
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
686
780
  }
687
781
  },
688
- B.absolutePath
782
+ le.absolutePath
689
783
  )) })
690
784
  ] }, e.absolutePath);
691
785
  },
692
- (e, r) => {
693
- if (e.entry !== r.entry) return !1;
694
- const a = e.entry.children !== void 0, n = r.entry.children !== void 0, o = a && e.isDirOpen(e.entry.absolutePath), l = n && r.isDirOpen(r.entry.absolutePath);
695
- return e.indentLevel === r.indentLevel && e.rowHeight === r.rowHeight && o === l && 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((s, m) => s === r.parentIsLast[m]);
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]);
696
790
  }
697
791
  );
698
- _e.displayName = "DirectoryEntryItem";
699
- const Ee = 20, ye = 16, He = 12, We = (e) => {
700
- const r = [];
792
+ Fe.displayName = "DirectoryEntryItem";
793
+ const _t = (e) => {
794
+ const t = [];
701
795
  if (e.children)
702
- for (const a of e.children)
703
- a.type === "directory" && (r.push(a.absolutePath), r.push(...We(a)));
704
- return r;
705
- }, Ct = ({
796
+ for (const o of e.children)
797
+ o.type === "directory" && (t.push(o.absolutePath), t.push(..._t(o)));
798
+ return t;
799
+ }, vr = ({
706
800
  entries: e,
707
- expansion: { toggle: r, isExpanded: a, expandMultiple: n, collapseMultiple: o, isPending: l, alwaysExpanded: s = !1, doubleClickAction: m = "recursive" },
708
- selection: { onEntryClick: R, selectedPath: w, mode: c = "none", selectedItems: h, onSelectionChange: y },
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 },
709
803
  visual: {
710
- className: E,
804
+ className: w,
711
805
  style: I,
712
- lineColor: i = "#A0AEC0",
713
- showTreeLines: u = !0,
714
- showExpandIcons: p = !0,
715
- showDirectoryIcons: j = !0,
716
- showFileIcons: v = !0,
717
- iconOverrides: g,
718
- expandIconSize: d,
719
- itemHeight: P = Ee,
720
- removeRootIndent: T = !1,
721
- highlightStyles: A,
722
- entryClassName: X,
723
- entryStyle: U,
724
- nameClassName: q,
725
- nameStyle: $,
726
- directoryNameClassName: V,
727
- directoryNameStyle: Z,
728
- fileNameClassName: G,
729
- fileNameStyle: se
806
+ lineColor: c = "#A0AEC0",
807
+ showTreeLines: d = !0,
808
+ showExpandIcons: b = !0,
809
+ showDirectoryIcons: O = !0,
810
+ showFileIcons: x = !0,
811
+ iconOverrides: S,
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,
822
+ fileNameClassName: J,
823
+ fileNameStyle: C
730
824
  } = {},
731
- virtualScroll: S
825
+ virtualScroll: U,
826
+ grid: N
732
827
  }) => {
733
- const [D, L] = ie(!1), O = fe(null), t = fe(null), [f, x] = ie(0), [k, te] = ie(null), {
734
- overscanCount: Q = 15,
735
- className: _,
736
- background: J,
737
- onScroll: re,
738
- onRangeChange: ce,
739
- initialScrollIndex: Ie,
740
- initialScrollOffset: B,
741
- callbackThrottleMs: ue = 5,
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,
742
837
  contentInsets: Xe,
743
- onItemFocus: Ve,
744
- viewportHeightOverride: z,
745
- scrollBarOptions: Ge,
746
- behaviorOptions: Je
747
- } = S ?? {}, [pe, Ne] = ie(typeof B == "number" ? B : 0), ze = C(
748
- (b, F) => {
749
- Ne(b), re?.(b, F);
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);
750
845
  },
751
- [re]
752
- ), Ue = C(
753
- (b) => {
754
- const { renderingStartIndex: F, renderingEndIndex: H } = b;
755
- te((M) => M && M.renderStart === F && M.renderEnd === H ? M : { renderStart: F, renderEnd: H }), ce?.(b);
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);
756
851
  },
757
- [ce]
852
+ [Ue]
758
853
  );
759
- oe(() => {
760
- typeof B == "number" && Ne(B);
761
- }, [B]), oe(() => {
762
- L(!0), gt();
763
- }, []), oe(() => {
764
- if (typeof z == "number") {
765
- x((M) => Math.abs(M - z) > 1 ? z : M);
766
- return;
767
- }
768
- const b = O.current;
769
- if (!b) return x(0);
770
- (() => {
771
- const M = b.clientHeight;
772
- x((le) => Math.abs(le - M) > 1 ? M : le);
773
- })();
774
- const H = new ResizeObserver((M) => {
775
- for (const le of M)
776
- le.target === b && x((we) => Math.abs(we - le.contentRect.height) > 1 ? le.contentRect.height : we);
777
- });
778
- return H.observe(b), () => H.disconnect();
779
- }, [z]);
780
- const ae = typeof z == "number" ? z : f, de = C((b) => s || (D ? a(b) : !1), [D, a, s]), Te = Y(W.container, l && W.containerPending, E), Pe = ee(
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(
781
877
  () => ({
782
- ...vt,
878
+ ...lr,
783
879
  ...I ?? {},
784
- ...typeof z == "number" ? { height: z, minHeight: z } : {}
880
+ ...typeof te == "number" ? { height: te, minHeight: te } : {}
785
881
  }),
786
- [I, z]
787
- ), qe = C(
788
- (b, F) => {
789
- const H = [b.absolutePath, ...We(b)], M = F || m;
790
- if (H.every((ke) => de(ke))) return o(H);
791
- if (H.every((ke) => !de(ke)) || M === "recursive") return n(H);
792
- if (M === "toggle") return o(H);
793
- console.warn(`[DirectoryTree] Unknown double click action: ${M}. 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.`);
794
890
  },
795
- [de, n, o, m]
796
- ), { flatItems: Ce, lineItems: Se, maxIndent: je } = ee(() => xt(e, de, u, T), [e, de, u, T]), K = ee(
797
- () => Ce.map((b, F) => {
798
- const H = typeof P == "function" ? P(b.entry, F) : P;
799
- return { ...b, rowHeight: Number.isFinite(H) && H > 0 ? H : Ee };
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 };
800
896
  }),
801
- [Ce, P]
802
- ), ne = ee(() => K.map((b) => b.rowHeight), [K]), be = ee(() => {
803
- const b = new Array(ne.length + 1);
804
- b[0] = 0;
805
- for (let F = 0; F < ne.length; F++)
806
- b[F + 1] = b[F] + ne[F];
807
- return b;
808
- }, [ne]), Ze = C((b) => K[b]?.rowHeight ?? Ee, [K]), ve = ee(
809
- () => !u || Se.length === 0 ? { segmentsByItem: [], glyphsByItem: [] } : wt(Se, ne, be, ye, u, d ?? He),
810
- [Se, ne, be, u, d]
811
- ), ge = ee(() => !u || e.length === 0 ? 0 : (je + 2) * ye, [e.length, je, u]), { renderStart: Ae, renderEnd: Oe, lookaheadEnd: Me } = ee(
812
- () => Et(K.length, ae, Q, k, pe, be),
813
- [K.length, ae, Q, k, pe, be]
814
- ), Qe = ee(() => !u || ge <= 0 || ae <= 0 || ve.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: ge, height: ae }, children: /* @__PURE__ */ N.jsx(
815
- Be,
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,
816
912
  {
817
- segmentsByItem: ve.segmentsByItem,
818
- glyphsByItem: ve.glyphsByItem,
819
- itemHeight: ne[0] ?? Ee,
820
- width: ge,
821
- viewportHeight: ae,
822
- scrollPosition: pe,
823
- color: i,
824
- expandGlyphColor: i,
825
- expandGlyphSize: d ?? He,
826
- renderStartIndex: Ae,
827
- renderEndIndex: Oe,
828
- lookaheadEndIndex: Me
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
829
925
  }
830
- ) }) }), [ge, ae, Ae, Oe, Me, pe, ve, i, u, d, ne]), Ke = C((b) => K[b], [K]);
831
- return e.length === 0 ? /* @__PURE__ */ N.jsx("div", { className: Te, style: Pe }) : /* @__PURE__ */ N.jsx("div", { ref: O, className: Te, style: Pe, role: "tree", children: /* @__PURE__ */ N.jsx(
832
- nt,
833
- {
834
- ref: t,
835
- itemCount: K.length,
836
- getItem: Ke,
837
- getItemHeight: Ze,
838
- viewportSize: ae,
839
- overscanCount: Q,
840
- onScroll: ze,
841
- onRangeChange: Ue,
842
- className: _,
843
- background: /* @__PURE__ */ N.jsxs(N.Fragment, { children: [
844
- Qe,
845
- J
846
- ] }),
847
- initialScrollIndex: Ie,
848
- initialScrollOffset: B,
849
- onItemFocus: Ve,
850
- callbackThrottleMs: ue,
851
- contentInsets: Xe,
852
- scrollBarOptions: Ge,
853
- behaviorOptions: Je,
854
- children: (b) => b && /* @__PURE__ */ N.jsx(
855
- _e,
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,
856
1070
  {
857
- entry: b.entry,
858
- indentLevel: b.indentLevel,
859
- rowHeight: b.rowHeight,
860
- isDirOpen: de,
861
- parentIsLast: b.parentIsLast,
862
- renderChildren: !1,
863
- expansion: { toggleDirectory: r, onToggleDirectoryRecursive: qe },
864
- selection: { onEntryClick: R, selectedPath: w ?? null, mode: c, selectedItems: h, onSelectionChange: y },
865
- visual: {
866
- iconOverrides: g,
867
- showExpandIcons: p,
868
- showDirectoryIcons: j,
869
- showFileIcons: v,
870
- useCanvasExpandIcons: u,
871
- expandIconSize: d,
872
- highlightStyles: A,
873
- entryClassName: X,
874
- entryStyle: U,
875
- nameClassName: q,
876
- nameStyle: $,
877
- directoryNameClassName: V,
878
- directoryNameStyle: Z,
879
- fileNameClassName: G,
880
- fileNameStyle: se
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;
881
1079
  }
882
- },
883
- b.entry.absolutePath
884
- )
885
- }
886
- ) });
887
- }, jt = ({ initialExpanded: e = /* @__PURE__ */ new Set(), storageKey: r } = {}) => {
888
- const [a, n] = rt(), [o, l] = ie(() => {
889
- 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)
890
1089
  try {
891
- const i = window.localStorage.getItem(r);
892
- if (i) {
893
- const u = JSON.parse(i);
894
- return new Set(u);
1090
+ const c = window.localStorage.getItem(t);
1091
+ if (c) {
1092
+ const d = JSON.parse(c);
1093
+ return new Set(d);
895
1094
  }
896
- } catch (i) {
897
- console.error("[useDirectoryTreeState] Error reading from localStorage", i);
1095
+ } catch (c) {
1096
+ console.error("[useDirectoryTreeState] Error reading from localStorage", c);
898
1097
  }
899
1098
  return e;
900
- }), s = C((i) => {
1099
+ }), a = F((c) => {
901
1100
  n(() => {
902
- l((u) => {
903
- const p = new Set(u);
904
- return i(p), p;
1101
+ l((d) => {
1102
+ const b = new Set(d);
1103
+ return c(b), b;
905
1104
  });
906
1105
  });
907
- }, []), m = C(
908
- (i, u) => {
909
- s((p) => {
910
- for (const j of i)
911
- u(p, j);
1106
+ }, []), m = F(
1107
+ (c, d) => {
1108
+ a((b) => {
1109
+ for (const O of c)
1110
+ d(b, O);
912
1111
  });
913
1112
  },
914
- [s]
1113
+ [a]
915
1114
  );
916
- oe(() => {
917
- if (r && typeof window < "u")
1115
+ ae(() => {
1116
+ if (t && typeof window < "u")
918
1117
  try {
919
- window.localStorage.setItem(r, JSON.stringify(Array.from(o)));
920
- } catch (i) {
921
- console.warn(`Error setting localStorage key "${r}":`, i);
1118
+ window.localStorage.setItem(t, JSON.stringify(Array.from(s)));
1119
+ } catch (c) {
1120
+ console.warn(`Error setting localStorage key "${t}":`, c);
922
1121
  }
923
- }, [o, r]);
924
- const R = C(
925
- (i) => {
926
- m([i], (u, p) => {
927
- u.has(p) ? u.delete(p) : u.add(p);
1122
+ }, [s, t]);
1123
+ const E = F(
1124
+ (c) => {
1125
+ m([c], (d, b) => {
1126
+ d.has(b) ? d.delete(b) : d.add(b);
928
1127
  });
929
1128
  },
930
1129
  [m]
931
- ), w = C(
932
- (i) => {
933
- m([i], (u, p) => {
934
- u.add(p);
1130
+ ), v = F(
1131
+ (c) => {
1132
+ m([c], (d, b) => {
1133
+ d.add(b);
935
1134
  });
936
1135
  },
937
1136
  [m]
938
- ), c = C(
939
- (i) => {
940
- m([i], (u, p) => {
941
- u.delete(p);
1137
+ ), i = F(
1138
+ (c) => {
1139
+ m([c], (d, b) => {
1140
+ d.delete(b);
942
1141
  });
943
1142
  },
944
1143
  [m]
945
- ), h = C(
946
- (i) => {
947
- m(i, (u, p) => {
948
- u.delete(p);
1144
+ ), f = F(
1145
+ (c) => {
1146
+ m(c, (d, b) => {
1147
+ d.delete(b);
949
1148
  });
950
1149
  },
951
1150
  [m]
952
- ), y = C(
953
- (i) => {
954
- m(i, (u, p) => {
955
- u.add(p);
1151
+ ), g = F(
1152
+ (c) => {
1153
+ m(c, (d, b) => {
1154
+ d.add(b);
956
1155
  });
957
1156
  },
958
1157
  [m]
959
- ), E = C(() => {
960
- s((i) => {
961
- i.clear();
1158
+ ), w = F(() => {
1159
+ a((c) => {
1160
+ c.clear();
962
1161
  });
963
- }, [s]), I = C((i) => o.has(i), [o]);
1162
+ }, [a]), I = F((c) => s.has(c), [s]);
964
1163
  return {
965
- expanded: o,
966
- toggle: R,
967
- expand: w,
968
- collapse: c,
969
- collapseMultiple: h,
970
- expandMultiple: y,
971
- collapseAll: E,
1164
+ expanded: s,
1165
+ toggle: E,
1166
+ expand: v,
1167
+ collapse: i,
1168
+ collapseMultiple: f,
1169
+ expandMultiple: g,
1170
+ collapseAll: w,
972
1171
  isExpanded: I,
973
- isPending: a
1172
+ isPending: o
974
1173
  };
975
1174
  };
976
1175
  export {
977
- Ct as DirectoryTree,
978
- W as directoryTreeClasses,
979
- jt as useDirectoryTreeState
1176
+ vr as DirectoryTree,
1177
+ A as directoryTreeClasses,
1178
+ br as useDirectoryTreeState
980
1179
  };