@aiquants/directory-tree 5.0.1 โ†’ 6.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/README.md CHANGED
@@ -7,7 +7,7 @@ A high-performance React directory tree component with virtualization, file sele
7
7
  - **๐Ÿš€ High Performance**: Built with [@aiquants/virtualscroll](../virtualscroll) to handle large directory structures efficiently with O(log n) operations
8
8
  - **๐ŸŒ€ Ultrafast Scrolling**: Inherits adaptive tap scroll circle from VirtualScroll for navigating massive datasets
9
9
  - **๐Ÿ“ File Selection**: Interactive file selection with visual feedback and multiple selection modes
10
- - **๐ŸŽจ Theming**: Customizable line colors with external theme control support
10
+ - **๐ŸŽจ Colour schemes**: Every built-in colour follows the host's `color-scheme` through CSS `light-dark()`, at WCAG 2.2 AAA contrast in both schemes, with no `.dark` class to wire up. See [Colours and color-scheme](#colours-and-color-scheme)
11
11
  - **โ™ฟ Accessibility**: Full keyboard navigation and screen reader support
12
12
  - **๐Ÿ“ฑ Responsive**: Optimized for both desktop and mobile interfaces
13
13
  - **๐Ÿ”ง TypeScript**: Complete TypeScript support with comprehensive type definitions
@@ -18,10 +18,6 @@ A high-performance React directory tree component with virtualization, file sele
18
18
  ## Installation
19
19
 
20
20
  ```bash
21
- npm install @aiquants/directory-tree
22
- # or
23
- yarn add @aiquants/directory-tree
24
- # or
25
21
  pnpm add @aiquants/directory-tree
26
22
  ```
27
23
 
@@ -30,7 +26,7 @@ pnpm add @aiquants/directory-tree
30
26
  This package requires the following peer dependencies:
31
27
 
32
28
  ```bash
33
- npm install react react-dom @aiquants/virtualscroll
29
+ pnpm add react react-dom @aiquants/virtualscroll
34
30
  ```
35
31
 
36
32
  `@aiquants/virtualscroll` must be 3.22.0 or later: it supplies the `locale` / `labels` chrome catalog, the pill-aware `scrollToIndex(index, { align: "nearest" })` that reveals focused rows, and the edge pills that hide while the pane rests at their edge (so the first and last rows are never left under a pill).
@@ -40,7 +36,6 @@ npm install react react-dom @aiquants/virtualscroll
40
36
  ```tsx
41
37
  import React from 'react';
42
38
  import { DirectoryTree, useDirectoryTreeState } from '@aiquants/directory-tree';
43
- import { useTheme } from './hooks/useTheme'; // Your theme hook
44
39
  import type { DirectoryEntry, DirectoryTreeClickEvent } from '@aiquants/directory-tree';
45
40
 
46
41
  const sampleData: DirectoryEntry[] = [
@@ -69,7 +64,6 @@ const sampleData: DirectoryEntry[] = [
69
64
  ];
70
65
 
71
66
  export default function App() {
72
- const { theme } = useTheme();
73
67
  const {
74
68
  toggle,
75
69
  isExpanded,
@@ -80,9 +74,6 @@ export default function App() {
80
74
  storageKey: 'my-directory-tree'
81
75
  });
82
76
 
83
- // Calculate line color based on theme
84
- const lineColor = theme === "dark" ? "#4A5568" : "#A0AEC0";
85
-
86
77
  const handleEntryClick = (event: DirectoryTreeClickEvent) => {
87
78
  console.log(`Entry clicked: ${event.entry.absolutePath}`);
88
79
  };
@@ -103,7 +94,6 @@ export default function App() {
103
94
  selectedPath: null
104
95
  }}
105
96
  visual={{
106
- lineColor,
107
97
  className: "h-full"
108
98
  }}
109
99
  />
@@ -139,7 +129,7 @@ The main component for rendering the directory tree.
139
129
  | `isExpanded` | `(path: string) => boolean` | Yes | - | Function to check if a directory is expanded |
140
130
  | `expandMultiple` | `(paths: string[]) => void` | Yes | - | Function to expand multiple directories |
141
131
  | `collapseMultiple` | `(paths: string[]) => void` | Yes | - | Function to collapse multiple directories |
142
- | `isPending` | `boolean` | No | `false` | Whether the tree is in a pending state |
132
+ | `isPending` | `boolean` | No | `false` | Whether a transition the host started is pending (`useDirectoryTreeState`'s `isPending`). While it is, the tree marks itself busy (`aria-busy` on the element with the tree's role) and shows the progress cursor; nothing is dimmed, and the rows stay operable |
143
133
  | `alwaysExpanded` | `boolean` | No | `false` | If true, all directories are always expanded |
144
134
  | `doubleClickAction` | `'recursive' \| 'toggle'` | No | `'recursive'` | Action on double-clicking a directory |
145
135
 
@@ -160,7 +150,7 @@ The main component for rendering the directory tree.
160
150
  | --- | --- | --- | --- | --- |
161
151
  | `className` | `string` | No | - | Optional CSS class name for the container |
162
152
  | `style` | `React.CSSProperties` | No | - | Optional inline styles for the container |
163
- | `lineColor` | `string` | No | `'#A0AEC0'` | The color of the tree lines |
153
+ | `lineColor` | `string` | No | `'#71829b'` (`DEFAULT_LINE_COLOR`) | The colour of the connector lines and the expand glyphs drawn with them, on a canvas above the rows: any colour a canvas reads, one value for both schemes (a canvas cannot resolve `light-dark()`). The default keeps 3.5:1 or more on every ground a row can show in both schemes. See [Colours and color-scheme](#colours-and-color-scheme) |
164
154
  | `showTreeLines` | `boolean` | No | `true` | Flag indicating whether to render tree connector lines |
165
155
  | `showExpandIcons` | `boolean` | No | `true` | Flag indicating whether to render directory expand icons |
166
156
  | `showDirectoryIcons` | `boolean` | No | `true` | Flag indicating whether to render directory type icons |
@@ -181,8 +171,8 @@ The main component for rendering the directory tree.
181
171
  | `directoryNameStyle` | `React.CSSProperties` | No | - | Additional inline styles specifically for directory names |
182
172
  | `fileNameClassName` | `string` | No | - | Additional CSS classes specifically for file names |
183
173
  | `fileNameStyle` | `React.CSSProperties` | No | - | Additional inline styles specifically for file names |
184
- | `expandIconClassName` | `string` | No | - | Additional CSS classes for the expand glyph (the chevron drawn in the row when `showTreeLines` is `false`), merged like `nameClassName`: the selected-row colour class still follows it, and a colour class replaces only the light default, so the built-in `dark:text-gray-400` stays unless the class carries a `dark:` colour too. Not checked: keep box utilities out of it |
185
- | `expandIconStyle` | `DirectoryTreeExpandIconStyle` | No | - | Inline styles for the expand glyph, applied like `nameStyle` (they win over every class, the selected-row colour included): `color` and `opacity` only (`EXPAND_ICON_STYLE_PROPERTIES`); any other property throws a `RangeError` at render, because the 14 px expand box is the tree's. The glyph is drawn in `currentColor`, so `{ color: "var(--your-token)" }` follows your colour tokens independently of the `dark` class. The canvas glyph drawn with the tree lines takes `lineColor`. See [Row and expand-icon styles](#row-and-expand-icon-styles) |
174
+ | `expandIconClassName` | `string` | No | - | Additional CSS classes for the expand glyph (the chevron drawn in the row when `showTreeLines` is `false`), merged like `nameClassName`: the selected-row colour class still follows it. The default colour is one `light-dark()` class with no `dark:` variant, so a colour class replaces it in both schemes; a class whose colour has to differ by scheme carries its own `light-dark()` value or a variable. Not checked: keep box utilities out of it |
175
+ | `expandIconStyle` | `DirectoryTreeExpandIconStyle` | No | - | Inline styles for the expand glyph, applied like `nameStyle` (they win over every class, the selected-row colour included): `color` and `opacity` only (`EXPAND_ICON_STYLE_PROPERTIES`); any other property throws a `RangeError` at render, because the 14 px expand box is the tree's. The glyph is drawn in `currentColor`, so `{ color: "var(--your-token)" }` follows your colour tokens. The canvas glyph drawn with the tree lines takes `lineColor`. See [Row and expand-icon styles](#row-and-expand-icon-styles) |
186
176
 
187
177
  ### Virtual Scroll Options
188
178
 
@@ -211,9 +201,10 @@ These are **not** accepted, because the tree owns them:
211
201
  - `behaviorOptions.enableKeyboardNavigation` and `behaviorOptions.enableEscapeRowReturn`: the tree's rows own the
212
202
  keyboard (see [Keyboard and focus](#keyboard-and-focus)); the tree always turns the engine's row navigation off,
213
203
  because its row wrappers would otherwise be focusable elements between `role="tree"` and the treeitems.
214
- - `contentProps.role`, `contentProps["aria-label"]`, `contentProps["aria-labelledby"]` and
215
- `contentProps["aria-multiselectable"]`: the tree's name comes from `visual.ariaLabel` / `visual.ariaLabelledBy`
216
- and its multiselection from `selection.mode`.
204
+ - `contentProps.role`, `contentProps["aria-label"]`, `contentProps["aria-labelledby"]`,
205
+ `contentProps["aria-multiselectable"]` and `contentProps["aria-busy"]`: the tree's name comes from
206
+ `visual.ariaLabel` / `visual.ariaLabelledBy`, its multiselection from `selection.mode` and its busy state from
207
+ `expansion.isPending`.
217
208
 
218
209
  Writing one of them in an object literal typed as `DirectoryTreeVirtualScrollOptions` is a type error. A value that
219
210
  reaches the tree any other way (a variable of a wider type, an object built by a generic helper or a spread, a
@@ -277,7 +268,7 @@ The classic tree follows the WAI-ARIA tree pattern with a roving tabindex: it al
277
268
  appears in the render that follows the one where the Tab stop row left the render window (the tree measures that
278
269
  in its own layout effect), so look it up after that commit, not in a layout effect of the same commit.
279
270
 
280
- The element that carries `role="tree"` (with the tree's name and `aria-multiselectable`) is the scroll pane's
271
+ The element that carries `role="tree"` (with the tree's name, `aria-multiselectable` and `aria-busy`) is the scroll pane's
281
272
  content element, which owns only the rows: the scrollbar, the Top/Bottom buttons and the live region
282
273
  (`virtualScroll.liveRegion`) stay outside the tree, and the wrappers between the tree and its rows carry no role,
283
274
  tabindex or ARIA attribute. The root container has no role; target it through `visual.className`.
@@ -364,7 +355,7 @@ type DirectoryEntry = {
364
355
 
365
356
  ## Styling
366
357
 
367
- The component's hand-written classes ship in **two CSS artifacts**; choose by host type. The tree is built on `@aiquants/virtualscroll`, so that package's stylesheet is a **peer CSS dependency** โ€” import it once alongside directory-tree. Theme control (light/dark) stays with the calling app.
358
+ The component's hand-written classes ship in **two CSS artifacts**; choose by host type. The tree is built on `@aiquants/virtualscroll`, so that package's stylesheet is a **peer CSS dependency** โ€” import it once alongside directory-tree. The colours follow the `color-scheme` the host sets (see [Colours and color-scheme](#colours-and-color-scheme)).
368
359
 
369
360
  - **Tailwind v4 host** โ€” import the components-only build in `layer(components)`, do the same for the virtualscroll peer build, and let your Tailwind build generate the JSX utilities from the package source:
370
361
 
@@ -384,30 +375,54 @@ The component's hand-written classes ship in **two CSS artifacts**; choose by ho
384
375
  @import "@aiquants/directory-tree/styles/directory-tree.standalone.css";
385
376
  ```
386
377
 
387
- Dark styles key off the `.dark` class on `<html>`.
378
+ Neither build reads a `.dark` class: the colours follow the host's `color-scheme`.
388
379
 
389
- ### Theme Control
380
+ ### Colours and color-scheme
390
381
 
391
- The `lineColor` prop allows you to control the tree line color based on your application's theme:
382
+ Every colour the tree paints by default is one role of its palette: a light-scheme value and a dark-scheme value
383
+ written as CSS `light-dark()`. The tree therefore follows the `color-scheme` the host puts on the root or on an
384
+ ancestor of the tree, and reads neither a `.dark` class nor `prefers-color-scheme`. `light-dark()` needs Chrome / Edge
385
+ 123, Firefox 120 or Safari 17.5.
392
386
 
393
- ```tsx
394
- import { useTheme } from './hooks/useTheme';
387
+ ```css
388
+ /* follow the OS */
389
+ :root { color-scheme: light dark; }
395
390
 
396
- function MyComponent() {
397
- const { theme } = useTheme();
391
+ /* or follow your own switch, for example a .dark class on <html> */
392
+ :root { color-scheme: light; }
393
+ :root.dark { color-scheme: dark; }
394
+ ```
398
395
 
399
- // Calculate line color based on theme
400
- const lineColor = theme === "dark" ? "#4A5568" : "#A0AEC0";
396
+ | Role | Light scheme | Dark scheme | Contrast in both schemes |
397
+ | --- | --- | --- | --- |
398
+ | Name | gray-700 `#364153` | gray-200 `#e5e7eb` | Text: 7:1 or more |
399
+ | Name on a selected row | blue-800 `#193cb8` | blue-200 `#bedbff` | Text: 7:1 or more |
400
+ | Text of a grid's header and footer rows | gray-600 `#4a5565` | gray-300 `#d1d5dc` | Text: 7:1 or more on the host surfaces (those rows are never hovered nor selected) |
401
+ | Chevron and type icons | gray-500 `#6a7282` | gray-400 `#99a1af` | Non-text: 3:1 or more |
402
+ | Chevron and type icons on a selected row | blue-700 `#1447e6` | blue-400 `#51a2ff` | Non-text: 3:1 or more |
403
+ | Inset ring of a file checked in the selection | blue-600 `#155dfc` | blue-400 `#51a2ff` | Non-text: 3:1 or more |
404
+ | Built-in file icons | the 600 step of the kind's hue (archives: amber-700, whose 600 step falls below 3:1 on the hovered row; plain text: the icon colour) | the 400 step (plain text: the icon colour) | Non-text: 3:1 or more |
405
+ | Connector lines and the glyphs drawn with them (`lineColor`) | `#71829b` | `#71829b` | Non-text: 3.5:1 or more |
406
+ | Hovered row | gray-100 `#f3f4f6` | gray-800 `#1e2939` | Ground |
407
+ | Selected row | blue-50 `#eff6ff` | blue-950 `#162456` | Ground |
408
+
409
+ The ratios hold on every ground a row can show: the host surfaces the defaults are checked on (white and gray-50 in the
410
+ light scheme, gray-950 and gray-900 in the dark one) and the tree's own hovered and selected rows. The tree paints no
411
+ surface of its own, so a host on another surface checks the defaults against it or passes its own colours. Nothing is
412
+ translucent: the hovered and the selected rows are opaque, and a pending transition marks the tree busy (`aria-busy`)
413
+ and shows the progress cursor instead of dimming it.
414
+
415
+ The tree draws its connector lines, and the expand glyphs that go with them, on a canvas above the rows, so a row's
416
+ background never hides whether a directory is open; the canvas lets every press through to the rows. A canvas cannot
417
+ resolve `light-dark()`, so `lineColor` is one colour for both schemes: the default keeps 3.5:1 or more on every ground
418
+ above (3.55:1 at its lowest in the light scheme and 3.75:1 in the dark one, both on the hovered row). A host whose line
419
+ colour has to follow its scheme passes the colour of the current scheme and changes it with the scheme:
401
420
 
402
- return (
403
- <DirectoryTree
404
- // ... other props
405
- visual={{
406
- lineColor: lineColor
407
- }}
408
- />
409
- );
410
- }
421
+ ```tsx
422
+ <DirectoryTree
423
+ // ... other props
424
+ visual={{ lineColor: scheme === "dark" ? appColours.dark.treeLine : appColours.light.treeLine }}
425
+ />
411
426
  ```
412
427
 
413
428
  ### Custom Styling
@@ -421,23 +436,26 @@ You can customize the appearance by passing custom classes or inline styles for
421
436
  style: { height: '400px' },
422
437
 
423
438
  // Style the entry rows: paint and text only (the row's box is the tree's)
424
- entryClassName: "rounded-md hover:bg-slate-100/50",
439
+ entryClassName: "rounded-md",
425
440
  entryStyle: { letterSpacing: "0.01em", textUnderlineOffset: "2px" },
426
441
 
427
442
  // Style the label text
428
443
  nameClassName: "text-sm font-medium",
429
444
 
430
- // Target directory or file names specifically
431
- directoryNameClassName: "text-slate-800 dark:text-slate-100",
432
- fileNameClassName: "text-slate-600 dark:text-slate-300",
445
+ // Target directory or file names specifically: one light-dark() pair per colour (slate-800 / slate-100 and
446
+ // slate-700 / slate-300 keep 7:1 on the default grounds in both schemes)
447
+ directoryNameClassName: "text-[color:light-dark(#1d293d,#f1f5f9)]",
448
+ fileNameClassName: "text-[color:light-dark(#314158,#cad5e2)]",
433
449
  }}
434
450
  // ... other props
435
451
  />
436
452
  ```
437
453
 
438
454
  The expand glyph drawn in the row (when `showTreeLines` is `false`) takes `expandIconClassName` /
439
- `expandIconStyle` the same way. To make its colour follow your own theme rather than the `dark` class, pass a colour
440
- token through `expandIconStyle`: an inline style wins over every class, the built-in `dark:` colour included.
455
+ `expandIconStyle` the same way. Its default colour is one `light-dark()` class, so a colour class in
456
+ `expandIconClassName` replaces it in both schemes; give a class whose colour has to differ by scheme its own
457
+ `light-dark()` value or a variable, for example `"text-(--app-tree-glyph)"`. A colour token passed through
458
+ `expandIconStyle` wins over every class, the selected-row colour included:
441
459
 
442
460
  ```tsx
443
461
  <DirectoryTree
@@ -446,11 +464,6 @@ token through `expandIconStyle`: an inline style wins over every class, the buil
446
464
  />
447
465
  ```
448
466
 
449
- `expandIconClassName` is merged into the built-in classes like `nameClassName`, so a colour class on its own replaces
450
- only the light default (`text-gray-500`): the built-in `dark:text-gray-400` stays and wins under your `dark` class.
451
- To set the colour with a class, give its `dark:` variant as well, for example
452
- `"text-(--app-tree-glyph) dark:text-(--app-tree-glyph)"`.
453
-
454
467
  Alternatively, you can customize components inside the container using global CSS classes:
455
468
 
456
469
  ```css
@@ -459,23 +472,23 @@ Alternatively, you can customize components inside the container using global CS
459
472
  }
460
473
  ```
461
474
 
462
- Alternatively, you can dynamically configure specific highlight styles for hover, directory selection, and item (file) selection by passing custom class names or inline styles via `highlightStyles`:
475
+ Alternatively, you can dynamically configure specific highlight styles for hover, directory selection, and item (file) selection by passing custom class names or inline styles via `highlightStyles`. Keep the backgrounds opaque: a translucent one mixes with whatever lies behind the row, so the contrast of the row's text and icons is no longer the one you checked. The colours below keep every default text of the row at 7:1 and every mark at 3:1 in both schemes:
463
476
 
464
477
  ```tsx
465
478
  <DirectoryTree
466
479
  visual={{
467
480
  highlightStyles: {
468
- // Custom hover style
469
- hoverClassName: "bg-amber-100 dark:bg-amber-900/20",
470
- hoverStyle: { boxShadow: "inset -2px 0 0 orange" },
471
-
472
- // Custom directory selection style
473
- directorySelectedClassName: "bg-emerald-100 dark:bg-emerald-900/20 font-bold",
474
- directorySelectedStyle: { boxShadow: "inset 3px 0 0 green" },
475
-
476
- // Custom item (file) selection style
477
- itemSelectedClassName: "bg-indigo-100 dark:bg-indigo-900/20 text-indigo-800",
478
- itemSelectedStyle: { boxShadow: "inset 3px 0 0 indigo" },
481
+ // Custom hover style (amber-50 / amber-950, edge amber-700 / amber-400)
482
+ hoverClassName: "bg-[color:light-dark(#fffbeb,#461901)]",
483
+ hoverStyle: { boxShadow: "inset -2px 0 0 light-dark(#bb4d00, #ffb900)" },
484
+
485
+ // Custom directory selection style (emerald-50 / emerald-950, edge emerald-700 / emerald-400)
486
+ directorySelectedClassName: "bg-[color:light-dark(#ecfdf5,#002c22)] font-bold",
487
+ directorySelectedStyle: { boxShadow: "inset 3px 0 0 light-dark(#007a55, #00d492)" },
488
+
489
+ // Custom item (file) selection style (indigo-50 / indigo-950, text indigo-800 / indigo-200, edge indigo-700 / indigo-300)
490
+ itemSelectedClassName: "bg-[color:light-dark(#eef2ff,#1e1a4d)] text-[color:light-dark(#372aac,#c6d2ff)]",
491
+ itemSelectedStyle: { boxShadow: "inset 3px 0 0 light-dark(#432dd7, #a3b3ff)" },
479
492
  }
480
493
  }}
