@arc-ui/components 11.24.2 → 11.26.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (67) hide show
  1. package/dist/Button/Button.cjs.js +1 -1
  2. package/dist/Button/Button.esm.js +1 -1
  3. package/dist/DatePicker/DatePicker.cjs.js +1276 -22
  4. package/dist/DatePicker/DatePicker.esm.js +1245 -10
  5. package/dist/InformationCard/InformationCard.cjs.js +1 -1
  6. package/dist/InformationCard/InformationCard.esm.js +1 -1
  7. package/dist/Modal/Modal.cjs.js +438 -225
  8. package/dist/Modal/Modal.esm.js +420 -225
  9. package/dist/PaginationSimple/PaginationSimple.cjs.js +23 -2
  10. package/dist/PaginationSimple/PaginationSimple.esm.js +23 -2
  11. package/dist/Select/Select.cjs.js +1514 -1065
  12. package/dist/Select/Select.esm.js +1496 -1066
  13. package/dist/SiteHeader/SiteHeader.cjs.js +2 -2
  14. package/dist/SiteHeader/SiteHeader.esm.js +2 -2
  15. package/dist/SiteHeaderV2/SiteHeaderV2.cjs.js +2 -2
  16. package/dist/SiteHeaderV2/SiteHeaderV2.esm.js +2 -2
  17. package/dist/Tabs/Tabs.cjs.js +4 -6
  18. package/dist/Tabs/Tabs.esm.js +4 -6
  19. package/dist/TextArea/TextArea.cjs.js +10 -13
  20. package/dist/TextArea/TextArea.esm.js +10 -13
  21. package/dist/Toast/Toast.cjs.js +4 -6
  22. package/dist/Toast/Toast.esm.js +4 -6
  23. package/dist/UniversalHeader/UniversalHeader.cjs.js +2 -2
  24. package/dist/UniversalHeader/UniversalHeader.esm.js +2 -2
  25. package/dist/_shared/cjs/{Button-6ba21d3b.js → Button-5b28f0ce.js} +3 -3
  26. package/dist/_shared/cjs/{SiteHeader.rehydrator-9d8f3dad.js → SiteHeader.rehydrator-8fa9d174.js} +1 -1
  27. package/dist/_shared/cjs/{SiteHeaderV2-ce1c8737.js → SiteHeaderV2-ca2f13a8.js} +1 -1
  28. package/dist/_shared/cjs/{Tabs-bc9fac46.js → Tabs-89455281.js} +19 -15
  29. package/dist/_shared/cjs/{Toast-26207fef.js → Toast-c760c89d.js} +32 -14
  30. package/dist/_shared/cjs/{UniversalHeader-b8389447.js → UniversalHeader-73e154eb.js} +6 -2
  31. package/dist/_shared/cjs/component-4979b2e7.js +409 -0
  32. package/dist/_shared/cjs/{index-77ab5c6a.js → floating-ui.react-dom-08b8b87c.js} +12 -284
  33. package/dist/_shared/cjs/index-1efbba95.js +1252 -0
  34. package/dist/_shared/cjs/{index-74004a9c.js → index-4edec793.js} +1 -1
  35. package/dist/_shared/cjs/{index-dd1d18ea.js → index-7641213c.js} +127 -2
  36. package/dist/_shared/cjs/{index-9f99d686.js → index-af744fa9.js} +1 -1
  37. package/dist/_shared/cjs/{index-6eb396a3.js → index-fb0cad18.js} +1 -1
  38. package/dist/_shared/esm/{Button-a7d134c6.js → Button-5b48b7ce.js} +3 -3
  39. package/dist/_shared/esm/{SiteHeader.rehydrator-2ec02ee7.js → SiteHeader.rehydrator-8f3c5d6e.js} +1 -1
  40. package/dist/_shared/esm/{SiteHeaderV2-a7c1b1cb.js → SiteHeaderV2-cb081752.js} +1 -1
  41. package/dist/_shared/esm/{Tabs-9485cab6.js → Tabs-959e885d.js} +10 -6
  42. package/dist/_shared/esm/{Toast-fcbfc194.js → Toast-a590067d.js} +25 -7
  43. package/dist/_shared/esm/{UniversalHeader-80c7313f.js → UniversalHeader-96bfbacc.js} +6 -2
  44. package/dist/_shared/esm/component-d7b471ff.js +382 -0
  45. package/dist/_shared/esm/{index-b84a20c6.js → floating-ui.react-dom-1bb71aae.js} +4 -281
  46. package/dist/_shared/esm/{index-7b531fa7.js → index-0ae23b06.js} +126 -2
  47. package/dist/_shared/esm/index-307f1bbc.js +1212 -0
  48. package/dist/_shared/esm/{index-044da8d0.js → index-9e54cc7d.js} +1 -1
  49. package/dist/_shared/esm/{index-efa9be1a.js → index-af7b6e55.js} +1 -1
  50. package/dist/_shared/esm/{index-2cfab9f2.js → index-ebe72f34.js} +1 -1
  51. package/dist/index.es.js +3608 -2938
  52. package/dist/index.es.js.map +1 -1
  53. package/dist/index.js +3591 -2921
  54. package/dist/index.js.map +1 -1
  55. package/dist/styles.css +2 -2
  56. package/dist/types/components/Button/Button.d.ts +12 -0
  57. package/dist/types/components/PaginationSimple/PaginationSimple.d.ts +28 -0
  58. package/dist/types/components/UniversalHeader/UniversalHeader.d.ts +4 -0
  59. package/package.json +3 -3
  60. package/dist/_shared/cjs/Combination-9974f2e2.js +0 -1330
  61. package/dist/_shared/cjs/index-a31e64a9.js +0 -27
  62. package/dist/_shared/cjs/index-d38f1bd0.js +0 -131
  63. package/dist/_shared/cjs/index-dcfdd5da.js +0 -11
  64. package/dist/_shared/esm/Combination-e9f7e64e.js +0 -1301
  65. package/dist/_shared/esm/index-25a5b393.js +0 -25
  66. package/dist/_shared/esm/index-a624de47.js +0 -9
  67. package/dist/_shared/esm/index-ca72c9d5.js +0 -129
@@ -1,13 +1,15 @@
1
1
  import { r as requiredArgs, t as toDate, i as isValid, f as format, C as Calendar, a as isBefore, b as isAfter, c as compareAsc } from '../_shared/esm/Calendar-ea232839.js';
2
- import { b as __spreadArray, _ as __rest, a as __assign } from '../_shared/esm/filter-data-attrs-ea8f4ed4.js';
3
- import React__default, { useRef, useState, createElement, useCallback, forwardRef, useEffect, useContext } from 'react';
2
+ import { _ as __rest, a as __assign, b as __spreadArray } from '../_shared/esm/filter-data-attrs-ea8f4ed4.js';
3
+ import * as React from 'react';
4
+ import React__default, { forwardRef, useContext, useState, useEffect, createElement, useRef, createContext, useCallback } from 'react';
4
5
  import { c as classNames } from '../_shared/esm/index-2e73c2e9.js';
5
6
  import { _ as _extends } from '../_shared/esm/extends-8cc61aad.js';
6
- import { $ as $c512c27ab02ef895$export$50c7b4e9d9f19c1, a as $71cd76cc60e0454e$export$6f32135080cb4c3, b as $6ed0406888f73fc4$export$c7b2cbe3552a0d05, c as $5e63c961fc1ce211$export$8c6ed5c666ac1360, d as $e42e1063c40fb3ef$export$b9ecd428b558ff10 } from '../_shared/esm/index-7b531fa7.js';
7
- import { $ as $f1701beae083dbae$export$602eac185826482c, h as hideOthers, a as $01b9c$RemoveScroll, b as $3db38b7d1fb3fe6a$export$b7ece24a22aeda8c, c as $d3863c46a17e8a28$export$20e40289641fbbb6, d as $5cb92bef7577960e$export$177fb62ff3ec1f22 } from '../_shared/esm/Combination-e9f7e64e.js';
8
- import { $ as $1746a345f3d73bb7$export$f680877a34711e37 } from '../_shared/esm/index-efa9be1a.js';
9
- import { $ as $cf1ac5d9fe0e8206$export$722aac194ae923, a as $cf1ac5d9fe0e8206$export$be92b6f5f03c0fe9, b as $cf1ac5d9fe0e8206$export$b688253958b8dfe7, c as $cf1ac5d9fe0e8206$export$7c6e2c02157bb7d2 } from '../_shared/esm/index-b84a20c6.js';
10
- import { $ as $921a889cee6df7e8$export$99c2b779aa4e8b8b } from '../_shared/esm/index-ca72c9d5.js';
7
+ import { $ as $6ed0406888f73fc4$export$c7b2cbe3552a0d05, a as $8927f6f2acc4f386$export$250ffa63cdc0d034, b as $e42e1063c40fb3ef$export$b9ecd428b558ff10, c as $b1b2314f5f9a1d84$export$25bec8c6f54ee79a, d as $8927f6f2acc4f386$export$6d1a0317bde7de7f, e as $9f79659886946c16$export$e5c5a5f917a5871c, f as $c512c27ab02ef895$export$50c7b4e9d9f19c1, g as $71cd76cc60e0454e$export$6f32135080cb4c3, h as $921a889cee6df7e8$export$99c2b779aa4e8b8b, i as $5e63c961fc1ce211$export$8c6ed5c666ac1360 } from '../_shared/esm/index-0ae23b06.js';
8
+ import { $ as $addc16e1bbe58fd0$export$3a72a57244d6e765 } from '../_shared/esm/index-ebe72f34.js';
9
+ import { $ as $1746a345f3d73bb7$export$f680877a34711e37 } from '../_shared/esm/index-af7b6e55.js';
10
+ import { u as useFloating, a as autoUpdate, o as offset, s as shift, l as limitShift, f as flip, b as size, c as arrow, h as hide } from '../_shared/esm/floating-ui.react-dom-1bb71aae.js';
11
+ import ReactDOM__default from 'react-dom';
12
+ import { c as createSidecarMedium, u as useMergeRefs, f as fullWidthClassName, z as zeroRightClassName, s as styleSingleton, R as RemoveScrollBar, e as exportSidecar } from '../_shared/esm/component-d7b471ff.js';
11
13
  import { A as ArcRootElementContext } from '../_shared/esm/Base-211ca3a4.js';
