react-tooltip 4.5.1 → 5.0.0-beta.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (110) hide show
  1. package/.editorconfig +25 -0
  2. package/.eslintrc.json +94 -0
  3. package/.gitattributes +3 -0
  4. package/.github/FUNDING.yml +13 -0
  5. package/.github/workflows/lint.yaml +35 -0
  6. package/.github/workflows/pull-request.yaml +11 -0
  7. package/.github/workflows/release.yaml +30 -0
  8. package/.husky/pre-commit +6 -0
  9. package/.prettierrc.json +10 -0
  10. package/.stylelintrc.json +19 -0
  11. package/.vscode/settings.json +27 -0
  12. package/bower.json +26 -0
  13. package/build/dist/react-tooltip.cjs.js +2909 -0
  14. package/build/dist/react-tooltip.cjs.min.js +6 -0
  15. package/build/dist/react-tooltip.css +73 -0
  16. package/build/dist/react-tooltip.esm.js +2901 -0
  17. package/build/dist/react-tooltip.esm.min.js +6 -0
  18. package/build/dist/react-tooltip.min.css +1 -0
  19. package/build/dist/react-tooltip.umd.js +2913 -0
  20. package/build/dist/react-tooltip.umd.min.js +6 -0
  21. package/build/index.css +79 -0
  22. package/build/index.html +19 -0
  23. package/build/index.js +36190 -0
  24. package/cli.js +30 -0
  25. package/contributing.md +40 -0
  26. package/dist/react-tooltip-tokens.css +8 -0
  27. package/dist/react-tooltip.cjs.js +2932 -0
  28. package/dist/react-tooltip.cjs.min.js +6 -0
  29. package/dist/react-tooltip.css +73 -0
  30. package/dist/react-tooltip.d.ts +21 -120
  31. package/dist/react-tooltip.esm.js +2924 -0
  32. package/dist/react-tooltip.esm.min.js +6 -0
  33. package/dist/react-tooltip.min.css +1 -0
  34. package/dist/react-tooltip.umd.js +2936 -0
  35. package/dist/react-tooltip.umd.min.js +6 -0
  36. package/docs/README.md +50 -0
  37. package/docs/babel.config.js +3 -0
  38. package/docs/docs/examples/_category_.json +7 -0
  39. package/docs/docs/examples/basic-examples.mdx +68 -0
  40. package/docs/docs/examples/children.mdx +67 -0
  41. package/docs/docs/examples/content.mdx +80 -0
  42. package/docs/docs/examples/delay.mdx +84 -0
  43. package/docs/docs/examples/events.mdx +85 -0
  44. package/docs/docs/examples/get-content.mdx +58 -0
  45. package/docs/docs/examples/html.mdx +75 -0
  46. package/docs/docs/examples/multiline.mdx +91 -0
  47. package/docs/docs/examples/offset.mdx +69 -0
  48. package/docs/docs/examples/place.mdx +55 -0
  49. package/docs/docs/examples/state.mdx +331 -0
  50. package/docs/docs/examples/styling.mdx +388 -0
  51. package/docs/docs/examples/variant.mdx +100 -0
  52. package/docs/docs/getting-started.mdx +100 -0
  53. package/docs/docs/options.mdx +105 -0
  54. package/docs/docs/upgrade-guide/_category_.json +7 -0
  55. package/docs/docs/upgrade-guide/basic-examples-v4-v5.mdx +119 -0
  56. package/docs/docs/upgrade-guide/changelog-v4-v5.md +86 -0
  57. package/docs/docusaurus.config.js +135 -0
  58. package/docs/package.json +47 -0
  59. package/docs/sidebars.js +33 -0
  60. package/docs/src/components/HomepageFeatures/index.tsx +71 -0
  61. package/docs/src/components/HomepageFeatures/styles.module.css +11 -0
  62. package/docs/src/css/custom.css +74 -0
  63. package/docs/src/pages/index.module.css +35 -0
  64. package/docs/src/pages/index.tsx +45 -0
  65. package/docs/src/pages/markdown-page.md +7 -0
  66. package/docs/static/.nojekyll +0 -0
  67. package/docs/static/img/Octocat.jpg +0 -0
  68. package/docs/static/img/Octocat.png +0 -0
  69. package/docs/static/img/Octocat.svg +9 -0
  70. package/docs/static/img/android-chrome-192x192.png +0 -0
  71. package/docs/static/img/android-chrome-512x512.png +0 -0
  72. package/docs/static/img/apple-touch-icon.png +0 -0
  73. package/docs/static/img/docusaurus.png +0 -0
  74. package/docs/static/img/favicon-16x16.png +0 -0
  75. package/docs/static/img/favicon-32x32.png +0 -0
  76. package/docs/static/img/favicon-old.ico +0 -0
  77. package/docs/static/img/favicon.ico +0 -0
  78. package/docs/static/img/github.svg +1 -0
  79. package/docs/static/img/happy-face-tooltip.png +0 -0
  80. package/docs/static/img/happy-face-tooltip.svg +21 -0
  81. package/docs/static/img/logo-dinossaur.svg +1 -0
  82. package/docs/static/img/logo.png +0 -0
  83. package/docs/static/img/logo.svg +21 -0
  84. package/docs/static/img/only-tooltip-top.png +0 -0
  85. package/docs/static/img/only-tooltip-top.svg +4 -0
  86. package/docs/static/img/only-tooltip.png +0 -0
  87. package/docs/static/img/only-tooltip.svg +4 -0
  88. package/docs/static/img/site.webmanifest +1 -0
  89. package/docs/static/img/undraw_docusaurus_mountain.svg +171 -0
  90. package/docs/static/img/undraw_docusaurus_react.svg +170 -0
  91. package/docs/static/img/undraw_docusaurus_tree.svg +40 -0
  92. package/docs/tsconfig.json +7 -0
  93. package/docs/yarn.lock +7599 -0
  94. package/example-v5/package.json +21 -0
  95. package/example-v5/public/index.html +20 -0
  96. package/example-v5/public/manifest.json +8 -0
  97. package/example-v5/src/App.jsx +908 -0
  98. package/example-v5/src/index.css +238 -0
  99. package/example-v5/src/index.js +15 -0
  100. package/example-v5/src/index.scss +251 -0
  101. package/package.json +94 -146
  102. package/public/index.html +19 -0
  103. package/rollup.config.dev.js +88 -0
  104. package/rollup.config.prod.js +104 -0
  105. package/rollup.config.types.js +17 -0
  106. package/tsconfig.json +109 -0
  107. package/dist/index.es.js +0 -3185
  108. package/dist/index.es.js.map +0 -1
  109. package/dist/index.js +0 -3192
  110. package/dist/index.js.map +0 -1
