@eightshift/ui-components 5.0.0 → 5.0.1

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 (144) hide show
  1. package/dist/Button-wERNNG0T.js +185 -0
  2. package/dist/Collection-CKsHTyhc.js +2363 -0
  3. package/dist/Color-BhgbJF5x.js +2452 -0
  4. package/dist/ColorSwatch-Bcn6oRSg.js +64 -0
  5. package/dist/ComboBox-D1LPUwWP.js +1906 -0
  6. package/dist/Dialog-D190gMbE.js +2298 -0
  7. package/dist/FieldError-DeUh5Wkw.js +42 -0
  8. package/dist/FocusScope-C-plSxbS.js +831 -0
  9. package/dist/Form-Cq3fu75_.js +5 -0
  10. package/dist/Group-C5iZpSAM.js +48 -0
  11. package/dist/Heading-D-Pboe4p.js +16 -0
  12. package/dist/Hidden-rE6uR-lr.js +41 -0
  13. package/dist/Input--mF4XVE1.js +133 -0
  14. package/dist/Label-Fp6AwSRn.js +17 -0
  15. package/dist/List-CZMUbkFU.js +593 -0
  16. package/dist/ListBox-4oW9kh3R.js +582 -0
  17. package/dist/NumberFormatter-DA8u1Ot7.js +140 -0
  18. package/dist/OverlayArrow-BpB9uB_I.js +637 -0
  19. package/dist/RSPContexts-2lR5GG9p.js +14 -0
  20. package/dist/Select-aab027f3.esm-BKIJGje-.js +2469 -0
  21. package/dist/Separator-B88tj5YD.js +323 -0
  22. package/dist/Slider-CyJzC1bp.js +853 -0
  23. package/dist/Text-DRpwWot2.js +16 -0
  24. package/dist/VisuallyHidden-DsKYcRQ_.js +48 -0
  25. package/dist/_commonjsHelpers-CUmg6egw.js +6 -0
  26. package/dist/assets/index.css +57 -0
  27. package/dist/assets/style-admin.css +5864 -0
  28. package/dist/assets/style-editor.css +5864 -0
  29. package/dist/assets/style.css +5870 -0
  30. package/dist/assets/wp-font-enhancements.css +8 -0
  31. package/dist/assets/wp-ui-enhancements.css +377 -0
  32. package/dist/components/animated-visibility/animated-visibility.js +105 -0
  33. package/dist/components/base-control/base-control.js +86 -0
  34. package/dist/components/breakpoint-preview/breakpoint-preview.js +161 -0
  35. package/dist/components/button/button.js +387 -0
  36. package/dist/components/checkbox/checkbox.js +320 -0
  37. package/dist/components/color-pickers/color-picker.js +272 -0
  38. package/dist/components/color-pickers/color-swatch.js +59 -0
  39. package/dist/components/color-pickers/gradient-editor.js +534 -0
  40. package/dist/components/color-pickers/solid-color-picker.js +1567 -0
  41. package/dist/components/component-toggle/component-toggle.js +161 -0
  42. package/dist/components/container-panel/container-panel.js +131 -0
  43. package/dist/components/draggable/draggable-context.js +5 -0
  44. package/dist/components/draggable/draggable-handle.js +46 -0
  45. package/dist/components/draggable/draggable.js +6979 -0
  46. package/dist/components/draggable-list/draggable-list-context.js +5 -0
  47. package/dist/components/draggable-list/draggable-list-item.js +77 -0
  48. package/dist/components/draggable-list/draggable-list.js +151 -0
  49. package/dist/components/expandable/expandable.js +342 -0
  50. package/dist/components/index.js +137 -0
  51. package/dist/components/input-field/input-field.js +231 -0
  52. package/dist/components/item-collection/item-collection.js +59 -0
  53. package/dist/components/layout/hstack.js +30 -0
  54. package/dist/components/layout/vstack.js +30 -0
  55. package/dist/components/link-input/link-input.js +291 -0
  56. package/dist/components/matrix-align/matrix-align.js +134 -0
  57. package/dist/components/menu/menu.js +285 -0
  58. package/dist/components/modal/modal.js +305 -0
  59. package/dist/components/notice/notice.js +123 -0
  60. package/dist/components/number-picker/number-picker.js +292 -0
  61. package/dist/components/option-select/option-select.js +264 -0
  62. package/dist/components/options-panel/options-panel.js +158 -0
  63. package/dist/components/placeholders/file-placeholder.js +42 -0
  64. package/dist/components/placeholders/image-placeholder.js +88 -0
  65. package/dist/components/placeholders/media-placeholder.js +63 -0
  66. package/dist/components/popover/popover.js +207 -0
  67. package/dist/components/radio/radio.js +579 -0
  68. package/dist/components/repeater/repeater-context.js +5 -0
  69. package/dist/components/repeater/repeater-item.js +119 -0
  70. package/dist/components/repeater/repeater.js +280 -0
  71. package/dist/components/responsive/mini-responsive.js +498 -0
  72. package/dist/components/responsive/responsive-legacy.js +343 -0
  73. package/dist/components/responsive/responsive.js +583 -0
  74. package/dist/components/responsive-preview/responsive-preview.js +123 -0
  75. package/dist/components/rich-label/rich-label.js +66 -0
  76. package/dist/components/select/async-multi-select.js +157 -0
  77. package/dist/components/select/async-single-select.js +137 -0
  78. package/dist/components/select/custom-select-default-components.js +38 -0
  79. package/dist/components/select/multi-select-components.js +8 -0
  80. package/dist/components/select/multi-select.js +151 -0
  81. package/dist/components/select/react-select-component-wrappers.js +90 -0
  82. package/dist/components/select/shared.js +26 -0
  83. package/dist/components/select/single-select.js +131 -0
  84. package/dist/components/select/styles.js +49 -0
  85. package/dist/components/select/v2/async-select.js +297 -0
  86. package/dist/components/select/v2/shared.js +24 -0
  87. package/dist/components/select/v2/single-select.js +991 -0
  88. package/dist/components/slider/column-config-slider.js +210 -0
  89. package/dist/components/slider/slider.js +345 -0
  90. package/dist/components/slider/utils.js +94 -0
  91. package/dist/components/spacer/spacer.js +97 -0
  92. package/dist/components/tabs/tabs.js +704 -0
  93. package/dist/components/toggle/switch.js +156 -0
  94. package/dist/components/toggle/toggle.js +64 -0
  95. package/dist/components/toggle-button/toggle-button.js +343 -0
  96. package/dist/components/tooltip/tooltip.js +527 -0
  97. package/dist/context-BYWrbm1z.js +92 -0
  98. package/dist/default-i18n-CT_oS1Fy.js +922 -0
  99. package/dist/filterDOMProps-EDDcM64A.js +28 -0
  100. package/dist/icons/block-icon.js +42 -0
  101. package/dist/icons/generic-color-swatch.js +113 -0
  102. package/dist/icons/icons.js +30371 -0
  103. package/dist/icons/index.js +11 -0
  104. package/dist/icons/jsx-svg.js +50 -0
  105. package/dist/index-641ee5b8.esm-BPU8rMZr.js +3137 -0
  106. package/dist/index-CFozsmNS.js +28321 -0
  107. package/dist/index-wl5606BX.js +44 -0
  108. package/dist/index.js +139 -0
  109. package/dist/lite-DVmmD_-j.js +7 -0
  110. package/dist/modifiers.esm-BuJQPI1X.js +31 -0
  111. package/dist/multi-select-components-Sp-JEFEX.js +3744 -0
  112. package/dist/number-GajL10e1.js +36 -0
  113. package/dist/react-jsx-parser.min-DZCiis5V.js +11753 -0
  114. package/dist/react-select-async.esm-D937XTWW.js +107 -0
  115. package/dist/react-select.esm-Ciai3aKf.js +15 -0
  116. package/dist/style-admin.js +1 -0
  117. package/dist/style-editor.js +1 -0
  118. package/dist/style.js +1 -0
  119. package/dist/textSelection-CCcyjiRP.js +46 -0
  120. package/dist/useButton-BOHxkGQF.js +50 -0
  121. package/dist/useEvent-D5o_CqDH.js +23 -0
  122. package/dist/useFocusRing-nMG2uzxS.js +107 -0
  123. package/dist/useFormReset-DlmRL87g.js +22 -0
  124. package/dist/useFormValidation-D0_aaK-e.js +224 -0
  125. package/dist/useHover-VO5tcIli.js +890 -0
  126. package/dist/useLabel-BKH4fVA4.js +27 -0
  127. package/dist/useLabels-ntF3rFY0.js +23 -0
  128. package/dist/useListState-Cq2Nvr-v.js +161 -0
  129. package/dist/useLocalizedStringFormatter-CGzwx1a0.js +121 -0
  130. package/dist/useNumberField-C9dmERhP.js +1207 -0
  131. package/dist/useNumberFormatter-MrRLgvhj.js +13 -0
  132. package/dist/usePress-DjNo5790.js +677 -0
  133. package/dist/useSingleSelectListState--r3AAhRj.js +38 -0
  134. package/dist/useToggle-CQaXLe-O.js +59 -0
  135. package/dist/useToggleState-C3DLdez5.js +19 -0
  136. package/dist/utilities/array-helpers.js +56 -0
  137. package/dist/utilities/debounce-throttle.js +123 -0
  138. package/dist/utilities/es-dash.js +382 -0
  139. package/dist/utilities/index.js +27 -0
  140. package/dist/utilities/text-helpers.js +136 -0
  141. package/dist/utils-B94NDG0v.js +370 -0
  142. package/dist/wp/wp-font-enhancements.js +1 -0
  143. package/dist/wp/wp-ui-enhancements.js +1 -0
  144. package/package.json +8 -8
