@react-aria/overlays 3.12.1 → 3.14.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.
@@ -0,0 +1,1457 @@
1
+ import $k7QOs$react, {useState as $k7QOs$useState, useCallback as $k7QOs$useCallback, useRef as $k7QOs$useRef, useEffect as $k7QOs$useEffect, useContext as $k7QOs$useContext, useMemo as $k7QOs$useMemo} from "react";
2
+ import {useLayoutEffect as $k7QOs$useLayoutEffect, useResizeObserver as $k7QOs$useResizeObserver, clamp as $k7QOs$clamp, useId as $k7QOs$useId, isIOS as $k7QOs$isIOS, chain as $k7QOs$chain, getScrollParent as $k7QOs$getScrollParent, useLabels as $k7QOs$useLabels, mergeProps as $k7QOs$mergeProps} from "@react-aria/utils";
3
+ import {useLocale as $k7QOs$useLocale, useLocalizedStringFormatter as $k7QOs$useLocalizedStringFormatter} from "@react-aria/i18n";
4
+ import {isElementInChildOfActiveScope as $k7QOs$isElementInChildOfActiveScope, FocusScope as $k7QOs$FocusScope} from "@react-aria/focus";
5
+ import {useInteractOutside as $k7QOs$useInteractOutside, useFocusWithin as $k7QOs$useFocusWithin} from "@react-aria/interactions";
6
+ import $k7QOs$reactdom from "react-dom";
7
+ import {useIsSSR as $k7QOs$useIsSSR} from "@react-aria/ssr";
8
+ import {VisuallyHidden as $k7QOs$VisuallyHidden} from "@react-aria/visually-hidden";
9
+
10
+ function $parcel$interopDefault(a) {
11
+ return a && a.__esModule ? a.default : a;
12
+ }
13
+ /*
14
+ * Copyright 2020 Adobe. All rights reserved.
15
+ * This file is licensed to you under the Apache License, Version 2.0 (the "License");
16
+ * you may not use this file except in compliance with the License. You may obtain a copy
17
+ * of the License at http://www.apache.org/licenses/LICENSE-2.0
18
+ *
19
+ * Unless required by applicable law or agreed to in writing, software distributed under
20
+ * the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
21
+ * OF ANY KIND, either express or implied. See the License for the specific language
22
+ * governing permissions and limitations under the License.
23
+ */ /*
24
+ * Copyright 2020 Adobe. All rights reserved.
25
+ * This file is licensed to you under the Apache License, Version 2.0 (the "License");
26
+ * you may not use this file except in compliance with the License. You may obtain a copy
27
+ * of the License at http://www.apache.org/licenses/LICENSE-2.0
28
+ *
29
+ * Unless required by applicable law or agreed to in writing, software distributed under
30
+ * the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
31
+ * OF ANY KIND, either express or implied. See the License for the specific language
32
+ * governing permissions and limitations under the License.
33
+ */ /*
34
+ * Copyright 2020 Adobe. All rights reserved.
35
+ * This file is licensed to you under the Apache License, Version 2.0 (the "License");
36
+ * you may not use this file except in compliance with the License. You may obtain a copy
37
+ * of the License at http://www.apache.org/licenses/LICENSE-2.0
38
+ *
39
+ * Unless required by applicable law or agreed to in writing, software distributed under
40
+ * the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
41
+ * OF ANY KIND, either express or implied. See the License for the specific language
42
+ * governing permissions and limitations under the License.
43
+ */
44
+ const $edcf132a9284368a$var$AXIS = {
45
+ top: "top",
46
+ bottom: "top",
47
+ left: "left",
48
+ right: "left"
49
+ };
50
+ const $edcf132a9284368a$var$FLIPPED_DIRECTION = {
51
+ top: "bottom",
52
+ bottom: "top",
53
+ left: "right",
54
+ right: "left"
55
+ };
56
+ const $edcf132a9284368a$var$CROSS_AXIS = {
57
+ top: "left",
58
+ left: "top"
59
+ };
60
+ const $edcf132a9284368a$var$AXIS_SIZE = {
61
+ top: "height",
62
+ left: "width"
63
+ };
64
+ const $edcf132a9284368a$var$TOTAL_SIZE = {
65
+ width: "totalWidth",
66
+ height: "totalHeight"
67
+ };
68
+ const $edcf132a9284368a$var$PARSED_PLACEMENT_CACHE = {};
69
+ // @ts-ignore
70
+ let $edcf132a9284368a$var$visualViewport = typeof window !== "undefined" && window.visualViewport;
71
+ function $edcf132a9284368a$var$getContainerDimensions(containerNode) {
72
+ let width = 0, height = 0, totalWidth = 0, totalHeight = 0, top = 0, left = 0;
73
+ let scroll = {};
74
+ if (containerNode.tagName === "BODY") {
75
+ let documentElement = document.documentElement;
76
+ totalWidth = documentElement.clientWidth;
77
+ totalHeight = documentElement.clientHeight;
78
+ var _visualViewport_width;
79
+ width = (_visualViewport_width = $edcf132a9284368a$var$visualViewport === null || $edcf132a9284368a$var$visualViewport === void 0 ? void 0 : $edcf132a9284368a$var$visualViewport.width) !== null && _visualViewport_width !== void 0 ? _visualViewport_width : totalWidth;
80
+ var _visualViewport_height;
81
+ height = (_visualViewport_height = $edcf132a9284368a$var$visualViewport === null || $edcf132a9284368a$var$visualViewport === void 0 ? void 0 : $edcf132a9284368a$var$visualViewport.height) !== null && _visualViewport_height !== void 0 ? _visualViewport_height : totalHeight;
82
+ scroll.top = documentElement.scrollTop || containerNode.scrollTop;
83
+ scroll.left = documentElement.scrollLeft || containerNode.scrollLeft;
84
+ } else {
85
+ ({ width: width , height: height , top: top , left: left } = $edcf132a9284368a$var$getOffset(containerNode));
86
+ scroll.top = containerNode.scrollTop;
87
+ scroll.left = containerNode.scrollLeft;
88
+ totalWidth = width;
89
+ totalHeight = height;
90
+ }
91
+ return {
92
+ width: width,
93
+ height: height,
94
+ totalWidth: totalWidth,
95
+ totalHeight: totalHeight,
96
+ scroll: scroll,
97
+ top: top,
98
+ left: left
99
+ };
100
+ }
101
+ function $edcf132a9284368a$var$getScroll(node) {
102
+ return {
103
+ top: node.scrollTop,
104
+ left: node.scrollLeft,
105
+ width: node.scrollWidth,
106
+ height: node.scrollHeight
107
+ };
108
+ }
109
+ function $edcf132a9284368a$var$getDelta(axis, offset, size, containerDimensions, padding) {
110
+ let containerScroll = containerDimensions.scroll[axis];
111
+ let containerHeight = containerDimensions[$edcf132a9284368a$var$AXIS_SIZE[axis]];
112
+ let startEdgeOffset = offset - padding - containerScroll;
113
+ let endEdgeOffset = offset + padding - containerScroll + size;
114
+ if (startEdgeOffset < 0) return -startEdgeOffset;
115
+ else if (endEdgeOffset > containerHeight) return Math.max(containerHeight - endEdgeOffset, -startEdgeOffset);
116
+ else return 0;
117
+ }
118
+ function $edcf132a9284368a$var$getMargins(node) {
119
+ let style = window.getComputedStyle(node);
120
+ return {
121
+ top: parseInt(style.marginTop, 10) || 0,
122
+ bottom: parseInt(style.marginBottom, 10) || 0,
123
+ left: parseInt(style.marginLeft, 10) || 0,
124
+ right: parseInt(style.marginRight, 10) || 0
125
+ };
126
+ }
127
+ function $edcf132a9284368a$var$parsePlacement(input) {
128
+ if ($edcf132a9284368a$var$PARSED_PLACEMENT_CACHE[input]) return $edcf132a9284368a$var$PARSED_PLACEMENT_CACHE[input];
129
+ let [placement, crossPlacement] = input.split(" ");
130
+ let axis = $edcf132a9284368a$var$AXIS[placement] || "right";
131
+ let crossAxis = $edcf132a9284368a$var$CROSS_AXIS[axis];
132
+ if (!$edcf132a9284368a$var$AXIS[crossPlacement]) crossPlacement = "center";
133
+ let size = $edcf132a9284368a$var$AXIS_SIZE[axis];
134
+ let crossSize = $edcf132a9284368a$var$AXIS_SIZE[crossAxis];
135
+ $edcf132a9284368a$var$PARSED_PLACEMENT_CACHE[input] = {
136
+ placement: placement,
137
+ crossPlacement: crossPlacement,
138
+ axis: axis,
139
+ crossAxis: crossAxis,
140
+ size: size,
141
+ crossSize: crossSize
142
+ };
143
+ return $edcf132a9284368a$var$PARSED_PLACEMENT_CACHE[input];
144
+ }
145
+ function $edcf132a9284368a$var$computePosition(childOffset, boundaryDimensions, overlaySize, placementInfo, offset, crossOffset, containerOffsetWithBoundary, isContainerPositioned, arrowSize, arrowBoundaryOffset) {
146
+ let { placement: placement , crossPlacement: crossPlacement , axis: axis , crossAxis: crossAxis , size: size , crossSize: crossSize } = placementInfo;
147
+ let position = {};
148
+ // button position
149
+ position[crossAxis] = childOffset[crossAxis];
150
+ if (crossPlacement === "center") // + (button size / 2) - (overlay size / 2)
151
+ // at this point the overlay center should match the button center
152
+ position[crossAxis] += (childOffset[crossSize] - overlaySize[crossSize]) / 2;
153
+ else if (crossPlacement !== crossAxis) // + (button size) - (overlay size)
154
+ // at this point the overlay bottom should match the button bottom
155
+ position[crossAxis] += childOffset[crossSize] - overlaySize[crossSize];
156
+ /* else {
157
+ the overlay top should match the button top
158
+ } */
159
+ // add the crossOffset from props
160
+ position[crossAxis] += crossOffset;
161
+ // overlay top overlapping arrow with button bottom
162
+ const minPosition = childOffset[crossAxis] - overlaySize[crossSize] + arrowSize + arrowBoundaryOffset;
163
+ // overlay bottom overlapping arrow with button top
164
+ const maxPosition = childOffset[crossAxis] + childOffset[crossSize] - arrowSize - arrowBoundaryOffset;
165
+ position[crossAxis] = (0, $k7QOs$clamp)(position[crossAxis], minPosition, maxPosition);
166
+ // Floor these so the position isn't placed on a partial pixel, only whole pixels. Shouldn't matter if it was floored or ceiled, so chose one.
167
+ if (placement === axis) {
168
+ // If the container is positioned (non-static), then we use the container's actual
169
+ // height, as `bottom` will be relative to this height. But if the container is static,
170
+ // then it can only be the `document.body`, and `bottom` will be relative to _its_
171
+ // container, which should be as large as boundaryDimensions.
172
+ const containerHeight = isContainerPositioned ? containerOffsetWithBoundary[size] : boundaryDimensions[$edcf132a9284368a$var$TOTAL_SIZE[size]];
173
+ position[$edcf132a9284368a$var$FLIPPED_DIRECTION[axis]] = Math.floor(containerHeight - childOffset[axis] + offset);
174
+ } else position[axis] = Math.floor(childOffset[axis] + childOffset[size] + offset);
175
+ return position;
176
+ }
177
+ function $edcf132a9284368a$var$getMaxHeight(position, boundaryDimensions, containerOffsetWithBoundary, childOffset, margins, padding) {
178
+ return position.top != null ? Math.max(0, boundaryDimensions.height + boundaryDimensions.top + boundaryDimensions.scroll.top // this is the bottom of the boundary
179
+ - (containerOffsetWithBoundary.top + position.top // this is the top of the overlay
180
+ ) - (margins.top + margins.bottom + padding // save additional space for margin and padding
181
+ )) : Math.max(0, childOffset.top + containerOffsetWithBoundary.top // this is the top of the trigger
182
+ - (boundaryDimensions.top + boundaryDimensions.scroll.top // this is the top of the boundary
183
+ ) - (margins.top + margins.bottom + padding // save additional space for margin and padding
184
+ ));
185
+ }
186
+ function $edcf132a9284368a$var$getAvailableSpace(boundaryDimensions, containerOffsetWithBoundary, childOffset, margins, padding, placementInfo) {
187
+ let { placement: placement , axis: axis , size: size } = placementInfo;
188
+ if (placement === axis) return Math.max(0, childOffset[axis] - boundaryDimensions[axis] - boundaryDimensions.scroll[axis] + containerOffsetWithBoundary[axis] - margins[axis] - margins[$edcf132a9284368a$var$FLIPPED_DIRECTION[axis]] - padding);
189
+ return Math.max(0, boundaryDimensions[size] + boundaryDimensions[axis] + boundaryDimensions.scroll[axis] - containerOffsetWithBoundary[axis] - childOffset[axis] - childOffset[size] - margins[axis] - margins[$edcf132a9284368a$var$FLIPPED_DIRECTION[axis]] - padding);
190
+ }
191
+ function $edcf132a9284368a$export$6839422d1f33cee9(placementInput, childOffset, overlaySize, scrollSize, margins, padding, flip, boundaryDimensions, containerOffsetWithBoundary, offset, crossOffset, isContainerPositioned, userSetMaxHeight, arrowSize, arrowBoundaryOffset) {
192
+ let placementInfo = $edcf132a9284368a$var$parsePlacement(placementInput);
193
+ let { size: size , crossAxis: crossAxis , crossSize: crossSize , placement: placement , crossPlacement: crossPlacement } = placementInfo;
194
+ let position = $edcf132a9284368a$var$computePosition(childOffset, boundaryDimensions, overlaySize, placementInfo, offset, crossOffset, containerOffsetWithBoundary, isContainerPositioned, arrowSize, arrowBoundaryOffset);
195
+ let normalizedOffset = offset;
196
+ let space = $edcf132a9284368a$var$getAvailableSpace(boundaryDimensions, containerOffsetWithBoundary, childOffset, margins, padding + offset, placementInfo);
197
+ // Check if the scroll size of the overlay is greater than the available space to determine if we need to flip
198
+ if (flip && scrollSize[size] > space) {
199
+ let flippedPlacementInfo = $edcf132a9284368a$var$parsePlacement(`${$edcf132a9284368a$var$FLIPPED_DIRECTION[placement]} ${crossPlacement}`);
200
+ let flippedPosition = $edcf132a9284368a$var$computePosition(childOffset, boundaryDimensions, overlaySize, flippedPlacementInfo, offset, crossOffset, containerOffsetWithBoundary, isContainerPositioned, arrowSize, arrowBoundaryOffset);
201
+ let flippedSpace = $edcf132a9284368a$var$getAvailableSpace(boundaryDimensions, containerOffsetWithBoundary, childOffset, margins, padding + offset, flippedPlacementInfo);
202
+ // If the available space for the flipped position is greater than the original available space, flip.
203
+ if (flippedSpace > space) {
204
+ placementInfo = flippedPlacementInfo;
205
+ position = flippedPosition;
206
+ normalizedOffset = offset;
207
+ }
208
+ }
209
+ let delta = $edcf132a9284368a$var$getDelta(crossAxis, position[crossAxis], overlaySize[crossSize], boundaryDimensions, padding);
210
+ position[crossAxis] += delta;
211
+ let maxHeight = $edcf132a9284368a$var$getMaxHeight(position, boundaryDimensions, containerOffsetWithBoundary, childOffset, margins, padding);
212
+ if (userSetMaxHeight && userSetMaxHeight < maxHeight) maxHeight = userSetMaxHeight;
213
+ overlaySize.height = Math.min(overlaySize.height, maxHeight);
214
+ position = $edcf132a9284368a$var$computePosition(childOffset, boundaryDimensions, overlaySize, placementInfo, normalizedOffset, crossOffset, containerOffsetWithBoundary, isContainerPositioned, arrowSize, arrowBoundaryOffset);
215
+ delta = $edcf132a9284368a$var$getDelta(crossAxis, position[crossAxis], overlaySize[crossSize], boundaryDimensions, padding);
216
+ position[crossAxis] += delta;
217
+ let arrowPosition = {};
218
+ // All values are transformed so that 0 is at the top/left of the overlay depending on the orientation
219
+ // Prefer the arrow being in the center of the trigger/overlay anchor element
220
+ let preferredArrowPosition = childOffset[crossAxis] + .5 * childOffset[crossSize] - overlaySize[crossAxis];
221
+ // Min/Max position limits for the arrow with respect to the overlay
222
+ const arrowMinPosition = arrowSize / 2 + arrowBoundaryOffset;
223
+ const arrowMaxPosition = overlaySize[crossSize] - arrowSize / 2 - arrowBoundaryOffset;
224
+ // Min/Max position limits for the arrow with respect to the trigger/overlay anchor element
225
+ const arrowOverlappingChildMinEdge = childOffset[crossAxis] - overlaySize[crossAxis] + arrowSize / 2;
226
+ const arrowOverlappingChildMaxEdge = childOffset[crossAxis] + childOffset[crossSize] - overlaySize[crossAxis] - arrowSize / 2;
227
+ // Clamp the arrow positioning so that it always is within the bounds of the anchor and the overlay
228
+ const arrowPositionOverlappingChild = (0, $k7QOs$clamp)(preferredArrowPosition, arrowOverlappingChildMinEdge, arrowOverlappingChildMaxEdge);
229
+ arrowPosition[crossAxis] = (0, $k7QOs$clamp)(arrowPositionOverlappingChild, arrowMinPosition, arrowMaxPosition);
230
+ return {
231
+ position: position,
232
+ maxHeight: maxHeight,
233
+ arrowOffsetLeft: arrowPosition.left,
234
+ arrowOffsetTop: arrowPosition.top,
235
+ placement: placementInfo.placement
236
+ };
237
+ }
238
+ function $edcf132a9284368a$export$b3ceb0cbf1056d98(opts) {
239
+ let { placement: placement , targetNode: targetNode , overlayNode: overlayNode , scrollNode: scrollNode , padding: padding , shouldFlip: shouldFlip , boundaryElement: boundaryElement , offset: offset , crossOffset: crossOffset , maxHeight: maxHeight , arrowSize: arrowSize , arrowBoundaryOffset: arrowBoundaryOffset = 0 } = opts;
240
+ let container = overlayNode instanceof HTMLElement ? $edcf132a9284368a$var$getContainingBlock(overlayNode) : document.documentElement;
241
+ let isViewportContainer = container === document.documentElement;
242
+ const containerPositionStyle = window.getComputedStyle(container).position;
243
+ let isContainerPositioned = !!containerPositionStyle && containerPositionStyle !== "static";
244
+ let childOffset = isViewportContainer ? $edcf132a9284368a$var$getOffset(targetNode) : $edcf132a9284368a$var$getPosition(targetNode, container);
245
+ if (!isViewportContainer) {
246
+ let { marginTop: marginTop , marginLeft: marginLeft } = window.getComputedStyle(targetNode);
247
+ childOffset.top += parseInt(marginTop, 10) || 0;
248
+ childOffset.left += parseInt(marginLeft, 10) || 0;
249
+ }
250
+ let overlaySize = $edcf132a9284368a$var$getOffset(overlayNode);
251
+ let margins = $edcf132a9284368a$var$getMargins(overlayNode);
252
+ overlaySize.width += margins.left + margins.right;
253
+ overlaySize.height += margins.top + margins.bottom;
254
+ let scrollSize = $edcf132a9284368a$var$getScroll(scrollNode);
255
+ let boundaryDimensions = $edcf132a9284368a$var$getContainerDimensions(boundaryElement);
256
+ let containerOffsetWithBoundary = boundaryElement.tagName === "BODY" ? $edcf132a9284368a$var$getOffset(container) : $edcf132a9284368a$var$getPosition(container, boundaryElement);
257
+ return $edcf132a9284368a$export$6839422d1f33cee9(placement, childOffset, overlaySize, scrollSize, margins, padding, shouldFlip, boundaryDimensions, containerOffsetWithBoundary, offset, crossOffset, isContainerPositioned, maxHeight, arrowSize, arrowBoundaryOffset);
258
+ }
259
+ function $edcf132a9284368a$var$getOffset(node) {
260
+ let { top: top , left: left , width: width , height: height } = node.getBoundingClientRect();
261
+ let { scrollTop: scrollTop , scrollLeft: scrollLeft , clientTop: clientTop , clientLeft: clientLeft } = document.documentElement;
262
+ return {
263
+ top: top + scrollTop - clientTop,
264
+ left: left + scrollLeft - clientLeft,
265
+ width: width,
266
+ height: height
267
+ };
268
+ }
269
+ function $edcf132a9284368a$var$getPosition(node, parent) {
270
+ let style = window.getComputedStyle(node);
271
+ let offset;
272
+ if (style.position === "fixed") {
273
+ let { top: top , left: left , width: width , height: height } = node.getBoundingClientRect();
274
+ offset = {
275
+ top: top,
276
+ left: left,
277
+ width: width,
278
+ height: height
279
+ };
280
+ } else {
281
+ offset = $edcf132a9284368a$var$getOffset(node);
282
+ let parentOffset = $edcf132a9284368a$var$getOffset(parent);
283
+ let parentStyle = window.getComputedStyle(parent);
284
+ parentOffset.top += (parseInt(parentStyle.borderTopWidth, 10) || 0) - parent.scrollTop;
285
+ parentOffset.left += (parseInt(parentStyle.borderLeftWidth, 10) || 0) - parent.scrollLeft;
286
+ offset.top -= parentOffset.top;
287
+ offset.left -= parentOffset.left;
288
+ }
289
+ offset.top -= parseInt(style.marginTop, 10) || 0;
290
+ offset.left -= parseInt(style.marginLeft, 10) || 0;
291
+ return offset;
292
+ }
293
+ // Returns the containing block of an element, which is the element that
294
+ // this element will be positioned relative to.
295
+ // https://developer.mozilla.org/en-US/docs/Web/CSS/Containing_block
296
+ function $edcf132a9284368a$var$getContainingBlock(node) {
297
+ // The offsetParent of an element in most cases equals the containing block.
298
+ // https://w3c.github.io/csswg-drafts/cssom-view/#dom-htmlelement-offsetparent
299
+ let offsetParent = node.offsetParent;
300
+ // The offsetParent algorithm terminates at the document body,
301
+ // even if the body is not a containing block. Double check that
302
+ // and use the documentElement if so.
303
+ if (offsetParent && offsetParent === document.body && window.getComputedStyle(offsetParent).position === "static" && !$edcf132a9284368a$var$isContainingBlock(offsetParent)) offsetParent = document.documentElement;
304
+ // TODO(later): handle table elements?
305
+ // The offsetParent can be null if the element has position: fixed, or a few other cases.
306
+ // We have to walk up the tree manually in this case because fixed positioned elements
307
+ // are still positioned relative to their containing block, which is not always the viewport.
308
+ if (offsetParent == null) {
309
+ offsetParent = node.parentElement;
310
+ while(offsetParent && !$edcf132a9284368a$var$isContainingBlock(offsetParent))offsetParent = offsetParent.parentElement;
311
+ }
312
+ // Fall back to the viewport.
313
+ return offsetParent || document.documentElement;
314
+ }
315
+ // https://developer.mozilla.org/en-US/docs/Web/CSS/Containing_block#identifying_the_containing_block
316
+ function $edcf132a9284368a$var$isContainingBlock(node) {
317
+ let style = window.getComputedStyle(node);
318
+ return style.transform !== "none" || /transform|perspective/.test(style.willChange) || style.filter !== "none" || style.contain === "paint" || // @ts-ignore
319
+ "backdropFilter" in style && style.backdropFilter !== "none" || // @ts-ignore
320
+ "WebkitBackdropFilter" in style && style.WebkitBackdropFilter !== "none";
321
+ }
322
+
323
+
324
+
325
+ /*
326
+ * Copyright 2020 Adobe. All rights reserved.
327
+ * This file is licensed to you under the Apache License, Version 2.0 (the "License");
328
+ * you may not use this file except in compliance with the License. You may obtain a copy
329
+ * of the License at http://www.apache.org/licenses/LICENSE-2.0
330
+ *
331
+ * Unless required by applicable law or agreed to in writing, software distributed under
332
+ * the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
333
+ * OF ANY KIND, either express or implied. See the License for the specific language
334
+ * governing permissions and limitations under the License.
335
+ */
336
+ const $dd149f63282afbbf$export$f6211563215e3b37 = new WeakMap();
337
+ function $dd149f63282afbbf$export$18fc8428861184da(opts) {
338
+ let { triggerRef: triggerRef , isOpen: isOpen , onClose: onClose } = opts;
339
+ (0, $k7QOs$useEffect)(()=>{
340
+ if (!isOpen || onClose === null) return;
341
+ let onScroll = (e)=>{
342
+ // Ignore if scrolling an scrollable region outside the trigger's tree.
343
+ let target = e.target;
344
+ // window is not a Node and doesn't have contain, but window contains everything
345
+ if (!triggerRef.current || target instanceof Node && !target.contains(triggerRef.current)) return;
346
+ let onCloseHandler = onClose || $dd149f63282afbbf$export$f6211563215e3b37.get(triggerRef.current);
347
+ if (onCloseHandler) onCloseHandler();
348
+ };
349
+ window.addEventListener("scroll", onScroll, true);
350
+ return ()=>{
351
+ window.removeEventListener("scroll", onScroll, true);
352
+ };
353
+ }, [
354
+ isOpen,
355
+ onClose,
356
+ triggerRef
357
+ ]);
358
+ }
359
+
360
+
361
+
362
+
363
+ // @ts-ignore
364
+ let $2a41e45df1593e64$var$visualViewport = typeof window !== "undefined" && window.visualViewport;
365
+ function $2a41e45df1593e64$export$d39e1813b3bdd0e1(props) {
366
+ let { direction: direction } = (0, $k7QOs$useLocale)();
367
+ let { arrowSize: arrowSize = 0 , targetRef: targetRef , overlayRef: overlayRef , scrollRef: scrollRef = overlayRef , placement: placement = "bottom" , containerPadding: containerPadding = 12 , shouldFlip: shouldFlip = true , boundaryElement: boundaryElement = typeof document !== "undefined" ? document.body : null , offset: offset = 0 , crossOffset: crossOffset = 0 , shouldUpdatePosition: shouldUpdatePosition = true , isOpen: isOpen = true , onClose: onClose , maxHeight: maxHeight , arrowBoundaryOffset: arrowBoundaryOffset = 0 } = props;
368
+ let [position, setPosition] = (0, $k7QOs$useState)({
369
+ position: {},
370
+ arrowOffsetLeft: undefined,
371
+ arrowOffsetTop: undefined,
372
+ maxHeight: undefined,
373
+ placement: undefined
374
+ });
375
+ let deps = [
376
+ shouldUpdatePosition,
377
+ placement,
378
+ overlayRef.current,
379
+ targetRef.current,
380
+ scrollRef.current,
381
+ containerPadding,
382
+ shouldFlip,
383
+ boundaryElement,
384
+ offset,
385
+ crossOffset,
386
+ isOpen,
387
+ direction,
388
+ maxHeight,
389
+ arrowBoundaryOffset,
390
+ arrowSize
391
+ ];
392
+ let updatePosition = (0, $k7QOs$useCallback)(()=>{
393
+ if (shouldUpdatePosition === false || !isOpen || !overlayRef.current || !targetRef.current || !scrollRef.current || !boundaryElement) return;
394
+ let position = (0, $edcf132a9284368a$export$b3ceb0cbf1056d98)({
395
+ placement: $2a41e45df1593e64$var$translateRTL(placement, direction),
396
+ overlayNode: overlayRef.current,
397
+ targetNode: targetRef.current,
398
+ scrollNode: scrollRef.current,
399
+ padding: containerPadding,
400
+ shouldFlip: shouldFlip,
401
+ boundaryElement: boundaryElement,
402
+ offset: offset,
403
+ crossOffset: crossOffset,
404
+ maxHeight: maxHeight,
405
+ arrowSize: arrowSize,
406
+ arrowBoundaryOffset: arrowBoundaryOffset
407
+ });
408
+ // Modify overlay styles directly so positioning happens immediately without the need of a second render
409
+ // This is so we don't have to delay autoFocus scrolling or delay applying preventScroll for popovers
410
+ Object.keys(position.position).forEach((key)=>overlayRef.current.style[key] = position.position[key] + "px");
411
+ overlayRef.current.style.maxHeight = position.maxHeight != null ? position.maxHeight + "px" : undefined;
412
+ // Trigger a set state for a second render anyway for arrow positioning
413
+ setPosition(position);
414
+ // eslint-disable-next-line react-hooks/exhaustive-deps
415
+ }, deps);
416
+ // Update position when anything changes
417
+ // eslint-disable-next-line react-hooks/exhaustive-deps
418
+ (0, $k7QOs$useLayoutEffect)(updatePosition, deps);
419
+ // Update position on window resize
420
+ $2a41e45df1593e64$var$useResize(updatePosition);
421
+ // Update position when the overlay changes size (might need to flip).
422
+ (0, $k7QOs$useResizeObserver)({
423
+ ref: overlayRef,
424
+ onResize: updatePosition
425
+ });
426
+ // Reposition the overlay and do not close on scroll while the visual viewport is resizing.
427
+ // This will ensure that overlays adjust their positioning when the iOS virtual keyboard appears.
428
+ let isResizing = (0, $k7QOs$useRef)(false);
429
+ (0, $k7QOs$useLayoutEffect)(()=>{
430
+ let timeout;
431
+ let onResize = ()=>{
432
+ isResizing.current = true;
433
+ clearTimeout(timeout);
434
+ timeout = setTimeout(()=>{
435
+ isResizing.current = false;
436
+ }, 500);
437
+ updatePosition();
438
+ };
439
+ $2a41e45df1593e64$var$visualViewport === null || $2a41e45df1593e64$var$visualViewport === void 0 ? void 0 : $2a41e45df1593e64$var$visualViewport.addEventListener("resize", onResize);
440
+ $2a41e45df1593e64$var$visualViewport === null || $2a41e45df1593e64$var$visualViewport === void 0 ? void 0 : $2a41e45df1593e64$var$visualViewport.addEventListener("scroll", onResize);
441
+ return ()=>{
442
+ $2a41e45df1593e64$var$visualViewport === null || $2a41e45df1593e64$var$visualViewport === void 0 ? void 0 : $2a41e45df1593e64$var$visualViewport.removeEventListener("resize", onResize);
443
+ $2a41e45df1593e64$var$visualViewport === null || $2a41e45df1593e64$var$visualViewport === void 0 ? void 0 : $2a41e45df1593e64$var$visualViewport.removeEventListener("scroll", onResize);
444
+ };
445
+ }, [
446
+ updatePosition
447
+ ]);
448
+ let close = (0, $k7QOs$useCallback)(()=>{
449
+ if (!isResizing.current) onClose();
450
+ }, [
451
+ onClose,
452
+ isResizing
453
+ ]);
454
+ // When scrolling a parent scrollable region of the trigger (other than the body),
455
+ // we hide the popover. Otherwise, its position would be incorrect.
456
+ (0, $dd149f63282afbbf$export$18fc8428861184da)({
457
+ triggerRef: targetRef,
458
+ isOpen: isOpen,
459
+ onClose: onClose && close
460
+ });
461
+ return {
462
+ overlayProps: {
463
+ style: {
464
+ position: "absolute",
465
+ zIndex: 100000,
466
+ ...position.position,
467
+ maxHeight: position.maxHeight
468
+ }
469
+ },
470
+ placement: position.placement,
471
+ arrowProps: {
472
+ style: {
473
+ left: position.arrowOffsetLeft,
474
+ top: position.arrowOffsetTop
475
+ }
476
+ },
477
+ updatePosition: updatePosition
478
+ };
479
+ }
480
+ function $2a41e45df1593e64$var$useResize(onResize) {
481
+ (0, $k7QOs$useLayoutEffect)(()=>{
482
+ window.addEventListener("resize", onResize, false);
483
+ return ()=>{
484
+ window.removeEventListener("resize", onResize, false);
485
+ };
486
+ }, [
487
+ onResize
488
+ ]);
489
+ }
490
+ function $2a41e45df1593e64$var$translateRTL(position, direction) {
491
+ if (direction === "rtl") return position.replace("start", "right").replace("end", "left");
492
+ return position.replace("start", "left").replace("end", "right");
493
+ }
494
+
495
+
496
+ /*
497
+ * Copyright 2020 Adobe. All rights reserved.
498
+ * This file is licensed to you under the Apache License, Version 2.0 (the "License");
499
+ * you may not use this file except in compliance with the License. You may obtain a copy
500
+ * of the License at http://www.apache.org/licenses/LICENSE-2.0
501
+ *
502
+ * Unless required by applicable law or agreed to in writing, software distributed under
503
+ * the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
504
+ * OF ANY KIND, either express or implied. See the License for the specific language
505
+ * governing permissions and limitations under the License.
506
+ */
507
+
508
+
509
+ const $a11501f3d1d39e6c$var$visibleOverlays = [];
510
+ function $a11501f3d1d39e6c$export$ea8f71083e90600f(props, ref) {
511
+ let { onClose: onClose , shouldCloseOnBlur: shouldCloseOnBlur , isOpen: isOpen , isDismissable: isDismissable = false , isKeyboardDismissDisabled: isKeyboardDismissDisabled = false , shouldCloseOnInteractOutside: shouldCloseOnInteractOutside } = props;
512
+ // Add the overlay ref to the stack of visible overlays on mount, and remove on unmount.
513
+ (0, $k7QOs$useEffect)(()=>{
514
+ if (isOpen) $a11501f3d1d39e6c$var$visibleOverlays.push(ref);
515
+ return ()=>{
516
+ let index = $a11501f3d1d39e6c$var$visibleOverlays.indexOf(ref);
517
+ if (index >= 0) $a11501f3d1d39e6c$var$visibleOverlays.splice(index, 1);
518
+ };
519
+ }, [
520
+ isOpen,
521
+ ref
522
+ ]);
523
+ // Only hide the overlay when it is the topmost visible overlay in the stack.
524
+ let onHide = ()=>{
525
+ if ($a11501f3d1d39e6c$var$visibleOverlays[$a11501f3d1d39e6c$var$visibleOverlays.length - 1] === ref && onClose) onClose();
526
+ };
527
+ let onInteractOutsideStart = (e)=>{
528
+ if (!shouldCloseOnInteractOutside || shouldCloseOnInteractOutside(e.target)) {
529
+ if ($a11501f3d1d39e6c$var$visibleOverlays[$a11501f3d1d39e6c$var$visibleOverlays.length - 1] === ref) {
530
+ e.stopPropagation();
531
+ e.preventDefault();
532
+ }
533
+ }
534
+ };
535
+ let onInteractOutside = (e)=>{
536
+ if (!shouldCloseOnInteractOutside || shouldCloseOnInteractOutside(e.target)) {
537
+ if ($a11501f3d1d39e6c$var$visibleOverlays[$a11501f3d1d39e6c$var$visibleOverlays.length - 1] === ref) {
538
+ e.stopPropagation();
539
+ e.preventDefault();
540
+ }
541
+ onHide();
542
+ }
543
+ };
544
+ // Handle the escape key
545
+ let onKeyDown = (e)=>{
546
+ if (e.key === "Escape" && !isKeyboardDismissDisabled) {
547
+ e.stopPropagation();
548
+ e.preventDefault();
549
+ onHide();
550
+ }
551
+ };
552
+ // Handle clicking outside the overlay to close it
553
+ (0, $k7QOs$useInteractOutside)({
554
+ ref: ref,
555
+ onInteractOutside: isDismissable ? onInteractOutside : null,
556
+ onInteractOutsideStart: onInteractOutsideStart
557
+ });
558
+ let { focusWithinProps: focusWithinProps } = (0, $k7QOs$useFocusWithin)({
559
+ isDisabled: !shouldCloseOnBlur,
560
+ onBlurWithin: (e)=>{
561
+ // If focus is moving into a child focus scope (e.g. menu inside a dialog),
562
+ // do not close the outer overlay. At this point, the active scope should
563
+ // still be the outer overlay, since blur events run before focus.
564
+ if (e.relatedTarget && (0, $k7QOs$isElementInChildOfActiveScope)(e.relatedTarget)) return;
565
+ if (!shouldCloseOnInteractOutside || shouldCloseOnInteractOutside(e.relatedTarget)) onClose();
566
+ }
567
+ });
568
+ let onPointerDownUnderlay = (e)=>{
569
+ // fixes a firefox issue that starts text selection https://bugzilla.mozilla.org/show_bug.cgi?id=1675846
570
+ if (e.target === e.currentTarget) e.preventDefault();
571
+ };
572
+ return {
573
+ overlayProps: {
574
+ onKeyDown: onKeyDown,
575
+ ...focusWithinProps
576
+ },
577
+ underlayProps: {
578
+ onPointerDown: onPointerDownUnderlay
579
+ }
580
+ };
581
+ }
582
+
583
+
584
+ /*
585
+ * Copyright 2020 Adobe. All rights reserved.
586
+ * This file is licensed to you under the Apache License, Version 2.0 (the "License");
587
+ * you may not use this file except in compliance with the License. You may obtain a copy
588
+ * of the License at http://www.apache.org/licenses/LICENSE-2.0
589
+ *
590
+ * Unless required by applicable law or agreed to in writing, software distributed under
591
+ * the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
592
+ * OF ANY KIND, either express or implied. See the License for the specific language
593
+ * governing permissions and limitations under the License.
594
+ */
595
+
596
+
597
+ function $628037886ba31236$export$f9d5c8beee7d008d(props, state, ref) {
598
+ let { type: type } = props;
599
+ let { isOpen: isOpen } = state;
600
+ // Backward compatibility. Share state close function with useOverlayPosition so it can close on scroll
601
+ // without forcing users to pass onClose.
602
+ (0, $k7QOs$useEffect)(()=>{
603
+ if (ref && ref.current) (0, $dd149f63282afbbf$export$f6211563215e3b37).set(ref.current, state.close);
604
+ });
605
+ // Aria 1.1 supports multiple values for aria-haspopup other than just menus.
606
+ // https://www.w3.org/TR/wai-aria-1.1/#aria-haspopup
607
+ // However, we only add it for menus for now because screen readers often
608
+ // announce it as a menu even for other values.
609
+ let ariaHasPopup = undefined;
610
+ if (type === "menu") ariaHasPopup = true;
611
+ else if (type === "listbox") ariaHasPopup = "listbox";
612
+ let overlayId = (0, $k7QOs$useId)();
613
+ return {
614
+ triggerProps: {
615
+ "aria-haspopup": ariaHasPopup,
616
+ "aria-expanded": isOpen,
617
+ "aria-controls": isOpen ? overlayId : null,
618
+ onPress: state.toggle
619
+ },
620
+ overlayProps: {
621
+ id: overlayId
622
+ }
623
+ };
624
+ }
625
+
626
+
627
+ /*
628
+ * Copyright 2020 Adobe. All rights reserved.
629
+ * This file is licensed to you under the Apache License, Version 2.0 (the "License");
630
+ * you may not use this file except in compliance with the License. You may obtain a copy
631
+ * of the License at http://www.apache.org/licenses/LICENSE-2.0
632
+ *
633
+ * Unless required by applicable law or agreed to in writing, software distributed under
634
+ * the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
635
+ * OF ANY KIND, either express or implied. See the License for the specific language
636
+ * governing permissions and limitations under the License.
637
+ */
638
+ // @ts-ignore
639
+ const $49c51c25361d4cd2$var$visualViewport = typeof window !== "undefined" && window.visualViewport;
640
+ // HTML input types that do not cause the software keyboard to appear.
641
+ const $49c51c25361d4cd2$var$nonTextInputTypes = new Set([
642
+ "checkbox",
643
+ "radio",
644
+ "range",
645
+ "color",
646
+ "file",
647
+ "image",
648
+ "button",
649
+ "submit",
650
+ "reset"
651
+ ]);
652
+ // The number of active usePreventScroll calls. Used to determine whether to revert back to the original page style/scroll position
653
+ let $49c51c25361d4cd2$var$preventScrollCount = 0;
654
+ let $49c51c25361d4cd2$var$restore;
655
+ function $49c51c25361d4cd2$export$ee0f7cc6afcd1c18(options = {}) {
656
+ let { isDisabled: isDisabled } = options;
657
+ (0, $k7QOs$useLayoutEffect)(()=>{
658
+ if (isDisabled) return;
659
+ $49c51c25361d4cd2$var$preventScrollCount++;
660
+ if ($49c51c25361d4cd2$var$preventScrollCount === 1) {
661
+ if ((0, $k7QOs$isIOS)()) $49c51c25361d4cd2$var$restore = $49c51c25361d4cd2$var$preventScrollMobileSafari();
662
+ else $49c51c25361d4cd2$var$restore = $49c51c25361d4cd2$var$preventScrollStandard();
663
+ }
664
+ return ()=>{
665
+ $49c51c25361d4cd2$var$preventScrollCount--;
666
+ if ($49c51c25361d4cd2$var$preventScrollCount === 0) $49c51c25361d4cd2$var$restore();
667
+ };
668
+ }, [
669
+ isDisabled
670
+ ]);
671
+ }
672
+ // For most browsers, all we need to do is set `overflow: hidden` on the root element, and
673
+ // add some padding to prevent the page from shifting when the scrollbar is hidden.
674
+ function $49c51c25361d4cd2$var$preventScrollStandard() {
675
+ return (0, $k7QOs$chain)($49c51c25361d4cd2$var$setStyle(document.documentElement, "paddingRight", `${window.innerWidth - document.documentElement.clientWidth}px`), $49c51c25361d4cd2$var$setStyle(document.documentElement, "overflow", "hidden"));
676
+ }
677
+ // Mobile Safari is a whole different beast. Even with overflow: hidden,
678
+ // it still scrolls the page in many situations:
679
+ //
680
+ // 1. When the bottom toolbar and address bar are collapsed, page scrolling is always allowed.
681
+ // 2. When the keyboard is visible, the viewport does not resize. Instead, the keyboard covers part of
682
+ // it, so it becomes scrollable.
683
+ // 3. When tapping on an input, the page always scrolls so that the input is centered in the visual viewport.
684
+ // This may cause even fixed position elements to scroll off the screen.
685
+ // 4. When using the next/previous buttons in the keyboard to navigate between inputs, the whole page always
686
+ // scrolls, even if the input is inside a nested scrollable element that could be scrolled instead.
687
+ //
688
+ // In order to work around these cases, and prevent scrolling without jankiness, we do a few things:
689
+ //
690
+ // 1. Prevent default on `touchmove` events that are not in a scrollable element. This prevents touch scrolling
691
+ // on the window.
692
+ // 2. Prevent default on `touchmove` events inside a scrollable element when the scroll position is at the
693
+ // top or bottom. This avoids the whole page scrolling instead, but does prevent overscrolling.
694
+ // 3. Prevent default on `touchend` events on input elements and handle focusing the element ourselves.
695
+ // 4. When focusing an input, apply a transform to trick Safari into thinking the input is at the top
696
+ // of the page, which prevents it from scrolling the page. After the input is focused, scroll the element
697
+ // into view ourselves, without scrolling the whole page.
698
+ // 5. Offset the body by the scroll position using a negative margin and scroll to the top. This should appear the
699
+ // same visually, but makes the actual scroll position always zero. This is required to make all of the
700
+ // above work or Safari will still try to scroll the page when focusing an input.
701
+ // 6. As a last resort, handle window scroll events, and scroll back to the top. This can happen when attempting
702
+ // to navigate to an input with the next/previous buttons that's outside a modal.
703
+ function $49c51c25361d4cd2$var$preventScrollMobileSafari() {
704
+ let scrollable;
705
+ let lastY = 0;
706
+ let onTouchStart = (e)=>{
707
+ // Store the nearest scrollable parent element from the element that the user touched.
708
+ scrollable = (0, $k7QOs$getScrollParent)(e.target);
709
+ if (scrollable === document.documentElement && scrollable === document.body) return;
710
+ lastY = e.changedTouches[0].pageY;
711
+ };
712
+ let onTouchMove = (e)=>{
713
+ // Prevent scrolling the window.
714
+ if (scrollable === document.documentElement || scrollable === document.body) {
715
+ e.preventDefault();
716
+ return;
717
+ }
718
+ // Prevent scrolling up when at the top and scrolling down when at the bottom
719
+ // of a nested scrollable area, otherwise mobile Safari will start scrolling
720
+ // the window instead. Unfortunately, this disables bounce scrolling when at
721
+ // the top but it's the best we can do.
722
+ let y = e.changedTouches[0].pageY;
723
+ let scrollTop = scrollable.scrollTop;
724
+ let bottom = scrollable.scrollHeight - scrollable.clientHeight;
725
+ if (scrollTop <= 0 && y > lastY || scrollTop >= bottom && y < lastY) e.preventDefault();
726
+ lastY = y;
727
+ };
728
+ let onTouchEnd = (e)=>{
729
+ let target = e.target;
730
+ // Apply this change if we're not already focused on the target element
731
+ if ($49c51c25361d4cd2$var$willOpenKeyboard(target) && target !== document.activeElement) {
732
+ e.preventDefault();
733
+ // Apply a transform to trick Safari into thinking the input is at the top of the page
734
+ // so it doesn't try to scroll it into view. When tapping on an input, this needs to
735
+ // be done before the "focus" event, so we have to focus the element ourselves.
736
+ target.style.transform = "translateY(-2000px)";
737
+ target.focus();
738
+ requestAnimationFrame(()=>{
739
+ target.style.transform = "";
740
+ });
741
+ }
742
+ };
743
+ let onFocus = (e)=>{
744
+ let target = e.target;
745
+ if ($49c51c25361d4cd2$var$willOpenKeyboard(target)) {
746
+ // Transform also needs to be applied in the focus event in cases where focus moves
747
+ // other than tapping on an input directly, e.g. the next/previous buttons in the
748
+ // software keyboard. In these cases, it seems applying the transform in the focus event
749
+ // is good enough, whereas when tapping an input, it must be done before the focus event. 🤷‍♂️
750
+ target.style.transform = "translateY(-2000px)";
751
+ requestAnimationFrame(()=>{
752
+ target.style.transform = "";
753
+ // This will have prevented the browser from scrolling the focused element into view,
754
+ // so we need to do this ourselves in a way that doesn't cause the whole page to scroll.
755
+ if ($49c51c25361d4cd2$var$visualViewport) {
756
+ if ($49c51c25361d4cd2$var$visualViewport.height < window.innerHeight) // If the keyboard is already visible, do this after one additional frame
757
+ // to wait for the transform to be removed.
758
+ requestAnimationFrame(()=>{
759
+ $49c51c25361d4cd2$var$scrollIntoView(target);
760
+ });
761
+ else // Otherwise, wait for the visual viewport to resize before scrolling so we can
762
+ // measure the correct position to scroll to.
763
+ $49c51c25361d4cd2$var$visualViewport.addEventListener("resize", ()=>$49c51c25361d4cd2$var$scrollIntoView(target), {
764
+ once: true
765
+ });
766
+ }
767
+ });
768
+ }
769
+ };
770
+ let onWindowScroll = ()=>{
771
+ // Last resort. If the window scrolled, scroll it back to the top.
772
+ // It should always be at the top because the body will have a negative margin (see below).
773
+ window.scrollTo(0, 0);
774
+ };
775
+ // Record the original scroll position so we can restore it.
776
+ // Then apply a negative margin to the body to offset it by the scroll position. This will
777
+ // enable us to scroll the window to the top, which is required for the rest of this to work.
778
+ let scrollX = window.pageXOffset;
779
+ let scrollY = window.pageYOffset;
780
+ let restoreStyles = (0, $k7QOs$chain)($49c51c25361d4cd2$var$setStyle(document.documentElement, "paddingRight", `${window.innerWidth - document.documentElement.clientWidth}px`), $49c51c25361d4cd2$var$setStyle(document.documentElement, "overflow", "hidden"), $49c51c25361d4cd2$var$setStyle(document.body, "marginTop", `-${scrollY}px`));
781
+ // Scroll to the top. The negative margin on the body will make this appear the same.
782
+ window.scrollTo(0, 0);
783
+ let removeEvents = (0, $k7QOs$chain)($49c51c25361d4cd2$var$addEvent(document, "touchstart", onTouchStart, {
784
+ passive: false,
785
+ capture: true
786
+ }), $49c51c25361d4cd2$var$addEvent(document, "touchmove", onTouchMove, {
787
+ passive: false,
788
+ capture: true
789
+ }), $49c51c25361d4cd2$var$addEvent(document, "touchend", onTouchEnd, {
790
+ passive: false,
791
+ capture: true
792
+ }), $49c51c25361d4cd2$var$addEvent(document, "focus", onFocus, true), $49c51c25361d4cd2$var$addEvent(window, "scroll", onWindowScroll));
793
+ return ()=>{
794
+ // Restore styles and scroll the page back to where it was.
795
+ restoreStyles();
796
+ removeEvents();
797
+ window.scrollTo(scrollX, scrollY);
798
+ };
799
+ }
800
+ // Sets a CSS property on an element, and returns a function to revert it to the previous value.
801
+ function $49c51c25361d4cd2$var$setStyle(element, style, value) {
802
+ let cur = element.style[style];
803
+ element.style[style] = value;
804
+ return ()=>{
805
+ element.style[style] = cur;
806
+ };
807
+ }
808
+ // Adds an event listener to an element, and returns a function to remove it.
809
+ function $49c51c25361d4cd2$var$addEvent(target, event, handler, options) {
810
+ target.addEventListener(event, handler, options);
811
+ return ()=>{
812
+ target.removeEventListener(event, handler, options);
813
+ };
814
+ }
815
+ function $49c51c25361d4cd2$var$scrollIntoView(target) {
816
+ let root = document.scrollingElement || document.documentElement;
817
+ while(target && target !== root){
818
+ // Find the parent scrollable element and adjust the scroll position if the target is not already in view.
819
+ let scrollable = (0, $k7QOs$getScrollParent)(target);
820
+ if (scrollable !== document.documentElement && scrollable !== document.body && scrollable !== target) {
821
+ let scrollableTop = scrollable.getBoundingClientRect().top;
822
+ let targetTop = target.getBoundingClientRect().top;
823
+ if (targetTop > scrollableTop + target.clientHeight) scrollable.scrollTop += targetTop - scrollableTop;
824
+ }
825
+ target = scrollable.parentElement;
826
+ }
827
+ }
828
+ function $49c51c25361d4cd2$var$willOpenKeyboard(target) {
829
+ return target instanceof HTMLInputElement && !$49c51c25361d4cd2$var$nonTextInputTypes.has(target.type) || target instanceof HTMLTextAreaElement || target instanceof HTMLElement && target.isContentEditable;
830
+ }
831
+
832
+
833
+ /*
834
+ * Copyright 2020 Adobe. All rights reserved.
835
+ * This file is licensed to you under the Apache License, Version 2.0 (the "License");
836
+ * you may not use this file except in compliance with the License. You may obtain a copy
837
+ * of the License at http://www.apache.org/licenses/LICENSE-2.0
838
+ *
839
+ * Unless required by applicable law or agreed to in writing, software distributed under
840
+ * the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
841
+ * OF ANY KIND, either express or implied. See the License for the specific language
842
+ * governing permissions and limitations under the License.
843
+ */
844
+
845
+
846
+ const $f57aed4a881a3485$var$Context = /*#__PURE__*/ (0, $k7QOs$react).createContext(null);
847
+ function $f57aed4a881a3485$export$178405afcd8c5eb(props) {
848
+ let { children: children } = props;
849
+ let parent = (0, $k7QOs$useContext)($f57aed4a881a3485$var$Context);
850
+ let [modalCount, setModalCount] = (0, $k7QOs$useState)(0);
851
+ let context = (0, $k7QOs$useMemo)(()=>({
852
+ parent: parent,
853
+ modalCount: modalCount,
854
+ addModal () {
855
+ setModalCount((count)=>count + 1);
856
+ if (parent) parent.addModal();
857
+ },
858
+ removeModal () {
859
+ setModalCount((count)=>count - 1);
860
+ if (parent) parent.removeModal();
861
+ }
862
+ }), [
863
+ parent,
864
+ modalCount
865
+ ]);
866
+ return /*#__PURE__*/ (0, $k7QOs$react).createElement($f57aed4a881a3485$var$Context.Provider, {
867
+ value: context
868
+ }, children);
869
+ }
870
+ function $f57aed4a881a3485$export$d9aaed4c3ece1bc0() {
871
+ let context = (0, $k7QOs$useContext)($f57aed4a881a3485$var$Context);
872
+ return {
873
+ modalProviderProps: {
874
+ "aria-hidden": context && context.modalCount > 0 ? true : null
875
+ }
876
+ };
877
+ }
878
+ /**
879
+ * Creates a root node that will be aria-hidden if there are other modals open.
880
+ */ function $f57aed4a881a3485$var$OverlayContainerDOM(props) {
881
+ let { modalProviderProps: modalProviderProps } = $f57aed4a881a3485$export$d9aaed4c3ece1bc0();
882
+ return /*#__PURE__*/ (0, $k7QOs$react).createElement("div", {
883
+ "data-overlay-container": true,
884
+ ...props,
885
+ ...modalProviderProps
886
+ });
887
+ }
888
+ function $f57aed4a881a3485$export$bf688221f59024e5(props) {
889
+ return /*#__PURE__*/ (0, $k7QOs$react).createElement($f57aed4a881a3485$export$178405afcd8c5eb, null, /*#__PURE__*/ (0, $k7QOs$react).createElement($f57aed4a881a3485$var$OverlayContainerDOM, props));
890
+ }
891
+ function $f57aed4a881a3485$export$b47c3594eab58386(props) {
892
+ let isSSR = (0, $k7QOs$useIsSSR)();
893
+ let { portalContainer: portalContainer = isSSR ? null : document.body , ...rest } = props;
894
+ (0, $k7QOs$react).useEffect(()=>{
895
+ if (portalContainer === null || portalContainer === void 0 ? void 0 : portalContainer.closest("[data-overlay-container]")) throw new Error("An OverlayContainer must not be inside another container. Please change the portalContainer prop.");
896
+ }, [
897
+ portalContainer
898
+ ]);
899
+ if (!portalContainer) return null;
900
+ let contents = /*#__PURE__*/ (0, $k7QOs$react).createElement($f57aed4a881a3485$export$bf688221f59024e5, rest);
901
+ return /*#__PURE__*/ (0, $k7QOs$reactdom).createPortal(contents, portalContainer);
902
+ }
903
+ function $f57aed4a881a3485$export$33ffd74ebf07f060(options) {
904
+ // Add aria-hidden to all parent providers on mount, and restore on unmount.
905
+ let context = (0, $k7QOs$useContext)($f57aed4a881a3485$var$Context);
906
+ if (!context) throw new Error("Modal is not contained within a provider");
907
+ (0, $k7QOs$useEffect)(()=>{
908
+ if ((options === null || options === void 0 ? void 0 : options.isDisabled) || !context || !context.parent) return;
909
+ // The immediate context is from the provider containing this modal, so we only
910
+ // want to trigger aria-hidden on its parents not on the modal provider itself.
911
+ context.parent.addModal();
912
+ return ()=>{
913
+ if (context && context.parent) context.parent.removeModal();
914
+ };
915
+ }, [
916
+ context,
917
+ context.parent,
918
+ options === null || options === void 0 ? void 0 : options.isDisabled
919
+ ]);
920
+ return {
921
+ modalProps: {
922
+ "data-ismodal": !(options === null || options === void 0 ? void 0 : options.isDisabled)
923
+ }
924
+ };
925
+ }
926
+
927
+
928
+ /*
929
+ * Copyright 2020 Adobe. All rights reserved.
930
+ * This file is licensed to you under the Apache License, Version 2.0 (the "License");
931
+ * you may not use this file except in compliance with the License. You may obtain a copy
932
+ * of the License at http://www.apache.org/licenses/LICENSE-2.0
933
+ *
934
+ * Unless required by applicable law or agreed to in writing, software distributed under
935
+ * the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
936
+ * OF ANY KIND, either express or implied. See the License for the specific language
937
+ * governing permissions and limitations under the License.
938
+ */ var $61fe14465afefc5e$exports = {};
939
+ var $773d5888b972f1cf$exports = {};
940
+ $773d5888b972f1cf$exports = {
941
+ "dismiss": `تجاهل`
942
+ };
943
+
944
+
945
+ var $d11f19852b941573$exports = {};
946
+ $d11f19852b941573$exports = {
947
+ "dismiss": `Отхвърляне`
948
+ };
949
+
950
+
951
+ var $b983974c2ee1efb3$exports = {};
952
+ $b983974c2ee1efb3$exports = {
953
+ "dismiss": `Odstranit`
954
+ };
955
+
956
+
957
+ var $5809cc9d4e92de73$exports = {};
958
+ $5809cc9d4e92de73$exports = {
959
+ "dismiss": `Luk`
960
+ };
961
+
962
+
963
+ var $c68c2e4fc74398d1$exports = {};
964
+ $c68c2e4fc74398d1$exports = {
965
+ "dismiss": `Schließen`
966
+ };
967
+
968
+
969
+ var $0898b4c153db2b77$exports = {};
970
+ $0898b4c153db2b77$exports = {
971
+ "dismiss": `Απόρριψη`
972
+ };
973
+
974
+
975
+ var $6d74810286a15183$exports = {};
976
+ $6d74810286a15183$exports = {
977
+ "dismiss": `Dismiss`
978
+ };
979
+
980
+
981
+ var $309d73dc65f78055$exports = {};
982
+ $309d73dc65f78055$exports = {
983
+ "dismiss": `Descartar`
984
+ };
985
+
986
+
987
+ var $44ad94f7205cf593$exports = {};
988
+ $44ad94f7205cf593$exports = {
989
+ "dismiss": `Lõpeta`
990
+ };
991
+
992
+
993
+ var $7c28f5687f0779a9$exports = {};
994
+ $7c28f5687f0779a9$exports = {
995
+ "dismiss": `Hylkää`
996
+ };
997
+
998
+
999
+ var $e6d75df4b68bd73a$exports = {};
1000
+ $e6d75df4b68bd73a$exports = {
1001
+ "dismiss": `Rejeter`
1002
+ };
1003
+
1004
+
1005
+ var $87505c9dab186d0f$exports = {};
1006
+ $87505c9dab186d0f$exports = {
1007
+ "dismiss": `התעלם`
1008
+ };
1009
+
1010
+
1011
+ var $553439c3ffb3e492$exports = {};
1012
+ $553439c3ffb3e492$exports = {
1013
+ "dismiss": `Odbaci`
1014
+ };
1015
+
1016
+
1017
+ var $74cf411061b983a2$exports = {};
1018
+ $74cf411061b983a2$exports = {
1019
+ "dismiss": `Elutasítás`
1020
+ };
1021
+
1022
+
1023
+ var $e933f298574dc435$exports = {};
1024
+ $e933f298574dc435$exports = {
1025
+ "dismiss": `Ignora`
1026
+ };
1027
+
1028
+
1029
+ var $ac91fc9fe02f71f6$exports = {};
1030
+ $ac91fc9fe02f71f6$exports = {
1031
+ "dismiss": `閉じる`
1032
+ };
1033
+
1034
+
1035
+ var $52b96f86422025af$exports = {};
1036
+ $52b96f86422025af$exports = {
1037
+ "dismiss": `무시`
1038
+ };
1039
+
1040
+
1041
+ var $c0d724c3e51dafa6$exports = {};
1042
+ $c0d724c3e51dafa6$exports = {
1043
+ "dismiss": `Atmesti`
1044
+ };
1045
+
1046
+
1047
+ var $c92899672a3fe72e$exports = {};
1048
+ $c92899672a3fe72e$exports = {
1049
+ "dismiss": `Nerādīt`
1050
+ };
1051
+
1052
+
1053
+ var $9f576b39d8e7a9d6$exports = {};
1054
+ $9f576b39d8e7a9d6$exports = {
1055
+ "dismiss": `Lukk`
1056
+ };
1057
+
1058
+
1059
+ var $9d025808aeec81a7$exports = {};
1060
+ $9d025808aeec81a7$exports = {
1061
+ "dismiss": `Negeren`
1062
+ };
1063
+
1064
+
1065
+ var $fce709921e2c0fa6$exports = {};
1066
+ $fce709921e2c0fa6$exports = {
1067
+ "dismiss": `Zignoruj`
1068
+ };
1069
+
1070
+
1071
+ var $2599cf0c4ab37f59$exports = {};
1072
+ $2599cf0c4ab37f59$exports = {
1073
+ "dismiss": `Descartar`
1074
+ };
1075
+
1076
+
1077
+ var $3c220ae7ef8a35fd$exports = {};
1078
+ $3c220ae7ef8a35fd$exports = {
1079
+ "dismiss": `Dispensar`
1080
+ };
1081
+
1082
+
1083
+ var $93562b5094072f54$exports = {};
1084
+ $93562b5094072f54$exports = {
1085
+ "dismiss": `Revocare`
1086
+ };
1087
+
1088
+
1089
+ var $cd9e2abd0d06c7b4$exports = {};
1090
+ $cd9e2abd0d06c7b4$exports = {
1091
+ "dismiss": `Пропустить`
1092
+ };
1093
+
1094
+
1095
+ var $45375701f409adf1$exports = {};
1096
+ $45375701f409adf1$exports = {
1097
+ "dismiss": `Zrušiť`
1098
+ };
1099
+
1100
+
1101
+ var $27fab53a576de9dd$exports = {};
1102
+ $27fab53a576de9dd$exports = {
1103
+ "dismiss": `Opusti`
1104
+ };
1105
+
1106
+
1107
+ var $4438748d9952e7c7$exports = {};
1108
+ $4438748d9952e7c7$exports = {
1109
+ "dismiss": `Odbaci`
1110
+ };
1111
+
1112
+
1113
+ var $0936d7347ef4da4c$exports = {};
1114
+ $0936d7347ef4da4c$exports = {
1115
+ "dismiss": `Avvisa`
1116
+ };
1117
+
1118
+
1119
+ var $29700c92185d38f8$exports = {};
1120
+ $29700c92185d38f8$exports = {
1121
+ "dismiss": `Kapat`
1122
+ };
1123
+
1124
+
1125
+ var $662ccaf2be4c25b3$exports = {};
1126
+ $662ccaf2be4c25b3$exports = {
1127
+ "dismiss": `Скасувати`
1128
+ };
1129
+
1130
+
1131
+ var $d80a27deda7cdb3c$exports = {};
1132
+ $d80a27deda7cdb3c$exports = {
1133
+ "dismiss": `取消`
1134
+ };
1135
+
1136
+
1137
+ var $2b2734393847c884$exports = {};
1138
+ $2b2734393847c884$exports = {
1139
+ "dismiss": `關閉`
1140
+ };
1141
+
1142
+
1143
+ $61fe14465afefc5e$exports = {
1144
+ "ar-AE": $773d5888b972f1cf$exports,
1145
+ "bg-BG": $d11f19852b941573$exports,
1146
+ "cs-CZ": $b983974c2ee1efb3$exports,
1147
+ "da-DK": $5809cc9d4e92de73$exports,
1148
+ "de-DE": $c68c2e4fc74398d1$exports,
1149
+ "el-GR": $0898b4c153db2b77$exports,
1150
+ "en-US": $6d74810286a15183$exports,
1151
+ "es-ES": $309d73dc65f78055$exports,
1152
+ "et-EE": $44ad94f7205cf593$exports,
1153
+ "fi-FI": $7c28f5687f0779a9$exports,
1154
+ "fr-FR": $e6d75df4b68bd73a$exports,
1155
+ "he-IL": $87505c9dab186d0f$exports,
1156
+ "hr-HR": $553439c3ffb3e492$exports,
1157
+ "hu-HU": $74cf411061b983a2$exports,
1158
+ "it-IT": $e933f298574dc435$exports,
1159
+ "ja-JP": $ac91fc9fe02f71f6$exports,
1160
+ "ko-KR": $52b96f86422025af$exports,
1161
+ "lt-LT": $c0d724c3e51dafa6$exports,
1162
+ "lv-LV": $c92899672a3fe72e$exports,
1163
+ "nb-NO": $9f576b39d8e7a9d6$exports,
1164
+ "nl-NL": $9d025808aeec81a7$exports,
1165
+ "pl-PL": $fce709921e2c0fa6$exports,
1166
+ "pt-BR": $2599cf0c4ab37f59$exports,
1167
+ "pt-PT": $3c220ae7ef8a35fd$exports,
1168
+ "ro-RO": $93562b5094072f54$exports,
1169
+ "ru-RU": $cd9e2abd0d06c7b4$exports,
1170
+ "sk-SK": $45375701f409adf1$exports,
1171
+ "sl-SI": $27fab53a576de9dd$exports,
1172
+ "sr-SP": $4438748d9952e7c7$exports,
1173
+ "sv-SE": $0936d7347ef4da4c$exports,
1174
+ "tr-TR": $29700c92185d38f8$exports,
1175
+ "uk-UA": $662ccaf2be4c25b3$exports,
1176
+ "zh-CN": $d80a27deda7cdb3c$exports,
1177
+ "zh-TW": $2b2734393847c884$exports
1178
+ };
1179
+
1180
+
1181
+
1182
+
1183
+
1184
+
1185
+ function $86ea4cb521eb2e37$export$2317d149ed6f78c4(props) {
1186
+ let { onDismiss: onDismiss , ...otherProps } = props;
1187
+ let stringFormatter = (0, $k7QOs$useLocalizedStringFormatter)((0, (/*@__PURE__*/$parcel$interopDefault($61fe14465afefc5e$exports))));
1188
+ let labels = (0, $k7QOs$useLabels)(otherProps, stringFormatter.format("dismiss"));
1189
+ let onClick = ()=>{
1190
+ if (onDismiss) onDismiss();
1191
+ };
1192
+ return /*#__PURE__*/ (0, $k7QOs$react).createElement((0, $k7QOs$VisuallyHidden), null, /*#__PURE__*/ (0, $k7QOs$react).createElement("button", {
1193
+ ...labels,
1194
+ tabIndex: -1,
1195
+ onClick: onClick
1196
+ }));
1197
+ }
1198
+
1199
+
1200
+ /*
1201
+ * Copyright 2020 Adobe. All rights reserved.
1202
+ * This file is licensed to you under the Apache License, Version 2.0 (the "License");
1203
+ * you may not use this file except in compliance with the License. You may obtain a copy
1204
+ * of the License at http://www.apache.org/licenses/LICENSE-2.0
1205
+ *
1206
+ * Unless required by applicable law or agreed to in writing, software distributed under
1207
+ * the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
1208
+ * OF ANY KIND, either express or implied. See the License for the specific language
1209
+ * governing permissions and limitations under the License.
1210
+ */ // Keeps a ref count of all hidden elements. Added to when hiding an element, and
1211
+ // subtracted from when showing it again. When it reaches zero, aria-hidden is removed.
1212
+ let $5e3802645cc19319$var$refCountMap = new WeakMap();
1213
+ let $5e3802645cc19319$var$observerStack = [];
1214
+ function $5e3802645cc19319$export$1c3ebcada18427bf(targets, root = document.body) {
1215
+ let visibleNodes = new Set(targets);
1216
+ let hiddenNodes = new Set();
1217
+ let walk = (root)=>{
1218
+ // Keep live announcer and top layer elements (e.g. toasts) visible.
1219
+ for (let element of root.querySelectorAll("[data-live-announcer], [data-react-aria-top-layer]"))visibleNodes.add(element);
1220
+ let acceptNode = (node)=>{
1221
+ // Skip this node and its children if it is one of the target nodes, or a live announcer.
1222
+ // Also skip children of already hidden nodes, as aria-hidden is recursive. An exception is
1223
+ // made for elements with role="row" since VoiceOver on iOS has issues hiding elements with role="row".
1224
+ // For that case we want to hide the cells inside as well (https://bugs.webkit.org/show_bug.cgi?id=222623).
1225
+ if (visibleNodes.has(node) || hiddenNodes.has(node.parentElement) && node.parentElement.getAttribute("role") !== "row") return NodeFilter.FILTER_REJECT;
1226
+ // Skip this node but continue to children if one of the targets is inside the node.
1227
+ for (let target of visibleNodes){
1228
+ if (node.contains(target)) return NodeFilter.FILTER_SKIP;
1229
+ }
1230
+ return NodeFilter.FILTER_ACCEPT;
1231
+ };
1232
+ let walker = document.createTreeWalker(root, NodeFilter.SHOW_ELEMENT, {
1233
+ acceptNode: acceptNode
1234
+ });
1235
+ // TreeWalker does not include the root.
1236
+ let acceptRoot = acceptNode(root);
1237
+ if (acceptRoot === NodeFilter.FILTER_ACCEPT) hide(root);
1238
+ if (acceptRoot !== NodeFilter.FILTER_REJECT) {
1239
+ let node = walker.nextNode();
1240
+ while(node != null){
1241
+ hide(node);
1242
+ node = walker.nextNode();
1243
+ }
1244
+ }
1245
+ };
1246
+ let hide = (node)=>{
1247
+ var _refCountMap_get;
1248
+ let refCount = (_refCountMap_get = $5e3802645cc19319$var$refCountMap.get(node)) !== null && _refCountMap_get !== void 0 ? _refCountMap_get : 0;
1249
+ // If already aria-hidden, and the ref count is zero, then this element
1250
+ // was already hidden and there's nothing for us to do.
1251
+ if (node.getAttribute("aria-hidden") === "true" && refCount === 0) return;
1252
+ if (refCount === 0) node.setAttribute("aria-hidden", "true");
1253
+ hiddenNodes.add(node);
1254
+ $5e3802645cc19319$var$refCountMap.set(node, refCount + 1);
1255
+ };
1256
+ // If there is already a MutationObserver listening from a previous call,
1257
+ // disconnect it so the new on takes over.
1258
+ if ($5e3802645cc19319$var$observerStack.length) $5e3802645cc19319$var$observerStack[$5e3802645cc19319$var$observerStack.length - 1].disconnect();
1259
+ walk(root);
1260
+ let observer = new MutationObserver((changes)=>{
1261
+ for (let change of changes){
1262
+ if (change.type !== "childList" || change.addedNodes.length === 0) continue;
1263
+ // If the parent element of the added nodes is not within one of the targets,
1264
+ // and not already inside a hidden node, hide all of the new children.
1265
+ if (![
1266
+ ...visibleNodes,
1267
+ ...hiddenNodes
1268
+ ].some((node)=>node.contains(change.target))) {
1269
+ for (let node of change.removedNodes)if (node instanceof Element) {
1270
+ visibleNodes.delete(node);
1271
+ hiddenNodes.delete(node);
1272
+ }
1273
+ for (let node1 of change.addedNodes){
1274
+ if ((node1 instanceof HTMLElement || node1 instanceof SVGElement) && (node1.dataset.liveAnnouncer === "true" || node1.dataset.reactAriaTopLayer === "true")) visibleNodes.add(node1);
1275
+ else if (node1 instanceof Element) walk(node1);
1276
+ }
1277
+ }
1278
+ }
1279
+ });
1280
+ observer.observe(root, {
1281
+ childList: true,
1282
+ subtree: true
1283
+ });
1284
+ let observerWrapper = {
1285
+ observe () {
1286
+ observer.observe(root, {
1287
+ childList: true,
1288
+ subtree: true
1289
+ });
1290
+ },
1291
+ disconnect () {
1292
+ observer.disconnect();
1293
+ }
1294
+ };
1295
+ $5e3802645cc19319$var$observerStack.push(observerWrapper);
1296
+ return ()=>{
1297
+ observer.disconnect();
1298
+ for (let node of hiddenNodes){
1299
+ let count = $5e3802645cc19319$var$refCountMap.get(node);
1300
+ if (count === 1) {
1301
+ node.removeAttribute("aria-hidden");
1302
+ $5e3802645cc19319$var$refCountMap.delete(node);
1303
+ } else $5e3802645cc19319$var$refCountMap.set(node, count - 1);
1304
+ }
1305
+ // Remove this observer from the stack, and start the previous one.
1306
+ if (observerWrapper === $5e3802645cc19319$var$observerStack[$5e3802645cc19319$var$observerStack.length - 1]) {
1307
+ $5e3802645cc19319$var$observerStack.pop();
1308
+ if ($5e3802645cc19319$var$observerStack.length) $5e3802645cc19319$var$observerStack[$5e3802645cc19319$var$observerStack.length - 1].observe();
1309
+ } else $5e3802645cc19319$var$observerStack.splice($5e3802645cc19319$var$observerStack.indexOf(observerWrapper), 1);
1310
+ };
1311
+ }
1312
+
1313
+
1314
+ /*
1315
+ * Copyright 2022 Adobe. All rights reserved.
1316
+ * This file is licensed to you under the Apache License, Version 2.0 (the "License");
1317
+ * you may not use this file except in compliance with the License. You may obtain a copy
1318
+ * of the License at http://www.apache.org/licenses/LICENSE-2.0
1319
+ *
1320
+ * Unless required by applicable law or agreed to in writing, software distributed under
1321
+ * the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
1322
+ * OF ANY KIND, either express or implied. See the License for the specific language
1323
+ * governing permissions and limitations under the License.
1324
+ */
1325
+
1326
+
1327
+
1328
+
1329
+ function $f2f8a6077418541e$export$542a6fd13ac93354(props, state) {
1330
+ let { triggerRef: triggerRef , popoverRef: popoverRef , isNonModal: isNonModal , isKeyboardDismissDisabled: isKeyboardDismissDisabled , ...otherProps } = props;
1331
+ let { overlayProps: overlayProps , underlayProps: underlayProps } = (0, $a11501f3d1d39e6c$export$ea8f71083e90600f)({
1332
+ isOpen: state.isOpen,
1333
+ onClose: state.close,
1334
+ shouldCloseOnBlur: true,
1335
+ isDismissable: !isNonModal,
1336
+ isKeyboardDismissDisabled: isKeyboardDismissDisabled
1337
+ }, popoverRef);
1338
+ let { overlayProps: positionProps , arrowProps: arrowProps , placement: placement } = (0, $2a41e45df1593e64$export$d39e1813b3bdd0e1)({
1339
+ ...otherProps,
1340
+ targetRef: triggerRef,
1341
+ overlayRef: popoverRef,
1342
+ isOpen: state.isOpen,
1343
+ onClose: null
1344
+ });
1345
+ (0, $49c51c25361d4cd2$export$ee0f7cc6afcd1c18)({
1346
+ isDisabled: isNonModal
1347
+ });
1348
+ (0, $k7QOs$useLayoutEffect)(()=>{
1349
+ if (state.isOpen && !isNonModal && popoverRef.current) return (0, $5e3802645cc19319$export$1c3ebcada18427bf)([
1350
+ popoverRef.current
1351
+ ]);
1352
+ }, [
1353
+ isNonModal,
1354
+ state.isOpen,
1355
+ popoverRef
1356
+ ]);
1357
+ return {
1358
+ popoverProps: (0, $k7QOs$mergeProps)(overlayProps, positionProps),
1359
+ arrowProps: arrowProps,
1360
+ underlayProps: underlayProps,
1361
+ placement: placement
1362
+ };
1363
+ }
1364
+
1365
+
1366
+ /*
1367
+ * Copyright 2022 Adobe. All rights reserved.
1368
+ * This file is licensed to you under the Apache License, Version 2.0 (the "License");
1369
+ * you may not use this file except in compliance with the License. You may obtain a copy
1370
+ * of the License at http://www.apache.org/licenses/LICENSE-2.0
1371
+ *
1372
+ * Unless required by applicable law or agreed to in writing, software distributed under
1373
+ * the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
1374
+ * OF ANY KIND, either express or implied. See the License for the specific language
1375
+ * governing permissions and limitations under the License.
1376
+ */
1377
+
1378
+
1379
+
1380
+ /*
1381
+ * Copyright 2022 Adobe. All rights reserved.
1382
+ * This file is licensed to you under the Apache License, Version 2.0 (the "License");
1383
+ * you may not use this file except in compliance with the License. You may obtain a copy
1384
+ * of the License at http://www.apache.org/licenses/LICENSE-2.0
1385
+ *
1386
+ * Unless required by applicable law or agreed to in writing, software distributed under
1387
+ * the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
1388
+ * OF ANY KIND, either express or implied. See the License for the specific language
1389
+ * governing permissions and limitations under the License.
1390
+ */
1391
+
1392
+
1393
+
1394
+
1395
+ const $337b884510726a0d$export$a2200b96afd16271 = /*#__PURE__*/ (0, $k7QOs$react).createContext(null);
1396
+ function $337b884510726a0d$export$c6fdb837b070b4ff(props) {
1397
+ let isSSR = (0, $k7QOs$useIsSSR)();
1398
+ let { portalContainer: portalContainer = isSSR ? null : document.body } = props;
1399
+ let [contain, setContain] = (0, $k7QOs$useState)(false);
1400
+ let contextValue = (0, $k7QOs$useMemo)(()=>({
1401
+ contain: contain,
1402
+ setContain: setContain
1403
+ }), [
1404
+ contain,
1405
+ setContain
1406
+ ]);
1407
+ if (!portalContainer) return null;
1408
+ let contents = /*#__PURE__*/ (0, $k7QOs$react).createElement($337b884510726a0d$export$a2200b96afd16271.Provider, {
1409
+ value: contextValue
1410
+ }, /*#__PURE__*/ (0, $k7QOs$react).createElement((0, $k7QOs$FocusScope), {
1411
+ restoreFocus: true,
1412
+ contain: contain
1413
+ }, props.children));
1414
+ return /*#__PURE__*/ (0, $k7QOs$reactdom).createPortal(contents, portalContainer);
1415
+ }
1416
+ function $337b884510726a0d$export$14c98a7594375490() {
1417
+ let ctx = (0, $k7QOs$useContext)($337b884510726a0d$export$a2200b96afd16271);
1418
+ let setContain = ctx === null || ctx === void 0 ? void 0 : ctx.setContain;
1419
+ (0, $k7QOs$useLayoutEffect)(()=>{
1420
+ setContain === null || setContain === void 0 ? void 0 : setContain(true);
1421
+ }, [
1422
+ setContain
1423
+ ]);
1424
+ }
1425
+
1426
+
1427
+
1428
+ function $8ac8429251c45e4b$export$dbc0f175b25fb0fb(props, state, ref) {
1429
+ let { overlayProps: overlayProps , underlayProps: underlayProps } = (0, $a11501f3d1d39e6c$export$ea8f71083e90600f)({
1430
+ ...props,
1431
+ isOpen: state.isOpen,
1432
+ onClose: state.close
1433
+ }, ref);
1434
+ (0, $49c51c25361d4cd2$export$ee0f7cc6afcd1c18)({
1435
+ isDisabled: !state.isOpen
1436
+ });
1437
+ (0, $337b884510726a0d$export$14c98a7594375490)();
1438
+ (0, $k7QOs$useEffect)(()=>{
1439
+ if (state.isOpen) return (0, $5e3802645cc19319$export$1c3ebcada18427bf)([
1440
+ ref.current
1441
+ ]);
1442
+ }, [
1443
+ state.isOpen,
1444
+ ref
1445
+ ]);
1446
+ return {
1447
+ modalProps: (0, $k7QOs$mergeProps)(overlayProps),
1448
+ underlayProps: underlayProps
1449
+ };
1450
+ }
1451
+
1452
+
1453
+
1454
+
1455
+
1456
+ export {$2a41e45df1593e64$export$d39e1813b3bdd0e1 as useOverlayPosition, $a11501f3d1d39e6c$export$ea8f71083e90600f as useOverlay, $628037886ba31236$export$f9d5c8beee7d008d as useOverlayTrigger, $49c51c25361d4cd2$export$ee0f7cc6afcd1c18 as usePreventScroll, $f57aed4a881a3485$export$178405afcd8c5eb as ModalProvider, $f57aed4a881a3485$export$d9aaed4c3ece1bc0 as useModalProvider, $f57aed4a881a3485$export$bf688221f59024e5 as OverlayProvider, $f57aed4a881a3485$export$b47c3594eab58386 as OverlayContainer, $f57aed4a881a3485$export$33ffd74ebf07f060 as useModal, $86ea4cb521eb2e37$export$2317d149ed6f78c4 as DismissButton, $5e3802645cc19319$export$1c3ebcada18427bf as ariaHideOutside, $f2f8a6077418541e$export$542a6fd13ac93354 as usePopover, $8ac8429251c45e4b$export$dbc0f175b25fb0fb as useModalOverlay, $337b884510726a0d$export$c6fdb837b070b4ff as Overlay, $337b884510726a0d$export$14c98a7594375490 as useOverlayFocusContain};
1457
+ //# sourceMappingURL=module.js.map