@easypost/easy-ui 1.0.0-alpha.4 → 1.0.0-alpha.6

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 (133) hide show
  1. package/Badge/index.js +32 -26
  2. package/Badge/index.mjs +32 -26
  3. package/Banner/index.js +15 -16
  4. package/Banner/index.mjs +15 -16
  5. package/Button/Button.d.ts +61 -0
  6. package/Button/Button.d.ts.map +1 -1
  7. package/Button/index.js +34 -69
  8. package/Button/index.mjs +33 -68
  9. package/CHANGELOG.md +21 -0
  10. package/Card/index.js +84 -5
  11. package/Card/index.mjs +84 -5
  12. package/Checkbox/index.js +84 -72
  13. package/Checkbox/index.mjs +84 -72
  14. package/CodeBlock/index.js +43 -49
  15. package/CodeBlock/index.mjs +43 -49
  16. package/DropdownButton/DropdownButton.d.ts +48 -0
  17. package/DropdownButton/DropdownButton.d.ts.map +1 -1
  18. package/DropdownButton/index.js +29 -101
  19. package/DropdownButton/index.mjs +29 -85
  20. package/HorizontalGrid/index.js +11 -31
  21. package/HorizontalGrid/index.mjs +11 -31
  22. package/HorizontalStack/index.js +48 -4
  23. package/HorizontalStack/index.mjs +48 -4
  24. package/Icon/Icon.d.ts +51 -0
  25. package/Icon/Icon.d.ts.map +1 -1
  26. package/Icon/index.js +38 -4
  27. package/Icon/index.mjs +38 -4
  28. package/IconButton/IconButton.d.ts +62 -0
  29. package/IconButton/IconButton.d.ts.map +1 -1
  30. package/IconButton/index.js +26 -43
  31. package/IconButton/index.mjs +25 -42
  32. package/InputField/Label.d.ts +2 -2
  33. package/InputField/index.js +282 -10
  34. package/InputField/index.mjs +266 -10
  35. package/InputField/utilities.d.ts +1 -1
  36. package/InputField/utilities.d.ts.map +1 -1
  37. package/Menu/MenuOverlay.d.ts.map +1 -1
  38. package/Menu/index.js +178 -1958
  39. package/Menu/index.mjs +168 -1948
  40. package/Menu/utilities.d.ts +11 -0
  41. package/Menu/utilities.d.ts.map +1 -0
  42. package/Notification/index.js +1534 -14
  43. package/Notification/index.mjs +1518 -14
  44. package/Provider/index.js +15 -15
  45. package/Provider/index.mjs +15 -15
  46. package/RadioGroup/index.js +63 -63
  47. package/RadioGroup/index.mjs +63 -63
  48. package/Select/Select.d.ts +88 -0
  49. package/Select/Select.d.ts.map +1 -0
  50. package/Select/Select.stories.d.ts +17 -0
  51. package/Select/Select.stories.d.ts.map +1 -0
  52. package/Select/Select.test.d.ts +2 -0
  53. package/Select/Select.test.d.ts.map +1 -0
  54. package/Select/SelectContext.d.ts +14 -0
  55. package/Select/SelectContext.d.ts.map +1 -0
  56. package/Select/SelectField.d.ts +62 -0
  57. package/Select/SelectField.d.ts.map +1 -0
  58. package/Select/SelectOption.d.ts +23 -0
  59. package/Select/SelectOption.d.ts.map +1 -0
  60. package/Select/SelectOverlay.d.ts +3 -0
  61. package/Select/SelectOverlay.d.ts.map +1 -0
  62. package/Select/SelectSection.d.ts +22 -0
  63. package/Select/SelectSection.d.ts.map +1 -0
  64. package/Select/SelectTrigger.d.ts +30 -0
  65. package/Select/SelectTrigger.d.ts.map +1 -0
  66. package/Select/index.d.ts +2 -0
  67. package/Select/index.d.ts.map +1 -0
  68. package/Select/index.js +816 -0
  69. package/Select/index.mjs +816 -0
  70. package/SelectorErrorTooltip/index.js +102 -11
  71. package/SelectorErrorTooltip/index.mjs +86 -11
  72. package/Text/index.js +85 -4
  73. package/Text/index.mjs +85 -4
  74. package/TextField/index.js +19 -38
  75. package/TextField/index.mjs +19 -38
  76. package/Textarea/index.js +20 -37
  77. package/Textarea/index.mjs +20 -37
  78. package/Theme/index.js +145 -9
  79. package/Theme/index.mjs +145 -9
  80. package/Toggle/index.js +51 -50
  81. package/Toggle/index.mjs +51 -50
  82. package/Tooltip/index.js +299 -10
  83. package/Tooltip/index.mjs +299 -10
  84. package/UnstyledButton/index.js +4 -4
  85. package/UnstyledButton/index.mjs +3 -3
  86. package/VerticalStack/index.js +13 -47
  87. package/VerticalStack/index.mjs +13 -47
  88. package/__chunks__/ExpandMore400-7c5263a4.mjs +49 -0
  89. package/__chunks__/ExpandMore400-92646971.js +65 -0
  90. package/__chunks__/InputIcon-2317befd.mjs +148 -0
  91. package/__chunks__/InputIcon-d3963cf8.js +147 -0
  92. package/__chunks__/{import-e7f45c7e.mjs → import-0561e1ba.mjs} +3 -3
  93. package/__chunks__/{import-b7971a11.mjs → import-19bc38ac.mjs} +72 -34
  94. package/__chunks__/{import-01299af6.js → import-24a482e1.js} +3 -2
  95. package/__chunks__/{import-baa3cd0c.mjs → import-29af6941.mjs} +4 -3
  96. package/__chunks__/{import-0d1b4d93.js → import-2b302763.js} +193 -141
  97. package/__chunks__/{import-ab878fb6.mjs → import-3d962a94.mjs} +205 -153
  98. package/__chunks__/{import-86330a7c.mjs → import-6a831ca1.mjs} +16 -15
  99. package/__chunks__/{import-7545401a.js → import-8b6c0bc7.js} +3 -3
  100. package/__chunks__/{import-63bf0645.js → import-a1e0f814.js} +47 -9
  101. package/__chunks__/{import-3ab42f86.js → import-a2023d8f.js} +35 -22
  102. package/__chunks__/{import-76076ca6.js → import-dea5a24d.js} +15 -14
  103. package/__chunks__/{import-856e0385.mjs → import-f1f4792a.mjs} +36 -23
  104. package/__chunks__/{UnstyledButton-883f0c6c.mjs → index-29d7bca9.mjs} +17 -42
  105. package/__chunks__/{UnstyledButton-96172ec0.js → index-3985350a.js} +17 -42
  106. package/__chunks__/{overlayscrollbars-react.es-c8369a03.mjs → overlayscrollbars-react.es-7f332a3b.mjs} +4 -4
  107. package/__chunks__/{overlayscrollbars-react.es-20563393.js → overlayscrollbars-react.es-f2a0bcff.js} +4 -4
  108. package/__chunks__/{real-module-e4cd2301.mjs → real-module-515df21d.mjs} +1 -1
  109. package/__chunks__/{real-module-ae2a4342.js → real-module-e36b1436.js} +1 -1
  110. package/__chunks__/useTriggerWidth-156b038a.js +2030 -0
  111. package/__chunks__/useTriggerWidth-addcd1d6.mjs +2031 -0
  112. package/package.json +11 -11
  113. package/style.css +1423 -1196
  114. package/utilities/css.js +14 -58
  115. package/utilities/css.mjs +14 -58
  116. package/__chunks__/Card-7bbd41e0.mjs +0 -110
  117. package/__chunks__/Card-dac53c75.js +0 -109
  118. package/__chunks__/HorizontalStack-a441c63f.mjs +0 -80
  119. package/__chunks__/HorizontalStack-a862839b.js +0 -79
  120. package/__chunks__/Icon-3d00481a.js +0 -44
  121. package/__chunks__/Icon-a75b5201.mjs +0 -45
  122. package/__chunks__/InputField-4fbaae06.js +0 -487
  123. package/__chunks__/InputField-a272f602.mjs +0 -472
  124. package/__chunks__/Notification-b8eafec6.mjs +0 -1456
  125. package/__chunks__/Notification-c5b34eb3.js +0 -1471
  126. package/__chunks__/SelectorErrorTooltip-43c5e29e.js +0 -84
  127. package/__chunks__/SelectorErrorTooltip-b6204987.mjs +0 -69
  128. package/__chunks__/Text-1ae70c19.js +0 -102
  129. package/__chunks__/Text-4ae50d5c.mjs +0 -103
  130. package/__chunks__/Theme-4e498252.mjs +0 -132
  131. package/__chunks__/Theme-751e5575.js +0 -131
  132. package/__chunks__/Tooltip-bd55165e.js +0 -317
  133. package/__chunks__/Tooltip-f7e67b21.mjs +0 -318