@@ -0,0 +1,2363 @@
1
+ import { a as $f39a9eba43920ace$export$8dc98ba7eadeaa56 } from "./Hidden-rE6uR-lr.js";
2
+ import { r as reactDomExports } from "./index-CFozsmNS.js";
3
+ import { B as $c87311424ea30a05$export$9ac100e40613ea10, g as $03deb23ff14920c4$export$4eaf04e54aa8eed6, d as $431fbd86ca7dc216$export$b204af158042fbac, z as $7215afc6de606d6b$export$de79e2c695e052f3, J as $f645667febf57a63$export$f9762fab77588ecb, i as $d4ee10de306f2510$export$cd4e5573fbe2b576, K as $c87311424ea30a05$export$e1865c3bedcd822b, u as $3ad3f6e1647bc98d$export$80f3e147d781571c, x as $507fabe10e71c6fb$export$630ff653c5ada6a9, b as $458b0a5536c1a7cf$export$40bfa8c7b0832715 } from "./useHover-VO5tcIli.js";
4
+ import React__default, { useRef, useState, useMemo, cloneElement, forwardRef, useContext, createContext, useCallback, useEffect } from "react";
5
+ import { k as $f0a04ccd8dbdd83b$export$e5c5a5f917a5871c, d as $3ef42575df84b30b$export$9d1611c77c2fe928, n as $b5e257d569688ac6$export$535bd6ca7f90a273, e as $bdb11010cef70236$export$f680877a34711e37, f as $8ae05eaa5c114e9c$export$7f54fc3180508a52 } from "./utils-B94NDG0v.js";
6
+ import { $ as $f6c31cce2adf654f$export$45712eceda6fad21, b as $ea8dcbcb9ea1b556$export$9a302a45f65d0572, c as $ea8dcbcb9ea1b556$export$95185d699e05d4d7 } from "./usePress-DjNo5790.js";
7
+ import { $ as $e9faafb641e167db$export$90fc3a17d93f704c } from "./useEvent-D5o_CqDH.js";
8
+ import { a as $9bf71ea28793e738$export$2d6ec8fc375ceafa } from "./FocusScope-C-plSxbS.js";
9
+ import { $ as $18f2051aff69b9bf$export$43bb16f9c6d9e3f7 } from "./context-BYWrbm1z.js";
10
+ function $ca9b37712f007381$export$72ef708ab07251f1(effect, dependencies) {
11
+ const isInitialMount = useRef(true);
12
+ const lastDeps = useRef(null);
13
+ $f0a04ccd8dbdd83b$export$e5c5a5f917a5871c(() => {
14
+ isInitialMount.current = true;
15
+ return () => {
16
+ isInitialMount.current = false;
17
+ };
18
+ }, []);
19
+ $f0a04ccd8dbdd83b$export$e5c5a5f917a5871c(() => {
20
+ if (isInitialMount.current) isInitialMount.current = false;
21
+ else if (!lastDeps.current || dependencies.some((dep, i) => !Object.is(dep, lastDeps[i]))) effect();
22
+ lastDeps.current = dependencies;
23
+ }, dependencies);
24
+ }
25
+ function $cc38e7bd3fc7b213$export$2bb74740c4e19def(node, checkForOverflow) {
26
+ if (!node) return false;
27
+ let style = window.getComputedStyle(node);
28
+ let isScrollable = /(auto|scroll)/.test(style.overflow + style.overflowX + style.overflowY);
29
+ if (isScrollable && checkForOverflow) isScrollable = node.scrollHeight !== node.clientHeight || node.scrollWidth !== node.clientWidth;
30
+ return isScrollable;
31
+ }
32
+ function $a40c673dc9f6d9c7$export$94ed1c92c7beeb22(node, checkForOverflow) {
33
+ const scrollParents = [];
34
+ while (node && node !== document.documentElement) {
35
+ if ($cc38e7bd3fc7b213$export$2bb74740c4e19def(node, checkForOverflow)) scrollParents.push(node);
36
+ node = node.parentElement;
37
+ }
38
+ return scrollParents;
39
+ }
40
+ let $ef06256079686ba0$var$descriptionId = 0;
41
+ const $ef06256079686ba0$var$descriptionNodes = /* @__PURE__ */ new Map();
42
+ function $ef06256079686ba0$export$f8aeda7b10753fa1(description) {
43
+ let [id, setId] = useState();
44
+ $f0a04ccd8dbdd83b$export$e5c5a5f917a5871c(() => {
45
+ if (!description) return;
46
+ let desc = $ef06256079686ba0$var$descriptionNodes.get(description);
47
+ if (!desc) {
48
+ let id2 = `react-aria-description-${$ef06256079686ba0$var$descriptionId++}`;
49
+ setId(id2);
50
+ let node = document.createElement("div");
51
+ node.id = id2;
52
+ node.style.display = "none";
53
+ node.textContent = description;
54
+ document.body.appendChild(node);
55
+ desc = {
56
+ refCount: 0,
57
+ element: node
58
+ };
59
+ $ef06256079686ba0$var$descriptionNodes.set(description, desc);
60
+ } else setId(desc.element.id);
61
+ desc.refCount++;
62
+ return () => {
63
+ if (desc && --desc.refCount === 0) {
64
+ desc.element.remove();
65
+ $ef06256079686ba0$var$descriptionNodes.delete(description);
66
+ }
67
+ };
68
+ }, [
69
+ description
70
+ ]);
71
+ return {
72
+ "aria-describedby": description ? id : void 0
73
+ };
74
+ }
75
+ function $2f04cbc44ee30ce0$export$53a0910f038337bd(scrollView, element) {
76
+ let offsetX = $2f04cbc44ee30ce0$var$relativeOffset(scrollView, element, "left");
77
+ let offsetY = $2f04cbc44ee30ce0$var$relativeOffset(scrollView, element, "top");
78
+ let width = element.offsetWidth;
79
+ let height = element.offsetHeight;
80
+ let x = scrollView.scrollLeft;
81
+ let y = scrollView.scrollTop;
82
+ let { borderTopWidth, borderLeftWidth, scrollPaddingTop, scrollPaddingRight, scrollPaddingBottom, scrollPaddingLeft } = getComputedStyle(scrollView);
83
+ let borderAdjustedX = x + parseInt(borderLeftWidth, 10);
84
+ let borderAdjustedY = y + parseInt(borderTopWidth, 10);
85
+ let maxX = borderAdjustedX + scrollView.clientWidth;
86
+ let maxY = borderAdjustedY + scrollView.clientHeight;
87
+ let scrollPaddingTopNumber = parseInt(scrollPaddingTop, 10) || 0;
88
+ let scrollPaddingBottomNumber = parseInt(scrollPaddingBottom, 10) || 0;
89
+ let scrollPaddingRightNumber = parseInt(scrollPaddingRight, 10) || 0;
90
+ let scrollPaddingLeftNumber = parseInt(scrollPaddingLeft, 10) || 0;
91
+ if (offsetX <= x + scrollPaddingLeftNumber) x = offsetX - parseInt(borderLeftWidth, 10) - scrollPaddingLeftNumber;
92
+ else if (offsetX + width > maxX - scrollPaddingRightNumber) x += offsetX + width - maxX + scrollPaddingRightNumber;
93
+ if (offsetY <= borderAdjustedY + scrollPaddingTopNumber) y = offsetY - parseInt(borderTopWidth, 10) - scrollPaddingTopNumber;
94
+ else if (offsetY + height > maxY - scrollPaddingBottomNumber) y += offsetY + height - maxY + scrollPaddingBottomNumber;
95
+ scrollView.scrollLeft = x;
96
+ scrollView.scrollTop = y;
97
+ }
98
+ function $2f04cbc44ee30ce0$var$relativeOffset(ancestor, child, axis) {
99
+ const prop = axis === "left" ? "offsetLeft" : "offsetTop";
100
+ let sum = 0;
101
+ while (child.offsetParent) {
102
+ sum += child[prop];
103
+ if (child.offsetParent === ancestor) break;
104
+ else if (child.offsetParent.contains(ancestor)) {
105
+ sum -= ancestor[prop];
106
+ break;
107
+ }
108
+ child = child.offsetParent;
109
+ }
110
+ return sum;
111
+ }
112
+ function $2f04cbc44ee30ce0$export$c826860796309d1b(targetElement, opts) {
113
+ if (targetElement && document.contains(targetElement)) {
114
+ let root = document.scrollingElement || document.documentElement;
115
+ let isScrollPrevented = window.getComputedStyle(root).overflow === "hidden";
116
+ if (!isScrollPrevented) {
117
+ var _targetElement_scrollIntoView;
118
+ let { left: originalLeft, top: originalTop } = targetElement.getBoundingClientRect();
119
+ targetElement === null || targetElement === void 0 ? void 0 : (_targetElement_scrollIntoView = targetElement.scrollIntoView) === null || _targetElement_scrollIntoView === void 0 ? void 0 : _targetElement_scrollIntoView.call(targetElement, {
120
+ block: "nearest"
121
+ });
122
+ let { left: newLeft, top: newTop } = targetElement.getBoundingClientRect();
123
+ if (Math.abs(originalLeft - newLeft) > 1 || Math.abs(originalTop - newTop) > 1) {
124
+ var _opts_containingElement_scrollIntoView, _opts_containingElement, _targetElement_scrollIntoView1;
125
+ opts === null || opts === void 0 ? void 0 : (_opts_containingElement = opts.containingElement) === null || _opts_containingElement === void 0 ? void 0 : (_opts_containingElement_scrollIntoView = _opts_containingElement.scrollIntoView) === null || _opts_containingElement_scrollIntoView === void 0 ? void 0 : _opts_containingElement_scrollIntoView.call(_opts_containingElement, {
126
+ block: "center",
127
+ inline: "center"
128
+ });
129
+ (_targetElement_scrollIntoView1 = targetElement.scrollIntoView) === null || _targetElement_scrollIntoView1 === void 0 ? void 0 : _targetElement_scrollIntoView1.call(targetElement, {
130
+ block: "nearest"
131
+ });
132
+ }
133
+ } else {
134
+ let scrollParents = $a40c673dc9f6d9c7$export$94ed1c92c7beeb22(targetElement);
135
+ for (let scrollParent of scrollParents) $2f04cbc44ee30ce0$export$53a0910f038337bd(scrollParent, targetElement);
136
+ }
137
+ }
138
+ }
139
+ const $5671b20cf9b562b2$export$447a38995de2c711 = "react-aria-clear-focus";
140
+ const $5671b20cf9b562b2$export$831c820ad60f9d12 = "react-aria-focus";
141
+ function $21f1aa98acb08317$export$16792effe837dba3(e) {
142
+ if ($c87311424ea30a05$export$9ac100e40613ea10()) return e.metaKey;
143
+ return e.ctrlKey;
144
+ }
145
+ class $23b9f4fcf0fe224b$export$d68d59712b04d9d1 {
146
+ get childNodes() {
147
+ throw new Error("childNodes is not supported");
148
+ }
149
+ clone() {
150
+ let node = new $23b9f4fcf0fe224b$export$d68d59712b04d9d1(this.type, this.key);
151
+ node.value = this.value;
152
+ node.level = this.level;
153
+ node.hasChildNodes = this.hasChildNodes;
154
+ node.rendered = this.rendered;
155
+ node.textValue = this.textValue;
156
+ node["aria-label"] = this["aria-label"];
157
+ node.index = this.index;
158
+ node.parentKey = this.parentKey;
159
+ node.prevKey = this.prevKey;
160
+ node.nextKey = this.nextKey;
161
+ node.firstChildKey = this.firstChildKey;
162
+ node.lastChildKey = this.lastChildKey;
163
+ node.props = this.props;
164
+ node.render = this.render;
165
+ node.colSpan = this.colSpan;
166
+ node.colIndex = this.colIndex;
167
+ return node;
168
+ }
169
+ constructor(type, key) {
170
+ this.value = null;
171
+ this.level = 0;
172
+ this.hasChildNodes = false;
173
+ this.rendered = null;
174
+ this.textValue = "";
175
+ this["aria-label"] = void 0;
176
+ this.index = 0;
177
+ this.parentKey = null;
178
+ this.prevKey = null;
179
+ this.nextKey = null;
180
+ this.firstChildKey = null;
181
+ this.lastChildKey = null;
182
+ this.props = {};
183
+ this.colSpan = null;
184
+ this.colIndex = null;
185
+ this.type = type;
186
+ this.key = key;
187
+ }
188
+ }
189
+ class $23b9f4fcf0fe224b$export$408d25a4e12db025 {
190
+ get size() {
191
+ return this.keyMap.size;
192
+ }
193
+ getKeys() {
194
+ return this.keyMap.keys();
195
+ }
196
+ *[Symbol.iterator]() {
197
+ let node = this.firstKey != null ? this.keyMap.get(this.firstKey) : void 0;
198
+ while (node) {
199
+ yield node;
200
+ node = node.nextKey != null ? this.keyMap.get(node.nextKey) : void 0;
201
+ }
202
+ }
203
+ getChildren(key) {
204
+ let keyMap = this.keyMap;
205
+ return {
206
+ *[Symbol.iterator]() {
207
+ let parent = keyMap.get(key);
208
+ let node = (parent === null || parent === void 0 ? void 0 : parent.firstChildKey) != null ? keyMap.get(parent.firstChildKey) : null;
209
+ while (node) {
210
+ yield node;
211
+ node = node.nextKey != null ? keyMap.get(node.nextKey) : void 0;
212
+ }
213
+ }
214
+ };
215
+ }
216
+ getKeyBefore(key) {
217
+ let node = this.keyMap.get(key);
218
+ if (!node) return null;
219
+ if (node.prevKey != null) {
220
+ node = this.keyMap.get(node.prevKey);
221
+ while (node && node.type !== "item" && node.lastChildKey != null) node = this.keyMap.get(node.lastChildKey);
222
+ var _node_key;
223
+ return (_node_key = node === null || node === void 0 ? void 0 : node.key) !== null && _node_key !== void 0 ? _node_key : null;
224
+ }
225
+ return node.parentKey;
226
+ }
227
+ getKeyAfter(key) {
228
+ let node = this.keyMap.get(key);
229
+ if (!node) return null;
230
+ if (node.type !== "item" && node.firstChildKey != null) return node.firstChildKey;
231
+ while (node) {
232
+ if (node.nextKey != null) return node.nextKey;
233
+ if (node.parentKey != null) node = this.keyMap.get(node.parentKey);
234
+ else return null;
235
+ }
236
+ return null;
237
+ }
238
+ getFirstKey() {
239
+ return this.firstKey;
240
+ }
241
+ getLastKey() {
242
+ let node = this.lastKey != null ? this.keyMap.get(this.lastKey) : null;
243
+ while ((node === null || node === void 0 ? void 0 : node.lastChildKey) != null) node = this.keyMap.get(node.lastChildKey);
244
+ var _node_key;
245
+ return (_node_key = node === null || node === void 0 ? void 0 : node.key) !== null && _node_key !== void 0 ? _node_key : null;
246
+ }
247
+ getItem(key) {
248
+ var _this_keyMap_get;
249
+ return (_this_keyMap_get = this.keyMap.get(key)) !== null && _this_keyMap_get !== void 0 ? _this_keyMap_get : null;
250
+ }
251
+ at() {
252
+ throw new Error("Not implemented");
253
+ }
254
+ clone() {
255
+ let Constructor = this.constructor;
256
+ let collection = new Constructor();
257
+ collection.keyMap = new Map(this.keyMap);
258
+ collection.firstKey = this.firstKey;
259
+ collection.lastKey = this.lastKey;
260
+ return collection;
261
+ }
262
+ addNode(node) {
263
+ if (this.frozen) throw new Error("Cannot add a node to a frozen collection");
264
+ this.keyMap.set(node.key, node);
265
+ }
266
+ removeNode(key) {
267
+ if (this.frozen) throw new Error("Cannot remove a node to a frozen collection");
268
+ this.keyMap.delete(key);
269
+ }
270
+ commit(firstKey, lastKey, isSSR = false) {
271
+ if (this.frozen) throw new Error("Cannot commit a frozen collection");
272
+ this.firstKey = firstKey;
273
+ this.lastKey = lastKey;
274
+ this.frozen = !isSSR;
275
+ }
276
+ // TODO: this is pretty specific to menu, will need to check if it is generic enough
277
+ // Will need to handle varying levels I assume but will revisit after I get searchable menu working for base menu
278
+ // TODO: an alternative is to simply walk the collection and add all item nodes that match the filter and any sections/separators we encounter
279
+ // to an array, then walk that new array and fix all the next/Prev keys while adding them to the new collection
280
+ UNSTABLE_filter(filterFn) {
281
+ let newCollection = new $23b9f4fcf0fe224b$export$408d25a4e12db025();
282
+ let lastNode = null;
283
+ for (let node of this) {
284
+ if (node.type === "section" && node.hasChildNodes) {
285
+ let clonedSection = node.clone();
286
+ let lastChildInSection = null;
287
+ for (let child of this.getChildren(node.key)) if ($23b9f4fcf0fe224b$var$shouldKeepNode(child, filterFn, this, newCollection)) {
288
+ let clonedChild = child.clone();
289
+ if (lastChildInSection == null) clonedSection.firstChildKey = clonedChild.key;
290
+ if (newCollection.firstKey == null) newCollection.firstKey = clonedSection.key;
291
+ if (lastChildInSection && lastChildInSection.parentKey === clonedChild.parentKey) {
292
+ lastChildInSection.nextKey = clonedChild.key;
293
+ clonedChild.prevKey = lastChildInSection.key;
294
+ } else clonedChild.prevKey = null;
295
+ clonedChild.nextKey = null;
296
+ newCollection.addNode(clonedChild);
297
+ lastChildInSection = clonedChild;
298
+ }
299
+ if (lastChildInSection) {
300
+ if (lastChildInSection.type !== "header") {
301
+ clonedSection.lastChildKey = lastChildInSection.key;
302
+ if (lastNode == null) clonedSection.prevKey = null;
303
+ else if (lastNode.type === "section" || lastNode.type === "separator") {
304
+ lastNode.nextKey = clonedSection.key;
305
+ clonedSection.prevKey = lastNode.key;
306
+ }
307
+ clonedSection.nextKey = null;
308
+ lastNode = clonedSection;
309
+ newCollection.addNode(clonedSection);
310
+ } else {
311
+ if (newCollection.firstKey === clonedSection.key) newCollection.firstKey = null;
312
+ newCollection.removeNode(lastChildInSection.key);
313
+ }
314
+ }
315
+ } else if (node.type === "separator") {
316
+ let clonedSeparator = node.clone();
317
+ clonedSeparator.nextKey = null;
318
+ if ((lastNode === null || lastNode === void 0 ? void 0 : lastNode.type) === "section") {
319
+ lastNode.nextKey = clonedSeparator.key;
320
+ clonedSeparator.prevKey = lastNode.key;
321
+ lastNode = clonedSeparator;
322
+ newCollection.addNode(clonedSeparator);
323
+ }
324
+ } else {
325
+ let clonedNode = node.clone();
326
+ if ($23b9f4fcf0fe224b$var$shouldKeepNode(clonedNode, filterFn, this, newCollection)) {
327
+ if (newCollection.firstKey == null) newCollection.firstKey = clonedNode.key;
328
+ if (lastNode != null && lastNode.type !== "section" && lastNode.type !== "separator" && lastNode.parentKey === clonedNode.parentKey) {
329
+ lastNode.nextKey = clonedNode.key;
330
+ clonedNode.prevKey = lastNode.key;
331
+ } else clonedNode.prevKey = null;
332
+ clonedNode.nextKey = null;
333
+ newCollection.addNode(clonedNode);
334
+ lastNode = clonedNode;
335
+ }
336
+ }
337
+ }
338
+ if ((lastNode === null || lastNode === void 0 ? void 0 : lastNode.type) === "separator" && lastNode.nextKey === null) {
339
+ let lastSection;
340
+ if (lastNode.prevKey != null) {
341
+ lastSection = newCollection.getItem(lastNode.prevKey);
342
+ lastSection.nextKey = null;
343
+ }
344
+ newCollection.removeNode(lastNode.key);
345
+ lastNode = lastSection;
346
+ }
347
+ newCollection.lastKey = (lastNode === null || lastNode === void 0 ? void 0 : lastNode.key) || null;
348
+ return newCollection;
349
+ }
350
+ constructor() {
351
+ this.keyMap = /* @__PURE__ */ new Map();
352
+ this.firstKey = null;
353
+ this.lastKey = null;
354
+ this.frozen = false;
355
+ }
356
+ }
357
+ function $23b9f4fcf0fe224b$var$shouldKeepNode(node, filterFn, oldCollection, newCollection) {
358
+ if (node.type === "subdialogtrigger" || node.type === "submenutrigger") {
359
+ let triggerChild = [
360
+ ...oldCollection.getChildren(node.key)
361
+ ][0];
362
+ if (triggerChild && filterFn(triggerChild.textValue)) {
363
+ let clonedChild = triggerChild.clone();
364
+ newCollection.addNode(clonedChild);
365
+ return true;
366
+ } else return false;
367
+ } else if (node.type === "header") return true;
368
+ else return filterFn(node.textValue);
369
+ }
370
+ class $681cc3c98f569e39$export$410b0c854570d131 {
371
+ *[Symbol.iterator]() {
372
+ let node = this.firstChild;
373
+ while (node) {
374
+ yield node;
375
+ node = node.nextSibling;
376
+ }
377
+ }
378
+ get firstChild() {
379
+ return this._firstChild;
380
+ }
381
+ set firstChild(firstChild) {
382
+ this._firstChild = firstChild;
383
+ this.ownerDocument.markDirty(this);
384
+ }
385
+ get lastChild() {
386
+ return this._lastChild;
387
+ }
388
+ set lastChild(lastChild) {
389
+ this._lastChild = lastChild;
390
+ this.ownerDocument.markDirty(this);
391
+ }
392
+ get previousSibling() {
393
+ return this._previousSibling;
394
+ }
395
+ set previousSibling(previousSibling) {
396
+ this._previousSibling = previousSibling;
397
+ this.ownerDocument.markDirty(this);
398
+ }
399
+ get nextSibling() {
400
+ return this._nextSibling;
401
+ }
402
+ set nextSibling(nextSibling) {
403
+ this._nextSibling = nextSibling;
404
+ this.ownerDocument.markDirty(this);
405
+ }
406
+ get parentNode() {
407
+ return this._parentNode;
408
+ }
409
+ set parentNode(parentNode) {
410
+ this._parentNode = parentNode;
411
+ this.ownerDocument.markDirty(this);
412
+ }
413
+ get isConnected() {
414
+ var _this_parentNode;
415
+ return ((_this_parentNode = this.parentNode) === null || _this_parentNode === void 0 ? void 0 : _this_parentNode.isConnected) || false;
416
+ }
417
+ invalidateChildIndices(child) {
418
+ if (this._minInvalidChildIndex == null || child.index < this._minInvalidChildIndex.index) this._minInvalidChildIndex = child;
419
+ }
420
+ updateChildIndices() {
421
+ let node = this._minInvalidChildIndex;
422
+ while (node) {
423
+ node.index = node.previousSibling ? node.previousSibling.index + 1 : 0;
424
+ node = node.nextSibling;
425
+ }
426
+ this._minInvalidChildIndex = null;
427
+ }
428
+ appendChild(child) {
429
+ if (child.parentNode) child.parentNode.removeChild(child);
430
+ if (this.firstChild == null) this.firstChild = child;
431
+ if (this.lastChild) {
432
+ this.lastChild.nextSibling = child;
433
+ child.index = this.lastChild.index + 1;
434
+ child.previousSibling = this.lastChild;
435
+ } else {
436
+ child.previousSibling = null;
437
+ child.index = 0;
438
+ }
439
+ child.parentNode = this;
440
+ child.nextSibling = null;
441
+ this.lastChild = child;
442
+ this.ownerDocument.markDirty(this);
443
+ this.ownerDocument.queueUpdate();
444
+ }
445
+ insertBefore(newNode, referenceNode) {
446
+ if (referenceNode == null) return this.appendChild(newNode);
447
+ if (newNode.parentNode) newNode.parentNode.removeChild(newNode);
448
+ newNode.nextSibling = referenceNode;
449
+ newNode.previousSibling = referenceNode.previousSibling;
450
+ newNode.index = referenceNode.index;
451
+ if (this.firstChild === referenceNode) this.firstChild = newNode;
452
+ else if (referenceNode.previousSibling) referenceNode.previousSibling.nextSibling = newNode;
453
+ referenceNode.previousSibling = newNode;
454
+ newNode.parentNode = referenceNode.parentNode;
455
+ this.invalidateChildIndices(referenceNode);
456
+ this.ownerDocument.queueUpdate();
457
+ }
458
+ removeChild(child) {
459
+ if (child.parentNode !== this || !this.ownerDocument.isMounted) return;
460
+ if (child.nextSibling) {
461
+ this.invalidateChildIndices(child.nextSibling);
462
+ child.nextSibling.previousSibling = child.previousSibling;
463
+ }
464
+ if (child.previousSibling) child.previousSibling.nextSibling = child.nextSibling;
465
+ if (this.firstChild === child) this.firstChild = child.nextSibling;
466
+ if (this.lastChild === child) this.lastChild = child.previousSibling;
467
+ child.parentNode = null;
468
+ child.nextSibling = null;
469
+ child.previousSibling = null;
470
+ child.index = 0;
471
+ this.ownerDocument.markDirty(child);
472
+ this.ownerDocument.queueUpdate();
473
+ }
474
+ addEventListener() {
475
+ }
476
+ removeEventListener() {
477
+ }
478
+ get previousVisibleSibling() {
479
+ let node = this.previousSibling;
480
+ while (node && node.isHidden) node = node.previousSibling;
481
+ return node;
482
+ }
483
+ get nextVisibleSibling() {
484
+ let node = this.nextSibling;
485
+ while (node && node.isHidden) node = node.nextSibling;
486
+ return node;
487
+ }
488
+ get firstVisibleChild() {
489
+ let node = this.firstChild;
490
+ while (node && node.isHidden) node = node.nextSibling;
491
+ return node;
492
+ }
493
+ get lastVisibleChild() {
494
+ let node = this.lastChild;
495
+ while (node && node.isHidden) node = node.previousSibling;
496
+ return node;
497
+ }
498
+ constructor(ownerDocument) {
499
+ this._firstChild = null;
500
+ this._lastChild = null;
501
+ this._previousSibling = null;
502
+ this._nextSibling = null;
503
+ this._parentNode = null;
504
+ this._minInvalidChildIndex = null;
505
+ this.ownerDocument = ownerDocument;
506
+ }
507
+ }
508
+ class $681cc3c98f569e39$export$dc064fe9e59310fd extends $681cc3c98f569e39$export$410b0c854570d131 {
509
+ get index() {
510
+ return this._index;
511
+ }
512
+ set index(index) {
513
+ this._index = index;
514
+ this.ownerDocument.markDirty(this);
515
+ }
516
+ get level() {
517
+ if (this.parentNode instanceof $681cc3c98f569e39$export$dc064fe9e59310fd) return this.parentNode.level + (this.node.type === "item" ? 1 : 0);
518
+ return 0;
519
+ }
520
+ /**
521
+ * Lazily gets a mutable instance of a Node. If the node has already
522
+ * been cloned during this update cycle, it just returns the existing one.
523
+ */
524
+ getMutableNode() {
525
+ if (!this.isMutated) {
526
+ this.node = this.node.clone();
527
+ this.isMutated = true;
528
+ }
529
+ this.ownerDocument.markDirty(this);
530
+ return this.node;
531
+ }
532
+ updateNode() {
533
+ var _this_previousVisibleSibling, _this_firstVisibleChild, _this_lastVisibleChild;
534
+ let nextSibling = this.nextVisibleSibling;
535
+ let node = this.getMutableNode();
536
+ node.index = this.index;
537
+ node.level = this.level;
538
+ node.parentKey = this.parentNode instanceof $681cc3c98f569e39$export$dc064fe9e59310fd ? this.parentNode.node.key : null;
539
+ var _this_previousVisibleSibling_node_key;
540
+ node.prevKey = (_this_previousVisibleSibling_node_key = (_this_previousVisibleSibling = this.previousVisibleSibling) === null || _this_previousVisibleSibling === void 0 ? void 0 : _this_previousVisibleSibling.node.key) !== null && _this_previousVisibleSibling_node_key !== void 0 ? _this_previousVisibleSibling_node_key : null;
541
+ var _nextSibling_node_key;
542
+ node.nextKey = (_nextSibling_node_key = nextSibling === null || nextSibling === void 0 ? void 0 : nextSibling.node.key) !== null && _nextSibling_node_key !== void 0 ? _nextSibling_node_key : null;
543
+ node.hasChildNodes = !!this.firstChild;
544
+ var _this_firstVisibleChild_node_key;
545
+ node.firstChildKey = (_this_firstVisibleChild_node_key = (_this_firstVisibleChild = this.firstVisibleChild) === null || _this_firstVisibleChild === void 0 ? void 0 : _this_firstVisibleChild.node.key) !== null && _this_firstVisibleChild_node_key !== void 0 ? _this_firstVisibleChild_node_key : null;
546
+ var _this_lastVisibleChild_node_key;
547
+ node.lastChildKey = (_this_lastVisibleChild_node_key = (_this_lastVisibleChild = this.lastVisibleChild) === null || _this_lastVisibleChild === void 0 ? void 0 : _this_lastVisibleChild.node.key) !== null && _this_lastVisibleChild_node_key !== void 0 ? _this_lastVisibleChild_node_key : null;
548
+ if ((node.colSpan != null || node.colIndex != null) && nextSibling) {
549
+ var _node_colIndex, _node_colSpan;
550
+ let nextColIndex = ((_node_colIndex = node.colIndex) !== null && _node_colIndex !== void 0 ? _node_colIndex : node.index) + ((_node_colSpan = node.colSpan) !== null && _node_colSpan !== void 0 ? _node_colSpan : 1);
551
+ if (nextColIndex !== nextSibling.node.colIndex) {
552
+ let siblingNode = nextSibling.getMutableNode();
553
+ siblingNode.colIndex = nextColIndex;
554
+ }
555
+ }
556
+ }
557
+ setProps(obj, ref, rendered, render) {
558
+ let node = this.getMutableNode();
559
+ let { value: value1, textValue, id, ...props } = obj;
560
+ props.ref = ref;
561
+ node.props = props;
562
+ node.rendered = rendered;
563
+ node.render = render;
564
+ node.value = value1;
565
+ node.textValue = textValue || (typeof props.children === "string" ? props.children : "") || obj["aria-label"] || "";
566
+ if (id != null && id !== node.key) {
567
+ if (this.hasSetProps) throw new Error("Cannot change the id of an item");
568
+ node.key = id;
569
+ }
570
+ if (props.colSpan != null) node.colSpan = props.colSpan;
571
+ this.hasSetProps = true;
572
+ this.ownerDocument.queueUpdate();
573
+ }
574
+ get style() {
575
+ let element = this;
576
+ return {
577
+ get display() {
578
+ return element.isHidden ? "none" : "";
579
+ },
580
+ set display(value) {
581
+ let isHidden = value === "none";
582
+ if (element.isHidden !== isHidden) {
583
+ var _element_parentNode, _element_parentNode1;
584
+ if (((_element_parentNode = element.parentNode) === null || _element_parentNode === void 0 ? void 0 : _element_parentNode.firstVisibleChild) === element || ((_element_parentNode1 = element.parentNode) === null || _element_parentNode1 === void 0 ? void 0 : _element_parentNode1.lastVisibleChild) === element) element.ownerDocument.markDirty(element.parentNode);
585
+ let prev = element.previousVisibleSibling;
586
+ let next = element.nextVisibleSibling;
587
+ if (prev) element.ownerDocument.markDirty(prev);
588
+ if (next) element.ownerDocument.markDirty(next);
589
+ element.isHidden = isHidden;
590
+ element.ownerDocument.markDirty(element);
591
+ }
592
+ }
593
+ };
594
+ }
595
+ hasAttribute() {
596
+ }
597
+ setAttribute() {
598
+ }
599
+ setAttributeNS() {
600
+ }
601
+ removeAttribute() {
602
+ }
603
+ constructor(type, ownerDocument) {
604
+ super(ownerDocument), this.nodeType = 8, this.isMutated = true, this._index = 0, this.hasSetProps = false, this.isHidden = false;
605
+ this.node = new $23b9f4fcf0fe224b$export$d68d59712b04d9d1(type, `react-aria-${++ownerDocument.nodeId}`);
606
+ }
607
+ }
608
+ class $681cc3c98f569e39$export$b34a105447964f9f extends $681cc3c98f569e39$export$410b0c854570d131 {
609
+ get isConnected() {
610
+ return this.isMounted;
611
+ }
612
+ createElement(type) {
613
+ return new $681cc3c98f569e39$export$dc064fe9e59310fd(type, this);
614
+ }
615
+ getMutableCollection() {
616
+ if (!this.nextCollection) this.nextCollection = this.collection.clone();
617
+ return this.nextCollection;
618
+ }
619
+ markDirty(node) {
620
+ this.dirtyNodes.add(node);
621
+ }
622
+ addNode(element) {
623
+ if (element.isHidden) return;
624
+ let collection = this.getMutableCollection();
625
+ if (!collection.getItem(element.node.key)) for (let child of element) this.addNode(child);
626
+ collection.addNode(element.node);
627
+ }
628
+ removeNode(node) {
629
+ for (let child of node) this.removeNode(child);
630
+ let collection = this.getMutableCollection();
631
+ collection.removeNode(node.node.key);
632
+ }
633
+ /** Finalizes the collection update, updating all nodes and freezing the collection. */
634
+ getCollection() {
635
+ if (this.inSubscription) return this.collection.clone();
636
+ this.queuedRender = false;
637
+ this.updateCollection();
638
+ return this.collection;
639
+ }
640
+ updateCollection() {
641
+ for (let element of this.dirtyNodes) if (element instanceof $681cc3c98f569e39$export$dc064fe9e59310fd && (!element.isConnected || element.isHidden)) this.removeNode(element);
642
+ else element.updateChildIndices();
643
+ for (let element of this.dirtyNodes) if (element instanceof $681cc3c98f569e39$export$dc064fe9e59310fd) {
644
+ if (element.isConnected && !element.isHidden) {
645
+ element.updateNode();
646
+ this.addNode(element);
647
+ }
648
+ element.isMutated = false;
649
+ }
650
+ this.dirtyNodes.clear();
651
+ if (this.nextCollection) {
652
+ var _this_firstVisibleChild, _this_lastVisibleChild;
653
+ var _this_firstVisibleChild_node_key, _this_lastVisibleChild_node_key;
654
+ this.nextCollection.commit((_this_firstVisibleChild_node_key = (_this_firstVisibleChild = this.firstVisibleChild) === null || _this_firstVisibleChild === void 0 ? void 0 : _this_firstVisibleChild.node.key) !== null && _this_firstVisibleChild_node_key !== void 0 ? _this_firstVisibleChild_node_key : null, (_this_lastVisibleChild_node_key = (_this_lastVisibleChild = this.lastVisibleChild) === null || _this_lastVisibleChild === void 0 ? void 0 : _this_lastVisibleChild.node.key) !== null && _this_lastVisibleChild_node_key !== void 0 ? _this_lastVisibleChild_node_key : null, this.isSSR);
655
+ if (!this.isSSR) {
656
+ this.collection = this.nextCollection;
657
+ this.nextCollection = null;
658
+ }
659
+ }
660
+ }
661
+ queueUpdate() {
662
+ if (this.dirtyNodes.size === 0 || this.queuedRender) return;
663
+ this.queuedRender = true;
664
+ this.inSubscription = true;
665
+ for (let fn of this.subscriptions) fn();
666
+ this.inSubscription = false;
667
+ }
668
+ subscribe(fn) {
669
+ this.subscriptions.add(fn);
670
+ return () => this.subscriptions.delete(fn);
671
+ }
672
+ resetAfterSSR() {
673
+ if (this.isSSR) {
674
+ this.isSSR = false;
675
+ this.firstChild = null;
676
+ this.lastChild = null;
677
+ this.nodeId = 0;
678
+ }
679
+ }
680
+ constructor(collection) {
681
+ super(null), this.nodeType = 11, this.ownerDocument = this, this.dirtyNodes = /* @__PURE__ */ new Set(), this.isSSR = false, this.nodeId = 0, this.nodesByProps = /* @__PURE__ */ new WeakMap(), this.isMounted = true, this.nextCollection = null, this.subscriptions = /* @__PURE__ */ new Set(), this.queuedRender = false, this.inSubscription = false;
682
+ this.collection = collection;
683
+ this.nextCollection = collection;
684
+ }
685
+ }
686
+ function $e948873055cbafe4$export$727c8fc270210f13(props) {
687
+ let { children, items, idScope, addIdAndValue, dependencies = [] } = props;
688
+ let cache = useMemo(() => /* @__PURE__ */ new WeakMap(), dependencies);
689
+ return useMemo(() => {
690
+ if (items && typeof children === "function") {
691
+ let res = [];
692
+ for (let item of items) {
693
+ let rendered = cache.get(item);
694
+ if (!rendered) {
695
+ rendered = children(item);
696
+ var _rendered_props_id, _ref;
697
+ let key = (_ref = (_rendered_props_id = rendered.props.id) !== null && _rendered_props_id !== void 0 ? _rendered_props_id : item.key) !== null && _ref !== void 0 ? _ref : item.id;
698
+ if (key == null) throw new Error("Could not determine key for item");
699
+ if (idScope) key = idScope + ":" + key;
700
+ rendered = cloneElement(rendered, addIdAndValue ? {
701
+ key,
702
+ id: key,
703
+ value: item
704
+ } : {
705
+ key
706
+ });
707
+ cache.set(item, rendered);
708
+ }
709
+ res.push(rendered);
710
+ }
711
+ return res;
712
+ } else if (typeof children !== "function") return children;
713
+ }, [
714
+ children,
715
+ items,
716
+ cache,
717
+ idScope,
718
+ addIdAndValue
719
+ ]);
720
+ }
721
+ const $8a26561d2877236e$var$DEFAULT_THRESHOLD = 500;
722
+ function $8a26561d2877236e$export$c24ed0104d07eab9(props) {
723
+ let { isDisabled, onLongPressStart, onLongPressEnd, onLongPress, threshold = $8a26561d2877236e$var$DEFAULT_THRESHOLD, accessibilityDescription } = props;
724
+ const timeRef = useRef(void 0);
725
+ let { addGlobalListener, removeGlobalListener } = $03deb23ff14920c4$export$4eaf04e54aa8eed6();
726
+ let { pressProps } = $f6c31cce2adf654f$export$45712eceda6fad21({
727
+ isDisabled,
728
+ onPressStart(e) {
729
+ e.continuePropagation();
730
+ if (e.pointerType === "mouse" || e.pointerType === "touch") {
731
+ if (onLongPressStart) onLongPressStart({
732
+ ...e,
733
+ type: "longpressstart"
734
+ });
735
+ timeRef.current = setTimeout(() => {
736
+ e.target.dispatchEvent(new PointerEvent("pointercancel", {
737
+ bubbles: true
738
+ }));
739
+ if ($431fbd86ca7dc216$export$b204af158042fbac(e.target).activeElement !== e.target) $7215afc6de606d6b$export$de79e2c695e052f3(e.target);
740
+ if (onLongPress) onLongPress({
741
+ ...e,
742
+ type: "longpress"
743
+ });
744
+ timeRef.current = void 0;
745
+ }, threshold);
746
+ if (e.pointerType === "touch") {
747
+ let onContextMenu = (e2) => {
748
+ e2.preventDefault();
749
+ };
750
+ addGlobalListener(e.target, "contextmenu", onContextMenu, {
751
+ once: true
752
+ });
753
+ addGlobalListener(window, "pointerup", () => {
754
+ setTimeout(() => {
755
+ removeGlobalListener(e.target, "contextmenu", onContextMenu);
756
+ }, 30);
757
+ }, {
758
+ once: true
759
+ });
760
+ }
761
+ }
762
+ },
763
+ onPressEnd(e) {
764
+ if (timeRef.current) clearTimeout(timeRef.current);
765
+ if (onLongPressEnd && (e.pointerType === "mouse" || e.pointerType === "touch")) onLongPressEnd({
766
+ ...e,
767
+ type: "longpressend"
768
+ });
769
+ }
770
+ });
771
+ let descriptionProps = $ef06256079686ba0$export$f8aeda7b10753fa1(onLongPress && !isDisabled ? accessibilityDescription : void 0);
772
+ return {
773
+ longPressProps: $3ef42575df84b30b$export$9d1611c77c2fe928(pressProps, descriptionProps)
774
+ };
775
+ }
776
+ var shim = { exports: {} };
777
+ var useSyncExternalStoreShim_production = {};
778
+ /**
779
+ * @license React
780
+ * use-sync-external-store-shim.production.js
781
+ *
782
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
783
+ *
784
+ * This source code is licensed under the MIT license found in the
785
+ * LICENSE file in the root directory of this source tree.
786
+ */
787
+ var hasRequiredUseSyncExternalStoreShim_production;
788
+ function requireUseSyncExternalStoreShim_production() {
789
+ if (hasRequiredUseSyncExternalStoreShim_production) return useSyncExternalStoreShim_production;
790
+ hasRequiredUseSyncExternalStoreShim_production = 1;
791
+ var React = React__default;
792
+ function is(x, y) {
793
+ return x === y && (0 !== x || 1 / x === 1 / y) || x !== x && y !== y;
794
+ }
795
+ var objectIs = "function" === typeof Object.is ? Object.is : is, useState2 = React.useState, useEffect2 = React.useEffect, useLayoutEffect = React.useLayoutEffect, useDebugValue = React.useDebugValue;
796
+ function useSyncExternalStore$2(subscribe, getSnapshot) {
797
+ var value = getSnapshot(), _useState = useState2({ inst: { value, getSnapshot } }), inst = _useState[0].inst, forceUpdate = _useState[1];
798
+ useLayoutEffect(
799
+ function() {
800
+ inst.value = value;
801
+ inst.getSnapshot = getSnapshot;
802
+ checkIfSnapshotChanged(inst) && forceUpdate({ inst });
803
+ },
804
+ [subscribe, value, getSnapshot]
805
+ );
806
+ useEffect2(
807
+ function() {
808
+ checkIfSnapshotChanged(inst) && forceUpdate({ inst });
809
+ return subscribe(function() {
810
+ checkIfSnapshotChanged(inst) && forceUpdate({ inst });
811
+ });
812
+ },
813
+ [subscribe]
814
+ );
815
+ useDebugValue(value);
816
+ return value;
817
+ }
818
+ function checkIfSnapshotChanged(inst) {
819
+ var latestGetSnapshot = inst.getSnapshot;
820
+ inst = inst.value;
821
+ try {
822
+ var nextValue = latestGetSnapshot();
823
+ return !objectIs(inst, nextValue);
824
+ } catch (error) {
825
+ return true;
826
+ }
827
+ }
828
+ function useSyncExternalStore$1(subscribe, getSnapshot) {
829
+ return getSnapshot();
830
+ }
831
+ var shim2 = "undefined" === typeof window || "undefined" === typeof window.document || "undefined" === typeof window.document.createElement ? useSyncExternalStore$1 : useSyncExternalStore$2;
832
+ useSyncExternalStoreShim_production.useSyncExternalStore = void 0 !== React.useSyncExternalStore ? React.useSyncExternalStore : shim2;
833
+ return useSyncExternalStoreShim_production;
834
+ }
835
+ var useSyncExternalStoreShim_development = {};
836
+ /**
837
+ * @license React
838
+ * use-sync-external-store-shim.development.js
839
+ *
840
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
841
+ *
842
+ * This source code is licensed under the MIT license found in the
843
+ * LICENSE file in the root directory of this source tree.
844
+ */
845
+ var hasRequiredUseSyncExternalStoreShim_development;
846
+ function requireUseSyncExternalStoreShim_development() {
847
+ if (hasRequiredUseSyncExternalStoreShim_development) return useSyncExternalStoreShim_development;
848
+ hasRequiredUseSyncExternalStoreShim_development = 1;
849
+ "production" !== process.env.NODE_ENV && function() {
850
+ function is(x, y) {
851
+ return x === y && (0 !== x || 1 / x === 1 / y) || x !== x && y !== y;
852
+ }
853
+ function useSyncExternalStore$2(subscribe, getSnapshot) {
854
+ didWarnOld18Alpha || void 0 === React.startTransition || (didWarnOld18Alpha = true, console.error(
855
+ "You are using an outdated, pre-release alpha of React 18 that does not support useSyncExternalStore. The use-sync-external-store shim will not work correctly. Upgrade to a newer pre-release."
856
+ ));
857
+ var value = getSnapshot();
858
+ if (!didWarnUncachedGetSnapshot) {
859
+ var cachedValue = getSnapshot();
860
+ objectIs(value, cachedValue) || (console.error(
861
+ "The result of getSnapshot should be cached to avoid an infinite loop"
862
+ ), didWarnUncachedGetSnapshot = true);
863
+ }
864
+ cachedValue = useState2({
865
+ inst: { value, getSnapshot }
866
+ });
867
+ var inst = cachedValue[0].inst, forceUpdate = cachedValue[1];
868
+ useLayoutEffect(
869
+ function() {
870
+ inst.value = value;
871
+ inst.getSnapshot = getSnapshot;
872
+ checkIfSnapshotChanged(inst) && forceUpdate({ inst });
873
+ },
874
+ [subscribe, value, getSnapshot]
875
+ );
876
+ useEffect2(
877
+ function() {
878
+ checkIfSnapshotChanged(inst) && forceUpdate({ inst });
879
+ return subscribe(function() {
880
+ checkIfSnapshotChanged(inst) && forceUpdate({ inst });
881
+ });
882
+ },
883
+ [subscribe]
884
+ );
885
+ useDebugValue(value);
886
+ return value;
887
+ }
888
+ function checkIfSnapshotChanged(inst) {
889
+ var latestGetSnapshot = inst.getSnapshot;
890
+ inst = inst.value;
891
+ try {
892
+ var nextValue = latestGetSnapshot();
893
+ return !objectIs(inst, nextValue);
894
+ } catch (error) {
895
+ return true;
896
+ }
897
+ }
898
+ function useSyncExternalStore$1(subscribe, getSnapshot) {
899
+ return getSnapshot();
900
+ }
901
+ "undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ && "function" === typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart && __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart(Error());
902
+ var React = React__default, objectIs = "function" === typeof Object.is ? Object.is : is, useState2 = React.useState, useEffect2 = React.useEffect, useLayoutEffect = React.useLayoutEffect, useDebugValue = React.useDebugValue, didWarnOld18Alpha = false, didWarnUncachedGetSnapshot = false, shim2 = "undefined" === typeof window || "undefined" === typeof window.document || "undefined" === typeof window.document.createElement ? useSyncExternalStore$1 : useSyncExternalStore$2;
903
+ useSyncExternalStoreShim_development.useSyncExternalStore = void 0 !== React.useSyncExternalStore ? React.useSyncExternalStore : shim2;
904
+ "undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ && "function" === typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop && __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop(Error());
905
+ }();
906
+ return useSyncExternalStoreShim_development;
907
+ }
908
+ var hasRequiredShim;
909
+ function requireShim() {
910
+ if (hasRequiredShim) return shim.exports;
911
+ hasRequiredShim = 1;
912
+ if (process.env.NODE_ENV === "production") {
913
+ shim.exports = requireUseSyncExternalStoreShim_production();
914
+ } else {
915
+ shim.exports = requireUseSyncExternalStoreShim_development();
916
+ }
917
+ return shim.exports;
918
+ }
919
+ var shimExports = requireShim();
920
+ const $e1995378a142960e$var$ShallowRenderContext = /* @__PURE__ */ createContext(false);
921
+ const $e1995378a142960e$var$CollectionDocumentContext = /* @__PURE__ */ createContext(null);
922
+ function $e1995378a142960e$export$bf788dd355e3a401(props) {
923
+ let doc = useContext($e1995378a142960e$var$CollectionDocumentContext);
924
+ if (doc)
925
+ return props.content;
926
+ let { collection, document: document2 } = $e1995378a142960e$var$useCollectionDocument(props.createCollection);
927
+ return /* @__PURE__ */ React__default.createElement(React__default.Fragment, null, /* @__PURE__ */ React__default.createElement($f39a9eba43920ace$export$8dc98ba7eadeaa56, null, /* @__PURE__ */ React__default.createElement($e1995378a142960e$var$CollectionDocumentContext.Provider, {
928
+ value: document2
929
+ }, props.content)), /* @__PURE__ */ React__default.createElement($e1995378a142960e$var$CollectionInner, {
930
+ render: props.children,
931
+ collection
932
+ }));
933
+ }
934
+ function $e1995378a142960e$var$CollectionInner({ collection, render }) {
935
+ return render(collection);
936
+ }
937
+ function $e1995378a142960e$var$useSyncExternalStoreFallback(subscribe, getSnapshot, getServerSnapshot) {
938
+ let isSSR = $b5e257d569688ac6$export$535bd6ca7f90a273();
939
+ let isSSRRef = useRef(isSSR);
940
+ isSSRRef.current = isSSR;
941
+ let getSnapshotWrapper = useCallback(() => {
942
+ return isSSRRef.current ? getServerSnapshot() : getSnapshot();
943
+ }, [
944
+ getSnapshot,
945
+ getServerSnapshot
946
+ ]);
947
+ return shimExports.useSyncExternalStore(subscribe, getSnapshotWrapper);
948
+ }
949
+ const $e1995378a142960e$var$useSyncExternalStore = typeof React__default["useSyncExternalStore"] === "function" ? React__default["useSyncExternalStore"] : $e1995378a142960e$var$useSyncExternalStoreFallback;
950
+ function $e1995378a142960e$var$useCollectionDocument(createCollection) {
951
+ let [document2] = useState(() => new $681cc3c98f569e39$export$b34a105447964f9f((createCollection === null || createCollection === void 0 ? void 0 : createCollection()) || new $23b9f4fcf0fe224b$export$408d25a4e12db025()));
952
+ let subscribe = useCallback((fn) => document2.subscribe(fn), [
953
+ document2
954
+ ]);
955
+ let getSnapshot = useCallback(() => {
956
+ let collection2 = document2.getCollection();
957
+ if (document2.isSSR)
958
+ document2.resetAfterSSR();
959
+ return collection2;
960
+ }, [
961
+ document2
962
+ ]);
963
+ let getServerSnapshot = useCallback(() => {
964
+ document2.isSSR = true;
965
+ return document2.getCollection();
966
+ }, [
967
+ document2
968
+ ]);
969
+ let collection = $e1995378a142960e$var$useSyncExternalStore(subscribe, getSnapshot, getServerSnapshot);
970
+ $f0a04ccd8dbdd83b$export$e5c5a5f917a5871c(() => {
971
+ document2.isMounted = true;
972
+ return () => {
973
+ document2.isMounted = false;
974
+ };
975
+ }, [
976
+ document2
977
+ ]);
978
+ return {
979
+ collection,
980
+ document: document2
981
+ };
982
+ }
983
+ const $e1995378a142960e$var$SSRContext = /* @__PURE__ */ createContext(null);
984
+ function $e1995378a142960e$var$useSSRCollectionNode(Type, props, ref, rendered, children, render) {
985
+ let itemRef = useCallback((element) => {
986
+ element === null || element === void 0 ? void 0 : element.setProps(props, ref, rendered, render);
987
+ }, [
988
+ props,
989
+ ref,
990
+ rendered,
991
+ render
992
+ ]);
993
+ let parentNode = useContext($e1995378a142960e$var$SSRContext);
994
+ if (parentNode) {
995
+ let element = parentNode.ownerDocument.nodesByProps.get(props);
996
+ if (!element) {
997
+ element = parentNode.ownerDocument.createElement(Type);
998
+ element.setProps(props, ref, rendered, render);
999
+ parentNode.appendChild(element);
1000
+ parentNode.ownerDocument.updateCollection();
1001
+ parentNode.ownerDocument.nodesByProps.set(props, element);
1002
+ }
1003
+ return children ? /* @__PURE__ */ React__default.createElement($e1995378a142960e$var$SSRContext.Provider, {
1004
+ value: element
1005
+ }, children) : null;
1006
+ }
1007
+ return /* @__PURE__ */ React__default.createElement(Type, {
1008
+ ref: itemRef
1009
+ }, children);
1010
+ }
1011
+ function $e1995378a142960e$export$18af5c7a9e9b3664(type, render) {
1012
+ let Component = ({ node }) => render(node.props, node.props.ref, node);
1013
+ let Result = forwardRef((props, ref) => {
1014
+ let focusableProps = useContext($f645667febf57a63$export$f9762fab77588ecb);
1015
+ let isShallow = useContext($e1995378a142960e$var$ShallowRenderContext);
1016
+ if (!isShallow) {
1017
+ if (render.length >= 3) throw new Error(render.name + " cannot be rendered outside a collection.");
1018
+ return render(props, ref);
1019
+ }
1020
+ return $e1995378a142960e$var$useSSRCollectionNode(type, props, ref, "children" in props ? props.children : null, null, (node) => (
1021
+ // Forward FocusableContext to real DOM tree so tooltips work.
1022
+ /* @__PURE__ */ React__default.createElement($f645667febf57a63$export$f9762fab77588ecb.Provider, {
1023
+ value: focusableProps
1024
+ }, /* @__PURE__ */ React__default.createElement(Component, {
1025
+ node
1026
+ }))
1027
+ ));
1028
+ });
1029
+ Result.displayName = render.name;
1030
+ return Result;
1031
+ }
1032
+ function $e1995378a142960e$export$e953bb1cd0f19726(type, render, useChildren = $e1995378a142960e$var$useCollectionChildren) {
1033
+ let Component = ({ node }) => render(node.props, node.props.ref, node);
1034
+ let Result = forwardRef((props, ref) => {
1035
+ let children = useChildren(props);
1036
+ var _useSSRCollectionNode;
1037
+ return (_useSSRCollectionNode = $e1995378a142960e$var$useSSRCollectionNode(type, props, ref, null, children, (node) => /* @__PURE__ */ React__default.createElement(Component, {
1038
+ node
1039
+ }))) !== null && _useSSRCollectionNode !== void 0 ? _useSSRCollectionNode : /* @__PURE__ */ React__default.createElement(React__default.Fragment, null);
1040
+ });
1041
+ Result.displayName = render.name;
1042
+ return Result;
1043
+ }
1044
+ function $e1995378a142960e$var$useCollectionChildren(options) {
1045
+ return $e948873055cbafe4$export$727c8fc270210f13({
1046
+ ...options,
1047
+ addIdAndValue: true
1048
+ });
1049
+ }
1050
+ const $e1995378a142960e$var$CollectionContext = /* @__PURE__ */ createContext(null);
1051
+ function $e1995378a142960e$export$fb8073518f34e6ec(props) {
1052
+ let ctx = useContext($e1995378a142960e$var$CollectionContext);
1053
+ let dependencies = ((ctx === null || ctx === void 0 ? void 0 : ctx.dependencies) || []).concat(props.dependencies);
1054
+ let idScope = props.idScope || (ctx === null || ctx === void 0 ? void 0 : ctx.idScope);
1055
+ let children = $e1995378a142960e$var$useCollectionChildren({
1056
+ ...props,
1057
+ idScope,
1058
+ dependencies
1059
+ });
1060
+ let doc = useContext($e1995378a142960e$var$CollectionDocumentContext);
1061
+ if (doc) children = /* @__PURE__ */ React__default.createElement($e1995378a142960e$var$CollectionRoot, null, children);
1062
+ ctx = useMemo(() => ({
1063
+ dependencies,
1064
+ idScope
1065
+ }), [
1066
+ idScope,
1067
+ ...dependencies
1068
+ ]);
1069
+ return /* @__PURE__ */ React__default.createElement($e1995378a142960e$var$CollectionContext.Provider, {
1070
+ value: ctx
1071
+ }, children);
1072
+ }
1073
+ function $e1995378a142960e$var$CollectionRoot({ children }) {
1074
+ let doc = useContext($e1995378a142960e$var$CollectionDocumentContext);
1075
+ let wrappedChildren = useMemo(() => /* @__PURE__ */ React__default.createElement($e1995378a142960e$var$CollectionDocumentContext.Provider, {
1076
+ value: null
1077
+ }, /* @__PURE__ */ React__default.createElement($e1995378a142960e$var$ShallowRenderContext.Provider, {
1078
+ value: true
1079
+ }, children)), [
1080
+ children
1081
+ ]);
1082
+ return $b5e257d569688ac6$export$535bd6ca7f90a273() ? /* @__PURE__ */ React__default.createElement($e1995378a142960e$var$SSRContext.Provider, {
1083
+ value: doc
1084
+ }, wrappedChildren) : /* @__PURE__ */ reactDomExports.createPortal(wrappedChildren, doc);
1085
+ }
1086
+ function $55f9b1ae81f22853$export$76e4e37e5339496d(to) {
1087
+ let from = $55f9b1ae81f22853$export$759df0d867455a91($431fbd86ca7dc216$export$b204af158042fbac(to));
1088
+ if (from !== to) {
1089
+ if (from) $55f9b1ae81f22853$export$6c5dc7e81d2cc29a(from, to);
1090
+ if (to) $55f9b1ae81f22853$export$2b35b76d2e30e129(to, from);
1091
+ }
1092
+ }
1093
+ function $55f9b1ae81f22853$export$6c5dc7e81d2cc29a(from, to) {
1094
+ from.dispatchEvent(new FocusEvent("blur", {
1095
+ relatedTarget: to
1096
+ }));
1097
+ from.dispatchEvent(new FocusEvent("focusout", {
1098
+ bubbles: true,
1099
+ relatedTarget: to
1100
+ }));
1101
+ }
1102
+ function $55f9b1ae81f22853$export$2b35b76d2e30e129(to, from) {
1103
+ to.dispatchEvent(new FocusEvent("focus", {
1104
+ relatedTarget: from
1105
+ }));
1106
+ to.dispatchEvent(new FocusEvent("focusin", {
1107
+ bubbles: true,
1108
+ relatedTarget: from
1109
+ }));
1110
+ }
1111
+ function $55f9b1ae81f22853$export$759df0d867455a91(document2) {
1112
+ let activeElement = $d4ee10de306f2510$export$cd4e5573fbe2b576(document2);
1113
+ let activeDescendant = activeElement === null || activeElement === void 0 ? void 0 : activeElement.getAttribute("aria-activedescendant");
1114
+ if (activeDescendant) return document2.getElementById(activeDescendant) || activeElement;
1115
+ return activeElement;
1116
+ }
1117
+ function $feb5ffebff200149$export$d3e3bd3e26688c04(e) {
1118
+ return $c87311424ea30a05$export$e1865c3bedcd822b() ? e.altKey : e.ctrlKey;
1119
+ }
1120
+ function $feb5ffebff200149$export$c3d8340acf92597f(collectionRef, key) {
1121
+ var _collectionRef_current, _collectionRef_current1;
1122
+ let selector = `[data-key="${CSS.escape(String(key))}"]`;
1123
+ let collection = (_collectionRef_current = collectionRef.current) === null || _collectionRef_current === void 0 ? void 0 : _collectionRef_current.dataset.collection;
1124
+ if (collection) selector = `[data-collection="${CSS.escape(collection)}"]${selector}`;
1125
+ return (_collectionRef_current1 = collectionRef.current) === null || _collectionRef_current1 === void 0 ? void 0 : _collectionRef_current1.querySelector(selector);
1126
+ }
1127
+ const $feb5ffebff200149$var$collectionMap = /* @__PURE__ */ new WeakMap();
1128
+ function $feb5ffebff200149$export$881eb0d9f3605d9d(collection) {
1129
+ let id = $bdb11010cef70236$export$f680877a34711e37();
1130
+ $feb5ffebff200149$var$collectionMap.set(collection, id);
1131
+ return id;
1132
+ }
1133
+ function $feb5ffebff200149$export$6aeb1680a0ae8741(collection) {
1134
+ return $feb5ffebff200149$var$collectionMap.get(collection);
1135
+ }
1136
+ const $fb3050f43d946246$var$TYPEAHEAD_DEBOUNCE_WAIT_MS = 1e3;
1137
+ function $fb3050f43d946246$export$e32c88dfddc6e1d8(options) {
1138
+ let { keyboardDelegate, selectionManager, onTypeSelect } = options;
1139
+ let state = useRef({
1140
+ search: "",
1141
+ timeout: void 0
1142
+ }).current;
1143
+ let onKeyDown = (e) => {
1144
+ let character = $fb3050f43d946246$var$getStringForKey(e.key);
1145
+ if (!character || e.ctrlKey || e.metaKey || !e.currentTarget.contains(e.target)) return;
1146
+ if (character === " " && state.search.trim().length > 0) {
1147
+ e.preventDefault();
1148
+ if (!("continuePropagation" in e)) e.stopPropagation();
1149
+ }
1150
+ state.search += character;
1151
+ if (keyboardDelegate.getKeyForSearch != null) {
1152
+ let key = keyboardDelegate.getKeyForSearch(state.search, selectionManager.focusedKey);
1153
+ if (key == null) key = keyboardDelegate.getKeyForSearch(state.search);
1154
+ if (key != null) {
1155
+ selectionManager.setFocusedKey(key);
1156
+ if (onTypeSelect) onTypeSelect(key);
1157
+ }
1158
+ }
1159
+ clearTimeout(state.timeout);
1160
+ state.timeout = setTimeout(() => {
1161
+ state.search = "";
1162
+ }, $fb3050f43d946246$var$TYPEAHEAD_DEBOUNCE_WAIT_MS);
1163
+ };
1164
+ return {
1165
+ typeSelectProps: {
1166
+ // Using a capturing listener to catch the keydown event before
1167
+ // other hooks in order to handle the Spacebar event.
1168
+ onKeyDownCapture: keyboardDelegate.getKeyForSearch ? onKeyDown : void 0
1169
+ }
1170
+ };
1171
+ }
1172
+ function $fb3050f43d946246$var$getStringForKey(key) {
1173
+ if (key.length === 1 || !/^[A-Z]/i.test(key)) return key;
1174
+ return "";
1175
+ }
1176
+ function $ae20dd8cbca75726$export$d6daf82dcd84e87c(options) {
1177
+ let { selectionManager: manager, keyboardDelegate: delegate, ref, autoFocus = false, shouldFocusWrap = false, disallowEmptySelection = false, disallowSelectAll = false, escapeKeyBehavior = "clearSelection", selectOnFocus = manager.selectionBehavior === "replace", disallowTypeAhead = false, shouldUseVirtualFocus, allowsTabNavigation = false, isVirtualized, scrollRef = ref, linkBehavior = "action" } = options;
1178
+ let { direction } = $18f2051aff69b9bf$export$43bb16f9c6d9e3f7();
1179
+ let router = $ea8dcbcb9ea1b556$export$9a302a45f65d0572();
1180
+ let onKeyDown = (e) => {
1181
+ var _ref_current;
1182
+ if (e.altKey && e.key === "Tab") e.preventDefault();
1183
+ if (!((_ref_current = ref.current) === null || _ref_current === void 0 ? void 0 : _ref_current.contains(e.target))) return;
1184
+ const navigateToKey = (key, childFocus) => {
1185
+ if (key != null) {
1186
+ if (manager.isLink(key) && linkBehavior === "selection" && selectOnFocus && !$feb5ffebff200149$export$d3e3bd3e26688c04(e)) {
1187
+ reactDomExports.flushSync(() => {
1188
+ manager.setFocusedKey(key, childFocus);
1189
+ });
1190
+ let item = $feb5ffebff200149$export$c3d8340acf92597f(ref, key);
1191
+ let itemProps = manager.getItemProps(key);
1192
+ if (item) router.open(item, e, itemProps.href, itemProps.routerOptions);
1193
+ return;
1194
+ }
1195
+ manager.setFocusedKey(key, childFocus);
1196
+ if (manager.isLink(key) && linkBehavior === "override") return;
1197
+ if (e.shiftKey && manager.selectionMode === "multiple") manager.extendSelection(key);
1198
+ else if (selectOnFocus && !$feb5ffebff200149$export$d3e3bd3e26688c04(e)) manager.replaceSelection(key);
1199
+ }
1200
+ };
1201
+ switch (e.key) {
1202
+ case "ArrowDown":
1203
+ if (delegate.getKeyBelow) {
1204
+ var _delegate_getKeyBelow, _delegate_getFirstKey, _delegate_getFirstKey1;
1205
+ let nextKey = manager.focusedKey != null ? (_delegate_getKeyBelow = delegate.getKeyBelow) === null || _delegate_getKeyBelow === void 0 ? void 0 : _delegate_getKeyBelow.call(delegate, manager.focusedKey) : (_delegate_getFirstKey = delegate.getFirstKey) === null || _delegate_getFirstKey === void 0 ? void 0 : _delegate_getFirstKey.call(delegate);
1206
+ if (nextKey == null && shouldFocusWrap) nextKey = (_delegate_getFirstKey1 = delegate.getFirstKey) === null || _delegate_getFirstKey1 === void 0 ? void 0 : _delegate_getFirstKey1.call(delegate, manager.focusedKey);
1207
+ if (nextKey != null) {
1208
+ e.preventDefault();
1209
+ navigateToKey(nextKey);
1210
+ }
1211
+ }
1212
+ break;
1213
+ case "ArrowUp":
1214
+ if (delegate.getKeyAbove) {
1215
+ var _delegate_getKeyAbove, _delegate_getLastKey, _delegate_getLastKey1;
1216
+ let nextKey = manager.focusedKey != null ? (_delegate_getKeyAbove = delegate.getKeyAbove) === null || _delegate_getKeyAbove === void 0 ? void 0 : _delegate_getKeyAbove.call(delegate, manager.focusedKey) : (_delegate_getLastKey = delegate.getLastKey) === null || _delegate_getLastKey === void 0 ? void 0 : _delegate_getLastKey.call(delegate);
1217
+ if (nextKey == null && shouldFocusWrap) nextKey = (_delegate_getLastKey1 = delegate.getLastKey) === null || _delegate_getLastKey1 === void 0 ? void 0 : _delegate_getLastKey1.call(delegate, manager.focusedKey);
1218
+ if (nextKey != null) {
1219
+ e.preventDefault();
1220
+ navigateToKey(nextKey);
1221
+ }
1222
+ }
1223
+ break;
1224
+ case "ArrowLeft":
1225
+ if (delegate.getKeyLeftOf) {
1226
+ var _delegate_getKeyLeftOf, _delegate_getFirstKey2, _delegate_getLastKey2;
1227
+ let nextKey = manager.focusedKey != null ? (_delegate_getKeyLeftOf = delegate.getKeyLeftOf) === null || _delegate_getKeyLeftOf === void 0 ? void 0 : _delegate_getKeyLeftOf.call(delegate, manager.focusedKey) : null;
1228
+ if (nextKey == null && shouldFocusWrap) nextKey = direction === "rtl" ? (_delegate_getFirstKey2 = delegate.getFirstKey) === null || _delegate_getFirstKey2 === void 0 ? void 0 : _delegate_getFirstKey2.call(delegate, manager.focusedKey) : (_delegate_getLastKey2 = delegate.getLastKey) === null || _delegate_getLastKey2 === void 0 ? void 0 : _delegate_getLastKey2.call(delegate, manager.focusedKey);
1229
+ if (nextKey != null) {
1230
+ e.preventDefault();
1231
+ navigateToKey(nextKey, direction === "rtl" ? "first" : "last");
1232
+ }
1233
+ }
1234
+ break;
1235
+ case "ArrowRight":
1236
+ if (delegate.getKeyRightOf) {
1237
+ var _delegate_getKeyRightOf, _delegate_getLastKey3, _delegate_getFirstKey3;
1238
+ let nextKey = manager.focusedKey != null ? (_delegate_getKeyRightOf = delegate.getKeyRightOf) === null || _delegate_getKeyRightOf === void 0 ? void 0 : _delegate_getKeyRightOf.call(delegate, manager.focusedKey) : null;
1239
+ if (nextKey == null && shouldFocusWrap) nextKey = direction === "rtl" ? (_delegate_getLastKey3 = delegate.getLastKey) === null || _delegate_getLastKey3 === void 0 ? void 0 : _delegate_getLastKey3.call(delegate, manager.focusedKey) : (_delegate_getFirstKey3 = delegate.getFirstKey) === null || _delegate_getFirstKey3 === void 0 ? void 0 : _delegate_getFirstKey3.call(delegate, manager.focusedKey);
1240
+ if (nextKey != null) {
1241
+ e.preventDefault();
1242
+ navigateToKey(nextKey, direction === "rtl" ? "last" : "first");
1243
+ }
1244
+ }
1245
+ break;
1246
+ case "Home":
1247
+ if (delegate.getFirstKey) {
1248
+ if (manager.focusedKey === null && e.shiftKey) return;
1249
+ e.preventDefault();
1250
+ let firstKey = delegate.getFirstKey(manager.focusedKey, $21f1aa98acb08317$export$16792effe837dba3(e));
1251
+ manager.setFocusedKey(firstKey);
1252
+ if (firstKey != null) {
1253
+ if ($21f1aa98acb08317$export$16792effe837dba3(e) && e.shiftKey && manager.selectionMode === "multiple") manager.extendSelection(firstKey);
1254
+ else if (selectOnFocus) manager.replaceSelection(firstKey);
1255
+ }
1256
+ }
1257
+ break;
1258
+ case "End":
1259
+ if (delegate.getLastKey) {
1260
+ if (manager.focusedKey === null && e.shiftKey) return;
1261
+ e.preventDefault();
1262
+ let lastKey = delegate.getLastKey(manager.focusedKey, $21f1aa98acb08317$export$16792effe837dba3(e));
1263
+ manager.setFocusedKey(lastKey);
1264
+ if (lastKey != null) {
1265
+ if ($21f1aa98acb08317$export$16792effe837dba3(e) && e.shiftKey && manager.selectionMode === "multiple") manager.extendSelection(lastKey);
1266
+ else if (selectOnFocus) manager.replaceSelection(lastKey);
1267
+ }
1268
+ }
1269
+ break;
1270
+ case "PageDown":
1271
+ if (delegate.getKeyPageBelow && manager.focusedKey != null) {
1272
+ let nextKey = delegate.getKeyPageBelow(manager.focusedKey);
1273
+ if (nextKey != null) {
1274
+ e.preventDefault();
1275
+ navigateToKey(nextKey);
1276
+ }
1277
+ }
1278
+ break;
1279
+ case "PageUp":
1280
+ if (delegate.getKeyPageAbove && manager.focusedKey != null) {
1281
+ let nextKey = delegate.getKeyPageAbove(manager.focusedKey);
1282
+ if (nextKey != null) {
1283
+ e.preventDefault();
1284
+ navigateToKey(nextKey);
1285
+ }
1286
+ }
1287
+ break;
1288
+ case "a":
1289
+ if ($21f1aa98acb08317$export$16792effe837dba3(e) && manager.selectionMode === "multiple" && disallowSelectAll !== true) {
1290
+ e.preventDefault();
1291
+ manager.selectAll();
1292
+ }
1293
+ break;
1294
+ case "Escape":
1295
+ if (escapeKeyBehavior === "clearSelection" && !disallowEmptySelection && manager.selectedKeys.size !== 0) {
1296
+ e.stopPropagation();
1297
+ e.preventDefault();
1298
+ manager.clearSelection();
1299
+ }
1300
+ break;
1301
+ case "Tab":
1302
+ if (!allowsTabNavigation) {
1303
+ if (e.shiftKey) ref.current.focus();
1304
+ else {
1305
+ let walker = $9bf71ea28793e738$export$2d6ec8fc375ceafa(ref.current, {
1306
+ tabbable: true
1307
+ });
1308
+ let next = void 0;
1309
+ let last;
1310
+ do {
1311
+ last = walker.lastChild();
1312
+ if (last) next = last;
1313
+ } while (last);
1314
+ if (next && !next.contains(document.activeElement)) $7215afc6de606d6b$export$de79e2c695e052f3(next);
1315
+ }
1316
+ break;
1317
+ }
1318
+ }
1319
+ };
1320
+ let scrollPos = useRef({
1321
+ top: 0,
1322
+ left: 0
1323
+ });
1324
+ $e9faafb641e167db$export$90fc3a17d93f704c(scrollRef, "scroll", isVirtualized ? void 0 : () => {
1325
+ var _scrollRef_current, _scrollRef_current1;
1326
+ var _scrollRef_current_scrollTop, _scrollRef_current_scrollLeft;
1327
+ scrollPos.current = {
1328
+ top: (_scrollRef_current_scrollTop = (_scrollRef_current = scrollRef.current) === null || _scrollRef_current === void 0 ? void 0 : _scrollRef_current.scrollTop) !== null && _scrollRef_current_scrollTop !== void 0 ? _scrollRef_current_scrollTop : 0,
1329
+ left: (_scrollRef_current_scrollLeft = (_scrollRef_current1 = scrollRef.current) === null || _scrollRef_current1 === void 0 ? void 0 : _scrollRef_current1.scrollLeft) !== null && _scrollRef_current_scrollLeft !== void 0 ? _scrollRef_current_scrollLeft : 0
1330
+ };
1331
+ });
1332
+ let onFocus = (e) => {
1333
+ if (manager.isFocused) {
1334
+ if (!e.currentTarget.contains(e.target)) manager.setFocused(false);
1335
+ return;
1336
+ }
1337
+ if (!e.currentTarget.contains(e.target)) return;
1338
+ manager.setFocused(true);
1339
+ if (manager.focusedKey == null) {
1340
+ var _delegate_getLastKey, _delegate_getFirstKey;
1341
+ let navigateToKey = (key) => {
1342
+ if (key != null) {
1343
+ manager.setFocusedKey(key);
1344
+ if (selectOnFocus && !manager.isSelected(key)) manager.replaceSelection(key);
1345
+ }
1346
+ };
1347
+ let relatedTarget = e.relatedTarget;
1348
+ var _manager_lastSelectedKey, _manager_firstSelectedKey;
1349
+ if (relatedTarget && e.currentTarget.compareDocumentPosition(relatedTarget) & Node.DOCUMENT_POSITION_FOLLOWING) navigateToKey((_manager_lastSelectedKey = manager.lastSelectedKey) !== null && _manager_lastSelectedKey !== void 0 ? _manager_lastSelectedKey : (_delegate_getLastKey = delegate.getLastKey) === null || _delegate_getLastKey === void 0 ? void 0 : _delegate_getLastKey.call(delegate));
1350
+ else navigateToKey((_manager_firstSelectedKey = manager.firstSelectedKey) !== null && _manager_firstSelectedKey !== void 0 ? _manager_firstSelectedKey : (_delegate_getFirstKey = delegate.getFirstKey) === null || _delegate_getFirstKey === void 0 ? void 0 : _delegate_getFirstKey.call(delegate));
1351
+ } else if (!isVirtualized && scrollRef.current) {
1352
+ scrollRef.current.scrollTop = scrollPos.current.top;
1353
+ scrollRef.current.scrollLeft = scrollPos.current.left;
1354
+ }
1355
+ if (manager.focusedKey != null && scrollRef.current) {
1356
+ let element = $feb5ffebff200149$export$c3d8340acf92597f(ref, manager.focusedKey);
1357
+ if (element instanceof HTMLElement) {
1358
+ if (!element.contains(document.activeElement) && !shouldUseVirtualFocus) $7215afc6de606d6b$export$de79e2c695e052f3(element);
1359
+ let modality = $507fabe10e71c6fb$export$630ff653c5ada6a9();
1360
+ if (modality === "keyboard") $2f04cbc44ee30ce0$export$c826860796309d1b(element, {
1361
+ containingElement: ref.current
1362
+ });
1363
+ }
1364
+ }
1365
+ };
1366
+ let onBlur = (e) => {
1367
+ if (!e.currentTarget.contains(e.relatedTarget)) manager.setFocused(false);
1368
+ };
1369
+ let shouldVirtualFocusFirst = useRef(false);
1370
+ $e9faafb641e167db$export$90fc3a17d93f704c(ref, $5671b20cf9b562b2$export$831c820ad60f9d12, !shouldUseVirtualFocus ? void 0 : (e) => {
1371
+ let { detail } = e;
1372
+ e.stopPropagation();
1373
+ manager.setFocused(true);
1374
+ if ((detail === null || detail === void 0 ? void 0 : detail.focusStrategy) === "first") shouldVirtualFocusFirst.current = true;
1375
+ });
1376
+ let updateActiveDescendant = $8ae05eaa5c114e9c$export$7f54fc3180508a52(() => {
1377
+ var _delegate_getFirstKey;
1378
+ var _delegate_getFirstKey1;
1379
+ let keyToFocus = (_delegate_getFirstKey1 = (_delegate_getFirstKey = delegate.getFirstKey) === null || _delegate_getFirstKey === void 0 ? void 0 : _delegate_getFirstKey.call(delegate)) !== null && _delegate_getFirstKey1 !== void 0 ? _delegate_getFirstKey1 : null;
1380
+ if (keyToFocus == null) {
1381
+ $55f9b1ae81f22853$export$76e4e37e5339496d(ref.current);
1382
+ if (manager.collection.size > 0) shouldVirtualFocusFirst.current = false;
1383
+ } else {
1384
+ manager.setFocusedKey(keyToFocus);
1385
+ shouldVirtualFocusFirst.current = false;
1386
+ }
1387
+ });
1388
+ $ca9b37712f007381$export$72ef708ab07251f1(() => {
1389
+ if (shouldVirtualFocusFirst.current) updateActiveDescendant();
1390
+ }, [
1391
+ manager.collection,
1392
+ updateActiveDescendant
1393
+ ]);
1394
+ let resetFocusFirstFlag = $8ae05eaa5c114e9c$export$7f54fc3180508a52(() => {
1395
+ if (manager.collection.size > 0) shouldVirtualFocusFirst.current = false;
1396
+ });
1397
+ $ca9b37712f007381$export$72ef708ab07251f1(() => {
1398
+ resetFocusFirstFlag();
1399
+ }, [
1400
+ manager.focusedKey,
1401
+ resetFocusFirstFlag
1402
+ ]);
1403
+ $e9faafb641e167db$export$90fc3a17d93f704c(ref, $5671b20cf9b562b2$export$447a38995de2c711, !shouldUseVirtualFocus ? void 0 : (e) => {
1404
+ var _e_detail;
1405
+ e.stopPropagation();
1406
+ manager.setFocused(false);
1407
+ if ((_e_detail = e.detail) === null || _e_detail === void 0 ? void 0 : _e_detail.clearFocusKey) manager.setFocusedKey(null);
1408
+ });
1409
+ const autoFocusRef = useRef(autoFocus);
1410
+ const didAutoFocusRef = useRef(false);
1411
+ useEffect(() => {
1412
+ if (autoFocusRef.current) {
1413
+ var _delegate_getFirstKey, _delegate_getLastKey;
1414
+ let focusedKey = null;
1415
+ var _delegate_getFirstKey1;
1416
+ if (autoFocus === "first") focusedKey = (_delegate_getFirstKey1 = (_delegate_getFirstKey = delegate.getFirstKey) === null || _delegate_getFirstKey === void 0 ? void 0 : _delegate_getFirstKey.call(delegate)) !== null && _delegate_getFirstKey1 !== void 0 ? _delegate_getFirstKey1 : null;
1417
+ var _delegate_getLastKey1;
1418
+ if (autoFocus === "last") focusedKey = (_delegate_getLastKey1 = (_delegate_getLastKey = delegate.getLastKey) === null || _delegate_getLastKey === void 0 ? void 0 : _delegate_getLastKey.call(delegate)) !== null && _delegate_getLastKey1 !== void 0 ? _delegate_getLastKey1 : null;
1419
+ let selectedKeys = manager.selectedKeys;
1420
+ if (selectedKeys.size) {
1421
+ for (let key of selectedKeys) if (manager.canSelectItem(key)) {
1422
+ focusedKey = key;
1423
+ break;
1424
+ }
1425
+ }
1426
+ manager.setFocused(true);
1427
+ manager.setFocusedKey(focusedKey);
1428
+ if (focusedKey == null && !shouldUseVirtualFocus && ref.current) $3ad3f6e1647bc98d$export$80f3e147d781571c(ref.current);
1429
+ if (manager.collection.size > 0) {
1430
+ autoFocusRef.current = false;
1431
+ didAutoFocusRef.current = true;
1432
+ }
1433
+ }
1434
+ });
1435
+ let lastFocusedKey = useRef(manager.focusedKey);
1436
+ useEffect(() => {
1437
+ if (manager.isFocused && manager.focusedKey != null && (manager.focusedKey !== lastFocusedKey.current || didAutoFocusRef.current) && scrollRef.current && ref.current) {
1438
+ let modality = $507fabe10e71c6fb$export$630ff653c5ada6a9();
1439
+ let element = $feb5ffebff200149$export$c3d8340acf92597f(ref, manager.focusedKey);
1440
+ if (!(element instanceof HTMLElement))
1441
+ return;
1442
+ if (modality === "keyboard" || didAutoFocusRef.current) {
1443
+ $2f04cbc44ee30ce0$export$53a0910f038337bd(scrollRef.current, element);
1444
+ if (modality !== "virtual") $2f04cbc44ee30ce0$export$c826860796309d1b(element, {
1445
+ containingElement: ref.current
1446
+ });
1447
+ }
1448
+ }
1449
+ if (!shouldUseVirtualFocus && manager.isFocused && manager.focusedKey == null && lastFocusedKey.current != null && ref.current) $3ad3f6e1647bc98d$export$80f3e147d781571c(ref.current);
1450
+ lastFocusedKey.current = manager.focusedKey;
1451
+ didAutoFocusRef.current = false;
1452
+ });
1453
+ $e9faafb641e167db$export$90fc3a17d93f704c(ref, "react-aria-focus-scope-restore", (e) => {
1454
+ e.preventDefault();
1455
+ manager.setFocused(true);
1456
+ });
1457
+ let handlers = {
1458
+ onKeyDown,
1459
+ onFocus,
1460
+ onBlur,
1461
+ onMouseDown(e) {
1462
+ if (scrollRef.current === e.target)
1463
+ e.preventDefault();
1464
+ }
1465
+ };
1466
+ let { typeSelectProps } = $fb3050f43d946246$export$e32c88dfddc6e1d8({
1467
+ keyboardDelegate: delegate,
1468
+ selectionManager: manager
1469
+ });
1470
+ if (!disallowTypeAhead) handlers = $3ef42575df84b30b$export$9d1611c77c2fe928(typeSelectProps, handlers);
1471
+ let tabIndex = void 0;
1472
+ if (!shouldUseVirtualFocus) tabIndex = manager.focusedKey == null ? 0 : -1;
1473
+ let collectionId = $feb5ffebff200149$export$881eb0d9f3605d9d(manager.collection);
1474
+ return {
1475
+ collectionProps: $3ef42575df84b30b$export$9d1611c77c2fe928(handlers, {
1476
+ tabIndex,
1477
+ "data-collection": collectionId
1478
+ })
1479
+ };
1480
+ }
1481
+ function $880e95eb8b93ba9a$export$ecf600387e221c37(options) {
1482
+ let { id, selectionManager: manager, key, ref, shouldSelectOnPressUp, shouldUseVirtualFocus, focus, isDisabled, onAction, allowsDifferentPressOrigin, linkBehavior = "action" } = options;
1483
+ let router = $ea8dcbcb9ea1b556$export$9a302a45f65d0572();
1484
+ id = $bdb11010cef70236$export$f680877a34711e37(id);
1485
+ let onSelect = (e) => {
1486
+ if (e.pointerType === "keyboard" && $feb5ffebff200149$export$d3e3bd3e26688c04(e)) manager.toggleSelection(key);
1487
+ else {
1488
+ if (manager.selectionMode === "none") return;
1489
+ if (manager.isLink(key)) {
1490
+ if (linkBehavior === "selection" && ref.current) {
1491
+ let itemProps2 = manager.getItemProps(key);
1492
+ router.open(ref.current, e, itemProps2.href, itemProps2.routerOptions);
1493
+ manager.setSelectedKeys(manager.selectedKeys);
1494
+ return;
1495
+ } else if (linkBehavior === "override" || linkBehavior === "none") return;
1496
+ }
1497
+ if (manager.selectionMode === "single") {
1498
+ if (manager.isSelected(key) && !manager.disallowEmptySelection) manager.toggleSelection(key);
1499
+ else manager.replaceSelection(key);
1500
+ } else if (e && e.shiftKey) manager.extendSelection(key);
1501
+ else if (manager.selectionBehavior === "toggle" || e && ($21f1aa98acb08317$export$16792effe837dba3(e) || e.pointerType === "touch" || e.pointerType === "virtual"))
1502
+ manager.toggleSelection(key);
1503
+ else manager.replaceSelection(key);
1504
+ }
1505
+ };
1506
+ useEffect(() => {
1507
+ let isFocused = key === manager.focusedKey;
1508
+ if (isFocused && manager.isFocused) {
1509
+ if (!shouldUseVirtualFocus) {
1510
+ if (focus) focus();
1511
+ else if (document.activeElement !== ref.current && ref.current) $3ad3f6e1647bc98d$export$80f3e147d781571c(ref.current);
1512
+ } else $55f9b1ae81f22853$export$76e4e37e5339496d(ref.current);
1513
+ }
1514
+ }, [
1515
+ ref,
1516
+ key,
1517
+ manager.focusedKey,
1518
+ manager.childFocusStrategy,
1519
+ manager.isFocused,
1520
+ shouldUseVirtualFocus
1521
+ ]);
1522
+ isDisabled = isDisabled || manager.isDisabled(key);
1523
+ let itemProps = {};
1524
+ if (!shouldUseVirtualFocus && !isDisabled) itemProps = {
1525
+ tabIndex: key === manager.focusedKey ? 0 : -1,
1526
+ onFocus(e) {
1527
+ if (e.target === ref.current) manager.setFocusedKey(key);
1528
+ }
1529
+ };
1530
+ else if (isDisabled) itemProps.onMouseDown = (e) => {
1531
+ e.preventDefault();
1532
+ };
1533
+ let isLinkOverride = manager.isLink(key) && linkBehavior === "override";
1534
+ let hasLinkAction = manager.isLink(key) && linkBehavior !== "selection" && linkBehavior !== "none";
1535
+ let allowsSelection = !isDisabled && manager.canSelectItem(key) && !isLinkOverride;
1536
+ let allowsActions = (onAction || hasLinkAction) && !isDisabled;
1537
+ let hasPrimaryAction = allowsActions && (manager.selectionBehavior === "replace" ? !allowsSelection : !allowsSelection || manager.isEmpty);
1538
+ let hasSecondaryAction = allowsActions && allowsSelection && manager.selectionBehavior === "replace";
1539
+ let hasAction = hasPrimaryAction || hasSecondaryAction;
1540
+ let modality = useRef(null);
1541
+ let longPressEnabled = hasAction && allowsSelection;
1542
+ let longPressEnabledOnPressStart = useRef(false);
1543
+ let hadPrimaryActionOnPressStart = useRef(false);
1544
+ let performAction = (e) => {
1545
+ if (onAction) onAction();
1546
+ if (hasLinkAction && ref.current) {
1547
+ let itemProps2 = manager.getItemProps(key);
1548
+ router.open(ref.current, e, itemProps2.href, itemProps2.routerOptions);
1549
+ }
1550
+ };
1551
+ let itemPressProps = {
1552
+ ref
1553
+ };
1554
+ if (shouldSelectOnPressUp) {
1555
+ itemPressProps.onPressStart = (e) => {
1556
+ modality.current = e.pointerType;
1557
+ longPressEnabledOnPressStart.current = longPressEnabled;
1558
+ if (e.pointerType === "keyboard" && (!hasAction || $880e95eb8b93ba9a$var$isSelectionKey())) onSelect(e);
1559
+ };
1560
+ if (!allowsDifferentPressOrigin) itemPressProps.onPress = (e) => {
1561
+ if (hasPrimaryAction || hasSecondaryAction && e.pointerType !== "mouse") {
1562
+ if (e.pointerType === "keyboard" && !$880e95eb8b93ba9a$var$isActionKey()) return;
1563
+ performAction(e);
1564
+ } else if (e.pointerType !== "keyboard" && allowsSelection) onSelect(e);
1565
+ };
1566
+ else {
1567
+ itemPressProps.onPressUp = hasPrimaryAction ? void 0 : (e) => {
1568
+ if (e.pointerType === "mouse" && allowsSelection) onSelect(e);
1569
+ };
1570
+ itemPressProps.onPress = hasPrimaryAction ? performAction : (e) => {
1571
+ if (e.pointerType !== "keyboard" && e.pointerType !== "mouse" && allowsSelection) onSelect(e);
1572
+ };
1573
+ }
1574
+ } else {
1575
+ itemPressProps.onPressStart = (e) => {
1576
+ modality.current = e.pointerType;
1577
+ longPressEnabledOnPressStart.current = longPressEnabled;
1578
+ hadPrimaryActionOnPressStart.current = hasPrimaryAction;
1579
+ if (allowsSelection && (e.pointerType === "mouse" && !hasPrimaryAction || e.pointerType === "keyboard" && (!allowsActions || $880e95eb8b93ba9a$var$isSelectionKey()))) onSelect(e);
1580
+ };
1581
+ itemPressProps.onPress = (e) => {
1582
+ if (e.pointerType === "touch" || e.pointerType === "pen" || e.pointerType === "virtual" || e.pointerType === "keyboard" && hasAction && $880e95eb8b93ba9a$var$isActionKey() || e.pointerType === "mouse" && hadPrimaryActionOnPressStart.current) {
1583
+ if (hasAction) performAction(e);
1584
+ else if (allowsSelection) onSelect(e);
1585
+ }
1586
+ };
1587
+ }
1588
+ itemProps["data-collection"] = $feb5ffebff200149$export$6aeb1680a0ae8741(manager.collection);
1589
+ itemProps["data-key"] = key;
1590
+ itemPressProps.preventFocusOnPress = shouldUseVirtualFocus;
1591
+ if (shouldUseVirtualFocus) itemPressProps = $3ef42575df84b30b$export$9d1611c77c2fe928(itemPressProps, {
1592
+ onPressStart(e) {
1593
+ if (e.pointerType !== "touch") {
1594
+ manager.setFocused(true);
1595
+ manager.setFocusedKey(key);
1596
+ }
1597
+ },
1598
+ onPress(e) {
1599
+ if (e.pointerType === "touch") {
1600
+ manager.setFocused(true);
1601
+ manager.setFocusedKey(key);
1602
+ }
1603
+ }
1604
+ });
1605
+ let { pressProps, isPressed } = $f6c31cce2adf654f$export$45712eceda6fad21(itemPressProps);
1606
+ let onDoubleClick = hasSecondaryAction ? (e) => {
1607
+ if (modality.current === "mouse") {
1608
+ e.stopPropagation();
1609
+ e.preventDefault();
1610
+ performAction(e);
1611
+ }
1612
+ } : void 0;
1613
+ let { longPressProps } = $8a26561d2877236e$export$c24ed0104d07eab9({
1614
+ isDisabled: !longPressEnabled,
1615
+ onLongPress(e) {
1616
+ if (e.pointerType === "touch") {
1617
+ onSelect(e);
1618
+ manager.setSelectionBehavior("toggle");
1619
+ }
1620
+ }
1621
+ });
1622
+ let onDragStartCapture = (e) => {
1623
+ if (modality.current === "touch" && longPressEnabledOnPressStart.current) e.preventDefault();
1624
+ };
1625
+ let onClick = manager.isLink(key) ? (e) => {
1626
+ if (!$ea8dcbcb9ea1b556$export$95185d699e05d4d7.isOpening) e.preventDefault();
1627
+ } : void 0;
1628
+ return {
1629
+ itemProps: $3ef42575df84b30b$export$9d1611c77c2fe928(
1630
+ itemProps,
1631
+ allowsSelection || hasPrimaryAction || shouldUseVirtualFocus ? pressProps : {},
1632
+ longPressEnabled ? longPressProps : {},
1633
+ {
1634
+ onDoubleClick,
1635
+ onDragStartCapture,
1636
+ onClick,
1637
+ id
1638
+ },
1639
+ // Prevent DOM focus from moving on mouse down when using virtual focus
1640
+ shouldUseVirtualFocus ? {
1641
+ onMouseDown: (e) => e.preventDefault()
1642
+ } : void 0
1643
+ ),
1644
+ isPressed,
1645
+ isSelected: manager.isSelected(key),
1646
+ isFocused: manager.isFocused && manager.focusedKey === key,
1647
+ isDisabled,
1648
+ allowsSelection,
1649
+ hasAction
1650
+ };
1651
+ }
1652
+ function $880e95eb8b93ba9a$var$isActionKey() {
1653
+ let event = window.event;
1654
+ return (event === null || event === void 0 ? void 0 : event.key) === "Enter";
1655
+ }
1656
+ function $880e95eb8b93ba9a$var$isSelectionKey() {
1657
+ let event = window.event;
1658
+ return (event === null || event === void 0 ? void 0 : event.key) === " " || (event === null || event === void 0 ? void 0 : event.code) === "Space";
1659
+ }
1660
+ class $eb2240fc39a57fa5$export$bf788dd355e3a401 {
1661
+ build(props, context) {
1662
+ this.context = context;
1663
+ return $eb2240fc39a57fa5$var$iterable(() => this.iterateCollection(props));
1664
+ }
1665
+ *iterateCollection(props) {
1666
+ let { children, items } = props;
1667
+ if (React__default.isValidElement(children) && children.type === React__default.Fragment) yield* this.iterateCollection({
1668
+ children: children.props.children,
1669
+ items
1670
+ });
1671
+ else if (typeof children === "function") {
1672
+ if (!items) throw new Error("props.children was a function but props.items is missing");
1673
+ let index = 0;
1674
+ for (let item of items) {
1675
+ yield* this.getFullNode({
1676
+ value: item,
1677
+ index
1678
+ }, {
1679
+ renderer: children
1680
+ });
1681
+ index++;
1682
+ }
1683
+ } else {
1684
+ let items2 = [];
1685
+ React__default.Children.forEach(children, (child) => {
1686
+ if (child) items2.push(child);
1687
+ });
1688
+ let index = 0;
1689
+ for (let item of items2) {
1690
+ let nodes = this.getFullNode({
1691
+ element: item,
1692
+ index
1693
+ }, {});
1694
+ for (let node of nodes) {
1695
+ index++;
1696
+ yield node;
1697
+ }
1698
+ }
1699
+ }
1700
+ }
1701
+ getKey(item, partialNode, state, parentKey) {
1702
+ if (item.key != null) return item.key;
1703
+ if (partialNode.type === "cell" && partialNode.key != null) return `${parentKey}${partialNode.key}`;
1704
+ let v = partialNode.value;
1705
+ if (v != null) {
1706
+ var _v_key;
1707
+ let key = (_v_key = v.key) !== null && _v_key !== void 0 ? _v_key : v.id;
1708
+ if (key == null) throw new Error("No key found for item");
1709
+ return key;
1710
+ }
1711
+ return parentKey ? `${parentKey}.${partialNode.index}` : `$.${partialNode.index}`;
1712
+ }
1713
+ getChildState(state, partialNode) {
1714
+ return {
1715
+ renderer: partialNode.renderer || state.renderer
1716
+ };
1717
+ }
1718
+ *getFullNode(partialNode, state, parentKey, parentNode) {
1719
+ if (React__default.isValidElement(partialNode.element) && partialNode.element.type === React__default.Fragment) {
1720
+ let children = [];
1721
+ React__default.Children.forEach(partialNode.element.props.children, (child) => {
1722
+ children.push(child);
1723
+ });
1724
+ var _partialNode_index;
1725
+ let index = (_partialNode_index = partialNode.index) !== null && _partialNode_index !== void 0 ? _partialNode_index : 0;
1726
+ for (const child of children) yield* this.getFullNode({
1727
+ element: child,
1728
+ index: index++
1729
+ }, state, parentKey, parentNode);
1730
+ return;
1731
+ }
1732
+ let element = partialNode.element;
1733
+ if (!element && partialNode.value && state && state.renderer) {
1734
+ let cached = this.cache.get(partialNode.value);
1735
+ if (cached && (!cached.shouldInvalidate || !cached.shouldInvalidate(this.context))) {
1736
+ cached.index = partialNode.index;
1737
+ cached.parentKey = parentNode ? parentNode.key : null;
1738
+ yield cached;
1739
+ return;
1740
+ }
1741
+ element = state.renderer(partialNode.value);
1742
+ }
1743
+ if (React__default.isValidElement(element)) {
1744
+ let type = element.type;
1745
+ if (typeof type !== "function" && typeof type.getCollectionNode !== "function") {
1746
+ let name = element.type;
1747
+ throw new Error(`Unknown element <${name}> in collection.`);
1748
+ }
1749
+ let childNodes = type.getCollectionNode(element.props, this.context);
1750
+ var _partialNode_index1;
1751
+ let index = (_partialNode_index1 = partialNode.index) !== null && _partialNode_index1 !== void 0 ? _partialNode_index1 : 0;
1752
+ let result = childNodes.next();
1753
+ while (!result.done && result.value) {
1754
+ let childNode = result.value;
1755
+ partialNode.index = index;
1756
+ var _childNode_key;
1757
+ let nodeKey = (_childNode_key = childNode.key) !== null && _childNode_key !== void 0 ? _childNode_key : null;
1758
+ if (nodeKey == null) nodeKey = childNode.element ? null : this.getKey(element, partialNode, state, parentKey);
1759
+ let nodes = this.getFullNode({
1760
+ ...childNode,
1761
+ key: nodeKey,
1762
+ index,
1763
+ wrapper: $eb2240fc39a57fa5$var$compose(partialNode.wrapper, childNode.wrapper)
1764
+ }, this.getChildState(state, childNode), parentKey ? `${parentKey}${element.key}` : element.key, parentNode);
1765
+ let children = [
1766
+ ...nodes
1767
+ ];
1768
+ for (let node2 of children) {
1769
+ var _childNode_value, _ref;
1770
+ node2.value = (_ref = (_childNode_value = childNode.value) !== null && _childNode_value !== void 0 ? _childNode_value : partialNode.value) !== null && _ref !== void 0 ? _ref : null;
1771
+ if (node2.value) this.cache.set(node2.value, node2);
1772
+ var _parentNode_type;
1773
+ if (partialNode.type && node2.type !== partialNode.type) throw new Error(`Unsupported type <${$eb2240fc39a57fa5$var$capitalize(node2.type)}> in <${$eb2240fc39a57fa5$var$capitalize((_parentNode_type = parentNode === null || parentNode === void 0 ? void 0 : parentNode.type) !== null && _parentNode_type !== void 0 ? _parentNode_type : "unknown parent type")}>. Only <${$eb2240fc39a57fa5$var$capitalize(partialNode.type)}> is supported.`);
1774
+ index++;
1775
+ yield node2;
1776
+ }
1777
+ result = childNodes.next(children);
1778
+ }
1779
+ return;
1780
+ }
1781
+ if (partialNode.key == null || partialNode.type == null) return;
1782
+ let builder = this;
1783
+ var _partialNode_value, _partialNode_textValue;
1784
+ let node = {
1785
+ type: partialNode.type,
1786
+ props: partialNode.props,
1787
+ key: partialNode.key,
1788
+ parentKey: parentNode ? parentNode.key : null,
1789
+ value: (_partialNode_value = partialNode.value) !== null && _partialNode_value !== void 0 ? _partialNode_value : null,
1790
+ level: parentNode ? parentNode.level + 1 : 0,
1791
+ index: partialNode.index,
1792
+ rendered: partialNode.rendered,
1793
+ textValue: (_partialNode_textValue = partialNode.textValue) !== null && _partialNode_textValue !== void 0 ? _partialNode_textValue : "",
1794
+ "aria-label": partialNode["aria-label"],
1795
+ wrapper: partialNode.wrapper,
1796
+ shouldInvalidate: partialNode.shouldInvalidate,
1797
+ hasChildNodes: partialNode.hasChildNodes || false,
1798
+ childNodes: $eb2240fc39a57fa5$var$iterable(function* () {
1799
+ if (!partialNode.hasChildNodes || !partialNode.childNodes) return;
1800
+ let index = 0;
1801
+ for (let child of partialNode.childNodes()) {
1802
+ if (child.key != null)
1803
+ child.key = `${node.key}${child.key}`;
1804
+ let nodes = builder.getFullNode({
1805
+ ...child,
1806
+ index
1807
+ }, builder.getChildState(state, child), node.key, node);
1808
+ for (let node2 of nodes) {
1809
+ index++;
1810
+ yield node2;
1811
+ }
1812
+ }
1813
+ })
1814
+ };
1815
+ yield node;
1816
+ }
1817
+ constructor() {
1818
+ this.cache = /* @__PURE__ */ new WeakMap();
1819
+ }
1820
+ }
1821
+ function $eb2240fc39a57fa5$var$iterable(iterator) {
1822
+ let cache = [];
1823
+ let iterable = null;
1824
+ return {
1825
+ *[Symbol.iterator]() {
1826
+ for (let item of cache) yield item;
1827
+ if (!iterable) iterable = iterator();
1828
+ for (let item of iterable) {
1829
+ cache.push(item);
1830
+ yield item;
1831
+ }
1832
+ }
1833
+ };
1834
+ }
1835
+ function $eb2240fc39a57fa5$var$compose(outer, inner) {
1836
+ if (outer && inner) return (element) => outer(inner(element));
1837
+ if (outer) return outer;
1838
+ if (inner) return inner;
1839
+ }
1840
+ function $eb2240fc39a57fa5$var$capitalize(str) {
1841
+ return str[0].toUpperCase() + str.slice(1);
1842
+ }
1843
+ function $7613b1592d41b092$export$6cd28814d92fa9c9(props, factory, context) {
1844
+ let builder = useMemo(() => new $eb2240fc39a57fa5$export$bf788dd355e3a401(), []);
1845
+ let { children, items, collection } = props;
1846
+ let result = useMemo(() => {
1847
+ if (collection) return collection;
1848
+ let nodes = builder.build({
1849
+ children,
1850
+ items
1851
+ }, context);
1852
+ return factory(nodes);
1853
+ }, [
1854
+ builder,
1855
+ children,
1856
+ items,
1857
+ collection,
1858
+ context,
1859
+ factory
1860
+ ]);
1861
+ return result;
1862
+ }
1863
+ function $c5a24bc478652b5f$export$1005530eda016c13(node, collection) {
1864
+ if (typeof collection.getChildren === "function") return collection.getChildren(node.key);
1865
+ return node.childNodes;
1866
+ }
1867
+ function $c5a24bc478652b5f$export$fbdeaa6a76694f71(iterable) {
1868
+ return $c5a24bc478652b5f$export$5f3398f8733f90e2(iterable);
1869
+ }
1870
+ function $c5a24bc478652b5f$export$5f3398f8733f90e2(iterable, index) {
1871
+ for (let item of iterable) {
1872
+ return item;
1873
+ }
1874
+ }
1875
+ function $c5a24bc478652b5f$export$8c434b3a7a4dad6(collection, a, b) {
1876
+ if (a.parentKey === b.parentKey) return a.index - b.index;
1877
+ let aAncestors = [
1878
+ ...$c5a24bc478652b5f$var$getAncestors(collection, a),
1879
+ a
1880
+ ];
1881
+ let bAncestors = [
1882
+ ...$c5a24bc478652b5f$var$getAncestors(collection, b),
1883
+ b
1884
+ ];
1885
+ let firstNonMatchingAncestor = aAncestors.slice(0, bAncestors.length).findIndex((a2, i) => a2 !== bAncestors[i]);
1886
+ if (firstNonMatchingAncestor !== -1) {
1887
+ a = aAncestors[firstNonMatchingAncestor];
1888
+ b = bAncestors[firstNonMatchingAncestor];
1889
+ return a.index - b.index;
1890
+ }
1891
+ if (aAncestors.findIndex((node) => node === b) >= 0) return 1;
1892
+ else if (bAncestors.findIndex((node) => node === a) >= 0) return -1;
1893
+ return -1;
1894
+ }
1895
+ function $c5a24bc478652b5f$var$getAncestors(collection, node) {
1896
+ let parents = [];
1897
+ let currNode = node;
1898
+ while ((currNode === null || currNode === void 0 ? void 0 : currNode.parentKey) != null) {
1899
+ currNode = collection.getItem(currNode.parentKey);
1900
+ if (currNode) parents.unshift(currNode);
1901
+ }
1902
+ return parents;
1903
+ }
1904
+ class $e40ea825a81a3709$export$52baac22726c72bf extends Set {
1905
+ constructor(keys, anchorKey, currentKey) {
1906
+ super(keys);
1907
+ if (keys instanceof $e40ea825a81a3709$export$52baac22726c72bf) {
1908
+ this.anchorKey = anchorKey !== null && anchorKey !== void 0 ? anchorKey : keys.anchorKey;
1909
+ this.currentKey = currentKey !== null && currentKey !== void 0 ? currentKey : keys.currentKey;
1910
+ } else {
1911
+ this.anchorKey = anchorKey !== null && anchorKey !== void 0 ? anchorKey : null;
1912
+ this.currentKey = currentKey !== null && currentKey !== void 0 ? currentKey : null;
1913
+ }
1914
+ }
1915
+ }
1916
+ function $7af3f5b51489e0b5$var$equalSets(setA, setB) {
1917
+ if (setA.size !== setB.size) return false;
1918
+ for (let item of setA) {
1919
+ if (!setB.has(item)) return false;
1920
+ }
1921
+ return true;
1922
+ }
1923
+ function $7af3f5b51489e0b5$export$253fe78d46329472(props) {
1924
+ let { selectionMode = "none", disallowEmptySelection = false, allowDuplicateSelectionEvents, selectionBehavior: selectionBehaviorProp = "toggle", disabledBehavior = "all" } = props;
1925
+ let isFocusedRef = useRef(false);
1926
+ let [, setFocused] = useState(false);
1927
+ let focusedKeyRef = useRef(null);
1928
+ let childFocusStrategyRef = useRef(null);
1929
+ let [, setFocusedKey] = useState(null);
1930
+ let selectedKeysProp = useMemo(() => $7af3f5b51489e0b5$var$convertSelection(props.selectedKeys), [
1931
+ props.selectedKeys
1932
+ ]);
1933
+ let defaultSelectedKeys = useMemo(() => $7af3f5b51489e0b5$var$convertSelection(props.defaultSelectedKeys, new $e40ea825a81a3709$export$52baac22726c72bf()), [
1934
+ props.defaultSelectedKeys
1935
+ ]);
1936
+ let [selectedKeys, setSelectedKeys] = $458b0a5536c1a7cf$export$40bfa8c7b0832715(selectedKeysProp, defaultSelectedKeys, props.onSelectionChange);
1937
+ let disabledKeysProp = useMemo(() => props.disabledKeys ? new Set(props.disabledKeys) : /* @__PURE__ */ new Set(), [
1938
+ props.disabledKeys
1939
+ ]);
1940
+ let [selectionBehavior, setSelectionBehavior] = useState(selectionBehaviorProp);
1941
+ if (selectionBehaviorProp === "replace" && selectionBehavior === "toggle" && typeof selectedKeys === "object" && selectedKeys.size === 0) setSelectionBehavior("replace");
1942
+ let lastSelectionBehavior = useRef(selectionBehaviorProp);
1943
+ useEffect(() => {
1944
+ if (selectionBehaviorProp !== lastSelectionBehavior.current) {
1945
+ setSelectionBehavior(selectionBehaviorProp);
1946
+ lastSelectionBehavior.current = selectionBehaviorProp;
1947
+ }
1948
+ }, [
1949
+ selectionBehaviorProp
1950
+ ]);
1951
+ return {
1952
+ selectionMode,
1953
+ disallowEmptySelection,
1954
+ selectionBehavior,
1955
+ setSelectionBehavior,
1956
+ get isFocused() {
1957
+ return isFocusedRef.current;
1958
+ },
1959
+ setFocused(f) {
1960
+ isFocusedRef.current = f;
1961
+ setFocused(f);
1962
+ },
1963
+ get focusedKey() {
1964
+ return focusedKeyRef.current;
1965
+ },
1966
+ get childFocusStrategy() {
1967
+ return childFocusStrategyRef.current;
1968
+ },
1969
+ setFocusedKey(k, childFocusStrategy = "first") {
1970
+ focusedKeyRef.current = k;
1971
+ childFocusStrategyRef.current = childFocusStrategy;
1972
+ setFocusedKey(k);
1973
+ },
1974
+ selectedKeys,
1975
+ setSelectedKeys(keys) {
1976
+ if (allowDuplicateSelectionEvents || !$7af3f5b51489e0b5$var$equalSets(keys, selectedKeys)) setSelectedKeys(keys);
1977
+ },
1978
+ disabledKeys: disabledKeysProp,
1979
+ disabledBehavior
1980
+ };
1981
+ }
1982
+ function $7af3f5b51489e0b5$var$convertSelection(selection, defaultValue) {
1983
+ if (!selection) return defaultValue;
1984
+ return selection === "all" ? "all" : new $e40ea825a81a3709$export$52baac22726c72bf(selection);
1985
+ }
1986
+ class $d496c0a20b6e58ec$export$6c8a5aaad13c9852 {
1987
+ /**
1988
+ * The type of selection that is allowed in the collection.
1989
+ */
1990
+ get selectionMode() {
1991
+ return this.state.selectionMode;
1992
+ }
1993
+ /**
1994
+ * Whether the collection allows empty selection.
1995
+ */
1996
+ get disallowEmptySelection() {
1997
+ return this.state.disallowEmptySelection;
1998
+ }
1999
+ /**
2000
+ * The selection behavior for the collection.
2001
+ */
2002
+ get selectionBehavior() {
2003
+ return this.state.selectionBehavior;
2004
+ }
2005
+ /**
2006
+ * Sets the selection behavior for the collection.
2007
+ */
2008
+ setSelectionBehavior(selectionBehavior) {
2009
+ this.state.setSelectionBehavior(selectionBehavior);
2010
+ }
2011
+ /**
2012
+ * Whether the collection is currently focused.
2013
+ */
2014
+ get isFocused() {
2015
+ return this.state.isFocused;
2016
+ }
2017
+ /**
2018
+ * Sets whether the collection is focused.
2019
+ */
2020
+ setFocused(isFocused) {
2021
+ this.state.setFocused(isFocused);
2022
+ }
2023
+ /**
2024
+ * The current focused key in the collection.
2025
+ */
2026
+ get focusedKey() {
2027
+ return this.state.focusedKey;
2028
+ }
2029
+ /** Whether the first or last child of the focused key should receive focus. */
2030
+ get childFocusStrategy() {
2031
+ return this.state.childFocusStrategy;
2032
+ }
2033
+ /**
2034
+ * Sets the focused key.
2035
+ */
2036
+ setFocusedKey(key, childFocusStrategy) {
2037
+ if (key == null || this.collection.getItem(key)) this.state.setFocusedKey(key, childFocusStrategy);
2038
+ }
2039
+ /**
2040
+ * The currently selected keys in the collection.
2041
+ */
2042
+ get selectedKeys() {
2043
+ return this.state.selectedKeys === "all" ? new Set(this.getSelectAllKeys()) : this.state.selectedKeys;
2044
+ }
2045
+ /**
2046
+ * The raw selection value for the collection.
2047
+ * Either 'all' for select all, or a set of keys.
2048
+ */
2049
+ get rawSelection() {
2050
+ return this.state.selectedKeys;
2051
+ }
2052
+ /**
2053
+ * Returns whether a key is selected.
2054
+ */
2055
+ isSelected(key) {
2056
+ if (this.state.selectionMode === "none") return false;
2057
+ let mappedKey = this.getKey(key);
2058
+ if (mappedKey == null) return false;
2059
+ return this.state.selectedKeys === "all" ? this.canSelectItem(mappedKey) : this.state.selectedKeys.has(mappedKey);
2060
+ }
2061
+ /**
2062
+ * Whether the selection is empty.
2063
+ */
2064
+ get isEmpty() {
2065
+ return this.state.selectedKeys !== "all" && this.state.selectedKeys.size === 0;
2066
+ }
2067
+ /**
2068
+ * Whether all items in the collection are selected.
2069
+ */
2070
+ get isSelectAll() {
2071
+ if (this.isEmpty) return false;
2072
+ if (this.state.selectedKeys === "all") return true;
2073
+ if (this._isSelectAll != null) return this._isSelectAll;
2074
+ let allKeys = this.getSelectAllKeys();
2075
+ let selectedKeys = this.state.selectedKeys;
2076
+ this._isSelectAll = allKeys.every((k) => selectedKeys.has(k));
2077
+ return this._isSelectAll;
2078
+ }
2079
+ get firstSelectedKey() {
2080
+ let first = null;
2081
+ for (let key of this.state.selectedKeys) {
2082
+ let item = this.collection.getItem(key);
2083
+ if (!first || item && $c5a24bc478652b5f$export$8c434b3a7a4dad6(this.collection, item, first) < 0) first = item;
2084
+ }
2085
+ var _first_key;
2086
+ return (_first_key = first === null || first === void 0 ? void 0 : first.key) !== null && _first_key !== void 0 ? _first_key : null;
2087
+ }
2088
+ get lastSelectedKey() {
2089
+ let last = null;
2090
+ for (let key of this.state.selectedKeys) {
2091
+ let item = this.collection.getItem(key);
2092
+ if (!last || item && $c5a24bc478652b5f$export$8c434b3a7a4dad6(this.collection, item, last) > 0) last = item;
2093
+ }
2094
+ var _last_key;
2095
+ return (_last_key = last === null || last === void 0 ? void 0 : last.key) !== null && _last_key !== void 0 ? _last_key : null;
2096
+ }
2097
+ get disabledKeys() {
2098
+ return this.state.disabledKeys;
2099
+ }
2100
+ get disabledBehavior() {
2101
+ return this.state.disabledBehavior;
2102
+ }
2103
+ /**
2104
+ * Extends the selection to the given key.
2105
+ */
2106
+ extendSelection(toKey) {
2107
+ if (this.selectionMode === "none") return;
2108
+ if (this.selectionMode === "single") {
2109
+ this.replaceSelection(toKey);
2110
+ return;
2111
+ }
2112
+ let mappedToKey = this.getKey(toKey);
2113
+ if (mappedToKey == null) return;
2114
+ let selection;
2115
+ if (this.state.selectedKeys === "all") selection = new $e40ea825a81a3709$export$52baac22726c72bf([
2116
+ mappedToKey
2117
+ ], mappedToKey, mappedToKey);
2118
+ else {
2119
+ let selectedKeys = this.state.selectedKeys;
2120
+ var _selectedKeys_anchorKey;
2121
+ let anchorKey = (_selectedKeys_anchorKey = selectedKeys.anchorKey) !== null && _selectedKeys_anchorKey !== void 0 ? _selectedKeys_anchorKey : mappedToKey;
2122
+ selection = new $e40ea825a81a3709$export$52baac22726c72bf(selectedKeys, anchorKey, mappedToKey);
2123
+ var _selectedKeys_currentKey;
2124
+ for (let key of this.getKeyRange(anchorKey, (_selectedKeys_currentKey = selectedKeys.currentKey) !== null && _selectedKeys_currentKey !== void 0 ? _selectedKeys_currentKey : mappedToKey)) selection.delete(key);
2125
+ for (let key of this.getKeyRange(mappedToKey, anchorKey)) if (this.canSelectItem(key)) selection.add(key);
2126
+ }
2127
+ this.state.setSelectedKeys(selection);
2128
+ }
2129
+ getKeyRange(from, to) {
2130
+ let fromItem = this.collection.getItem(from);
2131
+ let toItem = this.collection.getItem(to);
2132
+ if (fromItem && toItem) {
2133
+ if ($c5a24bc478652b5f$export$8c434b3a7a4dad6(this.collection, fromItem, toItem) <= 0) return this.getKeyRangeInternal(from, to);
2134
+ return this.getKeyRangeInternal(to, from);
2135
+ }
2136
+ return [];
2137
+ }
2138
+ getKeyRangeInternal(from, to) {
2139
+ var _this_layoutDelegate;
2140
+ if ((_this_layoutDelegate = this.layoutDelegate) === null || _this_layoutDelegate === void 0 ? void 0 : _this_layoutDelegate.getKeyRange) return this.layoutDelegate.getKeyRange(from, to);
2141
+ let keys = [];
2142
+ let key = from;
2143
+ while (key != null) {
2144
+ let item = this.collection.getItem(key);
2145
+ if (item && (item.type === "item" || item.type === "cell" && this.allowsCellSelection)) keys.push(key);
2146
+ if (key === to) return keys;
2147
+ key = this.collection.getKeyAfter(key);
2148
+ }
2149
+ return [];
2150
+ }
2151
+ getKey(key) {
2152
+ let item = this.collection.getItem(key);
2153
+ if (!item)
2154
+ return key;
2155
+ if (item.type === "cell" && this.allowsCellSelection) return key;
2156
+ while (item && item.type !== "item" && item.parentKey != null) item = this.collection.getItem(item.parentKey);
2157
+ if (!item || item.type !== "item") return null;
2158
+ return item.key;
2159
+ }
2160
+ /**
2161
+ * Toggles whether the given key is selected.
2162
+ */
2163
+ toggleSelection(key) {
2164
+ if (this.selectionMode === "none") return;
2165
+ if (this.selectionMode === "single" && !this.isSelected(key)) {
2166
+ this.replaceSelection(key);
2167
+ return;
2168
+ }
2169
+ let mappedKey = this.getKey(key);
2170
+ if (mappedKey == null) return;
2171
+ let keys = new $e40ea825a81a3709$export$52baac22726c72bf(this.state.selectedKeys === "all" ? this.getSelectAllKeys() : this.state.selectedKeys);
2172
+ if (keys.has(mappedKey)) keys.delete(mappedKey);
2173
+ else if (this.canSelectItem(mappedKey)) {
2174
+ keys.add(mappedKey);
2175
+ keys.anchorKey = mappedKey;
2176
+ keys.currentKey = mappedKey;
2177
+ }
2178
+ if (this.disallowEmptySelection && keys.size === 0) return;
2179
+ this.state.setSelectedKeys(keys);
2180
+ }
2181
+ /**
2182
+ * Replaces the selection with only the given key.
2183
+ */
2184
+ replaceSelection(key) {
2185
+ if (this.selectionMode === "none") return;
2186
+ let mappedKey = this.getKey(key);
2187
+ if (mappedKey == null) return;
2188
+ let selection = this.canSelectItem(mappedKey) ? new $e40ea825a81a3709$export$52baac22726c72bf([
2189
+ mappedKey
2190
+ ], mappedKey, mappedKey) : new $e40ea825a81a3709$export$52baac22726c72bf();
2191
+ this.state.setSelectedKeys(selection);
2192
+ }
2193
+ /**
2194
+ * Replaces the selection with the given keys.
2195
+ */
2196
+ setSelectedKeys(keys) {
2197
+ if (this.selectionMode === "none") return;
2198
+ let selection = new $e40ea825a81a3709$export$52baac22726c72bf();
2199
+ for (let key of keys) {
2200
+ let mappedKey = this.getKey(key);
2201
+ if (mappedKey != null) {
2202
+ selection.add(mappedKey);
2203
+ if (this.selectionMode === "single") break;
2204
+ }
2205
+ }
2206
+ this.state.setSelectedKeys(selection);
2207
+ }
2208
+ getSelectAllKeys() {
2209
+ let keys = [];
2210
+ let addKeys = (key) => {
2211
+ while (key != null) {
2212
+ if (this.canSelectItem(key)) {
2213
+ var _getFirstItem;
2214
+ let item = this.collection.getItem(key);
2215
+ if ((item === null || item === void 0 ? void 0 : item.type) === "item") keys.push(key);
2216
+ var _getFirstItem_key;
2217
+ if ((item === null || item === void 0 ? void 0 : item.hasChildNodes) && (this.allowsCellSelection || item.type !== "item")) addKeys((_getFirstItem_key = (_getFirstItem = $c5a24bc478652b5f$export$fbdeaa6a76694f71($c5a24bc478652b5f$export$1005530eda016c13(item, this.collection))) === null || _getFirstItem === void 0 ? void 0 : _getFirstItem.key) !== null && _getFirstItem_key !== void 0 ? _getFirstItem_key : null);
2218
+ }
2219
+ key = this.collection.getKeyAfter(key);
2220
+ }
2221
+ };
2222
+ addKeys(this.collection.getFirstKey());
2223
+ return keys;
2224
+ }
2225
+ /**
2226
+ * Selects all items in the collection.
2227
+ */
2228
+ selectAll() {
2229
+ if (!this.isSelectAll && this.selectionMode === "multiple") this.state.setSelectedKeys("all");
2230
+ }
2231
+ /**
2232
+ * Removes all keys from the selection.
2233
+ */
2234
+ clearSelection() {
2235
+ if (!this.disallowEmptySelection && (this.state.selectedKeys === "all" || this.state.selectedKeys.size > 0)) this.state.setSelectedKeys(new $e40ea825a81a3709$export$52baac22726c72bf());
2236
+ }
2237
+ /**
2238
+ * Toggles between select all and an empty selection.
2239
+ */
2240
+ toggleSelectAll() {
2241
+ if (this.isSelectAll) this.clearSelection();
2242
+ else this.selectAll();
2243
+ }
2244
+ select(key, e) {
2245
+ if (this.selectionMode === "none") return;
2246
+ if (this.selectionMode === "single") {
2247
+ if (this.isSelected(key) && !this.disallowEmptySelection) this.toggleSelection(key);
2248
+ else this.replaceSelection(key);
2249
+ } else if (this.selectionBehavior === "toggle" || e && (e.pointerType === "touch" || e.pointerType === "virtual"))
2250
+ this.toggleSelection(key);
2251
+ else this.replaceSelection(key);
2252
+ }
2253
+ /**
2254
+ * Returns whether the current selection is equal to the given selection.
2255
+ */
2256
+ isSelectionEqual(selection) {
2257
+ if (selection === this.state.selectedKeys) return true;
2258
+ let selectedKeys = this.selectedKeys;
2259
+ if (selection.size !== selectedKeys.size) return false;
2260
+ for (let key of selection) {
2261
+ if (!selectedKeys.has(key)) return false;
2262
+ }
2263
+ for (let key of selectedKeys) {
2264
+ if (!selection.has(key)) return false;
2265
+ }
2266
+ return true;
2267
+ }
2268
+ canSelectItem(key) {
2269
+ var _item_props;
2270
+ if (this.state.selectionMode === "none" || this.state.disabledKeys.has(key)) return false;
2271
+ let item = this.collection.getItem(key);
2272
+ if (!item || (item === null || item === void 0 ? void 0 : (_item_props = item.props) === null || _item_props === void 0 ? void 0 : _item_props.isDisabled) || item.type === "cell" && !this.allowsCellSelection) return false;
2273
+ return true;
2274
+ }
2275
+ isDisabled(key) {
2276
+ var _this_collection_getItem_props, _this_collection_getItem;
2277
+ return this.state.disabledBehavior === "all" && (this.state.disabledKeys.has(key) || !!((_this_collection_getItem = this.collection.getItem(key)) === null || _this_collection_getItem === void 0 ? void 0 : (_this_collection_getItem_props = _this_collection_getItem.props) === null || _this_collection_getItem_props === void 0 ? void 0 : _this_collection_getItem_props.isDisabled));
2278
+ }
2279
+ isLink(key) {
2280
+ var _this_collection_getItem_props, _this_collection_getItem;
2281
+ return !!((_this_collection_getItem = this.collection.getItem(key)) === null || _this_collection_getItem === void 0 ? void 0 : (_this_collection_getItem_props = _this_collection_getItem.props) === null || _this_collection_getItem_props === void 0 ? void 0 : _this_collection_getItem_props.href);
2282
+ }
2283
+ getItemProps(key) {
2284
+ var _this_collection_getItem;
2285
+ return (_this_collection_getItem = this.collection.getItem(key)) === null || _this_collection_getItem === void 0 ? void 0 : _this_collection_getItem.props;
2286
+ }
2287
+ withCollection(collection) {
2288
+ return new $d496c0a20b6e58ec$export$6c8a5aaad13c9852(collection, this.state, {
2289
+ allowsCellSelection: this.allowsCellSelection,
2290
+ layoutDelegate: this.layoutDelegate || void 0
2291
+ });
2292
+ }
2293
+ constructor(collection, state, options) {
2294
+ this.collection = collection;
2295
+ this.state = state;
2296
+ var _options_allowsCellSelection;
2297
+ this.allowsCellSelection = (_options_allowsCellSelection = options === null || options === void 0 ? void 0 : options.allowsCellSelection) !== null && _options_allowsCellSelection !== void 0 ? _options_allowsCellSelection : false;
2298
+ this._isSelectAll = null;
2299
+ this.layoutDelegate = (options === null || options === void 0 ? void 0 : options.layoutDelegate) || null;
2300
+ }
2301
+ }
2302
+ const $7135fc7d473fd974$export$d40e14dec8b060a8 = /* @__PURE__ */ createContext(null);
2303
+ const $7135fc7d473fd974$export$a164736487e3f0ae = {
2304
+ CollectionRoot({ collection, renderDropIndicator }) {
2305
+ return $7135fc7d473fd974$var$useCollectionRender(collection, null, renderDropIndicator);
2306
+ },
2307
+ CollectionBranch({ collection, parent, renderDropIndicator }) {
2308
+ return $7135fc7d473fd974$var$useCollectionRender(collection, parent, renderDropIndicator);
2309
+ }
2310
+ };
2311
+ function $7135fc7d473fd974$var$useCollectionRender(collection, parent, renderDropIndicator) {
2312
+ return $e948873055cbafe4$export$727c8fc270210f13({
2313
+ items: parent ? collection.getChildren(parent.key) : collection,
2314
+ dependencies: [
2315
+ renderDropIndicator
2316
+ ],
2317
+ children(node) {
2318
+ var _collection_getItem;
2319
+ let rendered = node.render(node);
2320
+ if (!renderDropIndicator || node.type !== "item") return rendered;
2321
+ let key = node.key;
2322
+ let keyAfter = collection.getKeyAfter(key);
2323
+ return /* @__PURE__ */ React__default.createElement(React__default.Fragment, null, renderDropIndicator({
2324
+ type: "item",
2325
+ key,
2326
+ dropPosition: "before"
2327
+ }), rendered, (keyAfter == null || ((_collection_getItem = collection.getItem(keyAfter)) === null || _collection_getItem === void 0 ? void 0 : _collection_getItem.type) !== "item") && renderDropIndicator({
2328
+ type: "item",
2329
+ key,
2330
+ dropPosition: "after"
2331
+ }));
2332
+ }
2333
+ });
2334
+ }
2335
+ const $7135fc7d473fd974$export$4feb769f8ddf26c5 = /* @__PURE__ */ createContext($7135fc7d473fd974$export$a164736487e3f0ae);
2336
+ function $7135fc7d473fd974$export$90e00781bc59d8f9(focusedKey) {
2337
+ return useMemo(() => focusedKey != null ? /* @__PURE__ */ new Set([
2338
+ focusedKey
2339
+ ]) : null, [
2340
+ focusedKey
2341
+ ]);
2342
+ }
2343
+ export {
2344
+ $7af3f5b51489e0b5$export$253fe78d46329472 as $,
2345
+ $7613b1592d41b092$export$6cd28814d92fa9c9 as a,
2346
+ $d496c0a20b6e58ec$export$6c8a5aaad13c9852 as b,
2347
+ $880e95eb8b93ba9a$export$ecf600387e221c37 as c,
2348
+ $e1995378a142960e$export$18af5c7a9e9b3664 as d,
2349
+ $e1995378a142960e$export$bf788dd355e3a401 as e,
2350
+ $e1995378a142960e$export$fb8073518f34e6ec as f,
2351
+ $7135fc7d473fd974$export$4feb769f8ddf26c5 as g,
2352
+ $7135fc7d473fd974$export$d40e14dec8b060a8 as h,
2353
+ $feb5ffebff200149$export$c3d8340acf92597f as i,
2354
+ $cc38e7bd3fc7b213$export$2bb74740c4e19def as j,
2355
+ $ae20dd8cbca75726$export$d6daf82dcd84e87c as k,
2356
+ $c5a24bc478652b5f$export$1005530eda016c13 as l,
2357
+ $7135fc7d473fd974$export$a164736487e3f0ae as m,
2358
+ $7135fc7d473fd974$export$90e00781bc59d8f9 as n,
2359
+ $fb3050f43d946246$export$e32c88dfddc6e1d8 as o,
2360
+ $55f9b1ae81f22853$export$2b35b76d2e30e129 as p,
2361
+ $8a26561d2877236e$export$c24ed0104d07eab9 as q,
2362
+ $e1995378a142960e$export$e953bb1cd0f19726 as r
2363
+ };