@vokril/ui-solid 0.19.0 → 0.20.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.
Files changed (87) hide show
  1. package/CHANGELOG.md +14 -0
  2. package/README.md +38 -2
  3. package/dist/createResizableSidebar-A0F4JmSU.js +472 -0
  4. package/dist/createResizableSidebar-DwCuRuho.cjs +1 -0
  5. package/dist/createVirtualWindow-9T5ZJCQR.cjs +1 -0
  6. package/dist/createVirtualWindow-Dqm5jxZa.js +117 -0
  7. package/dist/index.cjs +1 -1
  8. package/dist/index.js +108 -104
  9. package/dist/layout/createVirtualScroller.d.cts +8 -31
  10. package/dist/layout/createVirtualScroller.d.ts +8 -31
  11. package/dist/layout/createVirtualWindow.d.cts +64 -0
  12. package/dist/layout/createVirtualWindow.d.ts +64 -0
  13. package/dist/layout/index.cjs +1 -1
  14. package/dist/layout/index.d.cts +2 -0
  15. package/dist/layout/index.d.ts +2 -0
  16. package/dist/layout/index.js +7 -6
  17. package/dist/layout/virtualScrollerUtils.d.cts +58 -22
  18. package/dist/layout/virtualScrollerUtils.d.ts +58 -22
  19. package/dist/rowSource-BnUQ-LKT.cjs +1 -0
  20. package/dist/rowSource-CLEYuC95.js +1236 -0
  21. package/dist/server/createResizableSidebar-CZ0IGNm8.js +310 -0
  22. package/dist/server/createResizableSidebar-DDniLGSD.cjs +1 -0
  23. package/dist/server/createVirtualWindow-9T5ZJCQR.cjs +1 -0
  24. package/dist/server/createVirtualWindow-Dqm5jxZa.js +117 -0
  25. package/dist/server/index.cjs +1 -1
  26. package/dist/server/index.js +110 -106
  27. package/dist/server/layout/index.cjs +1 -1
  28. package/dist/server/layout/index.js +7 -6
  29. package/dist/server/rowSource-CdvoDIN7.cjs +1 -0
  30. package/dist/server/rowSource-D7lSI6LT.js +1122 -0
  31. package/dist/server/tree/index.cjs +1 -1
  32. package/dist/server/tree/index.js +11 -8
  33. package/dist/solid/layout/createVirtualScroller.js +17 -100
  34. package/dist/solid/layout/createVirtualWindow.js +129 -0
  35. package/dist/solid/layout/index.js +1 -0
  36. package/dist/solid/layout/virtualScrollerUtils.js +31 -32
  37. package/dist/solid/tree/TreeSurface.jsx +20 -13
  38. package/dist/solid/tree/createTreeController.js +110 -62
  39. package/dist/solid/tree/createTreeSurface.js +29 -12
  40. package/dist/solid/tree/index.js +1 -0
  41. package/dist/solid/tree/rowSource.js +93 -0
  42. package/dist/solid/tree/selectAllInScope.js +31 -25
  43. package/dist/solid/tree/stickyScroll.js +12 -10
  44. package/dist/solid/tree/treeAria.js +11 -30
  45. package/dist/solid/tree/treeKeymap.js +2 -24
  46. package/dist/solid/tree/viewportAnchor.js +23 -0
  47. package/dist/style.css +1 -1
  48. package/dist/tree/TreeStickyHeader.d.cts +1 -1
  49. package/dist/tree/TreeStickyHeader.d.ts +1 -1
  50. package/dist/tree/TreeSurface.d.cts +1 -1
  51. package/dist/tree/TreeSurface.d.ts +1 -1
  52. package/dist/tree/createTreeController.d.cts +19 -8
  53. package/dist/tree/createTreeController.d.ts +19 -8
  54. package/dist/tree/createTreeSurface.d.cts +8 -3
  55. package/dist/tree/createTreeSurface.d.ts +8 -3
  56. package/dist/tree/descriptor.d.cts +8 -9
  57. package/dist/tree/descriptor.d.ts +8 -9
  58. package/dist/tree/index.cjs +1 -1
  59. package/dist/tree/index.d.cts +1 -0
  60. package/dist/tree/index.d.ts +1 -0
  61. package/dist/tree/index.js +11 -8
  62. package/dist/tree/rowSource.d.cts +41 -0
  63. package/dist/tree/rowSource.d.ts +41 -0
  64. package/dist/tree/selectAllInScope.d.cts +20 -2
  65. package/dist/tree/selectAllInScope.d.ts +20 -2
  66. package/dist/tree/stickyScroll.d.cts +32 -5
  67. package/dist/tree/stickyScroll.d.ts +32 -5
  68. package/dist/tree/treeAria.d.cts +26 -10
  69. package/dist/tree/treeAria.d.ts +26 -10
  70. package/dist/tree/treeKeymap.d.cts +2 -16
  71. package/dist/tree/treeKeymap.d.ts +2 -16
  72. package/dist/tree/viewportAnchor.d.cts +21 -0
  73. package/dist/tree/viewportAnchor.d.ts +21 -0
  74. package/dist/ui.css +1 -1
  75. package/package.json +1 -1
  76. package/dist/createResizableSidebar-Dau7TIuH.cjs +0 -1
  77. package/dist/createResizableSidebar-gvf9me4K.js +0 -449
  78. package/dist/createVirtualScroller-CL49JE2P.cjs +0 -1
  79. package/dist/createVirtualScroller-vu-l4rVv.js +0 -93
  80. package/dist/descriptor-CaHgh9N_.cjs +0 -1
  81. package/dist/descriptor-eGtcBtpI.js +0 -1106
  82. package/dist/server/createResizableSidebar-BQG5elmd.js +0 -287
  83. package/dist/server/createResizableSidebar-tU8FO2MK.cjs +0 -1
  84. package/dist/server/createVirtualScroller-CL49JE2P.cjs +0 -1
  85. package/dist/server/createVirtualScroller-vu-l4rVv.js +0 -93
  86. package/dist/server/descriptor-CEGvvJZh.cjs +0 -1
  87. package/dist/server/descriptor-GLoKPx6x.js +0 -992