12
14
  import { T as TextInputWithPlaceHolder } from '../_shared/esm/TextInput-c0388103.js';
13
15
  import '../_shared/esm/use-media-query-4c807227.js';
@@ -19,8 +21,6 @@ import '../_shared/esm/Heading-d16e0e53.js';
19
21
  import '../_shared/esm/BtIconChevronLeftMid.esm-1ed8330b.js';
20
22
  import '../_shared/esm/BtIconChevronRightMid.esm-32268f1a.js';
21
23
  import '../_shared/esm/Icon-15799695.js';
22
- import 'react-dom';
23
- import '../_shared/esm/index-2cfab9f2.js';
24
24
  import '../_shared/esm/FormControl-8e836656.js';
25
25
  import '../_shared/esm/BtIconAlert.esm-a4608d47.js';
26
26
  import '../_shared/esm/DisclosureMini-56719716.js';
@@ -131,6 +131,1241 @@ var isRangeValid = function (value) {
131
131
 
132
132
  var DATE_FORMAT = "dd/MM/yyyy";
133
133
 
134
+ const $5cb92bef7577960e$var$CONTEXT_UPDATE = 'dismissableLayer.update';
135
+ const $5cb92bef7577960e$var$POINTER_DOWN_OUTSIDE = 'dismissableLayer.pointerDownOutside';
136
+ const $5cb92bef7577960e$var$FOCUS_OUTSIDE = 'dismissableLayer.focusOutside';
137
+ let $5cb92bef7577960e$var$originalBodyPointerEvents;
138
+ const $5cb92bef7577960e$var$DismissableLayerContext = /*#__PURE__*/ createContext({
139
+ layers: new Set(),
140
+ layersWithOutsidePointerEventsDisabled: new Set(),
141
+ branches: new Set()
142
+ });
143
+ const $5cb92bef7577960e$export$177fb62ff3ec1f22 = /*#__PURE__*/ forwardRef((props, forwardedRef)=>{
144
+ var _node$ownerDocument;
145
+ const { disableOutsidePointerEvents: disableOutsidePointerEvents = false , onEscapeKeyDown: onEscapeKeyDown , onPointerDownOutside: onPointerDownOutside , onFocusOutside: onFocusOutside , onInteractOutside: onInteractOutside , onDismiss: onDismiss , ...layerProps } = props;
146
+ const context = useContext($5cb92bef7577960e$var$DismissableLayerContext);
147
+ const [node1, setNode] = useState(null);
148
+ const ownerDocument = (_node$ownerDocument = node1 === null || node1 === void 0 ? void 0 : node1.ownerDocument) !== null && _node$ownerDocument !== void 0 ? _node$ownerDocument : globalThis === null || globalThis === void 0 ? void 0 : globalThis.document;
149
+ const [, force] = useState({});
150
+ const composedRefs = $6ed0406888f73fc4$export$c7b2cbe3552a0d05(forwardedRef, (node)=>setNode(node)
151
+ );
152
+ const layers = Array.from(context.layers);
153
+ const [highestLayerWithOutsidePointerEventsDisabled] = [
154
+ ...context.layersWithOutsidePointerEventsDisabled
155
+ ].slice(-1); // prettier-ignore
156
+ const highestLayerWithOutsidePointerEventsDisabledIndex = layers.indexOf(highestLayerWithOutsidePointerEventsDisabled); // prettier-ignore
157
+ const index = node1 ? layers.indexOf(node1) : -1;
158
+ const isBodyPointerEventsDisabled = context.layersWithOutsidePointerEventsDisabled.size > 0;
159
+ const isPointerEventsEnabled = index >= highestLayerWithOutsidePointerEventsDisabledIndex;
160
+ const pointerDownOutside = $5cb92bef7577960e$var$usePointerDownOutside((event)=>{
161
+ const target = event.target;
162
+ const isPointerDownOnBranch = [
163
+ ...context.branches
164
+ ].some((branch)=>branch.contains(target)
165
+ );
166
+ if (!isPointerEventsEnabled || isPointerDownOnBranch) return;
167
+ onPointerDownOutside === null || onPointerDownOutside === void 0 || onPointerDownOutside(event);
168
+ onInteractOutside === null || onInteractOutside === void 0 || onInteractOutside(event);
169
+ if (!event.defaultPrevented) onDismiss === null || onDismiss === void 0 || onDismiss();
170
+ }, ownerDocument);
171
+ const focusOutside = $5cb92bef7577960e$var$useFocusOutside((event)=>{
172
+ const target = event.target;
173
+ const isFocusInBranch = [
174
+ ...context.branches
175
+ ].some((branch)=>branch.contains(target)
176
+ );
177
+ if (isFocusInBranch) return;
178
+ onFocusOutside === null || onFocusOutside === void 0 || onFocusOutside(event);
179
+ onInteractOutside === null || onInteractOutside === void 0 || onInteractOutside(event);
180
+ if (!event.defaultPrevented) onDismiss === null || onDismiss === void 0 || onDismiss();
181
+ }, ownerDocument);
182
+ $addc16e1bbe58fd0$export$3a72a57244d6e765((event)=>{
183
+ const isHighestLayer = index === context.layers.size - 1;
184
+ if (!isHighestLayer) return;
185
+ onEscapeKeyDown === null || onEscapeKeyDown === void 0 || onEscapeKeyDown(event);
186
+ if (!event.defaultPrevented && onDismiss) {
187
+ event.preventDefault();
188
+ onDismiss();
189
+ }
190
+ }, ownerDocument);
191
+ useEffect(()=>{
192
+ if (!node1) return;
193
+ if (disableOutsidePointerEvents) {
194
+ if (context.layersWithOutsidePointerEventsDisabled.size === 0) {
195
+ $5cb92bef7577960e$var$originalBodyPointerEvents = ownerDocument.body.style.pointerEvents;
196
+ ownerDocument.body.style.pointerEvents = 'none';
197
+ }
198
+ context.layersWithOutsidePointerEventsDisabled.add(node1);
199
+ }
200
+ context.layers.add(node1);
201
+ $5cb92bef7577960e$var$dispatchUpdate();
202
+ return ()=>{
203
+ if (disableOutsidePointerEvents && context.layersWithOutsidePointerEventsDisabled.size === 1) ownerDocument.body.style.pointerEvents = $5cb92bef7577960e$var$originalBodyPointerEvents;
204
+ };
205
+ }, [
206
+ node1,
207
+ ownerDocument,
208
+ disableOutsidePointerEvents,
209
+ context
210
+ ]);
211
+ /**
212
+ * We purposefully prevent combining this effect with the `disableOutsidePointerEvents` effect
213
+ * because a change to `disableOutsidePointerEvents` would remove this layer from the stack
214
+ * and add it to the end again so the layering order wouldn't be _creation order_.
215
+ * We only want them to be removed from context stacks when unmounted.
216
+ */ useEffect(()=>{
217
+ return ()=>{
218
+ if (!node1) return;
219
+ context.layers.delete(node1);
220
+ context.layersWithOutsidePointerEventsDisabled.delete(node1);
221
+ $5cb92bef7577960e$var$dispatchUpdate();
222
+ };
223
+ }, [
224
+ node1,
225
+ context
226
+ ]);
227
+ useEffect(()=>{
228
+ const handleUpdate = ()=>force({})
229
+ ;
230
+ document.addEventListener($5cb92bef7577960e$var$CONTEXT_UPDATE, handleUpdate);
231
+ return ()=>document.removeEventListener($5cb92bef7577960e$var$CONTEXT_UPDATE, handleUpdate)
232
+ ;
233
+ }, []);
234
+ return /*#__PURE__*/ createElement($8927f6f2acc4f386$export$250ffa63cdc0d034.div, _extends({}, layerProps, {
235
+ ref: composedRefs,
236
+ style: {
237
+ pointerEvents: isBodyPointerEventsDisabled ? isPointerEventsEnabled ? 'auto' : 'none' : undefined,
238
+ ...props.style
239
+ },
240
+ onFocusCapture: $e42e1063c40fb3ef$export$b9ecd428b558ff10(props.onFocusCapture, focusOutside.onFocusCapture),
241
+ onBlurCapture: $e42e1063c40fb3ef$export$b9ecd428b558ff10(props.onBlurCapture, focusOutside.onBlurCapture),
242
+ onPointerDownCapture: $e42e1063c40fb3ef$export$b9ecd428b558ff10(props.onPointerDownCapture, pointerDownOutside.onPointerDownCapture)
243
+ }));
244
+ });
245
+ /* -----------------------------------------------------------------------------------------------*/ /**
246
+ * Listens for `pointerdown` outside a react subtree. We use `pointerdown` rather than `pointerup`
247
+ * to mimic layer dismissing behaviour present in OS.
248
+ * Returns props to pass to the node we want to check for outside events.
249
+ */ function $5cb92bef7577960e$var$usePointerDownOutside(onPointerDownOutside, ownerDocument = globalThis === null || globalThis === void 0 ? void 0 : globalThis.document) {
250
+ const handlePointerDownOutside = $b1b2314f5f9a1d84$export$25bec8c6f54ee79a(onPointerDownOutside);
251
+ const isPointerInsideReactTreeRef = useRef(false);
252
+ const handleClickRef = useRef(()=>{});
253
+ useEffect(()=>{
254
+ const handlePointerDown = (event)=>{
255
+ if (event.target && !isPointerInsideReactTreeRef.current) {
256
+ const eventDetail = {
257
+ originalEvent: event
258
+ };
259
+ function handleAndDispatchPointerDownOutsideEvent() {
260
+ $5cb92bef7577960e$var$handleAndDispatchCustomEvent($5cb92bef7577960e$var$POINTER_DOWN_OUTSIDE, handlePointerDownOutside, eventDetail, {
261
+ discrete: true
262
+ });
263
+ }
264
+ /**
265
+ * On touch devices, we need to wait for a click event because browsers implement
266
+ * a ~350ms delay between the time the user stops touching the display and when the
267
+ * browser executres events. We need to ensure we don't reactivate pointer-events within
268
+ * this timeframe otherwise the browser may execute events that should have been prevented.
269
+ *
270
+ * Additionally, this also lets us deal automatically with cancellations when a click event
271
+ * isn't raised because the page was considered scrolled/drag-scrolled, long-pressed, etc.
272
+ *
273
+ * This is why we also continuously remove the previous listener, because we cannot be
274
+ * certain that it was raised, and therefore cleaned-up.
275
+ */ if (event.pointerType === 'touch') {
276
+ ownerDocument.removeEventListener('click', handleClickRef.current);
277
+ handleClickRef.current = handleAndDispatchPointerDownOutsideEvent;
278
+ ownerDocument.addEventListener('click', handleClickRef.current, {
279
+ once: true
280
+ });
281
+ } else handleAndDispatchPointerDownOutsideEvent();
282
+ } else // We need to remove the event listener in case the outside click has been canceled.
283
+ // See: https://github.com/radix-ui/primitives/issues/2171
284
+ ownerDocument.removeEventListener('click', handleClickRef.current);
285
+ isPointerInsideReactTreeRef.current = false;
286
+ };
287
+ /**
288
+ * if this hook executes in a component that mounts via a `pointerdown` event, the event
289
+ * would bubble up to the document and trigger a `pointerDownOutside` event. We avoid
290
+ * this by delaying the event listener registration on the document.
291
+ * This is not React specific, but rather how the DOM works, ie:
292
+ * ```
293
+ * button.addEventListener('pointerdown', () => {
294
+ * console.log('I will log');
295
+ * document.addEventListener('pointerdown', () => {
296
+ * console.log('I will also log');
297
+ * })
298
+ * });
299
+ */ const timerId = window.setTimeout(()=>{
300
+ ownerDocument.addEventListener('pointerdown', handlePointerDown);
301
+ }, 0);
302
+ return ()=>{
303
+ window.clearTimeout(timerId);
304
+ ownerDocument.removeEventListener('pointerdown', handlePointerDown);
305
+ ownerDocument.removeEventListener('click', handleClickRef.current);
306
+ };
307
+ }, [
308
+ ownerDocument,
309
+ handlePointerDownOutside
310
+ ]);
311
+ return {
312
+ // ensures we check React component tree (not just DOM tree)
313
+ onPointerDownCapture: ()=>isPointerInsideReactTreeRef.current = true
314
+ };
315
+ }
316
+ /**
317
+ * Listens for when focus happens outside a react subtree.
318
+ * Returns props to pass to the root (node) of the subtree we want to check.
319
+ */ function $5cb92bef7577960e$var$useFocusOutside(onFocusOutside, ownerDocument = globalThis === null || globalThis === void 0 ? void 0 : globalThis.document) {
320
+ const handleFocusOutside = $b1b2314f5f9a1d84$export$25bec8c6f54ee79a(onFocusOutside);
321
+ const isFocusInsideReactTreeRef = useRef(false);
322
+ useEffect(()=>{
323
+ const handleFocus = (event)=>{
324
+ if (event.target && !isFocusInsideReactTreeRef.current) {
325
+ const eventDetail = {
326
+ originalEvent: event
327
+ };
328
+ $5cb92bef7577960e$var$handleAndDispatchCustomEvent($5cb92bef7577960e$var$FOCUS_OUTSIDE, handleFocusOutside, eventDetail, {
329
+ discrete: false
330
+ });
331
+ }
332
+ };
333
+ ownerDocument.addEventListener('focusin', handleFocus);
334
+ return ()=>ownerDocument.removeEventListener('focusin', handleFocus)
335
+ ;
336
+ }, [
337
+ ownerDocument,
338
+ handleFocusOutside
339
+ ]);
340
+ return {
341
+ onFocusCapture: ()=>isFocusInsideReactTreeRef.current = true
342
+ ,
343
+ onBlurCapture: ()=>isFocusInsideReactTreeRef.current = false
344
+ };
345
+ }
346
+ function $5cb92bef7577960e$var$dispatchUpdate() {
347
+ const event = new CustomEvent($5cb92bef7577960e$var$CONTEXT_UPDATE);
348
+ document.dispatchEvent(event);
349
+ }
350
+ function $5cb92bef7577960e$var$handleAndDispatchCustomEvent(name, handler, detail, { discrete: discrete }) {
351
+ const target = detail.originalEvent.target;
352
+ const event = new CustomEvent(name, {
353
+ bubbles: false,
354
+ cancelable: true,
355
+ detail: detail
356
+ });
357
+ if (handler) target.addEventListener(name, handler, {
358
+ once: true
359
+ });
360
+ if (discrete) $8927f6f2acc4f386$export$6d1a0317bde7de7f(target, event);
361
+ else target.dispatchEvent(event);
362
+ }
363
+
364
+ /** Number of components which have requested interest to have focus guards */ let $3db38b7d1fb3fe6a$var$count = 0;
365
+ /**
366
+ * Injects a pair of focus guards at the edges of the whole DOM tree
367
+ * to ensure `focusin` & `focusout` events can be caught consistently.
368
+ */ function $3db38b7d1fb3fe6a$export$b7ece24a22aeda8c() {
369
+ useEffect(()=>{
370
+ var _edgeGuards$, _edgeGuards$2;
371
+ const edgeGuards = document.querySelectorAll('[data-radix-focus-guard]');
372
+ document.body.insertAdjacentElement('afterbegin', (_edgeGuards$ = edgeGuards[0]) !== null && _edgeGuards$ !== void 0 ? _edgeGuards$ : $3db38b7d1fb3fe6a$var$createFocusGuard());
373
+ document.body.insertAdjacentElement('beforeend', (_edgeGuards$2 = edgeGuards[1]) !== null && _edgeGuards$2 !== void 0 ? _edgeGuards$2 : $3db38b7d1fb3fe6a$var$createFocusGuard());
374
+ $3db38b7d1fb3fe6a$var$count++;
375
+ return ()=>{
376
+ if ($3db38b7d1fb3fe6a$var$count === 1) document.querySelectorAll('[data-radix-focus-guard]').forEach((node)=>node.remove()
377
+ );
378
+ $3db38b7d1fb3fe6a$var$count--;
379
+ };
380
+ }, []);
381
+ }
382
+ function $3db38b7d1fb3fe6a$var$createFocusGuard() {
383
+ const element = document.createElement('span');
384
+ element.setAttribute('data-radix-focus-guard', '');
385
+ element.tabIndex = 0;
386
+ element.style.cssText = 'outline: none; opacity: 0; position: fixed; pointer-events: none';
387
+ return element;
388
+ }
389
+
390
+ const $d3863c46a17e8a28$var$AUTOFOCUS_ON_MOUNT = 'focusScope.autoFocusOnMount';
391
+ const $d3863c46a17e8a28$var$AUTOFOCUS_ON_UNMOUNT = 'focusScope.autoFocusOnUnmount';
392
+ const $d3863c46a17e8a28$var$EVENT_OPTIONS = {
393
+ bubbles: false,
394
+ cancelable: true
395
+ };
396
+ const $d3863c46a17e8a28$export$20e40289641fbbb6 = /*#__PURE__*/ forwardRef((props, forwardedRef)=>{
397
+ const { loop: loop = false , trapped: trapped = false , onMountAutoFocus: onMountAutoFocusProp , onUnmountAutoFocus: onUnmountAutoFocusProp , ...scopeProps } = props;
398
+ const [container1, setContainer] = useState(null);
399
+ const onMountAutoFocus = $b1b2314f5f9a1d84$export$25bec8c6f54ee79a(onMountAutoFocusProp);
400
+ const onUnmountAutoFocus = $b1b2314f5f9a1d84$export$25bec8c6f54ee79a(onUnmountAutoFocusProp);
401
+ const lastFocusedElementRef = useRef(null);
402
+ const composedRefs = $6ed0406888f73fc4$export$c7b2cbe3552a0d05(forwardedRef, (node)=>setContainer(node)
403
+ );
404
+ const focusScope = useRef({
405
+ paused: false,
406
+ pause () {
407
+ this.paused = true;
408
+ },
409
+ resume () {
410
+ this.paused = false;
411
+ }
412
+ }).current; // Takes care of trapping focus if focus is moved outside programmatically for example
413
+ useEffect(()=>{
414
+ if (trapped) {
415
+ function handleFocusIn(event) {
416
+ if (focusScope.paused || !container1) return;
417
+ const target = event.target;
418
+ if (container1.contains(target)) lastFocusedElementRef.current = target;
419
+ else $d3863c46a17e8a28$var$focus(lastFocusedElementRef.current, {
420
+ select: true
421
+ });
422
+ }
423
+ function handleFocusOut(event) {
424
+ if (focusScope.paused || !container1) return;
425
+ const relatedTarget = event.relatedTarget; // A `focusout` event with a `null` `relatedTarget` will happen in at least two cases:
426
+ //
427
+ // 1. When the user switches app/tabs/windows/the browser itself loses focus.
428
+ // 2. In Google Chrome, when the focused element is removed from the DOM.
429
+ //
430
+ // We let the browser do its thing here because:
431
+ //
432
+ // 1. The browser already keeps a memory of what's focused for when the page gets refocused.
433
+ // 2. In Google Chrome, if we try to focus the deleted focused element (as per below), it
434
+ // throws the CPU to 100%, so we avoid doing anything for this reason here too.
435
+ if (relatedTarget === null) return; // If the focus has moved to an actual legitimate element (`relatedTarget !== null`)
436
+ // that is outside the container, we move focus to the last valid focused element inside.
437
+ if (!container1.contains(relatedTarget)) $d3863c46a17e8a28$var$focus(lastFocusedElementRef.current, {
438
+ select: true
439
+ });
440
+ } // When the focused element gets removed from the DOM, browsers move focus
441
+ // back to the document.body. In this case, we move focus to the container
442
+ // to keep focus trapped correctly.
443
+ function handleMutations(mutations) {
444
+ const focusedElement = document.activeElement;
445
+ if (focusedElement !== document.body) return;
446
+ for (const mutation of mutations)if (mutation.removedNodes.length > 0) $d3863c46a17e8a28$var$focus(container1);
447
+ }
448
+ document.addEventListener('focusin', handleFocusIn);
449
+ document.addEventListener('focusout', handleFocusOut);
450
+ const mutationObserver = new MutationObserver(handleMutations);
451
+ if (container1) mutationObserver.observe(container1, {
452
+ childList: true,
453
+ subtree: true
454
+ });
455
+ return ()=>{
456
+ document.removeEventListener('focusin', handleFocusIn);
457
+ document.removeEventListener('focusout', handleFocusOut);
458
+ mutationObserver.disconnect();
459
+ };
460
+ }
461
+ }, [
462
+ trapped,
463
+ container1,
464
+ focusScope.paused
465
+ ]);
466
+ useEffect(()=>{
467
+ if (container1) {
468
+ $d3863c46a17e8a28$var$focusScopesStack.add(focusScope);
469
+ const previouslyFocusedElement = document.activeElement;
470
+ const hasFocusedCandidate = container1.contains(previouslyFocusedElement);
471
+ if (!hasFocusedCandidate) {
472
+ const mountEvent = new CustomEvent($d3863c46a17e8a28$var$AUTOFOCUS_ON_MOUNT, $d3863c46a17e8a28$var$EVENT_OPTIONS);
473
+ container1.addEventListener($d3863c46a17e8a28$var$AUTOFOCUS_ON_MOUNT, onMountAutoFocus);
474
+ container1.dispatchEvent(mountEvent);
475
+ if (!mountEvent.defaultPrevented) {
476
+ $d3863c46a17e8a28$var$focusFirst($d3863c46a17e8a28$var$removeLinks($d3863c46a17e8a28$var$getTabbableCandidates(container1)), {
477
+ select: true
478
+ });
479
+ if (document.activeElement === previouslyFocusedElement) $d3863c46a17e8a28$var$focus(container1);
480
+ }
481
+ }
482
+ return ()=>{
483
+ container1.removeEventListener($d3863c46a17e8a28$var$AUTOFOCUS_ON_MOUNT, onMountAutoFocus); // We hit a react bug (fixed in v17) with focusing in unmount.
484
+ // We need to delay the focus a little to get around it for now.
485
+ // See: https://github.com/facebook/react/issues/17894
486
+ setTimeout(()=>{
487
+ const unmountEvent = new CustomEvent($d3863c46a17e8a28$var$AUTOFOCUS_ON_UNMOUNT, $d3863c46a17e8a28$var$EVENT_OPTIONS);
488
+ container1.addEventListener($d3863c46a17e8a28$var$AUTOFOCUS_ON_UNMOUNT, onUnmountAutoFocus);
489
+ container1.dispatchEvent(unmountEvent);
490
+ if (!unmountEvent.defaultPrevented) $d3863c46a17e8a28$var$focus(previouslyFocusedElement !== null && previouslyFocusedElement !== void 0 ? previouslyFocusedElement : document.body, {
491
+ select: true
492
+ });
493
+ // we need to remove the listener after we `dispatchEvent`
494
+ container1.removeEventListener($d3863c46a17e8a28$var$AUTOFOCUS_ON_UNMOUNT, onUnmountAutoFocus);
495
+ $d3863c46a17e8a28$var$focusScopesStack.remove(focusScope);
496
+ }, 0);
497
+ };
498
+ }
499
+ }, [
500
+ container1,
501
+ onMountAutoFocus,
502
+ onUnmountAutoFocus,
503
+ focusScope
504
+ ]); // Takes care of looping focus (when tabbing whilst at the edges)
505
+ const handleKeyDown = useCallback((event)=>{
506
+ if (!loop && !trapped) return;
507
+ if (focusScope.paused) return;
508
+ const isTabKey = event.key === 'Tab' && !event.altKey && !event.ctrlKey && !event.metaKey;
509
+ const focusedElement = document.activeElement;
510
+ if (isTabKey && focusedElement) {
511
+ const container = event.currentTarget;
512
+ const [first, last] = $d3863c46a17e8a28$var$getTabbableEdges(container);
513
+ const hasTabbableElementsInside = first && last; // we can only wrap focus if we have tabbable edges
514
+ if (!hasTabbableElementsInside) {
515
+ if (focusedElement === container) event.preventDefault();
516
+ } else {
517
+ if (!event.shiftKey && focusedElement === last) {
518
+ event.preventDefault();
519
+ if (loop) $d3863c46a17e8a28$var$focus(first, {
520
+ select: true
521
+ });
522
+ } else if (event.shiftKey && focusedElement === first) {
523
+ event.preventDefault();
524
+ if (loop) $d3863c46a17e8a28$var$focus(last, {
525
+ select: true
526
+ });
527
+ }
528
+ }
529
+ }
530
+ }, [
531
+ loop,
532
+ trapped,
533
+ focusScope.paused
534
+ ]);
535
+ return /*#__PURE__*/ createElement($8927f6f2acc4f386$export$250ffa63cdc0d034.div, _extends({
536
+ tabIndex: -1
537
+ }, scopeProps, {
538
+ ref: composedRefs,
539
+ onKeyDown: handleKeyDown
540
+ }));
541
+ });
542
+ /* -------------------------------------------------------------------------------------------------
543
+ * Utils
544
+ * -----------------------------------------------------------------------------------------------*/ /**
545
+ * Attempts focusing the first element in a list of candidates.
546
+ * Stops when focus has actually moved.
547
+ */ function $d3863c46a17e8a28$var$focusFirst(candidates, { select: select = false } = {}) {
548
+ const previouslyFocusedElement = document.activeElement;
549
+ for (const candidate of candidates){
550
+ $d3863c46a17e8a28$var$focus(candidate, {
551
+ select: select
552
+ });
553
+ if (document.activeElement !== previouslyFocusedElement) return;
554
+ }
555
+ }
556
+ /**
557
+ * Returns the first and last tabbable elements inside a container.
558
+ */ function $d3863c46a17e8a28$var$getTabbableEdges(container) {
559
+ const candidates = $d3863c46a17e8a28$var$getTabbableCandidates(container);
560
+ const first = $d3863c46a17e8a28$var$findVisible(candidates, container);
561
+ const last = $d3863c46a17e8a28$var$findVisible(candidates.reverse(), container);
562
+ return [
563
+ first,
564
+ last
565
+ ];
566
+ }
567
+ /**
568
+ * Returns a list of potential tabbable candidates.
569
+ *
570
+ * NOTE: This is only a close approximation. For example it doesn't take into account cases like when
571
+ * elements are not visible. This cannot be worked out easily by just reading a property, but rather
572
+ * necessitate runtime knowledge (computed styles, etc). We deal with these cases separately.
573
+ *
574
+ * See: https://developer.mozilla.org/en-US/docs/Web/API/TreeWalker
575
+ * Credit: https://github.com/discord/focus-layers/blob/master/src/util/wrapFocus.tsx#L1
576
+ */ function $d3863c46a17e8a28$var$getTabbableCandidates(container) {
577
+ const nodes = [];
578
+ const walker = document.createTreeWalker(container, NodeFilter.SHOW_ELEMENT, {
579
+ acceptNode: (node)=>{
580
+ const isHiddenInput = node.tagName === 'INPUT' && node.type === 'hidden';
581
+ if (node.disabled || node.hidden || isHiddenInput) return NodeFilter.FILTER_SKIP; // `.tabIndex` is not the same as the `tabindex` attribute. It works on the
582
+ // runtime's understanding of tabbability, so this automatically accounts
583
+ // for any kind of element that could be tabbed to.
584
+ return node.tabIndex >= 0 ? NodeFilter.FILTER_ACCEPT : NodeFilter.FILTER_SKIP;
585
+ }
586
+ });
587
+ while(walker.nextNode())nodes.push(walker.currentNode); // we do not take into account the order of nodes with positive `tabIndex` as it
588
+ // hinders accessibility to have tab order different from visual order.
589
+ return nodes;
590
+ }
591
+ /**
592
+ * Returns the first visible element in a list.
593
+ * NOTE: Only checks visibility up to the `container`.
594
+ */ function $d3863c46a17e8a28$var$findVisible(elements, container) {
595
+ for (const element of elements){
596
+ // we stop checking if it's hidden at the `container` level (excluding)
597
+ if (!$d3863c46a17e8a28$var$isHidden(element, {
598
+ upTo: container
599
+ })) return element;
600
+ }
601
+ }
602
+ function $d3863c46a17e8a28$var$isHidden(node, { upTo: upTo }) {
603
+ if (getComputedStyle(node).visibility === 'hidden') return true;
604
+ while(node){
605
+ // we stop at `upTo` (excluding it)
606
+ if (upTo !== undefined && node === upTo) return false;
607
+ if (getComputedStyle(node).display === 'none') return true;
608
+ node = node.parentElement;
609
+ }
610
+ return false;
611
+ }
612
+ function $d3863c46a17e8a28$var$isSelectableInput(element) {
613
+ return element instanceof HTMLInputElement && 'select' in element;
614
+ }
615
+ function $d3863c46a17e8a28$var$focus(element, { select: select = false } = {}) {
616
+ // only focus if that element is focusable
617
+ if (element && element.focus) {
618
+ const previouslyFocusedElement = document.activeElement; // NOTE: we prevent scrolling on focus, to minimize jarring transitions for users
619
+ element.focus({
620
+ preventScroll: true
621
+ }); // only select if its not the same element, it supports selection and we need to select
622
+ if (element !== previouslyFocusedElement && $d3863c46a17e8a28$var$isSelectableInput(element) && select) element.select();
623
+ }
624
+ }
625
+ /* -------------------------------------------------------------------------------------------------
626
+ * FocusScope stack
627
+ * -----------------------------------------------------------------------------------------------*/ const $d3863c46a17e8a28$var$focusScopesStack = $d3863c46a17e8a28$var$createFocusScopesStack();
628
+ function $d3863c46a17e8a28$var$createFocusScopesStack() {
629
+ /** A stack of focus scopes, with the active one at the top */ let stack = [];
630
+ return {
631
+ add (focusScope) {
632
+ // pause the currently active focus scope (at the top of the stack)
633
+ const activeFocusScope = stack[0];
634
+ if (focusScope !== activeFocusScope) activeFocusScope === null || activeFocusScope === void 0 || activeFocusScope.pause();
635
+ // remove in case it already exists (because we'll re-add it at the top of the stack)
636
+ stack = $d3863c46a17e8a28$var$arrayRemove(stack, focusScope);
637
+ stack.unshift(focusScope);
638
+ },
639
+ remove (focusScope) {
640
+ var _stack$;
641
+ stack = $d3863c46a17e8a28$var$arrayRemove(stack, focusScope);
642
+ (_stack$ = stack[0]) === null || _stack$ === void 0 || _stack$.resume();
643
+ }
644
+ };
645
+ }
646
+ function $d3863c46a17e8a28$var$arrayRemove(array, item) {
647
+ const updatedArray = [
648
+ ...array
649
+ ];
650
+ const index = updatedArray.indexOf(item);
651
+ if (index !== -1) updatedArray.splice(index, 1);
652
+ return updatedArray;
653
+ }
654
+ function $d3863c46a17e8a28$var$removeLinks(items) {
655
+ return items.filter((item)=>item.tagName !== 'A'
656
+ );
657
+ }
658
+
659
+ function $db6c3485150b8e66$export$1ab7ae714698c4b8(element) {
660
+ const [size, setSize] = useState(undefined);
661
+ $9f79659886946c16$export$e5c5a5f917a5871c(()=>{
662
+ if (element) {
663
+ // provide size as early as possible
664
+ setSize({
665
+ width: element.offsetWidth,
666
+ height: element.offsetHeight
667
+ });
668
+ const resizeObserver = new ResizeObserver((entries)=>{
669
+ if (!Array.isArray(entries)) return;
670
+ // Since we only observe the one element, we don't need to loop over the
671
+ // array
672
+ if (!entries.length) return;
673
+ const entry = entries[0];
674
+ let width;
675
+ let height;
676
+ if ('borderBoxSize' in entry) {
677
+ const borderSizeEntry = entry['borderBoxSize']; // iron out differences between browsers
678
+ const borderSize = Array.isArray(borderSizeEntry) ? borderSizeEntry[0] : borderSizeEntry;
679
+ width = borderSize['inlineSize'];
680
+ height = borderSize['blockSize'];
681
+ } else {
682
+ // for browsers that don't support `borderBoxSize`
683
+ // we calculate it ourselves to get the correct border box.
684
+ width = element.offsetWidth;
685
+ height = element.offsetHeight;
686
+ }
687
+ setSize({
688
+ width: width,
689
+ height: height
690
+ });
691
+ });
692
+ resizeObserver.observe(element, {
693
+ box: 'border-box'
694
+ });
695
+ return ()=>resizeObserver.unobserve(element)
696
+ ;
697
+ } else // We only want to reset to `undefined` when the element becomes `null`,
698
+ // not if it changes to another element.
699
+ setSize(undefined);
700
+ }, [
701
+ element
702
+ ]);
703
+ return size;
704
+ }
705
+
706
+ /* -------------------------------------------------------------------------------------------------
707
+ * Popper
708
+ * -----------------------------------------------------------------------------------------------*/ const $cf1ac5d9fe0e8206$var$POPPER_NAME = 'Popper';
709
+ const [$cf1ac5d9fe0e8206$var$createPopperContext, $cf1ac5d9fe0e8206$export$722aac194ae923] = $c512c27ab02ef895$export$50c7b4e9d9f19c1($cf1ac5d9fe0e8206$var$POPPER_NAME);
710
+ const [$cf1ac5d9fe0e8206$var$PopperProvider, $cf1ac5d9fe0e8206$var$usePopperContext] = $cf1ac5d9fe0e8206$var$createPopperContext($cf1ac5d9fe0e8206$var$POPPER_NAME);
711
+ const $cf1ac5d9fe0e8206$export$badac9ada3a0bdf9 = (props)=>{
712
+ const { __scopePopper: __scopePopper , children: children } = props;
713
+ const [anchor, setAnchor] = useState(null);
714
+ return /*#__PURE__*/ createElement($cf1ac5d9fe0e8206$var$PopperProvider, {
715
+ scope: __scopePopper,
716
+ anchor: anchor,
717
+ onAnchorChange: setAnchor
718
+ }, children);
719
+ };
720
+ /* -------------------------------------------------------------------------------------------------
721
+ * PopperAnchor
722
+ * -----------------------------------------------------------------------------------------------*/ const $cf1ac5d9fe0e8206$var$ANCHOR_NAME = 'PopperAnchor';
723
+ const $cf1ac5d9fe0e8206$export$ecd4e1ccab6ed6d = /*#__PURE__*/ forwardRef((props, forwardedRef)=>{
724
+ const { __scopePopper: __scopePopper , virtualRef: virtualRef , ...anchorProps } = props;
725
+ const context = $cf1ac5d9fe0e8206$var$usePopperContext($cf1ac5d9fe0e8206$var$ANCHOR_NAME, __scopePopper);
726
+ const ref = useRef(null);
727
+ const composedRefs = $6ed0406888f73fc4$export$c7b2cbe3552a0d05(forwardedRef, ref);
728
+ useEffect(()=>{
729
+ // Consumer can anchor the popper to something that isn't
730
+ // a DOM node e.g. pointer position, so we override the
731
+ // `anchorRef` with their virtual ref in this case.
732
+ context.onAnchorChange((virtualRef === null || virtualRef === void 0 ? void 0 : virtualRef.current) || ref.current);
733
+ });
734
+ return virtualRef ? null : /*#__PURE__*/ createElement($8927f6f2acc4f386$export$250ffa63cdc0d034.div, _extends({}, anchorProps, {
735
+ ref: composedRefs
736
+ }));
737
+ });
738
+ /* -------------------------------------------------------------------------------------------------
739
+ * PopperContent
740
+ * -----------------------------------------------------------------------------------------------*/ const $cf1ac5d9fe0e8206$var$CONTENT_NAME = 'PopperContent';
741
+ const [$cf1ac5d9fe0e8206$var$PopperContentProvider, $cf1ac5d9fe0e8206$var$useContentContext] = $cf1ac5d9fe0e8206$var$createPopperContext($cf1ac5d9fe0e8206$var$CONTENT_NAME);
742
+ const $cf1ac5d9fe0e8206$export$bc4ae5855d3c4fc = /*#__PURE__*/ forwardRef((props, forwardedRef)=>{
743
+ var _arrowSize$width, _arrowSize$height, _middlewareData$arrow, _middlewareData$arrow2, _middlewareData$arrow3, _middlewareData$trans, _middlewareData$trans2, _middlewareData$hide;
744
+ const { __scopePopper: __scopePopper , side: side = 'bottom' , sideOffset: sideOffset = 0 , align: align = 'center' , alignOffset: alignOffset = 0 , arrowPadding: arrowPadding = 0 , avoidCollisions: avoidCollisions = true , collisionBoundary: collisionBoundary = [] , collisionPadding: collisionPaddingProp = 0 , sticky: sticky = 'partial' , hideWhenDetached: hideWhenDetached = false , updatePositionStrategy: updatePositionStrategy = 'optimized' , onPlaced: onPlaced , ...contentProps } = props;
745
+ const context = $cf1ac5d9fe0e8206$var$usePopperContext($cf1ac5d9fe0e8206$var$CONTENT_NAME, __scopePopper);
746
+ const [content, setContent] = useState(null);
747
+ const composedRefs = $6ed0406888f73fc4$export$c7b2cbe3552a0d05(forwardedRef, (node)=>setContent(node)
748
+ );
749
+ const [arrow$1, setArrow] = useState(null);
750
+ const arrowSize = $db6c3485150b8e66$export$1ab7ae714698c4b8(arrow$1);
751
+ const arrowWidth = (_arrowSize$width = arrowSize === null || arrowSize === void 0 ? void 0 : arrowSize.width) !== null && _arrowSize$width !== void 0 ? _arrowSize$width : 0;
752
+ const arrowHeight = (_arrowSize$height = arrowSize === null || arrowSize === void 0 ? void 0 : arrowSize.height) !== null && _arrowSize$height !== void 0 ? _arrowSize$height : 0;
753
+ const desiredPlacement = side + (align !== 'center' ? '-' + align : '');
754
+ const collisionPadding = typeof collisionPaddingProp === 'number' ? collisionPaddingProp : {
755
+ top: 0,
756
+ right: 0,
757
+ bottom: 0,
758
+ left: 0,
759
+ ...collisionPaddingProp
760
+ };
761
+ const boundary = Array.isArray(collisionBoundary) ? collisionBoundary : [
762
+ collisionBoundary
763
+ ];
764
+ const hasExplicitBoundaries = boundary.length > 0;
765
+ const detectOverflowOptions = {
766
+ padding: collisionPadding,
767
+ boundary: boundary.filter($cf1ac5d9fe0e8206$var$isNotNull),
768
+ // with `strategy: 'fixed'`, this is the only way to get it to respect boundaries
769
+ altBoundary: hasExplicitBoundaries
770
+ };
771
+ const { refs: refs , floatingStyles: floatingStyles , placement: placement , isPositioned: isPositioned , middlewareData: middlewareData } = useFloating({
772
+ // default to `fixed` strategy so users don't have to pick and we also avoid focus scroll issues
773
+ strategy: 'fixed',
774
+ placement: desiredPlacement,
775
+ whileElementsMounted: (...args)=>{
776
+ const cleanup = autoUpdate(...args, {
777
+ animationFrame: updatePositionStrategy === 'always'
778
+ });
779
+ return cleanup;
780
+ },
781
+ elements: {
782
+ reference: context.anchor
783
+ },
784
+ middleware: [
785
+ offset({
786
+ mainAxis: sideOffset + arrowHeight,
787
+ alignmentAxis: alignOffset
788
+ }),
789
+ avoidCollisions && shift({
790
+ mainAxis: true,
791
+ crossAxis: false,
792
+ limiter: sticky === 'partial' ? limitShift() : undefined,
793
+ ...detectOverflowOptions
794
+ }),
795
+ avoidCollisions && flip({
796
+ ...detectOverflowOptions
797
+ }),
798
+ size({
799
+ ...detectOverflowOptions,
800
+ apply: ({ elements: elements , rects: rects , availableWidth: availableWidth , availableHeight: availableHeight })=>{
801
+ const { width: anchorWidth , height: anchorHeight } = rects.reference;
802
+ const contentStyle = elements.floating.style;
803
+ contentStyle.setProperty('--radix-popper-available-width', `${availableWidth}px`);
804
+ contentStyle.setProperty('--radix-popper-available-height', `${availableHeight}px`);
805
+ contentStyle.setProperty('--radix-popper-anchor-width', `${anchorWidth}px`);
806
+ contentStyle.setProperty('--radix-popper-anchor-height', `${anchorHeight}px`);
807
+ }
808
+ }),
809
+ arrow$1 && arrow({
810
+ element: arrow$1,
811
+ padding: arrowPadding
812
+ }),
813
+ $cf1ac5d9fe0e8206$var$transformOrigin({
814
+ arrowWidth: arrowWidth,
815
+ arrowHeight: arrowHeight
816
+ }),
817
+ hideWhenDetached && hide({
818
+ strategy: 'referenceHidden',
819
+ ...detectOverflowOptions
820
+ })
821
+ ]
822
+ });
823
+ const [placedSide, placedAlign] = $cf1ac5d9fe0e8206$var$getSideAndAlignFromPlacement(placement);
824
+ const handlePlaced = $b1b2314f5f9a1d84$export$25bec8c6f54ee79a(onPlaced);
825
+ $9f79659886946c16$export$e5c5a5f917a5871c(()=>{
826
+ if (isPositioned) handlePlaced === null || handlePlaced === void 0 || handlePlaced();
827
+ }, [
828
+ isPositioned,
829
+ handlePlaced
830
+ ]);
831
+ const arrowX = (_middlewareData$arrow = middlewareData.arrow) === null || _middlewareData$arrow === void 0 ? void 0 : _middlewareData$arrow.x;
832
+ const arrowY = (_middlewareData$arrow2 = middlewareData.arrow) === null || _middlewareData$arrow2 === void 0 ? void 0 : _middlewareData$arrow2.y;
833
+ const cannotCenterArrow = ((_middlewareData$arrow3 = middlewareData.arrow) === null || _middlewareData$arrow3 === void 0 ? void 0 : _middlewareData$arrow3.centerOffset) !== 0;
834
+ const [contentZIndex, setContentZIndex] = useState();
835
+ $9f79659886946c16$export$e5c5a5f917a5871c(()=>{
836
+ if (content) setContentZIndex(window.getComputedStyle(content).zIndex);
837
+ }, [
838
+ content
839
+ ]);
840
+ return /*#__PURE__*/ createElement("div", {
841
+ ref: refs.setFloating,
842
+ "data-radix-popper-content-wrapper": "",
843
+ style: {
844
+ ...floatingStyles,
845
+ transform: isPositioned ? floatingStyles.transform : 'translate(0, -200%)',
846
+ // keep off the page when measuring
847
+ minWidth: 'max-content',
848
+ zIndex: contentZIndex,
849
+ ['--radix-popper-transform-origin']: [
850
+ (_middlewareData$trans = middlewareData.transformOrigin) === null || _middlewareData$trans === void 0 ? void 0 : _middlewareData$trans.x,
851
+ (_middlewareData$trans2 = middlewareData.transformOrigin) === null || _middlewareData$trans2 === void 0 ? void 0 : _middlewareData$trans2.y
852
+ ].join(' ')
853
+ } // Floating UI interally calculates logical alignment based the `dir` attribute on
854
+ ,
855
+ dir: props.dir
856
+ }, /*#__PURE__*/ createElement($cf1ac5d9fe0e8206$var$PopperContentProvider, {
857
+ scope: __scopePopper,
858
+ placedSide: placedSide,
859
+ onArrowChange: setArrow,
860
+ arrowX: arrowX,
861
+ arrowY: arrowY,
862
+ shouldHideArrow: cannotCenterArrow
863
+ }, /*#__PURE__*/ createElement($8927f6f2acc4f386$export$250ffa63cdc0d034.div, _extends({
864
+ "data-side": placedSide,
865
+ "data-align": placedAlign
866
+ }, contentProps, {
867
+ ref: composedRefs,
868
+ style: {
869
+ ...contentProps.style,
870
+ // if the PopperContent hasn't been placed yet (not all measurements done)
871
+ // we prevent animations so that users's animation don't kick in too early referring wrong sides
872
+ animation: !isPositioned ? 'none' : undefined,
873
+ // hide the content if using the hide middleware and should be hidden
874
+ opacity: (_middlewareData$hide = middlewareData.hide) !== null && _middlewareData$hide !== void 0 && _middlewareData$hide.referenceHidden ? 0 : undefined
875
+ }
876
+ }))));
877
+ });
878
+ /* -----------------------------------------------------------------------------------------------*/ function $cf1ac5d9fe0e8206$var$isNotNull(value) {
879
+ return value !== null;
880
+ }
881
+ const $cf1ac5d9fe0e8206$var$transformOrigin = (options)=>({
882
+ name: 'transformOrigin',
883
+ options: options,
884
+ fn (data) {
885
+ var _middlewareData$arrow4, _middlewareData$arrow5, _middlewareData$arrow6, _middlewareData$arrow7, _middlewareData$arrow8;
886
+ const { placement: placement , rects: rects , middlewareData: middlewareData } = data;
887
+ const cannotCenterArrow = ((_middlewareData$arrow4 = middlewareData.arrow) === null || _middlewareData$arrow4 === void 0 ? void 0 : _middlewareData$arrow4.centerOffset) !== 0;
888
+ const isArrowHidden = cannotCenterArrow;
889
+ const arrowWidth = isArrowHidden ? 0 : options.arrowWidth;
890
+ const arrowHeight = isArrowHidden ? 0 : options.arrowHeight;
891
+ const [placedSide, placedAlign] = $cf1ac5d9fe0e8206$var$getSideAndAlignFromPlacement(placement);
892
+ const noArrowAlign = {
893
+ start: '0%',
894
+ center: '50%',
895
+ end: '100%'
896
+ }[placedAlign];
897
+ const arrowXCenter = ((_middlewareData$arrow5 = (_middlewareData$arrow6 = middlewareData.arrow) === null || _middlewareData$arrow6 === void 0 ? void 0 : _middlewareData$arrow6.x) !== null && _middlewareData$arrow5 !== void 0 ? _middlewareData$arrow5 : 0) + arrowWidth / 2;
898
+ const arrowYCenter = ((_middlewareData$arrow7 = (_middlewareData$arrow8 = middlewareData.arrow) === null || _middlewareData$arrow8 === void 0 ? void 0 : _middlewareData$arrow8.y) !== null && _middlewareData$arrow7 !== void 0 ? _middlewareData$arrow7 : 0) + arrowHeight / 2;
899
+ let x = '';
900
+ let y = '';
901
+ if (placedSide === 'bottom') {
902
+ x = isArrowHidden ? noArrowAlign : `${arrowXCenter}px`;
903
+ y = `${-arrowHeight}px`;
904
+ } else if (placedSide === 'top') {
905
+ x = isArrowHidden ? noArrowAlign : `${arrowXCenter}px`;
906
+ y = `${rects.floating.height + arrowHeight}px`;
907
+ } else if (placedSide === 'right') {
908
+ x = `${-arrowHeight}px`;
909
+ y = isArrowHidden ? noArrowAlign : `${arrowYCenter}px`;
910
+ } else if (placedSide === 'left') {
911
+ x = `${rects.floating.width + arrowHeight}px`;
912
+ y = isArrowHidden ? noArrowAlign : `${arrowYCenter}px`;
913
+ }
914
+ return {
915
+ data: {
916
+ x: x,
917
+ y: y
918
+ }
919
+ };
920
+ }
921
+ })
922
+ ;
923
+ function $cf1ac5d9fe0e8206$var$getSideAndAlignFromPlacement(placement) {
924
+ const [side, align = 'center'] = placement.split('-');
925
+ return [
926
+ side,
927
+ align
928
+ ];
929
+ }
930
+ const $cf1ac5d9fe0e8206$export$be92b6f5f03c0fe9 = $cf1ac5d9fe0e8206$export$badac9ada3a0bdf9;
931
+ const $cf1ac5d9fe0e8206$export$b688253958b8dfe7 = $cf1ac5d9fe0e8206$export$ecd4e1ccab6ed6d;
932
+ const $cf1ac5d9fe0e8206$export$7c6e2c02157bb7d2 = $cf1ac5d9fe0e8206$export$bc4ae5855d3c4fc;
933
+
934
+ const $f1701beae083dbae$export$602eac185826482c = /*#__PURE__*/ forwardRef((props, forwardedRef)=>{
935
+ var _globalThis$document;
936
+ const { container: container = globalThis === null || globalThis === void 0 ? void 0 : (_globalThis$document = globalThis.document) === null || _globalThis$document === void 0 ? void 0 : _globalThis$document.body , ...portalProps } = props;
937
+ return container ? /*#__PURE__*/ ReactDOM__default.createPortal(/*#__PURE__*/ createElement($8927f6f2acc4f386$export$250ffa63cdc0d034.div, _extends({}, portalProps, {
938
+ ref: forwardedRef
939
+ })), container) : null;
940
+ });
941
+
942
+ var getDefaultParent = function (originalTarget) {
943
+ if (typeof document === 'undefined') {
944
+ return null;
945
+ }
946
+ var sampleTarget = Array.isArray(originalTarget) ? originalTarget[0] : originalTarget;
947
+ return sampleTarget.ownerDocument.body;
948
+ };
949
+ var counterMap = new WeakMap();
950
+ var uncontrolledNodes = new WeakMap();
951
+ var markerMap = {};
952
+ var lockCount = 0;
953
+ var unwrapHost = function (node) {
954
+ return node && (node.host || unwrapHost(node.parentNode));
955
+ };
956
+ var correctTargets = function (parent, targets) {
957
+ return targets
958
+ .map(function (target) {
959
+ if (parent.contains(target)) {
960
+ return target;
961
+ }
962
+ var correctedTarget = unwrapHost(target);
963
+ if (correctedTarget && parent.contains(correctedTarget)) {
964
+ return correctedTarget;
965
+ }
966
+ console.error('aria-hidden', target, 'in not contained inside', parent, '. Doing nothing');
967
+ return null;
968
+ })
969
+ .filter(function (x) { return Boolean(x); });
970
+ };
971
+ /**
972
+ * Marks everything except given node(or nodes) as aria-hidden
973
+ * @param {Element | Element[]} originalTarget - elements to keep on the page
974
+ * @param [parentNode] - top element, defaults to document.body
975
+ * @param {String} [markerName] - a special attribute to mark every node
976
+ * @param {String} [controlAttribute] - html Attribute to control
977
+ * @return {Undo} undo command
978
+ */
979
+ var applyAttributeToOthers = function (originalTarget, parentNode, markerName, controlAttribute) {
980
+ var targets = correctTargets(parentNode, Array.isArray(originalTarget) ? originalTarget : [originalTarget]);
981
+ if (!markerMap[markerName]) {
982
+ markerMap[markerName] = new WeakMap();
983
+ }
984
+ var markerCounter = markerMap[markerName];
985
+ var hiddenNodes = [];
986
+ var elementsToKeep = new Set();
987
+ var elementsToStop = new Set(targets);
988
+ var keep = function (el) {
989
+ if (!el || elementsToKeep.has(el)) {
990
+ return;
991
+ }
992
+ elementsToKeep.add(el);
993
+ keep(el.parentNode);
994
+ };
995
+ targets.forEach(keep);
996
+ var deep = function (parent) {
997
+ if (!parent || elementsToStop.has(parent)) {
998
+ return;
999
+ }
1000
+ Array.prototype.forEach.call(parent.children, function (node) {
1001
+ if (elementsToKeep.has(node)) {
1002
+ deep(node);
1003
+ }
1004
+ else {
1005
+ var attr = node.getAttribute(controlAttribute);
1006
+ var alreadyHidden = attr !== null && attr !== 'false';
1007
+ var counterValue = (counterMap.get(node) || 0) + 1;
1008
+ var markerValue = (markerCounter.get(node) || 0) + 1;
1009
+ counterMap.set(node, counterValue);
1010
+ markerCounter.set(node, markerValue);
1011
+ hiddenNodes.push(node);
1012
+ if (counterValue === 1 && alreadyHidden) {
1013
+ uncontrolledNodes.set(node, true);
1014
+ }
1015
+ if (markerValue === 1) {
1016
+ node.setAttribute(markerName, 'true');
1017
+ }
1018
+ if (!alreadyHidden) {
1019
+ node.setAttribute(controlAttribute, 'true');
1020
+ }
1021
+ }
1022
+ });
1023
+ };
1024
+ deep(parentNode);
1025
+ elementsToKeep.clear();
1026
+ lockCount++;
1027
+ return function () {
1028
+ hiddenNodes.forEach(function (node) {
1029
+ var counterValue = counterMap.get(node) - 1;
1030
+ var markerValue = markerCounter.get(node) - 1;
1031
+ counterMap.set(node, counterValue);
1032
+ markerCounter.set(node, markerValue);
1033
+ if (!counterValue) {
1034
+ if (!uncontrolledNodes.has(node)) {
1035
+ node.removeAttribute(controlAttribute);
1036
+ }
1037
+ uncontrolledNodes.delete(node);
1038
+ }
1039
+ if (!markerValue) {
1040
+ node.removeAttribute(markerName);
1041
+ }
1042
+ });
1043
+ lockCount--;
1044
+ if (!lockCount) {
1045
+ // clear
1046
+ counterMap = new WeakMap();
1047
+ counterMap = new WeakMap();
1048
+ uncontrolledNodes = new WeakMap();
1049
+ markerMap = {};
1050
+ }
1051
+ };
1052
+ };
1053
+ /**
1054
+ * Marks everything except given node(or nodes) as aria-hidden
1055
+ * @param {Element | Element[]} originalTarget - elements to keep on the page
1056
+ * @param [parentNode] - top element, defaults to document.body
1057
+ * @param {String} [markerName] - a special attribute to mark every node
1058
+ * @return {Undo} undo command
1059
+ */
1060
+ var hideOthers = function (originalTarget, parentNode, markerName) {
1061
+ if (markerName === void 0) { markerName = 'data-aria-hidden'; }
1062
+ var targets = Array.from(Array.isArray(originalTarget) ? originalTarget : [originalTarget]);
1063
+ var activeParentNode = parentNode || getDefaultParent(originalTarget);
1064
+ if (!activeParentNode) {
1065
+ return function () { return null; };
1066
+ }
1067
+ // we should not hide ariaLive elements - https://github.com/theKashey/aria-hidden/issues/10
1068
+ targets.push.apply(targets, Array.from(activeParentNode.querySelectorAll('[aria-live]')));
1069
+ return applyAttributeToOthers(targets, activeParentNode, markerName, 'aria-hidden');
1070
+ };
1071
+
1072
+ var effectCar = createSidecarMedium();
1073
+
1074
+ var nothing = function () {
1075
+ return;
1076
+ };
1077
+ /**
1078
+ * Removes scrollbar from the page and contain the scroll within the Lock
1079
+ */
1080
+ var RemoveScroll = React.forwardRef(function (props, parentRef) {
1081
+ var ref = React.useRef(null);
1082
+ var _a = React.useState({
1083
+ onScrollCapture: nothing,
1084
+ onWheelCapture: nothing,
1085
+ onTouchMoveCapture: nothing,
1086
+ }), callbacks = _a[0], setCallbacks = _a[1];
1087
+ var forwardProps = props.forwardProps, children = props.children, className = props.className, removeScrollBar = props.removeScrollBar, enabled = props.enabled, shards = props.shards, sideCar = props.sideCar, noIsolation = props.noIsolation, inert = props.inert, allowPinchZoom = props.allowPinchZoom, _b = props.as, Container = _b === void 0 ? 'div' : _b, rest = __rest(props, ["forwardProps", "children", "className", "removeScrollBar", "enabled", "shards", "sideCar", "noIsolation", "inert", "allowPinchZoom", "as"]);
1088
+ var SideCar = sideCar;
1089
+ var containerRef = useMergeRefs([ref, parentRef]);
1090
+ var containerProps = __assign(__assign({}, rest), callbacks);
1091
+ return (React.createElement(React.Fragment, null,
1092
+ enabled && (React.createElement(SideCar, { sideCar: effectCar, removeScrollBar: removeScrollBar, shards: shards, noIsolation: noIsolation, inert: inert, setCallbacks: setCallbacks, allowPinchZoom: !!allowPinchZoom, lockRef: ref })),
1093
+ forwardProps ? (React.cloneElement(React.Children.only(children), __assign(__assign({}, containerProps), { ref: containerRef }))) : (React.createElement(Container, __assign({}, containerProps, { className: className, ref: containerRef }), children))));
1094
+ });
1095
+ RemoveScroll.defaultProps = {
1096
+ enabled: true,
1097
+ removeScrollBar: true,
1098
+ inert: false,
1099
+ };
1100
+ RemoveScroll.classNames = {
1101
+ fullWidth: fullWidthClassName,
1102
+ zeroRight: zeroRightClassName,
1103
+ };
1104
+
1105
+ var passiveSupported = false;
1106
+ if (typeof window !== 'undefined') {
1107
+ try {
1108
+ var options = Object.defineProperty({}, 'passive', {
1109
+ get: function () {
1110
+ passiveSupported = true;
1111
+ return true;
1112
+ },
1113
+ });
1114
+ // @ts-ignore
1115
+ window.addEventListener('test', options, options);
1116
+ // @ts-ignore
1117
+ window.removeEventListener('test', options, options);
1118
+ }
1119
+ catch (err) {
1120
+ passiveSupported = false;
1121
+ }
1122
+ }
1123
+ var nonPassive = passiveSupported ? { passive: false } : false;
1124
+
1125
+ var alwaysContainsScroll = function (node) {
1126
+ // textarea will always _contain_ scroll inside self. It only can be hidden
1127
+ return node.tagName === 'TEXTAREA';
1128
+ };
1129
+ var elementCanBeScrolled = function (node, overflow) {
1130
+ var styles = window.getComputedStyle(node);
1131
+ return (
1132
+ // not-not-scrollable
1133
+ styles[overflow] !== 'hidden' &&
1134
+ // contains scroll inside self
1135
+ !(styles.overflowY === styles.overflowX && !alwaysContainsScroll(node) && styles[overflow] === 'visible'));
1136
+ };
1137
+ var elementCouldBeVScrolled = function (node) { return elementCanBeScrolled(node, 'overflowY'); };
1138
+ var elementCouldBeHScrolled = function (node) { return elementCanBeScrolled(node, 'overflowX'); };
1139
+ var locationCouldBeScrolled = function (axis, node) {
1140
+ var current = node;
1141
+ do {
1142
+ // Skip over shadow root
1143
+ if (typeof ShadowRoot !== 'undefined' && current instanceof ShadowRoot) {
1144
+ current = current.host;
1145
+ }
1146
+ var isScrollable = elementCouldBeScrolled(axis, current);
1147
+ if (isScrollable) {
1148
+ var _a = getScrollVariables(axis, current), s = _a[1], d = _a[2];
1149
+ if (s > d) {
1150
+ return true;
1151
+ }
1152
+ }
1153
+ current = current.parentNode;
1154
+ } while (current && current !== document.body);
1155
+ return false;
1156
+ };
1157
+ var getVScrollVariables = function (_a) {
1158
+ var scrollTop = _a.scrollTop, scrollHeight = _a.scrollHeight, clientHeight = _a.clientHeight;
1159
+ return [
1160
+ scrollTop,
1161
+ scrollHeight,
1162
+ clientHeight,
1163
+ ];
1164
+ };
1165
+ var getHScrollVariables = function (_a) {
1166
+ var scrollLeft = _a.scrollLeft, scrollWidth = _a.scrollWidth, clientWidth = _a.clientWidth;
1167
+ return [
1168
+ scrollLeft,
1169
+ scrollWidth,
1170
+ clientWidth,
1171
+ ];
1172
+ };
1173
+ var elementCouldBeScrolled = function (axis, node) {
1174
+ return axis === 'v' ? elementCouldBeVScrolled(node) : elementCouldBeHScrolled(node);
1175
+ };
1176
+ var getScrollVariables = function (axis, node) {
1177
+ return axis === 'v' ? getVScrollVariables(node) : getHScrollVariables(node);
1178
+ };
1179
+ var getDirectionFactor = function (axis, direction) {
1180
+ /**
1181
+ * If the element's direction is rtl (right-to-left), then scrollLeft is 0 when the scrollbar is at its rightmost position,
1182
+ * and then increasingly negative as you scroll towards the end of the content.
1183
+ * @see https://developer.mozilla.org/en-US/docs/Web/API/Element/scrollLeft
1184
+ */
1185
+ return axis === 'h' && direction === 'rtl' ? -1 : 1;
1186
+ };
1187
+ var handleScroll = function (axis, endTarget, event, sourceDelta, noOverscroll) {
1188
+ var directionFactor = getDirectionFactor(axis, window.getComputedStyle(endTarget).direction);
1189
+ var delta = directionFactor * sourceDelta;
1190
+ // find scrollable target
1191
+ var target = event.target;
1192
+ var targetInLock = endTarget.contains(target);
1193
+ var shouldCancelScroll = false;
1194
+ var isDeltaPositive = delta > 0;
1195
+ var availableScroll = 0;
1196
+ var availableScrollTop = 0;
1197
+ do {
1198
+ var _a = getScrollVariables(axis, target), position = _a[0], scroll_1 = _a[1], capacity = _a[2];
1199
+ var elementScroll = scroll_1 - capacity - directionFactor * position;
1200
+ if (position || elementScroll) {
1201
+ if (elementCouldBeScrolled(axis, target)) {
1202
+ availableScroll += elementScroll;
1203
+ availableScrollTop += position;
1204
+ }
1205
+ }
1206
+ target = target.parentNode;
1207
+ } while (
1208
+ // portaled content
1209
+ (!targetInLock && target !== document.body) ||
1210
+ // self content
1211
+ (targetInLock && (endTarget.contains(target) || endTarget === target)));
1212
+ if (isDeltaPositive && ((noOverscroll && availableScroll === 0) || (!noOverscroll && delta > availableScroll))) {
1213
+ shouldCancelScroll = true;
1214
+ }
1215
+ else if (!isDeltaPositive &&
1216
+ ((noOverscroll && availableScrollTop === 0) || (!noOverscroll && -delta > availableScrollTop))) {
1217
+ shouldCancelScroll = true;
1218
+ }
1219
+ return shouldCancelScroll;
1220
+ };
1221
+
1222
+ var getTouchXY = function (event) {
1223
+ return 'changedTouches' in event ? [event.changedTouches[0].clientX, event.changedTouches[0].clientY] : [0, 0];
1224
+ };
1225
+ var getDeltaXY = function (event) { return [event.deltaX, event.deltaY]; };
1226
+ var extractRef = function (ref) {
1227
+ return ref && 'current' in ref ? ref.current : ref;
1228
+ };
1229
+ var deltaCompare = function (x, y) { return x[0] === y[0] && x[1] === y[1]; };
1230
+ var generateStyle = function (id) { return "\n .block-interactivity-".concat(id, " {pointer-events: none;}\n .allow-interactivity-").concat(id, " {pointer-events: all;}\n"); };
1231
+ var idCounter = 0;
1232
+ var lockStack = [];
1233
+ function RemoveScrollSideCar(props) {
1234
+ var shouldPreventQueue = React.useRef([]);
1235
+ var touchStartRef = React.useRef([0, 0]);
1236
+ var activeAxis = React.useRef();
1237
+ var id = React.useState(idCounter++)[0];
1238
+ var Style = React.useState(function () { return styleSingleton(); })[0];
1239
+ var lastProps = React.useRef(props);
1240
+ React.useEffect(function () {
1241
+ lastProps.current = props;
1242
+ }, [props]);
1243
+ React.useEffect(function () {
1244
+ if (props.inert) {
1245
+ document.body.classList.add("block-interactivity-".concat(id));
1246
+ var allow_1 = __spreadArray([props.lockRef.current], (props.shards || []).map(extractRef), true).filter(Boolean);
1247
+ allow_1.forEach(function (el) { return el.classList.add("allow-interactivity-".concat(id)); });
1248
+ return function () {
1249
+ document.body.classList.remove("block-interactivity-".concat(id));
1250
+ allow_1.forEach(function (el) { return el.classList.remove("allow-interactivity-".concat(id)); });
1251
+ };
1252
+ }
1253
+ return;
1254
+ }, [props.inert, props.lockRef.current, props.shards]);
1255
+ var shouldCancelEvent = React.useCallback(function (event, parent) {
1256
+ if ('touches' in event && event.touches.length === 2) {
1257
+ return !lastProps.current.allowPinchZoom;
1258
+ }
1259
+ var touch = getTouchXY(event);
1260
+ var touchStart = touchStartRef.current;
1261
+ var deltaX = 'deltaX' in event ? event.deltaX : touchStart[0] - touch[0];
1262
+ var deltaY = 'deltaY' in event ? event.deltaY : touchStart[1] - touch[1];
1263
+ var currentAxis;
1264
+ var target = event.target;
1265
+ var moveDirection = Math.abs(deltaX) > Math.abs(deltaY) ? 'h' : 'v';
1266
+ // allow horizontal touch move on Range inputs. They will not cause any scroll
1267
+ if ('touches' in event && moveDirection === 'h' && target.type === 'range') {
1268
+ return false;
1269
+ }
1270
+ var canBeScrolledInMainDirection = locationCouldBeScrolled(moveDirection, target);
1271
+ if (!canBeScrolledInMainDirection) {
1272
+ return true;
1273
+ }
1274
+ if (canBeScrolledInMainDirection) {
1275
+ currentAxis = moveDirection;
1276
+ }
1277
+ else {
1278
+ currentAxis = moveDirection === 'v' ? 'h' : 'v';
1279
+ canBeScrolledInMainDirection = locationCouldBeScrolled(moveDirection, target);
1280
+ // other axis might be not scrollable
1281
+ }
1282
+ if (!canBeScrolledInMainDirection) {
1283
+ return false;
1284
+ }
1285
+ if (!activeAxis.current && 'changedTouches' in event && (deltaX || deltaY)) {
1286
+ activeAxis.current = currentAxis;
1287
+ }
1288
+ if (!currentAxis) {
1289
+ return true;
1290
+ }
1291
+ var cancelingAxis = activeAxis.current || currentAxis;
1292
+ return handleScroll(cancelingAxis, parent, event, cancelingAxis === 'h' ? deltaX : deltaY, true);
1293
+ }, []);
1294
+ var shouldPrevent = React.useCallback(function (_event) {
1295
+ var event = _event;
1296
+ if (!lockStack.length || lockStack[lockStack.length - 1] !== Style) {
1297
+ // not the last active
1298
+ return;
1299
+ }
1300
+ var delta = 'deltaY' in event ? getDeltaXY(event) : getTouchXY(event);
1301
+ var sourceEvent = shouldPreventQueue.current.filter(function (e) { return e.name === event.type && e.target === event.target && deltaCompare(e.delta, delta); })[0];
1302
+ // self event, and should be canceled
1303
+ if (sourceEvent && sourceEvent.should) {
1304
+ if (event.cancelable) {
1305
+ event.preventDefault();
1306
+ }
1307
+ return;
1308
+ }
1309
+ // outside or shard event
1310
+ if (!sourceEvent) {
1311
+ var shardNodes = (lastProps.current.shards || [])
1312
+ .map(extractRef)
1313
+ .filter(Boolean)
1314
+ .filter(function (node) { return node.contains(event.target); });
1315
+ var shouldStop = shardNodes.length > 0 ? shouldCancelEvent(event, shardNodes[0]) : !lastProps.current.noIsolation;
1316
+ if (shouldStop) {
1317
+ if (event.cancelable) {
1318
+ event.preventDefault();
1319
+ }
1320
+ }
1321
+ }
1322
+ }, []);
1323
+ var shouldCancel = React.useCallback(function (name, delta, target, should) {
1324
+ var event = { name: name, delta: delta, target: target, should: should };
1325
+ shouldPreventQueue.current.push(event);
1326
+ setTimeout(function () {
1327
+ shouldPreventQueue.current = shouldPreventQueue.current.filter(function (e) { return e !== event; });
1328
+ }, 1);
1329
+ }, []);
1330
+ var scrollTouchStart = React.useCallback(function (event) {
1331
+ touchStartRef.current = getTouchXY(event);
1332
+ activeAxis.current = undefined;
1333
+ }, []);
1334
+ var scrollWheel = React.useCallback(function (event) {
1335
+ shouldCancel(event.type, getDeltaXY(event), event.target, shouldCancelEvent(event, props.lockRef.current));
1336
+ }, []);
1337
+ var scrollTouchMove = React.useCallback(function (event) {
1338
+ shouldCancel(event.type, getTouchXY(event), event.target, shouldCancelEvent(event, props.lockRef.current));
1339
+ }, []);
1340
+ React.useEffect(function () {
1341
+ lockStack.push(Style);
1342
+ props.setCallbacks({
1343
+ onScrollCapture: scrollWheel,
1344
+ onWheelCapture: scrollWheel,
1345
+ onTouchMoveCapture: scrollTouchMove,
1346
+ });
1347
+ document.addEventListener('wheel', shouldPrevent, nonPassive);
1348
+ document.addEventListener('touchmove', shouldPrevent, nonPassive);
1349
+ document.addEventListener('touchstart', scrollTouchStart, nonPassive);
1350
+ return function () {
1351
+ lockStack = lockStack.filter(function (inst) { return inst !== Style; });
1352
+ document.removeEventListener('wheel', shouldPrevent, nonPassive);
1353
+ document.removeEventListener('touchmove', shouldPrevent, nonPassive);
1354
+ document.removeEventListener('touchstart', scrollTouchStart, nonPassive);
1355
+ };
1356
+ }, []);
1357
+ var removeScrollBar = props.removeScrollBar, inert = props.inert;
1358
+ return (React.createElement(React.Fragment, null,
1359
+ inert ? React.createElement(Style, { styles: generateStyle(id) }) : null,
1360
+ removeScrollBar ? React.createElement(RemoveScrollBar, { gapMode: "margin" }) : null));
1361
+ }
1362
+
1363
+ var SideCar = exportSidecar(effectCar, RemoveScrollSideCar);
1364
+
1365
+ var ReactRemoveScroll = React.forwardRef(function (props, ref) { return (React.createElement(RemoveScroll, __assign({}, props, { ref: ref, sideCar: SideCar }))); });
1366
+ ReactRemoveScroll.classNames = RemoveScroll.classNames;
1367
+ var $am6gm$RemoveScroll = ReactRemoveScroll;
1368
+
134
1369
  /* -------------------------------------------------------------------------------------------------
135
1370
  * Popover
136
1371
  * -----------------------------------------------------------------------------------------------*/ const $cb5cc270b50c6fcd$var$POPOVER_NAME = 'Popover';
@@ -231,7 +1466,7 @@ const $cb5cc270b50c6fcd$export$d7e1f420b25549ff = /*#__PURE__*/ forwardRef((prop
231
1466
  const content = contentRef.current;
232
1467
  if (content) return hideOthers(content);
233
1468
  }, []);
234
- return /*#__PURE__*/ createElement($01b9c$RemoveScroll, {
1469
+ return /*#__PURE__*/ createElement($am6gm$RemoveScroll, {
235
1470
  as: $5e63c961fc1ce211$export$8c6ed5c666ac1360,
236
1471
  allowPinchZoom: true
237
1472
  }, /*#__PURE__*/ createElement($cb5cc270b50c6fcd$var$PopoverContentImpl, _extends({}, props, {