react-tooltip 5.5.2 → 5.6.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.
@@ -1,2289 +1,2591 @@
1
1
  import require$$0, { createContext, useState, useCallback, useMemo, useContext, useRef, useEffect } from 'react';
2
2
 
3
- var jsxRuntime = {exports: {}};
4
-
5
- var reactJsxRuntime_development = {};
3
+ function getSide(placement) {
4
+ return placement.split('-')[0];
5
+ }
6
6
 
7
- /** @license React v16.14.0
8
- * react-jsx-runtime.development.js
9
- *
10
- * Copyright (c) Facebook, Inc. and its affiliates.
11
- *
12
- * This source code is licensed under the MIT license found in the
13
- * LICENSE file in the root directory of this source tree.
14
- */
7
+ function getAlignment(placement) {
8
+ return placement.split('-')[1];
9
+ }
15
10
 
16
- (function (exports) {
11
+ function getMainAxisFromPlacement(placement) {
12
+ return ['top', 'bottom'].includes(getSide(placement)) ? 'x' : 'y';
13
+ }
17
14
 
18
- {
19
- (function() {
15
+ function getLengthFromAxis(axis) {
16
+ return axis === 'y' ? 'height' : 'width';
17
+ }
20
18
 
21
- var React = require$$0;
19
+ function computeCoordsFromPlacement(_ref, placement, rtl) {
20
+ let {
21
+ reference,
22
+ floating
23
+ } = _ref;
24
+ const commonX = reference.x + reference.width / 2 - floating.width / 2;
25
+ const commonY = reference.y + reference.height / 2 - floating.height / 2;
26
+ const mainAxis = getMainAxisFromPlacement(placement);
27
+ const length = getLengthFromAxis(mainAxis);
28
+ const commonAlign = reference[length] / 2 - floating[length] / 2;
29
+ const side = getSide(placement);
30
+ const isVertical = mainAxis === 'x';
31
+ let coords;
22
32
 
23
- // ATTENTION
24
- // When adding new symbols to this file,
25
- // Please consider also adding to 'react-devtools-shared/src/backend/ReactSymbols'
26
- // The Symbol used to tag the ReactElement-like types. If there is no native Symbol
27
- // nor polyfill, then a plain number is used for performance.
28
- var REACT_ELEMENT_TYPE = 0xeac7;
29
- var REACT_PORTAL_TYPE = 0xeaca;
30
- exports.Fragment = 0xeacb;
31
- var REACT_STRICT_MODE_TYPE = 0xeacc;
32
- var REACT_PROFILER_TYPE = 0xead2;
33
- var REACT_PROVIDER_TYPE = 0xeacd;
34
- var REACT_CONTEXT_TYPE = 0xeace;
35
- var REACT_FORWARD_REF_TYPE = 0xead0;
36
- var REACT_SUSPENSE_TYPE = 0xead1;
37
- var REACT_SUSPENSE_LIST_TYPE = 0xead8;
38
- var REACT_MEMO_TYPE = 0xead3;
39
- var REACT_LAZY_TYPE = 0xead4;
40
- var REACT_BLOCK_TYPE = 0xead9;
41
- var REACT_SERVER_BLOCK_TYPE = 0xeada;
42
- var REACT_FUNDAMENTAL_TYPE = 0xead5;
43
- var REACT_DEBUG_TRACING_MODE_TYPE = 0xeae1;
44
- var REACT_LEGACY_HIDDEN_TYPE = 0xeae3;
33
+ switch (side) {
34
+ case 'top':
35
+ coords = {
36
+ x: commonX,
37
+ y: reference.y - floating.height
38
+ };
39
+ break;
45
40
 
46
- if (typeof Symbol === 'function' && Symbol.for) {
47
- var symbolFor = Symbol.for;
48
- REACT_ELEMENT_TYPE = symbolFor('react.element');
49
- REACT_PORTAL_TYPE = symbolFor('react.portal');
50
- exports.Fragment = symbolFor('react.fragment');
51
- REACT_STRICT_MODE_TYPE = symbolFor('react.strict_mode');
52
- REACT_PROFILER_TYPE = symbolFor('react.profiler');
53
- REACT_PROVIDER_TYPE = symbolFor('react.provider');
54
- REACT_CONTEXT_TYPE = symbolFor('react.context');
55
- REACT_FORWARD_REF_TYPE = symbolFor('react.forward_ref');
56
- REACT_SUSPENSE_TYPE = symbolFor('react.suspense');
57
- REACT_SUSPENSE_LIST_TYPE = symbolFor('react.suspense_list');
58
- REACT_MEMO_TYPE = symbolFor('react.memo');
59
- REACT_LAZY_TYPE = symbolFor('react.lazy');
60
- REACT_BLOCK_TYPE = symbolFor('react.block');
61
- REACT_SERVER_BLOCK_TYPE = symbolFor('react.server.block');
62
- REACT_FUNDAMENTAL_TYPE = symbolFor('react.fundamental');
63
- symbolFor('react.scope');
64
- symbolFor('react.opaque.id');
65
- REACT_DEBUG_TRACING_MODE_TYPE = symbolFor('react.debug_trace_mode');
66
- symbolFor('react.offscreen');
67
- REACT_LEGACY_HIDDEN_TYPE = symbolFor('react.legacy_hidden');
68
- }
41
+ case 'bottom':
42
+ coords = {
43
+ x: commonX,
44
+ y: reference.y + reference.height
45
+ };
46
+ break;
69
47
 
70
- var MAYBE_ITERATOR_SYMBOL = typeof Symbol === 'function' && Symbol.iterator;
71
- var FAUX_ITERATOR_SYMBOL = '@@iterator';
72
- function getIteratorFn(maybeIterable) {
73
- if (maybeIterable === null || typeof maybeIterable !== 'object') {
74
- return null;
75
- }
48
+ case 'right':
49
+ coords = {
50
+ x: reference.x + reference.width,
51
+ y: commonY
52
+ };
53
+ break;
76
54
 
77
- var maybeIterator = MAYBE_ITERATOR_SYMBOL && maybeIterable[MAYBE_ITERATOR_SYMBOL] || maybeIterable[FAUX_ITERATOR_SYMBOL];
55
+ case 'left':
56
+ coords = {
57
+ x: reference.x - floating.width,
58
+ y: commonY
59
+ };
60
+ break;
78
61
 
79
- if (typeof maybeIterator === 'function') {
80
- return maybeIterator;
81
- }
62
+ default:
63
+ coords = {
64
+ x: reference.x,
65
+ y: reference.y
66
+ };
67
+ }
82
68
 
83
- return null;
84
- }
69
+ switch (getAlignment(placement)) {
70
+ case 'start':
71
+ coords[mainAxis] -= commonAlign * (rtl && isVertical ? -1 : 1);
72
+ break;
85
73
 
86
- var ReactSharedInternals = React.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;
74
+ case 'end':
75
+ coords[mainAxis] += commonAlign * (rtl && isVertical ? -1 : 1);
76
+ break;
77
+ }
87
78
 
88
- function error(format) {
89
- {
90
- for (var _len2 = arguments.length, args = new Array(_len2 > 1 ? _len2 - 1 : 0), _key2 = 1; _key2 < _len2; _key2++) {
91
- args[_key2 - 1] = arguments[_key2];
92
- }
79
+ return coords;
80
+ }
93
81
 
94
- printWarning('error', format, args);
95
- }
96
- }
82
+ /**
83
+ * Computes the `x` and `y` coordinates that will place the floating element
84
+ * next to a reference element when it is given a certain positioning strategy.
85
+ *
86
+ * This export does not have any `platform` interface logic. You will need to
87
+ * write one for the platform you are using Floating UI with.
88
+ */
97
89
 
98
- function printWarning(level, format, args) {
99
- // When changing this logic, you might want to also
100
- // update consoleWithStackDev.www.js as well.
101
- {
102
- var ReactDebugCurrentFrame = ReactSharedInternals.ReactDebugCurrentFrame;
103
- var stack = '';
90
+ const computePosition$1 = async (reference, floating, config) => {
91
+ const {
92
+ placement = 'bottom',
93
+ strategy = 'absolute',
94
+ middleware = [],
95
+ platform
96
+ } = config;
97
+ const validMiddleware = middleware.filter(Boolean);
98
+ const rtl = await (platform.isRTL == null ? void 0 : platform.isRTL(floating));
104
99
 
105
- if (currentlyValidatingElement) {
106
- var name = getComponentName(currentlyValidatingElement.type);
107
- var owner = currentlyValidatingElement._owner;
108
- stack += describeComponentFrame(name, currentlyValidatingElement._source, owner && getComponentName(owner.type));
109
- }
100
+ {
101
+ if (platform == null) {
102
+ console.error(['Floating UI: `platform` property was not passed to config. If you', 'want to use Floating UI on the web, install @floating-ui/dom', 'instead of the /core package. Otherwise, you can create your own', '`platform`: https://floating-ui.com/docs/platform'].join(' '));
103
+ }
110
104
 
111
- stack += ReactDebugCurrentFrame.getStackAddendum();
105
+ if (validMiddleware.filter(_ref => {
106
+ let {
107
+ name
108
+ } = _ref;
109
+ return name === 'autoPlacement' || name === 'flip';
110
+ }).length > 1) {
111
+ throw new Error(['Floating UI: duplicate `flip` and/or `autoPlacement` middleware', 'detected. This will lead to an infinite loop. Ensure only one of', 'either has been passed to the `middleware` array.'].join(' '));
112
+ }
112
113
 
113
- if (stack !== '') {
114
- format += '%s';
115
- args = args.concat([stack]);
116
- }
114
+ if (!reference || !floating) {
115
+ console.error(['Floating UI: The reference and/or floating element was not defined', 'when `computePosition()` was called. Ensure that both elements have', 'been created and can be measured.'].join(' '));
116
+ }
117
+ }
117
118
 
118
- var argsWithFormat = args.map(function (item) {
119
- return '' + item;
120
- }); // Careful: RN currently depends on this prefix
119
+ let rects = await platform.getElementRects({
120
+ reference,
121
+ floating,
122
+ strategy
123
+ });
124
+ let {
125
+ x,
126
+ y
127
+ } = computeCoordsFromPlacement(rects, placement, rtl);
128
+ let statefulPlacement = placement;
129
+ let middlewareData = {};
130
+ let resetCount = 0;
121
131
 
122
- argsWithFormat.unshift('Warning: ' + format); // We intentionally don't use spread (or .apply) directly because it
123
- // breaks IE9: https://github.com/facebook/react/issues/13610
124
- // eslint-disable-next-line react-internal/no-production-logging
132
+ for (let i = 0; i < validMiddleware.length; i++) {
133
+ const {
134
+ name,
135
+ fn
136
+ } = validMiddleware[i];
137
+ const {
138
+ x: nextX,
139
+ y: nextY,
140
+ data,
141
+ reset
142
+ } = await fn({
143
+ x,
144
+ y,
145
+ initialPlacement: placement,
146
+ placement: statefulPlacement,
147
+ strategy,
148
+ middlewareData,
149
+ rects,
150
+ platform,
151
+ elements: {
152
+ reference,
153
+ floating
154
+ }
155
+ });
156
+ x = nextX != null ? nextX : x;
157
+ y = nextY != null ? nextY : y;
158
+ middlewareData = { ...middlewareData,
159
+ [name]: { ...middlewareData[name],
160
+ ...data
161
+ }
162
+ };
125
163
 
126
- Function.prototype.apply.call(console[level], console, argsWithFormat);
127
- }
128
- }
164
+ {
165
+ if (resetCount > 50) {
166
+ console.warn(['Floating UI: The middleware lifecycle appears to be running in an', 'infinite loop. This is usually caused by a `reset` continually', 'being returned without a break condition.'].join(' '));
167
+ }
168
+ }
129
169
 
130
- // Filter certain DOM attributes (e.g. src, href) if their values are empty strings.
170
+ if (reset && resetCount <= 50) {
171
+ resetCount++;
131
172
 
132
- var enableScopeAPI = false; // Experimental Create Event Handle API.
173
+ if (typeof reset === 'object') {
174
+ if (reset.placement) {
175
+ statefulPlacement = reset.placement;
176
+ }
133
177
 
134
- function isValidElementType(type) {
135
- if (typeof type === 'string' || typeof type === 'function') {
136
- return true;
137
- } // Note: typeof might be other than 'symbol' or 'number' (e.g. if it's a polyfill).
178
+ if (reset.rects) {
179
+ rects = reset.rects === true ? await platform.getElementRects({
180
+ reference,
181
+ floating,
182
+ strategy
183
+ }) : reset.rects;
184
+ }
138
185
 
186
+ ({
187
+ x,
188
+ y
189
+ } = computeCoordsFromPlacement(rects, statefulPlacement, rtl));
190
+ }
139
191
 
140
- if (type === exports.Fragment || type === REACT_PROFILER_TYPE || type === REACT_DEBUG_TRACING_MODE_TYPE || type === REACT_STRICT_MODE_TYPE || type === REACT_SUSPENSE_TYPE || type === REACT_SUSPENSE_LIST_TYPE || type === REACT_LEGACY_HIDDEN_TYPE || enableScopeAPI ) {
141
- return true;
142
- }
192
+ i = -1;
193
+ continue;
194
+ }
195
+ }
143
196
 
144
- if (typeof type === 'object' && type !== null) {
145
- if (type.$$typeof === REACT_LAZY_TYPE || type.$$typeof === REACT_MEMO_TYPE || type.$$typeof === REACT_PROVIDER_TYPE || type.$$typeof === REACT_CONTEXT_TYPE || type.$$typeof === REACT_FORWARD_REF_TYPE || type.$$typeof === REACT_FUNDAMENTAL_TYPE || type.$$typeof === REACT_BLOCK_TYPE || type[0] === REACT_SERVER_BLOCK_TYPE) {
146
- return true;
147
- }
148
- }
197
+ return {
198
+ x,
199
+ y,
200
+ placement: statefulPlacement,
201
+ strategy,
202
+ middlewareData
203
+ };
204
+ };
149
205
 
150
- return false;
151
- }
206
+ function expandPaddingObject(padding) {
207
+ return {
208
+ top: 0,
209
+ right: 0,
210
+ bottom: 0,
211
+ left: 0,
212
+ ...padding
213
+ };
214
+ }
152
215
 
216
+ function getSideObjectFromPadding(padding) {
217
+ return typeof padding !== 'number' ? expandPaddingObject(padding) : {
218
+ top: padding,
219
+ right: padding,
220
+ bottom: padding,
221
+ left: padding
222
+ };
223
+ }
153
224
 
154
- var BEFORE_SLASH_RE = /^(.*)[\\\/]/;
155
- function describeComponentFrame (name, source, ownerName) {
156
- var sourceInfo = '';
225
+ function rectToClientRect(rect) {
226
+ return { ...rect,
227
+ top: rect.y,
228
+ left: rect.x,
229
+ right: rect.x + rect.width,
230
+ bottom: rect.y + rect.height
231
+ };
232
+ }
157
233
 
158
- if (source) {
159
- var path = source.fileName;
160
- var fileName = path.replace(BEFORE_SLASH_RE, '');
234
+ /**
235
+ * Resolves with an object of overflow side offsets that determine how much the
236
+ * element is overflowing a given clipping boundary.
237
+ * - positive = overflowing the boundary by that number of pixels
238
+ * - negative = how many pixels left before it will overflow
239
+ * - 0 = lies flush with the boundary
240
+ * @see https://floating-ui.com/docs/detectOverflow
241
+ */
242
+ async function detectOverflow(middlewareArguments, options) {
243
+ var _await$platform$isEle;
161
244
 
162
- {
163
- // In DEV, include code for a common special case:
164
- // prefer "folder/index.js" instead of just "index.js".
165
- if (/^index\./.test(fileName)) {
166
- var match = path.match(BEFORE_SLASH_RE);
245
+ if (options === void 0) {
246
+ options = {};
247
+ }
167
248
 
168
- if (match) {
169
- var pathBeforeSlash = match[1];
249
+ const {
250
+ x,
251
+ y,
252
+ platform,
253
+ rects,
254
+ elements,
255
+ strategy
256
+ } = middlewareArguments;
257
+ const {
258
+ boundary = 'clippingAncestors',
259
+ rootBoundary = 'viewport',
260
+ elementContext = 'floating',
261
+ altBoundary = false,
262
+ padding = 0
263
+ } = options;
264
+ const paddingObject = getSideObjectFromPadding(padding);
265
+ const altContext = elementContext === 'floating' ? 'reference' : 'floating';
266
+ const element = elements[altBoundary ? altContext : elementContext];
267
+ const clippingClientRect = rectToClientRect(await platform.getClippingRect({
268
+ element: ((_await$platform$isEle = await (platform.isElement == null ? void 0 : platform.isElement(element))) != null ? _await$platform$isEle : true) ? element : element.contextElement || (await (platform.getDocumentElement == null ? void 0 : platform.getDocumentElement(elements.floating))),
269
+ boundary,
270
+ rootBoundary,
271
+ strategy
272
+ }));
273
+ const elementClientRect = rectToClientRect(platform.convertOffsetParentRelativeRectToViewportRelativeRect ? await platform.convertOffsetParentRelativeRectToViewportRelativeRect({
274
+ rect: elementContext === 'floating' ? { ...rects.floating,
275
+ x,
276
+ y
277
+ } : rects.reference,
278
+ offsetParent: await (platform.getOffsetParent == null ? void 0 : platform.getOffsetParent(elements.floating)),
279
+ strategy
280
+ }) : rects[elementContext]);
281
+ return {
282
+ top: clippingClientRect.top - elementClientRect.top + paddingObject.top,
283
+ bottom: elementClientRect.bottom - clippingClientRect.bottom + paddingObject.bottom,
284
+ left: clippingClientRect.left - elementClientRect.left + paddingObject.left,
285
+ right: elementClientRect.right - clippingClientRect.right + paddingObject.right
286
+ };
287
+ }
170
288
 
171
- if (pathBeforeSlash) {
172
- var folderName = pathBeforeSlash.replace(BEFORE_SLASH_RE, '');
173
- fileName = folderName + '/' + fileName;
174
- }
175
- }
176
- }
177
- }
289
+ const min$1 = Math.min;
290
+ const max$1 = Math.max;
178
291
 
179
- sourceInfo = ' (at ' + fileName + ':' + source.lineNumber + ')';
180
- } else if (ownerName) {
181
- sourceInfo = ' (created by ' + ownerName + ')';
182
- }
292
+ function within(min$1$1, value, max$1$1) {
293
+ return max$1(min$1$1, min$1(value, max$1$1));
294
+ }
183
295
 
184
- return '\n in ' + (name || 'Unknown') + sourceInfo;
185
- }
296
+ /**
297
+ * Positions an inner element of the floating element such that it is centered
298
+ * to the reference element.
299
+ * @see https://floating-ui.com/docs/arrow
300
+ */
301
+ const arrow = options => ({
302
+ name: 'arrow',
303
+ options,
186
304
 
187
- var Resolved = 1;
188
- function refineResolvedLazyComponent(lazyComponent) {
189
- return lazyComponent._status === Resolved ? lazyComponent._result : null;
190
- }
305
+ async fn(middlewareArguments) {
306
+ // Since `element` is required, we don't Partial<> the type
307
+ const {
308
+ element,
309
+ padding = 0
310
+ } = options != null ? options : {};
311
+ const {
312
+ x,
313
+ y,
314
+ placement,
315
+ rects,
316
+ platform
317
+ } = middlewareArguments;
191
318
 
192
- function getWrappedName(outerType, innerType, wrapperName) {
193
- var functionName = innerType.displayName || innerType.name || '';
194
- return outerType.displayName || (functionName !== '' ? wrapperName + "(" + functionName + ")" : wrapperName);
195
- }
319
+ if (element == null) {
320
+ {
321
+ console.warn('Floating UI: No `element` was passed to the `arrow` middleware.');
322
+ }
196
323
 
197
- function getComponentName(type) {
198
- if (type == null) {
199
- // Host root, text node or just invalid type.
200
- return null;
201
- }
324
+ return {};
325
+ }
202
326
 
203
- {
204
- if (typeof type.tag === 'number') {
205
- error('Received an unexpected object in getComponentName(). ' + 'This is likely a bug in React. Please file an issue.');
206
- }
207
- }
327
+ const paddingObject = getSideObjectFromPadding(padding);
328
+ const coords = {
329
+ x,
330
+ y
331
+ };
332
+ const axis = getMainAxisFromPlacement(placement);
333
+ const alignment = getAlignment(placement);
334
+ const length = getLengthFromAxis(axis);
335
+ const arrowDimensions = await platform.getDimensions(element);
336
+ const minProp = axis === 'y' ? 'top' : 'left';
337
+ const maxProp = axis === 'y' ? 'bottom' : 'right';
338
+ const endDiff = rects.reference[length] + rects.reference[axis] - coords[axis] - rects.floating[length];
339
+ const startDiff = coords[axis] - rects.reference[axis];
340
+ const arrowOffsetParent = await (platform.getOffsetParent == null ? void 0 : platform.getOffsetParent(element));
341
+ let clientSize = arrowOffsetParent ? axis === 'y' ? arrowOffsetParent.clientHeight || 0 : arrowOffsetParent.clientWidth || 0 : 0;
208
342
 
209
- if (typeof type === 'function') {
210
- return type.displayName || type.name || null;
211
- }
343
+ if (clientSize === 0) {
344
+ clientSize = rects.floating[length];
345
+ }
212
346
 
213
- if (typeof type === 'string') {
214
- return type;
215
- }
347
+ const centerToReference = endDiff / 2 - startDiff / 2; // Make sure the arrow doesn't overflow the floating element if the center
348
+ // point is outside the floating element's bounds
216
349
 
217
- switch (type) {
218
- case exports.Fragment:
219
- return 'Fragment';
350
+ const min = paddingObject[minProp];
351
+ const max = clientSize - arrowDimensions[length] - paddingObject[maxProp];
352
+ const center = clientSize / 2 - arrowDimensions[length] / 2 + centerToReference;
353
+ const offset = within(min, center, max); // Make sure that arrow points at the reference
220
354
 
221
- case REACT_PORTAL_TYPE:
222
- return 'Portal';
355
+ const alignmentPadding = alignment === 'start' ? paddingObject[minProp] : paddingObject[maxProp];
356
+ const shouldAddOffset = alignmentPadding > 0 && center !== offset && rects.reference[length] <= rects.floating[length];
357
+ const alignmentOffset = shouldAddOffset ? center < min ? min - center : max - center : 0;
358
+ return {
359
+ [axis]: coords[axis] - alignmentOffset,
360
+ data: {
361
+ [axis]: offset,
362
+ centerOffset: center - offset
363
+ }
364
+ };
365
+ }
223
366
 
224
- case REACT_PROFILER_TYPE:
225
- return "Profiler";
367
+ });
226
368
 
227
- case REACT_STRICT_MODE_TYPE:
228
- return 'StrictMode';
369
+ const hash$1 = {
370
+ left: 'right',
371
+ right: 'left',
372
+ bottom: 'top',
373
+ top: 'bottom'
374
+ };
375
+ function getOppositePlacement(placement) {
376
+ return placement.replace(/left|right|bottom|top/g, matched => hash$1[matched]);
377
+ }
229
378
 
230
- case REACT_SUSPENSE_TYPE:
231
- return 'Suspense';
379
+ function getAlignmentSides(placement, rects, rtl) {
380
+ if (rtl === void 0) {
381
+ rtl = false;
382
+ }
232
383
 
233
- case REACT_SUSPENSE_LIST_TYPE:
234
- return 'SuspenseList';
235
- }
384
+ const alignment = getAlignment(placement);
385
+ const mainAxis = getMainAxisFromPlacement(placement);
386
+ const length = getLengthFromAxis(mainAxis);
387
+ let mainAlignmentSide = mainAxis === 'x' ? alignment === (rtl ? 'end' : 'start') ? 'right' : 'left' : alignment === 'start' ? 'bottom' : 'top';
236
388
 
237
- if (typeof type === 'object') {
238
- switch (type.$$typeof) {
239
- case REACT_CONTEXT_TYPE:
240
- return 'Context.Consumer';
389
+ if (rects.reference[length] > rects.floating[length]) {
390
+ mainAlignmentSide = getOppositePlacement(mainAlignmentSide);
391
+ }
241
392
 
242
- case REACT_PROVIDER_TYPE:
243
- return 'Context.Provider';
393
+ return {
394
+ main: mainAlignmentSide,
395
+ cross: getOppositePlacement(mainAlignmentSide)
396
+ };
397
+ }
244
398
 
245
- case REACT_FORWARD_REF_TYPE:
246
- return getWrappedName(type, type.render, 'ForwardRef');
399
+ const hash = {
400
+ start: 'end',
401
+ end: 'start'
402
+ };
403
+ function getOppositeAlignmentPlacement(placement) {
404
+ return placement.replace(/start|end/g, matched => hash[matched]);
405
+ }
247
406
 
248
- case REACT_MEMO_TYPE:
249
- return getComponentName(type.type);
407
+ const sides = ['top', 'right', 'bottom', 'left'];
408
+ const allPlacements = /*#__PURE__*/sides.reduce((acc, side) => acc.concat(side, side + "-start", side + "-end"), []);
250
409
 
251
- case REACT_BLOCK_TYPE:
252
- return getComponentName(type.render);
410
+ function getPlacementList(alignment, autoAlignment, allowedPlacements) {
411
+ const allowedPlacementsSortedByAlignment = alignment ? [...allowedPlacements.filter(placement => getAlignment(placement) === alignment), ...allowedPlacements.filter(placement => getAlignment(placement) !== alignment)] : allowedPlacements.filter(placement => getSide(placement) === placement);
412
+ return allowedPlacementsSortedByAlignment.filter(placement => {
413
+ if (alignment) {
414
+ return getAlignment(placement) === alignment || (autoAlignment ? getOppositeAlignmentPlacement(placement) !== placement : false);
415
+ }
253
416
 
254
- case REACT_LAZY_TYPE:
255
- {
256
- var thenable = type;
257
- var resolvedThenable = refineResolvedLazyComponent(thenable);
417
+ return true;
418
+ });
419
+ }
258
420
 
259
- if (resolvedThenable) {
260
- return getComponentName(resolvedThenable);
261
- }
421
+ /**
422
+ * Automatically chooses the `placement` which has the most space available.
423
+ * @see https://floating-ui.com/docs/autoPlacement
424
+ */
425
+ const autoPlacement = function (options) {
426
+ if (options === void 0) {
427
+ options = {};
428
+ }
262
429
 
263
- break;
264
- }
265
- }
266
- }
430
+ return {
431
+ name: 'autoPlacement',
432
+ options,
267
433
 
268
- return null;
269
- }
434
+ async fn(middlewareArguments) {
435
+ var _middlewareData$autoP, _middlewareData$autoP2, _middlewareData$autoP3, _middlewareData$autoP4, _placementsSortedByLe;
270
436
 
271
- var loggedTypeFailures = {};
272
- ReactSharedInternals.ReactDebugCurrentFrame;
273
- var currentlyValidatingElement = null;
437
+ const {
438
+ x,
439
+ y,
440
+ rects,
441
+ middlewareData,
442
+ placement,
443
+ platform,
444
+ elements
445
+ } = middlewareArguments;
446
+ const {
447
+ alignment = null,
448
+ allowedPlacements = allPlacements,
449
+ autoAlignment = true,
450
+ ...detectOverflowOptions
451
+ } = options;
452
+ const placements = getPlacementList(alignment, autoAlignment, allowedPlacements);
453
+ const overflow = await detectOverflow(middlewareArguments, detectOverflowOptions);
454
+ const currentIndex = (_middlewareData$autoP = (_middlewareData$autoP2 = middlewareData.autoPlacement) == null ? void 0 : _middlewareData$autoP2.index) != null ? _middlewareData$autoP : 0;
455
+ const currentPlacement = placements[currentIndex];
274
456
 
275
- function setCurrentlyValidatingElement(element) {
276
- {
277
- currentlyValidatingElement = element;
278
- }
279
- }
457
+ if (currentPlacement == null) {
458
+ return {};
459
+ }
280
460
 
281
- function checkPropTypes(typeSpecs, values, location, componentName, element) {
282
- {
283
- // $FlowFixMe This is okay but Flow doesn't know it.
284
- var has = Function.call.bind(Object.prototype.hasOwnProperty);
461
+ const {
462
+ main,
463
+ cross
464
+ } = getAlignmentSides(currentPlacement, rects, await (platform.isRTL == null ? void 0 : platform.isRTL(elements.floating))); // Make `computeCoords` start from the right place
285
465
 
286
- for (var typeSpecName in typeSpecs) {
287
- if (has(typeSpecs, typeSpecName)) {
288
- var error$1 = void 0; // Prop type validation may throw. In case they do, we don't want to
289
- // fail the render phase where it didn't fail before. So we log it.
290
- // After these have been cleaned up, we'll let them throw.
466
+ if (placement !== currentPlacement) {
467
+ return {
468
+ x,
469
+ y,
470
+ reset: {
471
+ placement: placements[0]
472
+ }
473
+ };
474
+ }
291
475
 
292
- try {
293
- // This is intentionally an invariant that gets caught. It's the same
294
- // behavior as without this statement except with a better message.
295
- if (typeof typeSpecs[typeSpecName] !== 'function') {
296
- var err = Error((componentName || 'React class') + ': ' + location + ' type `' + typeSpecName + '` is invalid; ' + 'it must be a function, usually from the `prop-types` package, but received `' + typeof typeSpecs[typeSpecName] + '`.' + 'This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`.');
297
- err.name = 'Invariant Violation';
298
- throw err;
299
- }
476
+ const currentOverflows = [overflow[getSide(currentPlacement)], overflow[main], overflow[cross]];
477
+ const allOverflows = [...((_middlewareData$autoP3 = (_middlewareData$autoP4 = middlewareData.autoPlacement) == null ? void 0 : _middlewareData$autoP4.overflows) != null ? _middlewareData$autoP3 : []), {
478
+ placement: currentPlacement,
479
+ overflows: currentOverflows
480
+ }];
481
+ const nextPlacement = placements[currentIndex + 1]; // There are more placements to check
300
482
 
301
- error$1 = typeSpecs[typeSpecName](values, typeSpecName, componentName, location, null, 'SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED');
302
- } catch (ex) {
303
- error$1 = ex;
304
- }
483
+ if (nextPlacement) {
484
+ return {
485
+ data: {
486
+ index: currentIndex + 1,
487
+ overflows: allOverflows
488
+ },
489
+ reset: {
490
+ placement: nextPlacement
491
+ }
492
+ };
493
+ }
305
494
 
306
- if (error$1 && !(error$1 instanceof Error)) {
307
- setCurrentlyValidatingElement(element);
495
+ const placementsSortedByLeastOverflow = allOverflows.slice().sort((a, b) => a.overflows[0] - b.overflows[0]);
496
+ const placementThatFitsOnAllSides = (_placementsSortedByLe = placementsSortedByLeastOverflow.find(_ref => {
497
+ let {
498
+ overflows
499
+ } = _ref;
500
+ return overflows.every(overflow => overflow <= 0);
501
+ })) == null ? void 0 : _placementsSortedByLe.placement;
502
+ const resetPlacement = placementThatFitsOnAllSides != null ? placementThatFitsOnAllSides : placementsSortedByLeastOverflow[0].placement;
308
503
 
309
- error('%s: type specification of %s' + ' `%s` is invalid; the type checker ' + 'function must return `null` or an `Error` but returned a %s. ' + 'You may have forgotten to pass an argument to the type checker ' + 'creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and ' + 'shape all require an argument).', componentName || 'React class', location, typeSpecName, typeof error$1);
504
+ if (resetPlacement !== placement) {
505
+ return {
506
+ data: {
507
+ index: currentIndex + 1,
508
+ overflows: allOverflows
509
+ },
510
+ reset: {
511
+ placement: resetPlacement
512
+ }
513
+ };
514
+ }
310
515
 
311
- setCurrentlyValidatingElement(null);
312
- }
516
+ return {};
517
+ }
313
518
 
314
- if (error$1 instanceof Error && !(error$1.message in loggedTypeFailures)) {
315
- // Only monitor this failure once because there tends to be a lot of the
316
- // same error.
317
- loggedTypeFailures[error$1.message] = true;
318
- setCurrentlyValidatingElement(element);
519
+ };
520
+ };
319
521
 
320
- error('Failed %s type: %s', location, error$1.message);
522
+ function getExpandedPlacements(placement) {
523
+ const oppositePlacement = getOppositePlacement(placement);
524
+ return [getOppositeAlignmentPlacement(placement), oppositePlacement, getOppositeAlignmentPlacement(oppositePlacement)];
525
+ }
321
526
 
322
- setCurrentlyValidatingElement(null);
323
- }
324
- }
325
- }
326
- }
327
- }
527
+ /**
528
+ * Changes the placement of the floating element to one that will fit if the
529
+ * initially specified `placement` does not.
530
+ * @see https://floating-ui.com/docs/flip
531
+ */
532
+ const flip = function (options) {
533
+ if (options === void 0) {
534
+ options = {};
535
+ }
328
536
 
329
- var ReactCurrentOwner = ReactSharedInternals.ReactCurrentOwner;
330
- var hasOwnProperty = Object.prototype.hasOwnProperty;
331
- var RESERVED_PROPS = {
332
- key: true,
333
- ref: true,
334
- __self: true,
335
- __source: true
336
- };
337
- var specialPropKeyWarningShown;
338
- var specialPropRefWarningShown;
339
- var didWarnAboutStringRefs;
537
+ return {
538
+ name: 'flip',
539
+ options,
340
540
 
341
- {
342
- didWarnAboutStringRefs = {};
343
- }
541
+ async fn(middlewareArguments) {
542
+ var _middlewareData$flip;
344
543
 
345
- function hasValidRef(config) {
346
- {
347
- if (hasOwnProperty.call(config, 'ref')) {
348
- var getter = Object.getOwnPropertyDescriptor(config, 'ref').get;
544
+ const {
545
+ placement,
546
+ middlewareData,
547
+ rects,
548
+ initialPlacement,
549
+ platform,
550
+ elements
551
+ } = middlewareArguments;
552
+ const {
553
+ mainAxis: checkMainAxis = true,
554
+ crossAxis: checkCrossAxis = true,
555
+ fallbackPlacements: specifiedFallbackPlacements,
556
+ fallbackStrategy = 'bestFit',
557
+ flipAlignment = true,
558
+ ...detectOverflowOptions
559
+ } = options;
560
+ const side = getSide(placement);
561
+ const isBasePlacement = side === initialPlacement;
562
+ const fallbackPlacements = specifiedFallbackPlacements || (isBasePlacement || !flipAlignment ? [getOppositePlacement(initialPlacement)] : getExpandedPlacements(initialPlacement));
563
+ const placements = [initialPlacement, ...fallbackPlacements];
564
+ const overflow = await detectOverflow(middlewareArguments, detectOverflowOptions);
565
+ const overflows = [];
566
+ let overflowsData = ((_middlewareData$flip = middlewareData.flip) == null ? void 0 : _middlewareData$flip.overflows) || [];
349
567
 
350
- if (getter && getter.isReactWarning) {
351
- return false;
352
- }
353
- }
354
- }
568
+ if (checkMainAxis) {
569
+ overflows.push(overflow[side]);
570
+ }
355
571
 
356
- return config.ref !== undefined;
357
- }
572
+ if (checkCrossAxis) {
573
+ const {
574
+ main,
575
+ cross
576
+ } = getAlignmentSides(placement, rects, await (platform.isRTL == null ? void 0 : platform.isRTL(elements.floating)));
577
+ overflows.push(overflow[main], overflow[cross]);
578
+ }
358
579
 
359
- function hasValidKey(config) {
360
- {
361
- if (hasOwnProperty.call(config, 'key')) {
362
- var getter = Object.getOwnPropertyDescriptor(config, 'key').get;
580
+ overflowsData = [...overflowsData, {
581
+ placement,
582
+ overflows
583
+ }]; // One or more sides is overflowing
363
584
 
364
- if (getter && getter.isReactWarning) {
365
- return false;
366
- }
367
- }
368
- }
585
+ if (!overflows.every(side => side <= 0)) {
586
+ var _middlewareData$flip$, _middlewareData$flip2;
369
587
 
370
- return config.key !== undefined;
371
- }
588
+ const nextIndex = ((_middlewareData$flip$ = (_middlewareData$flip2 = middlewareData.flip) == null ? void 0 : _middlewareData$flip2.index) != null ? _middlewareData$flip$ : 0) + 1;
589
+ const nextPlacement = placements[nextIndex];
372
590
 
373
- function warnIfStringRefCannotBeAutoConverted(config, self) {
374
- {
375
- if (typeof config.ref === 'string' && ReactCurrentOwner.current && self && ReactCurrentOwner.current.stateNode !== self) {
376
- var componentName = getComponentName(ReactCurrentOwner.current.type);
591
+ if (nextPlacement) {
592
+ // Try next placement and re-run the lifecycle
593
+ return {
594
+ data: {
595
+ index: nextIndex,
596
+ overflows: overflowsData
597
+ },
598
+ reset: {
599
+ placement: nextPlacement
600
+ }
601
+ };
602
+ }
377
603
 
378
- if (!didWarnAboutStringRefs[componentName]) {
379
- error('Component "%s" contains the string ref "%s". ' + 'Support for string refs will be removed in a future major release. ' + 'This case cannot be automatically converted to an arrow function. ' + 'We ask you to manually fix this case by using useRef() or createRef() instead. ' + 'Learn more about using refs safely here: ' + 'https://reactjs.org/link/strict-mode-string-ref', getComponentName(ReactCurrentOwner.current.type), config.ref);
380
-
381
- didWarnAboutStringRefs[componentName] = true;
382
- }
383
- }
384
- }
385
- }
386
-
387
- function defineKeyPropWarningGetter(props, displayName) {
388
- {
389
- var warnAboutAccessingKey = function () {
390
- if (!specialPropKeyWarningShown) {
391
- specialPropKeyWarningShown = true;
392
-
393
- error('%s: `key` is not a prop. Trying to access it will result ' + 'in `undefined` being returned. If you need to access the same ' + 'value within the child component, you should pass it as a different ' + 'prop. (https://reactjs.org/link/special-props)', displayName);
394
- }
395
- };
396
-
397
- warnAboutAccessingKey.isReactWarning = true;
398
- Object.defineProperty(props, 'key', {
399
- get: warnAboutAccessingKey,
400
- configurable: true
401
- });
402
- }
403
- }
404
-
405
- function defineRefPropWarningGetter(props, displayName) {
406
- {
407
- var warnAboutAccessingRef = function () {
408
- if (!specialPropRefWarningShown) {
409
- specialPropRefWarningShown = true;
410
-
411
- error('%s: `ref` is not a prop. Trying to access it will result ' + 'in `undefined` being returned. If you need to access the same ' + 'value within the child component, you should pass it as a different ' + 'prop. (https://reactjs.org/link/special-props)', displayName);
412
- }
413
- };
414
-
415
- warnAboutAccessingRef.isReactWarning = true;
416
- Object.defineProperty(props, 'ref', {
417
- get: warnAboutAccessingRef,
418
- configurable: true
419
- });
420
- }
421
- }
422
- /**
423
- * Factory method to create a new React element. This no longer adheres to
424
- * the class pattern, so do not use new to call it. Also, instanceof check
425
- * will not work. Instead test $$typeof field against Symbol.for('react.element') to check
426
- * if something is a React Element.
427
- *
428
- * @param {*} type
429
- * @param {*} props
430
- * @param {*} key
431
- * @param {string|object} ref
432
- * @param {*} owner
433
- * @param {*} self A *temporary* helper to detect places where `this` is
434
- * different from the `owner` when React.createElement is called, so that we
435
- * can warn. We want to get rid of owner and replace string `ref`s with arrow
436
- * functions, and as long as `this` and owner are the same, there will be no
437
- * change in behavior.
438
- * @param {*} source An annotation object (added by a transpiler or otherwise)
439
- * indicating filename, line number, and/or other information.
440
- * @internal
441
- */
604
+ let resetPlacement = 'bottom';
442
605
 
606
+ switch (fallbackStrategy) {
607
+ case 'bestFit':
608
+ {
609
+ var _overflowsData$map$so;
443
610
 
444
- var ReactElement = function (type, key, ref, self, source, owner, props) {
445
- var element = {
446
- // This tag allows us to uniquely identify this as a React Element
447
- $$typeof: REACT_ELEMENT_TYPE,
448
- // Built-in properties that belong on the element
449
- type: type,
450
- key: key,
451
- ref: ref,
452
- props: props,
453
- // Record the component responsible for creating this element.
454
- _owner: owner
455
- };
611
+ const placement = (_overflowsData$map$so = overflowsData.map(d => [d, d.overflows.filter(overflow => overflow > 0).reduce((acc, overflow) => acc + overflow, 0)]).sort((a, b) => a[1] - b[1])[0]) == null ? void 0 : _overflowsData$map$so[0].placement;
456
612
 
457
- {
458
- // The validation flag is currently mutative. We put it on
459
- // an external backing store so that we can freeze the whole object.
460
- // This can be replaced with a WeakMap once they are implemented in
461
- // commonly used development environments.
462
- element._store = {}; // To make comparing ReactElements easier for testing purposes, we make
463
- // the validation flag non-enumerable (where possible, which should
464
- // include every environment we run tests in), so the test framework
465
- // ignores it.
613
+ if (placement) {
614
+ resetPlacement = placement;
615
+ }
466
616
 
467
- Object.defineProperty(element._store, 'validated', {
468
- configurable: false,
469
- enumerable: false,
470
- writable: true,
471
- value: false
472
- }); // self and source are DEV only properties.
617
+ break;
618
+ }
473
619
 
474
- Object.defineProperty(element, '_self', {
475
- configurable: false,
476
- enumerable: false,
477
- writable: false,
478
- value: self
479
- }); // Two elements created in two different places should be considered
480
- // equal for testing purposes and therefore we hide it from enumeration.
620
+ case 'initialPlacement':
621
+ resetPlacement = initialPlacement;
622
+ break;
623
+ }
481
624
 
482
- Object.defineProperty(element, '_source', {
483
- configurable: false,
484
- enumerable: false,
485
- writable: false,
486
- value: source
487
- });
625
+ if (placement !== resetPlacement) {
626
+ return {
627
+ reset: {
628
+ placement: resetPlacement
629
+ }
630
+ };
631
+ }
632
+ }
488
633
 
489
- if (Object.freeze) {
490
- Object.freeze(element.props);
491
- Object.freeze(element);
492
- }
493
- }
634
+ return {};
635
+ }
494
636
 
495
- return element;
496
- };
497
- /**
498
- * https://github.com/reactjs/rfcs/pull/107
499
- * @param {*} type
500
- * @param {object} props
501
- * @param {string} key
502
- */
637
+ };
638
+ };
503
639
 
504
- function jsxDEV(type, config, maybeKey, source, self) {
505
- {
506
- var propName; // Reserved names are extracted
640
+ async function convertValueToCoords(middlewareArguments, value) {
641
+ const {
642
+ placement,
643
+ platform,
644
+ elements
645
+ } = middlewareArguments;
646
+ const rtl = await (platform.isRTL == null ? void 0 : platform.isRTL(elements.floating));
647
+ const side = getSide(placement);
648
+ const alignment = getAlignment(placement);
649
+ const isVertical = getMainAxisFromPlacement(placement) === 'x';
650
+ const mainAxisMulti = ['left', 'top'].includes(side) ? -1 : 1;
651
+ const crossAxisMulti = rtl && isVertical ? -1 : 1;
652
+ const rawValue = typeof value === 'function' ? value(middlewareArguments) : value; // eslint-disable-next-line prefer-const
507
653
 
508
- var props = {};
509
- var key = null;
510
- var ref = null; // Currently, key can be spread in as a prop. This causes a potential
511
- // issue if key is also explicitly declared (ie. <div {...props} key="Hi" />
512
- // or <div key="Hi" {...props} /> ). We want to deprecate key spread,
513
- // but as an intermediary step, we will use jsxDEV for everything except
514
- // <div {...props} key="Hi" />, because we aren't currently able to tell if
515
- // key is explicitly declared to be undefined or not.
654
+ let {
655
+ mainAxis,
656
+ crossAxis,
657
+ alignmentAxis
658
+ } = typeof rawValue === 'number' ? {
659
+ mainAxis: rawValue,
660
+ crossAxis: 0,
661
+ alignmentAxis: null
662
+ } : {
663
+ mainAxis: 0,
664
+ crossAxis: 0,
665
+ alignmentAxis: null,
666
+ ...rawValue
667
+ };
516
668
 
517
- if (maybeKey !== undefined) {
518
- key = '' + maybeKey;
519
- }
669
+ if (alignment && typeof alignmentAxis === 'number') {
670
+ crossAxis = alignment === 'end' ? alignmentAxis * -1 : alignmentAxis;
671
+ }
520
672
 
521
- if (hasValidKey(config)) {
522
- key = '' + config.key;
523
- }
673
+ return isVertical ? {
674
+ x: crossAxis * crossAxisMulti,
675
+ y: mainAxis * mainAxisMulti
676
+ } : {
677
+ x: mainAxis * mainAxisMulti,
678
+ y: crossAxis * crossAxisMulti
679
+ };
680
+ }
681
+ /**
682
+ * Displaces the floating element from its reference element.
683
+ * @see https://floating-ui.com/docs/offset
684
+ */
524
685
 
525
- if (hasValidRef(config)) {
526
- ref = config.ref;
527
- warnIfStringRefCannotBeAutoConverted(config, self);
528
- } // Remaining properties are added to a new props object
686
+ const offset = function (value) {
687
+ if (value === void 0) {
688
+ value = 0;
689
+ }
529
690
 
691
+ return {
692
+ name: 'offset',
693
+ options: value,
530
694
 
531
- for (propName in config) {
532
- if (hasOwnProperty.call(config, propName) && !RESERVED_PROPS.hasOwnProperty(propName)) {
533
- props[propName] = config[propName];
534
- }
535
- } // Resolve default props
695
+ async fn(middlewareArguments) {
696
+ const {
697
+ x,
698
+ y
699
+ } = middlewareArguments;
700
+ const diffCoords = await convertValueToCoords(middlewareArguments, value);
701
+ return {
702
+ x: x + diffCoords.x,
703
+ y: y + diffCoords.y,
704
+ data: diffCoords
705
+ };
706
+ }
536
707
 
708
+ };
709
+ };
537
710
 
538
- if (type && type.defaultProps) {
539
- var defaultProps = type.defaultProps;
711
+ function getCrossAxis(axis) {
712
+ return axis === 'x' ? 'y' : 'x';
713
+ }
540
714
 
541
- for (propName in defaultProps) {
542
- if (props[propName] === undefined) {
543
- props[propName] = defaultProps[propName];
544
- }
545
- }
546
- }
715
+ /**
716
+ * Shifts the floating element in order to keep it in view when it will overflow
717
+ * a clipping boundary.
718
+ * @see https://floating-ui.com/docs/shift
719
+ */
720
+ const shift = function (options) {
721
+ if (options === void 0) {
722
+ options = {};
723
+ }
547
724
 
548
- if (key || ref) {
549
- var displayName = typeof type === 'function' ? type.displayName || type.name || 'Unknown' : type;
725
+ return {
726
+ name: 'shift',
727
+ options,
550
728
 
551
- if (key) {
552
- defineKeyPropWarningGetter(props, displayName);
553
- }
554
-
555
- if (ref) {
556
- defineRefPropWarningGetter(props, displayName);
557
- }
558
- }
729
+ async fn(middlewareArguments) {
730
+ const {
731
+ x,
732
+ y,
733
+ placement
734
+ } = middlewareArguments;
735
+ const {
736
+ mainAxis: checkMainAxis = true,
737
+ crossAxis: checkCrossAxis = false,
738
+ limiter = {
739
+ fn: _ref => {
740
+ let {
741
+ x,
742
+ y
743
+ } = _ref;
744
+ return {
745
+ x,
746
+ y
747
+ };
748
+ }
749
+ },
750
+ ...detectOverflowOptions
751
+ } = options;
752
+ const coords = {
753
+ x,
754
+ y
755
+ };
756
+ const overflow = await detectOverflow(middlewareArguments, detectOverflowOptions);
757
+ const mainAxis = getMainAxisFromPlacement(getSide(placement));
758
+ const crossAxis = getCrossAxis(mainAxis);
759
+ let mainAxisCoord = coords[mainAxis];
760
+ let crossAxisCoord = coords[crossAxis];
559
761
 
560
- return ReactElement(type, key, ref, self, source, ReactCurrentOwner.current, props);
561
- }
562
- }
762
+ if (checkMainAxis) {
763
+ const minSide = mainAxis === 'y' ? 'top' : 'left';
764
+ const maxSide = mainAxis === 'y' ? 'bottom' : 'right';
765
+ const min = mainAxisCoord + overflow[minSide];
766
+ const max = mainAxisCoord - overflow[maxSide];
767
+ mainAxisCoord = within(min, mainAxisCoord, max);
768
+ }
563
769
 
564
- var ReactCurrentOwner$1 = ReactSharedInternals.ReactCurrentOwner;
565
- ReactSharedInternals.ReactDebugCurrentFrame;
770
+ if (checkCrossAxis) {
771
+ const minSide = crossAxis === 'y' ? 'top' : 'left';
772
+ const maxSide = crossAxis === 'y' ? 'bottom' : 'right';
773
+ const min = crossAxisCoord + overflow[minSide];
774
+ const max = crossAxisCoord - overflow[maxSide];
775
+ crossAxisCoord = within(min, crossAxisCoord, max);
776
+ }
566
777
 
567
- function setCurrentlyValidatingElement$1(element) {
568
- currentlyValidatingElement = element;
569
- }
778
+ const limitedCoords = limiter.fn({ ...middlewareArguments,
779
+ [mainAxis]: mainAxisCoord,
780
+ [crossAxis]: crossAxisCoord
781
+ });
782
+ return { ...limitedCoords,
783
+ data: {
784
+ x: limitedCoords.x - x,
785
+ y: limitedCoords.y - y
786
+ }
787
+ };
788
+ }
570
789
 
571
- var propTypesMisspellWarningShown;
790
+ };
791
+ };
572
792
 
573
- {
574
- propTypesMisspellWarningShown = false;
575
- }
576
- /**
577
- * Verifies the object is a ReactElement.
578
- * See https://reactjs.org/docs/react-api.html#isvalidelement
579
- * @param {?object} object
580
- * @return {boolean} True if `object` is a ReactElement.
581
- * @final
582
- */
793
+ /**
794
+ * Provides data to change the size of the floating element. For instance,
795
+ * prevent it from overflowing its clipping boundary or match the width of the
796
+ * reference element.
797
+ * @see https://floating-ui.com/docs/size
798
+ */
799
+ const size = function (options) {
800
+ if (options === void 0) {
801
+ options = {};
802
+ }
583
803
 
584
- function isValidElement(object) {
585
- {
586
- return typeof object === 'object' && object !== null && object.$$typeof === REACT_ELEMENT_TYPE;
587
- }
588
- }
804
+ return {
805
+ name: 'size',
806
+ options,
589
807
 
590
- function getDeclarationErrorAddendum() {
591
- {
592
- if (ReactCurrentOwner$1.current) {
593
- var name = getComponentName(ReactCurrentOwner$1.current.type);
808
+ async fn(middlewareArguments) {
809
+ const {
810
+ placement,
811
+ rects,
812
+ platform,
813
+ elements
814
+ } = middlewareArguments;
815
+ const {
816
+ apply = () => {},
817
+ ...detectOverflowOptions
818
+ } = options;
819
+ const overflow = await detectOverflow(middlewareArguments, detectOverflowOptions);
820
+ const side = getSide(placement);
821
+ const alignment = getAlignment(placement);
822
+ let heightSide;
823
+ let widthSide;
824
+
825
+ if (side === 'top' || side === 'bottom') {
826
+ heightSide = side;
827
+ widthSide = alignment === ((await (platform.isRTL == null ? void 0 : platform.isRTL(elements.floating))) ? 'start' : 'end') ? 'left' : 'right';
828
+ } else {
829
+ widthSide = side;
830
+ heightSide = alignment === 'end' ? 'top' : 'bottom';
831
+ }
594
832
 
595
- if (name) {
596
- return '\n\nCheck the render method of `' + name + '`.';
597
- }
598
- }
833
+ const xMin = max$1(overflow.left, 0);
834
+ const xMax = max$1(overflow.right, 0);
835
+ const yMin = max$1(overflow.top, 0);
836
+ const yMax = max$1(overflow.bottom, 0);
837
+ const dimensions = {
838
+ availableHeight: rects.floating.height - (['left', 'right'].includes(placement) ? 2 * (yMin !== 0 || yMax !== 0 ? yMin + yMax : max$1(overflow.top, overflow.bottom)) : overflow[heightSide]),
839
+ availableWidth: rects.floating.width - (['top', 'bottom'].includes(placement) ? 2 * (xMin !== 0 || xMax !== 0 ? xMin + xMax : max$1(overflow.left, overflow.right)) : overflow[widthSide])
840
+ };
841
+ await apply({ ...middlewareArguments,
842
+ ...dimensions
843
+ });
844
+ const nextDimensions = await platform.getDimensions(elements.floating);
599
845
 
600
- return '';
601
- }
602
- }
846
+ if (rects.floating.width !== nextDimensions.width || rects.floating.height !== nextDimensions.height) {
847
+ return {
848
+ reset: {
849
+ rects: true
850
+ }
851
+ };
852
+ }
603
853
 
604
- function getSourceInfoErrorAddendum(source) {
605
- {
606
- if (source !== undefined) {
607
- var fileName = source.fileName.replace(/^.*[\\\/]/, '');
608
- var lineNumber = source.lineNumber;
609
- return '\n\nCheck your code at ' + fileName + ':' + lineNumber + '.';
610
- }
854
+ return {};
855
+ }
611
856
 
612
- return '';
613
- }
614
- }
615
- /**
616
- * Warn if there's no key explicitly set on dynamic arrays of children or
617
- * object keys are not valid. This allows us to keep track of children between
618
- * updates.
619
- */
857
+ };
858
+ };
620
859
 
860
+ /**
861
+ * Provides improved positioning for inline reference elements that can span
862
+ * over multiple lines, such as hyperlinks or range selections.
863
+ * @see https://floating-ui.com/docs/inline
864
+ */
865
+ const inline = function (options) {
866
+ if (options === void 0) {
867
+ options = {};
868
+ }
621
869
 
622
- var ownerHasKeyUseWarning = {};
870
+ return {
871
+ name: 'inline',
872
+ options,
623
873
 
624
- function getCurrentComponentErrorInfo(parentType) {
625
- {
626
- var info = getDeclarationErrorAddendum();
874
+ async fn(middlewareArguments) {
875
+ var _await$platform$getCl;
627
876
 
628
- if (!info) {
629
- var parentName = typeof parentType === 'string' ? parentType : parentType.displayName || parentType.name;
877
+ const {
878
+ placement,
879
+ elements,
880
+ rects,
881
+ platform,
882
+ strategy
883
+ } = middlewareArguments; // A MouseEvent's client{X,Y} coords can be up to 2 pixels off a
884
+ // ClientRect's bounds, despite the event listener being triggered. A
885
+ // padding of 2 seems to handle this issue.
630
886
 
631
- if (parentName) {
632
- info = "\n\nCheck the top-level render call using <" + parentName + ">.";
633
- }
634
- }
887
+ const {
888
+ padding = 2,
889
+ x,
890
+ y
891
+ } = options;
892
+ const fallback = rectToClientRect(platform.convertOffsetParentRelativeRectToViewportRelativeRect ? await platform.convertOffsetParentRelativeRectToViewportRelativeRect({
893
+ rect: rects.reference,
894
+ offsetParent: await (platform.getOffsetParent == null ? void 0 : platform.getOffsetParent(elements.floating)),
895
+ strategy
896
+ }) : rects.reference);
897
+ const clientRects = (_await$platform$getCl = await (platform.getClientRects == null ? void 0 : platform.getClientRects(elements.reference))) != null ? _await$platform$getCl : [];
898
+ const paddingObject = getSideObjectFromPadding(padding);
899
+
900
+ function getBoundingClientRect() {
901
+ // There are two rects and they are disjoined
902
+ if (clientRects.length === 2 && clientRects[0].left > clientRects[1].right && x != null && y != null) {
903
+ var _clientRects$find;
904
+
905
+ // Find the first rect in which the point is fully inside
906
+ return (_clientRects$find = clientRects.find(rect => x > rect.left - paddingObject.left && x < rect.right + paddingObject.right && y > rect.top - paddingObject.top && y < rect.bottom + paddingObject.bottom)) != null ? _clientRects$find : fallback;
907
+ } // There are 2 or more connected rects
908
+
909
+
910
+ if (clientRects.length >= 2) {
911
+ if (getMainAxisFromPlacement(placement) === 'x') {
912
+ const firstRect = clientRects[0];
913
+ const lastRect = clientRects[clientRects.length - 1];
914
+ const isTop = getSide(placement) === 'top';
915
+ const top = firstRect.top;
916
+ const bottom = lastRect.bottom;
917
+ const left = isTop ? firstRect.left : lastRect.left;
918
+ const right = isTop ? firstRect.right : lastRect.right;
919
+ const width = right - left;
920
+ const height = bottom - top;
921
+ return {
922
+ top,
923
+ bottom,
924
+ left,
925
+ right,
926
+ width,
927
+ height,
928
+ x: left,
929
+ y: top
930
+ };
931
+ }
635
932
 
636
- return info;
637
- }
638
- }
639
- /**
640
- * Warn if the element doesn't have an explicit key assigned to it.
641
- * This element is in an array. The array could grow and shrink or be
642
- * reordered. All children that haven't already been validated are required to
643
- * have a "key" property assigned to it. Error statuses are cached so a warning
644
- * will only be shown once.
645
- *
646
- * @internal
647
- * @param {ReactElement} element Element that requires a key.
648
- * @param {*} parentType element's parent's type.
649
- */
933
+ const isLeftSide = getSide(placement) === 'left';
934
+ const maxRight = max$1(...clientRects.map(rect => rect.right));
935
+ const minLeft = min$1(...clientRects.map(rect => rect.left));
936
+ const measureRects = clientRects.filter(rect => isLeftSide ? rect.left === minLeft : rect.right === maxRight);
937
+ const top = measureRects[0].top;
938
+ const bottom = measureRects[measureRects.length - 1].bottom;
939
+ const left = minLeft;
940
+ const right = maxRight;
941
+ const width = right - left;
942
+ const height = bottom - top;
943
+ return {
944
+ top,
945
+ bottom,
946
+ left,
947
+ right,
948
+ width,
949
+ height,
950
+ x: left,
951
+ y: top
952
+ };
953
+ }
650
954
 
955
+ return fallback;
956
+ }
651
957
 
652
- function validateExplicitKey(element, parentType) {
653
- {
654
- if (!element._store || element._store.validated || element.key != null) {
655
- return;
656
- }
958
+ const resetRects = await platform.getElementRects({
959
+ reference: {
960
+ getBoundingClientRect
961
+ },
962
+ floating: elements.floating,
963
+ strategy
964
+ });
657
965
 
658
- element._store.validated = true;
659
- var currentComponentErrorInfo = getCurrentComponentErrorInfo(parentType);
966
+ if (rects.reference.x !== resetRects.reference.x || rects.reference.y !== resetRects.reference.y || rects.reference.width !== resetRects.reference.width || rects.reference.height !== resetRects.reference.height) {
967
+ return {
968
+ reset: {
969
+ rects: resetRects
970
+ }
971
+ };
972
+ }
660
973
 
661
- if (ownerHasKeyUseWarning[currentComponentErrorInfo]) {
662
- return;
663
- }
974
+ return {};
975
+ }
664
976
 
665
- ownerHasKeyUseWarning[currentComponentErrorInfo] = true; // Usually the current owner is the offender, but if it accepts children as a
666
- // property, it may be the creator of the child that's responsible for
667
- // assigning it a key.
977
+ };
978
+ };
668
979
 
669
- var childOwner = '';
980
+ function isWindow(value) {
981
+ return value && value.document && value.location && value.alert && value.setInterval;
982
+ }
983
+ function getWindow(node) {
984
+ if (node == null) {
985
+ return window;
986
+ }
670
987
 
671
- if (element && element._owner && element._owner !== ReactCurrentOwner$1.current) {
672
- // Give the component that originally created this child.
673
- childOwner = " It was passed a child from " + getComponentName(element._owner.type) + ".";
674
- }
988
+ if (!isWindow(node)) {
989
+ const ownerDocument = node.ownerDocument;
990
+ return ownerDocument ? ownerDocument.defaultView || window : window;
991
+ }
675
992
 
676
- setCurrentlyValidatingElement$1(element);
993
+ return node;
994
+ }
677
995
 
678
- error('Each child in a list should have a unique "key" prop.' + '%s%s See https://reactjs.org/link/warning-keys for more information.', currentComponentErrorInfo, childOwner);
996
+ function getComputedStyle(element) {
997
+ return getWindow(element).getComputedStyle(element);
998
+ }
679
999
 
680
- setCurrentlyValidatingElement$1(null);
681
- }
682
- }
683
- /**
684
- * Ensure that every element either is passed in a static location, in an
685
- * array with an explicit keys property defined, or in an object literal
686
- * with valid key property.
687
- *
688
- * @internal
689
- * @param {ReactNode} node Statically passed child of any type.
690
- * @param {*} parentType node's parent's type.
691
- */
1000
+ function getNodeName(node) {
1001
+ return isWindow(node) ? '' : node ? (node.nodeName || '').toLowerCase() : '';
1002
+ }
692
1003
 
1004
+ function getUAString() {
1005
+ const uaData = navigator.userAgentData;
693
1006
 
694
- function validateChildKeys(node, parentType) {
695
- {
696
- if (typeof node !== 'object') {
697
- return;
698
- }
1007
+ if (uaData != null && uaData.brands) {
1008
+ return uaData.brands.map(item => item.brand + "/" + item.version).join(' ');
1009
+ }
699
1010
 
700
- if (Array.isArray(node)) {
701
- for (var i = 0; i < node.length; i++) {
702
- var child = node[i];
1011
+ return navigator.userAgent;
1012
+ }
703
1013
 
704
- if (isValidElement(child)) {
705
- validateExplicitKey(child, parentType);
706
- }
707
- }
708
- } else if (isValidElement(node)) {
709
- // This element was passed in a valid location.
710
- if (node._store) {
711
- node._store.validated = true;
712
- }
713
- } else if (node) {
714
- var iteratorFn = getIteratorFn(node);
1014
+ function isHTMLElement(value) {
1015
+ return value instanceof getWindow(value).HTMLElement;
1016
+ }
1017
+ function isElement(value) {
1018
+ return value instanceof getWindow(value).Element;
1019
+ }
1020
+ function isNode(value) {
1021
+ return value instanceof getWindow(value).Node;
1022
+ }
1023
+ function isShadowRoot(node) {
1024
+ // Browsers without `ShadowRoot` support
1025
+ if (typeof ShadowRoot === 'undefined') {
1026
+ return false;
1027
+ }
715
1028
 
716
- if (typeof iteratorFn === 'function') {
717
- // Entry iterators used to provide implicit keys,
718
- // but now we print a separate warning for them later.
719
- if (iteratorFn !== node.entries) {
720
- var iterator = iteratorFn.call(node);
721
- var step;
1029
+ const OwnElement = getWindow(node).ShadowRoot;
1030
+ return node instanceof OwnElement || node instanceof ShadowRoot;
1031
+ }
1032
+ function isOverflowElement(element) {
1033
+ // Firefox wants us to check `-x` and `-y` variations as well
1034
+ const {
1035
+ overflow,
1036
+ overflowX,
1037
+ overflowY,
1038
+ display
1039
+ } = getComputedStyle(element);
1040
+ return /auto|scroll|overlay|hidden/.test(overflow + overflowY + overflowX) && !['inline', 'contents'].includes(display);
1041
+ }
1042
+ function isTableElement(element) {
1043
+ return ['table', 'td', 'th'].includes(getNodeName(element));
1044
+ }
1045
+ function isContainingBlock(element) {
1046
+ // TODO: Try and use feature detection here instead
1047
+ const isFirefox = /firefox/i.test(getUAString());
1048
+ const css = getComputedStyle(element);
1049
+ const backdropFilter = css.backdropFilter || css.WebkitBackdropFilter; // This is non-exhaustive but covers the most common CSS properties that
1050
+ // create a containing block.
1051
+ // https://developer.mozilla.org/en-US/docs/Web/CSS/Containing_block#identifying_the_containing_block
722
1052
 
723
- while (!(step = iterator.next()).done) {
724
- if (isValidElement(step.value)) {
725
- validateExplicitKey(step.value, parentType);
726
- }
727
- }
728
- }
729
- }
730
- }
731
- }
732
- }
733
- /**
734
- * Given an element, validate that its props follow the propTypes definition,
735
- * provided by the type.
736
- *
737
- * @param {ReactElement} element
738
- */
1053
+ return css.transform !== 'none' || css.perspective !== 'none' || (backdropFilter ? backdropFilter !== 'none' : false) || isFirefox && css.willChange === 'filter' || isFirefox && (css.filter ? css.filter !== 'none' : false) || ['transform', 'perspective'].some(value => css.willChange.includes(value)) || ['paint', 'layout', 'strict', 'content'].some( // TS 4.1 compat
1054
+ value => {
1055
+ const contain = css.contain;
1056
+ return contain != null ? contain.includes(value) : false;
1057
+ });
1058
+ }
1059
+ function isLayoutViewport() {
1060
+ // Not Safari
1061
+ return !/^((?!chrome|android).)*safari/i.test(getUAString()); // Feature detection for this fails in various ways
1062
+ // • Always-visible scrollbar or not
1063
+ // • Width of <html>, etc.
1064
+ // const vV = win.visualViewport;
1065
+ // return vV ? Math.abs(win.innerWidth / vV.scale - vV.width) < 0.5 : true;
1066
+ }
1067
+ function isLastTraversableNode(node) {
1068
+ return ['html', 'body', '#document'].includes(getNodeName(node));
1069
+ }
739
1070
 
1071
+ const min = Math.min;
1072
+ const max = Math.max;
1073
+ const round = Math.round;
740
1074
 
741
- function validatePropTypes(element) {
742
- {
743
- var type = element.type;
1075
+ function getBoundingClientRect(element, includeScale, isFixedStrategy) {
1076
+ var _win$visualViewport$o, _win$visualViewport, _win$visualViewport$o2, _win$visualViewport2;
744
1077
 
745
- if (type === null || type === undefined || typeof type === 'string') {
746
- return;
747
- }
1078
+ if (includeScale === void 0) {
1079
+ includeScale = false;
1080
+ }
748
1081
 
749
- var propTypes;
1082
+ if (isFixedStrategy === void 0) {
1083
+ isFixedStrategy = false;
1084
+ }
750
1085
 
751
- if (typeof type === 'function') {
752
- propTypes = type.propTypes;
753
- } else if (typeof type === 'object' && (type.$$typeof === REACT_FORWARD_REF_TYPE || // Note: Memo only checks outer props here.
754
- // Inner props are checked in the reconciler.
755
- type.$$typeof === REACT_MEMO_TYPE)) {
756
- propTypes = type.propTypes;
757
- } else {
758
- return;
759
- }
1086
+ const clientRect = element.getBoundingClientRect();
1087
+ let scaleX = 1;
1088
+ let scaleY = 1;
760
1089
 
761
- if (propTypes) {
762
- // Intentionally inside to avoid triggering lazy initializers:
763
- var name = getComponentName(type);
764
- checkPropTypes(propTypes, element.props, 'prop', name, element);
765
- } else if (type.PropTypes !== undefined && !propTypesMisspellWarningShown) {
766
- propTypesMisspellWarningShown = true; // Intentionally inside to avoid triggering lazy initializers:
1090
+ if (includeScale && isHTMLElement(element)) {
1091
+ scaleX = element.offsetWidth > 0 ? round(clientRect.width) / element.offsetWidth || 1 : 1;
1092
+ scaleY = element.offsetHeight > 0 ? round(clientRect.height) / element.offsetHeight || 1 : 1;
1093
+ }
767
1094
 
768
- var _name = getComponentName(type);
1095
+ const win = isElement(element) ? getWindow(element) : window;
1096
+ const addVisualOffsets = !isLayoutViewport() && isFixedStrategy;
1097
+ const x = (clientRect.left + (addVisualOffsets ? (_win$visualViewport$o = (_win$visualViewport = win.visualViewport) == null ? void 0 : _win$visualViewport.offsetLeft) != null ? _win$visualViewport$o : 0 : 0)) / scaleX;
1098
+ const y = (clientRect.top + (addVisualOffsets ? (_win$visualViewport$o2 = (_win$visualViewport2 = win.visualViewport) == null ? void 0 : _win$visualViewport2.offsetTop) != null ? _win$visualViewport$o2 : 0 : 0)) / scaleY;
1099
+ const width = clientRect.width / scaleX;
1100
+ const height = clientRect.height / scaleY;
1101
+ return {
1102
+ width,
1103
+ height,
1104
+ top: y,
1105
+ right: x + width,
1106
+ bottom: y + height,
1107
+ left: x,
1108
+ x,
1109
+ y
1110
+ };
1111
+ }
769
1112
 
770
- error('Component %s declared `PropTypes` instead of `propTypes`. Did you misspell the property assignment?', _name || 'Unknown');
771
- }
1113
+ function getDocumentElement(node) {
1114
+ return ((isNode(node) ? node.ownerDocument : node.document) || window.document).documentElement;
1115
+ }
772
1116
 
773
- if (typeof type.getDefaultProps === 'function' && !type.getDefaultProps.isReactClassApproved) {
774
- error('getDefaultProps is only used on classic React.createClass ' + 'definitions. Use a static property named `defaultProps` instead.');
775
- }
776
- }
777
- }
778
- /**
779
- * Given a fragment, validate that it can only be provided with fragment props
780
- * @param {ReactElement} fragment
781
- */
1117
+ function getNodeScroll(element) {
1118
+ if (isElement(element)) {
1119
+ return {
1120
+ scrollLeft: element.scrollLeft,
1121
+ scrollTop: element.scrollTop
1122
+ };
1123
+ }
782
1124
 
1125
+ return {
1126
+ scrollLeft: element.pageXOffset,
1127
+ scrollTop: element.pageYOffset
1128
+ };
1129
+ }
783
1130
 
784
- function validateFragmentProps(fragment) {
785
- {
786
- var keys = Object.keys(fragment.props);
1131
+ function getWindowScrollBarX(element) {
1132
+ // If <html> has a CSS width greater than the viewport, then this will be
1133
+ // incorrect for RTL.
1134
+ return getBoundingClientRect(getDocumentElement(element)).left + getNodeScroll(element).scrollLeft;
1135
+ }
787
1136
 
788
- for (var i = 0; i < keys.length; i++) {
789
- var key = keys[i];
1137
+ function isScaled(element) {
1138
+ const rect = getBoundingClientRect(element);
1139
+ return round(rect.width) !== element.offsetWidth || round(rect.height) !== element.offsetHeight;
1140
+ }
790
1141
 
791
- if (key !== 'children' && key !== 'key') {
792
- setCurrentlyValidatingElement$1(fragment);
1142
+ function getRectRelativeToOffsetParent(element, offsetParent, strategy) {
1143
+ const isOffsetParentAnElement = isHTMLElement(offsetParent);
1144
+ const documentElement = getDocumentElement(offsetParent);
1145
+ const rect = getBoundingClientRect(element, // @ts-ignore - checked above (TS 4.1 compat)
1146
+ isOffsetParentAnElement && isScaled(offsetParent), strategy === 'fixed');
1147
+ let scroll = {
1148
+ scrollLeft: 0,
1149
+ scrollTop: 0
1150
+ };
1151
+ const offsets = {
1152
+ x: 0,
1153
+ y: 0
1154
+ };
793
1155
 
794
- error('Invalid prop `%s` supplied to `React.Fragment`. ' + 'React.Fragment can only have `key` and `children` props.', key);
1156
+ if (isOffsetParentAnElement || !isOffsetParentAnElement && strategy !== 'fixed') {
1157
+ if (getNodeName(offsetParent) !== 'body' || isOverflowElement(documentElement)) {
1158
+ scroll = getNodeScroll(offsetParent);
1159
+ }
795
1160
 
796
- setCurrentlyValidatingElement$1(null);
797
- break;
798
- }
799
- }
1161
+ if (isHTMLElement(offsetParent)) {
1162
+ const offsetRect = getBoundingClientRect(offsetParent, true);
1163
+ offsets.x = offsetRect.x + offsetParent.clientLeft;
1164
+ offsets.y = offsetRect.y + offsetParent.clientTop;
1165
+ } else if (documentElement) {
1166
+ offsets.x = getWindowScrollBarX(documentElement);
1167
+ }
1168
+ }
800
1169
 
801
- if (fragment.ref !== null) {
802
- setCurrentlyValidatingElement$1(fragment);
1170
+ return {
1171
+ x: rect.left + scroll.scrollLeft - offsets.x,
1172
+ y: rect.top + scroll.scrollTop - offsets.y,
1173
+ width: rect.width,
1174
+ height: rect.height
1175
+ };
1176
+ }
803
1177
 
804
- error('Invalid attribute `ref` supplied to `React.Fragment`.');
1178
+ function getParentNode(node) {
1179
+ if (getNodeName(node) === 'html') {
1180
+ return node;
1181
+ }
805
1182
 
806
- setCurrentlyValidatingElement$1(null);
807
- }
808
- }
809
- }
1183
+ const result = // Step into the shadow DOM of the parent of a slotted node
1184
+ node.assignedSlot || // DOM Element detected
1185
+ node.parentNode || ( // ShadowRoot detected
1186
+ isShadowRoot(node) ? node.host : null) || // Fallback
1187
+ getDocumentElement(node);
1188
+ return isShadowRoot(result) ? result.host : result;
1189
+ }
810
1190
 
811
- function jsxWithValidation(type, props, key, isStaticChildren, source, self) {
812
- {
813
- var validType = isValidElementType(type); // We warn in this case but don't throw. We expect the element creation to
814
- // succeed and there will likely be errors in render.
1191
+ function getTrueOffsetParent(element) {
1192
+ if (!isHTMLElement(element) || getComputedStyle(element).position === 'fixed') {
1193
+ return null;
1194
+ }
815
1195
 
816
- if (!validType) {
817
- var info = '';
1196
+ return element.offsetParent;
1197
+ }
818
1198
 
819
- if (type === undefined || typeof type === 'object' && type !== null && Object.keys(type).length === 0) {
820
- info += ' You likely forgot to export your component from the file ' + "it's defined in, or you might have mixed up default and named imports.";
821
- }
1199
+ function getContainingBlock(element) {
1200
+ let currentNode = getParentNode(element);
822
1201
 
823
- var sourceInfo = getSourceInfoErrorAddendum(source);
1202
+ while (isHTMLElement(currentNode) && !isLastTraversableNode(currentNode)) {
1203
+ if (isContainingBlock(currentNode)) {
1204
+ return currentNode;
1205
+ } else {
1206
+ currentNode = getParentNode(currentNode);
1207
+ }
1208
+ }
824
1209
 
825
- if (sourceInfo) {
826
- info += sourceInfo;
827
- } else {
828
- info += getDeclarationErrorAddendum();
829
- }
1210
+ return null;
1211
+ } // Gets the closest ancestor positioned element. Handles some edge cases,
1212
+ // such as table ancestors and cross browser bugs.
830
1213
 
831
- var typeString;
832
1214
 
833
- if (type === null) {
834
- typeString = 'null';
835
- } else if (Array.isArray(type)) {
836
- typeString = 'array';
837
- } else if (type !== undefined && type.$$typeof === REACT_ELEMENT_TYPE) {
838
- typeString = "<" + (getComponentName(type.type) || 'Unknown') + " />";
839
- info = ' Did you accidentally export a JSX literal instead of a component?';
840
- } else {
841
- typeString = typeof type;
842
- }
1215
+ function getOffsetParent(element) {
1216
+ const window = getWindow(element);
1217
+ let offsetParent = getTrueOffsetParent(element);
843
1218
 
844
- error('React.jsx: type is invalid -- expected a string (for ' + 'built-in components) or a class/function (for composite ' + 'components) but got: %s.%s', typeString, info);
845
- }
1219
+ while (offsetParent && isTableElement(offsetParent) && getComputedStyle(offsetParent).position === 'static') {
1220
+ offsetParent = getTrueOffsetParent(offsetParent);
1221
+ }
846
1222
 
847
- var element = jsxDEV(type, props, key, source, self); // The result can be nullish if a mock or a custom function is used.
848
- // TODO: Drop this when these are no longer allowed as the type argument.
1223
+ if (offsetParent && (getNodeName(offsetParent) === 'html' || getNodeName(offsetParent) === 'body' && getComputedStyle(offsetParent).position === 'static' && !isContainingBlock(offsetParent))) {
1224
+ return window;
1225
+ }
849
1226
 
850
- if (element == null) {
851
- return element;
852
- } // Skip key warning if the type isn't valid since our key validation logic
853
- // doesn't expect a non-string/function type and can throw confusing errors.
854
- // We don't want exception behavior to differ between dev and prod.
855
- // (Rendering will throw with a helpful message and as soon as the type is
856
- // fixed, the key warnings will appear.)
1227
+ return offsetParent || getContainingBlock(element) || window;
1228
+ }
857
1229
 
1230
+ function getDimensions(element) {
1231
+ if (isHTMLElement(element)) {
1232
+ return {
1233
+ width: element.offsetWidth,
1234
+ height: element.offsetHeight
1235
+ };
1236
+ }
858
1237
 
859
- if (validType) {
860
- var children = props.children;
1238
+ const rect = getBoundingClientRect(element);
1239
+ return {
1240
+ width: rect.width,
1241
+ height: rect.height
1242
+ };
1243
+ }
861
1244
 
862
- if (children !== undefined) {
863
- if (isStaticChildren) {
864
- if (Array.isArray(children)) {
865
- for (var i = 0; i < children.length; i++) {
866
- validateChildKeys(children[i], type);
867
- }
1245
+ function convertOffsetParentRelativeRectToViewportRelativeRect(_ref) {
1246
+ let {
1247
+ rect,
1248
+ offsetParent,
1249
+ strategy
1250
+ } = _ref;
1251
+ const isOffsetParentAnElement = isHTMLElement(offsetParent);
1252
+ const documentElement = getDocumentElement(offsetParent);
868
1253
 
869
- if (Object.freeze) {
870
- Object.freeze(children);
871
- }
872
- } else {
873
- error('React.jsx: Static children should always be an array. ' + 'You are likely explicitly calling React.jsxs or React.jsxDEV. ' + 'Use the Babel transform instead.');
874
- }
875
- } else {
876
- validateChildKeys(children, type);
877
- }
878
- }
879
- }
1254
+ if (offsetParent === documentElement) {
1255
+ return rect;
1256
+ }
880
1257
 
881
- if (type === exports.Fragment) {
882
- validateFragmentProps(element);
883
- } else {
884
- validatePropTypes(element);
885
- }
1258
+ let scroll = {
1259
+ scrollLeft: 0,
1260
+ scrollTop: 0
1261
+ };
1262
+ const offsets = {
1263
+ x: 0,
1264
+ y: 0
1265
+ };
886
1266
 
887
- return element;
888
- }
889
- } // These two functions exist to still get child warnings in dev
890
- // even with the prod transform. This means that jsxDEV is purely
891
- // opt-in behavior for better messages but that we won't stop
892
- // giving you warnings if you use production apis.
1267
+ if (isOffsetParentAnElement || !isOffsetParentAnElement && strategy !== 'fixed') {
1268
+ if (getNodeName(offsetParent) !== 'body' || isOverflowElement(documentElement)) {
1269
+ scroll = getNodeScroll(offsetParent);
1270
+ }
893
1271
 
894
- function jsxWithValidationStatic(type, props, key) {
895
- {
896
- return jsxWithValidation(type, props, key, true);
897
- }
898
- }
899
- function jsxWithValidationDynamic(type, props, key) {
900
- {
901
- return jsxWithValidation(type, props, key, false);
902
- }
903
- }
1272
+ if (isHTMLElement(offsetParent)) {
1273
+ const offsetRect = getBoundingClientRect(offsetParent, true);
1274
+ offsets.x = offsetRect.x + offsetParent.clientLeft;
1275
+ offsets.y = offsetRect.y + offsetParent.clientTop;
1276
+ } // This doesn't appear to be need to be negated.
1277
+ // else if (documentElement) {
1278
+ // offsets.x = getWindowScrollBarX(documentElement);
1279
+ // }
904
1280
 
905
- var jsx = jsxWithValidationDynamic ; // we may want to special case jsxs internally to take advantage of static children.
906
- // for now we can ship identical prod functions
1281
+ }
907
1282
 
908
- var jsxs = jsxWithValidationStatic ;
1283
+ return { ...rect,
1284
+ x: rect.x - scroll.scrollLeft + offsets.x,
1285
+ y: rect.y - scroll.scrollTop + offsets.y
1286
+ };
1287
+ }
909
1288
 
910
- exports.jsx = jsx;
911
- exports.jsxs = jsxs;
912
- })();
913
- }
914
- } (reactJsxRuntime_development));
1289
+ function getViewportRect(element, strategy) {
1290
+ const win = getWindow(element);
1291
+ const html = getDocumentElement(element);
1292
+ const visualViewport = win.visualViewport;
1293
+ let width = html.clientWidth;
1294
+ let height = html.clientHeight;
1295
+ let x = 0;
1296
+ let y = 0;
915
1297
 
916
- (function (module) {
1298
+ if (visualViewport) {
1299
+ width = visualViewport.width;
1300
+ height = visualViewport.height;
1301
+ const layoutViewport = isLayoutViewport();
917
1302
 
918
- {
919
- module.exports = reactJsxRuntime_development;
920
- }
921
- } (jsxRuntime));
1303
+ if (layoutViewport || !layoutViewport && strategy === 'fixed') {
1304
+ x = visualViewport.offsetLeft;
1305
+ y = visualViewport.offsetTop;
1306
+ }
1307
+ }
922
1308
 
923
- var classnames = {exports: {}};
1309
+ return {
1310
+ width,
1311
+ height,
1312
+ x,
1313
+ y
1314
+ };
1315
+ }
924
1316
 