@@ -0,0 +1,1236 @@
1
+ import { createComponent as A, insert as R, effect as K, className as M, memo as j, spread as me, mergeProps as Se, setStyleProperty as X, template as P, use as ke, delegateEvents as Te, setAttribute as _e } from "solid-js/web";
2
+ import { createMemo as G, Show as H, For as Me, createEffect as ee, Index as xe, createSelector as Ee, createSignal as J, onCleanup as De, useContext as $e, untrack as Ke, on as Oe } from "solid-js";
3
+ import { VpLoader2 as Ge, VpChevronRight as He, VpSearch as Pe } from "@vokril/icons";
4
+ import { O as Le } from "./OverlayScrollArea-c8Za77qs.js";
5
+ import { t as Fe } from "./i18n-DW9kcu0G.js";
6
+ import { c as Ne } from "./errorHandler-BvPGW-Nm.js";
7
+ import { i as Ce, n as Be } from "./keys-B2nlkpqc.js";
8
+ import { a as Ue } from "./useListCommands-BO_XrRHj.js";
9
+ import { a as Qe } from "./builtins-XOM9gfIx.js";
10
+ import { S as se, c as We } from "./createVirtualWindow-Dqm5jxZa.js";
11
+ import { D as qe } from "./DesktopContextMenuContext-DJ3PnqAv.js";
12
+ import { B as ce } from "./bugIndicatingError-h3J5qkL6.js";
13
+ const be = {
14
+ canExpand: !0,
15
+ canMultiSelect: !0,
16
+ canTypeAhead: !0,
17
+ canRename: !1,
18
+ canDestroy: !1,
19
+ expandAll: !1
20
+ };
21
+ function Ie(e, n) {
22
+ return `${e}-row-${n}`;
23
+ }
24
+ function Ve(e) {
25
+ const { treeId: n, label: o, multiSelectable: t, focusMode: r, cursorKey: a } = e;
26
+ return {
27
+ role: e.flat === !0 ? "listbox" : "tree",
28
+ // With roving tabindex the container yields its tab stop to the cursor row
29
+ // once there is one; with active-descendant the container IS the tab stop.
30
+ tabIndex: r === "active-descendant" || a === null ? 0 : -1,
31
+ "aria-label": o,
32
+ "aria-multiselectable": t ? !0 : void 0,
33
+ "aria-activedescendant": r === "active-descendant" && a !== null ? Ie(n, a) : void 0
34
+ };
35
+ }
36
+ function Ye(e) {
37
+ const { treeId: n, rows: o, index: t } = e, r = o.at(t), a = e.flat === !0, { posInSet: c, setSize: i } = o.siblingPosition(t);
38
+ return {
39
+ role: a ? "option" : "treeitem",
40
+ id: Ie(n, r.key),
41
+ // A listbox option has no level, and no expanded state to advertise.
42
+ "aria-level": a ? void 0 : r.depth + 1,
43
+ "aria-setsize": i,
44
+ "aria-posinset": c,
45
+ "aria-expanded": !a && r.expandable ? r.expanded : void 0,
46
+ // Announced while the row is fetching its children — silence is what a
47
+ // screen-reader user got before, for as long as the query took.
48
+ "aria-busy": r.busy === !0 ? !0 : void 0
49
+ };
50
+ }
51
+ function ze(e) {
52
+ return {
53
+ ...e.structure,
54
+ tabIndex: e.focusMode === "roving-tabindex" && e.isCursor ? 0 : -1,
55
+ "aria-selected": e.isSelected
56
+ };
57
+ }
58
+ const Xe = /[\^$.*+?(){}|[\]\\]/;
59
+ function Ze(e) {
60
+ const n = e.trim();
61
+ if (n.length === 0) return null;
62
+ if (Xe.test(n))
63
+ try {
64
+ const t = new RegExp(n, "gi");
65
+ return (r) => je(r, t);
66
+ } catch (t) {
67
+ Ne("fall through to substring", t);
68
+ }
69
+ const o = n.toLowerCase();
70
+ return (t) => Je(t, o, n.length);
71
+ }
72
+ function je(e, n) {
73
+ n.lastIndex = 0;
74
+ const o = [];
75
+ let t = 0, r;
76
+ for (; (r = n.exec(e)) !== null; )
77
+ r.index > t && o.push({ text: e.slice(t, r.index), match: !1 }), o.push({ text: r[0], match: !0 }), t = r.index + r[0].length, r[0].length === 0 && (n.lastIndex += 1);
78
+ return t < e.length && o.push({ text: e.slice(t), match: !1 }), o.length > 0 ? o : [{ text: e, match: !1 }];
79
+ }
80
+ function Je(e, n, o) {
81
+ if (o === 0) return [{ text: e, match: !1 }];
82
+ const t = e.toLowerCase(), r = [];
83
+ let a = 0;
84
+ for (; a <= e.length; ) {
85
+ const c = t.indexOf(n, a);
86
+ if (c === -1) {
87
+ a < e.length && r.push({ text: e.slice(a), match: !1 });
88
+ break;
89
+ }
90
+ c > a && r.push({ text: e.slice(a, c), match: !1 }), r.push({ text: e.slice(c, c + o), match: !0 }), a = c + o;
91
+ }
92
+ return r.length > 0 ? r : [{ text: e, match: !1 }];
93
+ }
94
+ const pe = "vk_treeStickyHost_6aT7a", et = "vk_treeViewport_Ku3yB", tt = "vk_treeContainer_iMrOQ", nt = "vk_treeSlice_homAf", rt = "vk_treeRow_Hh9r0", ot = "vk_treeRowCursor_QlUrp", ct = "vk_treeRowSelected_UdZj-", at = "vk_treeIndentGuides_W4J04", lt = "vk_treeIndentGuideActive_9m4l3", ut = "vk_treeRowChevron_6WMjE", it = "vk_treeRowChevronSpacer_Jbp-q", st = "vk_treeRowChevronIcon_KP24Y", dt = "vk_treeRowChevronIconOpen_fRKNn", ht = "vk_treeRowContent_RR7pP", ft = "vk_treeRowActions_LYQUv", gt = "vk_treeEmpty_s8RQ-", yt = "vk_treeRowChevronBusy_lZT8a", wt = "vk_treeSpeedSearchBadge_9GHNi", vt = "vk_treeSpeedSearchIcon_48Ae2", mt = "vk_treeSpeedSearchText_F4SZ8", St = "vk_treeMatchHighlight_NY75y", b = {
95
+ treeStickyHost: pe,
96
+ treeViewport: et,
97
+ treeContainer: tt,
98
+ treeSlice: nt,
99
+ treeRow: rt,
100
+ treeRowCursor: ot,
101
+ treeRowSelected: ct,
102
+ treeIndentGuides: at,
103
+ treeIndentGuideActive: lt,
104
+ treeRowChevron: ut,
105
+ treeRowChevronSpacer: it,
106
+ treeRowChevronIcon: st,
107
+ treeRowChevronIconOpen: dt,
108
+ treeRowContent: ht,
109
+ treeRowActions: ft,
110
+ treeEmpty: gt,
111
+ treeRowChevronBusy: yt,
112
+ treeSpeedSearchBadge: wt,
113
+ treeSpeedSearchIcon: vt,
114
+ treeSpeedSearchText: mt,
115
+ treeMatchHighlight: St
116
+ };
117
+ var kt = /* @__PURE__ */ P("<span aria-hidden=true tabindex=-1>"), re = /* @__PURE__ */ P("<span aria-hidden=true>"), xt = /* @__PURE__ */ P("<span tabindex=-1>"), Ct = /* @__PURE__ */ P("<div><span>"), bt = /* @__PURE__ */ P("<mark>");
118
+ function It(e) {
119
+ return e.ctrlKey || e.metaKey ? "toggle" : e.shiftKey ? "range" : "replace";
120
+ }
121
+ function Ae(e) {
122
+ let n;
123
+ ee(() => {
124
+ if (e.sticky === !0 || !e.isCursor || !e.treeHasFocus()) return;
125
+ const t = n;
126
+ !t || t.contains(t.ownerDocument.activeElement) || queueMicrotask(() => t.focus({
127
+ preventScroll: !0
128
+ }));
129
+ });
130
+ const o = () => A(H, {
131
+ get when() {
132
+ return e.row.expandable;
133
+ },
134
+ get fallback() {
135
+ return (() => {
136
+ var t = re();
137
+ return K(() => M(t, b.treeRowChevronSpacer)), t;
138
+ })();
139
+ },
140
+ get children() {
141
+ var t = kt();
142
+ return t.$$dblclick = (r) => r.stopPropagation(), t.$$keydown = (r) => {
143
+ (Ce(r, "Enter") || r.key === " ") && (r.stopPropagation(), e.onToggle(e.row));
144
+ }, t.$$click = (r) => {
145
+ r.stopPropagation(), e.onToggle(e.row);
146
+ }, R(t, A(H, {
147
+ get when() {
148
+ return e.row.busy;
149
+ },
150
+ get fallback() {
151
+ return A(He, {
152
+ get class() {
153
+ return `${b.treeRowChevronIcon} ${e.row.expanded ? b.treeRowChevronIconOpen : ""}`;
154
+ }
155
+ });
156
+ },
157
+ get children() {
158
+ return A(Ge, {
159
+ "data-motion-exempt": "true",
160
+ get class() {
161
+ return `${b.treeRowChevronIcon} ${b.treeRowChevronBusy}`;
162
+ }
163
+ });
164
+ }
165
+ })), K(() => M(t, b.treeRowChevron)), t;
166
+ }
167
+ });
168
+ return (() => {
169
+ var t = Ct(), r = t.firstChild, a = n;
170
+ return typeof a == "function" ? ke(a, t) : n = t, me(t, Se({
171
+ get tabIndex() {
172
+ return e.sticky === !0 ? -1 : 0;
173
+ }
174
+ }, () => e.sticky === !0 ? {
175
+ tabIndex: -1
176
+ } : e.aria, {
177
+ get onKeyDown() {
178
+ var c;
179
+ return (c = e.dom) == null ? void 0 : c.onKeyDown;
180
+ },
181
+ get class() {
182
+ var c;
183
+ return `${b.treeRow} ${((c = e.dom) == null ? void 0 : c.class) ?? ""}`;
184
+ },
185
+ get classList() {
186
+ return {
187
+ [b.treeRowCursor]: e.isCursor,
188
+ [b.treeRowSelected]: e.isSelected
189
+ };
190
+ },
191
+ get style() {
192
+ return {
193
+ height: `${e.rowHeight}px`,
194
+ // Depth travels as a CSS variable so indent stays ONE formula in the
195
+ // stylesheet. Four surfaces used to hardcode it four different ways.
196
+ "--tree-depth": String(e.row.depth)
197
+ };
198
+ }
199
+ }, () => e.sticky === !0 ? {
200
+ "data-tree-sticky-key": e.row.key
201
+ } : {
202
+ "data-tree-row-key": e.row.key
203
+ }, () => {
204
+ var c;
205
+ return ((c = e.dom) == null ? void 0 : c.title) !== void 0 ? {
206
+ title: e.dom.title
207
+ } : {};
208
+ }, () => {
209
+ var c;
210
+ return ((c = e.dom) == null ? void 0 : c.draggable) !== void 0 ? {
211
+ draggable: e.dom.draggable
212
+ } : {};
213
+ }, () => {
214
+ var c;
215
+ return (c = e.dom) != null && c.onDragStart ? {
216
+ onDragStart: e.dom.onDragStart
217
+ } : {};
218
+ }, () => {
219
+ var c;
220
+ return (c = e.dom) != null && c.onDragOver ? {
221
+ onDragOver: e.dom.onDragOver
222
+ } : {};
223
+ }, () => {
224
+ var c;
225
+ return (c = e.dom) != null && c.onDragLeave ? {
226
+ onDragLeave: e.dom.onDragLeave
227
+ } : {};
228
+ }, () => {
229
+ var c;
230
+ return (c = e.dom) != null && c.onDrop ? {
231
+ onDrop: e.dom.onDrop
232
+ } : {};
233
+ }, () => {
234
+ var c;
235
+ return (c = e.dom) != null && c.onDragEnd ? {
236
+ onDragEnd: e.dom.onDragEnd
237
+ } : {};
238
+ }, () => {
239
+ var c;
240
+ return (c = e.dom) != null && c.onMouseEnter ? {
241
+ onMouseEnter: e.dom.onMouseEnter
242
+ } : {};
243
+ }, () => {
244
+ var c;
245
+ return (c = e.dom) != null && c.onMouseLeave ? {
246
+ onMouseLeave: e.dom.onMouseLeave
247
+ } : {};
248
+ }, {
249
+ onMouseDown: (c) => {
250
+ if (c.button === 2) {
251
+ e.isSelected ? e.onFocusRow(e.index) : e.onSelect(e.index, "replace");
252
+ return;
253
+ }
254
+ c.button === 0 && e.onSelect(e.index, It(c));
255
+ },
256
+ onClick: (c) => e.onActivateClick(e.row, "single-click", c),
257
+ onDblClick: (c) => e.onActivateClick(e.row, "double-click", c),
258
+ onContextMenu: (c) => {
259
+ c.preventDefault(), c.stopPropagation(), e.onOpenMenu(e.row, c);
260
+ }
261
+ }), !1, !0), R(t, A(H, {
262
+ get when() {
263
+ return j(() => e.indentGuide !== "none")() && e.row.depth > 0;
264
+ },
265
+ get children() {
266
+ var c = re();
267
+ return K(() => M(c, b.treeIndentGuides)), c;
268
+ }
269
+ }), r), R(t, A(H, {
270
+ get when() {
271
+ return j(() => e.indentGuide === "active" && e.activeGuideDepth >= 0)() && e.row.depth > e.activeGuideDepth;
272
+ },
273
+ get children() {
274
+ var c = re();
275
+ return K((i) => {
276
+ var f = b.treeIndentGuideActive, v = `${e.activeGuideDepth}`;
277
+ return f !== i.e && M(c, i.e = f), v !== i.t && X(c, "--tree-active-col", i.t = v), i;
278
+ }, {
279
+ e: void 0,
280
+ t: void 0
281
+ }), c;
282
+ }
283
+ }), r), R(t, A(H, {
284
+ get when() {
285
+ return e.showChevronGutter;
286
+ },
287
+ get children() {
288
+ return o();
289
+ }
290
+ }), r), R(r, () => e.content), R(t, A(H, {
291
+ get when() {
292
+ return e.actions;
293
+ },
294
+ get children() {
295
+ var c = xt();
296
+ return c.$$dblclick = (i) => i.stopPropagation(), c.$$keydown = (i) => i.stopPropagation(), c.$$click = (i) => i.stopPropagation(), R(c, () => e.actions), K(() => M(c, b.treeRowActions)), c;
297
+ }
298
+ }), null), K(() => M(r, b.treeRowContent)), t;
299
+ })();
300
+ }
301
+ function gn(e) {
302
+ const n = () => e.query ? typeof e.query == "function" ? e.query() : e.query : "", o = G(() => {
303
+ const t = n().trim();
304
+ if (t.length === 0) return null;
305
+ const r = Ze(t);
306
+ return r ? r(e.text) : null;
307
+ });
308
+ return A(H, {
309
+ get when() {
310
+ return o();
311
+ },
312
+ get fallback() {
313
+ return j(() => e.text);
314
+ },
315
+ get children() {
316
+ return A(Me, {
317
+ get each() {
318
+ return o();
319
+ },
320
+ children: (t) => A(H, {
321
+ get when() {
322
+ return t.match;
323
+ },
324
+ get fallback() {
325
+ return j(() => t.text);
326
+ },
327
+ get children() {
328
+ var r = bt();
329
+ return R(r, () => t.text), K(() => M(r, e.class ?? b.treeMatchHighlight)), r;
330
+ }
331
+ })
332
+ });
333
+ }
334
+ });
335
+ }
336
+ Te(["click", "keydown", "dblclick"]);
337
+ const At = "vk_treeStickyWidget_Q-8QQ", Rt = "vk_treeStickyRow_7gWG2", de = {
338
+ treeStickyWidget: At,
339
+ treeStickyRow: Rt
340
+ };
341
+ var Tt = /* @__PURE__ */ P("<div role=list>"), _t = /* @__PURE__ */ P("<div role=listitem>");
342
+ function Mt(e) {
343
+ return (() => {
344
+ var n = Tt();
345
+ return R(n, A(xe, {
346
+ get each() {
347
+ return e.rows;
348
+ },
349
+ children: (o, t) => (() => {
350
+ var r = _t();
351
+ return R(r, A(Ae, {
352
+ sticky: !0,
353
+ get row() {
354
+ return o().row;
355
+ },
356
+ get index() {
357
+ return o().index;
358
+ },
359
+ get rowHeight() {
360
+ return e.descriptor.rowHeight;
361
+ },
362
+ get isCursor() {
363
+ return e.isCursor(o().index);
364
+ },
365
+ get isSelected() {
366
+ return e.isSelected(o().row);
367
+ },
368
+ treeHasFocus: () => !1,
369
+ get showChevronGutter() {
370
+ return e.showChevronGutter;
371
+ },
372
+ get indentGuide() {
373
+ return e.indentGuide;
374
+ },
375
+ get activeGuideDepth() {
376
+ return e.activeGuideDepth;
377
+ },
378
+ get dom() {
379
+ var a, c;
380
+ return (c = (a = e.descriptor).rowProps) == null ? void 0 : c.call(a, o().row);
381
+ },
382
+ get content() {
383
+ return e.descriptor.renderContent(o().row);
384
+ },
385
+ get actions() {
386
+ var a, c;
387
+ return (c = (a = e.descriptor).renderActions) == null ? void 0 : c.call(a, o().row);
388
+ },
389
+ get onSelect() {
390
+ return e.onSelect;
391
+ },
392
+ get onFocusRow() {
393
+ return e.onFocusRow;
394
+ },
395
+ get onToggle() {
396
+ return e.onToggle;
397
+ },
398
+ onActivateClick: () => e.onReveal(o().index),
399
+ get onOpenMenu() {
400
+ return e.onOpenMenu;
401
+ }
402
+ })), K((a) => {
403
+ var c = de.treeStickyRow, i = `${o().top}px`, f = `${e.rows.length - t}`;
404
+ return c !== a.e && M(r, a.e = c), i !== a.t && X(r, "top", a.t = i), f !== a.a && X(r, "z-index", a.a = f), a;
405
+ }, {
406
+ e: void 0,
407
+ t: void 0,
408
+ a: void 0
409
+ }), r;
410
+ })()
411
+ })), K((o) => {
412
+ var t = de.treeStickyWidget, r = e.label, a = `${e.height}px`;
413
+ return t !== o.e && M(n, o.e = t), r !== o.t && _e(n, "aria-label", o.t = r), a !== o.a && X(n, "height", o.a = a), o;
414
+ }, {
415
+ e: void 0,
416
+ t: void 0,
417
+ a: void 0
418
+ }), n;
419
+ })();
420
+ }
421
+ var Et = /* @__PURE__ */ P("<div role=status aria-live=polite aria-atomic=true><span>"), Dt = /* @__PURE__ */ P("<div><div>"), $t = /* @__PURE__ */ P("<p>"), Kt = /* @__PURE__ */ P("<div>");
422
+ const he = "roving-tabindex";
423
+ function yn(e) {
424
+ const n = () => e.surface.descriptor, o = () => e.surface.controller;
425
+ let t;
426
+ const r = G(() => ({
427
+ ...be,
428
+ ...n().capabilities
429
+ })), a = () => r().canExpand && (n().chevronGutter ?? !0), c = G(() => {
430
+ if ((n().indentGuide ?? "none") !== "active") return -1;
431
+ const w = e.surface.cursorRow();
432
+ return w ? w.depth - 1 : -1;
433
+ }), i = G(() => {
434
+ const {
435
+ start: w,
436
+ end: u
437
+ } = e.surface.scroller.range();
438
+ return Array.from({
439
+ length: u - w
440
+ }, (I, C) => w + C);
441
+ }), f = Ee(() => o().cursorIndex());
442
+ Ue({
443
+ container: () => t,
444
+ supportsMultiselect: () => r().canMultiSelect,
445
+ verbs: {
446
+ selectAll: () => o().selectAll()
447
+ }
448
+ });
449
+ const v = Qe() === null, s = (w) => (w.key === "a" || w.key === "A") && (w.ctrlKey || w.metaKey) && !w.altKey && !w.shiftKey, y = G(() => Ve({
450
+ treeId: n().id,
451
+ label: n().ariaLabel,
452
+ multiSelectable: r().canMultiSelect,
453
+ focusMode: he,
454
+ cursorKey: o().cursorKey(),
455
+ flat: !r().canExpand
456
+ })), S = (w) => {
457
+ const u = w;
458
+ return u != null && u.tagName ? u.tagName === "INPUT" || u.tagName === "TEXTAREA" || u.isContentEditable === !0 : !1;
459
+ }, T = () => t !== void 0 && t.contains(t.ownerDocument.activeElement), k = (w, u) => {
460
+ o().selectIndex(w, u);
461
+ }, B = (w, u, I) => {
462
+ var C, x;
463
+ (x = (C = n()).onActivate) == null || x.call(C, w, u, I);
464
+ }, E = (w, u) => {
465
+ e.surface.openMenu(w, {
466
+ x: u.clientX,
467
+ y: u.clientY
468
+ }, u);
469
+ }, Q = (w) => {
470
+ t == null || t.focus({
471
+ preventScroll: !0
472
+ }), e.surface.scroller.scrollToIndex(w, "auto", e.surface.stickyInsetFor(w));
473
+ };
474
+ return (() => {
475
+ var w = Kt();
476
+ return R(w, A(H, {
477
+ get when() {
478
+ return o().typeAheadQuery().length > 0;
479
+ },
480
+ get children() {
481
+ var u = Et(), I = u.firstChild;
482
+ return R(u, A(Pe, {
483
+ get class() {
484
+ return b.treeSpeedSearchIcon;
485
+ }
486
+ }), I), R(I, () => o().typeAheadQuery()), K((C) => {
487
+ var x = b.treeSpeedSearchBadge, D = b.treeSpeedSearchText;
488
+ return x !== C.e && M(u, C.e = x), D !== C.t && M(I, C.t = D), C;
489
+ }, {
490
+ e: void 0,
491
+ t: void 0
492
+ }), u;
493
+ }
494
+ }), null), R(w, A(Le, {
495
+ viewportRef: (u) => {
496
+ var I;
497
+ e.surface.scroller.containerRef(u), (I = e.viewportRef) == null || I.call(e, u);
498
+ },
499
+ get viewportClass() {
500
+ return `${b.treeViewport} ${e.viewportClass ?? ""}`.trim();
501
+ },
502
+ get children() {
503
+ return [(() => {
504
+ var u = Dt(), I = u.firstChild, C = t;
505
+ return typeof C == "function" ? ke(C, u) : t = u, me(u, Se(y, {
506
+ get class() {
507
+ return b.treeContainer;
508
+ },
509
+ get style() {
510
+ return {
511
+ height: `${e.surface.scroller.totalHeight()}px`
512
+ };
513
+ },
514
+ onKeyDown: (x) => {
515
+ if (!S(x.target)) {
516
+ if (v && s(x) && r().canMultiSelect) {
517
+ x.preventDefault(), o().selectAll();
518
+ return;
519
+ }
520
+ o().handleKeyDown(x);
521
+ }
522
+ },
523
+ onFocus: (x) => {
524
+ x.target === x.currentTarget && o().cursorIndex() < 0 && o().focusIndex(0);
525
+ }
526
+ }), !1, !0), R(I, A(xe, {
527
+ get each() {
528
+ return i();
529
+ },
530
+ children: (x) => {
531
+ const D = G(() => e.surface.source().at(x())), W = () => f(x()), Z = () => o().selectedKeys().has(D().key), ae = G(() => Ye({
532
+ treeId: n().id,
533
+ rows: e.surface.source(),
534
+ index: x(),
535
+ flat: !r().canExpand
536
+ }));
537
+ return A(Ae, {
538
+ get row() {
539
+ return D();
540
+ },
541
+ get index() {
542
+ return x();
543
+ },
544
+ get aria() {
545
+ return ze({
546
+ structure: ae(),
547
+ focusMode: he,
548
+ isCursor: W(),
549
+ isSelected: Z()
550
+ });
551
+ },
552
+ get rowHeight() {
553
+ return n().rowHeight;
554
+ },
555
+ get isCursor() {
556
+ return W();
557
+ },
558
+ get isSelected() {
559
+ return Z();
560
+ },
561
+ treeHasFocus: T,
562
+ get showChevronGutter() {
563
+ return a();
564
+ },
565
+ get indentGuide() {
566
+ return n().indentGuide ?? "none";
567
+ },
568
+ get activeGuideDepth() {
569
+ return c();
570
+ },
571
+ get dom() {
572
+ var L, F;
573
+ return (F = (L = n()).rowProps) == null ? void 0 : F.call(L, D());
574
+ },
575
+ get content() {
576
+ return n().renderContent(D());
577
+ },
578
+ get actions() {
579
+ var L, F;
580
+ return (F = (L = n()).renderActions) == null ? void 0 : F.call(L, D());
581
+ },
582
+ onSelect: k,
583
+ onFocusRow: (L) => o().focusIndex(L),
584
+ onToggle: (L) => {
585
+ var F, te;
586
+ return (te = (F = n()).onToggle) == null ? void 0 : te.call(F, L);
587
+ },
588
+ onActivateClick: B,
589
+ onOpenMenu: E
590
+ });
591
+ }
592
+ })), K((x) => {
593
+ var D = b.treeSlice, W = `translate3d(0, ${e.surface.scroller.offsetY()}px, 0)`;
594
+ return D !== x.e && M(I, x.e = D), W !== x.t && X(I, "transform", x.t = W), x;
595
+ }, {
596
+ e: void 0,
597
+ t: void 0
598
+ }), u;
599
+ })(), A(H, {
600
+ get when() {
601
+ return j(() => e.surface.source().length === 0)() && n().emptyLabel;
602
+ },
603
+ get children() {
604
+ var u = $t();
605
+ return R(u, () => n().emptyLabel), K(() => M(u, b.treeEmpty)), u;
606
+ }
607
+ })];
608
+ }
609
+ }), null), R(w, A(H, {
610
+ get when() {
611
+ return e.surface.stickyState().rows.length > 0;
612
+ },
613
+ get children() {
614
+ return A(Mt, {
615
+ get rows() {
616
+ return e.surface.stickyState().rows;
617
+ },
618
+ get height() {
619
+ return e.surface.stickyState().height;
620
+ },
621
+ get label() {
622
+ return Fe("Sticky parent rows");
623
+ },
624
+ get descriptor() {
625
+ return n();
626
+ },
627
+ get showChevronGutter() {
628
+ return a();
629
+ },
630
+ get indentGuide() {
631
+ return n().indentGuide ?? "none";
632
+ },
633
+ get activeGuideDepth() {
634
+ return c();
635
+ },
636
+ isCursor: (u) => o().cursorIndex() === u,
637
+ isSelected: (u) => o().selectedKeys().has(u.key),
638
+ onSelect: k,
639
+ onFocusRow: (u) => o().focusIndex(u),
640
+ onToggle: (u) => {
641
+ var I, C;
642
+ return (C = (I = n()).onToggle) == null ? void 0 : C.call(I, u);
643
+ },
644
+ onReveal: Q,
645
+ onOpenMenu: E
646
+ });
647
+ }
648
+ }), null), K((u) => {
649
+ var I = b.treeStickyHost, C = `${n().indentBaseRem ?? 0}rem`;
650
+ return I !== u.e && M(w, u.e = I), C !== u.t && X(w, "--tree-indent-base", u.t = C), u;
651
+ }, {
652
+ e: void 0,
653
+ t: void 0
654
+ }), w;
655
+ })();
656
+ }
657
+ const fe = 10, z = (e, n) => Math.max(0, Math.min(e, n - 1));
658
+ function Ot(e) {
659
+ return e.key.length === 1 && e.key !== " " && !e.ctrlKey && !e.metaKey && !e.altKey;
660
+ }
661
+ function Gt(e, n) {
662
+ const { index: o, rowCount: t, capabilities: r } = n;
663
+ if (t === 0) return null;
664
+ const a = o < 0 ? -1 : o;
665
+ switch (Be(e)) {
666
+ case "ArrowDown":
667
+ return e.shiftKey && r.canMultiSelect ? { type: "extend", to: z(a + 1, t) } : { type: "move", to: z(a + 1, t) };
668
+ case "ArrowUp":
669
+ return a < 0 ? { type: "move", to: t - 1 } : e.shiftKey && r.canMultiSelect ? { type: "extend", to: z(a - 1, t) } : { type: "move", to: z(a - 1, t) };
670
+ case "Home":
671
+ return { type: "move", to: 0 };
672
+ case "End":
673
+ return { type: "move", to: t - 1 };
674
+ case "PageDown":
675
+ return {
676
+ type: "move",
677
+ to: z(Math.max(a, 0) + fe, t)
678
+ };
679
+ case "PageUp":
680
+ return {
681
+ type: "move",
682
+ to: z(Math.max(a, 0) - fe, t)
683
+ };
684
+ case "ArrowRight":
685
+ return r.canExpand ? { type: "expandOrDescend" } : { type: "flatNavigate", direction: "in" };
686
+ case "ArrowLeft":
687
+ return e.ctrlKey || e.metaKey ? null : r.canExpand ? { type: "collapseOrAscend" } : { type: "flatNavigate", direction: "out" };
688
+ case "Enter":
689
+ return { type: "activate" };
690
+ case "ContextMenu":
691
+ return { type: "openMenu" };
692
+ case "F10":
693
+ return e.shiftKey ? { type: "openMenu" } : null;
694
+ }
695
+ return e.key === " " ? r.canExpand ? { type: "toggle" } : null : r.canTypeAhead && Ot(e) ? { type: "typeAhead", char: e.key } : null;
696
+ }
697
+ function Ht(e, n, o, t = !1) {
698
+ const r = o.toLowerCase();
699
+ if (r.length === 0) return -1;
700
+ const a = e.length;
701
+ if (a === 0) return -1;
702
+ const c = t ? 0 : 1;
703
+ for (let i = c; i <= a; i++) {
704
+ const f = (n + i + a) % a;
705
+ if (e.at(f).label.toLowerCase().startsWith(r)) return f;
706
+ }
707
+ for (let i = c; i <= a; i++) {
708
+ const f = (n + i + a) % a;
709
+ if (e.at(f).label.toLowerCase().includes(r)) return f;
710
+ }
711
+ return -1;
712
+ }
713
+ function Pt(e, n, o) {
714
+ const t = [...o].filter((v) => e.indexOfKey(v) >= 0), r = Lt(e, n, t), a = Ft(e, r), c = (v) => v.selectable !== !1 && (a === void 0 || v.kind === a), i = new Set(t);
715
+ let f = r < 0 ? -1 : e.parentIndex(r);
716
+ for (; ; ) {
717
+ const v = Nt(e, f, c);
718
+ if (f < 0) return v;
719
+ const s = v.length === i.size && v.every((S) => i.has(S));
720
+ if (v.length > 0 && !s) return v;
721
+ const y = e.at(f);
722
+ if (v.length > 0 && c(y))
723
+ return [y.key, ...v];
724
+ f = e.parentIndex(f);
725
+ }
726
+ }
727
+ function Lt(e, n, o) {
728
+ const t = n >= 0 && n < e.length ? e.at(n).key : void 0;
729
+ if (t !== void 0 && !o.includes(t)) return n;
730
+ const r = o[0];
731
+ return r === void 0 ? -1 : e.indexOfKey(r);
732
+ }
733
+ function Ft(e, n) {
734
+ if (n >= 0) {
735
+ const t = e.at(n);
736
+ if (t.selectable !== !1) return t.kind;
737
+ }
738
+ const o = Math.max(n, 0);
739
+ for (let t = 0; t < e.length; t++) {
740
+ const r = e.at((o + t) % e.length);
741
+ if (r.selectable !== !1) return r.kind;
742
+ }
743
+ }
744
+ function Nt(e, n, o) {
745
+ const t = n < 0 ? 0 : n + 1, r = n < 0 ? e.length - 1 : e.subtreeEnd(n), a = [];
746
+ for (let c = t; c <= r; c++) {
747
+ const i = e.at(c);
748
+ o(i) && a.push(i.key);
749
+ }
750
+ return a;
751
+ }
752
+ const ge = 1e3;
753
+ function oe(e, n) {
754
+ const o = [];
755
+ for (let t = e.parentIndex(n); t !== -1; t = e.parentIndex(t))
756
+ o.push(e.at(t).key);
757
+ return { key: e.at(n).key, ancestors: o, index: n };
758
+ }
759
+ function ye(e, n) {
760
+ if (n === null || e.length === 0) return -1;
761
+ if (n.index < e.length && e.at(n.index).key === n.key)
762
+ return n.index;
763
+ const o = e.indexOfKey(n.key);
764
+ if (o >= 0) return o;
765
+ for (const t of n.ancestors) {
766
+ const r = e.indexOfKey(t);
767
+ if (r >= 0) return r;
768
+ }
769
+ return Math.min(n.index, e.length - 1);
770
+ }
771
+ function Bt(e) {
772
+ const n = () => ({
773
+ ...be,
774
+ ...e.capabilities,
775
+ expandAll: !1
776
+ }), [o, t] = J(null), [r, a] = J(
777
+ /* @__PURE__ */ new Set()
778
+ ), [c, i] = J(null), f = G(
779
+ () => ye(e.rows(), o())
780
+ ), v = () => ye(e.rows(), c()), s = G(() => {
781
+ const l = f();
782
+ return l < 0 ? null : e.rows().at(l).key;
783
+ });
784
+ ee(() => {
785
+ const l = o(), d = f();
786
+ if (l === null || d < 0) return;
787
+ const h = e.rows(), g = h.at(d).key;
788
+ if (g === l.key) {
789
+ d !== l.index && t(oe(h, d));
790
+ return;
791
+ }
792
+ l.ancestors.includes(g) && t(oe(h, d));
793
+ });
794
+ const [y, S] = J("");
795
+ let T = 0, k;
796
+ const B = () => {
797
+ k !== void 0 && (clearTimeout(k), k = void 0), y().length > 0 && S("");
798
+ }, E = () => {
799
+ k !== void 0 && (clearTimeout(k), k = void 0), k = setTimeout(() => {
800
+ S(""), k = void 0;
801
+ }, ge);
802
+ };
803
+ De(() => {
804
+ k !== void 0 && (clearTimeout(k), k = void 0);
805
+ });
806
+ const Q = (l) => {
807
+ const d = e.rows();
808
+ return l >= 0 && l < d.length ? d.at(l) : void 0;
809
+ }, w = (l, d) => {
810
+ var g;
811
+ const h = oe(e.rows(), l);
812
+ t(h), d && i(h), (g = e.onScrollToIndex) == null || g.call(e, l);
813
+ }, u = (l) => {
814
+ const d = e.rows();
815
+ l < 0 || l >= d.length || l === f() || w(l, !0);
816
+ }, I = (l) => {
817
+ var h;
818
+ const d = e.rows().indexOfKey(l);
819
+ d < 0 || (d === f() ? (h = e.onScrollToIndex) == null || h.call(e, d) : u(d));
820
+ }, C = (l, d) => {
821
+ var U;
822
+ const h = e.rows(), g = (U = Q(l)) == null ? void 0 : U.kind, [m, _] = l <= d ? [l, d] : [d, l], $ = /* @__PURE__ */ new Set();
823
+ for (let q = Math.max(m, 0); q <= Math.min(_, h.length - 1); q++) {
824
+ const V = h.at(q);
825
+ V.selectable !== !1 && (g !== void 0 && V.kind !== g || $.add(V.key));
826
+ }
827
+ return $;
828
+ }, x = (l, d) => {
829
+ B();
830
+ const h = Q(l);
831
+ if (h) {
832
+ if (h.selectable === !1 && d !== "range") {
833
+ u(l);
834
+ return;
835
+ }
836
+ if (d === "toggle" && n().canMultiSelect) {
837
+ const g = new Set(r());
838
+ g.has(h.key) ? g.delete(h.key) : g.add(h.key), a(g), w(l, !0);
839
+ return;
840
+ }
841
+ if (d === "range" && n().canMultiSelect) {
842
+ const g = v();
843
+ a(C(g >= 0 ? g : l, l)), w(l, !1);
844
+ return;
845
+ }
846
+ a(/* @__PURE__ */ new Set([h.key])), w(l, !0);
847
+ }
848
+ }, D = (l, d) => {
849
+ const h = e.rows().indexOfKey(l);
850
+ h >= 0 && x(h, d);
851
+ }, W = () => {
852
+ B(), r().size > 0 && a(/* @__PURE__ */ new Set());
853
+ }, Z = (l, d) => {
854
+ const h = e.rows(), g = Q(l);
855
+ if (!g) return;
856
+ const m = g.depth + 1, _ = h.subtreeEnd(l);
857
+ for (let $ = l + 1; $ <= _; $ = h.subtreeEnd($) + 1) {
858
+ const U = h.at($);
859
+ U.depth === m && d(U, $);
860
+ }
861
+ };
862
+ return {
863
+ cursorIndex: f,
864
+ cursorKey: s,
865
+ selectedKeys: r,
866
+ typeAheadQuery: y,
867
+ get capabilities() {
868
+ return n();
869
+ },
870
+ focusIndex: u,
871
+ focusKey: I,
872
+ selectIndex: x,
873
+ selectKey: D,
874
+ clearSelection: W,
875
+ selectChildren: (l) => {
876
+ const d = /* @__PURE__ */ new Set();
877
+ let h, g = !1, m = -1;
878
+ Z(l, (_, $) => {
879
+ if (_.selectable !== !1) {
880
+ if (!g)
881
+ h = _.kind, m = $, g = !0;
882
+ else if (h !== void 0 && _.kind !== h) return;
883
+ d.add(_.key);
884
+ }
885
+ }), d.size !== 0 && (a(d), m >= 0 && w(m, !0));
886
+ },
887
+ selectAll: () => {
888
+ n().canMultiSelect && a(
889
+ new Set(Pt(e.rows(), f(), r()))
890
+ );
891
+ },
892
+ childKindsHomogeneous: (l) => {
893
+ let d, h = !1, g = 0, m = 0;
894
+ return Z(l, (_) => {
895
+ _.selectable !== !1 && (g++, h ? (d === void 0 || _.kind === d) && m++ : (d = _.kind, h = !0, m++));
896
+ }), {
897
+ homogeneous: g > 0 && g === m,
898
+ total: g,
899
+ selectable: m
900
+ };
901
+ },
902
+ handleKeyDown: (l) => {
903
+ var _, $, U, q, V, le, ue;
904
+ if (Ce(l, "Escape") && y().length > 0) {
905
+ l.preventDefault(), l.stopPropagation(), B();
906
+ return;
907
+ }
908
+ const d = e.rows(), h = f(), g = Gt(l, {
909
+ index: h,
910
+ rowCount: d.length,
911
+ capabilities: n()
912
+ });
913
+ if (!g) return;
914
+ const m = Q(h);
915
+ switch (g.type) {
916
+ case "move":
917
+ l.preventDefault(), u(g.to);
918
+ return;
919
+ case "extend": {
920
+ l.preventDefault();
921
+ const O = v();
922
+ a(C(O >= 0 ? O : h, g.to)), w(g.to, !1);
923
+ return;
924
+ }
925
+ case "expandOrDescend":
926
+ if (!m) return;
927
+ if (l.preventDefault(), m.expandable && !m.expanded) {
928
+ (_ = e.onToggle) == null || _.call(e, m);
929
+ return;
930
+ }
931
+ u(h + 1);
932
+ return;
933
+ case "collapseOrAscend": {
934
+ if (!m) return;
935
+ if (l.preventDefault(), m.expandable && m.expanded) {
936
+ ($ = e.onToggle) == null || $.call(e, m);
937
+ return;
938
+ }
939
+ const O = d.parentIndex(h);
940
+ O >= 0 && u(O);
941
+ return;
942
+ }
943
+ case "toggle":
944
+ if (!(m != null && m.expandable)) return;
945
+ l.preventDefault(), (U = e.onToggle) == null || U.call(e, m);
946
+ return;
947
+ case "flatNavigate":
948
+ l.preventDefault(), (q = e.onFlatNavigate) == null || q.call(e, g.direction, m);
949
+ return;
950
+ case "activate":
951
+ if (!m) return;
952
+ l.preventDefault(), (V = e.onActivate) == null || V.call(e, m);
953
+ return;
954
+ case "openMenu": {
955
+ if (!m) return;
956
+ l.preventDefault();
957
+ const O = l.target, N = O == null ? void 0 : O.getBoundingClientRect();
958
+ (le = e.onOpenMenu) == null || le.call(e, m, {
959
+ x: Math.round((N == null ? void 0 : N.left) ?? 0),
960
+ y: Math.round((N == null ? void 0 : N.bottom) ?? 0)
961
+ });
962
+ return;
963
+ }
964
+ case "typeAhead": {
965
+ const O = ((ue = e.now) == null ? void 0 : ue.call(e)) ?? Date.now(), N = O - T > ge, Y = N ? "" : y(), ne = Y.length === 1 && Y.toLowerCase() === g.char.toLowerCase() ? Y : `${Y}${g.char}`, ie = Ht(
966
+ d,
967
+ h,
968
+ ne,
969
+ ne.length > 1 && !N
970
+ );
971
+ if (T = O, ie < 0) {
972
+ S(Y), Y.length > 0 ? E() : B();
973
+ return;
974
+ }
975
+ S(ne), E(), l.preventDefault(), u(ie);
976
+ return;
977
+ }
978
+ }
979
+ },
980
+ openMenuAt: (l, d) => {
981
+ var g;
982
+ const h = Q(l);
983
+ h && ((g = e.onOpenMenu) == null || g.call(e, h, d));
984
+ }
985
+ };
986
+ }
987
+ const Ut = 0.4, Qt = { rows: [], height: 0 };
988
+ function Re(e) {
989
+ return Math.max(Math.floor(e), 1);
990
+ }
991
+ function Wt(e, n, o) {
992
+ let t = n, r = e.parentIndex(t);
993
+ for (; r !== -1; ) {
994
+ if (r === o) return t;
995
+ t = r, r = e.parentIndex(t);
996
+ }
997
+ return o === -1 ? t : -1;
998
+ }
999
+ function qt(e, n, o, t) {
1000
+ let r = e;
1001
+ for (let c = 0; c < e.length; c++)
1002
+ if (e[c].top + t > o || c >= n) {
1003
+ r = e.slice(0, c);
1004
+ break;
1005
+ }
1006
+ const a = r[r.length - 1];
1007
+ return a ? { rows: r, height: a.top + t } : { rows: [], height: 0 };
1008
+ }
1009
+ function Vt(e) {
1010
+ const { rows: n, scrollTop: o, rowHeight: t, viewportHeight: r } = e;
1011
+ if (n.length === 0 || t <= 0) return Qt;
1012
+ const a = Re(e.maxCount), c = [];
1013
+ let i = 0, f = -1;
1014
+ for (; ; ) {
1015
+ const v = Math.floor((o + i) / t);
1016
+ if (v < 0 || v >= n.length) break;
1017
+ const s = Wt(n, v, f);
1018
+ if (s === -1) break;
1019
+ const y = n.subtreeEnd(s);
1020
+ if (y === s || s === v && o === s * t - i) break;
1021
+ const S = (y + 1) * t - o, T = i, k = T + t > S && T <= S ? S - t : T;
1022
+ if (c.push({ index: s, row: n.at(s), top: k }), i = k + t, f = s, c.length >= a) break;
1023
+ }
1024
+ return qt(
1025
+ c,
1026
+ a,
1027
+ r * Ut,
1028
+ t
1029
+ );
1030
+ }
1031
+ function Yt(e, n, o, t) {
1032
+ if (n < 0 || n >= e.length) return 0;
1033
+ const r = Re(t);
1034
+ let a = 0, c = e.parentIndex(n);
1035
+ for (; c !== -1 && (a++, a !== r); )
1036
+ c = e.parentIndex(c);
1037
+ return a * o;
1038
+ }
1039
+ function we(e, n, o) {
1040
+ if (n <= 0 || e.length === 0 || o <= 0) return null;
1041
+ const t = Math.min(e.length - 1, Math.floor(n / o));
1042
+ return {
1043
+ key: e.at(t).key,
1044
+ offset: n - t * o,
1045
+ contentTop: n
1046
+ };
1047
+ }
1048
+ function zt(e, n, o, t) {
1049
+ if (n === null || Math.abs(o - n.contentTop) >= se)
1050
+ return null;
1051
+ const r = e.indexOfKey(n.key);
1052
+ if (r < 0) return null;
1053
+ const a = r * t + n.offset;
1054
+ return Math.abs(a - n.contentTop) >= se ? a : null;
1055
+ }
1056
+ const Xt = 8, ve = 7, Zt = { rows: [], height: 0 };
1057
+ function wn(e) {
1058
+ const n = $e(qe), o = G(() => e.rows()), t = We({
1059
+ count: () => o().length,
1060
+ itemHeight: e.rowHeight,
1061
+ overscan: e.overscan ?? Xt
1062
+ }), r = G(() => e.stickyScroll !== !0 ? Zt : Vt({
1063
+ rows: o(),
1064
+ scrollTop: t.scrollTop(),
1065
+ rowHeight: e.rowHeight,
1066
+ viewportHeight: t.viewportHeight(),
1067
+ maxCount: e.stickyScrollMaxCount ?? ve
1068
+ })), a = (s) => e.stickyScroll === !0 ? Yt(
1069
+ o(),
1070
+ s,
1071
+ e.rowHeight,
1072
+ e.stickyScrollMaxCount ?? ve
1073
+ ) : 0, c = Bt({
1074
+ rows: o,
1075
+ ...e.capabilities ? { capabilities: e.capabilities } : {},
1076
+ onToggle: (s) => {
1077
+ var y;
1078
+ return (y = e.onToggle) == null ? void 0 : y.call(e, s);
1079
+ },
1080
+ onActivate: (s) => {
1081
+ var y;
1082
+ return (y = e.onActivate) == null ? void 0 : y.call(e, s, "keyboard");
1083
+ },
1084
+ onOpenMenu: (s, y) => v(s, y),
1085
+ onCollapseAll: () => {
1086
+ var s;
1087
+ return (s = e.onCollapseAll) == null ? void 0 : s.call(e);
1088
+ },
1089
+ onFlatNavigate: (s, y) => {
1090
+ var S;
1091
+ return (S = e.onFlatNavigate) == null ? void 0 : S.call(
1092
+ e,
1093
+ s,
1094
+ y
1095
+ );
1096
+ },
1097
+ onRename: (s) => {
1098
+ var y;
1099
+ return (y = e.onRename) == null ? void 0 : y.call(e, s);
1100
+ },
1101
+ onDestroy: (s) => {
1102
+ var y;
1103
+ return (y = e.onDestroy) == null ? void 0 : y.call(e, s);
1104
+ },
1105
+ // Arrow keys in a virtualized list are a lie without this: the row the
1106
+ // cursor lands on may not be mounted yet.
1107
+ //
1108
+ // The inset is what keeps them honest once rows are pinned on top: "scroll
1109
+ // just enough" would otherwise stop the moment the cursor row reached the
1110
+ // viewport's top edge — which is now underneath the widget. Arrowing UP into
1111
+ // a parent would walk the cursor into a row nobody can see. Every scroll the
1112
+ // controller does — focus, the three selects, select-children, extend —
1113
+ // comes through this one call, so this is the only place it has to be said.
1114
+ onScrollToIndex: (s) => t.scrollToIndex(s, "auto", a(s))
1115
+ }), i = () => {
1116
+ const s = c.cursorIndex();
1117
+ return s < 0 ? void 0 : o().at(s);
1118
+ };
1119
+ let f = null;
1120
+ ee(() => {
1121
+ const s = t.scrollTop();
1122
+ f = we(
1123
+ Ke(o),
1124
+ s,
1125
+ e.rowHeight
1126
+ );
1127
+ }), ee(
1128
+ Oe(
1129
+ o,
1130
+ (s) => {
1131
+ const y = zt(
1132
+ s,
1133
+ f,
1134
+ t.readScrollTop(),
1135
+ e.rowHeight
1136
+ );
1137
+ y !== null && t.scrollToContentTop(y), f = we(
1138
+ s,
1139
+ t.readScrollTop(),
1140
+ e.rowHeight
1141
+ );
1142
+ },
1143
+ { defer: !0 }
1144
+ )
1145
+ );
1146
+ function v(s, y, S) {
1147
+ if (e.openMenu) {
1148
+ e.openMenu(s, y, S);
1149
+ return;
1150
+ }
1151
+ if (!e.buildMenu) return;
1152
+ const T = e.buildMenu(s, c.selectedKeys());
1153
+ if (T.length !== 0) {
1154
+ if (!n)
1155
+ throw new ce(
1156
+ "createTreeSurface: descriptor builds a context menu but no DesktopContextMenuProvider is mounted"
1157
+ );
1158
+ n.open(y.x, y.y, T, S);
1159
+ }
1160
+ }
1161
+ return {
1162
+ descriptor: e,
1163
+ controller: c,
1164
+ scroller: t,
1165
+ source: o,
1166
+ cursorRow: i,
1167
+ stickyState: r,
1168
+ stickyInsetFor: a,
1169
+ openMenu: v
1170
+ };
1171
+ }
1172
+ const vn = 0.85;
1173
+ function p(e, n) {
1174
+ if (!Number.isInteger(n) || n < 0 || n >= e.length)
1175
+ throw new ce(
1176
+ `tree row source: index ${n} is outside 0..${e.length - 1}`
1177
+ );
1178
+ }
1179
+ function jt(e) {
1180
+ const n = e.length, o = new Int32Array(n), t = new Int32Array(n), r = new Int32Array(n), a = new Int32Array(n), c = [], i = [], f = [], v = [];
1181
+ let s = -1, y = -1;
1182
+ for (let S = 0; S < n; S++) {
1183
+ const T = e[S].depth;
1184
+ for (; i.length > 0 && e[i[i.length - 1]].depth >= T; )
1185
+ t[i.pop()] = S - 1, f.pop(), v.pop();
1186
+ const k = i.length - 1;
1187
+ o[S] = k < 0 ? -1 : i[k];
1188
+ const B = k < 0 ? s : f[k];
1189
+ let E = k < 0 ? y : v[k];
1190
+ B !== T && (E = c.length, c.push(0), k < 0 ? (s = T, y = E) : (f[k] = T, v[k] = E)), c[E] = c[E] + 1, a[S] = E, r[S] = c[E], i.push(S), f.push(-1), v.push(-1);
1191
+ }
1192
+ for (const S of i) t[S] = n - 1;
1193
+ return { parent: o, subtreeEnd: t, posInSet: r, group: a, groupSizes: c };
1194
+ }
1195
+ function Jt(e) {
1196
+ const n = /* @__PURE__ */ new Map();
1197
+ for (let o = 0; o < e.length; o++) {
1198
+ const t = e[o].key, r = n.get(t);
1199
+ if (r !== void 0)
1200
+ throw new ce(
1201
+ `tree row source: key "${t}" occurs at rows ${r} and ${o}`
1202
+ );
1203
+ n.set(t, o);
1204
+ }
1205
+ return n;
1206
+ }
1207
+ function mn(e) {
1208
+ const n = e.slice(), o = jt(n), t = Jt(n), r = {
1209
+ length: n.length,
1210
+ at: (a) => (p(r, a), n[a]),
1211
+ parentIndex: (a) => (p(r, a), o.parent[a]),
1212
+ subtreeEnd: (a) => (p(r, a), o.subtreeEnd[a]),
1213
+ siblingPosition: (a) => (p(r, a), {
1214
+ posInSet: o.posInSet[a],
1215
+ setSize: o.groupSizes[o.group[a]]
1216
+ }),
1217
+ indexOfKey: (a) => t.get(a) ?? -1
1218
+ };
1219
+ return r;
1220
+ }
1221
+ export {
1222
+ be as D,
1223
+ vn as T,
1224
+ gn as a,
1225
+ Ae as b,
1226
+ yn as c,
1227
+ p as d,
1228
+ Ve as e,
1229
+ ze as f,
1230
+ Ye as g,
1231
+ Bt as h,
1232
+ wn as i,
1233
+ mn as j,
1234
+ Pt as s,
1235
+ Ie as t
1236
+ };