@@ -0,0 +1,2932 @@
1
+ 'use strict';
2
+
3
+ Object.defineProperty(exports, '__esModule', { value: true });
4
+
5
+ var require$$0 = require('react');
6
+
7
+ function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
8
+
9
+ var require$$0__default = /*#__PURE__*/_interopDefaultLegacy(require$$0);
10
+
11
+ var jsxRuntime = {exports: {}};
12
+
13
+ var reactJsxRuntime_development = {};
14
+
15
+ /**
16
+ * @license React
17
+ * react-jsx-runtime.development.js
18
+ *
19
+ * Copyright (c) Facebook, Inc. and its affiliates.
20
+ *
21
+ * This source code is licensed under the MIT license found in the
22
+ * LICENSE file in the root directory of this source tree.
23
+ */
24
+
25
+ {
26
+ (function() {
27
+
28
+ var React = require$$0__default["default"];
29
+
30
+ // ATTENTION
31
+ // When adding new symbols to this file,
32
+ // Please consider also adding to 'react-devtools-shared/src/backend/ReactSymbols'
33
+ // The Symbol used to tag the ReactElement-like types.
34
+ var REACT_ELEMENT_TYPE = Symbol.for('react.element');
35
+ var REACT_PORTAL_TYPE = Symbol.for('react.portal');
36
+ var REACT_FRAGMENT_TYPE = Symbol.for('react.fragment');
37
+ var REACT_STRICT_MODE_TYPE = Symbol.for('react.strict_mode');
38
+ var REACT_PROFILER_TYPE = Symbol.for('react.profiler');
39
+ var REACT_PROVIDER_TYPE = Symbol.for('react.provider');
40
+ var REACT_CONTEXT_TYPE = Symbol.for('react.context');
41
+ var REACT_FORWARD_REF_TYPE = Symbol.for('react.forward_ref');
42
+ var REACT_SUSPENSE_TYPE = Symbol.for('react.suspense');
43
+ var REACT_SUSPENSE_LIST_TYPE = Symbol.for('react.suspense_list');
44
+ var REACT_MEMO_TYPE = Symbol.for('react.memo');
45
+ var REACT_LAZY_TYPE = Symbol.for('react.lazy');
46
+ var REACT_OFFSCREEN_TYPE = Symbol.for('react.offscreen');
47
+ var MAYBE_ITERATOR_SYMBOL = Symbol.iterator;
48
+ var FAUX_ITERATOR_SYMBOL = '@@iterator';
49
+ function getIteratorFn(maybeIterable) {
50
+ if (maybeIterable === null || typeof maybeIterable !== 'object') {
51
+ return null;
52
+ }
53
+
54
+ var maybeIterator = MAYBE_ITERATOR_SYMBOL && maybeIterable[MAYBE_ITERATOR_SYMBOL] || maybeIterable[FAUX_ITERATOR_SYMBOL];
55
+
56
+ if (typeof maybeIterator === 'function') {
57
+ return maybeIterator;
58
+ }
59
+
60
+ return null;
61
+ }
62
+
63
+ var ReactSharedInternals = React.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;
64
+
65
+ function error(format) {
66
+ {
67
+ {
68
+ for (var _len2 = arguments.length, args = new Array(_len2 > 1 ? _len2 - 1 : 0), _key2 = 1; _key2 < _len2; _key2++) {
69
+ args[_key2 - 1] = arguments[_key2];
70
+ }
71
+
72
+ printWarning('error', format, args);
73
+ }
74
+ }
75
+ }
76
+
77
+ function printWarning(level, format, args) {
78
+ // When changing this logic, you might want to also
79
+ // update consoleWithStackDev.www.js as well.
80
+ {
81
+ var ReactDebugCurrentFrame = ReactSharedInternals.ReactDebugCurrentFrame;
82
+ var stack = ReactDebugCurrentFrame.getStackAddendum();
83
+
84
+ if (stack !== '') {
85
+ format += '%s';
86
+ args = args.concat([stack]);
87
+ } // eslint-disable-next-line react-internal/safe-string-coercion
88
+
89
+
90
+ var argsWithFormat = args.map(function (item) {
91
+ return String(item);
92
+ }); // Careful: RN currently depends on this prefix
93
+
94
+ argsWithFormat.unshift('Warning: ' + format); // We intentionally don't use spread (or .apply) directly because it
95
+ // breaks IE9: https://github.com/facebook/react/issues/13610
96
+ // eslint-disable-next-line react-internal/no-production-logging
97
+
98
+ Function.prototype.apply.call(console[level], console, argsWithFormat);
99
+ }
100
+ }
101
+
102
+ // -----------------------------------------------------------------------------
103
+
104
+ var enableScopeAPI = false; // Experimental Create Event Handle API.
105
+ var enableCacheElement = false;
106
+ var enableTransitionTracing = false; // No known bugs, but needs performance testing
107
+
108
+ var enableLegacyHidden = false; // Enables unstable_avoidThisFallback feature in Fiber
109
+ // stuff. Intended to enable React core members to more easily debug scheduling
110
+ // issues in DEV builds.
111
+
112
+ var enableDebugTracing = false; // Track which Fiber(s) schedule render work.
113
+
114
+ var REACT_MODULE_REFERENCE;
115
+
116
+ {
117
+ REACT_MODULE_REFERENCE = Symbol.for('react.module.reference');
118
+ }
119
+
120
+ function isValidElementType(type) {
121
+ if (typeof type === 'string' || typeof type === 'function') {
122
+ return true;
123
+ } // Note: typeof might be other than 'symbol' or 'number' (e.g. if it's a polyfill).
124
+
125
+
126
+ if (type === REACT_FRAGMENT_TYPE || type === REACT_PROFILER_TYPE || enableDebugTracing || type === REACT_STRICT_MODE_TYPE || type === REACT_SUSPENSE_TYPE || type === REACT_SUSPENSE_LIST_TYPE || enableLegacyHidden || type === REACT_OFFSCREEN_TYPE || enableScopeAPI || enableCacheElement || enableTransitionTracing ) {
127
+ return true;
128
+ }
129
+
130
+ if (typeof type === 'object' && type !== null) {
131
+ 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 || // This needs to include all possible module reference object
132
+ // types supported by any Flight configuration anywhere since
133
+ // we don't know which Flight build this will end up being used
134
+ // with.
135
+ type.$$typeof === REACT_MODULE_REFERENCE || type.getModuleId !== undefined) {
136
+ return true;
137
+ }
138
+ }
139
+
140
+ return false;
141
+ }
142
+
143
+ function getWrappedName(outerType, innerType, wrapperName) {
144
+ var displayName = outerType.displayName;
145
+
146
+ if (displayName) {
147
+ return displayName;
148
+ }
149
+
150
+ var functionName = innerType.displayName || innerType.name || '';
151
+ return functionName !== '' ? wrapperName + "(" + functionName + ")" : wrapperName;
152
+ } // Keep in sync with react-reconciler/getComponentNameFromFiber
153
+
154
+
155
+ function getContextName(type) {
156
+ return type.displayName || 'Context';
157
+ } // Note that the reconciler package should generally prefer to use getComponentNameFromFiber() instead.
158
+
159
+
160
+ function getComponentNameFromType(type) {
161
+ if (type == null) {
162
+ // Host root, text node or just invalid type.
163
+ return null;
164
+ }
165
+
166
+ {
167
+ if (typeof type.tag === 'number') {
168
+ error('Received an unexpected object in getComponentNameFromType(). ' + 'This is likely a bug in React. Please file an issue.');
169
+ }
170
+ }
171
+
172
+ if (typeof type === 'function') {
173
+ return type.displayName || type.name || null;
174
+ }
175
+
176
+ if (typeof type === 'string') {
177
+ return type;
178
+ }
179
+
180
+ switch (type) {
181
+ case REACT_FRAGMENT_TYPE:
182
+ return 'Fragment';
183
+
184
+ case REACT_PORTAL_TYPE:
185
+ return 'Portal';
186
+
187
+ case REACT_PROFILER_TYPE:
188
+ return 'Profiler';
189
+
190
+ case REACT_STRICT_MODE_TYPE:
191
+ return 'StrictMode';
192
+
193
+ case REACT_SUSPENSE_TYPE:
194
+ return 'Suspense';
195
+
196
+ case REACT_SUSPENSE_LIST_TYPE:
197
+ return 'SuspenseList';
198
+
199
+ }
200
+
201
+ if (typeof type === 'object') {
202
+ switch (type.$$typeof) {
203
+ case REACT_CONTEXT_TYPE:
204
+ var context = type;
205
+ return getContextName(context) + '.Consumer';
206
+
207
+ case REACT_PROVIDER_TYPE:
208
+ var provider = type;
209
+ return getContextName(provider._context) + '.Provider';
210
+
211
+ case REACT_FORWARD_REF_TYPE:
212
+ return getWrappedName(type, type.render, 'ForwardRef');
213
+
214
+ case REACT_MEMO_TYPE:
215
+ var outerName = type.displayName || null;
216
+
217
+ if (outerName !== null) {
218
+ return outerName;
219
+ }
220
+
221
+ return getComponentNameFromType(type.type) || 'Memo';
222
+
223
+ case REACT_LAZY_TYPE:
224
+ {
225
+ var lazyComponent = type;
226
+ var payload = lazyComponent._payload;
227
+ var init = lazyComponent._init;
228
+
229
+ try {
230
+ return getComponentNameFromType(init(payload));
231
+ } catch (x) {
232
+ return null;
233
+ }
234
+ }
235
+
236
+ // eslint-disable-next-line no-fallthrough
237
+ }
238
+ }
239
+
240
+ return null;
241
+ }
242
+
243
+ var assign = Object.assign;
244
+
245
+ // Helpers to patch console.logs to avoid logging during side-effect free
246
+ // replaying on render function. This currently only patches the object
247
+ // lazily which won't cover if the log function was extracted eagerly.
248
+ // We could also eagerly patch the method.
249
+ var disabledDepth = 0;
250
+ var prevLog;
251
+ var prevInfo;
252
+ var prevWarn;
253
+ var prevError;
254
+ var prevGroup;
255
+ var prevGroupCollapsed;
256
+ var prevGroupEnd;
257
+
258
+ function disabledLog() {}
259
+
260
+ disabledLog.__reactDisabledLog = true;
261
+ function disableLogs() {
262
+ {
263
+ if (disabledDepth === 0) {
264
+ /* eslint-disable react-internal/no-production-logging */
265
+ prevLog = console.log;
266
+ prevInfo = console.info;
267
+ prevWarn = console.warn;
268
+ prevError = console.error;
269
+ prevGroup = console.group;
270
+ prevGroupCollapsed = console.groupCollapsed;
271
+ prevGroupEnd = console.groupEnd; // https://github.com/facebook/react/issues/19099
272
+
273
+ var props = {
274
+ configurable: true,
275
+ enumerable: true,
276
+ value: disabledLog,
277
+ writable: true
278
+ }; // $FlowFixMe Flow thinks console is immutable.
279
+
280
+ Object.defineProperties(console, {
281
+ info: props,
282
+ log: props,
283
+ warn: props,
284
+ error: props,
285
+ group: props,
286
+ groupCollapsed: props,
287
+ groupEnd: props
288
+ });
289
+ /* eslint-enable react-internal/no-production-logging */
290
+ }
291
+
292
+ disabledDepth++;
293
+ }
294
+ }
295
+ function reenableLogs() {
296
+ {
297
+ disabledDepth--;
298
+
299
+ if (disabledDepth === 0) {
300
+ /* eslint-disable react-internal/no-production-logging */
301
+ var props = {
302
+ configurable: true,
303
+ enumerable: true,
304
+ writable: true
305
+ }; // $FlowFixMe Flow thinks console is immutable.
306
+
307
+ Object.defineProperties(console, {
308
+ log: assign({}, props, {
309
+ value: prevLog
310
+ }),
311
+ info: assign({}, props, {
312
+ value: prevInfo
313
+ }),
314
+ warn: assign({}, props, {
315
+ value: prevWarn
316
+ }),
317
+ error: assign({}, props, {
318
+ value: prevError
319
+ }),
320
+ group: assign({}, props, {
321
+ value: prevGroup
322
+ }),
323
+ groupCollapsed: assign({}, props, {
324
+ value: prevGroupCollapsed
325
+ }),
326
+ groupEnd: assign({}, props, {
327
+ value: prevGroupEnd
328
+ })
329
+ });
330
+ /* eslint-enable react-internal/no-production-logging */
331
+ }
332
+
333
+ if (disabledDepth < 0) {
334
+ error('disabledDepth fell below zero. ' + 'This is a bug in React. Please file an issue.');
335
+ }
336
+ }
337
+ }
338
+
339
+ var ReactCurrentDispatcher = ReactSharedInternals.ReactCurrentDispatcher;
340
+ var prefix;
341
+ function describeBuiltInComponentFrame(name, source, ownerFn) {
342
+ {
343
+ if (prefix === undefined) {
344
+ // Extract the VM specific prefix used by each line.
345
+ try {
346
+ throw Error();
347
+ } catch (x) {
348
+ var match = x.stack.trim().match(/\n( *(at )?)/);
349
+ prefix = match && match[1] || '';
350
+ }
351
+ } // We use the prefix to ensure our stacks line up with native stack frames.
352
+
353
+
354
+ return '\n' + prefix + name;
355
+ }
356
+ }
357
+ var reentry = false;
358
+ var componentFrameCache;
359
+
360
+ {
361
+ var PossiblyWeakMap = typeof WeakMap === 'function' ? WeakMap : Map;
362
+ componentFrameCache = new PossiblyWeakMap();
363
+ }
364
+
365
+ function describeNativeComponentFrame(fn, construct) {
366
+ // If something asked for a stack inside a fake render, it should get ignored.
367
+ if ( !fn || reentry) {
368
+ return '';
369
+ }
370
+
371
+ {
372
+ var frame = componentFrameCache.get(fn);
373
+
374
+ if (frame !== undefined) {
375
+ return frame;
376
+ }
377
+ }
378
+
379
+ var control;
380
+ reentry = true;
381
+ var previousPrepareStackTrace = Error.prepareStackTrace; // $FlowFixMe It does accept undefined.
382
+
383
+ Error.prepareStackTrace = undefined;
384
+ var previousDispatcher;
385
+
386
+ {
387
+ previousDispatcher = ReactCurrentDispatcher.current; // Set the dispatcher in DEV because this might be call in the render function
388
+ // for warnings.
389
+
390
+ ReactCurrentDispatcher.current = null;
391
+ disableLogs();
392
+ }
393
+
394
+ try {
395
+ // This should throw.
396
+ if (construct) {
397
+ // Something should be setting the props in the constructor.
398
+ var Fake = function () {
399
+ throw Error();
400
+ }; // $FlowFixMe
401
+
402
+
403
+ Object.defineProperty(Fake.prototype, 'props', {
404
+ set: function () {
405
+ // We use a throwing setter instead of frozen or non-writable props
406
+ // because that won't throw in a non-strict mode function.
407
+ throw Error();
408
+ }
409
+ });
410
+
411
+ if (typeof Reflect === 'object' && Reflect.construct) {
412
+ // We construct a different control for this case to include any extra
413
+ // frames added by the construct call.
414
+ try {
415
+ Reflect.construct(Fake, []);
416
+ } catch (x) {
417
+ control = x;
418
+ }
419
+
420
+ Reflect.construct(fn, [], Fake);
421
+ } else {
422
+ try {
423
+ Fake.call();
424
+ } catch (x) {
425
+ control = x;
426
+ }
427
+
428
+ fn.call(Fake.prototype);
429
+ }
430
+ } else {
431
+ try {
432
+ throw Error();
433
+ } catch (x) {
434
+ control = x;
435
+ }
436
+
437
+ fn();
438
+ }
439
+ } catch (sample) {
440
+ // This is inlined manually because closure doesn't do it for us.
441
+ if (sample && control && typeof sample.stack === 'string') {
442
+ // This extracts the first frame from the sample that isn't also in the control.
443
+ // Skipping one frame that we assume is the frame that calls the two.
444
+ var sampleLines = sample.stack.split('\n');
445
+ var controlLines = control.stack.split('\n');
446
+ var s = sampleLines.length - 1;
447
+ var c = controlLines.length - 1;
448
+
449
+ while (s >= 1 && c >= 0 && sampleLines[s] !== controlLines[c]) {
450
+ // We expect at least one stack frame to be shared.
451
+ // Typically this will be the root most one. However, stack frames may be
452
+ // cut off due to maximum stack limits. In this case, one maybe cut off
453
+ // earlier than the other. We assume that the sample is longer or the same
454
+ // and there for cut off earlier. So we should find the root most frame in
455
+ // the sample somewhere in the control.
456
+ c--;
457
+ }
458
+
459
+ for (; s >= 1 && c >= 0; s--, c--) {
460
+ // Next we find the first one that isn't the same which should be the
461
+ // frame that called our sample function and the control.
462
+ if (sampleLines[s] !== controlLines[c]) {
463
+ // In V8, the first line is describing the message but other VMs don't.
464
+ // If we're about to return the first line, and the control is also on the same
465
+ // line, that's a pretty good indicator that our sample threw at same line as
466
+ // the control. I.e. before we entered the sample frame. So we ignore this result.
467
+ // This can happen if you passed a class to function component, or non-function.
468
+ if (s !== 1 || c !== 1) {
469
+ do {
470
+ s--;
471
+ c--; // We may still have similar intermediate frames from the construct call.
472
+ // The next one that isn't the same should be our match though.
473
+
474
+ if (c < 0 || sampleLines[s] !== controlLines[c]) {
475
+ // V8 adds a "new" prefix for native classes. Let's remove it to make it prettier.
476
+ var _frame = '\n' + sampleLines[s].replace(' at new ', ' at '); // If our component frame is labeled "<anonymous>"
477
+ // but we have a user-provided "displayName"
478
+ // splice it in to make the stack more readable.
479
+
480
+
481
+ if (fn.displayName && _frame.includes('<anonymous>')) {
482
+ _frame = _frame.replace('<anonymous>', fn.displayName);
483
+ }
484
+
485
+ {
486
+ if (typeof fn === 'function') {
487
+ componentFrameCache.set(fn, _frame);
488
+ }
489
+ } // Return the line we found.
490
+
491
+
492
+ return _frame;
493
+ }
494
+ } while (s >= 1 && c >= 0);
495
+ }
496
+
497
+ break;
498
+ }
499
+ }
500
+ }
501
+ } finally {
502
+ reentry = false;
503
+
504
+ {
505
+ ReactCurrentDispatcher.current = previousDispatcher;
506
+ reenableLogs();
507
+ }
508
+
509
+ Error.prepareStackTrace = previousPrepareStackTrace;
510
+ } // Fallback to just using the name if we couldn't make it throw.
511
+
512
+
513
+ var name = fn ? fn.displayName || fn.name : '';
514
+ var syntheticFrame = name ? describeBuiltInComponentFrame(name) : '';
515
+
516
+ {
517
+ if (typeof fn === 'function') {
518
+ componentFrameCache.set(fn, syntheticFrame);
519
+ }
520
+ }
521
+
522
+ return syntheticFrame;
523
+ }
524
+ function describeFunctionComponentFrame(fn, source, ownerFn) {
525
+ {
526
+ return describeNativeComponentFrame(fn, false);
527
+ }
528
+ }
529
+
530
+ function shouldConstruct(Component) {
531
+ var prototype = Component.prototype;
532
+ return !!(prototype && prototype.isReactComponent);
533
+ }
534
+
535
+ function describeUnknownElementTypeFrameInDEV(type, source, ownerFn) {
536
+
537
+ if (type == null) {
538
+ return '';
539
+ }
540
+
541
+ if (typeof type === 'function') {
542
+ {
543
+ return describeNativeComponentFrame(type, shouldConstruct(type));
544
+ }
545
+ }
546
+
547
+ if (typeof type === 'string') {
548
+ return describeBuiltInComponentFrame(type);
549
+ }
550
+
551
+ switch (type) {
552
+ case REACT_SUSPENSE_TYPE:
553
+ return describeBuiltInComponentFrame('Suspense');
554
+
555
+ case REACT_SUSPENSE_LIST_TYPE:
556
+ return describeBuiltInComponentFrame('SuspenseList');
557
+ }
558
+
559
+ if (typeof type === 'object') {
560
+ switch (type.$$typeof) {
561
+ case REACT_FORWARD_REF_TYPE:
562
+ return describeFunctionComponentFrame(type.render);
563
+
564
+ case REACT_MEMO_TYPE:
565
+ // Memo may contain any component type so we recursively resolve it.
566
+ return describeUnknownElementTypeFrameInDEV(type.type, source, ownerFn);
567
+
568
+ case REACT_LAZY_TYPE:
569
+ {
570
+ var lazyComponent = type;
571
+ var payload = lazyComponent._payload;
572
+ var init = lazyComponent._init;
573
+
574
+ try {
575
+ // Lazy may contain any component type so we recursively resolve it.
576
+ return describeUnknownElementTypeFrameInDEV(init(payload), source, ownerFn);
577
+ } catch (x) {}
578
+ }
579
+ }
580
+ }
581
+
582
+ return '';
583
+ }
584
+
585
+ var hasOwnProperty = Object.prototype.hasOwnProperty;
586
+
587
+ var loggedTypeFailures = {};
588
+ var ReactDebugCurrentFrame = ReactSharedInternals.ReactDebugCurrentFrame;
589
+
590
+ function setCurrentlyValidatingElement(element) {
591
+ {
592
+ if (element) {
593
+ var owner = element._owner;
594
+ var stack = describeUnknownElementTypeFrameInDEV(element.type, element._source, owner ? owner.type : null);
595
+ ReactDebugCurrentFrame.setExtraStackFrame(stack);
596
+ } else {
597
+ ReactDebugCurrentFrame.setExtraStackFrame(null);
598
+ }
599
+ }
600
+ }
601
+
602
+ function checkPropTypes(typeSpecs, values, location, componentName, element) {
603
+ {
604
+ // $FlowFixMe This is okay but Flow doesn't know it.
605
+ var has = Function.call.bind(hasOwnProperty);
606
+
607
+ for (var typeSpecName in typeSpecs) {
608
+ if (has(typeSpecs, typeSpecName)) {
609
+ var error$1 = void 0; // Prop type validation may throw. In case they do, we don't want to
610
+ // fail the render phase where it didn't fail before. So we log it.
611
+ // After these have been cleaned up, we'll let them throw.
612
+
613
+ try {
614
+ // This is intentionally an invariant that gets caught. It's the same
615
+ // behavior as without this statement except with a better message.
616
+ if (typeof typeSpecs[typeSpecName] !== 'function') {
617
+ // eslint-disable-next-line react-internal/prod-error-codes
618
+ 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`.');
619
+ err.name = 'Invariant Violation';
620
+ throw err;
621
+ }
622
+
623
+ error$1 = typeSpecs[typeSpecName](values, typeSpecName, componentName, location, null, 'SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED');
624
+ } catch (ex) {
625
+ error$1 = ex;
626
+ }
627
+
628
+ if (error$1 && !(error$1 instanceof Error)) {
629
+ setCurrentlyValidatingElement(element);
630
+
631
+ 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);
632
+
633
+ setCurrentlyValidatingElement(null);
634
+ }
635
+
636
+ if (error$1 instanceof Error && !(error$1.message in loggedTypeFailures)) {
637
+ // Only monitor this failure once because there tends to be a lot of the
638
+ // same error.
639
+ loggedTypeFailures[error$1.message] = true;
640
+ setCurrentlyValidatingElement(element);
641
+
642
+ error('Failed %s type: %s', location, error$1.message);
643
+
644
+ setCurrentlyValidatingElement(null);
645
+ }
646
+ }
647
+ }
648
+ }
649
+ }
650
+
651
+ var isArrayImpl = Array.isArray; // eslint-disable-next-line no-redeclare
652
+
653
+ function isArray(a) {
654
+ return isArrayImpl(a);
655
+ }
656
+
657
+ /*
658
+ * The `'' + value` pattern (used in in perf-sensitive code) throws for Symbol
659
+ * and Temporal.* types. See https://github.com/facebook/react/pull/22064.
660
+ *
661
+ * The functions in this module will throw an easier-to-understand,
662
+ * easier-to-debug exception with a clear errors message message explaining the
663
+ * problem. (Instead of a confusing exception thrown inside the implementation
664
+ * of the `value` object).
665
+ */
666
+ // $FlowFixMe only called in DEV, so void return is not possible.
667
+ function typeName(value) {
668
+ {
669
+ // toStringTag is needed for namespaced types like Temporal.Instant
670
+ var hasToStringTag = typeof Symbol === 'function' && Symbol.toStringTag;
671
+ var type = hasToStringTag && value[Symbol.toStringTag] || value.constructor.name || 'Object';
672
+ return type;
673
+ }
674
+ } // $FlowFixMe only called in DEV, so void return is not possible.
675
+
676
+
677
+ function willCoercionThrow(value) {
678
+ {
679
+ try {
680
+ testStringCoercion(value);
681
+ return false;
682
+ } catch (e) {
683
+ return true;
684
+ }
685
+ }
686
+ }
687
+
688
+ function testStringCoercion(value) {
689
+ // If you ended up here by following an exception call stack, here's what's
690
+ // happened: you supplied an object or symbol value to React (as a prop, key,
691
+ // DOM attribute, CSS property, string ref, etc.) and when React tried to
692
+ // coerce it to a string using `'' + value`, an exception was thrown.
693
+ //
694
+ // The most common types that will cause this exception are `Symbol` instances
695
+ // and Temporal objects like `Temporal.Instant`. But any object that has a
696
+ // `valueOf` or `[Symbol.toPrimitive]` method that throws will also cause this
697
+ // exception. (Library authors do this to prevent users from using built-in
698
+ // numeric operators like `+` or comparison operators like `>=` because custom
699
+ // methods are needed to perform accurate arithmetic or comparison.)
700
+ //
701
+ // To fix the problem, coerce this object or symbol value to a string before
702
+ // passing it to React. The most reliable way is usually `String(value)`.
703
+ //
704
+ // To find which value is throwing, check the browser or debugger console.
705
+ // Before this exception was thrown, there should be `console.error` output
706
+ // that shows the type (Symbol, Temporal.PlainDate, etc.) that caused the
707
+ // problem and how that type was used: key, atrribute, input value prop, etc.
708
+ // In most cases, this console output also shows the component and its
709
+ // ancestor components where the exception happened.
710
+ //
711
+ // eslint-disable-next-line react-internal/safe-string-coercion
712
+ return '' + value;
713
+ }
714
+ function checkKeyStringCoercion(value) {
715
+ {
716
+ if (willCoercionThrow(value)) {
717
+ error('The provided key is an unsupported type %s.' + ' This value must be coerced to a string before before using it here.', typeName(value));
718
+
719
+ return testStringCoercion(value); // throw (to help callers find troubleshooting comments)
720
+ }
721
+ }
722
+ }
723
+
724
+ var ReactCurrentOwner = ReactSharedInternals.ReactCurrentOwner;
725
+ var RESERVED_PROPS = {
726
+ key: true,
727
+ ref: true,
728
+ __self: true,
729
+ __source: true
730
+ };
731
+ var specialPropKeyWarningShown;
732
+ var specialPropRefWarningShown;
733
+ var didWarnAboutStringRefs;
734
+
735
+ {
736
+ didWarnAboutStringRefs = {};
737
+ }
738
+
739
+ function hasValidRef(config) {
740
+ {
741
+ if (hasOwnProperty.call(config, 'ref')) {
742
+ var getter = Object.getOwnPropertyDescriptor(config, 'ref').get;
743
+
744
+ if (getter && getter.isReactWarning) {
745
+ return false;
746
+ }
747
+ }
748
+ }
749
+
750
+ return config.ref !== undefined;
751
+ }
752
+
753
+ function hasValidKey(config) {
754
+ {
755
+ if (hasOwnProperty.call(config, 'key')) {
756
+ var getter = Object.getOwnPropertyDescriptor(config, 'key').get;
757
+
758
+ if (getter && getter.isReactWarning) {
759
+ return false;
760
+ }
761
+ }
762
+ }
763
+
764
+ return config.key !== undefined;
765
+ }
766
+
767
+ function warnIfStringRefCannotBeAutoConverted(config, self) {
768
+ {
769
+ if (typeof config.ref === 'string' && ReactCurrentOwner.current && self && ReactCurrentOwner.current.stateNode !== self) {
770
+ var componentName = getComponentNameFromType(ReactCurrentOwner.current.type);
771
+
772
+ if (!didWarnAboutStringRefs[componentName]) {
773
+ 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', getComponentNameFromType(ReactCurrentOwner.current.type), config.ref);
774
+
775
+ didWarnAboutStringRefs[componentName] = true;
776
+ }
777
+ }
778
+ }
779
+ }
780
+
781
+ function defineKeyPropWarningGetter(props, displayName) {
782
+ {
783
+ var warnAboutAccessingKey = function () {
784
+ if (!specialPropKeyWarningShown) {
785
+ specialPropKeyWarningShown = true;
786
+
787
+ 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);
788
+ }
789
+ };
790
+
791
+ warnAboutAccessingKey.isReactWarning = true;
792
+ Object.defineProperty(props, 'key', {
793
+ get: warnAboutAccessingKey,
794
+ configurable: true
795
+ });
796
+ }
797
+ }
798
+
799
+ function defineRefPropWarningGetter(props, displayName) {
800
+ {
801
+ var warnAboutAccessingRef = function () {
802
+ if (!specialPropRefWarningShown) {
803
+ specialPropRefWarningShown = true;
804
+
805
+ 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);
806
+ }
807
+ };
808
+
809
+ warnAboutAccessingRef.isReactWarning = true;
810
+ Object.defineProperty(props, 'ref', {
811
+ get: warnAboutAccessingRef,
812
+ configurable: true
813
+ });
814
+ }
815
+ }
816
+ /**
817
+ * Factory method to create a new React element. This no longer adheres to
818
+ * the class pattern, so do not use new to call it. Also, instanceof check
819
+ * will not work. Instead test $$typeof field against Symbol.for('react.element') to check
820
+ * if something is a React Element.
821
+ *
822
+ * @param {*} type
823
+ * @param {*} props
824
+ * @param {*} key
825
+ * @param {string|object} ref
826
+ * @param {*} owner
827
+ * @param {*} self A *temporary* helper to detect places where `this` is
828
+ * different from the `owner` when React.createElement is called, so that we
829
+ * can warn. We want to get rid of owner and replace string `ref`s with arrow
830
+ * functions, and as long as `this` and owner are the same, there will be no
831
+ * change in behavior.
832
+ * @param {*} source An annotation object (added by a transpiler or otherwise)
833
+ * indicating filename, line number, and/or other information.
834
+ * @internal
835
+ */
836
+
837
+
838
+ var ReactElement = function (type, key, ref, self, source, owner, props) {
839
+ var element = {
840
+ // This tag allows us to uniquely identify this as a React Element
841
+ $$typeof: REACT_ELEMENT_TYPE,
842
+ // Built-in properties that belong on the element
843
+ type: type,
844
+ key: key,
845
+ ref: ref,
846
+ props: props,
847
+ // Record the component responsible for creating this element.
848
+ _owner: owner
849
+ };
850
+
851
+ {
852
+ // The validation flag is currently mutative. We put it on
853
+ // an external backing store so that we can freeze the whole object.
854
+ // This can be replaced with a WeakMap once they are implemented in
855
+ // commonly used development environments.
856
+ element._store = {}; // To make comparing ReactElements easier for testing purposes, we make
857
+ // the validation flag non-enumerable (where possible, which should
858
+ // include every environment we run tests in), so the test framework
859
+ // ignores it.
860
+
861
+ Object.defineProperty(element._store, 'validated', {
862
+ configurable: false,
863
+ enumerable: false,
864
+ writable: true,
865
+ value: false
866
+ }); // self and source are DEV only properties.
867
+
868
+ Object.defineProperty(element, '_self', {
869
+ configurable: false,
870
+ enumerable: false,
871
+ writable: false,
872
+ value: self
873
+ }); // Two elements created in two different places should be considered
874
+ // equal for testing purposes and therefore we hide it from enumeration.
875
+
876
+ Object.defineProperty(element, '_source', {
877
+ configurable: false,
878
+ enumerable: false,
879
+ writable: false,
880
+ value: source
881
+ });
882
+
883
+ if (Object.freeze) {
884
+ Object.freeze(element.props);
885
+ Object.freeze(element);
886
+ }
887
+ }
888
+
889
+ return element;
890
+ };
891
+ /**
892
+ * https://github.com/reactjs/rfcs/pull/107
893
+ * @param {*} type
894
+ * @param {object} props
895
+ * @param {string} key
896
+ */
897
+
898
+ function jsxDEV(type, config, maybeKey, source, self) {
899
+ {
900
+ var propName; // Reserved names are extracted
901
+
902
+ var props = {};
903
+ var key = null;
904
+ var ref = null; // Currently, key can be spread in as a prop. This causes a potential
905
+ // issue if key is also explicitly declared (ie. <div {...props} key="Hi" />
906
+ // or <div key="Hi" {...props} /> ). We want to deprecate key spread,
907
+ // but as an intermediary step, we will use jsxDEV for everything except
908
+ // <div {...props} key="Hi" />, because we aren't currently able to tell if
909
+ // key is explicitly declared to be undefined or not.
910
+
911
+ if (maybeKey !== undefined) {
912
+ {
913
+ checkKeyStringCoercion(maybeKey);
914
+ }
915
+
916
+ key = '' + maybeKey;
917
+ }
918
+
919
+ if (hasValidKey(config)) {
920
+ {
921
+ checkKeyStringCoercion(config.key);
922
+ }
923
+
924
+ key = '' + config.key;
925
+ }
926
+
927
+ if (hasValidRef(config)) {
928
+ ref = config.ref;
929
+ warnIfStringRefCannotBeAutoConverted(config, self);
930
+ } // Remaining properties are added to a new props object
931
+
932
+
933
+ for (propName in config) {
934
+ if (hasOwnProperty.call(config, propName) && !RESERVED_PROPS.hasOwnProperty(propName)) {
935
+ props[propName] = config[propName];
936
+ }
937
+ } // Resolve default props
938
+
939
+
940
+ if (type && type.defaultProps) {
941
+ var defaultProps = type.defaultProps;
942
+
943
+ for (propName in defaultProps) {
944
+ if (props[propName] === undefined) {
945
+ props[propName] = defaultProps[propName];
946
+ }
947
+ }
948
+ }
949
+
950
+ if (key || ref) {
951
+ var displayName = typeof type === 'function' ? type.displayName || type.name || 'Unknown' : type;
952
+
953
+ if (key) {
954
+ defineKeyPropWarningGetter(props, displayName);
955
+ }
956
+
957
+ if (ref) {
958
+ defineRefPropWarningGetter(props, displayName);
959
+ }
960
+ }
961
+
962
+ return ReactElement(type, key, ref, self, source, ReactCurrentOwner.current, props);
963
+ }
964
+ }
965
+
966
+ var ReactCurrentOwner$1 = ReactSharedInternals.ReactCurrentOwner;
967
+ var ReactDebugCurrentFrame$1 = ReactSharedInternals.ReactDebugCurrentFrame;
968
+
969
+ function setCurrentlyValidatingElement$1(element) {
970
+ {
971
+ if (element) {
972
+ var owner = element._owner;
973
+ var stack = describeUnknownElementTypeFrameInDEV(element.type, element._source, owner ? owner.type : null);
974
+ ReactDebugCurrentFrame$1.setExtraStackFrame(stack);
975
+ } else {
976
+ ReactDebugCurrentFrame$1.setExtraStackFrame(null);
977
+ }
978
+ }
979
+ }
980
+
981
+ var propTypesMisspellWarningShown;
982
+
983
+ {
984
+ propTypesMisspellWarningShown = false;
985
+ }
986
+ /**
987
+ * Verifies the object is a ReactElement.
988
+ * See https://reactjs.org/docs/react-api.html#isvalidelement
989
+ * @param {?object} object
990
+ * @return {boolean} True if `object` is a ReactElement.
991
+ * @final
992
+ */
993
+
994
+
995
+ function isValidElement(object) {
996
+ {
997
+ return typeof object === 'object' && object !== null && object.$$typeof === REACT_ELEMENT_TYPE;
998
+ }
999
+ }
1000
+
1001
+ function getDeclarationErrorAddendum() {
1002
+ {
1003
+ if (ReactCurrentOwner$1.current) {
1004
+ var name = getComponentNameFromType(ReactCurrentOwner$1.current.type);
1005
+
1006
+ if (name) {
1007
+ return '\n\nCheck the render method of `' + name + '`.';
1008
+ }
1009
+ }
1010
+
1011
+ return '';
1012
+ }
1013
+ }
1014
+
1015
+ function getSourceInfoErrorAddendum(source) {
1016
+ {
1017
+ if (source !== undefined) {
1018
+ var fileName = source.fileName.replace(/^.*[\\\/]/, '');
1019
+ var lineNumber = source.lineNumber;
1020
+ return '\n\nCheck your code at ' + fileName + ':' + lineNumber + '.';
1021
+ }
1022
+
1023
+ return '';
1024
+ }
1025
+ }
1026
+ /**
1027
+ * Warn if there's no key explicitly set on dynamic arrays of children or
1028
+ * object keys are not valid. This allows us to keep track of children between
1029
+ * updates.
1030
+ */
1031
+
1032
+
1033
+ var ownerHasKeyUseWarning = {};
1034
+
1035
+ function getCurrentComponentErrorInfo(parentType) {
1036
+ {
1037
+ var info = getDeclarationErrorAddendum();
1038
+
1039
+ if (!info) {
1040
+ var parentName = typeof parentType === 'string' ? parentType : parentType.displayName || parentType.name;
1041
+
1042
+ if (parentName) {
1043
+ info = "\n\nCheck the top-level render call using <" + parentName + ">.";
1044
+ }
1045
+ }
1046
+
1047
+ return info;
1048
+ }
1049
+ }
1050
+ /**
1051
+ * Warn if the element doesn't have an explicit key assigned to it.
1052
+ * This element is in an array. The array could grow and shrink or be
1053
+ * reordered. All children that haven't already been validated are required to
1054
+ * have a "key" property assigned to it. Error statuses are cached so a warning
1055
+ * will only be shown once.
1056
+ *
1057
+ * @internal
1058
+ * @param {ReactElement} element Element that requires a key.
1059
+ * @param {*} parentType element's parent's type.
1060
+ */
1061
+
1062
+
1063
+ function validateExplicitKey(element, parentType) {
1064
+ {
1065
+ if (!element._store || element._store.validated || element.key != null) {
1066
+ return;
1067
+ }
1068
+
1069
+ element._store.validated = true;
1070
+ var currentComponentErrorInfo = getCurrentComponentErrorInfo(parentType);
1071
+
1072
+ if (ownerHasKeyUseWarning[currentComponentErrorInfo]) {
1073
+ return;
1074
+ }
1075
+
1076
+ ownerHasKeyUseWarning[currentComponentErrorInfo] = true; // Usually the current owner is the offender, but if it accepts children as a
1077
+ // property, it may be the creator of the child that's responsible for
1078
+ // assigning it a key.
1079
+
1080
+ var childOwner = '';
1081
+
1082
+ if (element && element._owner && element._owner !== ReactCurrentOwner$1.current) {
1083
+ // Give the component that originally created this child.
1084
+ childOwner = " It was passed a child from " + getComponentNameFromType(element._owner.type) + ".";
1085
+ }
1086
+
1087
+ setCurrentlyValidatingElement$1(element);
1088
+
1089
+ 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);
1090
+
1091
+ setCurrentlyValidatingElement$1(null);
1092
+ }
1093
+ }
1094
+ /**
1095
+ * Ensure that every element either is passed in a static location, in an
1096
+ * array with an explicit keys property defined, or in an object literal
1097
+ * with valid key property.
1098
+ *
1099
+ * @internal
1100
+ * @param {ReactNode} node Statically passed child of any type.
1101
+ * @param {*} parentType node's parent's type.
1102
+ */
1103
+
1104
+
1105
+ function validateChildKeys(node, parentType) {
1106
+ {
1107
+ if (typeof node !== 'object') {
1108
+ return;
1109
+ }
1110
+
1111
+ if (isArray(node)) {
1112
+ for (var i = 0; i < node.length; i++) {
1113
+ var child = node[i];
1114
+
1115
+ if (isValidElement(child)) {
1116
+ validateExplicitKey(child, parentType);
1117
+ }
1118
+ }
1119
+ } else if (isValidElement(node)) {
1120
+ // This element was passed in a valid location.
1121
+ if (node._store) {
1122
+ node._store.validated = true;
1123
+ }
1124
+ } else if (node) {
1125
+ var iteratorFn = getIteratorFn(node);
1126
+
1127
+ if (typeof iteratorFn === 'function') {
1128
+ // Entry iterators used to provide implicit keys,
1129
+ // but now we print a separate warning for them later.
1130
+ if (iteratorFn !== node.entries) {
1131
+ var iterator = iteratorFn.call(node);
1132
+ var step;
1133
+
1134
+ while (!(step = iterator.next()).done) {
1135
+ if (isValidElement(step.value)) {
1136
+ validateExplicitKey(step.value, parentType);
1137
+ }
1138
+ }
1139
+ }
1140
+ }
1141
+ }
1142
+ }
1143
+ }
1144
+ /**
1145
+ * Given an element, validate that its props follow the propTypes definition,
1146
+ * provided by the type.
1147
+ *
1148
+ * @param {ReactElement} element
1149
+ */
1150
+
1151
+
1152
+ function validatePropTypes(element) {
1153
+ {
1154
+ var type = element.type;
1155
+
1156
+ if (type === null || type === undefined || typeof type === 'string') {
1157
+ return;
1158
+ }
1159
+
1160
+ var propTypes;
1161
+
1162
+ if (typeof type === 'function') {
1163
+ propTypes = type.propTypes;
1164
+ } else if (typeof type === 'object' && (type.$$typeof === REACT_FORWARD_REF_TYPE || // Note: Memo only checks outer props here.
1165
+ // Inner props are checked in the reconciler.
1166
+ type.$$typeof === REACT_MEMO_TYPE)) {
1167
+ propTypes = type.propTypes;
1168
+ } else {
1169
+ return;
1170
+ }
1171
+
1172
+ if (propTypes) {
1173
+ // Intentionally inside to avoid triggering lazy initializers:
1174
+ var name = getComponentNameFromType(type);
1175
+ checkPropTypes(propTypes, element.props, 'prop', name, element);
1176
+ } else if (type.PropTypes !== undefined && !propTypesMisspellWarningShown) {
1177
+ propTypesMisspellWarningShown = true; // Intentionally inside to avoid triggering lazy initializers:
1178
+
1179
+ var _name = getComponentNameFromType(type);
1180
+
1181
+ error('Component %s declared `PropTypes` instead of `propTypes`. Did you misspell the property assignment?', _name || 'Unknown');
1182
+ }
1183
+
1184
+ if (typeof type.getDefaultProps === 'function' && !type.getDefaultProps.isReactClassApproved) {
1185
+ error('getDefaultProps is only used on classic React.createClass ' + 'definitions. Use a static property named `defaultProps` instead.');
1186
+ }
1187
+ }
1188
+ }
1189
+ /**
1190
+ * Given a fragment, validate that it can only be provided with fragment props
1191
+ * @param {ReactElement} fragment
1192
+ */
1193
+
1194
+
1195
+ function validateFragmentProps(fragment) {
1196
+ {
1197
+ var keys = Object.keys(fragment.props);
1198
+
1199
+ for (var i = 0; i < keys.length; i++) {
1200
+ var key = keys[i];
1201
+
1202
+ if (key !== 'children' && key !== 'key') {
1203
+ setCurrentlyValidatingElement$1(fragment);
1204
+
1205
+ error('Invalid prop `%s` supplied to `React.Fragment`. ' + 'React.Fragment can only have `key` and `children` props.', key);
1206
+
1207
+ setCurrentlyValidatingElement$1(null);
1208
+ break;
1209
+ }
1210
+ }
1211
+
1212
+ if (fragment.ref !== null) {
1213
+ setCurrentlyValidatingElement$1(fragment);
1214
+
1215
+ error('Invalid attribute `ref` supplied to `React.Fragment`.');
1216
+
1217
+ setCurrentlyValidatingElement$1(null);
1218
+ }
1219
+ }
1220
+ }
1221
+
1222
+ function jsxWithValidation(type, props, key, isStaticChildren, source, self) {
1223
+ {
1224
+ var validType = isValidElementType(type); // We warn in this case but don't throw. We expect the element creation to
1225
+ // succeed and there will likely be errors in render.
1226
+
1227
+ if (!validType) {
1228
+ var info = '';
1229
+
1230
+ if (type === undefined || typeof type === 'object' && type !== null && Object.keys(type).length === 0) {
1231
+ 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.";
1232
+ }
1233
+
1234
+ var sourceInfo = getSourceInfoErrorAddendum(source);
1235
+
1236
+ if (sourceInfo) {
1237
+ info += sourceInfo;
1238
+ } else {
1239
+ info += getDeclarationErrorAddendum();
1240
+ }
1241
+
1242
+ var typeString;
1243
+
1244
+ if (type === null) {
1245
+ typeString = 'null';
1246
+ } else if (isArray(type)) {
1247
+ typeString = 'array';
1248
+ } else if (type !== undefined && type.$$typeof === REACT_ELEMENT_TYPE) {
1249
+ typeString = "<" + (getComponentNameFromType(type.type) || 'Unknown') + " />";
1250
+ info = ' Did you accidentally export a JSX literal instead of a component?';
1251
+ } else {
1252
+ typeString = typeof type;
1253
+ }
1254
+
1255
+ 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);
1256
+ }
1257
+
1258
+ var element = jsxDEV(type, props, key, source, self); // The result can be nullish if a mock or a custom function is used.
1259
+ // TODO: Drop this when these are no longer allowed as the type argument.
1260
+
1261
+ if (element == null) {
1262
+ return element;
1263
+ } // Skip key warning if the type isn't valid since our key validation logic
1264
+ // doesn't expect a non-string/function type and can throw confusing errors.
1265
+ // We don't want exception behavior to differ between dev and prod.
1266
+ // (Rendering will throw with a helpful message and as soon as the type is
1267
+ // fixed, the key warnings will appear.)
1268
+
1269
+
1270
+ if (validType) {
1271
+ var children = props.children;
1272
+
1273
+ if (children !== undefined) {
1274
+ if (isStaticChildren) {
1275
+ if (isArray(children)) {
1276
+ for (var i = 0; i < children.length; i++) {
1277
+ validateChildKeys(children[i], type);
1278
+ }
1279
+
1280
+ if (Object.freeze) {
1281
+ Object.freeze(children);
1282
+ }
1283
+ } else {
1284
+ 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.');
1285
+ }
1286
+ } else {
1287
+ validateChildKeys(children, type);
1288
+ }
1289
+ }
1290
+ }
1291
+
1292
+ if (type === REACT_FRAGMENT_TYPE) {
1293
+ validateFragmentProps(element);
1294
+ } else {
1295
+ validatePropTypes(element);
1296
+ }
1297
+
1298
+ return element;
1299
+ }
1300
+ } // These two functions exist to still get child warnings in dev
1301
+ // even with the prod transform. This means that jsxDEV is purely
1302
+ // opt-in behavior for better messages but that we won't stop
1303
+ // giving you warnings if you use production apis.
1304
+
1305
+ function jsxWithValidationStatic(type, props, key) {
1306
+ {
1307
+ return jsxWithValidation(type, props, key, true);
1308
+ }
1309
+ }
1310
+ function jsxWithValidationDynamic(type, props, key) {
1311
+ {
1312
+ return jsxWithValidation(type, props, key, false);
1313
+ }
1314
+ }
1315
+
1316
+ var jsx = jsxWithValidationDynamic ; // we may want to special case jsxs internally to take advantage of static children.
1317
+ // for now we can ship identical prod functions
1318
+
1319
+ var jsxs = jsxWithValidationStatic ;
1320
+
1321
+ reactJsxRuntime_development.Fragment = REACT_FRAGMENT_TYPE;
1322
+ reactJsxRuntime_development.jsx = jsx;
1323
+ reactJsxRuntime_development.jsxs = jsxs;
1324
+ })();
1325
+ }
1326
+
1327
+ (function (module) {
1328
+
1329
+ {
1330
+ module.exports = reactJsxRuntime_development;
1331
+ }
1332
+ } (jsxRuntime));
1333
+
1334
+ var classnames = {exports: {}};
1335
+
1336
+ /*!
1337
+ Copyright (c) 2018 Jed Watson.
1338
+ Licensed under the MIT License (MIT), see
1339
+ http://jedwatson.github.io/classnames
1340
+ */
1341
+
1342
+ (function (module) {
1343
+ /* global define */
1344
+
1345
+ (function () {
1346
+
1347
+ var hasOwn = {}.hasOwnProperty;
1348
+
1349
+ function classNames() {
1350
+ var classes = [];
1351
+
1352
+ for (var i = 0; i < arguments.length; i++) {
1353
+ var arg = arguments[i];
1354
+ if (!arg) continue;
1355
+
1356
+ var argType = typeof arg;
1357
+
1358
+ if (argType === 'string' || argType === 'number') {
1359
+ classes.push(arg);
1360
+ } else if (Array.isArray(arg)) {
1361
+ if (arg.length) {
1362
+ var inner = classNames.apply(null, arg);
1363
+ if (inner) {
1364
+ classes.push(inner);
1365
+ }
1366
+ }
1367
+ } else if (argType === 'object') {
1368
+ if (arg.toString !== Object.prototype.toString && !arg.toString.toString().includes('[native code]')) {
1369
+ classes.push(arg.toString());
1370
+ continue;
1371
+ }
1372
+
1373
+ for (var key in arg) {
1374
+ if (hasOwn.call(arg, key) && arg[key]) {
1375
+ classes.push(key);
1376
+ }
1377
+ }
1378
+ }
1379
+ }
1380
+
1381
+ return classes.join(' ');
1382
+ }
1383
+
1384
+ if (module.exports) {
1385
+ classNames.default = classNames;
1386
+ module.exports = classNames;
1387
+ } else {
1388
+ window.classNames = classNames;
1389
+ }
1390
+ }());
1391
+ } (classnames));
1392
+
1393
+ var classNames = classnames.exports;
1394
+
1395
+ /* eslint-disable func-names */
1396
+ /* eslint-disable prefer-rest-params */
1397
+ /* eslint-disable @typescript-eslint/no-this-alias */
1398
+ /**
1399
+ * This function debounce the received function
1400
+ * @param { function } func Function to be debounced
1401
+ * @param { number } wait Time to wait before execut the function
1402
+ * @param { boolean } immediate Param to define if the function will be executed immediately
1403
+ */
1404
+ const debounce = (func, wait, immediate) => {
1405
+ let timeout;
1406
+ return function () {
1407
+ // @ts-ignore
1408
+ const context = this;
1409
+ const args = arguments;
1410
+ const later = () => {
1411
+ timeout = null;
1412
+ if (!immediate) {
1413
+ func.apply(context, args);
1414
+ }
1415
+ };
1416
+ const callNow = immediate && !timeout;
1417
+ // @ts-ignore
1418
+ clearTimeout(timeout);
1419
+ timeout = setTimeout(later, wait);
1420
+ if (callNow) {
1421
+ func.apply(context, args);
1422
+ }
1423
+ };
1424
+ };
1425
+
1426
+ const TooltipContent = ({ content }) => {
1427
+ return jsxRuntime.exports.jsx("span", { dangerouslySetInnerHTML: { __html: content } });
1428
+ };
1429
+
1430
+ function getSide(placement) {
1431
+ return placement.split('-')[0];
1432
+ }
1433
+
1434
+ function getAlignment(placement) {
1435
+ return placement.split('-')[1];
1436
+ }
1437
+
1438
+ function getMainAxisFromPlacement(placement) {
1439
+ return ['top', 'bottom'].includes(getSide(placement)) ? 'x' : 'y';
1440
+ }
1441
+
1442
+ function getLengthFromAxis(axis) {
1443
+ return axis === 'y' ? 'height' : 'width';
1444
+ }
1445
+
1446
+ function computeCoordsFromPlacement(_ref, placement, rtl) {
1447
+ let {
1448
+ reference,
1449
+ floating
1450
+ } = _ref;
1451
+ const commonX = reference.x + reference.width / 2 - floating.width / 2;
1452
+ const commonY = reference.y + reference.height / 2 - floating.height / 2;
1453
+ const mainAxis = getMainAxisFromPlacement(placement);
1454
+ const length = getLengthFromAxis(mainAxis);
1455
+ const commonAlign = reference[length] / 2 - floating[length] / 2;
1456
+ const side = getSide(placement);
1457
+ const isVertical = mainAxis === 'x';
1458
+ let coords;
1459
+
1460
+ switch (side) {
1461
+ case 'top':
1462
+ coords = {
1463
+ x: commonX,
1464
+ y: reference.y - floating.height
1465
+ };
1466
+ break;
1467
+
1468
+ case 'bottom':
1469
+ coords = {
1470
+ x: commonX,
1471
+ y: reference.y + reference.height
1472
+ };
1473
+ break;
1474
+
1475
+ case 'right':
1476
+ coords = {
1477
+ x: reference.x + reference.width,
1478
+ y: commonY
1479
+ };
1480
+ break;
1481
+
1482
+ case 'left':
1483
+ coords = {
1484
+ x: reference.x - floating.width,
1485
+ y: commonY
1486
+ };
1487
+ break;
1488
+
1489
+ default:
1490
+ coords = {
1491
+ x: reference.x,
1492
+ y: reference.y
1493
+ };
1494
+ }
1495
+
1496
+ switch (getAlignment(placement)) {
1497
+ case 'start':
1498
+ coords[mainAxis] -= commonAlign * (rtl && isVertical ? -1 : 1);
1499
+ break;
1500
+
1501
+ case 'end':
1502
+ coords[mainAxis] += commonAlign * (rtl && isVertical ? -1 : 1);
1503
+ break;
1504
+ }
1505
+
1506
+ return coords;
1507
+ }
1508
+
1509
+ /**
1510
+ * Computes the `x` and `y` coordinates that will place the floating element
1511
+ * next to a reference element when it is given a certain positioning strategy.
1512
+ *
1513
+ * This export does not have any `platform` interface logic. You will need to
1514
+ * write one for the platform you are using Floating UI with.
1515
+ */
1516
+
1517
+ const computePosition$1 = async (reference, floating, config) => {
1518
+ const {
1519
+ placement = 'bottom',
1520
+ strategy = 'absolute',
1521
+ middleware = [],
1522
+ platform
1523
+ } = config;
1524
+ const validMiddleware = middleware.filter(Boolean);
1525
+ const rtl = await (platform.isRTL == null ? void 0 : platform.isRTL(floating));
1526
+
1527
+ {
1528
+ if (platform == null) {
1529
+ 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(' '));
1530
+ }
1531
+
1532
+ if (validMiddleware.filter(_ref => {
1533
+ let {
1534
+ name
1535
+ } = _ref;
1536
+ return name === 'autoPlacement' || name === 'flip';
1537
+ }).length > 1) {
1538
+ 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(' '));
1539
+ }
1540
+
1541
+ if (!reference || !floating) {
1542
+ 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(' '));
1543
+ }
1544
+ }
1545
+
1546
+ let rects = await platform.getElementRects({
1547
+ reference,
1548
+ floating,
1549
+ strategy
1550
+ });
1551
+ let {
1552
+ x,
1553
+ y
1554
+ } = computeCoordsFromPlacement(rects, placement, rtl);
1555
+ let statefulPlacement = placement;
1556
+ let middlewareData = {};
1557
+ let resetCount = 0;
1558
+
1559
+ for (let i = 0; i < validMiddleware.length; i++) {
1560
+ const {
1561
+ name,
1562
+ fn
1563
+ } = validMiddleware[i];
1564
+ const {
1565
+ x: nextX,
1566
+ y: nextY,
1567
+ data,
1568
+ reset
1569
+ } = await fn({
1570
+ x,
1571
+ y,
1572
+ initialPlacement: placement,
1573
+ placement: statefulPlacement,
1574
+ strategy,
1575
+ middlewareData,
1576
+ rects,
1577
+ platform,
1578
+ elements: {
1579
+ reference,
1580
+ floating
1581
+ }
1582
+ });
1583
+ x = nextX != null ? nextX : x;
1584
+ y = nextY != null ? nextY : y;
1585
+ middlewareData = { ...middlewareData,
1586
+ [name]: { ...middlewareData[name],
1587
+ ...data
1588
+ }
1589
+ };
1590
+
1591
+ {
1592
+ if (resetCount > 50) {
1593
+ 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(' '));
1594
+ }
1595
+ }
1596
+
1597
+ if (reset && resetCount <= 50) {
1598
+ resetCount++;
1599
+
1600
+ if (typeof reset === 'object') {
1601
+ if (reset.placement) {
1602
+ statefulPlacement = reset.placement;
1603
+ }
1604
+
1605
+ if (reset.rects) {
1606
+ rects = reset.rects === true ? await platform.getElementRects({
1607
+ reference,
1608
+ floating,
1609
+ strategy
1610
+ }) : reset.rects;
1611
+ }
1612
+
1613
+ ({
1614
+ x,
1615
+ y
1616
+ } = computeCoordsFromPlacement(rects, statefulPlacement, rtl));
1617
+ }
1618
+
1619
+ i = -1;
1620
+ continue;
1621
+ }
1622
+ }
1623
+
1624
+ return {
1625
+ x,
1626
+ y,
1627
+ placement: statefulPlacement,
1628
+ strategy,
1629
+ middlewareData
1630
+ };
1631
+ };
1632
+
1633
+ function expandPaddingObject(padding) {
1634
+ return {
1635
+ top: 0,
1636
+ right: 0,
1637
+ bottom: 0,
1638
+ left: 0,
1639
+ ...padding
1640
+ };
1641
+ }
1642
+
1643
+ function getSideObjectFromPadding(padding) {
1644
+ return typeof padding !== 'number' ? expandPaddingObject(padding) : {
1645
+ top: padding,
1646
+ right: padding,
1647
+ bottom: padding,
1648
+ left: padding
1649
+ };
1650
+ }
1651
+
1652
+ function rectToClientRect(rect) {
1653
+ return { ...rect,
1654
+ top: rect.y,
1655
+ left: rect.x,
1656
+ right: rect.x + rect.width,
1657
+ bottom: rect.y + rect.height
1658
+ };
1659
+ }
1660
+
1661
+ /**
1662
+ * Resolves with an object of overflow side offsets that determine how much the
1663
+ * element is overflowing a given clipping boundary.
1664
+ * - positive = overflowing the boundary by that number of pixels
1665
+ * - negative = how many pixels left before it will overflow
1666
+ * - 0 = lies flush with the boundary
1667
+ * @see https://floating-ui.com/docs/detectOverflow
1668
+ */
1669
+ async function detectOverflow(middlewareArguments, options) {
1670
+ var _await$platform$isEle;
1671
+
1672
+ if (options === void 0) {
1673
+ options = {};
1674
+ }
1675
+
1676
+ const {
1677
+ x,
1678
+ y,
1679
+ platform,
1680
+ rects,
1681
+ elements,
1682
+ strategy
1683
+ } = middlewareArguments;
1684
+ const {
1685
+ boundary = 'clippingAncestors',
1686
+ rootBoundary = 'viewport',
1687
+ elementContext = 'floating',
1688
+ altBoundary = false,
1689
+ padding = 0
1690
+ } = options;
1691
+ const paddingObject = getSideObjectFromPadding(padding);
1692
+ const altContext = elementContext === 'floating' ? 'reference' : 'floating';
1693
+ const element = elements[altBoundary ? altContext : elementContext];
1694
+ const clippingClientRect = rectToClientRect(await platform.getClippingRect({
1695
+ 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))),
1696
+ boundary,
1697
+ rootBoundary,
1698
+ strategy
1699
+ }));
1700
+ const elementClientRect = rectToClientRect(platform.convertOffsetParentRelativeRectToViewportRelativeRect ? await platform.convertOffsetParentRelativeRectToViewportRelativeRect({
1701
+ rect: elementContext === 'floating' ? { ...rects.floating,
1702
+ x,
1703
+ y
1704
+ } : rects.reference,
1705
+ offsetParent: await (platform.getOffsetParent == null ? void 0 : platform.getOffsetParent(elements.floating)),
1706
+ strategy
1707
+ }) : rects[elementContext]);
1708
+ return {
1709
+ top: clippingClientRect.top - elementClientRect.top + paddingObject.top,
1710
+ bottom: elementClientRect.bottom - clippingClientRect.bottom + paddingObject.bottom,
1711
+ left: clippingClientRect.left - elementClientRect.left + paddingObject.left,
1712
+ right: elementClientRect.right - clippingClientRect.right + paddingObject.right
1713
+ };
1714
+ }
1715
+
1716
+ const min$1 = Math.min;
1717
+ const max$1 = Math.max;
1718
+
1719
+ function within(min$1$1, value, max$1$1) {
1720
+ return max$1(min$1$1, min$1(value, max$1$1));
1721
+ }
1722
+
1723
+ /**
1724
+ * Positions an inner element of the floating element such that it is centered
1725
+ * to the reference element.
1726
+ * @see https://floating-ui.com/docs/arrow
1727
+ */
1728
+ const arrow = options => ({
1729
+ name: 'arrow',
1730
+ options,
1731
+
1732
+ async fn(middlewareArguments) {
1733
+ // Since `element` is required, we don't Partial<> the type
1734
+ const {
1735
+ element,
1736
+ padding = 0
1737
+ } = options != null ? options : {};
1738
+ const {
1739
+ x,
1740
+ y,
1741
+ placement,
1742
+ rects,
1743
+ platform
1744
+ } = middlewareArguments;
1745
+
1746
+ if (element == null) {
1747
+ {
1748
+ console.warn('Floating UI: No `element` was passed to the `arrow` middleware.');
1749
+ }
1750
+
1751
+ return {};
1752
+ }
1753
+
1754
+ const paddingObject = getSideObjectFromPadding(padding);
1755
+ const coords = {
1756
+ x,
1757
+ y
1758
+ };
1759
+ const axis = getMainAxisFromPlacement(placement);
1760
+ const alignment = getAlignment(placement);
1761
+ const length = getLengthFromAxis(axis);
1762
+ const arrowDimensions = await platform.getDimensions(element);
1763
+ const minProp = axis === 'y' ? 'top' : 'left';
1764
+ const maxProp = axis === 'y' ? 'bottom' : 'right';
1765
+ const endDiff = rects.reference[length] + rects.reference[axis] - coords[axis] - rects.floating[length];
1766
+ const startDiff = coords[axis] - rects.reference[axis];
1767
+ const arrowOffsetParent = await (platform.getOffsetParent == null ? void 0 : platform.getOffsetParent(element));
1768
+ let clientSize = arrowOffsetParent ? axis === 'y' ? arrowOffsetParent.clientHeight || 0 : arrowOffsetParent.clientWidth || 0 : 0;
1769
+
1770
+ if (clientSize === 0) {
1771
+ clientSize = rects.floating[length];
1772
+ }
1773
+
1774
+ const centerToReference = endDiff / 2 - startDiff / 2; // Make sure the arrow doesn't overflow the floating element if the center
1775
+ // point is outside the floating element's bounds
1776
+
1777
+ const min = paddingObject[minProp];
1778
+ const max = clientSize - arrowDimensions[length] - paddingObject[maxProp];
1779
+ const center = clientSize / 2 - arrowDimensions[length] / 2 + centerToReference;
1780
+ const offset = within(min, center, max); // Make sure that arrow points at the reference
1781
+
1782
+ const alignmentPadding = alignment === 'start' ? paddingObject[minProp] : paddingObject[maxProp];
1783
+ const shouldAddOffset = alignmentPadding > 0 && center !== offset && rects.reference[length] <= rects.floating[length];
1784
+ const alignmentOffset = shouldAddOffset ? center < min ? min - center : max - center : 0;
1785
+ return {
1786
+ [axis]: coords[axis] - alignmentOffset,
1787
+ data: {
1788
+ [axis]: offset,
1789
+ centerOffset: center - offset
1790
+ }
1791
+ };
1792
+ }
1793
+
1794
+ });
1795
+
1796
+ const hash$1 = {
1797
+ left: 'right',
1798
+ right: 'left',
1799
+ bottom: 'top',
1800
+ top: 'bottom'
1801
+ };
1802
+ function getOppositePlacement(placement) {
1803
+ return placement.replace(/left|right|bottom|top/g, matched => hash$1[matched]);
1804
+ }
1805
+
1806
+ function getAlignmentSides(placement, rects, rtl) {
1807
+ if (rtl === void 0) {
1808
+ rtl = false;
1809
+ }
1810
+
1811
+ const alignment = getAlignment(placement);
1812
+ const mainAxis = getMainAxisFromPlacement(placement);
1813
+ const length = getLengthFromAxis(mainAxis);
1814
+ let mainAlignmentSide = mainAxis === 'x' ? alignment === (rtl ? 'end' : 'start') ? 'right' : 'left' : alignment === 'start' ? 'bottom' : 'top';
1815
+
1816
+ if (rects.reference[length] > rects.floating[length]) {
1817
+ mainAlignmentSide = getOppositePlacement(mainAlignmentSide);
1818
+ }
1819
+
1820
+ return {
1821
+ main: mainAlignmentSide,
1822
+ cross: getOppositePlacement(mainAlignmentSide)
1823
+ };
1824
+ }
1825
+
1826
+ const hash = {
1827
+ start: 'end',
1828
+ end: 'start'
1829
+ };
1830
+ function getOppositeAlignmentPlacement(placement) {
1831
+ return placement.replace(/start|end/g, matched => hash[matched]);
1832
+ }
1833
+
1834
+ function getExpandedPlacements(placement) {
1835
+ const oppositePlacement = getOppositePlacement(placement);
1836
+ return [getOppositeAlignmentPlacement(placement), oppositePlacement, getOppositeAlignmentPlacement(oppositePlacement)];
1837
+ }
1838
+
1839
+ /**
1840
+ * Changes the placement of the floating element to one that will fit if the
1841
+ * initially specified `placement` does not.
1842
+ * @see https://floating-ui.com/docs/flip
1843
+ */
1844
+ const flip = function (options) {
1845
+ if (options === void 0) {
1846
+ options = {};
1847
+ }
1848
+
1849
+ return {
1850
+ name: 'flip',
1851
+ options,
1852
+
1853
+ async fn(middlewareArguments) {
1854
+ var _middlewareData$flip;
1855
+
1856
+ const {
1857
+ placement,
1858
+ middlewareData,
1859
+ rects,
1860
+ initialPlacement,
1861
+ platform,
1862
+ elements
1863
+ } = middlewareArguments;
1864
+ const {
1865
+ mainAxis: checkMainAxis = true,
1866
+ crossAxis: checkCrossAxis = true,
1867
+ fallbackPlacements: specifiedFallbackPlacements,
1868
+ fallbackStrategy = 'bestFit',
1869
+ flipAlignment = true,
1870
+ ...detectOverflowOptions
1871
+ } = options;
1872
+ const side = getSide(placement);
1873
+ const isBasePlacement = side === initialPlacement;
1874
+ const fallbackPlacements = specifiedFallbackPlacements || (isBasePlacement || !flipAlignment ? [getOppositePlacement(initialPlacement)] : getExpandedPlacements(initialPlacement));
1875
+ const placements = [initialPlacement, ...fallbackPlacements];
1876
+ const overflow = await detectOverflow(middlewareArguments, detectOverflowOptions);
1877
+ const overflows = [];
1878
+ let overflowsData = ((_middlewareData$flip = middlewareData.flip) == null ? void 0 : _middlewareData$flip.overflows) || [];
1879
+
1880
+ if (checkMainAxis) {
1881
+ overflows.push(overflow[side]);
1882
+ }
1883
+
1884
+ if (checkCrossAxis) {
1885
+ const {
1886
+ main,
1887
+ cross
1888
+ } = getAlignmentSides(placement, rects, await (platform.isRTL == null ? void 0 : platform.isRTL(elements.floating)));
1889
+ overflows.push(overflow[main], overflow[cross]);
1890
+ }
1891
+
1892
+ overflowsData = [...overflowsData, {
1893
+ placement,
1894
+ overflows
1895
+ }]; // One or more sides is overflowing
1896
+
1897
+ if (!overflows.every(side => side <= 0)) {
1898
+ var _middlewareData$flip$, _middlewareData$flip2;
1899
+
1900
+ const nextIndex = ((_middlewareData$flip$ = (_middlewareData$flip2 = middlewareData.flip) == null ? void 0 : _middlewareData$flip2.index) != null ? _middlewareData$flip$ : 0) + 1;
1901
+ const nextPlacement = placements[nextIndex];
1902
+
1903
+ if (nextPlacement) {
1904
+ // Try next placement and re-run the lifecycle
1905
+ return {
1906
+ data: {
1907
+ index: nextIndex,
1908
+ overflows: overflowsData
1909
+ },
1910
+ reset: {
1911
+ placement: nextPlacement
1912
+ }
1913
+ };
1914
+ }
1915
+
1916
+ let resetPlacement = 'bottom';
1917
+
1918
+ switch (fallbackStrategy) {
1919
+ case 'bestFit':
1920
+ {
1921
+ var _overflowsData$map$so;
1922
+
1923
+ 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;
1924
+
1925
+ if (placement) {
1926
+ resetPlacement = placement;
1927
+ }
1928
+
1929
+ break;
1930
+ }
1931
+
1932
+ case 'initialPlacement':
1933
+ resetPlacement = initialPlacement;
1934
+ break;
1935
+ }
1936
+
1937
+ if (placement !== resetPlacement) {
1938
+ return {
1939
+ reset: {
1940
+ placement: resetPlacement
1941
+ }
1942
+ };
1943
+ }
1944
+ }
1945
+
1946
+ return {};
1947
+ }
1948
+
1949
+ };
1950
+ };
1951
+
1952
+ async function convertValueToCoords(middlewareArguments, value) {
1953
+ const {
1954
+ placement,
1955
+ platform,
1956
+ elements
1957
+ } = middlewareArguments;
1958
+ const rtl = await (platform.isRTL == null ? void 0 : platform.isRTL(elements.floating));
1959
+ const side = getSide(placement);
1960
+ const alignment = getAlignment(placement);
1961
+ const isVertical = getMainAxisFromPlacement(placement) === 'x';
1962
+ const mainAxisMulti = ['left', 'top'].includes(side) ? -1 : 1;
1963
+ const crossAxisMulti = rtl && isVertical ? -1 : 1;
1964
+ const rawValue = typeof value === 'function' ? value(middlewareArguments) : value; // eslint-disable-next-line prefer-const
1965
+
1966
+ let {
1967
+ mainAxis,
1968
+ crossAxis,
1969
+ alignmentAxis
1970
+ } = typeof rawValue === 'number' ? {
1971
+ mainAxis: rawValue,
1972
+ crossAxis: 0,
1973
+ alignmentAxis: null
1974
+ } : {
1975
+ mainAxis: 0,
1976
+ crossAxis: 0,
1977
+ alignmentAxis: null,
1978
+ ...rawValue
1979
+ };
1980
+
1981
+ if (alignment && typeof alignmentAxis === 'number') {
1982
+ crossAxis = alignment === 'end' ? alignmentAxis * -1 : alignmentAxis;
1983
+ }
1984
+
1985
+ return isVertical ? {
1986
+ x: crossAxis * crossAxisMulti,
1987
+ y: mainAxis * mainAxisMulti
1988
+ } : {
1989
+ x: mainAxis * mainAxisMulti,
1990
+ y: crossAxis * crossAxisMulti
1991
+ };
1992
+ }
1993
+ /**
1994
+ * Displaces the floating element from its reference element.
1995
+ * @see https://floating-ui.com/docs/offset
1996
+ */
1997
+
1998
+ const offset = function (value) {
1999
+ if (value === void 0) {
2000
+ value = 0;
2001
+ }
2002
+
2003
+ return {
2004
+ name: 'offset',
2005
+ options: value,
2006
+
2007
+ async fn(middlewareArguments) {
2008
+ const {
2009
+ x,
2010
+ y
2011
+ } = middlewareArguments;
2012
+ const diffCoords = await convertValueToCoords(middlewareArguments, value);
2013
+ return {
2014
+ x: x + diffCoords.x,
2015
+ y: y + diffCoords.y,
2016
+ data: diffCoords
2017
+ };
2018
+ }
2019
+
2020
+ };
2021
+ };
2022
+
2023
+ function getCrossAxis(axis) {
2024
+ return axis === 'x' ? 'y' : 'x';
2025
+ }
2026
+
2027
+ /**
2028
+ * Shifts the floating element in order to keep it in view when it will overflow
2029
+ * a clipping boundary.
2030
+ * @see https://floating-ui.com/docs/shift
2031
+ */
2032
+ const shift = function (options) {
2033
+ if (options === void 0) {
2034
+ options = {};
2035
+ }
2036
+
2037
+ return {
2038
+ name: 'shift',
2039
+ options,
2040
+
2041
+ async fn(middlewareArguments) {
2042
+ const {
2043
+ x,
2044
+ y,
2045
+ placement
2046
+ } = middlewareArguments;
2047
+ const {
2048
+ mainAxis: checkMainAxis = true,
2049
+ crossAxis: checkCrossAxis = false,
2050
+ limiter = {
2051
+ fn: _ref => {
2052
+ let {
2053
+ x,
2054
+ y
2055
+ } = _ref;
2056
+ return {
2057
+ x,
2058
+ y
2059
+ };
2060
+ }
2061
+ },
2062
+ ...detectOverflowOptions
2063
+ } = options;
2064
+ const coords = {
2065
+ x,
2066
+ y
2067
+ };
2068
+ const overflow = await detectOverflow(middlewareArguments, detectOverflowOptions);
2069
+ const mainAxis = getMainAxisFromPlacement(getSide(placement));
2070
+ const crossAxis = getCrossAxis(mainAxis);
2071
+ let mainAxisCoord = coords[mainAxis];
2072
+ let crossAxisCoord = coords[crossAxis];
2073
+
2074
+ if (checkMainAxis) {
2075
+ const minSide = mainAxis === 'y' ? 'top' : 'left';
2076
+ const maxSide = mainAxis === 'y' ? 'bottom' : 'right';
2077
+ const min = mainAxisCoord + overflow[minSide];
2078
+ const max = mainAxisCoord - overflow[maxSide];
2079
+ mainAxisCoord = within(min, mainAxisCoord, max);
2080
+ }
2081
+
2082
+ if (checkCrossAxis) {
2083
+ const minSide = crossAxis === 'y' ? 'top' : 'left';
2084
+ const maxSide = crossAxis === 'y' ? 'bottom' : 'right';
2085
+ const min = crossAxisCoord + overflow[minSide];
2086
+ const max = crossAxisCoord - overflow[maxSide];
2087
+ crossAxisCoord = within(min, crossAxisCoord, max);
2088
+ }
2089
+
2090
+ const limitedCoords = limiter.fn({ ...middlewareArguments,
2091
+ [mainAxis]: mainAxisCoord,
2092
+ [crossAxis]: crossAxisCoord
2093
+ });
2094
+ return { ...limitedCoords,
2095
+ data: {
2096
+ x: limitedCoords.x - x,
2097
+ y: limitedCoords.y - y
2098
+ }
2099
+ };
2100
+ }
2101
+
2102
+ };
2103
+ };
2104
+
2105
+ function isWindow(value) {
2106
+ return value && value.document && value.location && value.alert && value.setInterval;
2107
+ }
2108
+ function getWindow(node) {
2109
+ if (node == null) {
2110
+ return window;
2111
+ }
2112
+
2113
+ if (!isWindow(node)) {
2114
+ const ownerDocument = node.ownerDocument;
2115
+ return ownerDocument ? ownerDocument.defaultView || window : window;
2116
+ }
2117
+
2118
+ return node;
2119
+ }
2120
+
2121
+ function getComputedStyle(element) {
2122
+ return getWindow(element).getComputedStyle(element);
2123
+ }
2124
+
2125
+ function getNodeName(node) {
2126
+ return isWindow(node) ? '' : node ? (node.nodeName || '').toLowerCase() : '';
2127
+ }
2128
+
2129
+ function getUAString() {
2130
+ const uaData = navigator.userAgentData;
2131
+
2132
+ if (uaData != null && uaData.brands) {
2133
+ return uaData.brands.map(item => item.brand + "/" + item.version).join(' ');
2134
+ }
2135
+
2136
+ return navigator.userAgent;
2137
+ }
2138
+
2139
+ function isHTMLElement(value) {
2140
+ return value instanceof getWindow(value).HTMLElement;
2141
+ }
2142
+ function isElement(value) {
2143
+ return value instanceof getWindow(value).Element;
2144
+ }
2145
+ function isNode(value) {
2146
+ return value instanceof getWindow(value).Node;
2147
+ }
2148
+ function isShadowRoot(node) {
2149
+ // Browsers without `ShadowRoot` support
2150
+ if (typeof ShadowRoot === 'undefined') {
2151
+ return false;
2152
+ }
2153
+
2154
+ const OwnElement = getWindow(node).ShadowRoot;
2155
+ return node instanceof OwnElement || node instanceof ShadowRoot;
2156
+ }
2157
+ function isOverflowElement(element) {
2158
+ // Firefox wants us to check `-x` and `-y` variations as well
2159
+ const {
2160
+ overflow,
2161
+ overflowX,
2162
+ overflowY,
2163
+ display
2164
+ } = getComputedStyle(element);
2165
+ return /auto|scroll|overlay|hidden/.test(overflow + overflowY + overflowX) && !['inline', 'contents'].includes(display);
2166
+ }
2167
+ function isTableElement(element) {
2168
+ return ['table', 'td', 'th'].includes(getNodeName(element));
2169
+ }
2170
+ function isContainingBlock(element) {
2171
+ // TODO: Try and use feature detection here instead
2172
+ const isFirefox = /firefox/i.test(getUAString());
2173
+ const css = getComputedStyle(element);
2174
+ const backdropFilter = css.backdropFilter || css.WebkitBackdropFilter; // This is non-exhaustive but covers the most common CSS properties that
2175
+ // create a containing block.
2176
+ // https://developer.mozilla.org/en-US/docs/Web/CSS/Containing_block#identifying_the_containing_block
2177
+
2178
+ 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
2179
+ value => {
2180
+ const contain = css.contain;
2181
+ return contain != null ? contain.includes(value) : false;
2182
+ });
2183
+ }
2184
+ function isLayoutViewport() {
2185
+ // Not Safari
2186
+ return !/^((?!chrome|android).)*safari/i.test(getUAString()); // Feature detection for this fails in various ways
2187
+ // • Always-visible scrollbar or not
2188
+ // • Width of <html>, etc.
2189
+ // const vV = win.visualViewport;
2190
+ // return vV ? Math.abs(win.innerWidth / vV.scale - vV.width) < 0.5 : true;
2191
+ }
2192
+ function isLastTraversableNode(node) {
2193
+ return ['html', 'body', '#document'].includes(getNodeName(node));
2194
+ }
2195
+
2196
+ const min = Math.min;
2197
+ const max = Math.max;
2198
+ const round = Math.round;
2199
+
2200
+ function getBoundingClientRect(element, includeScale, isFixedStrategy) {
2201
+ var _win$visualViewport$o, _win$visualViewport, _win$visualViewport$o2, _win$visualViewport2;
2202
+
2203
+ if (includeScale === void 0) {
2204
+ includeScale = false;
2205
+ }
2206
+
2207
+ if (isFixedStrategy === void 0) {
2208
+ isFixedStrategy = false;
2209
+ }
2210
+
2211
+ const clientRect = element.getBoundingClientRect();
2212
+ let scaleX = 1;
2213
+ let scaleY = 1;
2214
+
2215
+ if (includeScale && isHTMLElement(element)) {
2216
+ scaleX = element.offsetWidth > 0 ? round(clientRect.width) / element.offsetWidth || 1 : 1;
2217
+ scaleY = element.offsetHeight > 0 ? round(clientRect.height) / element.offsetHeight || 1 : 1;
2218
+ }
2219
+
2220
+ const win = isElement(element) ? getWindow(element) : window;
2221
+ const addVisualOffsets = !isLayoutViewport() && isFixedStrategy;
2222
+ 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;
2223
+ 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;
2224
+ const width = clientRect.width / scaleX;
2225
+ const height = clientRect.height / scaleY;
2226
+ return {
2227
+ width,
2228
+ height,
2229
+ top: y,
2230
+ right: x + width,
2231
+ bottom: y + height,
2232
+ left: x,
2233
+ x,
2234
+ y
2235
+ };
2236
+ }
2237
+
2238
+ function getDocumentElement(node) {
2239
+ return ((isNode(node) ? node.ownerDocument : node.document) || window.document).documentElement;
2240
+ }
2241
+
2242
+ function getNodeScroll(element) {
2243
+ if (isElement(element)) {
2244
+ return {
2245
+ scrollLeft: element.scrollLeft,
2246
+ scrollTop: element.scrollTop
2247
+ };
2248
+ }
2249
+
2250
+ return {
2251
+ scrollLeft: element.pageXOffset,
2252
+ scrollTop: element.pageYOffset
2253
+ };
2254
+ }
2255
+
2256
+ function getWindowScrollBarX(element) {
2257
+ // If <html> has a CSS width greater than the viewport, then this will be
2258
+ // incorrect for RTL.
2259
+ return getBoundingClientRect(getDocumentElement(element)).left + getNodeScroll(element).scrollLeft;
2260
+ }
2261
+
2262
+ function isScaled(element) {
2263
+ const rect = getBoundingClientRect(element);
2264
+ return round(rect.width) !== element.offsetWidth || round(rect.height) !== element.offsetHeight;
2265
+ }
2266
+
2267
+ function getRectRelativeToOffsetParent(element, offsetParent, strategy) {
2268
+ const isOffsetParentAnElement = isHTMLElement(offsetParent);
2269
+ const documentElement = getDocumentElement(offsetParent);
2270
+ const rect = getBoundingClientRect(element, // @ts-ignore - checked above (TS 4.1 compat)
2271
+ isOffsetParentAnElement && isScaled(offsetParent), strategy === 'fixed');
2272
+ let scroll = {
2273
+ scrollLeft: 0,
2274
+ scrollTop: 0
2275
+ };
2276
+ const offsets = {
2277
+ x: 0,
2278
+ y: 0
2279
+ };
2280
+
2281
+ if (isOffsetParentAnElement || !isOffsetParentAnElement && strategy !== 'fixed') {
2282
+ if (getNodeName(offsetParent) !== 'body' || isOverflowElement(documentElement)) {
2283
+ scroll = getNodeScroll(offsetParent);
2284
+ }
2285
+
2286
+ if (isHTMLElement(offsetParent)) {
2287
+ const offsetRect = getBoundingClientRect(offsetParent, true);
2288
+ offsets.x = offsetRect.x + offsetParent.clientLeft;
2289
+ offsets.y = offsetRect.y + offsetParent.clientTop;
2290
+ } else if (documentElement) {
2291
+ offsets.x = getWindowScrollBarX(documentElement);
2292
+ }
2293
+ }
2294
+
2295
+ return {
2296
+ x: rect.left + scroll.scrollLeft - offsets.x,
2297
+ y: rect.top + scroll.scrollTop - offsets.y,
2298
+ width: rect.width,
2299
+ height: rect.height
2300
+ };
2301
+ }
2302
+
2303
+ function getParentNode(node) {
2304
+ if (getNodeName(node) === 'html') {
2305
+ return node;
2306
+ }
2307
+
2308
+ const result = // Step into the shadow DOM of the parent of a slotted node
2309
+ node.assignedSlot || // DOM Element detected
2310
+ node.parentNode || ( // ShadowRoot detected
2311
+ isShadowRoot(node) ? node.host : null) || // Fallback
2312
+ getDocumentElement(node);
2313
+ return isShadowRoot(result) ? result.host : result;
2314
+ }
2315
+
2316
+ function getTrueOffsetParent(element) {
2317
+ if (!isHTMLElement(element) || getComputedStyle(element).position === 'fixed') {
2318
+ return null;
2319
+ }
2320
+
2321
+ return element.offsetParent;
2322
+ }
2323
+
2324
+ function getContainingBlock(element) {
2325
+ let currentNode = getParentNode(element);
2326
+
2327
+ while (isHTMLElement(currentNode) && !isLastTraversableNode(currentNode)) {
2328
+ if (isContainingBlock(currentNode)) {
2329
+ return currentNode;
2330
+ } else {
2331
+ currentNode = getParentNode(currentNode);
2332
+ }
2333
+ }
2334
+
2335
+ return null;
2336
+ } // Gets the closest ancestor positioned element. Handles some edge cases,
2337
+ // such as table ancestors and cross browser bugs.
2338
+
2339
+
2340
+ function getOffsetParent(element) {
2341
+ const window = getWindow(element);
2342
+ let offsetParent = getTrueOffsetParent(element);
2343
+
2344
+ while (offsetParent && isTableElement(offsetParent) && getComputedStyle(offsetParent).position === 'static') {
2345
+ offsetParent = getTrueOffsetParent(offsetParent);
2346
+ }
2347
+
2348
+ if (offsetParent && (getNodeName(offsetParent) === 'html' || getNodeName(offsetParent) === 'body' && getComputedStyle(offsetParent).position === 'static' && !isContainingBlock(offsetParent))) {
2349
+ return window;
2350
+ }
2351
+
2352
+ return offsetParent || getContainingBlock(element) || window;
2353
+ }
2354
+
2355
+ function getDimensions(element) {
2356
+ if (isHTMLElement(element)) {
2357
+ return {
2358
+ width: element.offsetWidth,
2359
+ height: element.offsetHeight
2360
+ };
2361
+ }
2362
+
2363
+ const rect = getBoundingClientRect(element);
2364
+ return {
2365
+ width: rect.width,
2366
+ height: rect.height
2367
+ };
2368
+ }
2369
+
2370
+ function convertOffsetParentRelativeRectToViewportRelativeRect(_ref) {
2371
+ let {
2372
+ rect,
2373
+ offsetParent,
2374
+ strategy
2375
+ } = _ref;
2376
+ const isOffsetParentAnElement = isHTMLElement(offsetParent);
2377
+ const documentElement = getDocumentElement(offsetParent);
2378
+
2379
+ if (offsetParent === documentElement) {
2380
+ return rect;
2381
+ }
2382
+
2383
+ let scroll = {
2384
+ scrollLeft: 0,
2385
+ scrollTop: 0
2386
+ };
2387
+ const offsets = {
2388
+ x: 0,
2389
+ y: 0
2390
+ };
2391
+
2392
+ if (isOffsetParentAnElement || !isOffsetParentAnElement && strategy !== 'fixed') {
2393
+ if (getNodeName(offsetParent) !== 'body' || isOverflowElement(documentElement)) {
2394
+ scroll = getNodeScroll(offsetParent);
2395
+ }
2396
+
2397
+ if (isHTMLElement(offsetParent)) {
2398
+ const offsetRect = getBoundingClientRect(offsetParent, true);
2399
+ offsets.x = offsetRect.x + offsetParent.clientLeft;
2400
+ offsets.y = offsetRect.y + offsetParent.clientTop;
2401
+ } // This doesn't appear to be need to be negated.
2402
+ // else if (documentElement) {
2403
+ // offsets.x = getWindowScrollBarX(documentElement);
2404
+ // }
2405
+
2406
+ }
2407
+
2408
+ return { ...rect,
2409
+ x: rect.x - scroll.scrollLeft + offsets.x,
2410
+ y: rect.y - scroll.scrollTop + offsets.y
2411
+ };
2412
+ }
2413
+
2414
+ function getViewportRect(element, strategy) {
2415
+ const win = getWindow(element);
2416
+ const html = getDocumentElement(element);
2417
+ const visualViewport = win.visualViewport;
2418
+ let width = html.clientWidth;
2419
+ let height = html.clientHeight;
2420
+ let x = 0;
2421
+ let y = 0;
2422
+
2423
+ if (visualViewport) {
2424
+ width = visualViewport.width;
2425
+ height = visualViewport.height;
2426
+ const layoutViewport = isLayoutViewport();
2427
+
2428
+ if (layoutViewport || !layoutViewport && strategy === 'fixed') {
2429
+ x = visualViewport.offsetLeft;
2430
+ y = visualViewport.offsetTop;
2431
+ }
2432
+ }
2433
+
2434
+ return {
2435
+ width,
2436
+ height,
2437
+ x,
2438
+ y
2439
+ };
2440
+ }
2441
+
2442
+ // of the `<html>` and `<body>` rect bounds if horizontally scrollable
2443
+
2444
+ function getDocumentRect(element) {
2445
+ var _element$ownerDocumen;
2446
+
2447
+ const html = getDocumentElement(element);
2448
+ const scroll = getNodeScroll(element);
2449
+ const body = (_element$ownerDocumen = element.ownerDocument) == null ? void 0 : _element$ownerDocumen.body;
2450
+ const width = max(html.scrollWidth, html.clientWidth, body ? body.scrollWidth : 0, body ? body.clientWidth : 0);
2451
+ const height = max(html.scrollHeight, html.clientHeight, body ? body.scrollHeight : 0, body ? body.clientHeight : 0);
2452
+ let x = -scroll.scrollLeft + getWindowScrollBarX(element);
2453
+ const y = -scroll.scrollTop;
2454
+
2455
+ if (getComputedStyle(body || html).direction === 'rtl') {
2456
+ x += max(html.clientWidth, body ? body.clientWidth : 0) - width;
2457
+ }
2458
+
2459
+ return {
2460
+ width,
2461
+ height,
2462
+ x,
2463
+ y
2464
+ };
2465
+ }
2466
+
2467
+ function getNearestOverflowAncestor(node) {
2468
+ const parentNode = getParentNode(node);
2469
+
2470
+ if (isLastTraversableNode(parentNode)) {
2471
+ // @ts-ignore assume body is always available
2472
+ return node.ownerDocument.body;
2473
+ }
2474
+
2475
+ if (isHTMLElement(parentNode) && isOverflowElement(parentNode)) {
2476
+ return parentNode;
2477
+ }
2478
+
2479
+ return getNearestOverflowAncestor(parentNode);
2480
+ }
2481
+
2482
+ function getOverflowAncestors(node, list) {
2483
+ var _node$ownerDocument;
2484
+
2485
+ if (list === void 0) {
2486
+ list = [];
2487
+ }
2488
+
2489
+ const scrollableAncestor = getNearestOverflowAncestor(node);
2490
+ const isBody = scrollableAncestor === ((_node$ownerDocument = node.ownerDocument) == null ? void 0 : _node$ownerDocument.body);
2491
+ const win = getWindow(scrollableAncestor);
2492
+ const target = isBody ? [win].concat(win.visualViewport || [], isOverflowElement(scrollableAncestor) ? scrollableAncestor : []) : scrollableAncestor;
2493
+ const updatedList = list.concat(target);
2494
+ return isBody ? updatedList : // @ts-ignore: isBody tells us target will be an HTMLElement here
2495
+ updatedList.concat(getOverflowAncestors(target));
2496
+ }
2497
+
2498
+ function getInnerBoundingClientRect(element, strategy) {
2499
+ const clientRect = getBoundingClientRect(element, false, strategy === 'fixed');
2500
+ const top = clientRect.top + element.clientTop;
2501
+ const left = clientRect.left + element.clientLeft;
2502
+ return {
2503
+ top,
2504
+ left,
2505
+ x: left,
2506
+ y: top,
2507
+ right: left + element.clientWidth,
2508
+ bottom: top + element.clientHeight,
2509
+ width: element.clientWidth,
2510
+ height: element.clientHeight
2511
+ };
2512
+ }
2513
+
2514
+ function getClientRectFromClippingAncestor(element, clippingAncestor, strategy) {
2515
+ if (clippingAncestor === 'viewport') {
2516
+ return rectToClientRect(getViewportRect(element, strategy));
2517
+ }
2518
+
2519
+ if (isElement(clippingAncestor)) {
2520
+ return getInnerBoundingClientRect(clippingAncestor, strategy);
2521
+ }
2522
+
2523
+ return rectToClientRect(getDocumentRect(getDocumentElement(element)));
2524
+ } // A "clipping ancestor" is an overflowable container with the characteristic of
2525
+ // clipping (or hiding) overflowing elements with a position different from
2526
+ // `initial`
2527
+
2528
+
2529
+ function getClippingElementAncestors(element) {
2530
+ let result = getOverflowAncestors(element).filter(el => isElement(el) && getNodeName(el) !== 'body');
2531
+ let currentNode = element;
2532
+ let currentContainingBlockComputedStyle = null; // https://developer.mozilla.org/en-US/docs/Web/CSS/Containing_block#identifying_the_containing_block
2533
+
2534
+ while (isElement(currentNode) && !isLastTraversableNode(currentNode)) {
2535
+ const computedStyle = getComputedStyle(currentNode);
2536
+
2537
+ if (computedStyle.position === 'static' && currentContainingBlockComputedStyle && ['absolute', 'fixed'].includes(currentContainingBlockComputedStyle.position) && !isContainingBlock(currentNode)) {
2538
+ // Drop non-containing blocks
2539
+ result = result.filter(ancestor => ancestor !== currentNode);
2540
+ } else {
2541
+ // Record last containing block for next iteration
2542
+ currentContainingBlockComputedStyle = computedStyle;
2543
+ }
2544
+
2545
+ currentNode = getParentNode(currentNode);
2546
+ }
2547
+
2548
+ return result;
2549
+ } // Gets the maximum area that the element is visible in due to any number of
2550
+ // clipping ancestors
2551
+
2552
+
2553
+ function getClippingRect(_ref) {
2554
+ let {
2555
+ element,
2556
+ boundary,
2557
+ rootBoundary,
2558
+ strategy
2559
+ } = _ref;
2560
+ const elementClippingAncestors = boundary === 'clippingAncestors' ? getClippingElementAncestors(element) : [].concat(boundary);
2561
+ const clippingAncestors = [...elementClippingAncestors, rootBoundary];
2562
+ const firstClippingAncestor = clippingAncestors[0];
2563
+ const clippingRect = clippingAncestors.reduce((accRect, clippingAncestor) => {
2564
+ const rect = getClientRectFromClippingAncestor(element, clippingAncestor, strategy);
2565
+ accRect.top = max(rect.top, accRect.top);
2566
+ accRect.right = min(rect.right, accRect.right);
2567
+ accRect.bottom = min(rect.bottom, accRect.bottom);
2568
+ accRect.left = max(rect.left, accRect.left);
2569
+ return accRect;
2570
+ }, getClientRectFromClippingAncestor(element, firstClippingAncestor, strategy));
2571
+ return {
2572
+ width: clippingRect.right - clippingRect.left,
2573
+ height: clippingRect.bottom - clippingRect.top,
2574
+ x: clippingRect.left,
2575
+ y: clippingRect.top
2576
+ };
2577
+ }
2578
+
2579
+ const platform = {
2580
+ getClippingRect,
2581
+ convertOffsetParentRelativeRectToViewportRelativeRect,
2582
+ isElement,
2583
+ getDimensions,
2584
+ getOffsetParent,
2585
+ getDocumentElement,
2586
+ getElementRects: _ref => {
2587
+ let {
2588
+ reference,
2589
+ floating,
2590
+ strategy
2591
+ } = _ref;
2592
+ return {
2593
+ reference: getRectRelativeToOffsetParent(reference, getOffsetParent(floating), strategy),
2594
+ floating: { ...getDimensions(floating),
2595
+ x: 0,
2596
+ y: 0
2597
+ }
2598
+ };
2599
+ },
2600
+ getClientRects: element => Array.from(element.getClientRects()),
2601
+ isRTL: element => getComputedStyle(element).direction === 'rtl'
2602
+ };
2603
+
2604
+ /**
2605
+ * Computes the `x` and `y` coordinates that will place the floating element
2606
+ * next to a reference element when it is given a certain CSS positioning
2607
+ * strategy.
2608
+ */
2609
+
2610
+ const computePosition = (reference, floating, options) => computePosition$1(reference, floating, {
2611
+ platform,
2612
+ ...options
2613
+ });
2614
+
2615
+ const computeToolTipPosition = async ({ elementReference = null, tooltipReference = null, tooltipArrowReference = null, place = 'top', offset: offsetValue = 10, }) => {
2616
+ if (elementReference === null) {
2617
+ // eslint-disable-next-line no-console
2618
+ console.error('The reference element for tooltip was not defined: ', elementReference);
2619
+ return { tooltipStyles: {}, tooltipArrowStyles: {} };
2620
+ }
2621
+ if (tooltipReference === null) {
2622
+ return { tooltipStyles: {}, tooltipArrowStyles: {} };
2623
+ }
2624
+ const middleware = [offset(Number(offsetValue)), flip(), shift({ padding: 5 })];
2625
+ if (tooltipArrowReference) {
2626
+ middleware.push(arrow({ element: tooltipArrowReference }));
2627
+ return computePosition(elementReference, tooltipReference, {
2628
+ placement: place,
2629
+ middleware,
2630
+ }).then(({ x, y, placement, middlewareData }) => {
2631
+ const styles = { left: `${x}px`, top: `${y}px` };
2632
+ // @ts-ignore
2633
+ const { x: arrowX, y: arrowY } = middlewareData.arrow;
2634
+ const staticSide = {
2635
+ top: 'bottom',
2636
+ right: 'left',
2637
+ bottom: 'top',
2638
+ left: 'right',
2639
+ }[placement.split('-')[0]];
2640
+ const arrowStyle = {
2641
+ left: arrowX != null ? `${arrowX}px` : '',
2642
+ top: arrowY != null ? `${arrowY}px` : '',
2643
+ right: '',
2644
+ bottom: '',
2645
+ // @ts-ignore
2646
+ [staticSide]: '-4px',
2647
+ };
2648
+ return { tooltipStyles: styles, tooltipArrowStyles: arrowStyle };
2649
+ });
2650
+ }
2651
+ return computePosition(elementReference, tooltipReference, {
2652
+ placement: 'bottom',
2653
+ middleware,
2654
+ }).then(({ x, y }) => {
2655
+ const styles = { left: `${x}px`, top: `${y}px` };
2656
+ return { tooltipStyles: styles, tooltipArrowStyles: {} };
2657
+ });
2658
+ };
2659
+
2660
+ var styles = {"tooltip":"styles-module_tooltip__mnnfp","arrow":"styles-module_arrow__K0L3T","show":"styles-module_show__2NboJ","dark":"styles-module_dark__xNqje","light":"styles-module_light__Z6W-X","success":"styles-module_success__A2AKt","warning":"styles-module_warning__SCK0X","error":"styles-module_error__JvumD","info":"styles-module_info__BWdHW"};
2661
+
2662
+ const Tooltip = ({
2663
+ // props
2664
+ id = require$$0.useId(), className, classNameArrow, variant = 'dark', anchorId, place = 'top', offset = 10, events = ['hover'], wrapper: WrapperElement = 'div', children = null, delayShow = 0, delayHide = 0,
2665
+ // props handled by controller
2666
+ isHtmlContent = false, content, isOpen, setIsOpen, }) => {
2667
+ const tooltipRef = require$$0.createRef();
2668
+ const tooltipArrowRef = require$$0.createRef();
2669
+ const tooltipShowDelayTimerRef = require$$0.useRef();
2670
+ const tooltipHideDelayTimerRef = require$$0.useRef();
2671
+ const [inlineStyles, setInlineStyles] = require$$0.useState({});
2672
+ const [inlineArrowStyles, setInlineArrowStyles] = require$$0.useState({});
2673
+ const [show, setShow] = require$$0.useState(false);
2674
+ const handleShow = (value) => {
2675
+ if (setIsOpen) {
2676
+ setIsOpen(value);
2677
+ }
2678
+ else if (isOpen === undefined) {
2679
+ setShow(value);
2680
+ }
2681
+ };
2682
+ const handleShowTooltipDelayed = () => {
2683
+ if (tooltipShowDelayTimerRef.current) {
2684
+ clearTimeout(tooltipShowDelayTimerRef.current);
2685
+ }
2686
+ tooltipShowDelayTimerRef.current = setTimeout(() => {
2687
+ handleShow(true);
2688
+ }, delayShow);
2689
+ };
2690
+ const handleHideTooltipDelayed = () => {
2691
+ if (tooltipHideDelayTimerRef.current) {
2692
+ clearTimeout(tooltipHideDelayTimerRef.current);
2693
+ }
2694
+ tooltipHideDelayTimerRef.current = setTimeout(() => {
2695
+ handleShow(false);
2696
+ }, delayHide);
2697
+ };
2698
+ const handleShowTooltip = () => {
2699
+ if (delayShow) {
2700
+ handleShowTooltipDelayed();
2701
+ }
2702
+ else {
2703
+ handleShow(true);
2704
+ }
2705
+ if (tooltipHideDelayTimerRef.current) {
2706
+ clearTimeout(tooltipHideDelayTimerRef.current);
2707
+ }
2708
+ };
2709
+ const handleHideTooltip = () => {
2710
+ if (delayHide) {
2711
+ handleHideTooltipDelayed();
2712
+ }
2713
+ else {
2714
+ handleShow(false);
2715
+ }
2716
+ if (show && tooltipShowDelayTimerRef.current) {
2717
+ clearTimeout(tooltipShowDelayTimerRef.current);
2718
+ }
2719
+ else if (!show && tooltipShowDelayTimerRef.current) {
2720
+ // workaround to prevent tooltip being show forever
2721
+ // when we remove the mouse before show tooltip with `delayShow`
2722
+ tooltipHideDelayTimerRef.current = setTimeout(() => {
2723
+ handleShow(false);
2724
+ }, delayShow * 2);
2725
+ }
2726
+ };
2727
+ const handleClickTooltipAnchor = () => {
2728
+ if (setIsOpen) {
2729
+ setIsOpen(!isOpen);
2730
+ }
2731
+ else if (isOpen === undefined) {
2732
+ setShow((currentValue) => !currentValue);
2733
+ }
2734
+ };
2735
+ // debounce handler to prevent call twice when
2736
+ // mouse enter and focus events being triggered toggether
2737
+ const debouncedHandleShowTooltip = debounce(handleShowTooltip, 50);
2738
+ const debouncedHandleHideTooltip = debounce(handleHideTooltip, 50);
2739
+ require$$0.useEffect(() => {
2740
+ const elementReference = document.querySelector(`#${anchorId}`);
2741
+ if (!elementReference) {
2742
+ // eslint-disable-next-line @typescript-eslint/no-empty-function
2743
+ return () => { };
2744
+ }
2745
+ const enabledEvents = [];
2746
+ if (events.find((event) => event === 'click')) {
2747
+ enabledEvents.push({ event: 'click', listener: handleClickTooltipAnchor });
2748
+ }
2749
+ if (events.find((event) => event === 'hover')) {
2750
+ enabledEvents.push({ event: 'mouseenter', listener: debouncedHandleShowTooltip }, { event: 'mouseleave', listener: debouncedHandleHideTooltip }, { event: 'focus', listener: debouncedHandleShowTooltip }, { event: 'blur', listener: debouncedHandleHideTooltip });
2751
+ }
2752
+ enabledEvents.forEach(({ event, listener }) => {
2753
+ elementReference === null || elementReference === void 0 ? void 0 : elementReference.addEventListener(event, listener);
2754
+ });
2755
+ return () => {
2756
+ enabledEvents.forEach(({ event, listener }) => {
2757
+ elementReference === null || elementReference === void 0 ? void 0 : elementReference.removeEventListener(event, listener);
2758
+ });
2759
+ };
2760
+ }, [anchorId, events, delayHide, delayShow]);
2761
+ require$$0.useEffect(() => {
2762
+ const elementReference = document.querySelector(`#${anchorId}`);
2763
+ computeToolTipPosition({
2764
+ place,
2765
+ offset,
2766
+ elementReference,
2767
+ tooltipReference: tooltipRef.current,
2768
+ tooltipArrowReference: tooltipArrowRef.current,
2769
+ }).then((computedStylesData) => {
2770
+ if (Object.keys(computedStylesData.tooltipStyles).length) {
2771
+ setInlineStyles(computedStylesData.tooltipStyles);
2772
+ }
2773
+ if (Object.keys(computedStylesData.tooltipArrowStyles).length) {
2774
+ setInlineArrowStyles(computedStylesData.tooltipArrowStyles);
2775
+ }
2776
+ });
2777
+ return () => {
2778
+ tooltipShowDelayTimerRef.current = undefined;
2779
+ tooltipHideDelayTimerRef.current = undefined;
2780
+ };
2781
+ }, [show, isOpen, anchorId]);
2782
+ return (jsxRuntime.exports.jsxs(WrapperElement, { id: id, role: "tooltip", className: classNames(styles['tooltip'], styles[variant], className, {
2783
+ [styles['show']]: isOpen || show,
2784
+ }), style: inlineStyles, ref: tooltipRef, children: [children || (isHtmlContent ? jsxRuntime.exports.jsx(TooltipContent, { content: content }) : content), jsxRuntime.exports.jsx("div", { className: classNames(styles['arrow'], classNameArrow), style: inlineArrowStyles, ref: tooltipArrowRef })] }));
2785
+ };
2786
+
2787
+ const dataAttributesKeys = [
2788
+ 'place',
2789
+ 'content',
2790
+ 'html',
2791
+ 'variant',
2792
+ 'offset',
2793
+ 'wrapper',
2794
+ 'events',
2795
+ 'delay-show',
2796
+ 'delay-hide', // delay to hide tooltip
2797
+ ];
2798
+
2799
+ const TooltipController = ({ id, anchorId, content, html, className, classNameArrow, variant = 'dark', place = 'top', offset = 10, wrapper = 'div', children = null, events = ['hover'], delayShow = 0, delayHide = 0, getContent, isOpen, setIsOpen, }) => {
2800
+ const [tooltipContent, setTooltipContent] = require$$0.useState(content || html);
2801
+ const [tooltipPlace, setTooltipPlace] = require$$0.useState(place);
2802
+ const [tooltipVariant, setTooltipVariant] = require$$0.useState(variant);
2803
+ const [tooltipOffset, setTooltipOffset] = require$$0.useState(offset);
2804
+ const [tooltipDelayShow, setTooltipDelayShow] = require$$0.useState(delayShow);
2805
+ const [tooltipDelayHide, setTooltipDelayHide] = require$$0.useState(delayHide);
2806
+ const [tooltipWrapper, setTooltipWrapper] = require$$0.useState(wrapper);
2807
+ const [tooltipEvents, setTooltipEvents] = require$$0.useState(events);
2808
+ const [isHtmlContent, setIsHtmlContent] = require$$0.useState(Boolean(html));
2809
+ const getDataAttributesFromAnchorElement = (elementReference) => {
2810
+ const dataAttributes = elementReference === null || elementReference === void 0 ? void 0 : elementReference.getAttributeNames().reduce((acc, name) => {
2811
+ if (name.includes('data-tooltip-')) {
2812
+ acc[name] = elementReference === null || elementReference === void 0 ? void 0 : elementReference.getAttribute(name);
2813
+ }
2814
+ return acc;
2815
+ }, {});
2816
+ return dataAttributes;
2817
+ };
2818
+ const applyAllDataAttributesFromAnchorElement = (dataAttributes) => {
2819
+ const keys = Object.keys(dataAttributes);
2820
+ let formatedKey = null;
2821
+ const handleDataAttributes = {
2822
+ place: (value) => {
2823
+ setTooltipPlace(value);
2824
+ },
2825
+ content: (value) => {
2826
+ setIsHtmlContent(true);
2827
+ if (getContent) {
2828
+ setTooltipContent(getContent(value));
2829
+ }
2830
+ else {
2831
+ setTooltipContent(value);
2832
+ }
2833
+ },
2834
+ html: (value) => {
2835
+ setIsHtmlContent(true);
2836
+ if (getContent) {
2837
+ setTooltipContent(getContent(value));
2838
+ }
2839
+ else {
2840
+ setTooltipContent(value);
2841
+ }
2842
+ },
2843
+ variant: (value) => {
2844
+ setTooltipVariant(value);
2845
+ },
2846
+ offset: (value) => {
2847
+ setTooltipOffset(value);
2848
+ },
2849
+ wrapper: (value) => {
2850
+ setTooltipWrapper(value);
2851
+ },
2852
+ events: (value) => {
2853
+ const parsedEvents = value.split(' ');
2854
+ setTooltipEvents(parsedEvents);
2855
+ },
2856
+ 'delay-show': (value) => {
2857
+ setTooltipDelayShow(Number(value));
2858
+ },
2859
+ 'delay-hide': (value) => {
2860
+ setTooltipDelayHide(Number(value));
2861
+ },
2862
+ };
2863
+ keys.forEach((key) => {
2864
+ formatedKey = key.replace('data-tooltip-', '');
2865
+ if (dataAttributesKeys.includes(formatedKey)) {
2866
+ // @ts-ignore
2867
+ handleDataAttributes[formatedKey](dataAttributes[key]);
2868
+ }
2869
+ });
2870
+ };
2871
+ const getElementSpecificAttributeKeyAndValueParsed = ({ element, attributeName, }) => {
2872
+ return { [attributeName]: element.getAttribute(attributeName) };
2873
+ };
2874
+ require$$0.useEffect(() => {
2875
+ if (!anchorId) {
2876
+ // eslint-disable-next-line @typescript-eslint/no-empty-function
2877
+ return () => { };
2878
+ }
2879
+ const elementReference = document.querySelector(`#${anchorId}`);
2880
+ if (!elementReference) {
2881
+ // eslint-disable-next-line @typescript-eslint/no-empty-function
2882
+ return () => { };
2883
+ }
2884
+ if (content && getContent) {
2885
+ setTooltipContent(getContent(content));
2886
+ }
2887
+ // do not check for subtree and childrens, we only want to know attribute changes
2888
+ // to stay watching `data-attributes` from anchor element
2889
+ const observerConfig = { attributes: true, childList: false, subtree: false };
2890
+ const observerCallback = (mutationList) => {
2891
+ mutationList.forEach((mutation) => {
2892
+ if (mutation.type === 'attributes') {
2893
+ const attributeKeyAndValue = getElementSpecificAttributeKeyAndValueParsed({
2894
+ element: elementReference,
2895
+ attributeName: mutation.attributeName,
2896
+ });
2897
+ applyAllDataAttributesFromAnchorElement(attributeKeyAndValue);
2898
+ }
2899
+ });
2900
+ };
2901
+ // Create an observer instance linked to the callback function
2902
+ const observer = new MutationObserver(observerCallback);
2903
+ // Start observing the target node for configured mutations
2904
+ observer.observe(elementReference, observerConfig);
2905
+ const dataAttributes = getDataAttributesFromAnchorElement(elementReference);
2906
+ applyAllDataAttributesFromAnchorElement(dataAttributes);
2907
+ return () => {
2908
+ // Remove the observer when the tooltip is destroyed
2909
+ observer.disconnect();
2910
+ };
2911
+ }, [anchorId]);
2912
+ const props = {
2913
+ id,
2914
+ anchorId,
2915
+ className,
2916
+ classNameArrow,
2917
+ content: tooltipContent,
2918
+ isHtmlContent,
2919
+ place: tooltipPlace,
2920
+ variant: tooltipVariant,
2921
+ offset: tooltipOffset,
2922
+ wrapper: tooltipWrapper,
2923
+ events: tooltipEvents,
2924
+ delayShow: tooltipDelayShow,
2925
+ delayHide: tooltipDelayHide,
2926
+ isOpen,
2927
+ setIsOpen,
2928
+ };
2929
+ return children ? jsxRuntime.exports.jsx(Tooltip, { ...props, children: children }) : jsxRuntime.exports.jsx(Tooltip, { ...props });
2930
+ };
2931
+
2932
+ exports.Tooltip = TooltipController;