@@ -0,0 +1,2031 @@
1
+ var __defProp = Object.defineProperty;
2
+ var __defProps = Object.defineProperties;
3
+ var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
4
+ var __getOwnPropSymbols = Object.getOwnPropertySymbols;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __propIsEnum = Object.prototype.propertyIsEnumerable;
7
+ var __knownSymbol = (name, symbol) => {
8
+ if (symbol = Symbol[name])
9
+ return symbol;
10
+ throw Error("Symbol." + name + " is not defined");
11
+ };
12
+ var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
13
+ var __spreadValues = (a, b) => {
14
+ for (var prop in b || (b = {}))
15
+ if (__hasOwnProp.call(b, prop))
16
+ __defNormalProp(a, prop, b[prop]);
17
+ if (__getOwnPropSymbols)
18
+ for (var prop of __getOwnPropSymbols(b)) {
19
+ if (__propIsEnum.call(b, prop))
20
+ __defNormalProp(a, prop, b[prop]);
21
+ }
22
+ return a;
23
+ };
24
+ var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
25
+ var __objRest = (source, exclude) => {
26
+ var target = {};
27
+ for (var prop in source)
28
+ if (__hasOwnProp.call(source, prop) && exclude.indexOf(prop) < 0)
29
+ target[prop] = source[prop];
30
+ if (source != null && __getOwnPropSymbols)
31
+ for (var prop of __getOwnPropSymbols(source)) {
32
+ if (exclude.indexOf(prop) < 0 && __propIsEnum.call(source, prop))
33
+ target[prop] = source[prop];
34
+ }
35
+ return target;
36
+ };
37
+ var __await = function(promise, isYieldStar) {
38
+ this[0] = promise;
39
+ this[1] = isYieldStar;
40
+ };
41
+ var __yieldStar = (value) => {
42
+ var obj = value[__knownSymbol("asyncIterator")];
43
+ var isAwait = false;
44
+ var method;
45
+ var it = {};
46
+ if (obj == null) {
47
+ obj = value[__knownSymbol("iterator")]();
48
+ method = (k) => it[k] = (x) => obj[k](x);
49
+ } else {
50
+ obj = obj.call(value);
51
+ method = (k) => it[k] = (v) => {
52
+ if (isAwait) {
53
+ isAwait = false;
54
+ if (k === "throw")
55
+ throw v;
56
+ return v;
57
+ }
58
+ isAwait = true;
59
+ return {
60
+ done: false,
61
+ value: new __await(new Promise((resolve) => {
62
+ var x = obj[k](v);
63
+ if (!(x instanceof Object))
64
+ throw TypeError("Object expected");
65
+ resolve(x);
66
+ }), 1)
67
+ };
68
+ };
69
+ }
70
+ return it[__knownSymbol("iterator")] = () => it, method("next"), "throw" in obj ? method("throw") : it.throw = (x) => {
71
+ throw x;
72
+ }, "return" in obj && method("return"), it;
73
+ };
74
+ import { t as $62d8ded9296f3872$export$2bb74740c4e19def, u as $e9faafb641e167db$export$90fc3a17d93f704c, v as $2f04cbc44ee30ce0$export$53a0910f038337bd, w as $2f04cbc44ee30ce0$export$c826860796309d1b, a as $3ef42575df84b30b$export$9d1611c77c2fe928, x as $c87311424ea30a05$export$e1865c3bedcd822b, p as $c87311424ea30a05$export$9ac100e40613ea10, i as $7215afc6de606d6b$export$de79e2c695e052f3, b as $bdb11010cef70236$export$f680877a34711e37, d as $65484d02dcb7eb3e$export$457c3d6518dd4c6f, g as $8ae05eaa5c114e9c$export$7f54fc3180508a52, o as $f0a04ccd8dbdd83b$export$e5c5a5f917a5871c, $ as $bdb11010cef70236$export$b4cc09c592e8fdb8, q as $9daab02d461809db$export$683480f191c0e3ea } from "./import-19bc38ac.mjs";
75
+ import { h as $6a99195332edec8b$export$80f3e147d781571c, $ as $f6c31cce2adf654f$export$45712eceda6fad21, i as $8a26561d2877236e$export$c24ed0104d07eab9, j as $507fabe10e71c6fb$export$630ff653c5ada6a9, g as $9bf71ea28793e738$export$2d6ec8fc375ceafa, f as $6179b936705e76d3$export$ae780daf29e6d456, k as $507fabe10e71c6fb$export$b9b3dfddab17db27, l as $46d819fcbaf35654$export$8f71654801c2f7cd } from "./import-3d962a94.mjs";
76
+ import { $ as $628037886ba31236$export$f9d5c8beee7d008d, a as $fc909762b330b746$export$61c6a8c84e605fb6 } from "./import-f1f4792a.mjs";
77
+ import React__default, { useRef, useMemo, useEffect, useCallback, useState } from "react";
78
+ import { b as $325a3faab7a68acd$export$a16aca283550c30d, $ as $18f2051aff69b9bf$export$43bb16f9c6d9e3f7, a as $fca6afa0e843324b$export$f12b703ca79dfbb1 } from "./real-module-515df21d.mjs";
79
+ import { $ as $458b0a5536c1a7cf$export$40bfa8c7b0832715 } from "./import-6a831ca1.mjs";
80
+ import { getComponentToken, pxToRem, getResponsiveValue } from "../utilities/css.mjs";
81
+ function $feb5ffebff200149$export$d3e3bd3e26688c04(e) {
82
+ return $c87311424ea30a05$export$e1865c3bedcd822b() ? e.altKey : e.ctrlKey;
83
+ }
84
+ function $feb5ffebff200149$export$16792effe837dba3(e) {
85
+ if ($c87311424ea30a05$export$9ac100e40613ea10())
86
+ return e.metaKey;
87
+ return e.ctrlKey;
88
+ }
89
+ const $fb3050f43d946246$var$TYPEAHEAD_DEBOUNCE_WAIT_MS = 1e3;
90
+ function $fb3050f43d946246$export$e32c88dfddc6e1d8(options) {
91
+ let { keyboardDelegate, selectionManager, onTypeSelect } = options;
92
+ let state = useRef({
93
+ search: "",
94
+ timeout: null
95
+ }).current;
96
+ let onKeyDown = (e) => {
97
+ let character = $fb3050f43d946246$var$getStringForKey(e.key);
98
+ if (!character || e.ctrlKey || e.metaKey || !e.currentTarget.contains(e.target))
99
+ return;
100
+ if (character === " " && state.search.trim().length > 0) {
101
+ e.preventDefault();
102
+ if (!("continuePropagation" in e))
103
+ e.stopPropagation();
104
+ }
105
+ state.search += character;
106
+ let key = keyboardDelegate.getKeyForSearch(state.search, selectionManager.focusedKey);
107
+ if (key == null)
108
+ key = keyboardDelegate.getKeyForSearch(state.search);
109
+ if (key != null) {
110
+ selectionManager.setFocusedKey(key);
111
+ if (onTypeSelect)
112
+ onTypeSelect(key);
113
+ }
114
+ clearTimeout(state.timeout);
115
+ state.timeout = setTimeout(() => {
116
+ state.search = "";
117
+ }, $fb3050f43d946246$var$TYPEAHEAD_DEBOUNCE_WAIT_MS);
118
+ };
119
+ return {
120
+ typeSelectProps: {
121
+ // Using a capturing listener to catch the keydown event before
122
+ // other hooks in order to handle the Spacebar event.
123
+ onKeyDownCapture: keyboardDelegate.getKeyForSearch ? onKeyDown : null
124
+ }
125
+ };
126
+ }
127
+ function $fb3050f43d946246$var$getStringForKey(key) {
128
+ if (key.length === 1 || !/^[A-Z]/i.test(key))
129
+ return key;
130
+ return "";
131
+ }
132
+ function $ae20dd8cbca75726$export$d6daf82dcd84e87c(options) {
133
+ let { selectionManager: manager, keyboardDelegate: delegate, ref, autoFocus = false, shouldFocusWrap = false, disallowEmptySelection = false, disallowSelectAll = false, selectOnFocus = manager.selectionBehavior === "replace", disallowTypeAhead = false, shouldUseVirtualFocus, allowsTabNavigation = false, isVirtualized, scrollRef = ref } = options;
134
+ let { direction } = $18f2051aff69b9bf$export$43bb16f9c6d9e3f7();
135
+ let onKeyDown = (e) => {
136
+ if (e.altKey && e.key === "Tab")
137
+ e.preventDefault();
138
+ if (!ref.current.contains(e.target))
139
+ return;
140
+ const navigateToKey = (key, childFocus) => {
141
+ if (key != null) {
142
+ manager.setFocusedKey(key, childFocus);
143
+ if (e.shiftKey && manager.selectionMode === "multiple")
144
+ manager.extendSelection(key);
145
+ else if (selectOnFocus && !$feb5ffebff200149$export$d3e3bd3e26688c04(e))
146
+ manager.replaceSelection(key);
147
+ }
148
+ };
149
+ switch (e.key) {
150
+ case "ArrowDown":
151
+ if (delegate.getKeyBelow) {
152
+ var _delegate_getFirstKey, _delegate_getFirstKey1;
153
+ e.preventDefault();
154
+ let nextKey = manager.focusedKey != null ? delegate.getKeyBelow(manager.focusedKey) : (_delegate_getFirstKey = delegate.getFirstKey) === null || _delegate_getFirstKey === void 0 ? void 0 : _delegate_getFirstKey.call(delegate);
155
+ if (nextKey == null && shouldFocusWrap)
156
+ nextKey = (_delegate_getFirstKey1 = delegate.getFirstKey) === null || _delegate_getFirstKey1 === void 0 ? void 0 : _delegate_getFirstKey1.call(delegate, manager.focusedKey);
157
+ navigateToKey(nextKey);
158
+ }
159
+ break;
160
+ case "ArrowUp":
161
+ if (delegate.getKeyAbove) {
162
+ var _delegate_getLastKey, _delegate_getLastKey1;
163
+ e.preventDefault();
164
+ let nextKey = manager.focusedKey != null ? delegate.getKeyAbove(manager.focusedKey) : (_delegate_getLastKey = delegate.getLastKey) === null || _delegate_getLastKey === void 0 ? void 0 : _delegate_getLastKey.call(delegate);
165
+ if (nextKey == null && shouldFocusWrap)
166
+ nextKey = (_delegate_getLastKey1 = delegate.getLastKey) === null || _delegate_getLastKey1 === void 0 ? void 0 : _delegate_getLastKey1.call(delegate, manager.focusedKey);
167
+ navigateToKey(nextKey);
168
+ }
169
+ break;
170
+ case "ArrowLeft":
171
+ if (delegate.getKeyLeftOf) {
172
+ var _delegate_getFirstKey2, _delegate_getLastKey2;
173
+ e.preventDefault();
174
+ let nextKey = delegate.getKeyLeftOf(manager.focusedKey);
175
+ if (nextKey == null && shouldFocusWrap)
176
+ 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);
177
+ navigateToKey(nextKey, direction === "rtl" ? "first" : "last");
178
+ }
179
+ break;
180
+ case "ArrowRight":
181
+ if (delegate.getKeyRightOf) {
182
+ var _delegate_getLastKey3, _delegate_getFirstKey3;
183
+ e.preventDefault();
184
+ let nextKey = delegate.getKeyRightOf(manager.focusedKey);
185
+ if (nextKey == null && shouldFocusWrap)
186
+ 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);
187
+ navigateToKey(nextKey, direction === "rtl" ? "last" : "first");
188
+ }
189
+ break;
190
+ case "Home":
191
+ if (delegate.getFirstKey) {
192
+ e.preventDefault();
193
+ let firstKey = delegate.getFirstKey(manager.focusedKey, $feb5ffebff200149$export$16792effe837dba3(e));
194
+ manager.setFocusedKey(firstKey);
195
+ if ($feb5ffebff200149$export$16792effe837dba3(e) && e.shiftKey && manager.selectionMode === "multiple")
196
+ manager.extendSelection(firstKey);
197
+ else if (selectOnFocus)
198
+ manager.replaceSelection(firstKey);
199
+ }
200
+ break;
201
+ case "End":
202
+ if (delegate.getLastKey) {
203
+ e.preventDefault();
204
+ let lastKey = delegate.getLastKey(manager.focusedKey, $feb5ffebff200149$export$16792effe837dba3(e));
205
+ manager.setFocusedKey(lastKey);
206
+ if ($feb5ffebff200149$export$16792effe837dba3(e) && e.shiftKey && manager.selectionMode === "multiple")
207
+ manager.extendSelection(lastKey);
208
+ else if (selectOnFocus)
209
+ manager.replaceSelection(lastKey);
210
+ }
211
+ break;
212
+ case "PageDown":
213
+ if (delegate.getKeyPageBelow) {
214
+ e.preventDefault();
215
+ let nextKey = delegate.getKeyPageBelow(manager.focusedKey);
216
+ navigateToKey(nextKey);
217
+ }
218
+ break;
219
+ case "PageUp":
220
+ if (delegate.getKeyPageAbove) {
221
+ e.preventDefault();
222
+ let nextKey = delegate.getKeyPageAbove(manager.focusedKey);
223
+ navigateToKey(nextKey);
224
+ }
225
+ break;
226
+ case "a":
227
+ if ($feb5ffebff200149$export$16792effe837dba3(e) && manager.selectionMode === "multiple" && disallowSelectAll !== true) {
228
+ e.preventDefault();
229
+ manager.selectAll();
230
+ }
231
+ break;
232
+ case "Escape":
233
+ e.preventDefault();
234
+ if (!disallowEmptySelection)
235
+ manager.clearSelection();
236
+ break;
237
+ case "Tab":
238
+ if (!allowsTabNavigation) {
239
+ if (e.shiftKey)
240
+ ref.current.focus();
241
+ else {
242
+ let walker = $9bf71ea28793e738$export$2d6ec8fc375ceafa(ref.current, {
243
+ tabbable: true
244
+ });
245
+ let next;
246
+ let last;
247
+ do {
248
+ last = walker.lastChild();
249
+ if (last)
250
+ next = last;
251
+ } while (last);
252
+ if (next && !next.contains(document.activeElement))
253
+ $7215afc6de606d6b$export$de79e2c695e052f3(next);
254
+ }
255
+ break;
256
+ }
257
+ }
258
+ };
259
+ let scrollPos = useRef({
260
+ top: 0,
261
+ left: 0
262
+ });
263
+ $e9faafb641e167db$export$90fc3a17d93f704c(scrollRef, "scroll", isVirtualized ? null : () => {
264
+ scrollPos.current = {
265
+ top: scrollRef.current.scrollTop,
266
+ left: scrollRef.current.scrollLeft
267
+ };
268
+ });
269
+ let onFocus = (e) => {
270
+ if (manager.isFocused) {
271
+ if (!e.currentTarget.contains(e.target))
272
+ manager.setFocused(false);
273
+ return;
274
+ }
275
+ if (!e.currentTarget.contains(e.target))
276
+ return;
277
+ manager.setFocused(true);
278
+ if (manager.focusedKey == null) {
279
+ let navigateToFirstKey = (key) => {
280
+ if (key != null) {
281
+ manager.setFocusedKey(key);
282
+ if (selectOnFocus)
283
+ manager.replaceSelection(key);
284
+ }
285
+ };
286
+ let relatedTarget = e.relatedTarget;
287
+ var _manager_lastSelectedKey, _manager_firstSelectedKey;
288
+ if (relatedTarget && e.currentTarget.compareDocumentPosition(relatedTarget) & Node.DOCUMENT_POSITION_FOLLOWING)
289
+ navigateToFirstKey((_manager_lastSelectedKey = manager.lastSelectedKey) !== null && _manager_lastSelectedKey !== void 0 ? _manager_lastSelectedKey : delegate.getLastKey());
290
+ else
291
+ navigateToFirstKey((_manager_firstSelectedKey = manager.firstSelectedKey) !== null && _manager_firstSelectedKey !== void 0 ? _manager_firstSelectedKey : delegate.getFirstKey());
292
+ } else if (!isVirtualized) {
293
+ scrollRef.current.scrollTop = scrollPos.current.top;
294
+ scrollRef.current.scrollLeft = scrollPos.current.left;
295
+ }
296
+ if (!isVirtualized && manager.focusedKey != null) {
297
+ let element = scrollRef.current.querySelector(`[data-key="${manager.focusedKey}"]`);
298
+ if (element) {
299
+ $7215afc6de606d6b$export$de79e2c695e052f3(element);
300
+ let modality = $507fabe10e71c6fb$export$630ff653c5ada6a9();
301
+ if (modality === "keyboard")
302
+ $2f04cbc44ee30ce0$export$c826860796309d1b(element, {
303
+ containingElement: ref.current
304
+ });
305
+ }
306
+ }
307
+ };
308
+ let onBlur = (e) => {
309
+ if (!e.currentTarget.contains(e.relatedTarget))
310
+ manager.setFocused(false);
311
+ };
312
+ const autoFocusRef = useRef(autoFocus);
313
+ useEffect(() => {
314
+ if (autoFocusRef.current) {
315
+ let focusedKey = null;
316
+ if (autoFocus === "first")
317
+ focusedKey = delegate.getFirstKey();
318
+ if (autoFocus === "last")
319
+ focusedKey = delegate.getLastKey();
320
+ let selectedKeys = manager.selectedKeys;
321
+ if (selectedKeys.size)
322
+ focusedKey = selectedKeys.values().next().value;
323
+ manager.setFocused(true);
324
+ manager.setFocusedKey(focusedKey);
325
+ if (focusedKey == null && !shouldUseVirtualFocus)
326
+ $6a99195332edec8b$export$80f3e147d781571c(ref.current);
327
+ }
328
+ autoFocusRef.current = false;
329
+ }, []);
330
+ let lastFocusedKey = useRef(manager.focusedKey);
331
+ useEffect(() => {
332
+ let modality = $507fabe10e71c6fb$export$630ff653c5ada6a9();
333
+ if (manager.isFocused && manager.focusedKey != null && (scrollRef === null || scrollRef === void 0 ? void 0 : scrollRef.current)) {
334
+ let element = scrollRef.current.querySelector(`[data-key="${manager.focusedKey}"]`);
335
+ if (element && modality === "keyboard") {
336
+ if (!isVirtualized)
337
+ $2f04cbc44ee30ce0$export$53a0910f038337bd(scrollRef.current, element);
338
+ $2f04cbc44ee30ce0$export$c826860796309d1b(element, {
339
+ containingElement: ref.current
340
+ });
341
+ }
342
+ }
343
+ if (manager.isFocused && manager.focusedKey == null && lastFocusedKey.current != null)
344
+ $6a99195332edec8b$export$80f3e147d781571c(ref.current);
345
+ lastFocusedKey.current = manager.focusedKey;
346
+ }, [
347
+ isVirtualized,
348
+ scrollRef,
349
+ manager.focusedKey,
350
+ manager.isFocused,
351
+ ref
352
+ ]);
353
+ let handlers = {
354
+ onKeyDown,
355
+ onFocus,
356
+ onBlur,
357
+ onMouseDown(e) {
358
+ if (scrollRef.current === e.target)
359
+ e.preventDefault();
360
+ }
361
+ };
362
+ let { typeSelectProps } = $fb3050f43d946246$export$e32c88dfddc6e1d8({
363
+ keyboardDelegate: delegate,
364
+ selectionManager: manager
365
+ });
366
+ if (!disallowTypeAhead)
367
+ handlers = $3ef42575df84b30b$export$9d1611c77c2fe928(typeSelectProps, handlers);
368
+ let tabIndex;
369
+ if (!shouldUseVirtualFocus)
370
+ tabIndex = manager.focusedKey == null ? 0 : -1;
371
+ return {
372
+ collectionProps: __spreadProps(__spreadValues({}, handlers), {
373
+ tabIndex
374
+ })
375
+ };
376
+ }
377
+ function $880e95eb8b93ba9a$export$ecf600387e221c37(options) {
378
+ let { selectionManager: manager, key, ref, shouldSelectOnPressUp, shouldUseVirtualFocus, focus, isDisabled, onAction, allowsDifferentPressOrigin } = options;
379
+ let onSelect = (e) => {
380
+ if (e.pointerType === "keyboard" && $feb5ffebff200149$export$d3e3bd3e26688c04(e))
381
+ manager.toggleSelection(key);
382
+ else {
383
+ if (manager.selectionMode === "none")
384
+ return;
385
+ if (manager.selectionMode === "single") {
386
+ if (manager.isSelected(key) && !manager.disallowEmptySelection)
387
+ manager.toggleSelection(key);
388
+ else
389
+ manager.replaceSelection(key);
390
+ } else if (e && e.shiftKey)
391
+ manager.extendSelection(key);
392
+ else if (manager.selectionBehavior === "toggle" || e && ($feb5ffebff200149$export$16792effe837dba3(e) || e.pointerType === "touch" || e.pointerType === "virtual"))
393
+ manager.toggleSelection(key);
394
+ else
395
+ manager.replaceSelection(key);
396
+ }
397
+ };
398
+ useEffect(() => {
399
+ let isFocused = key === manager.focusedKey;
400
+ if (isFocused && manager.isFocused && !shouldUseVirtualFocus) {
401
+ if (focus)
402
+ focus();
403
+ else if (document.activeElement !== ref.current)
404
+ $6a99195332edec8b$export$80f3e147d781571c(ref.current);
405
+ }
406
+ }, [
407
+ ref,
408
+ key,
409
+ manager.focusedKey,
410
+ manager.childFocusStrategy,
411
+ manager.isFocused,
412
+ shouldUseVirtualFocus
413
+ ]);
414
+ isDisabled = isDisabled || manager.isDisabled(key);
415
+ let itemProps = {};
416
+ if (!shouldUseVirtualFocus && !isDisabled)
417
+ itemProps = {
418
+ tabIndex: key === manager.focusedKey ? 0 : -1,
419
+ onFocus(e) {
420
+ if (e.target === ref.current)
421
+ manager.setFocusedKey(key);
422
+ }
423
+ };
424
+ else if (isDisabled)
425
+ itemProps.onMouseDown = (e) => {
426
+ e.preventDefault();
427
+ };
428
+ let allowsSelection = !isDisabled && manager.canSelectItem(key);
429
+ let allowsActions = onAction && !isDisabled;
430
+ let hasPrimaryAction = allowsActions && (manager.selectionBehavior === "replace" ? !allowsSelection : manager.isEmpty);
431
+ let hasSecondaryAction = allowsActions && allowsSelection && manager.selectionBehavior === "replace";
432
+ let hasAction = hasPrimaryAction || hasSecondaryAction;
433
+ let modality = useRef(null);
434
+ let longPressEnabled = hasAction && allowsSelection;
435
+ let longPressEnabledOnPressStart = useRef(false);
436
+ let hadPrimaryActionOnPressStart = useRef(false);
437
+ let itemPressProps = {};
438
+ if (shouldSelectOnPressUp) {
439
+ itemPressProps.onPressStart = (e) => {
440
+ modality.current = e.pointerType;
441
+ longPressEnabledOnPressStart.current = longPressEnabled;
442
+ if (e.pointerType === "keyboard" && (!hasAction || $880e95eb8b93ba9a$var$isSelectionKey()))
443
+ onSelect(e);
444
+ };
445
+ if (!allowsDifferentPressOrigin)
446
+ itemPressProps.onPress = (e) => {
447
+ if (hasPrimaryAction || hasSecondaryAction && e.pointerType !== "mouse") {
448
+ if (e.pointerType === "keyboard" && !$880e95eb8b93ba9a$var$isActionKey())
449
+ return;
450
+ onAction();
451
+ } else if (e.pointerType !== "keyboard")
452
+ onSelect(e);
453
+ };
454
+ else {
455
+ itemPressProps.onPressUp = (e) => {
456
+ if (e.pointerType !== "keyboard")
457
+ onSelect(e);
458
+ };
459
+ itemPressProps.onPress = hasPrimaryAction ? () => onAction() : null;
460
+ }
461
+ } else {
462
+ itemPressProps.onPressStart = (e) => {
463
+ modality.current = e.pointerType;
464
+ longPressEnabledOnPressStart.current = longPressEnabled;
465
+ hadPrimaryActionOnPressStart.current = hasPrimaryAction;
466
+ if (e.pointerType === "mouse" && !hasPrimaryAction || e.pointerType === "keyboard" && (!onAction || $880e95eb8b93ba9a$var$isSelectionKey()))
467
+ onSelect(e);
468
+ };
469
+ itemPressProps.onPress = (e) => {
470
+ if (e.pointerType === "touch" || e.pointerType === "pen" || e.pointerType === "virtual" || e.pointerType === "keyboard" && hasAction && $880e95eb8b93ba9a$var$isActionKey() || e.pointerType === "mouse" && hadPrimaryActionOnPressStart.current) {
471
+ if (hasAction)
472
+ onAction();
473
+ else
474
+ onSelect(e);
475
+ }
476
+ };
477
+ }
478
+ itemProps["data-key"] = key;
479
+ itemPressProps.preventFocusOnPress = shouldUseVirtualFocus;
480
+ let { pressProps, isPressed } = $f6c31cce2adf654f$export$45712eceda6fad21(itemPressProps);
481
+ let onDoubleClick = hasSecondaryAction ? (e) => {
482
+ if (modality.current === "mouse") {
483
+ e.stopPropagation();
484
+ e.preventDefault();
485
+ onAction();
486
+ }
487
+ } : void 0;
488
+ let { longPressProps } = $8a26561d2877236e$export$c24ed0104d07eab9({
489
+ isDisabled: !longPressEnabled,
490
+ onLongPress(e) {
491
+ if (e.pointerType === "touch") {
492
+ onSelect(e);
493
+ manager.setSelectionBehavior("toggle");
494
+ }
495
+ }
496
+ });
497
+ let onDragStartCapture = (e) => {
498
+ if (modality.current === "touch" && longPressEnabledOnPressStart.current)
499
+ e.preventDefault();
500
+ };
501
+ return {
502
+ itemProps: $3ef42575df84b30b$export$9d1611c77c2fe928(itemProps, allowsSelection || hasPrimaryAction ? pressProps : {}, longPressEnabled ? longPressProps : {}, {
503
+ onDoubleClick,
504
+ onDragStartCapture
505
+ }),
506
+ isPressed,
507
+ isSelected: manager.isSelected(key),
508
+ isFocused: manager.isFocused && manager.focusedKey === key,
509
+ isDisabled,
510
+ allowsSelection,
511
+ hasAction
512
+ };
513
+ }
514
+ function $880e95eb8b93ba9a$var$isActionKey() {
515
+ let event = window.event;
516
+ return (event === null || event === void 0 ? void 0 : event.key) === "Enter";
517
+ }
518
+ function $880e95eb8b93ba9a$var$isSelectionKey() {
519
+ let event = window.event;
520
+ return (event === null || event === void 0 ? void 0 : event.key) === " " || (event === null || event === void 0 ? void 0 : event.code) === "Space";
521
+ }
522
+ class $2a25aae57d74318e$export$a05409b8bb224a5a {
523
+ getNextKey(key) {
524
+ key = this.collection.getKeyAfter(key);
525
+ while (key != null) {
526
+ let item = this.collection.getItem(key);
527
+ if (item.type === "item" && !this.disabledKeys.has(key))
528
+ return key;
529
+ key = this.collection.getKeyAfter(key);
530
+ }
531
+ return null;
532
+ }
533
+ getPreviousKey(key) {
534
+ key = this.collection.getKeyBefore(key);
535
+ while (key != null) {
536
+ let item = this.collection.getItem(key);
537
+ if (item.type === "item" && !this.disabledKeys.has(key))
538
+ return key;
539
+ key = this.collection.getKeyBefore(key);
540
+ }
541
+ return null;
542
+ }
543
+ findKey(key, nextKey, shouldSkip) {
544
+ let item = this.getItem(key);
545
+ if (!item)
546
+ return null;
547
+ let prevRect = item.getBoundingClientRect();
548
+ do {
549
+ key = nextKey(key);
550
+ item = this.getItem(key);
551
+ } while (item && shouldSkip(prevRect, item.getBoundingClientRect()));
552
+ return key;
553
+ }
554
+ isSameRow(prevRect, itemRect) {
555
+ return prevRect.top === itemRect.top || prevRect.left !== itemRect.left;
556
+ }
557
+ isSameColumn(prevRect, itemRect) {
558
+ return prevRect.left === itemRect.left || prevRect.top !== itemRect.top;
559
+ }
560
+ getKeyBelow(key) {
561
+ if (this.layout === "grid" && this.orientation === "vertical")
562
+ return this.findKey(key, (key2) => this.getNextKey(key2), this.isSameRow);
563
+ else
564
+ return this.getNextKey(key);
565
+ }
566
+ getKeyAbove(key) {
567
+ if (this.layout === "grid" && this.orientation === "vertical")
568
+ return this.findKey(key, (key2) => this.getPreviousKey(key2), this.isSameRow);
569
+ else
570
+ return this.getPreviousKey(key);
571
+ }
572
+ getNextColumn(key, right) {
573
+ return right ? this.getPreviousKey(key) : this.getNextKey(key);
574
+ }
575
+ getKeyRightOf(key) {
576
+ if (this.layout === "grid") {
577
+ if (this.orientation === "vertical")
578
+ return this.getNextColumn(key, this.direction === "rtl");
579
+ else
580
+ return this.findKey(key, (key2) => this.getNextColumn(key2, this.direction === "rtl"), this.isSameColumn);
581
+ } else if (this.orientation === "horizontal")
582
+ return this.getNextColumn(key, this.direction === "rtl");
583
+ return null;
584
+ }
585
+ getKeyLeftOf(key) {
586
+ if (this.layout === "grid") {
587
+ if (this.orientation === "vertical")
588
+ return this.getNextColumn(key, this.direction === "ltr");
589
+ else
590
+ return this.findKey(key, (key2) => this.getNextColumn(key2, this.direction === "ltr"), this.isSameColumn);
591
+ } else if (this.orientation === "horizontal")
592
+ return this.getNextColumn(key, this.direction === "ltr");
593
+ return null;
594
+ }
595
+ getFirstKey() {
596
+ let key = this.collection.getFirstKey();
597
+ while (key != null) {
598
+ let item = this.collection.getItem(key);
599
+ if (item.type === "item" && !this.disabledKeys.has(key))
600
+ return key;
601
+ key = this.collection.getKeyAfter(key);
602
+ }
603
+ return null;
604
+ }
605
+ getLastKey() {
606
+ let key = this.collection.getLastKey();
607
+ while (key != null) {
608
+ let item = this.collection.getItem(key);
609
+ if (item.type === "item" && !this.disabledKeys.has(key))
610
+ return key;
611
+ key = this.collection.getKeyBefore(key);
612
+ }
613
+ return null;
614
+ }
615
+ getItem(key) {
616
+ return this.ref.current.querySelector(`[data-key="${key}"]`);
617
+ }
618
+ getKeyPageAbove(key) {
619
+ let menu = this.ref.current;
620
+ let item = this.getItem(key);
621
+ if (!item)
622
+ return null;
623
+ if (!$62d8ded9296f3872$export$2bb74740c4e19def(menu))
624
+ return this.getFirstKey();
625
+ let containerRect = menu.getBoundingClientRect();
626
+ let itemRect = item.getBoundingClientRect();
627
+ if (this.orientation === "horizontal") {
628
+ let containerX = containerRect.x - menu.scrollLeft;
629
+ let pageX = Math.max(0, itemRect.x - containerX + itemRect.width - containerRect.width);
630
+ while (item && itemRect.x - containerX > pageX) {
631
+ key = this.getKeyAbove(key);
632
+ item = key == null ? null : this.getItem(key);
633
+ itemRect = item === null || item === void 0 ? void 0 : item.getBoundingClientRect();
634
+ }
635
+ } else {
636
+ let containerY = containerRect.y - menu.scrollTop;
637
+ let pageY = Math.max(0, itemRect.y - containerY + itemRect.height - containerRect.height);
638
+ while (item && itemRect.y - containerY > pageY) {
639
+ key = this.getKeyAbove(key);
640
+ item = key == null ? null : this.getItem(key);
641
+ itemRect = item === null || item === void 0 ? void 0 : item.getBoundingClientRect();
642
+ }
643
+ }
644
+ return key !== null && key !== void 0 ? key : this.getFirstKey();
645
+ }
646
+ getKeyPageBelow(key) {
647
+ let menu = this.ref.current;
648
+ let item = this.getItem(key);
649
+ if (!item)
650
+ return null;
651
+ if (!$62d8ded9296f3872$export$2bb74740c4e19def(menu))
652
+ return this.getLastKey();
653
+ let containerRect = menu.getBoundingClientRect();
654
+ let itemRect = item.getBoundingClientRect();
655
+ if (this.orientation === "horizontal") {
656
+ let containerX = containerRect.x - menu.scrollLeft;
657
+ let pageX = Math.min(menu.scrollWidth, itemRect.x - containerX - itemRect.width + containerRect.width);
658
+ while (item && itemRect.x - containerX < pageX) {
659
+ key = this.getKeyBelow(key);
660
+ item = key == null ? null : this.getItem(key);
661
+ itemRect = item === null || item === void 0 ? void 0 : item.getBoundingClientRect();
662
+ }
663
+ } else {
664
+ let containerY = containerRect.y - menu.scrollTop;
665
+ let pageY = Math.min(menu.scrollHeight, itemRect.y - containerY - itemRect.height + containerRect.height);
666
+ while (item && itemRect.y - containerY < pageY) {
667
+ key = this.getKeyBelow(key);
668
+ item = key == null ? null : this.getItem(key);
669
+ itemRect = item === null || item === void 0 ? void 0 : item.getBoundingClientRect();
670
+ }
671
+ }
672
+ return key !== null && key !== void 0 ? key : this.getLastKey();
673
+ }
674
+ getKeyForSearch(search, fromKey) {
675
+ if (!this.collator)
676
+ return null;
677
+ let collection = this.collection;
678
+ let key = fromKey || this.getFirstKey();
679
+ while (key != null) {
680
+ let item = collection.getItem(key);
681
+ let substring = item.textValue.slice(0, search.length);
682
+ if (item.textValue && this.collator.compare(substring, search) === 0)
683
+ return key;
684
+ key = this.getKeyBelow(key);
685
+ }
686
+ return null;
687
+ }
688
+ constructor(...args) {
689
+ if (args.length === 1) {
690
+ let opts = args[0];
691
+ this.collection = opts.collection;
692
+ this.ref = opts.ref;
693
+ this.disabledKeys = opts.disabledKeys || /* @__PURE__ */ new Set();
694
+ this.orientation = opts.orientation;
695
+ this.direction = opts.direction;
696
+ this.layout = opts.layout || "stack";
697
+ } else {
698
+ this.collection = args[0];
699
+ this.disabledKeys = args[1];
700
+ this.ref = args[2];
701
+ this.collator = args[3];
702
+ this.layout = "stack";
703
+ this.orientation = "vertical";
704
+ }
705
+ if (this.layout === "stack" && this.orientation === "vertical") {
706
+ this.getKeyLeftOf = void 0;
707
+ this.getKeyRightOf = void 0;
708
+ }
709
+ }
710
+ }
711
+ function $982254629710d113$export$b95089534ab7c1fd(props) {
712
+ let { selectionManager, collection, disabledKeys, ref, keyboardDelegate, autoFocus, shouldFocusWrap, isVirtualized, disallowEmptySelection, selectOnFocus = selectionManager.selectionBehavior === "replace", disallowTypeAhead, shouldUseVirtualFocus, allowsTabNavigation } = props;
713
+ let collator = $325a3faab7a68acd$export$a16aca283550c30d({
714
+ usage: "search",
715
+ sensitivity: "base"
716
+ });
717
+ let disabledBehavior = selectionManager.disabledBehavior;
718
+ let delegate = useMemo(() => keyboardDelegate || new $2a25aae57d74318e$export$a05409b8bb224a5a(collection, disabledBehavior === "selection" ? /* @__PURE__ */ new Set() : disabledKeys, ref, collator), [
719
+ keyboardDelegate,
720
+ collection,
721
+ disabledKeys,
722
+ ref,
723
+ collator,
724
+ disabledBehavior
725
+ ]);
726
+ let { collectionProps } = $ae20dd8cbca75726$export$d6daf82dcd84e87c({
727
+ ref,
728
+ selectionManager,
729
+ keyboardDelegate: delegate,
730
+ autoFocus,
731
+ shouldFocusWrap,
732
+ disallowEmptySelection,
733
+ selectOnFocus,
734
+ disallowTypeAhead,
735
+ shouldUseVirtualFocus,
736
+ allowsTabNavigation,
737
+ isVirtualized,
738
+ scrollRef: ref
739
+ });
740
+ return {
741
+ listProps: collectionProps
742
+ };
743
+ }
744
+ function $c1d7fb2ec91bae71$var$Item(props) {
745
+ return null;
746
+ }
747
+ $c1d7fb2ec91bae71$var$Item.getCollectionNode = function* getCollectionNode(props, context) {
748
+ let { childItems, title, children } = props;
749
+ let rendered = props.title || props.children;
750
+ let textValue = props.textValue || (typeof rendered === "string" ? rendered : "") || props["aria-label"] || "";
751
+ if (!textValue && !(context === null || context === void 0 ? void 0 : context.suppressTextValueWarning))
752
+ console.warn("<Item> with non-plain text contents is unsupported by type to select for accessibility. Please add a `textValue` prop.");
753
+ yield {
754
+ type: "item",
755
+ props,
756
+ rendered,
757
+ textValue,
758
+ "aria-label": props["aria-label"],
759
+ hasChildNodes: $c1d7fb2ec91bae71$var$hasChildItems(props),
760
+ *childNodes() {
761
+ if (childItems)
762
+ for (let child of childItems)
763
+ yield {
764
+ type: "item",
765
+ value: child
766
+ };
767
+ else if (title) {
768
+ let items = [];
769
+ React__default.Children.forEach(children, (child) => {
770
+ items.push({
771
+ type: "item",
772
+ element: child
773
+ });
774
+ });
775
+ yield* __yieldStar(items);
776
+ }
777
+ }
778
+ };
779
+ };
780
+ function $c1d7fb2ec91bae71$var$hasChildItems(props) {
781
+ if (props.hasChildItems != null)
782
+ return props.hasChildItems;
783
+ if (props.childItems)
784
+ return true;
785
+ if (props.title && React__default.Children.count(props.children) > 0)
786
+ return true;
787
+ return false;
788
+ }
789
+ let $c1d7fb2ec91bae71$export$6d08773d2e66f8f2 = $c1d7fb2ec91bae71$var$Item;
790
+ function $9fc4852771d079eb$var$Section(props) {
791
+ return null;
792
+ }
793
+ $9fc4852771d079eb$var$Section.getCollectionNode = function* getCollectionNode2(props) {
794
+ let { children, title, items } = props;
795
+ yield {
796
+ type: "section",
797
+ props,
798
+ hasChildNodes: true,
799
+ rendered: title,
800
+ "aria-label": props["aria-label"],
801
+ *childNodes() {
802
+ if (typeof children === "function") {
803
+ if (!items)
804
+ throw new Error("props.children was a function but props.items is missing");
805
+ for (let item of items)
806
+ yield {
807
+ type: "item",
808
+ value: item,
809
+ renderer: children
810
+ };
811
+ } else {
812
+ let items2 = [];
813
+ React__default.Children.forEach(children, (child) => {
814
+ items2.push({
815
+ type: "item",
816
+ element: child
817
+ });
818
+ });
819
+ yield* __yieldStar(items2);
820
+ }
821
+ }
822
+ };
823
+ };
824
+ let $9fc4852771d079eb$export$6e2c8f0811a474ce = $9fc4852771d079eb$var$Section;
825
+ class $eb2240fc39a57fa5$export$bf788dd355e3a401 {
826
+ build(props, context) {
827
+ this.context = context;
828
+ return $eb2240fc39a57fa5$var$iterable(() => this.iterateCollection(props));
829
+ }
830
+ *iterateCollection(props) {
831
+ let { children, items } = props;
832
+ if (typeof children === "function") {
833
+ if (!items)
834
+ throw new Error("props.children was a function but props.items is missing");
835
+ for (let item of props.items)
836
+ yield* __yieldStar(this.getFullNode({
837
+ value: item
838
+ }, {
839
+ renderer: children
840
+ }));
841
+ } else {
842
+ let items2 = [];
843
+ React__default.Children.forEach(children, (child) => {
844
+ items2.push(child);
845
+ });
846
+ let index = 0;
847
+ for (let item of items2) {
848
+ let nodes = this.getFullNode({
849
+ element: item,
850
+ index
851
+ }, {});
852
+ for (let node of nodes) {
853
+ index++;
854
+ yield node;
855
+ }
856
+ }
857
+ }
858
+ }
859
+ getKey(item, partialNode, state, parentKey) {
860
+ if (item.key != null)
861
+ return item.key;
862
+ if (partialNode.type === "cell" && partialNode.key != null)
863
+ return `${parentKey}${partialNode.key}`;
864
+ let v = partialNode.value;
865
+ if (v != null) {
866
+ var _v_key;
867
+ let key = (_v_key = v.key) !== null && _v_key !== void 0 ? _v_key : v.id;
868
+ if (key == null)
869
+ throw new Error("No key found for item");
870
+ return key;
871
+ }
872
+ return parentKey ? `${parentKey}.${partialNode.index}` : `$.${partialNode.index}`;
873
+ }
874
+ getChildState(state, partialNode) {
875
+ return {
876
+ renderer: partialNode.renderer || state.renderer
877
+ };
878
+ }
879
+ *getFullNode(partialNode, state, parentKey, parentNode) {
880
+ let element = partialNode.element;
881
+ if (!element && partialNode.value && state && state.renderer) {
882
+ let cached = this.cache.get(partialNode.value);
883
+ if (cached && (!cached.shouldInvalidate || !cached.shouldInvalidate(this.context))) {
884
+ cached.index = partialNode.index;
885
+ cached.parentKey = parentNode ? parentNode.key : null;
886
+ yield cached;
887
+ return;
888
+ }
889
+ element = state.renderer(partialNode.value);
890
+ }
891
+ if (React__default.isValidElement(element)) {
892
+ let type = element.type;
893
+ if (typeof type !== "function" && typeof type.getCollectionNode !== "function") {
894
+ let name = typeof element.type === "function" ? element.type.name : element.type;
895
+ throw new Error(`Unknown element <${name}> in collection.`);
896
+ }
897
+ let childNodes = type.getCollectionNode(element.props, this.context);
898
+ let index = partialNode.index;
899
+ let result = childNodes.next();
900
+ while (!result.done && result.value) {
901
+ let childNode = result.value;
902
+ partialNode.index = index;
903
+ let nodeKey = childNode.key;
904
+ if (!nodeKey)
905
+ nodeKey = childNode.element ? null : this.getKey(element, partialNode, state, parentKey);
906
+ let nodes = this.getFullNode(__spreadProps(__spreadValues({}, childNode), {
907
+ key: nodeKey,
908
+ index,
909
+ wrapper: $eb2240fc39a57fa5$var$compose(partialNode.wrapper, childNode.wrapper)
910
+ }), this.getChildState(state, childNode), parentKey ? `${parentKey}${element.key}` : element.key, parentNode);
911
+ let children = [
912
+ ...nodes
913
+ ];
914
+ for (let node2 of children) {
915
+ node2.value = childNode.value || partialNode.value;
916
+ if (node2.value)
917
+ this.cache.set(node2.value, node2);
918
+ if (partialNode.type && node2.type !== partialNode.type)
919
+ throw new Error(`Unsupported type <${$eb2240fc39a57fa5$var$capitalize(node2.type)}> in <${$eb2240fc39a57fa5$var$capitalize(parentNode.type)}>. Only <${$eb2240fc39a57fa5$var$capitalize(partialNode.type)}> is supported.`);
920
+ index++;
921
+ yield node2;
922
+ }
923
+ result = childNodes.next(children);
924
+ }
925
+ return;
926
+ }
927
+ if (partialNode.key == null)
928
+ return;
929
+ let builder = this;
930
+ let node = {
931
+ type: partialNode.type,
932
+ props: partialNode.props,
933
+ key: partialNode.key,
934
+ parentKey: parentNode ? parentNode.key : null,
935
+ value: partialNode.value,
936
+ level: parentNode ? parentNode.level + 1 : 0,
937
+ index: partialNode.index,
938
+ rendered: partialNode.rendered,
939
+ textValue: partialNode.textValue,
940
+ "aria-label": partialNode["aria-label"],
941
+ wrapper: partialNode.wrapper,
942
+ shouldInvalidate: partialNode.shouldInvalidate,
943
+ hasChildNodes: partialNode.hasChildNodes,
944
+ childNodes: $eb2240fc39a57fa5$var$iterable(function* () {
945
+ if (!partialNode.hasChildNodes)
946
+ return;
947
+ let index = 0;
948
+ for (let child of partialNode.childNodes()) {
949
+ if (child.key != null)
950
+ child.key = `${node.key}${child.key}`;
951
+ child.index = index;
952
+ let nodes = builder.getFullNode(child, builder.getChildState(state, child), node.key, node);
953
+ for (let node2 of nodes) {
954
+ index++;
955
+ yield node2;
956
+ }
957
+ }
958
+ })
959
+ };
960
+ yield node;
961
+ }
962
+ constructor() {
963
+ this.cache = /* @__PURE__ */ new WeakMap();
964
+ }
965
+ }
966
+ function $eb2240fc39a57fa5$var$iterable(iterator) {
967
+ let cache = [];
968
+ let iterable = null;
969
+ return {
970
+ *[Symbol.iterator]() {
971
+ for (let item of cache)
972
+ yield item;
973
+ if (!iterable)
974
+ iterable = iterator();
975
+ for (let item of iterable) {
976
+ cache.push(item);
977
+ yield item;
978
+ }
979
+ }
980
+ };
981
+ }
982
+ function $eb2240fc39a57fa5$var$compose(outer, inner) {
983
+ if (outer && inner)
984
+ return (element) => outer(inner(element));
985
+ if (outer)
986
+ return outer;
987
+ if (inner)
988
+ return inner;
989
+ }
990
+ function $eb2240fc39a57fa5$var$capitalize(str) {
991
+ return str[0].toUpperCase() + str.slice(1);
992
+ }
993
+ function $7613b1592d41b092$export$6cd28814d92fa9c9(props, factory, context) {
994
+ let builder = useMemo(() => new $eb2240fc39a57fa5$export$bf788dd355e3a401(), []);
995
+ let { children, items, collection } = props;
996
+ let result = useMemo(() => {
997
+ if (collection)
998
+ return collection;
999
+ let nodes = builder.build({
1000
+ children,
1001
+ items
1002
+ }, context);
1003
+ return factory(nodes);
1004
+ }, [
1005
+ builder,
1006
+ children,
1007
+ items,
1008
+ collection,
1009
+ context,
1010
+ factory
1011
+ ]);
1012
+ return result;
1013
+ }
1014
+ function $c5a24bc478652b5f$export$1005530eda016c13(node, collection) {
1015
+ if (typeof collection.getChildren === "function")
1016
+ return collection.getChildren(node.key);
1017
+ return node.childNodes;
1018
+ }
1019
+ function $c5a24bc478652b5f$export$fbdeaa6a76694f71(iterable) {
1020
+ return $c5a24bc478652b5f$export$5f3398f8733f90e2(iterable, 0);
1021
+ }
1022
+ function $c5a24bc478652b5f$export$5f3398f8733f90e2(iterable, index) {
1023
+ if (index < 0)
1024
+ return void 0;
1025
+ let i = 0;
1026
+ for (let item of iterable) {
1027
+ if (i === index)
1028
+ return item;
1029
+ i++;
1030
+ }
1031
+ }
1032
+ function $c5a24bc478652b5f$export$8c434b3a7a4dad6(collection, a, b) {
1033
+ if (a.parentKey === b.parentKey)
1034
+ return a.index - b.index;
1035
+ let aAncestors = $c5a24bc478652b5f$var$getAncestors(collection, a);
1036
+ let bAncestors = $c5a24bc478652b5f$var$getAncestors(collection, b);
1037
+ let firstNonMatchingAncestor = aAncestors.slice(0, bAncestors.length).findIndex((a2, i) => a2 !== bAncestors[i]);
1038
+ if (firstNonMatchingAncestor !== -1) {
1039
+ a = aAncestors[firstNonMatchingAncestor];
1040
+ b = bAncestors[firstNonMatchingAncestor];
1041
+ return a.index - b.index;
1042
+ }
1043
+ return -1;
1044
+ }
1045
+ function $c5a24bc478652b5f$var$getAncestors(collection, node) {
1046
+ let parents = [];
1047
+ while ((node === null || node === void 0 ? void 0 : node.parentKey) != null) {
1048
+ node = collection.getItem(node.parentKey);
1049
+ parents.unshift(node);
1050
+ }
1051
+ return parents;
1052
+ }
1053
+ const $453cc9f0df89c0a5$var$cache = /* @__PURE__ */ new WeakMap();
1054
+ function $453cc9f0df89c0a5$export$77d5aafae4e095b2(collection) {
1055
+ let count = $453cc9f0df89c0a5$var$cache.get(collection);
1056
+ if (count != null)
1057
+ return count;
1058
+ count = 0;
1059
+ let countItems = (items) => {
1060
+ for (let item of items)
1061
+ if (item.type === "section")
1062
+ countItems($c5a24bc478652b5f$export$1005530eda016c13(item, collection));
1063
+ else
1064
+ count++;
1065
+ };
1066
+ countItems(collection);
1067
+ $453cc9f0df89c0a5$var$cache.set(collection, count);
1068
+ return count;
1069
+ }
1070
+ function $parcel$interopDefault(a) {
1071
+ return a && a.__esModule ? a.default : a;
1072
+ }
1073
+ var $2cbb7ca666678a14$exports = {};
1074
+ var $c0398ad35c3639b7$exports = {};
1075
+ $c0398ad35c3639b7$exports = {
1076
+ "longPressMessage": `اضغط مطولاً أو اضغط على Alt + السهم لأسفل لفتح القائمة`
1077
+ };
1078
+ var $7af657c4165927c3$exports = {};
1079
+ $7af657c4165927c3$exports = {
1080
+ "longPressMessage": `Натиснете продължително или натиснете Alt+ стрелка надолу, за да отворите менюто`
1081
+ };
1082
+ var $d95d4da6d531ab81$exports = {};
1083
+ $d95d4da6d531ab81$exports = {
1084
+ "longPressMessage": `Dlouhým stiskem nebo stisknutím kláves Alt + šipka dolů otevřete nabídku`
1085
+ };
1086
+ var $24ebda9c775dca17$exports = {};
1087
+ $24ebda9c775dca17$exports = {
1088
+ "longPressMessage": `Langt tryk eller tryk på Alt + pil ned for at åbne menuen`
1089
+ };
1090
+ var $743e0dfca6cab1e9$exports = {};
1091
+ $743e0dfca6cab1e9$exports = {
1092
+ "longPressMessage": `Drücken Sie lange oder drücken Sie Alt + Nach-unten, um das Menü zu öffnen`
1093
+ };
1094
+ var $a2f41026e05f1c84$exports = {};
1095
+ $a2f41026e05f1c84$exports = {
1096
+ "longPressMessage": `Πιέστε παρατεταμένα ή πατήστε Alt + κάτω βέλος για να ανοίξετε το μενού`
1097
+ };
1098
+ var $43b800e97c901737$exports = {};
1099
+ $43b800e97c901737$exports = {
1100
+ "longPressMessage": `Long press or press Alt + ArrowDown to open menu`
1101
+ };
1102
+ var $442f5f6ac211e29f$exports = {};
1103
+ $442f5f6ac211e29f$exports = {
1104
+ "longPressMessage": `Mantenga pulsado o pulse Alt + flecha abajo para abrir el menú`
1105
+ };
1106
+ var $dff280acfeb2d8ac$exports = {};
1107
+ $dff280acfeb2d8ac$exports = {
1108
+ "longPressMessage": `Menüü avamiseks vajutage pikalt või vajutage klahve Alt + allanool`
1109
+ };
1110
+ var $51608325613944d7$exports = {};
1111
+ $51608325613944d7$exports = {
1112
+ "longPressMessage": `Avaa valikko painamalla pohjassa tai näppäinyhdistelmällä Alt + Alanuoli`
1113
+ };
1114
+ var $c4a1b1eabeaa87be$exports = {};
1115
+ $c4a1b1eabeaa87be$exports = {
1116
+ "longPressMessage": `Appuyez de manière prolongée ou appuyez sur Alt + Flèche vers le bas pour ouvrir le menu.`
1117
+ };
1118
+ var $8c74815cdee18d1b$exports = {};
1119
+ $8c74815cdee18d1b$exports = {
1120
+ "longPressMessage": `לחץ לחיצה ארוכה או הקש Alt + ArrowDown כדי לפתוח את התפריט`
1121
+ };
1122
+ var $fd0e9ef6a7fe0ec9$exports = {};
1123
+ $fd0e9ef6a7fe0ec9$exports = {
1124
+ "longPressMessage": `Dugo pritisnite ili pritisnite Alt + strelicu prema dolje za otvaranje izbornika`
1125
+ };
1126
+ var $a89a74a39eba465a$exports = {};
1127
+ $a89a74a39eba465a$exports = {
1128
+ "longPressMessage": `Nyomja meg hosszan, vagy nyomja meg az Alt + lefele nyíl gombot a menü megnyitásához`
1129
+ };
1130
+ var $edc7c66594a0ae8a$exports = {};
1131
+ $edc7c66594a0ae8a$exports = {
1132
+ "longPressMessage": `Premere a lungo o premere Alt + Freccia giù per aprire il menu`
1133
+ };
1134
+ var $f1ab51510712db52$exports = {};
1135
+ $f1ab51510712db52$exports = {
1136
+ "longPressMessage": `長押しまたは Alt+下矢印キーでメニューを開く`
1137
+ };
1138
+ var $f9b672d9b82fa3d6$exports = {};
1139
+ $f9b672d9b82fa3d6$exports = {
1140
+ "longPressMessage": `길게 누르거나 Alt + 아래쪽 화살표를 눌러 메뉴 열기`
1141
+ };
1142
+ var $a385f3910feda499$exports = {};
1143
+ $a385f3910feda499$exports = {
1144
+ "longPressMessage": `Norėdami atidaryti meniu, nuspaudę palaikykite arba paspauskite „Alt + ArrowDown“.`
1145
+ };
1146
+ var $4f1bde932c441789$exports = {};
1147
+ $4f1bde932c441789$exports = {
1148
+ "longPressMessage": `Lai atvērtu izvēlni, turiet nospiestu vai nospiediet taustiņu kombināciju Alt + lejupvērstā bultiņa`
1149
+ };
1150
+ var $914a51a8a594d5be$exports = {};
1151
+ $914a51a8a594d5be$exports = {
1152
+ "longPressMessage": `Langt trykk eller trykk Alt + PilNed for å åpne menyen`
1153
+ };
1154
+ var $89aaf803103bb500$exports = {};
1155
+ $89aaf803103bb500$exports = {
1156
+ "longPressMessage": `Druk lang op Alt + pijl-omlaag of druk op Alt om het menu te openen`
1157
+ };
1158
+ var $c685891476dbaaca$exports = {};
1159
+ $c685891476dbaaca$exports = {
1160
+ "longPressMessage": `Naciśnij i przytrzymaj lub naciśnij klawisze Alt + Strzałka w dół, aby otworzyć menu`
1161
+ };
1162
+ var $885879b9b10c2959$exports = {};
1163
+ $885879b9b10c2959$exports = {
1164
+ "longPressMessage": `Pressione e segure ou pressione Alt + Seta para baixo para abrir o menu`
1165
+ };
1166
+ var $6b39616688a51692$exports = {};
1167
+ $6b39616688a51692$exports = {
1168
+ "longPressMessage": `Prima continuamente ou prima Alt + Seta Para Baixo para abrir o menu`
1169
+ };
1170
+ var $f26362aed63f47e2$exports = {};
1171
+ $f26362aed63f47e2$exports = {
1172
+ "longPressMessage": `Apăsați lung sau apăsați pe Alt + săgeată în jos pentru a deschide meniul`
1173
+ };
1174
+ var $06cbade644558bf0$exports = {};
1175
+ $06cbade644558bf0$exports = {
1176
+ "longPressMessage": `Нажмите и удерживайте или нажмите Alt + Стрелка вниз, чтобы открыть меню`
1177
+ };
1178
+ var $0a391ff68f9d59b1$exports = {};
1179
+ $0a391ff68f9d59b1$exports = {
1180
+ "longPressMessage": `Ponuku otvoríte dlhým stlačením alebo stlačením klávesu Alt + klávesu so šípkou nadol`
1181
+ };
1182
+ var $8193cf0e649c7928$exports = {};
1183
+ $8193cf0e649c7928$exports = {
1184
+ "longPressMessage": `Za odprtje menija pritisnite in držite gumb ali pritisnite Alt+puščica navzdol`
1185
+ };
1186
+ var $f398debcce5a5c55$exports = {};
1187
+ $f398debcce5a5c55$exports = {
1188
+ "longPressMessage": `Dugo pritisnite ili pritisnite Alt + strelicu prema dole da otvorite meni`
1189
+ };
1190
+ var $9e9fef000aa4c013$exports = {};
1191
+ $9e9fef000aa4c013$exports = {
1192
+ "longPressMessage": `Håll nedtryckt eller tryck på Alt + pil nedåt för att öppna menyn`
1193
+ };
1194
+ var $c016c8183bbe3d68$exports = {};
1195
+ $c016c8183bbe3d68$exports = {
1196
+ "longPressMessage": `Menüyü açmak için uzun basın veya Alt + Aşağı Ok tuşuna basın`
1197
+ };
1198
+ var $ca4f6c8462244e62$exports = {};
1199
+ $ca4f6c8462244e62$exports = {
1200
+ "longPressMessage": `Довго або звичайно натисніть комбінацію клавіш Alt і стрілка вниз, щоб відкрити меню`
1201
+ };
1202
+ var $2d9960c02ccac927$exports = {};
1203
+ $2d9960c02ccac927$exports = {
1204
+ "longPressMessage": `长按或按 Alt + 向下方向键以打开菜单`
1205
+ };
1206
+ var $f1b682a4c8c5631c$exports = {};
1207
+ $f1b682a4c8c5631c$exports = {
1208
+ "longPressMessage": `長按或按 Alt+向下鍵以開啟功能表`
1209
+ };
1210
+ $2cbb7ca666678a14$exports = {
1211
+ "ar-AE": $c0398ad35c3639b7$exports,
1212
+ "bg-BG": $7af657c4165927c3$exports,
1213
+ "cs-CZ": $d95d4da6d531ab81$exports,
1214
+ "da-DK": $24ebda9c775dca17$exports,
1215
+ "de-DE": $743e0dfca6cab1e9$exports,
1216
+ "el-GR": $a2f41026e05f1c84$exports,
1217
+ "en-US": $43b800e97c901737$exports,
1218
+ "es-ES": $442f5f6ac211e29f$exports,
1219
+ "et-EE": $dff280acfeb2d8ac$exports,
1220
+ "fi-FI": $51608325613944d7$exports,
1221
+ "fr-FR": $c4a1b1eabeaa87be$exports,
1222
+ "he-IL": $8c74815cdee18d1b$exports,
1223
+ "hr-HR": $fd0e9ef6a7fe0ec9$exports,
1224
+ "hu-HU": $a89a74a39eba465a$exports,
1225
+ "it-IT": $edc7c66594a0ae8a$exports,
1226
+ "ja-JP": $f1ab51510712db52$exports,
1227
+ "ko-KR": $f9b672d9b82fa3d6$exports,
1228
+ "lt-LT": $a385f3910feda499$exports,
1229
+ "lv-LV": $4f1bde932c441789$exports,
1230
+ "nb-NO": $914a51a8a594d5be$exports,
1231
+ "nl-NL": $89aaf803103bb500$exports,
1232
+ "pl-PL": $c685891476dbaaca$exports,
1233
+ "pt-BR": $885879b9b10c2959$exports,
1234
+ "pt-PT": $6b39616688a51692$exports,
1235
+ "ro-RO": $f26362aed63f47e2$exports,
1236
+ "ru-RU": $06cbade644558bf0$exports,
1237
+ "sk-SK": $0a391ff68f9d59b1$exports,
1238
+ "sl-SI": $8193cf0e649c7928$exports,
1239
+ "sr-SP": $f398debcce5a5c55$exports,
1240
+ "sv-SE": $9e9fef000aa4c013$exports,
1241
+ "tr-TR": $c016c8183bbe3d68$exports,
1242
+ "uk-UA": $ca4f6c8462244e62$exports,
1243
+ "zh-CN": $2d9960c02ccac927$exports,
1244
+ "zh-TW": $f1b682a4c8c5631c$exports
1245
+ };
1246
+ function $168583247155ddda$export$dc9c12ed27dd1b49(props, state, ref) {
1247
+ let { type = "menu", isDisabled, trigger = "press" } = props;
1248
+ let menuTriggerId = $bdb11010cef70236$export$f680877a34711e37();
1249
+ let { triggerProps, overlayProps } = $628037886ba31236$export$f9d5c8beee7d008d({
1250
+ type
1251
+ }, state, ref);
1252
+ let onKeyDown = (e) => {
1253
+ if (isDisabled)
1254
+ return;
1255
+ if (trigger === "longPress" && !e.altKey)
1256
+ return;
1257
+ if (ref && ref.current)
1258
+ switch (e.key) {
1259
+ case "Enter":
1260
+ case " ":
1261
+ if (trigger === "longPress")
1262
+ return;
1263
+ case "ArrowDown":
1264
+ if (!("continuePropagation" in e))
1265
+ e.stopPropagation();
1266
+ e.preventDefault();
1267
+ state.toggle("first");
1268
+ break;
1269
+ case "ArrowUp":
1270
+ if (!("continuePropagation" in e))
1271
+ e.stopPropagation();
1272
+ e.preventDefault();
1273
+ state.toggle("last");
1274
+ break;
1275
+ }
1276
+ };
1277
+ let stringFormatter = $fca6afa0e843324b$export$f12b703ca79dfbb1(/* @__PURE__ */ $parcel$interopDefault($2cbb7ca666678a14$exports));
1278
+ let { longPressProps } = $8a26561d2877236e$export$c24ed0104d07eab9({
1279
+ isDisabled: isDisabled || trigger !== "longPress",
1280
+ accessibilityDescription: stringFormatter.format("longPressMessage"),
1281
+ onLongPressStart() {
1282
+ state.close();
1283
+ },
1284
+ onLongPress() {
1285
+ state.open("first");
1286
+ }
1287
+ });
1288
+ let pressProps = {
1289
+ onPressStart(e) {
1290
+ if (e.pointerType !== "touch" && e.pointerType !== "keyboard" && !isDisabled)
1291
+ state.toggle(e.pointerType === "virtual" ? "first" : null);
1292
+ },
1293
+ onPress(e) {
1294
+ if (e.pointerType === "touch" && !isDisabled)
1295
+ state.toggle();
1296
+ }
1297
+ };
1298
+ delete triggerProps.onPress;
1299
+ return {
1300
+ menuTriggerProps: __spreadProps(__spreadValues(__spreadValues({}, triggerProps), trigger === "press" ? pressProps : longPressProps), {
1301
+ id: menuTriggerId,
1302
+ onKeyDown
1303
+ }),
1304
+ menuProps: __spreadProps(__spreadValues({}, overlayProps), {
1305
+ "aria-labelledby": menuTriggerId,
1306
+ autoFocus: state.focusStrategy || true,
1307
+ onClose: state.close
1308
+ })
1309
+ };
1310
+ }
1311
+ const $d5336fe17ce95402$export$6f49b4016bfc8d56 = /* @__PURE__ */ new WeakMap();
1312
+ function $d5336fe17ce95402$export$38eaa17faae8f579(props, state, ref) {
1313
+ let _a = props, { shouldFocusWrap = true } = _a, otherProps = __objRest(_a, ["shouldFocusWrap"]);
1314
+ if (!props["aria-label"] && !props["aria-labelledby"])
1315
+ console.warn("An aria-label or aria-labelledby prop is required for accessibility.");
1316
+ let domProps = $65484d02dcb7eb3e$export$457c3d6518dd4c6f(props, {
1317
+ labelable: true
1318
+ });
1319
+ let { listProps } = $982254629710d113$export$b95089534ab7c1fd(__spreadProps(__spreadValues({}, otherProps), {
1320
+ ref,
1321
+ selectionManager: state.selectionManager,
1322
+ collection: state.collection,
1323
+ disabledKeys: state.disabledKeys,
1324
+ shouldFocusWrap
1325
+ }));
1326
+ $d5336fe17ce95402$export$6f49b4016bfc8d56.set(state, {
1327
+ onClose: props.onClose,
1328
+ onAction: props.onAction
1329
+ });
1330
+ return {
1331
+ menuProps: $3ef42575df84b30b$export$9d1611c77c2fe928(domProps, __spreadProps(__spreadValues({
1332
+ role: "menu",
1333
+ // this forces AT to move their cursors into any open sub dialogs, the sub dialogs contain hidden close buttons in order to come back to this level of the menu
1334
+ "aria-hidden": state.expandedKeys.size > 0 ? true : void 0
1335
+ }, listProps), {
1336
+ onKeyDown: (e) => {
1337
+ if (e.key !== "Escape")
1338
+ listProps.onKeyDown(e);
1339
+ }
1340
+ }))
1341
+ };
1342
+ }
1343
+ function $a2e5df62f93c7633$export$9d32628fc2aea7da(props, state, ref) {
1344
+ let { key, closeOnSelect, isVirtualized, "aria-haspopup": hasPopup } = props;
1345
+ let { direction } = $18f2051aff69b9bf$export$43bb16f9c6d9e3f7();
1346
+ let isTrigger = !!hasPopup;
1347
+ let isOpen = state.expandedKeys.has(key);
1348
+ var _props_isDisabled;
1349
+ let isDisabled = (_props_isDisabled = props.isDisabled) !== null && _props_isDisabled !== void 0 ? _props_isDisabled : state.disabledKeys.has(key);
1350
+ var _props_isSelected;
1351
+ let isSelected = (_props_isSelected = props.isSelected) !== null && _props_isSelected !== void 0 ? _props_isSelected : state.selectionManager.isSelected(key);
1352
+ let openTimeout = useRef();
1353
+ let cancelOpenTimeout = useCallback(() => {
1354
+ if (openTimeout.current) {
1355
+ clearTimeout(openTimeout.current);
1356
+ openTimeout.current = void 0;
1357
+ }
1358
+ }, [
1359
+ openTimeout
1360
+ ]);
1361
+ let onSubmenuOpen = $8ae05eaa5c114e9c$export$7f54fc3180508a52(() => {
1362
+ cancelOpenTimeout();
1363
+ state.setExpandedKeys(/* @__PURE__ */ new Set([
1364
+ key
1365
+ ]));
1366
+ });
1367
+ $f0a04ccd8dbdd83b$export$e5c5a5f917a5871c(() => {
1368
+ return () => cancelOpenTimeout();
1369
+ }, [
1370
+ cancelOpenTimeout
1371
+ ]);
1372
+ let data = $d5336fe17ce95402$export$6f49b4016bfc8d56.get(state);
1373
+ let onClose = props.onClose || data.onClose;
1374
+ let onActionMenuDialogTrigger = useCallback(() => {
1375
+ onSubmenuOpen();
1376
+ }, []);
1377
+ let onAction = isTrigger ? onActionMenuDialogTrigger : props.onAction || data.onAction;
1378
+ let role = "menuitem";
1379
+ if (state.selectionManager.selectionMode === "single")
1380
+ role = "menuitemradio";
1381
+ else if (state.selectionManager.selectionMode === "multiple")
1382
+ role = "menuitemcheckbox";
1383
+ let labelId = $bdb11010cef70236$export$b4cc09c592e8fdb8();
1384
+ let descriptionId = $bdb11010cef70236$export$b4cc09c592e8fdb8();
1385
+ let keyboardId = $bdb11010cef70236$export$b4cc09c592e8fdb8();
1386
+ let ariaProps = {
1387
+ "aria-disabled": isDisabled || void 0,
1388
+ role,
1389
+ "aria-label": props["aria-label"],
1390
+ "aria-labelledby": labelId,
1391
+ "aria-describedby": [
1392
+ descriptionId,
1393
+ keyboardId
1394
+ ].filter(Boolean).join(" ") || void 0
1395
+ };
1396
+ if (state.selectionManager.selectionMode !== "none")
1397
+ ariaProps["aria-checked"] = isSelected;
1398
+ if (isVirtualized) {
1399
+ ariaProps["aria-posinset"] = state.collection.getItem(key).index;
1400
+ ariaProps["aria-setsize"] = $453cc9f0df89c0a5$export$77d5aafae4e095b2(state.collection);
1401
+ }
1402
+ if (hasPopup != null) {
1403
+ ariaProps["aria-haspopup"] = hasPopup;
1404
+ ariaProps["aria-expanded"] = isOpen ? "true" : "false";
1405
+ }
1406
+ let onPressStart = (e) => {
1407
+ if (e.pointerType === "keyboard" && onAction)
1408
+ onAction(key);
1409
+ };
1410
+ let onPressUp = (e) => {
1411
+ if (e.pointerType !== "keyboard") {
1412
+ if (onAction)
1413
+ onAction(key);
1414
+ if (!isTrigger && onClose && (closeOnSelect !== null && closeOnSelect !== void 0 ? closeOnSelect : state.selectionManager.selectionMode !== "multiple"))
1415
+ onClose();
1416
+ }
1417
+ };
1418
+ let { itemProps, isFocused } = $880e95eb8b93ba9a$export$ecf600387e221c37({
1419
+ selectionManager: state.selectionManager,
1420
+ key,
1421
+ ref,
1422
+ shouldSelectOnPressUp: true,
1423
+ allowsDifferentPressOrigin: true
1424
+ });
1425
+ let { pressProps, isPressed } = $f6c31cce2adf654f$export$45712eceda6fad21({
1426
+ onPressStart,
1427
+ onPressUp,
1428
+ isDisabled: isDisabled || isTrigger && state.expandedKeys.has(key)
1429
+ });
1430
+ let { hoverProps } = $6179b936705e76d3$export$ae780daf29e6d456({
1431
+ isDisabled,
1432
+ onHoverStart() {
1433
+ if (!$507fabe10e71c6fb$export$b9b3dfddab17db27() && !(isTrigger && state.expandedKeys.has(key))) {
1434
+ state.selectionManager.setFocused(true);
1435
+ state.selectionManager.setFocusedKey(key);
1436
+ let isFocused2 = key === state.selectionManager.focusedKey;
1437
+ if (isFocused2 && state.selectionManager.isFocused && document.activeElement !== ref.current)
1438
+ $6a99195332edec8b$export$80f3e147d781571c(ref.current);
1439
+ }
1440
+ },
1441
+ onHoverChange: (isHovered) => {
1442
+ if (isHovered && isTrigger && !state.expandedKeys.has(key)) {
1443
+ if (!openTimeout.current)
1444
+ openTimeout.current = setTimeout(() => {
1445
+ onSubmenuOpen();
1446
+ }, 200);
1447
+ } else if (!isHovered)
1448
+ cancelOpenTimeout();
1449
+ }
1450
+ });
1451
+ let { keyboardProps } = $46d819fcbaf35654$export$8f71654801c2f7cd({
1452
+ onKeyDown: (e) => {
1453
+ if (e.repeat) {
1454
+ e.continuePropagation();
1455
+ return;
1456
+ }
1457
+ switch (e.key) {
1458
+ case " ":
1459
+ if (!isDisabled && state.selectionManager.selectionMode === "none" && !isTrigger && closeOnSelect !== false && onClose)
1460
+ onClose();
1461
+ break;
1462
+ case "Enter":
1463
+ if (!isDisabled && closeOnSelect !== false && !isTrigger && onClose)
1464
+ onClose();
1465
+ break;
1466
+ case "ArrowRight":
1467
+ if (isTrigger && direction === "ltr")
1468
+ onSubmenuOpen();
1469
+ else
1470
+ e.continuePropagation();
1471
+ break;
1472
+ case "ArrowLeft":
1473
+ if (isTrigger && direction === "rtl")
1474
+ onSubmenuOpen();
1475
+ else
1476
+ e.continuePropagation();
1477
+ break;
1478
+ default:
1479
+ e.continuePropagation();
1480
+ break;
1481
+ }
1482
+ }
1483
+ });
1484
+ return {
1485
+ menuItemProps: __spreadValues(__spreadValues({}, ariaProps), $3ef42575df84b30b$export$9d1611c77c2fe928(itemProps, pressProps, hoverProps, keyboardProps)),
1486
+ labelProps: {
1487
+ id: labelId
1488
+ },
1489
+ descriptionProps: {
1490
+ id: descriptionId
1491
+ },
1492
+ keyboardShortcutProps: {
1493
+ id: keyboardId
1494
+ },
1495
+ isFocused,
1496
+ isSelected,
1497
+ isPressed,
1498
+ isDisabled
1499
+ };
1500
+ }
1501
+ function $3e5eb2498db5b506$export$73f7a44322579622(props) {
1502
+ let { heading, "aria-label": ariaLabel } = props;
1503
+ let headingId = $bdb11010cef70236$export$f680877a34711e37();
1504
+ return {
1505
+ itemProps: {
1506
+ role: "presentation"
1507
+ },
1508
+ headingProps: heading ? {
1509
+ // Techincally, menus cannot contain headings according to ARIA.
1510
+ // We hide the heading from assistive technology, using role="presentation",
1511
+ // and only use it as a label for the nested group.
1512
+ id: headingId,
1513
+ role: "presentation"
1514
+ } : {},
1515
+ groupProps: {
1516
+ role: "group",
1517
+ "aria-label": ariaLabel,
1518
+ "aria-labelledby": heading ? headingId : void 0
1519
+ }
1520
+ };
1521
+ }
1522
+ function $f4b273590fab9f93$export$52210f68a14655d0(props) {
1523
+ let domProps = $65484d02dcb7eb3e$export$457c3d6518dd4c6f(props, {
1524
+ labelable: true
1525
+ });
1526
+ let ariaOrientation;
1527
+ if (props.orientation === "vertical")
1528
+ ariaOrientation = "vertical";
1529
+ if (props.elementType !== "hr")
1530
+ return {
1531
+ separatorProps: __spreadProps(__spreadValues({}, domProps), {
1532
+ role: "separator",
1533
+ "aria-orientation": ariaOrientation
1534
+ })
1535
+ };
1536
+ return {
1537
+ separatorProps: domProps
1538
+ };
1539
+ }
1540
+ class $e40ea825a81a3709$export$52baac22726c72bf extends Set {
1541
+ constructor(keys, anchorKey, currentKey) {
1542
+ super(keys);
1543
+ if (keys instanceof $e40ea825a81a3709$export$52baac22726c72bf) {
1544
+ this.anchorKey = anchorKey || keys.anchorKey;
1545
+ this.currentKey = currentKey || keys.currentKey;
1546
+ } else {
1547
+ this.anchorKey = anchorKey;
1548
+ this.currentKey = currentKey;
1549
+ }
1550
+ }
1551
+ }
1552
+ function $7af3f5b51489e0b5$var$equalSets(setA, setB) {
1553
+ if (setA.size !== setB.size)
1554
+ return false;
1555
+ for (let item of setA) {
1556
+ if (!setB.has(item))
1557
+ return false;
1558
+ }
1559
+ return true;
1560
+ }
1561
+ function $7af3f5b51489e0b5$export$253fe78d46329472(props) {
1562
+ let { selectionMode = "none", disallowEmptySelection, allowDuplicateSelectionEvents, selectionBehavior: selectionBehaviorProp = "toggle", disabledBehavior = "all" } = props;
1563
+ let isFocusedRef = useRef(false);
1564
+ let [, setFocused] = useState(false);
1565
+ let focusedKeyRef = useRef(null);
1566
+ let childFocusStrategyRef = useRef(null);
1567
+ let [, setFocusedKey] = useState(null);
1568
+ let selectedKeysProp = useMemo(() => $7af3f5b51489e0b5$var$convertSelection(props.selectedKeys), [
1569
+ props.selectedKeys
1570
+ ]);
1571
+ let defaultSelectedKeys = useMemo(() => $7af3f5b51489e0b5$var$convertSelection(props.defaultSelectedKeys, new $e40ea825a81a3709$export$52baac22726c72bf()), [
1572
+ props.defaultSelectedKeys
1573
+ ]);
1574
+ let [selectedKeys, setSelectedKeys] = $458b0a5536c1a7cf$export$40bfa8c7b0832715(selectedKeysProp, defaultSelectedKeys, props.onSelectionChange);
1575
+ let disabledKeysProp = useMemo(() => props.disabledKeys ? new Set(props.disabledKeys) : /* @__PURE__ */ new Set(), [
1576
+ props.disabledKeys
1577
+ ]);
1578
+ let [selectionBehavior, setSelectionBehavior] = useState(selectionBehaviorProp);
1579
+ if (selectionBehaviorProp === "replace" && selectionBehavior === "toggle" && typeof selectedKeys === "object" && selectedKeys.size === 0)
1580
+ setSelectionBehavior("replace");
1581
+ let lastSelectionBehavior = useRef(selectionBehaviorProp);
1582
+ useEffect(() => {
1583
+ if (selectionBehaviorProp !== lastSelectionBehavior.current) {
1584
+ setSelectionBehavior(selectionBehaviorProp);
1585
+ lastSelectionBehavior.current = selectionBehaviorProp;
1586
+ }
1587
+ }, [
1588
+ selectionBehaviorProp
1589
+ ]);
1590
+ return {
1591
+ selectionMode,
1592
+ disallowEmptySelection,
1593
+ selectionBehavior,
1594
+ setSelectionBehavior,
1595
+ get isFocused() {
1596
+ return isFocusedRef.current;
1597
+ },
1598
+ setFocused(f) {
1599
+ isFocusedRef.current = f;
1600
+ setFocused(f);
1601
+ },
1602
+ get focusedKey() {
1603
+ return focusedKeyRef.current;
1604
+ },
1605
+ get childFocusStrategy() {
1606
+ return childFocusStrategyRef.current;
1607
+ },
1608
+ setFocusedKey(k, childFocusStrategy = "first") {
1609
+ focusedKeyRef.current = k;
1610
+ childFocusStrategyRef.current = childFocusStrategy;
1611
+ setFocusedKey(k);
1612
+ },
1613
+ selectedKeys,
1614
+ setSelectedKeys(keys) {
1615
+ if (allowDuplicateSelectionEvents || !$7af3f5b51489e0b5$var$equalSets(keys, selectedKeys))
1616
+ setSelectedKeys(keys);
1617
+ },
1618
+ disabledKeys: disabledKeysProp,
1619
+ disabledBehavior
1620
+ };
1621
+ }
1622
+ function $7af3f5b51489e0b5$var$convertSelection(selection, defaultValue) {
1623
+ if (!selection)
1624
+ return defaultValue;
1625
+ return selection === "all" ? "all" : new $e40ea825a81a3709$export$52baac22726c72bf(selection);
1626
+ }
1627
+ class $d496c0a20b6e58ec$export$6c8a5aaad13c9852 {
1628
+ /**
1629
+ * The type of selection that is allowed in the collection.
1630
+ */
1631
+ get selectionMode() {
1632
+ return this.state.selectionMode;
1633
+ }
1634
+ /**
1635
+ * Whether the collection allows empty selection.
1636
+ */
1637
+ get disallowEmptySelection() {
1638
+ return this.state.disallowEmptySelection;
1639
+ }
1640
+ /**
1641
+ * The selection behavior for the collection.
1642
+ */
1643
+ get selectionBehavior() {
1644
+ return this.state.selectionBehavior;
1645
+ }
1646
+ /**
1647
+ * Sets the selection behavior for the collection.
1648
+ */
1649
+ setSelectionBehavior(selectionBehavior) {
1650
+ this.state.setSelectionBehavior(selectionBehavior);
1651
+ }
1652
+ /**
1653
+ * Whether the collection is currently focused.
1654
+ */
1655
+ get isFocused() {
1656
+ return this.state.isFocused;
1657
+ }
1658
+ /**
1659
+ * Sets whether the collection is focused.
1660
+ */
1661
+ setFocused(isFocused) {
1662
+ this.state.setFocused(isFocused);
1663
+ }
1664
+ /**
1665
+ * The current focused key in the collection.
1666
+ */
1667
+ get focusedKey() {
1668
+ return this.state.focusedKey;
1669
+ }
1670
+ /** Whether the first or last child of the focused key should receive focus. */
1671
+ get childFocusStrategy() {
1672
+ return this.state.childFocusStrategy;
1673
+ }
1674
+ /**
1675
+ * Sets the focused key.
1676
+ */
1677
+ setFocusedKey(key, childFocusStrategy) {
1678
+ if (key == null || this.collection.getItem(key))
1679
+ this.state.setFocusedKey(key, childFocusStrategy);
1680
+ }
1681
+ /**
1682
+ * The currently selected keys in the collection.
1683
+ */
1684
+ get selectedKeys() {
1685
+ return this.state.selectedKeys === "all" ? new Set(this.getSelectAllKeys()) : this.state.selectedKeys;
1686
+ }
1687
+ /**
1688
+ * The raw selection value for the collection.
1689
+ * Either 'all' for select all, or a set of keys.
1690
+ */
1691
+ get rawSelection() {
1692
+ return this.state.selectedKeys;
1693
+ }
1694
+ /**
1695
+ * Returns whether a key is selected.
1696
+ */
1697
+ isSelected(key) {
1698
+ if (this.state.selectionMode === "none")
1699
+ return false;
1700
+ key = this.getKey(key);
1701
+ return this.state.selectedKeys === "all" ? this.canSelectItem(key) : this.state.selectedKeys.has(key);
1702
+ }
1703
+ /**
1704
+ * Whether the selection is empty.
1705
+ */
1706
+ get isEmpty() {
1707
+ return this.state.selectedKeys !== "all" && this.state.selectedKeys.size === 0;
1708
+ }
1709
+ /**
1710
+ * Whether all items in the collection are selected.
1711
+ */
1712
+ get isSelectAll() {
1713
+ if (this.isEmpty)
1714
+ return false;
1715
+ if (this.state.selectedKeys === "all")
1716
+ return true;
1717
+ if (this._isSelectAll != null)
1718
+ return this._isSelectAll;
1719
+ let allKeys = this.getSelectAllKeys();
1720
+ let selectedKeys = this.state.selectedKeys;
1721
+ this._isSelectAll = allKeys.every((k) => selectedKeys.has(k));
1722
+ return this._isSelectAll;
1723
+ }
1724
+ get firstSelectedKey() {
1725
+ let first = null;
1726
+ for (let key of this.state.selectedKeys) {
1727
+ let item = this.collection.getItem(key);
1728
+ if (!first || item && $c5a24bc478652b5f$export$8c434b3a7a4dad6(this.collection, item, first) < 0)
1729
+ first = item;
1730
+ }
1731
+ return first === null || first === void 0 ? void 0 : first.key;
1732
+ }
1733
+ get lastSelectedKey() {
1734
+ let last = null;
1735
+ for (let key of this.state.selectedKeys) {
1736
+ let item = this.collection.getItem(key);
1737
+ if (!last || item && $c5a24bc478652b5f$export$8c434b3a7a4dad6(this.collection, item, last) > 0)
1738
+ last = item;
1739
+ }
1740
+ return last === null || last === void 0 ? void 0 : last.key;
1741
+ }
1742
+ get disabledKeys() {
1743
+ return this.state.disabledKeys;
1744
+ }
1745
+ get disabledBehavior() {
1746
+ return this.state.disabledBehavior;
1747
+ }
1748
+ /**
1749
+ * Extends the selection to the given key.
1750
+ */
1751
+ extendSelection(toKey) {
1752
+ if (this.selectionMode === "none")
1753
+ return;
1754
+ if (this.selectionMode === "single") {
1755
+ this.replaceSelection(toKey);
1756
+ return;
1757
+ }
1758
+ toKey = this.getKey(toKey);
1759
+ let selection;
1760
+ if (this.state.selectedKeys === "all")
1761
+ selection = new $e40ea825a81a3709$export$52baac22726c72bf([
1762
+ toKey
1763
+ ], toKey, toKey);
1764
+ else {
1765
+ let selectedKeys = this.state.selectedKeys;
1766
+ let anchorKey = selectedKeys.anchorKey || toKey;
1767
+ selection = new $e40ea825a81a3709$export$52baac22726c72bf(selectedKeys, anchorKey, toKey);
1768
+ for (let key of this.getKeyRange(anchorKey, selectedKeys.currentKey || toKey))
1769
+ selection.delete(key);
1770
+ for (let key of this.getKeyRange(toKey, anchorKey))
1771
+ if (this.canSelectItem(key))
1772
+ selection.add(key);
1773
+ }
1774
+ this.state.setSelectedKeys(selection);
1775
+ }
1776
+ getKeyRange(from, to) {
1777
+ let fromItem = this.collection.getItem(from);
1778
+ let toItem = this.collection.getItem(to);
1779
+ if (fromItem && toItem) {
1780
+ if ($c5a24bc478652b5f$export$8c434b3a7a4dad6(this.collection, fromItem, toItem) <= 0)
1781
+ return this.getKeyRangeInternal(from, to);
1782
+ return this.getKeyRangeInternal(to, from);
1783
+ }
1784
+ return [];
1785
+ }
1786
+ getKeyRangeInternal(from, to) {
1787
+ let keys = [];
1788
+ let key = from;
1789
+ while (key) {
1790
+ let item = this.collection.getItem(key);
1791
+ if (item && item.type === "item" || item.type === "cell" && this.allowsCellSelection)
1792
+ keys.push(key);
1793
+ if (key === to)
1794
+ return keys;
1795
+ key = this.collection.getKeyAfter(key);
1796
+ }
1797
+ return [];
1798
+ }
1799
+ getKey(key) {
1800
+ let item = this.collection.getItem(key);
1801
+ if (!item)
1802
+ return key;
1803
+ if (item.type === "cell" && this.allowsCellSelection)
1804
+ return key;
1805
+ while (item.type !== "item" && item.parentKey != null)
1806
+ item = this.collection.getItem(item.parentKey);
1807
+ if (!item || item.type !== "item")
1808
+ return null;
1809
+ return item.key;
1810
+ }
1811
+ /**
1812
+ * Toggles whether the given key is selected.
1813
+ */
1814
+ toggleSelection(key) {
1815
+ if (this.selectionMode === "none")
1816
+ return;
1817
+ if (this.selectionMode === "single" && !this.isSelected(key)) {
1818
+ this.replaceSelection(key);
1819
+ return;
1820
+ }
1821
+ key = this.getKey(key);
1822
+ if (key == null)
1823
+ return;
1824
+ let keys = new $e40ea825a81a3709$export$52baac22726c72bf(this.state.selectedKeys === "all" ? this.getSelectAllKeys() : this.state.selectedKeys);
1825
+ if (keys.has(key))
1826
+ keys.delete(key);
1827
+ else if (this.canSelectItem(key)) {
1828
+ keys.add(key);
1829
+ keys.anchorKey = key;
1830
+ keys.currentKey = key;
1831
+ }
1832
+ if (this.disallowEmptySelection && keys.size === 0)
1833
+ return;
1834
+ this.state.setSelectedKeys(keys);
1835
+ }
1836
+ /**
1837
+ * Replaces the selection with only the given key.
1838
+ */
1839
+ replaceSelection(key) {
1840
+ if (this.selectionMode === "none")
1841
+ return;
1842
+ key = this.getKey(key);
1843
+ if (key == null)
1844
+ return;
1845
+ let selection = this.canSelectItem(key) ? new $e40ea825a81a3709$export$52baac22726c72bf([
1846
+ key
1847
+ ], key, key) : new $e40ea825a81a3709$export$52baac22726c72bf();
1848
+ this.state.setSelectedKeys(selection);
1849
+ }
1850
+ /**
1851
+ * Replaces the selection with the given keys.
1852
+ */
1853
+ setSelectedKeys(keys) {
1854
+ if (this.selectionMode === "none")
1855
+ return;
1856
+ let selection = new $e40ea825a81a3709$export$52baac22726c72bf();
1857
+ for (let key of keys) {
1858
+ key = this.getKey(key);
1859
+ if (key != null) {
1860
+ selection.add(key);
1861
+ if (this.selectionMode === "single")
1862
+ break;
1863
+ }
1864
+ }
1865
+ this.state.setSelectedKeys(selection);
1866
+ }
1867
+ getSelectAllKeys() {
1868
+ let keys = [];
1869
+ let addKeys = (key) => {
1870
+ while (key) {
1871
+ if (this.canSelectItem(key)) {
1872
+ let item = this.collection.getItem(key);
1873
+ if (item.type === "item")
1874
+ keys.push(key);
1875
+ if (item.hasChildNodes && (this.allowsCellSelection || item.type !== "item"))
1876
+ addKeys($c5a24bc478652b5f$export$fbdeaa6a76694f71($c5a24bc478652b5f$export$1005530eda016c13(item, this.collection)).key);
1877
+ }
1878
+ key = this.collection.getKeyAfter(key);
1879
+ }
1880
+ };
1881
+ addKeys(this.collection.getFirstKey());
1882
+ return keys;
1883
+ }
1884
+ /**
1885
+ * Selects all items in the collection.
1886
+ */
1887
+ selectAll() {
1888
+ if (!this.isSelectAll && this.selectionMode === "multiple")
1889
+ this.state.setSelectedKeys("all");
1890
+ }
1891
+ /**
1892
+ * Removes all keys from the selection.
1893
+ */
1894
+ clearSelection() {
1895
+ if (!this.disallowEmptySelection && (this.state.selectedKeys === "all" || this.state.selectedKeys.size > 0))
1896
+ this.state.setSelectedKeys(new $e40ea825a81a3709$export$52baac22726c72bf());
1897
+ }
1898
+ /**
1899
+ * Toggles between select all and an empty selection.
1900
+ */
1901
+ toggleSelectAll() {
1902
+ if (this.isSelectAll)
1903
+ this.clearSelection();
1904
+ else
1905
+ this.selectAll();
1906
+ }
1907
+ select(key, e) {
1908
+ if (this.selectionMode === "none")
1909
+ return;
1910
+ if (this.selectionMode === "single") {
1911
+ if (this.isSelected(key) && !this.disallowEmptySelection)
1912
+ this.toggleSelection(key);
1913
+ else
1914
+ this.replaceSelection(key);
1915
+ } else if (this.selectionBehavior === "toggle" || e && (e.pointerType === "touch" || e.pointerType === "virtual"))
1916
+ this.toggleSelection(key);
1917
+ else
1918
+ this.replaceSelection(key);
1919
+ }
1920
+ /**
1921
+ * Returns whether the current selection is equal to the given selection.
1922
+ */
1923
+ isSelectionEqual(selection) {
1924
+ if (selection === this.state.selectedKeys)
1925
+ return true;
1926
+ let selectedKeys = this.selectedKeys;
1927
+ if (selection.size !== selectedKeys.size)
1928
+ return false;
1929
+ for (let key of selection) {
1930
+ if (!selectedKeys.has(key))
1931
+ return false;
1932
+ }
1933
+ for (let key of selectedKeys) {
1934
+ if (!selection.has(key))
1935
+ return false;
1936
+ }
1937
+ return true;
1938
+ }
1939
+ canSelectItem(key) {
1940
+ if (this.state.selectionMode === "none" || this.state.disabledKeys.has(key))
1941
+ return false;
1942
+ let item = this.collection.getItem(key);
1943
+ if (!item || item.type === "cell" && !this.allowsCellSelection)
1944
+ return false;
1945
+ return true;
1946
+ }
1947
+ isDisabled(key) {
1948
+ return this.state.disabledKeys.has(key) && this.state.disabledBehavior === "all";
1949
+ }
1950
+ constructor(collection, state, options) {
1951
+ this.collection = collection;
1952
+ this.state = state;
1953
+ var _options_allowsCellSelection;
1954
+ this.allowsCellSelection = (_options_allowsCellSelection = options === null || options === void 0 ? void 0 : options.allowsCellSelection) !== null && _options_allowsCellSelection !== void 0 ? _options_allowsCellSelection : false;
1955
+ this._isSelectAll = null;
1956
+ }
1957
+ }
1958
+ function $a28c903ee9ad8dc5$export$79fefeb1c2091ac3(props) {
1959
+ let overlayTriggerState = $fc909762b330b746$export$61c6a8c84e605fb6(props);
1960
+ let [focusStrategy, setFocusStrategy] = useState(null);
1961
+ return __spreadProps(__spreadValues({
1962
+ focusStrategy
1963
+ }, overlayTriggerState), {
1964
+ open(focusStrategy2 = null) {
1965
+ setFocusStrategy(focusStrategy2);
1966
+ overlayTriggerState.open();
1967
+ },
1968
+ toggle(focusStrategy2 = null) {
1969
+ setFocusStrategy(focusStrategy2);
1970
+ overlayTriggerState.toggle();
1971
+ }
1972
+ });
1973
+ }
1974
+ const DEFAULT_MAX_ITEMS_UNTIL_SCROLL = 5;
1975
+ const DEFAULT_PLACEMENT = "bottom";
1976
+ const DEFAULT_WIDTH = "auto";
1977
+ const ITEM_HEIGHT = 32;
1978
+ const Y_PADDING_INSIDE_OVERLAY = 8;
1979
+ const OVERLAY_OFFSET = 8;
1980
+ const OVERLAY_PADDING_FROM_CONTAINER = 12;
1981
+ function getUnmergedPopoverStyles(width, triggerWidth) {
1982
+ return __spreadValues(__spreadValues(__spreadValues(__spreadValues({}, getComponentToken("menu", "item_height", `${pxToRem(ITEM_HEIGHT)}rem`)), getComponentToken("menu", "padding.y", `${pxToRem(Y_PADDING_INSIDE_OVERLAY)}rem`)), getComponentToken("menu", "min-width", width === "auto" ? `${triggerWidth}px` : void 0)), getResponsiveValue("menu", "width", width !== "auto" && width !== "fit-content" ? width : "auto"));
1983
+ }
1984
+ function useTriggerWidth(triggerRef) {
1985
+ const [triggerWidth, setTriggerWidth] = useState(null);
1986
+ $9daab02d461809db$export$683480f191c0e3ea({
1987
+ ref: triggerRef,
1988
+ onResize: () => {
1989
+ if (triggerRef.current) {
1990
+ const { width } = triggerRef.current.getBoundingClientRect();
1991
+ setTriggerWidth(width);
1992
+ }
1993
+ }
1994
+ });
1995
+ const initialRef = useRef(false);
1996
+ useEffect(() => {
1997
+ if (triggerRef.current && !initialRef.current) {
1998
+ const { width } = triggerRef.current.getBoundingClientRect();
1999
+ setTriggerWidth(width);
2000
+ initialRef.current = true;
2001
+ }
2002
+ }, [triggerRef]);
2003
+ return triggerWidth;
2004
+ }
2005
+ export {
2006
+ $7af3f5b51489e0b5$export$253fe78d46329472 as $,
2007
+ DEFAULT_MAX_ITEMS_UNTIL_SCROLL as D,
2008
+ ITEM_HEIGHT as I,
2009
+ OVERLAY_PADDING_FROM_CONTAINER as O,
2010
+ Y_PADDING_INSIDE_OVERLAY as Y,
2011
+ $7613b1592d41b092$export$6cd28814d92fa9c9 as a,
2012
+ $d496c0a20b6e58ec$export$6c8a5aaad13c9852 as b,
2013
+ $c1d7fb2ec91bae71$export$6d08773d2e66f8f2 as c,
2014
+ $a2e5df62f93c7633$export$9d32628fc2aea7da as d,
2015
+ $9fc4852771d079eb$export$6e2c8f0811a474ce as e,
2016
+ $3e5eb2498db5b506$export$73f7a44322579622 as f,
2017
+ $f4b273590fab9f93$export$52210f68a14655d0 as g,
2018
+ $d5336fe17ce95402$export$38eaa17faae8f579 as h,
2019
+ getUnmergedPopoverStyles as i,
2020
+ DEFAULT_PLACEMENT as j,
2021
+ DEFAULT_WIDTH as k,
2022
+ OVERLAY_OFFSET as l,
2023
+ $a28c903ee9ad8dc5$export$79fefeb1c2091ac3 as m,
2024
+ $168583247155ddda$export$dc9c12ed27dd1b49 as n,
2025
+ $982254629710d113$export$b95089534ab7c1fd as o,
2026
+ $453cc9f0df89c0a5$export$77d5aafae4e095b2 as p,
2027
+ $880e95eb8b93ba9a$export$ecf600387e221c37 as q,
2028
+ $2a25aae57d74318e$export$a05409b8bb224a5a as r,
2029
+ $fb3050f43d946246$export$e32c88dfddc6e1d8 as s,
2030
+ useTriggerWidth as u
2031
+ };