925
- /*!
926
- Copyright (c) 2018 Jed Watson.
927
- Licensed under the MIT License (MIT), see
928
- http://jedwatson.github.io/classnames
929
- */
1317
+ // of the `<html>` and `<body>` rect bounds if horizontally scrollable
930
1318
 
931
- (function (module) {
932
- /* global define */
1319
+ function getDocumentRect(element) {
1320
+ var _element$ownerDocumen;
933
1321
 
934
- (function () {
1322
+ const html = getDocumentElement(element);
1323
+ const scroll = getNodeScroll(element);
1324
+ const body = (_element$ownerDocumen = element.ownerDocument) == null ? void 0 : _element$ownerDocumen.body;
1325
+ const width = max(html.scrollWidth, html.clientWidth, body ? body.scrollWidth : 0, body ? body.clientWidth : 0);
1326
+ const height = max(html.scrollHeight, html.clientHeight, body ? body.scrollHeight : 0, body ? body.clientHeight : 0);
1327
+ let x = -scroll.scrollLeft + getWindowScrollBarX(element);
1328
+ const y = -scroll.scrollTop;
935
1329
 
936
- var hasOwn = {}.hasOwnProperty;
1330
+ if (getComputedStyle(body || html).direction === 'rtl') {
1331
+ x += max(html.clientWidth, body ? body.clientWidth : 0) - width;
1332
+ }
937
1333
 
938
- function classNames() {
939
- var classes = [];
1334
+ return {
1335
+ width,
1336
+ height,
1337
+ x,
1338
+ y
1339
+ };
1340
+ }
940
1341
 
941
- for (var i = 0; i < arguments.length; i++) {
942
- var arg = arguments[i];
943
- if (!arg) continue;
1342
+ function getNearestOverflowAncestor(node) {
1343
+ const parentNode = getParentNode(node);
944
1344
 
945
- var argType = typeof arg;
1345
+ if (isLastTraversableNode(parentNode)) {
1346
+ // @ts-ignore assume body is always available
1347
+ return node.ownerDocument.body;
1348
+ }
946
1349
 
947
- if (argType === 'string' || argType === 'number') {
948
- classes.push(arg);
949
- } else if (Array.isArray(arg)) {
950
- if (arg.length) {
951
- var inner = classNames.apply(null, arg);
952
- if (inner) {
953
- classes.push(inner);
954
- }
955
- }
956
- } else if (argType === 'object') {
957
- if (arg.toString !== Object.prototype.toString && !arg.toString.toString().includes('[native code]')) {
958
- classes.push(arg.toString());
959
- continue;
960
- }
1350
+ if (isHTMLElement(parentNode) && isOverflowElement(parentNode)) {
1351
+ return parentNode;
1352
+ }
961
1353
 
962
- for (var key in arg) {
963
- if (hasOwn.call(arg, key) && arg[key]) {
964
- classes.push(key);
965
- }
966
- }
967
- }
968
- }
969
-
970
- return classes.join(' ');
971
- }
972
-
973
- if (module.exports) {
974
- classNames.default = classNames;
975
- module.exports = classNames;
976
- } else {
977
- window.classNames = classNames;
978
- }
979
- }());
980
- } (classnames));
981
-
982
- var classNames = classnames.exports;
983
-
984
- /* eslint-disable @typescript-eslint/no-explicit-any */
985
- /**
986
- * This function debounce the received function
987
- * @param { function } func Function to be debounced
988
- * @param { number } wait Time to wait before execut the function
989
- * @param { boolean } immediate Param to define if the function will be executed immediately
990
- */
991
- const debounce = (func, wait, immediate) => {
992
- let timeout = null;
993
- return function debounced(...args) {
994
- const later = () => {
995
- timeout = null;
996
- if (!immediate) {
997
- func.apply(this, args);
998
- }
999
- };
1000
- if (timeout) {
1001
- clearTimeout(timeout);
1002
- }
1003
- timeout = setTimeout(later, wait);
1004
- };
1005
- };
1006
-
1007
- const TooltipContent = ({ content }) => {
1008
- return jsxRuntime.exports.jsx("span", { dangerouslySetInnerHTML: { __html: content } });
1009
- };
1010
-
1011
- const DEFAULT_TOOLTIP_ID = 'DEFAULT_TOOLTIP_ID';
1012
- const DEFAULT_CONTEXT_DATA = {
1013
- anchorRefs: new Set(),
1014
- activeAnchor: { current: null },
1015
- attach: () => {
1016
- /* attach anchor element */
1017
- },
1018
- detach: () => {
1019
- /* detach anchor element */
1020
- },
1021
- setActiveAnchor: () => {
1022
- /* set active anchor */
1023
- },
1024
- };
1025
- const DEFAULT_CONTEXT_DATA_WRAPPER = {
1026
- getTooltipData: () => DEFAULT_CONTEXT_DATA,
1027
- };
1028
- const TooltipContext = createContext(DEFAULT_CONTEXT_DATA_WRAPPER);
1029
- const TooltipProvider = ({ children }) => {
1030
- const [anchorRefMap, setAnchorRefMap] = useState({
1031
- [DEFAULT_TOOLTIP_ID]: new Set(),
1032
- });
1033
- const [activeAnchorMap, setActiveAnchorMap] = useState({
1034
- [DEFAULT_TOOLTIP_ID]: { current: null },
1035
- });
1036
- const attach = (tooltipId, ...refs) => {
1037
- setAnchorRefMap((oldMap) => {
1038
- var _a;
1039
- const tooltipRefs = (_a = oldMap[tooltipId]) !== null && _a !== void 0 ? _a : new Set();
1040
- refs.forEach((ref) => tooltipRefs.add(ref));
1041
- // create new object to trigger re-render
1042
- return { ...oldMap, [tooltipId]: new Set(tooltipRefs) };
1043
- });
1044
- };
1045
- const detach = (tooltipId, ...refs) => {
1046
- setAnchorRefMap((oldMap) => {
1047
- const tooltipRefs = oldMap[tooltipId];
1048
- if (!tooltipRefs) {
1049
- // tooltip not found
1050
- // maybe thow error?
1051
- return oldMap;
1052
- }
1053
- refs.forEach((ref) => tooltipRefs.delete(ref));
1054
- // create new object to trigger re-render
1055
- return { ...oldMap };
1056
- });
1057
- };
1058
- const setActiveAnchor = (tooltipId, ref) => {
1059
- setActiveAnchorMap((oldMap) => {
1060
- var _a;
1061
- if (((_a = oldMap[tooltipId]) === null || _a === void 0 ? void 0 : _a.current) === ref.current) {
1062
- return oldMap;
1063
- }
1064
- // create new object to trigger re-render
1065
- return { ...oldMap, [tooltipId]: ref };
1066
- });
1067
- };
1068
- const getTooltipData = useCallback((tooltipId = DEFAULT_TOOLTIP_ID) => {
1069
- var _a, _b;
1070
- return ({
1071
- anchorRefs: (_a = anchorRefMap[tooltipId]) !== null && _a !== void 0 ? _a : new Set(),
1072
- activeAnchor: (_b = activeAnchorMap[tooltipId]) !== null && _b !== void 0 ? _b : { current: null },
1073
- attach: (...refs) => attach(tooltipId, ...refs),
1074
- detach: (...refs) => detach(tooltipId, ...refs),
1075
- setActiveAnchor: (ref) => setActiveAnchor(tooltipId, ref),
1076
- });
1077
- }, [anchorRefMap, activeAnchorMap, attach, detach]);
1078
- const context = useMemo(() => {
1079
- return {
1080
- getTooltipData,
1081
- };
1082
- }, [getTooltipData]);
1083
- return jsxRuntime.exports.jsx(TooltipContext.Provider, { value: context, children: children });
1084
- };
1085
- function useTooltip(tooltipId = DEFAULT_TOOLTIP_ID) {
1086
- return useContext(TooltipContext).getTooltipData(tooltipId);
1354
+ return getNearestOverflowAncestor(parentNode);
1087
1355
  }
1088
1356
 
1089
- const TooltipWrapper = ({ tooltipId, children, className, place, content, html, variant, offset, wrapper, events, positionStrategy, delayShow, delayHide, }) => {
1090
- const { attach, detach } = useTooltip(tooltipId);
1091
- const anchorRef = useRef(null);
1092
- useEffect(() => {
1093
- attach(anchorRef);
1094
- return () => {
1095
- detach(anchorRef);
1096
- };
1097
- }, []);
1098
- return (jsxRuntime.exports.jsx("span", { ref: anchorRef, className: classNames('react-tooltip-wrapper', className), "data-tooltip-place": place, "data-tooltip-content": content, "data-tooltip-html": html, "data-tooltip-variant": variant, "data-tooltip-offset": offset, "data-tooltip-wrapper": wrapper, "data-tooltip-events": events, "data-tooltip-position-strategy": positionStrategy, "data-tooltip-delay-show": delayShow, "data-tooltip-delay-hide": delayHide, children: children }));
1099
- };
1100
-
1101
- function getSide(placement) {
1102
- return placement.split('-')[0];
1103
- }
1357
+ function getOverflowAncestors(node, list) {
1358
+ var _node$ownerDocument;
1104
1359
 
1105
- function getAlignment(placement) {
1106
- return placement.split('-')[1];
1107
- }
1360
+ if (list === void 0) {
1361
+ list = [];
1362
+ }
1108
1363
 
1109
- function getMainAxisFromPlacement(placement) {
1110
- return ['top', 'bottom'].includes(getSide(placement)) ? 'x' : 'y';
1364
+ const scrollableAncestor = getNearestOverflowAncestor(node);
1365
+ const isBody = scrollableAncestor === ((_node$ownerDocument = node.ownerDocument) == null ? void 0 : _node$ownerDocument.body);
1366
+ const win = getWindow(scrollableAncestor);
1367
+ const target = isBody ? [win].concat(win.visualViewport || [], isOverflowElement(scrollableAncestor) ? scrollableAncestor : []) : scrollableAncestor;
1368
+ const updatedList = list.concat(target);
1369
+ return isBody ? updatedList : // @ts-ignore: isBody tells us target will be an HTMLElement here
1370
+ updatedList.concat(getOverflowAncestors(target));
1111
1371
  }
1112
1372
 
1113
- function getLengthFromAxis(axis) {
1114
- return axis === 'y' ? 'height' : 'width';
1373
+ function getInnerBoundingClientRect(element, strategy) {
1374
+ const clientRect = getBoundingClientRect(element, false, strategy === 'fixed');
1375
+ const top = clientRect.top + element.clientTop;
1376
+ const left = clientRect.left + element.clientLeft;
1377
+ return {
1378
+ top,
1379
+ left,
1380
+ x: left,
1381
+ y: top,
1382
+ right: left + element.clientWidth,
1383
+ bottom: top + element.clientHeight,
1384
+ width: element.clientWidth,
1385
+ height: element.clientHeight
1386
+ };
1115
1387
  }
1116
1388
 
1117
- function computeCoordsFromPlacement(_ref, placement, rtl) {
1118
- let {
1119
- reference,
1120
- floating
1121
- } = _ref;
1122
- const commonX = reference.x + reference.width / 2 - floating.width / 2;
1123
- const commonY = reference.y + reference.height / 2 - floating.height / 2;
1124
- const mainAxis = getMainAxisFromPlacement(placement);
1125
- const length = getLengthFromAxis(mainAxis);
1126
- const commonAlign = reference[length] / 2 - floating[length] / 2;
1127
- const side = getSide(placement);
1128
- const isVertical = mainAxis === 'x';
1129
- let coords;
1389
+ function getClientRectFromClippingAncestor(element, clippingAncestor, strategy) {
1390
+ if (clippingAncestor === 'viewport') {
1391
+ return rectToClientRect(getViewportRect(element, strategy));
1392
+ }
1130
1393
 
1131
- switch (side) {
1132
- case 'top':
1133
- coords = {
1134
- x: commonX,
1135
- y: reference.y - floating.height
1136
- };
1137
- break;
1394
+ if (isElement(clippingAncestor)) {
1395
+ return getInnerBoundingClientRect(clippingAncestor, strategy);
1396
+ }
1138
1397
 
1139
- case 'bottom':
1140
- coords = {
1141
- x: commonX,
1142
- y: reference.y + reference.height
1143
- };
1144
- break;
1398
+ return rectToClientRect(getDocumentRect(getDocumentElement(element)));
1399
+ } // A "clipping ancestor" is an overflowable container with the characteristic of
1400
+ // clipping (or hiding) overflowing elements with a position different from
1401
+ // `initial`
1145
1402
 
1146
- case 'right':
1147
- coords = {
1148
- x: reference.x + reference.width,
1149
- y: commonY
1150
- };
1151
- break;
1152
1403
 
1153
- case 'left':
1154
- coords = {
1155
- x: reference.x - floating.width,
1156
- y: commonY
1157
- };
1158
- break;
1404
+ function getClippingElementAncestors(element) {
1405
+ let result = getOverflowAncestors(element).filter(el => isElement(el) && getNodeName(el) !== 'body');
1406
+ let currentNode = element;
1407
+ let currentContainingBlockComputedStyle = null; // https://developer.mozilla.org/en-US/docs/Web/CSS/Containing_block#identifying_the_containing_block
1159
1408
 
1160
- default:
1161
- coords = {
1162
- x: reference.x,
1163
- y: reference.y
1164
- };
1165
- }
1409
+ while (isElement(currentNode) && !isLastTraversableNode(currentNode)) {
1410
+ const computedStyle = getComputedStyle(currentNode);
1166
1411
 
1167
- switch (getAlignment(placement)) {
1168
- case 'start':
1169
- coords[mainAxis] -= commonAlign * (rtl && isVertical ? -1 : 1);
1170
- break;
1412
+ if (computedStyle.position === 'static' && currentContainingBlockComputedStyle && ['absolute', 'fixed'].includes(currentContainingBlockComputedStyle.position) && !isContainingBlock(currentNode)) {
1413
+ // Drop non-containing blocks
1414
+ result = result.filter(ancestor => ancestor !== currentNode);
1415
+ } else {
1416
+ // Record last containing block for next iteration
1417
+ currentContainingBlockComputedStyle = computedStyle;
1418
+ }
1171
1419
 
1172
- case 'end':
1173
- coords[mainAxis] += commonAlign * (rtl && isVertical ? -1 : 1);
1174
- break;
1420
+ currentNode = getParentNode(currentNode);
1175
1421
  }
1176
1422
 
1177
- return coords;
1178
- }
1423
+ return result;
1424
+ } // Gets the maximum area that the element is visible in due to any number of
1425
+ // clipping ancestors
1179
1426
 
1180
- /**
1181
- * Computes the `x` and `y` coordinates that will place the floating element
1182
- * next to a reference element when it is given a certain positioning strategy.
1183
- *
1184
- * This export does not have any `platform` interface logic. You will need to
1185
- * write one for the platform you are using Floating UI with.
1186
- */
1187
1427
 
1188
- const computePosition$1 = async (reference, floating, config) => {
1189
- const {
1190
- placement = 'bottom',
1191
- strategy = 'absolute',
1192
- middleware = [],
1193
- platform
1194
- } = config;
1195
- const validMiddleware = middleware.filter(Boolean);
1196
- const rtl = await (platform.isRTL == null ? void 0 : platform.isRTL(floating));
1428
+ function getClippingRect(_ref) {
1429
+ let {
1430
+ element,
1431
+ boundary,
1432
+ rootBoundary,
1433
+ strategy
1434
+ } = _ref;
1435
+ const elementClippingAncestors = boundary === 'clippingAncestors' ? getClippingElementAncestors(element) : [].concat(boundary);
1436
+ const clippingAncestors = [...elementClippingAncestors, rootBoundary];
1437
+ const firstClippingAncestor = clippingAncestors[0];
1438
+ const clippingRect = clippingAncestors.reduce((accRect, clippingAncestor) => {
1439
+ const rect = getClientRectFromClippingAncestor(element, clippingAncestor, strategy);
1440
+ accRect.top = max(rect.top, accRect.top);
1441
+ accRect.right = min(rect.right, accRect.right);
1442
+ accRect.bottom = min(rect.bottom, accRect.bottom);
1443
+ accRect.left = max(rect.left, accRect.left);
1444
+ return accRect;
1445
+ }, getClientRectFromClippingAncestor(element, firstClippingAncestor, strategy));
1446
+ return {
1447
+ width: clippingRect.right - clippingRect.left,
1448
+ height: clippingRect.bottom - clippingRect.top,
1449
+ x: clippingRect.left,
1450
+ y: clippingRect.top
1451
+ };
1452
+ }
1197
1453
 
1198
- {
1199
- if (platform == null) {
1200
- console.error(['Floating UI: `platform` property was not passed to config. If you', 'want to use Floating UI on the web, install @floating-ui/dom', 'instead of the /core package. Otherwise, you can create your own', '`platform`: https://floating-ui.com/docs/platform'].join(' '));
1201
- }
1454
+ const platform = {
1455
+ getClippingRect,
1456
+ convertOffsetParentRelativeRectToViewportRelativeRect,
1457
+ isElement,
1458
+ getDimensions,
1459
+ getOffsetParent,
1460
+ getDocumentElement,
1461
+ getElementRects: _ref => {
1462
+ let {
1463
+ reference,
1464
+ floating,
1465
+ strategy
1466
+ } = _ref;
1467
+ return {
1468
+ reference: getRectRelativeToOffsetParent(reference, getOffsetParent(floating), strategy),
1469
+ floating: { ...getDimensions(floating),
1470
+ x: 0,
1471
+ y: 0
1472
+ }
1473
+ };
1474
+ },
1475
+ getClientRects: element => Array.from(element.getClientRects()),
1476
+ isRTL: element => getComputedStyle(element).direction === 'rtl'
1477
+ };
1202
1478
 
1203
- if (validMiddleware.filter(_ref => {
1204
- let {
1205
- name
1206
- } = _ref;
1207
- return name === 'autoPlacement' || name === 'flip';
1208
- }).length > 1) {
1209
- throw new Error(['Floating UI: duplicate `flip` and/or `autoPlacement` middleware', 'detected. This will lead to an infinite loop. Ensure only one of', 'either has been passed to the `middleware` array.'].join(' '));
1210
- }
1479
+ /**
1480
+ * Computes the `x` and `y` coordinates that will place the floating element
1481
+ * next to a reference element when it is given a certain CSS positioning
1482
+ * strategy.
1483
+ */
1211
1484
 
1212
- if (!reference || !floating) {
1213
- console.error(['Floating UI: The reference and/or floating element was not defined', 'when `computePosition()` was called. Ensure that both elements have', 'been created and can be measured.'].join(' '));
1214
- }
1215
- }
1485
+ const computePosition = (reference, floating, options) => computePosition$1(reference, floating, {
1486
+ platform,
1487
+ ...options
1488
+ });
1216
1489
 
1217
- let rects = await platform.getElementRects({
1218
- reference,
1219
- floating,
1220
- strategy
1221
- });
1222
- let {
1223
- x,
1224
- y
1225
- } = computeCoordsFromPlacement(rects, placement, rtl);
1226
- let statefulPlacement = placement;
1227
- let middlewareData = {};
1228
- let resetCount = 0;
1490
+ var jsxRuntime = {exports: {}};
1229
1491
 
1230
- for (let i = 0; i < validMiddleware.length; i++) {
1231
- const {
1232
- name,
1233
- fn
1234
- } = validMiddleware[i];
1235
- const {
1236
- x: nextX,
1237
- y: nextY,
1238
- data,
1239
- reset
1240
- } = await fn({
1241
- x,
1242
- y,
1243
- initialPlacement: placement,
1244
- placement: statefulPlacement,
1245
- strategy,
1246
- middlewareData,
1247
- rects,
1248
- platform,
1249
- elements: {
1250
- reference,
1251
- floating
1252
- }
1253
- });
1254
- x = nextX != null ? nextX : x;
1255
- y = nextY != null ? nextY : y;
1256
- middlewareData = { ...middlewareData,
1257
- [name]: { ...middlewareData[name],
1258
- ...data
1259
- }
1260
- };
1492
+ var reactJsxRuntime_development = {};
1261
1493
 
1262
- {
1263
- if (resetCount > 50) {
1264
- console.warn(['Floating UI: The middleware lifecycle appears to be running in an', 'infinite loop. This is usually caused by a `reset` continually', 'being returned without a break condition.'].join(' '));
1265
- }
1266
- }
1494
+ /** @license React v16.14.0
1495
+ * react-jsx-runtime.development.js
1496
+ *
1497
+ * Copyright (c) Facebook, Inc. and its affiliates.
1498
+ *
1499
+ * This source code is licensed under the MIT license found in the
1500
+ * LICENSE file in the root directory of this source tree.
1501
+ */
1267
1502
 
1268
- if (reset && resetCount <= 50) {
1269
- resetCount++;
1503
+ (function (exports) {
1270
1504
 
1271
- if (typeof reset === 'object') {
1272
- if (reset.placement) {
1273
- statefulPlacement = reset.placement;
1274
- }
1505
+ {
1506
+ (function() {
1275
1507
 
1276
- if (reset.rects) {
1277
- rects = reset.rects === true ? await platform.getElementRects({
1278
- reference,
1279
- floating,
1280
- strategy
1281
- }) : reset.rects;
1282
- }
1508
+ var React = require$$0;
1283
1509
 
1284
- ({
1285
- x,
1286
- y
1287
- } = computeCoordsFromPlacement(rects, statefulPlacement, rtl));
1288
- }
1510
+ // ATTENTION
1511
+ // When adding new symbols to this file,
1512
+ // Please consider also adding to 'react-devtools-shared/src/backend/ReactSymbols'
1513
+ // The Symbol used to tag the ReactElement-like types. If there is no native Symbol
1514
+ // nor polyfill, then a plain number is used for performance.
1515
+ var REACT_ELEMENT_TYPE = 0xeac7;
1516
+ var REACT_PORTAL_TYPE = 0xeaca;
1517
+ exports.Fragment = 0xeacb;
1518
+ var REACT_STRICT_MODE_TYPE = 0xeacc;
1519
+ var REACT_PROFILER_TYPE = 0xead2;
1520
+ var REACT_PROVIDER_TYPE = 0xeacd;
1521
+ var REACT_CONTEXT_TYPE = 0xeace;
1522
+ var REACT_FORWARD_REF_TYPE = 0xead0;
1523
+ var REACT_SUSPENSE_TYPE = 0xead1;
1524
+ var REACT_SUSPENSE_LIST_TYPE = 0xead8;
1525
+ var REACT_MEMO_TYPE = 0xead3;
1526
+ var REACT_LAZY_TYPE = 0xead4;
1527
+ var REACT_BLOCK_TYPE = 0xead9;
1528
+ var REACT_SERVER_BLOCK_TYPE = 0xeada;
1529
+ var REACT_FUNDAMENTAL_TYPE = 0xead5;
1530
+ var REACT_DEBUG_TRACING_MODE_TYPE = 0xeae1;
1531
+ var REACT_LEGACY_HIDDEN_TYPE = 0xeae3;
1289
1532
 
1290
- i = -1;
1291
- continue;
1292
- }
1293
- }
1533
+ if (typeof Symbol === 'function' && Symbol.for) {
1534
+ var symbolFor = Symbol.for;
1535
+ REACT_ELEMENT_TYPE = symbolFor('react.element');
1536
+ REACT_PORTAL_TYPE = symbolFor('react.portal');
1537
+ exports.Fragment = symbolFor('react.fragment');
1538
+ REACT_STRICT_MODE_TYPE = symbolFor('react.strict_mode');
1539
+ REACT_PROFILER_TYPE = symbolFor('react.profiler');
1540
+ REACT_PROVIDER_TYPE = symbolFor('react.provider');
1541
+ REACT_CONTEXT_TYPE = symbolFor('react.context');
1542
+ REACT_FORWARD_REF_TYPE = symbolFor('react.forward_ref');
1543
+ REACT_SUSPENSE_TYPE = symbolFor('react.suspense');
1544
+ REACT_SUSPENSE_LIST_TYPE = symbolFor('react.suspense_list');
1545
+ REACT_MEMO_TYPE = symbolFor('react.memo');
1546
+ REACT_LAZY_TYPE = symbolFor('react.lazy');
1547
+ REACT_BLOCK_TYPE = symbolFor('react.block');
1548
+ REACT_SERVER_BLOCK_TYPE = symbolFor('react.server.block');
1549
+ REACT_FUNDAMENTAL_TYPE = symbolFor('react.fundamental');
1550
+ symbolFor('react.scope');
1551
+ symbolFor('react.opaque.id');
1552
+ REACT_DEBUG_TRACING_MODE_TYPE = symbolFor('react.debug_trace_mode');
1553
+ symbolFor('react.offscreen');
1554
+ REACT_LEGACY_HIDDEN_TYPE = symbolFor('react.legacy_hidden');
1555
+ }
1294
1556
 
1295
- return {
1296
- x,
1297
- y,
1298
- placement: statefulPlacement,
1299
- strategy,
1300
- middlewareData
1301
- };
1302
- };
1557
+ var MAYBE_ITERATOR_SYMBOL = typeof Symbol === 'function' && Symbol.iterator;
1558
+ var FAUX_ITERATOR_SYMBOL = '@@iterator';
1559
+ function getIteratorFn(maybeIterable) {
1560
+ if (maybeIterable === null || typeof maybeIterable !== 'object') {
1561
+ return null;
1562
+ }
1303
1563
 
1304
- function expandPaddingObject(padding) {
1305
- return {
1306
- top: 0,
1307
- right: 0,
1308
- bottom: 0,
1309
- left: 0,
1310
- ...padding
1311
- };
1312
- }
1564
+ var maybeIterator = MAYBE_ITERATOR_SYMBOL && maybeIterable[MAYBE_ITERATOR_SYMBOL] || maybeIterable[FAUX_ITERATOR_SYMBOL];
1313
1565
 
1314
- function getSideObjectFromPadding(padding) {
1315
- return typeof padding !== 'number' ? expandPaddingObject(padding) : {
1316
- top: padding,
1317
- right: padding,
1318
- bottom: padding,
1319
- left: padding
1320
- };
1321
- }
1566
+ if (typeof maybeIterator === 'function') {
1567
+ return maybeIterator;
1568
+ }
1569
+
1570
+ return null;
1571
+ }
1572
+
1573
+ var ReactSharedInternals = React.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;
1574
+
1575
+ function error(format) {
1576
+ {
1577
+ for (var _len2 = arguments.length, args = new Array(_len2 > 1 ? _len2 - 1 : 0), _key2 = 1; _key2 < _len2; _key2++) {
1578
+ args[_key2 - 1] = arguments[_key2];
1579
+ }
1580
+
1581
+ printWarning('error', format, args);
1582
+ }
1583
+ }
1584
+
1585
+ function printWarning(level, format, args) {
1586
+ // When changing this logic, you might want to also
1587
+ // update consoleWithStackDev.www.js as well.
1588
+ {
1589
+ var ReactDebugCurrentFrame = ReactSharedInternals.ReactDebugCurrentFrame;
1590
+ var stack = '';
1591
+
1592
+ if (currentlyValidatingElement) {
1593
+ var name = getComponentName(currentlyValidatingElement.type);
1594
+ var owner = currentlyValidatingElement._owner;
1595
+ stack += describeComponentFrame(name, currentlyValidatingElement._source, owner && getComponentName(owner.type));
1596
+ }
1597
+
1598
+ stack += ReactDebugCurrentFrame.getStackAddendum();
1599
+
1600
+ if (stack !== '') {
1601
+ format += '%s';
1602
+ args = args.concat([stack]);
1603
+ }
1604
+
1605
+ var argsWithFormat = args.map(function (item) {
1606
+ return '' + item;
1607
+ }); // Careful: RN currently depends on this prefix
1608
+
1609
+ argsWithFormat.unshift('Warning: ' + format); // We intentionally don't use spread (or .apply) directly because it
1610
+ // breaks IE9: https://github.com/facebook/react/issues/13610
1611
+ // eslint-disable-next-line react-internal/no-production-logging
1612
+
1613
+ Function.prototype.apply.call(console[level], console, argsWithFormat);
1614
+ }
1615
+ }
1616
+
1617
+ // Filter certain DOM attributes (e.g. src, href) if their values are empty strings.
1618
+
1619
+ var enableScopeAPI = false; // Experimental Create Event Handle API.
1620
+
1621
+ function isValidElementType(type) {
1622
+ if (typeof type === 'string' || typeof type === 'function') {
1623
+ return true;
1624
+ } // Note: typeof might be other than 'symbol' or 'number' (e.g. if it's a polyfill).
1625
+
1626
+
1627
+ if (type === exports.Fragment || type === REACT_PROFILER_TYPE || type === REACT_DEBUG_TRACING_MODE_TYPE || type === REACT_STRICT_MODE_TYPE || type === REACT_SUSPENSE_TYPE || type === REACT_SUSPENSE_LIST_TYPE || type === REACT_LEGACY_HIDDEN_TYPE || enableScopeAPI ) {
1628
+ return true;
1629
+ }
1630
+
1631
+ if (typeof type === 'object' && type !== null) {
1632
+ if (type.$$typeof === REACT_LAZY_TYPE || type.$$typeof === REACT_MEMO_TYPE || type.$$typeof === REACT_PROVIDER_TYPE || type.$$typeof === REACT_CONTEXT_TYPE || type.$$typeof === REACT_FORWARD_REF_TYPE || type.$$typeof === REACT_FUNDAMENTAL_TYPE || type.$$typeof === REACT_BLOCK_TYPE || type[0] === REACT_SERVER_BLOCK_TYPE) {
1633
+ return true;
1634
+ }
1635
+ }
1636
+
1637
+ return false;
1638
+ }
1639
+
1640
+
1641
+ var BEFORE_SLASH_RE = /^(.*)[\\\/]/;
1642
+ function describeComponentFrame (name, source, ownerName) {
1643
+ var sourceInfo = '';
1644
+
1645
+ if (source) {
1646
+ var path = source.fileName;
1647
+ var fileName = path.replace(BEFORE_SLASH_RE, '');
1648
+
1649
+ {
1650
+ // In DEV, include code for a common special case:
1651
+ // prefer "folder/index.js" instead of just "index.js".
1652
+ if (/^index\./.test(fileName)) {
1653
+ var match = path.match(BEFORE_SLASH_RE);
1654
+
1655
+ if (match) {
1656
+ var pathBeforeSlash = match[1];
1657
+
1658
+ if (pathBeforeSlash) {
1659
+ var folderName = pathBeforeSlash.replace(BEFORE_SLASH_RE, '');
1660
+ fileName = folderName + '/' + fileName;
1661
+ }
1662
+ }
1663
+ }
1664
+ }
1665
+
1666
+ sourceInfo = ' (at ' + fileName + ':' + source.lineNumber + ')';
1667
+ } else if (ownerName) {
1668
+ sourceInfo = ' (created by ' + ownerName + ')';
1669
+ }
1670
+
1671
+ return '\n in ' + (name || 'Unknown') + sourceInfo;
1672
+ }
1673
+
1674
+ var Resolved = 1;
1675
+ function refineResolvedLazyComponent(lazyComponent) {
1676
+ return lazyComponent._status === Resolved ? lazyComponent._result : null;
1677
+ }
1678
+
1679
+ function getWrappedName(outerType, innerType, wrapperName) {
1680
+ var functionName = innerType.displayName || innerType.name || '';
1681
+ return outerType.displayName || (functionName !== '' ? wrapperName + "(" + functionName + ")" : wrapperName);
1682
+ }
1683
+
1684
+ function getComponentName(type) {
1685
+ if (type == null) {
1686
+ // Host root, text node or just invalid type.
1687
+ return null;
1688
+ }
1689
+
1690
+ {
1691
+ if (typeof type.tag === 'number') {
1692
+ error('Received an unexpected object in getComponentName(). ' + 'This is likely a bug in React. Please file an issue.');
1693
+ }
1694
+ }
1695
+
1696
+ if (typeof type === 'function') {
1697
+ return type.displayName || type.name || null;
1698
+ }
1699
+
1700
+ if (typeof type === 'string') {
1701
+ return type;
1702
+ }
1703
+
1704
+ switch (type) {
1705
+ case exports.Fragment:
1706
+ return 'Fragment';
1707
+
1708
+ case REACT_PORTAL_TYPE:
1709
+ return 'Portal';
1710
+
1711
+ case REACT_PROFILER_TYPE:
1712
+ return "Profiler";
1713
+
1714
+ case REACT_STRICT_MODE_TYPE:
1715
+ return 'StrictMode';
1716
+
1717
+ case REACT_SUSPENSE_TYPE:
1718
+ return 'Suspense';
1719
+
1720
+ case REACT_SUSPENSE_LIST_TYPE:
1721
+ return 'SuspenseList';
1722
+ }
1723
+
1724
+ if (typeof type === 'object') {
1725
+ switch (type.$$typeof) {
1726
+ case REACT_CONTEXT_TYPE:
1727
+ return 'Context.Consumer';
1728
+
1729
+ case REACT_PROVIDER_TYPE:
1730
+ return 'Context.Provider';
1731
+
1732
+ case REACT_FORWARD_REF_TYPE:
1733
+ return getWrappedName(type, type.render, 'ForwardRef');
1734
+
1735
+ case REACT_MEMO_TYPE:
1736
+ return getComponentName(type.type);
1322
1737
 
1323
- function rectToClientRect(rect) {
1324
- return { ...rect,
1325
- top: rect.y,
1326
- left: rect.x,
1327
- right: rect.x + rect.width,
1328
- bottom: rect.y + rect.height
1329
- };
1330
- }
1738
+ case REACT_BLOCK_TYPE:
1739
+ return getComponentName(type.render);
1331
1740
 
1332
- /**
1333
- * Resolves with an object of overflow side offsets that determine how much the
1334
- * element is overflowing a given clipping boundary.
1335
- * - positive = overflowing the boundary by that number of pixels
1336
- * - negative = how many pixels left before it will overflow
1337
- * - 0 = lies flush with the boundary
1338
- * @see https://floating-ui.com/docs/detectOverflow
1339
- */
1340
- async function detectOverflow(middlewareArguments, options) {
1341
- var _await$platform$isEle;
1741
+ case REACT_LAZY_TYPE:
1742
+ {
1743
+ var thenable = type;
1744
+ var resolvedThenable = refineResolvedLazyComponent(thenable);
1342
1745
 
1343
- if (options === void 0) {
1344
- options = {};
1345
- }
1746
+ if (resolvedThenable) {
1747
+ return getComponentName(resolvedThenable);
1748
+ }
1346
1749
 
1347
- const {
1348
- x,
1349
- y,
1350
- platform,
1351
- rects,
1352
- elements,
1353
- strategy
1354
- } = middlewareArguments;
1355
- const {
1356
- boundary = 'clippingAncestors',
1357
- rootBoundary = 'viewport',
1358
- elementContext = 'floating',
1359
- altBoundary = false,
1360
- padding = 0
1361
- } = options;
1362
- const paddingObject = getSideObjectFromPadding(padding);
1363
- const altContext = elementContext === 'floating' ? 'reference' : 'floating';
1364
- const element = elements[altBoundary ? altContext : elementContext];
1365
- const clippingClientRect = rectToClientRect(await platform.getClippingRect({
1366
- element: ((_await$platform$isEle = await (platform.isElement == null ? void 0 : platform.isElement(element))) != null ? _await$platform$isEle : true) ? element : element.contextElement || (await (platform.getDocumentElement == null ? void 0 : platform.getDocumentElement(elements.floating))),
1367
- boundary,
1368
- rootBoundary,
1369
- strategy
1370
- }));
1371
- const elementClientRect = rectToClientRect(platform.convertOffsetParentRelativeRectToViewportRelativeRect ? await platform.convertOffsetParentRelativeRectToViewportRelativeRect({
1372
- rect: elementContext === 'floating' ? { ...rects.floating,
1373
- x,
1374
- y
1375
- } : rects.reference,
1376
- offsetParent: await (platform.getOffsetParent == null ? void 0 : platform.getOffsetParent(elements.floating)),
1377
- strategy
1378
- }) : rects[elementContext]);
1379
- return {
1380
- top: clippingClientRect.top - elementClientRect.top + paddingObject.top,
1381
- bottom: elementClientRect.bottom - clippingClientRect.bottom + paddingObject.bottom,
1382
- left: clippingClientRect.left - elementClientRect.left + paddingObject.left,
1383
- right: elementClientRect.right - clippingClientRect.right + paddingObject.right
1384
- };
1385
- }
1750
+ break;
1751
+ }
1752
+ }
1753
+ }
1386
1754
 
1387
- const min$1 = Math.min;
1388
- const max$1 = Math.max;
1755
+ return null;
1756
+ }
1389
1757
 
1390
- function within(min$1$1, value, max$1$1) {
1391
- return max$1(min$1$1, min$1(value, max$1$1));
1392
- }
1758
+ var loggedTypeFailures = {};
1759
+ ReactSharedInternals.ReactDebugCurrentFrame;
1760
+ var currentlyValidatingElement = null;
1393
1761
 
1394
- /**
1395
- * Positions an inner element of the floating element such that it is centered
1396
- * to the reference element.
1397
- * @see https://floating-ui.com/docs/arrow
1398
- */
1399
- const arrow = options => ({
1400
- name: 'arrow',
1401
- options,
1762
+ function setCurrentlyValidatingElement(element) {
1763
+ {
1764
+ currentlyValidatingElement = element;
1765
+ }
1766
+ }
1402
1767
 
1403
- async fn(middlewareArguments) {
1404
- // Since `element` is required, we don't Partial<> the type
1405
- const {
1406
- element,
1407
- padding = 0
1408
- } = options != null ? options : {};
1409
- const {
1410
- x,
1411
- y,
1412
- placement,
1413
- rects,
1414
- platform
1415
- } = middlewareArguments;
1768
+ function checkPropTypes(typeSpecs, values, location, componentName, element) {
1769
+ {
1770
+ // $FlowFixMe This is okay but Flow doesn't know it.
1771
+ var has = Function.call.bind(Object.prototype.hasOwnProperty);
1416
1772
 
1417
- if (element == null) {
1418
- {
1419
- console.warn('Floating UI: No `element` was passed to the `arrow` middleware.');
1420
- }
1773
+ for (var typeSpecName in typeSpecs) {
1774
+ if (has(typeSpecs, typeSpecName)) {
1775
+ var error$1 = void 0; // Prop type validation may throw. In case they do, we don't want to
1776
+ // fail the render phase where it didn't fail before. So we log it.
1777
+ // After these have been cleaned up, we'll let them throw.
1421
1778
 
1422
- return {};
1423
- }
1779
+ try {
1780
+ // This is intentionally an invariant that gets caught. It's the same
1781
+ // behavior as without this statement except with a better message.
1782
+ if (typeof typeSpecs[typeSpecName] !== 'function') {
1783
+ var err = Error((componentName || 'React class') + ': ' + location + ' type `' + typeSpecName + '` is invalid; ' + 'it must be a function, usually from the `prop-types` package, but received `' + typeof typeSpecs[typeSpecName] + '`.' + 'This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`.');
1784
+ err.name = 'Invariant Violation';
1785
+ throw err;
1786
+ }
1424
1787
 
1425
- const paddingObject = getSideObjectFromPadding(padding);
1426
- const coords = {
1427
- x,
1428
- y
1429
- };
1430
- const axis = getMainAxisFromPlacement(placement);
1431
- const alignment = getAlignment(placement);
1432
- const length = getLengthFromAxis(axis);
1433
- const arrowDimensions = await platform.getDimensions(element);
1434
- const minProp = axis === 'y' ? 'top' : 'left';
1435
- const maxProp = axis === 'y' ? 'bottom' : 'right';
1436
- const endDiff = rects.reference[length] + rects.reference[axis] - coords[axis] - rects.floating[length];
1437
- const startDiff = coords[axis] - rects.reference[axis];
1438
- const arrowOffsetParent = await (platform.getOffsetParent == null ? void 0 : platform.getOffsetParent(element));
1439
- let clientSize = arrowOffsetParent ? axis === 'y' ? arrowOffsetParent.clientHeight || 0 : arrowOffsetParent.clientWidth || 0 : 0;
1788
+ error$1 = typeSpecs[typeSpecName](values, typeSpecName, componentName, location, null, 'SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED');
1789
+ } catch (ex) {
1790
+ error$1 = ex;
1791
+ }
1440
1792
 
1441
- if (clientSize === 0) {
1442
- clientSize = rects.floating[length];
1443
- }
1793
+ if (error$1 && !(error$1 instanceof Error)) {
1794
+ setCurrentlyValidatingElement(element);
1444
1795
 
1445
- const centerToReference = endDiff / 2 - startDiff / 2; // Make sure the arrow doesn't overflow the floating element if the center
1446
- // point is outside the floating element's bounds
1796
+ error('%s: type specification of %s' + ' `%s` is invalid; the type checker ' + 'function must return `null` or an `Error` but returned a %s. ' + 'You may have forgotten to pass an argument to the type checker ' + 'creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and ' + 'shape all require an argument).', componentName || 'React class', location, typeSpecName, typeof error$1);
1447
1797
 
1448
- const min = paddingObject[minProp];
1449
- const max = clientSize - arrowDimensions[length] - paddingObject[maxProp];
1450
- const center = clientSize / 2 - arrowDimensions[length] / 2 + centerToReference;
1451
- const offset = within(min, center, max); // Make sure that arrow points at the reference
1798
+ setCurrentlyValidatingElement(null);
1799
+ }
1452
1800
 
1453
- const alignmentPadding = alignment === 'start' ? paddingObject[minProp] : paddingObject[maxProp];
1454
- const shouldAddOffset = alignmentPadding > 0 && center !== offset && rects.reference[length] <= rects.floating[length];
1455
- const alignmentOffset = shouldAddOffset ? center < min ? min - center : max - center : 0;
1456
- return {
1457
- [axis]: coords[axis] - alignmentOffset,
1458
- data: {
1459
- [axis]: offset,
1460
- centerOffset: center - offset
1461
- }
1462
- };
1463
- }
1801
+ if (error$1 instanceof Error && !(error$1.message in loggedTypeFailures)) {
1802
+ // Only monitor this failure once because there tends to be a lot of the
1803
+ // same error.
1804
+ loggedTypeFailures[error$1.message] = true;
1805
+ setCurrentlyValidatingElement(element);
1464
1806
 
1465
- });
1807
+ error('Failed %s type: %s', location, error$1.message);
1466
1808
 
1467
- const hash$1 = {
1468
- left: 'right',
1469
- right: 'left',
1470
- bottom: 'top',
1471
- top: 'bottom'
1472
- };
1473
- function getOppositePlacement(placement) {
1474
- return placement.replace(/left|right|bottom|top/g, matched => hash$1[matched]);
1475
- }
1809
+ setCurrentlyValidatingElement(null);
1810
+ }
1811
+ }
1812
+ }
1813
+ }
1814
+ }
1476
1815
 
1477
- function getAlignmentSides(placement, rects, rtl) {
1478
- if (rtl === void 0) {
1479
- rtl = false;
1480
- }
1816
+ var ReactCurrentOwner = ReactSharedInternals.ReactCurrentOwner;
1817
+ var hasOwnProperty = Object.prototype.hasOwnProperty;
1818
+ var RESERVED_PROPS = {
1819
+ key: true,
1820
+ ref: true,
1821
+ __self: true,
1822
+ __source: true
1823
+ };
1824
+ var specialPropKeyWarningShown;
1825
+ var specialPropRefWarningShown;
1826
+ var didWarnAboutStringRefs;
1481
1827
 
1482
- const alignment = getAlignment(placement);
1483
- const mainAxis = getMainAxisFromPlacement(placement);
1484
- const length = getLengthFromAxis(mainAxis);
1485
- let mainAlignmentSide = mainAxis === 'x' ? alignment === (rtl ? 'end' : 'start') ? 'right' : 'left' : alignment === 'start' ? 'bottom' : 'top';
1828
+ {
1829
+ didWarnAboutStringRefs = {};
1830
+ }
1486
1831
 
1487
- if (rects.reference[length] > rects.floating[length]) {
1488
- mainAlignmentSide = getOppositePlacement(mainAlignmentSide);
1489
- }
1832
+ function hasValidRef(config) {
1833
+ {
1834
+ if (hasOwnProperty.call(config, 'ref')) {
1835
+ var getter = Object.getOwnPropertyDescriptor(config, 'ref').get;
1490
1836
 
1491
- return {
1492
- main: mainAlignmentSide,
1493
- cross: getOppositePlacement(mainAlignmentSide)
1494
- };
1495
- }
1837
+ if (getter && getter.isReactWarning) {
1838
+ return false;
1839
+ }
1840
+ }
1841
+ }
1496
1842
 
1497
- const hash = {
1498
- start: 'end',
1499
- end: 'start'
1500
- };
1501
- function getOppositeAlignmentPlacement(placement) {
1502
- return placement.replace(/start|end/g, matched => hash[matched]);
1503
- }
1843
+ return config.ref !== undefined;
1844
+ }
1504
1845
 
1505
- function getExpandedPlacements(placement) {
1506
- const oppositePlacement = getOppositePlacement(placement);
1507
- return [getOppositeAlignmentPlacement(placement), oppositePlacement, getOppositeAlignmentPlacement(oppositePlacement)];
1508
- }
1846
+ function hasValidKey(config) {
1847
+ {
1848
+ if (hasOwnProperty.call(config, 'key')) {
1849
+ var getter = Object.getOwnPropertyDescriptor(config, 'key').get;
1850
+
1851
+ if (getter && getter.isReactWarning) {
1852
+ return false;
1853
+ }
1854
+ }
1855
+ }
1509
1856
 
1510
- /**
1511
- * Changes the placement of the floating element to one that will fit if the
1512
- * initially specified `placement` does not.
1513
- * @see https://floating-ui.com/docs/flip
1514
- */
1515
- const flip = function (options) {
1516
- if (options === void 0) {
1517
- options = {};
1518
- }
1857
+ return config.key !== undefined;
1858
+ }
1519
1859
 
1520
- return {
1521
- name: 'flip',
1522
- options,
1860
+ function warnIfStringRefCannotBeAutoConverted(config, self) {
1861
+ {
1862
+ if (typeof config.ref === 'string' && ReactCurrentOwner.current && self && ReactCurrentOwner.current.stateNode !== self) {
1863
+ var componentName = getComponentName(ReactCurrentOwner.current.type);
1523
1864
 
1524
- async fn(middlewareArguments) {
1525
- var _middlewareData$flip;
1865
+ if (!didWarnAboutStringRefs[componentName]) {
1866
+ error('Component "%s" contains the string ref "%s". ' + 'Support for string refs will be removed in a future major release. ' + 'This case cannot be automatically converted to an arrow function. ' + 'We ask you to manually fix this case by using useRef() or createRef() instead. ' + 'Learn more about using refs safely here: ' + 'https://reactjs.org/link/strict-mode-string-ref', getComponentName(ReactCurrentOwner.current.type), config.ref);
1526
1867
 
1527
- const {
1528
- placement,
1529
- middlewareData,
1530
- rects,
1531
- initialPlacement,
1532
- platform,
1533
- elements
1534
- } = middlewareArguments;
1535
- const {
1536
- mainAxis: checkMainAxis = true,
1537
- crossAxis: checkCrossAxis = true,
1538
- fallbackPlacements: specifiedFallbackPlacements,
1539
- fallbackStrategy = 'bestFit',
1540
- flipAlignment = true,
1541
- ...detectOverflowOptions
1542
- } = options;
1543
- const side = getSide(placement);
1544
- const isBasePlacement = side === initialPlacement;
1545
- const fallbackPlacements = specifiedFallbackPlacements || (isBasePlacement || !flipAlignment ? [getOppositePlacement(initialPlacement)] : getExpandedPlacements(initialPlacement));
1546
- const placements = [initialPlacement, ...fallbackPlacements];
1547
- const overflow = await detectOverflow(middlewareArguments, detectOverflowOptions);
1548
- const overflows = [];
1549
- let overflowsData = ((_middlewareData$flip = middlewareData.flip) == null ? void 0 : _middlewareData$flip.overflows) || [];
1868
+ didWarnAboutStringRefs[componentName] = true;
1869
+ }
1870
+ }
1871
+ }
1872
+ }
1550
1873
 
1551
- if (checkMainAxis) {
1552
- overflows.push(overflow[side]);
1553
- }
1874
+ function defineKeyPropWarningGetter(props, displayName) {
1875
+ {
1876
+ var warnAboutAccessingKey = function () {
1877
+ if (!specialPropKeyWarningShown) {
1878
+ specialPropKeyWarningShown = true;
1554
1879
 
1555
- if (checkCrossAxis) {
1556
- const {
1557
- main,
1558
- cross
1559
- } = getAlignmentSides(placement, rects, await (platform.isRTL == null ? void 0 : platform.isRTL(elements.floating)));
1560
- overflows.push(overflow[main], overflow[cross]);
1561
- }
1880
+ error('%s: `key` is not a prop. Trying to access it will result ' + 'in `undefined` being returned. If you need to access the same ' + 'value within the child component, you should pass it as a different ' + 'prop. (https://reactjs.org/link/special-props)', displayName);
1881
+ }
1882
+ };
1562
1883
 
1563
- overflowsData = [...overflowsData, {
1564
- placement,
1565
- overflows
1566
- }]; // One or more sides is overflowing
1884
+ warnAboutAccessingKey.isReactWarning = true;
1885
+ Object.defineProperty(props, 'key', {
1886
+ get: warnAboutAccessingKey,
1887
+ configurable: true
1888
+ });
1889
+ }
1890
+ }
1567
1891
 
1568
- if (!overflows.every(side => side <= 0)) {
1569
- var _middlewareData$flip$, _middlewareData$flip2;
1892
+ function defineRefPropWarningGetter(props, displayName) {
1893
+ {
1894
+ var warnAboutAccessingRef = function () {
1895
+ if (!specialPropRefWarningShown) {
1896
+ specialPropRefWarningShown = true;
1570
1897
 
1571
- const nextIndex = ((_middlewareData$flip$ = (_middlewareData$flip2 = middlewareData.flip) == null ? void 0 : _middlewareData$flip2.index) != null ? _middlewareData$flip$ : 0) + 1;
1572
- const nextPlacement = placements[nextIndex];
1898
+ error('%s: `ref` is not a prop. Trying to access it will result ' + 'in `undefined` being returned. If you need to access the same ' + 'value within the child component, you should pass it as a different ' + 'prop. (https://reactjs.org/link/special-props)', displayName);
1899
+ }
1900
+ };
1573
1901
 
1574
- if (nextPlacement) {
1575
- // Try next placement and re-run the lifecycle
1576
- return {
1577
- data: {
1578
- index: nextIndex,
1579
- overflows: overflowsData
1580
- },
1581
- reset: {
1582
- placement: nextPlacement
1583
- }
1584
- };
1585
- }
1902
+ warnAboutAccessingRef.isReactWarning = true;
1903
+ Object.defineProperty(props, 'ref', {
1904
+ get: warnAboutAccessingRef,
1905
+ configurable: true
1906
+ });
1907
+ }
1908
+ }
1909
+ /**
1910
+ * Factory method to create a new React element. This no longer adheres to
1911
+ * the class pattern, so do not use new to call it. Also, instanceof check
1912
+ * will not work. Instead test $$typeof field against Symbol.for('react.element') to check
1913
+ * if something is a React Element.
1914
+ *
1915
+ * @param {*} type
1916
+ * @param {*} props
1917
+ * @param {*} key
1918
+ * @param {string|object} ref
1919
+ * @param {*} owner
1920
+ * @param {*} self A *temporary* helper to detect places where `this` is
1921
+ * different from the `owner` when React.createElement is called, so that we
1922
+ * can warn. We want to get rid of owner and replace string `ref`s with arrow
1923
+ * functions, and as long as `this` and owner are the same, there will be no
1924
+ * change in behavior.
1925
+ * @param {*} source An annotation object (added by a transpiler or otherwise)
1926
+ * indicating filename, line number, and/or other information.
1927
+ * @internal
1928
+ */
1586
1929
 
1587
- let resetPlacement = 'bottom';
1588
1930
 
1589
- switch (fallbackStrategy) {
1590
- case 'bestFit':
1591
- {
1592
- var _overflowsData$map$so;
1931
+ var ReactElement = function (type, key, ref, self, source, owner, props) {
1932
+ var element = {
1933
+ // This tag allows us to uniquely identify this as a React Element
1934
+ $$typeof: REACT_ELEMENT_TYPE,
1935
+ // Built-in properties that belong on the element
1936
+ type: type,
1937
+ key: key,
1938
+ ref: ref,
1939
+ props: props,
1940
+ // Record the component responsible for creating this element.
1941
+ _owner: owner
1942
+ };
1593
1943
 
1594
- const placement = (_overflowsData$map$so = overflowsData.map(d => [d, d.overflows.filter(overflow => overflow > 0).reduce((acc, overflow) => acc + overflow, 0)]).sort((a, b) => a[1] - b[1])[0]) == null ? void 0 : _overflowsData$map$so[0].placement;
1944
+ {
1945
+ // The validation flag is currently mutative. We put it on
1946
+ // an external backing store so that we can freeze the whole object.
1947
+ // This can be replaced with a WeakMap once they are implemented in
1948
+ // commonly used development environments.
1949
+ element._store = {}; // To make comparing ReactElements easier for testing purposes, we make
1950
+ // the validation flag non-enumerable (where possible, which should
1951
+ // include every environment we run tests in), so the test framework
1952
+ // ignores it.
1595
1953
 
1596
- if (placement) {
1597
- resetPlacement = placement;
1598
- }
1954
+ Object.defineProperty(element._store, 'validated', {
1955
+ configurable: false,
1956
+ enumerable: false,
1957
+ writable: true,
1958
+ value: false
1959
+ }); // self and source are DEV only properties.
1599
1960
 
1600
- break;
1601
- }
1961
+ Object.defineProperty(element, '_self', {
1962
+ configurable: false,
1963
+ enumerable: false,
1964
+ writable: false,
1965
+ value: self
1966
+ }); // Two elements created in two different places should be considered
1967
+ // equal for testing purposes and therefore we hide it from enumeration.
1602
1968
 
1603
- case 'initialPlacement':
1604
- resetPlacement = initialPlacement;
1605
- break;
1606
- }
1969
+ Object.defineProperty(element, '_source', {
1970
+ configurable: false,
1971
+ enumerable: false,
1972
+ writable: false,
1973
+ value: source
1974
+ });
1607
1975
 
1608
- if (placement !== resetPlacement) {
1609
- return {
1610
- reset: {
1611
- placement: resetPlacement
1612
- }
1613
- };
1614
- }
1615
- }
1976
+ if (Object.freeze) {
1977
+ Object.freeze(element.props);
1978
+ Object.freeze(element);
1979
+ }
1980
+ }
1616
1981
 
1617
- return {};
1618
- }
1982
+ return element;
1983
+ };
1984
+ /**
1985
+ * https://github.com/reactjs/rfcs/pull/107
1986
+ * @param {*} type
1987
+ * @param {object} props
1988
+ * @param {string} key
1989
+ */
1619
1990
 
1620
- };
1621
- };
1991
+ function jsxDEV(type, config, maybeKey, source, self) {
1992
+ {
1993
+ var propName; // Reserved names are extracted
1622
1994
 
1623
- async function convertValueToCoords(middlewareArguments, value) {
1624
- const {
1625
- placement,
1626
- platform,
1627
- elements
1628
- } = middlewareArguments;
1629
- const rtl = await (platform.isRTL == null ? void 0 : platform.isRTL(elements.floating));
1630
- const side = getSide(placement);
1631
- const alignment = getAlignment(placement);
1632
- const isVertical = getMainAxisFromPlacement(placement) === 'x';
1633
- const mainAxisMulti = ['left', 'top'].includes(side) ? -1 : 1;
1634
- const crossAxisMulti = rtl && isVertical ? -1 : 1;
1635
- const rawValue = typeof value === 'function' ? value(middlewareArguments) : value; // eslint-disable-next-line prefer-const
1995
+ var props = {};
1996
+ var key = null;
1997
+ var ref = null; // Currently, key can be spread in as a prop. This causes a potential
1998
+ // issue if key is also explicitly declared (ie. <div {...props} key="Hi" />
1999
+ // or <div key="Hi" {...props} /> ). We want to deprecate key spread,
2000
+ // but as an intermediary step, we will use jsxDEV for everything except
2001
+ // <div {...props} key="Hi" />, because we aren't currently able to tell if
2002
+ // key is explicitly declared to be undefined or not.
1636
2003
 
1637
- let {
1638
- mainAxis,
1639
- crossAxis,
1640
- alignmentAxis
1641
- } = typeof rawValue === 'number' ? {
1642
- mainAxis: rawValue,
1643
- crossAxis: 0,
1644
- alignmentAxis: null
1645
- } : {
1646
- mainAxis: 0,
1647
- crossAxis: 0,
1648
- alignmentAxis: null,
1649
- ...rawValue
1650
- };
2004
+ if (maybeKey !== undefined) {
2005
+ key = '' + maybeKey;
2006
+ }
1651
2007
 
1652
- if (alignment && typeof alignmentAxis === 'number') {
1653
- crossAxis = alignment === 'end' ? alignmentAxis * -1 : alignmentAxis;
1654
- }
2008
+ if (hasValidKey(config)) {
2009
+ key = '' + config.key;
2010
+ }
1655
2011
 
1656
- return isVertical ? {
1657
- x: crossAxis * crossAxisMulti,
1658
- y: mainAxis * mainAxisMulti
1659
- } : {
1660
- x: mainAxis * mainAxisMulti,
1661
- y: crossAxis * crossAxisMulti
1662
- };
1663
- }
1664
- /**
1665
- * Displaces the floating element from its reference element.
1666
- * @see https://floating-ui.com/docs/offset
1667
- */
2012
+ if (hasValidRef(config)) {
2013
+ ref = config.ref;
2014
+ warnIfStringRefCannotBeAutoConverted(config, self);
2015
+ } // Remaining properties are added to a new props object
1668
2016
 
1669
- const offset = function (value) {
1670
- if (value === void 0) {
1671
- value = 0;
1672
- }
1673
2017
 
1674
- return {
1675
- name: 'offset',
1676
- options: value,
2018
+ for (propName in config) {
2019
+ if (hasOwnProperty.call(config, propName) && !RESERVED_PROPS.hasOwnProperty(propName)) {
2020
+ props[propName] = config[propName];
2021
+ }
2022
+ } // Resolve default props
1677
2023
 
1678
- async fn(middlewareArguments) {
1679
- const {
1680
- x,
1681
- y
1682
- } = middlewareArguments;
1683
- const diffCoords = await convertValueToCoords(middlewareArguments, value);
1684
- return {
1685
- x: x + diffCoords.x,
1686
- y: y + diffCoords.y,
1687
- data: diffCoords
1688
- };
1689
- }
1690
2024
 
1691
- };
1692
- };
2025
+ if (type && type.defaultProps) {
2026
+ var defaultProps = type.defaultProps;
1693
2027
 
1694
- function getCrossAxis(axis) {
1695
- return axis === 'x' ? 'y' : 'x';
1696
- }
2028
+ for (propName in defaultProps) {
2029
+ if (props[propName] === undefined) {
2030
+ props[propName] = defaultProps[propName];
2031
+ }
2032
+ }
2033
+ }
1697
2034
 
1698
- /**
1699
- * Shifts the floating element in order to keep it in view when it will overflow
1700
- * a clipping boundary.
1701
- * @see https://floating-ui.com/docs/shift
1702
- */
1703
- const shift = function (options) {
1704
- if (options === void 0) {
1705
- options = {};
1706
- }
2035
+ if (key || ref) {
2036
+ var displayName = typeof type === 'function' ? type.displayName || type.name || 'Unknown' : type;
1707
2037
 
1708
- return {
1709
- name: 'shift',
1710
- options,
2038
+ if (key) {
2039
+ defineKeyPropWarningGetter(props, displayName);
2040
+ }
1711
2041
 
1712
- async fn(middlewareArguments) {
1713
- const {
1714
- x,
1715
- y,
1716
- placement
1717
- } = middlewareArguments;
1718
- const {
1719
- mainAxis: checkMainAxis = true,
1720
- crossAxis: checkCrossAxis = false,
1721
- limiter = {
1722
- fn: _ref => {
1723
- let {
1724
- x,
1725
- y
1726
- } = _ref;
1727
- return {
1728
- x,
1729
- y
1730
- };
1731
- }
1732
- },
1733
- ...detectOverflowOptions
1734
- } = options;
1735
- const coords = {
1736
- x,
1737
- y
1738
- };
1739
- const overflow = await detectOverflow(middlewareArguments, detectOverflowOptions);
1740
- const mainAxis = getMainAxisFromPlacement(getSide(placement));
1741
- const crossAxis = getCrossAxis(mainAxis);
1742
- let mainAxisCoord = coords[mainAxis];
1743
- let crossAxisCoord = coords[crossAxis];
2042
+ if (ref) {
2043
+ defineRefPropWarningGetter(props, displayName);
2044
+ }
2045
+ }
1744
2046
 
1745
- if (checkMainAxis) {
1746
- const minSide = mainAxis === 'y' ? 'top' : 'left';
1747
- const maxSide = mainAxis === 'y' ? 'bottom' : 'right';
1748
- const min = mainAxisCoord + overflow[minSide];
1749
- const max = mainAxisCoord - overflow[maxSide];
1750
- mainAxisCoord = within(min, mainAxisCoord, max);
1751
- }
2047
+ return ReactElement(type, key, ref, self, source, ReactCurrentOwner.current, props);
2048
+ }
2049
+ }
1752
2050
 
1753
- if (checkCrossAxis) {
1754
- const minSide = crossAxis === 'y' ? 'top' : 'left';
1755
- const maxSide = crossAxis === 'y' ? 'bottom' : 'right';
1756
- const min = crossAxisCoord + overflow[minSide];
1757
- const max = crossAxisCoord - overflow[maxSide];
1758
- crossAxisCoord = within(min, crossAxisCoord, max);
1759
- }
2051
+ var ReactCurrentOwner$1 = ReactSharedInternals.ReactCurrentOwner;
2052
+ ReactSharedInternals.ReactDebugCurrentFrame;
1760
2053
 
1761
- const limitedCoords = limiter.fn({ ...middlewareArguments,
1762
- [mainAxis]: mainAxisCoord,
1763
- [crossAxis]: crossAxisCoord
1764
- });
1765
- return { ...limitedCoords,
1766
- data: {
1767
- x: limitedCoords.x - x,
1768
- y: limitedCoords.y - y
1769
- }
1770
- };
1771
- }
2054
+ function setCurrentlyValidatingElement$1(element) {
2055
+ currentlyValidatingElement = element;
2056
+ }
1772
2057
 
1773
- };
1774
- };
2058
+ var propTypesMisspellWarningShown;
1775
2059
 
1776
- function isWindow(value) {
1777
- return value && value.document && value.location && value.alert && value.setInterval;
1778
- }
1779
- function getWindow(node) {
1780
- if (node == null) {
1781
- return window;
1782
- }
2060
+ {
2061
+ propTypesMisspellWarningShown = false;
2062
+ }
2063
+ /**
2064
+ * Verifies the object is a ReactElement.
2065
+ * See https://reactjs.org/docs/react-api.html#isvalidelement
2066
+ * @param {?object} object
2067
+ * @return {boolean} True if `object` is a ReactElement.
2068
+ * @final
2069
+ */
1783
2070
 
1784
- if (!isWindow(node)) {
1785
- const ownerDocument = node.ownerDocument;
1786
- return ownerDocument ? ownerDocument.defaultView || window : window;
1787
- }
2071
+ function isValidElement(object) {
2072
+ {
2073
+ return typeof object === 'object' && object !== null && object.$$typeof === REACT_ELEMENT_TYPE;
2074
+ }
2075
+ }
1788
2076
 
1789
- return node;
1790
- }
2077
+ function getDeclarationErrorAddendum() {
2078
+ {
2079
+ if (ReactCurrentOwner$1.current) {
2080
+ var name = getComponentName(ReactCurrentOwner$1.current.type);
1791
2081
 
1792
- function getComputedStyle(element) {
1793
- return getWindow(element).getComputedStyle(element);
1794
- }
2082
+ if (name) {
2083
+ return '\n\nCheck the render method of `' + name + '`.';
2084
+ }
2085
+ }
1795
2086
 
1796
- function getNodeName(node) {
1797
- return isWindow(node) ? '' : node ? (node.nodeName || '').toLowerCase() : '';
1798
- }
2087
+ return '';
2088
+ }
2089
+ }
1799
2090
 
1800
- function getUAString() {
1801
- const uaData = navigator.userAgentData;
2091
+ function getSourceInfoErrorAddendum(source) {
2092
+ {
2093
+ if (source !== undefined) {
2094
+ var fileName = source.fileName.replace(/^.*[\\\/]/, '');
2095
+ var lineNumber = source.lineNumber;
2096
+ return '\n\nCheck your code at ' + fileName + ':' + lineNumber + '.';
2097
+ }
1802
2098
 
1803
- if (uaData != null && uaData.brands) {
1804
- return uaData.brands.map(item => item.brand + "/" + item.version).join(' ');
1805
- }
2099
+ return '';
2100
+ }
2101
+ }
2102
+ /**
2103
+ * Warn if there's no key explicitly set on dynamic arrays of children or
2104
+ * object keys are not valid. This allows us to keep track of children between
2105
+ * updates.
2106
+ */
1806
2107
 
1807
- return navigator.userAgent;
1808
- }
1809
2108
 
1810
- function isHTMLElement(value) {
1811
- return value instanceof getWindow(value).HTMLElement;
1812
- }
1813
- function isElement(value) {
1814
- return value instanceof getWindow(value).Element;
1815
- }
1816
- function isNode(value) {
1817
- return value instanceof getWindow(value).Node;
1818
- }
1819
- function isShadowRoot(node) {
1820
- // Browsers without `ShadowRoot` support
1821
- if (typeof ShadowRoot === 'undefined') {
1822
- return false;
1823
- }
2109
+ var ownerHasKeyUseWarning = {};
1824
2110
 
1825
- const OwnElement = getWindow(node).ShadowRoot;
1826
- return node instanceof OwnElement || node instanceof ShadowRoot;
1827
- }
1828
- function isOverflowElement(element) {
1829
- // Firefox wants us to check `-x` and `-y` variations as well
1830
- const {
1831
- overflow,
1832
- overflowX,
1833
- overflowY,
1834
- display
1835
- } = getComputedStyle(element);
1836
- return /auto|scroll|overlay|hidden/.test(overflow + overflowY + overflowX) && !['inline', 'contents'].includes(display);
1837
- }
1838
- function isTableElement(element) {
1839
- return ['table', 'td', 'th'].includes(getNodeName(element));
1840
- }
1841
- function isContainingBlock(element) {
1842
- // TODO: Try and use feature detection here instead
1843
- const isFirefox = /firefox/i.test(getUAString());
1844
- const css = getComputedStyle(element);
1845
- const backdropFilter = css.backdropFilter || css.WebkitBackdropFilter; // This is non-exhaustive but covers the most common CSS properties that
1846
- // create a containing block.
1847
- // https://developer.mozilla.org/en-US/docs/Web/CSS/Containing_block#identifying_the_containing_block
2111
+ function getCurrentComponentErrorInfo(parentType) {
2112
+ {
2113
+ var info = getDeclarationErrorAddendum();
1848
2114
 
1849
- return css.transform !== 'none' || css.perspective !== 'none' || (backdropFilter ? backdropFilter !== 'none' : false) || isFirefox && css.willChange === 'filter' || isFirefox && (css.filter ? css.filter !== 'none' : false) || ['transform', 'perspective'].some(value => css.willChange.includes(value)) || ['paint', 'layout', 'strict', 'content'].some( // TS 4.1 compat
1850
- value => {
1851
- const contain = css.contain;
1852
- return contain != null ? contain.includes(value) : false;
1853
- });
1854
- }
1855
- function isLayoutViewport() {
1856
- // Not Safari
1857
- return !/^((?!chrome|android).)*safari/i.test(getUAString()); // Feature detection for this fails in various ways
1858
- // • Always-visible scrollbar or not
1859
- // • Width of <html>, etc.
1860
- // const vV = win.visualViewport;
1861
- // return vV ? Math.abs(win.innerWidth / vV.scale - vV.width) < 0.5 : true;
1862
- }
1863
- function isLastTraversableNode(node) {
1864
- return ['html', 'body', '#document'].includes(getNodeName(node));
1865
- }
2115
+ if (!info) {
2116
+ var parentName = typeof parentType === 'string' ? parentType : parentType.displayName || parentType.name;
1866
2117
 
1867
- const min = Math.min;
1868
- const max = Math.max;
1869
- const round = Math.round;
2118
+ if (parentName) {
2119
+ info = "\n\nCheck the top-level render call using <" + parentName + ">.";
2120
+ }
2121
+ }
1870
2122
 
1871
- function getBoundingClientRect(element, includeScale, isFixedStrategy) {
1872
- var _win$visualViewport$o, _win$visualViewport, _win$visualViewport$o2, _win$visualViewport2;
2123
+ return info;
2124
+ }
2125
+ }
2126
+ /**
2127
+ * Warn if the element doesn't have an explicit key assigned to it.
2128
+ * This element is in an array. The array could grow and shrink or be
2129
+ * reordered. All children that haven't already been validated are required to
2130
+ * have a "key" property assigned to it. Error statuses are cached so a warning
2131
+ * will only be shown once.
2132
+ *
2133
+ * @internal
2134
+ * @param {ReactElement} element Element that requires a key.
2135
+ * @param {*} parentType element's parent's type.
2136
+ */
1873
2137
 
1874
- if (includeScale === void 0) {
1875
- includeScale = false;
1876
- }
1877
2138
 
1878
- if (isFixedStrategy === void 0) {
1879
- isFixedStrategy = false;
1880
- }
2139
+ function validateExplicitKey(element, parentType) {
2140
+ {
2141
+ if (!element._store || element._store.validated || element.key != null) {
2142
+ return;
2143
+ }
1881
2144
 
1882
- const clientRect = element.getBoundingClientRect();
1883
- let scaleX = 1;
1884
- let scaleY = 1;
2145
+ element._store.validated = true;
2146
+ var currentComponentErrorInfo = getCurrentComponentErrorInfo(parentType);
1885
2147
 
1886
- if (includeScale && isHTMLElement(element)) {
1887
- scaleX = element.offsetWidth > 0 ? round(clientRect.width) / element.offsetWidth || 1 : 1;
1888
- scaleY = element.offsetHeight > 0 ? round(clientRect.height) / element.offsetHeight || 1 : 1;
1889
- }
2148
+ if (ownerHasKeyUseWarning[currentComponentErrorInfo]) {
2149
+ return;
2150
+ }
1890
2151
 
1891
- const win = isElement(element) ? getWindow(element) : window;
1892
- const addVisualOffsets = !isLayoutViewport() && isFixedStrategy;
1893
- const x = (clientRect.left + (addVisualOffsets ? (_win$visualViewport$o = (_win$visualViewport = win.visualViewport) == null ? void 0 : _win$visualViewport.offsetLeft) != null ? _win$visualViewport$o : 0 : 0)) / scaleX;
1894
- const y = (clientRect.top + (addVisualOffsets ? (_win$visualViewport$o2 = (_win$visualViewport2 = win.visualViewport) == null ? void 0 : _win$visualViewport2.offsetTop) != null ? _win$visualViewport$o2 : 0 : 0)) / scaleY;
1895
- const width = clientRect.width / scaleX;
1896
- const height = clientRect.height / scaleY;
1897
- return {
1898
- width,
1899
- height,
1900
- top: y,
1901
- right: x + width,
1902
- bottom: y + height,
1903
- left: x,
1904
- x,
1905
- y
1906
- };
1907
- }
2152
+ ownerHasKeyUseWarning[currentComponentErrorInfo] = true; // Usually the current owner is the offender, but if it accepts children as a
2153
+ // property, it may be the creator of the child that's responsible for
2154
+ // assigning it a key.
1908
2155
 
1909
- function getDocumentElement(node) {
1910
- return ((isNode(node) ? node.ownerDocument : node.document) || window.document).documentElement;
1911
- }
2156
+ var childOwner = '';
1912
2157
 
1913
- function getNodeScroll(element) {
1914
- if (isElement(element)) {
1915
- return {
1916
- scrollLeft: element.scrollLeft,
1917
- scrollTop: element.scrollTop
1918
- };
1919
- }
2158
+ if (element && element._owner && element._owner !== ReactCurrentOwner$1.current) {
2159
+ // Give the component that originally created this child.
2160
+ childOwner = " It was passed a child from " + getComponentName(element._owner.type) + ".";
2161
+ }
1920
2162
 
1921
- return {
1922
- scrollLeft: element.pageXOffset,
1923
- scrollTop: element.pageYOffset
1924
- };
1925
- }
2163
+ setCurrentlyValidatingElement$1(element);
1926
2164
 
1927
- function getWindowScrollBarX(element) {
1928
- // If <html> has a CSS width greater than the viewport, then this will be
1929
- // incorrect for RTL.
1930
- return getBoundingClientRect(getDocumentElement(element)).left + getNodeScroll(element).scrollLeft;
1931
- }
2165
+ error('Each child in a list should have a unique "key" prop.' + '%s%s See https://reactjs.org/link/warning-keys for more information.', currentComponentErrorInfo, childOwner);
1932
2166
 
1933
- function isScaled(element) {
1934
- const rect = getBoundingClientRect(element);
1935
- return round(rect.width) !== element.offsetWidth || round(rect.height) !== element.offsetHeight;
1936
- }
2167
+ setCurrentlyValidatingElement$1(null);
2168
+ }
2169
+ }
2170
+ /**
2171
+ * Ensure that every element either is passed in a static location, in an
2172
+ * array with an explicit keys property defined, or in an object literal
2173
+ * with valid key property.
2174
+ *
2175
+ * @internal
2176
+ * @param {ReactNode} node Statically passed child of any type.
2177
+ * @param {*} parentType node's parent's type.
2178
+ */
1937
2179
 
1938
- function getRectRelativeToOffsetParent(element, offsetParent, strategy) {
1939
- const isOffsetParentAnElement = isHTMLElement(offsetParent);
1940
- const documentElement = getDocumentElement(offsetParent);
1941
- const rect = getBoundingClientRect(element, // @ts-ignore - checked above (TS 4.1 compat)
1942
- isOffsetParentAnElement && isScaled(offsetParent), strategy === 'fixed');
1943
- let scroll = {
1944
- scrollLeft: 0,
1945
- scrollTop: 0
1946
- };
1947
- const offsets = {
1948
- x: 0,
1949
- y: 0
1950
- };
1951
2180
 
1952
- if (isOffsetParentAnElement || !isOffsetParentAnElement && strategy !== 'fixed') {
1953
- if (getNodeName(offsetParent) !== 'body' || isOverflowElement(documentElement)) {
1954
- scroll = getNodeScroll(offsetParent);
1955
- }
2181
+ function validateChildKeys(node, parentType) {
2182
+ {
2183
+ if (typeof node !== 'object') {
2184
+ return;
2185
+ }
1956
2186
 
1957
- if (isHTMLElement(offsetParent)) {
1958
- const offsetRect = getBoundingClientRect(offsetParent, true);
1959
- offsets.x = offsetRect.x + offsetParent.clientLeft;
1960
- offsets.y = offsetRect.y + offsetParent.clientTop;
1961
- } else if (documentElement) {
1962
- offsets.x = getWindowScrollBarX(documentElement);
1963
- }
1964
- }
2187
+ if (Array.isArray(node)) {
2188
+ for (var i = 0; i < node.length; i++) {
2189
+ var child = node[i];
1965
2190
 
1966
- return {
1967
- x: rect.left + scroll.scrollLeft - offsets.x,
1968
- y: rect.top + scroll.scrollTop - offsets.y,
1969
- width: rect.width,
1970
- height: rect.height
1971
- };
1972
- }
2191
+ if (isValidElement(child)) {
2192
+ validateExplicitKey(child, parentType);
2193
+ }
2194
+ }
2195
+ } else if (isValidElement(node)) {
2196
+ // This element was passed in a valid location.
2197
+ if (node._store) {
2198
+ node._store.validated = true;
2199
+ }
2200
+ } else if (node) {
2201
+ var iteratorFn = getIteratorFn(node);
1973
2202
 
1974
- function getParentNode(node) {
1975
- if (getNodeName(node) === 'html') {
1976
- return node;
1977
- }
2203
+ if (typeof iteratorFn === 'function') {
2204
+ // Entry iterators used to provide implicit keys,
2205
+ // but now we print a separate warning for them later.
2206
+ if (iteratorFn !== node.entries) {
2207
+ var iterator = iteratorFn.call(node);
2208
+ var step;
1978
2209
 
1979
- const result = // Step into the shadow DOM of the parent of a slotted node
1980
- node.assignedSlot || // DOM Element detected
1981
- node.parentNode || ( // ShadowRoot detected
1982
- isShadowRoot(node) ? node.host : null) || // Fallback
1983
- getDocumentElement(node);
1984
- return isShadowRoot(result) ? result.host : result;
1985
- }
2210
+ while (!(step = iterator.next()).done) {
2211
+ if (isValidElement(step.value)) {
2212
+ validateExplicitKey(step.value, parentType);
2213
+ }
2214
+ }
2215
+ }
2216
+ }
2217
+ }
2218
+ }
2219
+ }
2220
+ /**
2221
+ * Given an element, validate that its props follow the propTypes definition,
2222
+ * provided by the type.
2223
+ *
2224
+ * @param {ReactElement} element
2225
+ */
1986
2226
 
1987
- function getTrueOffsetParent(element) {
1988
- if (!isHTMLElement(element) || getComputedStyle(element).position === 'fixed') {
1989
- return null;
1990
- }
1991
2227
 
1992
- return element.offsetParent;
1993
- }
2228
+ function validatePropTypes(element) {
2229
+ {
2230
+ var type = element.type;
1994
2231
 
1995
- function getContainingBlock(element) {
1996
- let currentNode = getParentNode(element);
2232
+ if (type === null || type === undefined || typeof type === 'string') {
2233
+ return;
2234
+ }
1997
2235
 
1998
- while (isHTMLElement(currentNode) && !isLastTraversableNode(currentNode)) {
1999
- if (isContainingBlock(currentNode)) {
2000
- return currentNode;
2001
- } else {
2002
- currentNode = getParentNode(currentNode);
2003
- }
2004
- }
2236
+ var propTypes;
2005
2237
 
2006
- return null;
2007
- } // Gets the closest ancestor positioned element. Handles some edge cases,
2008
- // such as table ancestors and cross browser bugs.
2238
+ if (typeof type === 'function') {
2239
+ propTypes = type.propTypes;
2240
+ } else if (typeof type === 'object' && (type.$$typeof === REACT_FORWARD_REF_TYPE || // Note: Memo only checks outer props here.
2241
+ // Inner props are checked in the reconciler.
2242
+ type.$$typeof === REACT_MEMO_TYPE)) {
2243
+ propTypes = type.propTypes;
2244
+ } else {
2245
+ return;
2246
+ }
2247
+
2248
+ if (propTypes) {
2249
+ // Intentionally inside to avoid triggering lazy initializers:
2250
+ var name = getComponentName(type);
2251
+ checkPropTypes(propTypes, element.props, 'prop', name, element);
2252
+ } else if (type.PropTypes !== undefined && !propTypesMisspellWarningShown) {
2253
+ propTypesMisspellWarningShown = true; // Intentionally inside to avoid triggering lazy initializers:
2254
+
2255
+ var _name = getComponentName(type);
2009
2256
 
2257
+ error('Component %s declared `PropTypes` instead of `propTypes`. Did you misspell the property assignment?', _name || 'Unknown');
2258
+ }
2010
2259
 
2011
- function getOffsetParent(element) {
2012
- const window = getWindow(element);
2013
- let offsetParent = getTrueOffsetParent(element);
2260
+ if (typeof type.getDefaultProps === 'function' && !type.getDefaultProps.isReactClassApproved) {
2261
+ error('getDefaultProps is only used on classic React.createClass ' + 'definitions. Use a static property named `defaultProps` instead.');
2262
+ }
2263
+ }
2264
+ }
2265
+ /**
2266
+ * Given a fragment, validate that it can only be provided with fragment props
2267
+ * @param {ReactElement} fragment
2268
+ */
2014
2269
 
2015
- while (offsetParent && isTableElement(offsetParent) && getComputedStyle(offsetParent).position === 'static') {
2016
- offsetParent = getTrueOffsetParent(offsetParent);
2017
- }
2018
2270
 
2019
- if (offsetParent && (getNodeName(offsetParent) === 'html' || getNodeName(offsetParent) === 'body' && getComputedStyle(offsetParent).position === 'static' && !isContainingBlock(offsetParent))) {
2020
- return window;
2021
- }
2271
+ function validateFragmentProps(fragment) {
2272
+ {
2273
+ var keys = Object.keys(fragment.props);
2022
2274
 
2023
- return offsetParent || getContainingBlock(element) || window;
2024
- }
2275
+ for (var i = 0; i < keys.length; i++) {
2276
+ var key = keys[i];
2025
2277
 
2026
- function getDimensions(element) {
2027
- if (isHTMLElement(element)) {
2028
- return {
2029
- width: element.offsetWidth,
2030
- height: element.offsetHeight
2031
- };
2032
- }
2278
+ if (key !== 'children' && key !== 'key') {
2279
+ setCurrentlyValidatingElement$1(fragment);
2033
2280
 
2034
- const rect = getBoundingClientRect(element);
2035
- return {
2036
- width: rect.width,
2037
- height: rect.height
2038
- };
2039
- }
2281
+ error('Invalid prop `%s` supplied to `React.Fragment`. ' + 'React.Fragment can only have `key` and `children` props.', key);
2040
2282
 
2041
- function convertOffsetParentRelativeRectToViewportRelativeRect(_ref) {
2042
- let {
2043
- rect,
2044
- offsetParent,
2045
- strategy
2046
- } = _ref;
2047
- const isOffsetParentAnElement = isHTMLElement(offsetParent);
2048
- const documentElement = getDocumentElement(offsetParent);
2283
+ setCurrentlyValidatingElement$1(null);
2284
+ break;
2285
+ }
2286
+ }
2049
2287
 
2050
- if (offsetParent === documentElement) {
2051
- return rect;
2052
- }
2288
+ if (fragment.ref !== null) {
2289
+ setCurrentlyValidatingElement$1(fragment);
2053
2290
 
2054
- let scroll = {
2055
- scrollLeft: 0,
2056
- scrollTop: 0
2057
- };
2058
- const offsets = {
2059
- x: 0,
2060
- y: 0
2061
- };
2291
+ error('Invalid attribute `ref` supplied to `React.Fragment`.');
2062
2292
 
2063
- if (isOffsetParentAnElement || !isOffsetParentAnElement && strategy !== 'fixed') {
2064
- if (getNodeName(offsetParent) !== 'body' || isOverflowElement(documentElement)) {
2065
- scroll = getNodeScroll(offsetParent);
2066
- }
2293
+ setCurrentlyValidatingElement$1(null);
2294
+ }
2295
+ }
2296
+ }
2067
2297
 
2068
- if (isHTMLElement(offsetParent)) {
2069
- const offsetRect = getBoundingClientRect(offsetParent, true);
2070
- offsets.x = offsetRect.x + offsetParent.clientLeft;
2071
- offsets.y = offsetRect.y + offsetParent.clientTop;
2072
- } // This doesn't appear to be need to be negated.
2073
- // else if (documentElement) {
2074
- // offsets.x = getWindowScrollBarX(documentElement);
2075
- // }
2298
+ function jsxWithValidation(type, props, key, isStaticChildren, source, self) {
2299
+ {
2300
+ var validType = isValidElementType(type); // We warn in this case but don't throw. We expect the element creation to
2301
+ // succeed and there will likely be errors in render.
2076
2302
 
2077
- }
2303
+ if (!validType) {
2304
+ var info = '';
2078
2305
 
2079
- return { ...rect,
2080
- x: rect.x - scroll.scrollLeft + offsets.x,
2081
- y: rect.y - scroll.scrollTop + offsets.y
2082
- };
2083
- }
2306
+ if (type === undefined || typeof type === 'object' && type !== null && Object.keys(type).length === 0) {
2307
+ info += ' You likely forgot to export your component from the file ' + "it's defined in, or you might have mixed up default and named imports.";
2308
+ }
2084
2309
 
2085
- function getViewportRect(element, strategy) {
2086
- const win = getWindow(element);
2087
- const html = getDocumentElement(element);
2088
- const visualViewport = win.visualViewport;
2089
- let width = html.clientWidth;
2090
- let height = html.clientHeight;
2091
- let x = 0;
2092
- let y = 0;
2310
+ var sourceInfo = getSourceInfoErrorAddendum(source);
2093
2311
 
2094
- if (visualViewport) {
2095
- width = visualViewport.width;
2096
- height = visualViewport.height;
2097
- const layoutViewport = isLayoutViewport();
2312
+ if (sourceInfo) {
2313
+ info += sourceInfo;
2314
+ } else {
2315
+ info += getDeclarationErrorAddendum();
2316
+ }
2098
2317
 
2099
- if (layoutViewport || !layoutViewport && strategy === 'fixed') {
2100
- x = visualViewport.offsetLeft;
2101
- y = visualViewport.offsetTop;
2102
- }
2103
- }
2318
+ var typeString;
2104
2319
 
2105
- return {
2106
- width,
2107
- height,
2108
- x,
2109
- y
2110
- };
2111
- }
2320
+ if (type === null) {
2321
+ typeString = 'null';
2322
+ } else if (Array.isArray(type)) {
2323
+ typeString = 'array';
2324
+ } else if (type !== undefined && type.$$typeof === REACT_ELEMENT_TYPE) {
2325
+ typeString = "<" + (getComponentName(type.type) || 'Unknown') + " />";
2326
+ info = ' Did you accidentally export a JSX literal instead of a component?';
2327
+ } else {
2328
+ typeString = typeof type;
2329
+ }
2112
2330
 
2113
- // of the `<html>` and `<body>` rect bounds if horizontally scrollable
2331
+ error('React.jsx: type is invalid -- expected a string (for ' + 'built-in components) or a class/function (for composite ' + 'components) but got: %s.%s', typeString, info);
2332
+ }
2114
2333
 
2115
- function getDocumentRect(element) {
2116
- var _element$ownerDocumen;
2334
+ var element = jsxDEV(type, props, key, source, self); // The result can be nullish if a mock or a custom function is used.
2335
+ // TODO: Drop this when these are no longer allowed as the type argument.
2117
2336
 
2118
- const html = getDocumentElement(element);
2119
- const scroll = getNodeScroll(element);
2120
- const body = (_element$ownerDocumen = element.ownerDocument) == null ? void 0 : _element$ownerDocumen.body;
2121
- const width = max(html.scrollWidth, html.clientWidth, body ? body.scrollWidth : 0, body ? body.clientWidth : 0);
2122
- const height = max(html.scrollHeight, html.clientHeight, body ? body.scrollHeight : 0, body ? body.clientHeight : 0);
2123
- let x = -scroll.scrollLeft + getWindowScrollBarX(element);
2124
- const y = -scroll.scrollTop;
2337
+ if (element == null) {
2338
+ return element;
2339
+ } // Skip key warning if the type isn't valid since our key validation logic
2340
+ // doesn't expect a non-string/function type and can throw confusing errors.
2341
+ // We don't want exception behavior to differ between dev and prod.
2342
+ // (Rendering will throw with a helpful message and as soon as the type is
2343
+ // fixed, the key warnings will appear.)
2125
2344
 
2126
- if (getComputedStyle(body || html).direction === 'rtl') {
2127
- x += max(html.clientWidth, body ? body.clientWidth : 0) - width;
2128
- }
2129
2345
 
2130
- return {
2131
- width,
2132
- height,
2133
- x,
2134
- y
2135
- };
2136
- }
2346
+ if (validType) {
2347
+ var children = props.children;
2137
2348
 
2138
- function getNearestOverflowAncestor(node) {
2139
- const parentNode = getParentNode(node);
2349
+ if (children !== undefined) {
2350
+ if (isStaticChildren) {
2351
+ if (Array.isArray(children)) {
2352
+ for (var i = 0; i < children.length; i++) {
2353
+ validateChildKeys(children[i], type);
2354
+ }
2140
2355
 
2141
- if (isLastTraversableNode(parentNode)) {
2142
- // @ts-ignore assume body is always available
2143
- return node.ownerDocument.body;
2144
- }
2356
+ if (Object.freeze) {
2357
+ Object.freeze(children);
2358
+ }
2359
+ } else {
2360
+ error('React.jsx: Static children should always be an array. ' + 'You are likely explicitly calling React.jsxs or React.jsxDEV. ' + 'Use the Babel transform instead.');
2361
+ }
2362
+ } else {
2363
+ validateChildKeys(children, type);
2364
+ }
2365
+ }
2366
+ }
2145
2367
 
2146
- if (isHTMLElement(parentNode) && isOverflowElement(parentNode)) {
2147
- return parentNode;
2148
- }
2368
+ if (type === exports.Fragment) {
2369
+ validateFragmentProps(element);
2370
+ } else {
2371
+ validatePropTypes(element);
2372
+ }
2149
2373
 
2150
- return getNearestOverflowAncestor(parentNode);
2151
- }
2374
+ return element;
2375
+ }
2376
+ } // These two functions exist to still get child warnings in dev
2377
+ // even with the prod transform. This means that jsxDEV is purely
2378
+ // opt-in behavior for better messages but that we won't stop
2379
+ // giving you warnings if you use production apis.
2152
2380
 
2153
- function getOverflowAncestors(node, list) {
2154
- var _node$ownerDocument;
2381
+ function jsxWithValidationStatic(type, props, key) {
2382
+ {
2383
+ return jsxWithValidation(type, props, key, true);
2384
+ }
2385
+ }
2386
+ function jsxWithValidationDynamic(type, props, key) {
2387
+ {
2388
+ return jsxWithValidation(type, props, key, false);
2389
+ }
2390
+ }
2155
2391
 
2156
- if (list === void 0) {
2157
- list = [];
2158
- }
2392
+ var jsx = jsxWithValidationDynamic ; // we may want to special case jsxs internally to take advantage of static children.
2393
+ // for now we can ship identical prod functions
2159
2394
 
2160
- const scrollableAncestor = getNearestOverflowAncestor(node);
2161
- const isBody = scrollableAncestor === ((_node$ownerDocument = node.ownerDocument) == null ? void 0 : _node$ownerDocument.body);
2162
- const win = getWindow(scrollableAncestor);
2163
- const target = isBody ? [win].concat(win.visualViewport || [], isOverflowElement(scrollableAncestor) ? scrollableAncestor : []) : scrollableAncestor;
2164
- const updatedList = list.concat(target);
2165
- return isBody ? updatedList : // @ts-ignore: isBody tells us target will be an HTMLElement here
2166
- updatedList.concat(getOverflowAncestors(target));
2167
- }
2395
+ var jsxs = jsxWithValidationStatic ;
2168
2396
 
2169
- function getInnerBoundingClientRect(element, strategy) {
2170
- const clientRect = getBoundingClientRect(element, false, strategy === 'fixed');
2171
- const top = clientRect.top + element.clientTop;
2172
- const left = clientRect.left + element.clientLeft;
2173
- return {
2174
- top,
2175
- left,
2176
- x: left,
2177
- y: top,
2178
- right: left + element.clientWidth,
2179
- bottom: top + element.clientHeight,
2180
- width: element.clientWidth,
2181
- height: element.clientHeight
2182
- };
2183
- }
2397
+ exports.jsx = jsx;
2398
+ exports.jsxs = jsxs;
2399
+ })();
2400
+ }
2401
+ } (reactJsxRuntime_development));
2184
2402
 
2185
- function getClientRectFromClippingAncestor(element, clippingAncestor, strategy) {
2186
- if (clippingAncestor === 'viewport') {
2187
- return rectToClientRect(getViewportRect(element, strategy));
2188
- }
2403
+ (function (module) {
2189
2404
 
2190
- if (isElement(clippingAncestor)) {
2191
- return getInnerBoundingClientRect(clippingAncestor, strategy);
2192
- }
2405
+ {
2406
+ module.exports = reactJsxRuntime_development;
2407
+ }
2408
+ } (jsxRuntime));
2193
2409
 
2194
- return rectToClientRect(getDocumentRect(getDocumentElement(element)));
2195
- } // A "clipping ancestor" is an overflowable container with the characteristic of
2196
- // clipping (or hiding) overflowing elements with a position different from
2197
- // `initial`
2410
+ var classnames = {exports: {}};
2198
2411
 
2412
+ /*!
2413
+ Copyright (c) 2018 Jed Watson.
2414
+ Licensed under the MIT License (MIT), see
2415
+ http://jedwatson.github.io/classnames
2416
+ */
2199
2417
 
2200
- function getClippingElementAncestors(element) {
2201
- let result = getOverflowAncestors(element).filter(el => isElement(el) && getNodeName(el) !== 'body');
2202
- let currentNode = element;
2203
- let currentContainingBlockComputedStyle = null; // https://developer.mozilla.org/en-US/docs/Web/CSS/Containing_block#identifying_the_containing_block
2418
+ (function (module) {
2419
+ /* global define */
2204
2420
 
2205
- while (isElement(currentNode) && !isLastTraversableNode(currentNode)) {
2206
- const computedStyle = getComputedStyle(currentNode);
2421
+ (function () {
2207
2422
 
2208
- if (computedStyle.position === 'static' && currentContainingBlockComputedStyle && ['absolute', 'fixed'].includes(currentContainingBlockComputedStyle.position) && !isContainingBlock(currentNode)) {
2209
- // Drop non-containing blocks
2210
- result = result.filter(ancestor => ancestor !== currentNode);
2211
- } else {
2212
- // Record last containing block for next iteration
2213
- currentContainingBlockComputedStyle = computedStyle;
2214
- }
2423
+ var hasOwn = {}.hasOwnProperty;
2215
2424
 
2216
- currentNode = getParentNode(currentNode);
2217
- }
2425
+ function classNames() {
2426
+ var classes = [];
2218
2427
 
2219
- return result;
2220
- } // Gets the maximum area that the element is visible in due to any number of
2221
- // clipping ancestors
2428
+ for (var i = 0; i < arguments.length; i++) {
2429
+ var arg = arguments[i];
2430
+ if (!arg) continue;
2222
2431
 
2432
+ var argType = typeof arg;
2223
2433
 
2224
- function getClippingRect(_ref) {
2225
- let {
2226
- element,
2227
- boundary,
2228
- rootBoundary,
2229
- strategy
2230
- } = _ref;
2231
- const elementClippingAncestors = boundary === 'clippingAncestors' ? getClippingElementAncestors(element) : [].concat(boundary);
2232
- const clippingAncestors = [...elementClippingAncestors, rootBoundary];
2233
- const firstClippingAncestor = clippingAncestors[0];
2234
- const clippingRect = clippingAncestors.reduce((accRect, clippingAncestor) => {
2235
- const rect = getClientRectFromClippingAncestor(element, clippingAncestor, strategy);
2236
- accRect.top = max(rect.top, accRect.top);
2237
- accRect.right = min(rect.right, accRect.right);
2238
- accRect.bottom = min(rect.bottom, accRect.bottom);
2239
- accRect.left = max(rect.left, accRect.left);
2240
- return accRect;
2241
- }, getClientRectFromClippingAncestor(element, firstClippingAncestor, strategy));
2242
- return {
2243
- width: clippingRect.right - clippingRect.left,
2244
- height: clippingRect.bottom - clippingRect.top,
2245
- x: clippingRect.left,
2246
- y: clippingRect.top
2247
- };
2248
- }
2434
+ if (argType === 'string' || argType === 'number') {
2435
+ classes.push(arg);
2436
+ } else if (Array.isArray(arg)) {
2437
+ if (arg.length) {
2438
+ var inner = classNames.apply(null, arg);
2439
+ if (inner) {
2440
+ classes.push(inner);
2441
+ }
2442
+ }
2443
+ } else if (argType === 'object') {
2444
+ if (arg.toString !== Object.prototype.toString && !arg.toString.toString().includes('[native code]')) {
2445
+ classes.push(arg.toString());
2446
+ continue;
2447
+ }
2249
2448
 
2250
- const platform = {
2251
- getClippingRect,
2252
- convertOffsetParentRelativeRectToViewportRelativeRect,
2253
- isElement,
2254
- getDimensions,
2255
- getOffsetParent,
2256
- getDocumentElement,
2257
- getElementRects: _ref => {
2258
- let {
2259
- reference,
2260
- floating,
2261
- strategy
2262
- } = _ref;
2263
- return {
2264
- reference: getRectRelativeToOffsetParent(reference, getOffsetParent(floating), strategy),
2265
- floating: { ...getDimensions(floating),
2266
- x: 0,
2267
- y: 0
2268
- }
2269
- };
2270
- },
2271
- getClientRects: element => Array.from(element.getClientRects()),
2272
- isRTL: element => getComputedStyle(element).direction === 'rtl'
2273
- };
2449
+ for (var key in arg) {
2450
+ if (hasOwn.call(arg, key) && arg[key]) {
2451
+ classes.push(key);
2452
+ }
2453
+ }
2454
+ }
2455
+ }
2456
+
2457
+ return classes.join(' ');
2458
+ }
2459
+
2460
+ if (module.exports) {
2461
+ classNames.default = classNames;
2462
+ module.exports = classNames;
2463
+ } else {
2464
+ window.classNames = classNames;
2465
+ }
2466
+ }());
2467
+ } (classnames));
2468
+
2469
+ var classNames = classnames.exports;
2274
2470
 
2471
+ /* eslint-disable @typescript-eslint/no-explicit-any */
2275
2472
  /**
2276
- * Computes the `x` and `y` coordinates that will place the floating element
2277
- * next to a reference element when it is given a certain CSS positioning
2278
- * strategy.
2473
+ * This function debounce the received function
2474
+ * @param { function } func Function to be debounced
2475
+ * @param { number } wait Time to wait before execut the function
2476
+ * @param { boolean } immediate Param to define if the function will be executed immediately
2279
2477
  */
2478
+ const debounce = (func, wait, immediate) => {
2479
+ let timeout = null;
2480
+ return function debounced(...args) {
2481
+ const later = () => {
2482
+ timeout = null;
2483
+ if (!immediate) {
2484
+ func.apply(this, args);
2485
+ }
2486
+ };
2487
+ if (timeout) {
2488
+ clearTimeout(timeout);
2489
+ }
2490
+ timeout = setTimeout(later, wait);
2491
+ };
2492
+ };
2280
2493
 
2281
- const computePosition = (reference, floating, options) => computePosition$1(reference, floating, {
2282
- platform,
2283
- ...options
2284
- });
2494
+ const TooltipContent = ({ content }) => {
2495
+ return jsxRuntime.exports.jsx("span", { dangerouslySetInnerHTML: { __html: content } });
2496
+ };
2497
+
2498
+ const DEFAULT_TOOLTIP_ID = 'DEFAULT_TOOLTIP_ID';
2499
+ const DEFAULT_CONTEXT_DATA = {
2500
+ anchorRefs: new Set(),
2501
+ activeAnchor: { current: null },
2502
+ attach: () => {
2503
+ /* attach anchor element */
2504
+ },
2505
+ detach: () => {
2506
+ /* detach anchor element */
2507
+ },
2508
+ setActiveAnchor: () => {
2509
+ /* set active anchor */
2510
+ },
2511
+ };
2512
+ const DEFAULT_CONTEXT_DATA_WRAPPER = {
2513
+ getTooltipData: () => DEFAULT_CONTEXT_DATA,
2514
+ };
2515
+ const TooltipContext = createContext(DEFAULT_CONTEXT_DATA_WRAPPER);
2516
+ const TooltipProvider = ({ children }) => {
2517
+ const [anchorRefMap, setAnchorRefMap] = useState({
2518
+ [DEFAULT_TOOLTIP_ID]: new Set(),
2519
+ });
2520
+ const [activeAnchorMap, setActiveAnchorMap] = useState({
2521
+ [DEFAULT_TOOLTIP_ID]: { current: null },
2522
+ });
2523
+ const attach = (tooltipId, ...refs) => {
2524
+ setAnchorRefMap((oldMap) => {
2525
+ var _a;
2526
+ const tooltipRefs = (_a = oldMap[tooltipId]) !== null && _a !== void 0 ? _a : new Set();
2527
+ refs.forEach((ref) => tooltipRefs.add(ref));
2528
+ // create new object to trigger re-render
2529
+ return { ...oldMap, [tooltipId]: new Set(tooltipRefs) };
2530
+ });
2531
+ };
2532
+ const detach = (tooltipId, ...refs) => {
2533
+ setAnchorRefMap((oldMap) => {
2534
+ const tooltipRefs = oldMap[tooltipId];
2535
+ if (!tooltipRefs) {
2536
+ // tooltip not found
2537
+ // maybe thow error?
2538
+ return oldMap;
2539
+ }
2540
+ refs.forEach((ref) => tooltipRefs.delete(ref));
2541
+ // create new object to trigger re-render
2542
+ return { ...oldMap };
2543
+ });
2544
+ };
2545
+ const setActiveAnchor = (tooltipId, ref) => {
2546
+ setActiveAnchorMap((oldMap) => {
2547
+ var _a;
2548
+ if (((_a = oldMap[tooltipId]) === null || _a === void 0 ? void 0 : _a.current) === ref.current) {
2549
+ return oldMap;
2550
+ }
2551
+ // create new object to trigger re-render
2552
+ return { ...oldMap, [tooltipId]: ref };
2553
+ });
2554
+ };
2555
+ const getTooltipData = useCallback((tooltipId = DEFAULT_TOOLTIP_ID) => {
2556
+ var _a, _b;
2557
+ return ({
2558
+ anchorRefs: (_a = anchorRefMap[tooltipId]) !== null && _a !== void 0 ? _a : new Set(),
2559
+ activeAnchor: (_b = activeAnchorMap[tooltipId]) !== null && _b !== void 0 ? _b : { current: null },
2560
+ attach: (...refs) => attach(tooltipId, ...refs),
2561
+ detach: (...refs) => detach(tooltipId, ...refs),
2562
+ setActiveAnchor: (ref) => setActiveAnchor(tooltipId, ref),
2563
+ });
2564
+ }, [anchorRefMap, activeAnchorMap, attach, detach]);
2565
+ const context = useMemo(() => {
2566
+ return {
2567
+ getTooltipData,
2568
+ };
2569
+ }, [getTooltipData]);
2570
+ return jsxRuntime.exports.jsx(TooltipContext.Provider, { value: context, children: children });
2571
+ };
2572
+ function useTooltip(tooltipId = DEFAULT_TOOLTIP_ID) {
2573
+ return useContext(TooltipContext).getTooltipData(tooltipId);
2574
+ }
2575
+
2576
+ const TooltipWrapper = ({ tooltipId, children, className, place, content, html, variant, offset, wrapper, events, positionStrategy, delayShow, delayHide, }) => {
2577
+ const { attach, detach } = useTooltip(tooltipId);
2578
+ const anchorRef = useRef(null);
2579
+ useEffect(() => {
2580
+ attach(anchorRef);
2581
+ return () => {
2582
+ detach(anchorRef);
2583
+ };
2584
+ }, []);
2585
+ return (jsxRuntime.exports.jsx("span", { ref: anchorRef, className: classNames('react-tooltip-wrapper', className), "data-tooltip-place": place, "data-tooltip-content": content, "data-tooltip-html": html, "data-tooltip-variant": variant, "data-tooltip-offset": offset, "data-tooltip-wrapper": wrapper, "data-tooltip-events": events, "data-tooltip-position-strategy": positionStrategy, "data-tooltip-delay-show": delayShow, "data-tooltip-delay-hide": delayHide, children: children }));
2586
+ };
2285
2587
 
2286
- const computeTooltipPosition = async ({ elementReference = null, tooltipReference = null, tooltipArrowReference = null, place = 'top', offset: offsetValue = 10, strategy = 'absolute', }) => {
2588
+ const computeTooltipPosition = async ({ elementReference = null, tooltipReference = null, tooltipArrowReference = null, place = 'top', offset: offsetValue = 10, strategy = 'absolute', middlewares = [offset(Number(offsetValue)), flip(), shift({ padding: 5 })], }) => {
2287
2589
  if (!elementReference) {
2288
2590
  // elementReference can be null or undefined and we will not compute the position
2289
2591
  // eslint-disable-next-line no-console
@@ -2293,7 +2595,7 @@ const computeTooltipPosition = async ({ elementReference = null, tooltipReferenc
2293
2595
  if (tooltipReference === null) {
2294
2596
  return { tooltipStyles: {}, tooltipArrowStyles: {} };
2295
2597
  }
2296
- const middleware = [offset(Number(offsetValue)), flip(), shift({ padding: 5 })];
2598
+ const middleware = middlewares;
2297
2599
  if (tooltipArrowReference) {
2298
2600
  middleware.push(arrow({ element: tooltipArrowReference, padding: 5 }));
2299
2601
  return computePosition(elementReference, tooltipReference, {
@@ -2334,7 +2636,7 @@ var styles = {"tooltip":"styles-module_tooltip__mnnfp","fixed":"styles-module_fi
2334
2636
 
2335
2637
  const Tooltip = ({
2336
2638
  // props
2337
- id, className, classNameArrow, variant = 'dark', anchorId, place = 'top', offset = 10, events = ['hover'], positionStrategy = 'absolute', wrapper: WrapperElement = 'div', children = null, delayShow = 0, delayHide = 0, float = false, noArrow = false, clickable = false, style: externalStyles, position, afterShow, afterHide,
2639
+ id, className, classNameArrow, variant = 'dark', anchorId, place = 'top', offset = 10, events = ['hover'], positionStrategy = 'absolute', middlewares, wrapper: WrapperElement = 'div', children = null, delayShow = 0, delayHide = 0, float = false, noArrow = false, clickable = false, style: externalStyles, position, afterShow, afterHide,
2338
2640
  // props handled by controller
2339
2641
  content, html, isOpen, setIsOpen, }) => {
2340
2642
  const tooltipRef = useRef(null);
@@ -2445,6 +2747,7 @@ content, html, isOpen, setIsOpen, }) => {
2445
2747
  tooltipReference: tooltipRef.current,
2446
2748
  tooltipArrowReference: tooltipArrowRef.current,
2447
2749
  strategy: positionStrategy,
2750
+ middlewares,
2448
2751
  }).then((computedStylesData) => {
2449
2752
  setCalculatingPosition(false);
2450
2753
  if (Object.keys(computedStylesData.tooltipStyles).length) {
@@ -2575,6 +2878,7 @@ content, html, isOpen, setIsOpen, }) => {
2575
2878
  tooltipReference: tooltipRef.current,
2576
2879
  tooltipArrowReference: tooltipArrowRef.current,
2577
2880
  strategy: positionStrategy,
2881
+ middlewares,
2578
2882
  }).then((computedStylesData) => {
2579
2883
  if (!mounted) {
2580
2884
  // invalidate computed positions after remount
@@ -2623,7 +2927,7 @@ content, html, isOpen, setIsOpen, }) => {
2623
2927
  }), style: inlineArrowStyles, ref: tooltipArrowRef })] }));
2624
2928
  };
2625
2929
 
2626
- const TooltipController = ({ id, anchorId, content, html, className, classNameArrow, variant = 'dark', place = 'top', offset = 10, wrapper = 'div', children = null, events = ['hover'], positionStrategy = 'absolute', delayShow = 0, delayHide = 0, float = false, noArrow = false, clickable = false, style, position, isOpen, setIsOpen, afterShow, afterHide, }) => {
2930
+ const TooltipController = ({ id, anchorId, content, html, className, classNameArrow, variant = 'dark', place = 'top', offset = 10, wrapper = 'div', children = null, events = ['hover'], positionStrategy = 'absolute', middlewares, delayShow = 0, delayHide = 0, float = false, noArrow = false, clickable = false, style, position, isOpen, setIsOpen, afterShow, afterHide, }) => {
2627
2931
  const [tooltipContent, setTooltipContent] = useState(content);
2628
2932
  const [tooltipHtml, setTooltipHtml] = useState(html);
2629
2933
  const [tooltipPlace, setTooltipPlace] = useState(place);
@@ -2755,6 +3059,7 @@ const TooltipController = ({ id, anchorId, content, html, className, classNameAr
2755
3059
  wrapper: tooltipWrapper,
2756
3060
  events: tooltipEvents,
2757
3061
  positionStrategy: tooltipPositionStrategy,
3062
+ middlewares,
2758
3063
  delayShow: tooltipDelayShow,
2759
3064
  delayHide: tooltipDelayHide,
2760
3065
  float: tooltipFloat,
@@ -2770,4 +3075,4 @@ const TooltipController = ({ id, anchorId, content, html, className, classNameAr
2770
3075
  return children ? jsxRuntime.exports.jsx(Tooltip, { ...props, children: children }) : jsxRuntime.exports.jsx(Tooltip, { ...props });
2771
3076
  };
2772
3077
 
2773
- export { TooltipController as Tooltip, TooltipProvider, TooltipWrapper };
3078
+ export { TooltipController as Tooltip, TooltipProvider, TooltipWrapper, autoPlacement, flip, inline, offset, shift, size };