481
494
  // ... other props
package/dist/cli.js CHANGED
@@ -98,10 +98,10 @@ class s {
98
98
  this.level <= 3 && this.impl.error(...this.formatMessage(t), ...e);
99
99
  }
100
100
  }
101
- const l = f(import.meta.url), p = a.dirname(l), r = new s(o.INFO, "[directory-tree]"), n = process.argv.slice(2);
101
+ const l = f(import.meta.url), h = a.dirname(l), r = new s(o.INFO, "[directory-tree]"), n = process.argv.slice(2);
102
102
  if (n[0] === "demo") {
103
103
  r.info("Starting demo server...");
104
- const i = a.join(p, "..", "demo"), t = m("pnpm", ["run", "dev"], {
104
+ const i = a.join(h, "..", "demo"), t = m("pnpm", ["run", "dev"], {
105
105
  cwd: i,
106
106
  stdio: "inherit",
107
107
  shell: process.platform === "win32"
@@ -112,4 +112,4 @@ if (n[0] === "demo") {
112
112
  r.error("Failed to start demo server:", e);
113
113
  });
114
114
  } else
115
- r.info(`Unknown command: ${n[0]}`), r.info("Usage: npx @aiquants/directory-tree demo"), process.exit(1);
115
+ r.info(`Unknown command: ${n[0]}`), r.info("Usage: node dist/cli.js demo"), process.exit(1);
package/dist/index.cjs CHANGED
@@ -1,6 +1,6 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const l=require("react"),me=require("@aiquants/virtualscroll"),A=require("tailwind-merge"),le=require("@phosphor-icons/react");function cn(e){const t=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e){for(const r in e)if(r!=="default"){const n=Object.getOwnPropertyDescriptor(e,r);Object.defineProperty(t,r,n.get?n:{enumerable:!0,get:()=>e[r]})}}return t.default=e,Object.freeze(t)}const ce=cn(l);var ut={exports:{}},Ke={};var Sr;function un(){if(Sr)return Ke;Sr=1;var e=Symbol.for("react.transitional.element"),t=Symbol.for("react.fragment");function r(n,o,c){var i=null;if(c!==void 0&&(i=""+c),o.key!==void 0&&(i=""+o.key),"key"in o){c={};for(var d in o)d!=="key"&&(c[d]=o[d])}else c=o;return o=c.ref,{$$typeof:e,type:n,key:i,ref:o!==void 0?o:null,props:c}}return Ke.Fragment=t,Ke.jsx=r,Ke.jsxs=r,Ke}var Ue={};var vr;function dn(){return vr||(vr=1,process.env.NODE_ENV!=="production"&&(function(){function e(s){if(s==null)return null;if(typeof s=="function")return s.$$typeof===z?null:s.displayName||s.name||null;if(typeof s=="string")return s;switch(s){case y:return"Fragment";case $:return"Profiler";case v:return"StrictMode";case D:return"Suspense";case F:return"SuspenseList";case K:return"Activity"}if(typeof s=="object")switch(typeof s.tag=="number"&&console.error("Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."),s.$$typeof){case p:return"Portal";case P:return s.displayName||"Context";case N:return(s._context.displayName||"Context")+".Consumer";case g:var f=s.render;return s=s.displayName,s||(s=f.displayName||f.name||"",s=s!==""?"ForwardRef("+s+")":"ForwardRef"),s;case O:return f=s.displayName||null,f!==null?f:e(s.type)||"Memo";case q:f=s._payload,s=s._init;try{return e(s(f))}catch{}}return null}function t(s){return""+s}function r(s){try{t(s);var f=!1}catch{f=!0}if(f){f=console;var T=f.error,R=typeof Symbol=="function"&&Symbol.toStringTag&&s[Symbol.toStringTag]||s.constructor.name||"Object";return T.call(f,"The provided key is an unsupported type %s. This value must be coerced to a string before using it here.",R),t(s)}}function n(s){if(s===y)return"<>";if(typeof s=="object"&&s!==null&&s.$$typeof===q)return"<...>";try{var f=e(s);return f?"<"+f+">":"<...>"}catch{return"<...>"}}function o(){var s=H.A;return s===null?null:s.getOwner()}function c(){return Error("react-stack-top-frame")}function i(s){if(ue.call(s,"key")){var f=Object.getOwnPropertyDescriptor(s,"key").get;if(f&&f.isReactWarning)return!1}return s.key!==void 0}function d(s,f){function T(){de||(de=!0,console.error("%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)",f))}T.isReactWarning=!0,Object.defineProperty(s,"key",{get:T,configurable:!0})}function S(){var s=e(this.type);return G[s]||(G[s]=!0,console.error("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.")),s=this.props.ref,s!==void 0?s:null}function w(s,f,T,R,ye,C){var j=T.ref;return s={$$typeof:b,type:s,key:f,props:T,_owner:R},(j!==void 0?j:null)!==null?Object.defineProperty(s,"ref",{enumerable:!1,get:S}):Object.defineProperty(s,"ref",{enumerable:!1,value:null}),s._store={},Object.defineProperty(s._store,"validated",{configurable:!1,enumerable:!1,writable:!0,value:0}),Object.defineProperty(s,"_debugInfo",{configurable:!1,enumerable:!1,writable:!0,value:null}),Object.defineProperty(s,"_debugStack",{configurable:!1,enumerable:!1,writable:!0,value:ye}),Object.defineProperty(s,"_debugTask",{configurable:!1,enumerable:!1,writable:!0,value:C}),Object.freeze&&(Object.freeze(s.props),Object.freeze(s)),s}function E(s,f,T,R,ye,C){var j=f.children;if(j!==void 0)if(R)if(W(j)){for(R=0;R<j.length;R++)I(j[R]);Object.freeze&&Object.freeze(j)}else console.error("React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead.");else I(j);if(ue.call(f,"key")){j=e(s);var Z=Object.keys(f).filter(function(Re){return Re!=="key"});R=0<Z.length?"{key: someKey, "+Z.join(": ..., ")+": ...}":"{key: someKey}",pe[j+R]||(Z=0<Z.length?"{"+Z.join(": ..., ")+": ...}":"{}",console.error(`A props object containing a "key" prop is being spread into JSX:
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const l=require("react"),ye=require("@aiquants/virtualscroll"),X=require("tailwind-merge"),le=require("@phosphor-icons/react");function fr(e){const t=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e){for(const n in e)if(n!=="default"){const r=Object.getOwnPropertyDescriptor(e,n);Object.defineProperty(t,n,r.get?r:{enumerable:!0,get:()=>e[n]})}}return t.default=e,Object.freeze(t)}const de=fr(l);var ft={exports:{}},Je={};var En;function hr(){if(En)return Je;En=1;var e=Symbol.for("react.transitional.element"),t=Symbol.for("react.fragment");function n(r,a,i){var c=null;if(i!==void 0&&(c=""+i),a.key!==void 0&&(c=""+a.key),"key"in a){i={};for(var d in a)d!=="key"&&(i[d]=a[d])}else i=a;return a=i.ref,{$$typeof:e,type:r,key:c,ref:a!==void 0?a:null,props:i}}return Je.Fragment=t,Je.jsx=n,Je.jsxs=n,Je}var qe={};var Rn;function mr(){return Rn||(Rn=1,process.env.NODE_ENV!=="production"&&(function(){function e(o){if(o==null)return null;if(typeof o=="function")return o.$$typeof===F?null:o.displayName||o.name||null;if(typeof o=="string")return o;switch(o){case E:return"Fragment";case $:return"Profiler";case v:return"StrictMode";case M:return"Suspense";case D:return"SuspenseList";case K:return"Activity"}if(typeof o=="object")switch(typeof o.tag=="number"&&console.error("Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."),o.$$typeof){case y:return"Portal";case P:return o.displayName||"Context";case N:return(o._context.displayName||"Context")+".Consumer";case b:var f=o.render;return o=o.displayName,o||(o=f.displayName||f.name||"",o=o!==""?"ForwardRef("+o+")":"ForwardRef"),o;case O:return f=o.displayName||null,f!==null?f:e(o.type)||"Memo";case q:f=o._payload,o=o._init;try{return e(o(f))}catch{}}return null}function t(o){return""+o}function n(o){try{t(o);var f=!1}catch{f=!0}if(f){f=console;var k=f.error,R=typeof Symbol=="function"&&Symbol.toStringTag&&o[Symbol.toStringTag]||o.constructor.name||"Object";return k.call(f,"The provided key is an unsupported type %s. This value must be coerced to a string before using it here.",R),t(o)}}function r(o){if(o===E)return"<>";if(typeof o=="object"&&o!==null&&o.$$typeof===q)return"<...>";try{var f=e(o);return f?"<"+f+">":"<...>"}catch{return"<...>"}}function a(){var o=H.A;return o===null?null:o.getOwner()}function i(){return Error("react-stack-top-frame")}function c(o){if(fe.call(o,"key")){var f=Object.getOwnPropertyDescriptor(o,"key").get;if(f&&f.isReactWarning)return!1}return o.key!==void 0}function d(o,f){function k(){he||(he=!0,console.error("%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)",f))}k.isReactWarning=!0,Object.defineProperty(o,"key",{get:k,configurable:!0})}function m(){var o=e(this.type);return Y[o]||(Y[o]=!0,console.error("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.")),o=this.props.ref,o!==void 0?o:null}function S(o,f,k,R,be,C){var L=k.ref;return o={$$typeof:g,type:o,key:f,props:k,_owner:R},(L!==void 0?L:null)!==null?Object.defineProperty(o,"ref",{enumerable:!1,get:m}):Object.defineProperty(o,"ref",{enumerable:!1,value:null}),o._store={},Object.defineProperty(o._store,"validated",{configurable:!1,enumerable:!1,writable:!0,value:0}),Object.defineProperty(o,"_debugInfo",{configurable:!1,enumerable:!1,writable:!0,value:null}),Object.defineProperty(o,"_debugStack",{configurable:!1,enumerable:!1,writable:!0,value:be}),Object.defineProperty(o,"_debugTask",{configurable:!1,enumerable:!1,writable:!0,value:C}),Object.freeze&&(Object.freeze(o.props),Object.freeze(o)),o}function T(o,f,k,R,be,C){var L=f.children;if(L!==void 0)if(R)if(B(L)){for(R=0;R<L.length;R++)x(L[R]);Object.freeze&&Object.freeze(L)}else console.error("React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead.");else x(L);if(fe.call(f,"key")){L=e(o);var Z=Object.keys(f).filter(function(ke){return ke!=="key"});R=0<Z.length?"{key: someKey, "+Z.join(": ..., ")+": ...}":"{key: someKey}",ge[L+R]||(Z=0<Z.length?"{"+Z.join(": ..., ")+": ...}":"{}",console.error(`A props object containing a "key" prop is being spread into JSX:
2
2
  let props = %s;
3
3
  <%s {...props} />
4
4
  React keys must be passed directly to JSX without using spread:
5
5
  let props = %s;
6
- <%s key={someKey} {...props} />`,R,j,Z,j),pe[j+R]=!0)}if(j=null,T!==void 0&&(r(T),j=""+T),i(f)&&(r(f.key),j=""+f.key),"key"in f){T={};for(var fe in f)fe!=="key"&&(T[fe]=f[fe])}else T=f;return j&&d(T,typeof s=="function"?s.displayName||s.name||"Unknown":s),w(s,j,T,o(),ye,C)}function I(s){_(s)?s._store&&(s._store.validated=1):typeof s=="object"&&s!==null&&s.$$typeof===q&&(s._payload.status==="fulfilled"?_(s._payload.value)&&s._payload.value._store&&(s._payload.value._store.validated=1):s._store&&(s._store.validated=1))}function _(s){return typeof s=="object"&&s!==null&&s.$$typeof===b}var m=l,b=Symbol.for("react.transitional.element"),p=Symbol.for("react.portal"),y=Symbol.for("react.fragment"),v=Symbol.for("react.strict_mode"),$=Symbol.for("react.profiler"),N=Symbol.for("react.consumer"),P=Symbol.for("react.context"),g=Symbol.for("react.forward_ref"),D=Symbol.for("react.suspense"),F=Symbol.for("react.suspense_list"),O=Symbol.for("react.memo"),q=Symbol.for("react.lazy"),K=Symbol.for("react.activity"),z=Symbol.for("react.client.reference"),H=m.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,ue=Object.prototype.hasOwnProperty,W=Array.isArray,re=console.createTask?console.createTask:function(){return null};m={react_stack_bottom_frame:function(s){return s()}};var de,G={},V=m.react_stack_bottom_frame.bind(m,c)(),ve=re(n(c)),pe={};Ue.Fragment=y,Ue.jsx=function(s,f,T){var R=1e4>H.recentlyCreatedOwnerStacks++;return E(s,f,T,!1,R?Error("react-stack-top-frame"):V,R?re(n(s)):ve)},Ue.jsxs=function(s,f,T){var R=1e4>H.recentlyCreatedOwnerStacks++;return E(s,f,T,!0,R?Error("react-stack-top-frame"):V,R?re(n(s)):ve)}})()),Ue}var wr;function fn(){return wr||(wr=1,process.env.NODE_ENV==="production"?ut.exports=un():ut.exports=dn()),ut.exports}var h=fn();function hn({title:e,titleId:t,...r},n){return ce.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"currentColor","aria-hidden":"true","data-slot":"icon",ref:n,"aria-labelledby":t},r),e?ce.createElement("title",{id:t},e):null,ce.createElement("path",{fillRule:"evenodd",d:"M12.53 16.28a.75.75 0 0 1-1.06 0l-7.5-7.5a.75.75 0 0 1 1.06-1.06L12 14.69l6.97-6.97a.75.75 0 1 1 1.06 1.06l-7.5 7.5Z",clipRule:"evenodd"}))}const mn=ce.forwardRef(hn);function pn({title:e,titleId:t,...r},n){return ce.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"currentColor","aria-hidden":"true","data-slot":"icon",ref:n,"aria-labelledby":t},r),e?ce.createElement("title",{id:t},e):null,ce.createElement("path",{fillRule:"evenodd",d:"M16.28 11.47a.75.75 0 0 1 0 1.06l-7.5 7.5a.75.75 0 0 1-1.06-1.06L14.69 12 7.72 5.03a.75.75 0 0 1 1.06-1.06l7.5 7.5Z",clipRule:"evenodd"}))}const yn=ce.forwardRef(pn);function gn({title:e,titleId:t,...r},n){return ce.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"currentColor","aria-hidden":"true","data-slot":"icon",ref:n,"aria-labelledby":t},r),e?ce.createElement("title",{id:t},e):null,ce.createElement("path",{d:"M19.5 21a3 3 0 0 0 3-3v-4.5a3 3 0 0 0-3-3h-15a3 3 0 0 0-3 3V18a3 3 0 0 0 3 3h15ZM1.5 10.146V6a3 3 0 0 1 3-3h5.379a2.25 2.25 0 0 1 1.59.659l2.122 2.121c.14.141.331.22.53.22H19.5a3 3 0 0 1 3 3v1.146A4.483 4.483 0 0 0 19.5 9h-15a4.483 4.483 0 0 0-3 1.146Z"}))}const bn=ce.forwardRef(gn),Pr="text-[length:var(--dt-font-size-body,0.8125rem)]",Sn=`${Pr} leading-[max(var(--dt-line-height-body,1.25rem),1.5em)]`,Tt=44,vn=12,wn=8,ie=14,En=14,Or=e=>e===void 0?void 0:{fontSize:typeof e=="number"?`${e}px`:e},oe=e=>({width:e,height:e}),M={container:"directory-tree-container relative h-full transition-opacity duration-300 overflow-y-hidden pb-[3px] pr-[2px]",containerPending:"opacity-70",entry:`directory-tree-entry flex items-center cursor-pointer relative select-none ${Sn}`,entryHover:A.twMerge("directory-tree-entry--hover hover:bg-gray-400/15","dark:hover:bg-gray-200/10"),entrySelected:A.twMerge("directory-tree-entry--selected bg-blue-400/10","dark:bg-blue-400/15"),entryItemSelected:A.twMerge("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)]"),expandIcon:A.twMerge("directory-tree-expand-icon flex-shrink-0 flex items-center justify-center","text-gray-500","dark:text-gray-400"),expandIconSelected:A.twMerge("directory-tree-expand-icon--selected text-blue-700","dark:text-blue-400"),typeIcon:A.twMerge("directory-tree-type-icon flex-shrink-0 flex items-center justify-center","text-gray-500","dark:text-gray-400"),typeIconSelected:A.twMerge("directory-tree-type-icon--selected text-blue-700","dark:text-blue-400"),name:A.twMerge(`directory-tree-name overflow-hidden text-ellipsis whitespace-nowrap ml-1 ${Pr} font-normal`,"text-gray-700","dark:text-gray-200"),nameDirectory:"directory-tree-name--directory font-medium",nameSelected:A.twMerge("directory-tree-name--selected text-blue-800 font-semibold","dark:text-blue-300")},Lt=e=>{const t=e.slice(e.lastIndexOf("/")+1),r=t.lastIndexOf(".");return r<=0?"":t.slice(r+1).toLowerCase()},xn=/^[a-z][a-z\d+.-]*:\/\//i,Er=e=>Lt(xn.test(e)?e.split(/[?#]/,1)[0]:e),jr=e=>Lt(e.name)||Er(e.relativePath)||Er(e.absolutePath),Lr=({isDirectory:e,isExpanded:t,showExpandIcons:r,useCanvasExpandIcons:n,expandIconSize:o})=>{const c=o?{width:o,height:o}:void 0,i=o?"":"h-4 w-4";return!(r&&e)||n?h.jsx("span",{className:i,style:c,"aria-hidden":"true"}):t?h.jsx(mn,{className:i,style:c}):h.jsx(yn,{className:i,style:c})},_t=(e,t)=>{if(e==null||typeof e=="boolean")return null;if(typeof e=="function")return console.warn(`[DirectoryTree] Function returned by renderer for "${t}". Return a node.`),null;if(typeof e=="object"){if("then"in e)return console.warn(`[DirectoryTree] Promise returned for "${t}". Not supported.`),null;if(Array.isArray(e)){const n=e.map(o=>_t(o,t)).filter(Boolean);return n.length?n:null}const r=e.type;if(r&&r.$$typeof===Symbol.for("react.lazy"))return console.warn(`[DirectoryTree] Lazy component for "${t}". Not supported.`),null}return e},Rn={markdown:e=>h.jsx(le.FileMd,{className:"text-sky-500 dark:text-sky-400",style:oe(e)}),pdf:e=>h.jsx(le.FilePdf,{className:"text-red-500 dark:text-red-400",style:oe(e)}),spreadsheet:e=>h.jsx(le.FileXls,{className:"text-emerald-600 dark:text-emerald-400",style:oe(e)}),csv:e=>h.jsx(le.FileCsv,{className:"text-emerald-600 dark:text-emerald-400",style:oe(e)}),document:e=>h.jsx(le.FileDoc,{className:"text-blue-600 dark:text-blue-400",style:oe(e)}),presentation:e=>h.jsx(le.FilePpt,{className:"text-orange-500 dark:text-orange-400",style:oe(e)}),image:e=>h.jsx(le.FileImage,{className:"text-teal-500 dark:text-teal-400",style:oe(e)}),audio:e=>h.jsx(le.FileAudio,{className:"text-pink-500 dark:text-pink-400",style:oe(e)}),video:e=>h.jsx(le.FileVideo,{className:"text-violet-500 dark:text-violet-400",style:oe(e)}),archive:e=>h.jsx(le.FileZip,{className:"text-amber-500 dark:text-amber-400",style:oe(e)}),code:e=>h.jsx(le.FileCode,{className:"text-purple-500 dark:text-purple-400",style:oe(e)}),text:e=>h.jsx(le.FileText,{className:"text-gray-500 dark:text-gray-400",style:oe(e)})},In={markdown:["md","markdown","mdx"],pdf:["pdf"],spreadsheet:["xls","xlsx","xlsm","xlsb","ods"],csv:["csv","tsv"],document:["doc","docx","rtf","odt"],presentation:["ppt","pptx","odp"],image:["png","jpg","jpeg","gif","svg","webp","ico","bmp","tiff","avif"],audio:["mp3","wav","ogg","m4a","flac","aac","wma"],video:["mp4","webm","mov","avi","mkv","wmv","flv"],archive:["zip","tar","gz","7z","rar","tgz","bz2"],code:["js","mjs","cjs","ts","tsx","jsx","json","html","htm","css","scss","py","go","rs","c","cpp","h","hpp","sh","bash","yaml","yml","sql","xml","toml"],text:["txt","log"]},kn=new Map(Object.entries(In).flatMap(([e,t])=>t.map(r=>[r,e]))),Tn=new Set(["","application/octet-stream","binary/octet-stream","text/plain","application/x-empty"]),Cn=e=>(e??"").split(";",1)[0].trim().toLowerCase(),_n=e=>{if(e==="text/markdown"||e==="text/x-markdown")return"markdown";if(e==="application/pdf")return"pdf";if(e.includes("excel")||e.includes("spreadsheet"))return"spreadsheet";if(e==="text/csv"||e==="text/tab-separated-values")return"csv";if(e.includes("word")||e.includes("google-apps.document")||e==="application/rtf")return"document";if(e.includes("powerpoint")||e.includes("presentation"))return"presentation";if(e.startsWith("image/"))return"image";if(e.startsWith("audio/"))return"audio";if(e.startsWith("video/"))return"video";if(e.includes("zip")||e.includes("tar")||e.includes("compressed")||e.includes("archive"))return"archive";if(e==="application/json"||e.includes("javascript")||e.includes("typescript")||e.includes("xml")||e.startsWith("text/html")||e.startsWith("text/css")||e.includes("x-python")||e.includes("x-sh")||e.includes("x-go")||e.includes("x-rust"))return"code";if(e.startsWith("text/"))return"text"},Nn=(e,t,r,n)=>{const o=Cn(e),c=_n(o),i=kn.get((t||(r?Lt(r):"")).toLowerCase()),S=(Tn.has(o)?[i,c]:[c,i]).find(w=>w!==void 0);return S===void 0?h.jsx(le.FileIcon,{className:"text-gray-400 dark:text-gray-400",style:oe(n)}):Rn[S](n)},Ar=(e,t,r)=>{const{entry:n,isDirectory:o,isExpanded:c,extension:i,mimeType:d}=e;let S;const w=d||n.mimeType;return n.icon!==void 0?S=n.icon:o?S=c&&t?.directoryExpanded||t?.directory||h.jsx(bn,{style:oe(r)}):i&&t?.fileByExtension?.[i]?S=t.fileByExtension[i]:S=t?.file||Nn(w,i,n.name,r),_t(typeof S=="function"?S(e):S,n.absolutePath)},Pn=e=>e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),Mr=e=>{if(!e)return;const t=Object.entries(e).filter(([,r])=>r!=null);if(t.length!==0)return Object.fromEntries(t.map(([r,n])=>[`data-${Pn(r)}`,String(n)]))},Dr=["color","background","backgroundColor","backgroundImage","backgroundPosition","backgroundSize","backgroundRepeat","backgroundClip","backgroundOrigin","backgroundAttachment","backgroundBlendMode","opacity","boxShadow","filter","backdropFilter","mixBlendMode","borderColor","borderRadius","outline","outlineColor","outlineStyle","outlineWidth","outlineOffset","textShadow","accentColor","caretColor","cursor","fontFamily","fontSize","fontStyle","fontWeight","fontVariant","fontFeatureSettings","fontVariationSettings","fontKerning","letterSpacing","lineHeight","textDecoration","textDecorationColor","textDecorationLine","textDecorationStyle","textDecorationThickness","textUnderlineOffset","textTransform"],Fr=["color","opacity"],On="the row's box belongs to the tree (height: visual.itemHeight, indent: visual.indentSize, icons: visual.typeIconSize, text size: visual.fontSize)",jn=new Set(Dr),Ln=new Set(Fr),xr=(e,t)=>{const r=t===void 0?e.option:`${e.option}.${t}`;return e.absolutePath===void 0?r:`${r} of "${e.absolutePath}"`},$r=(e,t,r,n)=>{if(e!==void 0){if(typeof e!="object"||e===null)throw new RangeError(`${xr(r,void 0)} must be an object of CSS properties or undefined, got ${e===null?"null":typeof e}.`);for(const[o,c]of Object.entries(e))if(c!==void 0&&!t.has(o))throw new RangeError(`${xr(r,o)} cannot be set: ${On}, so ${n}.`)}},Be=(e,t)=>$r(e,jn,t,"a row style accepts only paint and text properties (ROW_STYLE_PROPERTIES)"),An=(e,t)=>$r(e,Ln,t,"the expand icon style accepts only the glyph's colour and opacity (EXPAND_ICON_STYLE_PROPERTIES), and the 14 px expand box is the tree's"),Mn=500,zr=({entry:e,isDirectory:t,isExpanded:r,isItemSelected:n,selectionMode:o,onSelectionChange:c,onEntryClick:i,toggleDirectory:d,onToggleDirectoryRecursive:S})=>{const w=l.useRef(null);return l.useEffect(()=>()=>{w.current&&window.clearTimeout(w.current)},[]),l.useCallback(E=>{E.stopPropagation(),o!=="none"&&!t&&c&&c(e,!n);let I=!1;i({entry:e,isDirectory:t,isExpanded:r,preventDefault:()=>{I=!0}}),!(!t||I)&&(w.current?(window.clearTimeout(w.current),w.current=null,S(e)):w.current=window.setTimeout(()=>{d(e.absolutePath),w.current=null},Mn))},[t,e,r,S,d,i,o,c,n])},Br=e=>e==="right"?"dt-grid-cell--right":e==="center"?"dt-grid-cell--center":"",Rr=(e,t)=>e.children!==void 0&&t(e.absolutePath),Wr=(e,t)=>({width:e,gridTemplateColumns:t}),Hr=l.memo(({entry:e,indentLevel:t,positionInSet:r,setSize:n,rowIndex:o,flatIndex:c,onRowFocus:i,onRowBlur:d,isSelectedForAria:S,rowHeight:w,isDirOpen:E,columns:I,numericTemplate:_,numericTotal:m,nameWidth:b,rowClassName:p,selection:{onEntryClick:y,selectedPath:v,currentPath:$,mode:N="none",selectedItems:P,onSelectionChange:g},expansion:{toggleDirectory:D,onToggleDirectoryRecursive:F},visual:{iconOverrides:O,showExpandIcons:q=!0,showDirectoryIcons:K=!0,showFileIcons:z=!0,useCanvasExpandIcons:H=!1,expandIconSize:ue,typeIconSize:W,fontSize:re,indentSize:de,highlightStyles:G,expandIconClassName:V,expandIconStyle:ve}})=>{Be(e.style,{option:"entry.style",absolutePath:e.absolutePath});const[pe,s]=l.useState(!1),f=e.children!==void 0,T=f&&E(e.absolutePath),R=e.absolutePath===v,ye=e.absolutePath===$,C=!f&&!!P?.has(e.absolutePath),j=f?void 0:jr(e),Z=zr({entry:e,isDirectory:f,isExpanded:T,isItemSelected:C,selectionMode:N,onSelectionChange:g,onEntryClick:y,toggleDirectory:D,onToggleDirectoryRecursive:F}),fe=pe?G?.hoverClassName!==void 0?G.hoverClassName:M.entryHover:"",Re=(()=>{if(f){if(R)return G?.directorySelectedClassName!==void 0?G.directorySelectedClassName:M.entrySelected}else if(R||C)return G?.itemSelectedClassName!==void 0?G.itemSelectedClassName:A.twMerge(R&&M.entrySelected,C&&M.entryItemSelected);return""})(),L=typeof p=="function"?p(e):p,ge=A.twMerge("dt-grid-row cursor-pointer select-none",fe,Re,L,e.className),U=A.twMerge(M.expandIcon,V,(R||C)&&M.expandIconSelected),je=A.twMerge(M.typeIcon,(R||C)&&M.typeIconSelected),ne=A.twMerge("dt-grid-name-label ml-1","text-gray-700 dark:text-gray-200",f&&M.nameDirectory,(R||C)&&M.nameSelected),Q=Lr({isDirectory:f,isExpanded:T,showExpandIcons:q,useCanvasExpandIcons:H,expandIconSize:ue}),se=(f?K:z)?Ar({entry:e,isDirectory:f,isExpanded:T,isSelected:R,isItemSelected:C,extension:j,mimeType:e.mimeType},O,W):null,Ie={indentLevel:t,isDirectory:f,isExpanded:T},[_e,...ke]=I,Le=_e?.render?_e.render(e,Ie):e.label??e.name,we={...pe?G?.hoverStyle:{},...f&&R?G?.directorySelectedStyle:{},...!f&&(R||C)?G?.itemSelectedStyle:{}};return h.jsxs("div",{className:ge,style:{...we,...e.style,height:w},role:"row","aria-expanded":f?T:void 0,"aria-level":t+1,"aria-posinset":r,"aria-setsize":n,"aria-rowindex":o,"aria-selected":N==="none"?void 0:S,"aria-current":ye?"page":void 0,...Mr(e.data),"data-entry-type":f?"directory":"file","data-entry-expanded":f?String(T):void 0,"data-entry-selected":R?"true":void 0,"data-entry-item-selected":C?"true":void 0,onClick:Z,onMouseEnter:()=>s(!0),onMouseLeave:()=>s(!1),onFocus:Y=>i(c,e.absolutePath,Y.currentTarget),onBlur:Y=>d(e.absolutePath,Y.currentTarget),onKeyDown:Y=>{if(Y.key==="Enter"){if(Y.repeat){Y.preventDefault();return}Z(Y)}},tabIndex:0,children:[h.jsxs("div",{className:A.twMerge("dt-grid-name-cell",_e?.className),role:"gridcell",style:{width:b,paddingLeft:Math.max(0,t*de)},children:[(q||H)&&h.jsx("span",{className:U,style:{...ve,width:ie,height:ie},children:Q}),(f?K:z)&&h.jsx("span",{className:je,style:{width:W,height:W},children:se}),h.jsx("span",{className:ne,style:Or(re),children:Le})]}),ke.length>0&&h.jsx("div",{className:"dt-grid-numeric-viewport",children:h.jsx("div",{className:"dt-grid-numeric-track",style:Wr(m,_),children:ke.map(Y=>h.jsx("div",{className:A.twMerge("dt-grid-cell",Br(Y.align),Y.className),role:"gridcell",children:Y.render?Y.render(e,Ie):null},Y.key))})})]})},(e,t)=>{if(e.entry!==t.entry)return!1;const r=Rr(e.entry,e.isDirOpen),n=Rr(t.entry,t.isDirOpen);return e.indentLevel===t.indentLevel&&e.positionInSet===t.positionInSet&&e.setSize===t.setSize&&e.rowIndex===t.rowIndex&&e.flatIndex===t.flatIndex&&e.isSelectedForAria===t.isSelectedForAria&&e.rowHeight===t.rowHeight&&r===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.currentPath===t.selection.currentPath&&e.selection.mode===t.selection.mode&&e.selection.selectedItems===t.selection.selectedItems&&e.visual===t.visual});Hr.displayName="DirectoryTreeGridRow";const Yr=({kind:e,columns:t,numericTemplate:r,numericTotal:n,nameWidth:o,scrollBarWidth:c,className:i,nameContent:d,renderCell:S})=>{const[,...w]=t,E=e==="header"?"dt-grid-name-header":"dt-grid-name-footer",I=e==="header"?"dt-grid-header":"dt-grid-footer",_=e==="header"?"columnheader":"gridcell";return h.jsxs("div",{className:A.twMerge(I,"text-gray-600 dark:text-gray-300",i),role:"row",children:[h.jsx("div",{className:A.twMerge(E,"px-1",t[0]?.className),role:_,style:{width:o},children:d}),w.length>0&&h.jsx("div",{className:"dt-grid-numeric-viewport",children:h.jsx("div",{className:"dt-grid-numeric-track",style:Wr(n,r),children:w.map(m=>h.jsx("div",{className:A.twMerge("dt-grid-cell",Br(m.align),m.className),role:_,children:S(m)},m.key))})}),h.jsx("div",{className:"dt-grid-scrollbar-spacer",style:{width:c},"aria-hidden":"true"})]})},Dn=({columns:e,className:t,...r})=>h.jsx(Yr,{kind:"header",columns:e,className:t,nameContent:e[0]?.header??null,renderCell:n=>n.header??null,...r}),Ir=(e,t)=>typeof e=="function"?e(t):e??null,Fn=({columns:e,allEntries:t,className:r,...n})=>h.jsx(Yr,{kind:"footer",columns:e,className:r,nameContent:Ir(e[0]?.footer,t),renderCell:o=>Ir(o.footer,t),...n}),$n=240,Gr=96,Vr=12,Nt=(e,t)=>{const r=e?.width;return typeof r=="number"&&Number.isFinite(r)&&r>0?r:t},zn=e=>e.slice(1).map(t=>`${Nt(t,Gr)}px`).join(" "),Bn=({measuredWidth:e,columns:t,scrollBarWidth:r=Vr})=>{const n=Nt(t[0],$n),o=t.slice(1).reduce((S,w)=>S+Nt(w,Gr),0),c=Number.isFinite(e)&&e>0?e:0,i=Math.max(0,c-n-Math.max(0,r)),d=Math.max(0,o-i);return{nameWidth:n,numericTotal:o,numericVisible:i,maxHScroll:d}},Ct=(e,t)=>!Number.isFinite(e)||e<0?0:e>t?t:e,Wn=e=>{const t=[],r=n=>{for(const o of n)t.push(o),o.children&&o.children.length>0&&r(o.children)};return r(e),t},Xr=["entryKindDirectory","entryKindFile"],Pt=[...me.VIRTUAL_SCROLL_LABEL_KEYS,...Xr],Ot=Object.freeze({en:Object.freeze({entryKindDirectory:"directory",entryKindFile:"file"}),ja:Object.freeze({entryKindDirectory:"ใƒ‡ใ‚ฃใƒฌใ‚ฏใƒˆใƒช",entryKindFile:"ใƒ•ใ‚กใ‚คใƒซ"})}),Kr=Object.freeze({en:Object.freeze({...me.VIRTUAL_SCROLL_LABEL_CATALOGS.en,...Ot.en}),ja:Object.freeze({...me.VIRTUAL_SCROLL_LABEL_CATALOGS.ja,...Ot.ja})}),kr=e=>typeof e=="string"?JSON.stringify(e):e===null?"null":typeof e,Hn=e=>{const t={};let r=!1;for(const n of me.VIRTUAL_SCROLL_LABEL_KEYS){const o=Object.hasOwn(e,n)?e[n]:void 0;o!==void 0&&(t[n]=o,r=!0)}return r?t:void 0},Ur=(e,t)=>{const r=me.resolveVirtualScrollLocale(e);if(t===void 0)return Kr[r];if(t===null||typeof t!="object")throw new RangeError(`[directory-tree] labels must be an object; got ${kr(t)}`);const n=Object.getPrototypeOf(t);if(n!==Object.prototype&&n!==null)throw new RangeError(`[directory-tree] labels must be a plain object (prototype Object.prototype or null); got ${Array.isArray(t)?"an array":"an object with a non-plain prototype"}`);for(const i of Object.keys(t))if(!Pt.includes(i))throw new RangeError(`[directory-tree] labels.${i} is not a known label key; expected one of ${Pt.join(", ")}`);const c={...me.resolveVirtualScrollLabels(r,Hn(t)),...Ot[r]};for(const i of Xr){const d=Object.hasOwn(t,i)?t[i]:void 0;if(d!==void 0){if(typeof d!="string"||d.trim()==="")throw new RangeError(`[directory-tree] labels.${i} must be a non-blank string; got ${kr(d)}`);c[i]=d}}return Object.freeze(c)},Yn=e=>{const t={};for(const r of me.VIRTUAL_SCROLL_LABEL_KEYS)t[r]=e[r];return Object.freeze(t)},Gn=()=>{let e=null;return{mark:t=>{const r=t.composedPath();e=r,setTimeout(()=>{e===r&&(e=null)},0)},landedOn:t=>e?.includes(t)===!0}},Je=e=>typeof e=="string"?JSON.stringify(e):String(e),jt=(e,t)=>{if(typeof t!="number"||!Number.isFinite(t)||t<=0)throw new RangeError(`[directory-tree] visual.${e} must be a finite number greater than 0 (px); got ${Je(t)}.`);return t},Vn=e=>{if(typeof e=="string"&&e.trim()!==""||typeof e=="number"&&Number.isFinite(e)&&e>0)return e;throw new RangeError(`[directory-tree] visual.fontSize must be a finite number greater than 0 (px) or a CSS font size that is not blank; got ${Je(e)}.`)},Xn=({indentSize:e,typeIconSize:t,fontSize:r})=>({indentSize:e===void 0?vn:jt("indentSize",e),typeIconSize:t===void 0?En:jt("typeIconSize",t),fontSize:r===void 0?void 0:Vn(r)}),Kn=({indentSize:e,removeRootIndent:t,hasExpandBox:r})=>t?Math.max(0,e-(r?ie:0)):0,Un=(e,t,r)=>{if(typeof e!="function")return jt("itemHeight",e);const n=e(t,r);if(typeof n!="number"||!Number.isFinite(n)||n<=0)throw new RangeError(`[directory-tree] visual.itemHeight returned ${Je(n)} for ${JSON.stringify(t.absolutePath)} (row ${r}); it must return a finite number greater than 0 (px).`);return n},Jn=(e,t,r)=>{const n=t===void 0?wn:t;if(typeof n!="number"||!Number.isFinite(n)||n<=0||n>ie)throw new RangeError(`[directory-tree] visual.expandIconSize must be a finite number greater than 0 and at most ${ie} (the expand box, px) while tree lines are drawn; got ${Je(n)}.`);const{indentSize:o,typeIconSize:c}=e,i=n/2,d=ie+c-n/2;if(o<i||o>d)throw new RangeError(`[directory-tree] visual.indentSize ${Je(o)} does not fit the tree lines: with typeIconSize ${c} and an expand glyph of ${n} px it must be from ${i} (half the glyph) to ${d} (the ${ie} px expand box + typeIconSize โˆ’ half the glyph).`);return{indentSize:o,typeIconSize:c,glyphSize:n,originX:r}},qn=({indentSize:e,typeIconSize:t,glyphSize:r})=>Math.min(Math.max(ie+t/2-e,r/2),ie-r/2),Zn=(e,t)=>{const r=e.length-1;if(r<=0)return 0;let n=0,o=r-1,c=0;for(;n<=o;){const i=n+o>>>1;e[i]<=t?(c=i,n=i+1):o=i-1}return c},Qn=(e,t,r)=>{if(r<=0||e.length===0||t.length!==e.length+1)return null;const n=Zn(t,r),o=e[n];return o?{path:o.entry.absolutePath,offsetInViewport:r-t[n]}:null},eo=(e,t,r)=>{if(t.length===0||r.length!==t.length+1)return null;for(let n=0;n<t.length;n++)if(t[n].entry.absolutePath===e.path)return Math.max(0,r[n]+e.offsetInViewport);return null},to=(e,t,r)=>{const n=[];for(let o=t;o<r;o++){const c=e[o];if(!(!c||c.length===0))for(const i of c)n.push(i)}return n},ro=(e,t,r)=>{const n=[];for(let o=t;o<r;o++){const c=e[o];if(!(!c||c.length===0))for(const i of c)n.push(i)}return n},no=(e,t,r,n)=>{const o=Math.max(1,Math.floor(t*n)),c=Math.max(1,Math.floor(r*n));(e.width!==o||e.height!==c)&&(e.width=o,e.height=c);const i=e.style;i.width!==`${t}px`&&(i.width=`${t}px`),i.height!==`${r}px`&&(i.height=`${r}px`)},oo=(e,t,r)=>{e.lineWidth=r,e.beginPath();for(const n of t)e.moveTo(n.x1,n.y1),e.lineTo(n.x2,n.y2);e.stroke()},so=(e,t)=>{const r=/^#([0-9a-f]{3}|[0-9a-f]{6})$/i.exec(e.trim());if(!r)return null;let n=r[1];n.length===3&&(n=n.split("").map(d=>d+d).join(""));const o=Number.parseInt(n.slice(0,2),16),c=Number.parseInt(n.slice(2,4),16),i=Number.parseInt(n.slice(4,6),16);return`rgba(${o}, ${c}, ${i}, ${t})`},ao=(e,t,r,n)=>{if(t.length===0)return;const o=so(r,.14),c=e.strokeStyle,i=e.fillStyle,d=e.lineWidth,S=e.lineCap,w=e.lineJoin;e.strokeStyle=r,e.lineCap="round",e.lineJoin="round";for(const E of t){const I=n??E.size,_=Math.max(0,I/2),m=Math.max(1,Math.round(I*.08)),b=Math.max(1,Math.round(I*.14)),p=Math.max(0,_-m*.8),y=Math.max(0,p*.55);o&&(e.fillStyle=o,e.beginPath(),e.arc(E.centerX,E.centerY,p,0,Math.PI*2),e.fill()),e.lineWidth=m,e.beginPath(),e.arc(E.centerX,E.centerY,Math.max(0,_-m*.3),0,Math.PI*2),e.stroke(),e.lineWidth=b,e.beginPath(),e.moveTo(E.centerX-y,E.centerY),e.lineTo(E.centerX+y,E.centerY),e.stroke(),E.isExpanded||(e.beginPath(),e.moveTo(E.centerX,E.centerY-y),e.lineTo(E.centerX,E.centerY+y),e.stroke())}e.strokeStyle=c,e.fillStyle=i,e.lineWidth=d,e.lineCap=S,e.lineJoin=w},Jr=l.memo(({segmentsByItem:e,glyphsByItem:t,itemHeight:r,width:n,viewportHeight:o,scrollPosition:c,color:i="#a0aec0",strokeWidth:d=1,renderStartIndex:S,renderEndIndex:w,lookaheadEndIndex:E,devicePixelRatio:I,expandGlyphColor:_,expandGlyphSize:m})=>{const b=l.useRef(null),p=l.useRef(null),y=l.useRef({segmentsByItem:e,glyphsByItem:t,itemHeight:r,width:n,viewportHeight:o,scrollPosition:c,color:i,strokeWidth:d,renderStartIndex:S,renderEndIndex:w,lookaheadEndIndex:E,devicePixelRatio:I,expandGlyphColor:_,expandGlyphSize:m}),v=l.useCallback(()=>{p.current=null;const N=b.current;if(!N)return;const P=N.getContext("2d");if(!P)return;const g=y.current;if(g.width<=0||g.viewportHeight<=0){P.clearRect(0,0,N.width,N.height);return}const D=Number.isFinite(g.devicePixelRatio??NaN)?g.devicePixelRatio:typeof window<"u"&&window.devicePixelRatio||1;no(N,g.width,g.viewportHeight,D);const F=g.segmentsByItem.length,O=typeof g.renderStartIndex=="number"&&Number.isFinite(g.renderStartIndex)?Math.max(0,Math.floor(g.renderStartIndex)):Math.max(0,Math.floor(g.scrollPosition/g.itemHeight)),q=Math.min(F,Math.ceil((g.scrollPosition+g.viewportHeight)/g.itemHeight)),K=(()=>{if(typeof g.renderEndIndex=="number"&&Number.isFinite(g.renderEndIndex)){const W=Math.floor(g.renderEndIndex);return Math.max(Math.min(F,W+1),O)}return Math.max(q,O)})(),z=(()=>{if(typeof g.lookaheadEndIndex=="number"&&Number.isFinite(g.lookaheadEndIndex)){const W=Math.floor(g.lookaheadEndIndex),re=Math.min(F,W+1);return Math.max(re,K)}return Math.max(q,K)})(),H=to(g.segmentsByItem,O,z),ue=ro(g.glyphsByItem,O,z);P.save(),P.scale(D,D),P.clearRect(0,0,g.width,g.viewportHeight),P.translate(0,-g.scrollPosition),P.strokeStyle=g.color,oo(P,H,g.strokeWidth),ao(P,ue,g.expandGlyphColor??g.color,g.expandGlyphSize),P.restore()},[]),$=l.useCallback(()=>{p.current===null&&(p.current=window.requestAnimationFrame(v))},[v]);return l.useEffect(()=>{y.current={segmentsByItem:e,glyphsByItem:t,itemHeight:r,width:n,viewportHeight:o,scrollPosition:c,color:i,strokeWidth:d,renderStartIndex:S,renderEndIndex:w,lookaheadEndIndex:E,devicePixelRatio:I,expandGlyphColor:_,expandGlyphSize:m},$()},[e,t,r,n,o,c,i,d,S,w,E,I,_,m,$]),l.useEffect(()=>()=>{p.current!==null&&(window.cancelAnimationFrame(p.current),p.current=null)},[]),h.jsx("canvas",{ref:b,className:"pointer-events-none absolute top-0 left-0 z-0"})});Jr.displayName="TreeLineCanvas";const lo=e=>{const t=new Map;for(let r=0;r<e.length;r++){const n=e[r].entry.absolutePath;t.has(n)||t.set(n,r)}return t},Tr=(e,t)=>e.selectedPath===t?e:{selectedPath:t,selectionGeneration:e.selectionGeneration+1,anchor:e.anchor},io=(e,t)=>({...e,anchor:{path:t,selectionGeneration:e.selectionGeneration,focused:!0}}),co=(e,t)=>{const{anchor:r,selectionGeneration:n,selectedPath:o}=t;if(r!==null&&(r.focused||r.selectionGeneration===n)){const c=e.get(r.path);if(c!==void 0)return c}if(o!==null){const c=e.get(o);if(c!==void 0)return c}return 0},uo={msOverflowStyle:"none",scrollbarWidth:"none"},fo=()=>{let e=document.getElementById("directory-tree-webkit-scrollbar-hide");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))},ho=e=>{const t=l.useRef(null),r=t.current;return r!==null&&me.VIRTUAL_SCROLL_LABEL_KEYS.every(n=>r[n]===e[n])?r:(t.current=e,e)},Cr=new Set(["top","bottom","center","nearest"]),_r=e=>{const t=e?.align;if(t===void 0)return"top";if(!Cr.has(t))throw new RangeError(`[directory-tree] Unsupported scroll alignment ${JSON.stringify(t)}; expected one of ${[...Cr].join(", ")}.`);return t},mo={position:"absolute",width:1,height:1,margin:-1,padding:0,border:0,overflow:"hidden",clipPath:"inset(50%)",whiteSpace:"nowrap"},po=(e,t,r,n,o)=>{const c=[],i=[];let d=0;const S=(w,E,I)=>{const _=o?[...w].sort(o):w;for(let m=0;m<_.length;m++){const b=_[m],p=m===_.length-1,y=[...I,p],v=b.children!==void 0,$=v&&t(b.absolutePath,b.relativePath);let N=E,P=I;n&&(N=E-1,P=I.slice(1)),c.push({entry:b,indentLevel:N,depth:E,positionInSet:m+1,setSize:_.length}),r&&(N>d&&(d=N),i.push({id:b.absolutePath,name:b.name,absolutePath:b.absolutePath,indentLevel:N,isLastChild:p,isDirectory:v,isExpanded:$,ancestorIsLast:[...P],hideLines:n&&E===0})),v&&$&&b.children&&S(b.children,E+1,y)}};return S(e,0,[]),{flatItems:c,lineItems:i,maxIndent:d}},Nr=(e,t)=>{const r=e.length-1;if(r<=0)return 0;let n=0,o=r-1,c=0;for(;n<=o;){const i=n+o>>>1;e[i]<=t?(c=i,n=i+1):o=i-1}return c},yo=(e,t,r,n,o,c)=>{const i=n?.renderStart??Math.max(0,Nr(c,o)),d=t>0?Nr(c,o+t)+r:i+r,S=e>0?Math.min(e-1,Math.max(i,d)):i,w=n?.renderEnd??S,E=e>0?Math.min(e-1,w+r):w;return{renderStart:i,renderEnd:w,lookaheadEnd:E}},go=(e,t,r,n)=>{if(e.length===0)return{segmentsByItem:[],glyphsByItem:[]};const{indentSize:o,typeIconSize:c,glyphSize:i,originX:d}=n,S=Array.from({length:e.length},()=>[]),w=Array.from({length:e.length},()=>[]),E=d+qn(n),I=m=>m*o+E,_=i/2+2;for(let m=0;m<e.length;m++){const b=e[m],p=t[m]??0,y=r[m]??0,v=y+p/2,$=e[m+1],N=v+c/2,P=y+p,g=$!==void 0&&$.indentLevel===b.indentLevel+1&&N<P?{key:`${b.id}-connector-children`,x1:I($.indentLevel),y1:N,x2:I($.indentLevel),y2:P,itemIndex:m}:null;if(b.hideLines){g!==null&&(S[m]=[g]);continue}const D=[];for(let O=0;O<b.indentLevel;O++){if(b.ancestorIsLast[O]??!1)continue;let K=!1;for(let z=m;z<e.length;z++){const H=e[z];if(H.indentLevel>O&&H.ancestorIsLast.length>O&&!H.ancestorIsLast[O]){K=!0;break}if(z>m&&H.indentLevel===O)break}if(K){const z=I(O);D.push({key:`${b.id}-ancestor-${O}`,x1:z,y1:y,x2:z,y2:y+p,itemIndex:m})}}const F=I(b.indentLevel);m>0&&D.push({key:`${b.id}-connector-top`,x1:F,y1:y,x2:F,y2:b.isDirectory?v-_:v,itemIndex:m}),!b.isDirectory&&b.isLastChild&&D.push({key:`${b.id}-connector-horizontal`,x1:F,y1:v,x2:d+b.indentLevel*o+ie,y2:v,itemIndex:m}),b.isLastChild||(b.isDirectory?D.push({key:`${b.id}-connector-bottom`,x1:F,y1:v+_,x2:F,y2:y+p,itemIndex:m}):D.push({key:`${b.id}-connector-bottom`,x1:F,y1:v,x2:F,y2:y+p,itemIndex:m})),g!==null&&D.push(g),S[m]=D,b.isDirectory&&(w[m]=[{key:`${b.id}-glyph`,itemIndex:m,centerX:F,centerY:v,size:i,isExpanded:b.isExpanded}])}return{segmentsByItem:S,glyphsByItem:w}},qr=l.memo(({entry:e,indentLevel:t,originX:r,depth:n,positionInSet:o,setSize:c,isSelectedForAria:i,flatIndex:d,isActive:S,registerRowRef:w,onNavigationKeyDown:E,onRowFocus:I,onRowBlur:_,rowHeight:m,entryKindDirectory:b,entryKindFile:p,isDirOpen:y,expansion:{toggleDirectory:v,onToggleDirectoryRecursive:$},selection:{onEntryClick:N,selectedPath:P,currentPath:g,mode:D="none",selectedItems:F,onSelectionChange:O},visual:{iconOverrides:q,showExpandIcons:K=!0,showDirectoryIcons:z=!0,showFileIcons:H=!0,useCanvasExpandIcons:ue=!1,expandIconSize:W,typeIconSize:re,fontSize:de,indentSize:G,highlightStyles:V,entryClassName:ve,entryStyle:pe,nameClassName:s,nameStyle:f,directoryNameClassName:T,directoryNameStyle:R,fileNameClassName:ye,fileNameStyle:C,expandIconClassName:j,expandIconStyle:Z}})=>{Be(e.style,{option:"entry.style",absolutePath:e.absolutePath});const[fe,Re]=l.useState(!1),L=e.children!==void 0,ge=L&&y(e.absolutePath),U=e.absolutePath===P,je=e.absolutePath===g,ne=!L&&F?.has(e.absolutePath),Q=l.useCallback(ee=>w(d,ee),[w,d]),se=L?void 0:jr(e),Ie=zr({entry:e,isDirectory:L,isExpanded:ge,isItemSelected:!!ne,selectionMode:D,onSelectionChange:O,onEntryClick:N,toggleDirectory:v,onToggleDirectoryRecursive:$}),_e=fe?V?.hoverClassName!==void 0?V.hoverClassName:M.entryHover:"",ke=(()=>{if(L){if(U)return V?.directorySelectedClassName!==void 0?V.directorySelectedClassName:M.entrySelected}else if(U||ne)return V?.itemSelectedClassName!==void 0?V.itemSelectedClassName:A.twMerge(U&&M.entrySelected,ne&&M.entryItemSelected);return""})(),Le=A.twMerge(M.entry,_e,ke,ve,e.className),we=A.twMerge(M.expandIcon,j,(U||ne)&&M.expandIconSelected),Y=A.twMerge(M.typeIcon,(U||ne)&&M.typeIconSelected),We=A.twMerge(M.name,s,L&&M.nameDirectory,L&&T,!L&&ye,(U||ne)&&M.nameSelected),qe=Lr({isDirectory:L,isExpanded:ge,showExpandIcons:K&&t>=0,useCanvasExpandIcons:ue,expandIconSize:W}),dt=(L?z:H)?Ar({entry:e,isDirectory:L,isExpanded:ge,isSelected:U,isItemSelected:!!ne,extension:se,mimeType:e.mimeType},q,re):null,He={...fe?V?.hoverStyle:{},...L&&U?V?.directorySelectedStyle:{},...!L&&(U||ne)?V?.itemSelectedStyle:{}},Ye=Mr(e.data),Ze={width:re,height:re},Qe=Or(de),be=r+t*G;return h.jsxs("div",{className:Le,style:{...Qe,...He,...pe,...e.style,paddingLeft:`${Math.max(0,be)}px`,transform:be<0?`translateX(${be}px)`:void 0,width:be<0?`calc(100% + ${-be}px)`:void 0,height:`${m}px`},...Ye,"data-entry-type":L?"directory":"file","data-entry-expanded":L?String(ge):void 0,"data-entry-selected":U?"true":void 0,"data-entry-item-selected":ne?"true":void 0,onClick:Ie,onMouseEnter:()=>Re(!0),onMouseLeave:()=>Re(!1),onFocus:ee=>I(d,e.absolutePath,ee.currentTarget),onBlur:ee=>_(e.absolutePath,ee.currentTarget),ref:Q,onKeyDown:ee=>{if(ee.key==="Enter"||ee.key===" "){ee.preventDefault(),ee.repeat||Ie(ee);return}E(ee,d)},tabIndex:S?0:-1,role:"treeitem","aria-expanded":L?ge:void 0,"aria-level":n+1,"aria-posinset":o,"aria-setsize":c,"aria-selected":D==="none"?void 0:i,"aria-current":je?"page":void 0,"aria-label":`${e.name} (${L?b:p})`,children:[(K||ue)&&h.jsx("span",{className:we,style:{...Z,width:ie,height:ie},children:qe}),(L?z:H)&&h.jsx("span",{className:Y,style:Ze,children:dt}),h.jsx("span",{className:We,style:{...Qe,...f,...L?R:C},"data-entry-type":L?"directory":"file","data-entry-role":"name",children:e.label??e.name})]})},(e,t)=>{if(e.entry!==t.entry)return!1;const r=e.entry.children!==void 0,n=t.entry.children!==void 0,o=r&&e.isDirOpen(e.entry.absolutePath),c=n&&t.isDirOpen(t.entry.absolutePath);return e.indentLevel===t.indentLevel&&e.originX===t.originX&&e.depth===t.depth&&e.positionInSet===t.positionInSet&&e.setSize===t.setSize&&e.isSelectedForAria===t.isSelectedForAria&&e.flatIndex===t.flatIndex&&e.isActive===t.isActive&&e.rowHeight===t.rowHeight&&e.entryKindDirectory===t.entryKindDirectory&&e.entryKindFile===t.entryKindFile&&o===c&&e.selection.selectedPath===t.selection.selectedPath&&e.selection.currentPath===t.selection.currentPath&&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.typeIconSize===t.visual.typeIconSize&&e.visual.fontSize===t.visual.fontSize&&e.visual.indentSize===t.visual.indentSize&&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.visual.expandIconClassName===t.visual.expandIconClassName&&e.visual.expandIconStyle===t.visual.expandIconStyle});qr.displayName="DirectoryEntryItem";const Zr=e=>{const t=[];if(e.children)for(const r of e.children)r.type==="directory"&&(t.push(r.absolutePath),t.push(...Zr(r)));return t},bo=({entries:e,expansion:{toggle:t,isExpanded:r,expandMultiple:n,collapseMultiple:o,isPending:c,alwaysExpanded:i=!1,doubleClickAction:d="recursive"},selection:{onEntryClick:S,selectedPath:w,currentPath:E,mode:I="none",selectedItems:_,onSelectionChange:m},visual:{className:b,style:p,ariaLabel:y,ariaLabelledBy:v,lineColor:$="#A0AEC0",showTreeLines:N=!0,showExpandIcons:P=!0,showDirectoryIcons:g=!0,showFileIcons:D=!0,iconOverrides:F,expandIconSize:O,typeIconSize:q,fontSize:K,indentSize:z,itemHeight:H=Tt,removeRootIndent:ue=!1,highlightStyles:W,entryClassName:re,entryStyle:de,nameClassName:G,nameStyle:V,directoryNameClassName:ve,directoryNameStyle:pe,fileNameClassName:s,fileNameStyle:f,expandIconClassName:T,expandIconStyle:R}={},virtualScroll:ye,grid:C,sort:j,locale:Z,labels:fe,ref:Re})=>{const L=me.resolveVirtualScrollLocale(Z),ge=l.useMemo(()=>Ur(Z,fe),[Z,fe]),U=ho(Yn(ge)),{entryKindDirectory:je,entryKindFile:ne}=ge,Q=l.useMemo(()=>Xn({indentSize:z,typeIconSize:q,fontSize:K}),[z,q,K]);l.useMemo(()=>{Be(de,{option:"visual.entryStyle"}),Be(W?.hoverStyle,{option:"visual.highlightStyles.hoverStyle"}),Be(W?.directorySelectedStyle,{option:"visual.highlightStyles.directorySelectedStyle"}),Be(W?.itemSelectedStyle,{option:"visual.highlightStyles.itemSelectedStyle"}),An(R,{option:"visual.expandIconStyle"})},[de,W,R]);const se=C!==void 0,[Ie,_e]=l.useState(!1),ke=l.useRef(null),Le=l.useRef(null),we=l.useRef(null),[Y,We]=l.useState(0),[qe,dt]=l.useState(0),[He,Ye]=l.useState(0),[Ze,Qe]=l.useState(null),{overscanCount:be=15,className:ee,background:At,onScroll:Mt,onRangeChange:Dt,onScrollAdjust:Ft,liveRegion:$t,initialScrollIndex:zt,initialScrollOffset:Ae,initialScrollAnchor:Bt,callbackThrottleMs:Wt=5,contentInsets:Ht,onItemFocus:Yt,viewportHeightOverride:ae,scrollBarOptions:ft,behaviorOptions:Gt,preserveScrollAnchor:Vt=!1,getItemKey:Qr,testId:Xt,contentProps:ht}=ye??{},Kt=l.useMemo(()=>se?{...ht,role:"rowgroup"}:{...ht,role:"tree","aria-label":v?void 0:y,"aria-labelledby":v,"aria-multiselectable":I==="multiple"?!0:void 0},[se,ht,y,v,I]),Ut=l.useMemo(()=>({...Gt,enableKeyboardNavigation:!1}),[Gt]),[et,Jt]=l.useState(typeof Ae=="number"?Ae:0),mt=l.useRef(typeof Ae=="number"?Ae:0),qt=l.useCallback((a,u)=>{mt.current=a,Jt(a),Mt?.(a,u)},[Mt]),Zt=l.useCallback(a=>{const{renderingStartIndex:u,renderingEndIndex:x}=a;Qe(k=>k&&k.renderStart===u&&k.renderEnd===x?k:{renderStart:u,renderEnd:x}),Dt?.(a)},[Dt]);l.useEffect(()=>{_e(!0),fo()},[]),l.useEffect(()=>{const a=ke.current,u=se?Le.current:a,x=()=>{if(a){const B=a.clientWidth;dt(J=>Math.abs(J-B)>1?B:J)}if(typeof ae=="number")We(B=>Math.abs(B-ae)>1?ae:B);else if(u){const B=u.clientHeight;We(J=>Math.abs(J-B)>1?B:J)}};if(!(a||u))return We(0);x();const k=new ResizeObserver(x);return a&&k.observe(a),u&&u!==a&&k.observe(u),()=>k.disconnect()},[ae,se]);const Me=typeof ae=="number"?ae:Y,Se=l.useCallback(a=>i||(Ie?r(a):!1),[Ie,r,i]),Qt=A.twMerge(M.container,c&&M.containerPending,b),er=l.useMemo(()=>({...uo,...p??{},...typeof ae=="number"?{height:ae,minHeight:ae}:{}}),[p,ae]),pt=l.useCallback((a,u)=>{const x=[a.absolutePath,...Zr(a)],k=u||d;if(x.every(xe=>Se(xe)))return o(x);if(x.every(xe=>!Se(xe))||k==="recursive")return n(x);if(k==="toggle")return o(x);console.warn(`[DirectoryTree] Unknown double click action: ${k}. No action taken.`)},[Se,n,o,d]),yt=se?!1:ue,{flatItems:Ne,lineItems:gt,maxIndent:tr}=l.useMemo(()=>po(e,Se,N,yt,j),[e,Se,N,yt,j]),tt=Kn({indentSize:Q.indentSize,removeRootIndent:yt,hasExpandBox:P||N}),he=l.useMemo(()=>N?Jn(Q,O,tt):null,[N,Q,O,tt]),X=l.useMemo(()=>Ne.map((a,u)=>({...a,rowHeight:Un(H,a.entry,u)})),[Ne,H]),Te=l.useMemo(()=>X.map(a=>a.rowHeight),[X]),Pe=l.useMemo(()=>{const a=new Array(Te.length+1);a[0]=0;for(let u=0;u<Te.length;u++)a[u+1]=a[u]+Te[u];return a},[Te]),rr=l.useCallback(a=>X[a]?.rowHeight??Tt,[X]),en=l.useCallback(a=>X[a]?.entry.absolutePath??a,[X]),nr=Qr??en,De=w??null,bt=E??null,[or,Ge]=l.useState(()=>({selectedPath:De,selectionGeneration:0,anchor:null})),St=Tr(or,De);St!==or&&Ge(a=>Tr(a,De));const rt=l.useMemo(()=>lo(Ne),[Ne]),Fe=l.useMemo(()=>co(rt,St),[rt,St]),Ve=l.useRef(new Map),nt=l.useRef(null),[ot]=l.useState(Gn),Xe=l.useRef(null),[tn,sr]=l.useState(!0),vt=l.useRef(Ne);vt.current=Ne;const ar=l.useRef(Se);ar.current=Se;const wt=l.useRef(t);wt.current=t;const lr=l.useRef(rt);lr.current=rt;const Et=l.useRef(Fe);Et.current=Fe;const ir=l.useRef(Yt);ir.current=Yt;const Oe=l.useCallback(a=>{const u=we.current;return!u||u.getViewportSize()<=0?!1:(u.scrollToIndex(a,{align:"nearest"}),!0)},[]),Ee=l.useCallback(a=>{const u=Ve.current.get(a);if(u===void 0){Xe.current=a,Oe(a)||(Xe.current=null);return}Xe.current=null,Oe(a),u.focus({preventScroll:!0})},[Oe]),cr=l.useCallback((a,u)=>{if(u)Ve.current.set(a,u),Xe.current===a?(Xe.current=null,u.focus({preventScroll:!0})):u.contains(u.ownerDocument.activeElement)&&Ge(x=>x.anchor===null?x:{...x,anchor:{...x.anchor,focused:!0}});else{const x=Ve.current.get(a);Ve.current.delete(a),x?.contains(x.ownerDocument.activeElement)&&Ge(k=>k.anchor===null?k:{...k,anchor:{...k.anchor,focused:!1}})}a===Et.current&&sr(u!==null)},[]);l.useLayoutEffect(()=>{sr(Ve.current.has(Fe))},[Fe]);const xt=l.useCallback((a,u,x)=>{const k=nt.current===x;nt.current=null,k||(Ge(B=>io(B,u)),ot.landedOn(x)||Oe(a)),ir.current?.(a)},[Oe,ot]),st=l.useCallback(a=>ot.mark(a.nativeEvent),[ot]),Rt=l.useCallback((a,u)=>{const{ownerDocument:x}=u;if(!x.hasFocus()&&u.contains(x.activeElement)){nt.current=u;return}nt.current=null,Ge(k=>k.anchor!==null&&k.anchor.path===a?{...k,anchor:{...k.anchor,focused:!1}}:k)},[]),rn=l.useCallback(()=>Ee(Et.current),[Ee]),It=l.useCallback((a,u)=>{const x=_r(u),k=vt.current.length;if(!Number.isInteger(a)||a<0||a>=k)throw new RangeError(`[directory-tree] scrollToIndex: ${String(a)} is not a row index (${k===0?"the tree has no rows":`expected an integer in 0..${String(k-1)}`}).`);if(x==="nearest"){Oe(a);return}we.current?.scrollToIndex(a,{align:x})},[Oe]);l.useImperativeHandle(Re,()=>({scrollToIndex:It,scrollToPath:(a,u)=>{_r(u);const x=lr.current.get(a);return x===void 0?!1:(It(x,u),!0)},getScrollAnchor:()=>we.current?.getScrollAnchor()??null}),[It]);const ur=l.useCallback((a,u)=>{if(a.altKey||a.ctrlKey||a.metaKey)return;const x=vt.current,k=x.length-1;if(k<0)return;const B=x[u],J=B?.entry.children!==void 0,xe=J&&ar.current(B.entry.absolutePath);switch(a.key){case"ArrowDown":a.preventDefault(),Ee(Math.min(u+1,k));break;case"ArrowUp":a.preventDefault(),Ee(Math.max(u-1,0));break;case"Home":a.preventDefault(),Ee(0);break;case"End":a.preventDefault(),Ee(k);break;case"ArrowRight":a.preventDefault(),J&&!xe?wt.current(B.entry.absolutePath):J&&u<k&&x[u+1].depth>B.depth&&Ee(u+1);break;case"ArrowLeft":{if(a.preventDefault(),J&&xe){wt.current(B.entry.absolutePath);break}const ln=B?.depth??0;for(let ct=u-1;ct>=0;ct--)if(x[ct].depth<ln){Ee(ct);break}break}}},[Ee]),at=l.useMemo(()=>he===null||gt.length===0?{segmentsByItem:[],glyphsByItem:[]}:go(gt,Te,Pe,he),[gt,Te,Pe,he]),lt=l.useMemo(()=>he===null||e.length===0?0:he.originX+tr*he.indentSize+ie+he.typeIconSize,[e.length,tr,he]),{renderStart:dr,renderEnd:fr,lookaheadEnd:hr}=l.useMemo(()=>yo(X.length,Me,be,Ze,et,Pe),[X.length,Me,be,Ze,et,Pe]),kt=l.useMemo(()=>he===null||lt<=0||Me<=0||at.segmentsByItem.length===0?null:h.jsx("div",{className:"pointer-events-none absolute inset-0 z-0","aria-hidden":"true",children:h.jsx("div",{className:"absolute top-0 left-0",style:{width:lt,height:Me},children:h.jsx(Jr,{segmentsByItem:at.segmentsByItem,glyphsByItem:at.glyphsByItem,itemHeight:Te[0]??Tt,width:lt,viewportHeight:Me,scrollPosition:et,color:$,expandGlyphColor:$,expandGlyphSize:he.glyphSize,renderStartIndex:dr,renderEndIndex:fr,lookaheadEndIndex:hr})})}),[lt,Me,dr,fr,hr,et,at,$,he,Te]),mr=l.useCallback(a=>X[a],[X]),pr=l.useRef(null);l.useLayoutEffect(()=>{const a=pr.current;if(pr.current={items:X,offsets:Pe},!Vt||!a||a.items===X)return;const u=we.current,x=u?.getScrollPosition(),k=typeof x=="number"&&x>=0?x:mt.current,B=Qn(a.items,a.offsets,k);if(!B)return;const J=eo(B,X,Pe);if(J===null||Math.abs(J-k)<1)return;const xe=u?u.scrollTo(J):J;mt.current=xe,Jt(xe)},[X,Pe,Vt]);const Ce=C?.columns,$e=C?.scrollBarWidth??ft?.width??Vr,te=l.useMemo(()=>Ce?Bn({measuredWidth:qe,columns:Ce,scrollBarWidth:$e}):null,[Ce,qe,$e]),it=l.useMemo(()=>Ce?zn(Ce):"",[Ce]),nn=l.useMemo(()=>C?.showFooter&&Ce?Wn(e):[],[C?.showFooter,Ce,e]),ze=te?.maxHScroll??0;l.useEffect(()=>{Ye(a=>Ct(a,ze))},[ze]);const yr=l.useCallback(a=>Ye(u=>Ct(u+a,ze)),[ze]),gr=l.useMemo(()=>({iconOverrides:F,showExpandIcons:P,showDirectoryIcons:g,showFileIcons:D,useCanvasExpandIcons:N,expandIconSize:O,typeIconSize:Q.typeIconSize,fontSize:Q.fontSize,indentSize:Q.indentSize,highlightStyles:W,expandIconClassName:T,expandIconStyle:R}),[F,P,g,D,N,O,Q,W,T,R]),br=l.useMemo(()=>h.jsx(me.VirtualScroll,{ref:we,itemCount:X.length,getItem:mr,getItemHeight:rr,getItemKey:nr,testId:Xt,contentProps:Kt,locale:L,labels:U,viewportSize:typeof ae=="number"?ae:void 0,overscanCount:be,onScroll:qt,onRangeChange:Zt,onScrollAdjust:Ft,liveRegion:$t,className:ee,onWheelHorizontal:se?yr:void 0,background:h.jsxs(h.Fragment,{children:[se&&te?h.jsx("div",{className:"pointer-events-none absolute top-0 left-0 z-0 h-full overflow-hidden",style:{width:te.nameWidth},"aria-hidden":"true",children:kt}):kt,At]}),initialScrollIndex:zt,initialScrollOffset:Ae,initialScrollAnchor:Bt,callbackThrottleMs:Wt,contentInsets:Ht,scrollBarOptions:ft,behaviorOptions:Ut,children:(a,u)=>a?se&&C&&te?h.jsx(Hr,{entry:a.entry,indentLevel:a.indentLevel,positionInSet:a.positionInSet,setSize:a.setSize,rowIndex:u+(C.showHeader??!0?2:1),flatIndex:u,onRowFocus:xt,onRowBlur:Rt,isSelectedForAria:!!_?.has(a.entry.absolutePath),rowHeight:a.rowHeight,isDirOpen:Se,columns:C.columns,numericTemplate:it,numericTotal:te.numericTotal,nameWidth:te.nameWidth,rowClassName:C.rowClassName,selection:{onEntryClick:S,selectedPath:De,currentPath:bt,mode:I,selectedItems:_,onSelectionChange:m},expansion:{toggleDirectory:t,onToggleDirectoryRecursive:pt},visual:gr},a.entry.absolutePath):h.jsx(qr,{entry:a.entry,indentLevel:a.indentLevel,originX:tt,depth:a.depth,positionInSet:a.positionInSet,setSize:a.setSize,isSelectedForAria:!!_?.has(a.entry.absolutePath),flatIndex:u,isActive:u===Fe,registerRowRef:cr,onNavigationKeyDown:ur,onRowFocus:xt,onRowBlur:Rt,rowHeight:a.rowHeight,entryKindDirectory:je,entryKindFile:ne,isDirOpen:Se,expansion:{toggleDirectory:t,onToggleDirectoryRecursive:pt},selection:{onEntryClick:S,selectedPath:De,currentPath:bt,mode:I,selectedItems:_,onSelectionChange:m},visual:{iconOverrides:F,showExpandIcons:P,showDirectoryIcons:g,showFileIcons:D,useCanvasExpandIcons:N,expandIconSize:O,typeIconSize:Q.typeIconSize,fontSize:Q.fontSize,indentSize:Q.indentSize,highlightStyles:W,entryClassName:re,entryStyle:de,nameClassName:G,nameStyle:V,directoryNameClassName:ve,directoryNameStyle:pe,fileNameClassName:s,fileNameStyle:f,expandIconClassName:T,expandIconStyle:R}},a.entry.absolutePath):null}),[X.length,mr,rr,nr,Xt,Kt,L,U,je,ne,Fe,cr,ur,xt,Rt,ae,be,qt,Zt,Ft,$t,ee,se,yr,te,kt,At,zt,Ae,Bt,Wt,Ht,ft,Ut,C,it,Se,S,De,bt,I,_,m,t,pt,gr,F,P,g,D,N,O,Q,tt,W,re,de,G,V,ve,pe,s,f,T,R]);if(!(C&&te))return h.jsxs("div",{ref:ke,className:Qt,style:er,onPointerDownCapture:st,onMouseDownCapture:st,children:[Ne.length>0&&!tn&&h.jsx("span",{tabIndex:0,"data-directory-tree-tab-stop":"",style:mo,onFocus:rn}),br]});const on=C.showHeader??!0,sn=C.showFooter??!1,an={...er,"--dt-hscroll":`${He}px`};return h.jsxs("div",{ref:ke,className:A.twMerge(Qt,"dt-grid"),style:an,role:"treegrid","aria-label":v?void 0:y,"aria-labelledby":v,"aria-multiselectable":I==="multiple"?!0:void 0,"aria-rowcount":X.length+(C.showHeader??!0?1:0),onPointerDownCapture:st,onMouseDownCapture:st,children:[on&&h.jsx("div",{role:"rowgroup",children:h.jsx(Dn,{columns:C.columns,numericTemplate:it,numericTotal:te.numericTotal,nameWidth:te.nameWidth,scrollBarWidth:$e,className:C.headerClassName})}),h.jsx("div",{ref:Le,className:"dt-grid-body",children:br}),ze>0&&h.jsxs("div",{className:"dt-grid-hscrollbar-row",children:[h.jsx("div",{className:"dt-grid-scrollbar-spacer",style:{width:te.nameWidth},"aria-hidden":"true"}),h.jsx(me.ScrollBar,{horizontal:!0,contentSize:te.numericTotal,viewportSize:te.numericVisible,scrollPosition:He,scrollBarWidth:$e,locale:L,labels:U,onScroll:a=>{const u=typeof a=="function"?a(He):a,x=Ct(u,ze);return Ye(x),x}}),h.jsx("div",{className:"dt-grid-scrollbar-spacer",style:{width:$e},"aria-hidden":"true"})]}),sn&&h.jsx("div",{role:"rowgroup",children:h.jsx(Fn,{columns:C.columns,numericTemplate:it,numericTotal:te.numericTotal,nameWidth:te.nameWidth,scrollBarWidth:$e,allEntries:nn,className:C.footerClassName})})]})},So=({initialExpanded:e=new Set,storageKey:t}={})=>{const[r,n]=l.useTransition(),[o,c]=l.useState(()=>{if(typeof window<"u"&&t)try{const p=window.localStorage.getItem(t);if(p){const y=JSON.parse(p);return new Set(y)}}catch(p){console.error("[useDirectoryTreeState] Error reading from localStorage",p)}return e}),i=l.useCallback(p=>{n(()=>{c(y=>{const v=new Set(y);return p(v),v})})},[]),d=l.useCallback((p,y)=>{i(v=>{for(const $ of p)y(v,$)})},[i]);l.useEffect(()=>{if(t&&typeof window<"u")try{window.localStorage.setItem(t,JSON.stringify(Array.from(o)))}catch(p){console.warn(`Error setting localStorage key "${t}":`,p)}},[o,t]);const S=l.useCallback(p=>{d([p],(y,v)=>{y.has(v)?y.delete(v):y.add(v)})},[d]),w=l.useCallback(p=>{d([p],(y,v)=>{y.add(v)})},[d]),E=l.useCallback(p=>{d([p],(y,v)=>{y.delete(v)})},[d]),I=l.useCallback(p=>{d(p,(y,v)=>{y.delete(v)})},[d]),_=l.useCallback(p=>{d(p,(y,v)=>{y.add(v)})},[d]),m=l.useCallback(()=>{i(p=>{p.clear()})},[i]),b=l.useCallback(p=>o.has(p),[o]);return{expanded:o,toggle:S,expand:w,collapse:E,collapseMultiple:I,expandMultiple:_,collapseAll:m,isExpanded:b,isPending:r}};exports.DIRECTORY_TREE_LABEL_CATALOGS=Kr;exports.DIRECTORY_TREE_LABEL_KEYS=Pt;exports.DirectoryTree=bo;exports.EXPAND_ICON_STYLE_PROPERTIES=Fr;exports.ROW_STYLE_PROPERTIES=Dr;exports.directoryTreeClasses=M;exports.resolveDirectoryTreeLabels=Ur;exports.useDirectoryTreeState=So;
6
+ <%s key={someKey} {...props} />`,R,L,Z,L),ge[L+R]=!0)}if(L=null,k!==void 0&&(n(k),L=""+k),c(f)&&(n(f.key),L=""+f.key),"key"in f){k={};for(var me in f)me!=="key"&&(k[me]=f[me])}else k=f;return L&&d(k,typeof o=="function"?o.displayName||o.name||"Unknown":o),S(o,L,k,a(),be,C)}function x(o){_(o)?o._store&&(o._store.validated=1):typeof o=="object"&&o!==null&&o.$$typeof===q&&(o._payload.status==="fulfilled"?_(o._payload.value)&&o._payload.value._store&&(o._payload.value._store.validated=1):o._store&&(o._store.validated=1))}function _(o){return typeof o=="object"&&o!==null&&o.$$typeof===g}var p=l,g=Symbol.for("react.transitional.element"),y=Symbol.for("react.portal"),E=Symbol.for("react.fragment"),v=Symbol.for("react.strict_mode"),$=Symbol.for("react.profiler"),N=Symbol.for("react.consumer"),P=Symbol.for("react.context"),b=Symbol.for("react.forward_ref"),M=Symbol.for("react.suspense"),D=Symbol.for("react.suspense_list"),O=Symbol.for("react.memo"),q=Symbol.for("react.lazy"),K=Symbol.for("react.activity"),F=Symbol.for("react.client.reference"),H=p.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,fe=Object.prototype.hasOwnProperty,B=Array.isArray,ne=console.createTask?console.createTask:function(){return null};p={react_stack_bottom_frame:function(o){return o()}};var he,Y={},G=p.react_stack_bottom_frame.bind(p,i)(),Ee=ne(r(i)),ge={};qe.Fragment=E,qe.jsx=function(o,f,k){var R=1e4>H.recentlyCreatedOwnerStacks++;return T(o,f,k,!1,R?Error("react-stack-top-frame"):G,R?ne(r(o)):Ee)},qe.jsxs=function(o,f,k){var R=1e4>H.recentlyCreatedOwnerStacks++;return T(o,f,k,!0,R?Error("react-stack-top-frame"):G,R?ne(r(o)):Ee)}})()),qe}var xn;function pr(){return xn||(xn=1,process.env.NODE_ENV==="production"?ft.exports=hr():ft.exports=mr()),ft.exports}var h=pr();function yr({title:e,titleId:t,...n},r){return de.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"currentColor","aria-hidden":"true","data-slot":"icon",ref:r,"aria-labelledby":t},n),e?de.createElement("title",{id:t},e):null,de.createElement("path",{fillRule:"evenodd",d:"M12.53 16.28a.75.75 0 0 1-1.06 0l-7.5-7.5a.75.75 0 0 1 1.06-1.06L12 14.69l6.97-6.97a.75.75 0 1 1 1.06 1.06l-7.5 7.5Z",clipRule:"evenodd"}))}const gr=de.forwardRef(yr);function br({title:e,titleId:t,...n},r){return de.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"currentColor","aria-hidden":"true","data-slot":"icon",ref:r,"aria-labelledby":t},n),e?de.createElement("title",{id:t},e):null,de.createElement("path",{fillRule:"evenodd",d:"M16.28 11.47a.75.75 0 0 1 0 1.06l-7.5 7.5a.75.75 0 0 1-1.06-1.06L14.69 12 7.72 5.03a.75.75 0 0 1 1.06-1.06l7.5 7.5Z",clipRule:"evenodd"}))}const Sr=de.forwardRef(br);function vr({title:e,titleId:t,...n},r){return de.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"currentColor","aria-hidden":"true","data-slot":"icon",ref:r,"aria-labelledby":t},n),e?de.createElement("title",{id:t},e):null,de.createElement("path",{d:"M19.5 21a3 3 0 0 0 3-3v-4.5a3 3 0 0 0-3-3h-15a3 3 0 0 0-3 3V18a3 3 0 0 0 3 3h15ZM1.5 10.146V6a3 3 0 0 1 3-3h5.379a2.25 2.25 0 0 1 1.59.659l2.122 2.121c.14.141.331.22.53.22H19.5a3 3 0 0 1 3 3v1.146A4.483 4.483 0 0 0 19.5 9h-15a4.483 4.483 0 0 0-3 1.146Z"}))}const wr=de.forwardRef(vr),jn="#71829b",ie={rowHover:"hover:bg-[color:light-dark(#f3f4f6,#1e2939)]",rowSelected:"bg-[color:light-dark(#eff6ff,#162456)]",checkedRing:"inset-ring-1 inset-ring-[color:light-dark(#155dfc,#51a2ff)]",name:"text-[color:light-dark(#364153,#e5e7eb)]",nameSelected:"text-[color:light-dark(#193cb8,#bedbff)]",gridEdge:"text-[color:light-dark(#4a5565,#d1d5dc)]",icon:"text-[color:light-dark(#6a7282,#99a1af)]",iconSelected:"text-[color:light-dark(#1447e6,#51a2ff)]"},ue={markdown:"text-[color:light-dark(#0084d1,#00bcff)]",pdf:"text-[color:light-dark(#e7000b,#ff6467)]",spreadsheet:"text-[color:light-dark(#009966,#00d492)]",csv:"text-[color:light-dark(#009966,#00d492)]",document:"text-[color:light-dark(#155dfc,#51a2ff)]",presentation:"text-[color:light-dark(#f54900,#ff8904)]",image:"text-[color:light-dark(#009689,#00d5be)]",audio:"text-[color:light-dark(#e60076,#fb64b6)]",video:"text-[color:light-dark(#7f22fe,#a684ff)]",archive:"text-[color:light-dark(#bb4d00,#ffb900)]",code:"text-[color:light-dark(#9810fa,#c27aff)]",text:"text-[color:light-dark(#6a7282,#99a1af)]"},An="text-[length:var(--dt-font-size-body,0.8125rem)]",Er=`${An} leading-[max(var(--dt-line-height-body,1.25rem),1.5em)]`,_t=44,Rr=12,xr=8,ce=14,Ir=14,Mn=e=>e===void 0?void 0:{fontSize:typeof e=="number"?`${e}px`:e},oe=e=>({width:e,height:e}),A={container:"directory-tree-container relative h-full overflow-y-hidden pb-[3px] pr-[2px]",containerPending:"cursor-progress",entry:`directory-tree-entry flex items-center cursor-pointer relative select-none ${Er}`,entryHover:`directory-tree-entry--hover ${ie.rowHover}`,entrySelected:`directory-tree-entry--selected ${ie.rowSelected}`,entryItemSelected:`directory-tree-entry--item-selected ${ie.rowSelected} ${ie.checkedRing}`,expandIcon:`directory-tree-expand-icon flex-shrink-0 flex items-center justify-center ${ie.icon}`,expandIconSelected:`directory-tree-expand-icon--selected ${ie.iconSelected}`,typeIcon:`directory-tree-type-icon flex-shrink-0 flex items-center justify-center ${ie.icon}`,typeIconSelected:`directory-tree-type-icon--selected ${ie.iconSelected}`,name:`directory-tree-name overflow-hidden text-ellipsis whitespace-nowrap ml-1 ${An} font-normal ${ie.name}`,nameDirectory:"directory-tree-name--directory font-medium",nameSelected:`directory-tree-name--selected font-semibold ${ie.nameSelected}`},Mt=e=>{const t=e.slice(e.lastIndexOf("/")+1),n=t.lastIndexOf(".");return n<=0?"":t.slice(n+1).toLowerCase()},kr=/^[a-z][a-z\d+.-]*:\/\//i,In=e=>Mt(kr.test(e)?e.split(/[?#]/,1)[0]:e),Dn=e=>Mt(e.name)||In(e.relativePath)||In(e.absolutePath),$n=({isDirectory:e,isExpanded:t,showExpandIcons:n,useCanvasExpandIcons:r,expandIconSize:a})=>{const i=a?{width:a,height:a}:void 0,c=a?"":"h-4 w-4";return!(n&&e)||r?h.jsx("span",{className:c,style:i,"aria-hidden":"true"}):t?h.jsx(gr,{className:c,style:i}):h.jsx(Sr,{className:c,style:i})},Pt=(e,t)=>{if(e==null||typeof e=="boolean")return null;if(typeof e=="function")return console.warn(`[DirectoryTree] Function returned by renderer for "${t}". Return a node.`),null;if(typeof e=="object"){if("then"in e)return console.warn(`[DirectoryTree] Promise returned for "${t}". Not supported.`),null;if(Array.isArray(e)){const r=e.map(a=>Pt(a,t)).filter(Boolean);return r.length?r:null}const n=e.type;if(n&&n.$$typeof===Symbol.for("react.lazy"))return console.warn(`[DirectoryTree] Lazy component for "${t}". Not supported.`),null}return e},Cr={markdown:e=>h.jsx(le.FileMd,{className:ue.markdown,style:oe(e)}),pdf:e=>h.jsx(le.FilePdf,{className:ue.pdf,style:oe(e)}),spreadsheet:e=>h.jsx(le.FileXls,{className:ue.spreadsheet,style:oe(e)}),csv:e=>h.jsx(le.FileCsv,{className:ue.csv,style:oe(e)}),document:e=>h.jsx(le.FileDoc,{className:ue.document,style:oe(e)}),presentation:e=>h.jsx(le.FilePpt,{className:ue.presentation,style:oe(e)}),image:e=>h.jsx(le.FileImage,{className:ue.image,style:oe(e)}),audio:e=>h.jsx(le.FileAudio,{className:ue.audio,style:oe(e)}),video:e=>h.jsx(le.FileVideo,{className:ue.video,style:oe(e)}),archive:e=>h.jsx(le.FileZip,{className:ue.archive,style:oe(e)}),code:e=>h.jsx(le.FileCode,{className:ue.code,style:oe(e)}),text:e=>h.jsx(le.FileText,{className:ue.text,style:oe(e)})},Tr={markdown:["md","markdown","mdx"],pdf:["pdf"],spreadsheet:["xls","xlsx","xlsm","xlsb","ods"],csv:["csv","tsv"],document:["doc","docx","rtf","odt"],presentation:["ppt","pptx","odp"],image:["png","jpg","jpeg","gif","svg","webp","ico","bmp","tiff","avif"],audio:["mp3","wav","ogg","m4a","flac","aac","wma"],video:["mp4","webm","mov","avi","mkv","wmv","flv"],archive:["zip","tar","gz","7z","rar","tgz","bz2"],code:["js","mjs","cjs","ts","tsx","jsx","json","html","htm","css","scss","py","go","rs","c","cpp","h","hpp","sh","bash","yaml","yml","sql","xml","toml"],text:["txt","log"]},_r=new Map(Object.entries(Tr).flatMap(([e,t])=>t.map(n=>[n,e]))),Nr=new Set(["","application/octet-stream","binary/octet-stream","text/plain","application/x-empty"]),Pr=e=>(e??"").split(";",1)[0].trim().toLowerCase(),Or=e=>{if(e==="text/markdown"||e==="text/x-markdown")return"markdown";if(e==="application/pdf")return"pdf";if(e.includes("excel")||e.includes("spreadsheet"))return"spreadsheet";if(e==="text/csv"||e==="text/tab-separated-values")return"csv";if(e.includes("word")||e.includes("google-apps.document")||e==="application/rtf")return"document";if(e.includes("powerpoint")||e.includes("presentation"))return"presentation";if(e.startsWith("image/"))return"image";if(e.startsWith("audio/"))return"audio";if(e.startsWith("video/"))return"video";if(e.includes("zip")||e.includes("tar")||e.includes("compressed")||e.includes("archive"))return"archive";if(e==="application/json"||e.includes("javascript")||e.includes("typescript")||e.includes("xml")||e.startsWith("text/html")||e.startsWith("text/css")||e.includes("x-python")||e.includes("x-sh")||e.includes("x-go")||e.includes("x-rust"))return"code";if(e.startsWith("text/"))return"text"},Lr=(e,t,n,r)=>{const a=Pr(e),i=Or(a),c=_r.get((t||(n?Mt(n):"")).toLowerCase()),m=(Nr.has(a)?[c,i]:[i,c]).find(S=>S!==void 0);return m===void 0?h.jsx(le.FileIcon,{className:ie.icon,style:oe(r)}):Cr[m](r)},Fn=(e,t,n)=>{const{entry:r,isDirectory:a,isExpanded:i,extension:c,mimeType:d}=e;let m;const S=d||r.mimeType;return r.icon!==void 0?m=r.icon:a?m=i&&t?.directoryExpanded||t?.directory||h.jsx(wr,{style:oe(n)}):c&&t?.fileByExtension?.[c]?m=t.fileByExtension[c]:m=t?.file||Lr(S,c,r.name,n),Pt(typeof m=="function"?m(e):m,r.absolutePath)},jr=e=>e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),zn=e=>{if(!e)return;const t=Object.entries(e).filter(([,n])=>n!=null);if(t.length!==0)return Object.fromEntries(t.map(([n,r])=>[`data-${jr(n)}`,String(r)]))},Bn=["color","background","backgroundColor","backgroundImage","backgroundPosition","backgroundSize","backgroundRepeat","backgroundClip","backgroundOrigin","backgroundAttachment","backgroundBlendMode","opacity","boxShadow","filter","backdropFilter","mixBlendMode","borderColor","borderRadius","outline","outlineColor","outlineStyle","outlineWidth","outlineOffset","textShadow","accentColor","caretColor","cursor","fontFamily","fontSize","fontStyle","fontWeight","fontVariant","fontFeatureSettings","fontVariationSettings","fontKerning","letterSpacing","lineHeight","textDecoration","textDecorationColor","textDecorationLine","textDecorationStyle","textDecorationThickness","textUnderlineOffset","textTransform"],Hn=["color","opacity"],Ar="the row's box belongs to the tree (height: visual.itemHeight, indent: visual.indentSize, icons: visual.typeIconSize, text size: visual.fontSize)",Mr=new Set(Bn),Dr=new Set(Hn),kn=(e,t)=>{const n=t===void 0?e.option:`${e.option}.${t}`;return e.absolutePath===void 0?n:`${n} of "${e.absolutePath}"`},Wn=(e,t,n,r)=>{if(e!==void 0){if(typeof e!="object"||e===null)throw new RangeError(`${kn(n,void 0)} must be an object of CSS properties or undefined, got ${e===null?"null":typeof e}.`);for(const[a,i]of Object.entries(e))if(i!==void 0&&!t.has(a))throw new RangeError(`${kn(n,a)} cannot be set: ${Ar}, so ${r}.`)}},We=(e,t)=>Wn(e,Mr,t,"a row style accepts only paint and text properties (ROW_STYLE_PROPERTIES)"),$r=(e,t)=>Wn(e,Dr,t,"the expand icon style accepts only the glyph's colour and opacity (EXPAND_ICON_STYLE_PROPERTIES), and the 14 px expand box is the tree's"),Fr=500,Yn=({entry:e,isDirectory:t,isExpanded:n,isItemSelected:r,selectionMode:a,onSelectionChange:i,onEntryClick:c,toggleDirectory:d,onToggleDirectoryRecursive:m})=>{const S=l.useRef(null);return l.useEffect(()=>()=>{S.current&&window.clearTimeout(S.current)},[]),l.useCallback(T=>{T.stopPropagation(),a!=="none"&&!t&&i&&i(e,!r);let x=!1;c({entry:e,isDirectory:t,isExpanded:n,preventDefault:()=>{x=!0}}),!(!t||x)&&(S.current?(window.clearTimeout(S.current),S.current=null,m(e)):S.current=window.setTimeout(()=>{d(e.absolutePath),S.current=null},Fr))},[t,e,n,m,d,c,a,i,r])},Gn=e=>e==="right"?"dt-grid-cell--right":e==="center"?"dt-grid-cell--center":"",Cn=(e,t)=>e.children!==void 0&&t(e.absolutePath),Vn=(e,t)=>({width:e,gridTemplateColumns:t}),Xn=l.memo(({entry:e,indentLevel:t,positionInSet:n,setSize:r,rowIndex:a,flatIndex:i,onRowFocus:c,onRowBlur:d,isSelectedForAria:m,rowHeight:S,isDirOpen:T,columns:x,numericTemplate:_,numericTotal:p,nameWidth:g,rowClassName:y,selection:{onEntryClick:E,selectedPath:v,currentPath:$,mode:N="none",selectedItems:P,onSelectionChange:b},expansion:{toggleDirectory:M,onToggleDirectoryRecursive:D},visual:{iconOverrides:O,showExpandIcons:q=!0,showDirectoryIcons:K=!0,showFileIcons:F=!0,useCanvasExpandIcons:H=!1,expandIconSize:fe,typeIconSize:B,fontSize:ne,indentSize:he,highlightStyles:Y,expandIconClassName:G,expandIconStyle:Ee}})=>{We(e.style,{option:"entry.style",absolutePath:e.absolutePath});const[ge,o]=l.useState(!1),f=e.children!==void 0,k=f&&T(e.absolutePath),R=e.absolutePath===v,be=e.absolutePath===$,C=!f&&!!P?.has(e.absolutePath),L=f?void 0:Dn(e),Z=Yn({entry:e,isDirectory:f,isExpanded:k,isItemSelected:C,selectionMode:N,onSelectionChange:b,onEntryClick:E,toggleDirectory:M,onToggleDirectoryRecursive:D}),me=ge?Y?.hoverClassName!==void 0?Y.hoverClassName:A.entryHover:"",ke=(()=>{if(f){if(R)return Y?.directorySelectedClassName!==void 0?Y.directorySelectedClassName:A.entrySelected}else if(R||C)return Y?.itemSelectedClassName!==void 0?Y.itemSelectedClassName:X.twMerge(R&&A.entrySelected,C&&A.entryItemSelected);return""})(),j=typeof y=="function"?y(e):y,Se=X.twMerge("dt-grid-row cursor-pointer select-none",me,ke,j,e.className),U=X.twMerge(A.expandIcon,G,(R||C)&&A.expandIconSelected),Ae=X.twMerge(A.typeIcon,(R||C)&&A.typeIconSelected),re=X.twMerge("dt-grid-name-label ml-1",ie.name,f&&A.nameDirectory,(R||C)&&A.nameSelected),Q=$n({isDirectory:f,isExpanded:k,showExpandIcons:q,useCanvasExpandIcons:H,expandIconSize:fe}),se=(f?K:F)?Fn({entry:e,isDirectory:f,isExpanded:k,isSelected:R,isItemSelected:C,extension:L,mimeType:e.mimeType},O,B):null,Ce={indentLevel:t,isDirectory:f,isExpanded:k},[Pe,...Te]=x,Me=Pe?.render?Pe.render(e,Ce):e.label??e.name,Re={...ge?Y?.hoverStyle:{},...f&&R?Y?.directorySelectedStyle:{},...!f&&(R||C)?Y?.itemSelectedStyle:{}};return h.jsxs("div",{className:Se,style:{...Re,...e.style,height:S},role:"row","aria-expanded":f?k:void 0,"aria-level":t+1,"aria-posinset":n,"aria-setsize":r,"aria-rowindex":a,"aria-selected":N==="none"?void 0:m,"aria-current":be?"page":void 0,...zn(e.data),"data-entry-type":f?"directory":"file","data-entry-expanded":f?String(k):void 0,"data-entry-selected":R?"true":void 0,"data-entry-item-selected":C?"true":void 0,onClick:Z,onMouseEnter:()=>o(!0),onMouseLeave:()=>o(!1),onFocus:W=>c(i,e.absolutePath,W.currentTarget),onBlur:W=>d(e.absolutePath,W.currentTarget),onKeyDown:W=>{if(W.key==="Enter"){if(W.repeat){W.preventDefault();return}Z(W)}},tabIndex:0,children:[h.jsxs("div",{className:X.twMerge("dt-grid-name-cell",Pe?.className),role:"gridcell",style:{width:g,paddingLeft:Math.max(0,t*he)},children:[(q||H)&&h.jsx("span",{className:U,style:{...Ee,width:ce,height:ce},children:Q}),(f?K:F)&&h.jsx("span",{className:Ae,style:{width:B,height:B},children:se}),h.jsx("span",{className:re,style:Mn(ne),children:Me})]}),Te.length>0&&h.jsx("div",{className:"dt-grid-numeric-viewport",children:h.jsx("div",{className:"dt-grid-numeric-track",style:Vn(p,_),children:Te.map(W=>h.jsx("div",{className:X.twMerge("dt-grid-cell",Gn(W.align),W.className),role:"gridcell",children:W.render?W.render(e,Ce):null},W.key))})})]})},(e,t)=>{if(e.entry!==t.entry)return!1;const n=Cn(e.entry,e.isDirOpen),r=Cn(t.entry,t.isDirOpen);return e.indentLevel===t.indentLevel&&e.positionInSet===t.positionInSet&&e.setSize===t.setSize&&e.rowIndex===t.rowIndex&&e.flatIndex===t.flatIndex&&e.isSelectedForAria===t.isSelectedForAria&&e.rowHeight===t.rowHeight&&n===r&&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.currentPath===t.selection.currentPath&&e.selection.mode===t.selection.mode&&e.selection.selectedItems===t.selection.selectedItems&&e.visual===t.visual});Xn.displayName="DirectoryTreeGridRow";const Kn=({kind:e,columns:t,numericTemplate:n,numericTotal:r,nameWidth:a,scrollBarWidth:i,className:c,nameContent:d,renderCell:m})=>{const[,...S]=t,T=e==="header"?"dt-grid-name-header":"dt-grid-name-footer",x=e==="header"?"dt-grid-header":"dt-grid-footer",_=e==="header"?"columnheader":"gridcell";return h.jsxs("div",{className:X.twMerge(x,ie.gridEdge,c),role:"row",children:[h.jsx("div",{className:X.twMerge(T,"px-1",t[0]?.className),role:_,style:{width:a},children:d}),S.length>0&&h.jsx("div",{className:"dt-grid-numeric-viewport",children:h.jsx("div",{className:"dt-grid-numeric-track",style:Vn(r,n),children:S.map(p=>h.jsx("div",{className:X.twMerge("dt-grid-cell",Gn(p.align),p.className),role:_,children:m(p)},p.key))})}),h.jsx("div",{className:"dt-grid-scrollbar-spacer",style:{width:i},"aria-hidden":"true"})]})},zr=({columns:e,className:t,...n})=>h.jsx(Kn,{kind:"header",columns:e,className:t,nameContent:e[0]?.header??null,renderCell:r=>r.header??null,...n}),Tn=(e,t)=>typeof e=="function"?e(t):e??null,Br=({columns:e,allEntries:t,className:n,...r})=>h.jsx(Kn,{kind:"footer",columns:e,className:n,nameContent:Tn(e[0]?.footer,t),renderCell:a=>Tn(a.footer,t),...r}),Hr=240,Un=96,Jn=12,Ot=(e,t)=>{const n=e?.width;return typeof n=="number"&&Number.isFinite(n)&&n>0?n:t},Wr=e=>e.slice(1).map(t=>`${Ot(t,Un)}px`).join(" "),Yr=({measuredWidth:e,columns:t,scrollBarWidth:n=Jn})=>{const r=Ot(t[0],Hr),a=t.slice(1).reduce((m,S)=>m+Ot(S,Un),0),i=Number.isFinite(e)&&e>0?e:0,c=Math.max(0,i-r-Math.max(0,n)),d=Math.max(0,a-c);return{nameWidth:r,numericTotal:a,numericVisible:c,maxHScroll:d}},Nt=(e,t)=>!Number.isFinite(e)||e<0?0:e>t?t:e,Gr=e=>{const t=[],n=r=>{for(const a of r)t.push(a),a.children&&a.children.length>0&&n(a.children)};return n(e),t},qn=["entryKindDirectory","entryKindFile"],Lt=[...ye.VIRTUAL_SCROLL_LABEL_KEYS,...qn],jt=Object.freeze({en:Object.freeze({entryKindDirectory:"directory",entryKindFile:"file"}),ja:Object.freeze({entryKindDirectory:"ใƒ‡ใ‚ฃใƒฌใ‚ฏใƒˆใƒช",entryKindFile:"ใƒ•ใ‚กใ‚คใƒซ"})}),Zn=Object.freeze({en:Object.freeze({...ye.VIRTUAL_SCROLL_LABEL_CATALOGS.en,...jt.en}),ja:Object.freeze({...ye.VIRTUAL_SCROLL_LABEL_CATALOGS.ja,...jt.ja})}),_n=e=>typeof e=="string"?JSON.stringify(e):e===null?"null":typeof e,Vr=e=>{const t={};let n=!1;for(const r of ye.VIRTUAL_SCROLL_LABEL_KEYS){const a=Object.hasOwn(e,r)?e[r]:void 0;a!==void 0&&(t[r]=a,n=!0)}return n?t:void 0},Qn=(e,t)=>{const n=ye.resolveVirtualScrollLocale(e);if(t===void 0)return Zn[n];if(t===null||typeof t!="object")throw new RangeError(`[directory-tree] labels must be an object; got ${_n(t)}`);const r=Object.getPrototypeOf(t);if(r!==Object.prototype&&r!==null)throw new RangeError(`[directory-tree] labels must be a plain object (prototype Object.prototype or null); got ${Array.isArray(t)?"an array":"an object with a non-plain prototype"}`);for(const c of Object.keys(t))if(!Lt.includes(c))throw new RangeError(`[directory-tree] labels.${c} is not a known label key; expected one of ${Lt.join(", ")}`);const i={...ye.resolveVirtualScrollLabels(n,Vr(t)),...jt[n]};for(const c of qn){const d=Object.hasOwn(t,c)?t[c]:void 0;if(d!==void 0){if(typeof d!="string"||d.trim()==="")throw new RangeError(`[directory-tree] labels.${c} must be a non-blank string; got ${_n(d)}`);i[c]=d}}return Object.freeze(i)},Xr=e=>{const t={};for(const n of ye.VIRTUAL_SCROLL_LABEL_KEYS)t[n]=e[n];return Object.freeze(t)},Kr=()=>{let e=null;return{mark:t=>{const n=t.composedPath();e=n,setTimeout(()=>{e===n&&(e=null)},0)},landedOn:t=>e?.includes(t)===!0}},Ze=e=>typeof e=="string"?JSON.stringify(e):String(e),At=(e,t)=>{if(typeof t!="number"||!Number.isFinite(t)||t<=0)throw new RangeError(`[directory-tree] visual.${e} must be a finite number greater than 0 (px); got ${Ze(t)}.`);return t},Ur=e=>{if(typeof e=="string"&&e.trim()!==""||typeof e=="number"&&Number.isFinite(e)&&e>0)return e;throw new RangeError(`[directory-tree] visual.fontSize must be a finite number greater than 0 (px) or a CSS font size that is not blank; got ${Ze(e)}.`)},Jr=({indentSize:e,typeIconSize:t,fontSize:n})=>({indentSize:e===void 0?Rr:At("indentSize",e),typeIconSize:t===void 0?Ir:At("typeIconSize",t),fontSize:n===void 0?void 0:Ur(n)}),qr=({indentSize:e,removeRootIndent:t,hasExpandBox:n})=>t?Math.max(0,e-(n?ce:0)):0,Zr=(e,t,n)=>{if(typeof e!="function")return At("itemHeight",e);const r=e(t,n);if(typeof r!="number"||!Number.isFinite(r)||r<=0)throw new RangeError(`[directory-tree] visual.itemHeight returned ${Ze(r)} for ${JSON.stringify(t.absolutePath)} (row ${n}); it must return a finite number greater than 0 (px).`);return r},Qr=(e,t,n)=>{const r=t===void 0?xr:t;if(typeof r!="number"||!Number.isFinite(r)||r<=0||r>ce)throw new RangeError(`[directory-tree] visual.expandIconSize must be a finite number greater than 0 and at most ${ce} (the expand box, px) while tree lines are drawn; got ${Ze(r)}.`);const{indentSize:a,typeIconSize:i}=e,c=r/2,d=ce+i-r/2;if(a<c||a>d)throw new RangeError(`[directory-tree] visual.indentSize ${Ze(a)} does not fit the tree lines: with typeIconSize ${i} and an expand glyph of ${r} px it must be from ${c} (half the glyph) to ${d} (the ${ce} px expand box + typeIconSize โˆ’ half the glyph).`);return{indentSize:a,typeIconSize:i,glyphSize:r,originX:n}},eo=({indentSize:e,typeIconSize:t,glyphSize:n})=>Math.min(Math.max(ce+t/2-e,n/2),ce-n/2),to=(e,t)=>{const n=e.length-1;if(n<=0)return 0;let r=0,a=n-1,i=0;for(;r<=a;){const c=r+a>>>1;e[c]<=t?(i=c,r=c+1):a=c-1}return i},no=(e,t,n)=>{if(n<=0||e.length===0||t.length!==e.length+1)return null;const r=to(t,n),a=e[r];return a?{path:a.entry.absolutePath,offsetInViewport:n-t[r]}:null},ro=(e,t,n)=>{if(t.length===0||n.length!==t.length+1)return null;for(let r=0;r<t.length;r++)if(t[r].entry.absolutePath===e.path)return Math.max(0,n[r]+e.offsetInViewport);return null},oo=(e,t,n)=>{const r=[];for(let a=t;a<n;a++){const i=e[a];if(!(!i||i.length===0))for(const c of i)r.push(c)}return r},so=(e,t,n)=>{const r=[];for(let a=t;a<n;a++){const i=e[a];if(!(!i||i.length===0))for(const c of i)r.push(c)}return r},ao=(e,t,n,r)=>{const a=Math.max(1,Math.floor(t*r)),i=Math.max(1,Math.floor(n*r));(e.width!==a||e.height!==i)&&(e.width=a,e.height=i);const c=e.style;c.width!==`${t}px`&&(c.width=`${t}px`),c.height!==`${n}px`&&(c.height=`${n}px`)},lo=(e,t,n)=>{e.lineWidth=n,e.beginPath();for(const r of t)e.moveTo(r.x1,r.y1),e.lineTo(r.x2,r.y2);e.stroke()},io=(e,t,n,r)=>{if(t.length===0)return;const a=e.strokeStyle,i=e.lineWidth,c=e.lineCap,d=e.lineJoin;e.strokeStyle=n,e.lineCap="round",e.lineJoin="round";for(const m of t){const S=r??m.size,T=Math.max(0,S/2),x=Math.max(1,Math.round(S*.08)),_=Math.max(1,Math.round(S*.14)),p=Math.max(0,T-x*.8),g=Math.max(0,p*.55);e.lineWidth=x,e.beginPath(),e.arc(m.centerX,m.centerY,Math.max(0,T-x*.3),0,Math.PI*2),e.stroke(),e.lineWidth=_,e.beginPath(),e.moveTo(m.centerX-g,m.centerY),e.lineTo(m.centerX+g,m.centerY),e.stroke(),m.isExpanded||(e.beginPath(),e.moveTo(m.centerX,m.centerY-g),e.lineTo(m.centerX,m.centerY+g),e.stroke())}e.strokeStyle=a,e.lineWidth=i,e.lineCap=c,e.lineJoin=d},er=l.memo(({segmentsByItem:e,glyphsByItem:t,itemHeight:n,width:r,viewportHeight:a,scrollPosition:i,color:c=jn,strokeWidth:d=1,renderStartIndex:m,renderEndIndex:S,lookaheadEndIndex:T,devicePixelRatio:x,expandGlyphColor:_,expandGlyphSize:p})=>{const g=l.useRef(null),y=l.useRef(null),E=l.useRef({segmentsByItem:e,glyphsByItem:t,itemHeight:n,width:r,viewportHeight:a,scrollPosition:i,color:c,strokeWidth:d,renderStartIndex:m,renderEndIndex:S,lookaheadEndIndex:T,devicePixelRatio:x,expandGlyphColor:_,expandGlyphSize:p}),v=l.useCallback(()=>{y.current=null;const N=g.current;if(!N)return;const P=N.getContext("2d");if(!P)return;const b=E.current;if(b.width<=0||b.viewportHeight<=0){P.clearRect(0,0,N.width,N.height);return}const M=Number.isFinite(b.devicePixelRatio??NaN)?b.devicePixelRatio:typeof window<"u"&&window.devicePixelRatio||1;ao(N,b.width,b.viewportHeight,M);const D=b.segmentsByItem.length,O=typeof b.renderStartIndex=="number"&&Number.isFinite(b.renderStartIndex)?Math.max(0,Math.floor(b.renderStartIndex)):Math.max(0,Math.floor(b.scrollPosition/b.itemHeight)),q=Math.min(D,Math.ceil((b.scrollPosition+b.viewportHeight)/b.itemHeight)),K=(()=>{if(typeof b.renderEndIndex=="number"&&Number.isFinite(b.renderEndIndex)){const B=Math.floor(b.renderEndIndex);return Math.max(Math.min(D,B+1),O)}return Math.max(q,O)})(),F=(()=>{if(typeof b.lookaheadEndIndex=="number"&&Number.isFinite(b.lookaheadEndIndex)){const B=Math.floor(b.lookaheadEndIndex),ne=Math.min(D,B+1);return Math.max(ne,K)}return Math.max(q,K)})(),H=oo(b.segmentsByItem,O,F),fe=so(b.glyphsByItem,O,F);P.save(),P.scale(M,M),P.clearRect(0,0,b.width,b.viewportHeight),P.translate(0,-b.scrollPosition),P.strokeStyle=b.color,lo(P,H,b.strokeWidth),io(P,fe,b.expandGlyphColor??b.color,b.expandGlyphSize),P.restore()},[]),$=l.useCallback(()=>{y.current===null&&(y.current=window.requestAnimationFrame(v))},[v]);return l.useEffect(()=>{E.current={segmentsByItem:e,glyphsByItem:t,itemHeight:n,width:r,viewportHeight:a,scrollPosition:i,color:c,strokeWidth:d,renderStartIndex:m,renderEndIndex:S,lookaheadEndIndex:T,devicePixelRatio:x,expandGlyphColor:_,expandGlyphSize:p},$()},[e,t,n,r,a,i,c,d,m,S,T,x,_,p,$]),l.useEffect(()=>()=>{y.current!==null&&(window.cancelAnimationFrame(y.current),y.current=null)},[]),h.jsx("canvas",{ref:g,className:"pointer-events-none absolute top-0 left-0 z-0"})});er.displayName="TreeLineCanvas";const co=e=>{const t=new Map;for(let n=0;n<e.length;n++){const r=e[n].entry.absolutePath;t.has(r)||t.set(r,n)}return t},Nn=(e,t)=>e.selectedPath===t?e:{selectedPath:t,selectionGeneration:e.selectionGeneration+1,anchor:e.anchor},uo=(e,t)=>({...e,anchor:{path:t,selectionGeneration:e.selectionGeneration,focused:!0}}),fo=(e,t)=>{const{anchor:n,selectionGeneration:r,selectedPath:a}=t;if(n!==null&&(n.focused||n.selectionGeneration===r)){const i=e.get(n.path);if(i!==void 0)return i}if(a!==null){const i=e.get(a);if(i!==void 0)return i}return 0},ho={msOverflowStyle:"none",scrollbarWidth:"none"},mo=()=>{let e=document.getElementById("directory-tree-webkit-scrollbar-hide");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))},po=e=>{const t=l.useRef(null),n=t.current;return n!==null&&ye.VIRTUAL_SCROLL_LABEL_KEYS.every(r=>n[r]===e[r])?n:(t.current=e,e)},Pn=new Set(["top","bottom","center","nearest"]),On=e=>{const t=e?.align;if(t===void 0)return"top";if(!Pn.has(t))throw new RangeError(`[directory-tree] Unsupported scroll alignment ${JSON.stringify(t)}; expected one of ${[...Pn].join(", ")}.`);return t},yo={position:"absolute",width:1,height:1,margin:-1,padding:0,border:0,overflow:"hidden",clipPath:"inset(50%)",whiteSpace:"nowrap"},go=(e,t,n,r,a)=>{const i=[],c=[];let d=0;const m=(S,T,x)=>{const _=a?[...S].sort(a):S;for(let p=0;p<_.length;p++){const g=_[p],y=p===_.length-1,E=[...x,y],v=g.children!==void 0,$=v&&t(g.absolutePath,g.relativePath);let N=T,P=x;r&&(N=T-1,P=x.slice(1)),i.push({entry:g,indentLevel:N,depth:T,positionInSet:p+1,setSize:_.length}),n&&(N>d&&(d=N),c.push({id:g.absolutePath,name:g.name,absolutePath:g.absolutePath,indentLevel:N,isLastChild:y,isDirectory:v,isExpanded:$,ancestorIsLast:[...P],hideLines:r&&T===0})),v&&$&&g.children&&m(g.children,T+1,E)}};return m(e,0,[]),{flatItems:i,lineItems:c,maxIndent:d}},Ln=(e,t)=>{const n=e.length-1;if(n<=0)return 0;let r=0,a=n-1,i=0;for(;r<=a;){const c=r+a>>>1;e[c]<=t?(i=c,r=c+1):a=c-1}return i},bo=(e,t,n,r,a,i)=>{const c=r?.renderStart??Math.max(0,Ln(i,a)),d=t>0?Ln(i,a+t)+n:c+n,m=e>0?Math.min(e-1,Math.max(c,d)):c,S=r?.renderEnd??m,T=e>0?Math.min(e-1,S+n):S;return{renderStart:c,renderEnd:S,lookaheadEnd:T}},So=(e,t,n,r)=>{if(e.length===0)return{segmentsByItem:[],glyphsByItem:[]};const{indentSize:a,typeIconSize:i,glyphSize:c,originX:d}=r,m=Array.from({length:e.length},()=>[]),S=Array.from({length:e.length},()=>[]),T=d+eo(r),x=p=>p*a+T,_=c/2+2;for(let p=0;p<e.length;p++){const g=e[p],y=t[p]??0,E=n[p]??0,v=E+y/2,$=e[p+1],N=v+i/2,P=E+y,b=$!==void 0&&$.indentLevel===g.indentLevel+1&&N<P?{key:`${g.id}-connector-children`,x1:x($.indentLevel),y1:N,x2:x($.indentLevel),y2:P,itemIndex:p}:null;if(g.hideLines){b!==null&&(m[p]=[b]);continue}const M=[];for(let O=0;O<g.indentLevel;O++){if(g.ancestorIsLast[O]??!1)continue;let K=!1;for(let F=p;F<e.length;F++){const H=e[F];if(H.indentLevel>O&&H.ancestorIsLast.length>O&&!H.ancestorIsLast[O]){K=!0;break}if(F>p&&H.indentLevel===O)break}if(K){const F=x(O);M.push({key:`${g.id}-ancestor-${O}`,x1:F,y1:E,x2:F,y2:E+y,itemIndex:p})}}const D=x(g.indentLevel);p>0&&M.push({key:`${g.id}-connector-top`,x1:D,y1:E,x2:D,y2:g.isDirectory?v-_:v,itemIndex:p}),!g.isDirectory&&g.isLastChild&&M.push({key:`${g.id}-connector-horizontal`,x1:D,y1:v,x2:d+g.indentLevel*a+ce,y2:v,itemIndex:p}),g.isLastChild||(g.isDirectory?M.push({key:`${g.id}-connector-bottom`,x1:D,y1:v+_,x2:D,y2:E+y,itemIndex:p}):M.push({key:`${g.id}-connector-bottom`,x1:D,y1:v,x2:D,y2:E+y,itemIndex:p})),b!==null&&M.push(b),m[p]=M,g.isDirectory&&(S[p]=[{key:`${g.id}-glyph`,itemIndex:p,centerX:D,centerY:v,size:c,isExpanded:g.isExpanded}])}return{segmentsByItem:m,glyphsByItem:S}},tr=l.memo(({entry:e,indentLevel:t,originX:n,depth:r,positionInSet:a,setSize:i,isSelectedForAria:c,flatIndex:d,isActive:m,registerRowRef:S,onNavigationKeyDown:T,onRowFocus:x,onRowBlur:_,rowHeight:p,entryKindDirectory:g,entryKindFile:y,isDirOpen:E,expansion:{toggleDirectory:v,onToggleDirectoryRecursive:$},selection:{onEntryClick:N,selectedPath:P,currentPath:b,mode:M="none",selectedItems:D,onSelectionChange:O},visual:{iconOverrides:q,showExpandIcons:K=!0,showDirectoryIcons:F=!0,showFileIcons:H=!0,useCanvasExpandIcons:fe=!1,expandIconSize:B,typeIconSize:ne,fontSize:he,indentSize:Y,highlightStyles:G,entryClassName:Ee,entryStyle:ge,nameClassName:o,nameStyle:f,directoryNameClassName:k,directoryNameStyle:R,fileNameClassName:be,fileNameStyle:C,expandIconClassName:L,expandIconStyle:Z}})=>{We(e.style,{option:"entry.style",absolutePath:e.absolutePath});const[me,ke]=l.useState(!1),j=e.children!==void 0,Se=j&&E(e.absolutePath),U=e.absolutePath===P,Ae=e.absolutePath===b,re=!j&&D?.has(e.absolutePath),Q=l.useCallback(ee=>S(d,ee),[S,d]),se=j?void 0:Dn(e),Ce=Yn({entry:e,isDirectory:j,isExpanded:Se,isItemSelected:!!re,selectionMode:M,onSelectionChange:O,onEntryClick:N,toggleDirectory:v,onToggleDirectoryRecursive:$}),Pe=me?G?.hoverClassName!==void 0?G.hoverClassName:A.entryHover:"",Te=(()=>{if(j){if(U)return G?.directorySelectedClassName!==void 0?G.directorySelectedClassName:A.entrySelected}else if(U||re)return G?.itemSelectedClassName!==void 0?G.itemSelectedClassName:X.twMerge(U&&A.entrySelected,re&&A.entryItemSelected);return""})(),Me=X.twMerge(A.entry,Pe,Te,Ee,e.className),Re=X.twMerge(A.expandIcon,L,(U||re)&&A.expandIconSelected),W=X.twMerge(A.typeIcon,(U||re)&&A.typeIconSelected),Ye=X.twMerge(A.name,o,j&&A.nameDirectory,j&&k,!j&&be,(U||re)&&A.nameSelected),Qe=$n({isDirectory:j,isExpanded:Se,showExpandIcons:K&&t>=0,useCanvasExpandIcons:fe,expandIconSize:B}),ht=(j?F:H)?Fn({entry:e,isDirectory:j,isExpanded:Se,isSelected:U,isItemSelected:!!re,extension:se,mimeType:e.mimeType},q,ne):null,Ge={...me?G?.hoverStyle:{},...j&&U?G?.directorySelectedStyle:{},...!j&&(U||re)?G?.itemSelectedStyle:{}},Ve=zn(e.data),et={width:ne,height:ne},tt=Mn(he),ve=n+t*Y;return h.jsxs("div",{className:Me,style:{...tt,...Ge,...ge,...e.style,paddingLeft:`${Math.max(0,ve)}px`,transform:ve<0?`translateX(${ve}px)`:void 0,width:ve<0?`calc(100% + ${-ve}px)`:void 0,height:`${p}px`},...Ve,"data-entry-type":j?"directory":"file","data-entry-expanded":j?String(Se):void 0,"data-entry-selected":U?"true":void 0,"data-entry-item-selected":re?"true":void 0,onClick:Ce,onMouseEnter:()=>ke(!0),onMouseLeave:()=>ke(!1),onFocus:ee=>x(d,e.absolutePath,ee.currentTarget),onBlur:ee=>_(e.absolutePath,ee.currentTarget),ref:Q,onKeyDown:ee=>{if(ee.key==="Enter"||ee.key===" "){ee.preventDefault(),ee.repeat||Ce(ee);return}T(ee,d)},tabIndex:m?0:-1,role:"treeitem","aria-expanded":j?Se:void 0,"aria-level":r+1,"aria-posinset":a,"aria-setsize":i,"aria-selected":M==="none"?void 0:c,"aria-current":Ae?"page":void 0,"aria-label":`${e.name} (${j?g:y})`,children:[(K||fe)&&h.jsx("span",{className:Re,style:{...Z,width:ce,height:ce},children:Qe}),(j?F:H)&&h.jsx("span",{className:W,style:et,children:ht}),h.jsx("span",{className:Ye,style:{...tt,...f,...j?R:C},"data-entry-type":j?"directory":"file","data-entry-role":"name",children:e.label??e.name})]})},(e,t)=>{if(e.entry!==t.entry)return!1;const n=e.entry.children!==void 0,r=t.entry.children!==void 0,a=n&&e.isDirOpen(e.entry.absolutePath),i=r&&t.isDirOpen(t.entry.absolutePath);return e.indentLevel===t.indentLevel&&e.originX===t.originX&&e.depth===t.depth&&e.positionInSet===t.positionInSet&&e.setSize===t.setSize&&e.isSelectedForAria===t.isSelectedForAria&&e.flatIndex===t.flatIndex&&e.isActive===t.isActive&&e.rowHeight===t.rowHeight&&e.entryKindDirectory===t.entryKindDirectory&&e.entryKindFile===t.entryKindFile&&a===i&&e.selection.selectedPath===t.selection.selectedPath&&e.selection.currentPath===t.selection.currentPath&&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.typeIconSize===t.visual.typeIconSize&&e.visual.fontSize===t.visual.fontSize&&e.visual.indentSize===t.visual.indentSize&&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.visual.expandIconClassName===t.visual.expandIconClassName&&e.visual.expandIconStyle===t.visual.expandIconStyle});tr.displayName="DirectoryEntryItem";const nr=e=>{const t=[];if(e.children)for(const n of e.children)n.type==="directory"&&(t.push(n.absolutePath),t.push(...nr(n)));return t},vo=({entries:e,expansion:{toggle:t,isExpanded:n,expandMultiple:r,collapseMultiple:a,isPending:i,alwaysExpanded:c=!1,doubleClickAction:d="recursive"},selection:{onEntryClick:m,selectedPath:S,currentPath:T,mode:x="none",selectedItems:_,onSelectionChange:p},visual:{className:g,style:y,ariaLabel:E,ariaLabelledBy:v,lineColor:$=jn,showTreeLines:N=!0,showExpandIcons:P=!0,showDirectoryIcons:b=!0,showFileIcons:M=!0,iconOverrides:D,expandIconSize:O,typeIconSize:q,fontSize:K,indentSize:F,itemHeight:H=_t,removeRootIndent:fe=!1,highlightStyles:B,entryClassName:ne,entryStyle:he,nameClassName:Y,nameStyle:G,directoryNameClassName:Ee,directoryNameStyle:ge,fileNameClassName:o,fileNameStyle:f,expandIconClassName:k,expandIconStyle:R}={},virtualScroll:be,grid:C,sort:L,locale:Z,labels:me,ref:ke})=>{const j=ye.resolveVirtualScrollLocale(Z),Se=l.useMemo(()=>Qn(Z,me),[Z,me]),U=po(Xr(Se)),{entryKindDirectory:Ae,entryKindFile:re}=Se,Q=l.useMemo(()=>Jr({indentSize:F,typeIconSize:q,fontSize:K}),[F,q,K]);l.useMemo(()=>{We(he,{option:"visual.entryStyle"}),We(B?.hoverStyle,{option:"visual.highlightStyles.hoverStyle"}),We(B?.directorySelectedStyle,{option:"visual.highlightStyles.directorySelectedStyle"}),We(B?.itemSelectedStyle,{option:"visual.highlightStyles.itemSelectedStyle"}),$r(R,{option:"visual.expandIconStyle"})},[he,B,R]);const se=C!==void 0,[Ce,Pe]=l.useState(!1),Te=l.useRef(null),Me=l.useRef(null),Re=l.useRef(null),[W,Ye]=l.useState(0),[Qe,ht]=l.useState(0),[Ge,Ve]=l.useState(0),[et,tt]=l.useState(null),{overscanCount:ve=15,className:ee,background:Dt,onScroll:$t,onRangeChange:Ft,onScrollAdjust:zt,liveRegion:Bt,initialScrollIndex:Ht,initialScrollOffset:De,initialScrollAnchor:Wt,callbackThrottleMs:Yt=5,contentInsets:Gt,onItemFocus:Vt,viewportHeightOverride:ae,scrollBarOptions:mt,behaviorOptions:Xt,preserveScrollAnchor:Kt=!1,getItemKey:rr,testId:Ut,contentProps:pt}=be??{},Jt=l.useMemo(()=>se?{...pt,role:"rowgroup"}:{...pt,role:"tree","aria-label":v?void 0:E,"aria-labelledby":v,"aria-multiselectable":x==="multiple"?!0:void 0,"aria-busy":i?!0:void 0},[se,pt,E,v,x,i]),qt=l.useMemo(()=>({...Xt,enableKeyboardNavigation:!1}),[Xt]),[nt,Zt]=l.useState(typeof De=="number"?De:0),yt=l.useRef(typeof De=="number"?De:0),Qt=l.useCallback((s,u)=>{yt.current=s,Zt(s),$t?.(s,u)},[$t]),en=l.useCallback(s=>{const{renderingStartIndex:u,renderingEndIndex:w}=s;tt(I=>I&&I.renderStart===u&&I.renderEnd===w?I:{renderStart:u,renderEnd:w}),Ft?.(s)},[Ft]);l.useEffect(()=>{Pe(!0),mo()},[]),l.useEffect(()=>{const s=Te.current,u=se?Me.current:s,w=()=>{if(s){const z=s.clientWidth;ht(J=>Math.abs(J-z)>1?z:J)}if(typeof ae=="number")Ye(z=>Math.abs(z-ae)>1?ae:z);else if(u){const z=u.clientHeight;Ye(J=>Math.abs(J-z)>1?z:J)}};if(!(s||u))return Ye(0);w();const I=new ResizeObserver(w);return s&&I.observe(s),u&&u!==s&&I.observe(u),()=>I.disconnect()},[ae,se]);const $e=typeof ae=="number"?ae:W,we=l.useCallback(s=>c||(Ce?n(s):!1),[Ce,n,c]),tn=X.twMerge(A.container,i&&A.containerPending,g),nn=l.useMemo(()=>({...ho,...y??{},...typeof ae=="number"?{height:ae,minHeight:ae}:{}}),[y,ae]),gt=l.useCallback((s,u)=>{const w=[s.absolutePath,...nr(s)],I=u||d;if(w.every(Ie=>we(Ie)))return a(w);if(w.every(Ie=>!we(Ie))||I==="recursive")return r(w);if(I==="toggle")return a(w);console.warn(`[DirectoryTree] Unknown double click action: ${I}. No action taken.`)},[we,r,a,d]),bt=se?!1:fe,{flatItems:Oe,lineItems:St,maxIndent:rn}=l.useMemo(()=>go(e,we,N,bt,L),[e,we,N,bt,L]),rt=qr({indentSize:Q.indentSize,removeRootIndent:bt,hasExpandBox:P||N}),pe=l.useMemo(()=>N?Qr(Q,O,rt):null,[N,Q,O,rt]),V=l.useMemo(()=>Oe.map((s,u)=>({...s,rowHeight:Zr(H,s.entry,u)})),[Oe,H]),_e=l.useMemo(()=>V.map(s=>s.rowHeight),[V]),Le=l.useMemo(()=>{const s=new Array(_e.length+1);s[0]=0;for(let u=0;u<_e.length;u++)s[u+1]=s[u]+_e[u];return s},[_e]),on=l.useCallback(s=>V[s]?.rowHeight??_t,[V]),or=l.useCallback(s=>V[s]?.entry.absolutePath??s,[V]),sn=rr??or,Fe=S??null,vt=T??null,[an,Xe]=l.useState(()=>({selectedPath:Fe,selectionGeneration:0,anchor:null})),wt=Nn(an,Fe);wt!==an&&Xe(s=>Nn(s,Fe));const ot=l.useMemo(()=>co(Oe),[Oe]),ze=l.useMemo(()=>fo(ot,wt),[ot,wt]),Ke=l.useRef(new Map),st=l.useRef(null),[at]=l.useState(Kr),Ue=l.useRef(null),[sr,ln]=l.useState(!0),Et=l.useRef(Oe);Et.current=Oe;const cn=l.useRef(we);cn.current=we;const Rt=l.useRef(t);Rt.current=t;const un=l.useRef(ot);un.current=ot;const xt=l.useRef(ze);xt.current=ze;const dn=l.useRef(Vt);dn.current=Vt;const je=l.useCallback(s=>{const u=Re.current;return!u||u.getViewportSize()<=0?!1:(u.scrollToIndex(s,{align:"nearest"}),!0)},[]),xe=l.useCallback(s=>{const u=Ke.current.get(s);if(u===void 0){Ue.current=s,je(s)||(Ue.current=null);return}Ue.current=null,je(s),u.focus({preventScroll:!0})},[je]),fn=l.useCallback((s,u)=>{if(u)Ke.current.set(s,u),Ue.current===s?(Ue.current=null,u.focus({preventScroll:!0})):u.contains(u.ownerDocument.activeElement)&&Xe(w=>w.anchor===null?w:{...w,anchor:{...w.anchor,focused:!0}});else{const w=Ke.current.get(s);Ke.current.delete(s),w?.contains(w.ownerDocument.activeElement)&&Xe(I=>I.anchor===null?I:{...I,anchor:{...I.anchor,focused:!1}})}s===xt.current&&ln(u!==null)},[]);l.useLayoutEffect(()=>{ln(Ke.current.has(ze))},[ze]);const It=l.useCallback((s,u,w)=>{const I=st.current===w;st.current=null,I||(Xe(z=>uo(z,u)),at.landedOn(w)||je(s)),dn.current?.(s)},[je,at]),lt=l.useCallback(s=>at.mark(s.nativeEvent),[at]),kt=l.useCallback((s,u)=>{const{ownerDocument:w}=u;if(!w.hasFocus()&&u.contains(w.activeElement)){st.current=u;return}st.current=null,Xe(I=>I.anchor!==null&&I.anchor.path===s?{...I,anchor:{...I.anchor,focused:!1}}:I)},[]),ar=l.useCallback(()=>xe(xt.current),[xe]),Ct=l.useCallback((s,u)=>{const w=On(u),I=Et.current.length;if(!Number.isInteger(s)||s<0||s>=I)throw new RangeError(`[directory-tree] scrollToIndex: ${String(s)} is not a row index (${I===0?"the tree has no rows":`expected an integer in 0..${String(I-1)}`}).`);if(w==="nearest"){je(s);return}Re.current?.scrollToIndex(s,{align:w})},[je]);l.useImperativeHandle(ke,()=>({scrollToIndex:Ct,scrollToPath:(s,u)=>{On(u);const w=un.current.get(s);return w===void 0?!1:(Ct(w,u),!0)},getScrollAnchor:()=>Re.current?.getScrollAnchor()??null}),[Ct]);const hn=l.useCallback((s,u)=>{if(s.altKey||s.ctrlKey||s.metaKey)return;const w=Et.current,I=w.length-1;if(I<0)return;const z=w[u],J=z?.entry.children!==void 0,Ie=J&&cn.current(z.entry.absolutePath);switch(s.key){case"ArrowDown":s.preventDefault(),xe(Math.min(u+1,I));break;case"ArrowUp":s.preventDefault(),xe(Math.max(u-1,0));break;case"Home":s.preventDefault(),xe(0);break;case"End":s.preventDefault(),xe(I);break;case"ArrowRight":s.preventDefault(),J&&!Ie?Rt.current(z.entry.absolutePath):J&&u<I&&w[u+1].depth>z.depth&&xe(u+1);break;case"ArrowLeft":{if(s.preventDefault(),J&&Ie){Rt.current(z.entry.absolutePath);break}const dr=z?.depth??0;for(let dt=u-1;dt>=0;dt--)if(w[dt].depth<dr){xe(dt);break}break}}},[xe]),it=l.useMemo(()=>pe===null||St.length===0?{segmentsByItem:[],glyphsByItem:[]}:So(St,_e,Le,pe),[St,_e,Le,pe]),ct=l.useMemo(()=>pe===null||e.length===0?0:pe.originX+rn*pe.indentSize+ce+pe.typeIconSize,[e.length,rn,pe]),{renderStart:mn,renderEnd:pn,lookaheadEnd:yn}=l.useMemo(()=>bo(V.length,$e,ve,et,nt,Le),[V.length,$e,ve,et,nt,Le]),Tt=l.useMemo(()=>pe===null||ct<=0||$e<=0||it.segmentsByItem.length===0?null:h.jsx("div",{className:"pointer-events-none absolute inset-0 z-1","aria-hidden":"true",children:h.jsx("div",{className:"absolute top-0 left-0",style:{width:ct,height:$e},children:h.jsx(er,{segmentsByItem:it.segmentsByItem,glyphsByItem:it.glyphsByItem,itemHeight:_e[0]??_t,width:ct,viewportHeight:$e,scrollPosition:nt,color:$,expandGlyphColor:$,expandGlyphSize:pe.glyphSize,renderStartIndex:mn,renderEndIndex:pn,lookaheadEndIndex:yn})})}),[ct,$e,mn,pn,yn,nt,it,$,pe,_e]),gn=l.useCallback(s=>V[s],[V]),bn=l.useRef(null);l.useLayoutEffect(()=>{const s=bn.current;if(bn.current={items:V,offsets:Le},!Kt||!s||s.items===V)return;const u=Re.current,w=u?.getScrollPosition(),I=typeof w=="number"&&w>=0?w:yt.current,z=no(s.items,s.offsets,I);if(!z)return;const J=ro(z,V,Le);if(J===null||Math.abs(J-I)<1)return;const Ie=u?u.scrollTo(J):J;yt.current=Ie,Zt(Ie)},[V,Le,Kt]);const Ne=C?.columns,Be=C?.scrollBarWidth??mt?.width??Jn,te=l.useMemo(()=>Ne?Yr({measuredWidth:Qe,columns:Ne,scrollBarWidth:Be}):null,[Ne,Qe,Be]),ut=l.useMemo(()=>Ne?Wr(Ne):"",[Ne]),lr=l.useMemo(()=>C?.showFooter&&Ne?Gr(e):[],[C?.showFooter,Ne,e]),He=te?.maxHScroll??0;l.useEffect(()=>{Ve(s=>Nt(s,He))},[He]);const Sn=l.useCallback(s=>Ve(u=>Nt(u+s,He)),[He]),vn=l.useMemo(()=>({iconOverrides:D,showExpandIcons:P,showDirectoryIcons:b,showFileIcons:M,useCanvasExpandIcons:N,expandIconSize:O,typeIconSize:Q.typeIconSize,fontSize:Q.fontSize,indentSize:Q.indentSize,highlightStyles:B,expandIconClassName:k,expandIconStyle:R}),[D,P,b,M,N,O,Q,B,k,R]),wn=l.useMemo(()=>h.jsx(ye.VirtualScroll,{ref:Re,itemCount:V.length,getItem:gn,getItemHeight:on,getItemKey:sn,testId:Ut,contentProps:Jt,locale:j,labels:U,viewportSize:typeof ae=="number"?ae:void 0,overscanCount:ve,onScroll:Qt,onRangeChange:en,onScrollAdjust:zt,liveRegion:Bt,className:ee,onWheelHorizontal:se?Sn:void 0,background:h.jsxs(h.Fragment,{children:[se&&te?h.jsx("div",{className:"pointer-events-none absolute top-0 left-0 z-1 h-full overflow-hidden",style:{width:te.nameWidth},"aria-hidden":"true",children:Tt}):Tt,Dt]}),initialScrollIndex:Ht,initialScrollOffset:De,initialScrollAnchor:Wt,callbackThrottleMs:Yt,contentInsets:Gt,scrollBarOptions:mt,behaviorOptions:qt,children:(s,u)=>s?se&&C&&te?h.jsx(Xn,{entry:s.entry,indentLevel:s.indentLevel,positionInSet:s.positionInSet,setSize:s.setSize,rowIndex:u+(C.showHeader??!0?2:1),flatIndex:u,onRowFocus:It,onRowBlur:kt,isSelectedForAria:!!_?.has(s.entry.absolutePath),rowHeight:s.rowHeight,isDirOpen:we,columns:C.columns,numericTemplate:ut,numericTotal:te.numericTotal,nameWidth:te.nameWidth,rowClassName:C.rowClassName,selection:{onEntryClick:m,selectedPath:Fe,currentPath:vt,mode:x,selectedItems:_,onSelectionChange:p},expansion:{toggleDirectory:t,onToggleDirectoryRecursive:gt},visual:vn},s.entry.absolutePath):h.jsx(tr,{entry:s.entry,indentLevel:s.indentLevel,originX:rt,depth:s.depth,positionInSet:s.positionInSet,setSize:s.setSize,isSelectedForAria:!!_?.has(s.entry.absolutePath),flatIndex:u,isActive:u===ze,registerRowRef:fn,onNavigationKeyDown:hn,onRowFocus:It,onRowBlur:kt,rowHeight:s.rowHeight,entryKindDirectory:Ae,entryKindFile:re,isDirOpen:we,expansion:{toggleDirectory:t,onToggleDirectoryRecursive:gt},selection:{onEntryClick:m,selectedPath:Fe,currentPath:vt,mode:x,selectedItems:_,onSelectionChange:p},visual:{iconOverrides:D,showExpandIcons:P,showDirectoryIcons:b,showFileIcons:M,useCanvasExpandIcons:N,expandIconSize:O,typeIconSize:Q.typeIconSize,fontSize:Q.fontSize,indentSize:Q.indentSize,highlightStyles:B,entryClassName:ne,entryStyle:he,nameClassName:Y,nameStyle:G,directoryNameClassName:Ee,directoryNameStyle:ge,fileNameClassName:o,fileNameStyle:f,expandIconClassName:k,expandIconStyle:R}},s.entry.absolutePath):null}),[V.length,gn,on,sn,Ut,Jt,j,U,Ae,re,ze,fn,hn,It,kt,ae,ve,Qt,en,zt,Bt,ee,se,Sn,te,Tt,Dt,Ht,De,Wt,Yt,Gt,mt,qt,C,ut,we,m,Fe,vt,x,_,p,t,gt,vn,D,P,b,M,N,O,Q,rt,B,ne,he,Y,G,Ee,ge,o,f,k,R]);if(!(C&&te))return h.jsxs("div",{ref:Te,className:tn,style:nn,onPointerDownCapture:lt,onMouseDownCapture:lt,children:[Oe.length>0&&!sr&&h.jsx("span",{tabIndex:0,"data-directory-tree-tab-stop":"",style:yo,onFocus:ar}),wn]});const ir=C.showHeader??!0,cr=C.showFooter??!1,ur={...nn,"--dt-hscroll":`${Ge}px`};return h.jsxs("div",{ref:Te,className:X.twMerge(tn,"dt-grid"),style:ur,role:"treegrid","aria-label":v?void 0:E,"aria-labelledby":v,"aria-multiselectable":x==="multiple"?!0:void 0,"aria-busy":i?!0:void 0,"aria-rowcount":V.length+(C.showHeader??!0?1:0),onPointerDownCapture:lt,onMouseDownCapture:lt,children:[ir&&h.jsx("div",{role:"rowgroup",children:h.jsx(zr,{columns:C.columns,numericTemplate:ut,numericTotal:te.numericTotal,nameWidth:te.nameWidth,scrollBarWidth:Be,className:C.headerClassName})}),h.jsx("div",{ref:Me,className:"dt-grid-body",children:wn}),He>0&&h.jsxs("div",{className:"dt-grid-hscrollbar-row",children:[h.jsx("div",{className:"dt-grid-scrollbar-spacer",style:{width:te.nameWidth},"aria-hidden":"true"}),h.jsx(ye.ScrollBar,{horizontal:!0,contentSize:te.numericTotal,viewportSize:te.numericVisible,scrollPosition:Ge,scrollBarWidth:Be,locale:j,labels:U,onScroll:s=>{const u=typeof s=="function"?s(Ge):s,w=Nt(u,He);return Ve(w),w}}),h.jsx("div",{className:"dt-grid-scrollbar-spacer",style:{width:Be},"aria-hidden":"true"})]}),cr&&h.jsx("div",{role:"rowgroup",children:h.jsx(Br,{columns:C.columns,numericTemplate:ut,numericTotal:te.numericTotal,nameWidth:te.nameWidth,scrollBarWidth:Be,allEntries:lr,className:C.footerClassName})})]})},wo=({initialExpanded:e=new Set,storageKey:t}={})=>{const[n,r]=l.useTransition(),[a,i]=l.useState(()=>{if(typeof window<"u"&&t)try{const y=window.localStorage.getItem(t);if(y){const E=JSON.parse(y);return new Set(E)}}catch(y){console.error("[useDirectoryTreeState] Error reading from localStorage",y)}return e}),c=l.useCallback(y=>{r(()=>{i(E=>{const v=new Set(E);return y(v),v})})},[]),d=l.useCallback((y,E)=>{c(v=>{for(const $ of y)E(v,$)})},[c]);l.useEffect(()=>{if(t&&typeof window<"u")try{window.localStorage.setItem(t,JSON.stringify(Array.from(a)))}catch(y){console.warn(`Error setting localStorage key "${t}":`,y)}},[a,t]);const m=l.useCallback(y=>{d([y],(E,v)=>{E.has(v)?E.delete(v):E.add(v)})},[d]),S=l.useCallback(y=>{d([y],(E,v)=>{E.add(v)})},[d]),T=l.useCallback(y=>{d([y],(E,v)=>{E.delete(v)})},[d]),x=l.useCallback(y=>{d(y,(E,v)=>{E.delete(v)})},[d]),_=l.useCallback(y=>{d(y,(E,v)=>{E.add(v)})},[d]),p=l.useCallback(()=>{c(y=>{y.clear()})},[c]),g=l.useCallback(y=>a.has(y),[a]);return{expanded:a,toggle:m,expand:S,collapse:T,collapseMultiple:x,expandMultiple:_,collapseAll:p,isExpanded:g,isPending:n}};exports.DIRECTORY_TREE_LABEL_CATALOGS=Zn;exports.DIRECTORY_TREE_LABEL_KEYS=Lt;exports.DirectoryTree=vo;exports.EXPAND_ICON_STYLE_PROPERTIES=Hn;exports.ROW_STYLE_PROPERTIES=Bn;exports.directoryTreeClasses=A;exports.resolveDirectoryTreeLabels=Qn;exports.useDirectoryTreeState=wo;